diff --git a/.github/workflows/deploy-gh-page.yml b/.github/workflows/deploy-gh-page.yml index 38d9e70fa1..3ccd22d104 100644 --- a/.github/workflows/deploy-gh-page.yml +++ b/.github/workflows/deploy-gh-page.yml @@ -3,7 +3,7 @@ name: deploy-gh-page on: push: branches: - - "3.12" + - "3.13" jobs: cd: @@ -18,7 +18,7 @@ jobs: run: make all - name: Deploy to gh page - uses: JamesIves/github-pages-deploy-action@v4.6.3 + uses: JamesIves/github-pages-deploy-action@v4.6.4 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages diff --git a/.github/workflows/py312-sync-cpython.yml b/.github/workflows/py313-sync-cpython.yml similarity index 90% rename from .github/workflows/py312-sync-cpython.yml rename to .github/workflows/py313-sync-cpython.yml index f10378c019..9305dbc4b2 100644 --- a/.github/workflows/py312-sync-cpython.yml +++ b/.github/workflows/py313-sync-cpython.yml @@ -1,9 +1,9 @@ -name: python-3.12-sync-with-cpython +name: python-3.13-sync-with-cpython on: push: branches: - - "3.12" + - "3.13" schedule: - cron: "0 0 * * *" @@ -11,8 +11,8 @@ jobs: sync: runs-on: ubuntu-latest env: - VERSION: "3.12" - BRANCH: "cron/sync/3.12" + VERSION: "3.13" + BRANCH: "cron/sync/3.13" steps: - uses: actions/checkout@v4 with: @@ -50,15 +50,15 @@ jobs: base: ${{ env.VERSION }} branch: ${{ env.BRANCH }} delete-branch: false - title: 'Sync with CPython ${{ env.VERSION }}' + title: "Sync with CPython ${{ env.VERSION }}" body: | Sync with CPython ${{ env.VERSION }} draft: true labels: | sync-cpython automation - + - name: Check outputs run: | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" - echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" \ No newline at end of file + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" diff --git a/.gitignore b/.gitignore index 185f2c0f70..948c289ec6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,12 @@ *.mo __pycache__ .DS_Store + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ diff --git a/.scripts/poetry.lock b/.scripts/poetry.lock index 482702ad5f..5f06f9c25c 100644 --- a/.scripts/poetry.lock +++ b/.scripts/poetry.lock @@ -173,13 +173,13 @@ files = [ [[package]] name = "hstspreload" -version = "2024.9.1" +version = "2024.10.1" description = "Chromium HSTS Preload list as a Python package" optional = false python-versions = ">=3.6" files = [ - {file = "hstspreload-2024.9.1-py3-none-any.whl", hash = "sha256:9c1b2d0313899d3ff9dac03ab39d53fed95c32eef9862e7eabee8dc07dfd589c"}, - {file = "hstspreload-2024.9.1.tar.gz", hash = "sha256:2ab4518495a132c4ae430c474afffd12938852c6eec68ce1368c8f7858dc3076"}, + {file = "hstspreload-2024.10.1-py3-none-any.whl", hash = "sha256:3ab481036cbdff095cb411dafe33ee7924492319cf6ddaf4e776a159537541b3"}, + {file = "hstspreload-2024.10.1.tar.gz", hash = "sha256:2859a6b52253743ddddad468d8c9570ba650170ca49ac416336826915ee409b8"}, ] [[package]] @@ -483,13 +483,13 @@ yaml = ["ruamel.yaml (==0.17.21)"] [[package]] name = "urllib3" -version = "2.2.2" +version = "2.2.3" description = "HTTP library with thread-safe connection pooling, file post, and more." optional = false python-versions = ">=3.8" files = [ - {file = "urllib3-2.2.2-py3-none-any.whl", hash = "sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472"}, - {file = "urllib3-2.2.2.tar.gz", hash = "sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168"}, + {file = "urllib3-2.2.3-py3-none-any.whl", hash = "sha256:ca899ca043dcb1bafa3e262d73aa25c465bfb49e0bd9dd5d59f1d0acba2f8fac"}, + {file = "urllib3-2.2.3.tar.gz", hash = "sha256:e7d814a81dad81e6caf2ec9fdedb284ecc9c73076b62654547cc64ccdcae26e9"}, ] [package.extras] diff --git a/Makefile b/Makefile index b1793e0908..db5116d478 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ endef export PRINT_HELP_PYSCRIPT # End of python section CPYTHON_CLONE := ../cpython -VERSION := $(or $(VERSION), 3.12) +VERSION := $(or $(VERSION), 3.13) SPHINX_CONF := $(CPYTHON_CLONE)/Doc/conf.py LANGUAGE := zh_TW LC_MESSAGES := $(CPYTHON_CLONE)/Doc/locales/$(LANGUAGE)/LC_MESSAGES diff --git a/README.rst b/README.rst index 385d4ee165..c239b4a89a 100644 --- a/README.rst +++ b/README.rst @@ -6,7 +6,7 @@ Python 官方說明文件臺灣繁體中文翻譯計畫 :target: https://discord.gg/44XheGXhWH :alt: Join Chat on Discord -這是 Python 3.12 官方說明文件的臺灣繁體中文(zh_TW)翻譯。 +這是 Python 3.13 官方說明文件的臺灣繁體中文(zh_TW)翻譯。 翻譯之前,請務必詳讀並同意\ `授權與 License`_。參與方式請參考\ `參與翻譯`_。 @@ -132,13 +132,13 @@ the PSF for inclusion in the documentation. 接著在 terminal 裡按照以下步驟: -1. 基於最新版本的 ``upstream/3.12`` 開啟一個 branch,現在假設我們想要翻譯 library/math.po \ +1. 基於最新版本的 ``upstream/3.13`` 開啟一個 branch,現在假設我們想要翻譯 library/math.po \ 所以把這個 branch 叫做 ``library/math``: .. code-block:: bash git fetch upstream - git checkout -b library/math upstream/3.12 + git checkout -b library/math upstream/3.13 2. 接著就可以開始翻譯(翻譯時可參考\ `翻譯守則`_),你可以手動開啟 Poedit 應用程式再選 \ library/math.po 檔案打開 @@ -222,7 +222,7 @@ the PSF for inclusion in the documentation. - 從 upstream(我們的主要 GitHub repo)做 fetch 的動作 - 對 origin(你的 fork)做 push -- 永遠不對 ``3.12`` branch 進行修改,請保持讓這個 branch 唯讀,可以避免掉很多問題。 +- 永遠不對 ``3.13`` branch 進行修改,請保持讓這個 branch 唯讀,可以避免掉很多問題。 要翻譯哪些東西 -------------- diff --git a/about.po b/about.po index 4b90148fd5..34c5041570 100644 --- a/about.po +++ b/about.po @@ -12,7 +12,7 @@ # hsiao yi , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-08-05 00:19+0000\n" "PO-Revision-Date: 2022-05-12 00:11+0800\n" diff --git a/bugs.po b/bugs.po index b040a99bb9..2837ebfc0a 100644 --- a/bugs.po +++ b/bugs.po @@ -11,7 +11,7 @@ # Steven Hsu , 2021-2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-04-18 19:45+0000\n" "PO-Revision-Date: 2022-08-31 12:34+0800\n" diff --git a/c-api/abstract.po b/c-api/abstract.po index e2ef911a82..87e9a0091e 100644 --- a/c-api/abstract.po +++ b/c-api/abstract.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-12-09 21:20+0800\n" diff --git a/c-api/allocation.po b/c-api/allocation.po index f167bb99fa..c4605012ef 100644 --- a/c-api/allocation.po +++ b/c-api/allocation.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-08-09 00:03+0000\n" "PO-Revision-Date: 2022-10-16 15:35+0800\n" diff --git a/c-api/apiabiversion.po b/c-api/apiabiversion.po index 62558d43f5..8b589303e8 100644 --- a/c-api/apiabiversion.po +++ b/c-api/apiabiversion.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 00:03+0000\n" "PO-Revision-Date: 2022-01-24 22:34+0800\n" diff --git a/c-api/arg.po b/c-api/arg.po index a8487118c9..f62175c411 100644 --- a/c-api/arg.po +++ b/c-api/arg.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-10-16 03:21+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,25 +55,33 @@ msgid "" "brackets is the type of the C variable(s) whose address should be passed." msgstr "" -#: ../../c-api/arg.rst:31 +#: ../../c-api/arg.rst:33 msgid "Strings and buffers" msgstr "" -#: ../../c-api/arg.rst:33 +#: ../../c-api/arg.rst:37 +msgid "" +"On Python 3.12 and older, the macro :c:macro:`!PY_SSIZE_T_CLEAN` must be " +"defined before including :file:`Python.h` to use all ``#`` variants of " +"formats (``s#``, ``y#``, etc.) explained below. This is not necessary on " +"Python 3.13 and later." +msgstr "" + +#: ../../c-api/arg.rst:42 msgid "" "These formats allow accessing an object as a contiguous chunk of memory. You " "don't have to provide raw storage for the returned unicode or bytes area." msgstr "" -#: ../../c-api/arg.rst:37 +#: ../../c-api/arg.rst:46 msgid "Unless otherwise stated, buffers are not NUL-terminated." msgstr "" -#: ../../c-api/arg.rst:39 +#: ../../c-api/arg.rst:48 msgid "There are three ways strings and buffers can be converted to C:" msgstr "" -#: ../../c-api/arg.rst:41 +#: ../../c-api/arg.rst:50 msgid "" "Formats such as ``y*`` and ``s*`` fill a :c:type:`Py_buffer` structure. This " "locks the underlying buffer so that the caller can subsequently use the " @@ -83,14 +91,14 @@ msgid "" "data (or in any early abort case)." msgstr "" -#: ../../c-api/arg.rst:48 +#: ../../c-api/arg.rst:57 msgid "" "The ``es``, ``es#``, ``et`` and ``et#`` formats allocate the result buffer. " "**You have to call** :c:func:`PyMem_Free` after you have finished processing " "the data (or in any early abort case)." msgstr "" -#: ../../c-api/arg.rst:54 +#: ../../c-api/arg.rst:63 msgid "" "Other formats take a :class:`str` or a read-only :term:`bytes-like object`, " "such as :class:`bytes`, and provide a ``const char *`` pointer to its " @@ -99,7 +107,7 @@ msgid "" "won't have to release any memory yourself." msgstr "" -#: ../../c-api/arg.rst:61 +#: ../../c-api/arg.rst:70 msgid "" "To ensure that the underlying buffer may be safely borrowed, the object's :c:" "member:`PyBufferProcs.bf_releasebuffer` field must be ``NULL``. This " @@ -107,22 +115,13 @@ msgid "" "read-only objects such as :class:`memoryview` of :class:`bytes`." msgstr "" -#: ../../c-api/arg.rst:67 +#: ../../c-api/arg.rst:76 msgid "" "Besides this ``bf_releasebuffer`` requirement, there is no check to verify " "whether the input object is immutable (e.g. whether it would honor a request " "for a writable buffer, or whether another thread can mutate the data)." msgstr "" -#: ../../c-api/arg.rst:73 -msgid "" -"For all ``#`` variants of formats (``s#``, ``y#``, etc.), the macro :c:macro:" -"`PY_SSIZE_T_CLEAN` must be defined before including :file:`Python.h`. On " -"Python 3.9 and older, the type of the length argument is :c:type:" -"`Py_ssize_t` if the :c:macro:`PY_SSIZE_T_CLEAN` macro is defined, or int " -"otherwise." -msgstr "" - #: ../../c-api/arg.rst:80 msgid "``s`` (:class:`str`) [const char \\*]" msgstr "``s`` (:class:`str`) [const char \\*]" @@ -178,7 +177,7 @@ msgid "" "encoding." msgstr "" -#: ../../c-api/arg.rst:113 ../../c-api/arg.rst:546 +#: ../../c-api/arg.rst:113 ../../c-api/arg.rst:581 msgid "``z`` (:class:`str` or ``None``) [const char \\*]" msgstr "``z``\\ (:class:`str` 或 ``None``)[const char \\*]" @@ -427,7 +426,7 @@ msgid "" "c:expr:`unsigned char`." msgstr "" -#: ../../c-api/arg.rst:236 ../../c-api/arg.rst:580 +#: ../../c-api/arg.rst:236 ../../c-api/arg.rst:615 msgid "``B`` (:class:`int`) [unsigned char]" msgstr "``B`` (:class:`int`) [unsigned char]" @@ -437,7 +436,7 @@ msgid "" "a C :c:expr:`unsigned char`." msgstr "" -#: ../../c-api/arg.rst:240 ../../c-api/arg.rst:574 +#: ../../c-api/arg.rst:240 ../../c-api/arg.rst:609 msgid "``h`` (:class:`int`) [short int]" msgstr "``h`` (:class:`int`) [short int]" @@ -445,7 +444,7 @@ msgstr "``h`` (:class:`int`) [short int]" msgid "Convert a Python integer to a C :c:expr:`short int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`short int`。" -#: ../../c-api/arg.rst:243 ../../c-api/arg.rst:583 +#: ../../c-api/arg.rst:243 ../../c-api/arg.rst:618 msgid "``H`` (:class:`int`) [unsigned short int]" msgstr "``H`` (:class:`int`) [unsigned short int]" @@ -457,7 +456,7 @@ msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned short int`,轉換過程無溢位檢" "查。" -#: ../../c-api/arg.rst:247 ../../c-api/arg.rst:568 +#: ../../c-api/arg.rst:247 ../../c-api/arg.rst:603 msgid "``i`` (:class:`int`) [int]" msgstr "``i`` (:class:`int`) [int]" @@ -465,7 +464,7 @@ msgstr "``i`` (:class:`int`) [int]" msgid "Convert a Python integer to a plain C :c:expr:`int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`int`。" -#: ../../c-api/arg.rst:250 ../../c-api/arg.rst:586 +#: ../../c-api/arg.rst:250 ../../c-api/arg.rst:621 msgid "``I`` (:class:`int`) [unsigned int]" msgstr "``I`` (:class:`int`) [unsigned int]" @@ -476,7 +475,7 @@ msgid "" msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned int`,轉換過程無溢位檢查。" -#: ../../c-api/arg.rst:254 ../../c-api/arg.rst:577 +#: ../../c-api/arg.rst:254 ../../c-api/arg.rst:612 msgid "``l`` (:class:`int`) [long int]" msgstr "``l`` (:class:`int`) [long int]" @@ -484,7 +483,7 @@ msgstr "``l`` (:class:`int`) [long int]" msgid "Convert a Python integer to a C :c:expr:`long int`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`long int`。" -#: ../../c-api/arg.rst:257 ../../c-api/arg.rst:589 +#: ../../c-api/arg.rst:257 ../../c-api/arg.rst:624 msgid "``k`` (:class:`int`) [unsigned long]" msgstr "``k`` (:class:`int`) [unsigned long]" @@ -495,7 +494,7 @@ msgid "" msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned long`,轉換過程無溢位檢查。" -#: ../../c-api/arg.rst:261 ../../c-api/arg.rst:592 +#: ../../c-api/arg.rst:261 ../../c-api/arg.rst:627 msgid "``L`` (:class:`int`) [long long]" msgstr "``L`` (:class:`int`) [long long]" @@ -503,7 +502,7 @@ msgstr "``L`` (:class:`int`) [long long]" msgid "Convert a Python integer to a C :c:expr:`long long`." msgstr "將一個 Python 整數轉換成 C 的 :c:expr:`long long`。" -#: ../../c-api/arg.rst:264 ../../c-api/arg.rst:595 +#: ../../c-api/arg.rst:264 ../../c-api/arg.rst:630 msgid "``K`` (:class:`int`) [unsigned long long]" msgstr "``K`` (:class:`int`) [unsigned long long]" @@ -515,7 +514,7 @@ msgstr "" "將一個 Python 整數轉換成 C 的 :c:expr:`unsigned long long`,轉換過程無溢位檢" "查。" -#: ../../c-api/arg.rst:268 ../../c-api/arg.rst:598 +#: ../../c-api/arg.rst:268 ../../c-api/arg.rst:633 msgid "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" msgstr "``n`` (:class:`int`) [:c:type:`Py_ssize_t`]" @@ -537,7 +536,7 @@ msgstr "" msgid "Allow :class:`bytearray` objects." msgstr "允許 :class:`bytearray` 物件。" -#: ../../c-api/arg.rst:278 ../../c-api/arg.rst:605 +#: ../../c-api/arg.rst:278 ../../c-api/arg.rst:640 msgid "``C`` (:class:`str` of length 1) [int]" msgstr "``C``\\ (長度為 1 的 :class:`str`)[int]" @@ -547,7 +546,7 @@ msgid "" "1, to a C :c:expr:`int`." msgstr "" -#: ../../c-api/arg.rst:282 ../../c-api/arg.rst:612 +#: ../../c-api/arg.rst:282 ../../c-api/arg.rst:647 msgid "``f`` (:class:`float`) [float]" msgstr "``f`` (:class:`float`) [float]" @@ -555,7 +554,7 @@ msgstr "``f`` (:class:`float`) [float]" msgid "Convert a Python floating-point number to a C :c:expr:`float`." msgstr "將一個 Python 浮點數轉換成 C 的 :c:type::c:expr:`float`。" -#: ../../c-api/arg.rst:285 ../../c-api/arg.rst:609 +#: ../../c-api/arg.rst:285 ../../c-api/arg.rst:644 msgid "``d`` (:class:`float`) [double]" msgstr "``d`` (:class:`float`) [double]" @@ -575,7 +574,7 @@ msgstr "將一個 Python 複數轉換成 C 的 :c:type:`Py_complex` 結構。" msgid "Other objects" msgstr "其他物件" -#: ../../c-api/arg.rst:294 ../../c-api/arg.rst:618 +#: ../../c-api/arg.rst:294 ../../c-api/arg.rst:653 msgid "``O`` (object) [PyObject \\*]" msgstr "``O``\\ (物件)[PyObject \\*]" @@ -600,7 +599,7 @@ msgid "" "required type, :exc:`TypeError` is raised." msgstr "" -#: ../../c-api/arg.rst:310 ../../c-api/arg.rst:636 +#: ../../c-api/arg.rst:310 ../../c-api/arg.rst:671 msgid "``O&`` (object) [*converter*, *anything*]" msgstr "``O&``\\ (物件)[*converter*, *anything*]" @@ -652,7 +651,7 @@ msgid "" "how Python tests values for truth." msgstr "" -#: ../../c-api/arg.rst:342 ../../c-api/arg.rst:642 +#: ../../c-api/arg.rst:342 ../../c-api/arg.rst:677 msgid "``(items)`` (:class:`tuple`) [*matching-items*]" msgstr "``(items)`` (:class:`tuple`) [*matching-items*]" @@ -772,43 +771,72 @@ msgstr "" #: ../../c-api/arg.rst:418 msgid "" "Parse the parameters of a function that takes both positional and keyword " -"parameters into local variables. The *keywords* argument is a ``NULL``-" -"terminated array of keyword parameter names. Empty names denote :ref:" -"`positional-only parameters `. Returns true on " -"success; on failure, it returns false and raises the appropriate exception." +"parameters into local variables. The *keywords* argument is a ``NULL``-" +"terminated array of keyword parameter names specified as null-terminated " +"ASCII or UTF-8 encoded C strings. Empty names denote :ref:`positional-only " +"parameters `. Returns true on success; on " +"failure, it returns false and raises the appropriate exception." +msgstr "" + +#: ../../c-api/arg.rst:429 +msgid "" +"The *keywords* parameter declaration is :c:expr:`char * const *` in C and :c:" +"expr:`const char * const *` in C++. This can be overridden with the :c:macro:" +"`PY_CXX_CONST` macro." msgstr "" -#: ../../c-api/arg.rst:425 +#: ../../c-api/arg.rst:433 msgid "" "Added support for :ref:`positional-only parameters `." msgstr "" -#: ../../c-api/arg.rst:432 +#: ../../c-api/arg.rst:437 +msgid "" +"The *keywords* parameter has now type :c:expr:`char * const *` in C and :c:" +"expr:`const char * const *` in C++, instead of :c:expr:`char **`. Added " +"support for non-ASCII keyword parameter names." +msgstr "" + +#: ../../c-api/arg.rst:446 msgid "" "Identical to :c:func:`PyArg_ParseTupleAndKeywords`, except that it accepts a " "va_list rather than a variable number of arguments." msgstr "" -#: ../../c-api/arg.rst:438 +#: ../../c-api/arg.rst:452 msgid "" "Ensure that the keys in the keywords argument dictionary are strings. This " "is only needed if :c:func:`PyArg_ParseTupleAndKeywords` is not used, since " "the latter already does this check." msgstr "" -#: ../../c-api/arg.rst:448 +#: ../../c-api/arg.rst:461 +msgid "" +"Parse the parameter of a function that takes a single positional parameter " +"into a local variable. Returns true on success; on failure, it returns " +"false and raises the appropriate exception." +msgstr "" + +#: ../../c-api/arg.rst:465 +msgid "Example::" +msgstr "" + +#: ../../c-api/arg.rst:467 msgid "" -"Function used to deconstruct the argument lists of \"old-style\" functions " -"--- these are functions which use the :const:`METH_OLDARGS` parameter " -"parsing method, which has been removed in Python 3. This is not recommended " -"for use in parameter parsing in new code, and most code in the standard " -"interpreter has been modified to no longer use this for that purpose. It " -"does remain a convenient way to decompose other tuples, however, and may " -"continue to be used for that purpose." +"// Function using METH_O calling convention\n" +"static PyObject*\n" +"my_function(PyObject *module, PyObject *arg)\n" +"{\n" +" int value;\n" +" if (!PyArg_Parse(arg, \"i:my_function\", &value)) {\n" +" return NULL;\n" +" }\n" +" // ... use value ...\n" +"}" msgstr "" -#: ../../c-api/arg.rst:459 +#: ../../c-api/arg.rst:481 msgid "" "A simpler form of parameter retrieval which does not use a format string to " "specify the types of the arguments. Functions which use this method to " @@ -826,13 +854,13 @@ msgid "" "if there was a failure." msgstr "" -#: ../../c-api/arg.rst:474 +#: ../../c-api/arg.rst:496 msgid "" "This is an example of the use of this function, taken from the sources for " "the :mod:`!_weakref` helper module for weak references::" msgstr "" -#: ../../c-api/arg.rst:477 +#: ../../c-api/arg.rst:499 msgid "" "static PyObject *\n" "weakref_ref(PyObject *self, PyObject *args)\n" @@ -860,21 +888,30 @@ msgstr "" " return result;\n" "}" -#: ../../c-api/arg.rst:490 +#: ../../c-api/arg.rst:512 msgid "" "The call to :c:func:`PyArg_UnpackTuple` in this example is entirely " "equivalent to this call to :c:func:`PyArg_ParseTuple`::" msgstr "" -#: ../../c-api/arg.rst:493 +#: ../../c-api/arg.rst:515 msgid "PyArg_ParseTuple(args, \"O|O:ref\", &object, &callback)" msgstr "PyArg_ParseTuple(args, \"O|O:ref\", &object, &callback)" -#: ../../c-api/arg.rst:498 +#: ../../c-api/arg.rst:519 +msgid "" +"The value to be inserted, if any, before :c:expr:`char * const *` in the " +"*keywords* parameter declaration of :c:func:`PyArg_ParseTupleAndKeywords` " +"and :c:func:`PyArg_VaParseTupleAndKeywords`. Default empty for C and " +"``const`` for C++ (:c:expr:`const char * const *`). To override, define it " +"to the desired value before including :file:`Python.h`." +msgstr "" + +#: ../../c-api/arg.rst:533 msgid "Building values" msgstr "" -#: ../../c-api/arg.rst:502 +#: ../../c-api/arg.rst:537 msgid "" "Create a new value based on a format string similar to those accepted by the " "``PyArg_Parse*`` family of functions and a sequence of values. Returns the " @@ -882,7 +919,7 @@ msgid "" "``NULL`` is returned." msgstr "" -#: ../../c-api/arg.rst:507 +#: ../../c-api/arg.rst:542 msgid "" ":c:func:`Py_BuildValue` does not always build a tuple. It builds a tuple " "only if its format string contains two or more format units. If the format " @@ -891,7 +928,7 @@ msgid "" "it to return a tuple of size 0 or one, parenthesize the format string." msgstr "" -#: ../../c-api/arg.rst:513 +#: ../../c-api/arg.rst:548 msgid "" "When memory buffers are passed as parameters to supply data to build " "objects, as for the ``s`` and ``s#`` formats, the required data is copied. " @@ -902,7 +939,7 @@ msgid "" "`Py_BuildValue` returns." msgstr "" -#: ../../c-api/arg.rst:521 +#: ../../c-api/arg.rst:556 msgid "" "In the following description, the quoted form is the format unit; the entry " "in (round) parentheses is the Python object type that the format unit will " @@ -910,155 +947,155 @@ msgid "" "be passed." msgstr "" -#: ../../c-api/arg.rst:525 +#: ../../c-api/arg.rst:560 msgid "" "The characters space, tab, colon and comma are ignored in format strings " "(but not within format units such as ``s#``). This can be used to make long " "format strings a tad more readable." msgstr "" -#: ../../c-api/arg.rst:529 +#: ../../c-api/arg.rst:564 msgid "``s`` (:class:`str` or ``None``) [const char \\*]" msgstr "``s``\\ (:class:`str` 或 ``None``)[const char \\*]" -#: ../../c-api/arg.rst:530 +#: ../../c-api/arg.rst:565 msgid "" "Convert a null-terminated C string to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, ``None`` is used." msgstr "" -#: ../../c-api/arg.rst:533 +#: ../../c-api/arg.rst:568 msgid "" "``s#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" "``s#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:534 +#: ../../c-api/arg.rst:569 msgid "" "Convert a C string and its length to a Python :class:`str` object using " "``'utf-8'`` encoding. If the C string pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:538 +#: ../../c-api/arg.rst:573 msgid "``y`` (:class:`bytes`) [const char \\*]" msgstr "``y`` (:class:`bytes`) [const char \\*]" -#: ../../c-api/arg.rst:539 +#: ../../c-api/arg.rst:574 msgid "" "This converts a C string to a Python :class:`bytes` object. If the C string " "pointer is ``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:542 +#: ../../c-api/arg.rst:577 msgid "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "``y#`` (:class:`bytes`) [const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:543 +#: ../../c-api/arg.rst:578 msgid "" "This converts a C string and its lengths to a Python object. If the C " "string pointer is ``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:547 ../../c-api/arg.rst:563 +#: ../../c-api/arg.rst:582 ../../c-api/arg.rst:598 msgid "Same as ``s``." msgstr "和 ``s`` 相同。" -#: ../../c-api/arg.rst:549 +#: ../../c-api/arg.rst:584 msgid "" "``z#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" "``z#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:550 ../../c-api/arg.rst:566 +#: ../../c-api/arg.rst:585 ../../c-api/arg.rst:601 msgid "Same as ``s#``." msgstr "和 ``s#`` 相同。" -#: ../../c-api/arg.rst:552 +#: ../../c-api/arg.rst:587 msgid "``u`` (:class:`str`) [const wchar_t \\*]" msgstr "``u`` (:class:`str`) [const wchar_t \\*]" -#: ../../c-api/arg.rst:553 +#: ../../c-api/arg.rst:588 msgid "" "Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or " "UCS-4) data to a Python Unicode object. If the Unicode buffer pointer is " "``NULL``, ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:557 +#: ../../c-api/arg.rst:592 msgid "``u#`` (:class:`str`) [const wchar_t \\*, :c:type:`Py_ssize_t`]" msgstr "``u#`` (:class:`str`) [const wchar_t \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:558 +#: ../../c-api/arg.rst:593 msgid "" "Convert a Unicode (UTF-16 or UCS-4) data buffer and its length to a Python " "Unicode object. If the Unicode buffer pointer is ``NULL``, the length is " "ignored and ``None`` is returned." msgstr "" -#: ../../c-api/arg.rst:562 +#: ../../c-api/arg.rst:597 msgid "``U`` (:class:`str` or ``None``) [const char \\*]" msgstr "``U``\\ (:class:`str` 或 ``None``)[const char \\*]" -#: ../../c-api/arg.rst:565 +#: ../../c-api/arg.rst:600 msgid "" "``U#`` (:class:`str` or ``None``) [const char \\*, :c:type:`Py_ssize_t`]" msgstr "" "``U#``\\ (:class:`str` 或 ``None``)[const char \\*, :c:type:`Py_ssize_t`]" -#: ../../c-api/arg.rst:569 +#: ../../c-api/arg.rst:604 msgid "Convert a plain C :c:expr:`int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:571 +#: ../../c-api/arg.rst:606 msgid "``b`` (:class:`int`) [char]" msgstr "``b`` (:class:`int`) [char]" -#: ../../c-api/arg.rst:572 +#: ../../c-api/arg.rst:607 msgid "Convert a plain C :c:expr:`char` to a Python integer object." msgstr "將一個 C 的 :c:expr:`char` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:575 +#: ../../c-api/arg.rst:610 msgid "Convert a plain C :c:expr:`short int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`short int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:578 +#: ../../c-api/arg.rst:613 msgid "Convert a C :c:expr:`long int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`long int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:581 +#: ../../c-api/arg.rst:616 msgid "Convert a C :c:expr:`unsigned char` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned char` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:584 +#: ../../c-api/arg.rst:619 msgid "Convert a C :c:expr:`unsigned short int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned short int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:587 +#: ../../c-api/arg.rst:622 msgid "Convert a C :c:expr:`unsigned int` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned int` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:590 +#: ../../c-api/arg.rst:625 msgid "Convert a C :c:expr:`unsigned long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:593 +#: ../../c-api/arg.rst:628 msgid "Convert a C :c:expr:`long long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`long long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:596 +#: ../../c-api/arg.rst:631 msgid "Convert a C :c:expr:`unsigned long long` to a Python integer object." msgstr "將一個 C 的 :c:expr:`unsigned long long` 轉換成 Python 整數物件。" -#: ../../c-api/arg.rst:599 +#: ../../c-api/arg.rst:634 msgid "Convert a C :c:type:`Py_ssize_t` to a Python integer." msgstr "將一個 C 的 :c:type:`Py_ssize_t` 轉換成 Python 整數。" -#: ../../c-api/arg.rst:601 +#: ../../c-api/arg.rst:636 msgid "``c`` (:class:`bytes` of length 1) [char]" msgstr "``c``\\ (長度為 1 的 :class:`bytes`)[char]" -#: ../../c-api/arg.rst:602 +#: ../../c-api/arg.rst:637 msgid "" "Convert a C :c:expr:`int` representing a byte to a Python :class:`bytes` " "object of length 1." @@ -1066,7 +1103,7 @@ msgstr "" "將一個 C 中代表一個位元組的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" "`bytes`。" -#: ../../c-api/arg.rst:606 +#: ../../c-api/arg.rst:641 msgid "" "Convert a C :c:expr:`int` representing a character to Python :class:`str` " "object of length 1." @@ -1074,23 +1111,23 @@ msgstr "" "將一個 C 中代表一個字元的 :c:expr:`int` 轉換成 Python 中長度為一的 :class:" "`str`。" -#: ../../c-api/arg.rst:610 +#: ../../c-api/arg.rst:645 msgid "Convert a C :c:expr:`double` to a Python floating-point number." msgstr "將一個 C 的 :c:expr:`double` 轉換成 Python 浮點數。" -#: ../../c-api/arg.rst:613 +#: ../../c-api/arg.rst:648 msgid "Convert a C :c:expr:`float` to a Python floating-point number." msgstr "將一個 C 的 :c:expr:`float` 轉換成 Python 浮點數。" -#: ../../c-api/arg.rst:615 +#: ../../c-api/arg.rst:650 msgid "``D`` (:class:`complex`) [Py_complex \\*]" msgstr "``D`` (:class:`complex`) [Py_complex \\*]" -#: ../../c-api/arg.rst:616 +#: ../../c-api/arg.rst:651 msgid "Convert a C :c:type:`Py_complex` structure to a Python complex number." msgstr "將一個 C 的 :c:type:`Py_complex` 結構轉換成 Python 複數。" -#: ../../c-api/arg.rst:619 +#: ../../c-api/arg.rst:654 msgid "" "Pass a Python object untouched but create a new :term:`strong reference` to " "it (i.e. its reference count is incremented by one). If the object passed in " @@ -1100,26 +1137,26 @@ msgid "" "no exception has been raised yet, :exc:`SystemError` is set." msgstr "" -#: ../../c-api/arg.rst:628 +#: ../../c-api/arg.rst:663 msgid "``S`` (object) [PyObject \\*]" msgstr "``S``\\ (物件)[PyObject \\*]" -#: ../../c-api/arg.rst:629 +#: ../../c-api/arg.rst:664 msgid "Same as ``O``." msgstr "和 ``O`` 相同。" -#: ../../c-api/arg.rst:631 +#: ../../c-api/arg.rst:666 msgid "``N`` (object) [PyObject \\*]" msgstr "``N``\\ (物件)[PyObject \\*]" -#: ../../c-api/arg.rst:632 +#: ../../c-api/arg.rst:667 msgid "" "Same as ``O``, except it doesn't create a new :term:`strong reference`. " "Useful when the object is created by a call to an object constructor in the " "argument list." msgstr "" -#: ../../c-api/arg.rst:637 +#: ../../c-api/arg.rst:672 msgid "" "Convert *anything* to a Python object through a *converter* function. The " "function is called with *anything* (which should be compatible with :c:expr:" @@ -1127,40 +1164,40 @@ msgid "" "``NULL`` if an error occurred." msgstr "" -#: ../../c-api/arg.rst:643 +#: ../../c-api/arg.rst:678 msgid "" "Convert a sequence of C values to a Python tuple with the same number of " "items." msgstr "" -#: ../../c-api/arg.rst:645 +#: ../../c-api/arg.rst:680 msgid "``[items]`` (:class:`list`) [*matching-items*]" msgstr "``[items]`` (:class:`list`) [*matching-items*]" -#: ../../c-api/arg.rst:646 +#: ../../c-api/arg.rst:681 msgid "" "Convert a sequence of C values to a Python list with the same number of " "items." msgstr "" -#: ../../c-api/arg.rst:648 +#: ../../c-api/arg.rst:683 msgid "``{items}`` (:class:`dict`) [*matching-items*]" msgstr "``{items}`` (:class:`dict`) [*matching-items*]" -#: ../../c-api/arg.rst:649 +#: ../../c-api/arg.rst:684 msgid "" "Convert a sequence of C values to a Python dictionary. Each pair of " "consecutive C values adds one item to the dictionary, serving as key and " "value, respectively." msgstr "" -#: ../../c-api/arg.rst:653 +#: ../../c-api/arg.rst:688 msgid "" "If there is an error in the format string, the :exc:`SystemError` exception " "is set and ``NULL`` returned." msgstr "" -#: ../../c-api/arg.rst:658 +#: ../../c-api/arg.rst:693 msgid "" "Identical to :c:func:`Py_BuildValue`, except that it accepts a va_list " "rather than a variable number of arguments." diff --git a/c-api/bool.po b/c-api/bool.po index d90772c4a7..9a057a6678 100644 --- a/c-api/bool.po +++ b/c-api/bool.po @@ -8,9 +8,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-29 10:36+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-12-09 20:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -52,27 +52,26 @@ msgstr "" #: ../../c-api/bool.rst:28 msgid "" -"The Python ``False`` object. This object has no methods and is `immortal " -"`_." +"The Python ``False`` object. This object has no methods and is :term:" +"`immortal`." msgstr "" -"Python 的 ``False`` 物件。此物件沒有任何方法且為\\ `不滅的 (immortal) " -"`_。" +"Python 的 ``False`` 物件。此物件沒有任何方法且為\\ :term:`不滅的 (immortal) " +"`。" #: ../../c-api/bool.rst:31 -msgid ":c:data:`Py_False` is immortal." -msgstr ":c:data:`Py_False` 為不滅的。" +msgid ":c:data:`Py_False` is :term:`immortal`." +msgstr ":c:data:`Py_False` 為\\ :term:`不滅的 `。" #: ../../c-api/bool.rst:37 msgid "" -"The Python ``True`` object. This object has no methods and is `immortal " -"`_." +"The Python ``True`` object. This object has no methods and is :term:" +"`immortal`." msgstr "" -"Python 的 ``True`` 物件。此物件沒有任何方法且為\\ `不滅的 (immortal) " -"`_。" +"Python 的 ``True`` 物件。此物件沒有任何方法且為\\ :term:`不滅的 `。" #: ../../c-api/bool.rst:40 -msgid ":c:data:`Py_True` is immortal." -msgstr ":c:data:`Py_True` 為不滅的。" +msgid ":c:data:`Py_True` is :term:`immortal`." +msgstr ":c:data:`Py_True` 為\\ :term:`不滅的 `。" #: ../../c-api/bool.rst:46 msgid "Return :c:data:`Py_False` from a function." diff --git a/c-api/buffer.po b/c-api/buffer.po index 7d80cf51b9..d183ac606f 100644 --- a/c-api/buffer.po +++ b/c-api/buffer.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2018-05-23 14:30+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -341,16 +341,17 @@ msgid "" "itemsize`, :c:member:`~Py_buffer.ndim`." msgstr "" -#: ../../c-api/buffer.rst:249 +#: ../../c-api/buffer.rst:248 msgid "readonly, format" msgstr "" -#: ../../c-api/buffer.rst:253 +#: ../../c-api/buffer.rst:252 msgid "" "Controls the :c:member:`~Py_buffer.readonly` field. If set, the exporter " "MUST provide a writable buffer or else report failure. Otherwise, the " "exporter MAY provide either a read-only or writable buffer, but the choice " -"MUST be consistent for all consumers." +"MUST be consistent for all consumers. For example, :c:expr:`PyBUF_SIMPLE | " +"PyBUF_WRITABLE` can be used to request a simple writable buffer." msgstr "" #: ../../c-api/buffer.rst:260 @@ -369,156 +370,157 @@ msgstr "" #: ../../c-api/buffer.rst:268 msgid "" -":c:macro:`PyBUF_FORMAT` can be \\|'d to any of the flags except :c:macro:" -"`PyBUF_SIMPLE`. The latter already implies format ``B`` (unsigned bytes)." +":c:macro:`PyBUF_FORMAT` must be \\|'d to any of the flags except :c:macro:" +"`PyBUF_SIMPLE`, because the latter already implies format ``B`` (unsigned " +"bytes). :c:macro:`!PyBUF_FORMAT` cannot be used on its own." msgstr "" -#: ../../c-api/buffer.rst:273 +#: ../../c-api/buffer.rst:274 msgid "shape, strides, suboffsets" msgstr "" -#: ../../c-api/buffer.rst:275 +#: ../../c-api/buffer.rst:276 msgid "" "The flags that control the logical structure of the memory are listed in " "decreasing order of complexity. Note that each flag contains all bits of the " "flags below it." msgstr "" -#: ../../c-api/buffer.rst:282 ../../c-api/buffer.rst:306 -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 +#: ../../c-api/buffer.rst:332 msgid "Request" msgstr "" -#: ../../c-api/buffer.rst:282 ../../c-api/buffer.rst:306 -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 +#: ../../c-api/buffer.rst:332 msgid "shape" msgstr "" -#: ../../c-api/buffer.rst:282 ../../c-api/buffer.rst:306 -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 +#: ../../c-api/buffer.rst:332 msgid "strides" msgstr "" -#: ../../c-api/buffer.rst:282 ../../c-api/buffer.rst:306 -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:283 ../../c-api/buffer.rst:307 +#: ../../c-api/buffer.rst:332 msgid "suboffsets" msgstr "" -#: ../../c-api/buffer.rst:284 ../../c-api/buffer.rst:286 -#: ../../c-api/buffer.rst:288 ../../c-api/buffer.rst:308 -#: ../../c-api/buffer.rst:310 ../../c-api/buffer.rst:312 -#: ../../c-api/buffer.rst:314 ../../c-api/buffer.rst:333 -#: ../../c-api/buffer.rst:335 ../../c-api/buffer.rst:337 -#: ../../c-api/buffer.rst:339 ../../c-api/buffer.rst:341 -#: ../../c-api/buffer.rst:343 ../../c-api/buffer.rst:345 -#: ../../c-api/buffer.rst:347 +#: ../../c-api/buffer.rst:285 ../../c-api/buffer.rst:287 +#: ../../c-api/buffer.rst:289 ../../c-api/buffer.rst:309 +#: ../../c-api/buffer.rst:311 ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:315 ../../c-api/buffer.rst:334 +#: ../../c-api/buffer.rst:336 ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:342 +#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:346 +#: ../../c-api/buffer.rst:348 msgid "yes" msgstr "" -#: ../../c-api/buffer.rst:284 ../../c-api/buffer.rst:333 -#: ../../c-api/buffer.rst:335 +#: ../../c-api/buffer.rst:285 ../../c-api/buffer.rst:334 +#: ../../c-api/buffer.rst:336 msgid "if needed" msgstr "" -#: ../../c-api/buffer.rst:286 ../../c-api/buffer.rst:288 -#: ../../c-api/buffer.rst:290 ../../c-api/buffer.rst:308 -#: ../../c-api/buffer.rst:310 ../../c-api/buffer.rst:312 -#: ../../c-api/buffer.rst:314 ../../c-api/buffer.rst:337 -#: ../../c-api/buffer.rst:339 ../../c-api/buffer.rst:341 -#: ../../c-api/buffer.rst:343 ../../c-api/buffer.rst:345 -#: ../../c-api/buffer.rst:347 +#: ../../c-api/buffer.rst:287 ../../c-api/buffer.rst:289 +#: ../../c-api/buffer.rst:291 ../../c-api/buffer.rst:309 +#: ../../c-api/buffer.rst:311 ../../c-api/buffer.rst:313 +#: ../../c-api/buffer.rst:315 ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:340 ../../c-api/buffer.rst:342 +#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:346 +#: ../../c-api/buffer.rst:348 msgid "NULL" msgstr "NULL" -#: ../../c-api/buffer.rst:297 +#: ../../c-api/buffer.rst:298 msgid "contiguity requests" msgstr "" -#: ../../c-api/buffer.rst:299 +#: ../../c-api/buffer.rst:300 msgid "" "C or Fortran :term:`contiguity ` can be explicitly requested, " "with and without stride information. Without stride information, the buffer " "must be C-contiguous." msgstr "" -#: ../../c-api/buffer.rst:306 ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:307 ../../c-api/buffer.rst:332 msgid "contig" msgstr "" -#: ../../c-api/buffer.rst:308 ../../c-api/buffer.rst:314 -#: ../../c-api/buffer.rst:345 ../../c-api/buffer.rst:347 +#: ../../c-api/buffer.rst:309 ../../c-api/buffer.rst:315 +#: ../../c-api/buffer.rst:346 ../../c-api/buffer.rst:348 msgid "C" msgstr "C" -#: ../../c-api/buffer.rst:310 +#: ../../c-api/buffer.rst:311 msgid "F" msgstr "F" -#: ../../c-api/buffer.rst:312 +#: ../../c-api/buffer.rst:313 msgid "C or F" msgstr "C 或 F" -#: ../../c-api/buffer.rst:314 +#: ../../c-api/buffer.rst:315 msgid ":c:macro:`PyBUF_ND`" msgstr ":c:macro:`PyBUF_ND`" -#: ../../c-api/buffer.rst:319 +#: ../../c-api/buffer.rst:320 msgid "compound requests" msgstr "" -#: ../../c-api/buffer.rst:321 +#: ../../c-api/buffer.rst:322 msgid "" "All possible requests are fully defined by some combination of the flags in " "the previous section. For convenience, the buffer protocol provides " "frequently used combinations as single flags." msgstr "" -#: ../../c-api/buffer.rst:325 +#: ../../c-api/buffer.rst:326 msgid "" "In the following table *U* stands for undefined contiguity. The consumer " "would have to call :c:func:`PyBuffer_IsContiguous` to determine contiguity." msgstr "" -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:332 msgid "readonly" msgstr "" -#: ../../c-api/buffer.rst:331 +#: ../../c-api/buffer.rst:332 msgid "format" msgstr "" -#: ../../c-api/buffer.rst:333 ../../c-api/buffer.rst:335 -#: ../../c-api/buffer.rst:337 ../../c-api/buffer.rst:339 -#: ../../c-api/buffer.rst:341 ../../c-api/buffer.rst:343 +#: ../../c-api/buffer.rst:334 ../../c-api/buffer.rst:336 +#: ../../c-api/buffer.rst:338 ../../c-api/buffer.rst:340 +#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:344 msgid "U" msgstr "U" -#: ../../c-api/buffer.rst:333 ../../c-api/buffer.rst:337 -#: ../../c-api/buffer.rst:341 ../../c-api/buffer.rst:345 +#: ../../c-api/buffer.rst:334 ../../c-api/buffer.rst:338 +#: ../../c-api/buffer.rst:342 ../../c-api/buffer.rst:346 msgid "0" msgstr "0" -#: ../../c-api/buffer.rst:335 ../../c-api/buffer.rst:339 -#: ../../c-api/buffer.rst:343 ../../c-api/buffer.rst:347 +#: ../../c-api/buffer.rst:336 ../../c-api/buffer.rst:340 +#: ../../c-api/buffer.rst:344 ../../c-api/buffer.rst:348 msgid "1 or 0" msgstr "1 或 0" -#: ../../c-api/buffer.rst:352 +#: ../../c-api/buffer.rst:353 msgid "Complex arrays" msgstr "" -#: ../../c-api/buffer.rst:355 +#: ../../c-api/buffer.rst:356 msgid "NumPy-style: shape and strides" msgstr "" -#: ../../c-api/buffer.rst:357 +#: ../../c-api/buffer.rst:358 msgid "" "The logical structure of NumPy-style arrays is defined by :c:member:" "`~Py_buffer.itemsize`, :c:member:`~Py_buffer.ndim`, :c:member:`~Py_buffer." "shape` and :c:member:`~Py_buffer.strides`." msgstr "" -#: ../../c-api/buffer.rst:360 +#: ../../c-api/buffer.rst:361 msgid "" "If ``ndim == 0``, the memory location pointed to by :c:member:`~Py_buffer." "buf` is interpreted as a scalar of size :c:member:`~Py_buffer.itemsize`. In " @@ -526,14 +528,14 @@ msgid "" "strides` are ``NULL``." msgstr "" -#: ../../c-api/buffer.rst:364 +#: ../../c-api/buffer.rst:365 msgid "" "If :c:member:`~Py_buffer.strides` is ``NULL``, the array is interpreted as a " "standard n-dimensional C-array. Otherwise, the consumer must access an n-" "dimensional array as follows:" msgstr "" -#: ../../c-api/buffer.rst:368 +#: ../../c-api/buffer.rst:369 msgid "" "ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * " "strides[n-1];\n" @@ -543,14 +545,14 @@ msgstr "" "strides[n-1];\n" "item = *((typeof(item) *)ptr);" -#: ../../c-api/buffer.rst:374 +#: ../../c-api/buffer.rst:375 msgid "" "As noted above, :c:member:`~Py_buffer.buf` can point to any location within " "the actual memory block. An exporter can check the validity of a buffer with " "this function:" msgstr "" -#: ../../c-api/buffer.rst:378 +#: ../../c-api/buffer.rst:379 msgid "" "def verify_structure(memlen, itemsize, ndim, shape, strides, offset):\n" " \"\"\"Verify that the parameters represent a valid array within\n" @@ -579,11 +581,11 @@ msgid "" " return 0 <= offset+imin and offset+imax+itemsize <= memlen" msgstr "" -#: ../../c-api/buffer.rst:408 +#: ../../c-api/buffer.rst:409 msgid "PIL-style: shape, strides and suboffsets" msgstr "" -#: ../../c-api/buffer.rst:410 +#: ../../c-api/buffer.rst:411 msgid "" "In addition to the regular items, PIL-style arrays can contain pointers that " "must be followed in order to get to the next element in a dimension. For " @@ -594,14 +596,14 @@ msgid "" "x[2][3]`` arrays that can be located anywhere in memory." msgstr "" -#: ../../c-api/buffer.rst:419 +#: ../../c-api/buffer.rst:420 msgid "" "Here is a function that returns a pointer to the element in an N-D array " "pointed to by an N-dimensional index when there are both non-``NULL`` " "strides and suboffsets::" msgstr "" -#: ../../c-api/buffer.rst:423 +#: ../../c-api/buffer.rst:424 msgid "" "void *get_item_pointer(int ndim, void *buf, Py_ssize_t *strides,\n" " Py_ssize_t *suboffsets, Py_ssize_t *indices) {\n" @@ -629,25 +631,25 @@ msgstr "" " return (void*)pointer;\n" "}" -#: ../../c-api/buffer.rst:438 +#: ../../c-api/buffer.rst:439 msgid "Buffer-related functions" msgstr "" -#: ../../c-api/buffer.rst:442 +#: ../../c-api/buffer.rst:443 msgid "" "Return ``1`` if *obj* supports the buffer interface otherwise ``0``. When " "``1`` is returned, it doesn't guarantee that :c:func:`PyObject_GetBuffer` " "will succeed. This function always succeeds." msgstr "" -#: ../../c-api/buffer.rst:449 +#: ../../c-api/buffer.rst:450 msgid "" "Send a request to *exporter* to fill in *view* as specified by *flags*. If " "the exporter cannot provide a buffer of the exact type, it MUST raise :exc:" "`BufferError`, set ``view->obj`` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/buffer.rst:454 +#: ../../c-api/buffer.rst:455 msgid "" "On success, fill in *view*, set ``view->obj`` to a new reference to " "*exporter* and return 0. In the case of chained buffer providers that " @@ -655,7 +657,7 @@ msgid "" "instead of *exporter* (See :ref:`Buffer Object Structures `)." msgstr "" -#: ../../c-api/buffer.rst:459 +#: ../../c-api/buffer.rst:460 msgid "" "Successful calls to :c:func:`PyObject_GetBuffer` must be paired with calls " "to :c:func:`PyBuffer_Release`, similar to :c:func:`malloc` and :c:func:" @@ -663,7 +665,7 @@ msgid "" "`PyBuffer_Release` must be called exactly once." msgstr "" -#: ../../c-api/buffer.rst:467 +#: ../../c-api/buffer.rst:468 msgid "" "Release the buffer *view* and release the :term:`strong reference` (i.e. " "decrement the reference count) to the view's supporting object, ``view-" @@ -671,19 +673,19 @@ msgid "" "used, otherwise reference leaks may occur." msgstr "" -#: ../../c-api/buffer.rst:472 +#: ../../c-api/buffer.rst:473 msgid "" "It is an error to call this function on a buffer that was not obtained via :" "c:func:`PyObject_GetBuffer`." msgstr "" -#: ../../c-api/buffer.rst:478 +#: ../../c-api/buffer.rst:479 msgid "" "Return the implied :c:member:`~Py_buffer.itemsize` from :c:member:" "`~Py_buffer.format`. On error, raise an exception and return -1." msgstr "" -#: ../../c-api/buffer.rst:486 +#: ../../c-api/buffer.rst:487 msgid "" "Return ``1`` if the memory defined by the *view* is C-style (*order* is " "``'C'``) or Fortran-style (*order* is ``'F'``) :term:`contiguous` or either " @@ -691,69 +693,69 @@ msgid "" "succeeds." msgstr "" -#: ../../c-api/buffer.rst:493 +#: ../../c-api/buffer.rst:494 msgid "" "Get the memory area pointed to by the *indices* inside the given *view*. " "*indices* must point to an array of ``view->ndim`` indices." msgstr "" -#: ../../c-api/buffer.rst:499 +#: ../../c-api/buffer.rst:500 msgid "" "Copy contiguous *len* bytes from *buf* to *view*. *fort* can be ``'C'`` or " "``'F'`` (for C-style or Fortran-style ordering). ``0`` is returned on " "success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:506 +#: ../../c-api/buffer.rst:507 msgid "" "Copy *len* bytes from *src* to its contiguous representation in *buf*. " "*order* can be ``'C'`` or ``'F'`` or ``'A'`` (for C-style or Fortran-style " "ordering or either one). ``0`` is returned on success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:510 +#: ../../c-api/buffer.rst:511 msgid "This function fails if *len* != *src->len*." msgstr "" -#: ../../c-api/buffer.rst:515 +#: ../../c-api/buffer.rst:516 msgid "" "Copy data from *src* to *dest* buffer. Can convert between C-style and or " "Fortran-style buffers." msgstr "" -#: ../../c-api/buffer.rst:518 +#: ../../c-api/buffer.rst:519 msgid "``0`` is returned on success, ``-1`` on error." msgstr "" -#: ../../c-api/buffer.rst:522 +#: ../../c-api/buffer.rst:523 msgid "" "Fill the *strides* array with byte-strides of a :term:`contiguous` (C-style " "if *order* is ``'C'`` or Fortran-style if *order* is ``'F'``) array of the " "given shape with the given number of bytes per element." msgstr "" -#: ../../c-api/buffer.rst:529 +#: ../../c-api/buffer.rst:530 msgid "" "Handle buffer requests for an exporter that wants to expose *buf* of size " "*len* with writability set according to *readonly*. *buf* is interpreted as " "a sequence of unsigned bytes." msgstr "" -#: ../../c-api/buffer.rst:533 +#: ../../c-api/buffer.rst:534 msgid "" "The *flags* argument indicates the request type. This function always fills " "in *view* as specified by flags, unless *buf* has been designated as read-" "only and :c:macro:`PyBUF_WRITABLE` is set in *flags*." msgstr "" -#: ../../c-api/buffer.rst:537 +#: ../../c-api/buffer.rst:538 msgid "" "On success, set ``view->obj`` to a new reference to *exporter* and return 0. " "Otherwise, raise :exc:`BufferError`, set ``view->obj`` to ``NULL`` and " "return ``-1``;" msgstr "" -#: ../../c-api/buffer.rst:541 +#: ../../c-api/buffer.rst:542 msgid "" "If this function is used as part of a :ref:`getbufferproc `, " "*exporter* MUST be set to the exporting object and *flags* must be passed " @@ -780,14 +782,14 @@ msgstr "buffer object(緩衝物件)" msgid "PyBufferProcs (C type)" msgstr "PyBufferProcs(C 型別)" -#: ../../c-api/buffer.rst:294 +#: ../../c-api/buffer.rst:295 msgid "contiguous" msgstr "contiguous(連續的)" -#: ../../c-api/buffer.rst:294 +#: ../../c-api/buffer.rst:295 msgid "C-contiguous" msgstr "C-contiguous(C 連續的)" -#: ../../c-api/buffer.rst:294 +#: ../../c-api/buffer.rst:295 msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" diff --git a/c-api/bytearray.po b/c-api/bytearray.po index b99829a933..57d7d62324 100644 --- a/c-api/bytearray.po +++ b/c-api/bytearray.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-04 00:03+0000\n" "PO-Revision-Date: 2023-08-12 11:42+0800\n" diff --git a/c-api/bytes.po b/c-api/bytes.po index e70159eeb0..4cb4ac8545 100644 --- a/c-api/bytes.po +++ b/c-api/bytes.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-12-26 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -316,16 +316,14 @@ msgstr "" #: ../../c-api/bytes.rst:194 msgid "" -"A way to resize a bytes object even though it is \"immutable\". Only use " -"this to build up a brand new bytes object; don't use this if the bytes may " -"already be known in other parts of the code. It is an error to call this " -"function if the refcount on the input bytes object is not one. Pass the " -"address of an existing bytes object as an lvalue (it may be written into), " -"and the new size desired. On success, *\\*bytes* holds the resized bytes " -"object and ``0`` is returned; the address in *\\*bytes* may differ from its " -"input value. If the reallocation fails, the original bytes object at " -"*\\*bytes* is deallocated, *\\*bytes* is set to ``NULL``, :exc:`MemoryError` " -"is set, and ``-1`` is returned." +"Resize a bytes object. *newsize* will be the new length of the bytes object. " +"You can think of it as creating a new bytes object and destroying the old " +"one, only more efficiently. Pass the address of an existing bytes object as " +"an lvalue (it may be written into), and the new size desired. On success, " +"*\\*bytes* holds the resized bytes object and ``0`` is returned; the address " +"in *\\*bytes* may differ from its input value. If the reallocation fails, " +"the original bytes object at *\\*bytes* is deallocated, *\\*bytes* is set to " +"``NULL``, :exc:`MemoryError` is set, and ``-1`` is returned." msgstr "" #: ../../c-api/bytes.rst:11 diff --git a/c-api/call.po b/c-api/call.po index 481a78e876..4f635027c2 100644 --- a/c-api/call.po +++ b/c-api/call.po @@ -6,9 +6,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-10-16 03:20+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -227,30 +227,11 @@ msgstr "" "要呼叫一個實作了 vectorcall 的物件,請就像其他可呼叫物件一樣使用\\ :ref:`呼" "叫 API` 中的函式。:c:func:`PyObject_Vectorcall` 通常是最有效率的。" -#: ../../c-api/call.rst:120 -msgid "" -"In CPython 3.8, the vectorcall API and related functions were available " -"provisionally under names with a leading underscore: " -"``_PyObject_Vectorcall``, ``_Py_TPFLAGS_HAVE_VECTORCALL``, " -"``_PyObject_VectorcallMethod``, ``_PyVectorcall_Function``, " -"``_PyObject_CallOneArg``, ``_PyObject_CallMethodNoArgs``, " -"``_PyObject_CallMethodOneArg``. Additionally, ``PyObject_VectorcallDict`` " -"was available as ``_PyObject_FastCallDict``. The old names are still defined " -"as aliases of the new, non-underscored names." -msgstr "" -"在 CPython 3.8 中,vectorcall API 和相關函式暫定以帶開頭底線的名稱提供:" -"``_PyObject_Vectorcall``、``_Py_TPFLAGS_HAVE_VECTORCALL``、" -"``_PyObject_VectorcallMethod``、``_PyVectorcall_Function``、" -"``_PyObject_CallOneArg``、``_PyObject_CallMethodNoArgs``、" -"``_PyObject_CallMethodOneArg``。此外,``PyObject_VectorcallDict`` 也以 " -"``_PyObject_FastCallDict`` 名稱提供。這些舊名稱仍有被定義,做為不帶底線的新名" -"稱的別名。" - -#: ../../c-api/call.rst:132 +#: ../../c-api/call.rst:119 msgid "Recursion Control" msgstr "遞迴控制" -#: ../../c-api/call.rst:134 +#: ../../c-api/call.rst:121 msgid "" "When using *tp_call*, callees do not need to worry about :ref:`recursion " "`: CPython uses :c:func:`Py_EnterRecursiveCall` and :c:func:" @@ -260,7 +241,7 @@ msgstr "" "使用 *tp_call* 的呼叫會使用 :c:func:`Py_EnterRecursiveCall` 和 :c:func:" "`Py_LeaveRecursiveCall`。" -#: ../../c-api/call.rst:139 +#: ../../c-api/call.rst:126 msgid "" "For efficiency, this is not the case for calls done using vectorcall: the " "callee should use *Py_EnterRecursiveCall* and *Py_LeaveRecursiveCall* if " @@ -269,27 +250,27 @@ msgstr "" "為保證效率,這不適用於使用 vectorcall 的呼叫:被呼叫方在需要時應當使用 " "*Py_EnterRecursiveCall* 和 *Py_LeaveRecursiveCall*。" -#: ../../c-api/call.rst:145 +#: ../../c-api/call.rst:132 msgid "Vectorcall Support API" msgstr "Vectorcall 支援 API" -#: ../../c-api/call.rst:149 +#: ../../c-api/call.rst:136 msgid "" "Given a vectorcall *nargsf* argument, return the actual number of arguments. " "Currently equivalent to::" msgstr "給定一個 vectorcall *nargsf* 引數,回傳引數的實際數量。目前等同於: ::" -#: ../../c-api/call.rst:153 +#: ../../c-api/call.rst:140 msgid "(Py_ssize_t)(nargsf & ~PY_VECTORCALL_ARGUMENTS_OFFSET)" msgstr "(Py_ssize_t)(nargsf & ~PY_VECTORCALL_ARGUMENTS_OFFSET)" -#: ../../c-api/call.rst:155 +#: ../../c-api/call.rst:142 msgid "" "However, the function ``PyVectorcall_NARGS`` should be used to allow for " "future extensions." msgstr "然而,應使用 ``PyVectorcall_NARGS`` 函式以便將來需要擴充。" -#: ../../c-api/call.rst:162 +#: ../../c-api/call.rst:149 msgid "" "If *op* does not support the vectorcall protocol (either because the type " "does not or because the specific instance does not), return *NULL*. " @@ -300,7 +281,7 @@ msgstr "" "*NULL*。否則,回傳儲存在 *op* 中的 vectorcall 函式指標。這個函式不會引發例" "外。" -#: ../../c-api/call.rst:167 +#: ../../c-api/call.rst:154 msgid "" "This is mostly useful to check whether or not *op* supports vectorcall, " "which can be done by checking ``PyVectorcall_Function(op) != NULL``." @@ -308,7 +289,7 @@ msgstr "" "這大多在檢查 *op* 是否支援 vectorcall 時能派上用場,可以透過檢查 " "``PyVectorcall_Function(op) != NULL`` 來達成。" -#: ../../c-api/call.rst:174 +#: ../../c-api/call.rst:161 msgid "" "Call *callable*'s :c:type:`vectorcallfunc` with positional and keyword " "arguments given in a tuple and dict, respectively." @@ -316,7 +297,7 @@ msgstr "" "呼叫 *callable* 的 :c:type:`vectorcallfunc`,其位置引數和關鍵字引數分別以 " "tuple 和 dict 格式給定。" -#: ../../c-api/call.rst:177 +#: ../../c-api/call.rst:164 msgid "" "This is a specialized function, intended to be put in the :c:member:" "`~PyTypeObject.tp_call` slot or be used in an implementation of ``tp_call``. " @@ -327,11 +308,11 @@ msgstr "" "用於 ``tp_call`` 的實作。它不會檢查 :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` 旗" "標並且它不會退回 (fall back) 使用 ``tp_call``。" -#: ../../c-api/call.rst:188 +#: ../../c-api/call.rst:175 msgid "Object Calling API" msgstr "物件呼叫 API" -#: ../../c-api/call.rst:190 +#: ../../c-api/call.rst:177 msgid "" "Various functions are available for calling a Python object. Each converts " "its arguments to a convention supported by the called object – either " @@ -342,133 +323,133 @@ msgstr "" "的慣用形式 – 可以是 *tp_call* 或 vectorcall。為了儘可能減少轉換的進行,請選擇" "一個適合你所擁有資料格式的函式。" -#: ../../c-api/call.rst:196 +#: ../../c-api/call.rst:183 msgid "" "The following table summarizes the available functions; please see " "individual documentation for details." msgstr "下表總結了可用的函式;請參閱各個說明文件以瞭解詳情。" -#: ../../c-api/call.rst:200 +#: ../../c-api/call.rst:187 msgid "Function" msgstr "函式" -#: ../../c-api/call.rst:200 +#: ../../c-api/call.rst:187 msgid "callable" msgstr "callable" -#: ../../c-api/call.rst:200 +#: ../../c-api/call.rst:187 msgid "args" msgstr "args" -#: ../../c-api/call.rst:200 +#: ../../c-api/call.rst:187 msgid "kwargs" msgstr "kwargs" -#: ../../c-api/call.rst:202 +#: ../../c-api/call.rst:189 msgid ":c:func:`PyObject_Call`" msgstr ":c:func:`PyObject_Call`" -#: ../../c-api/call.rst:202 ../../c-api/call.rst:204 ../../c-api/call.rst:206 -#: ../../c-api/call.rst:208 ../../c-api/call.rst:210 ../../c-api/call.rst:214 -#: ../../c-api/call.rst:222 ../../c-api/call.rst:224 +#: ../../c-api/call.rst:189 ../../c-api/call.rst:191 ../../c-api/call.rst:193 +#: ../../c-api/call.rst:195 ../../c-api/call.rst:197 ../../c-api/call.rst:201 +#: ../../c-api/call.rst:209 ../../c-api/call.rst:211 msgid "``PyObject *``" msgstr "``PyObject *``" -#: ../../c-api/call.rst:202 +#: ../../c-api/call.rst:189 msgid "tuple" msgstr "tuple" -#: ../../c-api/call.rst:202 ../../c-api/call.rst:224 +#: ../../c-api/call.rst:189 ../../c-api/call.rst:211 msgid "dict/``NULL``" msgstr "dict/``NULL``" -#: ../../c-api/call.rst:204 +#: ../../c-api/call.rst:191 msgid ":c:func:`PyObject_CallNoArgs`" msgstr ":c:func:`PyObject_CallNoArgs`" -#: ../../c-api/call.rst:204 ../../c-api/call.rst:206 ../../c-api/call.rst:208 -#: ../../c-api/call.rst:210 ../../c-api/call.rst:212 ../../c-api/call.rst:214 -#: ../../c-api/call.rst:216 ../../c-api/call.rst:218 ../../c-api/call.rst:220 +#: ../../c-api/call.rst:191 ../../c-api/call.rst:193 ../../c-api/call.rst:195 +#: ../../c-api/call.rst:197 ../../c-api/call.rst:199 ../../c-api/call.rst:201 +#: ../../c-api/call.rst:203 ../../c-api/call.rst:205 ../../c-api/call.rst:207 msgid "---" msgstr "---" -#: ../../c-api/call.rst:206 +#: ../../c-api/call.rst:193 msgid ":c:func:`PyObject_CallOneArg`" msgstr ":c:func:`PyObject_CallOneArg`" -#: ../../c-api/call.rst:206 ../../c-api/call.rst:220 +#: ../../c-api/call.rst:193 ../../c-api/call.rst:207 msgid "1 object" msgstr "一個物件" -#: ../../c-api/call.rst:208 +#: ../../c-api/call.rst:195 msgid ":c:func:`PyObject_CallObject`" msgstr ":c:func:`PyObject_CallObject`" -#: ../../c-api/call.rst:208 +#: ../../c-api/call.rst:195 msgid "tuple/``NULL``" msgstr "tuple/``NULL``" -#: ../../c-api/call.rst:210 +#: ../../c-api/call.rst:197 msgid ":c:func:`PyObject_CallFunction`" msgstr ":c:func:`PyObject_CallFunction`" -#: ../../c-api/call.rst:210 ../../c-api/call.rst:212 +#: ../../c-api/call.rst:197 ../../c-api/call.rst:199 msgid "format" msgstr "format" -#: ../../c-api/call.rst:212 +#: ../../c-api/call.rst:199 msgid ":c:func:`PyObject_CallMethod`" msgstr ":c:func:`PyObject_CallMethod`" -#: ../../c-api/call.rst:212 +#: ../../c-api/call.rst:199 msgid "obj + ``char*``" msgstr "物件 + ``char*``" -#: ../../c-api/call.rst:214 +#: ../../c-api/call.rst:201 msgid ":c:func:`PyObject_CallFunctionObjArgs`" msgstr ":c:func:`PyObject_CallFunctionObjArgs`" -#: ../../c-api/call.rst:214 ../../c-api/call.rst:216 +#: ../../c-api/call.rst:201 ../../c-api/call.rst:203 msgid "variadic" msgstr "可變引數" -#: ../../c-api/call.rst:216 +#: ../../c-api/call.rst:203 msgid ":c:func:`PyObject_CallMethodObjArgs`" msgstr ":c:func:`PyObject_CallMethodObjArgs`" -#: ../../c-api/call.rst:216 ../../c-api/call.rst:218 ../../c-api/call.rst:220 +#: ../../c-api/call.rst:203 ../../c-api/call.rst:205 ../../c-api/call.rst:207 msgid "obj + name" msgstr "物件 + 名稱" -#: ../../c-api/call.rst:218 +#: ../../c-api/call.rst:205 msgid ":c:func:`PyObject_CallMethodNoArgs`" msgstr ":c:func:`PyObject_CallMethodNoArgs`" -#: ../../c-api/call.rst:220 +#: ../../c-api/call.rst:207 msgid ":c:func:`PyObject_CallMethodOneArg`" msgstr ":c:func:`PyObject_CallMethodOneArg`" -#: ../../c-api/call.rst:222 +#: ../../c-api/call.rst:209 msgid ":c:func:`PyObject_Vectorcall`" msgstr ":c:func:`PyObject_Vectorcall`" -#: ../../c-api/call.rst:222 ../../c-api/call.rst:224 ../../c-api/call.rst:226 +#: ../../c-api/call.rst:209 ../../c-api/call.rst:211 ../../c-api/call.rst:213 msgid "vectorcall" msgstr "vectorcall" -#: ../../c-api/call.rst:224 +#: ../../c-api/call.rst:211 msgid ":c:func:`PyObject_VectorcallDict`" msgstr ":c:func:`PyObject_VectorcallDict`" -#: ../../c-api/call.rst:226 +#: ../../c-api/call.rst:213 msgid ":c:func:`PyObject_VectorcallMethod`" msgstr ":c:func:`PyObject_VectorcallMethod`" -#: ../../c-api/call.rst:226 +#: ../../c-api/call.rst:213 msgid "arg + name" msgstr "引數 + 名稱" -#: ../../c-api/call.rst:232 +#: ../../c-api/call.rst:219 msgid "" "Call a callable Python object *callable*, with arguments given by the tuple " "*args*, and named arguments given by the dictionary *kwargs*." @@ -476,7 +457,7 @@ msgstr "" "呼叫一個可呼叫的 Python 物件 *callable*,附帶由 tuple *args* 所給定的引數及由" "字典 *kwargs* 所給定的關鍵字引數。" -#: ../../c-api/call.rst:235 +#: ../../c-api/call.rst:222 msgid "" "*args* must not be *NULL*; use an empty tuple if no arguments are needed. If " "no named arguments are needed, *kwargs* can be *NULL*." @@ -484,22 +465,22 @@ msgstr "" "*args* 必須不為 *NULL*;如果不需要引數,請使用一個空 tuple。如果不需要關鍵字" "引數,則 *kwargs* 可以為 *NULL*。" -#: ../../c-api/call.rst:238 ../../c-api/call.rst:250 ../../c-api/call.rst:261 -#: ../../c-api/call.rst:272 ../../c-api/call.rst:284 ../../c-api/call.rst:304 -#: ../../c-api/call.rst:323 ../../c-api/call.rst:337 ../../c-api/call.rst:346 -#: ../../c-api/call.rst:358 ../../c-api/call.rst:371 ../../c-api/call.rst:405 +#: ../../c-api/call.rst:225 ../../c-api/call.rst:237 ../../c-api/call.rst:248 +#: ../../c-api/call.rst:259 ../../c-api/call.rst:271 ../../c-api/call.rst:291 +#: ../../c-api/call.rst:310 ../../c-api/call.rst:324 ../../c-api/call.rst:333 +#: ../../c-api/call.rst:345 ../../c-api/call.rst:358 ../../c-api/call.rst:392 msgid "" "Return the result of the call on success, or raise an exception and return " "*NULL* on failure." msgstr "成功時回傳結果,或在失敗時引發一個例外並回傳 *NULL*。" -#: ../../c-api/call.rst:241 +#: ../../c-api/call.rst:228 msgid "" "This is the equivalent of the Python expression: ``callable(*args, " "**kwargs)``." msgstr "這等價於 Python 運算式 ``callable(*args, **kwargs)``。" -#: ../../c-api/call.rst:247 +#: ../../c-api/call.rst:234 msgid "" "Call a callable Python object *callable* without any arguments. It is the " "most efficient way to call a callable Python object without any argument." @@ -507,7 +488,7 @@ msgstr "" "呼叫一個可呼叫的 Python 物件 *callable* 並不附帶任何引數。這是不帶引數呼叫 " "Python 可呼叫物件的最有效方式。" -#: ../../c-api/call.rst:258 +#: ../../c-api/call.rst:245 msgid "" "Call a callable Python object *callable* with exactly 1 positional argument " "*arg* and no keyword arguments." @@ -515,7 +496,7 @@ msgstr "" "呼叫一個可呼叫的 Python 物件 *callable* 並附帶正好一個位置引數 *arg* 而沒有關" "鍵字引數。" -#: ../../c-api/call.rst:269 +#: ../../c-api/call.rst:256 msgid "" "Call a callable Python object *callable*, with arguments given by the tuple " "*args*. If no arguments are needed, then *args* can be *NULL*." @@ -523,11 +504,11 @@ msgstr "" "呼叫一個可呼叫的 Python 物件 *callable*,附帶由 tuple *args* 所給定的引數。如" "果不需要傳入引數,則 *args* 可以為 *NULL*。" -#: ../../c-api/call.rst:275 ../../c-api/call.rst:287 +#: ../../c-api/call.rst:262 ../../c-api/call.rst:274 msgid "This is the equivalent of the Python expression: ``callable(*args)``." msgstr "這等價於 Python 運算式 ``callable(*args)``。" -#: ../../c-api/call.rst:280 +#: ../../c-api/call.rst:267 msgid "" "Call a callable Python object *callable*, with a variable number of C " "arguments. The C arguments are described using a :c:func:`Py_BuildValue` " @@ -538,7 +519,7 @@ msgstr "" "用 :c:func:`Py_BuildValue` 風格的格式字串來描述。格式可以為 *NULL*,表示沒有" "提供任何引數。" -#: ../../c-api/call.rst:289 +#: ../../c-api/call.rst:276 msgid "" "Note that if you only pass :c:expr:`PyObject *` args, :c:func:" "`PyObject_CallFunctionObjArgs` is a faster alternative." @@ -546,11 +527,11 @@ msgstr "" "注意,如果你只傳入 :c:expr:`PyObject *` 引數,則 :c:func:" "`PyObject_CallFunctionObjArgs` 是另一個更快速的選擇。" -#: ../../c-api/call.rst:292 +#: ../../c-api/call.rst:279 msgid "The type of *format* was changed from ``char *``." msgstr "這個 *format* 的型別已從 ``char *`` 更改。" -#: ../../c-api/call.rst:298 +#: ../../c-api/call.rst:285 msgid "" "Call the method named *name* of object *obj* with a variable number of C " "arguments. The C arguments are described by a :c:func:`Py_BuildValue` " @@ -559,17 +540,17 @@ msgstr "" "呼叫 *obj* 物件中名為 *name* 的 method 並附帶數量可變的 C 引數。這些 C 引數" "由 :c:func:`Py_BuildValue` 格式字串來描述,並應當生成一個 tuple。" -#: ../../c-api/call.rst:302 +#: ../../c-api/call.rst:289 msgid "The format can be *NULL*, indicating that no arguments are provided." msgstr "格式可以為 *NULL*,表示沒有提供任何引數。" -#: ../../c-api/call.rst:307 +#: ../../c-api/call.rst:294 msgid "" "This is the equivalent of the Python expression: ``obj.name(arg1, " "arg2, ...)``." msgstr "這等價於 Python 運算式 ``obj.name(arg1, arg2, ...)``。" -#: ../../c-api/call.rst:310 +#: ../../c-api/call.rst:297 msgid "" "Note that if you only pass :c:expr:`PyObject *` args, :c:func:" "`PyObject_CallMethodObjArgs` is a faster alternative." @@ -577,11 +558,11 @@ msgstr "" "注意,如果你只傳入 :c:expr:`PyObject *` 引數,則 :c:func:" "`PyObject_CallMethodObjArgs` 是另一個更快速的選擇。" -#: ../../c-api/call.rst:313 +#: ../../c-api/call.rst:300 msgid "The types of *name* and *format* were changed from ``char *``." msgstr "*name* 和 *format* 的型別已從 ``char *`` 更改。" -#: ../../c-api/call.rst:319 +#: ../../c-api/call.rst:306 msgid "" "Call a callable Python object *callable*, with a variable number of :c:expr:" "`PyObject *` arguments. The arguments are provided as a variable number of " @@ -590,13 +571,13 @@ msgstr "" "呼叫一個可呼叫的 Python 物件 *callable*,附帶數量可變的 :c:expr:`PyObject *` " "引數。這些引數是以位置在 *NULL* 後面、數量可變的參數來提供。" -#: ../../c-api/call.rst:326 +#: ../../c-api/call.rst:313 msgid "" "This is the equivalent of the Python expression: ``callable(arg1, " "arg2, ...)``." msgstr "這等價於 Python 運算式 ``callable(arg1, arg2, ...)``。" -#: ../../c-api/call.rst:332 +#: ../../c-api/call.rst:319 msgid "" "Call a method of the Python object *obj*, where the name of the method is " "given as a Python string object in *name*. It is called with a variable " @@ -607,7 +588,7 @@ msgstr "" "Python 字串物件給定。被呼叫時會附帶數量可變的 :c:expr:`PyObject *` 引數。這些" "引數是以位置在 *NULL* 後面、且數量可變的參數來提供。" -#: ../../c-api/call.rst:343 +#: ../../c-api/call.rst:330 msgid "" "Call a method of the Python object *obj* without arguments, where the name " "of the method is given as a Python string object in *name*." @@ -615,7 +596,7 @@ msgstr "" "不附帶任何引數地呼叫 Python 物件 *obj* 中的一個 method,其中 method 名稱由 " "*name* 中的 Python 字串物件給定。" -#: ../../c-api/call.rst:354 +#: ../../c-api/call.rst:341 msgid "" "Call a method of the Python object *obj* with a single positional argument " "*arg*, where the name of the method is given as a Python string object in " @@ -624,7 +605,7 @@ msgstr "" "附帶一個位置引數 *arg* 地呼叫 Python 物件 *obj* 中的一個 method,其中 method " "名稱由 *name* 中的 Python 字串物件給定。" -#: ../../c-api/call.rst:366 +#: ../../c-api/call.rst:353 msgid "" "Call a callable Python object *callable*. The arguments are the same as for :" "c:type:`vectorcallfunc`. If *callable* supports vectorcall_, this directly " @@ -634,7 +615,7 @@ msgstr "" "的相同。如果 *callable* 支援 vectorcall_,則它會直接呼叫存放在 *callable* 中" "的 vectorcall 函式。" -#: ../../c-api/call.rst:378 +#: ../../c-api/call.rst:365 msgid "" "Call *callable* with positional arguments passed exactly as in the " "vectorcall_ protocol, but with keyword arguments passed as a dictionary " @@ -643,7 +624,7 @@ msgstr "" "附帶與在 vectorcall_ 協定中傳入的相同位置引數來呼叫 *callable*,但會加上以字" "典 *kwdict* 格式傳入的關鍵字引數。*args* 陣列將只包含位置引數。" -#: ../../c-api/call.rst:382 +#: ../../c-api/call.rst:369 msgid "" "Regardless of which protocol is used internally, a conversion of arguments " "needs to be done. Therefore, this function should only be used if the caller " @@ -653,7 +634,7 @@ msgstr "" "無論內部使用了哪一種協定,都會需要進行引數的轉換。因此,此函式應該只有在呼叫" "方已經擁有一個要作為關鍵字引數的字典、但沒有作為位置引數的 tuple 時才被使用。" -#: ../../c-api/call.rst:392 +#: ../../c-api/call.rst:379 msgid "" "Call a method using the vectorcall calling convention. The name of the " "method is given as a Python string *name*. The object whose method is called " @@ -671,7 +652,7 @@ msgstr "" "加上 :c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`。關鍵字引數可以像在 :c:func:" "`PyObject_Vectorcall` 中一樣被傳入。" -#: ../../c-api/call.rst:401 +#: ../../c-api/call.rst:388 msgid "" "If the object has the :c:macro:`Py_TPFLAGS_METHOD_DESCRIPTOR` feature, this " "will call the unbound method object with the full *args* vector as arguments." @@ -679,14 +660,32 @@ msgstr "" "如果物件具有 :c:macro:`Py_TPFLAGS_METHOD_DESCRIPTOR` 特性,這將以完整的 " "*args* 向量作為引數來呼叫 unbound method(未繫結方法)物件。" -#: ../../c-api/call.rst:412 +#: ../../c-api/call.rst:399 msgid "Call Support API" msgstr "呼叫支援 API" -#: ../../c-api/call.rst:416 +#: ../../c-api/call.rst:403 msgid "" "Determine if the object *o* is callable. Return ``1`` if the object is " "callable and ``0`` otherwise. This function always succeeds." msgstr "" "判定物件 *o* 是否為可呼叫的。如果物件是可呼叫物件則回傳 ``1``,其他情況回傳 " "``0``。這個函式不會呼叫失敗。" + +#~ msgid "" +#~ "In CPython 3.8, the vectorcall API and related functions were available " +#~ "provisionally under names with a leading underscore: " +#~ "``_PyObject_Vectorcall``, ``_Py_TPFLAGS_HAVE_VECTORCALL``, " +#~ "``_PyObject_VectorcallMethod``, ``_PyVectorcall_Function``, " +#~ "``_PyObject_CallOneArg``, ``_PyObject_CallMethodNoArgs``, " +#~ "``_PyObject_CallMethodOneArg``. Additionally, ``PyObject_VectorcallDict`` " +#~ "was available as ``_PyObject_FastCallDict``. The old names are still " +#~ "defined as aliases of the new, non-underscored names." +#~ msgstr "" +#~ "在 CPython 3.8 中,vectorcall API 和相關函式暫定以帶開頭底線的名稱提供:" +#~ "``_PyObject_Vectorcall``、``_Py_TPFLAGS_HAVE_VECTORCALL``、" +#~ "``_PyObject_VectorcallMethod``、``_PyVectorcall_Function``、" +#~ "``_PyObject_CallOneArg``、``_PyObject_CallMethodNoArgs``、" +#~ "``_PyObject_CallMethodOneArg``。此外,``PyObject_VectorcallDict`` 也以 " +#~ "``_PyObject_FastCallDict`` 名稱提供。這些舊名稱仍有被定義,做為不帶底線的" +#~ "新名稱的別名。" diff --git a/c-api/capsule.po b/c-api/capsule.po index 7ce4bb7a23..42a0ea59ac 100644 --- a/c-api/capsule.po +++ b/c-api/capsule.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:30+0000\n" diff --git a/c-api/cell.po b/c-api/cell.po index 2f91c7b625..26beccfb9a 100644 --- a/c-api/cell.po +++ b/c-api/cell.po @@ -9,7 +9,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-10 00:04+0000\n" "PO-Revision-Date: 2022-10-16 15:33+0800\n" diff --git a/c-api/code.po b/c-api/code.po index c127f837d6..79fec6db3e 100644 --- a/c-api/code.po +++ b/c-api/code.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -57,107 +57,114 @@ msgstr "" #: ../../c-api/code.rst:43 msgid "" +"Renamed from ``PyCode_GetFirstFree`` as part of :ref:`unstable-c-api`. The " +"old name is deprecated, but will remain available until the signature " +"changes again." +msgstr "" + +#: ../../c-api/code.rst:49 +msgid "" "Return a new code object. If you need a dummy code object to create a " "frame, use :c:func:`PyCode_NewEmpty` instead." msgstr "" -#: ../../c-api/code.rst:46 +#: ../../c-api/code.rst:52 msgid "" "Since the definition of the bytecode changes often, calling :c:func:" "`PyUnstable_Code_New` directly can bind you to a precise Python version." msgstr "" -#: ../../c-api/code.rst:49 +#: ../../c-api/code.rst:55 msgid "" "The many arguments of this function are inter-dependent in complex ways, " "meaning that subtle changes to values are likely to result in incorrect " "execution or VM crashes. Use this function only with extreme care." msgstr "" -#: ../../c-api/code.rst:53 +#: ../../c-api/code.rst:59 msgid "Added ``qualname`` and ``exceptiontable`` parameters." msgstr "新增 ``qualname`` 和 ``exceptiontable`` 參數。" -#: ../../c-api/code.rst:60 +#: ../../c-api/code.rst:66 msgid "" "Renamed from ``PyCode_New`` as part of :ref:`unstable-c-api`. The old name " "is deprecated, but will remain available until the signature changes again." msgstr "" -#: ../../c-api/code.rst:66 +#: ../../c-api/code.rst:72 msgid "" "Similar to :c:func:`PyUnstable_Code_New`, but with an extra " "\"posonlyargcount\" for positional-only arguments. The same caveats that " "apply to ``PyUnstable_Code_New`` also apply to this function." msgstr "" -#: ../../c-api/code.rst:71 +#: ../../c-api/code.rst:77 msgid "as ``PyCode_NewWithPosOnlyArgs``" msgstr "" -#: ../../c-api/code.rst:73 +#: ../../c-api/code.rst:79 msgid "Added ``qualname`` and ``exceptiontable`` parameters." msgstr "新增 ``qualname`` 和 ``exceptiontable`` 參數。" -#: ../../c-api/code.rst:78 +#: ../../c-api/code.rst:84 msgid "" "Renamed to ``PyUnstable_Code_NewWithPosOnlyArgs``. The old name is " "deprecated, but will remain available until the signature changes again." msgstr "" -#: ../../c-api/code.rst:84 +#: ../../c-api/code.rst:90 msgid "" "Return a new empty code object with the specified filename, function name, " "and first line number. The resulting code object will raise an ``Exception`` " "if executed." msgstr "" -#: ../../c-api/code.rst:90 +#: ../../c-api/code.rst:96 msgid "" "Return the line number of the instruction that occurs on or before " "``byte_offset`` and ends after it. If you just need the line number of a " "frame, use :c:func:`PyFrame_GetLineNumber` instead." msgstr "" -#: ../../c-api/code.rst:93 +#: ../../c-api/code.rst:99 msgid "" "For efficiently iterating over the line numbers in a code object, use :pep:" "`the API described in PEP 626 <0626#out-of-process-debuggers-and-profilers>`." msgstr "" -#: ../../c-api/code.rst:98 +#: ../../c-api/code.rst:104 msgid "" "Sets the passed ``int`` pointers to the source code line and column numbers " "for the instruction at ``byte_offset``. Sets the value to ``0`` when " "information is not available for any particular element." msgstr "" -#: ../../c-api/code.rst:102 +#: ../../c-api/code.rst:108 msgid "Returns ``1`` if the function succeeds and 0 otherwise." msgstr "" -#: ../../c-api/code.rst:108 +#: ../../c-api/code.rst:114 msgid "" "Equivalent to the Python code ``getattr(co, 'co_code')``. Returns a strong " "reference to a :c:type:`PyBytesObject` representing the bytecode in a code " "object. On error, ``NULL`` is returned and an exception is raised." msgstr "" -#: ../../c-api/code.rst:113 +#: ../../c-api/code.rst:119 msgid "" "This ``PyBytesObject`` may be created on-demand by the interpreter and does " "not necessarily represent the bytecode actually executed by CPython. The " "primary use case for this function is debuggers and profilers." msgstr "" -#: ../../c-api/code.rst:121 +#: ../../c-api/code.rst:127 msgid "" "Equivalent to the Python code ``getattr(co, 'co_varnames')``. Returns a new " "reference to a :c:type:`PyTupleObject` containing the names of the local " "variables. On error, ``NULL`` is returned and an exception is raised." msgstr "" -#: ../../c-api/code.rst:130 +#: ../../c-api/code.rst:136 msgid "" "Equivalent to the Python code ``getattr(co, 'co_cellvars')``. Returns a new " "reference to a :c:type:`PyTupleObject` containing the names of the local " @@ -165,14 +172,14 @@ msgid "" "returned and an exception is raised." msgstr "" -#: ../../c-api/code.rst:139 +#: ../../c-api/code.rst:145 msgid "" "Equivalent to the Python code ``getattr(co, 'co_freevars')``. Returns a new " "reference to a :c:type:`PyTupleObject` containing the names of the free " "variables. On error, ``NULL`` is returned and an exception is raised." msgstr "" -#: ../../c-api/code.rst:147 +#: ../../c-api/code.rst:153 msgid "" "Register *callback* as a code object watcher for the current interpreter. " "Return an ID which may be passed to :c:func:`PyCode_ClearWatcher`. In case " @@ -180,7 +187,7 @@ msgid "" "exception." msgstr "" -#: ../../c-api/code.rst:156 +#: ../../c-api/code.rst:162 msgid "" "Clear watcher identified by *watcher_id* previously returned from :c:func:" "`PyCode_AddWatcher` for the current interpreter. Return ``0`` on success, or " @@ -188,17 +195,17 @@ msgid "" "never registered.)" msgstr "" -#: ../../c-api/code.rst:165 +#: ../../c-api/code.rst:171 msgid "" "Enumeration of possible code object watcher events: - " "``PY_CODE_EVENT_CREATE`` - ``PY_CODE_EVENT_DESTROY``" msgstr "" -#: ../../c-api/code.rst:173 +#: ../../c-api/code.rst:179 msgid "Type of a code object watcher callback function." msgstr "" -#: ../../c-api/code.rst:175 +#: ../../c-api/code.rst:181 msgid "" "If *event* is ``PY_CODE_EVENT_CREATE``, then the callback is invoked after " "`co` has been fully initialized. Otherwise, the callback is invoked before " @@ -206,7 +213,7 @@ msgid "" "inspected." msgstr "" -#: ../../c-api/code.rst:180 +#: ../../c-api/code.rst:186 msgid "" "If *event* is ``PY_CODE_EVENT_DESTROY``, taking a reference in the callback " "to the about-to-be-destroyed code object will resurrect it and prevent it " @@ -214,7 +221,7 @@ msgid "" "later, any watcher callbacks active at that time will be called again." msgstr "" -#: ../../c-api/code.rst:185 +#: ../../c-api/code.rst:191 msgid "" "Users of this API should not rely on internal runtime implementation " "details. Such details may include, but are not limited to, the exact order " @@ -224,14 +231,14 @@ msgid "" "the Python code being executed." msgstr "" -#: ../../c-api/code.rst:192 +#: ../../c-api/code.rst:198 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " "will be printed as an unraisable exception using :c:func:" "`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -#: ../../c-api/code.rst:196 +#: ../../c-api/code.rst:202 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " @@ -240,85 +247,85 @@ msgid "" "it before returning." msgstr "" -#: ../../c-api/code.rst:206 +#: ../../c-api/code.rst:212 msgid "Extra information" msgstr "" -#: ../../c-api/code.rst:208 +#: ../../c-api/code.rst:214 msgid "" "To support low-level extensions to frame evaluation, such as external just-" "in-time compilers, it is possible to attach arbitrary extra data to code " "objects." msgstr "" -#: ../../c-api/code.rst:212 +#: ../../c-api/code.rst:218 msgid "" "These functions are part of the unstable C API tier: this functionality is a " "CPython implementation detail, and the API may change without deprecation " "warnings." msgstr "" -#: ../../c-api/code.rst:218 +#: ../../c-api/code.rst:224 msgid "Return a new an opaque index value used to adding data to code objects." msgstr "" -#: ../../c-api/code.rst:220 +#: ../../c-api/code.rst:226 msgid "" "You generally call this function once (per interpreter) and use the result " "with ``PyCode_GetExtra`` and ``PyCode_SetExtra`` to manipulate data on " "individual code objects." msgstr "" -#: ../../c-api/code.rst:224 +#: ../../c-api/code.rst:230 msgid "" "If *free* is not ``NULL``: when a code object is deallocated, *free* will be " "called on non-``NULL`` data stored under the new index. Use :c:func:" "`Py_DecRef` when storing :c:type:`PyObject`." msgstr "" -#: ../../c-api/code.rst:230 +#: ../../c-api/code.rst:236 msgid "as ``_PyEval_RequestCodeExtraIndex``" msgstr "" -#: ../../c-api/code.rst:234 +#: ../../c-api/code.rst:240 msgid "" "Renamed to ``PyUnstable_Eval_RequestCodeExtraIndex``. The old private name " "is deprecated, but will be available until the API changes." msgstr "" -#: ../../c-api/code.rst:240 +#: ../../c-api/code.rst:246 msgid "" "Set *extra* to the extra data stored under the given index. Return 0 on " "success. Set an exception and return -1 on failure." msgstr "" -#: ../../c-api/code.rst:243 +#: ../../c-api/code.rst:249 msgid "" "If no data was set under the index, set *extra* to ``NULL`` and return 0 " "without setting an exception." msgstr "" -#: ../../c-api/code.rst:248 +#: ../../c-api/code.rst:254 msgid "as ``_PyCode_GetExtra``" msgstr "" -#: ../../c-api/code.rst:252 +#: ../../c-api/code.rst:258 msgid "" "Renamed to ``PyUnstable_Code_GetExtra``. The old private name is deprecated, " "but will be available until the API changes." msgstr "" -#: ../../c-api/code.rst:258 +#: ../../c-api/code.rst:264 msgid "" "Set the extra data stored under the given index to *extra*. Return 0 on " "success. Set an exception and return -1 on failure." msgstr "" -#: ../../c-api/code.rst:263 +#: ../../c-api/code.rst:269 msgid "as ``_PyCode_SetExtra``" msgstr "" -#: ../../c-api/code.rst:267 +#: ../../c-api/code.rst:273 msgid "" "Renamed to ``PyUnstable_Code_SetExtra``. The old private name is deprecated, " "but will be available until the API changes." @@ -336,22 +343,22 @@ msgstr "code(程式碼)" msgid "code object" msgstr "code object(程式碼物件)" -#: ../../c-api/code.rst:56 +#: ../../c-api/code.rst:62 msgid "PyCode_New (C function)" msgstr "PyCode_New(C 函式)" -#: ../../c-api/code.rst:69 +#: ../../c-api/code.rst:75 msgid "PyCode_NewWithPosOnlyArgs (C function)" msgstr "PyCode_NewWithPosOnlyArgs(C 函式)" -#: ../../c-api/code.rst:228 +#: ../../c-api/code.rst:234 msgid "_PyEval_RequestCodeExtraIndex (C function)" msgstr "_PyEval_RequestCodeExtraIndex(C 函式)" -#: ../../c-api/code.rst:246 +#: ../../c-api/code.rst:252 msgid "_PyCode_GetExtra (C function)" msgstr "_PyCode_GetExtra(C 函式)" -#: ../../c-api/code.rst:261 +#: ../../c-api/code.rst:267 msgid "_PyCode_SetExtra (C function)" msgstr "_PyCode_SetExtra(C 函式)" diff --git a/c-api/codec.po b/c-api/codec.po index 68de1f7702..3cd05b00bc 100644 --- a/c-api/codec.po +++ b/c-api/codec.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 00:03+0000\n" "PO-Revision-Date: 2023-07-24 17:51+0000\n" diff --git a/c-api/complex.po b/c-api/complex.po index 8d905e1455..a6448fac77 100644 --- a/c-api/complex.po +++ b/c-api/complex.po @@ -5,9 +5,9 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -181,6 +181,19 @@ msgid "Return the real part of *op* as a C :c:expr:`double`." msgstr "以 C 的 :c:expr:`double` 形式回傳 *op* 的實部。" #: ../../c-api/complex.rst:126 +#, fuzzy +msgid "" +"If *op* is not a Python complex number object but has a :meth:`~object." +"__complex__` method, this method will first be called to convert *op* to a " +"Python complex number object. If :meth:`!__complex__` is not defined then " +"it falls back to call :c:func:`PyFloat_AsDouble` and returns its result." +msgstr "" +"如果 *op* 不是 Python 複數物件,但有一個 :meth:`~object.__complex__` 方法,則" +"首先會呼叫該方法將 *op* 轉換為 Python 複數物件。如果 :meth:`!__complex__` 並" +"未定義,那麼它會回退到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未" +"定義,則它將繼續回退為 :meth:`~object.__index__`。" + +#: ../../c-api/complex.rst:132 ../../c-api/complex.rst:148 msgid "" "Upon failure, this method returns ``-1.0`` with an exception set, so one " "should call :c:func:`PyErr_Occurred` to check for errors." @@ -188,15 +201,33 @@ msgstr "" "失敗時,此方法回傳 ``-1.0`` 並設定例外,因此應該呼叫 :c:func:" "`PyErr_Occurred` 來檢查錯誤。" -#: ../../c-api/complex.rst:132 +#: ../../c-api/complex.rst:135 ../../c-api/complex.rst:151 +msgid "Use :meth:`~object.__complex__` if available." +msgstr "如果可用則使用 :meth:`~object.__complex__`。" + +#: ../../c-api/complex.rst:140 msgid "Return the imaginary part of *op* as a C :c:expr:`double`." msgstr "將 *op* 的虛部作為 C 的 :c:expr:`double` 回傳。" -#: ../../c-api/complex.rst:137 +#: ../../c-api/complex.rst:142 +#, fuzzy +msgid "" +"If *op* is not a Python complex number object but has a :meth:`~object." +"__complex__` method, this method will first be called to convert *op* to a " +"Python complex number object. If :meth:`!__complex__` is not defined then " +"it falls back to call :c:func:`PyFloat_AsDouble` and returns ``0.0`` on " +"success." +msgstr "" +"如果 *op* 不是 Python 複數物件,但有一個 :meth:`~object.__complex__` 方法,則" +"首先會呼叫該方法將 *op* 轉換為 Python 複數物件。如果 :meth:`!__complex__` 並" +"未定義,那麼它會回退到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未" +"定義,則它將繼續回退為 :meth:`~object.__index__`。" + +#: ../../c-api/complex.rst:156 msgid "Return the :c:type:`Py_complex` value of the complex number *op*." msgstr "回傳複數 *op* 的 :c:type:`Py_complex` 值。" -#: ../../c-api/complex.rst:139 +#: ../../c-api/complex.rst:158 msgid "" "If *op* is not a Python complex number object but has a :meth:`~object." "__complex__` method, this method will first be called to convert *op* to a " @@ -209,7 +240,7 @@ msgstr "" "未定義,那麼它會回退到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未" "定義,則它將繼續回退為 :meth:`~object.__index__`。" -#: ../../c-api/complex.rst:145 +#: ../../c-api/complex.rst:164 msgid "" "Upon failure, this method returns :c:type:`Py_complex` with :c:member:" "`~Py_complex.real` set to ``-1.0`` and with an exception set, so one should " @@ -218,7 +249,7 @@ msgstr "" "失敗時,此方法回傳 :c:type:`Py_complex` 並將 :c:member:`~Py_complex.real` 設" "為 ``-1.0``,並設定例外,因此應該呼叫 :c:func:`PyErr_Occurred` 來檢查錯誤。" -#: ../../c-api/complex.rst:149 +#: ../../c-api/complex.rst:168 msgid "Use :meth:`~object.__index__` if available." msgstr "如果可用則使用 :meth:`~object.__index__`。" diff --git a/c-api/concrete.po b/c-api/concrete.po index 4db03592ba..cafd42eadc 100644 --- a/c-api/concrete.po +++ b/c-api/concrete.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" "PO-Revision-Date: 2022-11-13 20:37+0800\n" diff --git a/c-api/contextvars.po b/c-api/contextvars.po index 1f5674b054..8e7184e42d 100644 --- a/c-api/contextvars.po +++ b/c-api/contextvars.po @@ -3,7 +3,7 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" diff --git a/c-api/conversion.po b/c-api/conversion.po index d7c2b52620..a8c2e00699 100644 --- a/c-api/conversion.po +++ b/c-api/conversion.po @@ -7,7 +7,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-01-27 00:03+0000\n" "PO-Revision-Date: 2023-12-11 18:26+0000\n" diff --git a/c-api/coro.po b/c-api/coro.po index 5d375aa714..1a5f027a6d 100644 --- a/c-api/coro.po +++ b/c-api/coro.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-13 00:11+0000\n" "PO-Revision-Date: 2021-12-09 21:15+0800\n" diff --git a/c-api/datetime.po b/c-api/datetime.po index e2e8158f5d..aca575f97c 100644 --- a/c-api/datetime.po +++ b/c-api/datetime.po @@ -8,7 +8,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-08-22 00:03+0000\n" "PO-Revision-Date: 2023-07-01 04:14+0800\n" diff --git a/c-api/descriptor.po b/c-api/descriptor.po index 4a8d94a8d2..314623827e 100644 --- a/c-api/descriptor.po +++ b/c-api/descriptor.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-10-26 16:47+0000\n" "PO-Revision-Date: 2021-12-09 20:56+0800\n" diff --git a/c-api/dict.po b/c-api/dict.po index e696336c09..5a9c30db1f 100644 --- a/c-api/dict.po +++ b/c-api/dict.po @@ -7,9 +7,9 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -66,7 +66,7 @@ msgstr "" #: ../../c-api/dict.rst:48 msgid "Empty an existing dictionary of all key-value pairs." -msgstr "" +msgstr "清空現有字典中的所有鍵值對。" #: ../../c-api/dict.rst:53 msgid "" @@ -76,10 +76,17 @@ msgid "" msgstr "" #: ../../c-api/dict.rst:60 +msgid "" +"This is the same as :c:func:`PyDict_Contains`, but *key* is specified as a :" +"c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" +"`PyObject*`." +msgstr "" + +#: ../../c-api/dict.rst:69 msgid "Return a new dictionary that contains the same key-value pairs as *p*." msgstr "" -#: ../../c-api/dict.rst:65 +#: ../../c-api/dict.rst:74 msgid "" "Insert *val* into the dictionary *p* with a key of *key*. *key* must be :" "term:`hashable`; if it isn't, :exc:`TypeError` will be raised. Return ``0`` " @@ -87,14 +94,14 @@ msgid "" "to *val*." msgstr "" -#: ../../c-api/dict.rst:73 +#: ../../c-api/dict.rst:82 msgid "" "This is the same as :c:func:`PyDict_SetItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/dict.rst:80 +#: ../../c-api/dict.rst:89 msgid "" "Remove the entry in dictionary *p* with key *key*. *key* must be :term:" "`hashable`; if it isn't, :exc:`TypeError` is raised. If *key* is not in the " @@ -102,47 +109,72 @@ msgid "" "failure." msgstr "" -#: ../../c-api/dict.rst:88 +#: ../../c-api/dict.rst:97 msgid "" "This is the same as :c:func:`PyDict_DelItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/dict.rst:95 +#: ../../c-api/dict.rst:104 +msgid "" +"Return a new :term:`strong reference` to the object from dictionary *p* " +"which has a key *key*:" +msgstr "" + +#: ../../c-api/dict.rst:107 +msgid "" +"If the key is present, set *\\*result* to a new :term:`strong reference` to " +"the value and return ``1``." +msgstr "" + +#: ../../c-api/dict.rst:109 +msgid "If the key is missing, set *\\*result* to ``NULL`` and return ``0``." +msgstr "" + +#: ../../c-api/dict.rst:110 ../../c-api/dict.rst:207 +msgid "On error, raise an exception and return ``-1``." +msgstr "" + +#: ../../c-api/dict.rst:114 +msgid "See also the :c:func:`PyObject_GetItem` function." +msgstr "" + +#: ../../c-api/dict.rst:119 msgid "" -"Return the object from dictionary *p* which has a key *key*. Return " -"``NULL`` if the key *key* is not present, but *without* setting an exception." +"Return a :term:`borrowed reference` to the object from dictionary *p* which " +"has a key *key*. Return ``NULL`` if the key *key* is missing *without* " +"setting an exception." msgstr "" -#: ../../c-api/dict.rst:100 +#: ../../c-api/dict.rst:125 msgid "" "Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" "`~object.__eq__` methods are silently ignored. Prefer the :c:func:" "`PyDict_GetItemWithError` function instead." msgstr "" -#: ../../c-api/dict.rst:104 +#: ../../c-api/dict.rst:129 msgid "" "Calling this API without :term:`GIL` held had been allowed for historical " "reason. It is no longer allowed." msgstr "" -#: ../../c-api/dict.rst:111 +#: ../../c-api/dict.rst:136 msgid "" "Variant of :c:func:`PyDict_GetItem` that does not suppress exceptions. " "Return ``NULL`` **with** an exception set if an exception occurred. Return " "``NULL`` **without** an exception set if the key wasn't present." msgstr "" -#: ../../c-api/dict.rst:119 +#: ../../c-api/dict.rst:144 msgid "" "This is the same as :c:func:`PyDict_GetItem`, but *key* is specified as a :c:" "expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/dict.rst:125 +#: ../../c-api/dict.rst:150 msgid "" "Exceptions that occur while this calls :meth:`~object.__hash__` and :meth:" "`~object.__eq__` methods or while creating the temporary :class:`str` object " @@ -150,7 +182,14 @@ msgid "" "function with your own :c:func:`PyUnicode_FromString` *key* instead." msgstr "" -#: ../../c-api/dict.rst:134 +#: ../../c-api/dict.rst:159 +msgid "" +"Similar than :c:func:`PyDict_GetItemRef`, but *key* is specified as a :c:" +"expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" +"`PyObject*`." +msgstr "" + +#: ../../c-api/dict.rst:168 msgid "" "This is the same as the Python-level :meth:`dict.setdefault`. If present, " "it returns the value corresponding to *key* from the dictionary *p*. If the " @@ -160,29 +199,79 @@ msgid "" "the insertion." msgstr "" -#: ../../c-api/dict.rst:144 +#: ../../c-api/dict.rst:179 +msgid "" +"Inserts *default_value* into the dictionary *p* with a key of *key* if the " +"key is not already present in the dictionary. If *result* is not ``NULL``, " +"then *\\*result* is set to a :term:`strong reference` to either " +"*default_value*, if the key was not present, or the existing value, if *key* " +"was already present in the dictionary. Returns ``1`` if the key was present " +"and *default_value* was not inserted, or ``0`` if the key was not present " +"and *default_value* was inserted. On failure, returns ``-1``, sets an " +"exception, and sets ``*result`` to ``NULL``." +msgstr "" + +#: ../../c-api/dict.rst:189 +msgid "" +"For clarity: if you have a strong reference to *default_value* before " +"calling this function, then after it returns, you hold a strong reference to " +"both *default_value* and *\\*result* (if it's not ``NULL``). These may refer " +"to the same object: in that case you hold two separate references to it." +msgstr "" + +#: ../../c-api/dict.rst:200 +msgid "" +"Remove *key* from dictionary *p* and optionally return the removed value. Do " +"not raise :exc:`KeyError` if the key missing." +msgstr "" + +#: ../../c-api/dict.rst:203 +msgid "" +"If the key is present, set *\\*result* to a new reference to the removed " +"value if *result* is not ``NULL``, and return ``1``." +msgstr "" + +#: ../../c-api/dict.rst:205 +msgid "" +"If the key is missing, set *\\*result* to ``NULL`` if *result* is not " +"``NULL``, and return ``0``." +msgstr "" + +#: ../../c-api/dict.rst:209 +msgid "" +"This is similar to :meth:`dict.pop`, but without the default value and not " +"raising :exc:`KeyError` if the key missing." +msgstr "" + +#: ../../c-api/dict.rst:217 +msgid "" +"Similar to :c:func:`PyDict_Pop`, but *key* is specified as a :c:expr:`const " +"char*` UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`." +msgstr "" + +#: ../../c-api/dict.rst:226 msgid "" "Return a :c:type:`PyListObject` containing all the items from the dictionary." msgstr "" -#: ../../c-api/dict.rst:149 +#: ../../c-api/dict.rst:231 msgid "" "Return a :c:type:`PyListObject` containing all the keys from the dictionary." msgstr "" -#: ../../c-api/dict.rst:154 +#: ../../c-api/dict.rst:236 msgid "" "Return a :c:type:`PyListObject` containing all the values from the " "dictionary *p*." msgstr "" -#: ../../c-api/dict.rst:162 +#: ../../c-api/dict.rst:244 msgid "" "Return the number of items in the dictionary. This is equivalent to " "``len(p)`` on a dictionary." msgstr "" -#: ../../c-api/dict.rst:168 +#: ../../c-api/dict.rst:250 msgid "" "Iterate over all key-value pairs in the dictionary *p*. The :c:type:" "`Py_ssize_t` referred to by *ppos* must be initialized to ``0`` prior to the " @@ -196,11 +285,11 @@ msgid "" "structure is sparse, the offsets are not consecutive." msgstr "" -#: ../../c-api/dict.rst:179 +#: ../../c-api/dict.rst:261 msgid "For example::" msgstr "舉例來說: ::" -#: ../../c-api/dict.rst:181 +#: ../../c-api/dict.rst:263 msgid "" "PyObject *key, *value;\n" "Py_ssize_t pos = 0;\n" @@ -211,14 +300,14 @@ msgid "" "}" msgstr "" -#: ../../c-api/dict.rst:189 +#: ../../c-api/dict.rst:271 msgid "" "The dictionary *p* should not be mutated during iteration. It is safe to " "modify the values of the keys as you iterate over the dictionary, but only " "so long as the set of keys does not change. For example::" msgstr "" -#: ../../c-api/dict.rst:193 +#: ../../c-api/dict.rst:275 msgid "" "PyObject *key, *value;\n" "Py_ssize_t pos = 0;\n" @@ -256,7 +345,23 @@ msgstr "" " Py_DECREF(o);\n" "}" -#: ../../c-api/dict.rst:214 +#: ../../c-api/dict.rst:293 +msgid "" +"The function is not thread-safe in the :term:`free-threaded ` build without external synchronization. You can use :c:macro:" +"`Py_BEGIN_CRITICAL_SECTION` to lock the dictionary while iterating over it::" +msgstr "" + +#: ../../c-api/dict.rst:298 +msgid "" +"Py_BEGIN_CRITICAL_SECTION(self->dict);\n" +"while (PyDict_Next(self->dict, &pos, &key, &value)) {\n" +" ...\n" +"}\n" +"Py_END_CRITICAL_SECTION();" +msgstr "" + +#: ../../c-api/dict.rst:307 msgid "" "Iterate over mapping object *b* adding key-value pairs to dictionary *a*. " "*b* may be a dictionary, or any object supporting :c:func:`PyMapping_Keys` " @@ -266,7 +371,7 @@ msgid "" "or ``-1`` if an exception was raised." msgstr "" -#: ../../c-api/dict.rst:224 +#: ../../c-api/dict.rst:317 msgid "" "This is the same as ``PyDict_Merge(a, b, 1)`` in C, and is similar to ``a." "update(b)`` in Python except that :c:func:`PyDict_Update` doesn't fall back " @@ -275,7 +380,7 @@ msgid "" "exception was raised." msgstr "" -#: ../../c-api/dict.rst:233 +#: ../../c-api/dict.rst:326 msgid "" "Update or merge into dictionary *a*, from the key-value pairs in *seq2*. " "*seq2* must be an iterable object producing iterable objects of length 2, " @@ -284,7 +389,7 @@ msgid "" "if an exception was raised. Equivalent Python (except for the return value)::" msgstr "" -#: ../../c-api/dict.rst:240 +#: ../../c-api/dict.rst:333 msgid "" "def PyDict_MergeFromSeq2(a, seq2, override):\n" " for key, value in seq2:\n" @@ -296,7 +401,7 @@ msgstr "" " if override or key not in a:\n" " a[key] = value" -#: ../../c-api/dict.rst:247 +#: ../../c-api/dict.rst:340 msgid "" "Register *callback* as a dictionary watcher. Return a non-negative integer " "id which must be passed to future calls to :c:func:`PyDict_Watch`. In case " @@ -304,21 +409,21 @@ msgid "" "exception." msgstr "" -#: ../../c-api/dict.rst:256 +#: ../../c-api/dict.rst:349 msgid "" "Clear watcher identified by *watcher_id* previously returned from :c:func:" "`PyDict_AddWatcher`. Return ``0`` on success, ``-1`` on error (e.g. if the " "given *watcher_id* was never registered.)" msgstr "" -#: ../../c-api/dict.rst:264 +#: ../../c-api/dict.rst:357 msgid "" "Mark dictionary *dict* as watched. The callback granted *watcher_id* by :c:" "func:`PyDict_AddWatcher` will be called when *dict* is modified or " "deallocated. Return ``0`` on success or ``-1`` on error." msgstr "" -#: ../../c-api/dict.rst:272 +#: ../../c-api/dict.rst:365 msgid "" "Mark dictionary *dict* as no longer watched. The callback granted " "*watcher_id* by :c:func:`PyDict_AddWatcher` will no longer be called when " @@ -326,7 +431,7 @@ msgid "" "watched by this watcher. Return ``0`` on success or ``-1`` on error." msgstr "" -#: ../../c-api/dict.rst:281 +#: ../../c-api/dict.rst:374 msgid "" "Enumeration of possible dictionary watcher events: ``PyDict_EVENT_ADDED``, " "``PyDict_EVENT_MODIFIED``, ``PyDict_EVENT_DELETED``, " @@ -334,11 +439,11 @@ msgid "" "``PyDict_EVENT_DEALLOCATED``." msgstr "" -#: ../../c-api/dict.rst:289 +#: ../../c-api/dict.rst:382 msgid "Type of a dict watcher callback function." msgstr "" -#: ../../c-api/dict.rst:291 +#: ../../c-api/dict.rst:384 msgid "" "If *event* is ``PyDict_EVENT_CLEARED`` or ``PyDict_EVENT_DEALLOCATED``, both " "*key* and *new_value* will be ``NULL``. If *event* is ``PyDict_EVENT_ADDED`` " @@ -347,7 +452,7 @@ msgid "" "dictionary and *new_value* will be ``NULL``." msgstr "" -#: ../../c-api/dict.rst:297 +#: ../../c-api/dict.rst:390 msgid "" "``PyDict_EVENT_CLONED`` occurs when *dict* was previously empty and another " "dict is merged into it. To maintain efficiency of this operation, per-key " @@ -355,14 +460,14 @@ msgid "" "``PyDict_EVENT_CLONED`` is issued, and *key* will be the source dictionary." msgstr "" -#: ../../c-api/dict.rst:303 +#: ../../c-api/dict.rst:396 msgid "" "The callback may inspect but must not modify *dict*; doing so could have " "unpredictable effects, including infinite recursion. Do not trigger Python " "code execution in the callback, as it could modify the dict as a side effect." msgstr "" -#: ../../c-api/dict.rst:307 +#: ../../c-api/dict.rst:400 msgid "" "If *event* is ``PyDict_EVENT_DEALLOCATED``, taking a new reference in the " "callback to the about-to-be-destroyed dictionary will resurrect it and " @@ -371,20 +476,20 @@ msgid "" "again." msgstr "" -#: ../../c-api/dict.rst:313 +#: ../../c-api/dict.rst:406 msgid "" "Callbacks occur before the notified modification to *dict* takes place, so " "the prior state of *dict* can be inspected." msgstr "" -#: ../../c-api/dict.rst:316 +#: ../../c-api/dict.rst:409 msgid "" "If the callback sets an exception, it must return ``-1``; this exception " "will be printed as an unraisable exception using :c:func:" "`PyErr_WriteUnraisable`. Otherwise it should return ``0``." msgstr "" -#: ../../c-api/dict.rst:320 +#: ../../c-api/dict.rst:413 msgid "" "There may already be a pending exception set on entry to the callback. In " "this case, the callback should return ``0`` with the same exception still " @@ -401,11 +506,11 @@ msgstr "object(物件)" msgid "dictionary" msgstr "dictionary(字典)" -#: ../../c-api/dict.rst:160 +#: ../../c-api/dict.rst:242 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/dict.rst:160 +#: ../../c-api/dict.rst:242 msgid "len" msgstr "len" diff --git a/c-api/exceptions.po b/c-api/exceptions.po index 9c9a07f5a1..faaa283f82 100644 --- a/c-api/exceptions.po +++ b/c-api/exceptions.po @@ -6,9 +6,9 @@ # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -143,22 +143,31 @@ msgstr "使用 :func:`sys.unraisablehook`。" #: ../../c-api/exceptions.rst:104 msgid "" +"Similar to :c:func:`PyErr_WriteUnraisable`, but the *format* and subsequent " +"parameters help format the warning message; they have the same meaning and " +"values as in :c:func:`PyUnicode_FromFormat`. ``PyErr_WriteUnraisable(obj)`` " +"is roughly equivalent to ``PyErr_FormatUnraisable(\"Exception ignored in: " +"%R\", obj)``. If *format* is ``NULL``, only the traceback is printed." +msgstr "" + +#: ../../c-api/exceptions.rst:116 +msgid "" "Print the standard traceback display of ``exc`` to ``sys.stderr``, including " "chained exceptions and notes." msgstr "" -#: ../../c-api/exceptions.rst:110 +#: ../../c-api/exceptions.rst:123 msgid "Raising exceptions" msgstr "" -#: ../../c-api/exceptions.rst:112 +#: ../../c-api/exceptions.rst:125 msgid "" "These functions help you set the current thread's error indicator. For " "convenience, some of these functions will always return a ``NULL`` pointer " "for use in a ``return`` statement." msgstr "" -#: ../../c-api/exceptions.rst:119 +#: ../../c-api/exceptions.rst:132 msgid "" "This is the most common way to set the error indicator. The first argument " "specifies the exception type; it is normally one of the standard exceptions, " @@ -167,13 +176,13 @@ msgid "" "error message; it is decoded from ``'utf-8'``." msgstr "" -#: ../../c-api/exceptions.rst:128 +#: ../../c-api/exceptions.rst:141 msgid "" "This function is similar to :c:func:`PyErr_SetString` but lets you specify " "an arbitrary Python object for the \"value\" of the exception." msgstr "" -#: ../../c-api/exceptions.rst:134 +#: ../../c-api/exceptions.rst:147 msgid "" "This function sets the error indicator and returns ``NULL``. *exception* " "should be a Python exception class. The *format* and subsequent parameters " @@ -181,31 +190,31 @@ msgid "" "c:func:`PyUnicode_FromFormat`. *format* is an ASCII-encoded string." msgstr "" -#: ../../c-api/exceptions.rst:143 +#: ../../c-api/exceptions.rst:156 msgid "" "Same as :c:func:`PyErr_Format`, but taking a :c:type:`va_list` argument " "rather than a variable number of arguments." msgstr "" -#: ../../c-api/exceptions.rst:151 +#: ../../c-api/exceptions.rst:164 msgid "This is a shorthand for ``PyErr_SetObject(type, Py_None)``." msgstr "" -#: ../../c-api/exceptions.rst:156 +#: ../../c-api/exceptions.rst:169 msgid "" "This is a shorthand for ``PyErr_SetString(PyExc_TypeError, message)``, where " "*message* indicates that a built-in operation was invoked with an illegal " "argument. It is mostly for internal use." msgstr "" -#: ../../c-api/exceptions.rst:163 +#: ../../c-api/exceptions.rst:176 msgid "" "This is a shorthand for ``PyErr_SetNone(PyExc_MemoryError)``; it returns " "``NULL`` so an object allocation function can write ``return " "PyErr_NoMemory();`` when it runs out of memory." msgstr "" -#: ../../c-api/exceptions.rst:172 +#: ../../c-api/exceptions.rst:185 msgid "" "This is a convenience function to raise an exception when a C library " "function has returned an error and set the C variable :c:data:`errno`. It " @@ -219,7 +228,7 @@ msgid "" "``return PyErr_SetFromErrno(type);`` when the system call returns an error." msgstr "" -#: ../../c-api/exceptions.rst:186 +#: ../../c-api/exceptions.rst:199 msgid "" "Similar to :c:func:`PyErr_SetFromErrno`, with the additional behavior that " "if *filenameObject* is not ``NULL``, it is passed to the constructor of " @@ -227,21 +236,21 @@ msgid "" "is used to define the :attr:`!filename` attribute of the exception instance." msgstr "" -#: ../../c-api/exceptions.rst:195 +#: ../../c-api/exceptions.rst:208 msgid "" "Similar to :c:func:`PyErr_SetFromErrnoWithFilenameObject`, but takes a " "second filename object, for raising errors when a function that takes two " "filenames fails." msgstr "" -#: ../../c-api/exceptions.rst:204 +#: ../../c-api/exceptions.rst:217 msgid "" "Similar to :c:func:`PyErr_SetFromErrnoWithFilenameObject`, but the filename " "is given as a C string. *filename* is decoded from the :term:`filesystem " "encoding and error handler`." msgstr "" -#: ../../c-api/exceptions.rst:211 +#: ../../c-api/exceptions.rst:224 msgid "" "This is a convenience function to raise :exc:`OSError`. If called with " "*ierr* of ``0``, the error code returned by a call to :c:func:`!" @@ -255,19 +264,19 @@ msgid "" "``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:221 ../../c-api/exceptions.rst:229 -#: ../../c-api/exceptions.rst:240 ../../c-api/exceptions.rst:250 -#: ../../c-api/exceptions.rst:258 ../../c-api/exceptions.rst:268 +#: ../../c-api/exceptions.rst:234 ../../c-api/exceptions.rst:242 +#: ../../c-api/exceptions.rst:253 ../../c-api/exceptions.rst:263 +#: ../../c-api/exceptions.rst:271 ../../c-api/exceptions.rst:281 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../c-api/exceptions.rst:226 +#: ../../c-api/exceptions.rst:239 msgid "" "Similar to :c:func:`PyErr_SetFromWindowsErr`, with an additional parameter " "specifying the exception type to be raised." msgstr "" -#: ../../c-api/exceptions.rst:234 +#: ../../c-api/exceptions.rst:247 msgid "" "Similar to :c:func:`PyErr_SetFromWindowsErr`, with the additional behavior " "that if *filename* is not ``NULL``, it is decoded from the filesystem " @@ -276,7 +285,7 @@ msgid "" "attribute of the exception instance." msgstr "" -#: ../../c-api/exceptions.rst:245 +#: ../../c-api/exceptions.rst:258 msgid "" "Similar to :c:func:`PyErr_SetExcFromWindowsErr`, with the additional " "behavior that if *filename* is not ``NULL``, it is passed to the constructor " @@ -284,19 +293,19 @@ msgid "" "filename` attribute of the exception instance." msgstr "" -#: ../../c-api/exceptions.rst:255 +#: ../../c-api/exceptions.rst:268 msgid "" "Similar to :c:func:`PyErr_SetExcFromWindowsErrWithFilenameObject`, but " "accepts a second filename object." msgstr "" -#: ../../c-api/exceptions.rst:265 +#: ../../c-api/exceptions.rst:278 msgid "" "Similar to :c:func:`PyErr_SetFromWindowsErrWithFilename`, with an additional " "parameter specifying the exception type to be raised." msgstr "" -#: ../../c-api/exceptions.rst:273 +#: ../../c-api/exceptions.rst:286 msgid "" "This is a convenience function to raise :exc:`ImportError`. *msg* will be " "set as the exception's message string. *name* and *path*, both of which can " @@ -304,13 +313,13 @@ msgid "" "``path`` attributes." msgstr "" -#: ../../c-api/exceptions.rst:283 +#: ../../c-api/exceptions.rst:296 msgid "" "Much like :c:func:`PyErr_SetImportError` but this function allows for " "specifying a subclass of :exc:`ImportError` to raise." msgstr "" -#: ../../c-api/exceptions.rst:291 +#: ../../c-api/exceptions.rst:304 msgid "" "Set file, line, and offset information for the current exception. If the " "current exception is not a :exc:`SyntaxError`, then it sets additional " @@ -318,19 +327,19 @@ msgid "" "is a :exc:`SyntaxError`." msgstr "" -#: ../../c-api/exceptions.rst:301 +#: ../../c-api/exceptions.rst:314 msgid "" "Like :c:func:`PyErr_SyntaxLocationObject`, but *filename* is a byte string " "decoded from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/exceptions.rst:309 +#: ../../c-api/exceptions.rst:322 msgid "" "Like :c:func:`PyErr_SyntaxLocationEx`, but the *col_offset* parameter is " "omitted." msgstr "" -#: ../../c-api/exceptions.rst:315 +#: ../../c-api/exceptions.rst:328 msgid "" "This is a shorthand for ``PyErr_SetString(PyExc_SystemError, message)``, " "where *message* indicates that an internal operation (e.g. a Python/C API " @@ -338,11 +347,11 @@ msgid "" "use." msgstr "" -#: ../../c-api/exceptions.rst:322 +#: ../../c-api/exceptions.rst:335 msgid "Issuing warnings" msgstr "" -#: ../../c-api/exceptions.rst:324 +#: ../../c-api/exceptions.rst:337 msgid "" "Use these functions to issue warnings from C code. They mirror similar " "functions exported by the Python :mod:`warnings` module. They normally " @@ -358,7 +367,7 @@ msgid "" "return an error value)." msgstr "" -#: ../../c-api/exceptions.rst:339 +#: ../../c-api/exceptions.rst:352 msgid "" "Issue a warning message. The *category* argument is a warning category (see " "below) or ``NULL``; the *message* argument is a UTF-8 encoded string. " @@ -368,7 +377,7 @@ msgid "" "`PyErr_WarnEx`, 2 is the function above that, and so forth." msgstr "" -#: ../../c-api/exceptions.rst:346 +#: ../../c-api/exceptions.rst:359 msgid "" "Warning categories must be subclasses of :c:data:`PyExc_Warning`; :c:data:" "`PyExc_Warning` is a subclass of :c:data:`PyExc_Exception`; the default " @@ -377,14 +386,14 @@ msgid "" "enumerated at :ref:`standardwarningcategories`." msgstr "" -#: ../../c-api/exceptions.rst:352 +#: ../../c-api/exceptions.rst:365 msgid "" "For information about warning control, see the documentation for the :mod:" "`warnings` module and the :option:`-W` option in the command line " "documentation. There is no C API for warning control." msgstr "" -#: ../../c-api/exceptions.rst:359 +#: ../../c-api/exceptions.rst:372 msgid "" "Issue a warning message with explicit control over all warning attributes. " "This is a straightforward wrapper around the Python function :func:`warnings." @@ -392,32 +401,32 @@ msgid "" "arguments may be set to ``NULL`` to get the default effect described there." msgstr "" -#: ../../c-api/exceptions.rst:370 +#: ../../c-api/exceptions.rst:383 msgid "" "Similar to :c:func:`PyErr_WarnExplicitObject` except that *message* and " "*module* are UTF-8 encoded strings, and *filename* is decoded from the :term:" "`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/exceptions.rst:377 +#: ../../c-api/exceptions.rst:390 msgid "" "Function similar to :c:func:`PyErr_WarnEx`, but use :c:func:" "`PyUnicode_FromFormat` to format the warning message. *format* is an ASCII-" "encoded string." msgstr "" -#: ../../c-api/exceptions.rst:386 +#: ../../c-api/exceptions.rst:399 msgid "" "Function similar to :c:func:`PyErr_WarnFormat`, but *category* is :exc:" "`ResourceWarning` and it passes *source* to :class:`!warnings." "WarningMessage`." msgstr "" -#: ../../c-api/exceptions.rst:393 +#: ../../c-api/exceptions.rst:406 msgid "Querying the error indicator" msgstr "" -#: ../../c-api/exceptions.rst:397 +#: ../../c-api/exceptions.rst:410 msgid "" "Test whether the error indicator is set. If set, return the exception " "*type* (the first argument to the last call to one of the ``PyErr_Set*`` " @@ -426,11 +435,11 @@ msgid "" "`Py_DECREF` it." msgstr "" -#: ../../c-api/exceptions.rst:403 +#: ../../c-api/exceptions.rst:416 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/exceptions.rst:407 +#: ../../c-api/exceptions.rst:420 msgid "" "Do not compare the return value to a specific exception; use :c:func:" "`PyErr_ExceptionMatches` instead, shown below. (The comparison could easily " @@ -438,14 +447,14 @@ msgid "" "of a class exception, or it may be a subclass of the expected exception.)" msgstr "" -#: ../../c-api/exceptions.rst:415 +#: ../../c-api/exceptions.rst:428 msgid "" "Equivalent to ``PyErr_GivenExceptionMatches(PyErr_Occurred(), exc)``. This " "should only be called when an exception is actually set; a memory access " "violation will occur if no exception has been raised." msgstr "" -#: ../../c-api/exceptions.rst:422 +#: ../../c-api/exceptions.rst:435 msgid "" "Return true if the *given* exception matches the exception type in *exc*. " "If *exc* is a class object, this also returns true when *given* is an " @@ -453,23 +462,23 @@ msgid "" "tuple (and recursively in subtuples) are searched for a match." msgstr "" -#: ../../c-api/exceptions.rst:430 +#: ../../c-api/exceptions.rst:443 msgid "" "Return the exception currently being raised, clearing the error indicator at " "the same time. Return ``NULL`` if the error indicator is not set." msgstr "" -#: ../../c-api/exceptions.rst:433 +#: ../../c-api/exceptions.rst:446 msgid "" "This function is used by code that needs to catch exceptions, or code that " "needs to save and restore the error indicator temporarily." msgstr "" -#: ../../c-api/exceptions.rst:436 ../../c-api/exceptions.rst:480 +#: ../../c-api/exceptions.rst:449 ../../c-api/exceptions.rst:493 msgid "For example::" msgstr "舉例來說: ::" -#: ../../c-api/exceptions.rst:438 +#: ../../c-api/exceptions.rst:451 msgid "" "{\n" " PyObject *exc = PyErr_GetRaisedException();\n" @@ -480,27 +489,27 @@ msgid "" "}" msgstr "" -#: ../../c-api/exceptions.rst:446 +#: ../../c-api/exceptions.rst:459 msgid "" ":c:func:`PyErr_GetHandledException`, to save the exception currently being " "handled." msgstr "" -#: ../../c-api/exceptions.rst:454 +#: ../../c-api/exceptions.rst:467 msgid "" "Set *exc* as the exception currently being raised, clearing the existing " "exception if one is set." msgstr "" -#: ../../c-api/exceptions.rst:459 +#: ../../c-api/exceptions.rst:472 msgid "This call steals a reference to *exc*, which must be a valid exception." msgstr "" -#: ../../c-api/exceptions.rst:468 +#: ../../c-api/exceptions.rst:481 msgid "Use :c:func:`PyErr_GetRaisedException` instead." msgstr "" -#: ../../c-api/exceptions.rst:470 +#: ../../c-api/exceptions.rst:483 msgid "" "Retrieve the error indicator into three variables whose addresses are " "passed. If the error indicator is not set, set all three variables to " @@ -509,13 +518,13 @@ msgid "" "the type object is not." msgstr "" -#: ../../c-api/exceptions.rst:477 +#: ../../c-api/exceptions.rst:490 msgid "" "This function is normally only used by legacy code that needs to catch " "exceptions or save and restore the error indicator temporarily." msgstr "" -#: ../../c-api/exceptions.rst:482 +#: ../../c-api/exceptions.rst:495 msgid "" "{\n" " PyObject *type, *value, *traceback;\n" @@ -527,11 +536,11 @@ msgid "" "}" msgstr "" -#: ../../c-api/exceptions.rst:496 +#: ../../c-api/exceptions.rst:509 msgid "Use :c:func:`PyErr_SetRaisedException` instead." msgstr "" -#: ../../c-api/exceptions.rst:498 +#: ../../c-api/exceptions.rst:511 msgid "" "Set the error indicator from the three objects, *type*, *value*, and " "*traceback*, clearing the existing exception if one is set. If the objects " @@ -544,20 +553,20 @@ msgid "" "don't use this function. I warned you.)" msgstr "" -#: ../../c-api/exceptions.rst:512 +#: ../../c-api/exceptions.rst:525 msgid "" "This function is normally only used by legacy code that needs to save and " "restore the error indicator temporarily. Use :c:func:`PyErr_Fetch` to save " "the current error indicator." msgstr "" -#: ../../c-api/exceptions.rst:521 +#: ../../c-api/exceptions.rst:534 msgid "" "Use :c:func:`PyErr_GetRaisedException` instead, to avoid any possible de-" "normalization." msgstr "" -#: ../../c-api/exceptions.rst:524 +#: ../../c-api/exceptions.rst:537 msgid "" "Under certain circumstances, the values returned by :c:func:`PyErr_Fetch` " "below can be \"unnormalized\", meaning that ``*exc`` is a class object but " @@ -567,14 +576,14 @@ msgid "" "improve performance." msgstr "" -#: ../../c-api/exceptions.rst:532 +#: ../../c-api/exceptions.rst:545 msgid "" "This function *does not* implicitly set the :attr:`~BaseException." "__traceback__` attribute on the exception value. If setting the traceback " "appropriately is desired, the following additional snippet is needed::" msgstr "" -#: ../../c-api/exceptions.rst:537 +#: ../../c-api/exceptions.rst:550 msgid "" "if (tb != NULL) {\n" " PyException_SetTraceback(val, tb);\n" @@ -584,7 +593,7 @@ msgstr "" " PyException_SetTraceback(val, tb);\n" "}" -#: ../../c-api/exceptions.rst:544 +#: ../../c-api/exceptions.rst:557 msgid "" "Retrieve the active exception instance, as would be returned by :func:`sys." "exception`. This refers to an exception that was *already caught*, not to an " @@ -592,7 +601,7 @@ msgid "" "or ``NULL``. Does not modify the interpreter's exception state." msgstr "" -#: ../../c-api/exceptions.rst:551 +#: ../../c-api/exceptions.rst:564 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -600,14 +609,14 @@ msgid "" "clear the exception state." msgstr "" -#: ../../c-api/exceptions.rst:560 +#: ../../c-api/exceptions.rst:573 msgid "" "Set the active exception, as known from ``sys.exception()``. This refers to " "an exception that was *already caught*, not to an exception that was freshly " "raised. To clear the exception state, pass ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:567 +#: ../../c-api/exceptions.rst:580 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -615,7 +624,7 @@ msgid "" "exception state." msgstr "" -#: ../../c-api/exceptions.rst:576 +#: ../../c-api/exceptions.rst:589 msgid "" "Retrieve the old-style representation of the exception info, as known from :" "func:`sys.exc_info`. This refers to an exception that was *already caught*, " @@ -625,7 +634,7 @@ msgid "" "using :c:func:`PyErr_GetHandledException`." msgstr "" -#: ../../c-api/exceptions.rst:585 +#: ../../c-api/exceptions.rst:598 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -633,7 +642,7 @@ msgid "" "exception state." msgstr "" -#: ../../c-api/exceptions.rst:595 +#: ../../c-api/exceptions.rst:608 msgid "" "Set the exception info, as known from ``sys.exc_info()``. This refers to an " "exception that was *already caught*, not to an exception that was freshly " @@ -643,7 +652,7 @@ msgid "" "`PyErr_SetHandledException`." msgstr "" -#: ../../c-api/exceptions.rst:604 +#: ../../c-api/exceptions.rst:617 msgid "" "This function is not normally used by code that wants to handle exceptions. " "Rather, it can be used when code needs to save and restore the exception " @@ -651,22 +660,22 @@ msgid "" "state." msgstr "" -#: ../../c-api/exceptions.rst:611 +#: ../../c-api/exceptions.rst:624 msgid "" "The ``type`` and ``traceback`` arguments are no longer used and can be NULL. " "The interpreter now derives them from the exception instance (the ``value`` " "argument). The function still steals references of all three arguments." msgstr "" -#: ../../c-api/exceptions.rst:619 +#: ../../c-api/exceptions.rst:632 msgid "Signal Handling" msgstr "" -#: ../../c-api/exceptions.rst:629 +#: ../../c-api/exceptions.rst:642 msgid "This function interacts with Python's signal handling." msgstr "" -#: ../../c-api/exceptions.rst:631 +#: ../../c-api/exceptions.rst:644 msgid "" "If the function is called from the main thread and under the main Python " "interpreter, it checks whether a signal has been sent to the processes and " @@ -674,7 +683,7 @@ msgid "" "module is supported, this can invoke a signal handler written in Python." msgstr "" -#: ../../c-api/exceptions.rst:636 +#: ../../c-api/exceptions.rst:649 msgid "" "The function attempts to handle all pending signals, and then returns ``0``. " "However, if a Python signal handler raises an exception, the error indicator " @@ -683,44 +692,44 @@ msgid "" "`PyErr_CheckSignals()` invocation)." msgstr "" -#: ../../c-api/exceptions.rst:642 +#: ../../c-api/exceptions.rst:655 msgid "" "If the function is called from a non-main thread, or under a non-main Python " "interpreter, it does nothing and returns ``0``." msgstr "" -#: ../../c-api/exceptions.rst:645 +#: ../../c-api/exceptions.rst:658 msgid "" "This function can be called by long-running C code that wants to be " "interruptible by user requests (such as by pressing Ctrl-C)." msgstr "" -#: ../../c-api/exceptions.rst:649 +#: ../../c-api/exceptions.rst:662 msgid "" "The default Python signal handler for :c:macro:`!SIGINT` raises the :exc:" "`KeyboardInterrupt` exception." msgstr "" -#: ../../c-api/exceptions.rst:660 +#: ../../c-api/exceptions.rst:673 msgid "" "Simulate the effect of a :c:macro:`!SIGINT` signal arriving. This is " "equivalent to ``PyErr_SetInterruptEx(SIGINT)``." msgstr "" -#: ../../c-api/exceptions.rst:664 ../../c-api/exceptions.rst:691 +#: ../../c-api/exceptions.rst:677 ../../c-api/exceptions.rst:704 msgid "" "This function is async-signal-safe. It can be called without the :term:" "`GIL` and from a C signal handler." msgstr "" -#: ../../c-api/exceptions.rst:674 +#: ../../c-api/exceptions.rst:687 msgid "" "Simulate the effect of a signal arriving. The next time :c:func:" "`PyErr_CheckSignals` is called, the Python signal handler for the given " "signal number will be called." msgstr "" -#: ../../c-api/exceptions.rst:678 +#: ../../c-api/exceptions.rst:691 msgid "" "This function can be called by C code that sets up its own signal handling " "and wants Python signal handlers to be invoked as expected when an " @@ -728,27 +737,27 @@ msgid "" "interrupt an operation)." msgstr "" -#: ../../c-api/exceptions.rst:683 +#: ../../c-api/exceptions.rst:696 msgid "" "If the given signal isn't handled by Python (it was set to :py:const:`signal." "SIG_DFL` or :py:const:`signal.SIG_IGN`), it will be ignored." msgstr "" -#: ../../c-api/exceptions.rst:686 +#: ../../c-api/exceptions.rst:699 msgid "" "If *signum* is outside of the allowed range of signal numbers, ``-1`` is " "returned. Otherwise, ``0`` is returned. The error indicator is never " "changed by this function." msgstr "" -#: ../../c-api/exceptions.rst:699 +#: ../../c-api/exceptions.rst:712 msgid "" "This utility function specifies a file descriptor to which the signal number " "is written as a single byte whenever a signal is received. *fd* must be non-" "blocking. It returns the previous such file descriptor." msgstr "" -#: ../../c-api/exceptions.rst:703 +#: ../../c-api/exceptions.rst:716 msgid "" "The value ``-1`` disables the feature; this is the initial state. This is " "equivalent to :func:`signal.set_wakeup_fd` in Python, but without any error " @@ -756,15 +765,15 @@ msgid "" "be called from the main thread." msgstr "" -#: ../../c-api/exceptions.rst:708 +#: ../../c-api/exceptions.rst:721 msgid "On Windows, the function now also supports socket handles." msgstr "" -#: ../../c-api/exceptions.rst:713 +#: ../../c-api/exceptions.rst:726 msgid "Exception Classes" msgstr "例外類別" -#: ../../c-api/exceptions.rst:717 +#: ../../c-api/exceptions.rst:730 msgid "" "This utility function creates and returns a new exception class. The *name* " "argument must be the name of the new exception, a C string of the form " @@ -773,41 +782,41 @@ msgid "" "(accessible in C as :c:data:`PyExc_Exception`)." msgstr "" -#: ../../c-api/exceptions.rst:723 +#: ../../c-api/exceptions.rst:736 msgid "" -"The :attr:`!__module__` attribute of the new class is set to the first part " -"(up to the last dot) of the *name* argument, and the class name is set to " -"the last part (after the last dot). The *base* argument can be used to " +"The :attr:`~type.__module__` attribute of the new class is set to the first " +"part (up to the last dot) of the *name* argument, and the class name is set " +"to the last part (after the last dot). The *base* argument can be used to " "specify alternate base classes; it can either be only one class or a tuple " "of classes. The *dict* argument can be used to specify a dictionary of class " "variables and methods." msgstr "" -#: ../../c-api/exceptions.rst:732 +#: ../../c-api/exceptions.rst:745 msgid "" "Same as :c:func:`PyErr_NewException`, except that the new exception class " "can easily be given a docstring: If *doc* is non-``NULL``, it will be used " "as the docstring for the exception class." msgstr "" -#: ../../c-api/exceptions.rst:740 +#: ../../c-api/exceptions.rst:753 msgid "Exception Objects" msgstr "例外物件" -#: ../../c-api/exceptions.rst:744 +#: ../../c-api/exceptions.rst:757 msgid "" "Return the traceback associated with the exception as a new reference, as " "accessible from Python through the :attr:`~BaseException.__traceback__` " "attribute. If there is no traceback associated, this returns ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:752 +#: ../../c-api/exceptions.rst:765 msgid "" "Set the traceback associated with the exception to *tb*. Use ``Py_None`` to " "clear it." msgstr "" -#: ../../c-api/exceptions.rst:758 +#: ../../c-api/exceptions.rst:771 msgid "" "Return the context (another exception instance during whose handling *ex* " "was raised) associated with the exception as a new reference, as accessible " @@ -815,14 +824,14 @@ msgid "" "there is no context associated, this returns ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:766 +#: ../../c-api/exceptions.rst:779 msgid "" "Set the context associated with the exception to *ctx*. Use ``NULL`` to " "clear it. There is no type check to make sure that *ctx* is an exception " "instance. This steals a reference to *ctx*." msgstr "" -#: ../../c-api/exceptions.rst:773 +#: ../../c-api/exceptions.rst:786 msgid "" "Return the cause (either an exception instance, or ``None``, set by " "``raise ... from ...``) associated with the exception as a new reference, as " @@ -830,28 +839,28 @@ msgid "" "attribute." msgstr "" -#: ../../c-api/exceptions.rst:781 +#: ../../c-api/exceptions.rst:794 msgid "" "Set the cause associated with the exception to *cause*. Use ``NULL`` to " "clear it. There is no type check to make sure that *cause* is either an " "exception instance or ``None``. This steals a reference to *cause*." msgstr "" -#: ../../c-api/exceptions.rst:785 +#: ../../c-api/exceptions.rst:798 msgid "" "The :attr:`~BaseException.__suppress_context__` attribute is implicitly set " "to ``True`` by this function." msgstr "" -#: ../../c-api/exceptions.rst:791 +#: ../../c-api/exceptions.rst:804 msgid "Return :attr:`~BaseException.args` of exception *ex*." msgstr "" -#: ../../c-api/exceptions.rst:796 +#: ../../c-api/exceptions.rst:809 msgid "Set :attr:`~BaseException.args` of exception *ex* to *args*." msgstr "" -#: ../../c-api/exceptions.rst:800 +#: ../../c-api/exceptions.rst:813 msgid "" "Implement part of the interpreter's implementation of :keyword:`!except*`. " "*orig* is the original exception that was caught, and *excs* is the list of " @@ -863,72 +872,72 @@ msgid "" "if there is nothing to reraise." msgstr "" -#: ../../c-api/exceptions.rst:814 +#: ../../c-api/exceptions.rst:827 msgid "Unicode Exception Objects" msgstr "" -#: ../../c-api/exceptions.rst:816 +#: ../../c-api/exceptions.rst:829 msgid "" "The following functions are used to create and modify Unicode exceptions " "from C." msgstr "" -#: ../../c-api/exceptions.rst:820 +#: ../../c-api/exceptions.rst:833 msgid "" "Create a :class:`UnicodeDecodeError` object with the attributes *encoding*, " "*object*, *length*, *start*, *end* and *reason*. *encoding* and *reason* are " "UTF-8 encoded strings." msgstr "" -#: ../../c-api/exceptions.rst:827 +#: ../../c-api/exceptions.rst:840 msgid "Return the *encoding* attribute of the given exception object." msgstr "" -#: ../../c-api/exceptions.rst:833 +#: ../../c-api/exceptions.rst:846 msgid "Return the *object* attribute of the given exception object." msgstr "" -#: ../../c-api/exceptions.rst:839 +#: ../../c-api/exceptions.rst:852 msgid "" "Get the *start* attribute of the given exception object and place it into " "*\\*start*. *start* must not be ``NULL``. Return ``0`` on success, ``-1`` " "on failure." msgstr "" -#: ../../c-api/exceptions.rst:847 +#: ../../c-api/exceptions.rst:860 msgid "" "Set the *start* attribute of the given exception object to *start*. Return " "``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:854 +#: ../../c-api/exceptions.rst:867 msgid "" "Get the *end* attribute of the given exception object and place it into " "*\\*end*. *end* must not be ``NULL``. Return ``0`` on success, ``-1`` on " "failure." msgstr "" -#: ../../c-api/exceptions.rst:862 +#: ../../c-api/exceptions.rst:875 msgid "" "Set the *end* attribute of the given exception object to *end*. Return " "``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:869 +#: ../../c-api/exceptions.rst:882 msgid "Return the *reason* attribute of the given exception object." msgstr "" -#: ../../c-api/exceptions.rst:875 +#: ../../c-api/exceptions.rst:888 msgid "" "Set the *reason* attribute of the given exception object to *reason*. " "Return ``0`` on success, ``-1`` on failure." msgstr "" -#: ../../c-api/exceptions.rst:882 +#: ../../c-api/exceptions.rst:895 msgid "Recursion Control" msgstr "" -#: ../../c-api/exceptions.rst:884 +#: ../../c-api/exceptions.rst:897 msgid "" "These two functions provide a way to perform safe recursive calls at the C " "level, both in the core and in extension modules. They are needed if the " @@ -938,44 +947,44 @@ msgid "" "recursion handling." msgstr "" -#: ../../c-api/exceptions.rst:893 +#: ../../c-api/exceptions.rst:906 msgid "Marks a point where a recursive C-level call is about to be performed." msgstr "" -#: ../../c-api/exceptions.rst:895 +#: ../../c-api/exceptions.rst:908 msgid "" "If :c:macro:`!USE_STACKCHECK` is defined, this function checks if the OS " "stack overflowed using :c:func:`PyOS_CheckStack`. If this is the case, it " "sets a :exc:`MemoryError` and returns a nonzero value." msgstr "" -#: ../../c-api/exceptions.rst:899 +#: ../../c-api/exceptions.rst:912 msgid "" "The function then checks if the recursion limit is reached. If this is the " "case, a :exc:`RecursionError` is set and a nonzero value is returned. " "Otherwise, zero is returned." msgstr "" -#: ../../c-api/exceptions.rst:903 +#: ../../c-api/exceptions.rst:916 msgid "" "*where* should be a UTF-8 encoded string such as ``\" in instance check\"`` " "to be concatenated to the :exc:`RecursionError` message caused by the " "recursion depth limit." msgstr "" -#: ../../c-api/exceptions.rst:907 ../../c-api/exceptions.rst:915 +#: ../../c-api/exceptions.rst:920 ../../c-api/exceptions.rst:928 msgid "" "This function is now also available in the :ref:`limited API `." msgstr "" -#: ../../c-api/exceptions.rst:912 +#: ../../c-api/exceptions.rst:925 msgid "" "Ends a :c:func:`Py_EnterRecursiveCall`. Must be called once for each " "*successful* invocation of :c:func:`Py_EnterRecursiveCall`." msgstr "" -#: ../../c-api/exceptions.rst:918 +#: ../../c-api/exceptions.rst:931 msgid "" "Properly implementing :c:member:`~PyTypeObject.tp_repr` for container types " "requires special recursion handling. In addition to protecting the stack, :" @@ -984,13 +993,13 @@ msgid "" "Effectively, these are the C equivalent to :func:`reprlib.recursive_repr`." msgstr "" -#: ../../c-api/exceptions.rst:926 +#: ../../c-api/exceptions.rst:939 msgid "" "Called at the beginning of the :c:member:`~PyTypeObject.tp_repr` " "implementation to detect cycles." msgstr "" -#: ../../c-api/exceptions.rst:929 +#: ../../c-api/exceptions.rst:942 msgid "" "If the object has already been processed, the function returns a positive " "integer. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " @@ -998,30 +1007,30 @@ msgid "" "`dict` objects return ``{...}`` and :class:`list` objects return ``[...]``." msgstr "" -#: ../../c-api/exceptions.rst:935 +#: ../../c-api/exceptions.rst:948 msgid "" "The function will return a negative integer if the recursion limit is " "reached. In that case the :c:member:`~PyTypeObject.tp_repr` implementation " "should typically return ``NULL``." msgstr "" -#: ../../c-api/exceptions.rst:939 +#: ../../c-api/exceptions.rst:952 msgid "" "Otherwise, the function returns zero and the :c:member:`~PyTypeObject." "tp_repr` implementation can continue normally." msgstr "" -#: ../../c-api/exceptions.rst:944 +#: ../../c-api/exceptions.rst:957 msgid "" "Ends a :c:func:`Py_ReprEnter`. Must be called once for each invocation of :" "c:func:`Py_ReprEnter` that returns zero." msgstr "" -#: ../../c-api/exceptions.rst:951 +#: ../../c-api/exceptions.rst:964 msgid "Standard Exceptions" msgstr "" -#: ../../c-api/exceptions.rst:953 +#: ../../c-api/exceptions.rst:966 msgid "" "All standard Python exceptions are available as global variables whose names " "are ``PyExc_`` followed by the Python exception name. These have the type :" @@ -1029,451 +1038,459 @@ msgid "" "all the variables:" msgstr "" -#: ../../c-api/exceptions.rst:1014 ../../c-api/exceptions.rst:1147 -#: ../../c-api/exceptions.rst:1192 +#: ../../c-api/exceptions.rst:1028 ../../c-api/exceptions.rst:1163 +#: ../../c-api/exceptions.rst:1208 msgid "C Name" msgstr "C 名稱" -#: ../../c-api/exceptions.rst:1014 ../../c-api/exceptions.rst:1192 +#: ../../c-api/exceptions.rst:1028 ../../c-api/exceptions.rst:1208 msgid "Python Name" msgstr "Python 名稱" -#: ../../c-api/exceptions.rst:1014 ../../c-api/exceptions.rst:1147 -#: ../../c-api/exceptions.rst:1192 +#: ../../c-api/exceptions.rst:1028 ../../c-api/exceptions.rst:1163 +#: ../../c-api/exceptions.rst:1208 msgid "Notes" msgstr "註解" -#: ../../c-api/exceptions.rst:1016 +#: ../../c-api/exceptions.rst:1030 msgid ":c:data:`PyExc_BaseException`" msgstr ":c:data:`PyExc_BaseException`" -#: ../../c-api/exceptions.rst:1016 +#: ../../c-api/exceptions.rst:1030 msgid ":exc:`BaseException`" msgstr ":exc:`BaseException`" -#: ../../c-api/exceptions.rst:1016 ../../c-api/exceptions.rst:1018 -#: ../../c-api/exceptions.rst:1020 ../../c-api/exceptions.rst:1066 -#: ../../c-api/exceptions.rst:1078 +#: ../../c-api/exceptions.rst:1030 ../../c-api/exceptions.rst:1032 +#: ../../c-api/exceptions.rst:1034 ../../c-api/exceptions.rst:1080 +#: ../../c-api/exceptions.rst:1092 msgid "[1]_" msgstr "[1]_" -#: ../../c-api/exceptions.rst:1018 +#: ../../c-api/exceptions.rst:1032 msgid ":c:data:`PyExc_Exception`" msgstr ":c:data:`PyExc_Exception`" -#: ../../c-api/exceptions.rst:1018 +#: ../../c-api/exceptions.rst:1032 msgid ":exc:`Exception`" msgstr ":exc:`Exception`" -#: ../../c-api/exceptions.rst:1020 +#: ../../c-api/exceptions.rst:1034 msgid ":c:data:`PyExc_ArithmeticError`" msgstr ":c:data:`PyExc_ArithmeticError`" -#: ../../c-api/exceptions.rst:1020 +#: ../../c-api/exceptions.rst:1034 msgid ":exc:`ArithmeticError`" msgstr ":exc:`ArithmeticError`" -#: ../../c-api/exceptions.rst:1022 +#: ../../c-api/exceptions.rst:1036 msgid ":c:data:`PyExc_AssertionError`" msgstr ":c:data:`PyExc_AssertionError`" -#: ../../c-api/exceptions.rst:1022 +#: ../../c-api/exceptions.rst:1036 msgid ":exc:`AssertionError`" msgstr ":exc:`AssertionError`" -#: ../../c-api/exceptions.rst:1024 +#: ../../c-api/exceptions.rst:1038 msgid ":c:data:`PyExc_AttributeError`" msgstr ":c:data:`PyExc_AttributeError`" -#: ../../c-api/exceptions.rst:1024 +#: ../../c-api/exceptions.rst:1038 msgid ":exc:`AttributeError`" msgstr ":exc:`AttributeError`" -#: ../../c-api/exceptions.rst:1026 +#: ../../c-api/exceptions.rst:1040 msgid ":c:data:`PyExc_BlockingIOError`" msgstr ":c:data:`PyExc_BlockingIOError`" -#: ../../c-api/exceptions.rst:1026 +#: ../../c-api/exceptions.rst:1040 msgid ":exc:`BlockingIOError`" msgstr ":exc:`BlockingIOError`" -#: ../../c-api/exceptions.rst:1028 +#: ../../c-api/exceptions.rst:1042 msgid ":c:data:`PyExc_BrokenPipeError`" msgstr ":c:data:`PyExc_BrokenPipeError`" -#: ../../c-api/exceptions.rst:1028 +#: ../../c-api/exceptions.rst:1042 msgid ":exc:`BrokenPipeError`" msgstr ":exc:`BrokenPipeError`" -#: ../../c-api/exceptions.rst:1030 +#: ../../c-api/exceptions.rst:1044 msgid ":c:data:`PyExc_BufferError`" msgstr ":c:data:`PyExc_BufferError`" -#: ../../c-api/exceptions.rst:1030 +#: ../../c-api/exceptions.rst:1044 msgid ":exc:`BufferError`" msgstr ":exc:`BufferError`" -#: ../../c-api/exceptions.rst:1032 +#: ../../c-api/exceptions.rst:1046 msgid ":c:data:`PyExc_ChildProcessError`" msgstr ":c:data:`PyExc_ChildProcessError`" -#: ../../c-api/exceptions.rst:1032 +#: ../../c-api/exceptions.rst:1046 msgid ":exc:`ChildProcessError`" msgstr ":exc:`ChildProcessError`" -#: ../../c-api/exceptions.rst:1034 +#: ../../c-api/exceptions.rst:1048 msgid ":c:data:`PyExc_ConnectionAbortedError`" msgstr ":c:data:`PyExc_ConnectionAbortedError`" -#: ../../c-api/exceptions.rst:1034 +#: ../../c-api/exceptions.rst:1048 msgid ":exc:`ConnectionAbortedError`" msgstr ":exc:`ConnectionAbortedError`" -#: ../../c-api/exceptions.rst:1036 +#: ../../c-api/exceptions.rst:1050 msgid ":c:data:`PyExc_ConnectionError`" msgstr ":c:data:`PyExc_ConnectionError`" -#: ../../c-api/exceptions.rst:1036 +#: ../../c-api/exceptions.rst:1050 msgid ":exc:`ConnectionError`" msgstr ":exc:`ConnectionError`" -#: ../../c-api/exceptions.rst:1038 +#: ../../c-api/exceptions.rst:1052 msgid ":c:data:`PyExc_ConnectionRefusedError`" msgstr ":c:data:`PyExc_ConnectionRefusedError`" -#: ../../c-api/exceptions.rst:1038 +#: ../../c-api/exceptions.rst:1052 msgid ":exc:`ConnectionRefusedError`" msgstr ":exc:`ConnectionRefusedError`" -#: ../../c-api/exceptions.rst:1040 +#: ../../c-api/exceptions.rst:1054 msgid ":c:data:`PyExc_ConnectionResetError`" msgstr ":c:data:`PyExc_ConnectionResetError`" -#: ../../c-api/exceptions.rst:1040 +#: ../../c-api/exceptions.rst:1054 msgid ":exc:`ConnectionResetError`" msgstr ":exc:`ConnectionResetError`" -#: ../../c-api/exceptions.rst:1042 +#: ../../c-api/exceptions.rst:1056 msgid ":c:data:`PyExc_EOFError`" msgstr ":c:data:`PyExc_EOFError`" -#: ../../c-api/exceptions.rst:1042 +#: ../../c-api/exceptions.rst:1056 msgid ":exc:`EOFError`" msgstr ":exc:`EOFError`" -#: ../../c-api/exceptions.rst:1044 +#: ../../c-api/exceptions.rst:1058 msgid ":c:data:`PyExc_FileExistsError`" msgstr ":c:data:`PyExc_FileExistsError`" -#: ../../c-api/exceptions.rst:1044 +#: ../../c-api/exceptions.rst:1058 msgid ":exc:`FileExistsError`" msgstr ":exc:`FileExistsError`" -#: ../../c-api/exceptions.rst:1046 +#: ../../c-api/exceptions.rst:1060 msgid ":c:data:`PyExc_FileNotFoundError`" msgstr ":c:data:`PyExc_FileNotFoundError`" -#: ../../c-api/exceptions.rst:1046 +#: ../../c-api/exceptions.rst:1060 msgid ":exc:`FileNotFoundError`" msgstr ":exc:`FileNotFoundError`" -#: ../../c-api/exceptions.rst:1048 +#: ../../c-api/exceptions.rst:1062 msgid ":c:data:`PyExc_FloatingPointError`" msgstr ":c:data:`PyExc_FloatingPointError`" -#: ../../c-api/exceptions.rst:1048 +#: ../../c-api/exceptions.rst:1062 msgid ":exc:`FloatingPointError`" msgstr ":exc:`FloatingPointError`" -#: ../../c-api/exceptions.rst:1050 +#: ../../c-api/exceptions.rst:1064 msgid ":c:data:`PyExc_GeneratorExit`" msgstr ":c:data:`PyExc_GeneratorExit`" -#: ../../c-api/exceptions.rst:1050 +#: ../../c-api/exceptions.rst:1064 msgid ":exc:`GeneratorExit`" msgstr ":exc:`GeneratorExit`" -#: ../../c-api/exceptions.rst:1052 +#: ../../c-api/exceptions.rst:1066 msgid ":c:data:`PyExc_ImportError`" msgstr ":c:data:`PyExc_ImportError`" -#: ../../c-api/exceptions.rst:1052 +#: ../../c-api/exceptions.rst:1066 msgid ":exc:`ImportError`" msgstr ":exc:`ImportError`" -#: ../../c-api/exceptions.rst:1054 +#: ../../c-api/exceptions.rst:1068 msgid ":c:data:`PyExc_IndentationError`" msgstr ":c:data:`PyExc_IndentationError`" -#: ../../c-api/exceptions.rst:1054 +#: ../../c-api/exceptions.rst:1068 msgid ":exc:`IndentationError`" msgstr ":exc:`IndentationError`" -#: ../../c-api/exceptions.rst:1056 +#: ../../c-api/exceptions.rst:1070 msgid ":c:data:`PyExc_IndexError`" msgstr ":c:data:`PyExc_IndexError`" -#: ../../c-api/exceptions.rst:1056 +#: ../../c-api/exceptions.rst:1070 msgid ":exc:`IndexError`" msgstr ":exc:`IndexError`" -#: ../../c-api/exceptions.rst:1058 +#: ../../c-api/exceptions.rst:1072 msgid ":c:data:`PyExc_InterruptedError`" msgstr ":c:data:`PyExc_InterruptedError`" -#: ../../c-api/exceptions.rst:1058 +#: ../../c-api/exceptions.rst:1072 msgid ":exc:`InterruptedError`" msgstr ":exc:`InterruptedError`" -#: ../../c-api/exceptions.rst:1060 +#: ../../c-api/exceptions.rst:1074 msgid ":c:data:`PyExc_IsADirectoryError`" msgstr ":c:data:`PyExc_IsADirectoryError`" -#: ../../c-api/exceptions.rst:1060 +#: ../../c-api/exceptions.rst:1074 msgid ":exc:`IsADirectoryError`" msgstr ":exc:`IsADirectoryError`" -#: ../../c-api/exceptions.rst:1062 +#: ../../c-api/exceptions.rst:1076 msgid ":c:data:`PyExc_KeyError`" msgstr ":c:data:`PyExc_KeyError`" -#: ../../c-api/exceptions.rst:1062 +#: ../../c-api/exceptions.rst:1076 msgid ":exc:`KeyError`" msgstr ":exc:`KeyError`" -#: ../../c-api/exceptions.rst:1064 +#: ../../c-api/exceptions.rst:1078 msgid ":c:data:`PyExc_KeyboardInterrupt`" msgstr ":c:data:`PyExc_KeyboardInterrupt`" -#: ../../c-api/exceptions.rst:1064 +#: ../../c-api/exceptions.rst:1078 msgid ":exc:`KeyboardInterrupt`" msgstr ":exc:`KeyboardInterrupt`" -#: ../../c-api/exceptions.rst:1066 +#: ../../c-api/exceptions.rst:1080 msgid ":c:data:`PyExc_LookupError`" msgstr ":c:data:`PyExc_LookupError`" -#: ../../c-api/exceptions.rst:1066 +#: ../../c-api/exceptions.rst:1080 msgid ":exc:`LookupError`" msgstr ":exc:`LookupError`" -#: ../../c-api/exceptions.rst:1068 +#: ../../c-api/exceptions.rst:1082 msgid ":c:data:`PyExc_MemoryError`" msgstr ":c:data:`PyExc_MemoryError`" -#: ../../c-api/exceptions.rst:1068 +#: ../../c-api/exceptions.rst:1082 msgid ":exc:`MemoryError`" msgstr ":exc:`MemoryError`" -#: ../../c-api/exceptions.rst:1070 +#: ../../c-api/exceptions.rst:1084 msgid ":c:data:`PyExc_ModuleNotFoundError`" msgstr ":c:data:`PyExc_ModuleNotFoundError`" -#: ../../c-api/exceptions.rst:1070 +#: ../../c-api/exceptions.rst:1084 msgid ":exc:`ModuleNotFoundError`" msgstr ":exc:`ModuleNotFoundError`" -#: ../../c-api/exceptions.rst:1072 +#: ../../c-api/exceptions.rst:1086 msgid ":c:data:`PyExc_NameError`" msgstr ":c:data:`PyExc_NameError`" -#: ../../c-api/exceptions.rst:1072 +#: ../../c-api/exceptions.rst:1086 msgid ":exc:`NameError`" msgstr ":exc:`NameError`" -#: ../../c-api/exceptions.rst:1074 +#: ../../c-api/exceptions.rst:1088 msgid ":c:data:`PyExc_NotADirectoryError`" msgstr ":c:data:`PyExc_NotADirectoryError`" -#: ../../c-api/exceptions.rst:1074 +#: ../../c-api/exceptions.rst:1088 msgid ":exc:`NotADirectoryError`" msgstr ":exc:`NotADirectoryError`" -#: ../../c-api/exceptions.rst:1076 +#: ../../c-api/exceptions.rst:1090 msgid ":c:data:`PyExc_NotImplementedError`" msgstr ":c:data:`PyExc_NotImplementedError`" -#: ../../c-api/exceptions.rst:1076 +#: ../../c-api/exceptions.rst:1090 msgid ":exc:`NotImplementedError`" msgstr ":exc:`NotImplementedError`" -#: ../../c-api/exceptions.rst:1078 +#: ../../c-api/exceptions.rst:1092 msgid ":c:data:`PyExc_OSError`" msgstr ":c:data:`PyExc_OSError`" -#: ../../c-api/exceptions.rst:1078 +#: ../../c-api/exceptions.rst:1092 msgid ":exc:`OSError`" msgstr ":exc:`OSError`" -#: ../../c-api/exceptions.rst:1080 +#: ../../c-api/exceptions.rst:1094 msgid ":c:data:`PyExc_OverflowError`" msgstr ":c:data:`PyExc_OverflowError`" -#: ../../c-api/exceptions.rst:1080 +#: ../../c-api/exceptions.rst:1094 msgid ":exc:`OverflowError`" msgstr ":exc:`OverflowError`" -#: ../../c-api/exceptions.rst:1082 +#: ../../c-api/exceptions.rst:1096 msgid ":c:data:`PyExc_PermissionError`" msgstr ":c:data:`PyExc_PermissionError`" -#: ../../c-api/exceptions.rst:1082 +#: ../../c-api/exceptions.rst:1096 msgid ":exc:`PermissionError`" msgstr ":exc:`PermissionError`" -#: ../../c-api/exceptions.rst:1084 +#: ../../c-api/exceptions.rst:1098 msgid ":c:data:`PyExc_ProcessLookupError`" msgstr ":c:data:`PyExc_ProcessLookupError`" -#: ../../c-api/exceptions.rst:1084 +#: ../../c-api/exceptions.rst:1098 msgid ":exc:`ProcessLookupError`" msgstr ":exc:`ProcessLookupError`" -#: ../../c-api/exceptions.rst:1086 +#: ../../c-api/exceptions.rst:1100 +msgid ":c:data:`PyExc_PythonFinalizationError`" +msgstr ":c:data:`PyExc_PythonFinalizationError`" + +#: ../../c-api/exceptions.rst:1100 +msgid ":exc:`PythonFinalizationError`" +msgstr ":exc:`PythonFinalizationError`" + +#: ../../c-api/exceptions.rst:1102 msgid ":c:data:`PyExc_RecursionError`" msgstr ":c:data:`PyExc_RecursionError`" -#: ../../c-api/exceptions.rst:1086 +#: ../../c-api/exceptions.rst:1102 msgid ":exc:`RecursionError`" msgstr ":exc:`RecursionError`" -#: ../../c-api/exceptions.rst:1088 +#: ../../c-api/exceptions.rst:1104 msgid ":c:data:`PyExc_ReferenceError`" msgstr ":c:data:`PyExc_ReferenceError`" -#: ../../c-api/exceptions.rst:1088 +#: ../../c-api/exceptions.rst:1104 msgid ":exc:`ReferenceError`" msgstr ":exc:`ReferenceError`" -#: ../../c-api/exceptions.rst:1090 +#: ../../c-api/exceptions.rst:1106 msgid ":c:data:`PyExc_RuntimeError`" msgstr ":c:data:`PyExc_RuntimeError`" -#: ../../c-api/exceptions.rst:1090 +#: ../../c-api/exceptions.rst:1106 msgid ":exc:`RuntimeError`" msgstr ":exc:`RuntimeError`" -#: ../../c-api/exceptions.rst:1092 +#: ../../c-api/exceptions.rst:1108 msgid ":c:data:`PyExc_StopAsyncIteration`" msgstr ":c:data:`PyExc_StopAsyncIteration`" -#: ../../c-api/exceptions.rst:1092 +#: ../../c-api/exceptions.rst:1108 msgid ":exc:`StopAsyncIteration`" msgstr ":exc:`StopAsyncIteration`" -#: ../../c-api/exceptions.rst:1094 +#: ../../c-api/exceptions.rst:1110 msgid ":c:data:`PyExc_StopIteration`" msgstr ":c:data:`PyExc_StopIteration`" -#: ../../c-api/exceptions.rst:1094 +#: ../../c-api/exceptions.rst:1110 msgid ":exc:`StopIteration`" msgstr ":exc:`StopIteration`" -#: ../../c-api/exceptions.rst:1096 +#: ../../c-api/exceptions.rst:1112 msgid ":c:data:`PyExc_SyntaxError`" msgstr ":c:data:`PyExc_SyntaxError`" -#: ../../c-api/exceptions.rst:1096 +#: ../../c-api/exceptions.rst:1112 msgid ":exc:`SyntaxError`" msgstr ":exc:`SyntaxError`" -#: ../../c-api/exceptions.rst:1098 +#: ../../c-api/exceptions.rst:1114 msgid ":c:data:`PyExc_SystemError`" msgstr ":c:data:`PyExc_SystemError`" -#: ../../c-api/exceptions.rst:1098 +#: ../../c-api/exceptions.rst:1114 msgid ":exc:`SystemError`" msgstr ":exc:`SystemError`" -#: ../../c-api/exceptions.rst:1100 +#: ../../c-api/exceptions.rst:1116 msgid ":c:data:`PyExc_SystemExit`" msgstr ":c:data:`PyExc_SystemExit`" -#: ../../c-api/exceptions.rst:1100 +#: ../../c-api/exceptions.rst:1116 msgid ":exc:`SystemExit`" msgstr ":exc:`SystemExit`" -#: ../../c-api/exceptions.rst:1102 +#: ../../c-api/exceptions.rst:1118 msgid ":c:data:`PyExc_TabError`" msgstr ":c:data:`PyExc_TabError`" -#: ../../c-api/exceptions.rst:1102 +#: ../../c-api/exceptions.rst:1118 msgid ":exc:`TabError`" msgstr ":exc:`TabError`" -#: ../../c-api/exceptions.rst:1104 +#: ../../c-api/exceptions.rst:1120 msgid ":c:data:`PyExc_TimeoutError`" msgstr ":c:data:`PyExc_TimeoutError`" -#: ../../c-api/exceptions.rst:1104 +#: ../../c-api/exceptions.rst:1120 msgid ":exc:`TimeoutError`" msgstr ":exc:`TimeoutError`" -#: ../../c-api/exceptions.rst:1106 +#: ../../c-api/exceptions.rst:1122 msgid ":c:data:`PyExc_TypeError`" msgstr ":c:data:`PyExc_TypeError`" -#: ../../c-api/exceptions.rst:1106 +#: ../../c-api/exceptions.rst:1122 msgid ":exc:`TypeError`" msgstr ":exc:`TypeError`" -#: ../../c-api/exceptions.rst:1108 +#: ../../c-api/exceptions.rst:1124 msgid ":c:data:`PyExc_UnboundLocalError`" msgstr ":c:data:`PyExc_UnboundLocalError`" -#: ../../c-api/exceptions.rst:1108 +#: ../../c-api/exceptions.rst:1124 msgid ":exc:`UnboundLocalError`" msgstr ":exc:`UnboundLocalError`" -#: ../../c-api/exceptions.rst:1110 +#: ../../c-api/exceptions.rst:1126 msgid ":c:data:`PyExc_UnicodeDecodeError`" msgstr ":c:data:`PyExc_UnicodeDecodeError`" -#: ../../c-api/exceptions.rst:1110 +#: ../../c-api/exceptions.rst:1126 msgid ":exc:`UnicodeDecodeError`" msgstr ":exc:`UnicodeDecodeError`" -#: ../../c-api/exceptions.rst:1112 +#: ../../c-api/exceptions.rst:1128 msgid ":c:data:`PyExc_UnicodeEncodeError`" msgstr ":c:data:`PyExc_UnicodeEncodeError`" -#: ../../c-api/exceptions.rst:1112 +#: ../../c-api/exceptions.rst:1128 msgid ":exc:`UnicodeEncodeError`" msgstr ":exc:`UnicodeEncodeError`" -#: ../../c-api/exceptions.rst:1114 +#: ../../c-api/exceptions.rst:1130 msgid ":c:data:`PyExc_UnicodeError`" msgstr ":c:data:`PyExc_UnicodeError`" -#: ../../c-api/exceptions.rst:1114 +#: ../../c-api/exceptions.rst:1130 msgid ":exc:`UnicodeError`" msgstr ":exc:`UnicodeError`" -#: ../../c-api/exceptions.rst:1116 +#: ../../c-api/exceptions.rst:1132 msgid ":c:data:`PyExc_UnicodeTranslateError`" msgstr ":c:data:`PyExc_UnicodeTranslateError`" -#: ../../c-api/exceptions.rst:1116 +#: ../../c-api/exceptions.rst:1132 msgid ":exc:`UnicodeTranslateError`" msgstr ":exc:`UnicodeTranslateError`" -#: ../../c-api/exceptions.rst:1118 +#: ../../c-api/exceptions.rst:1134 msgid ":c:data:`PyExc_ValueError`" msgstr ":c:data:`PyExc_ValueError`" -#: ../../c-api/exceptions.rst:1118 +#: ../../c-api/exceptions.rst:1134 msgid ":exc:`ValueError`" msgstr ":exc:`ValueError`" -#: ../../c-api/exceptions.rst:1120 +#: ../../c-api/exceptions.rst:1136 msgid ":c:data:`PyExc_ZeroDivisionError`" msgstr ":c:data:`PyExc_ZeroDivisionError`" -#: ../../c-api/exceptions.rst:1120 +#: ../../c-api/exceptions.rst:1136 msgid ":exc:`ZeroDivisionError`" msgstr ":exc:`ZeroDivisionError`" -#: ../../c-api/exceptions.rst:1123 +#: ../../c-api/exceptions.rst:1139 msgid "" ":c:data:`PyExc_BlockingIOError`, :c:data:`PyExc_BrokenPipeError`, :c:data:" "`PyExc_ChildProcessError`, :c:data:`PyExc_ConnectionError`, :c:data:" @@ -1493,57 +1510,57 @@ msgstr "" "`PyExc_PermissionError`, :c:data:`PyExc_ProcessLookupError` 和 :c:data:" "`PyExc_TimeoutError` 是在 :pep:`3151` 被引入。" -#: ../../c-api/exceptions.rst:1133 +#: ../../c-api/exceptions.rst:1149 msgid ":c:data:`PyExc_StopAsyncIteration` and :c:data:`PyExc_RecursionError`." msgstr ":c:data:`PyExc_StopAsyncIteration` 和 :c:data:`PyExc_RecursionError`。" -#: ../../c-api/exceptions.rst:1136 +#: ../../c-api/exceptions.rst:1152 msgid ":c:data:`PyExc_ModuleNotFoundError`." msgstr ":c:data:`PyExc_ModuleNotFoundError`。" -#: ../../c-api/exceptions.rst:1139 +#: ../../c-api/exceptions.rst:1155 msgid "These are compatibility aliases to :c:data:`PyExc_OSError`:" msgstr "" -#: ../../c-api/exceptions.rst:1149 +#: ../../c-api/exceptions.rst:1165 msgid ":c:data:`!PyExc_EnvironmentError`" msgstr ":c:data:`!PyExc_EnvironmentError`" -#: ../../c-api/exceptions.rst:1151 +#: ../../c-api/exceptions.rst:1167 msgid ":c:data:`!PyExc_IOError`" msgstr ":c:data:`!PyExc_IOError`" -#: ../../c-api/exceptions.rst:1153 +#: ../../c-api/exceptions.rst:1169 msgid ":c:data:`!PyExc_WindowsError`" msgstr ":c:data:`!PyExc_WindowsError`" -#: ../../c-api/exceptions.rst:1153 +#: ../../c-api/exceptions.rst:1169 msgid "[2]_" msgstr "[2]_" -#: ../../c-api/exceptions.rst:1156 +#: ../../c-api/exceptions.rst:1172 msgid "These aliases used to be separate exception types." msgstr "" -#: ../../c-api/exceptions.rst:1159 ../../c-api/exceptions.rst:1220 +#: ../../c-api/exceptions.rst:1175 ../../c-api/exceptions.rst:1236 msgid "Notes:" msgstr "註解:" -#: ../../c-api/exceptions.rst:1162 +#: ../../c-api/exceptions.rst:1178 msgid "This is a base class for other standard exceptions." msgstr "" -#: ../../c-api/exceptions.rst:1165 +#: ../../c-api/exceptions.rst:1181 msgid "" "Only defined on Windows; protect code that uses this by testing that the " "preprocessor macro ``MS_WINDOWS`` is defined." msgstr "" -#: ../../c-api/exceptions.rst:1171 +#: ../../c-api/exceptions.rst:1187 msgid "Standard Warning Categories" msgstr "" -#: ../../c-api/exceptions.rst:1173 +#: ../../c-api/exceptions.rst:1189 msgid "" "All standard Python warning categories are available as global variables " "whose names are ``PyExc_`` followed by the Python exception name. These have " @@ -1551,393 +1568,397 @@ msgid "" "here are all the variables:" msgstr "" -#: ../../c-api/exceptions.rst:1194 +#: ../../c-api/exceptions.rst:1210 msgid ":c:data:`PyExc_Warning`" msgstr ":c:data:`PyExc_Warning`" -#: ../../c-api/exceptions.rst:1194 +#: ../../c-api/exceptions.rst:1210 msgid ":exc:`Warning`" msgstr ":exc:`Warning`" -#: ../../c-api/exceptions.rst:1194 +#: ../../c-api/exceptions.rst:1210 msgid "[3]_" msgstr "[3]_" -#: ../../c-api/exceptions.rst:1196 +#: ../../c-api/exceptions.rst:1212 msgid ":c:data:`PyExc_BytesWarning`" msgstr ":c:data:`PyExc_BytesWarning`" -#: ../../c-api/exceptions.rst:1196 +#: ../../c-api/exceptions.rst:1212 msgid ":exc:`BytesWarning`" msgstr ":exc:`BytesWarning`" -#: ../../c-api/exceptions.rst:1198 +#: ../../c-api/exceptions.rst:1214 msgid ":c:data:`PyExc_DeprecationWarning`" msgstr ":c:data:`PyExc_DeprecationWarning`" -#: ../../c-api/exceptions.rst:1198 +#: ../../c-api/exceptions.rst:1214 msgid ":exc:`DeprecationWarning`" msgstr ":exc:`DeprecationWarning`" -#: ../../c-api/exceptions.rst:1200 +#: ../../c-api/exceptions.rst:1216 msgid ":c:data:`PyExc_FutureWarning`" msgstr ":c:data:`PyExc_FutureWarning`" -#: ../../c-api/exceptions.rst:1200 +#: ../../c-api/exceptions.rst:1216 msgid ":exc:`FutureWarning`" msgstr ":exc:`FutureWarning`" -#: ../../c-api/exceptions.rst:1202 +#: ../../c-api/exceptions.rst:1218 msgid ":c:data:`PyExc_ImportWarning`" msgstr ":c:data:`PyExc_ImportWarning`" -#: ../../c-api/exceptions.rst:1202 +#: ../../c-api/exceptions.rst:1218 msgid ":exc:`ImportWarning`" msgstr ":exc:`ImportWarning`" -#: ../../c-api/exceptions.rst:1204 +#: ../../c-api/exceptions.rst:1220 msgid ":c:data:`PyExc_PendingDeprecationWarning`" msgstr ":c:data:`PyExc_PendingDeprecationWarning`" -#: ../../c-api/exceptions.rst:1204 +#: ../../c-api/exceptions.rst:1220 msgid ":exc:`PendingDeprecationWarning`" msgstr ":exc:`PendingDeprecationWarning`" -#: ../../c-api/exceptions.rst:1206 +#: ../../c-api/exceptions.rst:1222 msgid ":c:data:`PyExc_ResourceWarning`" msgstr ":c:data:`PyExc_ResourceWarning`" -#: ../../c-api/exceptions.rst:1206 +#: ../../c-api/exceptions.rst:1222 msgid ":exc:`ResourceWarning`" msgstr ":exc:`ResourceWarning`" -#: ../../c-api/exceptions.rst:1208 +#: ../../c-api/exceptions.rst:1224 msgid ":c:data:`PyExc_RuntimeWarning`" msgstr ":c:data:`PyExc_RuntimeWarning`" -#: ../../c-api/exceptions.rst:1208 +#: ../../c-api/exceptions.rst:1224 msgid ":exc:`RuntimeWarning`" msgstr ":exc:`RuntimeWarning`" -#: ../../c-api/exceptions.rst:1210 +#: ../../c-api/exceptions.rst:1226 msgid ":c:data:`PyExc_SyntaxWarning`" msgstr ":c:data:`PyExc_SyntaxWarning`" -#: ../../c-api/exceptions.rst:1210 +#: ../../c-api/exceptions.rst:1226 msgid ":exc:`SyntaxWarning`" msgstr ":exc:`SyntaxWarning`" -#: ../../c-api/exceptions.rst:1212 +#: ../../c-api/exceptions.rst:1228 msgid ":c:data:`PyExc_UnicodeWarning`" msgstr ":c:data:`PyExc_UnicodeWarning`" -#: ../../c-api/exceptions.rst:1212 +#: ../../c-api/exceptions.rst:1228 msgid ":exc:`UnicodeWarning`" msgstr ":exc:`UnicodeWarning`" -#: ../../c-api/exceptions.rst:1214 +#: ../../c-api/exceptions.rst:1230 msgid ":c:data:`PyExc_UserWarning`" msgstr ":c:data:`PyExc_UserWarning`" -#: ../../c-api/exceptions.rst:1214 +#: ../../c-api/exceptions.rst:1230 msgid ":exc:`UserWarning`" msgstr ":exc:`UserWarning`" -#: ../../c-api/exceptions.rst:1217 +#: ../../c-api/exceptions.rst:1233 msgid ":c:data:`PyExc_ResourceWarning`." msgstr ":c:data:`PyExc_ResourceWarning`." -#: ../../c-api/exceptions.rst:1223 +#: ../../c-api/exceptions.rst:1239 msgid "This is a base class for other standard warning categories." msgstr "" -#: ../../c-api/exceptions.rst:170 +#: ../../c-api/exceptions.rst:183 msgid "strerror (C function)" msgstr "strerror(C 函式)" -#: ../../c-api/exceptions.rst:624 ../../c-api/exceptions.rst:655 -#: ../../c-api/exceptions.rst:670 +#: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 +#: ../../c-api/exceptions.rst:683 msgid "module" msgstr "module(模組)" -#: ../../c-api/exceptions.rst:624 ../../c-api/exceptions.rst:655 -#: ../../c-api/exceptions.rst:670 +#: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 +#: ../../c-api/exceptions.rst:683 msgid "signal" msgstr "signal(訊號)" -#: ../../c-api/exceptions.rst:624 ../../c-api/exceptions.rst:655 +#: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 msgid "SIGINT (C macro)" msgstr "SIGINT(C 巨集)" -#: ../../c-api/exceptions.rst:624 ../../c-api/exceptions.rst:655 -#: ../../c-api/exceptions.rst:670 +#: ../../c-api/exceptions.rst:637 ../../c-api/exceptions.rst:668 +#: ../../c-api/exceptions.rst:683 msgid "KeyboardInterrupt (built-in exception)" msgstr "KeyboardInterrupt(內建例外)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_BaseException (C var)" msgstr "PyExc_BaseException(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_Exception (C var)" msgstr "PyExc_Exception(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ArithmeticError (C var)" msgstr "PyExc_ArithmeticError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_AssertionError (C var)" msgstr "PyExc_AssertionError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_AttributeError (C var)" msgstr "PyExc_AttributeError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_BlockingIOError (C var)" msgstr "PyExc_BlockingIOError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_BrokenPipeError (C var)" msgstr "PyExc_BrokenPipeError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_BufferError (C var)" msgstr "PyExc_BufferError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ChildProcessError (C var)" msgstr "PyExc_ChildProcessError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ConnectionAbortedError (C var)" msgstr "PyExc_ConnectionAbortedError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ConnectionError (C var)" msgstr "PyExc_ConnectionError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ConnectionRefusedError (C var)" msgstr "PyExc_ConnectionRefusedError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ConnectionResetError (C var)" msgstr "PyExc_ConnectionResetError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_EOFError (C var)" msgstr "PyExc_EOFError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_FileExistsError (C var)" msgstr "PyExc_FileExistsError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_FileNotFoundError (C var)" msgstr "PyExc_FileNotFoundError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_FloatingPointError (C var)" msgstr "PyExc_FloatingPointError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_GeneratorExit (C var)" msgstr "PyExc_GeneratorExit(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ImportError (C var)" msgstr "PyExc_ImportError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_IndentationError (C var)" msgstr "PyExc_IndentationError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_IndexError (C var)" msgstr "PyExc_IndexError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_InterruptedError (C var)" msgstr "PyExc_InterruptedError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_IsADirectoryError (C var)" msgstr "PyExc_IsADirectoryError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_KeyError (C var)" msgstr "PyExc_KeyError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_KeyboardInterrupt (C var)" msgstr "PyExc_KeyboardInterrupt(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_LookupError (C var)" msgstr "PyExc_LookupError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_MemoryError (C var)" msgstr "PyExc_MemoryError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ModuleNotFoundError (C var)" msgstr "PyExc_ModuleNotFoundError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_NameError (C var)" msgstr "PyExc_NameError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_NotADirectoryError (C var)" msgstr "PyExc_NotADirectoryError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_NotImplementedError (C var)" msgstr "PyExc_NotImplementedError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_OSError (C var)" msgstr "PyExc_OSError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_OverflowError (C var)" msgstr "PyExc_OverflowError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_PermissionError (C var)" msgstr "PyExc_PermissionError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ProcessLookupError (C var)" msgstr "PyExc_ProcessLookupError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 +msgid "PyExc_PythonFinalizationError (C var)" +msgstr "PyExc_PythonFinalizationError(C 變數)" + +#: ../../c-api/exceptions.rst:971 msgid "PyExc_RecursionError (C var)" msgstr "PyExc_RecursionError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ReferenceError (C var)" msgstr "PyExc_ReferenceError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_RuntimeError (C var)" msgstr "PyExc_RuntimeError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_StopAsyncIteration (C var)" msgstr "PyExc_StopAsyncIteration(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_StopIteration (C var)" msgstr "PyExc_StopIteration(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_SyntaxError (C var)" msgstr "PyExc_SyntaxError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_SystemError (C var)" msgstr "PyExc_SystemError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_SystemExit (C var)" msgstr "PyExc_SystemExit(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_TabError (C var)" msgstr "PyExc_TabError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_TimeoutError (C var)" msgstr "PyExc_TimeoutError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_TypeError (C var)" msgstr "PyExc_TypeError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_UnboundLocalError (C var)" msgstr "PyExc_UnboundLocalError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_UnicodeDecodeError (C var)" msgstr "PyExc_UnicodeDecodeError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_UnicodeEncodeError (C var)" msgstr "PyExc_UnicodeEncodeError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_UnicodeError (C var)" msgstr "PyExc_UnicodeError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_UnicodeTranslateError (C var)" msgstr "PyExc_UnicodeTranslateError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ValueError (C var)" msgstr "PyExc_ValueError(C 變數)" -#: ../../c-api/exceptions.rst:958 +#: ../../c-api/exceptions.rst:971 msgid "PyExc_ZeroDivisionError (C var)" msgstr "PyExc_ZeroDivisionError(C 變數)" -#: ../../c-api/exceptions.rst:1141 +#: ../../c-api/exceptions.rst:1157 msgid "PyExc_EnvironmentError (C var)" msgstr "PyExc_EnvironmentError(C 變數)" -#: ../../c-api/exceptions.rst:1141 +#: ../../c-api/exceptions.rst:1157 msgid "PyExc_IOError (C var)" msgstr "PyExc_IOError(C 變數)" -#: ../../c-api/exceptions.rst:1141 +#: ../../c-api/exceptions.rst:1157 msgid "PyExc_WindowsError (C var)" msgstr "PyExc_WindowsError(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_Warning (C var)" msgstr "PyExc_Warning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_BytesWarning (C var)" msgstr "PyExc_BytesWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_DeprecationWarning (C var)" msgstr "PyExc_DeprecationWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_FutureWarning (C var)" msgstr "PyExc_FutureWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_ImportWarning (C var)" msgstr "PyExc_ImportWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_PendingDeprecationWarning (C var)" msgstr "PyExc_PendingDeprecationWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_ResourceWarning (C var)" msgstr "PyExc_ResourceWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_RuntimeWarning (C var)" msgstr "PyExc_RuntimeWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_SyntaxWarning (C var)" msgstr "PyExc_SyntaxWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_UnicodeWarning (C var)" msgstr "PyExc_UnicodeWarning(C 變數)" -#: ../../c-api/exceptions.rst:1178 +#: ../../c-api/exceptions.rst:1194 msgid "PyExc_UserWarning (C var)" msgstr "PyExc_UserWarning(C 變數)" diff --git a/c-api/file.po b/c-api/file.po index 4a1d1c1e24..ccf0d607eb 100644 --- a/c-api/file.po +++ b/c-api/file.po @@ -7,9 +7,9 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-04 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-04-24 20:38+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -111,10 +111,10 @@ msgstr "" "數。" #: ../../c-api/file.rst:68 -msgid "The handler is a function of type:" +msgid "The *handler* is a function of type:" msgstr "" -#: ../../c-api/file.rst:72 +#: ../../c-api/file.rst:73 #, fuzzy msgid "" "Equivalent of :c:expr:`PyObject *(\\*)(PyObject *path, void *userData)`, " @@ -123,7 +123,7 @@ msgstr "" "處理程式是 :c:expr:`PyObject *(\\*)(PyObject *path, void *userData)` 型別的函" "式,其中 *path* 保證為 :c:type:`PyUnicodeObject`。" -#: ../../c-api/file.rst:76 +#: ../../c-api/file.rst:77 msgid "" "The *userData* pointer is passed into the hook function. Since hook " "functions may be called from different runtimes, this pointer should not " @@ -132,7 +132,7 @@ msgstr "" "*userData* 指標被傳遞到掛鉤函式 (hook function) 中。由於可能會從不同的執行環" "境 (runtime) 呼叫掛鉤函式,因此該指標不應直接指向 Python 狀態。" -#: ../../c-api/file.rst:80 +#: ../../c-api/file.rst:81 msgid "" "As this hook is intentionally used during import, avoid importing new " "modules during its execution unless they are known to be frozen or available " @@ -141,7 +141,7 @@ msgstr "" "由於此掛鉤函式是在導入期間有意使用的,因此請避免在其執行期間導入新模組,除非" "它們已知有被凍結或在 ``sys.modules`` 中可用。" -#: ../../c-api/file.rst:84 +#: ../../c-api/file.rst:85 #, fuzzy msgid "" "Once a hook has been set, it cannot be removed or replaced, and later calls " @@ -152,11 +152,11 @@ msgstr "" "`PyFile_SetOpenCodeHook` 將失敗。失敗時,函式回傳 -1 並在直譯器已初始化時設定" "例外。" -#: ../../c-api/file.rst:88 +#: ../../c-api/file.rst:89 msgid "This function is safe to call before :c:func:`Py_Initialize`." msgstr "在 :c:func:`Py_Initialize` 之前呼叫此函式是安全的。" -#: ../../c-api/file.rst:90 +#: ../../c-api/file.rst:91 msgid "" "Raises an :ref:`auditing event ` ``setopencodehook`` with no " "arguments." @@ -164,7 +164,7 @@ msgstr "" "不帶引數地引發一個\\ :ref:`稽核事件 (auditing event) ` " "``setopencodehook``。" -#: ../../c-api/file.rst:100 +#: ../../c-api/file.rst:101 msgid "" "Write object *obj* to file object *p*. The only supported flag for *flags* " "is :c:macro:`Py_PRINT_RAW`; if given, the :func:`str` of the object is " @@ -175,7 +175,7 @@ msgstr "" "`Py_PRINT_RAW`;如果有給定,則寫入物件的 :func:`str` 而不是 :func:`repr`。在" "成功回傳 ``0`` 或在失敗回傳 ``-1``;將設定適當的例外。" -#: ../../c-api/file.rst:108 +#: ../../c-api/file.rst:109 msgid "" "Write string *s* to file object *p*. Return ``0`` on success or ``-1`` on " "failure; the appropriate exception will be set." @@ -195,6 +195,6 @@ msgstr "file(檔案)" msgid "EOFError (built-in exception)" msgstr "EOFError(內建例外)" -#: ../../c-api/file.rst:98 +#: ../../c-api/file.rst:99 msgid "Py_PRINT_RAW (C macro)" msgstr "Py_PRINT_RAW(C 巨集)" diff --git a/c-api/float.po b/c-api/float.po index df086b405b..3c2eff7ff2 100644 --- a/c-api/float.po +++ b/c-api/float.po @@ -7,7 +7,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" @@ -159,7 +159,7 @@ msgstr "" #: ../../c-api/float.rst:122 msgid "``-0.0`` and ``+0.0`` produce the same bytes string." -msgstr "" +msgstr "``-0.0`` 和 ``+0.0`` 會產生同樣的位元組字串。" #: ../../c-api/float.rst:126 msgid "Pack a C double as the IEEE 754 binary16 half-precision format." diff --git a/c-api/frame.po b/c-api/frame.po index c7c3384f27..1e518a36e3 100644 --- a/c-api/frame.po +++ b/c-api/frame.po @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-12-06 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -87,7 +87,7 @@ msgstr "回傳 :term:`strong reference`。結果不能為 ``NULL``。" msgid "Get the *frame* code." msgstr "" -#: ../../c-api/frame.rst:64 ../../c-api/frame.rst:125 +#: ../../c-api/frame.rst:64 ../../c-api/frame.rst:130 msgid "Return a :term:`strong reference`." msgstr "回傳 :term:`strong reference`。" @@ -146,34 +146,43 @@ msgid "" msgstr "" #: ../../c-api/frame.rst:123 -msgid "Get the *frame*'s :attr:`~frame.f_locals` attribute (:class:`dict`)." +msgid "" +"Get the *frame*'s :attr:`~frame.f_locals` attribute. If the frame refers to " +"an :term:`optimized scope`, this returns a write-through proxy object that " +"allows modifying the locals. In all other cases (classes, modules, :func:" +"`exec`, :func:`eval`) it returns the mapping representing the frame locals " +"directly (as described for :func:`locals`)." +msgstr "" + +#: ../../c-api/frame.rst:134 +msgid "As part of :pep:`667`, return a proxy object for optimized scopes." msgstr "" -#: ../../c-api/frame.rst:132 +#: ../../c-api/frame.rst:140 msgid "Return the line number that *frame* is currently executing." msgstr "" -#: ../../c-api/frame.rst:137 +#: ../../c-api/frame.rst:145 msgid "Internal Frames" msgstr "" -#: ../../c-api/frame.rst:139 +#: ../../c-api/frame.rst:147 msgid "Unless using :pep:`523`, you will not need this." msgstr "" -#: ../../c-api/frame.rst:143 +#: ../../c-api/frame.rst:151 msgid "The interpreter's internal frame representation." msgstr "" -#: ../../c-api/frame.rst:149 +#: ../../c-api/frame.rst:157 msgid "Return a :term:`strong reference` to the code object for the frame." msgstr "" -#: ../../c-api/frame.rst:156 +#: ../../c-api/frame.rst:164 msgid "Return the byte offset into the last executed instruction." msgstr "" -#: ../../c-api/frame.rst:163 +#: ../../c-api/frame.rst:171 msgid "" "Return the currently executing line number, or -1 if there is no line number." msgstr "" diff --git a/c-api/function.po b/c-api/function.po index fd946abcb3..c9e9a6c79f 100644 --- a/c-api/function.po +++ b/c-api/function.po @@ -8,7 +8,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-12-13 00:03+0000\n" "PO-Revision-Date: 2022-11-12 15:45+0800\n" diff --git a/c-api/gcsupport.po b/c-api/gcsupport.po index e52f8c9b5d..51c11e9884 100644 --- a/c-api/gcsupport.po +++ b/c-api/gcsupport.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:31+0000\n" diff --git a/c-api/gen.po b/c-api/gen.po index 400aa9f691..a1d498d11c 100644 --- a/c-api/gen.po +++ b/c-api/gen.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-13 00:11+0000\n" "PO-Revision-Date: 2022-10-16 15:33+0800\n" diff --git a/c-api/hash.po b/c-api/hash.po index 543ff1d4b4..42324bd36d 100644 --- a/c-api/hash.po +++ b/c-api/hash.po @@ -5,9 +5,9 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-02-18 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-04-30 00:20+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,7 +22,9 @@ msgid "PyHash API" msgstr "PyHash API" #: ../../c-api/hash.rst:6 -msgid "See also the :c:member:`PyTypeObject.tp_hash` member." +#, fuzzy +msgid "" +"See also the :c:member:`PyTypeObject.tp_hash` member and :ref:`numeric-hash`." msgstr "另請參閱 :c:member:`PyTypeObject.tp_hash` 成員。" #: ../../c-api/hash.rst:10 @@ -33,28 +35,70 @@ msgstr "雜湊值型別:有符號整數。" msgid "Hash value type: unsigned integer." msgstr "雜湊值型別:無符號整數。" -#: ../../c-api/hash.rst:23 +#: ../../c-api/hash.rst:22 +msgid "" +"The `Mersenne prime `_ ``P = " +"2**n -1``, used for numeric hash scheme." +msgstr "" + +#: ../../c-api/hash.rst:28 +msgid "The exponent ``n`` of ``P`` in :c:macro:`PyHASH_MODULUS`." +msgstr "" + +#: ../../c-api/hash.rst:34 +msgid "Prime multiplier used in string and various other hashes." +msgstr "" + +#: ../../c-api/hash.rst:40 +msgid "The hash value returned for a positive infinity." +msgstr "" + +#: ../../c-api/hash.rst:46 +msgid "The multiplier used for the imaginary part of a complex number." +msgstr "" + +#: ../../c-api/hash.rst:52 msgid "Hash function definition used by :c:func:`PyHash_GetFuncDef`." msgstr ":c:func:`PyHash_GetFuncDef` 所使用的雜湊函式定義。" -#: ../../c-api/hash.rst:31 +#: ../../c-api/hash.rst:60 msgid "Hash function name (UTF-8 encoded string)." msgstr "雜湊函式名稱(UTF-8 編碼字串)。" -#: ../../c-api/hash.rst:35 +#: ../../c-api/hash.rst:64 msgid "Internal size of the hash value in bits." msgstr "雜湊值的內部大小(以位元為單位)。" -#: ../../c-api/hash.rst:39 +#: ../../c-api/hash.rst:68 msgid "Size of seed input in bits." msgstr "Seed 輸入的大小(以位元為單位)。" -#: ../../c-api/hash.rst:46 +#: ../../c-api/hash.rst:75 msgid "Get the hash function definition." msgstr "取得雜湊函式定義。" -#: ../../c-api/hash.rst:49 +#: ../../c-api/hash.rst:78 msgid ":pep:`456` \"Secure and interchangeable hash algorithm\"." msgstr "" ":pep:`456`\\ 「安全且可交替使用的雜湊演算法 (Secure and interchangeable hash " "algorithm)」。" + +#: ../../c-api/hash.rst:85 +msgid "" +"Hash a pointer value: process the pointer value as an integer (cast it to " +"``uintptr_t`` internally). The pointer is not dereferenced." +msgstr "" + +#: ../../c-api/hash.rst:88 +msgid "The function cannot fail: it cannot return ``-1``." +msgstr "" + +#: ../../c-api/hash.rst:94 +msgid "" +"Generic hashing function that is meant to be put into a type object's " +"``tp_hash`` slot. Its result only depends on the object's identity." +msgstr "" + +#: ../../c-api/hash.rst:99 +msgid "In CPython, it is equivalent to :c:func:`Py_HashPointer`." +msgstr "" diff --git a/c-api/import.po b/c-api/import.po index 340d9ccd66..96b3529885 100644 --- a/c-api/import.po +++ b/c-api/import.po @@ -6,9 +6,9 @@ # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,13 +41,17 @@ msgid "" "needed anymore." msgstr "" -#: ../../c-api/import.rst:34 +#: ../../c-api/import.rst:29 +msgid "Use :c:func:`PyImport_ImportModule` instead." +msgstr "請改用 :c:func:`PyImport_ImportModule`。" + +#: ../../c-api/import.rst:37 msgid "" "Import a module. This is best described by referring to the built-in Python " "function :func:`__import__`." msgstr "" -#: ../../c-api/import.rst:37 ../../c-api/import.rst:53 +#: ../../c-api/import.rst:40 ../../c-api/import.rst:56 msgid "" "The return value is a new reference to the imported module or top-level " "package, or ``NULL`` with an exception set on failure. Like for :func:" @@ -55,30 +59,30 @@ msgid "" "is normally the top-level package, unless a non-empty *fromlist* was given." msgstr "" -#: ../../c-api/import.rst:43 +#: ../../c-api/import.rst:46 msgid "" "Failing imports remove incomplete module objects, like with :c:func:" "`PyImport_ImportModule`." msgstr "" -#: ../../c-api/import.rst:49 +#: ../../c-api/import.rst:52 msgid "" "Import a module. This is best described by referring to the built-in Python " "function :func:`__import__`, as the standard :func:`__import__` function " "calls this function directly." msgstr "" -#: ../../c-api/import.rst:63 +#: ../../c-api/import.rst:66 msgid "" "Similar to :c:func:`PyImport_ImportModuleLevelObject`, but the name is a " "UTF-8 encoded string instead of a Unicode object." msgstr "" -#: ../../c-api/import.rst:66 +#: ../../c-api/import.rst:69 msgid "Negative values for *level* are no longer accepted." msgstr "" -#: ../../c-api/import.rst:71 +#: ../../c-api/import.rst:74 msgid "" "This is a higher-level interface that calls the current \"import hook " "function\" (with an explicit *level* of 0, meaning absolute import). It " @@ -87,40 +91,59 @@ msgid "" "hooks are installed in the current environment." msgstr "" -#: ../../c-api/import.rst:77 +#: ../../c-api/import.rst:80 msgid "This function always uses absolute imports." msgstr "" -#: ../../c-api/import.rst:82 +#: ../../c-api/import.rst:85 msgid "" "Reload a module. Return a new reference to the reloaded module, or ``NULL`` " "with an exception set on failure (the module still exists in this case)." msgstr "" -#: ../../c-api/import.rst:88 +#: ../../c-api/import.rst:91 +msgid "Return the module object corresponding to a module name." +msgstr "" + +#: ../../c-api/import.rst:93 +msgid "" +"The *name* argument may be of the form ``package.module``. First check the " +"modules dictionary if there's one there, and if not, create a new one and " +"insert it in the modules dictionary." +msgstr "" + +#: ../../c-api/import.rst:97 msgid "" -"Return the module object corresponding to a module name. The *name* " -"argument may be of the form ``package.module``. First check the modules " -"dictionary if there's one there, and if not, create a new one and insert it " -"in the modules dictionary. Return ``NULL`` with an exception set on failure." +"Return a :term:`strong reference` to the module on success. Return ``NULL`` " +"with an exception set on failure." +msgstr "" + +#: ../../c-api/import.rst:100 +msgid "The module name *name* is decoded from UTF-8." msgstr "" -#: ../../c-api/import.rst:95 +#: ../../c-api/import.rst:102 msgid "" "This function does not load or import the module; if the module wasn't " "already loaded, you will get an empty module object. Use :c:func:" -"`PyImport_ImportModule` or one of its variants to import a module. Package " +"`PyImport_ImportModule` or one of its variants to import a module. Package " "structures implied by a dotted name for *name* are not created if not " "already present." msgstr "" -#: ../../c-api/import.rst:105 +#: ../../c-api/import.rst:113 msgid "" -"Similar to :c:func:`PyImport_AddModuleObject`, but the name is a UTF-8 " -"encoded string instead of a Unicode object." +"Similar to :c:func:`PyImport_AddModuleRef`, but return a :term:`borrowed " +"reference` and *name* is a Python :class:`str` object." msgstr "" -#: ../../c-api/import.rst:113 +#: ../../c-api/import.rst:121 +msgid "" +"Similar to :c:func:`PyImport_AddModuleRef`, but return a :term:`borrowed " +"reference`." +msgstr "" + +#: ../../c-api/import.rst:129 msgid "" "Given a module name (possibly of the form ``package.module``) and a code " "object read from a Python bytecode file or obtained from the built-in " @@ -134,7 +157,7 @@ msgid "" "to the module author's intents) state." msgstr "" -#: ../../c-api/import.rst:123 +#: ../../c-api/import.rst:139 msgid "" "The module's :attr:`__spec__` and :attr:`__loader__` will be set, if not set " "already, with the appropriate values. The spec's loader will be set to the " @@ -142,61 +165,61 @@ msgid "" "machinery.SourceFileLoader` otherwise." msgstr "" -#: ../../c-api/import.rst:128 +#: ../../c-api/import.rst:144 msgid "" "The module's :attr:`__file__` attribute will be set to the code object's :" "attr:`~codeobject.co_filename`. If applicable, :attr:`__cached__` will also " "be set." msgstr "" -#: ../../c-api/import.rst:132 +#: ../../c-api/import.rst:148 msgid "" "This function will reload the module if it was already imported. See :c:" "func:`PyImport_ReloadModule` for the intended way to reload a module." msgstr "" -#: ../../c-api/import.rst:135 +#: ../../c-api/import.rst:151 msgid "" "If *name* points to a dotted name of the form ``package.module``, any " "package structures not already created will still not be created." msgstr "" -#: ../../c-api/import.rst:138 +#: ../../c-api/import.rst:154 msgid "" "See also :c:func:`PyImport_ExecCodeModuleEx` and :c:func:" "`PyImport_ExecCodeModuleWithPathnames`." msgstr "" -#: ../../c-api/import.rst:141 +#: ../../c-api/import.rst:157 msgid "" "The setting of :attr:`__cached__` and :attr:`__loader__` is deprecated. See :" "class:`~importlib.machinery.ModuleSpec` for alternatives." msgstr "" -#: ../../c-api/import.rst:149 +#: ../../c-api/import.rst:165 msgid "" "Like :c:func:`PyImport_ExecCodeModule`, but the :attr:`__file__` attribute " "of the module object is set to *pathname* if it is non-``NULL``." msgstr "" -#: ../../c-api/import.rst:152 +#: ../../c-api/import.rst:168 msgid "See also :c:func:`PyImport_ExecCodeModuleWithPathnames`." msgstr "也請見 :c:func:`PyImport_ExecCodeModuleWithPathnames`。" -#: ../../c-api/import.rst:157 +#: ../../c-api/import.rst:173 msgid "" "Like :c:func:`PyImport_ExecCodeModuleEx`, but the :attr:`__cached__` " "attribute of the module object is set to *cpathname* if it is non-``NULL``. " "Of the three functions, this is the preferred one to use." msgstr "" -#: ../../c-api/import.rst:163 +#: ../../c-api/import.rst:179 msgid "" "Setting :attr:`__cached__` is deprecated. See :class:`~importlib.machinery." "ModuleSpec` for alternatives." msgstr "" -#: ../../c-api/import.rst:170 +#: ../../c-api/import.rst:186 msgid "" "Like :c:func:`PyImport_ExecCodeModuleObject`, but *name*, *pathname* and " "*cpathname* are UTF-8 encoded strings. Attempts are also made to figure out " @@ -204,48 +227,48 @@ msgid "" "set to ``NULL``." msgstr "" -#: ../../c-api/import.rst:176 +#: ../../c-api/import.rst:192 msgid "" "Uses :func:`!imp.source_from_cache` in calculating the source path if only " "the bytecode path is provided." msgstr "" -#: ../../c-api/import.rst:179 +#: ../../c-api/import.rst:195 msgid "No longer uses the removed :mod:`!imp` module." msgstr "不再使用已被移除的 :mod:`!imp` 模組。" -#: ../../c-api/import.rst:185 +#: ../../c-api/import.rst:201 msgid "" "Return the magic number for Python bytecode files (a.k.a. :file:`.pyc` " "file). The magic number should be present in the first four bytes of the " "bytecode file, in little-endian byte order. Returns ``-1`` on error." msgstr "" -#: ../../c-api/import.rst:189 +#: ../../c-api/import.rst:205 msgid "Return value of ``-1`` upon failure." msgstr "當失敗時回傳 ``-1``。" -#: ../../c-api/import.rst:195 +#: ../../c-api/import.rst:211 msgid "" "Return the magic tag string for :pep:`3147` format Python bytecode file " "names. Keep in mind that the value at ``sys.implementation.cache_tag`` is " "authoritative and should be used instead of this function." msgstr "" -#: ../../c-api/import.rst:203 +#: ../../c-api/import.rst:219 msgid "" "Return the dictionary used for the module administration (a.k.a. ``sys." "modules``). Note that this is a per-interpreter variable." msgstr "" -#: ../../c-api/import.rst:208 +#: ../../c-api/import.rst:224 msgid "" "Return the already imported module with the given name. If the module has " "not been imported yet then returns ``NULL`` but does not set an error. " "Returns ``NULL`` and sets an error if the lookup failed." msgstr "" -#: ../../c-api/import.rst:216 +#: ../../c-api/import.rst:232 msgid "" "Return a finder object for a :data:`sys.path`/:attr:`!pkg.__path__` item " "*path*, possibly by fetching it from the :data:`sys.path_importer_cache` " @@ -256,7 +279,7 @@ msgid "" "path_importer_cache`. Return a new reference to the finder object." msgstr "" -#: ../../c-api/import.rst:227 +#: ../../c-api/import.rst:243 msgid "" "Load a frozen module named *name*. Return ``1`` for success, ``0`` if the " "module is not found, and ``-1`` with an exception set if the initialization " @@ -265,17 +288,17 @@ msgid "" "the module if it was already imported.)" msgstr "" -#: ../../c-api/import.rst:235 +#: ../../c-api/import.rst:251 msgid "The ``__file__`` attribute is no longer set on the module." msgstr "" -#: ../../c-api/import.rst:241 +#: ../../c-api/import.rst:257 msgid "" "Similar to :c:func:`PyImport_ImportFrozenModuleObject`, but the name is a " "UTF-8 encoded string instead of a Unicode object." msgstr "" -#: ../../c-api/import.rst:249 +#: ../../c-api/import.rst:265 msgid "" "This is the structure type definition for frozen module descriptors, as " "generated by the :program:`freeze` utility (see :file:`Tools/freeze/` in the " @@ -283,7 +306,7 @@ msgid "" "h`, is::" msgstr "" -#: ../../c-api/import.rst:254 +#: ../../c-api/import.rst:270 msgid "" "struct _frozen {\n" " const char *name;\n" @@ -299,13 +322,13 @@ msgstr "" " bool is_package;\n" "};" -#: ../../c-api/import.rst:261 +#: ../../c-api/import.rst:277 msgid "" "The new ``is_package`` field indicates whether the module is a package or " "not. This replaces setting the ``size`` field to a negative value." msgstr "" -#: ../../c-api/import.rst:267 +#: ../../c-api/import.rst:283 msgid "" "This pointer is initialized to point to an array of :c:struct:`_frozen` " "records, terminated by one whose members are all ``NULL`` or zero. When a " @@ -314,7 +337,7 @@ msgid "" "frozen modules." msgstr "" -#: ../../c-api/import.rst:275 +#: ../../c-api/import.rst:291 msgid "" "Add a single module to the existing table of built-in modules. This is a " "convenience wrapper around :c:func:`PyImport_ExtendInittab`, returning " @@ -324,7 +347,7 @@ msgid "" "before :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/import.rst:285 +#: ../../c-api/import.rst:301 msgid "" "Structure describing a single entry in the list of built-in modules. " "Programs which embed Python may use an array of these structures in " @@ -332,15 +355,15 @@ msgid "" "built-in modules. The structure consists of two members:" msgstr "" -#: ../../c-api/import.rst:293 +#: ../../c-api/import.rst:309 msgid "The module name, as an ASCII encoded string." msgstr "" -#: ../../c-api/import.rst:297 +#: ../../c-api/import.rst:313 msgid "Initialization function for a module built into the interpreter." msgstr "" -#: ../../c-api/import.rst:302 +#: ../../c-api/import.rst:318 msgid "" "Add a collection of modules to the table of built-in modules. The *newtab* " "array must end with a sentinel entry which contains ``NULL`` for the :c:" @@ -351,7 +374,7 @@ msgid "" "before :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/import.rst:309 +#: ../../c-api/import.rst:325 msgid "" "If Python is initialized multiple times, :c:func:`PyImport_AppendInittab` " "or :c:func:`PyImport_ExtendInittab` must be called before each Python " @@ -374,18 +397,18 @@ msgstr "__all__(套件變數)" msgid "modules (in module sys)" msgstr "modules(sys 模組中)" -#: ../../c-api/import.rst:32 ../../c-api/import.rst:111 +#: ../../c-api/import.rst:35 ../../c-api/import.rst:127 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/import.rst:32 +#: ../../c-api/import.rst:35 msgid "__import__" msgstr "__import__" -#: ../../c-api/import.rst:111 +#: ../../c-api/import.rst:127 msgid "compile" msgstr "compile(編譯)" -#: ../../c-api/import.rst:247 +#: ../../c-api/import.rst:263 msgid "freeze utility" msgstr "freeze utility(凍結工具)" diff --git a/c-api/index.po b/c-api/index.po index d1aa91e806..7e0a7df309 100644 --- a/c-api/index.po +++ b/c-api/index.po @@ -8,7 +8,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-07-05 21:11+0800\n" diff --git a/c-api/init.po b/c-api/init.po index 8f5da7b89d..f06d0dbb97 100644 --- a/c-api/init.po +++ b/c-api/init.po @@ -6,9 +6,9 @@ # Adrian Liaw , 2018 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" "PO-Revision-Date: 2023-04-24 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -74,98 +74,94 @@ msgid ":c:func:`PyObject_SetArenaAllocator`" msgstr ":c:func:`PyObject_SetArenaAllocator`" #: ../../c-api/init.rst:32 -msgid ":c:func:`Py_SetPath`" -msgstr ":c:func:`Py_SetPath`" - -#: ../../c-api/init.rst:33 msgid ":c:func:`Py_SetProgramName`" msgstr ":c:func:`Py_SetProgramName`" -#: ../../c-api/init.rst:34 +#: ../../c-api/init.rst:33 msgid ":c:func:`Py_SetPythonHome`" msgstr ":c:func:`Py_SetPythonHome`" -#: ../../c-api/init.rst:35 -msgid ":c:func:`Py_SetStandardStreamEncoding`" -msgstr ":c:func:`Py_SetStandardStreamEncoding`" - -#: ../../c-api/init.rst:36 -msgid ":c:func:`PySys_AddWarnOption`" -msgstr ":c:func:`PySys_AddWarnOption`" - -#: ../../c-api/init.rst:37 -msgid ":c:func:`PySys_AddXOption`" -msgstr ":c:func:`PySys_AddXOption`" - -#: ../../c-api/init.rst:38 +#: ../../c-api/init.rst:34 msgid ":c:func:`PySys_ResetWarnOptions`" msgstr ":c:func:`PySys_ResetWarnOptions`" -#: ../../c-api/init.rst:40 +#: ../../c-api/init.rst:36 msgid "Informative functions:" msgstr "" -#: ../../c-api/init.rst:42 +#: ../../c-api/init.rst:38 msgid ":c:func:`Py_IsInitialized`" msgstr ":c:func:`Py_IsInitialized`" -#: ../../c-api/init.rst:43 +#: ../../c-api/init.rst:39 msgid ":c:func:`PyMem_GetAllocator`" msgstr ":c:func:`PyMem_GetAllocator`" -#: ../../c-api/init.rst:44 +#: ../../c-api/init.rst:40 msgid ":c:func:`PyObject_GetArenaAllocator`" msgstr ":c:func:`PyObject_GetArenaAllocator`" -#: ../../c-api/init.rst:45 +#: ../../c-api/init.rst:41 msgid ":c:func:`Py_GetBuildInfo`" msgstr ":c:func:`Py_GetBuildInfo`" -#: ../../c-api/init.rst:46 +#: ../../c-api/init.rst:42 msgid ":c:func:`Py_GetCompiler`" msgstr ":c:func:`Py_GetCompiler`" -#: ../../c-api/init.rst:47 +#: ../../c-api/init.rst:43 msgid ":c:func:`Py_GetCopyright`" msgstr ":c:func:`Py_GetCopyright`" -#: ../../c-api/init.rst:48 +#: ../../c-api/init.rst:44 msgid ":c:func:`Py_GetPlatform`" msgstr ":c:func:`Py_GetPlatform`" -#: ../../c-api/init.rst:49 +#: ../../c-api/init.rst:45 msgid ":c:func:`Py_GetVersion`" msgstr ":c:func:`Py_GetVersion`" -#: ../../c-api/init.rst:51 +#: ../../c-api/init.rst:47 msgid "Utilities:" msgstr "" -#: ../../c-api/init.rst:53 +#: ../../c-api/init.rst:49 msgid ":c:func:`Py_DecodeLocale`" msgstr ":c:func:`Py_DecodeLocale`" -#: ../../c-api/init.rst:55 +#: ../../c-api/init.rst:51 msgid "Memory allocators:" msgstr "" -#: ../../c-api/init.rst:57 +#: ../../c-api/init.rst:53 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../c-api/init.rst:58 +#: ../../c-api/init.rst:54 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../c-api/init.rst:59 +#: ../../c-api/init.rst:55 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../c-api/init.rst:60 +#: ../../c-api/init.rst:56 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../c-api/init.rst:64 +#: ../../c-api/init.rst:58 +msgid "Synchronization:" +msgstr "" + +#: ../../c-api/init.rst:60 +msgid ":c:func:`PyMutex_Lock`" +msgstr ":c:func:`PyMutex_Lock`" + +#: ../../c-api/init.rst:61 +msgid ":c:func:`PyMutex_Unlock`" +msgstr ":c:func:`PyMutex_Unlock`" + +#: ../../c-api/init.rst:65 msgid "" "The following functions **should not be called** before :c:func:" "`Py_Initialize`: :c:func:`Py_EncodeLocale`, :c:func:`Py_GetPath`, :c:func:" @@ -174,18 +170,18 @@ msgid "" "`Py_GetProgramName` and :c:func:`PyEval_InitThreads`." msgstr "" -#: ../../c-api/init.rst:74 +#: ../../c-api/init.rst:75 msgid "Global configuration variables" msgstr "" -#: ../../c-api/init.rst:76 +#: ../../c-api/init.rst:77 msgid "" "Python has variables for the global configuration to control different " "features and options. By default, these flags are controlled by :ref:" "`command line options `." msgstr "" -#: ../../c-api/init.rst:80 +#: ../../c-api/init.rst:81 msgid "" "When a flag is set by an option, the value of the flag is the number of " "times that the option was set. For example, ``-b`` sets :c:data:" @@ -193,108 +189,108 @@ msgid "" "2." msgstr "" -#: ../../c-api/init.rst:86 +#: ../../c-api/init.rst:87 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "bytes_warning` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:90 +#: ../../c-api/init.rst:91 msgid "" "Issue a warning when comparing :class:`bytes` or :class:`bytearray` with :" "class:`str` or :class:`bytes` with :class:`int`. Issue an error if greater " "or equal to ``2``." msgstr "" -#: ../../c-api/init.rst:94 +#: ../../c-api/init.rst:95 msgid "Set by the :option:`-b` option." msgstr "由 :option:`-b` 選項設定。" -#: ../../c-api/init.rst:100 +#: ../../c-api/init.rst:101 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "parser_debug` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:104 +#: ../../c-api/init.rst:105 msgid "" "Turn on parser debugging output (for expert only, depending on compilation " "options)." msgstr "" -#: ../../c-api/init.rst:107 +#: ../../c-api/init.rst:108 msgid "" "Set by the :option:`-d` option and the :envvar:`PYTHONDEBUG` environment " "variable." msgstr "由 :option:`-d` 選項與 :envvar:`PYTHONDEBUG` 環境變數設定。" -#: ../../c-api/init.rst:114 +#: ../../c-api/init.rst:115 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "write_bytecode` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:118 +#: ../../c-api/init.rst:119 msgid "" "If set to non-zero, Python won't try to write ``.pyc`` files on the import " "of source modules." msgstr "" -#: ../../c-api/init.rst:121 +#: ../../c-api/init.rst:122 msgid "" "Set by the :option:`-B` option and the :envvar:`PYTHONDONTWRITEBYTECODE` " "environment variable." msgstr "" "由 :option:`-B` 選項與 :envvar:`PYTHONDONTWRITEBYTECODE` 環境變數設定。" -#: ../../c-api/init.rst:128 +#: ../../c-api/init.rst:129 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "pathconfig_warnings` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:132 +#: ../../c-api/init.rst:133 msgid "" "Suppress error messages when calculating the module search path in :c:func:" "`Py_GetPath`." msgstr "" -#: ../../c-api/init.rst:135 +#: ../../c-api/init.rst:136 msgid "Private flag used by ``_freeze_module`` and ``frozenmain`` programs." msgstr "" -#: ../../c-api/init.rst:141 +#: ../../c-api/init.rst:142 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "hash_seed` and :c:member:`PyConfig.use_hash_seed` should be used instead, " "see :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:146 +#: ../../c-api/init.rst:147 msgid "" "Set to ``1`` if the :envvar:`PYTHONHASHSEED` environment variable is set to " "a non-empty string." msgstr "" "如果環境變數 :envvar:`PYTHONHASHSEED` 被設定為一個非空字串則設為 ``1``。" -#: ../../c-api/init.rst:149 +#: ../../c-api/init.rst:150 msgid "" "If the flag is non-zero, read the :envvar:`PYTHONHASHSEED` environment " "variable to initialize the secret hash seed." msgstr "" -#: ../../c-api/init.rst:156 +#: ../../c-api/init.rst:157 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "use_environment` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:160 +#: ../../c-api/init.rst:161 msgid "" "Ignore all :envvar:`!PYTHON*` environment variables, e.g. :envvar:" "`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set." @@ -302,73 +298,73 @@ msgstr "" "忽略所有可能被設定的 :envvar:`!PYTHON*` 環境變數,例如 :envvar:`PYTHONPATH` " "與 :envvar:`PYTHONHOME`。" -#: ../../c-api/init.rst:163 +#: ../../c-api/init.rst:164 msgid "Set by the :option:`-E` and :option:`-I` options." msgstr "由 :option:`-E` 與 :option:`-I` 選項設定。" -#: ../../c-api/init.rst:169 +#: ../../c-api/init.rst:170 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "inspect` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:173 +#: ../../c-api/init.rst:174 msgid "" "When a script is passed as first argument or the :option:`-c` option is " "used, enter interactive mode after executing the script or the command, even " "when :data:`sys.stdin` does not appear to be a terminal." msgstr "" -#: ../../c-api/init.rst:177 +#: ../../c-api/init.rst:178 msgid "" "Set by the :option:`-i` option and the :envvar:`PYTHONINSPECT` environment " "variable." msgstr "由 :option:`-i` 選項與 :envvar:`PYTHONINSPECT` 環境變數設定。" -#: ../../c-api/init.rst:184 +#: ../../c-api/init.rst:185 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "interactive` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:188 +#: ../../c-api/init.rst:189 msgid "Set by the :option:`-i` option." msgstr "由 :option:`-i` 選項設定。" -#: ../../c-api/init.rst:194 +#: ../../c-api/init.rst:195 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "isolated` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:198 +#: ../../c-api/init.rst:199 msgid "" "Run Python in isolated mode. In isolated mode :data:`sys.path` contains " "neither the script's directory nor the user's site-packages directory." msgstr "" -#: ../../c-api/init.rst:201 +#: ../../c-api/init.rst:202 msgid "Set by the :option:`-I` option." msgstr "由 :option:`-i` 選項設定。" -#: ../../c-api/init.rst:209 +#: ../../c-api/init.rst:210 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyPreConfig." "legacy_windows_fs_encoding` should be used instead, see :ref:`Python " "Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:213 +#: ../../c-api/init.rst:214 msgid "" "If the flag is non-zero, use the ``mbcs`` encoding with ``replace`` error " "handler, instead of the UTF-8 encoding with ``surrogatepass`` error handler, " "for the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/init.rst:217 +#: ../../c-api/init.rst:218 msgid "" "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment " "variable is set to a non-empty string." @@ -376,45 +372,45 @@ msgstr "" "如果環境變數 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 被設定為一個非空字串則設" "為 ``1``。" -#: ../../c-api/init.rst:220 +#: ../../c-api/init.rst:221 msgid "See :pep:`529` for more details." msgstr "更多詳情請見 :pep:`529`。" -#: ../../c-api/init.rst:222 ../../c-api/init.rst:240 +#: ../../c-api/init.rst:223 ../../c-api/init.rst:241 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../c-api/init.rst:228 +#: ../../c-api/init.rst:229 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "legacy_windows_stdio` should be used instead, see :ref:`Python " "Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:232 +#: ../../c-api/init.rst:233 msgid "" "If the flag is non-zero, use :class:`io.FileIO` instead of :class:`!io." "_WindowsConsoleIO` for :mod:`sys` standard streams." msgstr "" -#: ../../c-api/init.rst:235 +#: ../../c-api/init.rst:236 msgid "" "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment variable " "is set to a non-empty string." msgstr "" -#: ../../c-api/init.rst:238 +#: ../../c-api/init.rst:239 msgid "See :pep:`528` for more details." msgstr "更多詳情請見 :pep:`528`。" -#: ../../c-api/init.rst:246 +#: ../../c-api/init.rst:247 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "site_import` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:250 +#: ../../c-api/init.rst:251 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " @@ -422,24 +418,24 @@ msgid "" "main` if you want them to be triggered)." msgstr "" -#: ../../c-api/init.rst:255 +#: ../../c-api/init.rst:256 msgid "Set by the :option:`-S` option." msgstr "由 :option:`-S` 選項設定。" -#: ../../c-api/init.rst:261 +#: ../../c-api/init.rst:262 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "user_site_directory` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:265 +#: ../../c-api/init.rst:266 msgid "" "Don't add the :data:`user site-packages directory ` to :data:" "`sys.path`." msgstr "" -#: ../../c-api/init.rst:268 +#: ../../c-api/init.rst:269 msgid "" "Set by the :option:`-s` and :option:`-I` options, and the :envvar:" "`PYTHONNOUSERSITE` environment variable." @@ -447,60 +443,60 @@ msgstr "" "由 :option:`-s` 選項、:option:`-I` 選項與 :envvar:`PYTHONNOUSERSITE` 環境變數" "設定。" -#: ../../c-api/init.rst:275 +#: ../../c-api/init.rst:276 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "optimization_level` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:279 +#: ../../c-api/init.rst:280 msgid "" "Set by the :option:`-O` option and the :envvar:`PYTHONOPTIMIZE` environment " "variable." msgstr "由 :option:`-O` 選項與 :envvar:`PYTHONOPTIMIZE` 環境變數設定。" -#: ../../c-api/init.rst:286 +#: ../../c-api/init.rst:287 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "quiet` should be used instead, see :ref:`Python Initialization Configuration " "`." msgstr "" -#: ../../c-api/init.rst:290 +#: ../../c-api/init.rst:291 msgid "" "Don't display the copyright and version messages even in interactive mode." msgstr "" -#: ../../c-api/init.rst:292 +#: ../../c-api/init.rst:293 msgid "Set by the :option:`-q` option." msgstr "由 :option:`-q` 選項設定。" -#: ../../c-api/init.rst:300 +#: ../../c-api/init.rst:301 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "buffered_stdio` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:304 +#: ../../c-api/init.rst:305 msgid "Force the stdout and stderr streams to be unbuffered." msgstr "" -#: ../../c-api/init.rst:306 +#: ../../c-api/init.rst:307 msgid "" "Set by the :option:`-u` option and the :envvar:`PYTHONUNBUFFERED` " "environment variable." msgstr "由 :option:`-u` 選項與 :envvar:`PYTHONUNBUFFERED` 環境變數設定。" -#: ../../c-api/init.rst:313 +#: ../../c-api/init.rst:314 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "verbose` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:317 +#: ../../c-api/init.rst:318 msgid "" "Print a message each time a module is initialized, showing the place " "(filename or built-in module) from which it is loaded. If greater or equal " @@ -508,29 +504,30 @@ msgid "" "for a module. Also provides information on module cleanup at exit." msgstr "" -#: ../../c-api/init.rst:322 +#: ../../c-api/init.rst:323 msgid "" "Set by the :option:`-v` option and the :envvar:`PYTHONVERBOSE` environment " "variable." msgstr "由 :option:`-v` 選項與 :envvar:`PYTHONVERBOSE` 環境變數設定。" -#: ../../c-api/init.rst:329 +#: ../../c-api/init.rst:330 msgid "Initializing and finalizing the interpreter" msgstr "" -#: ../../c-api/init.rst:347 +#: ../../c-api/init.rst:345 msgid "" "Initialize the Python interpreter. In an application embedding Python, " "this should be called before using any other Python/C API functions; see :" "ref:`Before Python Initialization ` for the few exceptions." msgstr "" -#: ../../c-api/init.rst:351 +#: ../../c-api/init.rst:349 msgid "" "This initializes the table of loaded modules (``sys.modules``), and creates " "the fundamental modules :mod:`builtins`, :mod:`__main__` and :mod:`sys`. It " "also initializes the module search path (``sys.path``). It does not set " -"``sys.argv``; use :c:func:`PySys_SetArgvEx` for that. This is a no-op when " +"``sys.argv``; use the new :c:type:`PyConfig` API of the :ref:`Python " +"Initialization Configuration ` for that. This is a no-op when " "called for a second time (without calling :c:func:`Py_FinalizeEx` first). " "There is no return value; it is a fatal error if the initialization fails." msgstr "" @@ -563,6 +560,12 @@ msgstr "" #: ../../c-api/init.rst:386 msgid "" +"Return true (non-zero) if the main Python interpreter is :term:`shutting " +"down `. Return false (zero) otherwise." +msgstr "" + +#: ../../c-api/init.rst:394 +msgid "" "Undo all initializations made by :c:func:`Py_Initialize` and subsequent use " "of Python/C API functions, and destroy all sub-interpreters (see :c:func:" "`Py_NewInterpreter` below) that were created and not yet destroyed since the " @@ -571,7 +574,7 @@ msgid "" "second time (without calling :c:func:`Py_Initialize` again first)." msgstr "" -#: ../../c-api/init.rst:393 +#: ../../c-api/init.rst:401 msgid "" "Since this is the reverse of :c:func:`Py_Initialize`, it should be called in " "the same thread with the same interpreter active. That means the main " @@ -579,13 +582,13 @@ msgid "" "`Py_RunMain` is running." msgstr "" -#: ../../c-api/init.rst:398 +#: ../../c-api/init.rst:406 msgid "" "Normally the return value is ``0``. If there were errors during finalization " "(flushing buffered data), ``-1`` is returned." msgstr "" -#: ../../c-api/init.rst:402 +#: ../../c-api/init.rst:410 msgid "" "This function is provided for a number of reasons. An embedding application " "might want to restart Python without having to restart the application " @@ -596,7 +599,7 @@ msgid "" "Python before exiting from the application." msgstr "" -#: ../../c-api/init.rst:410 +#: ../../c-api/init.rst:418 msgid "" "**Bugs and caveats:** The destruction of modules and objects in modules is " "done in random order; this may cause destructors (:meth:`~object.__del__` " @@ -611,7 +614,7 @@ msgid "" "more than once." msgstr "" -#: ../../c-api/init.rst:421 +#: ../../c-api/init.rst:429 msgid "" "Raises an :ref:`auditing event ` ``cpython." "_PySys_ClearAuditHooks`` with no arguments." @@ -619,68 +622,24 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "_PySys_ClearAuditHooks``。" -#: ../../c-api/init.rst:427 +#: ../../c-api/init.rst:435 msgid "" "This is a backwards-compatible version of :c:func:`Py_FinalizeEx` that " "disregards the return value." msgstr "" -#: ../../c-api/init.rst:432 +#: ../../c-api/init.rst:440 msgid "Process-wide parameters" msgstr "" -#: ../../c-api/init.rst:442 -msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"stdio_encoding` and :c:member:`PyConfig.stdio_errors` should be used " -"instead, see :ref:`Python Initialization Configuration `." -msgstr "" - -#: ../../c-api/init.rst:447 -msgid "" -"This function should be called before :c:func:`Py_Initialize`, if it is " -"called at all. It specifies which encoding and error handling to use with " -"standard IO, with the same meanings as in :func:`str.encode`." -msgstr "" - -#: ../../c-api/init.rst:451 -msgid "" -"It overrides :envvar:`PYTHONIOENCODING` values, and allows embedding code to " -"control IO encoding when the environment variable does not work." -msgstr "" - -#: ../../c-api/init.rst:454 -msgid "" -"*encoding* and/or *errors* may be ``NULL`` to use :envvar:`PYTHONIOENCODING` " -"and/or default values (depending on other settings)." -msgstr "" - -#: ../../c-api/init.rst:458 -msgid "" -"Note that :data:`sys.stderr` always uses the \"backslashreplace\" error " -"handler, regardless of this (or any other) setting." -msgstr "" - -#: ../../c-api/init.rst:461 -msgid "" -"If :c:func:`Py_FinalizeEx` is called, this function will need to be called " -"again in order to affect subsequent calls to :c:func:`Py_Initialize`." -msgstr "" - -#: ../../c-api/init.rst:464 -msgid "" -"Returns ``0`` if successful, a nonzero value on error (e.g. calling after " -"the interpreter has already been initialized)." -msgstr "" - -#: ../../c-api/init.rst:479 +#: ../../c-api/init.rst:450 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "program_name` should be used instead, see :ref:`Python Initialization " "Configuration `." msgstr "" -#: ../../c-api/init.rst:483 +#: ../../c-api/init.rst:454 msgid "" "This function should be called before :c:func:`Py_Initialize` is called for " "the first time, if it is called at all. It tells the interpreter the value " @@ -694,36 +653,41 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:494 +#: ../../c-api/init.rst:465 ../../c-api/init.rst:704 ../../c-api/init.rst:740 +#: ../../c-api/init.rst:766 msgid "" "Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" -"`wchar_t *` string." +"`wchar_*` string." msgstr "" -#: ../../c-api/init.rst:504 +#: ../../c-api/init.rst:473 msgid "" -"Return the program name set with :c:func:`Py_SetProgramName`, or the " +"Return the program name set with :c:member:`PyConfig.program_name`, or the " "default. The returned string points into static storage; the caller should " "not modify its value." msgstr "" -#: ../../c-api/init.rst:508 ../../c-api/init.rst:527 ../../c-api/init.rst:568 -#: ../../c-api/init.rst:587 ../../c-api/init.rst:611 ../../c-api/init.rst:834 +#: ../../c-api/init.rst:477 ../../c-api/init.rst:499 ../../c-api/init.rst:543 +#: ../../c-api/init.rst:564 ../../c-api/init.rst:590 ../../c-api/init.rst:778 msgid "" "This function should not be called before :c:func:`Py_Initialize`, otherwise " "it returns ``NULL``." msgstr "此函式不應該在 :c:func:`Py_Initialize` 之前呼叫,否則會回傳 ``NULL``。" -#: ../../c-api/init.rst:511 ../../c-api/init.rst:530 ../../c-api/init.rst:571 -#: ../../c-api/init.rst:590 ../../c-api/init.rst:616 ../../c-api/init.rst:837 +#: ../../c-api/init.rst:480 ../../c-api/init.rst:502 ../../c-api/init.rst:546 +#: ../../c-api/init.rst:567 ../../c-api/init.rst:595 ../../c-api/init.rst:781 msgid "It now returns ``NULL`` if called before :c:func:`Py_Initialize`." msgstr "如果在 :c:func:`Py_Initialize` 之前呼叫,現在會回傳 ``NULL``。" -#: ../../c-api/init.rst:517 +#: ../../c-api/init.rst:483 ../../c-api/init.rst:570 +msgid "Get :data:`sys.executable` instead." +msgstr "" + +#: ../../c-api/init.rst:489 msgid "" "Return the *prefix* for installed platform-independent files. This is " "derived through a number of complicated rules from the program name set " -"with :c:func:`Py_SetProgramName` and some environment variables; for " +"with :c:member:`PyConfig.program_name` and some environment variables; for " "example, if the program name is ``'/usr/local/bin/python'``, the prefix is " "``'/usr/local'``. The returned string points into static storage; the caller " "should not modify its value. This corresponds to the :makevar:`prefix` " @@ -733,11 +697,15 @@ msgid "" "also the next function." msgstr "" -#: ../../c-api/init.rst:536 +#: ../../c-api/init.rst:505 +msgid "Get :data:`sys.prefix` instead." +msgstr "" + +#: ../../c-api/init.rst:511 msgid "" "Return the *exec-prefix* for installed platform-*dependent* files. This is " "derived through a number of complicated rules from the program name set " -"with :c:func:`Py_SetProgramName` and some environment variables; for " +"with :c:member:`PyConfig.program_name` and some environment variables; for " "example, if the program name is ``'/usr/local/bin/python'``, the exec-prefix " "is ``'/usr/local'``. The returned string points into static storage; the " "caller should not modify its value. This corresponds to the :makevar:" @@ -747,7 +715,7 @@ msgid "" "on Unix." msgstr "" -#: ../../c-api/init.rst:546 +#: ../../c-api/init.rst:521 msgid "" "Background: The exec-prefix differs from the prefix when platform dependent " "files (such as executables and shared libraries) are installed in a " @@ -756,7 +724,7 @@ msgid "" "independent may be installed in :file:`/usr/local`." msgstr "" -#: ../../c-api/init.rst:552 +#: ../../c-api/init.rst:527 msgid "" "Generally speaking, a platform is a combination of hardware and software " "families, e.g. Sparc machines running the Solaris 2.x operating system are " @@ -770,7 +738,7 @@ msgid "" "independent from the Python version by which they were compiled!)." msgstr "" -#: ../../c-api/init.rst:563 +#: ../../c-api/init.rst:538 msgid "" "System administrators will know how to configure the :program:`mount` or :" "program:`automount` programs to share :file:`/usr/local` between platforms " @@ -778,19 +746,23 @@ msgid "" "platform." msgstr "" -#: ../../c-api/init.rst:581 +#: ../../c-api/init.rst:549 +msgid "Get :data:`sys.exec_prefix` instead." +msgstr "" + +#: ../../c-api/init.rst:558 msgid "" "Return the full program name of the Python executable; this is computed as " "a side-effect of deriving the default module search path from the program " -"name (set by :c:func:`Py_SetProgramName` above). The returned string points " +"name (set by :c:member:`PyConfig.program_name`). The returned string points " "into static storage; the caller should not modify its value. The value is " "available to Python code as ``sys.executable``." msgstr "" -#: ../../c-api/init.rst:601 +#: ../../c-api/init.rst:580 msgid "" "Return the default module search path; this is computed from the program " -"name (set by :c:func:`Py_SetProgramName` above) and some environment " +"name (set by :c:member:`PyConfig.program_name`) and some environment " "variables. The returned string consists of a series of directory names " "separated by a platform dependent delimiter character. The delimiter " "character is ``':'`` on Unix and macOS, ``';'`` on Windows. The returned " @@ -800,63 +772,21 @@ msgid "" "for loading modules." msgstr "" -#: ../../c-api/init.rst:627 -msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"module_search_paths` and :c:member:`PyConfig.module_search_paths_set` should " -"be used instead, see :ref:`Python Initialization Configuration `." -msgstr "" - -#: ../../c-api/init.rst:632 -msgid "" -"Set the default module search path. If this function is called before :c:" -"func:`Py_Initialize`, then :c:func:`Py_GetPath` won't attempt to compute a " -"default search path but uses the one provided instead. This is useful if " -"Python is embedded by an application that has full knowledge of the location " -"of all modules. The path components should be separated by the platform " -"dependent delimiter character, which is ``':'`` on Unix and macOS, ``';'`` " -"on Windows." -msgstr "" - -#: ../../c-api/init.rst:640 -msgid "" -"This also causes :data:`sys.executable` to be set to the program full path " -"(see :c:func:`Py_GetProgramFullPath`) and for :data:`sys.prefix` and :data:" -"`sys.exec_prefix` to be empty. It is up to the caller to modify these if " -"required after calling :c:func:`Py_Initialize`." -msgstr "" - -#: ../../c-api/init.rst:645 ../../c-api/init.rst:760 ../../c-api/init.rst:796 -#: ../../c-api/init.rst:822 -msgid "" -"Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a :c:expr:" -"`wchar_*` string." +#: ../../c-api/init.rst:598 +msgid "Get :data:`sys.path` instead." msgstr "" -#: ../../c-api/init.rst:648 -msgid "" -"The path argument is copied internally, so the caller may free it after the " -"call completes." -msgstr "" - -#: ../../c-api/init.rst:651 -msgid "" -"The program full path is now used for :data:`sys.executable`, instead of the " -"program name." -msgstr "" - -#: ../../c-api/init.rst:660 +#: ../../c-api/init.rst:604 msgid "" "Return the version of this Python interpreter. This is a string that looks " "something like ::" msgstr "" -#: ../../c-api/init.rst:663 +#: ../../c-api/init.rst:607 msgid "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" msgstr "\"3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \\n[GCC 4.2.3]\"" -#: ../../c-api/init.rst:667 +#: ../../c-api/init.rst:611 msgid "" "The first word (up to the first space character) is the current Python " "version; the first characters are the major and minor version separated by a " @@ -865,11 +795,11 @@ msgid "" "version`." msgstr "" -#: ../../c-api/init.rst:672 +#: ../../c-api/init.rst:616 msgid "See also the :c:var:`Py_Version` constant." msgstr "" -#: ../../c-api/init.rst:679 +#: ../../c-api/init.rst:623 msgid "" "Return the platform identifier for the current platform. On Unix, this is " "formed from the \"official\" name of the operating system, converted to " @@ -880,50 +810,50 @@ msgid "" "available to Python code as ``sys.platform``." msgstr "" -#: ../../c-api/init.rst:690 +#: ../../c-api/init.rst:634 msgid "" "Return the official copyright string for the current Python version, for " "example" msgstr "" -#: ../../c-api/init.rst:692 +#: ../../c-api/init.rst:636 msgid "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" msgstr "``'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'``" -#: ../../c-api/init.rst:696 +#: ../../c-api/init.rst:640 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as ``sys.copyright``." msgstr "" -#: ../../c-api/init.rst:702 +#: ../../c-api/init.rst:646 msgid "" "Return an indication of the compiler used to build the current Python " "version, in square brackets, for example::" msgstr "" -#: ../../c-api/init.rst:705 +#: ../../c-api/init.rst:649 msgid "\"[GCC 2.7.2.2]\"" msgstr "\"[GCC 2.7.2.2]\"" -#: ../../c-api/init.rst:709 ../../c-api/init.rst:723 +#: ../../c-api/init.rst:653 ../../c-api/init.rst:667 msgid "" "The returned string points into static storage; the caller should not modify " "its value. The value is available to Python code as part of the variable " "``sys.version``." msgstr "" -#: ../../c-api/init.rst:716 +#: ../../c-api/init.rst:660 msgid "" "Return information about the sequence number and build date and time of the " "current Python interpreter instance, for example ::" msgstr "" -#: ../../c-api/init.rst:719 +#: ../../c-api/init.rst:663 msgid "\"#67, Aug 1 1997, 22:34:28\"" msgstr "\"#67, Aug 1 1997, 22:34:28\"" -#: ../../c-api/init.rst:735 +#: ../../c-api/init.rst:679 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv`, :c:member:`PyConfig.parse_argv` and :c:member:`PyConfig.safe_path` " @@ -931,7 +861,7 @@ msgid "" "config>`." msgstr "" -#: ../../c-api/init.rst:740 +#: ../../c-api/init.rst:684 msgid "" "Set :data:`sys.argv` based on *argc* and *argv*. These parameters are " "similar to those passed to the program's :c:func:`main` function with the " @@ -942,84 +872,84 @@ msgid "" "fatal condition is signalled using :c:func:`Py_FatalError`." msgstr "" -#: ../../c-api/init.rst:748 +#: ../../c-api/init.rst:692 msgid "" "If *updatepath* is zero, this is all the function does. If *updatepath* is " "non-zero, the function also modifies :data:`sys.path` according to the " "following algorithm:" msgstr "" -#: ../../c-api/init.rst:752 +#: ../../c-api/init.rst:696 msgid "" "If the name of an existing script is passed in ``argv[0]``, the absolute " "path of the directory where the script is located is prepended to :data:`sys." "path`." msgstr "" -#: ../../c-api/init.rst:755 +#: ../../c-api/init.rst:699 msgid "" "Otherwise (that is, if *argc* is ``0`` or ``argv[0]`` doesn't point to an " "existing file name), an empty string is prepended to :data:`sys.path`, which " "is the same as prepending the current working directory (``\".\"``)." msgstr "" -#: ../../c-api/init.rst:763 ../../c-api/init.rst:799 +#: ../../c-api/init.rst:707 ../../c-api/init.rst:743 msgid "" "See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv` " "members of the :ref:`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:767 +#: ../../c-api/init.rst:711 msgid "" "It is recommended that applications embedding the Python interpreter for " "purposes other than executing a single script pass ``0`` as *updatepath*, " "and update :data:`sys.path` themselves if desired. See :cve:`2008-5983`." msgstr "" -#: ../../c-api/init.rst:772 +#: ../../c-api/init.rst:716 msgid "" "On versions before 3.1.3, you can achieve the same effect by manually " "popping the first :data:`sys.path` element after having called :c:func:" "`PySys_SetArgv`, for example using::" msgstr "" -#: ../../c-api/init.rst:776 +#: ../../c-api/init.rst:720 msgid "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" msgstr "PyRun_SimpleString(\"import sys; sys.path.pop(0)\\n\");" -#: ../../c-api/init.rst:788 +#: ../../c-api/init.rst:732 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "argv` and :c:member:`PyConfig.parse_argv` should be used instead, see :ref:" "`Python Initialization Configuration `." msgstr "" -#: ../../c-api/init.rst:792 +#: ../../c-api/init.rst:736 msgid "" "This function works like :c:func:`PySys_SetArgvEx` with *updatepath* set to " "``1`` unless the :program:`python` interpreter was started with the :option:" "`-I`." msgstr "" -#: ../../c-api/init.rst:802 +#: ../../c-api/init.rst:746 msgid "The *updatepath* value depends on :option:`-I`." msgstr "" -#: ../../c-api/init.rst:809 +#: ../../c-api/init.rst:753 msgid "" "This API is kept for backward compatibility: setting :c:member:`PyConfig." "home` should be used instead, see :ref:`Python Initialization Configuration " "`." msgstr "" -#: ../../c-api/init.rst:813 +#: ../../c-api/init.rst:757 msgid "" "Set the default \"home\" directory, that is, the location of the standard " "Python libraries. See :envvar:`PYTHONHOME` for the meaning of the argument " "string." msgstr "" -#: ../../c-api/init.rst:817 +#: ../../c-api/init.rst:761 msgid "" "The argument should point to a zero-terminated character string in static " "storage whose contents will not change for the duration of the program's " @@ -1027,18 +957,24 @@ msgid "" "this storage." msgstr "" -#: ../../c-api/init.rst:830 +#: ../../c-api/init.rst:774 msgid "" -"Return the default \"home\", that is, the value set by a previous call to :c:" -"func:`Py_SetPythonHome`, or the value of the :envvar:`PYTHONHOME` " -"environment variable if it is set." +"Return the default \"home\", that is, the value set by :c:member:`PyConfig." +"home`, or the value of the :envvar:`PYTHONHOME` environment variable if it " +"is set." msgstr "" -#: ../../c-api/init.rst:844 +#: ../../c-api/init.rst:784 +msgid "" +"Get :c:member:`PyConfig.home` or :envvar:`PYTHONHOME` environment variable " +"instead." +msgstr "改為取得 :c:member:`PyConfig.home` 或 :envvar:`PYTHONHOME` 環境變數。" + +#: ../../c-api/init.rst:792 msgid "Thread State and the Global Interpreter Lock" msgstr "" -#: ../../c-api/init.rst:851 +#: ../../c-api/init.rst:799 msgid "" "The Python interpreter is not fully thread-safe. In order to support multi-" "threaded Python programs, there's a global lock, called the :term:`global " @@ -1050,7 +986,7 @@ msgid "" "once instead of twice." msgstr "" -#: ../../c-api/init.rst:861 +#: ../../c-api/init.rst:809 msgid "" "Therefore, the rule exists that only the thread that has acquired the :term:" "`GIL` may operate on Python objects or call Python/C API functions. In order " @@ -1060,7 +996,7 @@ msgid "" "a file, so that other Python threads can run in the meantime." msgstr "" -#: ../../c-api/init.rst:871 +#: ../../c-api/init.rst:819 msgid "" "The Python interpreter keeps some thread-specific bookkeeping information " "inside a data structure called :c:type:`PyThreadState`. There's also one " @@ -1068,17 +1004,17 @@ msgid "" "retrieved using :c:func:`PyThreadState_Get`." msgstr "" -#: ../../c-api/init.rst:877 +#: ../../c-api/init.rst:825 msgid "Releasing the GIL from extension code" msgstr "" -#: ../../c-api/init.rst:879 +#: ../../c-api/init.rst:827 msgid "" "Most extension code manipulating the :term:`GIL` has the following simple " "structure::" msgstr "" -#: ../../c-api/init.rst:882 +#: ../../c-api/init.rst:830 msgid "" "Save the thread state in a local variable.\n" "Release the global interpreter lock.\n" @@ -1087,29 +1023,29 @@ msgid "" "Restore the thread state from the local variable." msgstr "" -#: ../../c-api/init.rst:888 +#: ../../c-api/init.rst:836 msgid "This is so common that a pair of macros exists to simplify it::" msgstr "" -#: ../../c-api/init.rst:890 +#: ../../c-api/init.rst:838 msgid "" "Py_BEGIN_ALLOW_THREADS\n" "... Do some blocking I/O operation ...\n" "Py_END_ALLOW_THREADS" msgstr "" -#: ../../c-api/init.rst:898 +#: ../../c-api/init.rst:846 msgid "" "The :c:macro:`Py_BEGIN_ALLOW_THREADS` macro opens a new block and declares a " "hidden local variable; the :c:macro:`Py_END_ALLOW_THREADS` macro closes the " "block." msgstr "" -#: ../../c-api/init.rst:902 +#: ../../c-api/init.rst:850 msgid "The block above expands to the following code::" msgstr "" -#: ../../c-api/init.rst:904 +#: ../../c-api/init.rst:852 msgid "" "PyThreadState *_save;\n" "\n" @@ -1118,7 +1054,7 @@ msgid "" "PyEval_RestoreThread(_save);" msgstr "" -#: ../../c-api/init.rst:914 +#: ../../c-api/init.rst:862 msgid "" "Here is how these functions work: the global interpreter lock is used to " "protect the pointer to the current thread state. When releasing the lock " @@ -1129,7 +1065,7 @@ msgid "" "state, the lock must be acquired before storing the thread state pointer." msgstr "" -#: ../../c-api/init.rst:923 +#: ../../c-api/init.rst:871 msgid "" "Calling system I/O functions is the most common use case for releasing the " "GIL, but it can also be useful before calling long-running computations " @@ -1139,11 +1075,11 @@ msgid "" "compressing or hashing data." msgstr "" -#: ../../c-api/init.rst:934 +#: ../../c-api/init.rst:882 msgid "Non-Python created threads" msgstr "" -#: ../../c-api/init.rst:936 +#: ../../c-api/init.rst:884 msgid "" "When threads are created using the dedicated Python APIs (such as the :mod:" "`threading` module), a thread state is automatically associated to them and " @@ -1153,7 +1089,7 @@ msgid "" "for them." msgstr "" -#: ../../c-api/init.rst:943 +#: ../../c-api/init.rst:891 msgid "" "If you need to call Python code from these threads (often this will be part " "of a callback API provided by the aforementioned third-party library), you " @@ -1164,14 +1100,14 @@ msgid "" "finally free the thread state data structure." msgstr "" -#: ../../c-api/init.rst:951 +#: ../../c-api/init.rst:899 msgid "" "The :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` functions " "do all of the above automatically. The typical idiom for calling into " "Python from a C thread is::" msgstr "" -#: ../../c-api/init.rst:955 +#: ../../c-api/init.rst:903 msgid "" "PyGILState_STATE gstate;\n" "gstate = PyGILState_Ensure();\n" @@ -1184,7 +1120,7 @@ msgid "" "PyGILState_Release(gstate);" msgstr "" -#: ../../c-api/init.rst:965 +#: ../../c-api/init.rst:913 msgid "" "Note that the ``PyGILState_*`` functions assume there is only one global " "interpreter (created automatically by :c:func:`Py_Initialize`). Python " @@ -1193,11 +1129,11 @@ msgid "" "``PyGILState_*`` API is unsupported." msgstr "" -#: ../../c-api/init.rst:975 +#: ../../c-api/init.rst:923 msgid "Cautions about fork()" msgstr "" -#: ../../c-api/init.rst:977 +#: ../../c-api/init.rst:925 msgid "" "Another important thing to note about threads is their behaviour in the face " "of the C :c:func:`fork` call. On most systems with :c:func:`fork`, after a " @@ -1206,7 +1142,7 @@ msgid "" "CPython's runtime." msgstr "" -#: ../../c-api/init.rst:983 +#: ../../c-api/init.rst:931 msgid "" "The fact that only the \"current\" thread remains means any locks held by " "other threads will never be released. Python solves this for :func:`os.fork` " @@ -1223,7 +1159,7 @@ msgid "" "locks, but is not always able to." msgstr "" -#: ../../c-api/init.rst:998 +#: ../../c-api/init.rst:946 msgid "" "The fact that all other threads go away also means that CPython's runtime " "state there must be cleaned up properly, which :func:`os.fork` does. This " @@ -1236,17 +1172,17 @@ msgid "" "called immediately after." msgstr "" -#: ../../c-api/init.rst:1011 +#: ../../c-api/init.rst:959 msgid "High-level API" msgstr "高階 API" -#: ../../c-api/init.rst:1013 +#: ../../c-api/init.rst:961 msgid "" "These are the most commonly used types and functions when writing C " "extension code, or when embedding the Python interpreter:" msgstr "" -#: ../../c-api/init.rst:1018 +#: ../../c-api/init.rst:966 msgid "" "This data structure represents the state shared by a number of cooperating " "threads. Threads belonging to the same interpreter share their module " @@ -1254,7 +1190,7 @@ msgid "" "in this structure." msgstr "" -#: ../../c-api/init.rst:1023 +#: ../../c-api/init.rst:971 msgid "" "Threads belonging to different interpreters initially share nothing, except " "process state like available memory, open file descriptors and such. The " @@ -1262,52 +1198,41 @@ msgid "" "which interpreter they belong." msgstr "" -#: ../../c-api/init.rst:1031 +#: ../../c-api/init.rst:979 msgid "" "This data structure represents the state of a single thread. The only " "public data member is:" msgstr "" -#: ../../c-api/init.rst:1036 +#: ../../c-api/init.rst:984 msgid "This thread's interpreter state." msgstr "" -#: ../../c-api/init.rst:1047 +#: ../../c-api/init.rst:995 msgid "Deprecated function which does nothing." msgstr "" -#: ../../c-api/init.rst:1049 +#: ../../c-api/init.rst:997 msgid "" "In Python 3.6 and older, this function created the GIL if it didn't exist." msgstr "" -#: ../../c-api/init.rst:1051 +#: ../../c-api/init.rst:999 msgid "The function now does nothing." msgstr "此函式現在不會做任何事情。" -#: ../../c-api/init.rst:1054 +#: ../../c-api/init.rst:1002 msgid "" "This function is now called by :c:func:`Py_Initialize()`, so you don't have " "to call it yourself anymore." msgstr "" -#: ../../c-api/init.rst:1058 +#: ../../c-api/init.rst:1006 msgid "" "This function cannot be called before :c:func:`Py_Initialize()` anymore." msgstr "" -#: ../../c-api/init.rst:1068 -msgid "" -"Returns a non-zero value if :c:func:`PyEval_InitThreads` has been called. " -"This function can be called without holding the GIL, and therefore can be " -"used to avoid calls to the locking API when running single-threaded." -msgstr "" - -#: ../../c-api/init.rst:1072 -msgid "The :term:`GIL` is now initialized by :c:func:`Py_Initialize()`." -msgstr "" - -#: ../../c-api/init.rst:1080 +#: ../../c-api/init.rst:1016 msgid "" "Release the global interpreter lock (if it has been created) and reset the " "thread state to ``NULL``, returning the previous thread state (which is not " @@ -1315,7 +1240,7 @@ msgid "" "acquired it." msgstr "" -#: ../../c-api/init.rst:1088 +#: ../../c-api/init.rst:1024 msgid "" "Acquire the global interpreter lock (if it has been created) and set the " "thread state to *tstate*, which must not be ``NULL``. If the lock has been " @@ -1323,37 +1248,54 @@ msgid "" "ensues." msgstr "" -#: ../../c-api/init.rst:1094 ../../c-api/init.rst:1140 -#: ../../c-api/init.rst:1422 +#: ../../c-api/init.rst:1030 ../../c-api/init.rst:1089 +#: ../../c-api/init.rst:1371 msgid "" "Calling this function from a thread when the runtime is finalizing will " "terminate the thread, even if the thread was not created by Python. You can " -"use :c:func:`!_Py_IsFinalizing` or :func:`sys.is_finalizing` to check if the " +"use :c:func:`Py_IsFinalizing` or :func:`sys.is_finalizing` to check if the " "interpreter is in process of being finalized before calling this function to " "avoid unwanted termination." msgstr "" -#: ../../c-api/init.rst:1102 +#: ../../c-api/init.rst:1038 msgid "" "Return the current thread state. The global interpreter lock must be held. " "When the current thread state is ``NULL``, this issues a fatal error (so " "that the caller needn't check for ``NULL``)." msgstr "" -#: ../../c-api/init.rst:1109 +#: ../../c-api/init.rst:1042 +msgid "See also :c:func:`PyThreadState_GetUnchecked`." +msgstr "也請見 :c:func:`PyThreadState_GetUnchecked`。" + +#: ../../c-api/init.rst:1047 +msgid "" +"Similar to :c:func:`PyThreadState_Get`, but don't kill the process with a " +"fatal error if it is NULL. The caller is responsible to check if the result " +"is NULL." +msgstr "" + +#: ../../c-api/init.rst:1051 +msgid "" +"In Python 3.5 to 3.12, the function was private and known as " +"``_PyThreadState_UncheckedGet()``." +msgstr "" + +#: ../../c-api/init.rst:1058 msgid "" "Swap the current thread state with the thread state given by the argument " "*tstate*, which may be ``NULL``. The global interpreter lock must be held " "and is not released." msgstr "" -#: ../../c-api/init.rst:1114 +#: ../../c-api/init.rst:1063 msgid "" "The following functions use thread-local storage, and are not compatible " "with sub-interpreters:" msgstr "" -#: ../../c-api/init.rst:1119 +#: ../../c-api/init.rst:1068 msgid "" "Ensure that the current thread is ready to call the Python C API regardless " "of the current state of Python, or of the global interpreter lock. This may " @@ -1366,7 +1308,7 @@ msgid "" "is acceptable." msgstr "" -#: ../../c-api/init.rst:1129 +#: ../../c-api/init.rst:1078 msgid "" "The return value is an opaque \"handle\" to the thread state when :c:func:" "`PyGILState_Ensure` was called, and must be passed to :c:func:" @@ -1376,13 +1318,13 @@ msgid "" "func:`PyGILState_Release`." msgstr "" -#: ../../c-api/init.rst:1136 +#: ../../c-api/init.rst:1085 msgid "" "When the function returns, the current thread will hold the GIL and be able " "to call arbitrary Python code. Failure is a fatal error." msgstr "" -#: ../../c-api/init.rst:1148 +#: ../../c-api/init.rst:1097 msgid "" "Release any resources previously acquired. After this call, Python's state " "will be the same as it was prior to the corresponding :c:func:" @@ -1390,13 +1332,13 @@ msgid "" "caller, hence the use of the GILState API)." msgstr "" -#: ../../c-api/init.rst:1153 +#: ../../c-api/init.rst:1102 msgid "" "Every call to :c:func:`PyGILState_Ensure` must be matched by a call to :c:" "func:`PyGILState_Release` on the same thread." msgstr "" -#: ../../c-api/init.rst:1159 +#: ../../c-api/init.rst:1108 msgid "" "Get the current thread state for this thread. May return ``NULL`` if no " "GILState API has been used on the current thread. Note that the main thread " @@ -1404,7 +1346,7 @@ msgid "" "made on the main thread. This is mainly a helper/diagnostic function." msgstr "" -#: ../../c-api/init.rst:1167 +#: ../../c-api/init.rst:1116 msgid "" "Return ``1`` if the current thread is holding the GIL and ``0`` otherwise. " "This function can be called from any thread at any time. Only if it has had " @@ -1415,13 +1357,13 @@ msgid "" "otherwise behave differently." msgstr "" -#: ../../c-api/init.rst:1179 +#: ../../c-api/init.rst:1128 msgid "" "The following macros are normally used without a trailing semicolon; look " "for example usage in the Python source distribution." msgstr "" -#: ../../c-api/init.rst:1185 +#: ../../c-api/init.rst:1134 msgid "" "This macro expands to ``{ PyThreadState *_save; _save = PyEval_SaveThread();" "``. Note that it contains an opening brace; it must be matched with a " @@ -1429,7 +1371,7 @@ msgid "" "discussion of this macro." msgstr "" -#: ../../c-api/init.rst:1193 +#: ../../c-api/init.rst:1142 msgid "" "This macro expands to ``PyEval_RestoreThread(_save); }``. Note that it " "contains a closing brace; it must be matched with an earlier :c:macro:" @@ -1437,40 +1379,40 @@ msgid "" "macro." msgstr "" -#: ../../c-api/init.rst:1201 +#: ../../c-api/init.rst:1150 msgid "" "This macro expands to ``PyEval_RestoreThread(_save);``: it is equivalent to :" "c:macro:`Py_END_ALLOW_THREADS` without the closing brace." msgstr "" -#: ../../c-api/init.rst:1207 +#: ../../c-api/init.rst:1156 msgid "" "This macro expands to ``_save = PyEval_SaveThread();``: it is equivalent to :" "c:macro:`Py_BEGIN_ALLOW_THREADS` without the opening brace and variable " "declaration." msgstr "" -#: ../../c-api/init.rst:1213 +#: ../../c-api/init.rst:1162 msgid "Low-level API" msgstr "低階 API" -#: ../../c-api/init.rst:1215 +#: ../../c-api/init.rst:1164 msgid "" "All of the following functions must be called after :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/init.rst:1217 +#: ../../c-api/init.rst:1166 msgid ":c:func:`Py_Initialize()` now initializes the :term:`GIL`." msgstr "" -#: ../../c-api/init.rst:1223 +#: ../../c-api/init.rst:1172 msgid "" "Create a new interpreter state object. The global interpreter lock need not " "be held, but may be held if it is necessary to serialize calls to this " "function." msgstr "" -#: ../../c-api/init.rst:1227 +#: ../../c-api/init.rst:1176 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_New`` with no arguments." @@ -1478,13 +1420,13 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_New``。" -#: ../../c-api/init.rst:1232 +#: ../../c-api/init.rst:1181 msgid "" "Reset all information in an interpreter state object. The global " "interpreter lock must be held." msgstr "" -#: ../../c-api/init.rst:1235 +#: ../../c-api/init.rst:1184 msgid "" "Raises an :ref:`auditing event ` ``cpython." "PyInterpreterState_Clear`` with no arguments." @@ -1492,160 +1434,160 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``cpython." "PyInterpreterState_Clear``。" -#: ../../c-api/init.rst:1240 +#: ../../c-api/init.rst:1189 msgid "" "Destroy an interpreter state object. The global interpreter lock need not " "be held. The interpreter state must have been reset with a previous call " "to :c:func:`PyInterpreterState_Clear`." msgstr "" -#: ../../c-api/init.rst:1247 +#: ../../c-api/init.rst:1196 msgid "" "Create a new thread state object belonging to the given interpreter object. " "The global interpreter lock need not be held, but may be held if it is " "necessary to serialize calls to this function." msgstr "" -#: ../../c-api/init.rst:1254 +#: ../../c-api/init.rst:1203 msgid "" "Reset all information in a thread state object. The global interpreter lock " "must be held." msgstr "" -#: ../../c-api/init.rst:1257 +#: ../../c-api/init.rst:1206 msgid "" "This function now calls the :c:member:`PyThreadState.on_delete` callback. " "Previously, that happened in :c:func:`PyThreadState_Delete`." msgstr "" -#: ../../c-api/init.rst:1264 +#: ../../c-api/init.rst:1213 msgid "" "Destroy a thread state object. The global interpreter lock need not be " "held. The thread state must have been reset with a previous call to :c:func:" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1271 +#: ../../c-api/init.rst:1220 msgid "" "Destroy the current thread state and release the global interpreter lock. " -"Like :c:func:`PyThreadState_Delete`, the global interpreter lock need not be " +"Like :c:func:`PyThreadState_Delete`, the global interpreter lock must be " "held. The thread state must have been reset with a previous call to :c:func:" "`PyThreadState_Clear`." msgstr "" -#: ../../c-api/init.rst:1279 +#: ../../c-api/init.rst:1228 msgid "Get the current frame of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1281 +#: ../../c-api/init.rst:1230 msgid "" "Return a :term:`strong reference`. Return ``NULL`` if no frame is currently " "executing." msgstr "" -#: ../../c-api/init.rst:1284 +#: ../../c-api/init.rst:1233 msgid "See also :c:func:`PyEval_GetFrame`." msgstr "也請見 :c:func:`PyEval_GetFrame`。" -#: ../../c-api/init.rst:1286 ../../c-api/init.rst:1295 -#: ../../c-api/init.rst:1304 +#: ../../c-api/init.rst:1235 ../../c-api/init.rst:1244 +#: ../../c-api/init.rst:1253 msgid "*tstate* must not be ``NULL``." msgstr "*tstate* 不可為 ``NULL``。" -#: ../../c-api/init.rst:1293 +#: ../../c-api/init.rst:1242 msgid "" "Get the unique thread state identifier of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1302 +#: ../../c-api/init.rst:1251 msgid "Get the interpreter of the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1311 +#: ../../c-api/init.rst:1260 msgid "Suspend tracing and profiling in the Python thread state *tstate*." msgstr "" -#: ../../c-api/init.rst:1313 +#: ../../c-api/init.rst:1262 msgid "Resume them using the :c:func:`PyThreadState_LeaveTracing` function." msgstr "" -#: ../../c-api/init.rst:1320 +#: ../../c-api/init.rst:1269 msgid "" "Resume tracing and profiling in the Python thread state *tstate* suspended " "by the :c:func:`PyThreadState_EnterTracing` function." msgstr "" -#: ../../c-api/init.rst:1323 +#: ../../c-api/init.rst:1272 msgid "" "See also :c:func:`PyEval_SetTrace` and :c:func:`PyEval_SetProfile` functions." msgstr "" -#: ../../c-api/init.rst:1331 +#: ../../c-api/init.rst:1280 msgid "Get the current interpreter." msgstr "" -#: ../../c-api/init.rst:1333 +#: ../../c-api/init.rst:1282 msgid "" "Issue a fatal error if there no current Python thread state or no current " "interpreter. It cannot return NULL." msgstr "" -#: ../../c-api/init.rst:1336 ../../c-api/init.rst:1346 +#: ../../c-api/init.rst:1285 ../../c-api/init.rst:1295 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/init.rst:1343 +#: ../../c-api/init.rst:1292 msgid "" "Return the interpreter's unique ID. If there was any error in doing so then " "``-1`` is returned and an error is set." msgstr "" -#: ../../c-api/init.rst:1353 +#: ../../c-api/init.rst:1302 msgid "" "Return a dictionary in which interpreter-specific data may be stored. If " "this function returns ``NULL`` then no exception has been raised and the " "caller should assume no interpreter-specific dict is available." msgstr "" -#: ../../c-api/init.rst:1357 +#: ../../c-api/init.rst:1306 msgid "" "This is not a replacement for :c:func:`PyModule_GetState()`, which " "extensions should use to store interpreter-specific state information." msgstr "" -#: ../../c-api/init.rst:1364 +#: ../../c-api/init.rst:1313 msgid "Type of a frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1366 +#: ../../c-api/init.rst:1315 msgid "" "The *throwflag* parameter is used by the ``throw()`` method of generators: " "if non-zero, handle the current exception." msgstr "" -#: ../../c-api/init.rst:1369 +#: ../../c-api/init.rst:1318 msgid "The function now takes a *tstate* parameter." msgstr "" -#: ../../c-api/init.rst:1372 +#: ../../c-api/init.rst:1321 msgid "" "The *frame* parameter changed from ``PyFrameObject*`` to " "``_PyInterpreterFrame*``." msgstr "" -#: ../../c-api/init.rst:1377 +#: ../../c-api/init.rst:1326 msgid "Get the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1379 ../../c-api/init.rst:1387 +#: ../../c-api/init.rst:1328 ../../c-api/init.rst:1336 msgid "See the :pep:`523` \"Adding a frame evaluation API to CPython\"." msgstr "" -#: ../../c-api/init.rst:1385 +#: ../../c-api/init.rst:1334 msgid "Set the frame evaluation function." msgstr "" -#: ../../c-api/init.rst:1394 +#: ../../c-api/init.rst:1343 msgid "" "Return a dictionary in which extensions can store thread-specific state " "information. Each extension should use a unique key to use to store state " @@ -1654,7 +1596,7 @@ msgid "" "raised and the caller should assume no current thread state is available." msgstr "" -#: ../../c-api/init.rst:1403 +#: ../../c-api/init.rst:1352 msgid "" "Asynchronously raise an exception in a thread. The *id* argument is the " "thread id of the target thread; *exc* is the exception object to be raised. " @@ -1666,33 +1608,33 @@ msgid "" "raises no exceptions." msgstr "" -#: ../../c-api/init.rst:1411 +#: ../../c-api/init.rst:1360 msgid "" "The type of the *id* parameter changed from :c:expr:`long` to :c:expr:" "`unsigned long`." msgstr "" -#: ../../c-api/init.rst:1417 +#: ../../c-api/init.rst:1366 msgid "" "Acquire the global interpreter lock and set the current thread state to " "*tstate*, which must not be ``NULL``. The lock must have been created " "earlier. If this thread already has the lock, deadlock ensues." msgstr "" -#: ../../c-api/init.rst:1428 ../../c-api/init.rst:1466 +#: ../../c-api/init.rst:1377 msgid "" "Updated to be consistent with :c:func:`PyEval_RestoreThread`, :c:func:" "`Py_END_ALLOW_THREADS`, and :c:func:`PyGILState_Ensure`, and terminate the " "current thread if called while the interpreter is finalizing." msgstr "" -#: ../../c-api/init.rst:1433 +#: ../../c-api/init.rst:1382 msgid "" ":c:func:`PyEval_RestoreThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1439 +#: ../../c-api/init.rst:1388 msgid "" "Reset the current thread state to ``NULL`` and release the global " "interpreter lock. The lock must have been created earlier and must be held " @@ -1701,50 +1643,17 @@ msgid "" "isn't, a fatal error is reported." msgstr "" -#: ../../c-api/init.rst:1445 +#: ../../c-api/init.rst:1394 msgid "" ":c:func:`PyEval_SaveThread` is a higher-level function which is always " "available (even when threads have not been initialized)." msgstr "" -#: ../../c-api/init.rst:1451 -msgid "" -"Acquire the global interpreter lock. The lock must have been created " -"earlier. If this thread already has the lock, a deadlock ensues." -msgstr "" - -#: ../../c-api/init.rst:1454 -msgid "" -"This function does not update the current thread state. Please use :c:func:" -"`PyEval_RestoreThread` or :c:func:`PyEval_AcquireThread` instead." -msgstr "" - -#: ../../c-api/init.rst:1460 -msgid "" -"Calling this function from a thread when the runtime is finalizing will " -"terminate the thread, even if the thread was not created by Python. You can " -"use :c:func:`_Py_IsFinalizing` or :func:`sys.is_finalizing` to check if the " -"interpreter is in process of being finalized before calling this function to " -"avoid unwanted termination." -msgstr "" - -#: ../../c-api/init.rst:1474 -msgid "" -"Release the global interpreter lock. The lock must have been created " -"earlier." -msgstr "" - -#: ../../c-api/init.rst:1476 -msgid "" -"This function does not update the current thread state. Please use :c:func:" -"`PyEval_SaveThread` or :c:func:`PyEval_ReleaseThread` instead." -msgstr "" - -#: ../../c-api/init.rst:1485 +#: ../../c-api/init.rst:1401 msgid "Sub-interpreter support" msgstr "" -#: ../../c-api/init.rst:1487 +#: ../../c-api/init.rst:1403 msgid "" "While in most uses, you will only embed a single Python interpreter, there " "are cases where you need to create several independent interpreters in the " @@ -1752,7 +1661,7 @@ msgid "" "to do that." msgstr "" -#: ../../c-api/init.rst:1492 +#: ../../c-api/init.rst:1408 msgid "" "The \"main\" interpreter is the first one created when the runtime " "initializes. It is usually the only Python interpreter in a process. Unlike " @@ -1763,31 +1672,31 @@ msgid "" "returns a pointer to its state." msgstr "" -#: ../../c-api/init.rst:1499 +#: ../../c-api/init.rst:1415 msgid "" "You can switch between sub-interpreters using the :c:func:" "`PyThreadState_Swap` function. You can create and destroy them using the " "following functions:" msgstr "" -#: ../../c-api/init.rst:1505 +#: ../../c-api/init.rst:1421 msgid "" "Structure containing most parameters to configure a sub-interpreter. Its " "values are used only in :c:func:`Py_NewInterpreterFromConfig` and never " "modified by the runtime." msgstr "" -#: ../../c-api/init.rst:1511 +#: ../../c-api/init.rst:1427 msgid "Structure fields:" msgstr "" -#: ../../c-api/init.rst:1515 +#: ../../c-api/init.rst:1431 msgid "" "If this is ``0`` then the sub-interpreter will use its own \"object\" " "allocator state. Otherwise it will use (share) the main interpreter's." msgstr "" -#: ../../c-api/init.rst:1519 +#: ../../c-api/init.rst:1435 msgid "" "If this is ``0`` then :c:member:`~PyInterpreterConfig." "check_multi_interp_extensions` must be ``1`` (non-zero). If this is ``1`` " @@ -1795,44 +1704,44 @@ msgid "" "`PyInterpreterConfig_OWN_GIL`." msgstr "" -#: ../../c-api/init.rst:1527 +#: ../../c-api/init.rst:1443 msgid "" "If this is ``0`` then the runtime will not support forking the process in " "any thread where the sub-interpreter is currently active. Otherwise fork is " "unrestricted." msgstr "" -#: ../../c-api/init.rst:1531 +#: ../../c-api/init.rst:1447 msgid "" "Note that the :mod:`subprocess` module still works when fork is disallowed." msgstr "" -#: ../../c-api/init.rst:1536 +#: ../../c-api/init.rst:1452 msgid "" "If this is ``0`` then the runtime will not support replacing the current " "process via exec (e.g. :func:`os.execv`) in any thread where the sub-" "interpreter is currently active. Otherwise exec is unrestricted." msgstr "" -#: ../../c-api/init.rst:1541 +#: ../../c-api/init.rst:1457 msgid "" "Note that the :mod:`subprocess` module still works when exec is disallowed." msgstr "" -#: ../../c-api/init.rst:1546 +#: ../../c-api/init.rst:1462 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create threads. Otherwise threads are allowed." msgstr "" -#: ../../c-api/init.rst:1552 +#: ../../c-api/init.rst:1468 msgid "" "If this is ``0`` then the sub-interpreter's :mod:`threading` module won't " "create daemon threads. Otherwise daemon threads are allowed (as long as :c:" "member:`~PyInterpreterConfig.allow_threads` is non-zero)." msgstr "" -#: ../../c-api/init.rst:1559 +#: ../../c-api/init.rst:1475 msgid "" "If this is ``0`` then all extension modules may be imported, including " "legacy (single-phase init) modules, in any thread where the sub-interpreter " @@ -1841,37 +1750,37 @@ msgid "" "`Py_mod_multiple_interpreters`.)" msgstr "" -#: ../../c-api/init.rst:1566 +#: ../../c-api/init.rst:1482 msgid "" "This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig." "use_main_obmalloc` is ``0``." msgstr "" -#: ../../c-api/init.rst:1571 +#: ../../c-api/init.rst:1487 msgid "" "This determines the operation of the GIL for the sub-interpreter. It may be " "one of the following:" msgstr "" -#: ../../c-api/init.rst:1578 +#: ../../c-api/init.rst:1494 msgid "Use the default selection (:c:macro:`PyInterpreterConfig_SHARED_GIL`)." msgstr "" -#: ../../c-api/init.rst:1582 +#: ../../c-api/init.rst:1498 msgid "Use (share) the main interpreter's GIL." msgstr "" -#: ../../c-api/init.rst:1586 +#: ../../c-api/init.rst:1502 msgid "Use the sub-interpreter's own GIL." msgstr "" -#: ../../c-api/init.rst:1588 +#: ../../c-api/init.rst:1504 msgid "" "If this is :c:macro:`PyInterpreterConfig_OWN_GIL` then :c:member:" "`PyInterpreterConfig.use_main_obmalloc` must be ``0``." msgstr "" -#: ../../c-api/init.rst:1602 +#: ../../c-api/init.rst:1518 msgid "" "Create a new sub-interpreter. This is an (almost) totally separate " "environment for the execution of Python code. In particular, the new " @@ -1884,13 +1793,13 @@ msgid "" "underlying file descriptors)." msgstr "" -#: ../../c-api/init.rst:1612 +#: ../../c-api/init.rst:1528 msgid "" "The given *config* controls the options with which the interpreter is " "initialized." msgstr "" -#: ../../c-api/init.rst:1615 +#: ../../c-api/init.rst:1531 msgid "" "Upon success, *tstate_p* will be set to the first thread state created in " "the new sub-interpreter. This thread state is made in the current thread " @@ -1901,7 +1810,7 @@ msgid "" "state." msgstr "" -#: ../../c-api/init.rst:1624 +#: ../../c-api/init.rst:1540 msgid "" "Like all other Python/C API functions, the global interpreter lock must be " "held before calling this function and is still held when it returns. " @@ -1913,13 +1822,13 @@ msgid "" "released here." msgstr "" -#: ../../c-api/init.rst:1635 +#: ../../c-api/init.rst:1551 msgid "" "Sub-interpreters are most effective when isolated from each other, with " "certain functionality restricted::" msgstr "" -#: ../../c-api/init.rst:1638 +#: ../../c-api/init.rst:1554 msgid "" "PyInterpreterConfig config = {\n" " .use_main_obmalloc = 0,\n" @@ -1943,7 +1852,7 @@ msgstr "" "};\n" "PyThreadState *tstate = Py_NewInterpreterFromConfig(&config);" -#: ../../c-api/init.rst:1649 +#: ../../c-api/init.rst:1565 msgid "" "Note that the config is used only briefly and does not get modified. During " "initialization the config's values are converted into various :c:type:" @@ -1951,11 +1860,11 @@ msgid "" "internally on the :c:type:`PyInterpreterState`." msgstr "" -#: ../../c-api/init.rst:1658 +#: ../../c-api/init.rst:1574 msgid "Extension modules are shared between (sub-)interpreters as follows:" msgstr "" -#: ../../c-api/init.rst:1660 +#: ../../c-api/init.rst:1576 msgid "" "For modules using multi-phase initialization, e.g. :c:func:" "`PyModule_FromDefAndSpec`, a separate module object is created and " @@ -1963,7 +1872,7 @@ msgid "" "are shared between these module objects." msgstr "" -#: ../../c-api/init.rst:1666 +#: ../../c-api/init.rst:1582 msgid "" "For modules using single-phase initialization, e.g. :c:func:" "`PyModule_Create`, the first time a particular extension is imported, it is " @@ -1975,7 +1884,7 @@ msgid "" "might cause unwanted behavior (see `Bugs and caveats`_ below)." msgstr "" -#: ../../c-api/init.rst:1677 +#: ../../c-api/init.rst:1593 msgid "" "Note that this is different from what happens when an extension is imported " "after the interpreter has been completely re-initialized by calling :c:func:" @@ -1985,7 +1894,7 @@ msgid "" "shared between these modules." msgstr "" -#: ../../c-api/init.rst:1697 +#: ../../c-api/init.rst:1613 msgid "" "Create a new sub-interpreter. This is essentially just a wrapper around :c:" "func:`Py_NewInterpreterFromConfig` with a config that preserves the existing " @@ -1994,7 +1903,7 @@ msgid "" "single-phase init modules." msgstr "" -#: ../../c-api/init.rst:1709 +#: ../../c-api/init.rst:1625 msgid "" "Destroy the (sub-)interpreter represented by the given thread state. The " "given thread state must be the current thread state. See the discussion of " @@ -2004,17 +1913,17 @@ msgid "" "be held before calling this function. No GIL is held when it returns." msgstr "" -#: ../../c-api/init.rst:1717 +#: ../../c-api/init.rst:1633 msgid "" ":c:func:`Py_FinalizeEx` will destroy all sub-interpreters that haven't been " "explicitly destroyed at that point." msgstr "" -#: ../../c-api/init.rst:1722 +#: ../../c-api/init.rst:1638 msgid "A Per-Interpreter GIL" msgstr "" -#: ../../c-api/init.rst:1724 +#: ../../c-api/init.rst:1640 msgid "" "Using :c:func:`Py_NewInterpreterFromConfig` you can create a sub-interpreter " "that is completely isolated from other interpreters, including having its " @@ -2026,7 +1935,7 @@ msgid "" "just using threads. (See :pep:`554`.)" msgstr "" -#: ../../c-api/init.rst:1734 +#: ../../c-api/init.rst:1650 msgid "" "Using an isolated interpreter requires vigilance in preserving that " "isolation. That especially means not sharing any objects or mutable state " @@ -2035,12 +1944,12 @@ msgid "" "the refcount. One simple but less-efficient approach around this is to use " "a global lock around all use of some state (or object). Alternately, " "effectively immutable objects (like integers or strings) can be made safe in " -"spite of their refcounts by making them \"immortal\". In fact, this has been " -"done for the builtin singletons, small integers, and a number of other " +"spite of their refcounts by making them :term:`immortal`. In fact, this has " +"been done for the builtin singletons, small integers, and a number of other " "builtin objects." msgstr "" -#: ../../c-api/init.rst:1745 +#: ../../c-api/init.rst:1661 msgid "" "If you preserve isolation then you will have access to proper multi-core " "computing without the complications that come with free-threading. Failure " @@ -2048,7 +1957,7 @@ msgid "" "threading, including races and hard-to-debug crashes." msgstr "" -#: ../../c-api/init.rst:1750 +#: ../../c-api/init.rst:1666 msgid "" "Aside from that, one of the main challenges of using multiple isolated " "interpreters is how to communicate between them safely (not break isolation) " @@ -2058,11 +1967,11 @@ msgid "" "sharing) data between interpreters." msgstr "" -#: ../../c-api/init.rst:1761 +#: ../../c-api/init.rst:1677 msgid "Bugs and caveats" msgstr "" -#: ../../c-api/init.rst:1763 +#: ../../c-api/init.rst:1679 msgid "" "Because sub-interpreters (and the main interpreter) are part of the same " "process, the insulation between them isn't perfect --- for example, using " @@ -2075,7 +1984,7 @@ msgid "" "should be avoided if possible." msgstr "" -#: ../../c-api/init.rst:1773 +#: ../../c-api/init.rst:1689 msgid "" "Special care should be taken to avoid sharing user-defined functions, " "methods, instances or classes between sub-interpreters, since import " @@ -2084,7 +1993,7 @@ msgid "" "objects from which the above are reachable." msgstr "" -#: ../../c-api/init.rst:1779 +#: ../../c-api/init.rst:1695 msgid "" "Also note that combining this functionality with ``PyGILState_*`` APIs is " "delicate, because these APIs assume a bijection between Python thread states " @@ -2096,25 +2005,25 @@ msgid "" "created threads will probably be broken when using sub-interpreters." msgstr "" -#: ../../c-api/init.rst:1790 +#: ../../c-api/init.rst:1706 msgid "Asynchronous Notifications" msgstr "" -#: ../../c-api/init.rst:1792 +#: ../../c-api/init.rst:1708 msgid "" "A mechanism is provided to make asynchronous notifications to the main " "interpreter thread. These notifications take the form of a function pointer " "and a void pointer argument." msgstr "" -#: ../../c-api/init.rst:1799 +#: ../../c-api/init.rst:1715 msgid "" "Schedule a function to be called from the main interpreter thread. On " "success, ``0`` is returned and *func* is queued for being called in the main " "thread. On failure, ``-1`` is returned without setting any exception." msgstr "" -#: ../../c-api/init.rst:1803 +#: ../../c-api/init.rst:1719 msgid "" "When successfully queued, *func* will be *eventually* called from the main " "interpreter thread with the argument *arg*. It will be called " @@ -2122,17 +2031,17 @@ msgid "" "these conditions met:" msgstr "" -#: ../../c-api/init.rst:1808 +#: ../../c-api/init.rst:1724 msgid "on a :term:`bytecode` boundary;" msgstr "" -#: ../../c-api/init.rst:1809 +#: ../../c-api/init.rst:1725 msgid "" "with the main thread holding the :term:`global interpreter lock` (*func* can " "therefore use the full C API)." msgstr "" -#: ../../c-api/init.rst:1812 +#: ../../c-api/init.rst:1728 msgid "" "*func* must return ``0`` on success, or ``-1`` on failure with an exception " "set. *func* won't be interrupted to perform another asynchronous " @@ -2140,20 +2049,20 @@ msgid "" "if the global interpreter lock is released." msgstr "" -#: ../../c-api/init.rst:1817 +#: ../../c-api/init.rst:1733 msgid "" "This function doesn't need a current thread state to run, and it doesn't " "need the global interpreter lock." msgstr "" -#: ../../c-api/init.rst:1820 +#: ../../c-api/init.rst:1736 msgid "" "To call this function in a subinterpreter, the caller must hold the GIL. " "Otherwise, the function *func* can be scheduled to be called from the wrong " "interpreter." msgstr "" -#: ../../c-api/init.rst:1825 +#: ../../c-api/init.rst:1741 msgid "" "This is a low-level function, only useful for very special cases. There is " "no guarantee that *func* will be called as quick as possible. If the main " @@ -2163,7 +2072,7 @@ msgid "" "`PyGILState API`." msgstr "" -#: ../../c-api/init.rst:1834 +#: ../../c-api/init.rst:1750 msgid "" "If this function is called in a subinterpreter, the function *func* is now " "scheduled to be called from the subinterpreter, rather than being called " @@ -2171,18 +2080,18 @@ msgid "" "scheduled calls." msgstr "" -#: ../../c-api/init.rst:1843 +#: ../../c-api/init.rst:1759 msgid "Profiling and Tracing" msgstr "" -#: ../../c-api/init.rst:1848 +#: ../../c-api/init.rst:1764 msgid "" "The Python interpreter provides some low-level support for attaching " "profiling and execution tracing facilities. These are used for profiling, " "debugging, and coverage analysis tools." msgstr "" -#: ../../c-api/init.rst:1852 +#: ../../c-api/init.rst:1768 msgid "" "This C interface allows the profiling or tracing code to avoid the overhead " "of calling through Python-level callable objects, making a direct C function " @@ -2192,7 +2101,7 @@ msgid "" "reported to the Python-level trace functions in previous versions." msgstr "" -#: ../../c-api/init.rst:1862 +#: ../../c-api/init.rst:1778 msgid "" "The type of the trace function registered using :c:func:`PyEval_SetProfile` " "and :c:func:`PyEval_SetTrace`. The first parameter is the object passed to " @@ -2204,66 +2113,66 @@ msgid "" "value of *what*:" msgstr "" -#: ../../c-api/init.rst:1871 +#: ../../c-api/init.rst:1787 msgid "Value of *what*" msgstr "" -#: ../../c-api/init.rst:1871 +#: ../../c-api/init.rst:1787 msgid "Meaning of *arg*" msgstr "*arg* 的含義" -#: ../../c-api/init.rst:1873 +#: ../../c-api/init.rst:1789 msgid ":c:data:`PyTrace_CALL`" msgstr ":c:data:`PyTrace_CALL`" -#: ../../c-api/init.rst:1873 ../../c-api/init.rst:1878 -#: ../../c-api/init.rst:1889 +#: ../../c-api/init.rst:1789 ../../c-api/init.rst:1794 +#: ../../c-api/init.rst:1805 msgid "Always :c:data:`Py_None`." msgstr "" -#: ../../c-api/init.rst:1875 +#: ../../c-api/init.rst:1791 msgid ":c:data:`PyTrace_EXCEPTION`" msgstr ":c:data:`PyTrace_EXCEPTION`" -#: ../../c-api/init.rst:1875 +#: ../../c-api/init.rst:1791 msgid "Exception information as returned by :func:`sys.exc_info`." msgstr "" -#: ../../c-api/init.rst:1878 +#: ../../c-api/init.rst:1794 msgid ":c:data:`PyTrace_LINE`" msgstr ":c:data:`PyTrace_LINE`" -#: ../../c-api/init.rst:1880 +#: ../../c-api/init.rst:1796 msgid ":c:data:`PyTrace_RETURN`" msgstr ":c:data:`PyTrace_RETURN`" -#: ../../c-api/init.rst:1880 +#: ../../c-api/init.rst:1796 msgid "" "Value being returned to the caller, or ``NULL`` if caused by an exception." msgstr "" -#: ../../c-api/init.rst:1883 +#: ../../c-api/init.rst:1799 msgid ":c:data:`PyTrace_C_CALL`" msgstr ":c:data:`PyTrace_C_CALL`" -#: ../../c-api/init.rst:1883 ../../c-api/init.rst:1885 -#: ../../c-api/init.rst:1887 +#: ../../c-api/init.rst:1799 ../../c-api/init.rst:1801 +#: ../../c-api/init.rst:1803 msgid "Function object being called." msgstr "被呼叫的函式物件。" -#: ../../c-api/init.rst:1885 +#: ../../c-api/init.rst:1801 msgid ":c:data:`PyTrace_C_EXCEPTION`" msgstr ":c:data:`PyTrace_C_EXCEPTION`" -#: ../../c-api/init.rst:1887 +#: ../../c-api/init.rst:1803 msgid ":c:data:`PyTrace_C_RETURN`" msgstr ":c:data:`PyTrace_C_RETURN`" -#: ../../c-api/init.rst:1889 +#: ../../c-api/init.rst:1805 msgid ":c:data:`PyTrace_OPCODE`" msgstr ":c:data:`PyTrace_OPCODE`" -#: ../../c-api/init.rst:1894 +#: ../../c-api/init.rst:1810 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "a new call to a function or method is being reported, or a new entry into a " @@ -2272,7 +2181,7 @@ msgid "" "the corresponding frame." msgstr "" -#: ../../c-api/init.rst:1903 +#: ../../c-api/init.rst:1819 msgid "" "The value of the *what* parameter to a :c:type:`Py_tracefunc` function when " "an exception has been raised. The callback function is called with this " @@ -2284,7 +2193,7 @@ msgid "" "profiler." msgstr "" -#: ../../c-api/init.rst:1914 +#: ../../c-api/init.rst:1830 msgid "" "The value passed as the *what* parameter to a :c:type:`Py_tracefunc` " "function (but not a profiling function) when a line-number event is being " @@ -2292,31 +2201,31 @@ msgid "" "f_trace_lines` to *0* on that frame." msgstr "" -#: ../../c-api/init.rst:1922 +#: ../../c-api/init.rst:1838 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a call is about to return." msgstr "" -#: ../../c-api/init.rst:1928 +#: ../../c-api/init.rst:1844 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function is about to be called." msgstr "" -#: ../../c-api/init.rst:1934 +#: ../../c-api/init.rst:1850 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has raised an exception." msgstr "" -#: ../../c-api/init.rst:1940 +#: ../../c-api/init.rst:1856 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions when " "a C function has returned." msgstr "" -#: ../../c-api/init.rst:1946 +#: ../../c-api/init.rst:1862 msgid "" "The value for the *what* parameter to :c:type:`Py_tracefunc` functions (but " "not profiling functions) when a new opcode is about to be executed. This " @@ -2324,7 +2233,7 @@ msgid "" "attr:`~frame.f_trace_opcodes` to *1* on the frame." msgstr "" -#: ../../c-api/init.rst:1954 +#: ../../c-api/init.rst:1870 msgid "" "Set the profiler function to *func*. The *obj* parameter is passed to the " "function as its first parameter, and may be any Python object, or ``NULL``. " @@ -2334,29 +2243,29 @@ msgid "" "`PyTrace_LINE` :c:data:`PyTrace_OPCODE` and :c:data:`PyTrace_EXCEPTION`." msgstr "" -#: ../../c-api/init.rst:1961 +#: ../../c-api/init.rst:1877 msgid "See also the :func:`sys.setprofile` function." msgstr "" -#: ../../c-api/init.rst:1963 ../../c-api/init.rst:1970 -#: ../../c-api/init.rst:1989 ../../c-api/init.rst:1996 +#: ../../c-api/init.rst:1879 ../../c-api/init.rst:1886 +#: ../../c-api/init.rst:1905 ../../c-api/init.rst:1912 msgid "The caller must hold the :term:`GIL`." msgstr "呼叫者必須持有 :term:`GIL`。" -#: ../../c-api/init.rst:1967 +#: ../../c-api/init.rst:1883 msgid "" "Like :c:func:`PyEval_SetProfile` but sets the profile function in all " "running threads belonging to the current interpreter instead of the setting " "it only on the current thread." msgstr "" -#: ../../c-api/init.rst:1972 +#: ../../c-api/init.rst:1888 msgid "" "As :c:func:`PyEval_SetProfile`, this function ignores any exceptions raised " "while setting the profile functions in all threads." msgstr "" -#: ../../c-api/init.rst:1980 +#: ../../c-api/init.rst:1896 msgid "" "Set the tracing function to *func*. This is similar to :c:func:" "`PyEval_SetProfile`, except the tracing function does receive line-number " @@ -2367,65 +2276,120 @@ msgid "" "*what* parameter." msgstr "" -#: ../../c-api/init.rst:1987 +#: ../../c-api/init.rst:1903 msgid "See also the :func:`sys.settrace` function." msgstr "也請見 :func:`sys.settrace` 函式。" -#: ../../c-api/init.rst:1993 +#: ../../c-api/init.rst:1909 msgid "" "Like :c:func:`PyEval_SetTrace` but sets the tracing function in all running " "threads belonging to the current interpreter instead of the setting it only " "on the current thread." msgstr "" -#: ../../c-api/init.rst:1998 +#: ../../c-api/init.rst:1914 msgid "" "As :c:func:`PyEval_SetTrace`, this function ignores any exceptions raised " "while setting the trace functions in all threads." msgstr "" -#: ../../c-api/init.rst:2007 +#: ../../c-api/init.rst:1920 +msgid "Reference tracing" +msgstr "" + +#: ../../c-api/init.rst:1926 +msgid "" +"The type of the trace function registered using :c:func:" +"`PyRefTracer_SetTracer`. The first parameter is a Python object that has " +"been just created (when **event** is set to :c:data:`PyRefTracer_CREATE`) or " +"about to be destroyed (when **event** is set to :c:data:" +"`PyRefTracer_DESTROY`). The **data** argument is the opaque pointer that was " +"provided when :c:func:`PyRefTracer_SetTracer` was called." +msgstr "" + +#: ../../c-api/init.rst:1936 +msgid "" +"The value for the *event* parameter to :c:type:`PyRefTracer` functions when " +"a Python object has been created." +msgstr "" + +#: ../../c-api/init.rst:1941 +msgid "" +"The value for the *event* parameter to :c:type:`PyRefTracer` functions when " +"a Python object has been destroyed." +msgstr "" + +#: ../../c-api/init.rst:1946 +msgid "" +"Register a reference tracer function. The function will be called when a new " +"Python has been created or when an object is going to be destroyed. If " +"**data** is provided it must be an opaque pointer that will be provided when " +"the tracer function is called. Return ``0`` on success. Set an exception and " +"return ``-1`` on error." +msgstr "" + +#: ../../c-api/init.rst:1952 +msgid "" +"Not that tracer functions **must not** create Python objects inside or " +"otherwise the call will be re-entrant. The tracer also **must not** clear " +"any existing exception or set an exception. The GIL will be held every time " +"the tracer function is called." +msgstr "" + +#: ../../c-api/init.rst:1957 ../../c-api/init.rst:1968 +msgid "The GIL must be held when calling this function." +msgstr "" + +#: ../../c-api/init.rst:1963 +msgid "" +"Get the registered reference tracer function and the value of the opaque " +"data pointer that was registered when :c:func:`PyRefTracer_SetTracer` was " +"called. If no tracer was registered this function will return NULL and will " +"set the **data** pointer to NULL." +msgstr "" + +#: ../../c-api/init.rst:1975 msgid "Advanced Debugger Support" msgstr "" -#: ../../c-api/init.rst:2012 +#: ../../c-api/init.rst:1980 msgid "" "These functions are only intended to be used by advanced debugging tools." msgstr "" -#: ../../c-api/init.rst:2017 +#: ../../c-api/init.rst:1985 msgid "" "Return the interpreter state object at the head of the list of all such " "objects." msgstr "" -#: ../../c-api/init.rst:2022 +#: ../../c-api/init.rst:1990 msgid "Return the main interpreter state object." msgstr "" -#: ../../c-api/init.rst:2027 +#: ../../c-api/init.rst:1995 msgid "" "Return the next interpreter state object after *interp* from the list of all " "such objects." msgstr "" -#: ../../c-api/init.rst:2033 +#: ../../c-api/init.rst:2001 msgid "" "Return the pointer to the first :c:type:`PyThreadState` object in the list " "of threads associated with the interpreter *interp*." msgstr "" -#: ../../c-api/init.rst:2039 +#: ../../c-api/init.rst:2007 msgid "" "Return the next thread state object after *tstate* from the list of all such " "objects belonging to the same :c:type:`PyInterpreterState` object." msgstr "" -#: ../../c-api/init.rst:2046 +#: ../../c-api/init.rst:2014 msgid "Thread Local Storage Support" msgstr "" -#: ../../c-api/init.rst:2050 +#: ../../c-api/init.rst:2018 msgid "" "The Python interpreter provides low-level support for thread-local storage " "(TLS) which wraps the underlying native TLS implementation to support the " @@ -2435,19 +2399,19 @@ msgid "" "thread." msgstr "" -#: ../../c-api/init.rst:2057 +#: ../../c-api/init.rst:2025 msgid "" "The GIL does *not* need to be held when calling these functions; they supply " "their own locking." msgstr "" -#: ../../c-api/init.rst:2060 +#: ../../c-api/init.rst:2028 msgid "" "Note that :file:`Python.h` does not include the declaration of the TLS APIs, " "you need to include :file:`pythread.h` to use thread-local storage." msgstr "" -#: ../../c-api/init.rst:2064 +#: ../../c-api/init.rst:2032 msgid "" "None of these API functions handle memory management on behalf of the :c:" "expr:`void*` values. You need to allocate and deallocate them yourself. If " @@ -2455,22 +2419,22 @@ msgid "" "don't do refcount operations on them either." msgstr "" -#: ../../c-api/init.rst:2072 +#: ../../c-api/init.rst:2040 msgid "Thread Specific Storage (TSS) API" msgstr "" -#: ../../c-api/init.rst:2074 +#: ../../c-api/init.rst:2042 msgid "" "TSS API is introduced to supersede the use of the existing TLS API within " "the CPython interpreter. This API uses a new type :c:type:`Py_tss_t` " "instead of :c:expr:`int` to represent thread keys." msgstr "" -#: ../../c-api/init.rst:2080 +#: ../../c-api/init.rst:2048 msgid "\"A New C-API for Thread-Local Storage in CPython\" (:pep:`539`)" msgstr "" -#: ../../c-api/init.rst:2085 +#: ../../c-api/init.rst:2053 msgid "" "This data structure represents the state of a thread key, the definition of " "which may depend on the underlying TLS implementation, and it has an " @@ -2478,52 +2442,52 @@ msgid "" "public members in this structure." msgstr "" -#: ../../c-api/init.rst:2090 +#: ../../c-api/init.rst:2058 msgid "" "When :ref:`Py_LIMITED_API ` is not defined, static allocation of " "this type by :c:macro:`Py_tss_NEEDS_INIT` is allowed." msgstr "" -#: ../../c-api/init.rst:2096 +#: ../../c-api/init.rst:2064 msgid "" "This macro expands to the initializer for :c:type:`Py_tss_t` variables. Note " "that this macro won't be defined with :ref:`Py_LIMITED_API `." msgstr "" -#: ../../c-api/init.rst:2101 +#: ../../c-api/init.rst:2069 msgid "Dynamic Allocation" msgstr "" -#: ../../c-api/init.rst:2103 +#: ../../c-api/init.rst:2071 msgid "" "Dynamic allocation of the :c:type:`Py_tss_t`, required in extension modules " "built with :ref:`Py_LIMITED_API `, where static allocation of this " "type is not possible due to its implementation being opaque at build time." msgstr "" -#: ../../c-api/init.rst:2110 +#: ../../c-api/init.rst:2078 msgid "" "Return a value which is the same state as a value initialized with :c:macro:" "`Py_tss_NEEDS_INIT`, or ``NULL`` in the case of dynamic allocation failure." msgstr "" -#: ../../c-api/init.rst:2117 +#: ../../c-api/init.rst:2085 msgid "" "Free the given *key* allocated by :c:func:`PyThread_tss_alloc`, after first " "calling :c:func:`PyThread_tss_delete` to ensure any associated thread locals " "have been unassigned. This is a no-op if the *key* argument is ``NULL``." msgstr "" -#: ../../c-api/init.rst:2123 +#: ../../c-api/init.rst:2091 msgid "" "A freed key becomes a dangling pointer. You should reset the key to ``NULL``." msgstr "" -#: ../../c-api/init.rst:2128 +#: ../../c-api/init.rst:2096 msgid "Methods" msgstr "方法" -#: ../../c-api/init.rst:2130 +#: ../../c-api/init.rst:2098 msgid "" "The parameter *key* of these functions must not be ``NULL``. Moreover, the " "behaviors of :c:func:`PyThread_tss_set` and :c:func:`PyThread_tss_get` are " @@ -2531,13 +2495,13 @@ msgid "" "func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2138 +#: ../../c-api/init.rst:2106 msgid "" "Return a non-zero value if the given :c:type:`Py_tss_t` has been initialized " "by :c:func:`PyThread_tss_create`." msgstr "" -#: ../../c-api/init.rst:2144 +#: ../../c-api/init.rst:2112 msgid "" "Return a zero value on successful initialization of a TSS key. The behavior " "is undefined if the value pointed to by the *key* argument is not " @@ -2546,7 +2510,7 @@ msgid "" "no-op and immediately returns success." msgstr "" -#: ../../c-api/init.rst:2153 +#: ../../c-api/init.rst:2121 msgid "" "Destroy a TSS key to forget the values associated with the key across all " "threads, and change the key's initialization state to uninitialized. A " @@ -2555,31 +2519,31 @@ msgid "" "key -- calling it on an already destroyed key is a no-op." msgstr "" -#: ../../c-api/init.rst:2162 +#: ../../c-api/init.rst:2130 msgid "" "Return a zero value to indicate successfully associating a :c:expr:`void*` " "value with a TSS key in the current thread. Each thread has a distinct " "mapping of the key to a :c:expr:`void*` value." msgstr "" -#: ../../c-api/init.rst:2169 +#: ../../c-api/init.rst:2137 msgid "" "Return the :c:expr:`void*` value associated with a TSS key in the current " "thread. This returns ``NULL`` if no value is associated with the key in the " "current thread." msgstr "" -#: ../../c-api/init.rst:2177 +#: ../../c-api/init.rst:2145 msgid "Thread Local Storage (TLS) API" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../c-api/init.rst:2179 +#: ../../c-api/init.rst:2147 msgid "" "This API is superseded by :ref:`Thread Specific Storage (TSS) API `." msgstr "" -#: ../../c-api/init.rst:2184 +#: ../../c-api/init.rst:2152 msgid "" "This version of the API does not support platforms where the native TLS key " "is defined in a way that cannot be safely cast to ``int``. On such " @@ -2588,190 +2552,364 @@ msgid "" "platforms." msgstr "" -#: ../../c-api/init.rst:2189 +#: ../../c-api/init.rst:2157 msgid "" "Due to the compatibility problem noted above, this version of the API should " "not be used in new code." msgstr "" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:502 ../../c-api/init.rst:577 -msgid "Py_SetProgramName()" -msgstr "Py_SetProgramName()" +#: ../../c-api/init.rst:2168 +msgid "Synchronization Primitives" +msgstr "" + +#: ../../c-api/init.rst:2170 +msgid "The C-API provides a basic mutual exclusion lock." +msgstr "" + +#: ../../c-api/init.rst:2174 +msgid "" +"A mutual exclusion lock. The :c:type:`!PyMutex` should be initialized to " +"zero to represent the unlocked state. For example::" +msgstr "" + +#: ../../c-api/init.rst:2177 +msgid "PyMutex mutex = {0};" +msgstr "" -#: ../../c-api/init.rst:334 +#: ../../c-api/init.rst:2179 +msgid "" +"Instances of :c:type:`!PyMutex` should not be copied or moved. Both the " +"contents and address of a :c:type:`!PyMutex` are meaningful, and it must " +"remain at a fixed, writable location in memory." +msgstr "" + +#: ../../c-api/init.rst:2185 +msgid "" +"A :c:type:`!PyMutex` currently occupies one byte, but the size should be " +"considered unstable. The size may change in future Python releases without " +"a deprecation period." +msgstr "" + +#: ../../c-api/init.rst:2193 +msgid "" +"Lock mutex *m*. If another thread has already locked it, the calling thread " +"will block until the mutex is unlocked. While blocked, the thread will " +"temporarily release the :term:`GIL` if it is held." +msgstr "" + +#: ../../c-api/init.rst:2201 +msgid "" +"Unlock mutex *m*. The mutex must be locked --- otherwise, the function will " +"issue a fatal error." +msgstr "" + +#: ../../c-api/init.rst:2209 +msgid "Python Critical Section API" +msgstr "" + +#: ../../c-api/init.rst:2211 +msgid "" +"The critical section API provides a deadlock avoidance layer on top of per-" +"object locks for :term:`free-threaded ` CPython. They are " +"intended to replace reliance on the :term:`global interpreter lock`, and are " +"no-ops in versions of Python with the global interpreter lock." +msgstr "" + +#: ../../c-api/init.rst:2216 +msgid "" +"Critical sections avoid deadlocks by implicitly suspending active critical " +"sections and releasing the locks during calls to :c:func:" +"`PyEval_SaveThread`. When :c:func:`PyEval_RestoreThread` is called, the most " +"recent critical section is resumed, and its locks reacquired. This means " +"the critical section API provides weaker guarantees than traditional locks " +"-- they are useful because their behavior is similar to the :term:`GIL`." +msgstr "" + +#: ../../c-api/init.rst:2223 +msgid "" +"The functions and structs used by the macros are exposed for cases where C " +"macros are not available. They should only be used as in the given macro " +"expansions. Note that the sizes and contents of the structures may change in " +"future Python versions." +msgstr "" + +#: ../../c-api/init.rst:2230 +msgid "" +"Operations that need to lock two objects at once must use :c:macro:" +"`Py_BEGIN_CRITICAL_SECTION2`. You *cannot* use nested critical sections to " +"lock more than one object at once, because the inner critical section may " +"suspend the outer critical sections. This API does not provide a way to " +"lock more than two objects at once." +msgstr "" + +#: ../../c-api/init.rst:2236 +msgid "Example usage::" +msgstr "" + +#: ../../c-api/init.rst:2238 +msgid "" +"static PyObject *\n" +"set_field(MyObject *self, PyObject *value)\n" +"{\n" +" Py_BEGIN_CRITICAL_SECTION(self);\n" +" Py_SETREF(self->field, Py_XNewRef(value));\n" +" Py_END_CRITICAL_SECTION();\n" +" Py_RETURN_NONE;\n" +"}" +msgstr "" + +#: ../../c-api/init.rst:2247 +msgid "" +"In the above example, :c:macro:`Py_SETREF` calls :c:macro:`Py_DECREF`, which " +"can call arbitrary code through an object's deallocation function. The " +"critical section API avoids potentital deadlocks due to reentrancy and lock " +"ordering by allowing the runtime to temporarily suspend the critical section " +"if the code triggered by the finalizer blocks and calls :c:func:" +"`PyEval_SaveThread`." +msgstr "" + +#: ../../c-api/init.rst:2255 +msgid "" +"Acquires the per-object lock for the object *op* and begins a critical " +"section." +msgstr "" + +#: ../../c-api/init.rst:2258 ../../c-api/init.rst:2272 +#: ../../c-api/init.rst:2287 ../../c-api/init.rst:2301 +msgid "In the free-threaded build, this macro expands to::" +msgstr "" + +#: ../../c-api/init.rst:2260 +msgid "" +"{\n" +" PyCriticalSection _py_cs;\n" +" PyCriticalSection_Begin(&_py_cs, (PyObject*)(op))" +msgstr "" + +#: ../../c-api/init.rst:2264 ../../c-api/init.rst:2293 +msgid "In the default build, this macro expands to ``{``." +msgstr "" + +#: ../../c-api/init.rst:2270 +msgid "Ends the critical section and releases the per-object lock." +msgstr "" + +#: ../../c-api/init.rst:2274 +msgid "" +" PyCriticalSection_End(&_py_cs);\n" +"}" +msgstr "" + +#: ../../c-api/init.rst:2277 ../../c-api/init.rst:2306 +msgid "In the default build, this macro expands to ``}``." +msgstr "" + +#: ../../c-api/init.rst:2283 +msgid "" +"Acquires the per-objects locks for the objects *a* and *b* and begins a " +"critical section. The locks are acquired in a consistent order (lowest " +"address first) to avoid lock ordering deadlocks." +msgstr "" + +#: ../../c-api/init.rst:2289 +msgid "" +"{\n" +" PyCriticalSection2 _py_cs2;\n" +" PyCriticalSection_Begin2(&_py_cs2, (PyObject*)(a), (PyObject*)(b))" +msgstr "" + +#: ../../c-api/init.rst:2299 +msgid "Ends the critical section and releases the per-object locks." +msgstr "" + +#: ../../c-api/init.rst:2303 +msgid "" +" PyCriticalSection_End2(&_py_cs2);\n" +"}" +msgstr "" + +#: ../../c-api/init.rst:335 msgid "PyEval_InitThreads()" msgstr "PyEval_InitThreads()" -#: ../../c-api/init.rst:334 +#: ../../c-api/init.rst:335 msgid "modules (in module sys)" msgstr "modules(sys 模組中)" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:596 ../../c-api/init.rst:622 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:576 msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:596 ../../c-api/init.rst:622 -#: ../../c-api/init.rst:1063 ../../c-api/init.rst:1594 -#: ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:576 ../../c-api/init.rst:1011 +#: ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 msgid "module" msgstr "模組" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 msgid "builtins" msgstr "builtins(內建)" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 msgid "__main__" msgstr "__main__" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 msgid "sys" msgstr "sys" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:596 ../../c-api/init.rst:622 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:576 msgid "search" msgstr "search(搜尋)" -#: ../../c-api/init.rst:334 ../../c-api/init.rst:596 ../../c-api/init.rst:622 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:576 msgid "path" msgstr "path(路徑)" -#: ../../c-api/init.rst:334 -msgid "PySys_SetArgv (C function)" -msgstr "PySys_SetArgv(C 函式)" - -#: ../../c-api/init.rst:334 -msgid "PySys_SetArgvEx (C function)" -msgstr "PySys_SetArgvEx(C 函式)" - -#: ../../c-api/init.rst:334 ../../c-api/init.rst:1654 ../../c-api/init.rst:1707 +#: ../../c-api/init.rst:335 ../../c-api/init.rst:1570 ../../c-api/init.rst:1623 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" -#: ../../c-api/init.rst:437 ../../c-api/init.rst:474 +#: ../../c-api/init.rst:445 msgid "Py_Initialize()" msgstr "Py_Initialize()" -#: ../../c-api/init.rst:437 ../../c-api/init.rst:474 ../../c-api/init.rst:730 +#: ../../c-api/init.rst:445 ../../c-api/init.rst:674 msgid "main()" msgstr "main()" -#: ../../c-api/init.rst:437 -msgid "stdin" -msgstr "stdin" - -#: ../../c-api/init.rst:437 -msgid "stdout" -msgstr "stdout" - -#: ../../c-api/init.rst:437 -msgid "sdterr" -msgstr "sdterr" - -#: ../../c-api/init.rst:474 ../../c-api/init.rst:622 +#: ../../c-api/init.rst:445 msgid "Py_GetPath()" msgstr "Py_GetPath()" -#: ../../c-api/init.rst:577 +#: ../../c-api/init.rst:555 msgid "executable (in module sys)" msgstr "executable(sys 模組中)" -#: ../../c-api/init.rst:596 -msgid "Py_SetPath()" -msgstr "Py_SetPath()" - -#: ../../c-api/init.rst:665 ../../c-api/init.rst:707 ../../c-api/init.rst:721 +#: ../../c-api/init.rst:609 ../../c-api/init.rst:651 ../../c-api/init.rst:665 msgid "version (in module sys)" msgstr "version(sys 模組中)" -#: ../../c-api/init.rst:677 +#: ../../c-api/init.rst:621 msgid "platform (in module sys)" msgstr "platform(sys 模組中)" -#: ../../c-api/init.rst:694 +#: ../../c-api/init.rst:638 msgid "copyright (in module sys)" msgstr "copyright(sys 模組中)" -#: ../../c-api/init.rst:730 +#: ../../c-api/init.rst:674 msgid "Py_FatalError()" msgstr "Py_FatalError()" -#: ../../c-api/init.rst:730 +#: ../../c-api/init.rst:674 msgid "argv (in module sys)" msgstr "argv(sys 模組中)" -#: ../../c-api/init.rst:846 +#: ../../c-api/init.rst:794 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../c-api/init.rst:846 +#: ../../c-api/init.rst:794 msgid "interpreter lock" msgstr "interpreter lock(直譯器鎖)" -#: ../../c-api/init.rst:846 +#: ../../c-api/init.rst:794 msgid "lock, interpreter" msgstr "lock, interpreter(鎖、直譯器)" -#: ../../c-api/init.rst:859 +#: ../../c-api/init.rst:807 msgid "setswitchinterval (in module sys)" msgstr "setswitchinterval (sys 模組中)" -#: ../../c-api/init.rst:868 +#: ../../c-api/init.rst:816 msgid "PyThreadState (C type)" msgstr "PyThreadState(C 型別)" -#: ../../c-api/init.rst:894 +#: ../../c-api/init.rst:842 msgid "Py_BEGIN_ALLOW_THREADS (C macro)" msgstr "Py_BEGIN_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:894 +#: ../../c-api/init.rst:842 msgid "Py_END_ALLOW_THREADS (C macro)" msgstr "Py_END_ALLOW_THREADS(C 巨集)" -#: ../../c-api/init.rst:910 +#: ../../c-api/init.rst:858 msgid "PyEval_RestoreThread (C function)" msgstr "PyEval_RestoreThread(C 函式)" -#: ../../c-api/init.rst:910 +#: ../../c-api/init.rst:858 msgid "PyEval_SaveThread (C function)" msgstr "PyEval_SaveThread(C 函式)" -#: ../../c-api/init.rst:1041 +#: ../../c-api/init.rst:989 msgid "PyEval_AcquireThread()" msgstr "PyEval_AcquireThread()" -#: ../../c-api/init.rst:1041 +#: ../../c-api/init.rst:989 msgid "PyEval_ReleaseThread()" msgstr "PyEval_ReleaseThread()" -#: ../../c-api/init.rst:1041 +#: ../../c-api/init.rst:989 msgid "PyEval_SaveThread()" msgstr "PyEval_SaveThread()" -#: ../../c-api/init.rst:1041 +#: ../../c-api/init.rst:989 msgid "PyEval_RestoreThread()" msgstr "PyEval_RestoreThread()" -#: ../../c-api/init.rst:1063 +#: ../../c-api/init.rst:1011 msgid "_thread" msgstr "_thread" -#: ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 msgid "stdout (in module sys)" msgstr "stdout(sys 模組中)" -#: ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 msgid "stderr (in module sys)" msgstr "stderr(sys 模組中)" -#: ../../c-api/init.rst:1594 ../../c-api/init.rst:1689 +#: ../../c-api/init.rst:1510 ../../c-api/init.rst:1605 msgid "stdin (in module sys)" msgstr "stdin(sys 模組中)" -#: ../../c-api/init.rst:1654 +#: ../../c-api/init.rst:1570 msgid "Py_Initialize (C function)" msgstr "Py_Initialize(C 函式)" -#: ../../c-api/init.rst:1684 +#: ../../c-api/init.rst:1600 msgid "close (in module os)" msgstr "close(os 模組中)" + +#~ msgid ":c:func:`Py_SetPath`" +#~ msgstr ":c:func:`Py_SetPath`" + +#~ msgid ":c:func:`Py_SetStandardStreamEncoding`" +#~ msgstr ":c:func:`Py_SetStandardStreamEncoding`" + +#~ msgid ":c:func:`PySys_AddWarnOption`" +#~ msgstr ":c:func:`PySys_AddWarnOption`" + +#~ msgid ":c:func:`PySys_AddXOption`" +#~ msgstr ":c:func:`PySys_AddXOption`" + +#~ msgid "Py_SetProgramName()" +#~ msgstr "Py_SetProgramName()" + +#~ msgid "PySys_SetArgv (C function)" +#~ msgstr "PySys_SetArgv(C 函式)" + +#~ msgid "PySys_SetArgvEx (C function)" +#~ msgstr "PySys_SetArgvEx(C 函式)" + +#~ msgid "stdin" +#~ msgstr "stdin" + +#~ msgid "stdout" +#~ msgstr "stdout" + +#~ msgid "sdterr" +#~ msgstr "sdterr" + +#~ msgid "Py_SetPath()" +#~ msgstr "Py_SetPath()" diff --git a/c-api/init_config.po b/c-api/init_config.po index b2ac9bf415..a51f220060 100644 --- a/c-api/init_config.po +++ b/c-api/init_config.po @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -149,7 +149,7 @@ msgid "*index* must be greater than or equal to ``0``." msgstr "" #: ../../c-api/init_config.rst:108 ../../c-api/init_config.rst:128 -#: ../../c-api/init_config.rst:235 ../../c-api/init_config.rst:544 +#: ../../c-api/init_config.rst:235 ../../c-api/init_config.rst:554 msgid "Structure fields:" msgstr "" @@ -355,116 +355,135 @@ msgid "" "allocator ` with :ref:`debug hooks `." msgstr "" -#: ../../c-api/init_config.rst:257 +#: ../../c-api/init_config.rst:256 +msgid "" +"``PYMEM_ALLOCATOR_MIMALLOC`` (``6``): use ``mimalloc``, a fast malloc " +"replacement." +msgstr "" + +#: ../../c-api/init_config.rst:258 +msgid "" +"``PYMEM_ALLOCATOR_MIMALLOC_DEBUG`` (``7``): use ``mimalloc``, a fast malloc " +"replacement with :ref:`debug hooks `." +msgstr "" + +#: ../../c-api/init_config.rst:262 msgid "" "``PYMEM_ALLOCATOR_PYMALLOC`` and ``PYMEM_ALLOCATOR_PYMALLOC_DEBUG`` are not " "supported if Python is :option:`configured using --without-pymalloc <--" "without-pymalloc>`." msgstr "" -#: ../../c-api/init_config.rst:261 +#: ../../c-api/init_config.rst:266 +msgid "" +"``PYMEM_ALLOCATOR_MIMALLOC`` and ``PYMEM_ALLOCATOR_MIMALLOC_DEBUG`` are not " +"supported if Python is :option:`configured using --without-mimalloc <--" +"without-mimalloc>` or if the underlying atomic support isn't available." +msgstr "" + +#: ../../c-api/init_config.rst:271 msgid "See :ref:`Memory Management `." msgstr "請見\\ :ref:`記憶體管理 `。" -#: ../../c-api/init_config.rst:263 +#: ../../c-api/init_config.rst:273 msgid "Default: ``PYMEM_ALLOCATOR_NOT_SET``." msgstr "預設:``PYMEM_ALLOCATOR_NOT_SET``。" -#: ../../c-api/init_config.rst:267 +#: ../../c-api/init_config.rst:277 msgid "Set the LC_CTYPE locale to the user preferred locale." msgstr "" -#: ../../c-api/init_config.rst:269 +#: ../../c-api/init_config.rst:279 msgid "" "If equals to ``0``, set :c:member:`~PyPreConfig.coerce_c_locale` and :c:" "member:`~PyPreConfig.coerce_c_locale_warn` members to ``0``." msgstr "" -#: ../../c-api/init_config.rst:272 ../../c-api/init_config.rst:283 +#: ../../c-api/init_config.rst:282 ../../c-api/init_config.rst:293 msgid "See the :term:`locale encoding`." msgstr "請見 :term:`locale encoding`。" -#: ../../c-api/init_config.rst:274 ../../c-api/init_config.rst:329 -#: ../../c-api/init_config.rst:684 +#: ../../c-api/init_config.rst:284 ../../c-api/init_config.rst:339 +#: ../../c-api/init_config.rst:710 msgid "Default: ``1`` in Python config, ``0`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:278 +#: ../../c-api/init_config.rst:288 msgid "If equals to ``2``, coerce the C locale." msgstr "" -#: ../../c-api/init_config.rst:280 +#: ../../c-api/init_config.rst:290 msgid "" "If equals to ``1``, read the LC_CTYPE locale to decide if it should be " "coerced." msgstr "" -#: ../../c-api/init_config.rst:285 ../../c-api/init_config.rst:291 +#: ../../c-api/init_config.rst:295 ../../c-api/init_config.rst:301 msgid "Default: ``-1`` in Python config, ``0`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:289 +#: ../../c-api/init_config.rst:299 msgid "If non-zero, emit a warning if the C locale is coerced." msgstr "" -#: ../../c-api/init_config.rst:295 +#: ../../c-api/init_config.rst:305 msgid "" ":ref:`Python Development Mode `: see :c:member:`PyConfig.dev_mode`." msgstr "" -#: ../../c-api/init_config.rst:298 ../../c-api/init_config.rst:693 -#: ../../c-api/init_config.rst:735 ../../c-api/init_config.rst:1188 +#: ../../c-api/init_config.rst:308 ../../c-api/init_config.rst:719 +#: ../../c-api/init_config.rst:765 ../../c-api/init_config.rst:1244 msgid "Default: ``-1`` in Python mode, ``0`` in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:302 +#: ../../c-api/init_config.rst:312 msgid "Isolated mode: see :c:member:`PyConfig.isolated`." msgstr "" -#: ../../c-api/init_config.rst:304 ../../c-api/init_config.rst:880 +#: ../../c-api/init_config.rst:314 ../../c-api/init_config.rst:921 msgid "Default: ``0`` in Python mode, ``1`` in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:308 +#: ../../c-api/init_config.rst:318 msgid "If non-zero:" msgstr "如果不為 0:" -#: ../../c-api/init_config.rst:310 +#: ../../c-api/init_config.rst:320 msgid "Set :c:member:`PyPreConfig.utf8_mode` to ``0``," msgstr "將 :c:member:`PyPreConfig.utf8_mode` 設為 ``0``、" -#: ../../c-api/init_config.rst:311 +#: ../../c-api/init_config.rst:321 msgid "Set :c:member:`PyConfig.filesystem_encoding` to ``\"mbcs\"``," msgstr "將 :c:member:`PyConfig.filesystem_encoding` 設為 ``\"mbcs\"``、" -#: ../../c-api/init_config.rst:312 +#: ../../c-api/init_config.rst:322 msgid "Set :c:member:`PyConfig.filesystem_errors` to ``\"replace\"``." msgstr "將 :c:member:`PyConfig.filesystem_errors` 設為 ``\"replace\"``。" -#: ../../c-api/init_config.rst:314 +#: ../../c-api/init_config.rst:324 msgid "" "Initialized from the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment " "variable value." msgstr "" -#: ../../c-api/init_config.rst:317 ../../c-api/init_config.rst:894 +#: ../../c-api/init_config.rst:327 ../../c-api/init_config.rst:935 msgid "" "Only available on Windows. ``#ifdef MS_WINDOWS`` macro can be used for " "Windows specific code." msgstr "" -#: ../../c-api/init_config.rst:320 ../../c-api/init_config.rst:632 -#: ../../c-api/init_config.rst:639 ../../c-api/init_config.rst:706 -#: ../../c-api/init_config.rst:815 ../../c-api/init_config.rst:829 -#: ../../c-api/init_config.rst:843 ../../c-api/init_config.rst:897 -#: ../../c-api/init_config.rst:911 ../../c-api/init_config.rst:971 -#: ../../c-api/init_config.rst:1023 ../../c-api/init_config.rst:1083 -#: ../../c-api/init_config.rst:1123 ../../c-api/init_config.rst:1152 -#: ../../c-api/init_config.rst:1239 +#: ../../c-api/init_config.rst:330 ../../c-api/init_config.rst:658 +#: ../../c-api/init_config.rst:665 ../../c-api/init_config.rst:732 +#: ../../c-api/init_config.rst:843 ../../c-api/init_config.rst:857 +#: ../../c-api/init_config.rst:871 ../../c-api/init_config.rst:938 +#: ../../c-api/init_config.rst:952 ../../c-api/init_config.rst:1012 +#: ../../c-api/init_config.rst:1064 ../../c-api/init_config.rst:1126 +#: ../../c-api/init_config.rst:1180 ../../c-api/init_config.rst:1209 +#: ../../c-api/init_config.rst:1298 msgid "Default: ``0``." msgstr "預設:``0``。" -#: ../../c-api/init_config.rst:324 +#: ../../c-api/init_config.rst:334 msgid "" "If non-zero, :c:func:`Py_PreInitializeFromArgs` and :c:func:" "`Py_PreInitializeFromBytesArgs` parse their ``argv`` argument the same way " @@ -472,95 +491,95 @@ msgid "" "Arguments `." msgstr "" -#: ../../c-api/init_config.rst:333 +#: ../../c-api/init_config.rst:343 msgid "" "Use :ref:`environment variables `? See :c:member:`PyConfig." "use_environment`." msgstr "" -#: ../../c-api/init_config.rst:336 ../../c-api/init_config.rst:1213 +#: ../../c-api/init_config.rst:346 ../../c-api/init_config.rst:1272 msgid "Default: ``1`` in Python config and ``0`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:340 +#: ../../c-api/init_config.rst:350 msgid "If non-zero, enable the :ref:`Python UTF-8 Mode `." msgstr "" -#: ../../c-api/init_config.rst:342 +#: ../../c-api/init_config.rst:352 msgid "" "Set to ``0`` or ``1`` by the :option:`-X utf8 <-X>` command line option and " "the :envvar:`PYTHONUTF8` environment variable." msgstr "" -#: ../../c-api/init_config.rst:345 +#: ../../c-api/init_config.rst:355 msgid "Also set to ``1`` if the ``LC_CTYPE`` locale is ``C`` or ``POSIX``." msgstr "" -#: ../../c-api/init_config.rst:347 +#: ../../c-api/init_config.rst:357 msgid "Default: ``-1`` in Python config and ``0`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:353 +#: ../../c-api/init_config.rst:363 msgid "Preinitialize Python with PyPreConfig" msgstr "" -#: ../../c-api/init_config.rst:355 +#: ../../c-api/init_config.rst:365 msgid "The preinitialization of Python:" msgstr "" -#: ../../c-api/init_config.rst:357 +#: ../../c-api/init_config.rst:367 msgid "Set the Python memory allocators (:c:member:`PyPreConfig.allocator`)" msgstr "" -#: ../../c-api/init_config.rst:358 +#: ../../c-api/init_config.rst:368 msgid "Configure the LC_CTYPE locale (:term:`locale encoding`)" msgstr "" -#: ../../c-api/init_config.rst:359 +#: ../../c-api/init_config.rst:369 msgid "" "Set the :ref:`Python UTF-8 Mode ` (:c:member:`PyPreConfig." "utf8_mode`)" msgstr "" -#: ../../c-api/init_config.rst:362 +#: ../../c-api/init_config.rst:372 msgid "" "The current preconfiguration (``PyPreConfig`` type) is stored in " "``_PyRuntime.preconfig``." msgstr "" -#: ../../c-api/init_config.rst:365 +#: ../../c-api/init_config.rst:375 msgid "Functions to preinitialize Python:" msgstr "" -#: ../../c-api/init_config.rst:369 ../../c-api/init_config.rst:375 -#: ../../c-api/init_config.rst:384 +#: ../../c-api/init_config.rst:379 ../../c-api/init_config.rst:385 +#: ../../c-api/init_config.rst:394 msgid "Preinitialize Python from *preconfig* preconfiguration." msgstr "" -#: ../../c-api/init_config.rst:371 ../../c-api/init_config.rst:380 -#: ../../c-api/init_config.rst:389 +#: ../../c-api/init_config.rst:381 ../../c-api/init_config.rst:390 +#: ../../c-api/init_config.rst:399 msgid "*preconfig* must not be ``NULL``." msgstr "*preconfig* 不可為 ``NULL``。" -#: ../../c-api/init_config.rst:377 +#: ../../c-api/init_config.rst:387 msgid "" "Parse *argv* command line arguments (bytes strings) if :c:member:" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: ../../c-api/init_config.rst:386 +#: ../../c-api/init_config.rst:396 msgid "" "Parse *argv* command line arguments (wide strings) if :c:member:" "`~PyPreConfig.parse_argv` of *preconfig* is non-zero." msgstr "" -#: ../../c-api/init_config.rst:391 ../../c-api/init_config.rst:1301 +#: ../../c-api/init_config.rst:401 ../../c-api/init_config.rst:1360 msgid "" "The caller is responsible to handle exceptions (error or exit) using :c:func:" "`PyStatus_Exception` and :c:func:`Py_ExitStatusException`." msgstr "" -#: ../../c-api/init_config.rst:394 +#: ../../c-api/init_config.rst:404 msgid "" "For :ref:`Python Configuration ` (:c:func:" "`PyPreConfig_InitPythonConfig`), if Python is initialized with command line " @@ -570,7 +589,7 @@ msgid "" "`Python UTF-8 Mode `." msgstr "" -#: ../../c-api/init_config.rst:401 +#: ../../c-api/init_config.rst:411 msgid "" "``PyMem_SetAllocator()`` can be called after :c:func:`Py_PreInitialize` and " "before :c:func:`Py_InitializeFromConfig` to install a custom memory " @@ -578,7 +597,7 @@ msgid "" "`PyPreConfig.allocator` is set to ``PYMEM_ALLOCATOR_NOT_SET``." msgstr "" -#: ../../c-api/init_config.rst:406 +#: ../../c-api/init_config.rst:416 msgid "" "Python memory allocation functions like :c:func:`PyMem_RawMalloc` must not " "be used before the Python preinitialization, whereas calling directly " @@ -586,13 +605,13 @@ msgid "" "not be called before the Python preinitialization." msgstr "" -#: ../../c-api/init_config.rst:411 +#: ../../c-api/init_config.rst:421 msgid "" "Example using the preinitialization to enable the :ref:`Python UTF-8 Mode " "`::" msgstr "" -#: ../../c-api/init_config.rst:414 +#: ../../c-api/init_config.rst:424 msgid "" "PyStatus status;\n" "PyPreConfig preconfig;\n" @@ -612,84 +631,84 @@ msgid "" "Py_Finalize();" msgstr "" -#: ../../c-api/init_config.rst:433 +#: ../../c-api/init_config.rst:443 msgid "PyConfig" msgstr "PyConfig" -#: ../../c-api/init_config.rst:437 +#: ../../c-api/init_config.rst:447 msgid "Structure containing most parameters to configure Python." msgstr "" -#: ../../c-api/init_config.rst:439 +#: ../../c-api/init_config.rst:449 msgid "" "When done, the :c:func:`PyConfig_Clear` function must be used to release the " "configuration memory." msgstr "" -#: ../../c-api/init_config.rst:444 +#: ../../c-api/init_config.rst:454 msgid "Structure methods:" msgstr "" -#: ../../c-api/init_config.rst:448 +#: ../../c-api/init_config.rst:458 msgid "" "Initialize configuration with the :ref:`Python Configuration `." msgstr "" -#: ../../c-api/init_config.rst:453 +#: ../../c-api/init_config.rst:463 msgid "" "Initialize configuration with the :ref:`Isolated Configuration `." msgstr "" -#: ../../c-api/init_config.rst:458 +#: ../../c-api/init_config.rst:468 msgid "Copy the wide character string *str* into ``*config_str``." msgstr "" -#: ../../c-api/init_config.rst:460 ../../c-api/init_config.rst:467 -#: ../../c-api/init_config.rst:474 ../../c-api/init_config.rst:482 -#: ../../c-api/init_config.rst:488 ../../c-api/init_config.rst:505 +#: ../../c-api/init_config.rst:470 ../../c-api/init_config.rst:477 +#: ../../c-api/init_config.rst:484 ../../c-api/init_config.rst:492 +#: ../../c-api/init_config.rst:498 ../../c-api/init_config.rst:515 msgid ":ref:`Preinitialize Python ` if needed." msgstr "" -#: ../../c-api/init_config.rst:464 +#: ../../c-api/init_config.rst:474 msgid "" "Decode *str* using :c:func:`Py_DecodeLocale` and set the result into " "``*config_str``." msgstr "" -#: ../../c-api/init_config.rst:471 +#: ../../c-api/init_config.rst:481 msgid "" "Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) " "from the *argv* list of wide character strings." msgstr "" -#: ../../c-api/init_config.rst:478 +#: ../../c-api/init_config.rst:488 msgid "" "Set command line arguments (:c:member:`~PyConfig.argv` member of *config*) " "from the *argv* list of bytes strings. Decode bytes using :c:func:" "`Py_DecodeLocale`." msgstr "" -#: ../../c-api/init_config.rst:486 +#: ../../c-api/init_config.rst:496 msgid "Set the list of wide strings *list* to *length* and *items*." msgstr "" -#: ../../c-api/init_config.rst:492 +#: ../../c-api/init_config.rst:502 msgid "Read all Python configuration." msgstr "" -#: ../../c-api/init_config.rst:494 +#: ../../c-api/init_config.rst:504 msgid "Fields which are already initialized are left unchanged." msgstr "" -#: ../../c-api/init_config.rst:496 +#: ../../c-api/init_config.rst:506 msgid "" "Fields for :ref:`path configuration ` are no longer " "calculated or modified when calling this function, as of Python 3.11." msgstr "" -#: ../../c-api/init_config.rst:499 ../../c-api/init_config.rst:1000 +#: ../../c-api/init_config.rst:509 ../../c-api/init_config.rst:1041 msgid "" "The :c:func:`PyConfig_Read` function only parses :c:member:`PyConfig.argv` " "arguments once: :c:member:`PyConfig.parse_argv` is set to ``2`` after " @@ -698,25 +717,25 @@ msgid "" "as Python options." msgstr "" -#: ../../c-api/init_config.rst:507 +#: ../../c-api/init_config.rst:517 msgid "" "The :c:member:`PyConfig.argv` arguments are now only parsed once, :c:member:" "`PyConfig.parse_argv` is set to ``2`` after arguments are parsed, and " "arguments are only parsed if :c:member:`PyConfig.parse_argv` equals ``1``." msgstr "" -#: ../../c-api/init_config.rst:513 +#: ../../c-api/init_config.rst:523 msgid "" ":c:func:`PyConfig_Read` no longer calculates all paths, and so fields listed " "under :ref:`Python Path Configuration ` may no longer be " "updated until :c:func:`Py_InitializeFromConfig` is called." msgstr "" -#: ../../c-api/init_config.rst:521 +#: ../../c-api/init_config.rst:531 msgid "Release configuration memory." msgstr "" -#: ../../c-api/init_config.rst:523 +#: ../../c-api/init_config.rst:533 msgid "" "Most ``PyConfig`` methods :ref:`preinitialize Python ` if needed. " "In that case, the Python preinitialization configuration (:c:type:" @@ -725,23 +744,23 @@ msgid "" "before calling a :c:type:`PyConfig` method:" msgstr "" -#: ../../c-api/init_config.rst:529 +#: ../../c-api/init_config.rst:539 msgid ":c:member:`PyConfig.dev_mode`" msgstr ":c:member:`PyConfig.dev_mode`" -#: ../../c-api/init_config.rst:530 +#: ../../c-api/init_config.rst:540 msgid ":c:member:`PyConfig.isolated`" msgstr ":c:member:`PyConfig.isolated`" -#: ../../c-api/init_config.rst:531 +#: ../../c-api/init_config.rst:541 msgid ":c:member:`PyConfig.parse_argv`" msgstr ":c:member:`PyConfig.parse_argv`" -#: ../../c-api/init_config.rst:532 +#: ../../c-api/init_config.rst:542 msgid ":c:member:`PyConfig.use_environment`" msgstr ":c:member:`PyConfig.use_environment`" -#: ../../c-api/init_config.rst:534 +#: ../../c-api/init_config.rst:544 msgid "" "Moreover, if :c:func:`PyConfig_SetArgv` or :c:func:`PyConfig_SetBytesArgv` " "is used, this method must be called before other methods, since the " @@ -749,412 +768,435 @@ msgid "" "member:`~PyConfig.parse_argv` is non-zero)." msgstr "" -#: ../../c-api/init_config.rst:539 +#: ../../c-api/init_config.rst:549 msgid "" "The caller of these methods is responsible to handle exceptions (error or " "exit) using ``PyStatus_Exception()`` and ``Py_ExitStatusException()``." msgstr "" -#: ../../c-api/init_config.rst:548 -msgid "Command line arguments: :data:`sys.argv`." -msgstr "命令列引數::data:`sys.argv`。" +#: ../../c-api/init_config.rst:562 +msgid "" +"Set :data:`sys.argv` command line arguments based on :c:member:`~PyConfig." +"argv`. These parameters are similar to those passed to the program's :c:" +"func:`main` function with the difference that the first entry should refer " +"to the script file to be executed rather than the executable hosting the " +"Python interpreter. If there isn't a script that will be run, the first " +"entry in :c:member:`~PyConfig.argv` can be an empty string." +msgstr "" -#: ../../c-api/init_config.rst:550 +#: ../../c-api/init_config.rst:570 msgid "" "Set :c:member:`~PyConfig.parse_argv` to ``1`` to parse :c:member:`~PyConfig." "argv` the same way the regular Python parses Python command line arguments " "and then to strip Python arguments from :c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:555 +#: ../../c-api/init_config.rst:575 msgid "" "If :c:member:`~PyConfig.argv` is empty, an empty string is added to ensure " "that :data:`sys.argv` always exists and is never empty." msgstr "" -#: ../../c-api/init_config.rst:558 ../../c-api/init_config.rst:585 -#: ../../c-api/init_config.rst:597 ../../c-api/init_config.rst:605 -#: ../../c-api/init_config.rst:713 ../../c-api/init_config.rst:722 -#: ../../c-api/init_config.rst:804 ../../c-api/init_config.rst:941 -#: ../../c-api/init_config.rst:1042 ../../c-api/init_config.rst:1060 -#: ../../c-api/init_config.rst:1074 ../../c-api/init_config.rst:1091 -#: ../../c-api/init_config.rst:1104 ../../c-api/init_config.rst:1112 +#: ../../c-api/init_config.rst:578 ../../c-api/init_config.rst:605 +#: ../../c-api/init_config.rst:619 ../../c-api/init_config.rst:629 +#: ../../c-api/init_config.rst:739 ../../c-api/init_config.rst:750 +#: ../../c-api/init_config.rst:832 ../../c-api/init_config.rst:982 +#: ../../c-api/init_config.rst:1083 ../../c-api/init_config.rst:1102 +#: ../../c-api/init_config.rst:1117 ../../c-api/init_config.rst:1134 +#: ../../c-api/init_config.rst:1147 ../../c-api/init_config.rst:1155 +#: ../../c-api/init_config.rst:1169 msgid "Default: ``NULL``." msgstr "預設值:``NULL``。" -#: ../../c-api/init_config.rst:560 +#: ../../c-api/init_config.rst:580 msgid "See also the :c:member:`~PyConfig.orig_argv` member." msgstr "" -#: ../../c-api/init_config.rst:564 +#: ../../c-api/init_config.rst:584 msgid "" "If equals to zero, ``Py_RunMain()`` prepends a potentially unsafe path to :" "data:`sys.path` at startup:" msgstr "" -#: ../../c-api/init_config.rst:567 +#: ../../c-api/init_config.rst:587 msgid "" "If :c:member:`argv[0] ` is equal to ``L\"-m\"`` (``python -m " "module``), prepend the current working directory." msgstr "" -#: ../../c-api/init_config.rst:569 +#: ../../c-api/init_config.rst:589 msgid "" "If running a script (``python script.py``), prepend the script's directory. " "If it's a symbolic link, resolve symbolic links." msgstr "" -#: ../../c-api/init_config.rst:571 +#: ../../c-api/init_config.rst:591 msgid "" "Otherwise (``python -c code`` and ``python``), prepend an empty string, " "which means the current working directory." msgstr "" -#: ../../c-api/init_config.rst:574 +#: ../../c-api/init_config.rst:594 msgid "" "Set to ``1`` by the :option:`-P` command line option and the :envvar:" "`PYTHONSAFEPATH` environment variable." msgstr "" -#: ../../c-api/init_config.rst:577 +#: ../../c-api/init_config.rst:597 msgid "Default: ``0`` in Python config, ``1`` in isolated config." msgstr "" -#: ../../c-api/init_config.rst:583 +#: ../../c-api/init_config.rst:603 msgid ":data:`sys.base_exec_prefix`." msgstr ":data:`sys.base_exec_prefix`。" -#: ../../c-api/init_config.rst:587 ../../c-api/init_config.rst:599 -#: ../../c-api/init_config.rst:607 ../../c-api/init_config.rst:715 -#: ../../c-api/init_config.rst:724 ../../c-api/init_config.rst:958 -#: ../../c-api/init_config.rst:1044 +#: ../../c-api/init_config.rst:607 ../../c-api/init_config.rst:621 +#: ../../c-api/init_config.rst:631 ../../c-api/init_config.rst:741 +#: ../../c-api/init_config.rst:752 ../../c-api/init_config.rst:999 +#: ../../c-api/init_config.rst:1085 msgid "Part of the :ref:`Python Path Configuration ` output." msgstr "" -#: ../../c-api/init_config.rst:591 +#: ../../c-api/init_config.rst:609 +msgid "See also :c:member:`PyConfig.exec_prefix`." +msgstr "也請見 :c:member:`PyConfig.exec_prefix`" + +#: ../../c-api/init_config.rst:613 msgid "Python base executable: :data:`sys._base_executable`." msgstr "" -#: ../../c-api/init_config.rst:593 +#: ../../c-api/init_config.rst:615 msgid "Set by the :envvar:`__PYVENV_LAUNCHER__` environment variable." msgstr "" -#: ../../c-api/init_config.rst:595 +#: ../../c-api/init_config.rst:617 msgid "Set from :c:member:`PyConfig.executable` if ``NULL``." msgstr "" -#: ../../c-api/init_config.rst:603 +#: ../../c-api/init_config.rst:623 +msgid "See also :c:member:`PyConfig.executable`." +msgstr "也請見 :c:member:`PyConfig.executable`" + +#: ../../c-api/init_config.rst:627 msgid ":data:`sys.base_prefix`." msgstr ":data:`sys.base_prefix`。" -#: ../../c-api/init_config.rst:611 +#: ../../c-api/init_config.rst:633 +msgid "See also :c:member:`PyConfig.prefix`." +msgstr "也請見 :c:member:`PyConfig.prefix`" + +#: ../../c-api/init_config.rst:637 msgid "" "If equals to ``0`` and :c:member:`~PyConfig.configure_c_stdio` is non-zero, " "disable buffering on the C streams stdout and stderr." msgstr "" -#: ../../c-api/init_config.rst:614 +#: ../../c-api/init_config.rst:640 msgid "" "Set to ``0`` by the :option:`-u` command line option and the :envvar:" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../c-api/init_config.rst:617 +#: ../../c-api/init_config.rst:643 msgid "stdin is always opened in buffered mode." msgstr "" -#: ../../c-api/init_config.rst:619 ../../c-api/init_config.rst:652 -#: ../../c-api/init_config.rst:1140 ../../c-api/init_config.rst:1271 +#: ../../c-api/init_config.rst:645 ../../c-api/init_config.rst:678 +#: ../../c-api/init_config.rst:1197 ../../c-api/init_config.rst:1330 msgid "Default: ``1``." msgstr "預設值:``1``。" -#: ../../c-api/init_config.rst:623 +#: ../../c-api/init_config.rst:649 msgid "" "If equals to ``1``, issue a warning when comparing :class:`bytes` or :class:" "`bytearray` with :class:`str`, or comparing :class:`bytes` with :class:`int`." msgstr "" -#: ../../c-api/init_config.rst:627 +#: ../../c-api/init_config.rst:653 msgid "" "If equal or greater to ``2``, raise a :exc:`BytesWarning` exception in these " "cases." msgstr "" -#: ../../c-api/init_config.rst:630 +#: ../../c-api/init_config.rst:656 msgid "Incremented by the :option:`-b` command line option." msgstr "" -#: ../../c-api/init_config.rst:636 +#: ../../c-api/init_config.rst:662 msgid "" "If non-zero, emit a :exc:`EncodingWarning` warning when :class:`io." "TextIOWrapper` uses its default encoding. See :ref:`io-encoding-warning` for " "details." msgstr "" -#: ../../c-api/init_config.rst:645 +#: ../../c-api/init_config.rst:671 msgid "" "If equals to ``0``, disables the inclusion of the end line and column " "mappings in code objects. Also disables traceback printing carets to " "specific error locations." msgstr "" -#: ../../c-api/init_config.rst:649 +#: ../../c-api/init_config.rst:675 msgid "" "Set to ``0`` by the :envvar:`PYTHONNODEBUGRANGES` environment variable and " "by the :option:`-X no_debug_ranges <-X>` command line option." msgstr "" -#: ../../c-api/init_config.rst:658 +#: ../../c-api/init_config.rst:684 msgid "" "Control the validation behavior of hash-based ``.pyc`` files: value of the :" "option:`--check-hash-based-pycs` command line option." msgstr "" -#: ../../c-api/init_config.rst:661 +#: ../../c-api/init_config.rst:687 msgid "Valid values:" msgstr "" -#: ../../c-api/init_config.rst:663 +#: ../../c-api/init_config.rst:689 msgid "" "``L\"always\"``: Hash the source file for invalidation regardless of value " "of the 'check_source' flag." msgstr "" -#: ../../c-api/init_config.rst:665 +#: ../../c-api/init_config.rst:691 msgid "``L\"never\"``: Assume that hash-based pycs always are valid." msgstr "" -#: ../../c-api/init_config.rst:666 +#: ../../c-api/init_config.rst:692 msgid "" "``L\"default\"``: The 'check_source' flag in hash-based pycs determines " "invalidation." msgstr "" -#: ../../c-api/init_config.rst:669 +#: ../../c-api/init_config.rst:695 msgid "Default: ``L\"default\"``." msgstr "預設:``L\"default\"``。" -#: ../../c-api/init_config.rst:671 +#: ../../c-api/init_config.rst:697 msgid "See also :pep:`552` \"Deterministic pycs\"." msgstr "" -#: ../../c-api/init_config.rst:675 +#: ../../c-api/init_config.rst:701 msgid "If non-zero, configure C standard streams:" msgstr "" -#: ../../c-api/init_config.rst:677 +#: ../../c-api/init_config.rst:703 msgid "" "On Windows, set the binary mode (``O_BINARY``) on stdin, stdout and stderr." msgstr "" -#: ../../c-api/init_config.rst:679 +#: ../../c-api/init_config.rst:705 msgid "" "If :c:member:`~PyConfig.buffered_stdio` equals zero, disable buffering of " "stdin, stdout and stderr streams." msgstr "" -#: ../../c-api/init_config.rst:681 +#: ../../c-api/init_config.rst:707 msgid "" "If :c:member:`~PyConfig.interactive` is non-zero, enable stream buffering on " "stdin and stdout (only stdout on Windows)." msgstr "" -#: ../../c-api/init_config.rst:688 +#: ../../c-api/init_config.rst:714 msgid "If non-zero, enable the :ref:`Python Development Mode `." msgstr "" -#: ../../c-api/init_config.rst:690 +#: ../../c-api/init_config.rst:716 msgid "" "Set to ``1`` by the :option:`-X dev <-X>` option and the :envvar:" "`PYTHONDEVMODE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:697 +#: ../../c-api/init_config.rst:723 msgid "Dump Python references?" msgstr "" -#: ../../c-api/init_config.rst:699 +#: ../../c-api/init_config.rst:725 msgid "If non-zero, dump all objects which are still alive at exit." msgstr "" -#: ../../c-api/init_config.rst:701 +#: ../../c-api/init_config.rst:727 msgid "Set to ``1`` by the :envvar:`PYTHONDUMPREFS` environment variable." msgstr "" -#: ../../c-api/init_config.rst:703 +#: ../../c-api/init_config.rst:729 msgid "" -"Need a special build of Python with the ``Py_TRACE_REFS`` macro defined: see " -"the :option:`configure --with-trace-refs option <--with-trace-refs>`." +"Needs a special build of Python with the ``Py_TRACE_REFS`` macro defined: " +"see the :option:`configure --with-trace-refs option <--with-trace-refs>`." msgstr "" -#: ../../c-api/init_config.rst:710 +#: ../../c-api/init_config.rst:736 msgid "" "The site-specific directory prefix where the platform-dependent Python files " "are installed: :data:`sys.exec_prefix`." msgstr "" -#: ../../c-api/init_config.rst:719 +#: ../../c-api/init_config.rst:743 +msgid "See also :c:member:`PyConfig.base_exec_prefix`." +msgstr "也請見 :c:member:`PyConfig.base_exec_prefix`" + +#: ../../c-api/init_config.rst:747 msgid "" "The absolute path of the executable binary for the Python interpreter: :data:" "`sys.executable`." msgstr "" -#: ../../c-api/init_config.rst:728 +#: ../../c-api/init_config.rst:754 +msgid "See also :c:member:`PyConfig.base_executable`." +msgstr "也請見 :c:member:`PyConfig.base_executable`" + +#: ../../c-api/init_config.rst:758 msgid "Enable faulthandler?" msgstr "" -#: ../../c-api/init_config.rst:730 +#: ../../c-api/init_config.rst:760 msgid "If non-zero, call :func:`faulthandler.enable` at startup." msgstr "" -#: ../../c-api/init_config.rst:732 +#: ../../c-api/init_config.rst:762 msgid "" "Set to ``1`` by :option:`-X faulthandler <-X>` and the :envvar:" "`PYTHONFAULTHANDLER` environment variable." msgstr "" -#: ../../c-api/init_config.rst:739 +#: ../../c-api/init_config.rst:769 msgid "" ":term:`Filesystem encoding `: :func:" "`sys.getfilesystemencoding`." msgstr "" -#: ../../c-api/init_config.rst:742 +#: ../../c-api/init_config.rst:772 msgid "On macOS, Android and VxWorks: use ``\"utf-8\"`` by default." msgstr "" -#: ../../c-api/init_config.rst:744 +#: ../../c-api/init_config.rst:774 msgid "" "On Windows: use ``\"utf-8\"`` by default, or ``\"mbcs\"`` if :c:member:" "`~PyPreConfig.legacy_windows_fs_encoding` of :c:type:`PyPreConfig` is non-" "zero." msgstr "" -#: ../../c-api/init_config.rst:748 +#: ../../c-api/init_config.rst:778 msgid "Default encoding on other platforms:" msgstr "" -#: ../../c-api/init_config.rst:750 +#: ../../c-api/init_config.rst:780 msgid "``\"utf-8\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero." msgstr "" -#: ../../c-api/init_config.rst:751 +#: ../../c-api/init_config.rst:781 msgid "" "``\"ascii\"`` if Python detects that ``nl_langinfo(CODESET)`` announces the " "ASCII encoding, whereas the ``mbstowcs()`` function decodes from a different " "encoding (usually Latin1)." msgstr "" -#: ../../c-api/init_config.rst:754 +#: ../../c-api/init_config.rst:784 msgid "``\"utf-8\"`` if ``nl_langinfo(CODESET)`` returns an empty string." msgstr "" -#: ../../c-api/init_config.rst:755 +#: ../../c-api/init_config.rst:785 msgid "" "Otherwise, use the :term:`locale encoding`: ``nl_langinfo(CODESET)`` result." msgstr "" -#: ../../c-api/init_config.rst:758 +#: ../../c-api/init_config.rst:788 msgid "" "At Python startup, the encoding name is normalized to the Python codec name. " "For example, ``\"ANSI_X3.4-1968\"`` is replaced with ``\"ascii\"``." msgstr "" -#: ../../c-api/init_config.rst:761 +#: ../../c-api/init_config.rst:791 msgid "See also the :c:member:`~PyConfig.filesystem_errors` member." msgstr "" -#: ../../c-api/init_config.rst:765 +#: ../../c-api/init_config.rst:795 msgid "" ":term:`Filesystem error handler `: :" "func:`sys.getfilesystemencodeerrors`." msgstr "" -#: ../../c-api/init_config.rst:768 +#: ../../c-api/init_config.rst:798 msgid "" "On Windows: use ``\"surrogatepass\"`` by default, or ``\"replace\"`` if :c:" "member:`~PyPreConfig.legacy_windows_fs_encoding` of :c:type:`PyPreConfig` is " "non-zero." msgstr "" -#: ../../c-api/init_config.rst:772 +#: ../../c-api/init_config.rst:802 msgid "On other platforms: use ``\"surrogateescape\"`` by default." msgstr "" -#: ../../c-api/init_config.rst:774 +#: ../../c-api/init_config.rst:804 msgid "Supported error handlers:" msgstr "" -#: ../../c-api/init_config.rst:776 +#: ../../c-api/init_config.rst:806 msgid "``\"strict\"``" msgstr "``\"strict\"``" -#: ../../c-api/init_config.rst:777 +#: ../../c-api/init_config.rst:807 msgid "``\"surrogateescape\"``" msgstr "``\"surrogateescape\"``" -#: ../../c-api/init_config.rst:778 +#: ../../c-api/init_config.rst:808 msgid "``\"surrogatepass\"`` (only supported with the UTF-8 encoding)" msgstr "" -#: ../../c-api/init_config.rst:780 +#: ../../c-api/init_config.rst:810 msgid "See also the :c:member:`~PyConfig.filesystem_encoding` member." msgstr "" -#: ../../c-api/init_config.rst:785 +#: ../../c-api/init_config.rst:815 msgid "Randomized hash function seed." msgstr "" -#: ../../c-api/init_config.rst:787 +#: ../../c-api/init_config.rst:817 msgid "" "If :c:member:`~PyConfig.use_hash_seed` is zero, a seed is chosen randomly at " "Python startup, and :c:member:`~PyConfig.hash_seed` is ignored." msgstr "" -#: ../../c-api/init_config.rst:790 +#: ../../c-api/init_config.rst:820 msgid "Set by the :envvar:`PYTHONHASHSEED` environment variable." msgstr "" -#: ../../c-api/init_config.rst:792 +#: ../../c-api/init_config.rst:822 msgid "" "Default *use_hash_seed* value: ``-1`` in Python mode, ``0`` in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:797 -msgid "Python home directory." -msgstr "" - -#: ../../c-api/init_config.rst:799 +#: ../../c-api/init_config.rst:827 msgid "" -"If :c:func:`Py_SetPythonHome` has been called, use its argument if it is not " -"``NULL``." +"Set the default Python \"home\" directory, that is, the location of the " +"standard Python libraries (see :envvar:`PYTHONHOME`)." msgstr "" -#: ../../c-api/init_config.rst:802 +#: ../../c-api/init_config.rst:830 msgid "Set by the :envvar:`PYTHONHOME` environment variable." msgstr "" -#: ../../c-api/init_config.rst:806 ../../c-api/init_config.rst:923 -#: ../../c-api/init_config.rst:943 ../../c-api/init_config.rst:1032 -#: ../../c-api/init_config.rst:1062 +#: ../../c-api/init_config.rst:834 ../../c-api/init_config.rst:964 +#: ../../c-api/init_config.rst:984 ../../c-api/init_config.rst:1073 +#: ../../c-api/init_config.rst:1104 msgid "Part of the :ref:`Python Path Configuration ` input." msgstr "" -#: ../../c-api/init_config.rst:810 +#: ../../c-api/init_config.rst:838 msgid "If non-zero, profile import time." msgstr "" -#: ../../c-api/init_config.rst:812 +#: ../../c-api/init_config.rst:840 msgid "" "Set the ``1`` by the :option:`-X importtime <-X>` option and the :envvar:" "`PYTHONPROFILEIMPORTTIME` environment variable." msgstr "" -#: ../../c-api/init_config.rst:819 +#: ../../c-api/init_config.rst:847 msgid "Enter interactive mode after executing a script or a command." msgstr "" -#: ../../c-api/init_config.rst:821 +#: ../../c-api/init_config.rst:849 msgid "" "If greater than ``0``, enable inspect: when a script is passed as first " "argument or the -c option is used, enter interactive mode after executing " @@ -1162,30 +1204,30 @@ msgid "" "a terminal." msgstr "" -#: ../../c-api/init_config.rst:826 +#: ../../c-api/init_config.rst:854 msgid "" "Incremented by the :option:`-i` command line option. Set to ``1`` if the :" "envvar:`PYTHONINSPECT` environment variable is non-empty." msgstr "" -#: ../../c-api/init_config.rst:833 +#: ../../c-api/init_config.rst:861 msgid "Install Python signal handlers?" msgstr "" -#: ../../c-api/init_config.rst:835 ../../c-api/init_config.rst:1006 -#: ../../c-api/init_config.rst:1030 ../../c-api/init_config.rst:1223 +#: ../../c-api/init_config.rst:863 ../../c-api/init_config.rst:1047 +#: ../../c-api/init_config.rst:1071 ../../c-api/init_config.rst:1282 msgid "Default: ``1`` in Python mode, ``0`` in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:839 +#: ../../c-api/init_config.rst:867 msgid "If greater than ``0``, enable the interactive mode (REPL)." msgstr "" -#: ../../c-api/init_config.rst:841 +#: ../../c-api/init_config.rst:869 msgid "Incremented by the :option:`-i` command line option." msgstr "" -#: ../../c-api/init_config.rst:847 +#: ../../c-api/init_config.rst:875 msgid "" "Configures the :ref:`integer string conversion length limitation " "`. An initial value of ``-1`` means the value will be " @@ -1195,30 +1237,47 @@ msgid "" "str_digits_check_threshold`) are unsupported and will produce an error." msgstr "" -#: ../../c-api/init_config.rst:855 +#: ../../c-api/init_config.rst:883 msgid "" "Configured by the :option:`-X int_max_str_digits <-X>` command line flag or " "the :envvar:`PYTHONINTMAXSTRDIGITS` environment variable." msgstr "" -#: ../../c-api/init_config.rst:858 +#: ../../c-api/init_config.rst:886 msgid "" "Default: ``-1`` in Python mode. 4300 (:data:`sys.int_info." "default_max_str_digits`) in isolated mode." msgstr "" -#: ../../c-api/init_config.rst:865 +#: ../../c-api/init_config.rst:893 +msgid "" +"If the value of :c:member:`~PyConfig.cpu_count` is not ``-1`` then it will " +"override the return values of :func:`os.cpu_count`, :func:`os." +"process_cpu_count`, and :func:`multiprocessing.cpu_count`." +msgstr "" + +#: ../../c-api/init_config.rst:897 +msgid "" +"Configured by the :samp:`-X cpu_count={n|default}` command line flag or the :" +"envvar:`PYTHON_CPU_COUNT` environment variable." +msgstr "" + +#: ../../c-api/init_config.rst:900 ../../c-api/init_config.rst:1259 +msgid "Default: ``-1``." +msgstr "預設值:``1``。" + +#: ../../c-api/init_config.rst:906 msgid "If greater than ``0``, enable isolated mode:" msgstr "" -#: ../../c-api/init_config.rst:867 +#: ../../c-api/init_config.rst:908 msgid "" "Set :c:member:`~PyConfig.safe_path` to ``1``: don't prepend a potentially " "unsafe path to :data:`sys.path` at Python startup, such as the current " "directory, the script's directory or an empty string." msgstr "" -#: ../../c-api/init_config.rst:871 +#: ../../c-api/init_config.rst:912 msgid "" "Set :c:member:`~PyConfig.use_environment` to ``0``: ignore ``PYTHON`` " "environment variables." @@ -1226,77 +1285,77 @@ msgstr "" "將 :c:member:`~PyConfig.use_environment` 設定為 ``0``:忽略 ``PYTHON`` 環境變" "數。" -#: ../../c-api/init_config.rst:873 +#: ../../c-api/init_config.rst:914 msgid "" "Set :c:member:`~PyConfig.user_site_directory` to ``0``: don't add the user " "site directory to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:875 +#: ../../c-api/init_config.rst:916 msgid "" "Python REPL doesn't import :mod:`readline` nor enable default readline " "configuration on interactive prompts." msgstr "" -#: ../../c-api/init_config.rst:878 +#: ../../c-api/init_config.rst:919 msgid "Set to ``1`` by the :option:`-I` command line option." msgstr "" -#: ../../c-api/init_config.rst:882 +#: ../../c-api/init_config.rst:923 msgid "" "See also the :ref:`Isolated Configuration ` and :c:" "member:`PyPreConfig.isolated`." msgstr "" -#: ../../c-api/init_config.rst:887 +#: ../../c-api/init_config.rst:928 msgid "" "If non-zero, use :class:`io.FileIO` instead of :class:`!io." "_WindowsConsoleIO` for :data:`sys.stdin`, :data:`sys.stdout` and :data:`sys." "stderr`." msgstr "" -#: ../../c-api/init_config.rst:891 +#: ../../c-api/init_config.rst:932 msgid "" "Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment variable " "is set to a non-empty string." msgstr "" -#: ../../c-api/init_config.rst:899 +#: ../../c-api/init_config.rst:940 msgid "See also the :pep:`528` (Change Windows console encoding to UTF-8)." msgstr "" -#: ../../c-api/init_config.rst:903 +#: ../../c-api/init_config.rst:944 msgid "" "If non-zero, dump statistics on :ref:`Python pymalloc memory allocator " "` at exit." msgstr "" -#: ../../c-api/init_config.rst:906 +#: ../../c-api/init_config.rst:947 msgid "Set to ``1`` by the :envvar:`PYTHONMALLOCSTATS` environment variable." msgstr "" -#: ../../c-api/init_config.rst:908 +#: ../../c-api/init_config.rst:949 msgid "" "The option is ignored if Python is :option:`configured using the --without-" "pymalloc option <--without-pymalloc>`." msgstr "" -#: ../../c-api/init_config.rst:915 +#: ../../c-api/init_config.rst:956 msgid "Platform library directory name: :data:`sys.platlibdir`." msgstr "" -#: ../../c-api/init_config.rst:917 +#: ../../c-api/init_config.rst:958 msgid "Set by the :envvar:`PYTHONPLATLIBDIR` environment variable." msgstr "" -#: ../../c-api/init_config.rst:919 +#: ../../c-api/init_config.rst:960 msgid "" "Default: value of the ``PLATLIBDIR`` macro which is set by the :option:" "`configure --with-platlibdir option <--with-platlibdir>` (default: " "``\"lib\"``, or ``\"DLLs\"`` on Windows)." msgstr "" -#: ../../c-api/init_config.rst:927 +#: ../../c-api/init_config.rst:968 msgid "" "This macro is now used on Windows to locate the standard library extension " "modules, typically under ``DLLs``. However, for compatibility, note that " @@ -1304,21 +1363,21 @@ msgid "" "and virtual environments." msgstr "" -#: ../../c-api/init_config.rst:936 +#: ../../c-api/init_config.rst:977 msgid "" "Module search paths (:data:`sys.path`) as a string separated by ``DELIM`` (:" "data:`os.pathsep`)." msgstr "" -#: ../../c-api/init_config.rst:939 +#: ../../c-api/init_config.rst:980 msgid "Set by the :envvar:`PYTHONPATH` environment variable." msgstr "" -#: ../../c-api/init_config.rst:948 +#: ../../c-api/init_config.rst:989 msgid "Module search paths: :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:950 +#: ../../c-api/init_config.rst:991 msgid "" "If :c:member:`~PyConfig.module_search_paths_set` is equal to ``0``, :c:func:" "`Py_InitializeFromConfig` will replace :c:member:`~PyConfig." @@ -1326,41 +1385,41 @@ msgid "" "to ``1``." msgstr "" -#: ../../c-api/init_config.rst:955 +#: ../../c-api/init_config.rst:996 msgid "" "Default: empty list (``module_search_paths``) and ``0`` " "(``module_search_paths_set``)." msgstr "" -#: ../../c-api/init_config.rst:962 +#: ../../c-api/init_config.rst:1003 msgid "Compilation optimization level:" msgstr "" -#: ../../c-api/init_config.rst:964 +#: ../../c-api/init_config.rst:1005 msgid "``0``: Peephole optimizer, set ``__debug__`` to ``True``." msgstr "" -#: ../../c-api/init_config.rst:965 +#: ../../c-api/init_config.rst:1006 msgid "``1``: Level 0, remove assertions, set ``__debug__`` to ``False``." msgstr "" -#: ../../c-api/init_config.rst:966 +#: ../../c-api/init_config.rst:1007 msgid "``2``: Level 1, strip docstrings." msgstr "" -#: ../../c-api/init_config.rst:968 +#: ../../c-api/init_config.rst:1009 msgid "" "Incremented by the :option:`-O` command line option. Set to the :envvar:" "`PYTHONOPTIMIZE` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:975 +#: ../../c-api/init_config.rst:1016 msgid "" "The list of the original command line arguments passed to the Python " "executable: :data:`sys.orig_argv`." msgstr "" -#: ../../c-api/init_config.rst:978 +#: ../../c-api/init_config.rst:1019 msgid "" "If :c:member:`~PyConfig.orig_argv` list is empty and :c:member:`~PyConfig." "argv` is not a list only containing an empty string, :c:func:`PyConfig_Read` " @@ -1369,388 +1428,400 @@ msgid "" "parse_argv` is non-zero)." msgstr "" -#: ../../c-api/init_config.rst:985 +#: ../../c-api/init_config.rst:1026 msgid "" "See also the :c:member:`~PyConfig.argv` member and the :c:func:" "`Py_GetArgcArgv` function." msgstr "" -#: ../../c-api/init_config.rst:988 ../../c-api/init_config.rst:1258 -#: ../../c-api/init_config.rst:1277 +#: ../../c-api/init_config.rst:1029 ../../c-api/init_config.rst:1317 +#: ../../c-api/init_config.rst:1336 msgid "Default: empty list." msgstr "" -#: ../../c-api/init_config.rst:994 +#: ../../c-api/init_config.rst:1035 msgid "Parse command line arguments?" msgstr "" -#: ../../c-api/init_config.rst:996 +#: ../../c-api/init_config.rst:1037 msgid "" "If equals to ``1``, parse :c:member:`~PyConfig.argv` the same way the " "regular Python parses :ref:`command line arguments `, and " "strip Python arguments from :c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:1008 +#: ../../c-api/init_config.rst:1049 msgid "" "The :c:member:`PyConfig.argv` arguments are now only parsed if :c:member:" "`PyConfig.parse_argv` equals to ``1``." msgstr "" -#: ../../c-api/init_config.rst:1014 +#: ../../c-api/init_config.rst:1055 msgid "" "Parser debug mode. If greater than ``0``, turn on parser debugging output " "(for expert only, depending on compilation options)." msgstr "" -#: ../../c-api/init_config.rst:1017 +#: ../../c-api/init_config.rst:1058 msgid "" "Incremented by the :option:`-d` command line option. Set to the :envvar:" "`PYTHONDEBUG` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:1020 +#: ../../c-api/init_config.rst:1061 ../../c-api/init_config.rst:1166 msgid "" -"Need a :ref:`debug build of Python ` (the ``Py_DEBUG`` macro " +"Needs a :ref:`debug build of Python ` (the ``Py_DEBUG`` macro " "must be defined)." msgstr "" -#: ../../c-api/init_config.rst:1027 +#: ../../c-api/init_config.rst:1068 msgid "" "If non-zero, calculation of path configuration is allowed to log warnings " "into ``stderr``. If equals to ``0``, suppress these warnings." msgstr "" -#: ../../c-api/init_config.rst:1034 +#: ../../c-api/init_config.rst:1075 msgid "Now also applies on Windows." msgstr "" -#: ../../c-api/init_config.rst:1039 +#: ../../c-api/init_config.rst:1080 msgid "" "The site-specific directory prefix where the platform independent Python " "files are installed: :data:`sys.prefix`." msgstr "" -#: ../../c-api/init_config.rst:1048 +#: ../../c-api/init_config.rst:1087 +msgid "See also :c:member:`PyConfig.base_prefix`." +msgstr "也請見 :c:member:`PyConfig.base_prefix`" + +#: ../../c-api/init_config.rst:1091 msgid "" "Program name used to initialize :c:member:`~PyConfig.executable` and in " "early error messages during Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1051 -msgid "If :func:`Py_SetProgramName` has been called, use its argument." -msgstr "" - -#: ../../c-api/init_config.rst:1052 +#: ../../c-api/init_config.rst:1094 msgid "On macOS, use :envvar:`PYTHONEXECUTABLE` environment variable if set." msgstr "" -#: ../../c-api/init_config.rst:1053 +#: ../../c-api/init_config.rst:1095 msgid "" "If the ``WITH_NEXT_FRAMEWORK`` macro is defined, use :envvar:" "`__PYVENV_LAUNCHER__` environment variable if set." msgstr "" -#: ../../c-api/init_config.rst:1055 +#: ../../c-api/init_config.rst:1097 msgid "" "Use ``argv[0]`` of :c:member:`~PyConfig.argv` if available and non-empty." msgstr "" -#: ../../c-api/init_config.rst:1057 +#: ../../c-api/init_config.rst:1099 msgid "" "Otherwise, use ``L\"python\"`` on Windows, or ``L\"python3\"`` on other " "platforms." msgstr "" -#: ../../c-api/init_config.rst:1066 +#: ../../c-api/init_config.rst:1108 msgid "" "Directory where cached ``.pyc`` files are written: :data:`sys." "pycache_prefix`." msgstr "" -#: ../../c-api/init_config.rst:1069 +#: ../../c-api/init_config.rst:1111 msgid "" "Set by the :option:`-X pycache_prefix=PATH <-X>` command line option and " -"the :envvar:`PYTHONPYCACHEPREFIX` environment variable." +"the :envvar:`PYTHONPYCACHEPREFIX` environment variable. The command-line " +"option takes precedence." msgstr "" -#: ../../c-api/init_config.rst:1072 +#: ../../c-api/init_config.rst:1115 msgid "If ``NULL``, :data:`sys.pycache_prefix` is set to ``None``." msgstr "" -#: ../../c-api/init_config.rst:1078 +#: ../../c-api/init_config.rst:1121 msgid "" "Quiet mode. If greater than ``0``, don't display the copyright and version " "at Python startup in interactive mode." msgstr "" -#: ../../c-api/init_config.rst:1081 +#: ../../c-api/init_config.rst:1124 msgid "Incremented by the :option:`-q` command line option." msgstr "" -#: ../../c-api/init_config.rst:1087 +#: ../../c-api/init_config.rst:1130 msgid "Value of the :option:`-c` command line option." msgstr "" -#: ../../c-api/init_config.rst:1089 ../../c-api/init_config.rst:1110 +#: ../../c-api/init_config.rst:1132 ../../c-api/init_config.rst:1153 msgid "Used by :c:func:`Py_RunMain`." msgstr "" -#: ../../c-api/init_config.rst:1095 +#: ../../c-api/init_config.rst:1138 msgid "" "Filename passed on the command line: trailing command line argument without :" "option:`-c` or :option:`-m`. It is used by the :c:func:`Py_RunMain` function." msgstr "" -#: ../../c-api/init_config.rst:1099 +#: ../../c-api/init_config.rst:1142 msgid "" "For example, it is set to ``script.py`` by the ``python3 script.py arg`` " "command line." msgstr "" -#: ../../c-api/init_config.rst:1102 +#: ../../c-api/init_config.rst:1145 msgid "See also the :c:member:`PyConfig.skip_source_first_line` option." msgstr "也請見 :c:member:`PyConfig.skip_source_first_line` 選項。" -#: ../../c-api/init_config.rst:1108 +#: ../../c-api/init_config.rst:1151 msgid "Value of the :option:`-m` command line option." msgstr "" -#: ../../c-api/init_config.rst:1116 -msgid "Show total reference count at exit (excluding immortal objects)?" +#: ../../c-api/init_config.rst:1159 +msgid "" +"``package.module`` path to module that should be imported before ``site.py`` " +"is run." msgstr "" -#: ../../c-api/init_config.rst:1118 +#: ../../c-api/init_config.rst:1162 +msgid "" +"Set by the :option:`-X presite=package.module <-X>` command-line option and " +"the :envvar:`PYTHON_PRESITE` environment variable. The command-line option " +"takes precedence." +msgstr "" + +#: ../../c-api/init_config.rst:1173 +msgid "" +"Show total reference count at exit (excluding :term:`immortal` objects)?" +msgstr "" + +#: ../../c-api/init_config.rst:1175 msgid "Set to ``1`` by :option:`-X showrefcount <-X>` command line option." msgstr "" -#: ../../c-api/init_config.rst:1120 +#: ../../c-api/init_config.rst:1177 msgid "" -"Need a :ref:`debug build of Python ` (the ``Py_REF_DEBUG`` " +"Needs a :ref:`debug build of Python ` (the ``Py_REF_DEBUG`` " "macro must be defined)." msgstr "" -#: ../../c-api/init_config.rst:1127 +#: ../../c-api/init_config.rst:1184 msgid "Import the :mod:`site` module at startup?" msgstr "" -#: ../../c-api/init_config.rst:1129 +#: ../../c-api/init_config.rst:1186 msgid "" "If equal to zero, disable the import of the module site and the site-" "dependent manipulations of :data:`sys.path` that it entails." msgstr "" -#: ../../c-api/init_config.rst:1132 +#: ../../c-api/init_config.rst:1189 msgid "" "Also disable these manipulations if the :mod:`site` module is explicitly " "imported later (call :func:`site.main` if you want them to be triggered)." msgstr "" -#: ../../c-api/init_config.rst:1135 +#: ../../c-api/init_config.rst:1192 msgid "Set to ``0`` by the :option:`-S` command line option." msgstr "" -#: ../../c-api/init_config.rst:1137 +#: ../../c-api/init_config.rst:1194 msgid "" ":data:`sys.flags.no_site ` is set to the inverted value of :c:" "member:`~PyConfig.site_import`." msgstr "" -#: ../../c-api/init_config.rst:1144 +#: ../../c-api/init_config.rst:1201 msgid "" "If non-zero, skip the first line of the :c:member:`PyConfig.run_filename` " "source." msgstr "" -#: ../../c-api/init_config.rst:1147 +#: ../../c-api/init_config.rst:1204 msgid "" "It allows the usage of non-Unix forms of ``#!cmd``. This is intended for a " "DOS specific hack only." msgstr "" -#: ../../c-api/init_config.rst:1150 +#: ../../c-api/init_config.rst:1207 msgid "Set to ``1`` by the :option:`-x` command line option." msgstr "" -#: ../../c-api/init_config.rst:1157 +#: ../../c-api/init_config.rst:1214 msgid "" "Encoding and encoding errors of :data:`sys.stdin`, :data:`sys.stdout` and :" "data:`sys.stderr` (but :data:`sys.stderr` always uses " "``\"backslashreplace\"`` error handler)." msgstr "" -#: ../../c-api/init_config.rst:1161 -msgid "" -"If :c:func:`Py_SetStandardStreamEncoding` has been called, use its *error* " -"and *errors* arguments if they are not ``NULL``." -msgstr "" - -#: ../../c-api/init_config.rst:1164 +#: ../../c-api/init_config.rst:1218 msgid "" "Use the :envvar:`PYTHONIOENCODING` environment variable if it is non-empty." msgstr "" -#: ../../c-api/init_config.rst:1167 +#: ../../c-api/init_config.rst:1221 msgid "Default encoding:" msgstr "" -#: ../../c-api/init_config.rst:1169 +#: ../../c-api/init_config.rst:1223 msgid "``\"UTF-8\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero." msgstr "" -#: ../../c-api/init_config.rst:1170 +#: ../../c-api/init_config.rst:1224 msgid "Otherwise, use the :term:`locale encoding`." msgstr "" -#: ../../c-api/init_config.rst:1172 +#: ../../c-api/init_config.rst:1226 msgid "Default error handler:" msgstr "" -#: ../../c-api/init_config.rst:1174 +#: ../../c-api/init_config.rst:1228 msgid "On Windows: use ``\"surrogateescape\"``." msgstr "" -#: ../../c-api/init_config.rst:1175 +#: ../../c-api/init_config.rst:1229 msgid "" "``\"surrogateescape\"`` if :c:member:`PyPreConfig.utf8_mode` is non-zero, or " "if the LC_CTYPE locale is \"C\" or \"POSIX\"." msgstr "" -#: ../../c-api/init_config.rst:1177 +#: ../../c-api/init_config.rst:1231 msgid "``\"strict\"`` otherwise." msgstr "" -#: ../../c-api/init_config.rst:1181 +#: ../../c-api/init_config.rst:1233 +msgid "See also :c:member:`PyConfig.legacy_windows_stdio`." +msgstr "也請見 :c:member:`PyConfig.legacy_windows_stdio`。" + +#: ../../c-api/init_config.rst:1237 msgid "Enable tracemalloc?" msgstr "" -#: ../../c-api/init_config.rst:1183 +#: ../../c-api/init_config.rst:1239 msgid "If non-zero, call :func:`tracemalloc.start` at startup." msgstr "" -#: ../../c-api/init_config.rst:1185 +#: ../../c-api/init_config.rst:1241 msgid "" "Set by :option:`-X tracemalloc=N <-X>` command line option and by the :" "envvar:`PYTHONTRACEMALLOC` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1192 +#: ../../c-api/init_config.rst:1248 msgid "Enable compatibility mode with the perf profiler?" msgstr "" -#: ../../c-api/init_config.rst:1194 +#: ../../c-api/init_config.rst:1250 msgid "" "If non-zero, initialize the perf trampoline. See :ref:`perf_profiling` for " "more information." msgstr "" -#: ../../c-api/init_config.rst:1197 +#: ../../c-api/init_config.rst:1253 msgid "" -"Set by :option:`-X perf <-X>` command line option and by the :envvar:" -"`PYTHONPERFSUPPORT` environment variable." +"Set by :option:`-X perf <-X>` command-line option and by the :envvar:" +"`PYTHON_PERF_JIT_SUPPORT` environment variable for perf support with stack " +"pointers and :option:`-X perf_jit <-X>` command-line option and by the :" +"envvar:`PYTHON_PERF_JIT_SUPPORT` environment variable for perf support with " +"DWARF JIT information." msgstr "" -#: ../../c-api/init_config.rst:1200 -msgid "Default: ``-1``." -msgstr "預設值:``1``。" - -#: ../../c-api/init_config.rst:1206 +#: ../../c-api/init_config.rst:1265 msgid "Use :ref:`environment variables `?" msgstr "" -#: ../../c-api/init_config.rst:1208 +#: ../../c-api/init_config.rst:1267 msgid "" "If equals to zero, ignore the :ref:`environment variables `." msgstr "" -#: ../../c-api/init_config.rst:1211 +#: ../../c-api/init_config.rst:1270 msgid "Set to ``0`` by the :option:`-E` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1217 +#: ../../c-api/init_config.rst:1276 msgid "If non-zero, add the user site directory to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1219 +#: ../../c-api/init_config.rst:1278 msgid "Set to ``0`` by the :option:`-s` and :option:`-I` command line options." msgstr "" -#: ../../c-api/init_config.rst:1221 +#: ../../c-api/init_config.rst:1280 msgid "Set to ``0`` by the :envvar:`PYTHONNOUSERSITE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1227 +#: ../../c-api/init_config.rst:1286 msgid "" "Verbose mode. If greater than ``0``, print a message each time a module is " "imported, showing the place (filename or built-in module) from which it is " "loaded." msgstr "" -#: ../../c-api/init_config.rst:1231 +#: ../../c-api/init_config.rst:1290 msgid "" "If greater than or equal to ``2``, print a message for each file that is " "checked for when searching for a module. Also provides information on module " "cleanup at exit." msgstr "" -#: ../../c-api/init_config.rst:1235 +#: ../../c-api/init_config.rst:1294 msgid "Incremented by the :option:`-v` command line option." msgstr "" -#: ../../c-api/init_config.rst:1237 +#: ../../c-api/init_config.rst:1296 msgid "Set by the :envvar:`PYTHONVERBOSE` environment variable value." msgstr "" -#: ../../c-api/init_config.rst:1243 +#: ../../c-api/init_config.rst:1302 msgid "" "Options of the :mod:`warnings` module to build warnings filters, lowest to " "highest priority: :data:`sys.warnoptions`." msgstr "" -#: ../../c-api/init_config.rst:1246 +#: ../../c-api/init_config.rst:1305 msgid "" "The :mod:`warnings` module adds :data:`sys.warnoptions` in the reverse " "order: the last :c:member:`PyConfig.warnoptions` item becomes the first item " "of :data:`warnings.filters` which is checked first (highest priority)." msgstr "" -#: ../../c-api/init_config.rst:1251 +#: ../../c-api/init_config.rst:1310 msgid "" "The :option:`-W` command line options adds its value to :c:member:`~PyConfig." "warnoptions`, it can be used multiple times." msgstr "" -#: ../../c-api/init_config.rst:1254 +#: ../../c-api/init_config.rst:1313 msgid "" "The :envvar:`PYTHONWARNINGS` environment variable can also be used to add " "warning options. Multiple options can be specified, separated by commas (``," "``)." msgstr "" -#: ../../c-api/init_config.rst:1262 +#: ../../c-api/init_config.rst:1321 msgid "" "If equal to ``0``, Python won't try to write ``.pyc`` files on the import of " "source modules." msgstr "" -#: ../../c-api/init_config.rst:1265 +#: ../../c-api/init_config.rst:1324 msgid "" "Set to ``0`` by the :option:`-B` command line option and the :envvar:" "`PYTHONDONTWRITEBYTECODE` environment variable." msgstr "" -#: ../../c-api/init_config.rst:1268 +#: ../../c-api/init_config.rst:1327 msgid "" ":data:`sys.dont_write_bytecode` is initialized to the inverted value of :c:" "member:`~PyConfig.write_bytecode`." msgstr "" -#: ../../c-api/init_config.rst:1275 +#: ../../c-api/init_config.rst:1334 msgid "Values of the :option:`-X` command line options: :data:`sys._xoptions`." msgstr "" -#: ../../c-api/init_config.rst:1279 +#: ../../c-api/init_config.rst:1338 msgid "" "If :c:member:`~PyConfig.parse_argv` is non-zero, :c:member:`~PyConfig.argv` " "arguments are parsed the same way the regular Python parses :ref:`command " @@ -1758,29 +1829,29 @@ msgid "" "c:member:`~PyConfig.argv`." msgstr "" -#: ../../c-api/init_config.rst:1284 +#: ../../c-api/init_config.rst:1343 msgid "" "The :c:member:`~PyConfig.xoptions` options are parsed to set other options: " "see the :option:`-X` command line option." msgstr "" -#: ../../c-api/init_config.rst:1289 +#: ../../c-api/init_config.rst:1348 msgid "The ``show_alloc_count`` field has been removed." msgstr "" -#: ../../c-api/init_config.rst:1293 +#: ../../c-api/init_config.rst:1352 msgid "Initialization with PyConfig" msgstr "" -#: ../../c-api/init_config.rst:1295 +#: ../../c-api/init_config.rst:1354 msgid "Function to initialize Python:" msgstr "" -#: ../../c-api/init_config.rst:1299 +#: ../../c-api/init_config.rst:1358 msgid "Initialize Python from *config* configuration." msgstr "" -#: ../../c-api/init_config.rst:1304 +#: ../../c-api/init_config.rst:1363 msgid "" "If :c:func:`PyImport_FrozenModules`, :c:func:`PyImport_AppendInittab` or :c:" "func:`PyImport_ExtendInittab` are used, they must be set or called after " @@ -1789,17 +1860,17 @@ msgid "" "`PyImport_ExtendInittab` must be called before each Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1311 +#: ../../c-api/init_config.rst:1370 msgid "" "The current configuration (``PyConfig`` type) is stored in " "``PyInterpreterState.config``." msgstr "" -#: ../../c-api/init_config.rst:1314 +#: ../../c-api/init_config.rst:1373 msgid "Example setting the program name::" msgstr "" -#: ../../c-api/init_config.rst:1316 +#: ../../c-api/init_config.rst:1375 msgid "" "void init_python(void)\n" "{\n" @@ -1853,7 +1924,7 @@ msgstr "" " Py_ExitStatusException(status);\n" "}" -#: ../../c-api/init_config.rst:1342 +#: ../../c-api/init_config.rst:1401 msgid "" "More complete example modifying the default configuration, read the " "configuration, and then override some parameters. Note that since 3.11, many " @@ -1862,7 +1933,7 @@ msgid "" "called will be left unchanged by initialization::" msgstr "" -#: ../../c-api/init_config.rst:1349 +#: ../../c-api/init_config.rst:1408 msgid "" "PyStatus init_python(const char *program_name)\n" "{\n" @@ -1917,18 +1988,18 @@ msgid "" "}" msgstr "" -#: ../../c-api/init_config.rst:1405 +#: ../../c-api/init_config.rst:1464 msgid "Isolated Configuration" msgstr "" -#: ../../c-api/init_config.rst:1407 +#: ../../c-api/init_config.rst:1466 msgid "" ":c:func:`PyPreConfig_InitIsolatedConfig` and :c:func:" "`PyConfig_InitIsolatedConfig` functions create a configuration to isolate " "Python from the system. For example, to embed Python into an application." msgstr "" -#: ../../c-api/init_config.rst:1412 +#: ../../c-api/init_config.rst:1471 msgid "" "This configuration ignores global configuration variables, environment " "variables, command line arguments (:c:member:`PyConfig.argv` is not parsed) " @@ -1936,115 +2007,115 @@ msgid "" "LC_CTYPE locale are left unchanged. Signal handlers are not installed." msgstr "" -#: ../../c-api/init_config.rst:1417 +#: ../../c-api/init_config.rst:1476 msgid "" "Configuration files are still used with this configuration to determine " "paths that are unspecified. Ensure :c:member:`PyConfig.home` is specified to " "avoid computing the default path configuration." msgstr "" -#: ../../c-api/init_config.rst:1425 +#: ../../c-api/init_config.rst:1484 msgid "Python Configuration" msgstr "" -#: ../../c-api/init_config.rst:1427 +#: ../../c-api/init_config.rst:1486 msgid "" ":c:func:`PyPreConfig_InitPythonConfig` and :c:func:" "`PyConfig_InitPythonConfig` functions create a configuration to build a " "customized Python which behaves as the regular Python." msgstr "" -#: ../../c-api/init_config.rst:1431 +#: ../../c-api/init_config.rst:1490 msgid "" "Environments variables and command line arguments are used to configure " "Python, whereas global configuration variables are ignored." msgstr "" -#: ../../c-api/init_config.rst:1434 +#: ../../c-api/init_config.rst:1493 msgid "" "This function enables C locale coercion (:pep:`538`) and :ref:`Python UTF-8 " "Mode ` (:pep:`540`) depending on the LC_CTYPE locale, :envvar:" "`PYTHONUTF8` and :envvar:`PYTHONCOERCECLOCALE` environment variables." msgstr "" -#: ../../c-api/init_config.rst:1443 +#: ../../c-api/init_config.rst:1502 msgid "Python Path Configuration" msgstr "" -#: ../../c-api/init_config.rst:1445 +#: ../../c-api/init_config.rst:1504 msgid ":c:type:`PyConfig` contains multiple fields for the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1447 +#: ../../c-api/init_config.rst:1506 msgid "Path configuration inputs:" msgstr "" -#: ../../c-api/init_config.rst:1449 +#: ../../c-api/init_config.rst:1508 msgid ":c:member:`PyConfig.home`" msgstr ":c:member:`PyConfig.home`" -#: ../../c-api/init_config.rst:1450 +#: ../../c-api/init_config.rst:1509 msgid ":c:member:`PyConfig.platlibdir`" msgstr ":c:member:`PyConfig.platlibdir`" -#: ../../c-api/init_config.rst:1451 +#: ../../c-api/init_config.rst:1510 msgid ":c:member:`PyConfig.pathconfig_warnings`" msgstr ":c:member:`PyConfig.pathconfig_warnings`" -#: ../../c-api/init_config.rst:1452 +#: ../../c-api/init_config.rst:1511 msgid ":c:member:`PyConfig.program_name`" msgstr ":c:member:`PyConfig.program_name`" -#: ../../c-api/init_config.rst:1453 +#: ../../c-api/init_config.rst:1512 msgid ":c:member:`PyConfig.pythonpath_env`" msgstr ":c:member:`PyConfig.pythonpath_env`" -#: ../../c-api/init_config.rst:1454 +#: ../../c-api/init_config.rst:1513 msgid "current working directory: to get absolute paths" msgstr "" -#: ../../c-api/init_config.rst:1455 +#: ../../c-api/init_config.rst:1514 msgid "" "``PATH`` environment variable to get the program full path (from :c:member:" "`PyConfig.program_name`)" msgstr "" -#: ../../c-api/init_config.rst:1457 +#: ../../c-api/init_config.rst:1516 msgid "``__PYVENV_LAUNCHER__`` environment variable" msgstr "``__PYVENV_LAUNCHER__`` 環境變數" -#: ../../c-api/init_config.rst:1458 +#: ../../c-api/init_config.rst:1517 msgid "" "(Windows only) Application paths in the registry under " "\"Software\\Python\\PythonCore\\X.Y\\PythonPath\" of HKEY_CURRENT_USER and " "HKEY_LOCAL_MACHINE (where X.Y is the Python version)." msgstr "" -#: ../../c-api/init_config.rst:1462 +#: ../../c-api/init_config.rst:1521 msgid "Path configuration output fields:" msgstr "" -#: ../../c-api/init_config.rst:1464 +#: ../../c-api/init_config.rst:1523 msgid ":c:member:`PyConfig.base_exec_prefix`" msgstr ":c:member:`PyConfig.base_exec_prefix`" -#: ../../c-api/init_config.rst:1465 +#: ../../c-api/init_config.rst:1524 msgid ":c:member:`PyConfig.base_executable`" msgstr ":c:member:`PyConfig.base_executable`" -#: ../../c-api/init_config.rst:1466 +#: ../../c-api/init_config.rst:1525 msgid ":c:member:`PyConfig.base_prefix`" msgstr ":c:member:`PyConfig.base_prefix`" -#: ../../c-api/init_config.rst:1467 +#: ../../c-api/init_config.rst:1526 msgid ":c:member:`PyConfig.exec_prefix`" msgstr ":c:member:`PyConfig.exec_prefix`" -#: ../../c-api/init_config.rst:1468 +#: ../../c-api/init_config.rst:1527 msgid ":c:member:`PyConfig.executable`" msgstr ":c:member:`PyConfig.executable`" -#: ../../c-api/init_config.rst:1469 +#: ../../c-api/init_config.rst:1528 msgid "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" @@ -2052,11 +2123,11 @@ msgstr "" ":c:member:`PyConfig.module_search_paths_set`, :c:member:`PyConfig." "module_search_paths`" -#: ../../c-api/init_config.rst:1471 +#: ../../c-api/init_config.rst:1530 msgid ":c:member:`PyConfig.prefix`" msgstr ":c:member:`PyConfig.prefix`" -#: ../../c-api/init_config.rst:1473 +#: ../../c-api/init_config.rst:1532 msgid "" "If at least one \"output field\" is not set, Python calculates the path " "configuration to fill unset fields. If :c:member:`~PyConfig." @@ -2065,7 +2136,7 @@ msgid "" "module_search_paths_set` is set to ``1``." msgstr "" -#: ../../c-api/init_config.rst:1479 +#: ../../c-api/init_config.rst:1538 msgid "" "It is possible to completely ignore the function calculating the default " "path configuration by setting explicitly all path configuration output " @@ -2075,52 +2146,52 @@ msgid "" "modification." msgstr "" -#: ../../c-api/init_config.rst:1486 +#: ../../c-api/init_config.rst:1545 msgid "" "Set :c:member:`~PyConfig.pathconfig_warnings` to ``0`` to suppress warnings " "when calculating the path configuration (Unix only, Windows does not log any " "warning)." msgstr "" -#: ../../c-api/init_config.rst:1489 +#: ../../c-api/init_config.rst:1548 msgid "" "If :c:member:`~PyConfig.base_prefix` or :c:member:`~PyConfig." "base_exec_prefix` fields are not set, they inherit their value from :c:" "member:`~PyConfig.prefix` and :c:member:`~PyConfig.exec_prefix` respectively." msgstr "" -#: ../../c-api/init_config.rst:1493 +#: ../../c-api/init_config.rst:1552 msgid ":c:func:`Py_RunMain` and :c:func:`Py_Main` modify :data:`sys.path`:" msgstr "" -#: ../../c-api/init_config.rst:1495 +#: ../../c-api/init_config.rst:1554 msgid "" "If :c:member:`~PyConfig.run_filename` is set and is a directory which " "contains a ``__main__.py`` script, prepend :c:member:`~PyConfig." "run_filename` to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1498 +#: ../../c-api/init_config.rst:1557 msgid "If :c:member:`~PyConfig.isolated` is zero:" msgstr "" -#: ../../c-api/init_config.rst:1500 +#: ../../c-api/init_config.rst:1559 msgid "" "If :c:member:`~PyConfig.run_module` is set, prepend the current directory " "to :data:`sys.path`. Do nothing if the current directory cannot be read." msgstr "" -#: ../../c-api/init_config.rst:1502 +#: ../../c-api/init_config.rst:1561 msgid "" "If :c:member:`~PyConfig.run_filename` is set, prepend the directory of the " "filename to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1504 +#: ../../c-api/init_config.rst:1563 msgid "Otherwise, prepend an empty string to :data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1506 +#: ../../c-api/init_config.rst:1565 msgid "" "If :c:member:`~PyConfig.site_import` is non-zero, :data:`sys.path` can be " "modified by the :mod:`site` module. If :c:member:`~PyConfig." @@ -2129,170 +2200,170 @@ msgid "" "data:`sys.path`." msgstr "" -#: ../../c-api/init_config.rst:1512 +#: ../../c-api/init_config.rst:1571 msgid "The following configuration files are used by the path configuration:" msgstr "" -#: ../../c-api/init_config.rst:1514 +#: ../../c-api/init_config.rst:1573 msgid "``pyvenv.cfg``" msgstr "``pyvenv.cfg``" -#: ../../c-api/init_config.rst:1515 +#: ../../c-api/init_config.rst:1574 msgid "``._pth`` file (ex: ``python._pth``)" msgstr "" -#: ../../c-api/init_config.rst:1516 +#: ../../c-api/init_config.rst:1575 msgid "``pybuilddir.txt`` (Unix only)" msgstr "" -#: ../../c-api/init_config.rst:1518 +#: ../../c-api/init_config.rst:1577 msgid "If a ``._pth`` file is present:" msgstr "" -#: ../../c-api/init_config.rst:1520 +#: ../../c-api/init_config.rst:1579 msgid "Set :c:member:`~PyConfig.isolated` to ``1``." msgstr "將 :c:member:`~PyConfig.isolated` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1521 +#: ../../c-api/init_config.rst:1580 msgid "Set :c:member:`~PyConfig.use_environment` to ``0``." msgstr "將 :c:member:`~PyConfig.use_environment` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1522 +#: ../../c-api/init_config.rst:1581 msgid "Set :c:member:`~PyConfig.site_import` to ``0``." msgstr "將 :c:member:`~PyConfig.site_import` 設定為 ``0``。" -#: ../../c-api/init_config.rst:1523 +#: ../../c-api/init_config.rst:1582 msgid "Set :c:member:`~PyConfig.safe_path` to ``1``." msgstr "將 :c:member:`~PyConfig.safe_path` 設定為 ``1``。" -#: ../../c-api/init_config.rst:1525 +#: ../../c-api/init_config.rst:1584 msgid "" "The ``__PYVENV_LAUNCHER__`` environment variable is used to set :c:member:" -"`PyConfig.base_executable`" +"`PyConfig.base_executable`." msgstr "" -#: ../../c-api/init_config.rst:1530 +#: ../../c-api/init_config.rst:1589 msgid "Py_RunMain()" msgstr "Py_RunMain()" -#: ../../c-api/init_config.rst:1534 +#: ../../c-api/init_config.rst:1593 msgid "" "Execute the command (:c:member:`PyConfig.run_command`), the script (:c:" "member:`PyConfig.run_filename`) or the module (:c:member:`PyConfig." "run_module`) specified on the command line or in the configuration." msgstr "" -#: ../../c-api/init_config.rst:1539 +#: ../../c-api/init_config.rst:1598 msgid "By default and when if :option:`-i` option is used, run the REPL." msgstr "" -#: ../../c-api/init_config.rst:1541 +#: ../../c-api/init_config.rst:1600 msgid "" "Finally, finalizes Python and returns an exit status that can be passed to " "the ``exit()`` function." msgstr "" -#: ../../c-api/init_config.rst:1544 +#: ../../c-api/init_config.rst:1603 msgid "" "See :ref:`Python Configuration ` for an example of " "customized Python always running in isolated mode using :c:func:`Py_RunMain`." msgstr "" -#: ../../c-api/init_config.rst:1550 +#: ../../c-api/init_config.rst:1609 msgid "Py_GetArgcArgv()" msgstr "Py_GetArgcArgv()" -#: ../../c-api/init_config.rst:1554 +#: ../../c-api/init_config.rst:1613 msgid "Get the original command line arguments, before Python modified them." msgstr "" -#: ../../c-api/init_config.rst:1556 +#: ../../c-api/init_config.rst:1615 msgid "See also :c:member:`PyConfig.orig_argv` member." msgstr "" -#: ../../c-api/init_config.rst:1560 +#: ../../c-api/init_config.rst:1619 msgid "Multi-Phase Initialization Private Provisional API" msgstr "" -#: ../../c-api/init_config.rst:1562 +#: ../../c-api/init_config.rst:1621 msgid "" "This section is a private provisional API introducing multi-phase " "initialization, the core feature of :pep:`432`:" msgstr "" -#: ../../c-api/init_config.rst:1565 +#: ../../c-api/init_config.rst:1624 msgid "\"Core\" initialization phase, \"bare minimum Python\":" msgstr "" -#: ../../c-api/init_config.rst:1567 +#: ../../c-api/init_config.rst:1626 msgid "Builtin types;" msgstr "內建型別;" -#: ../../c-api/init_config.rst:1568 +#: ../../c-api/init_config.rst:1627 msgid "Builtin exceptions;" msgstr "內建例外;" -#: ../../c-api/init_config.rst:1569 +#: ../../c-api/init_config.rst:1628 msgid "Builtin and frozen modules;" msgstr "" -#: ../../c-api/init_config.rst:1570 +#: ../../c-api/init_config.rst:1629 msgid "" "The :mod:`sys` module is only partially initialized (ex: :data:`sys.path` " "doesn't exist yet)." msgstr "" -#: ../../c-api/init_config.rst:1573 +#: ../../c-api/init_config.rst:1632 msgid "\"Main\" initialization phase, Python is fully initialized:" msgstr "" -#: ../../c-api/init_config.rst:1575 +#: ../../c-api/init_config.rst:1634 msgid "Install and configure :mod:`importlib`;" msgstr "" -#: ../../c-api/init_config.rst:1576 +#: ../../c-api/init_config.rst:1635 msgid "Apply the :ref:`Path Configuration `;" msgstr "" -#: ../../c-api/init_config.rst:1577 +#: ../../c-api/init_config.rst:1636 msgid "Install signal handlers;" msgstr "" -#: ../../c-api/init_config.rst:1578 +#: ../../c-api/init_config.rst:1637 msgid "" "Finish :mod:`sys` module initialization (ex: create :data:`sys.stdout` and :" "data:`sys.path`);" msgstr "" -#: ../../c-api/init_config.rst:1580 +#: ../../c-api/init_config.rst:1639 msgid "" "Enable optional features like :mod:`faulthandler` and :mod:`tracemalloc`;" msgstr "" -#: ../../c-api/init_config.rst:1581 +#: ../../c-api/init_config.rst:1640 msgid "Import the :mod:`site` module;" msgstr "引入 :mod:`site` 模組;" -#: ../../c-api/init_config.rst:1582 +#: ../../c-api/init_config.rst:1641 msgid "etc." msgstr "" -#: ../../c-api/init_config.rst:1584 +#: ../../c-api/init_config.rst:1643 msgid "Private provisional API:" msgstr "" -#: ../../c-api/init_config.rst:1586 +#: ../../c-api/init_config.rst:1645 msgid "" ":c:member:`PyConfig._init_main`: if set to ``0``, :c:func:" "`Py_InitializeFromConfig` stops at the \"Core\" initialization phase." msgstr "" -#: ../../c-api/init_config.rst:1591 +#: ../../c-api/init_config.rst:1650 msgid "" "Move to the \"Main\" initialization phase, finish the Python initialization." msgstr "" -#: ../../c-api/init_config.rst:1593 +#: ../../c-api/init_config.rst:1652 msgid "" "No module is imported during the \"Core\" phase and the ``importlib`` module " "is not configured: the :ref:`Path Configuration ` is only " @@ -2301,14 +2372,14 @@ msgid "" "maybe install a custom :data:`sys.meta_path` importer or an import hook, etc." msgstr "" -#: ../../c-api/init_config.rst:1599 +#: ../../c-api/init_config.rst:1658 msgid "" "It may become possible to calculate the :ref:`Path Configuration ` in Python, after the Core phase and before the Main phase, which is " "one of the :pep:`432` motivation." msgstr "" -#: ../../c-api/init_config.rst:1603 +#: ../../c-api/init_config.rst:1662 msgid "" "The \"Core\" phase is not properly defined: what should be and what should " "not be available at this phase is not specified yet. The API is marked as " @@ -2316,13 +2387,13 @@ msgid "" "until a proper public API is designed." msgstr "" -#: ../../c-api/init_config.rst:1608 +#: ../../c-api/init_config.rst:1667 msgid "" "Example running Python code between \"Core\" and \"Main\" initialization " "phases::" msgstr "" -#: ../../c-api/init_config.rst:1611 +#: ../../c-api/init_config.rst:1670 msgid "" "void init_python(void)\n" "{\n" @@ -2358,3 +2429,14 @@ msgid "" " }\n" "}" msgstr "" + +#: ../../c-api/init_config.rst:558 +msgid "main()" +msgstr "" + +#: ../../c-api/init_config.rst:558 +msgid "argv (in module sys)" +msgstr "" + +#~ msgid "Command line arguments: :data:`sys.argv`." +#~ msgstr "命令列引數::data:`sys.argv`。" diff --git a/c-api/intro.po b/c-api/intro.po index 5432552e14..9854c7f4d0 100644 --- a/c-api/intro.po +++ b/c-api/intro.po @@ -6,9 +6,9 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-04-25 18:01+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1211,13 +1211,14 @@ msgstr "" "`PYTHONHOME`,或者透過設定 :envvar:`PYTHONPATH` 在標準路徑前面插入額外的目" "錄。" -#: ../../c-api/intro.rst:779 +#: ../../c-api/intro.rst:778 +#, fuzzy msgid "" -"The embedding application can steer the search by calling " -"``Py_SetProgramName(file)`` *before* calling :c:func:`Py_Initialize`. Note " -"that :envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` is " -"still inserted in front of the standard path. An application that requires " -"total control has to provide its own implementation of :c:func:" +"The embedding application can steer the search by setting :c:member:" +"`PyConfig.program_name` *before* calling :c:func:`Py_InitializeFromConfig`. " +"Note that :envvar:`PYTHONHOME` still overrides this and :envvar:`PYTHONPATH` " +"is still inserted in front of the standard path. An application that " +"requires total control has to provide its own implementation of :c:func:" "`Py_GetPath`, :c:func:`Py_GetPrefix`, :c:func:`Py_GetExecPrefix`, and :c:" "func:`Py_GetProgramFullPath` (all defined in :file:`Modules/getpath.c`)." msgstr "" @@ -1426,10 +1427,6 @@ msgstr "path(路徑)" msgid "path (in module sys)" msgstr "path(sys 模組中)" -#: ../../c-api/intro.rst:772 -msgid "Py_SetProgramName (C function)" -msgstr "Py_SetProgramName(C 函式)" - #: ../../c-api/intro.rst:772 msgid "Py_GetPath (C function)" msgstr "Py_GetPath(C 函式)" @@ -1449,3 +1446,6 @@ msgstr "Py_GetProgramFullPath(C 函式)" #: ../../c-api/intro.rst:787 msgid "Py_IsInitialized (C function)" msgstr "Py_IsInitialized(C 函式)" + +#~ msgid "Py_SetProgramName (C function)" +#~ msgstr "Py_SetProgramName(C 函式)" diff --git a/c-api/iter.po b/c-api/iter.po index 8b674435cc..ac90b9dc26 100644 --- a/c-api/iter.po +++ b/c-api/iter.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2023-07-01 03:44+0800\n" diff --git a/c-api/iterator.po b/c-api/iterator.po index fe68f1fa77..3675b02e9a 100644 --- a/c-api/iterator.po +++ b/c-api/iterator.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-24 00:03+0000\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/c-api/list.po b/c-api/list.po index ed430f77a6..8627316f79 100644 --- a/c-api/list.po +++ b/c-api/list.po @@ -6,9 +6,9 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-08-24 00:55+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -57,43 +57,54 @@ msgid "Return a new list of length *len* on success, or ``NULL`` on failure." msgstr "成功時回傳長度為 *len* 的新串列,失敗時回傳 ``NULL``。" #: ../../c-api/list.rst:40 +#, fuzzy msgid "" "If *len* is greater than zero, the returned list object's items are set to " -"``NULL``. Thus you cannot use abstract API functions such as :c:func:" -"`PySequence_SetItem` or expose the object to Python code before setting all " -"items to a real object with :c:func:`PyList_SetItem`." +"``NULL``. Thus you cannot use abstract API functions such as :c:func:" +"`PySequence_SetItem` or expose the object to Python code before setting all " +"items to a real object with :c:func:`PyList_SetItem` or :c:func:" +"`PyList_SET_ITEM()`. The following APIs are safe APIs before the list is " +"fully initialized: :c:func:`PyList_SetItem()` and :c:func:" +"`PyList_SET_ITEM()`." msgstr "" "如果 *len* 大於零,則回傳的串列物件之項目將被設定為 ``NULL``。因此,在使用 :" "c:func:`PyList_SetItem` 來將所有項目設定為一個真實物件前,你無法使用像是 :c:" "func:`PySequence_SetItem` 的使用抽象 API 函式,也不能將物件暴露 (expose) 給 " "Python 程式碼。" -#: ../../c-api/list.rst:50 +#: ../../c-api/list.rst:53 msgid "" "Return the length of the list object in *list*; this is equivalent to " "``len(list)`` on a list object." msgstr "回傳 *list* 串列物件的長度;這相當於串列物件的 ``len(list)``。" -#: ../../c-api/list.rst:56 +#: ../../c-api/list.rst:59 msgid "Similar to :c:func:`PyList_Size`, but without error checking." msgstr "與 :c:func:`PyList_Size` 類似,但沒有錯誤檢查。" -#: ../../c-api/list.rst:61 +#: ../../c-api/list.rst:64 +#, fuzzy msgid "" "Return the object at position *index* in the list pointed to by *list*. The " "position must be non-negative; indexing from the end of the list is not " -"supported. If *index* is out of bounds (<0 or >=len(list)), return ``NULL`` " -"and set an :exc:`IndexError` exception." +"supported. If *index* is out of bounds (:code:`<0 or >=len(list)`), return " +"``NULL`` and set an :exc:`IndexError` exception." msgstr "" "回傳 *list* 指向的串列中位於 *index* 位置的物件。該位置不可為負數;並不支援從" "串列尾末開始索引。如果 *index* 超出邊界範圍(<0 或 >=len(list))則回傳 " "``NULL`` 並設定 :exc:`IndexError` 例外。" -#: ../../c-api/list.rst:69 +#: ../../c-api/list.rst:74 +msgid "" +"Like :c:func:`PyList_GetItemRef`, but returns a :term:`borrowed reference` " +"instead of a :term:`strong reference`." +msgstr "" + +#: ../../c-api/list.rst:80 msgid "Similar to :c:func:`PyList_GetItem`, but without error checking." msgstr "與 :c:func:`PyList_GetItem` 類似,但沒有錯誤檢查。" -#: ../../c-api/list.rst:74 +#: ../../c-api/list.rst:85 msgid "" "Set the item at index *index* in list to *item*. Return ``0`` on success. " "If *index* is out of bounds, return ``-1`` and set an :exc:`IndexError` " @@ -102,14 +113,14 @@ msgstr "" "將串列中索引 *index* 處的項目設定為 *item*。成功時回傳 ``0``。如果 *index* 超" "出邊界範圍則回傳 ``-1`` 並設定一個 :exc:`IndexError` 例外。" -#: ../../c-api/list.rst:80 +#: ../../c-api/list.rst:91 msgid "" "This function \"steals\" a reference to *item* and discards a reference to " "an item already in the list at the affected position." msgstr "" "此函式「竊取」對 *item* 的參照,並丟棄對串列中受影響位置上已存在項目的參照。" -#: ../../c-api/list.rst:86 +#: ../../c-api/list.rst:97 msgid "" "Macro form of :c:func:`PyList_SetItem` without error checking. This is " "normally only used to fill in new lists where there is no previous content." @@ -117,7 +128,13 @@ msgstr "" ":c:func:`PyList_SetItem` 的巨集形式,沒有錯誤檢查。這通常僅用於填充沒有已存在" "內容的新串列。" -#: ../../c-api/list.rst:91 +#: ../../c-api/list.rst:100 +msgid "" +"Bounds checking is performed as an assertion if Python is built in :ref:" +"`debug mode ` or :option:`with assertions <--with-assertions>`." +msgstr "" + +#: ../../c-api/list.rst:106 msgid "" "This macro \"steals\" a reference to *item*, and, unlike :c:func:" "`PyList_SetItem`, does *not* discard a reference to any item that is being " @@ -127,7 +144,7 @@ msgstr "" "\\ *不會*\\ 丟棄對任意被替換項目的參照;*list* 中位置 *i* 的任何參照都將被洩" "漏 (leak)。" -#: ../../c-api/list.rst:99 +#: ../../c-api/list.rst:114 msgid "" "Insert the item *item* into list *list* in front of index *index*. Return " "``0`` if successful; return ``-1`` and set an exception if unsuccessful. " @@ -137,7 +154,7 @@ msgstr "" "``0``;如果失敗則回傳 ``-1`` 並設定例外。類似於 ``list.insert(index, " "item)``。" -#: ../../c-api/list.rst:106 +#: ../../c-api/list.rst:121 msgid "" "Append the object *item* at the end of list *list*. Return ``0`` if " "successful; return ``-1`` and set an exception if unsuccessful. Analogous " @@ -146,7 +163,7 @@ msgstr "" "將物件 *item* 附加到串列 *list* 的最後面。如果成功則回傳 ``0``;如果不成功," "則回傳 ``-1`` 並設定例外。類似於 ``list.append(item)``。" -#: ../../c-api/list.rst:113 +#: ../../c-api/list.rst:128 msgid "" "Return a list of the objects in *list* containing the objects *between* " "*low* and *high*. Return ``NULL`` and set an exception if unsuccessful. " @@ -157,7 +174,7 @@ msgstr "" "成功則回傳 ``NULL`` 並設定例外。類似於 ``list[low:high]``。不支援從串列尾末開" "始索引。" -#: ../../c-api/list.rst:120 +#: ../../c-api/list.rst:135 msgid "" "Set the slice of *list* between *low* and *high* to the contents of " "*itemlist*. Analogous to ``list[low:high] = itemlist``. The *itemlist* may " @@ -170,7 +187,33 @@ msgstr "" "(切片刪除)。成功時回傳 ``0``,失敗時則回傳 ``-1``。不支援從串列尾末開始索" "引。" -#: ../../c-api/list.rst:129 +#: ../../c-api/list.rst:144 +msgid "" +"Extend *list* with the contents of *iterable*. This is the same as " +"``PyList_SetSlice(list, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable)`` and " +"analogous to ``list.extend(iterable)`` or ``list += iterable``." +msgstr "" + +#: ../../c-api/list.rst:148 +msgid "" +"Raise an exception and return ``-1`` if *list* is not a :class:`list` " +"object. Return 0 on success." +msgstr "" + +#: ../../c-api/list.rst:156 +msgid "" +"Remove all items from *list*. This is the same as ``PyList_SetSlice(list, " +"0, PY_SSIZE_T_MAX, NULL)`` and analogous to ``list.clear()`` or ``del " +"list[:]``." +msgstr "" + +#: ../../c-api/list.rst:160 +msgid "" +"Raise an exception and return ``-1`` if *list* is not a :class:`list` " +"object. Return 0 on success." +msgstr "" + +#: ../../c-api/list.rst:168 msgid "" "Sort the items of *list* in place. Return ``0`` on success, ``-1`` on " "failure. This is equivalent to ``list.sort()``." @@ -178,7 +221,7 @@ msgstr "" "對 *list* 的項目進行原地 (in place) 排序。成功時回傳 ``0``,失敗時回傳 " "``-1``。這相當於 ``list.sort()``。" -#: ../../c-api/list.rst:135 +#: ../../c-api/list.rst:174 msgid "" "Reverse the items of *list* in place. Return ``0`` on success, ``-1`` on " "failure. This is the equivalent of ``list.reverse()``." @@ -186,7 +229,7 @@ msgstr "" "原地反轉 *list* 的項目。成功時回傳 ``0``,失敗時回傳 ``-1``。這相當於 ``list." "reverse()``。" -#: ../../c-api/list.rst:143 +#: ../../c-api/list.rst:182 msgid "" "Return a new tuple object containing the contents of *list*; equivalent to " "``tuple(list)``." @@ -202,14 +245,14 @@ msgstr "object(物件)" msgid "list" msgstr "list(串列)" -#: ../../c-api/list.rst:48 ../../c-api/list.rst:141 +#: ../../c-api/list.rst:51 ../../c-api/list.rst:180 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/list.rst:48 +#: ../../c-api/list.rst:51 msgid "len" msgstr "len" -#: ../../c-api/list.rst:141 +#: ../../c-api/list.rst:180 msgid "tuple" msgstr "tuple(元組)" diff --git a/c-api/long.po b/c-api/long.po index dc269967a2..8416a8fa8a 100644 --- a/c-api/long.po +++ b/c-api/long.po @@ -5,9 +5,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-06 00:03+0000\n" +"POT-Creation-Date: 2024-09-30 09:19+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -138,35 +138,80 @@ msgid "" "retrieved from the resulting value using :c:func:`PyLong_AsVoidPtr`." msgstr "" -#: ../../c-api/long.rst:123 ../../c-api/long.rst:141 +#: ../../c-api/long.rst:118 +msgid "" +"Create a Python integer from the value contained in the first *n_bytes* of " +"*buffer*, interpreted as a two's-complement signed number." +msgstr "" + +#: ../../c-api/long.rst:121 +msgid "" +"*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will " +"select the native endian that CPython was compiled with and assume that the " +"most-significant bit is a sign bit. Passing " +"``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` will produce the same result as " +"calling :c:func:`PyLong_FromUnsignedNativeBytes`. Other flags are ignored." +msgstr "" + +#: ../../c-api/long.rst:132 +msgid "" +"Create a Python integer from the value contained in the first *n_bytes* of " +"*buffer*, interpreted as an unsigned number." +msgstr "" + +#: ../../c-api/long.rst:135 +msgid "" +"*flags* are as for :c:func:`PyLong_AsNativeBytes`. Passing ``-1`` will " +"select the native endian that CPython was compiled with and assume that the " +"most-significant bit is not a sign bit. Flags other than endian are ignored." +msgstr "" + +#: ../../c-api/long.rst:148 ../../c-api/long.rst:184 msgid "" "Return a C :c:expr:`long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:127 +#: ../../c-api/long.rst:152 msgid "" "Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" "expr:`long`." msgstr "" -#: ../../c-api/long.rst:130 ../../c-api/long.rst:150 ../../c-api/long.rst:171 -#: ../../c-api/long.rst:191 ../../c-api/long.rst:214 +#: ../../c-api/long.rst:155 ../../c-api/long.rst:193 ../../c-api/long.rst:214 +#: ../../c-api/long.rst:234 ../../c-api/long.rst:257 msgid "Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:132 ../../c-api/long.rst:152 ../../c-api/long.rst:173 -#: ../../c-api/long.rst:195 ../../c-api/long.rst:279 ../../c-api/long.rst:299 +#: ../../c-api/long.rst:157 ../../c-api/long.rst:195 ../../c-api/long.rst:216 +#: ../../c-api/long.rst:238 ../../c-api/long.rst:322 ../../c-api/long.rst:342 msgid "Use :meth:`~object.__index__` if available." msgstr "" -#: ../../c-api/long.rst:135 ../../c-api/long.rst:155 ../../c-api/long.rst:176 -#: ../../c-api/long.rst:198 ../../c-api/long.rst:282 ../../c-api/long.rst:302 +#: ../../c-api/long.rst:160 ../../c-api/long.rst:198 ../../c-api/long.rst:219 +#: ../../c-api/long.rst:241 ../../c-api/long.rst:325 ../../c-api/long.rst:345 msgid "This function will no longer use :meth:`~object.__int__`." msgstr "" -#: ../../c-api/long.rst:145 +#: ../../c-api/long.rst:167 +msgid "" +"A :term:`soft deprecated` alias. Exactly equivalent to the preferred " +"``PyLong_AsLong``. In particular, it can fail with :exc:`OverflowError` or " +"another exception." +msgstr "" + +#: ../../c-api/long.rst:171 +msgid "The function is soft deprecated." +msgstr "" + +#: ../../c-api/long.rst:176 +msgid "" +"Similar to :c:func:`PyLong_AsLong`, but store the result in a C :c:expr:" +"`int` instead of a C :c:expr:`long`." +msgstr "" + +#: ../../c-api/long.rst:188 msgid "" "If the value of *obj* is greater than :c:macro:`LONG_MAX` or less than :c:" "macro:`LONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " @@ -174,20 +219,20 @@ msgid "" "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: ../../c-api/long.rst:164 ../../c-api/long.rst:182 +#: ../../c-api/long.rst:207 ../../c-api/long.rst:225 msgid "" "Return a C :c:expr:`long long` representation of *obj*. If *obj* is not an " "instance of :c:type:`PyLongObject`, first call its :meth:`~object.__index__` " "method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:168 +#: ../../c-api/long.rst:211 msgid "" "Raise :exc:`OverflowError` if the value of *obj* is out of range for a :c:" "expr:`long long`." msgstr "" -#: ../../c-api/long.rst:186 +#: ../../c-api/long.rst:229 msgid "" "If the value of *obj* is greater than :c:macro:`LLONG_MAX` or less than :c:" "macro:`LLONG_MIN`, set *\\*overflow* to ``1`` or ``-1``, respectively, and " @@ -195,133 +240,133 @@ msgid "" "exception occurs set *\\*overflow* to ``0`` and return ``-1`` as usual." msgstr "" -#: ../../c-api/long.rst:208 +#: ../../c-api/long.rst:251 msgid "" "Return a C :c:type:`Py_ssize_t` representation of *pylong*. *pylong* must " "be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:211 +#: ../../c-api/long.rst:254 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "type:`Py_ssize_t`." msgstr "" -#: ../../c-api/long.rst:223 +#: ../../c-api/long.rst:266 msgid "" "Return a C :c:expr:`unsigned long` representation of *pylong*. *pylong* " "must be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:226 +#: ../../c-api/long.rst:269 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "expr:`unsigned long`." msgstr "" -#: ../../c-api/long.rst:229 +#: ../../c-api/long.rst:272 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:239 +#: ../../c-api/long.rst:282 msgid "" "Return a C :c:type:`size_t` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:242 +#: ../../c-api/long.rst:285 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "type:`size_t`." msgstr "" -#: ../../c-api/long.rst:245 +#: ../../c-api/long.rst:288 msgid "" "Returns ``(size_t)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:254 +#: ../../c-api/long.rst:297 msgid "" "Return a C :c:expr:`unsigned long long` representation of *pylong*. " "*pylong* must be an instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:257 +#: ../../c-api/long.rst:300 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for an :" "c:expr:`unsigned long long`." msgstr "" -#: ../../c-api/long.rst:260 +#: ../../c-api/long.rst:303 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:263 +#: ../../c-api/long.rst:306 msgid "" "A negative *pylong* now raises :exc:`OverflowError`, not :exc:`TypeError`." msgstr "" -#: ../../c-api/long.rst:269 +#: ../../c-api/long.rst:312 msgid "" "Return a C :c:expr:`unsigned long` representation of *obj*. If *obj* is not " "an instance of :c:type:`PyLongObject`, first call its :meth:`~object." "__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:273 +#: ../../c-api/long.rst:316 msgid "" "If the value of *obj* is out of range for an :c:expr:`unsigned long`, return " "the reduction of that value modulo ``ULONG_MAX + 1``." msgstr "" -#: ../../c-api/long.rst:276 +#: ../../c-api/long.rst:319 msgid "" "Returns ``(unsigned long)-1`` on error. Use :c:func:`PyErr_Occurred` to " "disambiguate." msgstr "" -#: ../../c-api/long.rst:288 +#: ../../c-api/long.rst:331 msgid "" "Return a C :c:expr:`unsigned long long` representation of *obj*. If *obj* " "is not an instance of :c:type:`PyLongObject`, first call its :meth:`~object." "__index__` method (if present) to convert it to a :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:293 +#: ../../c-api/long.rst:336 msgid "" "If the value of *obj* is out of range for an :c:expr:`unsigned long long`, " "return the reduction of that value modulo ``ULLONG_MAX + 1``." msgstr "" -#: ../../c-api/long.rst:296 +#: ../../c-api/long.rst:339 msgid "" "Returns ``(unsigned long long)-1`` on error. Use :c:func:`PyErr_Occurred` " "to disambiguate." msgstr "" -#: ../../c-api/long.rst:308 +#: ../../c-api/long.rst:351 msgid "" "Return a C :c:expr:`double` representation of *pylong*. *pylong* must be an " "instance of :c:type:`PyLongObject`." msgstr "" -#: ../../c-api/long.rst:311 +#: ../../c-api/long.rst:354 msgid "" "Raise :exc:`OverflowError` if the value of *pylong* is out of range for a :c:" "expr:`double`." msgstr "" -#: ../../c-api/long.rst:314 +#: ../../c-api/long.rst:357 msgid "" "Returns ``-1.0`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:319 +#: ../../c-api/long.rst:362 msgid "" "Convert a Python integer *pylong* to a C :c:expr:`void` pointer. If *pylong* " "cannot be converted, an :exc:`OverflowError` will be raised. This is only " @@ -329,52 +374,263 @@ msgid "" "c:func:`PyLong_FromVoidPtr`." msgstr "" -#: ../../c-api/long.rst:324 +#: ../../c-api/long.rst:367 msgid "" "Returns ``NULL`` on error. Use :c:func:`PyErr_Occurred` to disambiguate." msgstr "" -#: ../../c-api/long.rst:329 +#: ../../c-api/long.rst:372 +msgid "" +"Copy the Python integer value *pylong* to a native *buffer* of size " +"*n_bytes*. The *flags* can be set to ``-1`` to behave similarly to a C cast, " +"or to values documented below to control the behavior." +msgstr "" + +#: ../../c-api/long.rst:376 +msgid "" +"Returns ``-1`` with an exception raised on error. This may happen if " +"*pylong* cannot be interpreted as an integer, or if *pylong* was negative " +"and the ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` flag was set." +msgstr "" + +#: ../../c-api/long.rst:380 +msgid "" +"Otherwise, returns the number of bytes required to store the value. If this " +"is equal to or less than *n_bytes*, the entire value was copied. All " +"*n_bytes* of the buffer are written: large buffers are padded with zeroes." +msgstr "" + +#: ../../c-api/long.rst:385 +msgid "" +"If the returned value is greater than than *n_bytes*, the value was " +"truncated: as many of the lowest bits of the value as could fit are written, " +"and the higher bits are ignored. This matches the typical behavior of a C-" +"style downcast." +msgstr "" + +#: ../../c-api/long.rst:392 +msgid "" +"Overflow is not considered an error. If the returned value is larger than " +"*n_bytes*, most significant bits were discarded." +msgstr "" + +#: ../../c-api/long.rst:395 +msgid "``0`` will never be returned." +msgstr "``0`` 將永不被回傳。" + +#: ../../c-api/long.rst:397 +msgid "Values are always copied as two's-complement." +msgstr "" + +#: ../../c-api/long.rst:399 +msgid "Usage example::" +msgstr "使用範例: ::" + +#: ../../c-api/long.rst:401 +msgid "" +"int32_t value;\n" +"Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, &value, sizeof(value), -1);\n" +"if (bytes < 0) {\n" +" // Failed. A Python exception was set with the reason.\n" +" return NULL;\n" +"}\n" +"else if (bytes <= (Py_ssize_t)sizeof(value)) {\n" +" // Success!\n" +"}\n" +"else {\n" +" // Overflow occurred, but 'value' contains the truncated\n" +" // lowest bits of pylong.\n" +"}" +msgstr "" + +#: ../../c-api/long.rst:415 +msgid "" +"Passing zero to *n_bytes* will return the size of a buffer that would be " +"large enough to hold the value. This may be larger than technically " +"necessary, but not unreasonably so. If *n_bytes=0*, *buffer* may be ``NULL``." +msgstr "" + +#: ../../c-api/long.rst:422 +msgid "" +"Passing *n_bytes=0* to this function is not an accurate way to determine the " +"bit length of the value." +msgstr "" + +#: ../../c-api/long.rst:425 +msgid "" +"To get at the entire Python value of an unknown size, the function can be " +"called twice: first to determine the buffer size, then to fill it::" +msgstr "" + +#: ../../c-api/long.rst:428 +msgid "" +"// Ask how much space we need.\n" +"Py_ssize_t expected = PyLong_AsNativeBytes(pylong, NULL, 0, -1);\n" +"if (expected < 0) {\n" +" // Failed. A Python exception was set with the reason.\n" +" return NULL;\n" +"}\n" +"assert(expected != 0); // Impossible per the API definition.\n" +"uint8_t *bignum = malloc(expected);\n" +"if (!bignum) {\n" +" PyErr_SetString(PyExc_MemoryError, \"bignum malloc failed.\");\n" +" return NULL;\n" +"}\n" +"// Safely get the entire value.\n" +"Py_ssize_t bytes = PyLong_AsNativeBytes(pylong, bignum, expected, -1);\n" +"if (bytes < 0) { // Exception has been set.\n" +" free(bignum);\n" +" return NULL;\n" +"}\n" +"else if (bytes > expected) { // This should not be possible.\n" +" PyErr_SetString(PyExc_RuntimeError,\n" +" \"Unexpected bignum truncation after a size check.\");\n" +" free(bignum);\n" +" return NULL;\n" +"}\n" +"// The expected success given the above pre-check.\n" +"// ... use bignum ...\n" +"free(bignum);" +msgstr "" + +#: ../../c-api/long.rst:456 +msgid "" +"*flags* is either ``-1`` (``Py_ASNATIVEBYTES_DEFAULTS``) to select defaults " +"that behave most like a C cast, or a combintation of the other flags in the " +"table below. Note that ``-1`` cannot be combined with other flags." +msgstr "" + +#: ../../c-api/long.rst:461 +msgid "" +"Currently, ``-1`` corresponds to ``Py_ASNATIVEBYTES_NATIVE_ENDIAN | " +"Py_ASNATIVEBYTES_UNSIGNED_BUFFER``." +msgstr "" + +#: ../../c-api/long.rst:467 +msgid "Flag" +msgstr "旗標" + +#: ../../c-api/long.rst:467 +msgid "Value" +msgstr "數值" + +#: ../../c-api/long.rst:469 +msgid "``-1``" +msgstr "``-1``" + +#: ../../c-api/long.rst:470 +msgid "``0``" +msgstr "``0``" + +#: ../../c-api/long.rst:471 +msgid "``1``" +msgstr "``1``" + +#: ../../c-api/long.rst:472 +msgid "``3``" +msgstr "``3``" + +#: ../../c-api/long.rst:473 +msgid "``4``" +msgstr "``4``" + +#: ../../c-api/long.rst:474 +msgid "``8``" +msgstr "``8``" + +#: ../../c-api/long.rst:475 +msgid "``16``" +msgstr "``16``" + +#: ../../c-api/long.rst:478 +msgid "" +"Specifying ``Py_ASNATIVEBYTES_NATIVE_ENDIAN`` will override any other endian " +"flags. Passing ``2`` is reserved." +msgstr "" + +#: ../../c-api/long.rst:481 +msgid "" +"By default, sufficient buffer will be requested to include a sign bit. For " +"example, when converting 128 with *n_bytes=1*, the function will return 2 " +"(or more) in order to store a zero sign bit." +msgstr "" + +#: ../../c-api/long.rst:485 +msgid "" +"If ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` is specified, a zero sign bit will " +"be omitted from size calculations. This allows, for example, 128 to fit in a " +"single-byte buffer. If the destination buffer is later treated as signed, a " +"positive input value may become negative. Note that the flag does not affect " +"handling of negative values: for those, space for a sign bit is always " +"requested." +msgstr "" + +#: ../../c-api/long.rst:492 +msgid "" +"Specifying ``Py_ASNATIVEBYTES_REJECT_NEGATIVE`` causes an exception to be " +"set if *pylong* is negative. Without this flag, negative values will be " +"copied provided there is enough space for at least one sign bit, regardless " +"of whether ``Py_ASNATIVEBYTES_UNSIGNED_BUFFER`` was specified." +msgstr "" + +#: ../../c-api/long.rst:497 +msgid "" +"If ``Py_ASNATIVEBYTES_ALLOW_INDEX`` is specified and a non-integer value is " +"passed, its :meth:`~object.__index__` method will be called first. This may " +"result in Python code executing and other threads being allowed to run, " +"which could cause changes to other objects or values in use. When *flags* is " +"``-1``, this option is not set, and non-integer values will raise :exc:" +"`TypeError`." +msgstr "" + +#: ../../c-api/long.rst:506 +msgid "" +"With the default *flags* (``-1``, or *UNSIGNED_BUFFER* without " +"*REJECT_NEGATIVE*), multiple Python integers can map to a single value " +"without overflow. For example, both ``255`` and ``-1`` fit a single-byte " +"buffer and set all its bits. This matches typical C cast behavior." +msgstr "" + +#: ../../c-api/long.rst:517 msgid "" "On success, return a read only :term:`named tuple`, that holds information " "about Python's internal representation of integers. See :data:`sys.int_info` " "for description of individual fields." msgstr "" -#: ../../c-api/long.rst:333 +#: ../../c-api/long.rst:521 msgid "On failure, return ``NULL`` with an exception set." msgstr "在失敗時,會回傳 ``NULL`` 並設定例外。" -#: ../../c-api/long.rst:340 +#: ../../c-api/long.rst:528 msgid "Return 1 if *op* is compact, 0 otherwise." msgstr "" -#: ../../c-api/long.rst:342 +#: ../../c-api/long.rst:530 msgid "" "This function makes it possible for performance-critical code to implement a " "“fast path” for small integers. For compact values use :c:func:" "`PyUnstable_Long_CompactValue`; for others fall back to a :c:func:" -"`PyLong_As* ` function or :c:func:`calling " -"` :meth:`int.to_bytes`." +"`PyLong_As* ` function or :c:func:`PyLong_AsNativeBytes`." msgstr "" -#: ../../c-api/long.rst:348 +#: ../../c-api/long.rst:536 msgid "The speedup is expected to be negligible for most users." msgstr "" -#: ../../c-api/long.rst:350 +#: ../../c-api/long.rst:538 msgid "" "Exactly what values are considered compact is an implementation detail and " "is subject to change." msgstr "" -#: ../../c-api/long.rst:355 +#: ../../c-api/long.rst:543 msgid "" "If *op* is compact, as determined by :c:func:`PyUnstable_Long_IsCompact`, " "return its value." msgstr "" -#: ../../c-api/long.rst:358 +#: ../../c-api/long.rst:546 msgid "Otherwise, the return value is undefined." msgstr "" @@ -390,23 +646,23 @@ msgstr "long integer(長整数)" msgid "integer" msgstr "integer(整数)" -#: ../../c-api/long.rst:119 +#: ../../c-api/long.rst:144 msgid "LONG_MAX (C macro)" msgstr "LONG_MAX(C 巨集)" -#: ../../c-api/long.rst:119 ../../c-api/long.rst:161 ../../c-api/long.rst:204 -#: ../../c-api/long.rst:219 ../../c-api/long.rst:235 ../../c-api/long.rst:251 +#: ../../c-api/long.rst:144 ../../c-api/long.rst:204 ../../c-api/long.rst:247 +#: ../../c-api/long.rst:262 ../../c-api/long.rst:278 ../../c-api/long.rst:294 msgid "OverflowError (built-in exception)" msgstr "OverflowError(内建例外)" -#: ../../c-api/long.rst:204 +#: ../../c-api/long.rst:247 msgid "PY_SSIZE_T_MAX (C macro)" msgstr "PY_SSIZE_T_MAX(C 巨集)" -#: ../../c-api/long.rst:219 +#: ../../c-api/long.rst:262 msgid "ULONG_MAX (C macro)" msgstr "ULONG_MAX(C 巨集)" -#: ../../c-api/long.rst:235 +#: ../../c-api/long.rst:278 msgid "SIZE_MAX (C macro)" msgstr "SIZE_MAX(C 巨集)" diff --git a/c-api/mapping.po b/c-api/mapping.po index aa99402ad8..49e8987a80 100644 --- a/c-api/mapping.po +++ b/c-api/mapping.po @@ -5,9 +5,9 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-03 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-05-11 14:32+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -61,6 +61,31 @@ msgstr "" #: ../../c-api/mapping.rst:38 msgid "" +"Variant of :c:func:`PyObject_GetItem` which doesn't raise :exc:`KeyError` if " +"the key is not found." +msgstr "" + +#: ../../c-api/mapping.rst:41 +msgid "" +"If the key is found, return ``1`` and set *\\*result* to a new :term:`strong " +"reference` to the corresponding value. If the key is not found, return ``0`` " +"and set *\\*result* to ``NULL``; the :exc:`KeyError` is silenced. If an " +"error other than :exc:`KeyError` is raised, return ``-1`` and set " +"*\\*result* to ``NULL``." +msgstr "" + +#: ../../c-api/mapping.rst:53 +#, fuzzy +msgid "" +"This is the same as :c:func:`PyMapping_GetOptionalItem`, but *key* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." +msgstr "" +"這與 :c:func:`PyMapping_HasKey` 相同,但 *key* 被指定為 :c:expr:`const " +"char*` UTF-8 編碼位元組字串,而不是 :c:expr:`PyObject*`。" + +#: ../../c-api/mapping.rst:62 +msgid "" "This is the same as :c:func:`PyObject_SetItem`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." @@ -68,11 +93,11 @@ msgstr "" "這與 :c:func:`PyObject_SetItem` 相同,但 *key* 被指定為 :c:expr:`const " "char*` UTF-8 編碼位元組字串,而不是 :c:expr:`PyObject*`。" -#: ../../c-api/mapping.rst:45 +#: ../../c-api/mapping.rst:69 msgid "This is an alias of :c:func:`PyObject_DelItem`." msgstr "這是 :c:func:`PyObject_DelItem` 的別名。" -#: ../../c-api/mapping.rst:50 +#: ../../c-api/mapping.rst:74 msgid "" "This is the same as :c:func:`PyObject_DelItem`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" @@ -81,7 +106,27 @@ msgstr "" "這與 :c:func:`PyObject_DelItem` 相同,但 *key* 被指定為 :c:expr:`const " "char*` UTF-8 編碼位元組字串,而不是 :c:expr:`PyObject*`。" -#: ../../c-api/mapping.rst:57 +#: ../../c-api/mapping.rst:81 +#, fuzzy +msgid "" +"Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. " +"This is equivalent to the Python expression ``key in o``. On failure, return " +"``-1``." +msgstr "" +"如果對映物件具有鍵 *key* 則回傳 ``1``,否則回傳 ``0``。這相當於 Python 運算" +"式 ``key in o``。這個函式總會是成功的。" + +#: ../../c-api/mapping.rst:90 +#, fuzzy +msgid "" +"This is the same as :c:func:`PyMapping_HasKeyWithError`, but *key* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." +msgstr "" +"這與 :c:func:`PyMapping_HasKey` 相同,但 *key* 被指定為 :c:expr:`const " +"char*` UTF-8 編碼位元組字串,而不是 :c:expr:`PyObject*`。" + +#: ../../c-api/mapping.rst:99 msgid "" "Return ``1`` if the mapping object has the key *key* and ``0`` otherwise. " "This is equivalent to the Python expression ``key in o``. This function " @@ -90,16 +135,18 @@ msgstr "" "如果對映物件具有鍵 *key* 則回傳 ``1``,否則回傳 ``0``。這相當於 Python 運算" "式 ``key in o``。這個函式總會是成功的。" -#: ../../c-api/mapping.rst:63 +#: ../../c-api/mapping.rst:105 +#, fuzzy msgid "" "Exceptions which occur when this calls :meth:`~object.__getitem__` method " "are silently ignored. For proper error handling, use :c:func:" +"`PyMapping_HasKeyWithError`, :c:func:`PyMapping_GetOptionalItem` or :c:func:" "`PyObject_GetItem()` instead." msgstr "" "當它呼叫 :meth:`~object.__getitem__` 方法時發生的例外將被默默忽略。為了適當地" "處理錯誤,請改用 :c:func:`PyObject_GetItem()`。" -#: ../../c-api/mapping.rst:70 +#: ../../c-api/mapping.rst:113 msgid "" "This is the same as :c:func:`PyMapping_HasKey`, but *key* is specified as a :" "c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" @@ -108,34 +155,37 @@ msgstr "" "這與 :c:func:`PyMapping_HasKey` 相同,但 *key* 被指定為 :c:expr:`const " "char*` UTF-8 編碼位元組字串,而不是 :c:expr:`PyObject*`。" -#: ../../c-api/mapping.rst:76 +#: ../../c-api/mapping.rst:119 +#, fuzzy msgid "" "Exceptions that occur when this calls :meth:`~object.__getitem__` method or " "while creating the temporary :class:`str` object are silently ignored. For " -"proper error handling, use :c:func:`PyMapping_GetItemString` instead." +"proper error handling, use :c:func:`PyMapping_HasKeyStringWithError`, :c:" +"func:`PyMapping_GetOptionalItemString` or :c:func:`PyMapping_GetItemString` " +"instead." msgstr "" "當它呼叫 :meth:`~object.__getitem__` 方法或建立臨時 :class:`str` 物件時發生的" "例外將被默默忽略。為了適當地處理錯誤,請改用 :c:func:" "`PyMapping_GetItemString`。" -#: ../../c-api/mapping.rst:84 +#: ../../c-api/mapping.rst:129 msgid "" "On success, return a list of the keys in object *o*. On failure, return " "``NULL``." msgstr "成功時回傳一個物件 *o* 內之鍵的串列,失敗時回傳 ``NULL``。" -#: ../../c-api/mapping.rst:87 ../../c-api/mapping.rst:96 -#: ../../c-api/mapping.rst:105 +#: ../../c-api/mapping.rst:132 ../../c-api/mapping.rst:141 +#: ../../c-api/mapping.rst:150 msgid "Previously, the function returned a list or a tuple." msgstr "在以前,該函式會回傳串列或元組。" -#: ../../c-api/mapping.rst:93 +#: ../../c-api/mapping.rst:138 msgid "" "On success, return a list of the values in object *o*. On failure, return " "``NULL``." msgstr "成功時回傳物件 *o* 中值的串列。失敗時回傳 ``NULL``。" -#: ../../c-api/mapping.rst:102 +#: ../../c-api/mapping.rst:147 msgid "" "On success, return a list of the items in object *o*, where each item is a " "tuple containing a key-value pair. On failure, return ``NULL``." diff --git a/c-api/marshal.po b/c-api/marshal.po index 536fc0744c..3e1eb7377f 100644 --- a/c-api/marshal.po +++ b/c-api/marshal.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" diff --git a/c-api/memory.po b/c-api/memory.po index 27c22cf58f..e3b9669a9d 100644 --- a/c-api/memory.po +++ b/c-api/memory.po @@ -6,9 +6,9 @@ # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 14:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -135,59 +135,70 @@ msgid "" "details on how every domain allocates memory or what internal functions each " "domain calls is considered an implementation detail, but for debugging " "purposes a simplified table can be found at :ref:`here `. There is no hard requirement to use the memory returned by the " -"allocation functions belonging to a given domain for only the purposes " -"hinted by that domain (although this is the recommended practice). For " -"example, one could use the memory returned by :c:func:`PyMem_RawMalloc` for " -"allocating Python objects or the memory returned by :c:func:" -"`PyObject_Malloc` for allocating memory for buffers." +"allocators>`. The APIs used to allocate and free a block of memory must be " +"from the same domain. For example, :c:func:`PyMem_Free` must be used to free " +"memory allocated using :c:func:`PyMem_Malloc`." msgstr "" -#: ../../c-api/memory.rst:112 +#: ../../c-api/memory.rst:109 msgid "The three allocation domains are:" msgstr "" -#: ../../c-api/memory.rst:114 +#: ../../c-api/memory.rst:111 msgid "" "Raw domain: intended for allocating memory for general-purpose memory " "buffers where the allocation *must* go to the system allocator or where the " "allocator can operate without the :term:`GIL`. The memory is requested " -"directly to the system." +"directly from the system. See :ref:`Raw Memory Interface `." msgstr "" -#: ../../c-api/memory.rst:119 +#: ../../c-api/memory.rst:116 msgid "" "\"Mem\" domain: intended for allocating memory for Python buffers and " "general-purpose memory buffers where the allocation must be performed with " -"the :term:`GIL` held. The memory is taken from the Python private heap." +"the :term:`GIL` held. The memory is taken from the Python private heap. See :" +"ref:`Memory Interface `." msgstr "" -#: ../../c-api/memory.rst:123 +#: ../../c-api/memory.rst:121 msgid "" -"Object domain: intended for allocating memory belonging to Python objects. " -"The memory is taken from the Python private heap." +"Object domain: intended for allocating memory for Python objects. The memory " +"is taken from the Python private heap. See :ref:`Object allocators " +"`." msgstr "" #: ../../c-api/memory.rst:126 msgid "" -"When freeing memory previously allocated by the allocating functions " -"belonging to a given domain,the matching specific deallocating functions " -"must be used. For example, :c:func:`PyMem_Free` must be used to free memory " -"allocated using :c:func:`PyMem_Malloc`." +"The :term:`free-threaded ` build requires that only Python " +"objects are allocated using the \"object\" domain and that all Python " +"objects are allocated using that domain. This differs from the prior Python " +"versions, where this was only a best practice and not a hard requirement." msgstr "" -#: ../../c-api/memory.rst:131 -msgid "Raw Memory Interface" +#: ../../c-api/memory.rst:130 +msgid "" +"For example, buffers (non-Python objects) should be allocated using :c:func:" +"`PyMem_Malloc`, :c:func:`PyMem_RawMalloc`, or :c:func:`malloc`, but not :c:" +"func:`PyObject_Malloc`." msgstr "" #: ../../c-api/memory.rst:133 +msgid "See :ref:`Memory Allocation APIs `." +msgstr "" + +#: ../../c-api/memory.rst:139 +msgid "Raw Memory Interface" +msgstr "" + +#: ../../c-api/memory.rst:141 msgid "" "The following function sets are wrappers to the system allocator. These " "functions are thread-safe, the :term:`GIL ` does " "not need to be held." msgstr "" -#: ../../c-api/memory.rst:137 +#: ../../c-api/memory.rst:145 msgid "" "The :ref:`default raw memory allocator ` uses the " "following functions: :c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` " @@ -195,63 +206,63 @@ msgid "" "requesting zero bytes." msgstr "" -#: ../../c-api/memory.rst:146 ../../c-api/memory.rst:217 -#: ../../c-api/memory.rst:325 +#: ../../c-api/memory.rst:154 ../../c-api/memory.rst:225 +#: ../../c-api/memory.rst:335 msgid "" "Allocates *n* bytes and returns a pointer of type :c:expr:`void*` to the " "allocated memory, or ``NULL`` if the request fails." msgstr "" -#: ../../c-api/memory.rst:149 +#: ../../c-api/memory.rst:157 msgid "" "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, " "as if ``PyMem_RawMalloc(1)`` had been called instead. The memory will not " "have been initialized in any way." msgstr "" -#: ../../c-api/memory.rst:156 ../../c-api/memory.rst:227 -#: ../../c-api/memory.rst:335 +#: ../../c-api/memory.rst:164 ../../c-api/memory.rst:235 +#: ../../c-api/memory.rst:345 msgid "" "Allocates *nelem* elements each whose size in bytes is *elsize* and returns " "a pointer of type :c:expr:`void*` to the allocated memory, or ``NULL`` if " "the request fails. The memory is initialized to zeros." msgstr "" -#: ../../c-api/memory.rst:160 +#: ../../c-api/memory.rst:168 msgid "" "Requesting zero elements or elements of size zero bytes returns a distinct " "non-``NULL`` pointer if possible, as if ``PyMem_RawCalloc(1, 1)`` had been " "called instead." msgstr "" -#: ../../c-api/memory.rst:169 ../../c-api/memory.rst:240 -#: ../../c-api/memory.rst:348 +#: ../../c-api/memory.rst:177 ../../c-api/memory.rst:248 +#: ../../c-api/memory.rst:358 msgid "" "Resizes the memory block pointed to by *p* to *n* bytes. The contents will " "be unchanged to the minimum of the old and the new sizes." msgstr "" -#: ../../c-api/memory.rst:172 +#: ../../c-api/memory.rst:180 msgid "" "If *p* is ``NULL``, the call is equivalent to ``PyMem_RawMalloc(n)``; else " "if *n* is equal to zero, the memory block is resized but is not freed, and " "the returned pointer is non-``NULL``." msgstr "" -#: ../../c-api/memory.rst:176 +#: ../../c-api/memory.rst:184 msgid "" "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" "func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or :c:func:" "`PyMem_RawCalloc`." msgstr "" -#: ../../c-api/memory.rst:180 +#: ../../c-api/memory.rst:188 msgid "" "If the request fails, :c:func:`PyMem_RawRealloc` returns ``NULL`` and *p* " "remains a valid pointer to the previous memory area." msgstr "" -#: ../../c-api/memory.rst:186 +#: ../../c-api/memory.rst:194 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " "previous call to :c:func:`PyMem_RawMalloc`, :c:func:`PyMem_RawRealloc` or :c:" @@ -259,73 +270,73 @@ msgid "" "called before, undefined behavior occurs." msgstr "" -#: ../../c-api/memory.rst:191 ../../c-api/memory.rst:261 -#: ../../c-api/memory.rst:369 +#: ../../c-api/memory.rst:199 ../../c-api/memory.rst:269 +#: ../../c-api/memory.rst:379 msgid "If *p* is ``NULL``, no operation is performed." msgstr "" -#: ../../c-api/memory.rst:197 +#: ../../c-api/memory.rst:205 msgid "Memory Interface" msgstr "記憶體介面" -#: ../../c-api/memory.rst:199 ../../c-api/memory.rst:305 +#: ../../c-api/memory.rst:207 ../../c-api/memory.rst:315 msgid "" "The following function sets, modeled after the ANSI C standard, but " "specifying behavior when requesting zero bytes, are available for allocating " "and releasing memory from the Python heap." msgstr "" -#: ../../c-api/memory.rst:203 +#: ../../c-api/memory.rst:211 msgid "" "The :ref:`default memory allocator ` uses the :" "ref:`pymalloc memory allocator `." msgstr "" -#: ../../c-api/memory.rst:208 ../../c-api/memory.rst:320 +#: ../../c-api/memory.rst:216 ../../c-api/memory.rst:330 msgid "" "The :term:`GIL ` must be held when using these " "functions." msgstr "" -#: ../../c-api/memory.rst:213 +#: ../../c-api/memory.rst:221 msgid "" "The default allocator is now pymalloc instead of system :c:func:`malloc`." msgstr "" -#: ../../c-api/memory.rst:220 +#: ../../c-api/memory.rst:228 msgid "" "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, " "as if ``PyMem_Malloc(1)`` had been called instead. The memory will not have " "been initialized in any way." msgstr "" -#: ../../c-api/memory.rst:231 +#: ../../c-api/memory.rst:239 msgid "" "Requesting zero elements or elements of size zero bytes returns a distinct " "non-``NULL`` pointer if possible, as if ``PyMem_Calloc(1, 1)`` had been " "called instead." msgstr "" -#: ../../c-api/memory.rst:243 +#: ../../c-api/memory.rst:251 msgid "" "If *p* is ``NULL``, the call is equivalent to ``PyMem_Malloc(n)``; else if " "*n* is equal to zero, the memory block is resized but is not freed, and the " "returned pointer is non-``NULL``." msgstr "" -#: ../../c-api/memory.rst:247 +#: ../../c-api/memory.rst:255 msgid "" "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" "func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:`PyMem_Calloc`." msgstr "" -#: ../../c-api/memory.rst:250 +#: ../../c-api/memory.rst:258 msgid "" "If the request fails, :c:func:`PyMem_Realloc` returns ``NULL`` and *p* " "remains a valid pointer to the previous memory area." msgstr "" -#: ../../c-api/memory.rst:256 +#: ../../c-api/memory.rst:264 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " "previous call to :c:func:`PyMem_Malloc`, :c:func:`PyMem_Realloc` or :c:func:" @@ -333,20 +344,20 @@ msgid "" "undefined behavior occurs." msgstr "" -#: ../../c-api/memory.rst:263 +#: ../../c-api/memory.rst:271 msgid "" "The following type-oriented macros are provided for convenience. Note that " "*TYPE* refers to any C type." msgstr "" -#: ../../c-api/memory.rst:269 +#: ../../c-api/memory.rst:277 msgid "" "Same as :c:func:`PyMem_Malloc`, but allocates ``(n * sizeof(TYPE))`` bytes " "of memory. Returns a pointer cast to ``TYPE*``. The memory will not have " "been initialized in any way." msgstr "" -#: ../../c-api/memory.rst:276 +#: ../../c-api/memory.rst:284 msgid "" "Same as :c:func:`PyMem_Realloc`, but the memory block is resized to ``(n * " "sizeof(TYPE))`` bytes. Returns a pointer cast to ``TYPE*``. On return, *p* " @@ -354,17 +365,17 @@ msgid "" "failure." msgstr "" -#: ../../c-api/memory.rst:281 +#: ../../c-api/memory.rst:289 msgid "" "This is a C preprocessor macro; *p* is always reassigned. Save the original " "value of *p* to avoid losing memory when handling errors." msgstr "" -#: ../../c-api/memory.rst:287 +#: ../../c-api/memory.rst:295 msgid "Same as :c:func:`PyMem_Free`." msgstr "和 :c:func:`PyMem_Free` 相同。" -#: ../../c-api/memory.rst:289 +#: ../../c-api/memory.rst:297 msgid "" "In addition, the following macro sets are provided for calling the Python " "memory allocator directly, without involving the C API functions listed " @@ -372,35 +383,35 @@ msgid "" "across Python versions and is therefore deprecated in extension modules." msgstr "" -#: ../../c-api/memory.rst:294 +#: ../../c-api/memory.rst:302 msgid "``PyMem_MALLOC(size)``" msgstr "``PyMem_MALLOC(size)``" -#: ../../c-api/memory.rst:295 +#: ../../c-api/memory.rst:303 msgid "``PyMem_NEW(type, size)``" msgstr "``PyMem_NEW(type, size)``" -#: ../../c-api/memory.rst:296 +#: ../../c-api/memory.rst:304 msgid "``PyMem_REALLOC(ptr, size)``" msgstr "``PyMem_REALLOC(ptr, size)``" -#: ../../c-api/memory.rst:297 +#: ../../c-api/memory.rst:305 msgid "``PyMem_RESIZE(ptr, type, size)``" msgstr "``PyMem_RESIZE(ptr, type, size)``" -#: ../../c-api/memory.rst:298 +#: ../../c-api/memory.rst:306 msgid "``PyMem_FREE(ptr)``" msgstr "``PyMem_FREE(ptr)``" -#: ../../c-api/memory.rst:299 +#: ../../c-api/memory.rst:307 msgid "``PyMem_DEL(ptr)``" msgstr "``PyMem_DEL(ptr)``" -#: ../../c-api/memory.rst:303 +#: ../../c-api/memory.rst:313 msgid "Object allocators" msgstr "" -#: ../../c-api/memory.rst:310 +#: ../../c-api/memory.rst:320 msgid "" "There is no guarantee that the memory returned by these allocators can be " "successfully cast to a Python object when intercepting the allocating " @@ -408,47 +419,47 @@ msgid "" "Memory Allocators ` section." msgstr "" -#: ../../c-api/memory.rst:315 +#: ../../c-api/memory.rst:325 msgid "" "The :ref:`default object allocator ` uses the :" "ref:`pymalloc memory allocator `." msgstr "" -#: ../../c-api/memory.rst:328 +#: ../../c-api/memory.rst:338 msgid "" "Requesting zero bytes returns a distinct non-``NULL`` pointer if possible, " "as if ``PyObject_Malloc(1)`` had been called instead. The memory will not " "have been initialized in any way." msgstr "" -#: ../../c-api/memory.rst:339 +#: ../../c-api/memory.rst:349 msgid "" "Requesting zero elements or elements of size zero bytes returns a distinct " "non-``NULL`` pointer if possible, as if ``PyObject_Calloc(1, 1)`` had been " "called instead." msgstr "" -#: ../../c-api/memory.rst:351 +#: ../../c-api/memory.rst:361 msgid "" "If *p* is ``NULL``, the call is equivalent to ``PyObject_Malloc(n)``; else " "if *n* is equal to zero, the memory block is resized but is not freed, and " "the returned pointer is non-``NULL``." msgstr "" -#: ../../c-api/memory.rst:355 +#: ../../c-api/memory.rst:365 msgid "" "Unless *p* is ``NULL``, it must have been returned by a previous call to :c:" "func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` or :c:func:" "`PyObject_Calloc`." msgstr "" -#: ../../c-api/memory.rst:358 +#: ../../c-api/memory.rst:368 msgid "" "If the request fails, :c:func:`PyObject_Realloc` returns ``NULL`` and *p* " "remains a valid pointer to the previous memory area." msgstr "" -#: ../../c-api/memory.rst:364 +#: ../../c-api/memory.rst:374 msgid "" "Frees the memory block pointed to by *p*, which must have been returned by a " "previous call to :c:func:`PyObject_Malloc`, :c:func:`PyObject_Realloc` or :c:" @@ -456,277 +467,283 @@ msgid "" "called before, undefined behavior occurs." msgstr "" -#: ../../c-api/memory.rst:375 +#: ../../c-api/memory.rst:385 msgid "Default Memory Allocators" msgstr "" -#: ../../c-api/memory.rst:377 +#: ../../c-api/memory.rst:387 msgid "Default memory allocators:" msgstr "" -#: ../../c-api/memory.rst:380 +#: ../../c-api/memory.rst:390 msgid "Configuration" msgstr "配置" -#: ../../c-api/memory.rst:380 +#: ../../c-api/memory.rst:390 msgid "Name" msgstr "名稱" -#: ../../c-api/memory.rst:380 +#: ../../c-api/memory.rst:390 msgid "PyMem_RawMalloc" msgstr "PyMem_RawMalloc" -#: ../../c-api/memory.rst:380 +#: ../../c-api/memory.rst:390 msgid "PyMem_Malloc" msgstr "PyMem_Malloc" -#: ../../c-api/memory.rst:380 +#: ../../c-api/memory.rst:390 msgid "PyObject_Malloc" msgstr "PyObject_Malloc" -#: ../../c-api/memory.rst:382 +#: ../../c-api/memory.rst:392 msgid "Release build" msgstr "" -#: ../../c-api/memory.rst:382 +#: ../../c-api/memory.rst:392 msgid "``\"pymalloc\"``" msgstr "``\"pymalloc\"``" -#: ../../c-api/memory.rst:382 ../../c-api/memory.rst:384 +#: ../../c-api/memory.rst:392 ../../c-api/memory.rst:394 msgid "``malloc``" msgstr "``malloc``" -#: ../../c-api/memory.rst:382 +#: ../../c-api/memory.rst:392 msgid "``pymalloc``" msgstr "``pymalloc``" -#: ../../c-api/memory.rst:383 +#: ../../c-api/memory.rst:393 msgid "Debug build" msgstr "" -#: ../../c-api/memory.rst:383 +#: ../../c-api/memory.rst:393 msgid "``\"pymalloc_debug\"``" msgstr "``\"pymalloc_debug\"``" -#: ../../c-api/memory.rst:383 ../../c-api/memory.rst:385 +#: ../../c-api/memory.rst:393 ../../c-api/memory.rst:395 msgid "``malloc`` + debug" msgstr "" -#: ../../c-api/memory.rst:383 +#: ../../c-api/memory.rst:393 msgid "``pymalloc`` + debug" msgstr "" -#: ../../c-api/memory.rst:384 +#: ../../c-api/memory.rst:394 msgid "Release build, without pymalloc" msgstr "" -#: ../../c-api/memory.rst:384 +#: ../../c-api/memory.rst:394 msgid "``\"malloc\"``" msgstr "``\"malloc\"``" -#: ../../c-api/memory.rst:385 +#: ../../c-api/memory.rst:395 msgid "Debug build, without pymalloc" msgstr "" -#: ../../c-api/memory.rst:385 +#: ../../c-api/memory.rst:395 msgid "``\"malloc_debug\"``" msgstr "``\"malloc_debug\"``" -#: ../../c-api/memory.rst:388 +#: ../../c-api/memory.rst:398 msgid "Legend:" msgstr "" -#: ../../c-api/memory.rst:390 +#: ../../c-api/memory.rst:400 msgid "Name: value for :envvar:`PYTHONMALLOC` environment variable." msgstr "" -#: ../../c-api/memory.rst:391 +#: ../../c-api/memory.rst:401 msgid "" "``malloc``: system allocators from the standard C library, C functions: :c:" "func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`." msgstr "" -#: ../../c-api/memory.rst:393 +#: ../../c-api/memory.rst:403 msgid "``pymalloc``: :ref:`pymalloc memory allocator `." msgstr "" -#: ../../c-api/memory.rst:394 +#: ../../c-api/memory.rst:404 +msgid "" +"``mimalloc``: :ref:`mimalloc memory allocator `. The pymalloc " +"allocator will be used if mimalloc support isn't available." +msgstr "" + +#: ../../c-api/memory.rst:406 msgid "" "\"+ debug\": with :ref:`debug hooks on the Python memory allocators `." msgstr "" -#: ../../c-api/memory.rst:396 +#: ../../c-api/memory.rst:408 msgid "\"Debug build\": :ref:`Python build in debug mode `." msgstr "" -#: ../../c-api/memory.rst:401 +#: ../../c-api/memory.rst:413 msgid "Customize Memory Allocators" msgstr "" -#: ../../c-api/memory.rst:407 +#: ../../c-api/memory.rst:419 msgid "" "Structure used to describe a memory block allocator. The structure has the " "following fields:" msgstr "" -#: ../../c-api/memory.rst:411 ../../c-api/memory.rst:658 +#: ../../c-api/memory.rst:423 ../../c-api/memory.rst:670 msgid "Field" msgstr "欄位" -#: ../../c-api/memory.rst:411 ../../c-api/memory.rst:658 +#: ../../c-api/memory.rst:423 ../../c-api/memory.rst:670 msgid "Meaning" msgstr "意義" -#: ../../c-api/memory.rst:413 ../../c-api/memory.rst:660 +#: ../../c-api/memory.rst:425 ../../c-api/memory.rst:672 msgid "``void *ctx``" msgstr "``void *ctx``" -#: ../../c-api/memory.rst:413 ../../c-api/memory.rst:660 +#: ../../c-api/memory.rst:425 ../../c-api/memory.rst:672 msgid "user context passed as first argument" msgstr "" -#: ../../c-api/memory.rst:415 +#: ../../c-api/memory.rst:427 msgid "``void* malloc(void *ctx, size_t size)``" msgstr "``void* malloc(void *ctx, size_t size)``" -#: ../../c-api/memory.rst:415 +#: ../../c-api/memory.rst:427 msgid "allocate a memory block" msgstr "" -#: ../../c-api/memory.rst:417 +#: ../../c-api/memory.rst:429 msgid "``void* calloc(void *ctx, size_t nelem, size_t elsize)``" msgstr "``void* calloc(void *ctx, size_t nelem, size_t elsize)``" -#: ../../c-api/memory.rst:417 +#: ../../c-api/memory.rst:429 msgid "allocate a memory block initialized with zeros" msgstr "" -#: ../../c-api/memory.rst:420 +#: ../../c-api/memory.rst:432 msgid "``void* realloc(void *ctx, void *ptr, size_t new_size)``" msgstr "``void* realloc(void *ctx, void *ptr, size_t new_size)``" -#: ../../c-api/memory.rst:420 +#: ../../c-api/memory.rst:432 msgid "allocate or resize a memory block" msgstr "" -#: ../../c-api/memory.rst:422 +#: ../../c-api/memory.rst:434 msgid "``void free(void *ctx, void *ptr)``" msgstr "``void free(void *ctx, void *ptr)``" -#: ../../c-api/memory.rst:422 +#: ../../c-api/memory.rst:434 msgid "free a memory block" msgstr "" -#: ../../c-api/memory.rst:425 +#: ../../c-api/memory.rst:437 msgid "" "The :c:type:`!PyMemAllocator` structure was renamed to :c:type:" "`PyMemAllocatorEx` and a new ``calloc`` field was added." msgstr "" -#: ../../c-api/memory.rst:432 +#: ../../c-api/memory.rst:444 msgid "Enum used to identify an allocator domain. Domains:" msgstr "" -#: ../../c-api/memory.rst:438 ../../c-api/memory.rst:447 -#: ../../c-api/memory.rst:456 +#: ../../c-api/memory.rst:450 ../../c-api/memory.rst:459 +#: ../../c-api/memory.rst:468 msgid "Functions:" msgstr "函式:" -#: ../../c-api/memory.rst:440 +#: ../../c-api/memory.rst:452 msgid ":c:func:`PyMem_RawMalloc`" msgstr ":c:func:`PyMem_RawMalloc`" -#: ../../c-api/memory.rst:441 +#: ../../c-api/memory.rst:453 msgid ":c:func:`PyMem_RawRealloc`" msgstr ":c:func:`PyMem_RawRealloc`" -#: ../../c-api/memory.rst:442 +#: ../../c-api/memory.rst:454 msgid ":c:func:`PyMem_RawCalloc`" msgstr ":c:func:`PyMem_RawCalloc`" -#: ../../c-api/memory.rst:443 +#: ../../c-api/memory.rst:455 msgid ":c:func:`PyMem_RawFree`" msgstr ":c:func:`PyMem_RawFree`" -#: ../../c-api/memory.rst:449 +#: ../../c-api/memory.rst:461 msgid ":c:func:`PyMem_Malloc`," msgstr ":c:func:`PyMem_Malloc`," -#: ../../c-api/memory.rst:450 +#: ../../c-api/memory.rst:462 msgid ":c:func:`PyMem_Realloc`" msgstr ":c:func:`PyMem_Realloc`" -#: ../../c-api/memory.rst:451 +#: ../../c-api/memory.rst:463 msgid ":c:func:`PyMem_Calloc`" msgstr ":c:func:`PyMem_Calloc`" -#: ../../c-api/memory.rst:452 +#: ../../c-api/memory.rst:464 msgid ":c:func:`PyMem_Free`" msgstr ":c:func:`PyMem_Free`" -#: ../../c-api/memory.rst:458 +#: ../../c-api/memory.rst:470 msgid ":c:func:`PyObject_Malloc`" msgstr ":c:func:`PyObject_Malloc`" -#: ../../c-api/memory.rst:459 +#: ../../c-api/memory.rst:471 msgid ":c:func:`PyObject_Realloc`" msgstr ":c:func:`PyObject_Realloc`" -#: ../../c-api/memory.rst:460 +#: ../../c-api/memory.rst:472 msgid ":c:func:`PyObject_Calloc`" msgstr ":c:func:`PyObject_Calloc`" -#: ../../c-api/memory.rst:461 +#: ../../c-api/memory.rst:473 msgid ":c:func:`PyObject_Free`" msgstr ":c:func:`PyObject_Free`" -#: ../../c-api/memory.rst:465 +#: ../../c-api/memory.rst:477 msgid "Get the memory block allocator of the specified domain." msgstr "" -#: ../../c-api/memory.rst:470 +#: ../../c-api/memory.rst:482 msgid "Set the memory block allocator of the specified domain." msgstr "" -#: ../../c-api/memory.rst:472 +#: ../../c-api/memory.rst:484 msgid "" "The new allocator must return a distinct non-``NULL`` pointer when " "requesting zero bytes." msgstr "" -#: ../../c-api/memory.rst:475 +#: ../../c-api/memory.rst:487 msgid "" "For the :c:macro:`PYMEM_DOMAIN_RAW` domain, the allocator must be thread-" "safe: the :term:`GIL ` is not held when the " "allocator is called." msgstr "" -#: ../../c-api/memory.rst:479 +#: ../../c-api/memory.rst:491 msgid "" "For the remaining domains, the allocator must also be thread-safe: the " "allocator may be called in different interpreters that do not share a " "``GIL``." msgstr "" -#: ../../c-api/memory.rst:483 +#: ../../c-api/memory.rst:495 msgid "" "If the new allocator is not a hook (does not call the previous allocator), " "the :c:func:`PyMem_SetupDebugHooks` function must be called to reinstall the " "debug hooks on top on the new allocator." msgstr "" -#: ../../c-api/memory.rst:487 +#: ../../c-api/memory.rst:499 msgid "" "See also :c:member:`PyPreConfig.allocator` and :ref:`Preinitialize Python " "with PyPreConfig `." msgstr "" -#: ../../c-api/memory.rst:492 +#: ../../c-api/memory.rst:504 msgid ":c:func:`PyMem_SetAllocator` does have the following contract:" msgstr "" -#: ../../c-api/memory.rst:494 +#: ../../c-api/memory.rst:506 msgid "" "It can be called after :c:func:`Py_PreInitialize` and before :c:func:" "`Py_InitializeFromConfig` to install a custom memory allocator. There are no " @@ -736,7 +753,7 @@ msgid "" "domains>` for more information." msgstr "" -#: ../../c-api/memory.rst:502 +#: ../../c-api/memory.rst:514 msgid "" "If called after Python has finish initializing (after :c:func:" "`Py_InitializeFromConfig` has been called) the allocator **must** wrap the " @@ -744,21 +761,21 @@ msgid "" "arbitrary one is **not supported**." msgstr "" -#: ../../c-api/memory.rst:507 +#: ../../c-api/memory.rst:519 msgid "All allocators must be thread-safe." msgstr "" -#: ../../c-api/memory.rst:513 +#: ../../c-api/memory.rst:525 msgid "" "Setup :ref:`debug hooks in the Python memory allocators ` " "to detect memory errors." msgstr "" -#: ../../c-api/memory.rst:520 +#: ../../c-api/memory.rst:532 msgid "Debug hooks on the Python memory allocators" msgstr "" -#: ../../c-api/memory.rst:522 +#: ../../c-api/memory.rst:534 msgid "" "When :ref:`Python is built in debug mode `, the :c:func:" "`PyMem_SetupDebugHooks` function is called at the :ref:`Python " @@ -766,19 +783,19 @@ msgid "" "allocators to detect memory errors." msgstr "" -#: ../../c-api/memory.rst:527 +#: ../../c-api/memory.rst:539 msgid "" "The :envvar:`PYTHONMALLOC` environment variable can be used to install debug " "hooks on a Python compiled in release mode (ex: ``PYTHONMALLOC=debug``)." msgstr "" -#: ../../c-api/memory.rst:530 +#: ../../c-api/memory.rst:542 msgid "" "The :c:func:`PyMem_SetupDebugHooks` function can be used to set debug hooks " "after calling :c:func:`PyMem_SetAllocator`." msgstr "" -#: ../../c-api/memory.rst:533 +#: ../../c-api/memory.rst:545 msgid "" "These debug hooks fill dynamically allocated memory blocks with special, " "recognizable bit patterns. Newly allocated memory is filled with the byte " @@ -788,25 +805,25 @@ msgid "" "these bytes are unlikely to be valid addresses, floats, or ASCII strings." msgstr "" -#: ../../c-api/memory.rst:540 +#: ../../c-api/memory.rst:552 msgid "Runtime checks:" msgstr "Runtime 檢查:" -#: ../../c-api/memory.rst:542 +#: ../../c-api/memory.rst:554 msgid "" "Detect API violations. For example, detect if :c:func:`PyObject_Free` is " "called on a memory block allocated by :c:func:`PyMem_Malloc`." msgstr "" -#: ../../c-api/memory.rst:544 +#: ../../c-api/memory.rst:556 msgid "Detect write before the start of the buffer (buffer underflow)." msgstr "" -#: ../../c-api/memory.rst:545 +#: ../../c-api/memory.rst:557 msgid "Detect write after the end of the buffer (buffer overflow)." msgstr "" -#: ../../c-api/memory.rst:546 +#: ../../c-api/memory.rst:558 msgid "" "Check that the :term:`GIL ` is held when allocator " "functions of :c:macro:`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) " @@ -814,7 +831,7 @@ msgid "" "called." msgstr "" -#: ../../c-api/memory.rst:551 +#: ../../c-api/memory.rst:563 msgid "" "On error, the debug hooks use the :mod:`tracemalloc` module to get the " "traceback where a memory block was allocated. The traceback is only " @@ -822,7 +839,7 @@ msgid "" "memory block was traced." msgstr "" -#: ../../c-api/memory.rst:556 +#: ../../c-api/memory.rst:568 msgid "" "Let *S* = ``sizeof(size_t)``. ``2*S`` bytes are added at each end of each " "block of *N* bytes requested. The memory layout is like so, where p " @@ -832,49 +849,49 @@ msgid "" "from a Python slice):" msgstr "" -#: ../../c-api/memory.rst:562 +#: ../../c-api/memory.rst:574 msgid "``p[-2*S:-S]``" msgstr "``p[-2*S:-S]``" -#: ../../c-api/memory.rst:563 +#: ../../c-api/memory.rst:575 msgid "" "Number of bytes originally asked for. This is a size_t, big-endian (easier " "to read in a memory dump)." msgstr "" -#: ../../c-api/memory.rst:565 +#: ../../c-api/memory.rst:577 msgid "``p[-S]``" msgstr "``p[-S]``" -#: ../../c-api/memory.rst:566 +#: ../../c-api/memory.rst:578 msgid "API identifier (ASCII character):" msgstr "" -#: ../../c-api/memory.rst:568 +#: ../../c-api/memory.rst:580 msgid "``'r'`` for :c:macro:`PYMEM_DOMAIN_RAW`." msgstr "" -#: ../../c-api/memory.rst:569 +#: ../../c-api/memory.rst:581 msgid "``'m'`` for :c:macro:`PYMEM_DOMAIN_MEM`." msgstr "" -#: ../../c-api/memory.rst:570 +#: ../../c-api/memory.rst:582 msgid "``'o'`` for :c:macro:`PYMEM_DOMAIN_OBJ`." msgstr "" -#: ../../c-api/memory.rst:572 +#: ../../c-api/memory.rst:584 msgid "``p[-S+1:0]``" msgstr "``p[-S+1:0]``" -#: ../../c-api/memory.rst:573 +#: ../../c-api/memory.rst:585 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch under- writes and reads." msgstr "" -#: ../../c-api/memory.rst:575 +#: ../../c-api/memory.rst:587 msgid "``p[0:N]``" msgstr "``p[0:N]``" -#: ../../c-api/memory.rst:576 +#: ../../c-api/memory.rst:588 msgid "" "The requested memory, filled with copies of PYMEM_CLEANBYTE, used to catch " "reference to uninitialized memory. When a realloc-like function is called " @@ -885,25 +902,25 @@ msgid "" "bytes are also filled with PYMEM_DEADBYTE." msgstr "" -#: ../../c-api/memory.rst:584 +#: ../../c-api/memory.rst:596 msgid "``p[N:N+S]``" msgstr "``p[N:N+S]``" -#: ../../c-api/memory.rst:585 +#: ../../c-api/memory.rst:597 msgid "Copies of PYMEM_FORBIDDENBYTE. Used to catch over- writes and reads." msgstr "" -#: ../../c-api/memory.rst:587 +#: ../../c-api/memory.rst:599 msgid "``p[N+S:N+2*S]``" msgstr "``p[N+S:N+2*S]``" -#: ../../c-api/memory.rst:588 +#: ../../c-api/memory.rst:600 msgid "" "Only used if the ``PYMEM_DEBUG_SERIALNO`` macro is defined (not defined by " "default)." msgstr "" -#: ../../c-api/memory.rst:591 +#: ../../c-api/memory.rst:603 msgid "" "A serial number, incremented by 1 on each call to a malloc-like or realloc-" "like function. Big-endian :c:type:`size_t`. If \"bad memory\" is detected " @@ -913,7 +930,7 @@ msgid "" "number is incremented, and exists so you can set such a breakpoint easily." msgstr "" -#: ../../c-api/memory.rst:598 +#: ../../c-api/memory.rst:610 msgid "" "A realloc-like or free-like function first checks that the " "PYMEM_FORBIDDENBYTE bytes at each end are intact. If they've been altered, " @@ -926,7 +943,7 @@ msgid "" "getting used)." msgstr "" -#: ../../c-api/memory.rst:607 +#: ../../c-api/memory.rst:619 msgid "" "The :c:func:`PyMem_SetupDebugHooks` function now also works on Python " "compiled in release mode. On error, the debug hooks now use :mod:" @@ -935,7 +952,7 @@ msgid "" "`PYMEM_DOMAIN_OBJ` and :c:macro:`PYMEM_DOMAIN_MEM` domains are called." msgstr "" -#: ../../c-api/memory.rst:615 +#: ../../c-api/memory.rst:627 msgid "" "Byte patterns ``0xCB`` (``PYMEM_CLEANBYTE``), ``0xDB`` (``PYMEM_DEADBYTE``) " "and ``0xFB`` (``PYMEM_FORBIDDENBYTE``) have been replaced with ``0xCD``, " @@ -943,11 +960,11 @@ msgid "" "``malloc()`` and ``free()``." msgstr "" -#: ../../c-api/memory.rst:625 +#: ../../c-api/memory.rst:637 msgid "The pymalloc allocator" msgstr "" -#: ../../c-api/memory.rst:627 +#: ../../c-api/memory.rst:639 msgid "" "Python has a *pymalloc* allocator optimized for small objects (smaller or " "equal to 512 bytes) with a short lifetime. It uses memory mappings called " @@ -956,110 +973,122 @@ msgid "" "`PyMem_RawRealloc` for allocations larger than 512 bytes." msgstr "" -#: ../../c-api/memory.rst:633 +#: ../../c-api/memory.rst:645 msgid "" "*pymalloc* is the :ref:`default allocator ` of " "the :c:macro:`PYMEM_DOMAIN_MEM` (ex: :c:func:`PyMem_Malloc`) and :c:macro:" "`PYMEM_DOMAIN_OBJ` (ex: :c:func:`PyObject_Malloc`) domains." msgstr "" -#: ../../c-api/memory.rst:637 +#: ../../c-api/memory.rst:649 msgid "The arena allocator uses the following functions:" msgstr "" -#: ../../c-api/memory.rst:639 +#: ../../c-api/memory.rst:651 msgid ":c:func:`!VirtualAlloc` and :c:func:`!VirtualFree` on Windows," msgstr "" -#: ../../c-api/memory.rst:640 +#: ../../c-api/memory.rst:652 msgid ":c:func:`!mmap` and :c:func:`!munmap` if available," msgstr "" -#: ../../c-api/memory.rst:641 +#: ../../c-api/memory.rst:653 msgid ":c:func:`malloc` and :c:func:`free` otherwise." msgstr "" -#: ../../c-api/memory.rst:643 +#: ../../c-api/memory.rst:655 msgid "" "This allocator is disabled if Python is configured with the :option:`--" "without-pymalloc` option. It can also be disabled at runtime using the :" "envvar:`PYTHONMALLOC` environment variable (ex: ``PYTHONMALLOC=malloc``)." msgstr "" -#: ../../c-api/memory.rst:648 +#: ../../c-api/memory.rst:660 msgid "Customize pymalloc Arena Allocator" msgstr "" -#: ../../c-api/memory.rst:654 +#: ../../c-api/memory.rst:666 msgid "" "Structure used to describe an arena allocator. The structure has three " "fields:" msgstr "" -#: ../../c-api/memory.rst:662 +#: ../../c-api/memory.rst:674 msgid "``void* alloc(void *ctx, size_t size)``" msgstr "``void* alloc(void *ctx, size_t size)``" -#: ../../c-api/memory.rst:662 +#: ../../c-api/memory.rst:674 msgid "allocate an arena of size bytes" msgstr "" -#: ../../c-api/memory.rst:664 +#: ../../c-api/memory.rst:676 msgid "``void free(void *ctx, void *ptr, size_t size)``" msgstr "``void free(void *ctx, void *ptr, size_t size)``" -#: ../../c-api/memory.rst:664 +#: ../../c-api/memory.rst:676 msgid "free an arena" msgstr "" -#: ../../c-api/memory.rst:669 +#: ../../c-api/memory.rst:681 msgid "Get the arena allocator." msgstr "" -#: ../../c-api/memory.rst:673 +#: ../../c-api/memory.rst:685 msgid "Set the arena allocator." msgstr "" -#: ../../c-api/memory.rst:677 +#: ../../c-api/memory.rst:690 +msgid "The mimalloc allocator" +msgstr "" + +#: ../../c-api/memory.rst:694 +msgid "" +"Python supports the mimalloc allocator when the underlying platform support " +"is available. mimalloc \"is a general purpose allocator with excellent " +"performance characteristics. Initially developed by Daan Leijen for the " +"runtime systems of the Koka and Lean languages.\"" +msgstr "" + +#: ../../c-api/memory.rst:699 msgid "tracemalloc C API" msgstr "" -#: ../../c-api/memory.rst:683 +#: ../../c-api/memory.rst:705 msgid "Track an allocated memory block in the :mod:`tracemalloc` module." msgstr "" -#: ../../c-api/memory.rst:685 +#: ../../c-api/memory.rst:707 msgid "" "Return ``0`` on success, return ``-1`` on error (failed to allocate memory " "to store the trace). Return ``-2`` if tracemalloc is disabled." msgstr "" -#: ../../c-api/memory.rst:688 +#: ../../c-api/memory.rst:710 msgid "If memory block is already tracked, update the existing trace." msgstr "" -#: ../../c-api/memory.rst:692 +#: ../../c-api/memory.rst:714 msgid "" "Untrack an allocated memory block in the :mod:`tracemalloc` module. Do " "nothing if the block was not tracked." msgstr "" -#: ../../c-api/memory.rst:695 +#: ../../c-api/memory.rst:717 msgid "Return ``-2`` if tracemalloc is disabled, otherwise return ``0``." msgstr "" -#: ../../c-api/memory.rst:701 +#: ../../c-api/memory.rst:723 msgid "Examples" msgstr "範例" -#: ../../c-api/memory.rst:703 +#: ../../c-api/memory.rst:725 msgid "" "Here is the example from section :ref:`memoryoverview`, rewritten so that " "the I/O buffer is allocated from the Python heap by using the first function " "set::" msgstr "" -#: ../../c-api/memory.rst:706 +#: ../../c-api/memory.rst:728 msgid "" "PyObject *res;\n" "char *buf = (char *) PyMem_Malloc(BUFSIZ); /* for I/O */\n" @@ -1072,11 +1101,11 @@ msgid "" "return res;" msgstr "" -#: ../../c-api/memory.rst:716 +#: ../../c-api/memory.rst:738 msgid "The same code using the type-oriented function set::" msgstr "" -#: ../../c-api/memory.rst:718 +#: ../../c-api/memory.rst:740 msgid "" "PyObject *res;\n" "char *buf = PyMem_New(char, BUFSIZ); /* for I/O */\n" @@ -1089,7 +1118,7 @@ msgid "" "return res;" msgstr "" -#: ../../c-api/memory.rst:728 +#: ../../c-api/memory.rst:750 msgid "" "Note that in the two examples above, the buffer is always manipulated via " "functions belonging to the same set. Indeed, it is required to use the same " @@ -1099,7 +1128,7 @@ msgid "" "different allocators operating on different heaps. ::" msgstr "" -#: ../../c-api/memory.rst:735 +#: ../../c-api/memory.rst:757 msgid "" "char *buf1 = PyMem_New(char, BUFSIZ);\n" "char *buf2 = (char *) malloc(BUFSIZ);\n" @@ -1110,14 +1139,14 @@ msgid "" "free(buf1); /* Fatal -- should be PyMem_Del() */" msgstr "" -#: ../../c-api/memory.rst:743 +#: ../../c-api/memory.rst:765 msgid "" "In addition to the functions aimed at handling raw memory blocks from the " "Python heap, objects in Python are allocated and released with :c:macro:" "`PyObject_New`, :c:macro:`PyObject_NewVar` and :c:func:`PyObject_Del`." msgstr "" -#: ../../c-api/memory.rst:747 +#: ../../c-api/memory.rst:769 msgid "" "These will be explained in the next chapter on defining and implementing new " "object types in C." diff --git a/c-api/memoryview.po b/c-api/memoryview.po index 25b6abf571..0221f2b2b8 100644 --- a/c-api/memoryview.po +++ b/c-api/memoryview.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-01-30 00:03+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/c-api/method.po b/c-api/method.po index 749218e03a..1583723816 100644 --- a/c-api/method.po +++ b/c-api/method.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-24 00:03+0000\n" "PO-Revision-Date: 2022-01-24 22:22+0800\n" diff --git a/c-api/module.po b/c-api/module.po index a5f3d840f4..13cc3dc95a 100644 --- a/c-api/module.po +++ b/c-api/module.po @@ -5,9 +5,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -50,7 +50,7 @@ msgid "" msgstr "" #: ../../c-api/module.rst:46 ../../c-api/module.rst:270 -#: ../../c-api/module.rst:445 +#: ../../c-api/module.rst:472 msgid "Return ``NULL`` with an exception set on error." msgstr "在失敗時回傳 ``NULL`` 並設定例外。" @@ -430,7 +430,7 @@ msgid "" "order they appear in the *m_slots* array." msgstr "" -#: ../../c-api/module.rst:389 +#: ../../c-api/module.rst:389 ../../c-api/module.rst:422 msgid "Specifies one of the following values:" msgstr "" @@ -468,15 +468,44 @@ msgid "" "defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED``." msgstr "" -#: ../../c-api/module.rst:420 +#: ../../c-api/module.rst:428 +msgid "" +"The module depends on the presence of the global interpreter lock (GIL), and " +"may access global state without synchronization." +msgstr "" + +#: ../../c-api/module.rst:433 +msgid "The module is safe to run without an active GIL." +msgstr "" + +#: ../../c-api/module.rst:435 +msgid "" +"This slot is ignored by Python builds not configured with :option:`--disable-" +"gil`. Otherwise, it determines whether or not importing this module will " +"cause the GIL to be automatically enabled. See :ref:`whatsnew313-free-" +"threaded-cpython` for more detail." +msgstr "" + +#: ../../c-api/module.rst:440 +msgid "" +"Multiple ``Py_mod_gil`` slots may not be specified in one module definition." +msgstr "" + +#: ../../c-api/module.rst:442 +msgid "" +"If ``Py_mod_gil`` is not specified, the import machinery defaults to " +"``Py_MOD_GIL_USED``." +msgstr "" + +#: ../../c-api/module.rst:447 msgid "See :PEP:`489` for more details on multi-phase initialization." msgstr "" -#: ../../c-api/module.rst:423 +#: ../../c-api/module.rst:450 msgid "Low-level module creation functions" msgstr "" -#: ../../c-api/module.rst:425 +#: ../../c-api/module.rst:452 msgid "" "The following functions are called under the hood when using multi-phase " "initialization. They can be used directly, for example when creating module " @@ -484,14 +513,14 @@ msgid "" "``PyModule_ExecDef`` must be called to fully initialize a module." msgstr "" -#: ../../c-api/module.rst:432 +#: ../../c-api/module.rst:459 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*. This behaves like :c:func:`PyModule_FromDefAndSpec2` with " "*module_api_version* set to :c:macro:`PYTHON_API_VERSION`." msgstr "" -#: ../../c-api/module.rst:440 +#: ../../c-api/module.rst:467 msgid "" "Create a new module object, given the definition in *def* and the ModuleSpec " "*spec*, assuming the API version *module_api_version*. If that version does " @@ -499,24 +528,24 @@ msgid "" "emitted." msgstr "" -#: ../../c-api/module.rst:449 +#: ../../c-api/module.rst:476 msgid "" "Most uses of this function should be using :c:func:`PyModule_FromDefAndSpec` " "instead; only use this if you are sure you need it." msgstr "" -#: ../../c-api/module.rst:456 +#: ../../c-api/module.rst:483 msgid "Process any execution slots (:c:data:`Py_mod_exec`) given in *def*." msgstr "" -#: ../../c-api/module.rst:462 +#: ../../c-api/module.rst:489 msgid "" "Set the docstring for *module* to *docstring*. This function is called " "automatically when creating a module from ``PyModuleDef``, using either " "``PyModule_Create`` or ``PyModule_FromDefAndSpec``." msgstr "" -#: ../../c-api/module.rst:471 +#: ../../c-api/module.rst:498 msgid "" "Add the functions from the ``NULL`` terminated *functions* array to " "*module*. Refer to the :c:type:`PyMethodDef` documentation for details on " @@ -528,11 +557,11 @@ msgid "" "``PyModule_FromDefAndSpec``." msgstr "" -#: ../../c-api/module.rst:483 +#: ../../c-api/module.rst:510 msgid "Support functions" msgstr "支援的函式" -#: ../../c-api/module.rst:485 +#: ../../c-api/module.rst:512 msgid "" "The module initialization function (if using single phase initialization) or " "a function called from a module execution slot (if using multi-phase " @@ -540,28 +569,29 @@ msgid "" "module state:" msgstr "" -#: ../../c-api/module.rst:492 +#: ../../c-api/module.rst:519 msgid "" "Add an object to *module* as *name*. This is a convenience function which " "can be used from the module's initialization function." msgstr "" -#: ../../c-api/module.rst:495 +#: ../../c-api/module.rst:522 msgid "" "On success, return ``0``. On error, raise an exception and return ``-1``." msgstr "" -#: ../../c-api/module.rst:497 +#: ../../c-api/module.rst:524 msgid "" "Return ``-1`` if *value* is ``NULL``. It must be called with an exception " "raised in this case." msgstr "" -#: ../../c-api/module.rst:500 ../../c-api/module.rst:549 +#: ../../c-api/module.rst:527 ../../c-api/module.rst:574 +#: ../../c-api/module.rst:601 msgid "Example usage::" msgstr "用法範例: ::" -#: ../../c-api/module.rst:502 +#: ../../c-api/module.rst:529 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -587,13 +617,13 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:514 ../../c-api/module.rst:567 +#: ../../c-api/module.rst:541 msgid "" "The example can also be written without checking explicitly if *obj* is " "``NULL``::" msgstr "" -#: ../../c-api/module.rst:517 +#: ../../c-api/module.rst:544 msgid "" "static int\n" "add_spam(PyObject *module, int value)\n" @@ -613,80 +643,94 @@ msgstr "" " return res;\n" " }" -#: ../../c-api/module.rst:526 ../../c-api/module.rst:583 +#: ../../c-api/module.rst:553 msgid "" "Note that ``Py_XDECREF()`` should be used instead of ``Py_DECREF()`` in this " "case, since *obj* can be ``NULL``." msgstr "" -#: ../../c-api/module.rst:534 +#: ../../c-api/module.rst:556 +msgid "" +"The number of different *name* strings passed to this function should be " +"kept small, usually by only using statically allocated strings as *name*. " +"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:569 +msgid "" +"Similar to :c:func:`PyModule_AddObjectRef`, but \"steals\" a reference to " +"*value*. It can be called with a result of function that returns a new " +"reference without bothering to check its result or even saving it to a " +"variable." +msgstr "" + +#: ../../c-api/module.rst:576 +msgid "" +"if (PyModule_Add(module, \"spam\", PyBytes_FromString(value)) < 0) {\n" +" goto error;\n" +"}" +msgstr "" + +#: ../../c-api/module.rst:585 msgid "" "Similar to :c:func:`PyModule_AddObjectRef`, but steals a reference to " "*value* on success (if it returns ``0``)." msgstr "" -#: ../../c-api/module.rst:537 +#: ../../c-api/module.rst:588 msgid "" -"The new :c:func:`PyModule_AddObjectRef` function is recommended, since it is " -"easy to introduce reference leaks by misusing the :c:func:" -"`PyModule_AddObject` function." +"The new :c:func:`PyModule_Add` or :c:func:`PyModule_AddObjectRef` functions " +"are recommended, since it is easy to introduce reference leaks by misusing " +"the :c:func:`PyModule_AddObject` function." msgstr "" -#: ../../c-api/module.rst:543 +#: ../../c-api/module.rst:595 msgid "" "Unlike other functions that steal references, ``PyModule_AddObject()`` only " "releases the reference to *value* **on success**." msgstr "" -#: ../../c-api/module.rst:546 +#: ../../c-api/module.rst:598 msgid "" "This means that its return value must be checked, and calling code must :c:" -"func:`Py_DECREF` *value* manually on error." +"func:`Py_XDECREF` *value* manually on error." msgstr "" -#: ../../c-api/module.rst:551 +#: ../../c-api/module.rst:603 msgid "" -"static int\n" -"add_spam(PyObject *module, int value)\n" -"{\n" -" PyObject *obj = PyLong_FromLong(value);\n" -" if (obj == NULL) {\n" -" return -1;\n" -" }\n" -" if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" -" Py_DECREF(obj);\n" -" return -1;\n" -" }\n" -" // PyModule_AddObject() stole a reference to obj:\n" -" // Py_DECREF(obj) is not needed here\n" -" return 0;\n" -"}" +"PyObject *obj = PyBytes_FromString(value);\n" +"if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" +" // If 'obj' is not NULL and PyModule_AddObject() failed,\n" +" // 'obj' strong reference must be deleted with Py_XDECREF().\n" +" // If 'obj' is NULL, Py_XDECREF() does nothing.\n" +" Py_XDECREF(obj);\n" +" goto error;\n" +"}\n" +"// PyModule_AddObject() stole a reference to obj:\n" +"// Py_XDECREF(obj) is not needed here." msgstr "" -#: ../../c-api/module.rst:570 -msgid "" -"static int\n" -"add_spam(PyObject *module, int value)\n" -"{\n" -" PyObject *obj = PyLong_FromLong(value);\n" -" if (PyModule_AddObject(module, \"spam\", obj) < 0) {\n" -" Py_XDECREF(obj);\n" -" return -1;\n" -" }\n" -" // PyModule_AddObject() stole a reference to obj:\n" -" // Py_DECREF(obj) is not needed here\n" -" return 0;\n" -"}" +#: ../../c-api/module.rst:616 +msgid ":c:func:`PyModule_AddObject` is :term:`soft deprecated`." msgstr "" -#: ../../c-api/module.rst:589 +#: ../../c-api/module.rst:621 msgid "" "Add an integer constant to *module* as *name*. This convenience function " "can be used from the module's initialization function. Return ``-1`` with an " "exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:596 +#: ../../c-api/module.rst:625 +msgid "" +"This is a convenience function that calls :c:func:`PyLong_FromLong` and :c:" +"func:`PyModule_AddObjectRef`; see their documentation for details." +msgstr "" + +#: ../../c-api/module.rst:631 msgid "" "Add a string constant to *module* as *name*. This convenience function can " "be used from the module's initialization function. The string *value* must " @@ -694,7 +738,14 @@ msgid "" "on success." msgstr "" -#: ../../c-api/module.rst:604 +#: ../../c-api/module.rst:636 +msgid "" +"This is a convenience function that calls :c:func:" +"`PyUnicode_InternFromString` and :c:func:`PyModule_AddObjectRef`; see their " +"documentation for details." +msgstr "" + +#: ../../c-api/module.rst:643 msgid "" "Add an int constant to *module*. The name and the value are taken from " "*macro*. For example ``PyModule_AddIntMacro(module, AF_INET)`` adds the int " @@ -702,11 +753,11 @@ msgid "" "with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:612 +#: ../../c-api/module.rst:651 msgid "Add a string constant to *module*." msgstr "" -#: ../../c-api/module.rst:616 +#: ../../c-api/module.rst:655 msgid "" "Add a type object to *module*. The type object is finalized by calling " "internally :c:func:`PyType_Ready`. The name of the type object is taken from " @@ -714,25 +765,36 @@ msgid "" "``-1`` with an exception set on error, ``0`` on success." msgstr "" -#: ../../c-api/module.rst:626 +#: ../../c-api/module.rst:665 +msgid "" +"Indicate that *module* does or does not support running without the global " +"interpreter lock (GIL), using one of the values from :c:macro:`Py_mod_gil`. " +"It must be called during *module*'s initialization function. If this " +"function is not called during module initialization, the import machinery " +"assumes the module does not support running without the GIL. This function " +"is only available in Python builds configured with :option:`--disable-gil`. " +"Return ``-1`` with an exception set on error, ``0`` on success." +msgstr "" + +#: ../../c-api/module.rst:678 msgid "Module lookup" msgstr "模組查找" -#: ../../c-api/module.rst:628 +#: ../../c-api/module.rst:680 msgid "" "Single-phase initialization creates singleton modules that can be looked up " "in the context of the current interpreter. This allows the module object to " "be retrieved later with only a reference to the module definition." msgstr "" -#: ../../c-api/module.rst:632 +#: ../../c-api/module.rst:684 msgid "" "These functions will not work on modules created using multi-phase " "initialization, since multiple such modules can be created from a single " "definition." msgstr "" -#: ../../c-api/module.rst:637 +#: ../../c-api/module.rst:689 msgid "" "Returns the module object that was created from *def* for the current " "interpreter. This method requires that the module object has been attached " @@ -741,18 +803,18 @@ msgid "" "to the interpreter state yet, it returns ``NULL``." msgstr "" -#: ../../c-api/module.rst:644 +#: ../../c-api/module.rst:696 msgid "" "Attaches the module object passed to the function to the interpreter state. " "This allows the module object to be accessible via :c:func:" "`PyState_FindModule`." msgstr "" -#: ../../c-api/module.rst:647 +#: ../../c-api/module.rst:699 msgid "Only effective on modules created using single-phase initialization." msgstr "" -#: ../../c-api/module.rst:649 +#: ../../c-api/module.rst:701 msgid "" "Python calls ``PyState_AddModule`` automatically after importing a module, " "so it is unnecessary (but harmless) to call it from module initialization " @@ -763,15 +825,15 @@ msgid "" "state updates)." msgstr "" -#: ../../c-api/module.rst:657 ../../c-api/module.rst:668 +#: ../../c-api/module.rst:709 ../../c-api/module.rst:720 msgid "The caller must hold the GIL." msgstr "" -#: ../../c-api/module.rst:659 +#: ../../c-api/module.rst:711 msgid "Return ``-1`` with an exception set on error, ``0`` on success." msgstr "成功時回傳 ``0``,在失敗時回傳 ``-1`` 並設定例外。" -#: ../../c-api/module.rst:665 +#: ../../c-api/module.rst:717 msgid "" "Removes the module object created from *def* from the interpreter state. " "Return ``-1`` with an exception set on error, ``0`` on success." diff --git a/c-api/monitoring.po b/c-api/monitoring.po new file mode 100644 index 0000000000..ef4d13984c --- /dev/null +++ b/c-api/monitoring.po @@ -0,0 +1,285 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../c-api/monitoring.rst:6 +msgid "Monitoring C API" +msgstr "" + +#: ../../c-api/monitoring.rst:8 +msgid "Added in version 3.13." +msgstr "" + +#: ../../c-api/monitoring.rst:10 +msgid "" +"An extension may need to interact with the event monitoring system. " +"Subscribing to events and registering callbacks can be done via the Python " +"API exposed in :mod:`sys.monitoring`." +msgstr "" + +#: ../../c-api/monitoring.rst:15 +msgid "Generating Execution Events" +msgstr "" + +#: ../../c-api/monitoring.rst:17 +msgid "" +"The functions below make it possible for an extension to fire monitoring " +"events as it emulates the execution of Python code. Each of these functions " +"accepts a ``PyMonitoringState`` struct which contains concise information " +"about the activation state of events, as well as the event arguments, which " +"include a ``PyObject*`` representing the code object, the instruction offset " +"and sometimes additional, event-specific arguments (see :mod:`sys." +"monitoring` for details about the signatures of the different event " +"callbacks). The ``codelike`` argument should be an instance of :class:`types." +"CodeType` or of a type that emulates it." +msgstr "" + +#: ../../c-api/monitoring.rst:27 +msgid "" +"The VM disables tracing when firing an event, so there is no need for user " +"code to do that." +msgstr "" + +#: ../../c-api/monitoring.rst:30 +msgid "" +"Monitoring functions should not be called with an exception set, except " +"those listed below as working with the current exception." +msgstr "" + +#: ../../c-api/monitoring.rst:35 +msgid "" +"Representation of the state of an event type. It is allocated by the user " +"while its contents are maintained by the monitoring API functions described " +"below." +msgstr "" + +#: ../../c-api/monitoring.rst:39 +msgid "" +"All of the functions below return 0 on success and -1 (with an exception " +"set) on error." +msgstr "" + +#: ../../c-api/monitoring.rst:41 +msgid "See :mod:`sys.monitoring` for descriptions of the events." +msgstr "" + +#: ../../c-api/monitoring.rst:45 +msgid "Fire a ``PY_START`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:50 +msgid "Fire a ``PY_RESUME`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:55 +msgid "Fire a ``PY_RETURN`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:60 +msgid "Fire a ``PY_YIELD`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:65 +msgid "Fire a ``CALL`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:70 +msgid "Fire a ``LINE`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:75 +msgid "Fire a ``JUMP`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:80 +msgid "Fire a ``BRANCH`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:85 +msgid "Fire a ``C_RETURN`` event." +msgstr "" + +#: ../../c-api/monitoring.rst:90 +msgid "" +"Fire a ``PY_THROW`` event with the current exception (as returned by :c:func:" +"`PyErr_GetRaisedException`)." +msgstr "" + +#: ../../c-api/monitoring.rst:96 +msgid "" +"Fire a ``RAISE`` event with the current exception (as returned by :c:func:" +"`PyErr_GetRaisedException`)." +msgstr "" + +#: ../../c-api/monitoring.rst:102 +msgid "" +"Fire a ``C_RAISE`` event with the current exception (as returned by :c:func:" +"`PyErr_GetRaisedException`)." +msgstr "" + +#: ../../c-api/monitoring.rst:108 +msgid "" +"Fire a ``RERAISE`` event with the current exception (as returned by :c:func:" +"`PyErr_GetRaisedException`)." +msgstr "" + +#: ../../c-api/monitoring.rst:114 +msgid "" +"Fire an ``EXCEPTION_HANDLED`` event with the current exception (as returned " +"by :c:func:`PyErr_GetRaisedException`)." +msgstr "" + +#: ../../c-api/monitoring.rst:120 +msgid "" +"Fire a ``PY_UNWIND`` event with the current exception (as returned by :c:" +"func:`PyErr_GetRaisedException`)." +msgstr "" + +#: ../../c-api/monitoring.rst:126 +msgid "" +"Fire a ``STOP_ITERATION`` event. If ``value`` is an instance of :exc:" +"`StopIteration`, it is used. Otherwise, a new :exc:`StopIteration` instance " +"is created with ``value`` as its argument." +msgstr "" + +#: ../../c-api/monitoring.rst:131 +msgid "Managing the Monitoring State" +msgstr "" + +#: ../../c-api/monitoring.rst:133 +msgid "" +"Monitoring states can be managed with the help of monitoring scopes. A scope " +"would typically correspond to a python function." +msgstr "" + +#: ../../c-api/monitoring.rst:138 +msgid "" +"Enter a monitored scope. ``event_types`` is an array of the event IDs for " +"events that may be fired from the scope. For example, the ID of a " +"``PY_START`` event is the value ``PY_MONITORING_EVENT_PY_START``, which is " +"numerically equal to the base-2 logarithm of ``sys.monitoring.events." +"PY_START``. ``state_array`` is an array with a monitoring state entry for " +"each event in ``event_types``, it is allocated by the user but populated by :" +"c:func:`!PyMonitoring_EnterScope` with information about the activation " +"state of the event. The size of ``event_types`` (and hence also of " +"``state_array``) is given in ``length``." +msgstr "" + +#: ../../c-api/monitoring.rst:148 +msgid "" +"The ``version`` argument is a pointer to a value which should be allocated " +"by the user together with ``state_array`` and initialized to 0, and then set " +"only by :c:func:`!PyMonitoring_EnterScope` itelf. It allows this function to " +"determine whether event states have changed since the previous call, and to " +"return quickly if they have not." +msgstr "" + +#: ../../c-api/monitoring.rst:154 +msgid "" +"The scopes referred to here are lexical scopes: a function, class or " +"method. :c:func:`!PyMonitoring_EnterScope` should be called whenever the " +"lexical scope is entered. Scopes can be reentered, reusing the same " +"*state_array* and *version*, in situations like when emulating a recursive " +"Python function. When a code-like's execution is paused, such as when " +"emulating a generator, the scope needs to be exited and re-entered." +msgstr "" + +#: ../../c-api/monitoring.rst:161 +msgid "The macros for *event_types* are:" +msgstr "" + +#: ../../c-api/monitoring.rst:169 +msgid "Macro" +msgstr "巨集" + +#: ../../c-api/monitoring.rst:169 +msgid "Event" +msgstr "" + +#: ../../c-api/monitoring.rst:171 +msgid ":monitoring-event:`BRANCH`" +msgstr ":monitoring-event:`BRANCH`" + +#: ../../c-api/monitoring.rst:172 +msgid ":monitoring-event:`CALL`" +msgstr ":monitoring-event:`CALL`" + +#: ../../c-api/monitoring.rst:173 +msgid ":monitoring-event:`C_RAISE`" +msgstr ":monitoring-event:`C_RAISE`" + +#: ../../c-api/monitoring.rst:174 +msgid ":monitoring-event:`C_RETURN`" +msgstr ":monitoring-event:`C_RETURN`" + +#: ../../c-api/monitoring.rst:175 +msgid ":monitoring-event:`EXCEPTION_HANDLED`" +msgstr ":monitoring-event:`EXCEPTION_HANDLED`" + +#: ../../c-api/monitoring.rst:176 +msgid ":monitoring-event:`INSTRUCTION`" +msgstr ":monitoring-event:`INSTRUCTION`" + +#: ../../c-api/monitoring.rst:177 +msgid ":monitoring-event:`JUMP`" +msgstr ":monitoring-event:`JUMP`" + +#: ../../c-api/monitoring.rst:178 +msgid ":monitoring-event:`LINE`" +msgstr ":monitoring-event:`LINE`" + +#: ../../c-api/monitoring.rst:179 +msgid ":monitoring-event:`PY_RESUME`" +msgstr ":monitoring-event:`PY_RESUME`" + +#: ../../c-api/monitoring.rst:180 +msgid ":monitoring-event:`PY_RETURN`" +msgstr ":monitoring-event:`PY_RETURN`" + +#: ../../c-api/monitoring.rst:181 +msgid ":monitoring-event:`PY_START`" +msgstr ":monitoring-event:`PY_START`" + +#: ../../c-api/monitoring.rst:182 +msgid ":monitoring-event:`PY_THROW`" +msgstr ":monitoring-event:`PY_THROW`" + +#: ../../c-api/monitoring.rst:183 +msgid ":monitoring-event:`PY_UNWIND`" +msgstr ":monitoring-event:`PY_UNWIND`" + +#: ../../c-api/monitoring.rst:184 +msgid ":monitoring-event:`PY_YIELD`" +msgstr ":monitoring-event:`PY_YIELD`" + +#: ../../c-api/monitoring.rst:185 +msgid ":monitoring-event:`RAISE`" +msgstr ":monitoring-event:`RAISE`" + +#: ../../c-api/monitoring.rst:186 +msgid ":monitoring-event:`RERAISE`" +msgstr ":monitoring-event:`RERAISE`" + +#: ../../c-api/monitoring.rst:187 +msgid ":monitoring-event:`STOP_ITERATION`" +msgstr ":monitoring-event:`STOP_ITERATION`" + +#: ../../c-api/monitoring.rst:192 +msgid "" +"Exit the last scope that was entered with :c:func:`!PyMonitoring_EnterScope`." +msgstr "" diff --git a/c-api/none.po b/c-api/none.po index a4dc2654ef..eb714cd111 100644 --- a/c-api/none.po +++ b/c-api/none.po @@ -6,9 +6,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-07-29 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,11 +34,12 @@ msgstr "" #: ../../c-api/none.rst:18 msgid "" "The Python ``None`` object, denoting lack of value. This object has no " -"methods and is `immortal `_." +"methods and is :term:`immortal`." msgstr "" #: ../../c-api/none.rst:21 -msgid ":c:data:`Py_None` is immortal." +#, fuzzy +msgid ":c:data:`Py_None` is :term:`immortal`." msgstr ":c:data:`Py_None` 為不滅的 (immortal)。" #: ../../c-api/none.rst:26 diff --git a/c-api/number.po b/c-api/number.po index d058488140..83e14a4b31 100644 --- a/c-api/number.po +++ b/c-api/number.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-07-20 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" diff --git a/c-api/objbuffer.po b/c-api/objbuffer.po deleted file mode 100644 index 8b850ef948..0000000000 --- a/c-api/objbuffer.po +++ /dev/null @@ -1,105 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -# Liang-Bo Wang , 2015 -# Matt Wang , 2023 -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" -"PO-Revision-Date: 2023-07-01 04:33+0800\n" -"Last-Translator: Matt Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.3.2\n" - -#: ../../c-api/objbuffer.rst:4 -msgid "Old Buffer Protocol" -msgstr "舊式緩衝協定 (Buffer Protocol)" - -#: ../../c-api/objbuffer.rst:8 -msgid "" -"These functions were part of the \"old buffer protocol\" API in Python 2. In " -"Python 3, this protocol doesn't exist anymore but the functions are still " -"exposed to ease porting 2.x code. They act as a compatibility wrapper " -"around the :ref:`new buffer protocol `, but they don't give " -"you control over the lifetime of the resources acquired when a buffer is " -"exported." -msgstr "" -"這些函式是 Python 2 中「舊式緩衝區協定」API 的一部分。在 Python 3 中,該協議" -"已經不存在,但這些函式仍有公開以供移植 2.x 程式碼。它們充當\\ :ref:`新式緩衝" -"區協定 `\\ 的相容性包裝器,但它們無法讓你控制匯出 (export) 緩" -"衝區時所獲取資源的生命週期。" - -#: ../../c-api/objbuffer.rst:15 -msgid "" -"Therefore, it is recommended that you call :c:func:`PyObject_GetBuffer` (or " -"the ``y*`` or ``w*`` :ref:`format codes ` with the :c:func:" -"`PyArg_ParseTuple` family of functions) to get a buffer view over an object, " -"and :c:func:`PyBuffer_Release` when the buffer view can be released." -msgstr "" -"因此,建議你呼叫 :c:func:`PyObject_GetBuffer` (或是以 ``y*`` 或 ``w*`` :ref:" -"`格式碼 (format code) ` 呼叫 :c:func:`PyArg_ParseTuple` 系列函" -"式)獲取物件的緩衝區視圖 (buffer view),以及緩衝區視圖可被釋放時呼叫 :c:func:" -"`PyBuffer_Release` 。" - -#: ../../c-api/objbuffer.rst:23 -msgid "" -"Returns a pointer to a read-only memory location usable as character-based " -"input. The *obj* argument must support the single-segment character buffer " -"interface. On success, returns ``0``, sets *buffer* to the memory location " -"and *buffer_len* to the buffer length. Returns ``-1`` and sets a :exc:" -"`TypeError` on error." -msgstr "" -"回傳一個指向可用作基於字元輸入之唯讀記憶體位置的指標。 *obj* 引數必須支援單一" -"片段 (single-segment) 字元緩衝區介面。成功時回傳 ``0``,並將 *buffer* 設定為" -"記憶體位置、將 *buffer_len* 設定為緩衝區長度。回傳 ``-1`` 並在錯誤時設定 :" -"exc:`TypeError`。" - -#: ../../c-api/objbuffer.rst:32 -msgid "" -"Returns a pointer to a read-only memory location containing arbitrary data. " -"The *obj* argument must support the single-segment readable buffer " -"interface. On success, returns ``0``, sets *buffer* to the memory location " -"and *buffer_len* to the buffer length. Returns ``-1`` and sets a :exc:" -"`TypeError` on error." -msgstr "" -"回傳一個指向包含任意資料之唯讀記憶體位置的指標。*obj* 引數必須支援單一片段可" -"讀緩衝區介面。成功時回傳 ``0``,並將 *buffer* 設定為記憶體位置、將 " -"*buffer_len* 設定為緩衝區長度。回傳 ``-1`` 並在錯誤時設定 :exc:`TypeError`。" - -#: ../../c-api/objbuffer.rst:41 -msgid "" -"Returns ``1`` if *o* supports the single-segment readable buffer interface. " -"Otherwise returns ``0``. This function always succeeds." -msgstr "" -"如果 *o* 支援單一片段可讀緩衝區介面,則回傳 ``1``,否則回傳 ``0``。這個函式一" -"定會執行成功的。" - -#: ../../c-api/objbuffer.rst:44 -msgid "" -"Note that this function tries to get and release a buffer, and exceptions " -"which occur while calling corresponding functions will get suppressed. To " -"get error reporting use :c:func:`PyObject_GetBuffer()` instead." -msgstr "" -"請注意,該函式嘗試獲取和釋放緩衝區,並且呼叫相應函式時發生的例外將被抑制。要" -"獲取錯誤報告,請改用 :c:func:`PyObject_GetBuffer()`。" - -#: ../../c-api/objbuffer.rst:51 -msgid "" -"Returns a pointer to a writable memory location. The *obj* argument must " -"support the single-segment, character buffer interface. On success, returns " -"``0``, sets *buffer* to the memory location and *buffer_len* to the buffer " -"length. Returns ``-1`` and sets a :exc:`TypeError` on error." -msgstr "" -"回傳指向可寫記憶體位置的指標。 *obj* 引數必須支援單一片段字元緩衝區介面。成功" -"時回傳 ``0``,並將 *buffer* 設定為記憶體位置,且將 *buffer_len* 設定為緩衝區" -"長度。回傳 ``-1`` 並在錯誤時設定 :exc:`TypeError`。" diff --git a/c-api/object.po b/c-api/object.po index eb0e3cc2c1..d557e3d5c6 100644 --- a/c-api/object.po +++ b/c-api/object.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,26 +23,149 @@ msgid "Object Protocol" msgstr "物件協定" #: ../../c-api/object.rst:11 +msgid "Get a :term:`strong reference` to a constant." +msgstr "" + +#: ../../c-api/object.rst:13 +msgid "Set an exception and return ``NULL`` if *constant_id* is invalid." +msgstr "" + +#: ../../c-api/object.rst:15 +msgid "*constant_id* must be one of these constant identifiers:" +msgstr "" + +#: ../../c-api/object.rst:20 +msgid "Constant Identifier" +msgstr "" + +#: ../../c-api/object.rst:20 +msgid "Value" +msgstr "" + +#: ../../c-api/object.rst:20 +msgid "Returned object" +msgstr "" + +#: ../../c-api/object.rst:22 ../../c-api/object.rst:27 +msgid "``0``" +msgstr "``0``" + +#: ../../c-api/object.rst:22 +msgid ":py:data:`None`" +msgstr ":py:data:`None`" + +#: ../../c-api/object.rst:23 ../../c-api/object.rst:28 +msgid "``1``" +msgstr "``1``" + +#: ../../c-api/object.rst:23 +msgid ":py:data:`False`" +msgstr ":py:data:`False`" + +#: ../../c-api/object.rst:24 +msgid "``2``" +msgstr "``2``" + +#: ../../c-api/object.rst:24 +msgid ":py:data:`True`" +msgstr ":py:data:`True`" + +#: ../../c-api/object.rst:25 +msgid "``3``" +msgstr "``3``" + +#: ../../c-api/object.rst:25 +msgid ":py:data:`Ellipsis`" +msgstr ":py:data:`Ellipsis`" + +#: ../../c-api/object.rst:26 +msgid "``4``" +msgstr "``4``" + +#: ../../c-api/object.rst:26 +msgid ":py:data:`NotImplemented`" +msgstr ":py:data:`NotImplemented`" + +#: ../../c-api/object.rst:27 +msgid "``5``" +msgstr "``5``" + +#: ../../c-api/object.rst:28 +msgid "``6``" +msgstr "``6``" + +#: ../../c-api/object.rst:29 +msgid "``7``" +msgstr "``7``" + +#: ../../c-api/object.rst:29 +msgid "``''``" +msgstr "``''``" + +#: ../../c-api/object.rst:30 +msgid "``8``" +msgstr "``8``" + +#: ../../c-api/object.rst:30 +msgid "``b''``" +msgstr "``b''``" + +#: ../../c-api/object.rst:31 +msgid "``9``" +msgstr "``9``" + +#: ../../c-api/object.rst:31 +msgid "``()``" +msgstr "``()``" + +#: ../../c-api/object.rst:34 +msgid "" +"Numeric values are only given for projects which cannot use the constant " +"identifiers." +msgstr "" + +#: ../../c-api/object.rst:42 +msgid "In CPython, all of these constants are :term:`immortal`." +msgstr "" + +#: ../../c-api/object.rst:47 +msgid "" +"Similar to :c:func:`Py_GetConstant`, but return a :term:`borrowed reference`." +msgstr "" + +#: ../../c-api/object.rst:50 +msgid "" +"This function is primarily intended for backwards compatibility: using :c:" +"func:`Py_GetConstant` is recommended for new code." +msgstr "" + +#: ../../c-api/object.rst:53 +msgid "" +"The reference is borrowed from the interpreter, and is valid until the " +"interpreter finalization." +msgstr "" + +#: ../../c-api/object.rst:61 msgid "" "The ``NotImplemented`` singleton, used to signal that an operation is not " "implemented for the given type combination." msgstr "" -#: ../../c-api/object.rst:17 +#: ../../c-api/object.rst:67 msgid "" "Properly handle returning :c:data:`Py_NotImplemented` from within a C " "function (that is, create a new :term:`strong reference` to :const:" "`NotImplemented` and return it)." msgstr "" -#: ../../c-api/object.rst:24 +#: ../../c-api/object.rst:74 msgid "" "Flag to be used with multiple functions that print the object (like :c:func:" "`PyObject_Print` and :c:func:`PyFile_WriteObject`). If passed, these " "function would use the :func:`str` of the object instead of the :func:`repr`." msgstr "" -#: ../../c-api/object.rst:32 +#: ../../c-api/object.rst:82 msgid "" "Print an object *o*, on file *fp*. Returns ``-1`` on error. The flags " "argument is used to enable certain printing options. The only option " @@ -50,50 +173,99 @@ msgid "" "the object is written instead of the :func:`repr`." msgstr "" -#: ../../c-api/object.rst:40 +#: ../../c-api/object.rst:90 +msgid "" +"Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. " +"This is equivalent to the Python expression ``hasattr(o, attr_name)``. On " +"failure, return ``-1``." +msgstr "" + +#: ../../c-api/object.rst:99 +msgid "" +"This is the same as :c:func:`PyObject_HasAttrWithError`, but *attr_name* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." +msgstr "" + +#: ../../c-api/object.rst:108 msgid "" -"Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. " -"This is equivalent to the Python expression ``hasattr(o, attr_name)``. This " -"function always succeeds." +"Returns ``1`` if *o* has the attribute *attr_name*, and ``0`` otherwise. " +"This function always succeeds." msgstr "" -#: ../../c-api/object.rst:46 +#: ../../c-api/object.rst:113 msgid "" "Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" "`~object.__getattribute__` methods are silently ignored. For proper error " -"handling, use :c:func:`PyObject_GetAttr` instead." +"handling, use :c:func:`PyObject_HasAttrWithError`, :c:func:" +"`PyObject_GetOptionalAttr` or :c:func:`PyObject_GetAttr` instead." msgstr "" -#: ../../c-api/object.rst:53 +#: ../../c-api/object.rst:121 msgid "" "This is the same as :c:func:`PyObject_HasAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/object.rst:59 +#: ../../c-api/object.rst:127 msgid "" "Exceptions that occur when this calls :meth:`~object.__getattr__` and :meth:" "`~object.__getattribute__` methods or while creating the temporary :class:" "`str` object are silently ignored. For proper error handling, use :c:func:" -"`PyObject_GetAttrString` instead." +"`PyObject_HasAttrStringWithError`, :c:func:`PyObject_GetOptionalAttrString` " +"or :c:func:`PyObject_GetAttrString` instead." msgstr "" -#: ../../c-api/object.rst:67 +#: ../../c-api/object.rst:137 msgid "" "Retrieve an attribute named *attr_name* from object *o*. Returns the " "attribute value on success, or ``NULL`` on failure. This is the equivalent " "of the Python expression ``o.attr_name``." msgstr "" -#: ../../c-api/object.rst:74 +#: ../../c-api/object.rst:141 +msgid "" +"If the missing attribute should not be treated as a failure, you can use :c:" +"func:`PyObject_GetOptionalAttr` instead." +msgstr "" + +#: ../../c-api/object.rst:147 msgid "" "This is the same as :c:func:`PyObject_GetAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/object.rst:81 +#: ../../c-api/object.rst:151 +msgid "" +"If the missing attribute should not be treated as a failure, you can use :c:" +"func:`PyObject_GetOptionalAttrString` instead." +msgstr "" + +#: ../../c-api/object.rst:157 +msgid "" +"Variant of :c:func:`PyObject_GetAttr` which doesn't raise :exc:" +"`AttributeError` if the attribute is not found." +msgstr "" + +#: ../../c-api/object.rst:160 +msgid "" +"If the attribute is found, return ``1`` and set *\\*result* to a new :term:" +"`strong reference` to the attribute. If the attribute is not found, return " +"``0`` and set *\\*result* to ``NULL``; the :exc:`AttributeError` is " +"silenced. If an error other than :exc:`AttributeError` is raised, return " +"``-1`` and set *\\*result* to ``NULL``." +msgstr "" + +#: ../../c-api/object.rst:172 +msgid "" +"This is the same as :c:func:`PyObject_GetOptionalAttr`, but *attr_name* is " +"specified as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than " +"a :c:expr:`PyObject*`." +msgstr "" + +#: ../../c-api/object.rst:180 msgid "" "Generic attribute getter function that is meant to be put into a type " "object's ``tp_getattro`` slot. It looks for a descriptor in the dictionary " @@ -103,34 +275,44 @@ msgid "" "descriptors don't. Otherwise, an :exc:`AttributeError` is raised." msgstr "" -#: ../../c-api/object.rst:91 +#: ../../c-api/object.rst:190 msgid "" "Set the value of the attribute named *attr_name*, for object *o*, to the " "value *v*. Raise an exception and return ``-1`` on failure; return ``0`` on " "success. This is the equivalent of the Python statement ``o.attr_name = v``." msgstr "" -#: ../../c-api/object.rst:96 +#: ../../c-api/object.rst:195 msgid "" "If *v* is ``NULL``, the attribute is deleted. This behaviour is deprecated " "in favour of using :c:func:`PyObject_DelAttr`, but there are currently no " "plans to remove it." msgstr "" -#: ../../c-api/object.rst:103 +#: ../../c-api/object.rst:202 msgid "" "This is the same as :c:func:`PyObject_SetAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/object.rst:107 +#: ../../c-api/object.rst:206 msgid "" "If *v* is ``NULL``, the attribute is deleted, but this feature is deprecated " "in favour of using :c:func:`PyObject_DelAttrString`." msgstr "" -#: ../../c-api/object.rst:113 +#: ../../c-api/object.rst:209 +msgid "" +"The number of different attribute names passed to this function should be " +"kept small, usually by using a statically allocated string as *attr_name*. " +"For attribute names that aren't known at compile time, prefer calling :c:" +"func:`PyUnicode_FromString` and :c:func:`PyObject_SetAttr` directly. For " +"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " +"internally to create a key object." +msgstr "" + +#: ../../c-api/object.rst:219 msgid "" "Generic attribute setter and deleter function that is meant to be put into a " "type object's :c:member:`~PyTypeObject.tp_setattro` slot. It looks for a " @@ -142,26 +324,36 @@ msgid "" "returned." msgstr "" -#: ../../c-api/object.rst:125 +#: ../../c-api/object.rst:231 msgid "" "Delete attribute named *attr_name*, for object *o*. Returns ``-1`` on " "failure. This is the equivalent of the Python statement ``del o.attr_name``." msgstr "" -#: ../../c-api/object.rst:131 +#: ../../c-api/object.rst:237 msgid "" "This is the same as :c:func:`PyObject_DelAttr`, but *attr_name* is specified " "as a :c:expr:`const char*` UTF-8 encoded bytes string, rather than a :c:expr:" "`PyObject*`." msgstr "" -#: ../../c-api/object.rst:138 +#: ../../c-api/object.rst:241 +msgid "" +"The number of different attribute names passed to this function should be " +"kept small, usually by using a statically allocated string as *attr_name*. " +"For attribute names that aren't known at compile time, prefer calling :c:" +"func:`PyUnicode_FromString` and :c:func:`PyObject_DelAttr` directly. For " +"more details, see :c:func:`PyUnicode_InternFromString`, which may be used " +"internally to create a key object for lookup." +msgstr "" + +#: ../../c-api/object.rst:252 msgid "" "A generic implementation for the getter of a ``__dict__`` descriptor. It " "creates the dictionary if necessary." msgstr "" -#: ../../c-api/object.rst:141 +#: ../../c-api/object.rst:255 msgid "" "This function may also be called to get the :py:attr:`~object.__dict__` of " "the object *o*. Pass ``NULL`` for *context* when calling it. Since this " @@ -170,30 +362,30 @@ msgid "" "the object." msgstr "" -#: ../../c-api/object.rst:147 +#: ../../c-api/object.rst:261 msgid "On failure, returns ``NULL`` with an exception set." msgstr "在失敗時,會回傳 ``NULL`` 並設定例外。" -#: ../../c-api/object.rst:154 +#: ../../c-api/object.rst:268 msgid "" "A generic implementation for the setter of a ``__dict__`` descriptor. This " "implementation does not allow the dictionary to be deleted." msgstr "" -#: ../../c-api/object.rst:162 +#: ../../c-api/object.rst:276 msgid "" "Return a pointer to :py:attr:`~object.__dict__` of the object *obj*. If " "there is no ``__dict__``, return ``NULL`` without setting an exception." msgstr "" -#: ../../c-api/object.rst:165 +#: ../../c-api/object.rst:279 msgid "" "This function may need to allocate memory for the dictionary, so it may be " "more efficient to call :c:func:`PyObject_GetAttr` when accessing an " "attribute on the object." msgstr "" -#: ../../c-api/object.rst:172 +#: ../../c-api/object.rst:286 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "which must be one of :c:macro:`Py_LT`, :c:macro:`Py_LE`, :c:macro:`Py_EQ`, :" @@ -204,33 +396,33 @@ msgid "" "success, or ``NULL`` on failure." msgstr "" -#: ../../c-api/object.rst:182 +#: ../../c-api/object.rst:296 msgid "" "Compare the values of *o1* and *o2* using the operation specified by *opid*, " "like :c:func:`PyObject_RichCompare`, but returns ``-1`` on error, ``0`` if " "the result is false, ``1`` otherwise." msgstr "" -#: ../../c-api/object.rst:187 +#: ../../c-api/object.rst:301 msgid "" "If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool` " "will always return ``1`` for :c:macro:`Py_EQ` and ``0`` for :c:macro:`Py_NE`." msgstr "" -#: ../../c-api/object.rst:192 +#: ../../c-api/object.rst:306 msgid "" "Format *obj* using *format_spec*. This is equivalent to the Python " "expression ``format(obj, format_spec)``." msgstr "" -#: ../../c-api/object.rst:195 +#: ../../c-api/object.rst:309 msgid "" "*format_spec* may be ``NULL``. In this case the call is equivalent to " "``format(obj)``. Returns the formatted string on success, ``NULL`` on " "failure." msgstr "" -#: ../../c-api/object.rst:203 +#: ../../c-api/object.rst:317 msgid "" "Compute a string representation of object *o*. Returns the string " "representation on success, ``NULL`` on failure. This is the equivalent of " @@ -238,13 +430,13 @@ msgid "" "function." msgstr "" -#: ../../c-api/object.rst:207 ../../c-api/object.rst:231 +#: ../../c-api/object.rst:321 ../../c-api/object.rst:345 msgid "" "This function now includes a debug assertion to help ensure that it does not " "silently discard an active exception." msgstr "" -#: ../../c-api/object.rst:215 +#: ../../c-api/object.rst:329 msgid "" "As :c:func:`PyObject_Repr`, compute a string representation of object *o*, " "but escape the non-ASCII characters in the string returned by :c:func:" @@ -253,7 +445,7 @@ msgid "" "Called by the :func:`ascii` built-in function." msgstr "" -#: ../../c-api/object.rst:226 +#: ../../c-api/object.rst:340 msgid "" "Compute a string representation of object *o*. Returns the string " "representation on success, ``NULL`` on failure. This is the equivalent of " @@ -261,7 +453,7 @@ msgid "" "function and, therefore, by the :func:`print` function." msgstr "" -#: ../../c-api/object.rst:240 +#: ../../c-api/object.rst:354 msgid "" "Compute a bytes representation of object *o*. ``NULL`` is returned on " "failure and a bytes object on success. This is equivalent to the Python " @@ -270,73 +462,73 @@ msgid "" "bytes object." msgstr "" -#: ../../c-api/object.rst:249 +#: ../../c-api/object.rst:363 msgid "" "Return ``1`` if the class *derived* is identical to or derived from the " "class *cls*, otherwise return ``0``. In case of an error, return ``-1``." msgstr "" -#: ../../c-api/object.rst:252 ../../c-api/object.rst:271 +#: ../../c-api/object.rst:366 ../../c-api/object.rst:385 msgid "" "If *cls* is a tuple, the check will be done against every entry in *cls*. " "The result will be ``1`` when at least one of the checks returns ``1``, " "otherwise it will be ``0``." msgstr "" -#: ../../c-api/object.rst:256 +#: ../../c-api/object.rst:370 msgid "" -"If *cls* has a :meth:`~class.__subclasscheck__` method, it will be called to " +"If *cls* has a :meth:`~type.__subclasscheck__` method, it will be called to " "determine the subclass status as described in :pep:`3119`. Otherwise, " "*derived* is a subclass of *cls* if it is a direct or indirect subclass, i." -"e. contained in ``cls.__mro__``." +"e. contained in :attr:`cls.__mro__ `." msgstr "" -#: ../../c-api/object.rst:261 +#: ../../c-api/object.rst:375 msgid "" "Normally only class objects, i.e. instances of :class:`type` or a derived " "class, are considered classes. However, objects can override this by having " -"a :attr:`~class.__bases__` attribute (which must be a tuple of base classes)." +"a :attr:`~type.__bases__` attribute (which must be a tuple of base classes)." msgstr "" -#: ../../c-api/object.rst:268 +#: ../../c-api/object.rst:382 msgid "" "Return ``1`` if *inst* is an instance of the class *cls* or a subclass of " "*cls*, or ``0`` if not. On error, returns ``-1`` and sets an exception." msgstr "" -#: ../../c-api/object.rst:275 +#: ../../c-api/object.rst:389 msgid "" -"If *cls* has a :meth:`~class.__instancecheck__` method, it will be called to " +"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:279 +#: ../../c-api/object.rst:393 msgid "" "An instance *inst* can override what is considered its class by having a :" -"attr:`~instance.__class__` attribute." +"attr:`~object.__class__` attribute." msgstr "" -#: ../../c-api/object.rst:282 +#: ../../c-api/object.rst:396 msgid "" "An object *cls* can override if it is considered a class, and what its base " -"classes are, by having a :attr:`~class.__bases__` attribute (which must be a " +"classes are, by having a :attr:`~type.__bases__` attribute (which must be a " "tuple of base classes)." msgstr "" -#: ../../c-api/object.rst:291 +#: ../../c-api/object.rst:405 msgid "" "Compute and return the hash value of an object *o*. On failure, return " "``-1``. This is the equivalent of the Python expression ``hash(o)``." msgstr "" -#: ../../c-api/object.rst:294 +#: ../../c-api/object.rst:408 msgid "" "The return type is now Py_hash_t. This is a signed integer the same size " "as :c:type:`Py_ssize_t`." msgstr "" -#: ../../c-api/object.rst:301 +#: ../../c-api/object.rst:415 msgid "" "Set a :exc:`TypeError` indicating that ``type(o)`` is not :term:`hashable` " "and return ``-1``. This function receives special treatment when stored in a " @@ -344,21 +536,21 @@ msgid "" "that it is not hashable." msgstr "" -#: ../../c-api/object.rst:309 +#: ../../c-api/object.rst:423 msgid "" "Returns ``1`` if the object *o* is considered to be true, and ``0`` " "otherwise. This is equivalent to the Python expression ``not not o``. On " "failure, return ``-1``." msgstr "" -#: ../../c-api/object.rst:316 +#: ../../c-api/object.rst:430 msgid "" "Returns ``0`` if the object *o* is considered to be true, and ``1`` " "otherwise. This is equivalent to the Python expression ``not o``. On " "failure, return ``-1``." msgstr "" -#: ../../c-api/object.rst:325 +#: ../../c-api/object.rst:439 msgid "" "When *o* is non-``NULL``, returns a type object corresponding to the object " "type of object *o*. On failure, raises :exc:`SystemError` and returns " @@ -369,13 +561,13 @@ msgid "" "when a new :term:`strong reference` is needed." msgstr "" -#: ../../c-api/object.rst:337 +#: ../../c-api/object.rst:451 msgid "" "Return non-zero if the object *o* is of type *type* or a subtype of *type*, " "and ``0`` otherwise. Both parameters must be non-``NULL``." msgstr "" -#: ../../c-api/object.rst:346 +#: ../../c-api/object.rst:460 msgid "" "Return the length of object *o*. If the object *o* provides either the " "sequence and mapping protocols, the sequence length is returned. On error, " @@ -383,7 +575,7 @@ msgid "" "``len(o)``." msgstr "" -#: ../../c-api/object.rst:353 +#: ../../c-api/object.rst:467 msgid "" "Return an estimated length for the object *o*. First try to return its " "actual length, then an estimate using :meth:`~object.__length_hint__`, and " @@ -392,26 +584,26 @@ msgid "" "defaultvalue)``." msgstr "" -#: ../../c-api/object.rst:363 +#: ../../c-api/object.rst:477 msgid "" "Return element of *o* corresponding to the object *key* or ``NULL`` on " "failure. This is the equivalent of the Python expression ``o[key]``." msgstr "" -#: ../../c-api/object.rst:369 +#: ../../c-api/object.rst:483 msgid "" "Map the object *key* to the value *v*. Raise an exception and return ``-1`` " "on failure; return ``0`` on success. This is the equivalent of the Python " "statement ``o[key] = v``. This function *does not* steal a reference to *v*." msgstr "" -#: ../../c-api/object.rst:377 +#: ../../c-api/object.rst:491 msgid "" "Remove the mapping for the object *key* from the object *o*. Return ``-1`` " "on failure. This is equivalent to the Python statement ``del o[key]``." msgstr "" -#: ../../c-api/object.rst:383 +#: ../../c-api/object.rst:497 msgid "" "This is equivalent to the Python expression ``dir(o)``, returning a " "(possibly empty) list of strings appropriate for the object argument, or " @@ -421,7 +613,7 @@ msgid "" "`PyErr_Occurred` will return false." msgstr "" -#: ../../c-api/object.rst:392 +#: ../../c-api/object.rst:506 msgid "" "This is equivalent to the Python expression ``iter(o)``. It returns a new " "iterator for the object argument, or the object itself if the object is " @@ -429,7 +621,7 @@ msgid "" "object cannot be iterated." msgstr "" -#: ../../c-api/object.rst:400 +#: ../../c-api/object.rst:514 msgid "" "This is the equivalent to the Python expression ``aiter(o)``. Takes an :" "class:`AsyncIterable` object and returns an :class:`AsyncIterator` for it. " @@ -438,90 +630,104 @@ msgid "" "``NULL`` if the object cannot be iterated." msgstr "" -#: ../../c-api/object.rst:410 +#: ../../c-api/object.rst:524 msgid "Get a pointer to subclass-specific data reserved for *cls*." msgstr "" -#: ../../c-api/object.rst:412 +#: ../../c-api/object.rst:526 msgid "" "The object *o* must be an instance of *cls*, and *cls* must have been " "created using negative :c:member:`PyType_Spec.basicsize`. Python does not " "check this." msgstr "" -#: ../../c-api/object.rst:416 +#: ../../c-api/object.rst:530 msgid "On error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/object.rst:422 +#: ../../c-api/object.rst:536 msgid "" "Return the size of the instance memory space reserved for *cls*, i.e. the " "size of the memory :c:func:`PyObject_GetTypeData` returns." msgstr "" -#: ../../c-api/object.rst:425 +#: ../../c-api/object.rst:539 msgid "" "This may be larger than requested using :c:member:`-PyType_Spec.basicsize " "`; it is safe to use this larger size (e.g. with :c:" "func:`!memset`)." msgstr "" -#: ../../c-api/object.rst:428 +#: ../../c-api/object.rst:542 msgid "" "The type *cls* **must** have been created using negative :c:member:" "`PyType_Spec.basicsize`. Python does not check this." msgstr "" -#: ../../c-api/object.rst:432 +#: ../../c-api/object.rst:546 msgid "On error, set an exception and return a negative value." msgstr "" -#: ../../c-api/object.rst:438 +#: ../../c-api/object.rst:552 msgid "" "Get a pointer to per-item data for a class with :c:macro:" "`Py_TPFLAGS_ITEMS_AT_END`." msgstr "" -#: ../../c-api/object.rst:441 +#: ../../c-api/object.rst:555 msgid "" "On error, set an exception and return ``NULL``. :py:exc:`TypeError` is " "raised if *o* does not have :c:macro:`Py_TPFLAGS_ITEMS_AT_END` set." msgstr "" -#: ../../c-api/object.rst:201 ../../c-api/object.rst:213 -#: ../../c-api/object.rst:238 ../../c-api/object.rst:289 -#: ../../c-api/object.rst:323 ../../c-api/object.rst:344 +#: ../../c-api/object.rst:563 +msgid "Visit the managed dictionary of *obj*." +msgstr "" + +#: ../../c-api/object.rst:565 ../../c-api/object.rst:574 +msgid "" +"This function must only be called in a traverse function of the type which " +"has the :c:macro:`Py_TPFLAGS_MANAGED_DICT` flag set." +msgstr "" + +#: ../../c-api/object.rst:572 +msgid "Clear the managed dictionary of *obj*." +msgstr "" + +#: ../../c-api/object.rst:315 ../../c-api/object.rst:327 +#: ../../c-api/object.rst:352 ../../c-api/object.rst:403 +#: ../../c-api/object.rst:437 ../../c-api/object.rst:458 msgid "built-in function" msgstr "bulit-in function(內建函式)" -#: ../../c-api/object.rst:201 +#: ../../c-api/object.rst:315 msgid "repr" msgstr "repr" -#: ../../c-api/object.rst:213 +#: ../../c-api/object.rst:327 msgid "ascii" msgstr "ascii" -#: ../../c-api/object.rst:221 +#: ../../c-api/object.rst:335 msgid "string" msgstr "string(字串)" -#: ../../c-api/object.rst:221 +#: ../../c-api/object.rst:335 msgid "PyObject_Str (C function)" msgstr "PyObject_Str(C 函式)" -#: ../../c-api/object.rst:238 +#: ../../c-api/object.rst:352 msgid "bytes" msgstr "bytes(位元組)" -#: ../../c-api/object.rst:289 +#: ../../c-api/object.rst:403 msgid "hash" msgstr "hash(雜湊)" -#: ../../c-api/object.rst:323 +#: ../../c-api/object.rst:437 msgid "type" msgstr "type(型別)" -#: ../../c-api/object.rst:344 +#: ../../c-api/object.rst:458 msgid "len" msgstr "len" diff --git a/c-api/objimpl.po b/c-api/objimpl.po index 7ae527d6fb..0958041469 100644 --- a/c-api/objimpl.po +++ b/c-api/objimpl.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/c-api/perfmaps.po b/c-api/perfmaps.po index f46aea6a4b..6c8314aa43 100644 --- a/c-api/perfmaps.po +++ b/c-api/perfmaps.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-17 17:39+0800\n" "PO-Revision-Date: 2024-05-11 14:42+0800\n" @@ -45,8 +45,8 @@ msgid "" "In Python, these helper APIs can be used by libraries and features that rely " "on generating machine code on the fly." msgstr "" -"在 Python 中,這些輔助 API 可以被依賴於運行期間 (on the fly) 產生機器碼的函式庫和" -"功能所使用。" +"在 Python 中,這些輔助 API 可以被依賴於運行期間 (on the fly) 產生機器碼的函式" +"庫和功能所使用。" #: ../../c-api/perfmaps.rst:19 msgid "" diff --git a/c-api/refcounting.po b/c-api/refcounting.po index 301f66bcb9..d5cacea802 100644 --- a/c-api/refcounting.po +++ b/c-api/refcounting.po @@ -6,9 +6,9 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-08-06 14:19+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,14 +37,14 @@ msgstr "取得物件 *o* 的參照計數。" #: ../../c-api/refcounting.rst:18 msgid "" "Note that the returned value may not actually reflect how many references to " -"the object are actually held. For example, some objects are \"immortal\" " -"and have a very high refcount that does not reflect the actual number of " -"references. Consequently, do not rely on the returned value to be accurate, " -"other than a value of 0 or 1." +"the object are actually held. For example, some objects are :term:" +"`immortal` and have a very high refcount that does not reflect the actual " +"number of references. Consequently, do not rely on the returned value to be " +"accurate, other than a value of 0 or 1." msgstr "" "請注意,回傳的值可能實際上並不反映實際保存了多少對該物件的參照。例如,某些物" -"件是「不滅的 (immortal)」,並且具有非常高的參照計數,不能反映實際的參照數量。" -"因此,除了 0 或 1 以外,不要依賴回傳值的準確性。" +"件是「\\ :term:`不滅的 (immortal) `\\ 」,並且具有非常高的參照計" +"數,不能反映實際的參照數量。因此,除了 0 或 1 以外,不要依賴回傳值的準確性。" #: ../../c-api/refcounting.rst:24 msgid "" @@ -65,18 +65,21 @@ msgstr "設定物件 *o* 的參照計數。" #: ../../c-api/refcounting.rst:37 msgid "" -"Note that this function has no effect on `immortal `_ objects." +"On :ref:`Python build with Free Threading `, if " +"*refcnt* is larger than ``UINT32_MAX``, the object is made :term:`immortal`." msgstr "" -"請注意,此函式對\\ `不滅的 `_\\ 物件沒有影" -"響。" -#: ../../c-api/refcounting.rst:43 ../../c-api/refcounting.rst:65 -#: ../../c-api/refcounting.rst:142 +#: ../../c-api/refcounting.rst:40 ../../c-api/refcounting.rst:53 +#: ../../c-api/refcounting.rst:119 +msgid "This function has no effect on :term:`immortal` objects." +msgstr "請注意,此函式對\\ :term:`不滅的 `\\ 物件沒有影響。" + +#: ../../c-api/refcounting.rst:44 ../../c-api/refcounting.rst:68 +#: ../../c-api/refcounting.rst:147 msgid "Immortal objects are not modified." msgstr "不滅的物件不會被修改。" -#: ../../c-api/refcounting.rst:49 +#: ../../c-api/refcounting.rst:50 msgid "" "Indicate taking a new :term:`strong reference` to object *o*, indicating it " "is in use and should not be destroyed." @@ -84,7 +87,7 @@ msgstr "" "代表取得對於物件 *o* 的新\\ :term:`強參照 `,即它正在使用且" "不應被銷毀。" -#: ../../c-api/refcounting.rst:52 +#: ../../c-api/refcounting.rst:55 msgid "" "This function is usually used to convert a :term:`borrowed reference` to a :" "term:`strong reference` in-place. The :c:func:`Py_NewRef` function can be " @@ -94,11 +97,11 @@ msgstr "" "換為\\ :term:`強參照 `。:c:func:`Py_NewRef` 函式可用於建立" "新的\\ :term:`強參照 `。" -#: ../../c-api/refcounting.rst:56 -msgid "When done using the object, release it by calling :c:func:`Py_DECREF`." +#: ../../c-api/refcounting.rst:59 +msgid "When done using the object, release is by calling :c:func:`Py_DECREF`." msgstr "使用完該物件後,透過呼叫 :c:func:`Py_DECREF` 來釋放它。" -#: ../../c-api/refcounting.rst:58 +#: ../../c-api/refcounting.rst:61 msgid "" "The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, " "use :c:func:`Py_XINCREF`." @@ -106,7 +109,7 @@ msgstr "" "該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請使用 :c:func:" "`Py_XINCREF`。" -#: ../../c-api/refcounting.rst:61 +#: ../../c-api/refcounting.rst:64 msgid "" "Do not expect this function to actually modify *o* in any way. For at least :" "pep:`some objects <0683>`, this function has no effect." @@ -114,7 +117,7 @@ msgstr "" "不要期望此函式會以任何方式實際修改 *o*,至少對於\\ :pep:`某些物件 <0683>`\\ " "來說,此函式沒有任何效果。" -#: ../../c-api/refcounting.rst:71 +#: ../../c-api/refcounting.rst:74 msgid "" "Similar to :c:func:`Py_INCREF`, but the object *o* can be ``NULL``, in which " "case this has no effect." @@ -122,11 +125,11 @@ msgstr "" "與 :c:func:`Py_INCREF` 類似,但物件 *o* 可以為 ``NULL``,在這種情況下這就不會" "有任何效果。" -#: ../../c-api/refcounting.rst:74 +#: ../../c-api/refcounting.rst:77 msgid "See also :c:func:`Py_XNewRef`." msgstr "另請見 :c:func:`Py_XNewRef`。" -#: ../../c-api/refcounting.rst:79 +#: ../../c-api/refcounting.rst:82 msgid "" "Create a new :term:`strong reference` to an object: call :c:func:`Py_INCREF` " "on *o* and return the object *o*." @@ -134,7 +137,7 @@ msgstr "" "建立對物件的新\\ :term:`強參照 `:於 *o* 呼叫 :c:func:" "`Py_INCREF` 並回傳物件 *o*。" -#: ../../c-api/refcounting.rst:82 +#: ../../c-api/refcounting.rst:85 msgid "" "When the :term:`strong reference` is no longer needed, :c:func:`Py_DECREF` " "should be called on it to release the reference." @@ -142,7 +145,7 @@ msgstr "" "當不再需要\\ :term:`強參照 `\\ 時,應對其呼叫 :c:func:" "`Py_DECREF` 以釋放該參照。" -#: ../../c-api/refcounting.rst:85 +#: ../../c-api/refcounting.rst:88 msgid "" "The object *o* must not be ``NULL``; use :c:func:`Py_XNewRef` if *o* can be " "``NULL``." @@ -150,11 +153,11 @@ msgstr "" "物件 *o* 不能為 ``NULL``;如果 *o* 可以為 ``NULL``,則使用 :c:func:" "`Py_XNewRef`。" -#: ../../c-api/refcounting.rst:88 +#: ../../c-api/refcounting.rst:91 msgid "For example::" msgstr "舉例來說: ::" -#: ../../c-api/refcounting.rst:90 +#: ../../c-api/refcounting.rst:93 msgid "" "Py_INCREF(obj);\n" "self->attr = obj;" @@ -162,27 +165,27 @@ msgstr "" "Py_INCREF(obj);\n" "self->attr = obj;" -#: ../../c-api/refcounting.rst:93 +#: ../../c-api/refcounting.rst:96 msgid "can be written as::" msgstr "可以寫成: ::" -#: ../../c-api/refcounting.rst:95 +#: ../../c-api/refcounting.rst:98 msgid "self->attr = Py_NewRef(obj);" msgstr "self->attr = Py_NewRef(obj);" -#: ../../c-api/refcounting.rst:97 +#: ../../c-api/refcounting.rst:100 msgid "See also :c:func:`Py_INCREF`." msgstr "另請參閱 :c:func:`Py_INCREF`。" -#: ../../c-api/refcounting.rst:104 +#: ../../c-api/refcounting.rst:107 msgid "Similar to :c:func:`Py_NewRef`, but the object *o* can be NULL." msgstr "與 :c:func:`Py_NewRef` 類似,但物件 *o* 可以為 NULL。" -#: ../../c-api/refcounting.rst:106 +#: ../../c-api/refcounting.rst:109 msgid "If the object *o* is ``NULL``, the function just returns ``NULL``." msgstr "如果物件 *o* 為 ``NULL``,則該函式僅回傳 ``NULL``。" -#: ../../c-api/refcounting.rst:113 +#: ../../c-api/refcounting.rst:116 msgid "" "Release a :term:`strong reference` to object *o*, indicating the reference " "is no longer used." @@ -190,7 +193,7 @@ msgstr "" "釋放一個對物件 *o* 的\\ :term:`強參照 `,代表該參照不會再被" "使用。" -#: ../../c-api/refcounting.rst:116 +#: ../../c-api/refcounting.rst:121 msgid "" "Once the last :term:`strong reference` is released (i.e. the object's " "reference count reaches 0), the object's type's deallocation function (which " @@ -200,14 +203,14 @@ msgstr "" "到零),則觸發物件之型別的釋放函式 (deallocation function)(不得為 " "``NULL``\\ )。" -#: ../../c-api/refcounting.rst:121 +#: ../../c-api/refcounting.rst:126 msgid "" "This function is usually used to delete a :term:`strong reference` before " "exiting its scope." msgstr "" "此函式通常用於在退出作用域之前刪除\\ :term:`強參照 `。" -#: ../../c-api/refcounting.rst:124 +#: ../../c-api/refcounting.rst:129 msgid "" "The object must not be ``NULL``; if you aren't sure that it isn't ``NULL``, " "use :c:func:`Py_XDECREF`." @@ -215,7 +218,7 @@ msgstr "" "該物件不能為 ``NULL``;如果你不確定它不是 ``NULL``,請改用 :c:func:" "`Py_XDECREF`。" -#: ../../c-api/refcounting.rst:127 +#: ../../c-api/refcounting.rst:132 msgid "" "Do not expect this function to actually modify *o* in any way. For at least :" "pep:`some objects <683>`, this function has no effect." @@ -223,7 +226,7 @@ msgstr "" "不要期望此函式會以任何方式實際修改 *o*,至少對於\\ :pep:`某些物件 <683>`\\ 來" "說,此函式沒有任何效果。" -#: ../../c-api/refcounting.rst:133 +#: ../../c-api/refcounting.rst:138 msgid "" "The deallocation function can cause arbitrary Python code to be invoked (e." "g. when a class instance with a :meth:`~object.__del__` method is " @@ -242,7 +245,7 @@ msgstr "" "式碼應將已刪除物件的參照複製到臨時變數中,更新 list 資料結構,然後為臨時變數" "呼叫 :c:func:`Py_DECREF`。" -#: ../../c-api/refcounting.rst:148 +#: ../../c-api/refcounting.rst:153 msgid "" "Similar to :c:func:`Py_DECREF`, but the object *o* can be ``NULL``, in which " "case this has no effect. The same warning from :c:func:`Py_DECREF` applies " @@ -251,7 +254,7 @@ msgstr "" "和 :c:func:`Py_DECREF` 類似,但該物件可以是 ``NULL``,在這種情況下巨集不起作" "用。在這裡也會出現與 :c:func:`Py_DECREF` 相同的警告。" -#: ../../c-api/refcounting.rst:155 +#: ../../c-api/refcounting.rst:160 msgid "" "Release a :term:`strong reference` for object *o*. The object may be " "``NULL``, in which case the macro has no effect; otherwise the effect is the " @@ -265,7 +268,7 @@ msgstr "" "非引數也設定為 ``NULL``。:c:func:`Py_DECREF` 的警告不適用於傳遞的物件,因為巨" "集在釋放其參照之前小心地使用臨時變數並將引數設定為 ``NULL``。" -#: ../../c-api/refcounting.rst:163 +#: ../../c-api/refcounting.rst:168 msgid "" "It is a good idea to use this macro whenever releasing a reference to an " "object that might be traversed during garbage collection." @@ -273,7 +276,7 @@ msgstr "" "每當要釋放垃圾回收 (garbage collection) 期間可能被遍歷到之對於物件的參照時," "使用此巨集是個好主意。" -#: ../../c-api/refcounting.rst:166 +#: ../../c-api/refcounting.rst:171 msgid "" "The macro argument is now only evaluated once. If the argument has side " "effects, these are no longer duplicated." @@ -281,7 +284,7 @@ msgstr "" "巨集引數現在僅會被求值 (evaluate) 一次。如果引數有其他副作用,則不再重複作" "用。" -#: ../../c-api/refcounting.rst:173 +#: ../../c-api/refcounting.rst:178 msgid "" "Indicate taking a new :term:`strong reference` to object *o*. A function " "version of :c:func:`Py_XINCREF`. It can be used for runtime dynamic " @@ -290,7 +293,7 @@ msgstr "" "代表取得對於物件 *o* 的\\ :term:`強參照 `。:c:func:" "`Py_XINCREF` 的函式版本。它可用於 Python 的 runtime 動態嵌入。" -#: ../../c-api/refcounting.rst:180 +#: ../../c-api/refcounting.rst:185 msgid "" "Release a :term:`strong reference` to object *o*. A function version of :c:" "func:`Py_XDECREF`. It can be used for runtime dynamic embedding of Python." @@ -298,7 +301,7 @@ msgstr "" "釋放對物件 *o* 的\\ :term:`強參照 `。:c:func:`Py_XDECREF` " "的函式版本。它可用於 Python 的 runtime 動態嵌入。" -#: ../../c-api/refcounting.rst:187 +#: ../../c-api/refcounting.rst:192 msgid "" "Macro safely releasing a :term:`strong reference` to object *dst* and " "setting *dst* to *src*." @@ -306,11 +309,11 @@ msgstr "" "巨集安全地釋放對於物件 *dst* 的\\ :term:`強參照 `\\ 並將 " "*dst* 設定為 *src*。" -#: ../../c-api/refcounting.rst:190 +#: ../../c-api/refcounting.rst:195 msgid "As in case of :c:func:`Py_CLEAR`, \"the obvious\" code can be deadly::" msgstr "與 :c:func:`Py_CLEAR` 的情況一樣,「明顯的」程式碼可能是致命的: ::" -#: ../../c-api/refcounting.rst:192 +#: ../../c-api/refcounting.rst:197 msgid "" "Py_DECREF(dst);\n" "dst = src;" @@ -318,15 +321,15 @@ msgstr "" "Py_DECREF(dst);\n" "dst = src;" -#: ../../c-api/refcounting.rst:195 +#: ../../c-api/refcounting.rst:200 msgid "The safe way is::" msgstr "安全的方法是: ::" -#: ../../c-api/refcounting.rst:197 +#: ../../c-api/refcounting.rst:202 msgid "Py_SETREF(dst, src);" msgstr "Py_SETREF(dst, src);" -#: ../../c-api/refcounting.rst:199 +#: ../../c-api/refcounting.rst:204 msgid "" "That arranges to set *dst* to *src* _before_ releasing the reference to the " "old value of *dst*, so that any code triggered as a side-effect of *dst* " @@ -336,13 +339,13 @@ msgstr "" "被拆除而觸發的任何副作用 (side-effect) 之程式碼不會相信 *dst* 是指向一個有效" "物件。" -#: ../../c-api/refcounting.rst:206 ../../c-api/refcounting.rst:218 +#: ../../c-api/refcounting.rst:211 ../../c-api/refcounting.rst:223 msgid "" "The macro arguments are now only evaluated once. If an argument has side " "effects, these are no longer duplicated." msgstr "巨集引數現在僅會被求值一次。如果引數有其他副作用,則不再重複作用。" -#: ../../c-api/refcounting.rst:213 +#: ../../c-api/refcounting.rst:218 msgid "" "Variant of :c:macro:`Py_SETREF` macro that uses :c:func:`Py_XDECREF` instead " "of :c:func:`Py_DECREF`." diff --git a/c-api/reflection.po b/c-api/reflection.po index 38e3cc09e9..6854e16e93 100644 --- a/c-api/reflection.po +++ b/c-api/reflection.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,41 +22,103 @@ msgstr "" msgid "Reflection" msgstr "" -#: ../../c-api/reflection.rst:10 +#: ../../c-api/reflection.rst:12 +msgid "Use :c:func:`PyEval_GetFrameBuiltins` instead." +msgstr "" + +#: ../../c-api/reflection.rst:14 ../../c-api/reflection.rst:66 msgid "" "Return a dictionary of the builtins in the current execution frame, or the " "interpreter of the thread state if no frame is currently executing." msgstr "" -#: ../../c-api/reflection.rst:16 +#: ../../c-api/reflection.rst:22 msgid "" -"Return a dictionary of the local variables in the current execution frame, " -"or ``NULL`` if no frame is currently executing." +"Use either :c:func:`PyEval_GetFrameLocals` to obtain the same behaviour as " +"calling :func:`locals` in Python code, or else call :c:func:" +"`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame` to access " +"the :attr:`~frame.f_locals` attribute of the currently executing frame." msgstr "" -#: ../../c-api/reflection.rst:22 +#: ../../c-api/reflection.rst:27 +msgid "" +"Return a mapping providing access to the local variables in the current " +"execution frame, or ``NULL`` if no frame is currently executing." +msgstr "" + +#: ../../c-api/reflection.rst:30 +msgid "" +"Refer to :func:`locals` for details of the mapping returned at different " +"scopes." +msgstr "" + +#: ../../c-api/reflection.rst:32 +msgid "" +"As this function returns a :term:`borrowed reference`, the dictionary " +"returned for :term:`optimized scopes ` is cached on the " +"frame object and will remain alive as long as the frame object does. Unlike :" +"c:func:`PyEval_GetFrameLocals` and :func:`locals`, subsequent calls to this " +"function in the same frame will update the contents of the cached dictionary " +"to reflect changes in the state of the local variables rather than returning " +"a new snapshot." +msgstr "" + +#: ../../c-api/reflection.rst:39 +msgid "" +"As part of :pep:`667`, :c:func:`PyFrame_GetLocals`, :func:`locals`, and :" +"attr:`FrameType.f_locals ` no longer make use of the shared " +"cache dictionary. Refer to the :ref:`What's New entry ` for additional details." +msgstr "" + +#: ../../c-api/reflection.rst:50 +msgid "Use :c:func:`PyEval_GetFrameGlobals` instead." +msgstr "" + +#: ../../c-api/reflection.rst:52 msgid "" "Return a dictionary of the global variables in the current execution frame, " "or ``NULL`` if no frame is currently executing." msgstr "" -#: ../../c-api/reflection.rst:28 +#: ../../c-api/reflection.rst:58 msgid "" "Return the current thread state's frame, which is ``NULL`` if no frame is " "currently executing." msgstr "" -#: ../../c-api/reflection.rst:31 +#: ../../c-api/reflection.rst:61 msgid "See also :c:func:`PyThreadState_GetFrame`." msgstr "另請見 :c:func:`PyThreadState_GetFrame`。" -#: ../../c-api/reflection.rst:36 +#: ../../c-api/reflection.rst:74 +msgid "" +"Return a dictionary of the local variables in the current execution frame, " +"or ``NULL`` if no frame is currently executing. Equivalent to calling :func:" +"`locals` in Python code." +msgstr "" + +#: ../../c-api/reflection.rst:78 +msgid "" +"To access :attr:`~frame.f_locals` on the current frame without making an " +"independent snapshot in :term:`optimized scopes `, call :c:" +"func:`PyFrame_GetLocals` on the result of :c:func:`PyEval_GetFrame`." +msgstr "" + +#: ../../c-api/reflection.rst:87 +msgid "" +"Return a dictionary of the global variables in the current execution frame, " +"or ``NULL`` if no frame is currently executing. Equivalent to calling :func:" +"`globals` in Python code." +msgstr "" + +#: ../../c-api/reflection.rst:96 msgid "" "Return the name of *func* if it is a function, class or instance object, " "else the name of *func*\\s type." msgstr "" -#: ../../c-api/reflection.rst:42 +#: ../../c-api/reflection.rst:102 msgid "" "Return a description string, depending on the type of *func*. Return values " "include \"()\" for functions and methods, \" constructor\", \" instance\", " diff --git a/c-api/sequence.po b/c-api/sequence.po index c321e9b980..edb70e4c6f 100644 --- a/c-api/sequence.po +++ b/c-api/sequence.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-24 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:32+0000\n" diff --git a/c-api/set.po b/c-api/set.po index 0a6f16c6ba..e094b1ee32 100644 --- a/c-api/set.po +++ b/c-api/set.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-11-27 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" diff --git a/c-api/slice.po b/c-api/slice.po index 4c70f299c0..a2b3dbc7a7 100644 --- a/c-api/slice.po +++ b/c-api/slice.po @@ -6,9 +6,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -161,10 +161,9 @@ msgstr "" #: ../../c-api/slice.rst:123 msgid "" "The Python ``Ellipsis`` object. This object has no methods. Like :c:data:" -"`Py_None`, it is an `immortal `_. " -"singleton object." +"`Py_None`, it is an :term:`immortal` singleton object." msgstr "" -#: ../../c-api/slice.rst:127 +#: ../../c-api/slice.rst:126 msgid ":c:data:`Py_Ellipsis` is immortal." msgstr ":c:data:`Py_Ellipsis` 為不滅的 (immortal)。" diff --git a/c-api/stable.po b/c-api/stable.po index 3bd34e00be..919634426e 100644 --- a/c-api/stable.po +++ b/c-api/stable.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-01-19 00:03+0000\n" "PO-Revision-Date: 2023-01-24 21:07+0800\n" diff --git a/c-api/structures.po b/c-api/structures.po index e46450f6bc..76d856ee90 100644 --- a/c-api/structures.po +++ b/c-api/structures.po @@ -5,9 +5,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -241,10 +241,11 @@ msgid "" msgstr "" #: ../../c-api/structures.rst:196 +#, fuzzy msgid "" -"PyObject *_PyCFunctionFast(PyObject *self,\n" -" PyObject *const *args,\n" -" Py_ssize_t nargs);" +"PyObject *PyCFunctionFast(PyObject *self,\n" +" PyObject *const *args,\n" +" Py_ssize_t nargs);" msgstr "" "PyObject *_PyCFunctionFast(PyObject *self,\n" " PyObject *const *args,\n" @@ -258,11 +259,12 @@ msgid "" msgstr "" #: ../../c-api/structures.rst:206 +#, fuzzy msgid "" -"PyObject *_PyCFunctionFastWithKeywords(PyObject *self,\n" -" PyObject *const *args,\n" -" Py_ssize_t nargs,\n" -" PyObject *kwnames);" +"PyObject *PyCFunctionFastWithKeywords(PyObject *self,\n" +" PyObject *const *args,\n" +" Py_ssize_t nargs,\n" +" PyObject *kwnames);" msgstr "" "PyObject *_PyCFunctionFastWithKeywords(PyObject *self,\n" " PyObject *const *args,\n" @@ -368,7 +370,7 @@ msgstr "" #: ../../c-api/structures.rst:292 msgid "" "Fast calling convention supporting only positional arguments. The methods " -"have the type :c:type:`_PyCFunctionFast`. The first parameter is *self*, the " +"have the type :c:type:`PyCFunctionFast`. The first parameter is *self*, the " "second parameter is a C array of :c:expr:`PyObject*` values indicating the " "arguments and the third parameter is the number of arguments (the length of " "the array)." @@ -385,7 +387,7 @@ msgstr ":c:expr:`METH_FASTCALL | METH_KEYWORDS`" #: ../../c-api/structures.rst:308 msgid "" "Extension of :c:macro:`METH_FASTCALL` supporting also keyword arguments, " -"with methods of type :c:type:`_PyCFunctionFastWithKeywords`. Keyword " +"with methods of type :c:type:`PyCFunctionFastWithKeywords`. Keyword " "arguments are passed the same way as in the :ref:`vectorcall protocol " "`: there is an additional fourth :c:expr:`PyObject*` parameter " "which is a tuple representing the names of the keyword arguments (which are " diff --git a/c-api/sys.po b/c-api/sys.po index 8508ebc7fe..5fa011518f 100644 --- a/c-api/sys.po +++ b/c-api/sys.po @@ -8,9 +8,9 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-04 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -282,54 +282,17 @@ msgid "" "prior to :c:func:`Py_Initialize`." msgstr "" -#: ../../c-api/sys.rst:247 ../../c-api/sys.rst:258 -msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"warnoptions` should be used instead, see :ref:`Python Initialization " -"Configuration `." -msgstr "" - -#: ../../c-api/sys.rst:251 -msgid "" -"Append *s* to :data:`sys.warnoptions`. This function must be called prior " -"to :c:func:`Py_Initialize` in order to affect the warnings filter list." -msgstr "" - -#: ../../c-api/sys.rst:262 -msgid "Append *unicode* to :data:`sys.warnoptions`." +#: ../../c-api/sys.rst:245 +msgid "Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead." msgstr "" -#: ../../c-api/sys.rst:264 -msgid "" -"Note: this function is not currently usable from outside the CPython " -"implementation, as it must be called prior to the implicit import of :mod:" -"`warnings` in :c:func:`Py_Initialize` to be effective, but can't be called " -"until enough of the runtime has been initialized to permit the creation of " -"Unicode objects." -msgstr "" - -#: ../../c-api/sys.rst:274 -msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"module_search_paths` and :c:member:`PyConfig.module_search_paths_set` should " -"be used instead, see :ref:`Python Initialization Configuration `." -msgstr "" - -#: ../../c-api/sys.rst:279 -msgid "" -"Set :data:`sys.path` to a list object of paths found in *path* which should " -"be a list of paths separated with the platform's search path delimiter (``:" -"`` on Unix, ``;`` on Windows)." -msgstr "" - -#: ../../c-api/sys.rst:287 +#: ../../c-api/sys.rst:250 msgid "" "Write the output string described by *format* to :data:`sys.stdout`. No " "exceptions are raised, even if truncation occurs (see below)." msgstr "" -#: ../../c-api/sys.rst:290 +#: ../../c-api/sys.rst:253 msgid "" "*format* should limit the total size of the formatted output string to 1000 " "bytes or less -- after 1000 bytes, the output string is truncated. In " @@ -340,85 +303,89 @@ msgid "" "of digits for very large numbers." msgstr "" -#: ../../c-api/sys.rst:298 +#: ../../c-api/sys.rst:261 msgid "" "If a problem occurs, or :data:`sys.stdout` is unset, the formatted message " "is written to the real (C level) *stdout*." msgstr "" -#: ../../c-api/sys.rst:303 +#: ../../c-api/sys.rst:266 msgid "" "As :c:func:`PySys_WriteStdout`, but write to :data:`sys.stderr` or *stderr* " "instead." msgstr "" -#: ../../c-api/sys.rst:308 +#: ../../c-api/sys.rst:271 msgid "" "Function similar to PySys_WriteStdout() but format the message using :c:func:" "`PyUnicode_FromFormatV` and don't truncate the message to an arbitrary " "length." msgstr "" -#: ../../c-api/sys.rst:316 +#: ../../c-api/sys.rst:279 msgid "" "As :c:func:`PySys_FormatStdout`, but write to :data:`sys.stderr` or *stderr* " "instead." msgstr "" -#: ../../c-api/sys.rst:323 -msgid "" -"This API is kept for backward compatibility: setting :c:member:`PyConfig." -"xoptions` should be used instead, see :ref:`Python Initialization " -"Configuration `." -msgstr "" - -#: ../../c-api/sys.rst:327 -msgid "" -"Parse *s* as a set of :option:`-X` options and add them to the current " -"options mapping as returned by :c:func:`PySys_GetXOptions`. This function " -"may be called prior to :c:func:`Py_Initialize`." -msgstr "" - -#: ../../c-api/sys.rst:337 +#: ../../c-api/sys.rst:286 msgid "" "Return the current dictionary of :option:`-X` options, similarly to :data:" "`sys._xoptions`. On error, ``NULL`` is returned and an exception is set." msgstr "" -#: ../../c-api/sys.rst:346 +#: ../../c-api/sys.rst:295 msgid "" "Raise an auditing event with any active hooks. Return zero for success and " "non-zero with an exception set on failure." msgstr "" -#: ../../c-api/sys.rst:349 +#: ../../c-api/sys.rst:298 +msgid "The *event* string argument must not be *NULL*." +msgstr "" + +#: ../../c-api/sys.rst:300 msgid "" "If any hooks have been added, *format* and other arguments will be used to " "construct a tuple to pass. Apart from ``N``, the same format characters as " "used in :c:func:`Py_BuildValue` are available. If the built value is not a " -"tuple, it will be added into a single-element tuple. (The ``N`` format " -"option consumes a reference, but since there is no way to know whether " -"arguments to this function will be consumed, using it may cause reference " -"leaks.)" +"tuple, it will be added into a single-element tuple." +msgstr "" + +#: ../../c-api/sys.rst:305 +msgid "" +"The ``N`` format option must not be used. It consumes a reference, but since " +"there is no way to know whether arguments to this function will be consumed, " +"using it may cause reference leaks." msgstr "" -#: ../../c-api/sys.rst:357 +#: ../../c-api/sys.rst:309 msgid "" "Note that ``#`` format characters should always be treated as :c:type:" "`Py_ssize_t`, regardless of whether ``PY_SSIZE_T_CLEAN`` was defined." msgstr "" -#: ../../c-api/sys.rst:360 +#: ../../c-api/sys.rst:312 msgid ":func:`sys.audit` performs the same function from Python code." msgstr "" -#: ../../c-api/sys.rst:366 +#: ../../c-api/sys.rst:314 +msgid "See also :c:func:`PySys_AuditTuple`." +msgstr "" + +#: ../../c-api/sys.rst:320 msgid "" "Require :c:type:`Py_ssize_t` for ``#`` format characters. Previously, an " "unavoidable deprecation warning was raised." msgstr "" -#: ../../c-api/sys.rst:372 +#: ../../c-api/sys.rst:326 +msgid "" +"Similar to :c:func:`PySys_Audit`, but pass arguments as a Python object. " +"*args* must be a :class:`tuple`. To pass no arguments, *args* can be *NULL*." +msgstr "" + +#: ../../c-api/sys.rst:334 msgid "" "Append the callable *hook* to the list of active auditing hooks. Return zero " "on success and non-zero on failure. If the runtime has been initialized, " @@ -426,14 +393,14 @@ msgid "" "all interpreters created by the runtime." msgstr "" -#: ../../c-api/sys.rst:378 +#: ../../c-api/sys.rst:340 msgid "" "The *userData* pointer is passed into the hook function. Since hook " "functions may be called from different runtimes, this pointer should not " "refer directly to Python state." msgstr "" -#: ../../c-api/sys.rst:382 +#: ../../c-api/sys.rst:344 msgid "" "This function is safe to call before :c:func:`Py_Initialize`. When called " "after runtime initialization, existing audit hooks are notified and may " @@ -441,20 +408,20 @@ msgid "" "`Exception` (other errors will not be silenced)." msgstr "" -#: ../../c-api/sys.rst:387 +#: ../../c-api/sys.rst:349 msgid "" "The hook function is always called with the GIL held by the Python " "interpreter that raised the event." msgstr "" -#: ../../c-api/sys.rst:390 +#: ../../c-api/sys.rst:352 msgid "" "See :pep:`578` for a detailed description of auditing. Functions in the " "runtime and standard library that raise events are listed in the :ref:`audit " "events table `. Details are in each function's documentation." msgstr "" -#: ../../c-api/sys.rst:395 ../../c-api/sys.rst:397 +#: ../../c-api/sys.rst:357 ../../c-api/sys.rst:359 msgid "" "If the interpreter is initialized, this function raises an auditing event " "``sys.addaudithook`` with no arguments. If any existing hooks raise an " @@ -463,18 +430,19 @@ msgid "" "hook has been added unless they control all existing hooks." msgstr "" -#: ../../c-api/sys.rst:406 +#: ../../c-api/sys.rst:368 msgid "" "The type of the hook function. *event* is the C string event argument passed " -"to :c:func:`PySys_Audit`. *args* is guaranteed to be a :c:type:" -"`PyTupleObject`. *userData* is the argument passed to PySys_AddAuditHook()." +"to :c:func:`PySys_Audit` or :c:func:`PySys_AuditTuple`. *args* is guaranteed " +"to be a :c:type:`PyTupleObject`. *userData* is the argument passed to " +"PySys_AddAuditHook()." msgstr "" -#: ../../c-api/sys.rst:417 +#: ../../c-api/sys.rst:380 msgid "Process Control" msgstr "行程控制" -#: ../../c-api/sys.rst:424 +#: ../../c-api/sys.rst:387 msgid "" "Print a fatal error message and kill the process. No cleanup is performed. " "This function should only be invoked when a condition is detected that would " @@ -484,29 +452,29 @@ msgid "" "file:`core` file." msgstr "" -#: ../../c-api/sys.rst:431 +#: ../../c-api/sys.rst:394 msgid "" "The ``Py_FatalError()`` function is replaced with a macro which logs " "automatically the name of the current function, unless the " "``Py_LIMITED_API`` macro is defined." msgstr "" -#: ../../c-api/sys.rst:435 +#: ../../c-api/sys.rst:398 msgid "Log the function name automatically." msgstr "" -#: ../../c-api/sys.rst:445 +#: ../../c-api/sys.rst:408 msgid "" "Exit the current process. This calls :c:func:`Py_FinalizeEx` and then calls " "the standard C library function ``exit(status)``. If :c:func:" "`Py_FinalizeEx` indicates an error, the exit status is set to 120." msgstr "" -#: ../../c-api/sys.rst:449 +#: ../../c-api/sys.rst:412 msgid "Errors from finalization no longer ignored." msgstr "" -#: ../../c-api/sys.rst:459 +#: ../../c-api/sys.rst:422 msgid "" "Register a cleanup function to be called by :c:func:`Py_FinalizeEx`. The " "cleanup function will be called with no arguments and should return no " @@ -522,18 +490,18 @@ msgstr "" msgid "USE_STACKCHECK (C macro)" msgstr "USE_STACKCHECK(C 巨集)" -#: ../../c-api/sys.rst:422 +#: ../../c-api/sys.rst:385 msgid "abort (C function)" msgstr "abort(C 函式)" -#: ../../c-api/sys.rst:441 ../../c-api/sys.rst:455 +#: ../../c-api/sys.rst:404 ../../c-api/sys.rst:418 msgid "Py_FinalizeEx (C function)" msgstr "Py_FinalizeEx(C 函式)" -#: ../../c-api/sys.rst:441 +#: ../../c-api/sys.rst:404 msgid "exit (C function)" msgstr "exit(C 函式)" -#: ../../c-api/sys.rst:455 +#: ../../c-api/sys.rst:418 msgid "cleanup functions" msgstr "cleanup functions(清理函式)" diff --git a/c-api/time.po b/c-api/time.po new file mode 100644 index 0000000000..7636335954 --- /dev/null +++ b/c-api/time.po @@ -0,0 +1,167 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../c-api/time.rst:6 +msgid "PyTime C API" +msgstr "" + +#: ../../c-api/time.rst:10 +msgid "" +"The clock C API provides access to system clocks. It is similar to the " +"Python :mod:`time` module." +msgstr "" + +#: ../../c-api/time.rst:13 +msgid "" +"For C API related to the :mod:`datetime` module, see :ref:`datetimeobjects`." +msgstr "" + +#: ../../c-api/time.rst:17 +msgid "Types" +msgstr "" + +#: ../../c-api/time.rst:21 +msgid "" +"A timestamp or duration in nanoseconds, represented as a signed 64-bit " +"integer." +msgstr "" + +#: ../../c-api/time.rst:24 +msgid "" +"The reference point for timestamps depends on the clock used. For example, :" +"c:func:`PyTime_Time` returns timestamps relative to the UNIX epoch." +msgstr "" + +#: ../../c-api/time.rst:27 +msgid "" +"The supported range is around [-292.3 years; +292.3 years]. Using the Unix " +"epoch (January 1st, 1970) as reference, the supported date range is around " +"[1677-09-21; 2262-04-11]. The exact limits are exposed as constants:" +msgstr "" + +#: ../../c-api/time.rst:34 +msgid "Minimum value of :c:type:`PyTime_t`." +msgstr "" + +#: ../../c-api/time.rst:38 +msgid "Maximum value of :c:type:`PyTime_t`." +msgstr "" + +#: ../../c-api/time.rst:42 +msgid "Clock Functions" +msgstr "" + +#: ../../c-api/time.rst:44 +msgid "" +"The following functions take a pointer to a :c:expr:`PyTime_t` that they set " +"to the value of a particular clock. Details of each clock are given in the " +"documentation of the corresponding Python function." +msgstr "" + +#: ../../c-api/time.rst:49 +msgid "" +"The functions return ``0`` on success, or ``-1`` (with an exception set) on " +"failure." +msgstr "" + +#: ../../c-api/time.rst:52 +msgid "" +"On integer overflow, they set the :c:data:`PyExc_OverflowError` exception " +"and set ``*result`` to the value clamped to the ``[PyTime_MIN; PyTime_MAX]`` " +"range. (On current systems, integer overflows are likely caused by " +"misconfigured system time.)" +msgstr "" + +#: ../../c-api/time.rst:58 +msgid "" +"As any other C API (unless otherwise specified), the functions must be " +"called with the :term:`GIL` held." +msgstr "" + +#: ../../c-api/time.rst:63 +msgid "" +"Read the monotonic clock. See :func:`time.monotonic` for important details " +"on this clock." +msgstr "" + +#: ../../c-api/time.rst:68 +msgid "" +"Read the performance counter. See :func:`time.perf_counter` for important " +"details on this clock." +msgstr "" + +#: ../../c-api/time.rst:73 +msgid "" +"Read the “wall clock” time. See :func:`time.time` for details important on " +"this clock." +msgstr "" + +#: ../../c-api/time.rst:78 +msgid "Raw Clock Functions" +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 "" + +#: ../../c-api/time.rst:83 +msgid "On success, the functions return ``0``." +msgstr "" + +#: ../../c-api/time.rst:85 +msgid "" +"On failure, they set ``*result`` to ``0`` and return ``-1``, *without* " +"setting an exception. To get the cause of the error, acquire the GIL and " +"call the regular (non-``Raw``) function. Note that the regular function may " +"succeed after the ``Raw`` one failed." +msgstr "" + +#: ../../c-api/time.rst:92 +msgid "" +"Similar to :c:func:`PyTime_Monotonic`, but don't set an exception on error " +"and don't require holding the GIL." +msgstr "" + +#: ../../c-api/time.rst:97 +msgid "" +"Similar to :c:func:`PyTime_PerfCounter`, but don't set an exception on error " +"and don't require holding the GIL." +msgstr "" + +#: ../../c-api/time.rst:102 +msgid "" +"Similar to :c:func:`PyTime_Time`, but don't set an exception on error and " +"don't require holding the GIL." +msgstr "" + +#: ../../c-api/time.rst:107 +msgid "Conversion functions" +msgstr "" + +#: ../../c-api/time.rst:111 +msgid "Convert a timestamp to a number of seconds as a C :c:expr:`double`." +msgstr "" + +#: ../../c-api/time.rst:113 +msgid "" +"The function cannot fail, but note that :c:expr:`double` has limited " +"accuracy for large values." +msgstr "" diff --git a/c-api/tuple.po b/c-api/tuple.po index 0d201d62fa..3e5dbda024 100644 --- a/c-api/tuple.po +++ b/c-api/tuple.po @@ -6,9 +6,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-28 13:20+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -119,14 +119,21 @@ msgid "" "*only* be used to fill in brand new tuples." msgstr "" -#: ../../c-api/tuple.rst:104 +#: ../../c-api/tuple.rst:102 ../../c-api/tuple.rst:217 +#: ../../c-api/tuple.rst:235 +msgid "" +"Bounds checking is performed as an assertion if Python is built in :ref:" +"`debug mode ` or :option:`with assertions <--with-assertions>`." +msgstr "" + +#: ../../c-api/tuple.rst:107 msgid "" "This function \"steals\" a reference to *o*, and, unlike :c:func:" "`PyTuple_SetItem`, does *not* discard a reference to any item that is being " "replaced; any reference in the tuple at position *pos* will be leaked." msgstr "" -#: ../../c-api/tuple.rst:112 +#: ../../c-api/tuple.rst:115 msgid "" "Can be used to resize a tuple. *newsize* will be the new length of the " "tuple. Because tuples are *supposed* to be immutable, this should only be " @@ -141,11 +148,11 @@ msgid "" "`SystemError`." msgstr "" -#: ../../c-api/tuple.rst:127 +#: ../../c-api/tuple.rst:130 msgid "Struct Sequence Objects" msgstr "" -#: ../../c-api/tuple.rst:129 +#: ../../c-api/tuple.rst:132 msgid "" "Struct sequence objects are the C equivalent of :func:`~collections." "namedtuple` objects, i.e. a sequence whose items can also be accessed " @@ -153,48 +160,48 @@ msgid "" "specific struct sequence type." msgstr "" -#: ../../c-api/tuple.rst:136 +#: ../../c-api/tuple.rst:139 msgid "" "Create a new struct sequence type from the data in *desc*, described below. " "Instances of the resulting type can be created with :c:func:" "`PyStructSequence_New`." msgstr "" -#: ../../c-api/tuple.rst:139 ../../c-api/tuple.rst:207 +#: ../../c-api/tuple.rst:142 ../../c-api/tuple.rst:210 msgid "Return ``NULL`` with an exception set on failure." msgstr "" -#: ../../c-api/tuple.rst:144 +#: ../../c-api/tuple.rst:147 msgid "Initializes a struct sequence type *type* from *desc* in place." msgstr "" -#: ../../c-api/tuple.rst:149 +#: ../../c-api/tuple.rst:152 msgid "" "Like :c:func:`PyStructSequence_InitType`, but returns ``0`` on success and " "``-1`` with an exception set on failure." msgstr "" -#: ../../c-api/tuple.rst:157 +#: ../../c-api/tuple.rst:160 msgid "Contains the meta information of a struct sequence type to create." msgstr "" -#: ../../c-api/tuple.rst:161 +#: ../../c-api/tuple.rst:164 msgid "Name of the struct sequence type." msgstr "" -#: ../../c-api/tuple.rst:165 +#: ../../c-api/tuple.rst:168 msgid "Pointer to docstring for the type or ``NULL`` to omit." msgstr "" -#: ../../c-api/tuple.rst:169 +#: ../../c-api/tuple.rst:172 msgid "Pointer to ``NULL``-terminated array with field names of the new type." msgstr "" -#: ../../c-api/tuple.rst:173 +#: ../../c-api/tuple.rst:176 msgid "Number of fields visible to the Python side (if used as tuple)." msgstr "" -#: ../../c-api/tuple.rst:178 +#: ../../c-api/tuple.rst:181 msgid "" "Describes a field of a struct sequence. As a struct sequence is modeled as a " "tuple, all fields are typed as :c:expr:`PyObject*`. The index in the :c:" @@ -203,55 +210,60 @@ msgid "" "described." msgstr "" -#: ../../c-api/tuple.rst:186 +#: ../../c-api/tuple.rst:189 msgid "" "Name for the field or ``NULL`` to end the list of named fields, set to :c:" "data:`PyStructSequence_UnnamedField` to leave unnamed." msgstr "" -#: ../../c-api/tuple.rst:191 +#: ../../c-api/tuple.rst:194 msgid "Field docstring or ``NULL`` to omit." msgstr "" -#: ../../c-api/tuple.rst:196 +#: ../../c-api/tuple.rst:199 msgid "Special value for a field name to leave it unnamed." msgstr "" -#: ../../c-api/tuple.rst:198 +#: ../../c-api/tuple.rst:201 msgid "The type was changed from ``char *``." msgstr "" -#: ../../c-api/tuple.rst:204 +#: ../../c-api/tuple.rst:207 msgid "" "Creates an instance of *type*, which must have been created with :c:func:" "`PyStructSequence_NewType`." msgstr "" -#: ../../c-api/tuple.rst:212 +#: ../../c-api/tuple.rst:215 msgid "" -"Return the object at position *pos* in the struct sequence pointed to by " -"*p*. No bounds checking is performed." +"Return the object at position *pos* in the struct sequence pointed to by *p*." msgstr "" -#: ../../c-api/tuple.rst:218 -msgid "Macro equivalent of :c:func:`PyStructSequence_GetItem`." +#: ../../c-api/tuple.rst:223 +msgid "Alias to :c:func:`PyStructSequence_GetItem`." msgstr "" -#: ../../c-api/tuple.rst:223 +#: ../../c-api/tuple.rst:225 +msgid "Now implemented as an alias to :c:func:`PyStructSequence_GetItem`." +msgstr "" + +#: ../../c-api/tuple.rst:231 msgid "" "Sets the field at index *pos* of the struct sequence *p* to value *o*. " "Like :c:func:`PyTuple_SET_ITEM`, this should only be used to fill in brand " "new instances." msgstr "" -#: ../../c-api/tuple.rst:229 ../../c-api/tuple.rst:239 +#: ../../c-api/tuple.rst:240 msgid "This function \"steals\" a reference to *o*." msgstr "" -#: ../../c-api/tuple.rst:234 -msgid "" -"Similar to :c:func:`PyStructSequence_SetItem`, but implemented as a static " -"inlined function." +#: ../../c-api/tuple.rst:245 +msgid "Alias to :c:func:`PyStructSequence_SetItem`." +msgstr "" + +#: ../../c-api/tuple.rst:247 +msgid "Now implemented as an alias to :c:func:`PyStructSequence_SetItem`." msgstr "" #: ../../c-api/tuple.rst:8 diff --git a/c-api/type.po b/c-api/type.po index 9cfbf0a947..9ca76377b5 100644 --- a/c-api/type.po +++ b/c-api/type.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-10-14 00:03+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -65,32 +65,32 @@ msgstr "" #: ../../c-api/type.rst:55 msgid "" "Return the type object's internal namespace, which is otherwise only exposed " -"via a read-only proxy (``cls.__dict__``). This is a replacement for " -"accessing :c:member:`~PyTypeObject.tp_dict` directly. The returned " -"dictionary must be treated as read-only." +"via a read-only proxy (:attr:`cls.__dict__ `). This is a " +"replacement for accessing :c:member:`~PyTypeObject.tp_dict` directly. The " +"returned dictionary must be treated as read-only." msgstr "" -#: ../../c-api/type.rst:60 +#: ../../c-api/type.rst:61 msgid "" "This function is meant for specific embedding and language-binding cases, " "where direct access to the dict is necessary and indirect access (e.g. via " "the proxy or :c:func:`PyObject_GetAttr`) isn't adequate." msgstr "" -#: ../../c-api/type.rst:64 +#: ../../c-api/type.rst:65 msgid "" "Extension modules should continue to use ``tp_dict``, directly or " "indirectly, when setting up their own types." msgstr "" -#: ../../c-api/type.rst:72 +#: ../../c-api/type.rst:73 msgid "" "Invalidate the internal lookup cache for the type and all of its subtypes. " "This function must be called after any manual modification of the attributes " "or base classes of the type." msgstr "" -#: ../../c-api/type.rst:79 +#: ../../c-api/type.rst:80 msgid "" "Register *callback* as a type watcher. Return a non-negative integer ID " "which must be passed to future calls to :c:func:`PyType_Watch`. In case of " @@ -98,21 +98,21 @@ msgid "" "exception." msgstr "" -#: ../../c-api/type.rst:89 +#: ../../c-api/type.rst:90 msgid "" "Clear watcher identified by *watcher_id* (previously returned from :c:func:" "`PyType_AddWatcher`). Return ``0`` on success, ``-1`` on error (e.g. if " "*watcher_id* was never registered.)" msgstr "" -#: ../../c-api/type.rst:93 +#: ../../c-api/type.rst:94 msgid "" "An extension should never call ``PyType_ClearWatcher`` with a *watcher_id* " "that was not returned to it by a previous call to :c:func:" "`PyType_AddWatcher`." msgstr "" -#: ../../c-api/type.rst:102 +#: ../../c-api/type.rst:103 msgid "" "Mark *type* as watched. The callback granted *watcher_id* by :c:func:" "`PyType_AddWatcher` will be called whenever :c:func:`PyType_Modified` " @@ -122,61 +122,61 @@ msgid "" "detail and subject to change.)" msgstr "" -#: ../../c-api/type.rst:109 +#: ../../c-api/type.rst:110 msgid "" "An extension should never call ``PyType_Watch`` with a *watcher_id* that was " "not returned to it by a previous call to :c:func:`PyType_AddWatcher`." msgstr "" -#: ../../c-api/type.rst:117 +#: ../../c-api/type.rst:118 msgid "Type of a type-watcher callback function." msgstr "" -#: ../../c-api/type.rst:119 +#: ../../c-api/type.rst:120 msgid "" "The callback must not modify *type* or cause :c:func:`PyType_Modified` to be " "called on *type* or any type in its MRO; violating this rule could cause " "infinite recursion." msgstr "" -#: ../../c-api/type.rst:128 +#: ../../c-api/type.rst:129 msgid "" "Return non-zero if the type object *o* sets the feature *feature*. Type " "features are denoted by single bit flags." msgstr "" -#: ../../c-api/type.rst:134 +#: ../../c-api/type.rst:135 msgid "" "Return true if the type object includes support for the cycle detector; this " "tests the type flag :c:macro:`Py_TPFLAGS_HAVE_GC`." msgstr "" -#: ../../c-api/type.rst:140 +#: ../../c-api/type.rst:141 msgid "Return true if *a* is a subtype of *b*." msgstr "" -#: ../../c-api/type.rst:142 +#: ../../c-api/type.rst:143 msgid "" -"This function only checks for actual subtypes, which means that :meth:" -"`~class.__subclasscheck__` is not called on *b*. Call :c:func:" -"`PyObject_IsSubclass` to do the same check that :func:`issubclass` would do." +"This function only checks for actual subtypes, which means that :meth:`~type." +"__subclasscheck__` is not called on *b*. Call :c:func:`PyObject_IsSubclass` " +"to do the same check that :func:`issubclass` would do." msgstr "" -#: ../../c-api/type.rst:150 +#: ../../c-api/type.rst:151 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_alloc` slot of a type " "object. Use Python's default memory allocation mechanism to allocate a new " "instance and initialize all its contents to ``NULL``." msgstr "" -#: ../../c-api/type.rst:156 +#: ../../c-api/type.rst:157 msgid "" "Generic handler for the :c:member:`~PyTypeObject.tp_new` slot of a type " "object. Create a new instance using the type's :c:member:`~PyTypeObject." "tp_alloc` slot." msgstr "" -#: ../../c-api/type.rst:161 +#: ../../c-api/type.rst:162 msgid "" "Finalize a type object. This should be called on all type objects to finish " "their initialization. This function is responsible for adding inherited " @@ -184,7 +184,7 @@ msgid "" "and sets an exception on error." msgstr "" -#: ../../c-api/type.rst:167 +#: ../../c-api/type.rst:168 msgid "" "If some of the base classes implements the GC protocol and the provided type " "does not include the :c:macro:`Py_TPFLAGS_HAVE_GC` in its flags, then the GC " @@ -195,19 +195,32 @@ msgid "" "handle." msgstr "" -#: ../../c-api/type.rst:177 +#: ../../c-api/type.rst:178 msgid "" -"Return the type's name. Equivalent to getting the type's ``__name__`` " -"attribute." +"Return the type's name. Equivalent to getting the type's :attr:`~type." +"__name__` attribute." msgstr "" -#: ../../c-api/type.rst:183 +#: ../../c-api/type.rst:185 msgid "" -"Return the type's qualified name. Equivalent to getting the type's " -"``__qualname__`` attribute." +"Return the type's qualified name. Equivalent to getting the type's :attr:" +"`~type.__qualname__` attribute." msgstr "" -#: ../../c-api/type.rst:190 +#: ../../c-api/type.rst:192 +msgid "" +"Return the type's fully qualified name. Equivalent to ``f\"{type.__module__}." +"{type.__qualname__}\"``, or :attr:`type.__qualname__` if :attr:`type." +"__module__` is not a string or is equal to ``\"builtins\"``." +msgstr "" + +#: ../../c-api/type.rst:200 +msgid "" +"Return the type's module name. Equivalent to getting the :attr:`type." +"__module__` attribute." +msgstr "" + +#: ../../c-api/type.rst:207 msgid "" "Return the function pointer stored in the given slot. If the result is " "``NULL``, this indicates that either the slot is ``NULL``, or that the " @@ -215,30 +228,30 @@ msgid "" "result pointer into the appropriate function type." msgstr "" -#: ../../c-api/type.rst:196 +#: ../../c-api/type.rst:213 msgid "" "See :c:member:`PyType_Slot.slot` for possible values of the *slot* argument." msgstr "" -#: ../../c-api/type.rst:200 +#: ../../c-api/type.rst:217 msgid "" ":c:func:`PyType_GetSlot` can now accept all types. Previously, it was " "limited to :ref:`heap types `." msgstr "" -#: ../../c-api/type.rst:206 +#: ../../c-api/type.rst:223 msgid "" "Return the module object associated with the given type when the type was " "created using :c:func:`PyType_FromModuleAndSpec`." msgstr "" -#: ../../c-api/type.rst:209 ../../c-api/type.rst:229 +#: ../../c-api/type.rst:226 ../../c-api/type.rst:246 msgid "" "If no module is associated with the given type, sets :py:class:`TypeError` " "and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:212 +#: ../../c-api/type.rst:229 msgid "" "This function is usually used to get the module in which a method is " "defined. Note that in such a method, ``PyType_GetModule(Py_TYPE(self))`` may " @@ -249,31 +262,31 @@ msgid "" "type:`!PyCMethod` cannot be used." msgstr "" -#: ../../c-api/type.rst:225 +#: ../../c-api/type.rst:242 msgid "" "Return the state of the module object associated with the given type. This " "is a shortcut for calling :c:func:`PyModule_GetState()` on the result of :c:" "func:`PyType_GetModule`." msgstr "" -#: ../../c-api/type.rst:232 +#: ../../c-api/type.rst:249 msgid "" "If the *type* has an associated module but its state is ``NULL``, returns " "``NULL`` without setting an exception." msgstr "" -#: ../../c-api/type.rst:239 +#: ../../c-api/type.rst:256 msgid "" "Find the first superclass whose module was created from the given :c:type:" "`PyModuleDef` *def*, and return that module." msgstr "" -#: ../../c-api/type.rst:242 +#: ../../c-api/type.rst:259 msgid "" "If no module is found, raises a :py:class:`TypeError` and returns ``NULL``." msgstr "" -#: ../../c-api/type.rst:244 +#: ../../c-api/type.rst:261 msgid "" "This function is intended to be used together with :c:func:" "`PyModule_GetState()` to get module state from slot methods (such as :c:" @@ -282,40 +295,40 @@ msgid "" "type:`PyCMethod` calling convention." msgstr "" -#: ../../c-api/type.rst:254 +#: ../../c-api/type.rst:271 msgid "Attempt to assign a version tag to the given type." msgstr "" -#: ../../c-api/type.rst:256 +#: ../../c-api/type.rst:273 msgid "" "Returns 1 if the type already had a valid version tag or a new one was " "assigned, or 0 if a new tag could not be assigned." msgstr "" -#: ../../c-api/type.rst:263 +#: ../../c-api/type.rst:280 msgid "Creating Heap-Allocated Types" msgstr "" -#: ../../c-api/type.rst:265 +#: ../../c-api/type.rst:282 msgid "" "The following functions and structs are used to create :ref:`heap types " "`." msgstr "" -#: ../../c-api/type.rst:270 +#: ../../c-api/type.rst:287 msgid "" "Create and return a :ref:`heap type ` from the *spec* (see :c:" "macro:`Py_TPFLAGS_HEAPTYPE`)." msgstr "" -#: ../../c-api/type.rst:273 +#: ../../c-api/type.rst:290 msgid "" "The metaclass *metaclass* is used to construct the resulting type object. " "When *metaclass* is ``NULL``, the metaclass is derived from *bases* (or " "*Py_tp_base[s]* slots if *bases* is ``NULL``, see below)." msgstr "" -#: ../../c-api/type.rst:277 +#: ../../c-api/type.rst:294 msgid "" "Metaclasses that override :c:member:`~PyTypeObject.tp_new` are not " "supported, except if ``tp_new`` is ``NULL``. (For backwards compatibility, " @@ -324,7 +337,7 @@ msgid "" "deprecated and in Python 3.14+ such metaclasses will not be supported.)" msgstr "" -#: ../../c-api/type.rst:284 +#: ../../c-api/type.rst:301 msgid "" "The *bases* argument can be used to specify base classes; it can either be " "only one class or a tuple of classes. If *bases* is ``NULL``, the " @@ -333,7 +346,7 @@ msgid "" "derives from :class:`object`." msgstr "" -#: ../../c-api/type.rst:290 +#: ../../c-api/type.rst:307 msgid "" "The *module* argument can be used to record the module in which the new " "class is defined. It must be a module object or ``NULL``. If not ``NULL``, " @@ -342,11 +355,11 @@ msgid "" "subclasses; it must be specified for each class individually." msgstr "" -#: ../../c-api/type.rst:297 +#: ../../c-api/type.rst:314 msgid "This function calls :c:func:`PyType_Ready` on the new type." msgstr "" -#: ../../c-api/type.rst:299 +#: ../../c-api/type.rst:316 msgid "" "Note that this function does *not* fully match the behavior of calling :py:" "class:`type() ` or using the :keyword:`class` statement. With user-" @@ -355,41 +368,41 @@ msgid "" "Specifically:" msgstr "" -#: ../../c-api/type.rst:306 +#: ../../c-api/type.rst:323 msgid "" ":py:meth:`~object.__new__` is not called on the new class (and it must be " "set to ``type.__new__``)." msgstr "" -#: ../../c-api/type.rst:308 +#: ../../c-api/type.rst:325 msgid ":py:meth:`~object.__init__` is not called on the new class." msgstr "" -#: ../../c-api/type.rst:309 +#: ../../c-api/type.rst:326 msgid ":py:meth:`~object.__init_subclass__` is not called on any bases." msgstr "" -#: ../../c-api/type.rst:310 +#: ../../c-api/type.rst:327 msgid ":py:meth:`~object.__set_name__` is not called on new descriptors." msgstr "" -#: ../../c-api/type.rst:316 +#: ../../c-api/type.rst:333 msgid "Equivalent to ``PyType_FromMetaclass(NULL, module, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, module, spec, bases)``。" -#: ../../c-api/type.rst:322 +#: ../../c-api/type.rst:339 msgid "" "The function now accepts a single class as the *bases* argument and ``NULL`` " "as the ``tp_doc`` slot." msgstr "" -#: ../../c-api/type.rst:327 ../../c-api/type.rst:344 +#: ../../c-api/type.rst:344 ../../c-api/type.rst:361 msgid "" "The function now finds and uses a metaclass corresponding to the provided " "base classes. Previously, only :class:`type` instances were returned." msgstr "" -#: ../../c-api/type.rst:330 ../../c-api/type.rst:347 ../../c-api/type.rst:363 +#: ../../c-api/type.rst:347 ../../c-api/type.rst:364 ../../c-api/type.rst:380 msgid "" "The :c:member:`~PyTypeObject.tp_new` of the metaclass is *ignored*. which " "may result in incomplete initialization. Creating classes whose metaclass " @@ -397,42 +410,42 @@ msgid "" "it will be no longer allowed." msgstr "" -#: ../../c-api/type.rst:338 +#: ../../c-api/type.rst:355 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, bases)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, bases)``。" -#: ../../c-api/type.rst:355 +#: ../../c-api/type.rst:372 msgid "Equivalent to ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``." msgstr "等價於 ``PyType_FromMetaclass(NULL, NULL, spec, NULL)``。" -#: ../../c-api/type.rst:359 +#: ../../c-api/type.rst:376 msgid "" "The function now finds and uses a metaclass corresponding to the base " "classes provided in *Py_tp_base[s]* slots. Previously, only :class:`type` " "instances were returned." msgstr "" -#: ../../c-api/type.rst:380 +#: ../../c-api/type.rst:397 msgid "Structure defining a type's behavior." msgstr "" -#: ../../c-api/type.rst:384 +#: ../../c-api/type.rst:401 msgid "Name of the type, used to set :c:member:`PyTypeObject.tp_name`." msgstr "" -#: ../../c-api/type.rst:388 +#: ../../c-api/type.rst:405 msgid "" "If positive, specifies the size of the instance in bytes. It is used to set :" "c:member:`PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/type.rst:391 +#: ../../c-api/type.rst:408 msgid "" "If zero, specifies that :c:member:`~PyTypeObject.tp_basicsize` should be " "inherited." msgstr "" -#: ../../c-api/type.rst:394 +#: ../../c-api/type.rst:411 msgid "" "If negative, the absolute value specifies how much space instances of the " "class need *in addition* to the superclass. Use :c:func:" @@ -440,17 +453,17 @@ msgid "" "this way." msgstr "" -#: ../../c-api/type.rst:401 +#: ../../c-api/type.rst:418 msgid "Previously, this field could not be negative." msgstr "" -#: ../../c-api/type.rst:405 +#: ../../c-api/type.rst:422 msgid "" "Size of one element of a variable-size type, in bytes. Used to set :c:member:" "`PyTypeObject.tp_itemsize`. See ``tp_itemsize`` documentation for caveats." msgstr "" -#: ../../c-api/type.rst:409 +#: ../../c-api/type.rst:426 msgid "" "If zero, :c:member:`~PyTypeObject.tp_itemsize` is inherited. Extending " "arbitrary variable-sized classes is dangerous, since some types use a fixed " @@ -459,58 +472,58 @@ msgid "" "only possible in the following situations:" msgstr "" -#: ../../c-api/type.rst:416 +#: ../../c-api/type.rst:433 msgid "" "The base is not variable-sized (its :c:member:`~PyTypeObject.tp_itemsize`)." msgstr "" -#: ../../c-api/type.rst:418 +#: ../../c-api/type.rst:435 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is positive, suggesting that " "the memory layout of the base class is known." msgstr "" -#: ../../c-api/type.rst:420 +#: ../../c-api/type.rst:437 msgid "" "The requested :c:member:`PyType_Spec.basicsize` is zero, suggesting that the " "subclass does not access the instance's memory directly." msgstr "" -#: ../../c-api/type.rst:423 +#: ../../c-api/type.rst:440 msgid "With the :c:macro:`Py_TPFLAGS_ITEMS_AT_END` flag." msgstr "" -#: ../../c-api/type.rst:427 +#: ../../c-api/type.rst:444 msgid "Type flags, used to set :c:member:`PyTypeObject.tp_flags`." msgstr "" -#: ../../c-api/type.rst:429 +#: ../../c-api/type.rst:446 msgid "" "If the ``Py_TPFLAGS_HEAPTYPE`` flag is not set, :c:func:" "`PyType_FromSpecWithBases` sets it automatically." msgstr "" -#: ../../c-api/type.rst:434 +#: ../../c-api/type.rst:451 msgid "" "Array of :c:type:`PyType_Slot` structures. Terminated by the special slot " "value ``{0, NULL}``." msgstr "" -#: ../../c-api/type.rst:437 +#: ../../c-api/type.rst:454 msgid "Each slot ID should be specified at most once." msgstr "" -#: ../../c-api/type.rst:447 +#: ../../c-api/type.rst:464 msgid "" "Structure defining optional functionality of a type, containing a slot ID " "and a value pointer." msgstr "" -#: ../../c-api/type.rst:452 +#: ../../c-api/type.rst:469 msgid "A slot ID." msgstr "" -#: ../../c-api/type.rst:454 +#: ../../c-api/type.rst:471 msgid "" "Slot IDs are named like the field names of the structures :c:type:" "`PyTypeObject`, :c:type:`PyNumberMethods`, :c:type:`PySequenceMethods`, :c:" @@ -518,30 +531,30 @@ msgid "" "prefix. For example, use:" msgstr "" -#: ../../c-api/type.rst:460 +#: ../../c-api/type.rst:477 msgid "``Py_tp_dealloc`` to set :c:member:`PyTypeObject.tp_dealloc`" msgstr "" -#: ../../c-api/type.rst:461 +#: ../../c-api/type.rst:478 msgid "``Py_nb_add`` to set :c:member:`PyNumberMethods.nb_add`" msgstr "" -#: ../../c-api/type.rst:462 +#: ../../c-api/type.rst:479 msgid "``Py_sq_length`` to set :c:member:`PySequenceMethods.sq_length`" msgstr "" -#: ../../c-api/type.rst:464 +#: ../../c-api/type.rst:481 msgid "" "The following “offset” fields cannot be set using :c:type:`PyType_Slot`:" msgstr "" -#: ../../c-api/type.rst:466 +#: ../../c-api/type.rst:483 msgid "" ":c:member:`~PyTypeObject.tp_weaklistoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` instead if possible)" msgstr "" -#: ../../c-api/type.rst:468 +#: ../../c-api/type.rst:485 msgid "" ":c:member:`~PyTypeObject.tp_dictoffset` (use :c:macro:" "`Py_TPFLAGS_MANAGED_DICT` instead if possible)" @@ -549,7 +562,7 @@ msgstr "" ":c:member:`~PyTypeObject.tp_dictoffset`\\ (如果可能,請改用 :c:macro:" "`Py_TPFLAGS_MANAGED_DICT`)" -#: ../../c-api/type.rst:470 +#: ../../c-api/type.rst:487 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall_offset` (use " "``\"__vectorcalloffset__\"`` in :ref:`PyMemberDef `)" @@ -557,7 +570,7 @@ msgstr "" ":c:member:`~PyTypeObject.tp_vectorcall_offset`\\ (請用 :ref:`PyMemberDef " "` 中的 ``\"__vectorcalloffset__\"``)" -#: ../../c-api/type.rst:474 +#: ../../c-api/type.rst:491 msgid "" "If it is not possible to switch to a ``MANAGED`` flag (for example, for " "vectorcall or to support Python older than 3.12), specify the offset in :c:" @@ -565,48 +578,48 @@ msgid "" "documentation ` for details." msgstr "" -#: ../../c-api/type.rst:480 +#: ../../c-api/type.rst:497 msgid "The following fields cannot be set at all when creating a heap type:" msgstr "" -#: ../../c-api/type.rst:482 +#: ../../c-api/type.rst:499 msgid "" ":c:member:`~PyTypeObject.tp_vectorcall` (use :c:member:`~PyTypeObject." "tp_new` and/or :c:member:`~PyTypeObject.tp_init`)" msgstr "" -#: ../../c-api/type.rst:486 +#: ../../c-api/type.rst:503 msgid "" "Internal fields: :c:member:`~PyTypeObject.tp_dict`, :c:member:`~PyTypeObject." "tp_mro`, :c:member:`~PyTypeObject.tp_cache`, :c:member:`~PyTypeObject." "tp_subclasses`, and :c:member:`~PyTypeObject.tp_weaklist`." msgstr "" -#: ../../c-api/type.rst:493 +#: ../../c-api/type.rst:510 msgid "" "Setting :c:data:`Py_tp_bases` or :c:data:`Py_tp_base` may be problematic on " "some platforms. To avoid issues, use the *bases* argument of :c:func:" "`PyType_FromSpecWithBases` instead." msgstr "" -#: ../../c-api/type.rst:500 +#: ../../c-api/type.rst:517 msgid "Slots in :c:type:`PyBufferProcs` may be set in the unlimited API." msgstr "" -#: ../../c-api/type.rst:502 +#: ../../c-api/type.rst:519 msgid "" ":c:member:`~PyBufferProcs.bf_getbuffer` and :c:member:`~PyBufferProcs." "bf_releasebuffer` are now available under the :ref:`limited API `." msgstr "" -#: ../../c-api/type.rst:509 +#: ../../c-api/type.rst:526 msgid "" "The desired value of the slot. In most cases, this is a pointer to a " "function." msgstr "" -#: ../../c-api/type.rst:512 +#: ../../c-api/type.rst:529 msgid "Slots other than ``Py_tp_doc`` may not be ``NULL``." msgstr "" diff --git a/c-api/typehints.po b/c-api/typehints.po index 6849cd7da0..c90a8f7b3c 100644 --- a/c-api/typehints.po +++ b/c-api/typehints.po @@ -6,7 +6,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-10-16 16:16+0800\n" diff --git a/c-api/typeobj.po b/c-api/typeobj.po index e9a2f100ef..951587ed1f 100644 --- a/c-api/typeobj.po +++ b/c-api/typeobj.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:33+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1292,43 +1292,42 @@ msgid "" msgstr "" #: ../../c-api/typeobj.rst:503 ../../c-api/typeobj.rst:526 -#: ../../c-api/typeobj.rst:548 ../../c-api/typeobj.rst:562 -#: ../../c-api/typeobj.rst:606 ../../c-api/typeobj.rst:649 -#: ../../c-api/typeobj.rst:708 ../../c-api/typeobj.rst:749 -#: ../../c-api/typeobj.rst:766 ../../c-api/typeobj.rst:783 -#: ../../c-api/typeobj.rst:801 ../../c-api/typeobj.rst:825 -#: ../../c-api/typeobj.rst:842 ../../c-api/typeobj.rst:854 -#: ../../c-api/typeobj.rst:866 ../../c-api/typeobj.rst:899 -#: ../../c-api/typeobj.rst:917 ../../c-api/typeobj.rst:937 -#: ../../c-api/typeobj.rst:958 ../../c-api/typeobj.rst:984 -#: ../../c-api/typeobj.rst:1003 ../../c-api/typeobj.rst:1019 -#: ../../c-api/typeobj.rst:1058 ../../c-api/typeobj.rst:1069 -#: ../../c-api/typeobj.rst:1079 ../../c-api/typeobj.rst:1089 -#: ../../c-api/typeobj.rst:1103 ../../c-api/typeobj.rst:1121 -#: ../../c-api/typeobj.rst:1144 ../../c-api/typeobj.rst:1159 -#: ../../c-api/typeobj.rst:1172 ../../c-api/typeobj.rst:1194 -#: ../../c-api/typeobj.rst:1238 ../../c-api/typeobj.rst:1259 -#: ../../c-api/typeobj.rst:1278 ../../c-api/typeobj.rst:1308 -#: ../../c-api/typeobj.rst:1330 ../../c-api/typeobj.rst:1356 -#: ../../c-api/typeobj.rst:1424 ../../c-api/typeobj.rst:1492 -#: ../../c-api/typeobj.rst:1553 ../../c-api/typeobj.rst:1589 -#: ../../c-api/typeobj.rst:1614 ../../c-api/typeobj.rst:1637 -#: ../../c-api/typeobj.rst:1650 ../../c-api/typeobj.rst:1665 -#: ../../c-api/typeobj.rst:1679 ../../c-api/typeobj.rst:1709 -#: ../../c-api/typeobj.rst:1741 ../../c-api/typeobj.rst:1767 -#: ../../c-api/typeobj.rst:1785 ../../c-api/typeobj.rst:1814 -#: ../../c-api/typeobj.rst:1858 ../../c-api/typeobj.rst:1875 -#: ../../c-api/typeobj.rst:1916 ../../c-api/typeobj.rst:1938 -#: ../../c-api/typeobj.rst:1970 ../../c-api/typeobj.rst:1998 -#: ../../c-api/typeobj.rst:2011 ../../c-api/typeobj.rst:2021 -#: ../../c-api/typeobj.rst:2038 ../../c-api/typeobj.rst:2055 -#: ../../c-api/typeobj.rst:2069 ../../c-api/typeobj.rst:2115 -#: ../../c-api/typeobj.rst:2138 +#: ../../c-api/typeobj.rst:540 ../../c-api/typeobj.rst:584 +#: ../../c-api/typeobj.rst:627 ../../c-api/typeobj.rst:686 +#: ../../c-api/typeobj.rst:727 ../../c-api/typeobj.rst:744 +#: ../../c-api/typeobj.rst:761 ../../c-api/typeobj.rst:779 +#: ../../c-api/typeobj.rst:803 ../../c-api/typeobj.rst:820 +#: ../../c-api/typeobj.rst:832 ../../c-api/typeobj.rst:844 +#: ../../c-api/typeobj.rst:877 ../../c-api/typeobj.rst:899 +#: ../../c-api/typeobj.rst:919 ../../c-api/typeobj.rst:940 +#: ../../c-api/typeobj.rst:966 ../../c-api/typeobj.rst:985 +#: ../../c-api/typeobj.rst:1001 ../../c-api/typeobj.rst:1040 +#: ../../c-api/typeobj.rst:1051 ../../c-api/typeobj.rst:1061 +#: ../../c-api/typeobj.rst:1071 ../../c-api/typeobj.rst:1085 +#: ../../c-api/typeobj.rst:1103 ../../c-api/typeobj.rst:1126 +#: ../../c-api/typeobj.rst:1144 ../../c-api/typeobj.rst:1157 +#: ../../c-api/typeobj.rst:1179 ../../c-api/typeobj.rst:1223 +#: ../../c-api/typeobj.rst:1244 ../../c-api/typeobj.rst:1263 +#: ../../c-api/typeobj.rst:1293 ../../c-api/typeobj.rst:1315 +#: ../../c-api/typeobj.rst:1341 ../../c-api/typeobj.rst:1426 +#: ../../c-api/typeobj.rst:1500 ../../c-api/typeobj.rst:1561 +#: ../../c-api/typeobj.rst:1597 ../../c-api/typeobj.rst:1622 +#: ../../c-api/typeobj.rst:1645 ../../c-api/typeobj.rst:1658 +#: ../../c-api/typeobj.rst:1673 ../../c-api/typeobj.rst:1687 +#: ../../c-api/typeobj.rst:1717 ../../c-api/typeobj.rst:1749 +#: ../../c-api/typeobj.rst:1775 ../../c-api/typeobj.rst:1793 +#: ../../c-api/typeobj.rst:1822 ../../c-api/typeobj.rst:1866 +#: ../../c-api/typeobj.rst:1883 ../../c-api/typeobj.rst:1924 +#: ../../c-api/typeobj.rst:1946 ../../c-api/typeobj.rst:1978 +#: ../../c-api/typeobj.rst:2006 ../../c-api/typeobj.rst:2019 +#: ../../c-api/typeobj.rst:2029 ../../c-api/typeobj.rst:2046 +#: ../../c-api/typeobj.rst:2063 ../../c-api/typeobj.rst:2077 +#: ../../c-api/typeobj.rst:2123 ../../c-api/typeobj.rst:2146 msgid "**Inheritance:**" msgstr "" -#: ../../c-api/typeobj.rst:505 ../../c-api/typeobj.rst:564 -#: ../../c-api/typeobj.rst:608 +#: ../../c-api/typeobj.rst:505 ../../c-api/typeobj.rst:542 +#: ../../c-api/typeobj.rst:586 msgid "This field is not inherited by subtypes." msgstr "" @@ -1356,58 +1355,31 @@ msgid "" "class. :c:func:`PyType_Ready` will not change this field if it is non-zero." msgstr "" -#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:710 -#: ../../c-api/typeobj.rst:827 ../../c-api/typeobj.rst:919 -#: ../../c-api/typeobj.rst:939 ../../c-api/typeobj.rst:1616 -#: ../../c-api/typeobj.rst:1639 ../../c-api/typeobj.rst:1769 -#: ../../c-api/typeobj.rst:1787 ../../c-api/typeobj.rst:1860 -#: ../../c-api/typeobj.rst:1972 ../../c-api/typeobj.rst:2117 +#: ../../c-api/typeobj.rst:528 ../../c-api/typeobj.rst:688 +#: ../../c-api/typeobj.rst:805 ../../c-api/typeobj.rst:901 +#: ../../c-api/typeobj.rst:921 ../../c-api/typeobj.rst:1624 +#: ../../c-api/typeobj.rst:1647 ../../c-api/typeobj.rst:1777 +#: ../../c-api/typeobj.rst:1795 ../../c-api/typeobj.rst:1868 +#: ../../c-api/typeobj.rst:1980 ../../c-api/typeobj.rst:2125 msgid "This field is inherited by subtypes." msgstr "" -#: ../../c-api/typeobj.rst:534 -msgid "" -"These fields are only present when the macro ``Py_TRACE_REFS`` is defined " -"(see the :option:`configure --with-trace-refs option <--with-trace-refs>`)." -msgstr "" - -#: ../../c-api/typeobj.rst:537 -msgid "" -"Their initialization to ``NULL`` is taken care of by the " -"``PyObject_HEAD_INIT`` macro. For :ref:`statically allocated objects " -"`, these fields always remain ``NULL``. For :ref:`dynamically " -"allocated objects `, these two fields are used to link the " -"object into a doubly linked list of *all* live objects on the heap." -msgstr "" - -#: ../../c-api/typeobj.rst:543 -msgid "" -"This could be used for various debugging purposes; currently the only uses " -"are the :func:`sys.getobjects` function and to print the objects that are " -"still alive at the end of a run when the environment variable :envvar:" -"`PYTHONDUMPREFS` is set." -msgstr "" - -#: ../../c-api/typeobj.rst:550 -msgid "These fields are not inherited by subtypes." -msgstr "" - -#: ../../c-api/typeobj.rst:554 +#: ../../c-api/typeobj.rst:532 msgid "PyVarObject Slots" msgstr "" -#: ../../c-api/typeobj.rst:558 +#: ../../c-api/typeobj.rst:536 msgid "" "For :ref:`statically allocated type objects `, this should be " "initialized to zero. For :ref:`dynamically allocated type objects `, this field has a special internal meaning." msgstr "" -#: ../../c-api/typeobj.rst:568 +#: ../../c-api/typeobj.rst:546 msgid "PyTypeObject Slots" msgstr "" -#: ../../c-api/typeobj.rst:570 +#: ../../c-api/typeobj.rst:548 msgid "" "Each slot has a section describing inheritance. If :c:func:`PyType_Ready` " "may set a value when the field is set to ``NULL`` then there will also be a " @@ -1415,7 +1387,7 @@ msgid "" "`PyBaseObject_Type` and :c:data:`PyType_Type` effectively act as defaults.)" msgstr "" -#: ../../c-api/typeobj.rst:577 +#: ../../c-api/typeobj.rst:555 msgid "" "Pointer to a NUL-terminated string containing the name of the type. For " "types that are accessible as module globals, the string should be the full " @@ -1427,44 +1399,44 @@ msgid "" "tp_name` initializer ``\"P.Q.M.T\"``." msgstr "" -#: ../../c-api/typeobj.rst:585 +#: ../../c-api/typeobj.rst:563 msgid "" "For :ref:`dynamically allocated type objects `, this should just " "be the type name, and the module name explicitly stored in the type dict as " "the value for key ``'__module__'``." msgstr "" -#: ../../c-api/typeobj.rst:590 +#: ../../c-api/typeobj.rst:568 msgid "" "For :ref:`statically allocated type objects `, the *tp_name* " "field should contain a dot. Everything before the last dot is made " -"accessible as the :attr:`__module__` attribute, and everything after the " -"last dot is made accessible as the :attr:`~definition.__name__` attribute." +"accessible as the :attr:`~type.__module__` attribute, and everything after " +"the last dot is made accessible as the :attr:`~type.__name__` attribute." msgstr "" -#: ../../c-api/typeobj.rst:596 +#: ../../c-api/typeobj.rst:574 msgid "" "If no dot is present, the entire :c:member:`~PyTypeObject.tp_name` field is " -"made accessible as the :attr:`~definition.__name__` attribute, and the :attr:" -"`__module__` attribute is undefined (unless explicitly set in the " +"made accessible as the :attr:`~type.__name__` attribute, and the :attr:" +"`~type.__module__` attribute is undefined (unless explicitly set in the " "dictionary, as explained above). This means your type will be impossible to " "pickle. Additionally, it will not be listed in module documentations " "created with pydoc." msgstr "" -#: ../../c-api/typeobj.rst:602 +#: ../../c-api/typeobj.rst:580 msgid "" "This field must not be ``NULL``. It is the only required field in :c:func:" "`PyTypeObject` (other than potentially :c:member:`~PyTypeObject." "tp_itemsize`)." msgstr "" -#: ../../c-api/typeobj.rst:614 +#: ../../c-api/typeobj.rst:592 msgid "" "These fields allow calculating the size in bytes of instances of the type." msgstr "" -#: ../../c-api/typeobj.rst:616 +#: ../../c-api/typeobj.rst:594 msgid "" "There are two kinds of types: types with fixed-length instances have a zero :" "c:member:`~PyTypeObject.tp_itemsize` field, types with variable-length " @@ -1473,7 +1445,7 @@ msgid "" "in :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:621 +#: ../../c-api/typeobj.rst:599 msgid "" "For a type with variable-length instances, the instances must have an :c:" "member:`~PyVarObject.ob_size` field, and the instance size is :c:member:" @@ -1489,7 +1461,7 @@ msgid "" "`~PyVarObject.ob_size` field)." msgstr "" -#: ../../c-api/typeobj.rst:632 +#: ../../c-api/typeobj.rst:610 msgid "" "The basic size includes the fields in the instance declared by the macro :c:" "macro:`PyObject_HEAD` or :c:macro:`PyObject_VAR_HEAD` (whichever is used to " @@ -1501,7 +1473,7 @@ msgid "" "include the GC header size." msgstr "" -#: ../../c-api/typeobj.rst:640 +#: ../../c-api/typeobj.rst:618 msgid "" "A note about alignment: if the variable items require a particular " "alignment, this should be taken care of by the value of :c:member:" @@ -1512,12 +1484,12 @@ msgid "" "alignment requirement for ``double``)." msgstr "" -#: ../../c-api/typeobj.rst:647 +#: ../../c-api/typeobj.rst:625 msgid "" "For any type with variable-length instances, this field must not be ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:651 +#: ../../c-api/typeobj.rst:629 msgid "" "These fields are inherited separately by subtypes. If the base type has a " "non-zero :c:member:`~PyTypeObject.tp_itemsize`, it is generally not safe to " @@ -1525,7 +1497,7 @@ msgid "" "subtype (though this depends on the implementation of the base type)." msgstr "" -#: ../../c-api/typeobj.rst:659 +#: ../../c-api/typeobj.rst:637 msgid "" "A pointer to the instance destructor function. This function must be " "defined unless the type guarantees that its instances will never be " @@ -1533,11 +1505,11 @@ msgid "" "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:663 +#: ../../c-api/typeobj.rst:641 msgid "void tp_dealloc(PyObject *self);" msgstr "void tp_dealloc(PyObject *self);" -#: ../../c-api/typeobj.rst:665 +#: ../../c-api/typeobj.rst:643 msgid "" "The destructor function is called by the :c:func:`Py_DECREF` and :c:func:" "`Py_XDECREF` macros when the new reference count is zero. At this point, " @@ -1555,14 +1527,14 @@ msgid "" "allocated using :c:macro:`PyObject_GC_New` or :c:macro:`PyObject_GC_NewVar`." msgstr "" -#: ../../c-api/typeobj.rst:680 +#: ../../c-api/typeobj.rst:658 msgid "" "If the type supports garbage collection (has the :c:macro:" "`Py_TPFLAGS_HAVE_GC` flag bit set), the destructor should call :c:func:" "`PyObject_GC_UnTrack` before clearing any member fields." msgstr "" -#: ../../c-api/typeobj.rst:684 +#: ../../c-api/typeobj.rst:662 msgid "" "static void foo_dealloc(foo_object *self) {\n" " PyObject_GC_UnTrack(self);\n" @@ -1576,7 +1548,7 @@ msgstr "" " Py_TYPE(self)->tp_free((PyObject *)self);\n" "}" -#: ../../c-api/typeobj.rst:692 +#: ../../c-api/typeobj.rst:670 msgid "" "Finally, if the type is heap allocated (:c:macro:`Py_TPFLAGS_HEAPTYPE`), the " "deallocator should release the owned reference to its type object (via :c:" @@ -1584,7 +1556,7 @@ msgid "" "dangling pointers, the recommended way to achieve this is:" msgstr "" -#: ../../c-api/typeobj.rst:698 +#: ../../c-api/typeobj.rst:676 msgid "" "static void foo_dealloc(foo_object *self) {\n" " PyTypeObject *tp = Py_TYPE(self);\n" @@ -1594,28 +1566,28 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:715 +#: ../../c-api/typeobj.rst:693 msgid "" "An optional offset to a per-instance function that implements calling the " "object using the :ref:`vectorcall protocol `, a more efficient " "alternative of the simpler :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:720 +#: ../../c-api/typeobj.rst:698 msgid "" "This field is only used if the flag :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` is " "set. If so, this must be a positive integer containing the offset in the " "instance of a :c:type:`vectorcallfunc` pointer." msgstr "" -#: ../../c-api/typeobj.rst:724 +#: ../../c-api/typeobj.rst:702 msgid "" "The *vectorcallfunc* pointer may be ``NULL``, in which case the instance " "behaves as if :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` was not set: calling the " "instance falls back to :c:member:`~PyTypeObject.tp_call`." msgstr "" -#: ../../c-api/typeobj.rst:728 +#: ../../c-api/typeobj.rst:706 msgid "" "Any class that sets ``Py_TPFLAGS_HAVE_VECTORCALL`` must also set :c:member:" "`~PyTypeObject.tp_call` and make sure its behaviour is consistent with the " @@ -1623,13 +1595,13 @@ msgid "" "`PyVectorcall_Call`." msgstr "" -#: ../../c-api/typeobj.rst:735 +#: ../../c-api/typeobj.rst:713 msgid "" "Before version 3.8, this slot was named ``tp_print``. In Python 2.x, it was " "used for printing to a file. In Python 3.0 to 3.7, it was unused." msgstr "" -#: ../../c-api/typeobj.rst:741 +#: ../../c-api/typeobj.rst:719 msgid "" "Before version 3.12, it was not recommended for :ref:`mutable heap types " "` to implement the vectorcall protocol. When a user sets :attr:" @@ -1639,7 +1611,7 @@ msgid "" "`Py_TPFLAGS_HAVE_VECTORCALL` flag." msgstr "" -#: ../../c-api/typeobj.rst:751 +#: ../../c-api/typeobj.rst:729 msgid "" "This field is always inherited. However, the :c:macro:" "`Py_TPFLAGS_HAVE_VECTORCALL` flag is not always inherited. If it's not set, " @@ -1647,11 +1619,11 @@ msgid "" "func:`PyVectorcall_Call` is explicitly called." msgstr "" -#: ../../c-api/typeobj.rst:760 +#: ../../c-api/typeobj.rst:738 msgid "An optional pointer to the get-attribute-string function." msgstr "" -#: ../../c-api/typeobj.rst:762 +#: ../../c-api/typeobj.rst:740 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_getattro` function, " @@ -1659,7 +1631,7 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:768 ../../c-api/typeobj.rst:960 +#: ../../c-api/typeobj.rst:746 ../../c-api/typeobj.rst:942 msgid "" "Group: :c:member:`~PyTypeObject.tp_getattr`, :c:member:`~PyTypeObject." "tp_getattro`" @@ -1667,7 +1639,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_getattr`、:c:member:`~PyTypeObject." "tp_getattro`" -#: ../../c-api/typeobj.rst:770 +#: ../../c-api/typeobj.rst:748 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_getattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " @@ -1676,12 +1648,12 @@ msgid "" "tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:777 ../../c-api/typeobj.rst:973 +#: ../../c-api/typeobj.rst:755 ../../c-api/typeobj.rst:955 msgid "" "An optional pointer to the function for setting and deleting attributes." msgstr "" -#: ../../c-api/typeobj.rst:779 +#: ../../c-api/typeobj.rst:757 msgid "" "This field is deprecated. When it is defined, it should point to a function " "that acts the same as the :c:member:`~PyTypeObject.tp_setattro` function, " @@ -1689,7 +1661,7 @@ msgid "" "attribute name." msgstr "" -#: ../../c-api/typeobj.rst:785 ../../c-api/typeobj.rst:986 +#: ../../c-api/typeobj.rst:763 ../../c-api/typeobj.rst:968 msgid "" "Group: :c:member:`~PyTypeObject.tp_setattr`, :c:member:`~PyTypeObject." "tp_setattro`" @@ -1697,7 +1669,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_setattr`、:c:member:`~PyTypeObject." "tp_setattro`" -#: ../../c-api/typeobj.rst:787 +#: ../../c-api/typeobj.rst:765 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_setattro`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " @@ -1706,38 +1678,38 @@ msgid "" "tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:794 +#: ../../c-api/typeobj.rst:772 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement :term:`awaitable` and :term:`asynchronous iterator` " "protocols at the C-level. See :ref:`async-structs` for details." msgstr "" -#: ../../c-api/typeobj.rst:798 +#: ../../c-api/typeobj.rst:776 msgid "Formerly known as ``tp_compare`` and ``tp_reserved``." msgstr "" -#: ../../c-api/typeobj.rst:803 +#: ../../c-api/typeobj.rst:781 msgid "" "The :c:member:`~PyTypeObject.tp_as_async` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:811 +#: ../../c-api/typeobj.rst:789 msgid "" "An optional pointer to a function that implements the built-in function :" "func:`repr`." msgstr "" -#: ../../c-api/typeobj.rst:814 +#: ../../c-api/typeobj.rst:792 msgid "The signature is the same as for :c:func:`PyObject_Repr`::" msgstr "" -#: ../../c-api/typeobj.rst:816 +#: ../../c-api/typeobj.rst:794 msgid "PyObject *tp_repr(PyObject *self);" msgstr "PyObject *tp_repr(PyObject *self);" -#: ../../c-api/typeobj.rst:818 +#: ../../c-api/typeobj.rst:796 msgid "" "The function must return a string or a Unicode object. Ideally, this " "function should return a string that, when passed to :func:`eval`, given a " @@ -1746,85 +1718,85 @@ msgid "" "``'>'`` from which both the type and the value of the object can be deduced." msgstr "" -#: ../../c-api/typeobj.rst:829 ../../c-api/typeobj.rst:941 -#: ../../c-api/typeobj.rst:966 ../../c-api/typeobj.rst:992 -#: ../../c-api/typeobj.rst:1033 ../../c-api/typeobj.rst:1562 -#: ../../c-api/typeobj.rst:1596 ../../c-api/typeobj.rst:1713 -#: ../../c-api/typeobj.rst:1746 ../../c-api/typeobj.rst:1821 -#: ../../c-api/typeobj.rst:1862 ../../c-api/typeobj.rst:1880 -#: ../../c-api/typeobj.rst:1922 ../../c-api/typeobj.rst:1943 -#: ../../c-api/typeobj.rst:1974 +#: ../../c-api/typeobj.rst:807 ../../c-api/typeobj.rst:886 +#: ../../c-api/typeobj.rst:923 ../../c-api/typeobj.rst:948 +#: ../../c-api/typeobj.rst:974 ../../c-api/typeobj.rst:1015 +#: ../../c-api/typeobj.rst:1570 ../../c-api/typeobj.rst:1604 +#: ../../c-api/typeobj.rst:1721 ../../c-api/typeobj.rst:1754 +#: ../../c-api/typeobj.rst:1829 ../../c-api/typeobj.rst:1870 +#: ../../c-api/typeobj.rst:1888 ../../c-api/typeobj.rst:1930 +#: ../../c-api/typeobj.rst:1951 ../../c-api/typeobj.rst:1982 msgid "**Default:**" msgstr "**預設:**" -#: ../../c-api/typeobj.rst:831 +#: ../../c-api/typeobj.rst:809 msgid "" "When this field is not set, a string of the form ``<%s object at %p>`` is " "returned, where ``%s`` is replaced by the type name, and ``%p`` by the " "object's memory address." msgstr "" -#: ../../c-api/typeobj.rst:838 +#: ../../c-api/typeobj.rst:816 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the number protocol. These fields are documented " "in :ref:`number-structs`." msgstr "" -#: ../../c-api/typeobj.rst:844 +#: ../../c-api/typeobj.rst:822 msgid "" "The :c:member:`~PyTypeObject.tp_as_number` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:850 +#: ../../c-api/typeobj.rst:828 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the sequence protocol. These fields are documented " "in :ref:`sequence-structs`." msgstr "" -#: ../../c-api/typeobj.rst:856 +#: ../../c-api/typeobj.rst:834 msgid "" "The :c:member:`~PyTypeObject.tp_as_sequence` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:862 +#: ../../c-api/typeobj.rst:840 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the mapping protocol. These fields are documented " "in :ref:`mapping-structs`." msgstr "" -#: ../../c-api/typeobj.rst:868 +#: ../../c-api/typeobj.rst:846 msgid "" "The :c:member:`~PyTypeObject.tp_as_mapping` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:876 +#: ../../c-api/typeobj.rst:854 msgid "" "An optional pointer to a function that implements the built-in function :" "func:`hash`." msgstr "" -#: ../../c-api/typeobj.rst:879 +#: ../../c-api/typeobj.rst:857 msgid "The signature is the same as for :c:func:`PyObject_Hash`::" msgstr "" -#: ../../c-api/typeobj.rst:881 +#: ../../c-api/typeobj.rst:859 msgid "Py_hash_t tp_hash(PyObject *);" msgstr "Py_hash_t tp_hash(PyObject *);" -#: ../../c-api/typeobj.rst:883 +#: ../../c-api/typeobj.rst:861 msgid "" "The value ``-1`` should not be returned as a normal return value; when an " "error occurs during the computation of the hash value, the function should " "set an exception and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:887 +#: ../../c-api/typeobj.rst:865 msgid "" "When this field is not set (*and* :c:member:`~PyTypeObject.tp_richcompare` " "is not set), an attempt to take the hash of the object raises :exc:" @@ -1832,7 +1804,7 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:891 +#: ../../c-api/typeobj.rst:869 msgid "" "This field can be set explicitly to :c:func:`PyObject_HashNotImplemented` to " "block inheritance of the hash method from a parent type. This is interpreted " @@ -1843,7 +1815,7 @@ msgid "" "`PyObject_HashNotImplemented`." msgstr "" -#: ../../c-api/typeobj.rst:901 ../../c-api/typeobj.rst:1555 +#: ../../c-api/typeobj.rst:879 ../../c-api/typeobj.rst:1563 msgid "" "Group: :c:member:`~PyTypeObject.tp_hash`, :c:member:`~PyTypeObject." "tp_richcompare`" @@ -1851,7 +1823,7 @@ msgstr "" "群組::c:member:`~PyTypeObject.tp_hash`、:c:member:`~PyTypeObject." "tp_richcompare`" -#: ../../c-api/typeobj.rst:903 +#: ../../c-api/typeobj.rst:881 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_richcompare`: a subtype inherits both of :c:member:`~PyTypeObject." @@ -1860,18 +1832,22 @@ msgid "" "are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:911 +#: ../../c-api/typeobj.rst:888 +msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericHash`." +msgstr "" + +#: ../../c-api/typeobj.rst:893 msgid "" "An optional pointer to a function that implements calling the object. This " "should be ``NULL`` if the object is not callable. The signature is the same " "as for :c:func:`PyObject_Call`::" msgstr "" -#: ../../c-api/typeobj.rst:915 +#: ../../c-api/typeobj.rst:897 msgid "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" msgstr "PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs);" -#: ../../c-api/typeobj.rst:924 +#: ../../c-api/typeobj.rst:906 msgid "" "An optional pointer to a function that implements the built-in operation :" "func:`str`. (Note that :class:`str` is a type now, and :func:`str` calls " @@ -1880,15 +1856,15 @@ msgid "" "this handler.)" msgstr "" -#: ../../c-api/typeobj.rst:929 +#: ../../c-api/typeobj.rst:911 msgid "The signature is the same as for :c:func:`PyObject_Str`::" msgstr "" -#: ../../c-api/typeobj.rst:931 +#: ../../c-api/typeobj.rst:913 msgid "PyObject *tp_str(PyObject *self);" msgstr "PyObject *tp_str(PyObject *self);" -#: ../../c-api/typeobj.rst:933 +#: ../../c-api/typeobj.rst:915 msgid "" "The function must return a string or a Unicode object. It should be a " "\"friendly\" string representation of the object, as this is the " @@ -1896,32 +1872,32 @@ msgid "" "function." msgstr "" -#: ../../c-api/typeobj.rst:943 +#: ../../c-api/typeobj.rst:925 msgid "" "When this field is not set, :c:func:`PyObject_Repr` is called to return a " "string representation." msgstr "" -#: ../../c-api/typeobj.rst:949 +#: ../../c-api/typeobj.rst:931 msgid "An optional pointer to the get-attribute function." msgstr "" -#: ../../c-api/typeobj.rst:951 +#: ../../c-api/typeobj.rst:933 msgid "The signature is the same as for :c:func:`PyObject_GetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:953 +#: ../../c-api/typeobj.rst:935 msgid "PyObject *tp_getattro(PyObject *self, PyObject *attr);" msgstr "PyObject *tp_getattro(PyObject *self, PyObject *attr);" -#: ../../c-api/typeobj.rst:955 +#: ../../c-api/typeobj.rst:937 msgid "" "It is usually convenient to set this field to :c:func:" "`PyObject_GenericGetAttr`, which implements the normal way of looking for " "object attributes." msgstr "" -#: ../../c-api/typeobj.rst:962 +#: ../../c-api/typeobj.rst:944 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_getattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_getattr` " @@ -1930,19 +1906,19 @@ msgid "" "tp_getattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:968 +#: ../../c-api/typeobj.rst:950 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:975 +#: ../../c-api/typeobj.rst:957 msgid "The signature is the same as for :c:func:`PyObject_SetAttr`::" msgstr "" -#: ../../c-api/typeobj.rst:977 +#: ../../c-api/typeobj.rst:959 msgid "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" msgstr "int tp_setattro(PyObject *self, PyObject *attr, PyObject *value);" -#: ../../c-api/typeobj.rst:979 +#: ../../c-api/typeobj.rst:961 msgid "" "In addition, setting *value* to ``NULL`` to delete an attribute must be " "supported. It is usually convenient to set this field to :c:func:" @@ -1950,7 +1926,7 @@ msgid "" "attributes." msgstr "" -#: ../../c-api/typeobj.rst:988 +#: ../../c-api/typeobj.rst:970 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_setattr`: a subtype inherits both :c:member:`~PyTypeObject.tp_setattr` " @@ -1959,24 +1935,24 @@ msgid "" "tp_setattro` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:994 +#: ../../c-api/typeobj.rst:976 msgid ":c:data:`PyBaseObject_Type` uses :c:func:`PyObject_GenericSetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:999 +#: ../../c-api/typeobj.rst:981 msgid "" "Pointer to an additional structure that contains fields relevant only to " "objects which implement the buffer interface. These fields are documented " "in :ref:`buffer-structs`." msgstr "" -#: ../../c-api/typeobj.rst:1005 +#: ../../c-api/typeobj.rst:987 msgid "" "The :c:member:`~PyTypeObject.tp_as_buffer` field is not inherited, but the " "contained fields are inherited individually." msgstr "" -#: ../../c-api/typeobj.rst:1011 +#: ../../c-api/typeobj.rst:993 msgid "" "This field is a bit mask of various flags. Some flags indicate variant " "semantics for certain situations; others are used to indicate that certain " @@ -1988,7 +1964,7 @@ msgid "" "accessed and must be considered to have a zero or ``NULL`` value instead." msgstr "" -#: ../../c-api/typeobj.rst:1021 +#: ../../c-api/typeobj.rst:1003 msgid "" "Inheritance of this field is complicated. Most flag bits are inherited " "individually, i.e. if the base type has a flag bit set, the subtype inherits " @@ -2004,7 +1980,7 @@ msgid "" "*really* inherited individually?" msgstr "" -#: ../../c-api/typeobj.rst:1035 +#: ../../c-api/typeobj.rst:1017 msgid "" ":c:data:`PyBaseObject_Type` uses ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``." @@ -2012,11 +1988,11 @@ msgstr "" ":c:data:`PyBaseObject_Type` 使用 ``Py_TPFLAGS_DEFAULT | " "Py_TPFLAGS_BASETYPE``。" -#: ../../c-api/typeobj.rst:1038 +#: ../../c-api/typeobj.rst:1020 msgid "**Bit Masks:**" msgstr "" -#: ../../c-api/typeobj.rst:1042 +#: ../../c-api/typeobj.rst:1024 msgid "" "The following bit masks are currently defined; these can be ORed together " "using the ``|`` operator to form the value of the :c:member:`~PyTypeObject." @@ -2025,7 +2001,7 @@ msgid "" "zero." msgstr "" -#: ../../c-api/typeobj.rst:1049 +#: ../../c-api/typeobj.rst:1031 msgid "" "This bit is set when the type object itself is allocated on the heap, for " "example, types created dynamically using :c:func:`PyType_FromSpec`. In this " @@ -2038,32 +2014,32 @@ msgid "" "reference cycle with their own module object." msgstr "" -#: ../../c-api/typeobj.rst:1060 ../../c-api/typeobj.rst:1071 -#: ../../c-api/typeobj.rst:1081 ../../c-api/typeobj.rst:1091 -#: ../../c-api/typeobj.rst:1123 +#: ../../c-api/typeobj.rst:1042 ../../c-api/typeobj.rst:1053 +#: ../../c-api/typeobj.rst:1063 ../../c-api/typeobj.rst:1073 +#: ../../c-api/typeobj.rst:1105 msgid "???" msgstr "???" -#: ../../c-api/typeobj.rst:1065 +#: ../../c-api/typeobj.rst:1047 msgid "" "This bit is set when the type can be used as the base type of another type. " "If this bit is clear, the type cannot be subtyped (similar to a \"final\" " "class in Java)." msgstr "" -#: ../../c-api/typeobj.rst:1076 +#: ../../c-api/typeobj.rst:1058 msgid "" "This bit is set when the type object has been fully initialized by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1086 +#: ../../c-api/typeobj.rst:1068 msgid "" "This bit is set while :c:func:`PyType_Ready` is in the process of " "initializing the type object." msgstr "" -#: ../../c-api/typeobj.rst:1096 +#: ../../c-api/typeobj.rst:1078 msgid "" "This bit is set when the object supports garbage collection. If this bit is " "set, instances must be created using :c:macro:`PyObject_GC_New` and " @@ -2073,14 +2049,14 @@ msgid "" "tp_clear` are present in the type object." msgstr "" -#: ../../c-api/typeobj.rst:1105 ../../c-api/typeobj.rst:1426 -#: ../../c-api/typeobj.rst:1494 +#: ../../c-api/typeobj.rst:1087 ../../c-api/typeobj.rst:1428 +#: ../../c-api/typeobj.rst:1502 msgid "" "Group: :c:macro:`Py_TPFLAGS_HAVE_GC`, :c:member:`~PyTypeObject." "tp_traverse`, :c:member:`~PyTypeObject.tp_clear`" msgstr "" -#: ../../c-api/typeobj.rst:1107 +#: ../../c-api/typeobj.rst:1089 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is inherited together with the :c:" "member:`~PyTypeObject.tp_traverse` and :c:member:`~PyTypeObject.tp_clear` " @@ -2090,99 +2066,105 @@ msgid "" "values." msgstr "" -#: ../../c-api/typeobj.rst:1117 +#: ../../c-api/typeobj.rst:1099 msgid "" "This is a bitmask of all the bits that pertain to the existence of certain " "fields in the type object and its extension structures. Currently, it " "includes the following bits: :c:macro:`Py_TPFLAGS_HAVE_STACKLESS_EXTENSION`." msgstr "" -#: ../../c-api/typeobj.rst:1128 +#: ../../c-api/typeobj.rst:1110 msgid "This bit indicates that objects behave like unbound methods." msgstr "" -#: ../../c-api/typeobj.rst:1130 +#: ../../c-api/typeobj.rst:1112 msgid "If this flag is set for ``type(meth)``, then:" msgstr "" -#: ../../c-api/typeobj.rst:1132 +#: ../../c-api/typeobj.rst:1114 msgid "" "``meth.__get__(obj, cls)(*args, **kwds)`` (with ``obj`` not None) must be " "equivalent to ``meth(obj, *args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1135 +#: ../../c-api/typeobj.rst:1117 msgid "" "``meth.__get__(None, cls)(*args, **kwds)`` must be equivalent to " "``meth(*args, **kwds)``." msgstr "" -#: ../../c-api/typeobj.rst:1138 +#: ../../c-api/typeobj.rst:1120 msgid "" "This flag enables an optimization for typical method calls like ``obj." "meth()``: it avoids creating a temporary \"bound method\" object for ``obj." "meth``." msgstr "" -#: ../../c-api/typeobj.rst:1146 +#: ../../c-api/typeobj.rst:1128 msgid "" "This flag is never inherited by types without the :c:macro:" "`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is inherited " "whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1152 +#: ../../c-api/typeobj.rst:1134 msgid "" -"This bit indicates that instances of the class have a ``__dict__`` " +"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:1155 +#: ../../c-api/typeobj.rst:1137 msgid "If this flag is set, :c:macro:`Py_TPFLAGS_HAVE_GC` should also be set." msgstr "" -#: ../../c-api/typeobj.rst:1161 +#: ../../c-api/typeobj.rst:1139 +msgid "" +"The type traverse function must call :c:func:`PyObject_VisitManagedDict` and " +"its clear function must call :c:func:`PyObject_ClearManagedDict`." +msgstr "" + +#: ../../c-api/typeobj.rst:1146 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject.tp_dictoffset` " "field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1167 +#: ../../c-api/typeobj.rst:1152 msgid "" "This bit indicates that instances of the class should be weakly " "referenceable." msgstr "" -#: ../../c-api/typeobj.rst:1174 +#: ../../c-api/typeobj.rst:1159 msgid "" "This flag is inherited unless the :c:member:`~PyTypeObject." "tp_weaklistoffset` field is set in a superclass." msgstr "" -#: ../../c-api/typeobj.rst:1180 +#: ../../c-api/typeobj.rst:1165 msgid "" "Only usable with variable-size types, i.e. ones with non-zero :c:member:" "`~PyTypeObject.tp_itemsize`." msgstr "" -#: ../../c-api/typeobj.rst:1183 +#: ../../c-api/typeobj.rst:1168 msgid "" "Indicates that the variable-sized portion of an instance of this type is at " "the end of the instance's memory area, at an offset of ``Py_TYPE(obj)-" ">tp_basicsize`` (which may be different in each subclass)." msgstr "" -#: ../../c-api/typeobj.rst:1188 +#: ../../c-api/typeobj.rst:1173 msgid "" "When setting this flag, be sure that all superclasses either use this memory " "layout, or are not variable-sized. Python does not check this." msgstr "" -#: ../../c-api/typeobj.rst:1196 +#: ../../c-api/typeobj.rst:1181 msgid "This flag is inherited." msgstr "" -#: ../../c-api/typeobj.rst:1210 +#: ../../c-api/typeobj.rst:1195 msgid "" "These flags are used by functions such as :c:func:`PyLong_Check` to quickly " "determine if a type is a subclass of a built-in type; such specific checks " @@ -2192,90 +2174,90 @@ msgid "" "behave differently depending on what kind of check is used." msgstr "" -#: ../../c-api/typeobj.rst:1221 +#: ../../c-api/typeobj.rst:1206 msgid "" "This bit is set when the :c:member:`~PyTypeObject.tp_finalize` slot is " "present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1226 +#: ../../c-api/typeobj.rst:1211 msgid "" "This flag isn't necessary anymore, as the interpreter assumes the :c:member:" "`~PyTypeObject.tp_finalize` slot is always present in the type structure." msgstr "" -#: ../../c-api/typeobj.rst:1234 +#: ../../c-api/typeobj.rst:1219 msgid "" "This bit is set when the class implements the :ref:`vectorcall protocol " "`. See :c:member:`~PyTypeObject.tp_vectorcall_offset` for " "details." msgstr "" -#: ../../c-api/typeobj.rst:1240 +#: ../../c-api/typeobj.rst:1225 msgid "" "This bit is inherited if :c:member:`~PyTypeObject.tp_call` is also inherited." msgstr "" -#: ../../c-api/typeobj.rst:1247 +#: ../../c-api/typeobj.rst:1232 msgid "" "This flag is now removed from a class when the class's :py:meth:`~object." "__call__` method is reassigned." msgstr "" -#: ../../c-api/typeobj.rst:1250 +#: ../../c-api/typeobj.rst:1235 msgid "This flag can now be inherited by mutable classes." msgstr "" -#: ../../c-api/typeobj.rst:1254 +#: ../../c-api/typeobj.rst:1239 msgid "" "This bit is set for type objects that are immutable: type attributes cannot " "be set nor deleted." msgstr "" -#: ../../c-api/typeobj.rst:1256 +#: ../../c-api/typeobj.rst:1241 msgid "" ":c:func:`PyType_Ready` automatically applies this flag to :ref:`static types " "`." msgstr "" -#: ../../c-api/typeobj.rst:1261 +#: ../../c-api/typeobj.rst:1246 msgid "This flag is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:1267 +#: ../../c-api/typeobj.rst:1252 msgid "" "Disallow creating instances of the type: set :c:member:`~PyTypeObject." "tp_new` to NULL and don't create the ``__new__`` key in the type dictionary." msgstr "" -#: ../../c-api/typeobj.rst:1271 +#: ../../c-api/typeobj.rst:1256 msgid "" "The flag must be set before creating the type, not after. For example, it " "must be set before :c:func:`PyType_Ready` is called on the type." msgstr "" -#: ../../c-api/typeobj.rst:1274 +#: ../../c-api/typeobj.rst:1259 msgid "" "The flag is set automatically on :ref:`static types ` if :c:" "member:`~PyTypeObject.tp_base` is NULL or ``&PyBaseObject_Type`` and :c:" "member:`~PyTypeObject.tp_new` is NULL." msgstr "" -#: ../../c-api/typeobj.rst:1280 +#: ../../c-api/typeobj.rst:1265 msgid "" "This flag is not inherited. However, subclasses will not be instantiable " "unless they provide a non-NULL :c:member:`~PyTypeObject.tp_new` (which is " "only possible via the C API)." msgstr "" -#: ../../c-api/typeobj.rst:1287 +#: ../../c-api/typeobj.rst:1272 msgid "" "To disallow instantiating a class directly but allow instantiating its " "subclasses (e.g. for an :term:`abstract base class`), do not use this flag. " "Instead, make :c:member:`~PyTypeObject.tp_new` only succeed for subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1298 +#: ../../c-api/typeobj.rst:1283 msgid "" "This bit indicates that instances of the class may match mapping patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2283,23 +2265,23 @@ msgid "" "unset when registering :class:`collections.abc.Sequence`." msgstr "" -#: ../../c-api/typeobj.rst:1305 ../../c-api/typeobj.rst:1327 +#: ../../c-api/typeobj.rst:1290 ../../c-api/typeobj.rst:1312 msgid "" ":c:macro:`Py_TPFLAGS_MAPPING` and :c:macro:`Py_TPFLAGS_SEQUENCE` are " "mutually exclusive; it is an error to enable both flags simultaneously." msgstr "" -#: ../../c-api/typeobj.rst:1310 +#: ../../c-api/typeobj.rst:1295 msgid "" "This flag is inherited by types that do not already set :c:macro:" "`Py_TPFLAGS_SEQUENCE`." msgstr "" -#: ../../c-api/typeobj.rst:1313 ../../c-api/typeobj.rst:1335 +#: ../../c-api/typeobj.rst:1298 ../../c-api/typeobj.rst:1320 msgid ":pep:`634` -- Structural Pattern Matching: Specification" msgstr "" -#: ../../c-api/typeobj.rst:1320 +#: ../../c-api/typeobj.rst:1305 msgid "" "This bit indicates that instances of the class may match sequence patterns " "when used as the subject of a :keyword:`match` block. It is automatically " @@ -2307,53 +2289,53 @@ msgid "" "unset when registering :class:`collections.abc.Mapping`." msgstr "" -#: ../../c-api/typeobj.rst:1332 +#: ../../c-api/typeobj.rst:1317 msgid "" "This flag is inherited by types that do not already set :c:macro:" "`Py_TPFLAGS_MAPPING`." msgstr "" -#: ../../c-api/typeobj.rst:1342 +#: ../../c-api/typeobj.rst:1327 msgid "" "Internal. Do not set or unset this flag. To indicate that a class has " "changed call :c:func:`PyType_Modified`" msgstr "" -#: ../../c-api/typeobj.rst:1346 +#: ../../c-api/typeobj.rst:1331 msgid "" -"This flag is present in header files, but is an internal feature and should " -"not be used. It will be removed in a future version of CPython" +"This flag is present in header files, but is not be used. It will be removed " +"in a future version of CPython" msgstr "" -#: ../../c-api/typeobj.rst:1352 +#: ../../c-api/typeobj.rst:1337 msgid "" "An optional pointer to a NUL-terminated C string giving the docstring for " -"this type object. This is exposed as the :attr:`__doc__` attribute on the " -"type and instances of the type." +"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:1358 +#: ../../c-api/typeobj.rst:1343 msgid "This field is *not* inherited by subtypes." msgstr "" -#: ../../c-api/typeobj.rst:1363 +#: ../../c-api/typeobj.rst:1348 msgid "" "An optional pointer to a traversal function for the garbage collector. This " "is only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1366 +#: ../../c-api/typeobj.rst:1351 msgid "int tp_traverse(PyObject *self, visitproc visit, void *arg);" msgstr "int tp_traverse(PyObject *self, visitproc visit, void *arg);" -#: ../../c-api/typeobj.rst:1368 ../../c-api/typeobj.rst:1489 +#: ../../c-api/typeobj.rst:1353 ../../c-api/typeobj.rst:1497 msgid "" "More information about Python's garbage collection scheme can be found in " "section :ref:`supporting-cycle-detection`." msgstr "" -#: ../../c-api/typeobj.rst:1371 +#: ../../c-api/typeobj.rst:1356 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` pointer is used by the garbage " "collector to detect reference cycles. A typical implementation of a :c:" @@ -2363,7 +2345,7 @@ msgid "" "`!_thread` extension module::" msgstr "" -#: ../../c-api/typeobj.rst:1377 +#: ../../c-api/typeobj.rst:1362 msgid "" "static int\n" "local_traverse(localobject *self, visitproc visit, void *arg)\n" @@ -2383,7 +2365,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1386 +#: ../../c-api/typeobj.rst:1371 msgid "" "Note that :c:func:`Py_VISIT` is called only on those members that can " "participate in reference cycles. Although there is also a ``self->key`` " @@ -2391,14 +2373,48 @@ msgid "" "part of a reference cycle." msgstr "" -#: ../../c-api/typeobj.rst:1390 +#: ../../c-api/typeobj.rst:1375 msgid "" "On the other hand, even if you know a member can never be part of a cycle, " "as a debugging aid you may want to visit it anyway just so the :mod:`gc` " "module's :func:`~gc.get_referents` function will include it." msgstr "" -#: ../../c-api/typeobj.rst:1395 +#: ../../c-api/typeobj.rst:1379 +msgid "" +"Heap types (:c:macro:`Py_TPFLAGS_HEAPTYPE`) must visit their type with::" +msgstr "" + +#: ../../c-api/typeobj.rst:1381 +msgid "Py_VISIT(Py_TYPE(self));" +msgstr "" + +#: ../../c-api/typeobj.rst:1383 +msgid "" +"It is only needed since Python 3.9. To support Python 3.8 and older, this " +"line must be conditional::" +msgstr "" + +#: ../../c-api/typeobj.rst:1386 +msgid "" +"#if PY_VERSION_HEX >= 0x03090000\n" +" Py_VISIT(Py_TYPE(self));\n" +"#endif" +msgstr "" + +#: ../../c-api/typeobj.rst:1390 +msgid "" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" +"`PyObject_VisitManagedDict` like this::" +msgstr "" + +#: ../../c-api/typeobj.rst:1394 +#, fuzzy +msgid "PyObject_VisitManagedDict((PyObject*)self, visit, arg);" +msgstr "PyObject *tp_iternext(PyObject *self);" + +#: ../../c-api/typeobj.rst:1397 msgid "" "When implementing :c:member:`~PyTypeObject.tp_traverse`, only the members " "that the instance *owns* (by having :term:`strong references ` hold a reference to " "their type. Their traversal function must therefore either visit :c:func:" @@ -2427,14 +2443,14 @@ msgid "" "superclass). If they do not, the type object may not be garbage-collected." msgstr "" -#: ../../c-api/typeobj.rst:1419 +#: ../../c-api/typeobj.rst:1421 msgid "" "Heap-allocated types are expected to visit ``Py_TYPE(self)`` in " "``tp_traverse``. In earlier versions of Python, due to `bug 40217 `_, doing this may lead to crashes in subclasses." msgstr "" -#: ../../c-api/typeobj.rst:1428 +#: ../../c-api/typeobj.rst:1430 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_clear` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :c:" @@ -2442,18 +2458,18 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1436 +#: ../../c-api/typeobj.rst:1438 msgid "" "An optional pointer to a clear function for the garbage collector. This is " "only used if the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit is set. The " "signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1439 +#: ../../c-api/typeobj.rst:1441 msgid "int tp_clear(PyObject *);" msgstr "int tp_clear(PyObject *);" -#: ../../c-api/typeobj.rst:1441 +#: ../../c-api/typeobj.rst:1443 msgid "" "The :c:member:`~PyTypeObject.tp_clear` member function is used to break " "reference cycles in cyclic garbage detected by the garbage collector. Taken " @@ -2468,7 +2484,7 @@ msgid "" "good reason to avoid implementing :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1451 +#: ../../c-api/typeobj.rst:1453 msgid "" "Implementations of :c:member:`~PyTypeObject.tp_clear` should drop the " "instance's references to those of its members that may be Python objects, " @@ -2476,7 +2492,7 @@ msgid "" "example::" msgstr "" -#: ../../c-api/typeobj.rst:1455 +#: ../../c-api/typeobj.rst:1457 msgid "" "static int\n" "local_clear(localobject *self)\n" @@ -2498,7 +2514,7 @@ msgstr "" " return 0;\n" "}" -#: ../../c-api/typeobj.rst:1465 +#: ../../c-api/typeobj.rst:1467 msgid "" "The :c:func:`Py_CLEAR` macro should be used, because clearing references is " "delicate: the reference to the contained object must not be released (via :" @@ -2513,7 +2529,19 @@ msgid "" "performs the operations in a safe order." msgstr "" -#: ../../c-api/typeobj.rst:1477 +#: ../../c-api/typeobj.rst:1479 +msgid "" +"If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" +"`~PyTypeObject.tp_flags` field, the traverse function must call :c:func:" +"`PyObject_ClearManagedDict` like this::" +msgstr "" + +#: ../../c-api/typeobj.rst:1483 +#, fuzzy +msgid "PyObject_ClearManagedDict((PyObject*)self);" +msgstr "PyObject *am_anext(PyObject *self);" + +#: ../../c-api/typeobj.rst:1485 msgid "" "Note that :c:member:`~PyTypeObject.tp_clear` is not *always* called before " "an instance is deallocated. For example, when reference counting is enough " @@ -2521,7 +2549,7 @@ msgid "" "is not involved and :c:member:`~PyTypeObject.tp_dealloc` is called directly." msgstr "" -#: ../../c-api/typeobj.rst:1483 +#: ../../c-api/typeobj.rst:1491 msgid "" "Because the goal of :c:member:`~PyTypeObject.tp_clear` functions is to break " "reference cycles, it's not necessary to clear contained objects like Python " @@ -2531,7 +2559,7 @@ msgid "" "invoke :c:member:`~PyTypeObject.tp_clear`." msgstr "" -#: ../../c-api/typeobj.rst:1496 +#: ../../c-api/typeobj.rst:1504 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_traverse` and the :c:macro:`Py_TPFLAGS_HAVE_GC` flag bit: the flag bit, :" @@ -2539,22 +2567,22 @@ msgid "" "are all inherited from the base type if they are all zero in the subtype." msgstr "" -#: ../../c-api/typeobj.rst:1504 +#: ../../c-api/typeobj.rst:1512 msgid "" "An optional pointer to the rich comparison function, whose signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1506 +#: ../../c-api/typeobj.rst:1514 msgid "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" msgstr "PyObject *tp_richcompare(PyObject *self, PyObject *other, int op);" -#: ../../c-api/typeobj.rst:1508 +#: ../../c-api/typeobj.rst:1516 msgid "" "The first parameter is guaranteed to be an instance of the type that is " "defined by :c:type:`PyTypeObject`." msgstr "" -#: ../../c-api/typeobj.rst:1511 +#: ../../c-api/typeobj.rst:1519 msgid "" "The function should return the result of the comparison (usually ``Py_True`` " "or ``Py_False``). If the comparison is undefined, it must return " @@ -2562,50 +2590,50 @@ msgid "" "set an exception condition." msgstr "" -#: ../../c-api/typeobj.rst:1516 +#: ../../c-api/typeobj.rst:1524 msgid "" "The following constants are defined to be used as the third argument for :c:" "member:`~PyTypeObject.tp_richcompare` and for :c:func:`PyObject_RichCompare`:" msgstr "" -#: ../../c-api/typeobj.rst:1522 +#: ../../c-api/typeobj.rst:1530 msgid "Constant" msgstr "常數" -#: ../../c-api/typeobj.rst:1522 +#: ../../c-api/typeobj.rst:1530 msgid "Comparison" msgstr "" -#: ../../c-api/typeobj.rst:1524 +#: ../../c-api/typeobj.rst:1532 msgid "``<``" msgstr "``<``" -#: ../../c-api/typeobj.rst:1526 +#: ../../c-api/typeobj.rst:1534 msgid "``<=``" msgstr "``<=``" -#: ../../c-api/typeobj.rst:1528 +#: ../../c-api/typeobj.rst:1536 msgid "``==``" msgstr "``==``" -#: ../../c-api/typeobj.rst:1530 +#: ../../c-api/typeobj.rst:1538 msgid "``!=``" msgstr "``!=``" -#: ../../c-api/typeobj.rst:1532 +#: ../../c-api/typeobj.rst:1540 msgid "``>``" msgstr "``>``" -#: ../../c-api/typeobj.rst:1534 +#: ../../c-api/typeobj.rst:1542 msgid "``>=``" msgstr "``>=``" -#: ../../c-api/typeobj.rst:1537 +#: ../../c-api/typeobj.rst:1545 msgid "" "The following macro is defined to ease writing rich comparison functions:" msgstr "" -#: ../../c-api/typeobj.rst:1541 +#: ../../c-api/typeobj.rst:1549 msgid "" "Return ``Py_True`` or ``Py_False`` from the function, depending on the " "result of a comparison. VAL_A and VAL_B must be orderable by C comparison " @@ -2613,15 +2641,15 @@ msgid "" "specifies the requested operation, as for :c:func:`PyObject_RichCompare`." msgstr "" -#: ../../c-api/typeobj.rst:1547 +#: ../../c-api/typeobj.rst:1555 msgid "The returned value is a new :term:`strong reference`." msgstr "" -#: ../../c-api/typeobj.rst:1549 +#: ../../c-api/typeobj.rst:1557 msgid "On error, sets an exception and returns ``NULL`` from the function." msgstr "" -#: ../../c-api/typeobj.rst:1557 +#: ../../c-api/typeobj.rst:1565 msgid "" "This field is inherited by subtypes together with :c:member:`~PyTypeObject." "tp_hash`: a subtype inherits :c:member:`~PyTypeObject.tp_richcompare` and :c:" @@ -2629,7 +2657,7 @@ msgid "" "tp_richcompare` and :c:member:`~PyTypeObject.tp_hash` are both ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1564 +#: ../../c-api/typeobj.rst:1572 msgid "" ":c:data:`PyBaseObject_Type` provides a :c:member:`~PyTypeObject." "tp_richcompare` implementation, which may be inherited. However, if only :c:" @@ -2638,13 +2666,13 @@ msgid "" "comparisons." msgstr "" -#: ../../c-api/typeobj.rst:1573 +#: ../../c-api/typeobj.rst:1581 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1576 +#: ../../c-api/typeobj.rst:1584 msgid "" "If the instances of this type are weakly referenceable, this field is " "greater than zero and contains the offset in the instance structure of the " @@ -2654,19 +2682,19 @@ msgid "" "`PyObject*` which is initialized to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:1583 +#: ../../c-api/typeobj.rst:1591 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_weaklist`; that " "is the list head for weak references to the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1586 +#: ../../c-api/typeobj.rst:1594 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_weaklistoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1591 +#: ../../c-api/typeobj.rst:1599 msgid "" "This field is inherited by subtypes, but see the rules listed below. A " "subtype may override this offset; this means that the subtype uses a " @@ -2675,7 +2703,7 @@ msgid "" "not be a problem." msgstr "" -#: ../../c-api/typeobj.rst:1598 +#: ../../c-api/typeobj.rst:1606 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit is set in the :c:member:" "`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject." @@ -2683,32 +2711,32 @@ msgid "" "unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1606 +#: ../../c-api/typeobj.rst:1614 msgid "" "An optional pointer to a function that returns an :term:`iterator` for the " "object. Its presence normally signals that the instances of this type are :" "term:`iterable` (although sequences may be iterable without this function)." msgstr "" -#: ../../c-api/typeobj.rst:1610 +#: ../../c-api/typeobj.rst:1618 msgid "This function has the same signature as :c:func:`PyObject_GetIter`::" msgstr "" -#: ../../c-api/typeobj.rst:1612 +#: ../../c-api/typeobj.rst:1620 msgid "PyObject *tp_iter(PyObject *self);" msgstr "PyObject *tp_iter(PyObject *self);" -#: ../../c-api/typeobj.rst:1621 +#: ../../c-api/typeobj.rst:1629 msgid "" "An optional pointer to a function that returns the next item in an :term:" "`iterator`. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1624 +#: ../../c-api/typeobj.rst:1632 msgid "PyObject *tp_iternext(PyObject *self);" msgstr "PyObject *tp_iternext(PyObject *self);" -#: ../../c-api/typeobj.rst:1626 +#: ../../c-api/typeobj.rst:1634 msgid "" "When the iterator is exhausted, it must return ``NULL``; a :exc:" "`StopIteration` exception may or may not be set. When another error occurs, " @@ -2716,74 +2744,74 @@ msgid "" "this type are iterators." msgstr "" -#: ../../c-api/typeobj.rst:1631 +#: ../../c-api/typeobj.rst:1639 msgid "" "Iterator types should also define the :c:member:`~PyTypeObject.tp_iter` " "function, and that function should return the iterator instance itself (not " "a new iterator instance)." msgstr "" -#: ../../c-api/typeobj.rst:1635 +#: ../../c-api/typeobj.rst:1643 msgid "This function has the same signature as :c:func:`PyIter_Next`." msgstr "" -#: ../../c-api/typeobj.rst:1644 +#: ../../c-api/typeobj.rst:1652 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMethodDef` structures, declaring regular methods of this type." msgstr "" -#: ../../c-api/typeobj.rst:1647 +#: ../../c-api/typeobj.rst:1655 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a method descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1652 +#: ../../c-api/typeobj.rst:1660 msgid "" "This field is not inherited by subtypes (methods are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1658 +#: ../../c-api/typeobj.rst:1666 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyMemberDef` structures, declaring regular data members (fields or slots) " "of instances of this type." msgstr "" -#: ../../c-api/typeobj.rst:1662 +#: ../../c-api/typeobj.rst:1670 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a member descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1667 +#: ../../c-api/typeobj.rst:1675 msgid "" "This field is not inherited by subtypes (members are inherited through a " "different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1673 +#: ../../c-api/typeobj.rst:1681 msgid "" "An optional pointer to a static ``NULL``-terminated array of :c:type:" "`PyGetSetDef` structures, declaring computed attributes of instances of this " "type." msgstr "" -#: ../../c-api/typeobj.rst:1676 +#: ../../c-api/typeobj.rst:1684 msgid "" "For each entry in the array, an entry is added to the type's dictionary " "(see :c:member:`~PyTypeObject.tp_dict` below) containing a getset descriptor." msgstr "" -#: ../../c-api/typeobj.rst:1681 +#: ../../c-api/typeobj.rst:1689 msgid "" "This field is not inherited by subtypes (computed attributes are inherited " "through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1687 +#: ../../c-api/typeobj.rst:1695 msgid "" "An optional pointer to a base type from which type properties are " "inherited. At this level, only single inheritance is supported; multiple " @@ -2791,7 +2819,7 @@ msgid "" "metatype." msgstr "" -#: ../../c-api/typeobj.rst:1695 +#: ../../c-api/typeobj.rst:1703 msgid "" "Slot initialization is subject to the rules of initializing globals. C99 " "requires the initializers to be \"address constants\". Function designators " @@ -2799,7 +2827,7 @@ msgid "" "valid C99 address constants." msgstr "" -#: ../../c-api/typeobj.rst:1700 +#: ../../c-api/typeobj.rst:1708 msgid "" "However, the unary '&' operator applied to a non-static variable like :c:" "data:`PyBaseObject_Type` is not required to produce an address constant. " @@ -2807,27 +2835,27 @@ msgid "" "strictly standard conforming in this particular behavior." msgstr "" -#: ../../c-api/typeobj.rst:1706 +#: ../../c-api/typeobj.rst:1714 msgid "" "Consequently, :c:member:`~PyTypeObject.tp_base` should be set in the " "extension module's init function." msgstr "" -#: ../../c-api/typeobj.rst:1711 +#: ../../c-api/typeobj.rst:1719 msgid "This field is not inherited by subtypes (obviously)." msgstr "" -#: ../../c-api/typeobj.rst:1715 +#: ../../c-api/typeobj.rst:1723 msgid "" "This field defaults to ``&PyBaseObject_Type`` (which to Python programmers " "is known as the type :class:`object`)." msgstr "" -#: ../../c-api/typeobj.rst:1721 +#: ../../c-api/typeobj.rst:1729 msgid "The type's dictionary is stored here by :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:1723 +#: ../../c-api/typeobj.rst:1731 msgid "" "This field should normally be initialized to ``NULL`` before PyType_Ready is " "called; it may also be initialized to a dictionary containing initial " @@ -2838,73 +2866,73 @@ msgid "" "be treated as read-only." msgstr "" -#: ../../c-api/typeobj.rst:1731 +#: ../../c-api/typeobj.rst:1739 msgid "" "Some types may not store their dictionary in this slot. Use :c:func:" "`PyType_GetDict` to retrieve the dictionary for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1737 +#: ../../c-api/typeobj.rst:1745 msgid "" "Internals detail: For static builtin types, this is always ``NULL``. " "Instead, the dict for such types is stored on ``PyInterpreterState``. Use :c:" "func:`PyType_GetDict` to get the dict for an arbitrary type." msgstr "" -#: ../../c-api/typeobj.rst:1743 +#: ../../c-api/typeobj.rst:1751 msgid "" "This field is not inherited by subtypes (though the attributes defined in " "here are inherited through a different mechanism)." msgstr "" -#: ../../c-api/typeobj.rst:1748 +#: ../../c-api/typeobj.rst:1756 msgid "" "If this field is ``NULL``, :c:func:`PyType_Ready` will assign a new " "dictionary to it." msgstr "" -#: ../../c-api/typeobj.rst:1753 +#: ../../c-api/typeobj.rst:1761 msgid "" "It is not safe to use :c:func:`PyDict_SetItem` on or otherwise modify :c:" "member:`~PyTypeObject.tp_dict` with the dictionary C-API." msgstr "" -#: ../../c-api/typeobj.rst:1759 +#: ../../c-api/typeobj.rst:1767 msgid "An optional pointer to a \"descriptor get\" function." msgstr "" -#: ../../c-api/typeobj.rst:1761 ../../c-api/typeobj.rst:1777 -#: ../../c-api/typeobj.rst:1841 ../../c-api/typeobj.rst:1871 -#: ../../c-api/typeobj.rst:1895 +#: ../../c-api/typeobj.rst:1769 ../../c-api/typeobj.rst:1785 +#: ../../c-api/typeobj.rst:1849 ../../c-api/typeobj.rst:1879 +#: ../../c-api/typeobj.rst:1903 msgid "The function signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1763 +#: ../../c-api/typeobj.rst:1771 msgid "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" msgstr "" "PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type);" -#: ../../c-api/typeobj.rst:1774 +#: ../../c-api/typeobj.rst:1782 msgid "" "An optional pointer to a function for setting and deleting a descriptor's " "value." msgstr "" -#: ../../c-api/typeobj.rst:1779 +#: ../../c-api/typeobj.rst:1787 msgid "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" msgstr "int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value);" -#: ../../c-api/typeobj.rst:1781 +#: ../../c-api/typeobj.rst:1789 msgid "The *value* argument is set to ``NULL`` to delete the value." msgstr "" -#: ../../c-api/typeobj.rst:1792 +#: ../../c-api/typeobj.rst:1800 msgid "" "While this field is still supported, :c:macro:`Py_TPFLAGS_MANAGED_DICT` " "should be used instead, if at all possible." msgstr "" -#: ../../c-api/typeobj.rst:1795 +#: ../../c-api/typeobj.rst:1803 msgid "" "If the instances of this type have a dictionary containing instance " "variables, this field is non-zero and contains the offset in the instances " @@ -2912,19 +2940,19 @@ msgid "" "func:`PyObject_GenericGetAttr`." msgstr "" -#: ../../c-api/typeobj.rst:1800 +#: ../../c-api/typeobj.rst:1808 msgid "" "Do not confuse this field with :c:member:`~PyTypeObject.tp_dict`; that is " "the dictionary for attributes of the type object itself." msgstr "" -#: ../../c-api/typeobj.rst:1803 +#: ../../c-api/typeobj.rst:1811 msgid "" "The value specifies the offset of the dictionary from the start of the " "instance structure." msgstr "" -#: ../../c-api/typeobj.rst:1805 +#: ../../c-api/typeobj.rst:1813 msgid "" "The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-" "only. To get the pointer to the dictionary call :c:func:" @@ -2933,13 +2961,13 @@ msgid "" "to call :c:func:`PyObject_GetAttr` when accessing an attribute on the object." msgstr "" -#: ../../c-api/typeobj.rst:1811 +#: ../../c-api/typeobj.rst:1819 msgid "" "It is an error to set both the :c:macro:`Py_TPFLAGS_MANAGED_WEAKREF` bit " "and :c:member:`~PyTypeObject.tp_dictoffset`." msgstr "" -#: ../../c-api/typeobj.rst:1816 +#: ../../c-api/typeobj.rst:1824 msgid "" "This field is inherited by subtypes. A subtype should not override this " "offset; doing so could be unsafe, if C code tries to access the dictionary " @@ -2947,25 +2975,25 @@ msgid "" "`Py_TPFLAGS_MANAGED_DICT`." msgstr "" -#: ../../c-api/typeobj.rst:1823 +#: ../../c-api/typeobj.rst:1831 msgid "" "This slot has no default. For :ref:`static types `, if the " "field is ``NULL`` then no :attr:`~object.__dict__` gets created for " "instances." msgstr "" -#: ../../c-api/typeobj.rst:1826 +#: ../../c-api/typeobj.rst:1834 msgid "" "If the :c:macro:`Py_TPFLAGS_MANAGED_DICT` bit is set in the :c:member:" -"`~PyTypeObject.tp_dict` field, then :c:member:`~PyTypeObject.tp_dictoffset` " +"`~PyTypeObject.tp_flags` field, then :c:member:`~PyTypeObject.tp_dictoffset` " "will be set to ``-1``, to indicate that it is unsafe to use this field." msgstr "" -#: ../../c-api/typeobj.rst:1834 +#: ../../c-api/typeobj.rst:1842 msgid "An optional pointer to an instance initialization function." msgstr "" -#: ../../c-api/typeobj.rst:1836 +#: ../../c-api/typeobj.rst:1844 msgid "" "This function corresponds to the :meth:`~object.__init__` method of " "classes. Like :meth:`!__init__`, it is possible to create an instance " @@ -2973,18 +3001,18 @@ msgid "" "instance by calling its :meth:`!__init__` method again." msgstr "" -#: ../../c-api/typeobj.rst:1843 +#: ../../c-api/typeobj.rst:1851 msgid "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" msgstr "int tp_init(PyObject *self, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1845 +#: ../../c-api/typeobj.rst:1853 msgid "" "The self argument is the instance to be initialized; the *args* and *kwds* " "arguments represent positional and keyword arguments of the call to :meth:" "`~object.__init__`." msgstr "" -#: ../../c-api/typeobj.rst:1849 +#: ../../c-api/typeobj.rst:1857 msgid "" "The :c:member:`~PyTypeObject.tp_init` function, if not ``NULL``, is called " "when an instance is created normally by calling its type, after the type's :" @@ -2996,53 +3024,53 @@ msgid "" "subtype's :c:member:`~PyTypeObject.tp_init` is called." msgstr "" -#: ../../c-api/typeobj.rst:1856 +#: ../../c-api/typeobj.rst:1864 msgid "Returns ``0`` on success, ``-1`` and sets an exception on error." msgstr "" -#: ../../c-api/typeobj.rst:1864 +#: ../../c-api/typeobj.rst:1872 msgid "" "For :ref:`static types ` this field does not have a default." msgstr "" -#: ../../c-api/typeobj.rst:1869 +#: ../../c-api/typeobj.rst:1877 msgid "An optional pointer to an instance allocation function." msgstr "" -#: ../../c-api/typeobj.rst:1873 +#: ../../c-api/typeobj.rst:1881 msgid "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" msgstr "PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems);" -#: ../../c-api/typeobj.rst:1877 +#: ../../c-api/typeobj.rst:1885 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)." msgstr "" -#: ../../c-api/typeobj.rst:1882 +#: ../../c-api/typeobj.rst:1890 msgid "" "For dynamic subtypes, this field is always set to :c:func:" "`PyType_GenericAlloc`, to force a standard heap allocation strategy." msgstr "" -#: ../../c-api/typeobj.rst:1886 +#: ../../c-api/typeobj.rst:1894 msgid "" "For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:" "`PyType_GenericAlloc`. That is the recommended value for all statically " "defined types." msgstr "" -#: ../../c-api/typeobj.rst:1893 +#: ../../c-api/typeobj.rst:1901 msgid "An optional pointer to an instance creation function." msgstr "" -#: ../../c-api/typeobj.rst:1897 +#: ../../c-api/typeobj.rst:1905 msgid "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" msgstr "" "PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds);" -#: ../../c-api/typeobj.rst:1899 +#: ../../c-api/typeobj.rst:1907 msgid "" "The *subtype* argument is the type of the object being created; the *args* " "and *kwds* arguments represent positional and keyword arguments of the call " @@ -3051,7 +3079,7 @@ msgid "" "that type (but not an unrelated type)." msgstr "" -#: ../../c-api/typeobj.rst:1905 +#: ../../c-api/typeobj.rst:1913 msgid "" "The :c:member:`~PyTypeObject.tp_new` function should call ``subtype-" ">tp_alloc(subtype, nitems)`` to allocate space for the object, and then do " @@ -3063,20 +3091,20 @@ msgid "" "be deferred to :c:member:`~PyTypeObject.tp_init`." msgstr "" -#: ../../c-api/typeobj.rst:1913 +#: ../../c-api/typeobj.rst:1921 msgid "" "Set the :c:macro:`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag to disallow " "creating instances of the type in Python." msgstr "" -#: ../../c-api/typeobj.rst:1918 +#: ../../c-api/typeobj.rst:1926 msgid "" "This field is inherited by subtypes, except it is not inherited by :ref:" "`static types ` whose :c:member:`~PyTypeObject.tp_base` is " "``NULL`` or ``&PyBaseObject_Type``." msgstr "" -#: ../../c-api/typeobj.rst:1924 +#: ../../c-api/typeobj.rst:1932 msgid "" "For :ref:`static types ` this field has no default. This means " "if the slot is defined as ``NULL``, the type cannot be called to create new " @@ -3084,44 +3112,44 @@ msgid "" "factory function." msgstr "" -#: ../../c-api/typeobj.rst:1932 +#: ../../c-api/typeobj.rst:1940 msgid "" "An optional pointer to an instance deallocation function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1934 +#: ../../c-api/typeobj.rst:1942 msgid "void tp_free(void *self);" msgstr "void tp_free(void *self);" -#: ../../c-api/typeobj.rst:1936 +#: ../../c-api/typeobj.rst:1944 msgid "" "An initializer that is compatible with this signature is :c:func:" "`PyObject_Free`." msgstr "" -#: ../../c-api/typeobj.rst:1940 +#: ../../c-api/typeobj.rst:1948 msgid "" "This field is inherited by static subtypes, but not by dynamic subtypes " "(subtypes created by a class statement)" msgstr "" -#: ../../c-api/typeobj.rst:1945 +#: ../../c-api/typeobj.rst:1953 msgid "" "In dynamic subtypes, this field is set to a deallocator suitable to match :c:" "func:`PyType_GenericAlloc` and the value of the :c:macro:" "`Py_TPFLAGS_HAVE_GC` flag bit." msgstr "" -#: ../../c-api/typeobj.rst:1949 +#: ../../c-api/typeobj.rst:1957 msgid "" "For static subtypes, :c:data:`PyBaseObject_Type` uses :c:func:`PyObject_Del`." msgstr "" -#: ../../c-api/typeobj.rst:1954 +#: ../../c-api/typeobj.rst:1962 msgid "An optional pointer to a function called by the garbage collector." msgstr "" -#: ../../c-api/typeobj.rst:1956 +#: ../../c-api/typeobj.rst:1964 msgid "" "The garbage collector needs to know whether a particular object is " "collectible or not. Normally, it is sufficient to look at the object's " @@ -3133,93 +3161,93 @@ msgid "" "instance. The signature is::" msgstr "" -#: ../../c-api/typeobj.rst:1964 +#: ../../c-api/typeobj.rst:1972 msgid "int tp_is_gc(PyObject *self);" msgstr "int tp_is_gc(PyObject *self);" -#: ../../c-api/typeobj.rst:1966 +#: ../../c-api/typeobj.rst:1974 msgid "" "(The only example of this are types themselves. The metatype, :c:data:" "`PyType_Type`, defines this function to distinguish between statically and :" "ref:`dynamically allocated types `.)" msgstr "" -#: ../../c-api/typeobj.rst:1976 +#: ../../c-api/typeobj.rst:1984 msgid "" "This slot has no default. If this field is ``NULL``, :c:macro:" "`Py_TPFLAGS_HAVE_GC` is used as the functional equivalent." msgstr "" -#: ../../c-api/typeobj.rst:1982 +#: ../../c-api/typeobj.rst:1990 msgid "Tuple of base types." msgstr "" -#: ../../c-api/typeobj.rst:1984 ../../c-api/typeobj.rst:2008 +#: ../../c-api/typeobj.rst:1992 ../../c-api/typeobj.rst:2016 msgid "" "This field should be set to ``NULL`` and treated as read-only. Python will " "fill it in when the type is :c:func:`initialized `." msgstr "" -#: ../../c-api/typeobj.rst:1987 +#: ../../c-api/typeobj.rst:1995 msgid "" "For dynamically created classes, the ``Py_tp_bases`` :c:type:`slot " "` can be used instead of the *bases* argument of :c:func:" "`PyType_FromSpecWithBases`. The argument form is preferred." msgstr "" -#: ../../c-api/typeobj.rst:1994 +#: ../../c-api/typeobj.rst:2002 msgid "" "Multiple inheritance does not work well for statically defined types. If you " "set ``tp_bases`` to a tuple, Python will not raise an error, but some slots " "will only be inherited from the first base." msgstr "" -#: ../../c-api/typeobj.rst:2000 ../../c-api/typeobj.rst:2023 -#: ../../c-api/typeobj.rst:2040 ../../c-api/typeobj.rst:2057 -#: ../../c-api/typeobj.rst:2071 +#: ../../c-api/typeobj.rst:2008 ../../c-api/typeobj.rst:2031 +#: ../../c-api/typeobj.rst:2048 ../../c-api/typeobj.rst:2065 +#: ../../c-api/typeobj.rst:2079 msgid "This field is not inherited." msgstr "" -#: ../../c-api/typeobj.rst:2005 +#: ../../c-api/typeobj.rst:2013 msgid "" "Tuple containing the expanded set of base types, starting with the type " "itself and ending with :class:`object`, in Method Resolution Order." msgstr "" -#: ../../c-api/typeobj.rst:2013 +#: ../../c-api/typeobj.rst:2021 msgid "" "This field is not inherited; it is calculated fresh by :c:func:" "`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2019 +#: ../../c-api/typeobj.rst:2027 msgid "Unused. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2028 +#: ../../c-api/typeobj.rst:2036 msgid "" "A collection of subclasses. Internal use only. May be an invalid pointer." msgstr "" -#: ../../c-api/typeobj.rst:2030 +#: ../../c-api/typeobj.rst:2038 msgid "" -"To get a list of subclasses, call the Python method :py:meth:`~class." +"To get a list of subclasses, call the Python method :py:meth:`~type." "__subclasses__`." msgstr "" -#: ../../c-api/typeobj.rst:2035 +#: ../../c-api/typeobj.rst:2043 msgid "" "For some types, this field does not hold a valid :c:expr:`PyObject*`. The " "type was changed to :c:expr:`void*` to indicate this." msgstr "" -#: ../../c-api/typeobj.rst:2045 +#: ../../c-api/typeobj.rst:2053 msgid "" "Weak reference list head, for weak references to this type object. Not " "inherited. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2050 +#: ../../c-api/typeobj.rst:2058 msgid "" "Internals detail: For the static builtin types this is always ``NULL``, even " "if weakrefs are added. Instead, the weakrefs for each are stored on " @@ -3227,25 +3255,25 @@ msgid "" "``_PyObject_GET_WEAKREFS_LISTPTR()`` macro to avoid the distinction." msgstr "" -#: ../../c-api/typeobj.rst:2062 +#: ../../c-api/typeobj.rst:2070 msgid "" "This field is deprecated. Use :c:member:`~PyTypeObject.tp_finalize` instead." msgstr "" -#: ../../c-api/typeobj.rst:2067 +#: ../../c-api/typeobj.rst:2075 msgid "Used to index into the method cache. Internal use only." msgstr "" -#: ../../c-api/typeobj.rst:2076 +#: ../../c-api/typeobj.rst:2084 msgid "" "An optional pointer to an instance finalization function. Its signature is::" msgstr "" -#: ../../c-api/typeobj.rst:2078 +#: ../../c-api/typeobj.rst:2086 msgid "void tp_finalize(PyObject *self);" msgstr "void tp_finalize(PyObject *self);" -#: ../../c-api/typeobj.rst:2080 +#: ../../c-api/typeobj.rst:2088 msgid "" "If :c:member:`~PyTypeObject.tp_finalize` is set, the interpreter calls it " "once when finalizing an instance. It is called either from the garbage " @@ -3255,14 +3283,14 @@ msgid "" "object in a sane state." msgstr "" -#: ../../c-api/typeobj.rst:2087 +#: ../../c-api/typeobj.rst:2095 msgid "" ":c:member:`~PyTypeObject.tp_finalize` should not mutate the current " "exception status; therefore, a recommended way to write a non-trivial " "finalizer is::" msgstr "" -#: ../../c-api/typeobj.rst:2090 +#: ../../c-api/typeobj.rst:2098 msgid "" "static void\n" "local_finalize(PyObject *self)\n" @@ -3279,7 +3307,7 @@ msgid "" "}" msgstr "" -#: ../../c-api/typeobj.rst:2104 +#: ../../c-api/typeobj.rst:2112 msgid "" "Also, note that, in a garbage collected Python, :c:member:`~PyTypeObject." "tp_dealloc` may be called from any Python thread, not just the thread which " @@ -3292,18 +3320,18 @@ msgid "" "which called tp_dealloc will not violate any assumptions of the library." msgstr "" -#: ../../c-api/typeobj.rst:2123 +#: ../../c-api/typeobj.rst:2131 msgid "" "Before version 3.8 it was necessary to set the :c:macro:" "`Py_TPFLAGS_HAVE_FINALIZE` flags bit in order for this field to be used. " "This is no longer required." msgstr "" -#: ../../c-api/typeobj.rst:2127 +#: ../../c-api/typeobj.rst:2135 msgid "\"Safe object finalization\" (:pep:`442`)" msgstr "" -#: ../../c-api/typeobj.rst:2132 +#: ../../c-api/typeobj.rst:2140 msgid "" "Vectorcall function to use for calls of this type object. In other words, it " "is used to implement :ref:`vectorcall ` for ``type.__call__``. " @@ -3311,65 +3339,65 @@ msgid "" "meth:`~object.__new__` and :meth:`~object.__init__` is used." msgstr "" -#: ../../c-api/typeobj.rst:2140 +#: ../../c-api/typeobj.rst:2148 msgid "This field is never inherited." msgstr "" -#: ../../c-api/typeobj.rst:2142 +#: ../../c-api/typeobj.rst:2150 msgid "(the field exists since 3.8 but it's only used since 3.9)" msgstr "" -#: ../../c-api/typeobj.rst:2147 +#: ../../c-api/typeobj.rst:2155 msgid "Internal. Do not use." msgstr "" -#: ../../c-api/typeobj.rst:2155 +#: ../../c-api/typeobj.rst:2163 msgid "Static Types" msgstr "" -#: ../../c-api/typeobj.rst:2157 +#: ../../c-api/typeobj.rst:2165 msgid "" "Traditionally, types defined in C code are *static*, that is, a static :c:" "type:`PyTypeObject` structure is defined directly in code and initialized " "using :c:func:`PyType_Ready`." msgstr "" -#: ../../c-api/typeobj.rst:2161 +#: ../../c-api/typeobj.rst:2169 msgid "" "This results in types that are limited relative to types defined in Python:" msgstr "" -#: ../../c-api/typeobj.rst:2163 +#: ../../c-api/typeobj.rst:2171 msgid "" "Static types are limited to one base, i.e. they cannot use multiple " "inheritance." msgstr "" -#: ../../c-api/typeobj.rst:2165 +#: ../../c-api/typeobj.rst:2173 msgid "" "Static type objects (but not necessarily their instances) are immutable. It " "is not possible to add or modify the type object's attributes from Python." msgstr "" -#: ../../c-api/typeobj.rst:2167 +#: ../../c-api/typeobj.rst:2175 msgid "" "Static type objects are shared across :ref:`sub-interpreters `, so they should not include any subinterpreter-" "specific state." msgstr "" -#: ../../c-api/typeobj.rst:2171 +#: ../../c-api/typeobj.rst:2179 msgid "" "Also, since :c:type:`PyTypeObject` is only part of the :ref:`Limited API " "` as an opaque struct, any extension modules using static " "types must be compiled for a specific Python minor version." msgstr "" -#: ../../c-api/typeobj.rst:2179 +#: ../../c-api/typeobj.rst:2187 msgid "Heap Types" msgstr "" -#: ../../c-api/typeobj.rst:2181 +#: ../../c-api/typeobj.rst:2189 msgid "" "An alternative to :ref:`static types ` is *heap-allocated " "types*, or *heap types* for short, which correspond closely to classes " @@ -3377,29 +3405,29 @@ msgid "" "`Py_TPFLAGS_HEAPTYPE` flag set." msgstr "" -#: ../../c-api/typeobj.rst:2186 +#: ../../c-api/typeobj.rst:2194 msgid "" "This is done by filling a :c:type:`PyType_Spec` structure and calling :c:" "func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases`, :c:func:" "`PyType_FromModuleAndSpec`, or :c:func:`PyType_FromMetaclass`." msgstr "" -#: ../../c-api/typeobj.rst:2194 +#: ../../c-api/typeobj.rst:2202 msgid "Number Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2201 +#: ../../c-api/typeobj.rst:2209 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the number protocol. Each function is used by the function of " "similar name documented in the :ref:`number` section." msgstr "" -#: ../../c-api/typeobj.rst:2207 ../../c-api/typeobj.rst:2531 +#: ../../c-api/typeobj.rst:2215 ../../c-api/typeobj.rst:2539 msgid "Here is the structure definition::" msgstr "" -#: ../../c-api/typeobj.rst:2209 +#: ../../c-api/typeobj.rst:2217 msgid "" "typedef struct {\n" " binaryfunc nb_add;\n" @@ -3487,7 +3515,7 @@ msgstr "" " binaryfunc nb_inplace_matrix_multiply;\n" "} PyNumberMethods;" -#: ../../c-api/typeobj.rst:2254 +#: ../../c-api/typeobj.rst:2262 msgid "" "Binary and ternary functions must check the type of all their operands, and " "implement the necessary conversions (at least one of the operands is an " @@ -3497,31 +3525,31 @@ msgid "" "and set an exception." msgstr "" -#: ../../c-api/typeobj.rst:2263 +#: ../../c-api/typeobj.rst:2271 msgid "" "The :c:member:`~PyNumberMethods.nb_reserved` field should always be " "``NULL``. It was previously called :c:member:`!nb_long`, and was renamed in " "Python 3.0.1." msgstr "" -#: ../../c-api/typeobj.rst:2308 +#: ../../c-api/typeobj.rst:2316 msgid "Mapping Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2315 +#: ../../c-api/typeobj.rst:2323 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the mapping protocol. It has three members:" msgstr "" -#: ../../c-api/typeobj.rst:2320 +#: ../../c-api/typeobj.rst:2328 msgid "" "This function is used by :c:func:`PyMapping_Size` and :c:func:" "`PyObject_Size`, and has the same signature. This slot may be set to " "``NULL`` if the object has no defined length." msgstr "" -#: ../../c-api/typeobj.rst:2326 +#: ../../c-api/typeobj.rst:2334 msgid "" "This function is used by :c:func:`PyObject_GetItem` and :c:func:" "`PySequence_GetSlice`, and has the same signature as :c:func:`!" @@ -3529,7 +3557,7 @@ msgid "" "`PyMapping_Check` function to return ``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2334 +#: ../../c-api/typeobj.rst:2342 msgid "" "This function is used by :c:func:`PyObject_SetItem`, :c:func:" "`PyObject_DelItem`, :c:func:`PySequence_SetSlice` and :c:func:" @@ -3539,17 +3567,17 @@ msgid "" "deletion." msgstr "" -#: ../../c-api/typeobj.rst:2345 +#: ../../c-api/typeobj.rst:2353 msgid "Sequence Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2352 +#: ../../c-api/typeobj.rst:2360 msgid "" "This structure holds pointers to the functions which an object uses to " "implement the sequence protocol." msgstr "" -#: ../../c-api/typeobj.rst:2357 +#: ../../c-api/typeobj.rst:2365 msgid "" "This function is used by :c:func:`PySequence_Size` and :c:func:" "`PyObject_Size`, and has the same signature. It is also used for handling " @@ -3557,21 +3585,21 @@ msgid "" "member:`~PySequenceMethods.sq_ass_item` slots." msgstr "" -#: ../../c-api/typeobj.rst:2364 +#: ../../c-api/typeobj.rst:2372 msgid "" "This function is used by :c:func:`PySequence_Concat` and has the same " "signature. It is also used by the ``+`` operator, after trying the numeric " "addition via the :c:member:`~PyNumberMethods.nb_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2370 +#: ../../c-api/typeobj.rst:2378 msgid "" "This function is used by :c:func:`PySequence_Repeat` and has the same " "signature. It is also used by the ``*`` operator, after trying numeric " "multiplication via the :c:member:`~PyNumberMethods.nb_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2376 +#: ../../c-api/typeobj.rst:2384 msgid "" "This function is used by :c:func:`PySequence_GetItem` and has the same " "signature. It is also used by :c:func:`PyObject_GetItem`, after trying the " @@ -3580,7 +3608,7 @@ msgid "" "``1``, it can be ``NULL`` otherwise." msgstr "" -#: ../../c-api/typeobj.rst:2382 +#: ../../c-api/typeobj.rst:2390 msgid "" "Negative indexes are handled as follows: if the :c:member:" "`~PySequenceMethods.sq_length` slot is filled, it is called and the sequence " @@ -3589,7 +3617,7 @@ msgid "" "index is passed as is to the function." msgstr "" -#: ../../c-api/typeobj.rst:2389 +#: ../../c-api/typeobj.rst:2397 msgid "" "This function is used by :c:func:`PySequence_SetItem` and has the same " "signature. It is also used by :c:func:`PyObject_SetItem` and :c:func:" @@ -3598,14 +3626,14 @@ msgid "" "``NULL`` if the object does not support item assignment and deletion." msgstr "" -#: ../../c-api/typeobj.rst:2398 +#: ../../c-api/typeobj.rst:2406 msgid "" "This function may be used by :c:func:`PySequence_Contains` and has the same " "signature. This slot may be left to ``NULL``, in this case :c:func:`!" "PySequence_Contains` simply traverses the sequence until it finds a match." msgstr "" -#: ../../c-api/typeobj.rst:2405 +#: ../../c-api/typeobj.rst:2413 msgid "" "This function is used by :c:func:`PySequence_InPlaceConcat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3615,7 +3643,7 @@ msgid "" "c:member:`~PyNumberMethods.nb_inplace_add` slot." msgstr "" -#: ../../c-api/typeobj.rst:2414 +#: ../../c-api/typeobj.rst:2422 msgid "" "This function is used by :c:func:`PySequence_InPlaceRepeat` and has the same " "signature. It should modify its first operand, and return it. This slot " @@ -3625,76 +3653,76 @@ msgid "" "via the :c:member:`~PyNumberMethods.nb_inplace_multiply` slot." msgstr "" -#: ../../c-api/typeobj.rst:2425 +#: ../../c-api/typeobj.rst:2433 msgid "Buffer Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2433 +#: ../../c-api/typeobj.rst:2441 msgid "" "This structure holds pointers to the functions required by the :ref:`Buffer " "protocol `. The protocol defines how an exporter object can " "expose its internal data to consumer objects." msgstr "" -#: ../../c-api/typeobj.rst:2439 ../../c-api/typeobj.rst:2488 -#: ../../c-api/typeobj.rst:2542 ../../c-api/typeobj.rst:2553 -#: ../../c-api/typeobj.rst:2565 ../../c-api/typeobj.rst:2575 +#: ../../c-api/typeobj.rst:2447 ../../c-api/typeobj.rst:2496 +#: ../../c-api/typeobj.rst:2550 ../../c-api/typeobj.rst:2561 +#: ../../c-api/typeobj.rst:2573 ../../c-api/typeobj.rst:2583 msgid "The signature of this function is::" msgstr "" -#: ../../c-api/typeobj.rst:2441 +#: ../../c-api/typeobj.rst:2449 msgid "int (PyObject *exporter, Py_buffer *view, int flags);" msgstr "int (PyObject *exporter, Py_buffer *view, int flags);" -#: ../../c-api/typeobj.rst:2443 +#: ../../c-api/typeobj.rst:2451 msgid "" "Handle a request to *exporter* to fill in *view* as specified by *flags*. " "Except for point (3), an implementation of this function MUST take these " "steps:" msgstr "" -#: ../../c-api/typeobj.rst:2447 +#: ../../c-api/typeobj.rst:2455 msgid "" "Check if the request can be met. If not, raise :exc:`BufferError`, set :c:" "expr:`view->obj` to ``NULL`` and return ``-1``." msgstr "" -#: ../../c-api/typeobj.rst:2450 +#: ../../c-api/typeobj.rst:2458 msgid "Fill in the requested fields." msgstr "" -#: ../../c-api/typeobj.rst:2452 +#: ../../c-api/typeobj.rst:2460 msgid "Increment an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2454 +#: ../../c-api/typeobj.rst:2462 msgid "" "Set :c:expr:`view->obj` to *exporter* and increment :c:expr:`view->obj`." msgstr "" -#: ../../c-api/typeobj.rst:2456 +#: ../../c-api/typeobj.rst:2464 msgid "Return ``0``." msgstr "回傳 ``0``。" -#: ../../c-api/typeobj.rst:2458 +#: ../../c-api/typeobj.rst:2466 msgid "" "If *exporter* is part of a chain or tree of buffer providers, two main " "schemes can be used:" msgstr "" -#: ../../c-api/typeobj.rst:2461 +#: ../../c-api/typeobj.rst:2469 msgid "" "Re-export: Each member of the tree acts as the exporting object and sets :c:" "expr:`view->obj` to a new reference to itself." msgstr "" -#: ../../c-api/typeobj.rst:2464 +#: ../../c-api/typeobj.rst:2472 msgid "" "Redirect: The buffer request is redirected to the root object of the tree. " "Here, :c:expr:`view->obj` will be a new reference to the root object." msgstr "" -#: ../../c-api/typeobj.rst:2468 +#: ../../c-api/typeobj.rst:2476 msgid "" "The individual fields of *view* are described in section :ref:`Buffer " "structure `, the rules how an exporter must react to " @@ -3702,7 +3730,7 @@ msgid "" "types>`." msgstr "" -#: ../../c-api/typeobj.rst:2473 +#: ../../c-api/typeobj.rst:2481 msgid "" "All memory pointed to in the :c:type:`Py_buffer` structure belongs to the " "exporter and must remain valid until there are no consumers left. :c:member:" @@ -3711,23 +3739,23 @@ msgid "" "internal` are read-only for the consumer." msgstr "" -#: ../../c-api/typeobj.rst:2480 +#: ../../c-api/typeobj.rst:2488 msgid "" ":c:func:`PyBuffer_FillInfo` provides an easy way of exposing a simple bytes " "buffer while dealing correctly with all request types." msgstr "" -#: ../../c-api/typeobj.rst:2483 +#: ../../c-api/typeobj.rst:2491 msgid "" ":c:func:`PyObject_GetBuffer` is the interface for the consumer that wraps " "this function." msgstr "" -#: ../../c-api/typeobj.rst:2490 +#: ../../c-api/typeobj.rst:2498 msgid "void (PyObject *exporter, Py_buffer *view);" msgstr "void (PyObject *exporter, Py_buffer *view);" -#: ../../c-api/typeobj.rst:2492 +#: ../../c-api/typeobj.rst:2500 msgid "" "Handle a request to release the resources of the buffer. If no resources " "need to be released, :c:member:`PyBufferProcs.bf_releasebuffer` may be " @@ -3735,15 +3763,15 @@ msgid "" "these optional steps:" msgstr "" -#: ../../c-api/typeobj.rst:2497 +#: ../../c-api/typeobj.rst:2505 msgid "Decrement an internal counter for the number of exports." msgstr "" -#: ../../c-api/typeobj.rst:2499 +#: ../../c-api/typeobj.rst:2507 msgid "If the counter is ``0``, free all memory associated with *view*." msgstr "" -#: ../../c-api/typeobj.rst:2501 +#: ../../c-api/typeobj.rst:2509 msgid "" "The exporter MUST use the :c:member:`~Py_buffer.internal` field to keep " "track of buffer-specific resources. This field is guaranteed to remain " @@ -3751,30 +3779,30 @@ msgid "" "*view* argument." msgstr "" -#: ../../c-api/typeobj.rst:2507 +#: ../../c-api/typeobj.rst:2515 msgid "" "This function MUST NOT decrement :c:expr:`view->obj`, since that is done " "automatically in :c:func:`PyBuffer_Release` (this scheme is useful for " "breaking reference cycles)." msgstr "" -#: ../../c-api/typeobj.rst:2512 +#: ../../c-api/typeobj.rst:2520 msgid "" ":c:func:`PyBuffer_Release` is the interface for the consumer that wraps this " "function." msgstr "" -#: ../../c-api/typeobj.rst:2520 +#: ../../c-api/typeobj.rst:2528 msgid "Async Object Structures" msgstr "" -#: ../../c-api/typeobj.rst:2528 +#: ../../c-api/typeobj.rst:2536 msgid "" "This structure holds pointers to the functions required to implement :term:" "`awaitable` and :term:`asynchronous iterator` objects." msgstr "" -#: ../../c-api/typeobj.rst:2533 +#: ../../c-api/typeobj.rst:2541 msgid "" "typedef struct {\n" " unaryfunc am_await;\n" @@ -3790,62 +3818,62 @@ msgstr "" " sendfunc am_send;\n" "} PyAsyncMethods;" -#: ../../c-api/typeobj.rst:2544 +#: ../../c-api/typeobj.rst:2552 msgid "PyObject *am_await(PyObject *self);" msgstr "" -#: ../../c-api/typeobj.rst:2546 +#: ../../c-api/typeobj.rst:2554 msgid "" "The returned object must be an :term:`iterator`, i.e. :c:func:`PyIter_Check` " "must return ``1`` for it." msgstr "" -#: ../../c-api/typeobj.rst:2549 +#: ../../c-api/typeobj.rst:2557 msgid "" "This slot may be set to ``NULL`` if an object is not an :term:`awaitable`." msgstr "" -#: ../../c-api/typeobj.rst:2555 +#: ../../c-api/typeobj.rst:2563 msgid "PyObject *am_aiter(PyObject *self);" msgstr "PyObject *am_aiter(PyObject *self);" -#: ../../c-api/typeobj.rst:2557 +#: ../../c-api/typeobj.rst:2565 msgid "" "Must return an :term:`asynchronous iterator` object. See :meth:`~object." "__anext__` for details." msgstr "" -#: ../../c-api/typeobj.rst:2560 +#: ../../c-api/typeobj.rst:2568 msgid "" "This slot may be set to ``NULL`` if an object does not implement " "asynchronous iteration protocol." msgstr "" -#: ../../c-api/typeobj.rst:2567 +#: ../../c-api/typeobj.rst:2575 msgid "PyObject *am_anext(PyObject *self);" msgstr "PyObject *am_anext(PyObject *self);" -#: ../../c-api/typeobj.rst:2569 +#: ../../c-api/typeobj.rst:2577 msgid "" "Must return an :term:`awaitable` object. See :meth:`~object.__anext__` for " "details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2577 +#: ../../c-api/typeobj.rst:2585 msgid "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" msgstr "" "PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result);" -#: ../../c-api/typeobj.rst:2579 +#: ../../c-api/typeobj.rst:2587 msgid "" "See :c:func:`PyIter_Send` for details. This slot may be set to ``NULL``." msgstr "" -#: ../../c-api/typeobj.rst:2588 +#: ../../c-api/typeobj.rst:2596 msgid "Slot Type typedefs" msgstr "" -#: ../../c-api/typeobj.rst:2592 +#: ../../c-api/typeobj.rst:2600 msgid "" "The purpose of this function is to separate memory allocation from memory " "initialization. It should return a pointer to a block of memory of adequate " @@ -3859,80 +3887,80 @@ msgid "" "length of the block should be :c:member:`~PyTypeObject.tp_basicsize`." msgstr "" -#: ../../c-api/typeobj.rst:2602 +#: ../../c-api/typeobj.rst:2610 msgid "" "This function should not do any other instance initialization, not even to " "allocate additional memory; that should be done by :c:member:`~PyTypeObject." "tp_new`." msgstr "" -#: ../../c-api/typeobj.rst:2609 +#: ../../c-api/typeobj.rst:2617 msgid "See :c:member:`~PyTypeObject.tp_free`." msgstr "請見 :c:member:`~PyTypeObject.tp_free`。" -#: ../../c-api/typeobj.rst:2613 +#: ../../c-api/typeobj.rst:2621 msgid "See :c:member:`~PyTypeObject.tp_new`." msgstr "請見 :c:member:`~PyTypeObject.tp_new`。" -#: ../../c-api/typeobj.rst:2617 +#: ../../c-api/typeobj.rst:2625 msgid "See :c:member:`~PyTypeObject.tp_init`." msgstr "請見 :c:member:`~PyTypeObject.tp_init`。" -#: ../../c-api/typeobj.rst:2621 +#: ../../c-api/typeobj.rst:2629 msgid "See :c:member:`~PyTypeObject.tp_repr`." msgstr "請見 :c:member:`~PyTypeObject.tp_repr`。" -#: ../../c-api/typeobj.rst:2625 ../../c-api/typeobj.rst:2634 +#: ../../c-api/typeobj.rst:2633 ../../c-api/typeobj.rst:2642 msgid "Return the value of the named attribute for the object." msgstr "" -#: ../../c-api/typeobj.rst:2629 ../../c-api/typeobj.rst:2640 +#: ../../c-api/typeobj.rst:2637 ../../c-api/typeobj.rst:2648 msgid "" "Set the value of the named attribute for the object. The value argument is " "set to ``NULL`` to delete the attribute." msgstr "" -#: ../../c-api/typeobj.rst:2636 +#: ../../c-api/typeobj.rst:2644 msgid "See :c:member:`~PyTypeObject.tp_getattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_getattro`。" -#: ../../c-api/typeobj.rst:2643 +#: ../../c-api/typeobj.rst:2651 msgid "See :c:member:`~PyTypeObject.tp_setattro`." msgstr "請見 :c:member:`~PyTypeObject.tp_setattro`。" -#: ../../c-api/typeobj.rst:2647 +#: ../../c-api/typeobj.rst:2655 msgid "See :c:member:`~PyTypeObject.tp_descr_get`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_get`。" -#: ../../c-api/typeobj.rst:2651 +#: ../../c-api/typeobj.rst:2659 msgid "See :c:member:`~PyTypeObject.tp_descr_set`." msgstr "請見 :c:member:`~PyTypeObject.tp_descr_set`。" -#: ../../c-api/typeobj.rst:2655 +#: ../../c-api/typeobj.rst:2663 msgid "See :c:member:`~PyTypeObject.tp_hash`." msgstr "請見 :c:member:`~PyTypeObject.tp_hash`。" -#: ../../c-api/typeobj.rst:2659 +#: ../../c-api/typeobj.rst:2667 msgid "See :c:member:`~PyTypeObject.tp_richcompare`." msgstr "請見 :c:member:`~PyTypeObject.tp_richcompare`。" -#: ../../c-api/typeobj.rst:2663 +#: ../../c-api/typeobj.rst:2671 msgid "See :c:member:`~PyTypeObject.tp_iter`." msgstr "請見 :c:member:`~PyTypeObject.tp_iter`。" -#: ../../c-api/typeobj.rst:2667 +#: ../../c-api/typeobj.rst:2675 msgid "See :c:member:`~PyTypeObject.tp_iternext`." msgstr "請見 :c:member:`~PyTypeObject.tp_iternext`。" -#: ../../c-api/typeobj.rst:2681 +#: ../../c-api/typeobj.rst:2689 msgid "See :c:member:`~PyAsyncMethods.am_send`." msgstr "請見 :c:member:`~PyAsyncMethods.am_send`。" -#: ../../c-api/typeobj.rst:2697 +#: ../../c-api/typeobj.rst:2705 msgid "Examples" msgstr "範例" -#: ../../c-api/typeobj.rst:2699 +#: ../../c-api/typeobj.rst:2707 msgid "" "The following are simple examples of Python type definitions. They include " "common usage you may encounter. Some demonstrate tricky corner cases. For " @@ -3940,11 +3968,11 @@ msgid "" "and :ref:`new-types-topics`." msgstr "" -#: ../../c-api/typeobj.rst:2704 +#: ../../c-api/typeobj.rst:2712 msgid "A basic :ref:`static type `::" msgstr "" -#: ../../c-api/typeobj.rst:2706 +#: ../../c-api/typeobj.rst:2714 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -3962,13 +3990,13 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2721 +#: ../../c-api/typeobj.rst:2729 msgid "" "You may also find older code (especially in the CPython code base) with a " "more verbose initializer::" msgstr "" -#: ../../c-api/typeobj.rst:2724 +#: ../../c-api/typeobj.rst:2732 msgid "" "static PyTypeObject MyObject_Type = {\n" " PyVarObject_HEAD_INIT(NULL, 0)\n" @@ -4052,11 +4080,11 @@ msgstr "" " myobj_new, /* tp_new */\n" "};" -#: ../../c-api/typeobj.rst:2765 +#: ../../c-api/typeobj.rst:2773 msgid "A type that supports weakrefs, instance dicts, and hashing::" msgstr "" -#: ../../c-api/typeobj.rst:2767 +#: ../../c-api/typeobj.rst:2775 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4082,14 +4110,14 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2790 +#: ../../c-api/typeobj.rst:2798 msgid "" "A str subclass that cannot be subclassed and cannot be called to create " "instances (e.g. uses a separate factory func) using :c:macro:" "`Py_TPFLAGS_DISALLOW_INSTANTIATION` flag::" msgstr "" -#: ../../c-api/typeobj.rst:2794 +#: ../../c-api/typeobj.rst:2802 msgid "" "typedef struct {\n" " PyUnicodeObject raw;\n" @@ -4107,12 +4135,12 @@ msgid "" "};" msgstr "" -#: ../../c-api/typeobj.rst:2809 +#: ../../c-api/typeobj.rst:2817 msgid "" "The simplest :ref:`static type ` with fixed-length instances::" msgstr "" -#: ../../c-api/typeobj.rst:2811 +#: ../../c-api/typeobj.rst:2819 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -4132,13 +4160,13 @@ msgstr "" " .tp_name = \"mymod.MyObject\",\n" "};" -#: ../../c-api/typeobj.rst:2820 +#: ../../c-api/typeobj.rst:2828 msgid "" "The simplest :ref:`static type ` with variable-length " "instances::" msgstr "" -#: ../../c-api/typeobj.rst:2822 +#: ../../c-api/typeobj.rst:2830 msgid "" "typedef struct {\n" " PyObject_VAR_HEAD\n" @@ -4164,14 +4192,14 @@ msgstr "" " .tp_itemsize = sizeof(char *),\n" "};" -#: ../../c-api/typeobj.rst:809 ../../c-api/typeobj.rst:874 +#: ../../c-api/typeobj.rst:787 ../../c-api/typeobj.rst:852 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../c-api/typeobj.rst:809 +#: ../../c-api/typeobj.rst:787 msgid "repr" msgstr "repr" -#: ../../c-api/typeobj.rst:874 +#: ../../c-api/typeobj.rst:852 msgid "hash" msgstr "hash(雜湊)" diff --git a/c-api/unicode.po b/c-api/unicode.po index 666d51aa2a..8ebbcebe8f 100644 --- a/c-api/unicode.po +++ b/c-api/unicode.po @@ -7,9 +7,9 @@ # Liang-Bo Wang , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -79,52 +79,52 @@ msgid "" "build time." msgstr "" -#: ../../c-api/unicode.rst:60 +#: ../../c-api/unicode.rst:62 msgid "" "These subtypes of :c:type:`PyObject` represent a Python Unicode object. In " "almost all cases, they shouldn't be used directly, since all API functions " "that deal with Unicode objects take and return :c:type:`PyObject` pointers." msgstr "" -#: ../../c-api/unicode.rst:69 +#: ../../c-api/unicode.rst:71 msgid "" "This instance of :c:type:`PyTypeObject` represents the Python Unicode type. " "It is exposed to Python code as ``str``." msgstr "" -#: ../../c-api/unicode.rst:73 +#: ../../c-api/unicode.rst:75 msgid "" "The following APIs are C macros and static inlined functions for fast checks " "and access to internal read-only data of Unicode objects:" msgstr "" -#: ../../c-api/unicode.rst:78 +#: ../../c-api/unicode.rst:80 msgid "" "Return true if the object *obj* is a Unicode object or an instance of a " "Unicode subtype. This function always succeeds." msgstr "" -#: ../../c-api/unicode.rst:84 +#: ../../c-api/unicode.rst:86 msgid "" "Return true if the object *obj* is a Unicode object, but not an instance of " "a subtype. This function always succeeds." msgstr "" -#: ../../c-api/unicode.rst:90 +#: ../../c-api/unicode.rst:92 msgid "Returns ``0``. This API is kept only for backward compatibility." msgstr "" -#: ../../c-api/unicode.rst:94 +#: ../../c-api/unicode.rst:96 msgid "This API does nothing since Python 3.12." msgstr "" -#: ../../c-api/unicode.rst:100 +#: ../../c-api/unicode.rst:102 msgid "" "Return the length of the Unicode string, in code points. *unicode* has to " "be a Unicode object in the \"canonical\" representation (not checked)." msgstr "" -#: ../../c-api/unicode.rst:110 +#: ../../c-api/unicode.rst:112 msgid "" "Return a pointer to the canonical representation cast to UCS1, UCS2 or UCS4 " "integer types for direct character access. No checks are performed if the " @@ -132,15 +132,15 @@ msgid "" "`PyUnicode_KIND` to select the right function." msgstr "" -#: ../../c-api/unicode.rst:122 +#: ../../c-api/unicode.rst:124 msgid "Return values of the :c:func:`PyUnicode_KIND` macro." msgstr "" -#: ../../c-api/unicode.rst:126 +#: ../../c-api/unicode.rst:128 msgid "``PyUnicode_WCHAR_KIND`` has been removed." msgstr "``PyUnicode_WCHAR_KIND`` 已被移除。" -#: ../../c-api/unicode.rst:132 +#: ../../c-api/unicode.rst:134 msgid "" "Return one of the PyUnicode kind constants (see above) that indicate how " "many bytes per character this Unicode object uses to store its data. " @@ -148,13 +148,13 @@ msgid "" "(not checked)." msgstr "" -#: ../../c-api/unicode.rst:141 +#: ../../c-api/unicode.rst:143 msgid "" "Return a void pointer to the raw Unicode buffer. *unicode* has to be a " "Unicode object in the \"canonical\" representation (not checked)." msgstr "" -#: ../../c-api/unicode.rst:150 +#: ../../c-api/unicode.rst:152 msgid "" "Write into a canonical representation *data* (as obtained with :c:func:" "`PyUnicode_DATA`). This function performs no sanity checks, and is intended " @@ -164,97 +164,97 @@ msgid "" "written to that location." msgstr "" -#: ../../c-api/unicode.rst:163 +#: ../../c-api/unicode.rst:165 msgid "" "Read a code point from a canonical representation *data* (as obtained with :" "c:func:`PyUnicode_DATA`). No checks or ready calls are performed." msgstr "" -#: ../../c-api/unicode.rst:171 +#: ../../c-api/unicode.rst:173 msgid "" "Read a character from a Unicode object *unicode*, which must be in the " "\"canonical\" representation. This is less efficient than :c:func:" "`PyUnicode_READ` if you do multiple consecutive reads." msgstr "" -#: ../../c-api/unicode.rst:180 +#: ../../c-api/unicode.rst:182 msgid "" "Return the maximum code point that is suitable for creating another string " "based on *unicode*, which must be in the \"canonical\" representation. This " "is always an approximation but more efficient than iterating over the string." msgstr "" -#: ../../c-api/unicode.rst:189 +#: ../../c-api/unicode.rst:191 msgid "" "Return ``1`` if the string is a valid identifier according to the language " "definition, section :ref:`identifiers`. Return ``0`` otherwise." msgstr "" -#: ../../c-api/unicode.rst:192 +#: ../../c-api/unicode.rst:194 msgid "" "The function does not call :c:func:`Py_FatalError` anymore if the string is " "not ready." msgstr "" -#: ../../c-api/unicode.rst:198 +#: ../../c-api/unicode.rst:200 msgid "Unicode Character Properties" msgstr "" -#: ../../c-api/unicode.rst:200 +#: ../../c-api/unicode.rst:202 msgid "" "Unicode provides many different character properties. The most often needed " "ones are available through these macros which are mapped to C functions " "depending on the Python configuration." msgstr "" -#: ../../c-api/unicode.rst:207 +#: ../../c-api/unicode.rst:209 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a whitespace character." msgstr "" -#: ../../c-api/unicode.rst:212 +#: ../../c-api/unicode.rst:214 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a lowercase character." msgstr "" -#: ../../c-api/unicode.rst:217 +#: ../../c-api/unicode.rst:219 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an uppercase character." msgstr "" -#: ../../c-api/unicode.rst:222 +#: ../../c-api/unicode.rst:224 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a titlecase character." msgstr "" -#: ../../c-api/unicode.rst:227 +#: ../../c-api/unicode.rst:229 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a linebreak character." msgstr "" -#: ../../c-api/unicode.rst:232 +#: ../../c-api/unicode.rst:234 msgid "Return ``1`` or ``0`` depending on whether *ch* is a decimal character." msgstr "" -#: ../../c-api/unicode.rst:237 +#: ../../c-api/unicode.rst:239 msgid "Return ``1`` or ``0`` depending on whether *ch* is a digit character." msgstr "" -#: ../../c-api/unicode.rst:242 +#: ../../c-api/unicode.rst:244 msgid "Return ``1`` or ``0`` depending on whether *ch* is a numeric character." msgstr "" -#: ../../c-api/unicode.rst:247 +#: ../../c-api/unicode.rst:249 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphabetic character." msgstr "" -#: ../../c-api/unicode.rst:252 +#: ../../c-api/unicode.rst:254 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is an alphanumeric character." msgstr "" -#: ../../c-api/unicode.rst:257 +#: ../../c-api/unicode.rst:259 msgid "" "Return ``1`` or ``0`` depending on whether *ch* is a printable character. " "Nonprintable characters are those characters defined in the Unicode " @@ -265,93 +265,92 @@ msgid "" "to :data:`sys.stdout` or :data:`sys.stderr`.)" msgstr "" -#: ../../c-api/unicode.rst:266 +#: ../../c-api/unicode.rst:268 msgid "These APIs can be used for fast direct character conversions:" msgstr "" -#: ../../c-api/unicode.rst:271 +#: ../../c-api/unicode.rst:273 msgid "Return the character *ch* converted to lower case." msgstr "" -#: ../../c-api/unicode.rst:273 ../../c-api/unicode.rst:281 -#: ../../c-api/unicode.rst:289 -msgid "This function uses simple case mappings." -msgstr "" - -#: ../../c-api/unicode.rst:279 +#: ../../c-api/unicode.rst:278 msgid "Return the character *ch* converted to upper case." msgstr "" -#: ../../c-api/unicode.rst:287 +#: ../../c-api/unicode.rst:283 msgid "Return the character *ch* converted to title case." msgstr "" -#: ../../c-api/unicode.rst:295 +#: ../../c-api/unicode.rst:288 msgid "" "Return the character *ch* converted to a decimal positive integer. Return " "``-1`` if this is not possible. This function does not raise exceptions." msgstr "" -#: ../../c-api/unicode.rst:301 +#: ../../c-api/unicode.rst:294 msgid "" "Return the character *ch* converted to a single digit integer. Return ``-1`` " "if this is not possible. This function does not raise exceptions." msgstr "" -#: ../../c-api/unicode.rst:307 +#: ../../c-api/unicode.rst:300 msgid "" "Return the character *ch* converted to a double. Return ``-1.0`` if this is " "not possible. This function does not raise exceptions." msgstr "" -#: ../../c-api/unicode.rst:311 +#: ../../c-api/unicode.rst:304 msgid "These APIs can be used to work with surrogates:" msgstr "" -#: ../../c-api/unicode.rst:315 +#: ../../c-api/unicode.rst:308 msgid "Check if *ch* is a surrogate (``0xD800 <= ch <= 0xDFFF``)." msgstr "" -#: ../../c-api/unicode.rst:319 +#: ../../c-api/unicode.rst:312 msgid "Check if *ch* is a high surrogate (``0xD800 <= ch <= 0xDBFF``)." msgstr "" -#: ../../c-api/unicode.rst:323 +#: ../../c-api/unicode.rst:316 msgid "Check if *ch* is a low surrogate (``0xDC00 <= ch <= 0xDFFF``)." msgstr "" -#: ../../c-api/unicode.rst:327 +#: ../../c-api/unicode.rst:320 msgid "" -"Join two surrogate characters and return a single :c:type:`Py_UCS4` value. " +"Join two surrogate code points and return a single :c:type:`Py_UCS4` value. " "*high* and *low* are respectively the leading and trailing surrogates in a " "surrogate pair. *high* must be in the range [0xD800; 0xDBFF] and *low* must " "be in the range [0xDC00; 0xDFFF]." msgstr "" -#: ../../c-api/unicode.rst:334 +#: ../../c-api/unicode.rst:327 msgid "Creating and accessing Unicode strings" msgstr "" -#: ../../c-api/unicode.rst:336 +#: ../../c-api/unicode.rst:329 msgid "" "To create Unicode objects and access their basic sequence properties, use " "these APIs:" msgstr "" -#: ../../c-api/unicode.rst:341 +#: ../../c-api/unicode.rst:334 msgid "" "Create a new Unicode object. *maxchar* should be the true maximum code " "point to be placed in the string. As an approximation, it can be rounded up " "to the nearest value in the sequence 127, 255, 65535, 1114111." msgstr "" -#: ../../c-api/unicode.rst:345 +#: ../../c-api/unicode.rst:338 msgid "" "This is the recommended way to allocate a new Unicode object. Objects " "created using this function are not resizable." msgstr "" -#: ../../c-api/unicode.rst:354 +#: ../../c-api/unicode.rst:341 +msgid "On error, set an exception and return ``NULL``." +msgstr "" + +#: ../../c-api/unicode.rst:349 msgid "" "Create a new Unicode object with the given *kind* (possible values are :c:" "macro:`PyUnicode_1BYTE_KIND` etc., as returned by :c:func:" @@ -359,7 +358,7 @@ msgid "" "1, 2 or 4 bytes per character, as given by the kind." msgstr "" -#: ../../c-api/unicode.rst:359 +#: ../../c-api/unicode.rst:354 msgid "" "If necessary, the input *buffer* is copied and transformed into the " "canonical representation. For example, if the *buffer* is a UCS4 string (:c:" @@ -367,7 +366,7 @@ msgid "" "range, it will be transformed into UCS1 (:c:macro:`PyUnicode_1BYTE_KIND`)." msgstr "" -#: ../../c-api/unicode.rst:370 +#: ../../c-api/unicode.rst:365 msgid "" "Create a Unicode object from the char buffer *str*. The bytes will be " "interpreted as being UTF-8 encoded. The buffer is copied into the new " @@ -375,29 +374,29 @@ msgid "" "data is not allowed." msgstr "" -#: ../../c-api/unicode.rst:376 +#: ../../c-api/unicode.rst:371 msgid "This function raises :exc:`SystemError` when:" msgstr "" -#: ../../c-api/unicode.rst:378 +#: ../../c-api/unicode.rst:373 msgid "*size* < 0," msgstr "" -#: ../../c-api/unicode.rst:379 +#: ../../c-api/unicode.rst:374 msgid "*str* is ``NULL`` and *size* > 0" msgstr "" -#: ../../c-api/unicode.rst:381 +#: ../../c-api/unicode.rst:376 msgid "*str* == ``NULL`` with *size* > 0 is not allowed anymore." msgstr "" -#: ../../c-api/unicode.rst:387 +#: ../../c-api/unicode.rst:382 msgid "" "Create a Unicode object from a UTF-8 encoded null-terminated char buffer " "*str*." msgstr "" -#: ../../c-api/unicode.rst:393 +#: ../../c-api/unicode.rst:388 msgid "" "Take a C :c:func:`printf`\\ -style *format* string and a variable number of " "arguments, calculate the size of the resulting Python Unicode string and " @@ -406,23 +405,23 @@ msgid "" "*format* ASCII-encoded string." msgstr "" -#: ../../c-api/unicode.rst:399 +#: ../../c-api/unicode.rst:394 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../c-api/unicode.rst:402 +#: ../../c-api/unicode.rst:397 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../c-api/unicode.rst:404 +#: ../../c-api/unicode.rst:399 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../c-api/unicode.rst:407 +#: ../../c-api/unicode.rst:402 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is given in the next argument, which must be of type :c:expr:" @@ -430,7 +429,7 @@ msgid "" "optional precision." msgstr "" -#: ../../c-api/unicode.rst:412 +#: ../../c-api/unicode.rst:407 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. If " "specified as ``'*'`` (an asterisk), the actual precision is given in the " @@ -438,271 +437,316 @@ msgid "" "comes after the precision." msgstr "" -#: ../../c-api/unicode.rst:417 +#: ../../c-api/unicode.rst:412 msgid "Length modifier (optional)." msgstr "" -#: ../../c-api/unicode.rst:419 +#: ../../c-api/unicode.rst:414 msgid "Conversion type." msgstr "" -#: ../../c-api/unicode.rst:421 +#: ../../c-api/unicode.rst:416 msgid "The conversion flag characters are:" msgstr "" -#: ../../c-api/unicode.rst:426 +#: ../../c-api/unicode.rst:421 msgid "Flag" msgstr "旗標" -#: ../../c-api/unicode.rst:426 +#: ../../c-api/unicode.rst:421 msgid "Meaning" msgstr "含義" -#: ../../c-api/unicode.rst:428 +#: ../../c-api/unicode.rst:423 msgid "``0``" msgstr "``0``" -#: ../../c-api/unicode.rst:428 +#: ../../c-api/unicode.rst:423 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../c-api/unicode.rst:430 +#: ../../c-api/unicode.rst:425 msgid "``-``" msgstr "``-``" -#: ../../c-api/unicode.rst:430 +#: ../../c-api/unicode.rst:425 msgid "" "The converted value is left adjusted (overrides the ``0`` flag if both are " "given)." msgstr "" -#: ../../c-api/unicode.rst:434 +#: ../../c-api/unicode.rst:429 msgid "" "The length modifiers for following integer conversions (``d``, ``i``, ``o``, " "``u``, ``x``, or ``X``) specify the type of the argument (:c:expr:`int` by " "default):" msgstr "" -#: ../../c-api/unicode.rst:441 +#: ../../c-api/unicode.rst:436 msgid "Modifier" msgstr "" -#: ../../c-api/unicode.rst:441 +#: ../../c-api/unicode.rst:436 msgid "Types" msgstr "" -#: ../../c-api/unicode.rst:443 +#: ../../c-api/unicode.rst:438 msgid "``l``" msgstr "``l``" -#: ../../c-api/unicode.rst:443 +#: ../../c-api/unicode.rst:438 msgid ":c:expr:`long` or :c:expr:`unsigned long`" msgstr ":c:expr:`long` 或 :c:expr:`unsigned long`" -#: ../../c-api/unicode.rst:445 +#: ../../c-api/unicode.rst:440 msgid "``ll``" msgstr "``ll``" -#: ../../c-api/unicode.rst:445 +#: ../../c-api/unicode.rst:440 msgid ":c:expr:`long long` or :c:expr:`unsigned long long`" msgstr ":c:expr:`long long` 或 :c:expr:`unsigned long long`" -#: ../../c-api/unicode.rst:447 +#: ../../c-api/unicode.rst:442 msgid "``j``" msgstr "``j``" -#: ../../c-api/unicode.rst:447 +#: ../../c-api/unicode.rst:442 msgid ":c:type:`intmax_t` or :c:type:`uintmax_t`" msgstr ":c:type:`intmax_t` 或 :c:type:`uintmax_t`" -#: ../../c-api/unicode.rst:449 +#: ../../c-api/unicode.rst:444 msgid "``z``" msgstr "``z``" -#: ../../c-api/unicode.rst:449 +#: ../../c-api/unicode.rst:444 msgid ":c:type:`size_t` or :c:type:`ssize_t`" msgstr ":c:type:`size_t` 或 :c:type:`ssize_t`" -#: ../../c-api/unicode.rst:451 +#: ../../c-api/unicode.rst:446 msgid "``t``" msgstr "``t``" -#: ../../c-api/unicode.rst:451 +#: ../../c-api/unicode.rst:446 msgid ":c:type:`ptrdiff_t`" msgstr ":c:type:`ptrdiff_t`" -#: ../../c-api/unicode.rst:454 +#: ../../c-api/unicode.rst:449 msgid "" "The length modifier ``l`` for following conversions ``s`` or ``V`` specify " "that the type of the argument is :c:expr:`const wchar_t*`." msgstr "" -#: ../../c-api/unicode.rst:457 +#: ../../c-api/unicode.rst:452 msgid "The conversion specifiers are:" msgstr "" -#: ../../c-api/unicode.rst:463 +#: ../../c-api/unicode.rst:458 msgid "Conversion Specifier" msgstr "" -#: ../../c-api/unicode.rst:464 +#: ../../c-api/unicode.rst:459 msgid "Type" msgstr "" -#: ../../c-api/unicode.rst:465 +#: ../../c-api/unicode.rst:460 msgid "Comment" msgstr "" -#: ../../c-api/unicode.rst:467 +#: ../../c-api/unicode.rst:462 msgid "``%``" msgstr "``%``" -#: ../../c-api/unicode.rst:468 +#: ../../c-api/unicode.rst:463 msgid "*n/a*" msgstr "*n/a*" -#: ../../c-api/unicode.rst:469 +#: ../../c-api/unicode.rst:464 msgid "The literal ``%`` character." msgstr "" -#: ../../c-api/unicode.rst:471 +#: ../../c-api/unicode.rst:466 msgid "``d``, ``i``" msgstr "``d``, ``i``" -#: ../../c-api/unicode.rst:472 ../../c-api/unicode.rst:476 -#: ../../c-api/unicode.rst:480 ../../c-api/unicode.rst:484 -#: ../../c-api/unicode.rst:488 +#: ../../c-api/unicode.rst:467 ../../c-api/unicode.rst:471 +#: ../../c-api/unicode.rst:475 ../../c-api/unicode.rst:479 +#: ../../c-api/unicode.rst:483 msgid "Specified by the length modifier" msgstr "" -#: ../../c-api/unicode.rst:473 +#: ../../c-api/unicode.rst:468 msgid "The decimal representation of a signed C integer." msgstr "" -#: ../../c-api/unicode.rst:475 +#: ../../c-api/unicode.rst:470 msgid "``u``" msgstr "``u``" -#: ../../c-api/unicode.rst:477 +#: ../../c-api/unicode.rst:472 msgid "The decimal representation of an unsigned C integer." msgstr "" -#: ../../c-api/unicode.rst:479 +#: ../../c-api/unicode.rst:474 msgid "``o``" msgstr "``o``" -#: ../../c-api/unicode.rst:481 +#: ../../c-api/unicode.rst:476 msgid "The octal representation of an unsigned C integer." msgstr "" -#: ../../c-api/unicode.rst:483 +#: ../../c-api/unicode.rst:478 msgid "``x``" msgstr "``x``" -#: ../../c-api/unicode.rst:485 +#: ../../c-api/unicode.rst:480 msgid "The hexadecimal representation of an unsigned C integer (lowercase)." msgstr "" -#: ../../c-api/unicode.rst:487 +#: ../../c-api/unicode.rst:482 msgid "``X``" msgstr "``X``" -#: ../../c-api/unicode.rst:489 +#: ../../c-api/unicode.rst:484 msgid "The hexadecimal representation of an unsigned C integer (uppercase)." msgstr "" -#: ../../c-api/unicode.rst:491 +#: ../../c-api/unicode.rst:486 msgid "``c``" msgstr "``c``" -#: ../../c-api/unicode.rst:492 +#: ../../c-api/unicode.rst:487 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../c-api/unicode.rst:493 +#: ../../c-api/unicode.rst:488 msgid "A single character." msgstr "" -#: ../../c-api/unicode.rst:495 +#: ../../c-api/unicode.rst:490 msgid "``s``" msgstr "``s``" -#: ../../c-api/unicode.rst:496 +#: ../../c-api/unicode.rst:491 msgid ":c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:497 +#: ../../c-api/unicode.rst:492 msgid "A null-terminated C character array." msgstr "" -#: ../../c-api/unicode.rst:499 +#: ../../c-api/unicode.rst:494 msgid "``p``" msgstr "``p``" -#: ../../c-api/unicode.rst:500 +#: ../../c-api/unicode.rst:495 msgid ":c:expr:`const void*`" msgstr ":c:expr:`const void*`" -#: ../../c-api/unicode.rst:501 +#: ../../c-api/unicode.rst:496 msgid "" "The hex representation of a C pointer. Mostly equivalent to " "``printf(\"%p\")`` except that it is guaranteed to start with the literal " "``0x`` regardless of what the platform's ``printf`` yields." msgstr "" -#: ../../c-api/unicode.rst:506 +#: ../../c-api/unicode.rst:501 msgid "``A``" msgstr "``A``" -#: ../../c-api/unicode.rst:507 ../../c-api/unicode.rst:511 -#: ../../c-api/unicode.rst:521 ../../c-api/unicode.rst:525 +#: ../../c-api/unicode.rst:502 ../../c-api/unicode.rst:506 +#: ../../c-api/unicode.rst:516 ../../c-api/unicode.rst:520 +#: ../../c-api/unicode.rst:524 ../../c-api/unicode.rst:529 msgid ":c:expr:`PyObject*`" msgstr ":c:expr:`PyObject*`" -#: ../../c-api/unicode.rst:508 +#: ../../c-api/unicode.rst:503 msgid "The result of calling :func:`ascii`." msgstr "" -#: ../../c-api/unicode.rst:510 +#: ../../c-api/unicode.rst:505 msgid "``U``" msgstr "``U``" -#: ../../c-api/unicode.rst:512 +#: ../../c-api/unicode.rst:507 msgid "A Unicode object." msgstr "一 Unicode 物件。" -#: ../../c-api/unicode.rst:514 +#: ../../c-api/unicode.rst:509 msgid "``V``" msgstr "``V``" -#: ../../c-api/unicode.rst:515 +#: ../../c-api/unicode.rst:510 msgid ":c:expr:`PyObject*`, :c:expr:`const char*` or :c:expr:`const wchar_t*`" msgstr ":c:expr:`PyObject*`、:c:expr:`const char*` 或 :c:expr:`const wchar_t*`" -#: ../../c-api/unicode.rst:516 +#: ../../c-api/unicode.rst:511 msgid "" "A Unicode object (which may be ``NULL``) and a null-terminated C character " "array as a second parameter (which will be used, if the first parameter is " "``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:520 +#: ../../c-api/unicode.rst:515 msgid "``S``" msgstr "``S``" -#: ../../c-api/unicode.rst:522 +#: ../../c-api/unicode.rst:517 msgid "The result of calling :c:func:`PyObject_Str`." msgstr "" -#: ../../c-api/unicode.rst:524 +#: ../../c-api/unicode.rst:519 msgid "``R``" msgstr "``R``" -#: ../../c-api/unicode.rst:526 +#: ../../c-api/unicode.rst:521 msgid "The result of calling :c:func:`PyObject_Repr`." msgstr "" -#: ../../c-api/unicode.rst:529 +#: ../../c-api/unicode.rst:523 +msgid "``T``" +msgstr "``T``" + +#: ../../c-api/unicode.rst:525 +msgid "" +"Get the fully qualified name of an object type; call :c:func:" +"`PyType_GetFullyQualifiedName`." +msgstr "" + +#: ../../c-api/unicode.rst:528 +msgid "``#T``" +msgstr "``#T``" + +#: ../../c-api/unicode.rst:530 +msgid "" +"Similar to ``T`` format, but use a colon (``:``) as separator between the " +"module name and the qualified name." +msgstr "" + +#: ../../c-api/unicode.rst:533 +msgid "``N``" +msgstr "``N``" + +#: ../../c-api/unicode.rst:534 ../../c-api/unicode.rst:539 +msgid ":c:expr:`PyTypeObject*`" +msgstr ":c:expr:`PyTypeObject*`" + +#: ../../c-api/unicode.rst:535 +msgid "" +"Get the fully qualified name of a type; call :c:func:" +"`PyType_GetFullyQualifiedName`." +msgstr "" + +#: ../../c-api/unicode.rst:538 +msgid "``#N``" +msgstr "``#N``" + +#: ../../c-api/unicode.rst:540 +msgid "" +"Similar to ``N`` format, but use a colon (``:``) as separator between the " +"module name and the qualified name." +msgstr "" + +#: ../../c-api/unicode.rst:544 msgid "" "The width formatter unit is number of characters rather than bytes. The " "precision formatter unit is number of bytes or :c:type:`wchar_t` items (if " @@ -712,28 +756,28 @@ msgid "" "``PyObject*`` argument is not ``NULL``)." msgstr "" -#: ../../c-api/unicode.rst:537 +#: ../../c-api/unicode.rst:552 msgid "" "Unlike to C :c:func:`printf` the ``0`` flag has effect even when a precision " "is given for integer conversions (``d``, ``i``, ``u``, ``o``, ``x``, or " "``X``)." msgstr "" -#: ../../c-api/unicode.rst:541 +#: ../../c-api/unicode.rst:556 msgid "Support for ``\"%lld\"`` and ``\"%llu\"`` added." msgstr "" -#: ../../c-api/unicode.rst:544 +#: ../../c-api/unicode.rst:559 msgid "Support for ``\"%li\"``, ``\"%lli\"`` and ``\"%zi\"`` added." msgstr "" -#: ../../c-api/unicode.rst:547 +#: ../../c-api/unicode.rst:562 msgid "" "Support width and precision formatter for ``\"%s\"``, ``\"%A\"``, " "``\"%U\"``, ``\"%V\"``, ``\"%S\"``, ``\"%R\"`` added." msgstr "" -#: ../../c-api/unicode.rst:551 +#: ../../c-api/unicode.rst:566 msgid "" "Support for conversion specifiers ``o`` and ``X``. Support for length " "modifiers ``j`` and ``t``. Length modifiers are now applied to all integer " @@ -742,36 +786,40 @@ msgid "" "flag ``-``." msgstr "" -#: ../../c-api/unicode.rst:559 +#: ../../c-api/unicode.rst:574 msgid "" "An unrecognized format character now sets a :exc:`SystemError`. In previous " "versions it caused all the rest of the format string to be copied as-is to " "the result string, and any extra arguments discarded." msgstr "" -#: ../../c-api/unicode.rst:566 +#: ../../c-api/unicode.rst:578 +msgid "Support for ``%T``, ``%#T``, ``%N`` and ``%#N`` formats added." +msgstr "" + +#: ../../c-api/unicode.rst:584 msgid "" "Identical to :c:func:`PyUnicode_FromFormat` except that it takes exactly two " "arguments." msgstr "" -#: ../../c-api/unicode.rst:572 +#: ../../c-api/unicode.rst:590 msgid "" "Copy an instance of a Unicode subtype to a new true Unicode object if " "necessary. If *obj* is already a true Unicode object (not a subtype), return " "a new :term:`strong reference` to the object." msgstr "" -#: ../../c-api/unicode.rst:576 +#: ../../c-api/unicode.rst:594 msgid "" "Objects other than Unicode or its subtypes will cause a :exc:`TypeError`." msgstr "" -#: ../../c-api/unicode.rst:582 +#: ../../c-api/unicode.rst:600 msgid "Decode an encoded object *obj* to a Unicode object." msgstr "" -#: ../../c-api/unicode.rst:584 +#: ../../c-api/unicode.rst:602 msgid "" ":class:`bytes`, :class:`bytearray` and other :term:`bytes-like objects " "` are decoded according to the given *encoding* and using " @@ -779,23 +827,27 @@ msgid "" "interface use the default values (see :ref:`builtincodecs` for details)." msgstr "" -#: ../../c-api/unicode.rst:590 +#: ../../c-api/unicode.rst:608 msgid "" "All other objects, including Unicode objects, cause a :exc:`TypeError` to be " "set." msgstr "" -#: ../../c-api/unicode.rst:593 +#: ../../c-api/unicode.rst:611 msgid "" "The API returns ``NULL`` if there was an error. The caller is responsible " "for decref'ing the returned objects." msgstr "" -#: ../../c-api/unicode.rst:599 +#: ../../c-api/unicode.rst:617 msgid "Return the length of the Unicode object, in code points." msgstr "" -#: ../../c-api/unicode.rst:610 +#: ../../c-api/unicode.rst:619 +msgid "On error, set an exception and return ``-1``." +msgstr "" + +#: ../../c-api/unicode.rst:630 msgid "" "Copy characters from one Unicode object into another. This function " "performs character conversion when necessary and falls back to :c:func:`!" @@ -803,52 +855,61 @@ msgid "" "otherwise returns the number of copied characters." msgstr "" -#: ../../c-api/unicode.rst:621 +#: ../../c-api/unicode.rst:641 msgid "" "Fill a string with a character: write *fill_char* into ``unicode[start:" "start+length]``." msgstr "" -#: ../../c-api/unicode.rst:624 +#: ../../c-api/unicode.rst:644 msgid "" "Fail if *fill_char* is bigger than the string maximum character, or if the " "string has more than 1 reference." msgstr "" -#: ../../c-api/unicode.rst:627 +#: ../../c-api/unicode.rst:647 msgid "" "Return the number of written character, or return ``-1`` and raise an " "exception on error." msgstr "" -#: ../../c-api/unicode.rst:636 +#: ../../c-api/unicode.rst:656 msgid "" "Write a character to a string. The string must have been created through :c:" "func:`PyUnicode_New`. Since Unicode strings are supposed to be immutable, " "the string must not be shared, or have been hashed yet." msgstr "" -#: ../../c-api/unicode.rst:640 +#: ../../c-api/unicode.rst:660 msgid "" "This function checks that *unicode* is a Unicode object, that the index is " "not out of bounds, and that the object can be modified safely (i.e. that it " "its reference count is one)." msgstr "" -#: ../../c-api/unicode.rst:649 +#: ../../c-api/unicode.rst:664 +msgid "Return ``0`` on success, ``-1`` on error with an exception set." +msgstr "" + +#: ../../c-api/unicode.rst:671 msgid "" "Read a character from a string. This function checks that *unicode* is a " "Unicode object and the index is not out of bounds, in contrast to :c:func:" "`PyUnicode_READ_CHAR`, which performs no error checking." msgstr "" -#: ../../c-api/unicode.rst:659 +#: ../../c-api/unicode.rst:675 +msgid "Return character on success, ``-1`` on error with an exception set." +msgstr "" + +#: ../../c-api/unicode.rst:683 msgid "" "Return a substring of *unicode*, from character index *start* (included) to " -"character index *end* (excluded). Negative indices are not supported." +"character index *end* (excluded). Negative indices are not supported. On " +"error, set an exception and return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:668 +#: ../../c-api/unicode.rst:693 msgid "" "Copy the string *unicode* into a UCS4 buffer, including a null character, if " "*copy_null* is set. Returns ``NULL`` and sets an exception on error (in " @@ -856,7 +917,7 @@ msgid "" "*unicode*). *buffer* is returned on success." msgstr "" -#: ../../c-api/unicode.rst:678 +#: ../../c-api/unicode.rst:703 msgid "" "Copy the string *unicode* into a new UCS4 buffer that is allocated using :c:" "func:`PyMem_Malloc`. If this fails, ``NULL`` is returned with a :exc:" @@ -864,17 +925,17 @@ msgid "" "appended." msgstr "" -#: ../../c-api/unicode.rst:687 +#: ../../c-api/unicode.rst:712 msgid "Locale Encoding" msgstr "" -#: ../../c-api/unicode.rst:689 +#: ../../c-api/unicode.rst:714 msgid "" "The current locale encoding can be used to decode text from the operating " "system." msgstr "" -#: ../../c-api/unicode.rst:696 +#: ../../c-api/unicode.rst:721 msgid "" "Decode a string from UTF-8 on Android and VxWorks, or from the current " "locale encoding on other platforms. The supported error handlers are " @@ -883,21 +944,21 @@ msgid "" "null character but cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:703 +#: ../../c-api/unicode.rst:728 msgid "" "Use :c:func:`PyUnicode_DecodeFSDefaultAndSize` to decode a string from the :" "term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:706 ../../c-api/unicode.rst:741 +#: ../../c-api/unicode.rst:731 ../../c-api/unicode.rst:766 msgid "This function ignores the :ref:`Python UTF-8 Mode `." msgstr "" -#: ../../c-api/unicode.rst:710 ../../c-api/unicode.rst:807 +#: ../../c-api/unicode.rst:735 ../../c-api/unicode.rst:832 msgid "The :c:func:`Py_DecodeLocale` function." msgstr ":c:func:`Py_DecodeLocale` 函式。" -#: ../../c-api/unicode.rst:714 +#: ../../c-api/unicode.rst:739 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -905,13 +966,13 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:723 +#: ../../c-api/unicode.rst:748 msgid "" "Similar to :c:func:`PyUnicode_DecodeLocaleAndSize`, but compute the string " "length using :c:func:`!strlen`." msgstr "" -#: ../../c-api/unicode.rst:731 +#: ../../c-api/unicode.rst:756 msgid "" "Encode a Unicode object to UTF-8 on Android and VxWorks, or to the current " "locale encoding on other platforms. The supported error handlers are " @@ -920,17 +981,17 @@ msgid "" "`bytes` object. *unicode* cannot contain embedded null characters." msgstr "" -#: ../../c-api/unicode.rst:738 +#: ../../c-api/unicode.rst:763 msgid "" "Use :c:func:`PyUnicode_EncodeFSDefault` to encode a string to the :term:" "`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:745 ../../c-api/unicode.rst:838 +#: ../../c-api/unicode.rst:770 ../../c-api/unicode.rst:863 msgid "The :c:func:`Py_EncodeLocale` function." msgstr ":c:func:`Py_EncodeLocale` 函式。" -#: ../../c-api/unicode.rst:749 +#: ../../c-api/unicode.rst:774 msgid "" "The function now also uses the current locale encoding for the " "``surrogateescape`` error handler, except on Android. Previously, :c:func:" @@ -938,24 +999,24 @@ msgid "" "locale encoding was used for ``strict``." msgstr "" -#: ../../c-api/unicode.rst:758 +#: ../../c-api/unicode.rst:783 msgid "File System Encoding" msgstr "" -#: ../../c-api/unicode.rst:760 +#: ../../c-api/unicode.rst:785 msgid "" "Functions encoding to and decoding from the :term:`filesystem encoding and " "error handler` (:pep:`383` and :pep:`529`)." msgstr "" -#: ../../c-api/unicode.rst:763 +#: ../../c-api/unicode.rst:788 msgid "" "To encode file names to :class:`bytes` during argument parsing, the " "``\"O&\"`` converter should be used, passing :c:func:`PyUnicode_FSConverter` " "as the conversion function:" msgstr "" -#: ../../c-api/unicode.rst:769 +#: ../../c-api/unicode.rst:794 msgid "" "ParseTuple converter: encode :class:`str` objects -- obtained directly or " "through the :class:`os.PathLike` interface -- to :class:`bytes` using :c:" @@ -964,18 +1025,18 @@ msgid "" "is no longer used." msgstr "" -#: ../../c-api/unicode.rst:777 ../../c-api/unicode.rst:794 +#: ../../c-api/unicode.rst:802 ../../c-api/unicode.rst:819 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../c-api/unicode.rst:780 +#: ../../c-api/unicode.rst:805 msgid "" "To decode file names to :class:`str` during argument parsing, the ``\"O&\"`` " "converter should be used, passing :c:func:`PyUnicode_FSDecoder` as the " "conversion function:" msgstr "" -#: ../../c-api/unicode.rst:786 +#: ../../c-api/unicode.rst:811 msgid "" "ParseTuple converter: decode :class:`bytes` objects -- obtained either " "directly or indirectly through the :class:`os.PathLike` interface -- to :" @@ -984,57 +1045,57 @@ msgid "" "which must be released when it is no longer used." msgstr "" -#: ../../c-api/unicode.rst:800 +#: ../../c-api/unicode.rst:825 msgid "Decode a string from the :term:`filesystem encoding and error handler`." msgstr "" -#: ../../c-api/unicode.rst:802 +#: ../../c-api/unicode.rst:827 msgid "" "If you need to decode a string from the current locale encoding, use :c:func:" "`PyUnicode_DecodeLocaleAndSize`." msgstr "" -#: ../../c-api/unicode.rst:809 ../../c-api/unicode.rst:822 -#: ../../c-api/unicode.rst:842 +#: ../../c-api/unicode.rst:834 ../../c-api/unicode.rst:847 +#: ../../c-api/unicode.rst:867 msgid "" "The :term:`filesystem error handler ` " "is now used." msgstr "" -#: ../../c-api/unicode.rst:816 +#: ../../c-api/unicode.rst:841 msgid "" "Decode a null-terminated string from the :term:`filesystem encoding and " "error handler`." msgstr "" -#: ../../c-api/unicode.rst:819 +#: ../../c-api/unicode.rst:844 msgid "" "If the string length is known, use :c:func:" "`PyUnicode_DecodeFSDefaultAndSize`." msgstr "" -#: ../../c-api/unicode.rst:829 +#: ../../c-api/unicode.rst:854 msgid "" "Encode a Unicode object to the :term:`filesystem encoding and error " "handler`, and return :class:`bytes`. Note that the resulting :class:`bytes` " "object can contain null bytes." msgstr "" -#: ../../c-api/unicode.rst:833 +#: ../../c-api/unicode.rst:858 msgid "" "If you need to encode a string to the current locale encoding, use :c:func:" "`PyUnicode_EncodeLocale`." msgstr "" -#: ../../c-api/unicode.rst:847 +#: ../../c-api/unicode.rst:872 msgid "wchar_t Support" msgstr "wchar_t 支援" -#: ../../c-api/unicode.rst:849 +#: ../../c-api/unicode.rst:874 msgid ":c:type:`wchar_t` support for platforms which support it:" msgstr "" -#: ../../c-api/unicode.rst:853 +#: ../../c-api/unicode.rst:878 msgid "" "Create a Unicode object from the :c:type:`wchar_t` buffer *wstr* of the " "given *size*. Passing ``-1`` as the *size* indicates that the function must " @@ -1042,7 +1103,7 @@ msgid "" "failure." msgstr "" -#: ../../c-api/unicode.rst:861 +#: ../../c-api/unicode.rst:886 msgid "" "Copy the Unicode object contents into the :c:type:`wchar_t` buffer *wstr*. " "At most *size* :c:type:`wchar_t` characters are copied (excluding a possibly " @@ -1050,13 +1111,13 @@ msgid "" "`wchar_t` characters copied or ``-1`` in case of an error." msgstr "" -#: ../../c-api/unicode.rst:866 +#: ../../c-api/unicode.rst:891 msgid "" "When *wstr* is ``NULL``, instead return the *size* that would be required to " "store all of *unicode* including a terminating null." msgstr "" -#: ../../c-api/unicode.rst:869 +#: ../../c-api/unicode.rst:894 msgid "" "Note that the resulting :c:expr:`wchar_t*` string may or may not be null-" "terminated. It is the responsibility of the caller to make sure that the :c:" @@ -1066,7 +1127,7 @@ msgid "" "most C functions." msgstr "" -#: ../../c-api/unicode.rst:879 +#: ../../c-api/unicode.rst:904 msgid "" "Convert the Unicode object to a wide character string. The output string " "always ends with a null character. If *size* is not ``NULL``, write the " @@ -1077,37 +1138,37 @@ msgid "" "`wchar_t*` string contains null characters a :exc:`ValueError` is raised." msgstr "" -#: ../../c-api/unicode.rst:887 +#: ../../c-api/unicode.rst:912 msgid "" "Returns a buffer allocated by :c:macro:`PyMem_New` (use :c:func:`PyMem_Free` " "to free it) on success. On error, returns ``NULL`` and *\\*size* is " "undefined. Raises a :exc:`MemoryError` if memory allocation is failed." msgstr "" -#: ../../c-api/unicode.rst:894 +#: ../../c-api/unicode.rst:919 msgid "" "Raises a :exc:`ValueError` if *size* is ``NULL`` and the :c:expr:`wchar_t*` " "string contains null characters." msgstr "" -#: ../../c-api/unicode.rst:902 +#: ../../c-api/unicode.rst:927 msgid "Built-in Codecs" msgstr "" -#: ../../c-api/unicode.rst:904 +#: ../../c-api/unicode.rst:929 msgid "" "Python provides a set of built-in codecs which are written in C for speed. " "All of these codecs are directly usable via the following functions." msgstr "" -#: ../../c-api/unicode.rst:907 +#: ../../c-api/unicode.rst:932 msgid "" "Many of the following APIs take two arguments encoding and errors, and they " "have the same semantics as the ones of the built-in :func:`str` string " "object constructor." msgstr "" -#: ../../c-api/unicode.rst:911 +#: ../../c-api/unicode.rst:936 msgid "" "Setting encoding to ``NULL`` causes the default encoding to be used which is " "UTF-8. The file system calls should use :c:func:`PyUnicode_FSConverter` for " @@ -1115,28 +1176,28 @@ msgid "" "handler` internally." msgstr "" -#: ../../c-api/unicode.rst:916 +#: ../../c-api/unicode.rst:941 msgid "" "Error handling is set by errors which may also be set to ``NULL`` meaning to " "use the default handling defined for the codec. Default error handling for " "all built-in codecs is \"strict\" (:exc:`ValueError` is raised)." msgstr "" -#: ../../c-api/unicode.rst:920 +#: ../../c-api/unicode.rst:945 msgid "" "The codecs all use a similar interface. Only deviations from the following " "generic ones are documented for simplicity." msgstr "" -#: ../../c-api/unicode.rst:925 +#: ../../c-api/unicode.rst:950 msgid "Generic Codecs" msgstr "" -#: ../../c-api/unicode.rst:927 +#: ../../c-api/unicode.rst:952 msgid "These are the generic codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:933 +#: ../../c-api/unicode.rst:958 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string " "*str*. *encoding* and *errors* have the same meaning as the parameters of " @@ -1145,7 +1206,7 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:943 +#: ../../c-api/unicode.rst:968 msgid "" "Encode a Unicode object and return the result as Python bytes object. " "*encoding* and *errors* have the same meaning as the parameters of the same " @@ -1154,21 +1215,21 @@ msgid "" "was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:951 +#: ../../c-api/unicode.rst:976 msgid "UTF-8 Codecs" msgstr "UTF-8 編解碼器" -#: ../../c-api/unicode.rst:953 +#: ../../c-api/unicode.rst:978 msgid "These are the UTF-8 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:958 +#: ../../c-api/unicode.rst:983 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-8 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:965 +#: ../../c-api/unicode.rst:990 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF8`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-8 byte sequences will " @@ -1176,14 +1237,20 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:973 +#: ../../c-api/unicode.rst:998 msgid "" "Encode a Unicode object using UTF-8 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:980 +#: ../../c-api/unicode.rst:1002 ../../c-api/unicode.rst:1017 +msgid "" +"The function fails if the string contains surrogate code points (``U+D800`` " +"- ``U+DFFF``)." +msgstr "" + +#: ../../c-api/unicode.rst:1008 msgid "" "Return a pointer to the UTF-8 encoding of the Unicode object, and store the " "size of the encoded representation (in bytes) in *size*. The *size* " @@ -1192,13 +1259,13 @@ msgid "" "regardless of whether there are any other null code points." msgstr "" -#: ../../c-api/unicode.rst:986 +#: ../../c-api/unicode.rst:1014 msgid "" -"In the case of an error, ``NULL`` is returned with an exception set and no " -"*size* is stored." +"On error, set an exception, set *size* to ``-1`` (if it's not NULL) and " +"return ``NULL``." msgstr "" -#: ../../c-api/unicode.rst:989 +#: ../../c-api/unicode.rst:1020 msgid "" "This caches the UTF-8 representation of the string in the Unicode object, " "and subsequent calls will return a pointer to the same buffer. The caller " @@ -1207,47 +1274,47 @@ msgid "" "collected." msgstr "" -#: ../../c-api/unicode.rst:996 ../../c-api/unicode.rst:1009 +#: ../../c-api/unicode.rst:1027 ../../c-api/unicode.rst:1040 msgid "The return type is now ``const char *`` rather of ``char *``." msgstr "" -#: ../../c-api/unicode.rst:999 +#: ../../c-api/unicode.rst:1030 msgid "This function is a part of the :ref:`limited API `." msgstr "" -#: ../../c-api/unicode.rst:1005 +#: ../../c-api/unicode.rst:1036 msgid "As :c:func:`PyUnicode_AsUTF8AndSize`, but does not store the size." msgstr "" -#: ../../c-api/unicode.rst:1014 +#: ../../c-api/unicode.rst:1045 msgid "UTF-32 Codecs" msgstr "UTF-32 編解碼器" -#: ../../c-api/unicode.rst:1016 +#: ../../c-api/unicode.rst:1047 msgid "These are the UTF-32 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1022 +#: ../../c-api/unicode.rst:1053 msgid "" "Decode *size* bytes from a UTF-32 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1026 ../../c-api/unicode.rst:1076 +#: ../../c-api/unicode.rst:1057 ../../c-api/unicode.rst:1107 msgid "" "If *byteorder* is non-``NULL``, the decoder starts decoding using the given " "byte order::" msgstr "" -#: ../../c-api/unicode.rst:1029 ../../c-api/unicode.rst:1079 +#: ../../c-api/unicode.rst:1060 ../../c-api/unicode.rst:1110 msgid "" "*byteorder == -1: little endian\n" "*byteorder == 0: native order\n" "*byteorder == 1: big endian" msgstr "" -#: ../../c-api/unicode.rst:1033 +#: ../../c-api/unicode.rst:1064 msgid "" "If ``*byteorder`` is zero, and the first four bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1255,21 +1322,21 @@ msgid "" "``-1`` or ``1``, any byte order mark is copied to the output." msgstr "" -#: ../../c-api/unicode.rst:1038 +#: ../../c-api/unicode.rst:1069 msgid "" "After completion, *\\*byteorder* is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1041 ../../c-api/unicode.rst:1092 +#: ../../c-api/unicode.rst:1072 ../../c-api/unicode.rst:1123 msgid "If *byteorder* is ``NULL``, the codec starts in native order mode." msgstr "" -#: ../../c-api/unicode.rst:1043 ../../c-api/unicode.rst:1094 +#: ../../c-api/unicode.rst:1074 ../../c-api/unicode.rst:1125 msgid "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1049 +#: ../../c-api/unicode.rst:1080 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF32`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF32Stateful` will not " @@ -1278,29 +1345,29 @@ msgid "" "number of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1058 +#: ../../c-api/unicode.rst:1089 msgid "" "Return a Python byte string using the UTF-32 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1064 +#: ../../c-api/unicode.rst:1095 msgid "UTF-16 Codecs" msgstr "UTF-16 編解碼器" -#: ../../c-api/unicode.rst:1066 +#: ../../c-api/unicode.rst:1097 msgid "These are the UTF-16 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1072 +#: ../../c-api/unicode.rst:1103 msgid "" "Decode *size* bytes from a UTF-16 encoded buffer string and return the " "corresponding Unicode object. *errors* (if non-``NULL``) defines the error " "handling. It defaults to \"strict\"." msgstr "" -#: ../../c-api/unicode.rst:1083 +#: ../../c-api/unicode.rst:1114 msgid "" "If ``*byteorder`` is zero, and the first two bytes of the input data are a " "byte order mark (BOM), the decoder switches to this byte order and the BOM " @@ -1309,13 +1376,13 @@ msgid "" "result in either a ``\\ufeff`` or a ``\\ufffe`` character)." msgstr "" -#: ../../c-api/unicode.rst:1089 +#: ../../c-api/unicode.rst:1120 msgid "" "After completion, ``*byteorder`` is set to the current byte order at the end " "of input data." msgstr "" -#: ../../c-api/unicode.rst:1100 +#: ../../c-api/unicode.rst:1131 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF16`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeUTF16Stateful` will not " @@ -1325,28 +1392,28 @@ msgid "" "*consumed*." msgstr "" -#: ../../c-api/unicode.rst:1109 +#: ../../c-api/unicode.rst:1140 msgid "" "Return a Python byte string using the UTF-16 encoding in native byte order. " "The string always starts with a BOM mark. Error handling is \"strict\". " "Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1115 +#: ../../c-api/unicode.rst:1146 msgid "UTF-7 Codecs" msgstr "UTF-7 編解碼器" -#: ../../c-api/unicode.rst:1117 +#: ../../c-api/unicode.rst:1148 msgid "These are the UTF-7 codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1122 +#: ../../c-api/unicode.rst:1153 msgid "" "Create a Unicode object by decoding *size* bytes of the UTF-7 encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1129 +#: ../../c-api/unicode.rst:1160 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeUTF7`. If " "*consumed* is not ``NULL``, trailing incomplete UTF-7 base-64 sections will " @@ -1354,101 +1421,101 @@ msgid "" "of bytes that have been decoded will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1136 +#: ../../c-api/unicode.rst:1167 msgid "Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1138 +#: ../../c-api/unicode.rst:1169 msgid "These are the \"Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1144 +#: ../../c-api/unicode.rst:1175 msgid "" "Create a Unicode object by decoding *size* bytes of the Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1150 +#: ../../c-api/unicode.rst:1181 msgid "" "Encode a Unicode object using Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1156 +#: ../../c-api/unicode.rst:1187 msgid "Raw-Unicode-Escape Codecs" msgstr "" -#: ../../c-api/unicode.rst:1158 +#: ../../c-api/unicode.rst:1189 msgid "These are the \"Raw Unicode Escape\" codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1164 +#: ../../c-api/unicode.rst:1195 msgid "" "Create a Unicode object by decoding *size* bytes of the Raw-Unicode-Escape " "encoded string *str*. Return ``NULL`` if an exception was raised by the " "codec." msgstr "" -#: ../../c-api/unicode.rst:1170 +#: ../../c-api/unicode.rst:1201 msgid "" "Encode a Unicode object using Raw-Unicode-Escape and return the result as a " "bytes object. Error handling is \"strict\". Return ``NULL`` if an " "exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1176 +#: ../../c-api/unicode.rst:1207 msgid "Latin-1 Codecs" msgstr "Latin-1 編解碼器" -#: ../../c-api/unicode.rst:1178 +#: ../../c-api/unicode.rst:1209 msgid "" "These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 " "Unicode ordinals and only these are accepted by the codecs during encoding." msgstr "" -#: ../../c-api/unicode.rst:1184 +#: ../../c-api/unicode.rst:1215 msgid "" "Create a Unicode object by decoding *size* bytes of the Latin-1 encoded " "string *str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1190 +#: ../../c-api/unicode.rst:1221 msgid "" "Encode a Unicode object using Latin-1 and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1196 +#: ../../c-api/unicode.rst:1227 msgid "ASCII Codecs" msgstr "ASCII 編解碼器" -#: ../../c-api/unicode.rst:1198 +#: ../../c-api/unicode.rst:1229 msgid "" "These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All " "other codes generate errors." msgstr "" -#: ../../c-api/unicode.rst:1204 +#: ../../c-api/unicode.rst:1235 msgid "" "Create a Unicode object by decoding *size* bytes of the ASCII encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1210 +#: ../../c-api/unicode.rst:1241 msgid "" "Encode a Unicode object using ASCII and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1216 +#: ../../c-api/unicode.rst:1247 msgid "Character Map Codecs" msgstr "" -#: ../../c-api/unicode.rst:1218 +#: ../../c-api/unicode.rst:1249 msgid "" "This codec is special in that it can be used to implement many different " "codecs (and this is in fact what was done to obtain most of the standard " @@ -1458,18 +1525,18 @@ msgid "" "sequences work well." msgstr "" -#: ../../c-api/unicode.rst:1224 +#: ../../c-api/unicode.rst:1255 msgid "These are the mapping codec APIs:" msgstr "" -#: ../../c-api/unicode.rst:1229 +#: ../../c-api/unicode.rst:1260 msgid "" "Create a Unicode object by decoding *size* bytes of the encoded string *str* " "using the given *mapping* object. Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1233 +#: ../../c-api/unicode.rst:1264 msgid "" "If *mapping* is ``NULL``, Latin-1 decoding will be applied. Else *mapping* " "must map bytes ordinals (integers in the range from 0 to 255) to Unicode " @@ -1479,14 +1546,14 @@ msgid "" "treated as undefined mappings and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1244 +#: ../../c-api/unicode.rst:1275 msgid "" "Encode a Unicode object using the given *mapping* object and return the " "result as a bytes object. Error handling is \"strict\". Return ``NULL`` if " "an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1248 +#: ../../c-api/unicode.rst:1279 msgid "" "The *mapping* object must map Unicode ordinal integers to bytes objects, " "integers in the range from 0 to 255 or ``None``. Unmapped character " @@ -1494,41 +1561,41 @@ msgid "" "``None`` are treated as \"undefined mapping\" and cause an error." msgstr "" -#: ../../c-api/unicode.rst:1254 +#: ../../c-api/unicode.rst:1285 msgid "The following codec API is special in that maps Unicode to Unicode." msgstr "" -#: ../../c-api/unicode.rst:1258 +#: ../../c-api/unicode.rst:1289 msgid "" "Translate a string by applying a character mapping table to it and return " "the resulting Unicode object. Return ``NULL`` if an exception was raised by " "the codec." msgstr "" -#: ../../c-api/unicode.rst:1262 +#: ../../c-api/unicode.rst:1293 msgid "" "The mapping table must map Unicode ordinal integers to Unicode ordinal " "integers or ``None`` (causing deletion of the character)." msgstr "" -#: ../../c-api/unicode.rst:1265 +#: ../../c-api/unicode.rst:1296 msgid "" "Mapping tables need only provide the :meth:`~object.__getitem__` interface; " "dictionaries and sequences work well. Unmapped character ordinals (ones " "which cause a :exc:`LookupError`) are left untouched and are copied as-is." msgstr "" -#: ../../c-api/unicode.rst:1269 +#: ../../c-api/unicode.rst:1300 msgid "" "*errors* has the usual meaning for codecs. It may be ``NULL`` which " "indicates to use the default error handling." msgstr "" -#: ../../c-api/unicode.rst:1274 +#: ../../c-api/unicode.rst:1305 msgid "MBCS codecs for Windows" msgstr "" -#: ../../c-api/unicode.rst:1276 +#: ../../c-api/unicode.rst:1307 msgid "" "These are the MBCS codec APIs. They are currently only available on Windows " "and use the Win32 MBCS converters to implement the conversions. Note that " @@ -1536,13 +1603,13 @@ msgid "" "is defined by the user settings on the machine running the codec." msgstr "" -#: ../../c-api/unicode.rst:1283 +#: ../../c-api/unicode.rst:1314 msgid "" "Create a Unicode object by decoding *size* bytes of the MBCS encoded string " "*str*. Return ``NULL`` if an exception was raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1290 +#: ../../c-api/unicode.rst:1321 msgid "" "If *consumed* is ``NULL``, behave like :c:func:`PyUnicode_DecodeMBCS`. If " "*consumed* is not ``NULL``, :c:func:`PyUnicode_DecodeMBCSStateful` will not " @@ -1550,44 +1617,44 @@ msgid "" "will be stored in *consumed*." msgstr "" -#: ../../c-api/unicode.rst:1298 +#: ../../c-api/unicode.rst:1329 msgid "" "Encode a Unicode object using MBCS and return the result as Python bytes " "object. Error handling is \"strict\". Return ``NULL`` if an exception was " "raised by the codec." msgstr "" -#: ../../c-api/unicode.rst:1305 +#: ../../c-api/unicode.rst:1336 msgid "" "Encode the Unicode object using the specified code page and return a Python " "bytes object. Return ``NULL`` if an exception was raised by the codec. Use :" "c:macro:`!CP_ACP` code page to get the MBCS encoder." msgstr "" -#: ../../c-api/unicode.rst:1313 +#: ../../c-api/unicode.rst:1344 msgid "Methods & Slots" msgstr "" -#: ../../c-api/unicode.rst:1319 +#: ../../c-api/unicode.rst:1350 msgid "Methods and Slot Functions" msgstr "" -#: ../../c-api/unicode.rst:1321 +#: ../../c-api/unicode.rst:1352 msgid "" "The following APIs are capable of handling Unicode objects and strings on " "input (we refer to them as strings in the descriptions) and return Unicode " "objects or integers as appropriate." msgstr "" -#: ../../c-api/unicode.rst:1325 +#: ../../c-api/unicode.rst:1356 msgid "They all return ``NULL`` or ``-1`` if an exception occurs." msgstr "" -#: ../../c-api/unicode.rst:1330 +#: ../../c-api/unicode.rst:1361 msgid "Concat two strings giving a new Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1335 +#: ../../c-api/unicode.rst:1366 msgid "" "Split a string giving a list of Unicode strings. If *sep* is ``NULL``, " "splitting will be done at all whitespace substrings. Otherwise, splits " @@ -1596,27 +1663,27 @@ msgid "" "list." msgstr "" -#: ../../c-api/unicode.rst:1343 +#: ../../c-api/unicode.rst:1374 msgid "" "Split a Unicode string at line breaks, returning a list of Unicode strings. " "CRLF is considered to be one line break. If *keepends* is ``0``, the Line " "break characters are not included in the resulting strings." msgstr "" -#: ../../c-api/unicode.rst:1350 +#: ../../c-api/unicode.rst:1381 msgid "" "Join a sequence of strings using the given *separator* and return the " "resulting Unicode string." msgstr "" -#: ../../c-api/unicode.rst:1357 +#: ../../c-api/unicode.rst:1388 msgid "" "Return ``1`` if *substr* matches ``unicode[start:end]`` at the given tail " "end (*direction* == ``-1`` means to do a prefix match, *direction* == ``1`` " "a suffix match), ``0`` otherwise. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1365 +#: ../../c-api/unicode.rst:1396 msgid "" "Return the first position of *substr* in ``unicode[start:end]`` using the " "given *direction* (*direction* == ``1`` means to do a forward search, " @@ -1625,7 +1692,7 @@ msgid "" "``-2`` indicates that an error occurred and an exception has been set." msgstr "" -#: ../../c-api/unicode.rst:1375 +#: ../../c-api/unicode.rst:1406 msgid "" "Return the first position of the character *ch* in ``unicode[start:end]`` " "using the given *direction* (*direction* == ``1`` means to do a forward " @@ -1635,37 +1702,57 @@ msgid "" "set." msgstr "" -#: ../../c-api/unicode.rst:1383 +#: ../../c-api/unicode.rst:1414 msgid "" "*start* and *end* are now adjusted to behave like ``unicode[start:end]``." msgstr "" -#: ../../c-api/unicode.rst:1390 +#: ../../c-api/unicode.rst:1421 msgid "" "Return the number of non-overlapping occurrences of *substr* in " "``unicode[start:end]``. Return ``-1`` if an error occurred." msgstr "" -#: ../../c-api/unicode.rst:1397 +#: ../../c-api/unicode.rst:1428 msgid "" "Replace at most *maxcount* occurrences of *substr* in *unicode* with " "*replstr* and return the resulting Unicode object. *maxcount* == ``-1`` " "means replace all occurrences." msgstr "" -#: ../../c-api/unicode.rst:1404 +#: ../../c-api/unicode.rst:1435 msgid "" "Compare two strings and return ``-1``, ``0``, ``1`` for less than, equal, " "and greater than, respectively." msgstr "" -#: ../../c-api/unicode.rst:1407 +#: ../../c-api/unicode.rst:1438 msgid "" "This function returns ``-1`` upon failure, so one should call :c:func:" "`PyErr_Occurred` to check for errors." msgstr "" -#: ../../c-api/unicode.rst:1413 +#: ../../c-api/unicode.rst:1444 +msgid "" +"Compare a Unicode object with a char buffer which is interpreted as being " +"UTF-8 or ASCII encoded and return true (``1``) if they are equal, or false " +"(``0``) otherwise. If the Unicode object contains surrogate code points " +"(``U+D800`` - ``U+DFFF``) or the C string is not valid UTF-8, false (``0``) " +"is returned." +msgstr "" + +#: ../../c-api/unicode.rst:1451 ../../c-api/unicode.rst:1472 +msgid "This function does not raise exceptions." +msgstr "" + +#: ../../c-api/unicode.rst:1458 +msgid "" +"Similar to :c:func:`PyUnicode_EqualToUTF8AndSize`, but compute *string* " +"length using :c:func:`!strlen`. If the Unicode object contains null " +"characters, false (``0``) is returned." +msgstr "" + +#: ../../c-api/unicode.rst:1467 msgid "" "Compare a Unicode object, *unicode*, with *string* and return ``-1``, ``0``, " "``1`` for less than, equal, and greater than, respectively. It is best to " @@ -1673,51 +1760,47 @@ msgid "" "string as ISO-8859-1 if it contains non-ASCII characters." msgstr "" -#: ../../c-api/unicode.rst:1418 -msgid "This function does not raise exceptions." -msgstr "" - -#: ../../c-api/unicode.rst:1423 +#: ../../c-api/unicode.rst:1477 msgid "Rich compare two Unicode strings and return one of the following:" msgstr "" -#: ../../c-api/unicode.rst:1425 +#: ../../c-api/unicode.rst:1479 msgid "``NULL`` in case an exception was raised" msgstr "" -#: ../../c-api/unicode.rst:1426 +#: ../../c-api/unicode.rst:1480 msgid ":c:data:`Py_True` or :c:data:`Py_False` for successful comparisons" msgstr "" -#: ../../c-api/unicode.rst:1427 +#: ../../c-api/unicode.rst:1481 msgid ":c:data:`Py_NotImplemented` in case the type combination is unknown" msgstr "" -#: ../../c-api/unicode.rst:1429 +#: ../../c-api/unicode.rst:1483 msgid "" "Possible values for *op* are :c:macro:`Py_GT`, :c:macro:`Py_GE`, :c:macro:" "`Py_EQ`, :c:macro:`Py_NE`, :c:macro:`Py_LT`, and :c:macro:`Py_LE`." msgstr "" -#: ../../c-api/unicode.rst:1435 +#: ../../c-api/unicode.rst:1489 msgid "" "Return a new string object from *format* and *args*; this is analogous to " "``format % args``." msgstr "" -#: ../../c-api/unicode.rst:1441 +#: ../../c-api/unicode.rst:1495 msgid "" "Check whether *substr* is contained in *unicode* and return true or false " "accordingly." msgstr "" -#: ../../c-api/unicode.rst:1444 +#: ../../c-api/unicode.rst:1498 msgid "" "*substr* has to coerce to a one element Unicode string. ``-1`` is returned " "if there was an error." msgstr "" -#: ../../c-api/unicode.rst:1450 +#: ../../c-api/unicode.rst:1504 msgid "" "Intern the argument :c:expr:`*p_unicode` in place. The argument must be the " "address of a pointer variable pointing to a Python Unicode string object. " @@ -1725,16 +1808,58 @@ msgid "" "`*p_unicode`, it sets :c:expr:`*p_unicode` to it (releasing the reference to " "the old string object and creating a new :term:`strong reference` to the " "interned string object), otherwise it leaves :c:expr:`*p_unicode` alone and " -"interns it (creating a new :term:`strong reference`). (Clarification: even " -"though there is a lot of talk about references, think of this function as " -"reference-neutral; you own the object after the call if and only if you " -"owned it before the call.)" +"interns it." msgstr "" -#: ../../c-api/unicode.rst:1463 +#: ../../c-api/unicode.rst:1511 +msgid "" +"(Clarification: even though there is a lot of talk about references, think " +"of this function as reference-neutral. You must own the object you pass in; " +"after the call you no longer own the passed-in reference, but you newly own " +"the result.)" +msgstr "" + +#: ../../c-api/unicode.rst:1516 +msgid "" +"This function never raises an exception. On error, it leaves its argument " +"unchanged without interning it." +msgstr "" + +#: ../../c-api/unicode.rst:1519 +msgid "" +"Instances of subclasses of :py:class:`str` may not be interned, that is, :c:" +"expr:`PyUnicode_CheckExact(*p_unicode)` must be true. If it is not, then -- " +"as with any other error -- the argument is left unchanged." +msgstr "" + +#: ../../c-api/unicode.rst:1523 +msgid "" +"Note that interned strings are not “immortal”. You must keep a reference to " +"the result to benefit from interning." +msgstr "" + +#: ../../c-api/unicode.rst:1529 msgid "" "A combination of :c:func:`PyUnicode_FromString` and :c:func:" -"`PyUnicode_InternInPlace`, returning either a new Unicode string object that " -"has been interned, or a new (\"owned\") reference to an earlier interned " -"string object with the same value." +"`PyUnicode_InternInPlace`, meant for statically allocated strings." +msgstr "" + +#: ../../c-api/unicode.rst:1532 +msgid "" +"Return a new (\"owned\") reference to either a new Unicode string object " +"that has been interned, or an earlier interned string object with the same " +"value." +msgstr "" + +#: ../../c-api/unicode.rst:1536 +msgid "" +"Python may keep a reference to the result, or make it :term:`immortal`, " +"preventing it from being garbage-collected promptly. For interning an " +"unbounded number of different strings, such as ones coming from user input, " +"prefer calling :c:func:`PyUnicode_FromString` and :c:func:" +"`PyUnicode_InternInPlace` directly." +msgstr "" + +#: ../../c-api/unicode.rst:1544 +msgid "Strings interned this way are made :term:`immortal`." msgstr "" diff --git a/c-api/utilities.po b/c-api/utilities.po index 71b6b1c0b7..4775a245ec 100644 --- a/c-api/utilities.po +++ b/c-api/utilities.po @@ -8,7 +8,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-01-31 17:38+0800\n" diff --git a/c-api/veryhigh.po b/c-api/veryhigh.po index 10005e654d..7f42392eaf 100644 --- a/c-api/veryhigh.po +++ b/c-api/veryhigh.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-02-12 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:08+0000\n" diff --git a/c-api/weakref.po b/c-api/weakref.po index 9217888102..7bbbcb9f44 100644 --- a/c-api/weakref.po +++ b/c-api/weakref.po @@ -6,9 +6,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-27 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -33,17 +33,19 @@ msgstr "" #: ../../c-api/weakref.rst:16 msgid "" -"Return true if *ob* is either a reference or proxy object. This function " -"always succeeds." +"Return non-zero if *ob* is either a reference or proxy object. This " +"function always succeeds." msgstr "" #: ../../c-api/weakref.rst:22 msgid "" -"Return true if *ob* is a reference object. This function always succeeds." +"Return non-zero if *ob* is a reference object. This function always " +"succeeds." msgstr "" #: ../../c-api/weakref.rst:27 -msgid "Return true if *ob* is a proxy object. This function always succeeds." +msgid "" +"Return non-zero if *ob* is a proxy object. This function always succeeds." msgstr "" #: ../../c-api/weakref.rst:32 @@ -72,11 +74,31 @@ msgstr "" #: ../../c-api/weakref.rst:56 msgid "" -"Return the referenced object from a weak reference, *ref*. If the referent " -"is no longer live, returns ``Py_None``." +"Get a :term:`strong reference` to the referenced object from a weak " +"reference, *ref*, into *\\*pobj*." +msgstr "" + +#: ../../c-api/weakref.rst:59 +msgid "" +"On success, set *\\*pobj* to a new :term:`strong reference` to the " +"referenced object and return 1." msgstr "" #: ../../c-api/weakref.rst:61 +msgid "If the reference is dead, set *\\*pobj* to ``NULL`` and return 0." +msgstr "" + +#: ../../c-api/weakref.rst:62 +msgid "On error, raise an exception and return -1." +msgstr "" + +#: ../../c-api/weakref.rst:69 +msgid "" +"Return a :term:`borrowed reference` to the referenced object from a weak " +"reference, *ref*. If the referent is no longer live, returns ``Py_None``." +msgstr "" + +#: ../../c-api/weakref.rst:74 msgid "" "This function returns a :term:`borrowed reference` to the referenced object. " "This means that you should always call :c:func:`Py_INCREF` on the object " @@ -84,19 +106,42 @@ msgid "" "reference." msgstr "" -#: ../../c-api/weakref.rst:69 +#: ../../c-api/weakref.rst:79 ../../c-api/weakref.rst:87 +msgid "Use :c:func:`PyWeakref_GetRef` instead." +msgstr "" + +#: ../../c-api/weakref.rst:85 msgid "Similar to :c:func:`PyWeakref_GetObject`, but does no error checking." msgstr "" -#: ../../c-api/weakref.rst:74 +#: ../../c-api/weakref.rst:93 msgid "" "This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler " "to clear weak references." msgstr "" -#: ../../c-api/weakref.rst:77 +#: ../../c-api/weakref.rst:96 msgid "" "This iterates through the weak references for *object* and calls callbacks " "for those references which have one. It returns when all callbacks have been " "attempted." msgstr "" + +#: ../../c-api/weakref.rst:103 +msgid "Clears the weakrefs for *object* without calling the callbacks." +msgstr "" + +#: ../../c-api/weakref.rst:105 +msgid "" +"This function is called by the :c:member:`~PyTypeObject.tp_dealloc` handler " +"for types with finalizers (i.e., :meth:`~object.__del__`). The handler for " +"those objects first calls :c:func:`PyObject_ClearWeakRefs` to clear weakrefs " +"and call their callbacks, then the finalizer, and finally this function to " +"clear any weakrefs that may have been created by the finalizer." +msgstr "" + +#: ../../c-api/weakref.rst:111 +msgid "" +"In most circumstances, it's more appropriate to use :c:func:" +"`PyObject_ClearWeakRefs` to clear weakrefs instead of this function." +msgstr "" diff --git a/contents.po b/contents.po index 6a7a4c49cb..3312166d6f 100644 --- a/contents.po +++ b/contents.po @@ -7,7 +7,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/copyright.po b/copyright.po index add619c6e3..63bcc2fbfa 100644 --- a/copyright.po +++ b/copyright.po @@ -9,9 +9,9 @@ # meowmeowcat , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-10 00:17+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-06-25 20:17+0800\n" "Last-Translator: meowmeowcat \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,7 +32,8 @@ msgid "Python and this documentation is:" msgstr "Python 和這份說明文件的版權:" #: ../../copyright.rst:7 -msgid "Copyright © 2001-2023 Python Software Foundation. All rights reserved." +#, fuzzy +msgid "Copyright © 2001-2024 Python Software Foundation. All rights reserved." msgstr "Copyright © 2001-2023 Python Software Foundation 保留一切權利。" #: ../../copyright.rst:9 diff --git a/deprecations/c-api-pending-removal-in-3.14.po b/deprecations/c-api-pending-removal-in-3.14.po index a8d1a702cf..aaa4c2db16 100644 --- a/deprecations/c-api-pending-removal-in-3.14.po +++ b/deprecations/c-api-pending-removal-in-3.14.po @@ -4,9 +4,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-17 00:03+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -41,164 +41,167 @@ msgid "" msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:12 -msgid "``PySys_SetArgvEx()``: set :c:member:`PyConfig.argv` instead." -msgstr "``PySys_SetArgvEx()``:請改以 :c:member:`PyConfig.argv` 設定。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:13 -msgid "``PySys_SetArgv()``: set :c:member:`PyConfig.argv` instead." -msgstr "``PySys_SetArgv()``:請改以 :c:member:`PyConfig.argv` 設定。" +msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:14 -msgid "``Py_SetProgramName()``: set :c:member:`PyConfig.program_name` instead." +msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:16 +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." msgstr "" -"``Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設定。" +":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設" +"定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:15 -msgid "``Py_SetPythonHome()``: set :c:member:`PyConfig.home` instead." -msgstr "``Py_SetPythonHome()``:請改以 :c:member:`PyConfig.home` 設定。" +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:18 +msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:17 -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:45 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" "`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:20 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 msgid "Global configuration variables:" msgstr "全域設定變數:" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:22 -msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 +msgid ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` instead." msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:23 -msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 +msgid ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` instead." msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 -msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +msgid ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` instead." msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:25 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 msgid "" -":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive` instead." +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` instead." msgstr ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 -msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +msgid ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` instead." msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:27 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:36 msgid "" -":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level` " +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " "instead." msgstr "" ":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 -msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +msgid ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` instead." msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:29 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 msgid "" -":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning` instead." +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` instead." msgstr "" ":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 msgid "" -":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings` instead." +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` instead." msgstr "" ":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:31 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:44 msgid "" -":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment` " +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" ":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." "use_environment`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" -":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode` " +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." "write_bytecode`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:33 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." "user_site_directory` instead." msgstr "" ":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." "user_site_directory`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" -":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio` " +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " "instead." msgstr "" ":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:35 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:52 msgid "" -":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed` instead." msgstr "" ":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " "和 :c:member:`PyConfig.hash_seed`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:37 -msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:55 +msgid ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` instead." msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." "legacy_windows_fs_encoding` instead." msgstr "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." "legacy_windows_fs_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:39 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." "legacy_windows_stdio` instead." msgstr "" ":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." "legacy_windows_stdio`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." +":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." "filesystem_encoding` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." "filesystem_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:41 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." +":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." "filesystem_encoding` instead." msgstr "" ":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." "filesystem_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." "filesystem_errors` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." "filesystem_errors`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:43 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` instead. (see :" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" "c:func:`Py_PreInitialize`)" msgstr "" ":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" diff --git a/deprecations/c-api-pending-removal-in-3.15.po b/deprecations/c-api-pending-removal-in-3.15.po index f9978c5575..1c765579a9 100644 --- a/deprecations/c-api-pending-removal-in-3.15.po +++ b/deprecations/c-api-pending-removal-in-3.15.po @@ -5,9 +5,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-17 00:03+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -26,64 +26,63 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -":c:func:`PyImport_ImportModuleNoBlock`: use :c:func:`PyImport_ImportModule` " -"instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" ":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" "`PyImport_ImportModule`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 -msgid "" -":c:func:`PyWeakref_GET_OBJECT`: use :c:func:`!PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GET_OBJECT`:請改用 :c:func:`!PyWeakref_GetRef`。" - #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 -msgid ":c:func:`PyWeakref_GetObject`: use :c:func:`!PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`!PyWeakref_GetRef`。" - -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:8 -msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." -msgstr ":c:type:`!Py_UNICODE_WIDE` type:請改用 :c:type:`wchar_t`。" +msgid "" +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead." +msgstr "" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 -msgid ":c:type:`Py_UNICODE` type: use :c:type:`wchar_t` instead." -msgstr ":c:type:`Py_UNICODE` type:請改用 :c:type:`wchar_t`。" +msgid "" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." +msgstr "" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" msgstr "Python 初始化函式:" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" -":c:func:`PySys_ResetWarnOptions`: clear :data:`sys.warnoptions` and :data:`!" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" ":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" "data:`!warnings.filters`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 -msgid ":c:func:`Py_GetExecPrefix`: get :data:`sys.exec_prefix` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 +msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 -msgid ":c:func:`Py_GetPath`: get :data:`sys.path` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:16 -msgid ":c:func:`Py_GetPrefix`: get :data:`sys.prefix` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 -msgid ":c:func:`Py_GetProgramFullPath`: get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 +msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:18 -msgid ":c:func:`Py_GetProgramName`: get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 +msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: get :c:member:`PyConfig.home` or the :envvar:" +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" "`PYTHONHOME` environment variable instead." msgstr "" ":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" diff --git a/deprecations/c-api-pending-removal-in-future.po b/deprecations/c-api-pending-removal-in-future.po index 3dc787ba8d..a042b964bc 100644 --- a/deprecations/c-api-pending-removal-in-future.po +++ b/deprecations/c-api-pending-removal-in-future.po @@ -5,9 +5,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-17 00:03+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -27,84 +27,85 @@ msgid "" msgstr "下列 API 已被棄用並將會被移除,不過目前尚未訂定移除日期。" #: ../../deprecations/c-api-pending-removal-in-future.rst:7 -msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: unneeded since Python 3.8." +msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." msgstr ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`:自 Python 3.8 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-future.rst:8 -msgid ":c:func:`PyErr_Fetch`: use :c:func:`PyErr_GetRaisedException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." msgstr ":c:func:`PyErr_Fetch`:請改用 :c:func:`PyErr_GetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +#: ../../deprecations/c-api-pending-removal-in-future.rst:11 msgid "" -":c:func:`PyErr_NormalizeException`: use :c:func:`PyErr_GetRaisedException` " +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" ":c:func:`PyErr_NormalizeException`:請改用 :c:func:" "`PyErr_GetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:10 +#: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" -":c:func:`PyErr_Restore`: use :c:func:`PyErr_SetRaisedException` instead." +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." msgstr ":c:func:`PyErr_Restore`:請改用 :c:func:`PyErr_SetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:11 +#: ../../deprecations/c-api-pending-removal-in-future.rst:15 msgid "" -":c:func:`PyModule_GetFilename`: use :c:func:`PyModule_GetFilenameObject` " +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " "instead." msgstr "" ":c:func:`PyModule_GetFilename`:請改用 :c:func:`PyModule_GetFilenameObject`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:12 -msgid ":c:func:`PyOS_AfterFork`: use :c:func:`PyOS_AfterFork_Child` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:13 +#: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: use :c:func:`PySlice_Unpack` and :c:func:" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" "`PySlice_AdjustIndices` instead." msgstr "" ":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" "`PySlice_AdjustIndices`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:14 +#: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" -":c:func:`!PyUnicode_AsDecodedObject`: use :c:func:`PyCodec_Decode` instead." +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." msgstr "" ":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:15 +#: ../../deprecations/c-api-pending-removal-in-future.rst:23 msgid "" -":c:func:`!PyUnicode_AsDecodedUnicode`: use :c:func:`PyCodec_Decode` instead." +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead." msgstr "" ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:16 +#: ../../deprecations/c-api-pending-removal-in-future.rst:25 msgid "" -":c:func:`!PyUnicode_AsEncodedObject`: use :c:func:`PyCodec_Encode` instead." +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." msgstr "" ":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +#: ../../deprecations/c-api-pending-removal-in-future.rst:27 msgid "" -":c:func:`!PyUnicode_AsEncodedUnicode`: use :c:func:`PyCodec_Encode` instead." +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead." msgstr "" ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:18 -msgid ":c:func:`PyUnicode_READY`: unneeded since Python 3.12" +#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" msgstr ":c:func:`PyUnicode_READY`:自 Python 3.12 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-future.rst:19 -msgid ":c:func:`!PyErr_Display`: use :c:func:`PyErr_DisplayException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:31 +msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." msgstr ":c:func:`!PyErr_Display`:請改用 :c:func:`PyErr_DisplayException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:20 +#: ../../deprecations/c-api-pending-removal-in-future.rst:33 msgid "" -":c:func:`!_PyErr_ChainExceptions`: use ``_PyErr_ChainExceptions1`` instead." +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " +"instead." msgstr "" ":c:func:`!_PyErr_ChainExceptions`:請改用 ``_PyErr_ChainExceptions1``。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:21 +#: ../../deprecations/c-api-pending-removal-in-future.rst:35 msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." @@ -112,40 +113,40 @@ msgstr "" ":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" "`PyObject_Hash`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:23 +#: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:24 +#: ../../deprecations/c-api-pending-removal-in-future.rst:38 msgid "Thread Local Storage (TLS) API:" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../deprecations/c-api-pending-removal-in-future.rst:26 +#: ../../deprecations/c-api-pending-removal-in-future.rst:40 msgid "" -":c:func:`PyThread_create_key`: use :c:func:`PyThread_tss_alloc` instead." +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." msgstr ":c:func:`PyThread_create_key`:請改用 :c:func:`PyThread_tss_alloc`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:27 -msgid ":c:func:`PyThread_delete_key`: use :c:func:`PyThread_tss_free` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:42 +msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." msgstr ":c:func:`PyThread_delete_key`:請改用 :c:func:`PyThread_tss_free`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:28 +#: ../../deprecations/c-api-pending-removal-in-future.rst:44 msgid "" -":c:func:`PyThread_set_key_value`: use :c:func:`PyThread_tss_set` instead." +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." msgstr ":c:func:`PyThread_set_key_value`:請改用 :c:func:`PyThread_tss_set`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +#: ../../deprecations/c-api-pending-removal-in-future.rst:46 msgid "" -":c:func:`PyThread_get_key_value`: use :c:func:`PyThread_tss_get` instead." +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." msgstr ":c:func:`PyThread_get_key_value`:請改用 :c:func:`PyThread_tss_get`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:30 +#: ../../deprecations/c-api-pending-removal-in-future.rst:48 msgid "" -":c:func:`PyThread_delete_key_value`: use :c:func:`PyThread_tss_delete` " +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " "instead." msgstr "" ":c:func:`PyThread_delete_key_value`:請改用 :c:func:`PyThread_tss_delete`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:31 -msgid ":c:func:`PyThread_ReInitTLS`: unneeded since Python 3.7." +#: ../../deprecations/c-api-pending-removal-in-future.rst:50 +msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" diff --git a/deprecations/index.po b/deprecations/index.po index 96ef5f4c93..7634be6157 100644 --- a/deprecations/index.po +++ b/deprecations/index.po @@ -2,12 +2,11 @@ # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # -#, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-30 18:24+0000\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,180 +19,6 @@ msgstr "" msgid "Deprecations" msgstr "已棄用項目" -#: ../../deprecations/pending-removal-in-3.13.rst:2 -msgid "Pending Removal in Python 3.13" -msgstr "Python 3.13 中待移除的項目" - -#: ../../deprecations/pending-removal-in-3.13.rst:4 -msgid "Modules (see :pep:`594`):" -msgstr "模組(請見 :pep:`594`):" - -#: ../../deprecations/pending-removal-in-3.13.rst:6 -msgid ":mod:`aifc`" -msgstr ":mod:`aifc`" - -#: ../../deprecations/pending-removal-in-3.13.rst:7 -msgid ":mod:`audioop`" -msgstr ":mod:`audioop`" - -#: ../../deprecations/pending-removal-in-3.13.rst:8 -msgid ":mod:`cgi`" -msgstr ":mod:`cgi`" - -#: ../../deprecations/pending-removal-in-3.13.rst:9 -msgid ":mod:`cgitb`" -msgstr ":mod:`cgitb`" - -#: ../../deprecations/pending-removal-in-3.13.rst:10 -msgid ":mod:`chunk`" -msgstr ":mod:`chunk`" - -#: ../../deprecations/pending-removal-in-3.13.rst:11 -msgid ":mod:`crypt`" -msgstr ":mod:`crypt`" - -#: ../../deprecations/pending-removal-in-3.13.rst:12 -msgid ":mod:`imghdr`" -msgstr ":mod:`imghdr`" - -#: ../../deprecations/pending-removal-in-3.13.rst:13 -msgid ":mod:`mailcap`" -msgstr ":mod:`mailcap`" - -#: ../../deprecations/pending-removal-in-3.13.rst:14 -msgid ":mod:`msilib`" -msgstr ":mod:`msilib`" - -#: ../../deprecations/pending-removal-in-3.13.rst:15 -msgid ":mod:`nis`" -msgstr ":mod:`nis`" - -#: ../../deprecations/pending-removal-in-3.13.rst:16 -msgid ":mod:`nntplib`" -msgstr ":mod:`nntplib`" - -#: ../../deprecations/pending-removal-in-3.13.rst:17 -msgid ":mod:`ossaudiodev`" -msgstr ":mod:`ossaudiodev`" - -#: ../../deprecations/pending-removal-in-3.13.rst:18 -msgid ":mod:`pipes`" -msgstr ":mod:`pipes`" - -#: ../../deprecations/pending-removal-in-3.13.rst:19 -msgid ":mod:`sndhdr`" -msgstr ":mod:`sndhdr`" - -#: ../../deprecations/pending-removal-in-3.13.rst:20 -msgid ":mod:`spwd`" -msgstr ":mod:`spwd`" - -#: ../../deprecations/pending-removal-in-3.13.rst:21 -msgid ":mod:`sunau`" -msgstr ":mod:`sunau`" - -#: ../../deprecations/pending-removal-in-3.13.rst:22 -msgid ":mod:`telnetlib`" -msgstr ":mod:`telnetlib`" - -#: ../../deprecations/pending-removal-in-3.13.rst:23 -msgid ":mod:`uu`" -msgstr ":mod:`uu`" - -#: ../../deprecations/pending-removal-in-3.13.rst:24 -msgid ":mod:`xdrlib`" -msgstr ":mod:`xdrlib`" - -#: ../../deprecations/pending-removal-in-3.13.rst:26 -msgid "Other modules:" -msgstr "其他模組:" - -#: ../../deprecations/pending-removal-in-3.13.rst:28 -msgid ":mod:`!lib2to3`, and the :program:`2to3` program (:gh:`84540`)" -msgstr ":mod:`!lib2to3` 和 :program:`2to3` 程式 (:gh:`84540`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:30 -msgid "APIs:" -msgstr "API:" - -#: ../../deprecations/pending-removal-in-3.13.rst:32 -msgid ":class:`!configparser.LegacyInterpolation` (:gh:`90765`)" -msgstr ":class:`!configparser.LegacyInterpolation` (:gh:`90765`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:33 -msgid "``locale.resetlocale()`` (:gh:`90817`)" -msgstr "``locale.resetlocale()`` (:gh:`90817`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:34 -msgid ":meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)" -msgstr ":meth:`!turtle.RawTurtle.settiltangle` (:gh:`50096`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:35 -msgid ":func:`!unittest.findTestCases` (:gh:`50096`)" -msgstr ":func:`!unittest.findTestCases` (:gh:`50096`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:36 -msgid ":func:`!unittest.getTestCaseNames` (:gh:`50096`)" -msgstr ":func:`!unittest.getTestCaseNames` (:gh:`50096`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:37 -msgid ":func:`!unittest.makeSuite` (:gh:`50096`)" -msgstr ":func:`!unittest.makeSuite` (:gh:`50096`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:38 -msgid ":meth:`!unittest.TestProgram.usageExit` (:gh:`67048`)" -msgstr ":meth:`!unittest.TestProgram.usageExit` (:gh:`67048`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:39 -msgid ":class:`!webbrowser.MacOSX` (:gh:`86421`)" -msgstr ":class:`!webbrowser.MacOSX` (:gh:`86421`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:40 -msgid ":class:`classmethod` descriptor chaining (:gh:`89519`)" -msgstr ":class:`classmethod` 描述器鏈接 (:gh:`89519`)" - -#: ../../deprecations/pending-removal-in-3.13.rst:41 -msgid ":mod:`importlib.resources` deprecated methods:" -msgstr ":mod:`importlib.resources` 的已棄用方法:" - -#: ../../deprecations/pending-removal-in-3.13.rst:43 -msgid "``contents()``" -msgstr "``contents()``" - -#: ../../deprecations/pending-removal-in-3.13.rst:44 -msgid "``is_resource()``" -msgstr "``is_resource()``" - -#: ../../deprecations/pending-removal-in-3.13.rst:45 -msgid "``open_binary()``" -msgstr "``open_binary()``" - -#: ../../deprecations/pending-removal-in-3.13.rst:46 -msgid "``open_text()``" -msgstr "``open_text()``" - -#: ../../deprecations/pending-removal-in-3.13.rst:47 -msgid "``path()``" -msgstr "``path()``" - -#: ../../deprecations/pending-removal-in-3.13.rst:48 -msgid "``read_binary()``" -msgstr "``read_binary()``" - -#: ../../deprecations/pending-removal-in-3.13.rst:49 -msgid "``read_text()``" -msgstr "``read_text()``" - -#: ../../deprecations/pending-removal-in-3.13.rst:51 -msgid "" -"Use :func:`importlib.resources.files` instead. Refer to `importlib-" -"resources: Migrating from Legacy `_ (:gh:`106531`)" -msgstr "" -"請改用 :func:`importlib.resources.files`。請參閱 `importlib-resources: " -"Migrating from Legacy `_ (:gh:`106531`)" - #: ../../deprecations/c-api-pending-removal-in-3.14.rst:2 #: ../../deprecations/pending-removal-in-3.14.rst:2 msgid "Pending Removal in Python 3.14" @@ -305,46 +130,38 @@ msgstr "" "Alan Williams 於 :gh:`72346` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:50 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " -"系統考慮。 (:gh:`97879`)" - -#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:55 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:62 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:64 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -355,7 +172,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:72 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -372,7 +189,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:80 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -380,7 +197,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -390,27 +207,27 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:92 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:94 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -420,7 +237,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -428,7 +245,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:105 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -440,7 +257,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -448,7 +265,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:115 +#: ../../deprecations/pending-removal-in-3.14.rst:112 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -463,143 +280,227 @@ msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" #: ../../deprecations/pending-removal-in-3.15.rst:4 +msgid ":mod:`ctypes`:" +msgstr ":mod:`ctypes`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -":class:`http.server.CGIHTTPRequestHandler` will be removed along with its " -"related ``--cgi`` flag to ``python -m http.server``. It was obsolete and " -"rarely used. No direct replacement exists. *Anything* is better than CGI " -"to interface a web server with a request handler." +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." msgstr "" -":class:`http.server.CGIHTTPRequestHandler` 將會被移除,連同其相關的 ``--" -"cgi`` 旗標到 ``python -m http.server``。它已經過時且很少被使用。沒有直接的替" -"代方案。*任何東西*\\ 都比 CGI 更好的來介接一個帶有請求處理器的網頁伺服器。" +"自 Python 3.13 起,未記錄的 :func:`!ctypes.SetPointerType` 函式已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:9 +msgid ":mod:`http.server`:" +msgstr ":mod:`http.server`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -":class:`locale`: :func:`locale.getdefaultlocale` was deprecated in Python " -"3.11 and originally planned for removal in Python 3.13 (:gh:`90817`), but " -"removal has been postponed to Python 3.15. Use :func:`locale.setlocale`, :" -"func:`locale.getencoding` and :func:`locale.getlocale` instead. (Contributed " -"by Hugo van Kemenade in :gh:`111187`.)" +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." msgstr "" -":class:`locale`::func:`locale.getdefaultlocale` 已在 Python 3.11 中被棄用," -"原本計劃在 Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :" -"func:`locale.setlocale`、:func:`locale.getencoding` 和 :func:`locale." -"getlocale`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" +"過時且很少使用的 :class:`~http.server.CGIHTTPRequestHandler` 自 Python 3.13 " +"起已被棄用。不存在直接的替代。*任何東西*\\ 都比 CGI 更好地將 Web 伺服器與請求" +"處理程序介接起來。" -#: ../../deprecations/pending-removal-in-3.15.rst:16 +#: ../../deprecations/pending-removal-in-3.15.rst:17 msgid "" -":mod:`pathlib`: :meth:`pathlib.PurePath.is_reserved` is deprecated and " -"scheduled for removal in Python 3.15. From Python 3.13 onwards, use ``os." -"path.isreserved`` to detect reserved paths on Windows." +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." msgstr "" -":mod:`pathlib`::meth:`pathlib.PurePath.is_reserved` 已被棄用並計劃在 Python " -"3.15 中移除。從 Python 3.13 開始,請用 ``os.path.isreserved`` 來偵測 Windows " -"上的保留路徑。" +"自 Python 3.13 起,:program:`python -m http.server` 命令列介面的 :option:`!--" +"cgi` 旗標已被棄用。" -#: ../../deprecations/pending-removal-in-3.15.rst:21 +#: ../../deprecations/pending-removal-in-3.15.rst:20 msgid "" -":mod:`platform`: :func:`~platform.java_ver` is deprecated and will be " -"removed in 3.15. It was largely untested, had a confusing API, and was only " -"useful for Jython support. (Contributed by Nikita Sobolev in :gh:`116349`.)" +":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " +"taken into consideration by the import system (:gh:`97879`)." msgstr "" -":mod:`platform`::func:`~platform.java_ver` 已被棄用並將在 3.15 中移除。它幾" -"乎沒有被測試過,API 令人困惑並且只對 Jython 支援有用。 (由 Nikita Sobolev " -"於 :gh:`116349` 貢獻。)" +":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " +"系統考慮。 (:gh:`97879`)" -#: ../../deprecations/pending-removal-in-3.15.rst:27 +#: ../../deprecations/pending-removal-in-3.15.rst:23 +msgid ":class:`locale`:" +msgstr ":class:`locale`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:25 msgid "" -":mod:`threading`: Passing any arguments to :func:`threading.RLock` is now " -"deprecated. C version allows any numbers of args and kwargs, but they are " -"just ignored. Python version does not allow any arguments. All arguments " -"will be removed from :func:`threading.RLock` in Python 3.15. (Contributed by " -"Nikita Sobolev in :gh:`102029`.)" +"The :func:`~locale.getdefaultlocale` function has been deprecated since " +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" -":mod:`threading`:對 :func:`threading.RLock` 傳遞任何引數現在已被棄用。C 版本" -"允許任意數量的引數和關鍵字引數,但它們會被忽略。Python 版本不允許任何引數。所" -"有引數將在 Python 3.15 中從 :func:`threading.RLock` 中移除。 (由 Nikita " -"Sobolev 於 :gh:`102029` 貢獻。)" +":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:34 -msgid ":class:`typing.NamedTuple`:" -msgstr ":class:`typing.NamedTuple`:" +#: ../../deprecations/pending-removal-in-3.15.rst:33 +msgid ":mod:`pathlib`:" +msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:36 +#: ../../deprecations/pending-removal-in-3.15.rst:35 msgid "" -"The undocumented keyword argument syntax for creating :class:`!NamedTuple` " -"classes (``NT = NamedTuple(\"NT\", x=int)``) is deprecated, and will be " -"disallowed in 3.15. Use the class-based syntax or the functional syntax " -"instead." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -"用於建立 :class:`!NamedTuple` 類別的未以文件記錄之關鍵字引數語法 (``NT = " -"NamedTuple(\"NT\", x=int)``) 已棄用,並將在 3.15 中被禁止。請改用基於類別的語" -"法或函式語法 (functional syntax)。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:40 +#: ../../deprecations/pending-removal-in-3.15.rst:39 +msgid ":mod:`platform`:" +msgstr ":mod:`platform`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:41 msgid "" -"When using the functional syntax to create a :class:`!NamedTuple` class, " -"failing to pass a value to the *fields* parameter (``NT = " -"NamedTuple(\"NT\")``) is deprecated. Passing ``None`` to the *fields* " -"parameter (``NT = NamedTuple(\"NT\", None)``) is also deprecated. Both will " -"be disallowed in Python 3.15. To create a :class:`!NamedTuple` class with 0 " -"fields, use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", " -"[])``." +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." msgstr "" -"當使用函式語法來建立 :class:`!NamedTuple` 類別時,沒將值傳遞給 *fields* 參數" -"的方式 (``NT = NamedTuple(\"NT\")``) 已被棄用,將 ``None`` 傳遞給 *fields* 參" -"數(``NT = NamedTuple(\"NT\", None)``)也已被棄用。這兩者將在 Python 3.15 中" -"會被禁止。要建立一個沒有欄位的 :class:`!NamedTuple` 類別,請使用 ``class " -"NT(NamedTuple): pass`` 或 ``NT = NamedTuple(\"NT\", [])``。" +"自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" +"援有用,具有令人困惑的 API,基本上未經測試。" + +#: ../../deprecations/pending-removal-in-3.15.rst:45 +msgid ":mod:`threading`:" +msgstr ":mod:`threading`:" #: ../../deprecations/pending-removal-in-3.15.rst:47 msgid "" -":class:`typing.TypedDict`: When using the functional syntax to create a :" -"class:`!TypedDict` class, failing to pass a value to the *fields* parameter " -"(``TD = TypedDict(\"TD\")``) is deprecated. Passing ``None`` to the *fields* " -"parameter (``TD = TypedDict(\"TD\", None)``) is also deprecated. Both will " -"be disallowed in Python 3.15. To create a :class:`!TypedDict` class with 0 " -"fields, use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." +msgstr "" +":func:`~threading.RLock` 在 Python 3.15 中將不接受任何引數。自 Python 3.14 " +"起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" +"任意數量的位置或關鍵字引數,並忽略每個引數。" + +#: ../../deprecations/pending-removal-in-3.15.rst:53 +msgid ":mod:`typing`:" +msgstr ":mod:`typing`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:55 +msgid "" +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." msgstr "" -":class:`typing.TypedDict`:當使用函式語法來建立 :class:`!TypedDict` 類別時," -"沒將值傳遞給 *fields* 參數的方式(``TD = TypedDict(\"TD\")``)已被棄用,將 " -"``None`` 傳遞給 *fields* 參數(``TD = TypedDict(\"TD\", None)``)也已被棄用。" -"這兩者將在 Python 3.15 中會被禁止。要建立一個沒有欄位的 :class:`!TypedDict` " -"類別,請使用 ``class TD(TypedDict): pass`` 或 ``TD = TypedDict(\"TD\", " -"{})``。" +"用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " +"(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" +"用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../deprecations/pending-removal-in-3.15.rst:61 msgid "" -":mod:`wave`: Deprecate the ``getmark()``, ``setmark()`` and ``getmarkers()`` " -"methods of the :class:`wave.Wave_read` and :class:`wave.Wave_write` classes. " -"They will be removed in Python 3.15. (Contributed by Victor Stinner in :gh:" -"`105096`.)" +"The :func:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." msgstr "" -":mod:`wave`:已棄用 :class:`wave.Wave_read` 和 :class:`wave.Wave_write` 類別" -"的 ``getmark()``、``setmark()`` 和 ``getmarkers()`` 方法。它們將在 Python " -"3.15 中被移除。 (由 Victor Stinner 於 :gh:`105096` 貢獻。)" +"自 Python 3.13 起,:func:`typing.no_type_check_decorator` 裝飾器函式已被棄" +"用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" +"援。" + +#: ../../deprecations/pending-removal-in-3.15.rst:66 +msgid ":mod:`wave`:" +msgstr ":mod:`wave`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:68 +msgid "" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." +msgstr "" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending Removal in Python 3.16" msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:4 +#: ../../deprecations/pending-removal-in-future.rst:12 +msgid ":mod:`builtins`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" + +#: ../../deprecations/pending-removal-in-3.16.rst:13 +msgid ":mod:`array`:" +msgstr ":mod:`array`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:15 msgid "" -":mod:`array`: :class:`array.array` ``'u'`` type (:c:type:`wchar_t`): use the " -"``'w'`` type instead (``Py_UCS4``)." +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." msgstr "" -":mod:`array`::class:`array.array` ``'u'`` 型別 (:c:type:`wchar_t`):請改用 " -"``'w'`` 型別 (``Py_UCS4``)。" +"自 Python 3.3 起,``'u'`` 格式碼 (:c:type:`wchar_t`) 在文件中已被棄用,自 " +"Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " +"來取代 Unicode 字元。" -#: ../../deprecations/pending-removal-in-3.16.rst:8 -msgid ":mod:`builtins`: ``~bool``, bitwise inversion on bool." -msgstr ":mod:`builtins`:``~bool``,對 bool 進行位元反轉。" +#: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid ":mod:`shutil`:" +msgstr ":mod:`shutil`:" -#: ../../deprecations/pending-removal-in-3.16.rst:11 +#: ../../deprecations/pending-removal-in-3.16.rst:23 msgid "" -":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " -"lack of interest. (Contributed by Bénédikt Tran in :gh:`119698`.)" +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." msgstr "" -":mod:`symtable`:由於並沒有太多關注,已棄用 :meth:`symtable.Class." -"get_methods`。 (由 Bénédikt Tran 於 :gh:`119698` 貢獻。)" +"自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" +"未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" + +#: ../../deprecations/pending-removal-in-3.16.rst:28 +msgid ":mod:`symtable`:" +msgstr ":mod:`symtable`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:30 +msgid "" +"The :meth:`Class.get_methods ` method has been " +"deprecated since Python 3.14." +msgstr "" +"自 Python 3.14 起,:meth:`Class.get_methods ` 方" +"法已被棄用。" + +#: ../../deprecations/pending-removal-in-3.16.rst:33 +msgid ":mod:`sys`:" +msgstr ":mod:`sys`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:35 +msgid "" +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." +msgstr "" +"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" +"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" + +#: ../../deprecations/pending-removal-in-3.16.rst:39 +msgid ":mod:`tarfile`:" +msgstr ":mod:`tarfile`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:41 +msgid "" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." +msgstr "" +"自 Python 3.13 起,未以文件記錄和未被使用的 :attr:`!TarFile.tarfile` 屬性已被" +"棄用。" #: ../../deprecations/c-api-pending-removal-in-future.rst:2 #: ../../deprecations/pending-removal-in-future.rst:2 @@ -622,10 +523,6 @@ msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" -#: ../../deprecations/pending-removal-in-future.rst:12 -msgid ":mod:`builtins`:" -msgstr ":mod:`builtins`:" - #: ../../deprecations/pending-removal-in-future.rst:14 msgid "``bool(NotImplemented)``." msgstr "``bool(NotImplemented)``。" @@ -769,17 +666,23 @@ msgstr "回傳值上的隱式 ``None``。" #: ../../deprecations/pending-removal-in-future.rst:69 msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:72 +msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:75 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:74 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -787,7 +690,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:80 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -799,12 +702,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:84 +#: ../../deprecations/pending-removal-in-future.rst:87 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:86 +#: ../../deprecations/pending-removal-in-future.rst:89 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -812,15 +715,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:91 +#: ../../deprecations/pending-removal-in-future.rst:94 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:95 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -828,58 +731,58 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" "`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:96 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:97 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid "" ":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " "ignored." msgstr "" ":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" -#: ../../deprecations/pending-removal-in-future.rst:109 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:111 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." @@ -887,11 +790,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." "notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:113 +#: ../../deprecations/pending-removal-in-future.rst:116 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." @@ -899,7 +802,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:118 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." @@ -907,20 +810,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" "attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:117 +#: ../../deprecations/pending-removal-in-future.rst:120 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:121 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:123 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:122 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -928,58 +831,58 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:127 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:129 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:135 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "" ":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" "`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " @@ -989,13 +892,13 @@ msgstr "" "class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" "`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:143 +#: ../../deprecations/pending-removal-in-future.rst:146 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:149 msgid "" ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." "etree.ElementTree.Element` is deprecated. In a future release it will always " @@ -1006,7 +909,7 @@ msgstr "" "Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " "``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:151 +#: ../../deprecations/pending-removal-in-future.rst:154 msgid "" ":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" "`~zipimport.zipimporter.exec_module` instead." @@ -1014,7 +917,7 @@ msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" -#: ../../deprecations/index.rst:15 +#: ../../deprecations/index.rst:13 msgid "C API Deprecations" msgstr "C API 的棄用項目" @@ -1040,164 +943,167 @@ msgid "" msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:12 -msgid "``PySys_SetArgvEx()``: set :c:member:`PyConfig.argv` instead." -msgstr "``PySys_SetArgvEx()``:請改以 :c:member:`PyConfig.argv` 設定。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:13 -msgid "``PySys_SetArgv()``: set :c:member:`PyConfig.argv` instead." -msgstr "``PySys_SetArgv()``:請改以 :c:member:`PyConfig.argv` 設定。" +msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:14 -msgid "``Py_SetProgramName()``: set :c:member:`PyConfig.program_name` instead." +msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:16 +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." msgstr "" -"``Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設定。" +":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設" +"定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:15 -msgid "``Py_SetPythonHome()``: set :c:member:`PyConfig.home` instead." -msgstr "``Py_SetPythonHome()``:請改以 :c:member:`PyConfig.home` 設定。" +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:18 +msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:17 -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:45 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" "`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:20 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 msgid "Global configuration variables:" msgstr "全域設定變數:" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:22 -msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 +msgid ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` instead." msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:23 -msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 +msgid ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` instead." msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 -msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +msgid ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` instead." msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:25 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 msgid "" -":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive` instead." +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` instead." msgstr ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 -msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +msgid ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` instead." msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:27 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:36 msgid "" -":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level` " +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " "instead." msgstr "" ":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 -msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +msgid ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` instead." msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:29 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 msgid "" -":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning` instead." +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` instead." msgstr "" ":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 msgid "" -":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings` instead." +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` instead." msgstr "" ":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:31 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:44 msgid "" -":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment` " +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" ":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." "use_environment`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" -":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode` " +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." "write_bytecode`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:33 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." "user_site_directory` instead." msgstr "" ":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." "user_site_directory`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" -":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio` " +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " "instead." msgstr "" ":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:35 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:52 msgid "" -":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed` instead." msgstr "" ":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " "和 :c:member:`PyConfig.hash_seed`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:37 -msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:55 +msgid ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` instead." msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." "legacy_windows_fs_encoding` instead." msgstr "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." "legacy_windows_fs_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:39 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." "legacy_windows_stdio` instead." msgstr "" ":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." "legacy_windows_stdio`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." +":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." "filesystem_encoding` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." "filesystem_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:41 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." +":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." "filesystem_encoding` instead." msgstr "" ":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." "filesystem_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." "filesystem_errors` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." "filesystem_errors`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:43 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` instead. (see :" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" "c:func:`Py_PreInitialize`)" msgstr "" ":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" @@ -1209,64 +1115,63 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -":c:func:`PyImport_ImportModuleNoBlock`: use :c:func:`PyImport_ImportModule` " -"instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" ":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" "`PyImport_ImportModule`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 -msgid "" -":c:func:`PyWeakref_GET_OBJECT`: use :c:func:`!PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GET_OBJECT`:請改用 :c:func:`!PyWeakref_GetRef`。" - #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 -msgid ":c:func:`PyWeakref_GetObject`: use :c:func:`!PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`!PyWeakref_GetRef`。" - -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:8 -msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." -msgstr ":c:type:`!Py_UNICODE_WIDE` type:請改用 :c:type:`wchar_t`。" +msgid "" +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead." +msgstr "" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 -msgid ":c:type:`Py_UNICODE` type: use :c:type:`wchar_t` instead." -msgstr ":c:type:`Py_UNICODE` type:請改用 :c:type:`wchar_t`。" +msgid "" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." +msgstr "" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" msgstr "Python 初始化函式:" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" -":c:func:`PySys_ResetWarnOptions`: clear :data:`sys.warnoptions` and :data:`!" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" ":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" "data:`!warnings.filters`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 -msgid ":c:func:`Py_GetExecPrefix`: get :data:`sys.exec_prefix` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 +msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 -msgid ":c:func:`Py_GetPath`: get :data:`sys.path` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:16 -msgid ":c:func:`Py_GetPrefix`: get :data:`sys.prefix` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 -msgid ":c:func:`Py_GetProgramFullPath`: get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 +msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:18 -msgid ":c:func:`Py_GetProgramName`: get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 +msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: get :c:member:`PyConfig.home` or the :envvar:" +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" "`PYTHONHOME` environment variable instead." msgstr "" ":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" @@ -1279,84 +1184,85 @@ msgid "" msgstr "下列 API 已被棄用並將會被移除,不過目前尚未訂定移除日期。" #: ../../deprecations/c-api-pending-removal-in-future.rst:7 -msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: unneeded since Python 3.8." +msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." msgstr ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`:自 Python 3.8 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-future.rst:8 -msgid ":c:func:`PyErr_Fetch`: use :c:func:`PyErr_GetRaisedException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." msgstr ":c:func:`PyErr_Fetch`:請改用 :c:func:`PyErr_GetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +#: ../../deprecations/c-api-pending-removal-in-future.rst:11 msgid "" -":c:func:`PyErr_NormalizeException`: use :c:func:`PyErr_GetRaisedException` " +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" ":c:func:`PyErr_NormalizeException`:請改用 :c:func:" "`PyErr_GetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:10 +#: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" -":c:func:`PyErr_Restore`: use :c:func:`PyErr_SetRaisedException` instead." +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." msgstr ":c:func:`PyErr_Restore`:請改用 :c:func:`PyErr_SetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:11 +#: ../../deprecations/c-api-pending-removal-in-future.rst:15 msgid "" -":c:func:`PyModule_GetFilename`: use :c:func:`PyModule_GetFilenameObject` " +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " "instead." msgstr "" ":c:func:`PyModule_GetFilename`:請改用 :c:func:`PyModule_GetFilenameObject`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:12 -msgid ":c:func:`PyOS_AfterFork`: use :c:func:`PyOS_AfterFork_Child` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:13 +#: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: use :c:func:`PySlice_Unpack` and :c:func:" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" "`PySlice_AdjustIndices` instead." msgstr "" ":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" "`PySlice_AdjustIndices`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:14 +#: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" -":c:func:`!PyUnicode_AsDecodedObject`: use :c:func:`PyCodec_Decode` instead." +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." msgstr "" ":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:15 +#: ../../deprecations/c-api-pending-removal-in-future.rst:23 msgid "" -":c:func:`!PyUnicode_AsDecodedUnicode`: use :c:func:`PyCodec_Decode` instead." +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead." msgstr "" ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:16 +#: ../../deprecations/c-api-pending-removal-in-future.rst:25 msgid "" -":c:func:`!PyUnicode_AsEncodedObject`: use :c:func:`PyCodec_Encode` instead." +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." msgstr "" ":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +#: ../../deprecations/c-api-pending-removal-in-future.rst:27 msgid "" -":c:func:`!PyUnicode_AsEncodedUnicode`: use :c:func:`PyCodec_Encode` instead." +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead." msgstr "" ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:18 -msgid ":c:func:`PyUnicode_READY`: unneeded since Python 3.12" +#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" msgstr ":c:func:`PyUnicode_READY`:自 Python 3.12 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-future.rst:19 -msgid ":c:func:`!PyErr_Display`: use :c:func:`PyErr_DisplayException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:31 +msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." msgstr ":c:func:`!PyErr_Display`:請改用 :c:func:`PyErr_DisplayException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:20 +#: ../../deprecations/c-api-pending-removal-in-future.rst:33 msgid "" -":c:func:`!_PyErr_ChainExceptions`: use ``_PyErr_ChainExceptions1`` instead." +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " +"instead." msgstr "" ":c:func:`!_PyErr_ChainExceptions`:請改用 ``_PyErr_ChainExceptions1``。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:21 +#: ../../deprecations/c-api-pending-removal-in-future.rst:35 msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." @@ -1364,40 +1270,40 @@ msgstr "" ":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" "`PyObject_Hash`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:23 +#: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:24 +#: ../../deprecations/c-api-pending-removal-in-future.rst:38 msgid "Thread Local Storage (TLS) API:" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../deprecations/c-api-pending-removal-in-future.rst:26 +#: ../../deprecations/c-api-pending-removal-in-future.rst:40 msgid "" -":c:func:`PyThread_create_key`: use :c:func:`PyThread_tss_alloc` instead." +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." msgstr ":c:func:`PyThread_create_key`:請改用 :c:func:`PyThread_tss_alloc`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:27 -msgid ":c:func:`PyThread_delete_key`: use :c:func:`PyThread_tss_free` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:42 +msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." msgstr ":c:func:`PyThread_delete_key`:請改用 :c:func:`PyThread_tss_free`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:28 +#: ../../deprecations/c-api-pending-removal-in-future.rst:44 msgid "" -":c:func:`PyThread_set_key_value`: use :c:func:`PyThread_tss_set` instead." +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." msgstr ":c:func:`PyThread_set_key_value`:請改用 :c:func:`PyThread_tss_set`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +#: ../../deprecations/c-api-pending-removal-in-future.rst:46 msgid "" -":c:func:`PyThread_get_key_value`: use :c:func:`PyThread_tss_get` instead." +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." msgstr ":c:func:`PyThread_get_key_value`:請改用 :c:func:`PyThread_tss_get`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:30 +#: ../../deprecations/c-api-pending-removal-in-future.rst:48 msgid "" -":c:func:`PyThread_delete_key_value`: use :c:func:`PyThread_tss_delete` " +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " "instead." msgstr "" ":c:func:`PyThread_delete_key_value`:請改用 :c:func:`PyThread_tss_delete`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:31 -msgid ":c:func:`PyThread_ReInitTLS`: unneeded since Python 3.7." +#: ../../deprecations/c-api-pending-removal-in-future.rst:50 +msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" diff --git a/deprecations/pending-removal-in-3.13.po b/deprecations/pending-removal-in-3.13.po index 75c25c93be..d39a172a1a 100644 --- a/deprecations/pending-removal-in-3.13.po +++ b/deprecations/pending-removal-in-3.13.po @@ -4,9 +4,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-30 18:24+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -24,80 +24,80 @@ msgid "Modules (see :pep:`594`):" msgstr "模組(請見 :pep:`594`):" #: ../../deprecations/pending-removal-in-3.13.rst:6 -msgid ":mod:`aifc`" -msgstr ":mod:`aifc`" +msgid ":mod:`!aifc`" +msgstr ":mod:`!aifc`" #: ../../deprecations/pending-removal-in-3.13.rst:7 -msgid ":mod:`audioop`" -msgstr ":mod:`audioop`" +msgid ":mod:`!audioop`" +msgstr ":mod:`!audioop`" #: ../../deprecations/pending-removal-in-3.13.rst:8 -msgid ":mod:`cgi`" -msgstr ":mod:`cgi`" +msgid ":mod:`!cgi`" +msgstr ":mod:`!cgi`" #: ../../deprecations/pending-removal-in-3.13.rst:9 -msgid ":mod:`cgitb`" -msgstr ":mod:`cgitb`" +msgid ":mod:`!cgitb`" +msgstr ":mod:`!cgitb`" #: ../../deprecations/pending-removal-in-3.13.rst:10 -msgid ":mod:`chunk`" -msgstr ":mod:`chunk`" +msgid ":mod:`!chunk`" +msgstr ":mod:`!chunk`" #: ../../deprecations/pending-removal-in-3.13.rst:11 -msgid ":mod:`crypt`" -msgstr ":mod:`crypt`" +msgid ":mod:`!crypt`" +msgstr ":mod:`!crypt`" #: ../../deprecations/pending-removal-in-3.13.rst:12 -msgid ":mod:`imghdr`" -msgstr ":mod:`imghdr`" +msgid ":mod:`!imghdr`" +msgstr ":mod:`!imghdr`" #: ../../deprecations/pending-removal-in-3.13.rst:13 -msgid ":mod:`mailcap`" -msgstr ":mod:`mailcap`" +msgid ":mod:`!mailcap`" +msgstr ":mod:`!mailcap`" #: ../../deprecations/pending-removal-in-3.13.rst:14 -msgid ":mod:`msilib`" -msgstr ":mod:`msilib`" +msgid ":mod:`!msilib`" +msgstr ":mod:`!msilib`" #: ../../deprecations/pending-removal-in-3.13.rst:15 -msgid ":mod:`nis`" -msgstr ":mod:`nis`" +msgid ":mod:`!nis`" +msgstr ":mod:`!nis`" #: ../../deprecations/pending-removal-in-3.13.rst:16 -msgid ":mod:`nntplib`" -msgstr ":mod:`nntplib`" +msgid ":mod:`!nntplib`" +msgstr ":mod:`!nntplib`" #: ../../deprecations/pending-removal-in-3.13.rst:17 -msgid ":mod:`ossaudiodev`" -msgstr ":mod:`ossaudiodev`" +msgid ":mod:`!ossaudiodev`" +msgstr ":mod:`!ossaudiodev`" #: ../../deprecations/pending-removal-in-3.13.rst:18 -msgid ":mod:`pipes`" -msgstr ":mod:`pipes`" +msgid ":mod:`!pipes`" +msgstr ":mod:`!pipes`" #: ../../deprecations/pending-removal-in-3.13.rst:19 -msgid ":mod:`sndhdr`" -msgstr ":mod:`sndhdr`" +msgid ":mod:`!sndhdr`" +msgstr ":mod:`!sndhdr`" #: ../../deprecations/pending-removal-in-3.13.rst:20 -msgid ":mod:`spwd`" -msgstr ":mod:`spwd`" +msgid ":mod:`!spwd`" +msgstr ":mod:`!spwd`" #: ../../deprecations/pending-removal-in-3.13.rst:21 -msgid ":mod:`sunau`" -msgstr ":mod:`sunau`" +msgid ":mod:`!sunau`" +msgstr ":mod:`!sunau`" #: ../../deprecations/pending-removal-in-3.13.rst:22 -msgid ":mod:`telnetlib`" -msgstr ":mod:`telnetlib`" +msgid ":mod:`!telnetlib`" +msgstr ":mod:`!telnetlib`" #: ../../deprecations/pending-removal-in-3.13.rst:23 -msgid ":mod:`uu`" -msgstr ":mod:`uu`" +msgid ":mod:`!uu`" +msgstr ":mod:`!uu`" #: ../../deprecations/pending-removal-in-3.13.rst:24 -msgid ":mod:`xdrlib`" -msgstr ":mod:`xdrlib`" +msgid ":mod:`!xdrlib`" +msgstr ":mod:`!xdrlib`" #: ../../deprecations/pending-removal-in-3.13.rst:26 msgid "Other modules:" diff --git a/deprecations/pending-removal-in-3.14.po b/deprecations/pending-removal-in-3.14.po index 85e1f5f2be..615e97ede1 100644 --- a/deprecations/pending-removal-in-3.14.po +++ b/deprecations/pending-removal-in-3.14.po @@ -5,9 +5,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-17 00:03+0000\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -126,46 +126,38 @@ msgstr "" "Alan Williams 於 :gh:`72346` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:50 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " -"系統考慮。 (:gh:`97879`)" - -#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:55 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../deprecations/pending-removal-in-3.14.rst:56 msgid "Use :mod:`importlib.resources.abc` classes instead:" msgstr "請改用 :mod:`importlib.resources.abc` 類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../deprecations/pending-removal-in-3.14.rst:62 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../deprecations/pending-removal-in-3.14.rst:64 +#: ../../deprecations/pending-removal-in-3.14.rst:61 msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -176,7 +168,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:72 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -193,7 +185,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:80 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -201,7 +193,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -211,27 +203,27 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:92 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:94 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders ` are used and *parameters* is " @@ -241,7 +233,7 @@ msgstr "" "使用 :ref:`named placeholders ` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -249,7 +241,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:105 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -261,7 +253,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -269,7 +261,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:115 +#: ../../deprecations/pending-removal-in-3.14.rst:112 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" diff --git a/deprecations/pending-removal-in-3.15.po b/deprecations/pending-removal-in-3.15.po index de1de43e01..d160dbfc7a 100644 --- a/deprecations/pending-removal-in-3.15.po +++ b/deprecations/pending-removal-in-3.15.po @@ -5,9 +5,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-30 18:24+0000\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,116 +21,138 @@ msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" #: ../../deprecations/pending-removal-in-3.15.rst:4 +msgid ":mod:`ctypes`:" +msgstr ":mod:`ctypes`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -":class:`http.server.CGIHTTPRequestHandler` will be removed along with its " -"related ``--cgi`` flag to ``python -m http.server``. It was obsolete and " -"rarely used. No direct replacement exists. *Anything* is better than CGI " -"to interface a web server with a request handler." +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." msgstr "" -":class:`http.server.CGIHTTPRequestHandler` 將會被移除,連同其相關的 ``--" -"cgi`` 旗標到 ``python -m http.server``。它已經過時且很少被使用。沒有直接的替" -"代方案。*任何東西*\\ 都比 CGI 更好的來介接一個帶有請求處理器的網頁伺服器。" +"自 Python 3.13 起,未記錄的 :func:`!ctypes.SetPointerType` 函式已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:9 +msgid ":mod:`http.server`:" +msgstr ":mod:`http.server`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -":class:`locale`: :func:`locale.getdefaultlocale` was deprecated in Python " -"3.11 and originally planned for removal in Python 3.13 (:gh:`90817`), but " -"removal has been postponed to Python 3.15. Use :func:`locale.setlocale`, :" -"func:`locale.getencoding` and :func:`locale.getlocale` instead. (Contributed " -"by Hugo van Kemenade in :gh:`111187`.)" +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." msgstr "" -":class:`locale`::func:`locale.getdefaultlocale` 已在 Python 3.11 中被棄用," -"原本計劃在 Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :" -"func:`locale.setlocale`、:func:`locale.getencoding` 和 :func:`locale." -"getlocale`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" +"過時且很少使用的 :class:`~http.server.CGIHTTPRequestHandler` 自 Python 3.13 " +"起已被棄用。不存在直接的替代。*任何東西*\\ 都比 CGI 更好地將 Web 伺服器與請求" +"處理程序介接起來。" -#: ../../deprecations/pending-removal-in-3.15.rst:16 +#: ../../deprecations/pending-removal-in-3.15.rst:17 msgid "" -":mod:`pathlib`: :meth:`pathlib.PurePath.is_reserved` is deprecated and " -"scheduled for removal in Python 3.15. From Python 3.13 onwards, use ``os." -"path.isreserved`` to detect reserved paths on Windows." +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." msgstr "" -":mod:`pathlib`::meth:`pathlib.PurePath.is_reserved` 已被棄用並計劃在 Python " -"3.15 中移除。從 Python 3.13 開始,請用 ``os.path.isreserved`` 來偵測 Windows " -"上的保留路徑。" +"自 Python 3.13 起,:program:`python -m http.server` 命令列介面的 :option:`!--" +"cgi` 旗標已被棄用。" -#: ../../deprecations/pending-removal-in-3.15.rst:21 +#: ../../deprecations/pending-removal-in-3.15.rst:20 msgid "" -":mod:`platform`: :func:`~platform.java_ver` is deprecated and will be " -"removed in 3.15. It was largely untested, had a confusing API, and was only " -"useful for Jython support. (Contributed by Nikita Sobolev in :gh:`116349`.)" +":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " +"taken into consideration by the import system (:gh:`97879`)." msgstr "" -":mod:`platform`::func:`~platform.java_ver` 已被棄用並將在 3.15 中移除。它幾" -"乎沒有被測試過,API 令人困惑並且只對 Jython 支援有用。 (由 Nikita Sobolev " -"於 :gh:`116349` 貢獻。)" +":mod:`importlib`:引入系統將不再設定或考慮 ``__package__`` 和 ``__cached__`` " +"(:gh:`97879`)。" -#: ../../deprecations/pending-removal-in-3.15.rst:27 +#: ../../deprecations/pending-removal-in-3.15.rst:23 +msgid ":class:`locale`:" +msgstr ":class:`locale`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:25 msgid "" -":mod:`threading`: Passing any arguments to :func:`threading.RLock` is now " -"deprecated. C version allows any numbers of args and kwargs, but they are " -"just ignored. Python version does not allow any arguments. All arguments " -"will be removed from :func:`threading.RLock` in Python 3.15. (Contributed by " -"Nikita Sobolev in :gh:`102029`.)" +"The :func:`~locale.getdefaultlocale` function has been deprecated since " +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" -":mod:`threading`:對 :func:`threading.RLock` 傳遞任何引數現在已被棄用。C 版本" -"允許任意數量的引數和關鍵字引數,但它們會被忽略。Python 版本不允許任何引數。所" -"有引數將在 Python 3.15 中從 :func:`threading.RLock` 中移除。 (由 Nikita " -"Sobolev 於 :gh:`102029` 貢獻。)" +":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:34 -msgid ":class:`typing.NamedTuple`:" -msgstr ":class:`typing.NamedTuple`:" +#: ../../deprecations/pending-removal-in-3.15.rst:33 +msgid ":mod:`pathlib`:" +msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:36 +#: ../../deprecations/pending-removal-in-3.15.rst:35 msgid "" -"The undocumented keyword argument syntax for creating :class:`!NamedTuple` " -"classes (``NT = NamedTuple(\"NT\", x=int)``) is deprecated, and will be " -"disallowed in 3.15. Use the class-based syntax or the functional syntax " -"instead." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -"用於建立 :class:`!NamedTuple` 類別的未以文件記錄之關鍵字引數語法 (``NT = " -"NamedTuple(\"NT\", x=int)``) 已棄用,並將在 3.15 中被禁止。請改用基於類別的語" -"法或函式語法 (functional syntax)。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" + +#: ../../deprecations/pending-removal-in-3.15.rst:39 +msgid ":mod:`platform`:" +msgstr ":mod:`platform`:" -#: ../../deprecations/pending-removal-in-3.15.rst:40 +#: ../../deprecations/pending-removal-in-3.15.rst:41 msgid "" -"When using the functional syntax to create a :class:`!NamedTuple` class, " -"failing to pass a value to the *fields* parameter (``NT = " -"NamedTuple(\"NT\")``) is deprecated. Passing ``None`` to the *fields* " -"parameter (``NT = NamedTuple(\"NT\", None)``) is also deprecated. Both will " -"be disallowed in Python 3.15. To create a :class:`!NamedTuple` class with 0 " -"fields, use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", " -"[])``." +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." msgstr "" -"當使用函式語法來建立 :class:`!NamedTuple` 類別時,沒將值傳遞給 *fields* 參數" -"的方式 (``NT = NamedTuple(\"NT\")``) 已被棄用,將 ``None`` 傳遞給 *fields* 參" -"數(``NT = NamedTuple(\"NT\", None)``)也已被棄用。這兩者將在 Python 3.15 中" -"會被禁止。要建立一個沒有欄位的 :class:`!NamedTuple` 類別,請使用 ``class " -"NT(NamedTuple): pass`` 或 ``NT = NamedTuple(\"NT\", [])``。" +"自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" +"援有用,具有令人困惑的 API,基本上未經測試。" + +#: ../../deprecations/pending-removal-in-3.15.rst:45 +msgid ":mod:`threading`:" +msgstr ":mod:`threading`:" #: ../../deprecations/pending-removal-in-3.15.rst:47 msgid "" -":class:`typing.TypedDict`: When using the functional syntax to create a :" -"class:`!TypedDict` class, failing to pass a value to the *fields* parameter " -"(``TD = TypedDict(\"TD\")``) is deprecated. Passing ``None`` to the *fields* " -"parameter (``TD = TypedDict(\"TD\", None)``) is also deprecated. Both will " -"be disallowed in Python 3.15. To create a :class:`!TypedDict` class with 0 " -"fields, use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." +msgstr "" +":func:`~threading.RLock` 在 Python 3.15 中將不接受任何引數。自 Python 3.14 " +"起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" +"任意數量的位置或關鍵字引數,並忽略每個引數。" + +#: ../../deprecations/pending-removal-in-3.15.rst:53 +msgid ":mod:`typing`:" +msgstr ":mod:`typing`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:55 +msgid "" +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." msgstr "" -":class:`typing.TypedDict`:當使用函式語法來建立 :class:`!TypedDict` 類別時," -"沒將值傳遞給 *fields* 參數的方式(``TD = TypedDict(\"TD\")``)已被棄用,將 " -"``None`` 傳遞給 *fields* 參數(``TD = TypedDict(\"TD\", None)``)也已被棄用。" -"這兩者將在 Python 3.15 中會被禁止。要建立一個沒有欄位的 :class:`!TypedDict` " -"類別,請使用 ``class TD(TypedDict): pass`` 或 ``TD = TypedDict(\"TD\", " -"{})``。" - -#: ../../deprecations/pending-removal-in-3.15.rst:54 +"用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " +"(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" +"用基於類別的語法或函式語法 (functional syntax)。" + +#: ../../deprecations/pending-removal-in-3.15.rst:61 +msgid "" +"The :func:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." +msgstr "" +"自 Python 3.13 起,:func:`typing.no_type_check_decorator` 裝飾器函式已被棄" +"用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" +"援。" + +#: ../../deprecations/pending-removal-in-3.15.rst:66 +msgid ":mod:`wave`:" +msgstr ":mod:`wave`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:68 msgid "" -":mod:`wave`: Deprecate the ``getmark()``, ``setmark()`` and ``getmarkers()`` " -"methods of the :class:`wave.Wave_read` and :class:`wave.Wave_write` classes. " -"They will be removed in Python 3.15. (Contributed by Victor Stinner in :gh:" -"`105096`.)" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." msgstr "" -":mod:`wave`:已棄用 :class:`wave.Wave_read` 和 :class:`wave.Wave_write` 類別" -"的 ``getmark()``、``setmark()`` 和 ``getmarkers()`` 方法。它們將在 Python " -"3.15 中被移除。 (由 Victor Stinner 於 :gh:`105096` 貢獻。)" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" diff --git a/deprecations/pending-removal-in-3.16.po b/deprecations/pending-removal-in-3.16.po index 3e33cc33de..80e023abb0 100644 --- a/deprecations/pending-removal-in-3.16.po +++ b/deprecations/pending-removal-in-3.16.po @@ -4,9 +4,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-26 00:03+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -20,21 +20,82 @@ msgid "Pending Removal in Python 3.16" msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:4 +msgid ":mod:`builtins`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" + +#: ../../deprecations/pending-removal-in-3.16.rst:13 +msgid ":mod:`array`:" +msgstr ":mod:`array`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:15 +msgid "" +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." +msgstr "" +"自 Python 3.3 起,``'u'`` 格式碼 (:c:type:`wchar_t`) 在文件中已被棄用,自 " +"Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " +"來取代 Unicode 字元。" + +#: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid ":mod:`shutil`:" +msgstr ":mod:`shutil`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:23 +msgid "" +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." +msgstr "" +"自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" +"未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" + +#: ../../deprecations/pending-removal-in-3.16.rst:28 +msgid ":mod:`symtable`:" +msgstr ":mod:`symtable`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:30 +msgid "" +"The :meth:`Class.get_methods ` method has been " +"deprecated since Python 3.14." +msgstr "" +"自 Python 3.14 起,:meth:`Class.get_methods ` 方" +"法已被棄用。" + +#: ../../deprecations/pending-removal-in-3.16.rst:33 +msgid ":mod:`sys`:" +msgstr ":mod:`sys`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:35 msgid "" -":mod:`array`: :class:`array.array` ``'u'`` type (:c:type:`wchar_t`): use the " -"``'w'`` type instead (``Py_UCS4``)." +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." msgstr "" -":mod:`array`::class:`array.array` ``'u'`` 型別 (:c:type:`wchar_t`):請改用 " -"``'w'`` 型別 (``Py_UCS4``)。" +"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" +"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" -#: ../../deprecations/pending-removal-in-3.16.rst:8 -msgid ":mod:`builtins`: ``~bool``, bitwise inversion on bool." -msgstr ":mod:`builtins`:``~bool``,對 bool 進行位元反轉。" +#: ../../deprecations/pending-removal-in-3.16.rst:39 +msgid ":mod:`tarfile`:" +msgstr ":mod:`tarfile`:" -#: ../../deprecations/pending-removal-in-3.16.rst:11 +#: ../../deprecations/pending-removal-in-3.16.rst:41 msgid "" -":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " -"lack of interest. (Contributed by Bénédikt Tran in :gh:`119698`.)" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." msgstr "" -":mod:`symtable`:由於並沒有太多關注,已棄用 :meth:`symtable.Class." -"get_methods`。 (由 Bénédikt Tran 於 :gh:`119698` 貢獻。)" +"自 Python 3.13 起,未以文件記錄和未被使用的 :attr:`!TarFile.tarfile` 屬性已被" +"棄用。" diff --git a/deprecations/pending-removal-in-future.po b/deprecations/pending-removal-in-future.po index fa52b56e5c..c46ed6f7d3 100644 --- a/deprecations/pending-removal-in-future.po +++ b/deprecations/pending-removal-in-future.po @@ -4,9 +4,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-26 18:24+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -182,17 +182,23 @@ msgstr "回傳值上的隱式 ``None``。" #: ../../deprecations/pending-removal-in-future.rst:69 msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:72 +msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:75 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:74 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -200,7 +206,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:80 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -212,12 +218,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:84 +#: ../../deprecations/pending-removal-in-future.rst:87 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:86 +#: ../../deprecations/pending-removal-in-future.rst:89 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -225,15 +231,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:91 +#: ../../deprecations/pending-removal-in-future.rst:94 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:95 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -241,58 +247,58 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" "`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:96 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:97 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid "" ":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " "ignored." msgstr "" ":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" -#: ../../deprecations/pending-removal-in-future.rst:109 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:111 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." @@ -300,11 +306,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." "notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:113 +#: ../../deprecations/pending-removal-in-future.rst:116 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." @@ -312,7 +318,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:118 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." @@ -320,20 +326,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" "attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:117 +#: ../../deprecations/pending-removal-in-future.rst:120 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:121 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:123 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:122 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -341,58 +347,58 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:127 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:129 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:135 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "" ":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" "`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " @@ -402,13 +408,13 @@ msgstr "" "class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" "`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:143 +#: ../../deprecations/pending-removal-in-future.rst:146 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:149 msgid "" ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." "etree.ElementTree.Element` is deprecated. In a future release it will always " @@ -419,7 +425,7 @@ msgstr "" "Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " "``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:151 +#: ../../deprecations/pending-removal-in-future.rst:154 msgid "" ":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" "`~zipimport.zipimporter.exec_module` instead." diff --git a/distributing/index.po b/distributing/index.po index c21b18ddd6..6ef90c29d0 100644 --- a/distributing/index.po +++ b/distributing/index.po @@ -7,7 +7,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-08-18 00:03+0000\n" "PO-Revision-Date: 2021-07-04 18:06+0800\n" diff --git a/extending/building.po b/extending/building.po index 8a2a5ced44..1e0c34fe84 100644 --- a/extending/building.po +++ b/extending/building.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 14:09+0000\n" diff --git a/extending/embedding.po b/extending/embedding.po index d49f76b779..ac486c5aef 100644 --- a/extending/embedding.po +++ b/extending/embedding.po @@ -6,9 +6,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -95,43 +95,64 @@ msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" -" wchar_t *program = Py_DecodeLocale(argv[0], NULL);\n" -" if (program == NULL) {\n" -" fprintf(stderr, \"Fatal error: cannot decode argv[0]\\n\");\n" -" exit(1);\n" +" PyStatus status;\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" +"\n" +" /* optional but recommended */\n" +" status = PyConfig_SetBytesString(&config, &config.program_name, " +"argv[0]);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" " }\n" -" Py_SetProgramName(program); /* optional but recommended */\n" -" Py_Initialize();\n" +"\n" +" status = Py_InitializeFromConfig(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +" PyConfig_Clear(&config);\n" +"\n" " PyRun_SimpleString(\"from time import time,ctime\\n\"\n" " \"print('Today is', ctime(time()))\\n\");\n" " if (Py_FinalizeEx() < 0) {\n" " exit(120);\n" " }\n" -" PyMem_RawFree(program);\n" " return 0;\n" +"\n" +" exception:\n" +" PyConfig_Clear(&config);\n" +" Py_ExitStatusException(status);\n" "}" msgstr "" -#: ../../extending/embedding.rst:78 +#: ../../extending/embedding.rst:92 msgid "" -"The :c:func:`Py_SetProgramName` function should be called before :c:func:" -"`Py_Initialize` to inform the interpreter about paths to Python run-time " -"libraries. Next, the Python interpreter is initialized with :c:func:" -"`Py_Initialize`, followed by the execution of a hard-coded Python script " -"that prints the date and time. Afterwards, the :c:func:`Py_FinalizeEx` call " -"shuts the interpreter down, followed by the end of the program. In a real " -"program, you may want to get the Python script from another source, perhaps " -"a text-editor routine, a file, or a database. Getting the Python code from " -"a file can better be done by using the :c:func:`PyRun_SimpleFile` function, " -"which saves you the trouble of allocating memory space and loading the file " -"contents." +"``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should " +"be used in some APIs instead of ``int``. It is not necessary since Python " +"3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-" +"string-and-buffers` for a description of this macro." msgstr "" -#: ../../extending/embedding.rst:93 +#: ../../extending/embedding.rst:97 +msgid "" +"Setting :c:member:`PyConfig.program_name` should be called before :c:func:" +"`Py_InitializeFromConfig` to inform the interpreter about paths to Python " +"run-time libraries. Next, the Python interpreter is initialized with :c:" +"func:`Py_Initialize`, followed by the execution of a hard-coded Python " +"script that prints the date and time. Afterwards, the :c:func:" +"`Py_FinalizeEx` call shuts the interpreter down, followed by the end of the " +"program. In a real program, you may want to get the Python script from " +"another source, perhaps a text-editor routine, a file, or a database. " +"Getting the Python code from a file can better be done by using the :c:func:" +"`PyRun_SimpleFile` function, which saves you the trouble of allocating " +"memory space and loading the file contents." +msgstr "" + +#: ../../extending/embedding.rst:112 msgid "Beyond Very High Level Embedding: An overview" msgstr "" -#: ../../extending/embedding.rst:95 +#: ../../extending/embedding.rst:114 msgid "" "The high level interface gives you the ability to execute arbitrary pieces " "of Python code from your application, but exchanging data values is quite " @@ -140,7 +161,7 @@ msgid "" "anything." msgstr "" -#: ../../extending/embedding.rst:100 +#: ../../extending/embedding.rst:119 msgid "" "It should be noted that extending Python and embedding Python is quite the " "same activity, despite the different intent. Most topics discussed in the " @@ -148,37 +169,37 @@ msgid "" "code from Python to C really does:" msgstr "" -#: ../../extending/embedding.rst:105 +#: ../../extending/embedding.rst:124 msgid "Convert data values from Python to C," msgstr "" -#: ../../extending/embedding.rst:107 +#: ../../extending/embedding.rst:126 msgid "Perform a function call to a C routine using the converted values, and" msgstr "" -#: ../../extending/embedding.rst:109 +#: ../../extending/embedding.rst:128 msgid "Convert the data values from the call from C to Python." msgstr "" -#: ../../extending/embedding.rst:111 +#: ../../extending/embedding.rst:130 msgid "When embedding Python, the interface code does:" msgstr "" -#: ../../extending/embedding.rst:113 +#: ../../extending/embedding.rst:132 msgid "Convert data values from C to Python," msgstr "" -#: ../../extending/embedding.rst:115 +#: ../../extending/embedding.rst:134 msgid "" "Perform a function call to a Python interface routine using the converted " "values, and" msgstr "" -#: ../../extending/embedding.rst:118 +#: ../../extending/embedding.rst:137 msgid "Convert the data values from the call from Python to C." msgstr "" -#: ../../extending/embedding.rst:120 +#: ../../extending/embedding.rst:139 msgid "" "As you can see, the data conversion steps are simply swapped to accommodate " "the different direction of the cross-language transfer. The only difference " @@ -186,7 +207,7 @@ msgid "" "you call a C routine, when embedding, you call a Python routine." msgstr "" -#: ../../extending/embedding.rst:125 +#: ../../extending/embedding.rst:144 msgid "" "This chapter will not discuss how to convert data from Python to C and vice " "versa. Also, proper use of references and dealing with errors is assumed to " @@ -194,11 +215,11 @@ msgid "" "interpreter, you can refer to earlier chapters for the required information." msgstr "" -#: ../../extending/embedding.rst:134 +#: ../../extending/embedding.rst:153 msgid "Pure Embedding" msgstr "" -#: ../../extending/embedding.rst:136 +#: ../../extending/embedding.rst:155 msgid "" "The first program aims to execute a function in a Python script. Like in the " "section about the very high level interface, the Python interpreter does not " @@ -206,11 +227,11 @@ msgid "" "section)." msgstr "" -#: ../../extending/embedding.rst:141 +#: ../../extending/embedding.rst:160 msgid "The code to run a function defined in a Python script is:" msgstr "" -#: ../../extending/embedding.rst:143 +#: ../../extending/embedding.rst:162 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -286,7 +307,7 @@ msgid "" "}\n" msgstr "" -#: ../../extending/embedding.rst:146 +#: ../../extending/embedding.rst:165 msgid "" "This code loads a Python script using ``argv[1]``, and calls the function " "named in ``argv[2]``. Its integer arguments are the other values of the " @@ -295,7 +316,7 @@ msgid "" "a Python script, such as:" msgstr "" -#: ../../extending/embedding.rst:152 +#: ../../extending/embedding.rst:171 msgid "" "def multiply(a,b):\n" " print(\"Will compute\", a, \"times\", b)\n" @@ -305,25 +326,25 @@ msgid "" " return c" msgstr "" -#: ../../extending/embedding.rst:161 +#: ../../extending/embedding.rst:180 msgid "then the result should be:" msgstr "" -#: ../../extending/embedding.rst:163 +#: ../../extending/embedding.rst:182 msgid "" "$ call multiply multiply 3 2\n" "Will compute 3 times 2\n" "Result of call: 6" msgstr "" -#: ../../extending/embedding.rst:169 +#: ../../extending/embedding.rst:188 msgid "" "Although the program is quite large for its functionality, most of the code " "is for data conversion between Python and C, and for error reporting. The " "interesting part with respect to embedding Python starts with ::" msgstr "" -#: ../../extending/embedding.rst:173 +#: ../../extending/embedding.rst:192 msgid "" "Py_Initialize();\n" "pName = PyUnicode_DecodeFSDefault(argv[1]);\n" @@ -331,7 +352,7 @@ msgid "" "pModule = PyImport_Import(pName);" msgstr "" -#: ../../extending/embedding.rst:178 +#: ../../extending/embedding.rst:197 msgid "" "After initializing the interpreter, the script is loaded using :c:func:" "`PyImport_Import`. This routine needs a Python string as its argument, " @@ -339,7 +360,7 @@ msgid "" "conversion routine. ::" msgstr "" -#: ../../extending/embedding.rst:183 +#: ../../extending/embedding.rst:202 msgid "" "pFunc = PyObject_GetAttrString(pModule, argv[2]);\n" "/* pFunc is a new reference */\n" @@ -350,7 +371,7 @@ msgid "" "Py_XDECREF(pFunc);" msgstr "" -#: ../../extending/embedding.rst:191 +#: ../../extending/embedding.rst:210 msgid "" "Once the script is loaded, the name we're looking for is retrieved using :c:" "func:`PyObject_GetAttrString`. If the name exists, and the object returned " @@ -359,22 +380,22 @@ msgid "" "Python function is then made with::" msgstr "" -#: ../../extending/embedding.rst:197 +#: ../../extending/embedding.rst:216 msgid "pValue = PyObject_CallObject(pFunc, pArgs);" msgstr "pValue = PyObject_CallObject(pFunc, pArgs);" -#: ../../extending/embedding.rst:199 +#: ../../extending/embedding.rst:218 msgid "" "Upon return of the function, ``pValue`` is either ``NULL`` or it contains a " "reference to the return value of the function. Be sure to release the " "reference after examining the value." msgstr "" -#: ../../extending/embedding.rst:207 +#: ../../extending/embedding.rst:226 msgid "Extending Embedded Python" msgstr "" -#: ../../extending/embedding.rst:209 +#: ../../extending/embedding.rst:228 msgid "" "Until now, the embedded Python interpreter had no access to functionality " "from the application itself. The Python API allows this by extending the " @@ -386,7 +407,7 @@ msgid "" "like you would write a normal Python extension. For example::" msgstr "" -#: ../../extending/embedding.rst:218 +#: ../../extending/embedding.rst:237 msgid "" "static int numargs=0;\n" "\n" @@ -417,13 +438,13 @@ msgid "" "}" msgstr "" -#: ../../extending/embedding.rst:246 +#: ../../extending/embedding.rst:265 msgid "" "Insert the above code just above the :c:func:`main` function. Also, insert " "the following two statements before the call to :c:func:`Py_Initialize`::" msgstr "" -#: ../../extending/embedding.rst:249 +#: ../../extending/embedding.rst:268 msgid "" "numargs = argc;\n" "PyImport_AppendInittab(\"emb\", &PyInit_emb);" @@ -431,30 +452,30 @@ msgstr "" "numargs = argc;\n" "PyImport_AppendInittab(\"emb\", &PyInit_emb);" -#: ../../extending/embedding.rst:252 +#: ../../extending/embedding.rst:271 msgid "" "These two lines initialize the ``numargs`` variable, and make the :func:`!" "emb.numargs` function accessible to the embedded Python interpreter. With " "these extensions, the Python script can do things like" msgstr "" -#: ../../extending/embedding.rst:256 +#: ../../extending/embedding.rst:275 msgid "" "import emb\n" "print(\"Number of arguments\", emb.numargs())" msgstr "" -#: ../../extending/embedding.rst:261 +#: ../../extending/embedding.rst:280 msgid "" "In a real application, the methods will expose an API of the application to " "Python." msgstr "" -#: ../../extending/embedding.rst:271 +#: ../../extending/embedding.rst:290 msgid "Embedding Python in C++" msgstr "" -#: ../../extending/embedding.rst:273 +#: ../../extending/embedding.rst:292 msgid "" "It is also possible to embed Python in a C++ program; precisely how this is " "done will depend on the details of the C++ system used; in general you will " @@ -463,11 +484,11 @@ msgid "" "+." msgstr "" -#: ../../extending/embedding.rst:282 +#: ../../extending/embedding.rst:301 msgid "Compiling and Linking under Unix-like systems" msgstr "" -#: ../../extending/embedding.rst:284 +#: ../../extending/embedding.rst:303 msgid "" "It is not necessarily trivial to find the right flags to pass to your " "compiler (and linker) in order to embed the Python interpreter into your " @@ -475,7 +496,7 @@ msgid "" "implemented as C dynamic extensions (:file:`.so` files) linked against it." msgstr "" -#: ../../extending/embedding.rst:290 +#: ../../extending/embedding.rst:309 msgid "" "To find out the required compiler and linker flags, you can execute the :" "file:`python{X.Y}-config` script which is generated as part of the " @@ -484,13 +505,13 @@ msgid "" "directly useful to you:" msgstr "" -#: ../../extending/embedding.rst:296 +#: ../../extending/embedding.rst:315 msgid "" "``pythonX.Y-config --cflags`` will give you the recommended flags when " "compiling:" msgstr "" -#: ../../extending/embedding.rst:299 +#: ../../extending/embedding.rst:318 msgid "" "$ /opt/bin/python3.11-config --cflags\n" "-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG " @@ -500,13 +521,13 @@ msgstr "" "-I/opt/include/python3.11 -I/opt/include/python3.11 -Wsign-compare -DNDEBUG " "-g -fwrapv -O3 -Wall" -#: ../../extending/embedding.rst:304 +#: ../../extending/embedding.rst:323 msgid "" "``pythonX.Y-config --ldflags --embed`` will give you the recommended flags " "when linking:" msgstr "" -#: ../../extending/embedding.rst:307 +#: ../../extending/embedding.rst:326 msgid "" "$ /opt/bin/python3.11-config --ldflags --embed\n" "-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -" @@ -516,7 +537,7 @@ msgstr "" "-L/opt/lib/python3.11/config-3.11-x86_64-linux-gnu -L/opt/lib -lpython3.11 -" "lpthread -ldl -lutil -lm" -#: ../../extending/embedding.rst:313 +#: ../../extending/embedding.rst:332 msgid "" "To avoid confusion between several Python installations (and especially " "between the system Python and your own compiled Python), it is recommended " @@ -524,7 +545,7 @@ msgid "" "above example." msgstr "" -#: ../../extending/embedding.rst:318 +#: ../../extending/embedding.rst:337 msgid "" "If this procedure doesn't work for you (it is not guaranteed to work for all " "Unix-like platforms; however, we welcome :ref:`bug reports >> import sysconfig\n" ">>> sysconfig.get_config_var('LIBS')\n" diff --git a/extending/extending.po b/extending/extending.po index 24afb86878..6ff3917736 100644 --- a/extending/extending.po +++ b/extending/extending.po @@ -6,9 +6,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:34+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -91,7 +91,7 @@ msgstr "" msgid "The first two lines of our file can be::" msgstr "" -#: ../../extending/extending.rst:60 +#: ../../extending/extending.rst:60 ../../extending/extending.rst:663 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include " @@ -114,11 +114,13 @@ msgstr "" #: ../../extending/extending.rst:72 msgid "" -"It is recommended to always define ``PY_SSIZE_T_CLEAN`` before including " -"``Python.h``. See :ref:`parsetuple` for a description of this macro." +"``#define PY_SSIZE_T_CLEAN`` was used to indicate that ``Py_ssize_t`` should " +"be used in some APIs instead of ``int``. It is not necessary since Python " +"3.13, but we keep it here for backward compatibility. See :ref:`arg-parsing-" +"string-and-buffers` for a description of this macro." msgstr "" -#: ../../extending/extending.rst:75 +#: ../../extending/extending.rst:77 msgid "" "All user-visible symbols defined by :file:`Python.h` have a prefix of ``Py`` " "or ``PY``, except those defined in standard header files. For convenience, " @@ -129,14 +131,14 @@ msgid "" "and :c:func:`realloc` directly." msgstr "" -#: ../../extending/extending.rst:83 +#: ../../extending/extending.rst:85 msgid "" "The next thing we add to our module file is the C function that will be " "called when the Python expression ``spam.system(string)`` is evaluated " "(we'll see shortly how it ends up being called)::" msgstr "" -#: ../../extending/extending.rst:87 +#: ../../extending/extending.rst:89 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -162,7 +164,7 @@ msgstr "" " return PyLong_FromLong(sts);\n" "}" -#: ../../extending/extending.rst:99 +#: ../../extending/extending.rst:101 msgid "" "There is a straightforward translation from the argument list in Python (for " "example, the single expression ``\"ls -l\"``) to the arguments passed to the " @@ -170,13 +172,13 @@ msgid "" "*self* and *args*." msgstr "" -#: ../../extending/extending.rst:104 +#: ../../extending/extending.rst:106 msgid "" "The *self* argument points to the module object for module-level functions; " "for a method it would point to the object instance." msgstr "" -#: ../../extending/extending.rst:107 +#: ../../extending/extending.rst:109 msgid "" "The *args* argument will be a pointer to a Python tuple object containing " "the arguments. Each item of the tuple corresponds to an argument in the " @@ -188,7 +190,7 @@ msgid "" "variables into which to store the converted values. More about this later." msgstr "" -#: ../../extending/extending.rst:116 +#: ../../extending/extending.rst:118 msgid "" ":c:func:`PyArg_ParseTuple` returns true (nonzero) if all arguments have the " "right type and its components have been stored in the variables whose " @@ -198,11 +200,11 @@ msgid "" "example)." msgstr "" -#: ../../extending/extending.rst:126 +#: ../../extending/extending.rst:128 msgid "Intermezzo: Errors and Exceptions" msgstr "" -#: ../../extending/extending.rst:128 +#: ../../extending/extending.rst:130 msgid "" "An important convention throughout the Python interpreter is the following: " "when a function fails, it should set an exception condition and return an " @@ -214,13 +216,13 @@ msgid "" "important to know about them to understand how errors are passed around." msgstr "" -#: ../../extending/extending.rst:137 +#: ../../extending/extending.rst:139 msgid "" "The Python API defines a number of functions to set various types of " "exceptions." msgstr "" -#: ../../extending/extending.rst:139 +#: ../../extending/extending.rst:141 msgid "" "The most common one is :c:func:`PyErr_SetString`. Its arguments are an " "exception object and a C string. The exception object is usually a " @@ -229,7 +231,7 @@ msgid "" "and stored as the \"associated value\" of the exception." msgstr "" -#: ../../extending/extending.rst:145 +#: ../../extending/extending.rst:147 msgid "" "Another useful function is :c:func:`PyErr_SetFromErrno`, which only takes an " "exception argument and constructs the associated value by inspection of the " @@ -239,7 +241,7 @@ msgid "" "to any of these functions." msgstr "" -#: ../../extending/extending.rst:152 +#: ../../extending/extending.rst:154 msgid "" "You can test non-destructively whether an exception has been set with :c:" "func:`PyErr_Occurred`. This returns the current exception object, or " @@ -248,7 +250,7 @@ msgid "" "since you should be able to tell from the return value." msgstr "" -#: ../../extending/extending.rst:158 +#: ../../extending/extending.rst:160 msgid "" "When a function *f* that calls another function *g* detects that the latter " "fails, *f* should itself return an error value (usually ``NULL`` or " @@ -261,7 +263,7 @@ msgid "" "tries to find an exception handler specified by the Python programmer." msgstr "" -#: ../../extending/extending.rst:168 +#: ../../extending/extending.rst:170 msgid "" "(There are situations where a module can actually give a more detailed error " "message by calling another ``PyErr_*`` function, and in such cases it is " @@ -270,7 +272,7 @@ msgid "" "can fail for a variety of reasons.)" msgstr "" -#: ../../extending/extending.rst:174 +#: ../../extending/extending.rst:176 msgid "" "To ignore an exception set by a function call that failed, the exception " "condition must be cleared explicitly by calling :c:func:`PyErr_Clear`. The " @@ -279,7 +281,7 @@ msgid "" "itself (possibly by trying something else, or pretending nothing went wrong)." msgstr "" -#: ../../extending/extending.rst:180 +#: ../../extending/extending.rst:182 msgid "" "Every failing :c:func:`malloc` call must be turned into an exception --- the " "direct caller of :c:func:`malloc` (or :c:func:`realloc`) must call :c:func:" @@ -288,7 +290,7 @@ msgid "" "so this note is only relevant to those who call :c:func:`malloc` directly." msgstr "" -#: ../../extending/extending.rst:186 +#: ../../extending/extending.rst:188 msgid "" "Also note that, with the important exception of :c:func:`PyArg_ParseTuple` " "and friends, functions that return an integer status usually return a " @@ -296,14 +298,14 @@ msgid "" "calls." msgstr "" -#: ../../extending/extending.rst:190 +#: ../../extending/extending.rst:192 msgid "" "Finally, be careful to clean up garbage (by making :c:func:`Py_XDECREF` or :" "c:func:`Py_DECREF` calls for objects you have already created) when you " "return an error indicator!" msgstr "" -#: ../../extending/extending.rst:194 +#: ../../extending/extending.rst:196 msgid "" "The choice of which exception to raise is entirely yours. There are " "predeclared C objects corresponding to all built-in Python exceptions, such " @@ -316,23 +318,24 @@ msgid "" "satisfy other conditions, :c:data:`PyExc_ValueError` is appropriate." msgstr "" -#: ../../extending/extending.rst:204 +#: ../../extending/extending.rst:206 msgid "" "You can also define a new exception that is unique to your module. For this, " "you usually declare a static object variable at the beginning of your file::" msgstr "" -#: ../../extending/extending.rst:207 +#: ../../extending/extending.rst:209 msgid "static PyObject *SpamError;" msgstr "static PyObject *SpamError;" -#: ../../extending/extending.rst:209 +#: ../../extending/extending.rst:211 msgid "" "and initialize it in your module's initialization function (:c:func:`!" "PyInit_spam`) with an exception object::" msgstr "" -#: ../../extending/extending.rst:212 +#: ../../extending/extending.rst:214 +#, fuzzy msgid "" "PyMODINIT_FUNC\n" "PyInit_spam(void)\n" @@ -344,9 +347,7 @@ msgid "" " return NULL;\n" "\n" " SpamError = PyErr_NewException(\"spam.error\", NULL, NULL);\n" -" Py_XINCREF(SpamError);\n" -" if (PyModule_AddObject(m, \"error\", SpamError) < 0) {\n" -" Py_XDECREF(SpamError);\n" +" if (PyModule_AddObjectRef(m, \"error\", SpamError) < 0) {\n" " Py_CLEAR(SpamError);\n" " Py_DECREF(m);\n" " return NULL;\n" @@ -636,14 +637,15 @@ msgstr "" #: ../../extending/extending.rst:386 msgid "" +"#define PY_SSIZE_T_CLEAN\n" +"#include \n" +"\n" "int\n" "main(int argc, char *argv[])\n" "{\n" -" wchar_t *program = Py_DecodeLocale(argv[0], NULL);\n" -" if (program == NULL) {\n" -" fprintf(stderr, \"Fatal error: cannot decode argv[0]\\n\");\n" -" exit(1);\n" -" }\n" +" PyStatus status;\n" +" PyConfig config;\n" +" PyConfig_InitPythonConfig(&config);\n" "\n" " /* Add a built-in module, before Py_Initialize */\n" " if (PyImport_AppendInittab(\"spam\", PyInit_spam) == -1) {\n" @@ -653,11 +655,19 @@ msgid "" " }\n" "\n" " /* Pass argv[0] to the Python interpreter */\n" -" Py_SetProgramName(program);\n" +" status = PyConfig_SetBytesString(&config, &config.program_name, " +"argv[0]);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" "\n" " /* Initialize the Python interpreter. Required.\n" " If this step fails, it will be a fatal error. */\n" -" Py_Initialize();\n" +" status = Py_InitializeFromConfig(&config);\n" +" if (PyStatus_Exception(status)) {\n" +" goto exception;\n" +" }\n" +" PyConfig_Clear(&config);\n" "\n" " /* Optionally import the module; alternatively,\n" " import can be deferred until the embedded script\n" @@ -668,14 +678,17 @@ msgid "" " fprintf(stderr, \"Error: could not import module 'spam'\\n\");\n" " }\n" "\n" -" ...\n" +" // ... use Python C API here ...\n" "\n" -" PyMem_RawFree(program);\n" " return 0;\n" +"\n" +" exception:\n" +" PyConfig_Clear(&config);\n" +" Py_ExitStatusException(status);\n" "}" msgstr "" -#: ../../extending/extending.rst:425 +#: ../../extending/extending.rst:436 msgid "" "Removing entries from ``sys.modules`` or importing compiled modules into " "multiple interpreters within a process (or following a :c:func:`fork` " @@ -684,14 +697,14 @@ msgid "" "initializing internal data structures." msgstr "" -#: ../../extending/extending.rst:431 +#: ../../extending/extending.rst:442 msgid "" "A more substantial example module is included in the Python source " "distribution as :file:`Modules/xxmodule.c`. This file may be used as a " "template or simply read as an example." msgstr "" -#: ../../extending/extending.rst:437 +#: ../../extending/extending.rst:448 msgid "" "Unlike our ``spam`` example, ``xxmodule`` uses *multi-phase initialization* " "(new in Python 3.5), where a PyModuleDef structure is returned from " @@ -699,11 +712,11 @@ msgid "" "For details on multi-phase initialization, see :PEP:`489`." msgstr "" -#: ../../extending/extending.rst:446 +#: ../../extending/extending.rst:457 msgid "Compilation and Linkage" msgstr "" -#: ../../extending/extending.rst:448 +#: ../../extending/extending.rst:459 msgid "" "There are two more things to do before you can use your new extension: " "compiling and linking it with the Python system. If you use dynamic " @@ -713,7 +726,7 @@ msgid "" "Windows (chapter :ref:`building-on-windows`) for more information about this." msgstr "" -#: ../../extending/extending.rst:455 +#: ../../extending/extending.rst:466 msgid "" "If you can't use dynamic loading, or if you want to make your module a " "permanent part of the Python interpreter, you will have to change the " @@ -723,11 +736,11 @@ msgid "" "line to the file :file:`Modules/Setup.local` describing your file:" msgstr "" -#: ../../extending/extending.rst:462 +#: ../../extending/extending.rst:473 msgid "spam spammodule.o" msgstr "spam spammodule.o" -#: ../../extending/extending.rst:466 +#: ../../extending/extending.rst:477 msgid "" "and rebuild the interpreter by running :program:`make` in the toplevel " "directory. You can also run :program:`make` in the :file:`Modules/` " @@ -736,21 +749,21 @@ msgid "" "the :file:`Setup` file.)" msgstr "" -#: ../../extending/extending.rst:472 +#: ../../extending/extending.rst:483 msgid "" "If your module requires additional libraries to link with, these can be " "listed on the line in the configuration file as well, for instance:" msgstr "" -#: ../../extending/extending.rst:475 +#: ../../extending/extending.rst:486 msgid "spam spammodule.o -lX11" msgstr "spam spammodule.o -lX11" -#: ../../extending/extending.rst:483 +#: ../../extending/extending.rst:494 msgid "Calling Python Functions from C" msgstr "" -#: ../../extending/extending.rst:485 +#: ../../extending/extending.rst:496 msgid "" "So far we have concentrated on making C functions callable from Python. The " "reverse is also useful: calling Python functions from C. This is especially " @@ -761,7 +774,7 @@ msgid "" "uses are also imaginable." msgstr "" -#: ../../extending/extending.rst:493 +#: ../../extending/extending.rst:504 msgid "" "Fortunately, the Python interpreter is easily called recursively, and there " "is a standard interface to call a Python function. (I won't dwell on how to " @@ -770,7 +783,7 @@ msgid "" "line option in :file:`Modules/main.c` from the Python source code.)" msgstr "" -#: ../../extending/extending.rst:499 +#: ../../extending/extending.rst:510 msgid "" "Calling a Python function is easy. First, the Python program must somehow " "pass you the Python function object. You should provide a function (or some " @@ -780,7 +793,7 @@ msgid "" "function might be part of a module definition::" msgstr "" -#: ../../extending/extending.rst:506 +#: ../../extending/extending.rst:517 msgid "" "static PyObject *my_callback = NULL;\n" "\n" @@ -807,7 +820,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:529 +#: ../../extending/extending.rst:540 msgid "" "This function must be registered with the interpreter using the :c:macro:" "`METH_VARARGS` flag; this is described in section :ref:`methodtable`. The :" @@ -815,7 +828,7 @@ msgid "" "section :ref:`parsetuple`." msgstr "" -#: ../../extending/extending.rst:534 +#: ../../extending/extending.rst:545 msgid "" "The macros :c:func:`Py_XINCREF` and :c:func:`Py_XDECREF` increment/decrement " "the reference count of an object and are safe in the presence of ``NULL`` " @@ -823,7 +836,7 @@ msgid "" "info on them in section :ref:`refcounts`." msgstr "" -#: ../../extending/extending.rst:541 +#: ../../extending/extending.rst:552 msgid "" "Later, when it is time to call the function, you call the C function :c:func:" "`PyObject_CallObject`. This function has two arguments, both pointers to " @@ -835,7 +848,7 @@ msgid "" "or more format codes between parentheses. For example::" msgstr "" -#: ../../extending/extending.rst:550 +#: ../../extending/extending.rst:561 msgid "" "int arg;\n" "PyObject *arglist;\n" @@ -849,7 +862,7 @@ msgid "" "Py_DECREF(arglist);" msgstr "" -#: ../../extending/extending.rst:561 +#: ../../extending/extending.rst:572 msgid "" ":c:func:`PyObject_CallObject` returns a Python object pointer: this is the " "return value of the Python function. :c:func:`PyObject_CallObject` is " @@ -858,7 +871,7 @@ msgid "" "`Py_DECREF`\\ -ed immediately after the :c:func:`PyObject_CallObject` call." msgstr "" -#: ../../extending/extending.rst:568 +#: ../../extending/extending.rst:579 msgid "" "The return value of :c:func:`PyObject_CallObject` is \"new\": either it is a " "brand new object, or it is an existing object whose reference count has been " @@ -867,7 +880,7 @@ msgid "" "not interested in its value." msgstr "" -#: ../../extending/extending.rst:574 +#: ../../extending/extending.rst:585 msgid "" "Before you do this, however, it is important to check that the return value " "isn't ``NULL``. If it is, the Python function terminated by raising an " @@ -878,7 +891,7 @@ msgid "" "should be cleared by calling :c:func:`PyErr_Clear`. For example::" msgstr "" -#: ../../extending/extending.rst:582 +#: ../../extending/extending.rst:593 msgid "" "if (result == NULL)\n" " return NULL; /* Pass error back */\n" @@ -886,7 +899,7 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:587 +#: ../../extending/extending.rst:598 msgid "" "Depending on the desired interface to the Python callback function, you may " "also have to provide an argument list to :c:func:`PyObject_CallObject`. In " @@ -898,7 +911,7 @@ msgid "" "you want to pass an integral event code, you might use the following code::" msgstr "" -#: ../../extending/extending.rst:596 +#: ../../extending/extending.rst:607 msgid "" "PyObject *arglist;\n" "...\n" @@ -911,7 +924,7 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:606 +#: ../../extending/extending.rst:617 msgid "" "Note the placement of ``Py_DECREF(arglist)`` immediately after the call, " "before the error check! Also note that strictly speaking this code is not " @@ -919,14 +932,14 @@ msgid "" "checked." msgstr "" -#: ../../extending/extending.rst:610 +#: ../../extending/extending.rst:621 msgid "" "You may also call a function with keyword arguments by using :c:func:" "`PyObject_Call`, which supports arguments and keyword arguments. As in the " "above example, we use :c:func:`Py_BuildValue` to construct the dictionary. ::" msgstr "" -#: ../../extending/extending.rst:614 +#: ../../extending/extending.rst:625 msgid "" "PyObject *dict;\n" "...\n" @@ -939,19 +952,19 @@ msgid "" "Py_DECREF(result);" msgstr "" -#: ../../extending/extending.rst:628 +#: ../../extending/extending.rst:639 msgid "Extracting Parameters in Extension Functions" msgstr "" -#: ../../extending/extending.rst:632 +#: ../../extending/extending.rst:643 msgid "The :c:func:`PyArg_ParseTuple` function is declared as follows::" msgstr "" -#: ../../extending/extending.rst:634 +#: ../../extending/extending.rst:645 msgid "int PyArg_ParseTuple(PyObject *arg, const char *format, ...);" msgstr "" -#: ../../extending/extending.rst:636 +#: ../../extending/extending.rst:647 msgid "" "The *arg* argument must be a tuple object containing an argument list passed " "from Python to a C function. The *format* argument must be a format string, " @@ -960,7 +973,7 @@ msgid "" "whose type is determined by the format string." msgstr "" -#: ../../extending/extending.rst:642 +#: ../../extending/extending.rst:653 msgid "" "Note that while :c:func:`PyArg_ParseTuple` checks that the Python arguments " "have the required types, it cannot check the validity of the addresses of C " @@ -968,23 +981,17 @@ msgid "" "probably crash or at least overwrite random bits in memory. So be careful!" msgstr "" -#: ../../extending/extending.rst:647 +#: ../../extending/extending.rst:658 msgid "" "Note that any Python object references which are provided to the caller are " "*borrowed* references; do not decrement their reference count!" msgstr "" -#: ../../extending/extending.rst:650 +#: ../../extending/extending.rst:661 msgid "Some example calls::" msgstr "一些呼叫範例: ::" -#: ../../extending/extending.rst:652 -msgid "" -"#define PY_SSIZE_T_CLEAN /* Make \"s#\" use Py_ssize_t rather than int. */\n" -"#include " -msgstr "" - -#: ../../extending/extending.rst:657 +#: ../../extending/extending.rst:668 msgid "" "int ok;\n" "int i, j;\n" @@ -1004,27 +1011,27 @@ msgstr "" "ok = PyArg_ParseTuple(args, \"\"); /* 沒有引數 */\n" " /* Python 呼叫:f() */" -#: ../../extending/extending.rst:668 +#: ../../extending/extending.rst:679 msgid "" "ok = PyArg_ParseTuple(args, \"s\", &s); /* A string */\n" " /* Possible Python call: f('whoops!') */" msgstr "" -#: ../../extending/extending.rst:673 +#: ../../extending/extending.rst:684 msgid "" "ok = PyArg_ParseTuple(args, \"lls\", &k, &l, &s); /* Two longs and a string " "*/\n" " /* Possible Python call: f(1, 2, 'three') */" msgstr "" -#: ../../extending/extending.rst:678 +#: ../../extending/extending.rst:689 msgid "" "ok = PyArg_ParseTuple(args, \"(ii)s#\", &i, &j, &s, &size);\n" " /* A pair of ints and a string, whose size is also returned */\n" " /* Possible Python call: f((1, 2), 'three') */" msgstr "" -#: ../../extending/extending.rst:684 +#: ../../extending/extending.rst:695 msgid "" "{\n" " const char *file;\n" @@ -1039,7 +1046,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:698 +#: ../../extending/extending.rst:709 msgid "" "{\n" " int left, top, right, bottom, h, v;\n" @@ -1051,7 +1058,7 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:709 +#: ../../extending/extending.rst:720 msgid "" "{\n" " Py_complex c;\n" @@ -1061,24 +1068,26 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:720 +#: ../../extending/extending.rst:731 msgid "Keyword Parameters for Extension Functions" msgstr "" -#: ../../extending/extending.rst:724 +#: ../../extending/extending.rst:735 msgid "" "The :c:func:`PyArg_ParseTupleAndKeywords` function is declared as follows::" msgstr "" -#: ../../extending/extending.rst:726 +#: ../../extending/extending.rst:737 +#, fuzzy msgid "" "int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" -" const char *format, char *kwlist[], ...);" +" const char *format, char * const " +"*kwlist, ...);" msgstr "" "int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict,\n" " const char *format, char *kwlist[], ...);" -#: ../../extending/extending.rst:729 +#: ../../extending/extending.rst:740 msgid "" "The *arg* and *format* parameters are identical to those of the :c:func:" "`PyArg_ParseTuple` function. The *kwdict* parameter is the dictionary of " @@ -1090,22 +1099,22 @@ msgid "" "raises an appropriate exception." msgstr "" -#: ../../extending/extending.rst:739 +#: ../../extending/extending.rst:750 msgid "" "Nested tuples cannot be parsed when using keyword arguments! Keyword " "parameters passed in which are not present in the *kwlist* will cause :exc:" "`TypeError` to be raised." msgstr "" -#: ../../extending/extending.rst:745 +#: ../../extending/extending.rst:756 msgid "" "Here is an example module which uses keywords, based on an example by Geoff " "Philbrick (philbrick@hks.com)::" msgstr "" -#: ../../extending/extending.rst:748 +#: ../../extending/extending.rst:759 msgid "" -"#define PY_SSIZE_T_CLEAN /* Make \"s#\" use Py_ssize_t rather than int. */\n" +"#define PY_SSIZE_T_CLEAN\n" "#include \n" "\n" "static PyObject *\n" @@ -1157,21 +1166,21 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:800 +#: ../../extending/extending.rst:811 msgid "Building Arbitrary Values" msgstr "" -#: ../../extending/extending.rst:802 +#: ../../extending/extending.rst:813 msgid "" "This function is the counterpart to :c:func:`PyArg_ParseTuple`. It is " "declared as follows::" msgstr "" -#: ../../extending/extending.rst:805 +#: ../../extending/extending.rst:816 msgid "PyObject *Py_BuildValue(const char *format, ...);" msgstr "PyObject *Py_BuildValue(const char *format, ...);" -#: ../../extending/extending.rst:807 +#: ../../extending/extending.rst:818 msgid "" "It recognizes a set of format units similar to the ones recognized by :c:" "func:`PyArg_ParseTuple`, but the arguments (which are input to the function, " @@ -1179,7 +1188,7 @@ msgid "" "object, suitable for returning from a C function called from Python." msgstr "" -#: ../../extending/extending.rst:812 +#: ../../extending/extending.rst:823 msgid "" "One difference with :c:func:`PyArg_ParseTuple`: while the latter requires " "its first argument to be a tuple (since Python argument lists are always " @@ -1191,12 +1200,12 @@ msgid "" "parenthesize the format string." msgstr "" -#: ../../extending/extending.rst:820 +#: ../../extending/extending.rst:831 msgid "" "Examples (to the left the call, to the right the resulting Python value):" msgstr "" -#: ../../extending/extending.rst:822 +#: ../../extending/extending.rst:833 msgid "" "Py_BuildValue(\"\") None\n" "Py_BuildValue(\"i\", 123) 123\n" @@ -1234,11 +1243,11 @@ msgstr "" "Py_BuildValue(\"((ii)(ii)) (ii)\",\n" " 1, 2, 3, 4, 5, 6) (((1, 2), (3, 4)), (5, 6))" -#: ../../extending/extending.rst:846 +#: ../../extending/extending.rst:857 msgid "Reference Counts" msgstr "" -#: ../../extending/extending.rst:848 +#: ../../extending/extending.rst:859 msgid "" "In languages like C or C++, the programmer is responsible for dynamic " "allocation and deallocation of memory on the heap. In C, this is done using " @@ -1247,7 +1256,7 @@ msgid "" "restrict the following discussion to the C case." msgstr "" -#: ../../extending/extending.rst:854 +#: ../../extending/extending.rst:865 msgid "" "Every block of memory allocated with :c:func:`malloc` should eventually be " "returned to the pool of available memory by exactly one call to :c:func:" @@ -1262,7 +1271,7 @@ msgid "" "crashes." msgstr "" -#: ../../extending/extending.rst:865 +#: ../../extending/extending.rst:876 msgid "" "Common causes of memory leaks are unusual paths through the code. For " "instance, a function may allocate a block of memory, do some calculation, " @@ -1279,7 +1288,7 @@ msgid "" "of errors." msgstr "" -#: ../../extending/extending.rst:878 +#: ../../extending/extending.rst:889 msgid "" "Since Python makes heavy use of :c:func:`malloc` and :c:func:`free`, it " "needs a strategy to avoid memory leaks as well as the use of freed memory. " @@ -1290,7 +1299,7 @@ msgid "" "reference to the object has been deleted and the object is freed." msgstr "" -#: ../../extending/extending.rst:886 +#: ../../extending/extending.rst:897 msgid "" "An alternative strategy is called :dfn:`automatic garbage collection`. " "(Sometimes, reference counting is also referred to as a garbage collection " @@ -1306,7 +1315,7 @@ msgid "" "with reference counts." msgstr "" -#: ../../extending/extending.rst:898 +#: ../../extending/extending.rst:909 msgid "" "While Python uses the traditional reference counting implementation, it also " "offers a cycle detector that works to detect reference cycles. This allows " @@ -1320,7 +1329,7 @@ msgid "" "though there are no further references to the cycle itself." msgstr "" -#: ../../extending/extending.rst:909 +#: ../../extending/extending.rst:920 msgid "" "The cycle detector is able to detect garbage cycles and can reclaim them. " "The :mod:`gc` module exposes a way to run the detector (the :func:`~gc." @@ -1328,11 +1337,11 @@ msgid "" "disable the detector at runtime." msgstr "" -#: ../../extending/extending.rst:918 +#: ../../extending/extending.rst:929 msgid "Reference Counting in Python" msgstr "" -#: ../../extending/extending.rst:920 +#: ../../extending/extending.rst:931 msgid "" "There are two macros, ``Py_INCREF(x)`` and ``Py_DECREF(x)``, which handle " "the incrementing and decrementing of the reference count. :c:func:" @@ -1343,7 +1352,7 @@ msgid "" "object." msgstr "" -#: ../../extending/extending.rst:927 +#: ../../extending/extending.rst:938 msgid "" "The big question now remains: when to use ``Py_INCREF(x)`` and " "``Py_DECREF(x)``? Let's first introduce some terms. Nobody \"owns\" an " @@ -1356,7 +1365,7 @@ msgid "" "reference creates a memory leak." msgstr "" -#: ../../extending/extending.rst:936 +#: ../../extending/extending.rst:947 msgid "" "It is also possible to :dfn:`borrow` [#]_ a reference to an object. The " "borrower of a reference should not call :c:func:`Py_DECREF`. The borrower " @@ -1365,7 +1374,7 @@ msgid "" "risks using freed memory and should be avoided completely [#]_." msgstr "" -#: ../../extending/extending.rst:942 +#: ../../extending/extending.rst:953 msgid "" "The advantage of borrowing over owning a reference is that you don't need to " "take care of disposing of the reference on all possible paths through the " @@ -1376,7 +1385,7 @@ msgid "" "borrowed has in fact disposed of it." msgstr "" -#: ../../extending/extending.rst:950 +#: ../../extending/extending.rst:961 msgid "" "A borrowed reference can be changed into an owned reference by calling :c:" "func:`Py_INCREF`. This does not affect the status of the owner from which " @@ -1385,18 +1394,18 @@ msgid "" "properly, as well as the previous owner)." msgstr "" -#: ../../extending/extending.rst:960 +#: ../../extending/extending.rst:971 msgid "Ownership Rules" msgstr "" -#: ../../extending/extending.rst:962 +#: ../../extending/extending.rst:973 msgid "" "Whenever an object reference is passed into or out of a function, it is part " "of the function's interface specification whether ownership is transferred " "with the reference or not." msgstr "" -#: ../../extending/extending.rst:966 +#: ../../extending/extending.rst:977 msgid "" "Most functions that return a reference to an object pass on ownership with " "the reference. In particular, all functions whose function it is to create " @@ -1407,7 +1416,7 @@ msgid "" "reference to a cached item." msgstr "" -#: ../../extending/extending.rst:974 +#: ../../extending/extending.rst:985 msgid "" "Many functions that extract objects from other objects also transfer " "ownership with the reference, for instance :c:func:" @@ -1418,14 +1427,14 @@ msgid "" "list or dictionary." msgstr "" -#: ../../extending/extending.rst:981 +#: ../../extending/extending.rst:992 msgid "" "The function :c:func:`PyImport_AddModule` also returns a borrowed reference, " "even though it may actually create the object it returns: this is possible " "because an owned reference to the object is stored in ``sys.modules``." msgstr "" -#: ../../extending/extending.rst:985 +#: ../../extending/extending.rst:996 msgid "" "When you pass an object reference into another function, in general, the " "function borrows the reference from you --- if it needs to store it, it will " @@ -1436,7 +1445,7 @@ msgid "" "don't take over ownership --- they are \"normal.\")" msgstr "" -#: ../../extending/extending.rst:993 +#: ../../extending/extending.rst:1004 msgid "" "When a C function is called from Python, it borrows references to its " "arguments from the caller. The caller owns a reference to the object, so " @@ -1445,18 +1454,18 @@ msgid "" "turned into an owned reference by calling :c:func:`Py_INCREF`." msgstr "" -#: ../../extending/extending.rst:999 +#: ../../extending/extending.rst:1010 msgid "" "The object reference returned from a C function that is called from Python " "must be an owned reference --- ownership is transferred from the function to " "its caller." msgstr "" -#: ../../extending/extending.rst:1007 +#: ../../extending/extending.rst:1018 msgid "Thin Ice" msgstr "" -#: ../../extending/extending.rst:1009 +#: ../../extending/extending.rst:1020 msgid "" "There are a few situations where seemingly harmless use of a borrowed " "reference can lead to problems. These all have to do with implicit " @@ -1464,14 +1473,14 @@ msgid "" "dispose of it." msgstr "" -#: ../../extending/extending.rst:1013 +#: ../../extending/extending.rst:1024 msgid "" "The first and most important case to know about is using :c:func:`Py_DECREF` " "on an unrelated object while borrowing a reference to a list item. For " "instance::" msgstr "" -#: ../../extending/extending.rst:1016 +#: ../../extending/extending.rst:1027 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1491,14 +1500,14 @@ msgstr "" " PyObject_Print(item, stdout, 0); /* BUG! */\n" "}" -#: ../../extending/extending.rst:1025 +#: ../../extending/extending.rst:1036 msgid "" "This function first borrows a reference to ``list[0]``, then replaces " "``list[1]`` with the value ``0``, and finally prints the borrowed reference. " "Looks harmless, right? But it's not!" msgstr "" -#: ../../extending/extending.rst:1029 +#: ../../extending/extending.rst:1040 msgid "" "Let's follow the control flow into :c:func:`PyList_SetItem`. The list owns " "references to all its items, so when item 1 is replaced, it has to dispose " @@ -1508,7 +1517,7 @@ msgid "" "count of 1, disposing of it will call its :meth:`!__del__` method." msgstr "" -#: ../../extending/extending.rst:1036 +#: ../../extending/extending.rst:1047 msgid "" "Since it is written in Python, the :meth:`!__del__` method can execute " "arbitrary Python code. Could it perhaps do something to invalidate the " @@ -1519,13 +1528,13 @@ msgid "" "associated with it, thereby invalidating ``item``." msgstr "" -#: ../../extending/extending.rst:1044 +#: ../../extending/extending.rst:1055 msgid "" "The solution, once you know the source of the problem, is easy: temporarily " "increment the reference count. The correct version of the function reads::" msgstr "" -#: ../../extending/extending.rst:1047 +#: ../../extending/extending.rst:1058 msgid "" "void\n" "no_bug(PyObject *list)\n" @@ -1549,14 +1558,14 @@ msgstr "" " Py_DECREF(item);\n" "}" -#: ../../extending/extending.rst:1058 +#: ../../extending/extending.rst:1069 msgid "" "This is a true story. An older version of Python contained variants of this " "bug and someone spent a considerable amount of time in a C debugger to " "figure out why his :meth:`!__del__` methods would fail..." msgstr "" -#: ../../extending/extending.rst:1062 +#: ../../extending/extending.rst:1073 msgid "" "The second case of problems with a borrowed reference is a variant involving " "threads. Normally, multiple threads in the Python interpreter can't get in " @@ -1569,7 +1578,7 @@ msgid "" "previous one::" msgstr "" -#: ../../extending/extending.rst:1071 +#: ../../extending/extending.rst:1082 msgid "" "void\n" "bug(PyObject *list)\n" @@ -1582,11 +1591,11 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1085 +#: ../../extending/extending.rst:1096 msgid "NULL Pointers" msgstr "NULL 指標" -#: ../../extending/extending.rst:1087 +#: ../../extending/extending.rst:1098 msgid "" "In general, functions that take object references as arguments do not expect " "you to pass them ``NULL`` pointers, and will dump core (or cause later core " @@ -1598,21 +1607,21 @@ msgid "" "more slowly." msgstr "" -#: ../../extending/extending.rst:1095 +#: ../../extending/extending.rst:1106 msgid "" "It is better to test for ``NULL`` only at the \"source:\" when a pointer " "that may be ``NULL`` is received, for example, from :c:func:`malloc` or from " "a function that may raise an exception." msgstr "" -#: ../../extending/extending.rst:1099 +#: ../../extending/extending.rst:1110 msgid "" "The macros :c:func:`Py_INCREF` and :c:func:`Py_DECREF` do not check for " "``NULL`` pointers --- however, their variants :c:func:`Py_XINCREF` and :c:" "func:`Py_XDECREF` do." msgstr "" -#: ../../extending/extending.rst:1103 +#: ../../extending/extending.rst:1114 msgid "" "The macros for checking for a particular object type (``Pytype_Check()``) " "don't check for ``NULL`` pointers --- again, there is much code that calls " @@ -1621,24 +1630,24 @@ msgid "" "variants with ``NULL`` checking." msgstr "" -#: ../../extending/extending.rst:1109 +#: ../../extending/extending.rst:1120 msgid "" "The C function calling mechanism guarantees that the argument list passed to " "C functions (``args`` in the examples) is never ``NULL`` --- in fact it " "guarantees that it is always a tuple [#]_." msgstr "" -#: ../../extending/extending.rst:1113 +#: ../../extending/extending.rst:1124 msgid "" "It is a severe error to ever let a ``NULL`` pointer \"escape\" to the Python " "user." msgstr "" -#: ../../extending/extending.rst:1124 +#: ../../extending/extending.rst:1135 msgid "Writing Extensions in C++" msgstr "" -#: ../../extending/extending.rst:1126 +#: ../../extending/extending.rst:1137 msgid "" "It is possible to write extension modules in C++. Some restrictions apply. " "If the main program (the Python interpreter) is compiled and linked by the C " @@ -1651,11 +1660,11 @@ msgid "" "(all recent C++ compilers define this symbol)." msgstr "" -#: ../../extending/extending.rst:1140 +#: ../../extending/extending.rst:1151 msgid "Providing a C API for an Extension Module" msgstr "" -#: ../../extending/extending.rst:1145 +#: ../../extending/extending.rst:1156 msgid "" "Many extension modules just provide new functions and types to be used from " "Python, but sometimes the code in an extension module can be useful for " @@ -1666,7 +1675,7 @@ msgid "" "functions for direct manipulation from other extension modules." msgstr "" -#: ../../extending/extending.rst:1153 +#: ../../extending/extending.rst:1164 msgid "" "At first sight this seems easy: just write the functions (without declaring " "them ``static``, of course), provide an appropriate header file, and " @@ -1682,7 +1691,7 @@ msgid "" "call might not have been loaded yet!" msgstr "" -#: ../../extending/extending.rst:1165 +#: ../../extending/extending.rst:1176 msgid "" "Portability therefore requires not to make any assumptions about symbol " "visibility. This means that all symbols in extension modules should be " @@ -1692,7 +1701,7 @@ msgid "" "accessible from other extension modules must be exported in a different way." msgstr "" -#: ../../extending/extending.rst:1172 +#: ../../extending/extending.rst:1183 msgid "" "Python provides a special mechanism to pass C-level information (pointers) " "from one extension module to another one: Capsules. A Capsule is a Python " @@ -1704,7 +1713,7 @@ msgid "" "the Capsule." msgstr "" -#: ../../extending/extending.rst:1180 +#: ../../extending/extending.rst:1191 msgid "" "There are many ways in which Capsules can be used to export the C API of an " "extension module. Each function could get its own Capsule, or all C API " @@ -1714,7 +1723,7 @@ msgid "" "client modules." msgstr "" -#: ../../extending/extending.rst:1186 +#: ../../extending/extending.rst:1197 msgid "" "Whichever method you choose, it's important to name your Capsules properly. " "The function :c:func:`PyCapsule_New` takes a name parameter (:c:expr:`const " @@ -1724,17 +1733,17 @@ msgid "" "from another." msgstr "" -#: ../../extending/extending.rst:1193 +#: ../../extending/extending.rst:1204 msgid "" "In particular, Capsules used to expose C APIs should be given a name " "following this convention::" msgstr "" -#: ../../extending/extending.rst:1196 +#: ../../extending/extending.rst:1207 msgid "modulename.attributename" msgstr "modulename.attributename" -#: ../../extending/extending.rst:1198 +#: ../../extending/extending.rst:1209 msgid "" "The convenience function :c:func:`PyCapsule_Import` makes it easy to load a " "C API provided via a Capsule, but only if the Capsule's name matches this " @@ -1742,7 +1751,7 @@ msgid "" "the Capsule they load contains the correct C API." msgstr "" -#: ../../extending/extending.rst:1203 +#: ../../extending/extending.rst:1214 msgid "" "The following example demonstrates an approach that puts most of the burden " "on the writer of the exporting module, which is appropriate for commonly " @@ -1753,7 +1762,7 @@ msgid "" "modules only have to call this macro before accessing the C API." msgstr "" -#: ../../extending/extending.rst:1211 +#: ../../extending/extending.rst:1222 msgid "" "The exporting module is a modification of the :mod:`!spam` module from " "section :ref:`extending-simpleexample`. The function :func:`!spam.system` " @@ -1764,13 +1773,13 @@ msgid "" "modules." msgstr "" -#: ../../extending/extending.rst:1218 +#: ../../extending/extending.rst:1229 msgid "" "The function :c:func:`!PySpam_System` is a plain C function, declared " "``static`` like everything else::" msgstr "" -#: ../../extending/extending.rst:1221 +#: ../../extending/extending.rst:1232 msgid "" "static int\n" "PySpam_System(const char *command)\n" @@ -1784,11 +1793,11 @@ msgstr "" " return system(command);\n" "}" -#: ../../extending/extending.rst:1227 +#: ../../extending/extending.rst:1238 msgid "The function :c:func:`!spam_system` is modified in a trivial way::" msgstr "" -#: ../../extending/extending.rst:1229 +#: ../../extending/extending.rst:1240 msgid "" "static PyObject *\n" "spam_system(PyObject *self, PyObject *args)\n" @@ -1814,19 +1823,19 @@ msgstr "" " return PyLong_FromLong(sts);\n" "}" -#: ../../extending/extending.rst:1241 +#: ../../extending/extending.rst:1252 msgid "In the beginning of the module, right after the line ::" msgstr "" -#: ../../extending/extending.rst:1243 +#: ../../extending/extending.rst:1254 msgid "#include " msgstr "#include " -#: ../../extending/extending.rst:1245 +#: ../../extending/extending.rst:1256 msgid "two more lines must be added::" msgstr "" -#: ../../extending/extending.rst:1247 +#: ../../extending/extending.rst:1258 msgid "" "#define SPAM_MODULE\n" "#include \"spammodule.h\"" @@ -1834,7 +1843,7 @@ msgstr "" "#define SPAM_MODULE\n" "#include \"spammodule.h\"" -#: ../../extending/extending.rst:1250 +#: ../../extending/extending.rst:1261 msgid "" "The ``#define`` is used to tell the header file that it is being included in " "the exporting module, not a client module. Finally, the module's " @@ -1842,7 +1851,7 @@ msgid "" "array::" msgstr "" -#: ../../extending/extending.rst:1254 +#: ../../extending/extending.rst:1265 msgid "" "PyMODINIT_FUNC\n" "PyInit_spam(void)\n" @@ -1862,8 +1871,7 @@ msgid "" " c_api_object = PyCapsule_New((void *)PySpam_API, \"spam._C_API\", " "NULL);\n" "\n" -" if (PyModule_AddObject(m, \"_C_API\", c_api_object) < 0) {\n" -" Py_XDECREF(c_api_object);\n" +" if (PyModule_Add(m, \"_C_API\", c_api_object) < 0) {\n" " Py_DECREF(m);\n" " return NULL;\n" " }\n" @@ -1872,19 +1880,19 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1280 +#: ../../extending/extending.rst:1290 msgid "" "Note that ``PySpam_API`` is declared ``static``; otherwise the pointer array " "would disappear when :c:func:`!PyInit_spam` terminates!" msgstr "" -#: ../../extending/extending.rst:1283 +#: ../../extending/extending.rst:1293 msgid "" "The bulk of the work is in the header file :file:`spammodule.h`, which looks " "like this::" msgstr "" -#: ../../extending/extending.rst:1286 +#: ../../extending/extending.rst:1296 msgid "" "#ifndef Py_SPAMMODULE_H\n" "#define Py_SPAMMODULE_H\n" @@ -1936,14 +1944,14 @@ msgid "" "#endif /* !defined(Py_SPAMMODULE_H) */" msgstr "" -#: ../../extending/extending.rst:1334 +#: ../../extending/extending.rst:1344 msgid "" "All that a client module must do in order to have access to the function :c:" "func:`!PySpam_System` is to call the function (or rather macro) :c:func:`!" "import_spam` in its initialization function::" msgstr "" -#: ../../extending/extending.rst:1338 +#: ../../extending/extending.rst:1348 msgid "" "PyMODINIT_FUNC\n" "PyInit_client(void)\n" @@ -1960,14 +1968,14 @@ msgid "" "}" msgstr "" -#: ../../extending/extending.rst:1352 +#: ../../extending/extending.rst:1362 msgid "" "The main disadvantage of this approach is that the file :file:`spammodule.h` " "is rather complicated. However, the basic structure is the same for each " "function that is exported, so it has to be learned only once." msgstr "" -#: ../../extending/extending.rst:1356 +#: ../../extending/extending.rst:1366 msgid "" "Finally it should be mentioned that Capsules offer additional functionality, " "which is especially useful for memory allocation and deallocation of the " @@ -1977,47 +1985,47 @@ msgid "" "in the Python source code distribution)." msgstr "" -#: ../../extending/extending.rst:1364 +#: ../../extending/extending.rst:1374 msgid "Footnotes" msgstr "註解" -#: ../../extending/extending.rst:1365 +#: ../../extending/extending.rst:1375 msgid "" "An interface for this function already exists in the standard module :mod:" "`os` --- it was chosen as a simple and straightforward example." msgstr "" -#: ../../extending/extending.rst:1368 +#: ../../extending/extending.rst:1378 msgid "" "The metaphor of \"borrowing\" a reference is not completely correct: the " "owner still has a copy of the reference." msgstr "" -#: ../../extending/extending.rst:1371 +#: ../../extending/extending.rst:1381 msgid "" "Checking that the reference count is at least 1 **does not work** --- the " "reference count itself could be in freed memory and may thus be reused for " "another object!" msgstr "" -#: ../../extending/extending.rst:1375 +#: ../../extending/extending.rst:1385 msgid "" "These guarantees don't hold when you use the \"old\" style calling " "convention --- this is still found in much existing code." msgstr "" -#: ../../extending/extending.rst:539 +#: ../../extending/extending.rst:550 msgid "PyObject_CallObject (C function)" msgstr "PyObject_CallObject(C 函式)" -#: ../../extending/extending.rst:630 +#: ../../extending/extending.rst:641 msgid "PyArg_ParseTuple (C function)" msgstr "PyArg_ParseTuple(C 函式)" -#: ../../extending/extending.rst:722 +#: ../../extending/extending.rst:733 msgid "PyArg_ParseTupleAndKeywords (C function)" msgstr "PyArg_ParseTupleAndKeywords(C 函式)" -#: ../../extending/extending.rst:743 +#: ../../extending/extending.rst:754 msgid "Philbrick, Geoff" msgstr "Philbrick, Geoff" diff --git a/extending/index.po b/extending/index.po index 51fce044dc..2518825082 100644 --- a/extending/index.po +++ b/extending/index.po @@ -6,7 +6,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-04-18 00:04+0000\n" "PO-Revision-Date: 2021-07-06 22:18+0800\n" diff --git a/extending/newtypes.po b/extending/newtypes.po index 9a479f42c9..7029e57821 100644 --- a/extending/newtypes.po +++ b/extending/newtypes.po @@ -6,9 +6,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:34+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -561,7 +561,7 @@ msgid "" "defined this way can have an associated doc string simply by providing the " "text in the table. An application can use the introspection API to retrieve " "the descriptor from the class object, and get the doc string using its :attr:" -"`!__doc__` attribute." +"`~type.__doc__` attribute." msgstr "" #: ../../extending/newtypes.rst:301 @@ -775,7 +775,7 @@ msgstr "" #: ../../extending/newtypes.rst:451 msgid "" -":c:type:`!Py_hash_t` is a signed integer type with a platform-varying width. " +":c:type:`Py_hash_t` is a signed integer type with a platform-varying width. " "Returning ``-1`` from :c:member:`~PyTypeObject.tp_hash` indicates an error, " "which is why you should be careful to avoid returning it when hash " "computation is successful, as seen above." diff --git a/extending/newtypes_tutorial.po b/extending/newtypes_tutorial.po index 676dd1c7d3..d344eb253f 100644 --- a/extending/newtypes_tutorial.po +++ b/extending/newtypes_tutorial.po @@ -2,9 +2,9 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -102,9 +102,8 @@ msgid "" " if (m == NULL)\n" " return NULL;\n" "\n" -" Py_INCREF(&CustomType);\n" -" if (PyModule_AddObject(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" -" Py_DECREF(&CustomType);\n" +" if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) " +"{\n" " Py_DECREF(m);\n" " return NULL;\n" " }\n" @@ -290,8 +289,8 @@ msgid "" "If you want your type to be subclassable from Python, and your type has the " "same :c:member:`~PyTypeObject.tp_basicsize` as its base type, you may have " "problems with multiple inheritance. A Python subclass of your type will " -"have to list your type first in its :attr:`~class.__bases__`, or else it " -"will not be able to call your type's :meth:`~object.__new__` method without " +"have to list your type first in its :attr:`~type.__bases__`, or else it will " +"not be able to call your type's :meth:`~object.__new__` method without " "getting an error. You can avoid this problem by ensuring that your type has " "a larger value for :c:member:`~PyTypeObject.tp_basicsize` than its base type " "does. Most of the time, this will be true anyway, because either your base " @@ -358,10 +357,9 @@ msgid "" msgstr "" #: ../../extending/newtypes_tutorial.rst:183 +#, fuzzy msgid "" -"Py_INCREF(&CustomType);\n" -"if (PyModule_AddObject(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" -" Py_DECREF(&CustomType);\n" +"if (PyModule_AddObjectRef(m, \"Custom\", (PyObject *) &CustomType) < 0) {\n" " Py_DECREF(m);\n" " return NULL;\n" "}" @@ -373,13 +371,13 @@ msgstr "" " return NULL;\n" "}" -#: ../../extending/newtypes_tutorial.rst:190 +#: ../../extending/newtypes_tutorial.rst:188 msgid "" "This adds the type to the module dictionary. This allows us to create :" "class:`!Custom` instances by calling the :class:`!Custom` class:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:193 +#: ../../extending/newtypes_tutorial.rst:191 msgid "" ">>> import custom\n" ">>> mycustom = custom.Custom()" @@ -387,13 +385,13 @@ msgstr "" ">>> import custom\n" ">>> mycustom = custom.Custom()" -#: ../../extending/newtypes_tutorial.rst:198 +#: ../../extending/newtypes_tutorial.rst:196 msgid "" "That's it! All that remains is to build it; put the above code in a file " "called :file:`custom.c`," msgstr "" -#: ../../extending/newtypes_tutorial.rst:201 +#: ../../extending/newtypes_tutorial.rst:199 msgid "" "[build-system]\n" "requires = [\"setuptools\"]\n" @@ -411,11 +409,11 @@ msgstr "" "name = \"custom\"\n" "version = \"1\"\n" -#: ../../extending/newtypes_tutorial.rst:203 +#: ../../extending/newtypes_tutorial.rst:201 msgid "in a file called :file:`pyproject.toml`, and" msgstr "" -#: ../../extending/newtypes_tutorial.rst:205 +#: ../../extending/newtypes_tutorial.rst:203 msgid "" "from setuptools import Extension, setup\n" "setup(ext_modules=[Extension(\"custom\", [\"custom.c\"])])" @@ -423,44 +421,44 @@ msgstr "" "from setuptools import Extension, setup\n" "setup(ext_modules=[Extension(\"custom\", [\"custom.c\"])])" -#: ../../extending/newtypes_tutorial.rst:210 +#: ../../extending/newtypes_tutorial.rst:208 msgid "in a file called :file:`setup.py`; then typing" msgstr "" -#: ../../extending/newtypes_tutorial.rst:212 -#: ../../extending/newtypes_tutorial.rst:527 +#: ../../extending/newtypes_tutorial.rst:210 +#: ../../extending/newtypes_tutorial.rst:525 msgid "$ python -m pip install ." msgstr "$ python -m pip install ." -#: ../../extending/newtypes_tutorial.rst:216 +#: ../../extending/newtypes_tutorial.rst:214 msgid "" "in a shell should produce a file :file:`custom.so` in a subdirectory and " "install it; now fire up Python --- you should be able to ``import custom`` " "and play around with ``Custom`` objects." msgstr "" -#: ../../extending/newtypes_tutorial.rst:220 +#: ../../extending/newtypes_tutorial.rst:218 msgid "That wasn't so hard, was it?" msgstr "" -#: ../../extending/newtypes_tutorial.rst:222 +#: ../../extending/newtypes_tutorial.rst:220 msgid "" "Of course, the current Custom type is pretty uninteresting. It has no data " "and doesn't do anything. It can't even be subclassed." msgstr "" -#: ../../extending/newtypes_tutorial.rst:227 +#: ../../extending/newtypes_tutorial.rst:225 msgid "Adding data and methods to the Basic example" msgstr "" -#: ../../extending/newtypes_tutorial.rst:229 +#: ../../extending/newtypes_tutorial.rst:227 msgid "" "Let's extend the basic example to add some data and methods. Let's also " "make the type usable as a base class. We'll create a new module, :mod:`!" "custom2` that adds these capabilities:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:233 +#: ../../extending/newtypes_tutorial.rst:231 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -595,11 +593,11 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:236 +#: ../../extending/newtypes_tutorial.rst:234 msgid "This version of the module has a number of changes." msgstr "" -#: ../../extending/newtypes_tutorial.rst:238 +#: ../../extending/newtypes_tutorial.rst:236 msgid "" "The :class:`!Custom` type now has three data attributes in its C struct, " "*first*, *last*, and *number*. The *first* and *last* variables are Python " @@ -607,11 +605,11 @@ msgid "" "integer." msgstr "" -#: ../../extending/newtypes_tutorial.rst:242 +#: ../../extending/newtypes_tutorial.rst:240 msgid "The object structure is updated accordingly::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:244 +#: ../../extending/newtypes_tutorial.rst:242 msgid "" "typedef struct {\n" " PyObject_HEAD\n" @@ -627,13 +625,13 @@ msgstr "" " int number;\n" "} CustomObject;" -#: ../../extending/newtypes_tutorial.rst:251 +#: ../../extending/newtypes_tutorial.rst:249 msgid "" "Because we now have data to manage, we have to be more careful about object " "allocation and deallocation. At a minimum, we need a deallocation method::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:254 +#: ../../extending/newtypes_tutorial.rst:252 msgid "" "static void\n" "Custom_dealloc(CustomObject *self)\n" @@ -651,15 +649,15 @@ msgstr "" " Py_TYPE(self)->tp_free((PyObject *) self);\n" "}" -#: ../../extending/newtypes_tutorial.rst:262 +#: ../../extending/newtypes_tutorial.rst:260 msgid "which is assigned to the :c:member:`~PyTypeObject.tp_dealloc` member::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:264 +#: ../../extending/newtypes_tutorial.rst:262 msgid ".tp_dealloc = (destructor) Custom_dealloc," msgstr ".tp_dealloc = (destructor) Custom_dealloc," -#: ../../extending/newtypes_tutorial.rst:266 +#: ../../extending/newtypes_tutorial.rst:264 msgid "" "This method first clears the reference counts of the two Python attributes. :" "c:func:`Py_XDECREF` correctly handles the case where its argument is " @@ -670,7 +668,7 @@ msgid "" "an instance of a subclass." msgstr "" -#: ../../extending/newtypes_tutorial.rst:275 +#: ../../extending/newtypes_tutorial.rst:273 msgid "" "The explicit cast to ``destructor`` above is needed because we defined " "``Custom_dealloc`` to take a ``CustomObject *`` argument, but the " @@ -679,13 +677,13 @@ msgid "" "oriented polymorphism, in C!" msgstr "" -#: ../../extending/newtypes_tutorial.rst:281 +#: ../../extending/newtypes_tutorial.rst:279 msgid "" "We want to make sure that the first and last names are initialized to empty " "strings, so we provide a ``tp_new`` implementation::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:284 +#: ../../extending/newtypes_tutorial.rst:282 msgid "" "static PyObject *\n" "Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds)\n" @@ -729,15 +727,15 @@ msgstr "" " return (PyObject *) self;\n" "}" -#: ../../extending/newtypes_tutorial.rst:305 +#: ../../extending/newtypes_tutorial.rst:303 msgid "and install it in the :c:member:`~PyTypeObject.tp_new` member::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:307 +#: ../../extending/newtypes_tutorial.rst:305 msgid ".tp_new = Custom_new," msgstr ".tp_new = Custom_new," -#: ../../extending/newtypes_tutorial.rst:309 +#: ../../extending/newtypes_tutorial.rst:307 msgid "" "The ``tp_new`` handler is responsible for creating (as opposed to " "initializing) objects of the type. It is exposed in Python as the :meth:" @@ -748,7 +746,7 @@ msgid "" "``first`` and ``last`` attributes to non-``NULL`` default values." msgstr "" -#: ../../extending/newtypes_tutorial.rst:317 +#: ../../extending/newtypes_tutorial.rst:315 msgid "" "``tp_new`` is passed the type being instantiated (not necessarily " "``CustomType``, if a subclass is instantiated) and any arguments passed when " @@ -758,29 +756,29 @@ msgid "" "k.a. ``tp_init`` in C or ``__init__`` in Python) methods." msgstr "" -#: ../../extending/newtypes_tutorial.rst:325 +#: ../../extending/newtypes_tutorial.rst:323 msgid "" "``tp_new`` shouldn't call ``tp_init`` explicitly, as the interpreter will do " "it itself." msgstr "" -#: ../../extending/newtypes_tutorial.rst:328 +#: ../../extending/newtypes_tutorial.rst:326 msgid "" "The ``tp_new`` implementation calls the :c:member:`~PyTypeObject.tp_alloc` " "slot to allocate memory::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:331 +#: ../../extending/newtypes_tutorial.rst:329 msgid "self = (CustomObject *) type->tp_alloc(type, 0);" msgstr "self = (CustomObject *) type->tp_alloc(type, 0);" -#: ../../extending/newtypes_tutorial.rst:333 +#: ../../extending/newtypes_tutorial.rst:331 msgid "" "Since memory allocation may fail, we must check the :c:member:`~PyTypeObject." "tp_alloc` result against ``NULL`` before proceeding." msgstr "" -#: ../../extending/newtypes_tutorial.rst:337 +#: ../../extending/newtypes_tutorial.rst:335 msgid "" "We didn't fill the :c:member:`~PyTypeObject.tp_alloc` slot ourselves. " "Rather :c:func:`PyType_Ready` fills it for us by inheriting it from our base " @@ -788,7 +786,7 @@ msgid "" "allocation strategy." msgstr "" -#: ../../extending/newtypes_tutorial.rst:343 +#: ../../extending/newtypes_tutorial.rst:341 msgid "" "If you are creating a co-operative :c:member:`~PyTypeObject.tp_new` (one " "that calls a base type's :c:member:`~PyTypeObject.tp_new` or :meth:`~object." @@ -801,13 +799,13 @@ msgid "" "subclasses without getting a :exc:`TypeError`.)" msgstr "" -#: ../../extending/newtypes_tutorial.rst:353 +#: ../../extending/newtypes_tutorial.rst:351 msgid "" "We also define an initialization function which accepts arguments to provide " "initial values for our instance::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:356 +#: ../../extending/newtypes_tutorial.rst:354 msgid "" "static int\n" "Custom_init(CustomObject *self, PyObject *args, PyObject *kwds)\n" @@ -861,15 +859,15 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:382 +#: ../../extending/newtypes_tutorial.rst:380 msgid "by filling the :c:member:`~PyTypeObject.tp_init` slot. ::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:384 +#: ../../extending/newtypes_tutorial.rst:382 msgid ".tp_init = (initproc) Custom_init," msgstr ".tp_init = (initproc) Custom_init," -#: ../../extending/newtypes_tutorial.rst:386 +#: ../../extending/newtypes_tutorial.rst:384 msgid "" "The :c:member:`~PyTypeObject.tp_init` slot is exposed in Python as the :meth:" "`~object.__init__` method. It is used to initialize an object after it's " @@ -877,7 +875,7 @@ msgid "" "they should return either ``0`` on success or ``-1`` on error." msgstr "" -#: ../../extending/newtypes_tutorial.rst:391 +#: ../../extending/newtypes_tutorial.rst:389 msgid "" "Unlike the ``tp_new`` handler, there is no guarantee that ``tp_init`` is " "called at all (for example, the :mod:`pickle` module by default doesn't " @@ -888,7 +886,7 @@ msgid "" "``first`` member like this::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:399 +#: ../../extending/newtypes_tutorial.rst:397 msgid "" "if (first) {\n" " Py_XDECREF(self->first);\n" @@ -902,7 +900,7 @@ msgstr "" " self->first = first;\n" "}" -#: ../../extending/newtypes_tutorial.rst:405 +#: ../../extending/newtypes_tutorial.rst:403 msgid "" "But this would be risky. Our type doesn't restrict the type of the " "``first`` member, so it could be any kind of object. It could have a " @@ -912,37 +910,37 @@ msgid "" "accesses and modifies our object." msgstr "" -#: ../../extending/newtypes_tutorial.rst:412 +#: ../../extending/newtypes_tutorial.rst:410 msgid "" "To be paranoid and protect ourselves against this possibility, we almost " "always reassign members before decrementing their reference counts. When " "don't we have to do this?" msgstr "" -#: ../../extending/newtypes_tutorial.rst:416 +#: ../../extending/newtypes_tutorial.rst:414 msgid "when we absolutely know that the reference count is greater than 1;" msgstr "" -#: ../../extending/newtypes_tutorial.rst:418 +#: ../../extending/newtypes_tutorial.rst:416 msgid "" "when we know that deallocation of the object [#]_ will neither release the :" "term:`GIL` nor cause any calls back into our type's code;" msgstr "" -#: ../../extending/newtypes_tutorial.rst:421 +#: ../../extending/newtypes_tutorial.rst:419 msgid "" "when decrementing a reference count in a :c:member:`~PyTypeObject." "tp_dealloc` handler on a type which doesn't support cyclic garbage " "collection [#]_." msgstr "" -#: ../../extending/newtypes_tutorial.rst:424 +#: ../../extending/newtypes_tutorial.rst:422 msgid "" "We want to expose our instance variables as attributes. There are a number " "of ways to do that. The simplest way is to define member definitions::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:427 +#: ../../extending/newtypes_tutorial.rst:425 msgid "" "static PyMemberDef Custom_members[] = {\n" " {\"first\", Py_T_OBJECT_EX, offsetof(CustomObject, first), 0,\n" @@ -955,23 +953,23 @@ msgid "" "};" msgstr "" -#: ../../extending/newtypes_tutorial.rst:437 +#: ../../extending/newtypes_tutorial.rst:435 msgid "" "and put the definitions in the :c:member:`~PyTypeObject.tp_members` slot::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:439 +#: ../../extending/newtypes_tutorial.rst:437 msgid ".tp_members = Custom_members," msgstr ".tp_members = Custom_members," -#: ../../extending/newtypes_tutorial.rst:441 +#: ../../extending/newtypes_tutorial.rst:439 msgid "" "Each member definition has a member name, type, offset, access flags and " "documentation string. See the :ref:`Generic-Attribute-Management` section " "below for details." msgstr "" -#: ../../extending/newtypes_tutorial.rst:445 +#: ../../extending/newtypes_tutorial.rst:443 msgid "" "A disadvantage of this approach is that it doesn't provide a way to restrict " "the types of objects that can be assigned to the Python attributes. We " @@ -982,13 +980,13 @@ msgid "" "deleted." msgstr "" -#: ../../extending/newtypes_tutorial.rst:452 +#: ../../extending/newtypes_tutorial.rst:450 msgid "" "We define a single method, :meth:`!Custom.name`, that outputs the objects " "name as the concatenation of the first and last names. ::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:455 +#: ../../extending/newtypes_tutorial.rst:453 msgid "" "static PyObject *\n" "Custom_name(CustomObject *self, PyObject *Py_UNUSED(ignored))\n" @@ -1018,7 +1016,7 @@ msgstr "" " return PyUnicode_FromFormat(\"%S %S\", self->first, self->last);\n" "}" -#: ../../extending/newtypes_tutorial.rst:469 +#: ../../extending/newtypes_tutorial.rst:467 msgid "" "The method is implemented as a C function that takes a :class:`!Custom` (or :" "class:`!Custom` subclass) instance as the first argument. Methods always " @@ -1028,7 +1026,7 @@ msgid "" "method is equivalent to the Python method:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:476 +#: ../../extending/newtypes_tutorial.rst:474 msgid "" "def name(self):\n" " return \"%s %s\" % (self.first, self.last)" @@ -1036,7 +1034,7 @@ msgstr "" "def name(self):\n" " return \"%s %s\" % (self.first, self.last)" -#: ../../extending/newtypes_tutorial.rst:481 +#: ../../extending/newtypes_tutorial.rst:479 msgid "" "Note that we have to check for the possibility that our :attr:`!first` and :" "attr:`!last` members are ``NULL``. This is because they can be deleted, in " @@ -1045,13 +1043,13 @@ msgid "" "We'll see how to do that in the next section." msgstr "" -#: ../../extending/newtypes_tutorial.rst:487 +#: ../../extending/newtypes_tutorial.rst:485 msgid "" "Now that we've defined the method, we need to create an array of method " "definitions::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:490 +#: ../../extending/newtypes_tutorial.rst:488 msgid "" "static PyMethodDef Custom_methods[] = {\n" " {\"name\", (PyCFunction) Custom_name, METH_NOARGS,\n" @@ -1061,21 +1059,21 @@ msgid "" "};" msgstr "" -#: ../../extending/newtypes_tutorial.rst:497 +#: ../../extending/newtypes_tutorial.rst:495 msgid "" "(note that we used the :c:macro:`METH_NOARGS` flag to indicate that the " "method is expecting no arguments other than *self*)" msgstr "" -#: ../../extending/newtypes_tutorial.rst:500 +#: ../../extending/newtypes_tutorial.rst:498 msgid "and assign it to the :c:member:`~PyTypeObject.tp_methods` slot::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:502 +#: ../../extending/newtypes_tutorial.rst:500 msgid ".tp_methods = Custom_methods," msgstr ".tp_methods = Custom_methods," -#: ../../extending/newtypes_tutorial.rst:504 +#: ../../extending/newtypes_tutorial.rst:502 msgid "" "Finally, we'll make our type usable as a base class for subclassing. We've " "written our methods carefully so far so that they don't make any assumptions " @@ -1083,22 +1081,22 @@ msgid "" "to add the :c:macro:`Py_TPFLAGS_BASETYPE` to our class flag definition::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:509 +#: ../../extending/newtypes_tutorial.rst:507 msgid ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE," msgstr ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE," -#: ../../extending/newtypes_tutorial.rst:511 +#: ../../extending/newtypes_tutorial.rst:509 msgid "" "We rename :c:func:`!PyInit_custom` to :c:func:`!PyInit_custom2`, update the " "module name in the :c:type:`PyModuleDef` struct, and update the full class " "name in the :c:type:`PyTypeObject` struct." msgstr "" -#: ../../extending/newtypes_tutorial.rst:515 +#: ../../extending/newtypes_tutorial.rst:513 msgid "Finally, we update our :file:`setup.py` file to include the new module," msgstr "" -#: ../../extending/newtypes_tutorial.rst:517 +#: ../../extending/newtypes_tutorial.rst:515 msgid "" "from setuptools import Extension, setup\n" "setup(ext_modules=[\n" @@ -1112,15 +1110,15 @@ msgstr "" " Extension(\"custom2\", [\"custom2.c\"]),\n" "])" -#: ../../extending/newtypes_tutorial.rst:525 +#: ../../extending/newtypes_tutorial.rst:523 msgid "and then we re-install so that we can ``import custom2``:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:532 +#: ../../extending/newtypes_tutorial.rst:530 msgid "Providing finer control over data attributes" msgstr "" -#: ../../extending/newtypes_tutorial.rst:534 +#: ../../extending/newtypes_tutorial.rst:532 msgid "" "In this section, we'll provide finer control over how the :attr:`!first` " "and :attr:`!last` attributes are set in the :class:`!Custom` example. In the " @@ -1129,7 +1127,7 @@ msgid "" "make sure that these attributes always contain strings." msgstr "" -#: ../../extending/newtypes_tutorial.rst:540 +#: ../../extending/newtypes_tutorial.rst:538 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -1307,14 +1305,14 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:543 +#: ../../extending/newtypes_tutorial.rst:541 msgid "" "To provide greater control, over the :attr:`!first` and :attr:`!last` " "attributes, we'll use custom getter and setter functions. Here are the " "functions for getting and setting the :attr:`!first` attribute::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:547 +#: ../../extending/newtypes_tutorial.rst:545 msgid "" "static PyObject *\n" "Custom_getfirst(CustomObject *self, void *closure)\n" @@ -1345,7 +1343,7 @@ msgid "" "}" msgstr "" -#: ../../extending/newtypes_tutorial.rst:574 +#: ../../extending/newtypes_tutorial.rst:572 msgid "" "The getter function is passed a :class:`!Custom` object and a \"closure\", " "which is a void pointer. In this case, the closure is ignored. (The " @@ -1355,7 +1353,7 @@ msgid "" "data in the closure.)" msgstr "" -#: ../../extending/newtypes_tutorial.rst:580 +#: ../../extending/newtypes_tutorial.rst:578 msgid "" "The setter function is passed the :class:`!Custom` object, the new value, " "and the closure. The new value may be ``NULL``, in which case the attribute " @@ -1363,11 +1361,11 @@ msgid "" "deleted or if its new value is not a string." msgstr "" -#: ../../extending/newtypes_tutorial.rst:585 +#: ../../extending/newtypes_tutorial.rst:583 msgid "We create an array of :c:type:`PyGetSetDef` structures::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:587 +#: ../../extending/newtypes_tutorial.rst:585 msgid "" "static PyGetSetDef Custom_getsetters[] = {\n" " {\"first\", (getter) Custom_getfirst, (setter) Custom_setfirst,\n" @@ -1378,26 +1376,26 @@ msgid "" "};" msgstr "" -#: ../../extending/newtypes_tutorial.rst:595 +#: ../../extending/newtypes_tutorial.rst:593 msgid "and register it in the :c:member:`~PyTypeObject.tp_getset` slot::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:597 +#: ../../extending/newtypes_tutorial.rst:595 msgid ".tp_getset = Custom_getsetters," msgstr ".tp_getset = Custom_getsetters," -#: ../../extending/newtypes_tutorial.rst:599 +#: ../../extending/newtypes_tutorial.rst:597 msgid "" "The last item in a :c:type:`PyGetSetDef` structure is the \"closure\" " "mentioned above. In this case, we aren't using a closure, so we just pass " "``NULL``." msgstr "" -#: ../../extending/newtypes_tutorial.rst:602 +#: ../../extending/newtypes_tutorial.rst:600 msgid "We also remove the member definitions for these attributes::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:604 +#: ../../extending/newtypes_tutorial.rst:602 msgid "" "static PyMemberDef Custom_members[] = {\n" " {\"number\", Py_T_INT, offsetof(CustomObject, number), 0,\n" @@ -1406,13 +1404,13 @@ msgid "" "};" msgstr "" -#: ../../extending/newtypes_tutorial.rst:610 +#: ../../extending/newtypes_tutorial.rst:608 msgid "" "We also need to update the :c:member:`~PyTypeObject.tp_init` handler to only " "allow strings [#]_ to be passed::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:613 +#: ../../extending/newtypes_tutorial.rst:611 msgid "" "static int\n" "Custom_init(CustomObject *self, PyObject *args, PyObject *kwds)\n" @@ -1441,7 +1439,7 @@ msgid "" "}" msgstr "" -#: ../../extending/newtypes_tutorial.rst:639 +#: ../../extending/newtypes_tutorial.rst:637 msgid "" "With these changes, we can assure that the ``first`` and ``last`` members " "are never ``NULL`` so we can remove checks for ``NULL`` values in almost all " @@ -1451,25 +1449,25 @@ msgid "" "possibility that the initialization of these members failed in ``tp_new``." msgstr "" -#: ../../extending/newtypes_tutorial.rst:646 +#: ../../extending/newtypes_tutorial.rst:644 msgid "" "We also rename the module initialization function and module name in the " "initialization function, as we did before, and we add an extra definition to " "the :file:`setup.py` file." msgstr "" -#: ../../extending/newtypes_tutorial.rst:652 +#: ../../extending/newtypes_tutorial.rst:650 msgid "Supporting cyclic garbage collection" msgstr "" -#: ../../extending/newtypes_tutorial.rst:654 +#: ../../extending/newtypes_tutorial.rst:652 msgid "" "Python has a :term:`cyclic garbage collector (GC) ` that " "can identify unneeded objects even when their reference counts are not zero. " "This can happen when objects are involved in cycles. For example, consider:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:658 +#: ../../extending/newtypes_tutorial.rst:656 msgid "" ">>> l = []\n" ">>> l.append(l)\n" @@ -1479,7 +1477,7 @@ msgstr "" ">>> l.append(l)\n" ">>> del l" -#: ../../extending/newtypes_tutorial.rst:664 +#: ../../extending/newtypes_tutorial.rst:662 msgid "" "In this example, we create a list that contains itself. When we delete it, " "it still has a reference from itself. Its reference count doesn't drop to " @@ -1487,7 +1485,7 @@ msgid "" "out that the list is garbage and free it." msgstr "" -#: ../../extending/newtypes_tutorial.rst:669 +#: ../../extending/newtypes_tutorial.rst:667 msgid "" "In the second version of the :class:`!Custom` example, we allowed any kind " "of object to be stored in the :attr:`!first` or :attr:`!last` attributes " @@ -1496,7 +1494,7 @@ msgid "" "those two reasons, :class:`!Custom` objects can participate in cycles:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:675 +#: ../../extending/newtypes_tutorial.rst:673 msgid "" ">>> import custom3\n" ">>> class Derived(custom3.Custom): pass\n" @@ -1510,7 +1508,7 @@ msgstr "" ">>> n = Derived()\n" ">>> n.some_attribute = n" -#: ../../extending/newtypes_tutorial.rst:683 +#: ../../extending/newtypes_tutorial.rst:681 msgid "" "To allow a :class:`!Custom` instance participating in a reference cycle to " "be properly detected and collected by the cyclic GC, our :class:`!Custom` " @@ -1518,7 +1516,7 @@ msgid "" "these slots:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:687 +#: ../../extending/newtypes_tutorial.rst:685 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -1715,13 +1713,13 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:690 +#: ../../extending/newtypes_tutorial.rst:688 msgid "" "First, the traversal method lets the cyclic GC know about subobjects that " "could participate in cycles::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:693 +#: ../../extending/newtypes_tutorial.rst:691 msgid "" "static int\n" "Custom_traverse(CustomObject *self, visitproc visit, void *arg)\n" @@ -1757,7 +1755,7 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:710 +#: ../../extending/newtypes_tutorial.rst:708 msgid "" "For each subobject that can participate in cycles, we need to call the :c:" "func:`!visit` function, which is passed to the traversal method. The :c:func:" @@ -1766,14 +1764,14 @@ msgid "" "be returned if it is non-zero." msgstr "" -#: ../../extending/newtypes_tutorial.rst:716 +#: ../../extending/newtypes_tutorial.rst:714 msgid "" "Python provides a :c:func:`Py_VISIT` macro that automates calling visit " "functions. With :c:func:`Py_VISIT`, we can minimize the amount of " "boilerplate in ``Custom_traverse``::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:720 +#: ../../extending/newtypes_tutorial.rst:718 msgid "" "static int\n" "Custom_traverse(CustomObject *self, visitproc visit, void *arg)\n" @@ -1791,19 +1789,19 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:729 +#: ../../extending/newtypes_tutorial.rst:727 msgid "" "The :c:member:`~PyTypeObject.tp_traverse` implementation must name its " "arguments exactly *visit* and *arg* in order to use :c:func:`Py_VISIT`." msgstr "" -#: ../../extending/newtypes_tutorial.rst:732 +#: ../../extending/newtypes_tutorial.rst:730 msgid "" "Second, we need to provide a method for clearing any subobjects that can " "participate in cycles::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:735 +#: ../../extending/newtypes_tutorial.rst:733 msgid "" "static int\n" "Custom_clear(CustomObject *self)\n" @@ -1821,7 +1819,7 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:743 +#: ../../extending/newtypes_tutorial.rst:741 msgid "" "Notice the use of the :c:func:`Py_CLEAR` macro. It is the recommended and " "safe way to clear data attributes of arbitrary types while decrementing " @@ -1831,11 +1829,11 @@ msgid "" "again (*especially* if there is a reference cycle)." msgstr "" -#: ../../extending/newtypes_tutorial.rst:751 +#: ../../extending/newtypes_tutorial.rst:749 msgid "You could emulate :c:func:`Py_CLEAR` by writing::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:753 +#: ../../extending/newtypes_tutorial.rst:751 msgid "" "PyObject *tmp;\n" "tmp = self->first;\n" @@ -1847,14 +1845,14 @@ msgstr "" "self->first = NULL;\n" "Py_XDECREF(tmp);" -#: ../../extending/newtypes_tutorial.rst:758 +#: ../../extending/newtypes_tutorial.rst:756 msgid "" "Nevertheless, it is much easier and less error-prone to always use :c:func:" "`Py_CLEAR` when deleting an attribute. Don't try to micro-optimize at the " "expense of robustness!" msgstr "" -#: ../../extending/newtypes_tutorial.rst:762 +#: ../../extending/newtypes_tutorial.rst:760 msgid "" "The deallocator ``Custom_dealloc`` may call arbitrary code when clearing " "attributes. It means the circular GC can be triggered inside the function. " @@ -1864,7 +1862,7 @@ msgid "" "`PyObject_GC_UnTrack` and ``Custom_clear``::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:769 +#: ../../extending/newtypes_tutorial.rst:767 msgid "" "static void\n" "Custom_dealloc(CustomObject *self)\n" @@ -1882,18 +1880,18 @@ msgstr "" " Py_TYPE(self)->tp_free((PyObject *) self);\n" "}" -#: ../../extending/newtypes_tutorial.rst:777 +#: ../../extending/newtypes_tutorial.rst:775 msgid "" "Finally, we add the :c:macro:`Py_TPFLAGS_HAVE_GC` flag to the class flags::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:779 +#: ../../extending/newtypes_tutorial.rst:777 msgid "" ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC," msgstr "" ".tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC," -#: ../../extending/newtypes_tutorial.rst:781 +#: ../../extending/newtypes_tutorial.rst:779 msgid "" "That's pretty much it. If we had written custom :c:member:`~PyTypeObject." "tp_alloc` or :c:member:`~PyTypeObject.tp_free` handlers, we'd need to modify " @@ -1901,11 +1899,11 @@ msgid "" "automatically provided." msgstr "" -#: ../../extending/newtypes_tutorial.rst:787 +#: ../../extending/newtypes_tutorial.rst:785 msgid "Subclassing other types" msgstr "" -#: ../../extending/newtypes_tutorial.rst:789 +#: ../../extending/newtypes_tutorial.rst:787 msgid "" "It is possible to create new extension types that are derived from existing " "types. It is easiest to inherit from the built in types, since an extension " @@ -1913,7 +1911,7 @@ msgid "" "share these :c:type:`PyTypeObject` structures between extension modules." msgstr "" -#: ../../extending/newtypes_tutorial.rst:794 +#: ../../extending/newtypes_tutorial.rst:792 msgid "" "In this example we will create a :class:`!SubList` type that inherits from " "the built-in :class:`list` type. The new type will be completely compatible " @@ -1921,7 +1919,7 @@ msgid "" "that increases an internal counter:" msgstr "" -#: ../../extending/newtypes_tutorial.rst:799 +#: ../../extending/newtypes_tutorial.rst:797 msgid "" ">>> import sublist\n" ">>> s = sublist.SubList(range(3))\n" @@ -1943,7 +1941,7 @@ msgstr "" ">>> print(s.increment())\n" "2" -#: ../../extending/newtypes_tutorial.rst:811 +#: ../../extending/newtypes_tutorial.rst:809 msgid "" "#define PY_SSIZE_T_CLEAN\n" "#include \n" @@ -2005,10 +2003,8 @@ msgid "" " if (m == NULL)\n" " return NULL;\n" "\n" -" Py_INCREF(&SubListType);\n" -" if (PyModule_AddObject(m, \"SubList\", (PyObject *) &SubListType) < 0) " -"{\n" -" Py_DECREF(&SubListType);\n" +" if (PyModule_AddObjectRef(m, \"SubList\", (PyObject *) &SubListType) < " +"0) {\n" " Py_DECREF(m);\n" " return NULL;\n" " }\n" @@ -2017,14 +2013,14 @@ msgid "" "}\n" msgstr "" -#: ../../extending/newtypes_tutorial.rst:814 +#: ../../extending/newtypes_tutorial.rst:812 msgid "" "As you can see, the source code closely resembles the :class:`!Custom` " "examples in previous sections. We will break down the main differences " "between them. ::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:817 +#: ../../extending/newtypes_tutorial.rst:815 msgid "" "typedef struct {\n" " PyListObject list;\n" @@ -2036,21 +2032,21 @@ msgstr "" " int state;\n" "} SubListObject;" -#: ../../extending/newtypes_tutorial.rst:822 +#: ../../extending/newtypes_tutorial.rst:820 msgid "" "The primary difference for derived type objects is that the base type's " "object structure must be the first value. The base type will already " "include the :c:func:`PyObject_HEAD` at the beginning of its structure." msgstr "" -#: ../../extending/newtypes_tutorial.rst:826 +#: ../../extending/newtypes_tutorial.rst:824 msgid "" "When a Python object is a :class:`!SubList` instance, its ``PyObject *`` " "pointer can be safely cast to both ``PyListObject *`` and ``SubListObject " "*``::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:829 +#: ../../extending/newtypes_tutorial.rst:827 msgid "" "static int\n" "SubList_init(SubListObject *self, PyObject *args, PyObject *kwds)\n" @@ -2070,13 +2066,13 @@ msgstr "" " return 0;\n" "}" -#: ../../extending/newtypes_tutorial.rst:838 +#: ../../extending/newtypes_tutorial.rst:836 msgid "" "We see above how to call through to the :meth:`~object.__init__` method of " "the base type." msgstr "" -#: ../../extending/newtypes_tutorial.rst:841 +#: ../../extending/newtypes_tutorial.rst:839 msgid "" "This pattern is important when writing a type with custom :c:member:" "`~PyTypeObject.tp_new` and :c:member:`~PyTypeObject.tp_dealloc` members. " @@ -2085,7 +2081,7 @@ msgid "" "the base class handle it by calling its own :c:member:`~PyTypeObject.tp_new`." msgstr "" -#: ../../extending/newtypes_tutorial.rst:847 +#: ../../extending/newtypes_tutorial.rst:845 msgid "" "The :c:type:`PyTypeObject` struct supports a :c:member:`~PyTypeObject." "tp_base` specifying the type's concrete base class. Due to cross-platform " @@ -2094,7 +2090,8 @@ msgid "" "function::" msgstr "" -#: ../../extending/newtypes_tutorial.rst:853 +#: ../../extending/newtypes_tutorial.rst:851 +#, fuzzy msgid "" "PyMODINIT_FUNC\n" "PyInit_sublist(void)\n" @@ -2108,10 +2105,8 @@ msgid "" " if (m == NULL)\n" " return NULL;\n" "\n" -" Py_INCREF(&SubListType);\n" -" if (PyModule_AddObject(m, \"SubList\", (PyObject *) &SubListType) < 0) " -"{\n" -" Py_DECREF(&SubListType);\n" +" if (PyModule_AddObjectRef(m, \"SubList\", (PyObject *) &SubListType) < " +"0) {\n" " Py_DECREF(m);\n" " return NULL;\n" " }\n" @@ -2142,7 +2137,7 @@ msgstr "" " return m;\n" "}" -#: ../../extending/newtypes_tutorial.rst:875 +#: ../../extending/newtypes_tutorial.rst:871 msgid "" "Before calling :c:func:`PyType_Ready`, the type structure must have the :c:" "member:`~PyTypeObject.tp_base` slot filled in. When we are deriving an " @@ -2151,29 +2146,29 @@ msgid "" "from the base type will be inherited." msgstr "" -#: ../../extending/newtypes_tutorial.rst:881 +#: ../../extending/newtypes_tutorial.rst:877 msgid "" "After that, calling :c:func:`PyType_Ready` and adding the type object to the " "module is the same as with the basic :class:`!Custom` examples." msgstr "" -#: ../../extending/newtypes_tutorial.rst:886 +#: ../../extending/newtypes_tutorial.rst:882 msgid "Footnotes" msgstr "註解" -#: ../../extending/newtypes_tutorial.rst:887 +#: ../../extending/newtypes_tutorial.rst:883 msgid "" "This is true when we know that the object is a basic type, like a string or " "a float." msgstr "" -#: ../../extending/newtypes_tutorial.rst:890 +#: ../../extending/newtypes_tutorial.rst:886 msgid "" "We relied on this in the :c:member:`~PyTypeObject.tp_dealloc` handler in " "this example, because our type doesn't support garbage collection." msgstr "" -#: ../../extending/newtypes_tutorial.rst:893 +#: ../../extending/newtypes_tutorial.rst:889 msgid "" "We now know that the first and last members are strings, so perhaps we could " "be less careful about decrementing their reference counts, however, we " @@ -2183,7 +2178,7 @@ msgid "" "objects." msgstr "" -#: ../../extending/newtypes_tutorial.rst:899 +#: ../../extending/newtypes_tutorial.rst:895 msgid "" "Also, even with our attributes restricted to strings instances, the user " "could pass arbitrary :class:`str` subclasses and therefore still create " diff --git a/extending/windows.po b/extending/windows.po index 41856183ab..a85d0b62fa 100644 --- a/extending/windows.po +++ b/extending/windows.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/faq/design.po b/faq/design.po index 8a3f22dcfc..8474f7dc97 100644 --- a/faq/design.po +++ b/faq/design.po @@ -7,9 +7,9 @@ # Steven Hsu , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-08-31 11:34+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -363,7 +363,7 @@ msgstr "" "(二) 當我看到一段程式碼寫著 len(x),我\\ *知道*\\ 他要找某個東西的長度。這" "告訴了我兩件事:結果是一個整數、參數是某種容器。相對地,當我看到 x.len(),我" "必須先知道 x 是某種容器,並實作了一個介面或是繼承了一個有標準 len() 的類別。" -"遇到一個沒有實作映射 (mapping) 的類別卻有 get() 或 keys() 方法,或是不是檔案" +"遇到一個沒有實作對映 (mapping) 的類別卻有 get() 或 keys() 方法,或是不是檔案" "但卻有 write() 方法時,我們偶爾會覺得困惑。" #: ../../faq/design.rst:189 @@ -526,7 +526,7 @@ msgid "" "For cases where you need to choose from a very large number of " "possibilities, you can create a dictionary mapping case values to functions " "to call. For example::" -msgstr "如果可能性很多,你可以用字典去映射要呼叫的函式。舉例來說: ::" +msgstr "如果可能性很多,你可以用字典去對映要呼叫的函式。舉例來說: ::" #: ../../faq/design.rst:272 msgid "" diff --git a/faq/extending.po b/faq/extending.po index 8f84a4ad13..720d5e9fe3 100644 --- a/faq/extending.po +++ b/faq/extending.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-02-18 13:08+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -186,7 +186,7 @@ msgstr "" "還有一個針對 Python 物件的高級 API,它由所謂的「抽象」介面提供——閱讀 " "``Include/abstract.h`` 了解更多詳細資訊。它允許使用 :c:func:" "`PySequence_Length`、:c:func:`PySequence_GetItem` 等呼叫以及許多其他有用的協" -"議(例如數字 (:c:func:`PyNumber_Index) ` 等)和 PyMapping API 中的映射。" +"議(例如數字 (:c:func:`PyNumber_Index) ` 等)和 PyMapping API 中的對映。" #: ../../faq/extending.rst:104 msgid "How do I use Py_BuildValue() to create a tuple of arbitrary length?" @@ -467,26 +467,25 @@ msgstr "" #: ../../faq/extending.rst:249 #, fuzzy msgid "" -"Most packaged versions of Python don't include the :file:`/usr/lib/python2." -"{x}/config/` directory, which contains various files required for compiling " +"Most packaged versions of Python omit some files required for compiling " "Python extensions." msgstr "" "大多數打包版本的 Python 不包含 :file:`/usr/lib/python2.{x}/config/` 目錄,該" "目錄包含編譯 Python 擴充所需的各種檔案。" -#: ../../faq/extending.rst:253 -msgid "For Red Hat, install the python-devel RPM to get the necessary files." -msgstr "在 Red Hat 上,請安裝 python-devel RPM 來取得必要的檔案。" +#: ../../faq/extending.rst:252 +msgid "For Red Hat, install the python3-devel RPM to get the necessary files." +msgstr "在 Red Hat 上,請安裝 python3-devel RPM 來取得必要的檔案。" -#: ../../faq/extending.rst:255 -msgid "For Debian, run ``apt-get install python-dev``." -msgstr "對於 Debian,運行 ``apt-get install python-dev``。" +#: ../../faq/extending.rst:254 +msgid "For Debian, run ``apt-get install python3-dev``." +msgstr "對於 Debian,運行 ``apt-get install python3-dev``。" -#: ../../faq/extending.rst:258 +#: ../../faq/extending.rst:257 msgid "How do I tell \"incomplete input\" from \"invalid input\"?" msgstr "如何從「無效輸入」區分出「不完整輸入」?" -#: ../../faq/extending.rst:260 +#: ../../faq/extending.rst:259 #, fuzzy msgid "" "Sometimes you want to emulate the Python interactive interpreter's behavior, " @@ -499,7 +498,7 @@ msgstr "" "(例如,你鍵入了 \"if\" 陳述句的開頭或者你沒有關閉你的括號或三重字串引號)," "但是當輸入無效時,它會立即為你提供語法錯誤消息。" -#: ../../faq/extending.rst:266 +#: ../../faq/extending.rst:265 msgid "" "In Python you can use the :mod:`codeop` module, which approximates the " "parser's behavior sufficiently. IDLE uses this, for example." @@ -507,7 +506,7 @@ msgstr "" "在 Python 中,你可以使用 :mod:`codeop` 模組,它充分模擬了剖析器 (parser) 的行" "為。像是 IDLE 就有使用它。" -#: ../../faq/extending.rst:269 +#: ../../faq/extending.rst:268 #, fuzzy msgid "" "The easiest way to do it in C is to call :c:func:`PyRun_InteractiveLoop` " @@ -521,11 +520,11 @@ msgstr "" "`PyOS_ReadlineFunctionPointer` 設定為指向你的自定義輸入函式。有關更多提示,請" "參閱``Modules/readline.c`` 和``Parser/myreadline.c``。" -#: ../../faq/extending.rst:276 +#: ../../faq/extending.rst:275 msgid "How do I find undefined g++ symbols __builtin_new or __pure_virtual?" msgstr "如何找到未定義的 g++ 符號 __builtin_new 或 __pure_virtual?" -#: ../../faq/extending.rst:278 +#: ../../faq/extending.rst:277 #, fuzzy msgid "" "To dynamically load g++ extension modules, you must recompile Python, relink " @@ -536,7 +535,7 @@ msgstr "" "Python 模組 Makefile 中的 LINKCC),並使用 g++ 鏈接你的擴充模組(例如,``g++ " "-shared -o mymodule.so mymodule.o` `)。" -#: ../../faq/extending.rst:284 +#: ../../faq/extending.rst:283 #, fuzzy msgid "" "Can I create an object class with some methods implemented in C and others " @@ -545,7 +544,7 @@ msgstr "" "我可以用一些用 C 實作的方法和用 Python 實作的其他方法(例如通過繼承)建立一個" "物件類別嗎?" -#: ../../faq/extending.rst:286 +#: ../../faq/extending.rst:285 msgid "" "Yes, you can inherit from built-in classes such as :class:`int`, :class:" "`list`, :class:`dict`, etc." @@ -553,7 +552,7 @@ msgstr "" "是的,你可以繼承內建類別,例如 :class:`int`、:class:`list`、:class:`dict` " "等。" -#: ../../faq/extending.rst:289 +#: ../../faq/extending.rst:288 msgid "" "The Boost Python Library (BPL, https://www.boost.org/libs/python/doc/index." "html) provides a way of doing this from C++ (i.e. you can inherit from an " diff --git a/faq/general.po b/faq/general.po index a43f9d3e8b..ac24b2276b 100644 --- a/faq/general.po +++ b/faq/general.po @@ -8,9 +8,9 @@ # Steven Hsu , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -611,12 +611,12 @@ msgstr "" "且會保證介面在一系列的錯誤修正發布版本中維持不變。" #: ../../faq/general.rst:311 +#, fuzzy msgid "" "The latest stable releases can always be found on the `Python download page " -"`_. There are two production-ready " -"versions of Python: 2.x and 3.x. The recommended version is 3.x, which is " -"supported by most widely used libraries. Although 2.x is still widely " -"used, :pep:`it is not maintained anymore <0373>`." +"`_. Python 3.x is the recommended version " +"and supported by most widely used libraries. Python 2.x :pep:`is not " +"maintained anymore <373>`." msgstr "" "最新的穩定發布版本隨時都可以在 `Python 下載頁面 `_\\ 上找到。Python 有兩個生產就緒 (production-ready) 的版本:2.x " diff --git a/faq/gui.po b/faq/gui.po index c3f53a6d87..96851969b6 100644 --- a/faq/gui.po +++ b/faq/gui.po @@ -1,4 +1,3 @@ -# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2022, Python Software Foundation # This file is distributed under the same license as the Python package. # @@ -7,9 +6,9 @@ # Steven Hsu, 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-09-05 00:04+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-07-02 17:41+0800\n" "Last-Translator: Steven Hsu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -93,30 +92,15 @@ msgstr "" #: ../../faq/gui.rst:49 msgid "" -"To get truly stand-alone applications, the Tcl scripts that form the library " -"have to be integrated into the application as well. One tool supporting that " -"is SAM (stand-alone modules), which is part of the Tix distribution (https://" -"tix.sourceforge.net/)." +"Various third-party freeze libraries such as py2exe and cx_Freeze have " +"handling for Tkinter applications built-in." msgstr "" -"要得到真正獨立的應用程式,必須將構成函式庫的 Tcl 腳本也整合到應用程式中。一個" -"可支援該方法的工具是 SAM(stand-alone modules,獨立模組),它是 Tix 發行版的" -"一部分 (https://tix.sourceforge.net/)。" #: ../../faq/gui.rst:54 -msgid "" -"Build Tix with SAM enabled, perform the appropriate call to :c:func:`!" -"Tclsam_init`, etc. inside Python's :file:`Modules/tkappinit.c`, and link " -"with libtclsam and libtksam (you might include the Tix libraries as well)." -msgstr "" -"請在 SAM 被啟用的情況下建置 Tix,對 Python 的 :file:`Modules/tkappinit.c` 中" -"的 :c:func:`!Tclsam_init` 等函式執行適當的呼叫,並與 libtclsam 和 libtksam 連" -"結(你可能也會 include Tix 函式庫)。" - -#: ../../faq/gui.rst:61 msgid "Can I have Tk events handled while waiting for I/O?" msgstr "是否可以在等待 I/O 時處理 Tk 事件?" -#: ../../faq/gui.rst:63 +#: ../../faq/gui.rst:56 msgid "" "On platforms other than Windows, yes, and you don't even need threads! But " "you'll have to restructure your I/O code a bit. Tk has the equivalent of " @@ -130,11 +114,11 @@ msgstr "" "進行時,該函式將會從 Tk mainloop 被呼叫。請參閱\\ :ref:`tkinter-file-" "handlers`。" -#: ../../faq/gui.rst:71 +#: ../../faq/gui.rst:64 msgid "I can't get key bindings to work in Tkinter: why?" msgstr "我無法讓鍵繫結 (key binding) 在 Tkinter 中作用:為什麼?" -#: ../../faq/gui.rst:73 +#: ../../faq/gui.rst:66 msgid "" "An often-heard complaint is that event handlers :ref:`bound ` to events with the :meth:`!bind` method don't get handled even when " @@ -144,7 +128,7 @@ msgstr "" "`\\ 到帶有 :meth:`!bind` method 的事件,但在按下相應的鍵" "時,該事件也沒有被處理。" -#: ../../faq/gui.rst:77 +#: ../../faq/gui.rst:70 msgid "" "The most common cause is that the widget to which the binding applies " "doesn't have \"keyboard focus\". Check out the Tk documentation for the " diff --git a/faq/index.po b/faq/index.po index 2d73109e45..37bec95316 100644 --- a/faq/index.po +++ b/faq/index.po @@ -6,7 +6,7 @@ # Adrian Liaw , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/faq/installed.po b/faq/installed.po index 557def12ef..260bb53d3c 100644 --- a/faq/installed.po +++ b/faq/installed.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-24 00:11+0000\n" "PO-Revision-Date: 2021-12-09 21:50+0800\n" diff --git a/faq/library.po b/faq/library.po index 8a15890b33..3a9a9e0094 100644 --- a/faq/library.po +++ b/faq/library.po @@ -6,9 +6,9 @@ # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-02-18 13:22+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -716,7 +716,7 @@ msgstr "" msgid "Can't we get rid of the Global Interpreter Lock?" msgstr "不能擺脫全局直譯器鎖嗎?" -#: ../../faq/library.rst:410 +#: ../../faq/library.rst:408 #, fuzzy msgid "" "The :term:`global interpreter lock` (GIL) is often seen as a hindrance to " @@ -728,17 +728,32 @@ msgstr "" "機器上部署的障礙,因為多執行緒 Python 程式實際上只使用一個 CPU,因為堅持(幾" "乎)所有 Python 程式碼只能在持有 GIL 的情況下運行。" -#: ../../faq/library.rst:415 +#: ../../faq/library.rst:413 +msgid "" +"With the approval of :pep:`703` work is now underway to remove the GIL from " +"the CPython implementation of Python. Initially it will be implemented as " +"an optional compiler flag when building the interpreter, and so separate " +"builds will be available with and without the GIL. Long-term, the hope is " +"to settle on a single build, once the performance implications of removing " +"the GIL are fully understood. Python 3.13 is likely to be the first release " +"containing this work, although it may not be completely functional in this " +"release." +msgstr "" + +#: ../../faq/library.rst:422 #, fuzzy msgid "" -"Back in the days of Python 1.5, Greg Stein actually implemented a " +"The current work to remove the GIL is based on a `fork of Python 3.9 with " +"the GIL removed `_ by Sam Gross. Prior " +"to that, in the days of Python 1.5, Greg Stein actually implemented a " "comprehensive patch set (the \"free threading\" patches) that removed the " -"GIL and replaced it with fine-grained locking. Adam Olsen recently did a " -"similar experiment in his `python-safethread `_ project. Unfortunately, both experiments " -"exhibited a sharp drop in single-thread performance (at least 30% slower), " -"due to the amount of fine-grained locking necessary to compensate for the " -"removal of the GIL." +"GIL and replaced it with fine-grained locking. Adam Olsen did a similar " +"experiment in his `python-safethread `_ project. Unfortunately, both of these earlier " +"experiments exhibited a sharp drop in single-thread performance (at least " +"30% slower), due to the amount of fine-grained locking necessary to " +"compensate for the removal of the GIL. The Python 3.9 fork is the first " +"attempt at removing the GIL with an acceptable performance impact." msgstr "" "回到 Python 1.5 時代,Greg Stein 實際上實作了一個全面的補丁集( \"自由執行緒" "\" 補丁),刪除了 GIL 並用細粒度鎖定取而代之。 Adam Olsen 最近在他的 `python-" @@ -746,16 +761,16 @@ msgstr "" "一個類似的實驗。不幸的是,這兩個實驗都表現出單執行緒性能的急劇下降(至少慢了 " "30%),這是由於需要大量的細粒度鎖定來補償 GIL 的移除。" -#: ../../faq/library.rst:423 +#: ../../faq/library.rst:437 #, fuzzy msgid "" -"This doesn't mean that you can't make good use of Python on multi-CPU " -"machines! You just have to be creative with dividing the work up between " -"multiple *processes* rather than multiple *threads*. The :class:" -"`~concurrent.futures.ProcessPoolExecutor` class in the new :mod:`concurrent." -"futures` module provides an easy way of doing so; the :mod:`multiprocessing` " -"module provides a lower-level API in case you want more control over " -"dispatching of tasks." +"The presence of the GIL in current Python releases doesn't mean that you " +"can't make good use of Python on multi-CPU machines! You just have to be " +"creative with dividing the work up between multiple *processes* rather than " +"multiple *threads*. The :class:`~concurrent.futures.ProcessPoolExecutor` " +"class in the new :mod:`concurrent.futures` module provides an easy way of " +"doing so; the :mod:`multiprocessing` module provides a lower-level API in " +"case you want more control over dispatching of tasks." msgstr "" "這並不意味著你不能在多 CPU 機器上用好 Python!你只需要創造性地將工作分配給多" "個*行程*而​​不是多個*執行緒*。新的 :mod:`concurrent.futures` 模組中的 :class:" @@ -763,7 +778,7 @@ msgstr "" "`multiprocessing` 模組提供了一個較低階別的 API,以防你希望更好地控制任務的調" "度。" -#: ../../faq/library.rst:431 +#: ../../faq/library.rst:446 #, fuzzy msgid "" "Judicious use of C extensions will also help; if you use a C extension to " @@ -776,53 +791,26 @@ msgstr "" "在執行執行緒在 C 程式碼中時釋放 GIL,並允許其他執行緒完成一些工作。一些標準函" "式庫模組,例如 :mod:`zlib` 和 :mod:`hashlib` 已經這樣做了。" -#: ../../faq/library.rst:437 -#, fuzzy -msgid "" -"It has been suggested that the GIL should be a per-interpreter-state lock " -"rather than truly global; interpreters then wouldn't be able to share " -"objects. Unfortunately, this isn't likely to happen either. It would be a " -"tremendous amount of work, because many object implementations currently " -"have global state. For example, small integers and short strings are cached; " -"these caches would have to be moved to the interpreter state. Other object " -"types have their own free list; these free lists would have to be moved to " -"the interpreter state. And so on." -msgstr "" -"有人建議 GIL 應該是每個直譯器狀態鎖,而不是真正的全局鎖;口譯員將無法共享物" -"件。不幸的是,這也不太可能發生。這將是一項巨大的工作量,因為目前許多物件實作" -"都具有全局狀態。例如,快取小整數和短字串;這些快取必須移至直譯器狀態。其他物" -"件型別有自己的空閒列表;這些空閒列表必須移至直譯器狀態。等等。" - -#: ../../faq/library.rst:446 -#, fuzzy -msgid "" -"And I doubt that it can even be done in finite time, because the same " -"problem exists for 3rd party extensions. It is likely that 3rd party " -"extensions are being written at a faster rate than you can convert them to " -"store all their global state in the interpreter state." -msgstr "" -"而且我懷疑它甚至可以在有限的時間內完成,因為第 3 方擴充存在同樣的問題。 3rd " -"方擴充的編寫速度可能比你轉換它們以將其所有全局狀態存儲在直譯器狀態中的速度更" -"快。" - -#: ../../faq/library.rst:451 -#, fuzzy +#: ../../faq/library.rst:452 msgid "" -"And finally, once you have multiple interpreters not sharing any state, what " -"have you gained over running each interpreter in a separate process?" +"An alternative approach to reducing the impact of the GIL is to make the GIL " +"a per-interpreter-state lock rather than truly global. This was :ref:`first " +"implemented in Python 3.12 ` and is available in the C " +"API. A Python interface to it is expected in Python 3.13. The main " +"limitation to it at the moment is likely to be 3rd party extension modules, " +"since these must be written with multiple interpreters in mind in order to " +"be usable, so many older extension modules will not be usable." msgstr "" -"最後,如果你有多個不共享任何狀態的直譯器,那麼在單獨的行程中運行每個直譯器有" -"什麼好處呢?" -#: ../../faq/library.rst:456 +#: ../../faq/library.rst:462 msgid "Input and Output" msgstr "輸入與輸出" -#: ../../faq/library.rst:459 +#: ../../faq/library.rst:465 msgid "How do I delete a file? (And other file questions...)" msgstr "如何刪除檔案?(以及其他檔案問題...)" -#: ../../faq/library.rst:461 +#: ../../faq/library.rst:467 #, fuzzy msgid "" "Use ``os.remove(filename)`` or ``os.unlink(filename)``; for documentation, " @@ -833,7 +821,7 @@ msgstr "" "mod:`os` 模組。這兩個功能是相同的; :func:`~os.unlink` 只是這個函式的 Unix 系" "統呼叫的名稱。" -#: ../../faq/library.rst:465 +#: ../../faq/library.rst:471 #, fuzzy msgid "" "To remove a directory, use :func:`os.rmdir`; use :func:`os.mkdir` to create " @@ -847,11 +835,11 @@ msgstr "" "removedirs(path)`` 將刪除中間目錄,只要它們是空的;如果要刪除整個目錄樹及其內" "容,請使用 :func:`shutil.rmtree`。" -#: ../../faq/library.rst:471 +#: ../../faq/library.rst:477 msgid "To rename a file, use ``os.rename(old_path, new_path)``." msgstr "要重新命名檔案,請使用 ``os.rename(old_path, new_path)``。" -#: ../../faq/library.rst:473 +#: ../../faq/library.rst:479 #, fuzzy msgid "" "To truncate a file, open it using ``f = open(filename, \"rb+\")``, and use " @@ -864,7 +852,7 @@ msgstr "" "檔案,還有 ``os.ftruncate(fd, offset)``,其中 *fd* 是檔案描述器(一個小整" "數)。" -#: ../../faq/library.rst:478 +#: ../../faq/library.rst:484 #, fuzzy msgid "" "The :mod:`shutil` module also contains a number of functions to work on " @@ -874,11 +862,11 @@ msgstr "" ":mod:`shutil` 模組還包含許多用於處理檔案的函式,包括:func:`~shutil." "copyfile`、:func:`~shutil.copytree` 和:func:`~shutil.rmtree`。" -#: ../../faq/library.rst:484 +#: ../../faq/library.rst:490 msgid "How do I copy a file?" msgstr "如何複製檔案?" -#: ../../faq/library.rst:486 +#: ../../faq/library.rst:492 #, fuzzy msgid "" "The :mod:`shutil` module contains a :func:`~shutil.copyfile` function. Note " @@ -896,11 +884,11 @@ msgstr "" "使用。它也不會複製檔案權限和元資料,儘管使用 :func:`shutil.copy2` 會保留其中" "的大部分(儘管不是全部)。" -#: ../../faq/library.rst:497 +#: ../../faq/library.rst:503 msgid "How do I read (or write) binary data?" msgstr "如何讀取(或寫入)二進位制資料?" -#: ../../faq/library.rst:499 +#: ../../faq/library.rst:505 #, fuzzy msgid "" "To read or write complex binary data formats, it's best to use the :mod:" @@ -910,7 +898,7 @@ msgstr "" "要讀取或寫入複雜的二進制資料格式,最好使用 :mod:`struct` 模組。它允許你獲取包" "含二進制資料(通常是數字)的字串並將其轉換為 Python 物件;反之亦然。" -#: ../../faq/library.rst:503 +#: ../../faq/library.rst:509 #, fuzzy msgid "" "For example, the following code reads two 2-byte integers and one 4-byte " @@ -919,7 +907,7 @@ msgstr "" "例如,以下程式碼從一個檔案中以大端格式讀取兩個 2 位元組整數和一個 4 位元組整" "數: ::" -#: ../../faq/library.rst:506 +#: ../../faq/library.rst:512 msgid "" "import struct\n" "\n" @@ -933,7 +921,7 @@ msgstr "" " s = f.read(8)\n" " x, y, z = struct.unpack(\">hhl\", s)" -#: ../../faq/library.rst:512 +#: ../../faq/library.rst:518 #, fuzzy msgid "" "The '>' in the format string forces big-endian data; the letter 'h' reads " @@ -943,7 +931,7 @@ msgstr "" "格式字串中的 \">\" 強制使用大端資料;字母 'h' 讀取一個 \"短整數\" (2 位元" "組), 'l' 從字串中讀取一個 \"長整數\" (4 位元組)。" -#: ../../faq/library.rst:516 +#: ../../faq/library.rst:522 #, fuzzy msgid "" "For data that is more regular (e.g. a homogeneous list of ints or floats), " @@ -952,7 +940,7 @@ msgstr "" "對於更規則的資料(例如,整數或浮點數的同類列表),你還可以使用 :mod:`array` " "模組。" -#: ../../faq/library.rst:521 +#: ../../faq/library.rst:527 #, fuzzy msgid "" "To read and write binary data, it is mandatory to open the file in binary " @@ -964,12 +952,12 @@ msgstr "" "給 :func:`open`)。如果你改用 ``\"r\"``(預設設定),檔案將以文本模式打開,並" "且 ``f.read()`` 將回傳 str 物件而不是 bytes ` 物件。" -#: ../../faq/library.rst:529 +#: ../../faq/library.rst:535 #, fuzzy msgid "I can't seem to use os.read() on a pipe created with os.popen(); why?" msgstr "我似乎無法在用 os.popen() 建立的管道上使用 os.read();為什麼?" -#: ../../faq/library.rst:531 +#: ../../faq/library.rst:537 #, fuzzy msgid "" ":func:`os.read` is a low-level function which takes a file descriptor, a " @@ -983,38 +971,38 @@ msgstr "" "型別相同。因此,要從使用 :func:`os.popen` 建立的管道 *p* 中讀取 *n* 個位元" "組,你需要使用 ``p.read(n)``。" -#: ../../faq/library.rst:617 +#: ../../faq/library.rst:623 msgid "How do I access the serial (RS232) port?" msgstr "如何存取序列 (RS232) 連接埠?" -#: ../../faq/library.rst:619 +#: ../../faq/library.rst:625 msgid "For Win32, OSX, Linux, BSD, Jython, IronPython:" msgstr "對於 Win32、OSX、Linux、BSD、Jython、IronPython:" -#: ../../faq/library.rst:621 +#: ../../faq/library.rst:627 msgid ":pypi:`pyserial`" msgstr ":pypi:`pyserial`" -#: ../../faq/library.rst:623 +#: ../../faq/library.rst:629 msgid "For Unix, see a Usenet post by Mitch Chapman:" msgstr "對於 Unix,請參閱 Mitch Chapman 的 Usenet 貼文:" -#: ../../faq/library.rst:625 +#: ../../faq/library.rst:631 msgid "https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com" msgstr "https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com" -#: ../../faq/library.rst:629 +#: ../../faq/library.rst:635 msgid "Why doesn't closing sys.stdout (stdin, stderr) really close it?" msgstr "為什麼關閉 sys.stdout (stdin, stderr) 並沒有真正關閉它?" -#: ../../faq/library.rst:631 +#: ../../faq/library.rst:637 msgid "" "Python :term:`file objects ` are a high-level layer of " "abstraction on low-level C file descriptors." msgstr "" "Python :term:`檔案物件 `\\ 是低階 C 檔案描述器的高階抽象層。" -#: ../../faq/library.rst:634 +#: ../../faq/library.rst:640 #, fuzzy msgid "" "For most file objects you create in Python via the built-in :func:`open` " @@ -1027,7 +1015,7 @@ msgstr "" "close()`` 從 Python 的角度將 Python 檔案物件標記為已關閉,並安排關閉底層 C 檔" "案描述器。當 ``f`` 變成垃圾時,這也會自動發生在 ``f`` 的析構函式中。" -#: ../../faq/library.rst:640 +#: ../../faq/library.rst:646 #, fuzzy msgid "" "But stdin, stdout and stderr are treated specially by Python, because of the " @@ -1039,7 +1027,7 @@ msgstr "" "態。運行 ``sys.stdout.close()`` 將 Python 級檔案物件標記為已關閉,但是 * " "not* 關閉關聯的 C 檔案描述器。" -#: ../../faq/library.rst:645 +#: ../../faq/library.rst:651 #, fuzzy msgid "" "To close the underlying C file descriptor for one of these three, you should " @@ -1049,7 +1037,7 @@ msgstr "" "要關閉這三個之一的底層 C 檔案描述器,你應該首先確定這是你真正想要做的(例如," "你可能會混淆試圖執行 I/O 的擴充模組)。如果是,使用 :func:`os.close`: ::" -#: ../../faq/library.rst:649 +#: ../../faq/library.rst:655 msgid "" "os.close(stdin.fileno())\n" "os.close(stdout.fileno())\n" @@ -1059,19 +1047,19 @@ msgstr "" "os.close(stdout.fileno())\n" "os.close(stderr.fileno())" -#: ../../faq/library.rst:653 +#: ../../faq/library.rst:659 msgid "Or you can use the numeric constants 0, 1 and 2, respectively." msgstr "或者你可以分別使用數字常數 0、1 和 2。" -#: ../../faq/library.rst:657 +#: ../../faq/library.rst:663 msgid "Network/Internet Programming" msgstr "網路 (Network)/網際網路 (Internet) 程式" -#: ../../faq/library.rst:660 +#: ../../faq/library.rst:666 msgid "What WWW tools are there for Python?" msgstr "Python 有哪些 WWW 工具?" -#: ../../faq/library.rst:662 +#: ../../faq/library.rst:668 #, fuzzy msgid "" "See the chapters titled :ref:`internet` and :ref:`netdata` in the Library " @@ -1081,7 +1069,7 @@ msgstr "" "請參閱函式庫參考手冊中標題為 :ref:`internet` 和 :ref:`netdata` 的章節。 " "Python 有許多模組可以幫助你構建伺服器端和用戶端 Web 系統。" -#: ../../faq/library.rst:668 +#: ../../faq/library.rst:674 #, fuzzy msgid "" "A summary of available frameworks is maintained by Paul Boddie at https://" @@ -1090,78 +1078,11 @@ msgstr "" "可用框架的摘要由 Paul Boddie 在 https://wiki.python.org/moin/" "WebProgramming\\ 維護。" -#: ../../faq/library.rst:671 -#, fuzzy -msgid "" -"Cameron Laird maintains a useful set of pages about Python web technologies " -"at https://web.archive.org/web/20210224183619/http://phaseit.net/claird/comp." -"lang.python/web_python." -msgstr "" -"Cameron Laird 在 https://web.archive.org/web/20210224183619/http://phaseit." -"net/claird/comp.lang.python/web_python 維護著一組有用的關於 Python 網路技術的" -"頁面。" - -#: ../../faq/library.rst:676 -msgid "How can I mimic CGI form submission (METHOD=POST)?" -msgstr "如何模擬 CGI 表單送出 (submission) (METHOD=POST)?" - -#: ../../faq/library.rst:678 -#, fuzzy -msgid "" -"I would like to retrieve web pages that are the result of POSTing a form. Is " -"there existing code that would let me do this easily?" -msgstr "" -"我想檢索作為發布表單結果的網頁。是否有現成的程式碼可以讓我輕鬆地做到這一點?" - -#: ../../faq/library.rst:681 -msgid "Yes. Here's a simple example that uses :mod:`urllib.request`::" -msgstr "是的,這是一個 :mod:`urllib.request` 的簡單範例: ::" - -#: ../../faq/library.rst:683 -msgid "" -"#!/usr/local/bin/python\n" -"\n" -"import urllib.request\n" -"\n" -"# build the query string\n" -"qs = \"First=Josephine&MI=Q&Last=Public\"\n" -"\n" -"# connect and send the server a path\n" -"req = urllib.request.urlopen('http://www.some-server.out-there'\n" -" '/cgi-bin/some-cgi-script', data=qs)\n" -"with req:\n" -" msg, hdrs = req.read(), req.info()" -msgstr "" - -#: ../../faq/library.rst:696 -#, fuzzy -msgid "" -"Note that in general for percent-encoded POST operations, query strings must " -"be quoted using :func:`urllib.parse.urlencode`. For example, to send " -"``name=Guy Steele, Jr.``::" -msgstr "" -"請注意,通常對於百分比編碼的 POST 操作,查詢字串必須使用 :func:`urllib.parse." -"urlencode` 引用。例如,發送 ``name=Guy Steele, Jr.``: ::" - -#: ../../faq/library.rst:700 -msgid "" -">>> import urllib.parse\n" -">>> urllib.parse.urlencode({'name': 'Guy Steele, Jr.'})\n" -"'name=Guy+Steele%2C+Jr.'" -msgstr "" -">>> import urllib.parse\n" -">>> urllib.parse.urlencode({'name': 'Guy Steele, Jr.'})\n" -"'name=Guy+Steele%2C+Jr.'" - -#: ../../faq/library.rst:704 -msgid ":ref:`urllib-howto` for extensive examples." -msgstr ":ref:`urllib-howto` 內有大量範例。" - -#: ../../faq/library.rst:708 +#: ../../faq/library.rst:679 msgid "What module should I use to help with generating HTML?" msgstr "我應該使用什麼模組來輔助產生 HTML?" -#: ../../faq/library.rst:712 +#: ../../faq/library.rst:683 #, fuzzy msgid "" "You can find a collection of useful links on the `Web Programming wiki page " @@ -1170,15 +1091,15 @@ msgstr "" "你可以在 \"Web 編寫程式維基頁面 \" 上找到一組有用的鏈接。" -#: ../../faq/library.rst:717 +#: ../../faq/library.rst:688 msgid "How do I send mail from a Python script?" msgstr "如何從 Python 腳本發送郵件?" -#: ../../faq/library.rst:719 +#: ../../faq/library.rst:690 msgid "Use the standard library module :mod:`smtplib`." msgstr "使用標準函式庫模組 :mod:`smtplib`。" -#: ../../faq/library.rst:721 +#: ../../faq/library.rst:692 #, fuzzy msgid "" "Here's a very simple interactive mail sender that uses it. This method will " @@ -1187,7 +1108,7 @@ msgstr "" "這是一個使用它的非常簡單的交互式郵件發件人。此方法適用於任何支援 SMTP 偵聽器" "的主機。: ::" -#: ../../faq/library.rst:724 +#: ../../faq/library.rst:695 msgid "" "import sys, smtplib\n" "\n" @@ -1207,7 +1128,7 @@ msgid "" "server.quit()" msgstr "" -#: ../../faq/library.rst:741 +#: ../../faq/library.rst:712 #, fuzzy msgid "" "A Unix-only alternative uses sendmail. The location of the sendmail program " @@ -1219,7 +1140,7 @@ msgstr "" "時是 \"/usr/lib/sendmail\" ,有時是 \"/usr/sbin/sendmail\" 。 sendmail 手冊頁" "將幫助你。這是一些示例程式碼: ::" -#: ../../faq/library.rst:746 +#: ../../faq/library.rst:717 msgid "" "import os\n" "\n" @@ -1235,18 +1156,18 @@ msgid "" " print(\"Sendmail exit status\", sts)" msgstr "" -#: ../../faq/library.rst:761 +#: ../../faq/library.rst:732 #, fuzzy msgid "How do I avoid blocking in the connect() method of a socket?" msgstr "如何避免阻塞 socket 的 connect() 方法?" -#: ../../faq/library.rst:763 +#: ../../faq/library.rst:734 msgid "" "The :mod:`select` module is commonly used to help with asynchronous I/O on " "sockets." msgstr ":mod:`select` 模組通常用於幫助處理 socket 上的非同步 I/O。" -#: ../../faq/library.rst:766 +#: ../../faq/library.rst:737 #, fuzzy msgid "" "To prevent the TCP connect from blocking, you can set the socket to non-" @@ -1262,7 +1183,7 @@ msgstr "" "誤號 ``.errno``。 ``errno.EINPROGRESS`` 表示連接正在進行中,但尚未完成。不同" "的作業系統將回傳不同的值,因此你將不得不檢查系統回傳的內容。" -#: ../../faq/library.rst:774 +#: ../../faq/library.rst:745 #, fuzzy msgid "" "You can use the :meth:`~socket.socket.connect_ex` method to avoid creating " @@ -1276,7 +1197,7 @@ msgstr "" "EISCONN`` 表示你已連接 - 或者你可以將此 socket 傳遞給 :meth:`select.select` " "檢查它是否可寫。" -#: ../../faq/library.rst:782 +#: ../../faq/library.rst:753 msgid "" "The :mod:`asyncio` module provides a general purpose single-threaded and " "concurrent asynchronous library, which can be used for writing non-blocking " @@ -1287,19 +1208,19 @@ msgstr "" "網路程式碼。第三方 `Twisted `_ 函式庫是一種流行且功能豐" "富的替代方案。" -#: ../../faq/library.rst:790 +#: ../../faq/library.rst:761 msgid "Databases" msgstr "資料庫" -#: ../../faq/library.rst:793 +#: ../../faq/library.rst:764 msgid "Are there any interfaces to database packages in Python?" msgstr "Python 中是否有任何資料庫套件的介面?" -#: ../../faq/library.rst:795 +#: ../../faq/library.rst:766 msgid "Yes." msgstr "有的。" -#: ../../faq/library.rst:797 +#: ../../faq/library.rst:768 #, fuzzy msgid "" "Interfaces to disk-based hashes such as :mod:`DBM ` and :mod:`GDBM " @@ -1311,22 +1232,22 @@ msgstr "" "含在標準 Python 中。還有 :mod:`sqlite3` 模組,它提供了一個輕量級的基於磁盤的" "關係資料庫。" -#: ../../faq/library.rst:802 +#: ../../faq/library.rst:773 #, fuzzy msgid "" "Support for most relational databases is available. See the " "`DatabaseProgramming wiki page `_ for details." msgstr "" -"支援大多數關係資料庫。有關詳細資訊,請參閱`DatabaseProgramming 維基頁面 " +"支援大多數關係資料庫。有關詳細資訊,請參閱 `DatabaseProgramming 維基頁面 " "`_。" -#: ../../faq/library.rst:808 +#: ../../faq/library.rst:779 #, fuzzy msgid "How do you implement persistent objects in Python?" msgstr "你如何在 Python 中實作持久物件?" -#: ../../faq/library.rst:810 +#: ../../faq/library.rst:781 #, fuzzy msgid "" "The :mod:`pickle` library module solves this in a very general way (though " @@ -1334,25 +1255,25 @@ msgid "" "mod:`shelve` library module uses pickle and (g)dbm to create persistent " "mappings containing arbitrary Python objects." msgstr "" -":mod:`pickle` 庫模組以一種非常通用的方式解決了這個問題(儘管你仍然不能存儲諸" -"如打開的檔案、socket 或窗口之類的東西),而 :mod:`shelve` 庫模組使用 pickle " -"和 (g) dbm 建立包含任意 Python 物件的持久映射。" +":mod:`pickle` 函式庫模組以一種非常通用的方式解決了這個問題(儘管你仍然不能存" +"儲諸如打開的檔案、socket 或窗口之類的東西),而 :mod:`shelve` 函式庫模組使用 " +"pickle 和 (g) dbm 建立包含任意 Python 物件的持久對映。" -#: ../../faq/library.rst:817 +#: ../../faq/library.rst:788 msgid "Mathematics and Numerics" msgstr "數學和數值" -#: ../../faq/library.rst:820 +#: ../../faq/library.rst:791 msgid "How do I generate random numbers in Python?" msgstr "如何在 Python 中生成隨機數?" -#: ../../faq/library.rst:822 +#: ../../faq/library.rst:793 msgid "" "The standard module :mod:`random` implements a random number generator. " "Usage is simple::" msgstr "標準模組 :mod:`random` 實作了一個隨機數生成器。用法很簡單: ::" -#: ../../faq/library.rst:825 +#: ../../faq/library.rst:796 msgid "" "import random\n" "random.random()" @@ -1360,43 +1281,123 @@ msgstr "" "import random\n" "random.random()" -#: ../../faq/library.rst:828 +#: ../../faq/library.rst:799 msgid "This returns a random floating-point number in the range [0, 1)." msgstr "這將回傳 [0, 1) 範圍內的隨機浮點數。" -#: ../../faq/library.rst:830 +#: ../../faq/library.rst:801 msgid "" "There are also many other specialized generators in this module, such as:" msgstr "該模組中還有許多其他專用生成器,例如:" -#: ../../faq/library.rst:832 +#: ../../faq/library.rst:803 msgid "``randrange(a, b)`` chooses an integer in the range [a, b)." msgstr "``randrange(a, b)`` 會選擇 [a, b) 範圍內的一個整數。" -#: ../../faq/library.rst:833 +#: ../../faq/library.rst:804 msgid "``uniform(a, b)`` chooses a floating-point number in the range [a, b)." msgstr "``uniform(a, b)`` 會選擇 [a, b) 範圍內的浮點數。" -#: ../../faq/library.rst:834 +#: ../../faq/library.rst:805 msgid "" "``normalvariate(mean, sdev)`` samples the normal (Gaussian) distribution." msgstr "``normalvariate(mean, sdev)`` 對常態(高斯)分佈進行採樣 (sample)。" -#: ../../faq/library.rst:836 +#: ../../faq/library.rst:807 msgid "Some higher-level functions operate on sequences directly, such as:" msgstr "一些更高階的函式會直接對序列進行操作,例如:" -#: ../../faq/library.rst:838 +#: ../../faq/library.rst:809 msgid "``choice(S)`` chooses a random element from a given sequence." msgstr "``choice(S)`` 會從給定序列中選擇一個隨機元素。" -#: ../../faq/library.rst:839 +#: ../../faq/library.rst:810 msgid "``shuffle(L)`` shuffles a list in-place, i.e. permutes it randomly." msgstr "``shuffle(L)`` 會原地 (in-place) 打亂 list,即隨機排列它。" -#: ../../faq/library.rst:841 +#: ../../faq/library.rst:812 msgid "" "There's also a ``Random`` class you can instantiate to create independent " "multiple random number generators." msgstr "" "還有一個 ``Random`` 類別,你可以將它實例化以建立多個獨立的隨機數生成器。" + +#, fuzzy +#~ msgid "" +#~ "It has been suggested that the GIL should be a per-interpreter-state lock " +#~ "rather than truly global; interpreters then wouldn't be able to share " +#~ "objects. Unfortunately, this isn't likely to happen either. It would be " +#~ "a tremendous amount of work, because many object implementations " +#~ "currently have global state. For example, small integers and short " +#~ "strings are cached; these caches would have to be moved to the " +#~ "interpreter state. Other object types have their own free list; these " +#~ "free lists would have to be moved to the interpreter state. And so on." +#~ msgstr "" +#~ "有人建議 GIL 應該是每個直譯器狀態鎖,而不是真正的全局鎖;口譯員將無法共享" +#~ "物件。不幸的是,這也不太可能發生。這將是一項巨大的工作量,因為目前許多物件" +#~ "實作都具有全局狀態。例如,快取小整數和短字串;這些快取必須移至直譯器狀態。" +#~ "其他物件型別有自己的空閒列表;這些空閒列表必須移至直譯器狀態。等等。" + +#, fuzzy +#~ msgid "" +#~ "And I doubt that it can even be done in finite time, because the same " +#~ "problem exists for 3rd party extensions. It is likely that 3rd party " +#~ "extensions are being written at a faster rate than you can convert them " +#~ "to store all their global state in the interpreter state." +#~ msgstr "" +#~ "而且我懷疑它甚至可以在有限的時間內完成,因為第 3 方擴充存在同樣的問題。 " +#~ "3rd 方擴充的編寫速度可能比你轉換它們以將其所有全局狀態存儲在直譯器狀態中的" +#~ "速度更快。" + +#, fuzzy +#~ msgid "" +#~ "And finally, once you have multiple interpreters not sharing any state, " +#~ "what have you gained over running each interpreter in a separate process?" +#~ msgstr "" +#~ "最後,如果你有多個不共享任何狀態的直譯器,那麼在單獨的行程中運行每個直譯器" +#~ "有什麼好處呢?" + +#, fuzzy +#~ msgid "" +#~ "Cameron Laird maintains a useful set of pages about Python web " +#~ "technologies at https://web.archive.org/web/20210224183619/http://phaseit." +#~ "net/claird/comp.lang.python/web_python." +#~ msgstr "" +#~ "Cameron Laird 在 https://web.archive.org/web/20210224183619/http://" +#~ "phaseit.net/claird/comp.lang.python/web_python 維護著一組有用的關於 " +#~ "Python 網路技術的頁面。" + +#~ msgid "How can I mimic CGI form submission (METHOD=POST)?" +#~ msgstr "如何模擬 CGI 表單送出 (submission) (METHOD=POST)?" + +#, fuzzy +#~ msgid "" +#~ "I would like to retrieve web pages that are the result of POSTing a form. " +#~ "Is there existing code that would let me do this easily?" +#~ msgstr "" +#~ "我想檢索作為發布表單結果的網頁。是否有現成的程式碼可以讓我輕鬆地做到這一" +#~ "點?" + +#~ msgid "Yes. Here's a simple example that uses :mod:`urllib.request`::" +#~ msgstr "是的,這是一個 :mod:`urllib.request` 的簡單範例: ::" + +#, fuzzy +#~ msgid "" +#~ "Note that in general for percent-encoded POST operations, query strings " +#~ "must be quoted using :func:`urllib.parse.urlencode`. For example, to " +#~ "send ``name=Guy Steele, Jr.``::" +#~ msgstr "" +#~ "請注意,通常對於百分比編碼的 POST 操作,查詢字串必須使用 :func:`urllib." +#~ "parse.urlencode` 引用。例如,發送 ``name=Guy Steele, Jr.``: ::" + +#~ msgid "" +#~ ">>> import urllib.parse\n" +#~ ">>> urllib.parse.urlencode({'name': 'Guy Steele, Jr.'})\n" +#~ "'name=Guy+Steele%2C+Jr.'" +#~ msgstr "" +#~ ">>> import urllib.parse\n" +#~ ">>> urllib.parse.urlencode({'name': 'Guy Steele, Jr.'})\n" +#~ "'name=Guy+Steele%2C+Jr.'" + +#~ msgid ":ref:`urllib-howto` for extensive examples." +#~ msgstr ":ref:`urllib-howto` 內有大量範例。" diff --git a/faq/programming.po b/faq/programming.po index c7022e1471..3a4d4abfe8 100644 --- a/faq/programming.po +++ b/faq/programming.po @@ -7,9 +7,9 @@ # hsiao yi , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-04-25 14:17+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -351,14 +351,14 @@ msgstr "" msgid "" "Why do lambdas defined in a loop with different values all return the same " "result?" -msgstr "為什麼在具有不同值的循環中定義的 lambda 都回傳相同的結果?" +msgstr "為什麼在具有不同值的迴圈中定義的 lambda 都回傳相同的結果?" #: ../../faq/programming.rst:210 msgid "" "Assume you use a for loop to define a few different lambdas (or even plain " "functions), e.g.::" msgstr "" -"假設你使用 for 循環來定義幾個不同的 lambda(甚至是普通函式),例如: ::" +"假設你使用 for 迴圈來定義幾個不同的 lambda(甚至是普通函式),例如: ::" #: ../../faq/programming.rst:213 msgid "" @@ -404,7 +404,7 @@ msgid "" "changing the value of ``x`` and see how the results of the lambdas change::" msgstr "" "發生這種情況是因為 ``x`` 不是 lambda 的局部變數,而是在外部作用域中定義的,並" -"且在呼叫 lambda 時存取它——而不是在定義時存取它。在循環結束時,``x`` 的值為 " +"且在呼叫 lambda 時存取它——而不是在定義時存取它。在迴圈結束時,``x`` 的值為 " "``4``,因此所有函式現在都回傳 ``4**2``,即 ``16``。你還可以透過更改 ``x`` 的" "值來驗證這一點,並查看 lambda 運算式的結果如何變化: ::" @@ -447,7 +447,7 @@ msgid "" "Therefore each lambda will now return the correct result::" msgstr "" "在這裡,``n=x`` 建立了一個新變數 ``n`` 局部於 lambda 並在定義 lambda 時計算," -"因此它具有與 ``x`` 在循環中的那個點相同的值。這意味著 ``n`` 的值在第一個 " +"因此它具有與 ``x`` 在迴圈中的那個點相同的值。這意味著 ``n`` 的值在第一個 " "lambda 中為 ``0`` ,在第二個中為 ``1`` ,在第三個中為 ``2`` ,依此類推。因此" "每個 lambda 現在將回傳正確的結果: ::" @@ -1517,9 +1517,8 @@ msgid "Don't try this at home, kids!" msgstr "孩子們,不要在家裡嘗試這個!" #: ../../faq/programming.rst:777 -#, fuzzy msgid "What does the slash(/) in the parameter list of a function mean?" -msgstr "函式參數 list 中的斜槓(/)是什麼意思?" +msgstr "函式參數串列中的斜槓 (/) 是什麼意思?" #: ../../faq/programming.rst:779 #, fuzzy @@ -1532,7 +1531,7 @@ msgid "" "only parameters. Its documentation looks like this::" msgstr "" "函式引數list中的斜杠表示它前面的參數是位置參數。僅位置參數是沒有外部可用名稱" -"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置映射到參數。例如,:" +"的參數。在呼叫接受僅位置參數的函式時,參數僅根據其位置對映到參數。例如,:" "func:`divmod` 是一個只接受位置參數的函式。它的文件看起來像這樣: ::" #: ../../faq/programming.rst:786 @@ -1794,6 +1793,7 @@ msgstr "" "用 :class:`io.StringIO` 物件或 :mod:`array` 模組: ::" #: ../../faq/programming.rst:914 +#, fuzzy msgid "" ">>> import io\n" ">>> s = \"Hello, world\"\n" @@ -1808,12 +1808,12 @@ msgid "" "'Hello, there!'\n" "\n" ">>> import array\n" -">>> a = array.array('u', s)\n" +">>> a = array.array('w', s)\n" ">>> print(a)\n" -"array('u', 'Hello, world')\n" +"array('w', 'Hello, world')\n" ">>> a[0] = 'y'\n" ">>> print(a)\n" -"array('u', 'yello, world')\n" +"array('w', 'yello, world')\n" ">>> a.tounicode()\n" "'yello, world'" msgstr "" @@ -1857,7 +1857,7 @@ msgid "" "names of the functions. This is also the primary technique used to emulate " "a case construct::" msgstr "" -"最好的方法是使用將字串映射到函式的字典。這種技術的主要優點是字串不需要與函式" +"最好的方法是使用將字串對映到函式的字典。這種技術的主要優點是字串不需要與函式" "名稱相匹配。這也是用於模擬案例構造的主要技術: ::" #: ../../faq/programming.rst:947 @@ -2662,7 +2662,7 @@ msgstr "" msgid "" "To just run the method or function without saving the return values, a " "plain :keyword:`for` loop will suffice::" -msgstr "要只運行方法或函式而不保存回傳值,一個普通的 for 循環就足夠了: ::" +msgstr "要只運行方法或函式而不保存回傳值,一個普通的 for 迴圈就足夠了: ::" #: ../../faq/programming.rst:1337 msgid "" @@ -2871,7 +2871,7 @@ msgid "" "value\". In Python, use the ``key`` argument for the :meth:`list.sort` " "method::" msgstr "" -"該技術歸功於 Perl 社區的 Randal Schwartz,它透過將每個元素映射到其「排序值」" +"該技術歸功於 Perl 社區的 Randal Schwartz,它透過將每個元素對映到其「排序值」" "的度量對list的元素進行排序。在 Python 中,對 :meth:`list.sort` 方法使用 " "``key`` 引數: ::" @@ -3223,25 +3223,44 @@ msgstr "" #: ../../faq/programming.rst:1616 #, fuzzy msgid "" -"Most :meth:`!__setattr__` implementations must modify :meth:`self.__dict__ " -"` to store local state for self without causing an infinite " -"recursion." +"Many :meth:`~object.__setattr__` implementations call :meth:`!object." +"__setattr__` to set an attribute on self without causing infinite recursion::" msgstr "" "大多數 :meth:`!__setattr__` 實作必須修改 :meth:`self.__dict__ ` 以存儲 self 的本地狀態,而不會導致無限遞迴。" -#: ../../faq/programming.rst:1622 +#: ../../faq/programming.rst:1619 +#, fuzzy +msgid "" +"class X:\n" +" def __setattr__(self, name, value):\n" +" # Custom logic here...\n" +" object.__setattr__(self, name, value)" +msgstr "" +"class X:\n" +" ...\n" +" def __setattr__(self, name, value):\n" +" self.__dict__[name] = value\n" +" ..." + +#: ../../faq/programming.rst:1624 +msgid "" +"Alternatively, it is possible to set attributes by inserting entries into :" +"attr:`self.__dict__ ` directly." +msgstr "" + +#: ../../faq/programming.rst:1629 #, fuzzy msgid "" "How do I call a method defined in a base class from a derived class that " "extends it?" msgstr "如何從擴充它的衍生類別呼叫基底類別中定義的方法?" -#: ../../faq/programming.rst:1624 +#: ../../faq/programming.rst:1631 msgid "Use the built-in :func:`super` function::" msgstr "使用內建的 :func:`super` 函式: ::" -#: ../../faq/programming.rst:1626 +#: ../../faq/programming.rst:1633 msgid "" "class Derived(Base):\n" " def meth(self):\n" @@ -3251,7 +3270,7 @@ msgstr "" " def meth(self):\n" " super().meth() # calls Base.meth" -#: ../../faq/programming.rst:1630 +#: ../../faq/programming.rst:1637 #, fuzzy msgid "" "In the example, :func:`super` will automatically determine the instance from " @@ -3262,12 +3281,12 @@ msgstr "" "在示例中,:func:`super` 將自動確定呼叫它的實例(``self`` 值),使用 " "``type(self ).__mro__``,並回傳 MRO 中``Derived`` 之後的下一行:``Base``。" -#: ../../faq/programming.rst:1637 +#: ../../faq/programming.rst:1644 #, fuzzy msgid "How can I organize my code to make it easier to change the base class?" msgstr "我如何組織我的程式碼以便更容易地更改基底類別?" -#: ../../faq/programming.rst:1639 +#: ../../faq/programming.rst:1646 #, fuzzy msgid "" "You could assign the base class to an alias and derive from the alias. Then " @@ -3279,7 +3298,7 @@ msgstr "" "說一句,如果你想動態決定(例如,取決於資源的可用性)使用哪個基底類別,這個技" "巧也很方便。例子: ::" -#: ../../faq/programming.rst:1644 +#: ../../faq/programming.rst:1651 msgid "" "class Base:\n" " ...\n" @@ -3297,19 +3316,19 @@ msgstr "" "class Derived(BaseAlias):\n" " ..." -#: ../../faq/programming.rst:1654 +#: ../../faq/programming.rst:1661 #, fuzzy msgid "How do I create static class data and static class methods?" msgstr "如何建立靜態類別資料和靜態類別方法?" -#: ../../faq/programming.rst:1656 +#: ../../faq/programming.rst:1663 #, fuzzy msgid "" "Both static data and static methods (in the sense of C++ or Java) are " "supported in Python." msgstr "Python 支援靜態資料和靜態方法(在 C++ 或 Java 的意義上)。" -#: ../../faq/programming.rst:1659 +#: ../../faq/programming.rst:1666 #, fuzzy msgid "" "For static data, simply define a class attribute. To assign a new value to " @@ -3318,7 +3337,7 @@ msgstr "" "對於靜態資料,只需定義一個類別屬性即可。要為屬性分配新值,你必須在分配中顯式" "使用類別名: ::" -#: ../../faq/programming.rst:1662 +#: ../../faq/programming.rst:1669 msgid "" "class C:\n" " count = 0 # number of times C.__init__ called\n" @@ -3330,7 +3349,7 @@ msgid "" " return C.count # or return self.count" msgstr "" -#: ../../faq/programming.rst:1671 +#: ../../faq/programming.rst:1678 #, fuzzy msgid "" "``c.count`` also refers to ``C.count`` for any ``c`` such that " @@ -3341,7 +3360,7 @@ msgstr "" "除非被 ``c`` 本身或某些人覆蓋從 ``c.__class__`` 回到 ``C`` 的基底類別搜索路徑" "上的類別。" -#: ../../faq/programming.rst:1675 +#: ../../faq/programming.rst:1682 #, fuzzy msgid "" "Caution: within a method of C, an assignment like ``self.count = 42`` " @@ -3353,15 +3372,15 @@ msgstr "" "一個名為 \"count\" 的新的不相關實例。類別靜態資料名稱的重新綁定必須始終指定類" "別是否在方法內: ::" -#: ../../faq/programming.rst:1680 +#: ../../faq/programming.rst:1687 msgid "C.count = 314" msgstr "C.count = 314" -#: ../../faq/programming.rst:1682 +#: ../../faq/programming.rst:1689 msgid "Static methods are possible::" msgstr "靜態方法是可能的: ::" -#: ../../faq/programming.rst:1684 +#: ../../faq/programming.rst:1691 msgid "" "class C:\n" " @staticmethod\n" @@ -3375,7 +3394,7 @@ msgstr "" " # 沒有 'self' 參數!\n" " ..." -#: ../../faq/programming.rst:1690 +#: ../../faq/programming.rst:1697 #, fuzzy msgid "" "However, a far more straightforward way to get the effect of a static method " @@ -3383,7 +3402,7 @@ msgid "" msgstr "" "然而,獲得靜態方法效果的一種更直接的方法是透過一個簡單的模組級函式: ::" -#: ../../faq/programming.rst:1693 +#: ../../faq/programming.rst:1700 msgid "" "def getcount():\n" " return C.count" @@ -3391,7 +3410,7 @@ msgstr "" "def getcount():\n" " return C.count" -#: ../../faq/programming.rst:1696 +#: ../../faq/programming.rst:1703 #, fuzzy msgid "" "If your code is structured so as to define one class (or tightly related " @@ -3400,12 +3419,12 @@ msgstr "" "如果你的程式碼結構化以便為每個模組定義一個類別(或緊密相關的類別層次結構)," "則這提供了所需的封裝。" -#: ../../faq/programming.rst:1701 +#: ../../faq/programming.rst:1708 #, fuzzy msgid "How can I overload constructors (or methods) in Python?" msgstr "如何在 Python 中重載構造函式(或方法)?" -#: ../../faq/programming.rst:1703 +#: ../../faq/programming.rst:1710 #, fuzzy msgid "" "This answer actually applies to all methods, but the question usually comes " @@ -3413,11 +3432,11 @@ msgid "" msgstr "" "這個答案實際上適用於所有方法,但這個問題通常首先出現在構造函式的上下文中。" -#: ../../faq/programming.rst:1706 +#: ../../faq/programming.rst:1713 msgid "In C++ you'd write" msgstr "在 C++ 中你會寫成" -#: ../../faq/programming.rst:1708 +#: ../../faq/programming.rst:1715 msgid "" "class C {\n" " C() { cout << \"No arguments\\n\"; }\n" @@ -3429,7 +3448,7 @@ msgstr "" " C(int i) { cout << \"Argument is \" << i << \"\\n\"; }\n" "}" -#: ../../faq/programming.rst:1715 +#: ../../faq/programming.rst:1722 #, fuzzy msgid "" "In Python you have to write a single constructor that catches all cases " @@ -3437,7 +3456,7 @@ msgid "" msgstr "" "在 Python 中,你必須編寫一個構造函式來捕獲所有使用預設引數的情況。例如: ::" -#: ../../faq/programming.rst:1718 +#: ../../faq/programming.rst:1725 msgid "" "class C:\n" " def __init__(self, i=None):\n" @@ -3453,17 +3472,17 @@ msgstr "" " else:\n" " print(\"Argument is\", i)" -#: ../../faq/programming.rst:1725 +#: ../../faq/programming.rst:1732 #, fuzzy msgid "This is not entirely equivalent, but close enough in practice." msgstr "這並不完全等價,但在實踐中足夠接近。" -#: ../../faq/programming.rst:1727 +#: ../../faq/programming.rst:1734 #, fuzzy msgid "You could also try a variable-length argument list, e.g. ::" msgstr "你也可以嘗試可變長度引數 list,例如: ::" -#: ../../faq/programming.rst:1729 +#: ../../faq/programming.rst:1736 msgid "" "def __init__(self, *args):\n" " ..." @@ -3471,17 +3490,17 @@ msgstr "" "def __init__(self, *args):\n" " ..." -#: ../../faq/programming.rst:1732 +#: ../../faq/programming.rst:1739 #, fuzzy msgid "The same approach works for all method definitions." msgstr "相同的方法適用於所有方法定義。" -#: ../../faq/programming.rst:1736 +#: ../../faq/programming.rst:1743 #, fuzzy msgid "I try to use __spam and I get an error about _SomeClassName__spam." msgstr "我嘗試使用 __spam,但收到有關 _SomeClassName__spam 的錯誤。" -#: ../../faq/programming.rst:1738 +#: ../../faq/programming.rst:1745 #, fuzzy msgid "" "Variable names with double leading underscores are \"mangled\" to provide a " @@ -3496,13 +3515,13 @@ msgstr "" "上替換為 ``_classname__spam``,其中 ``classname`` 是當前類別名,所有前導底線" "被去除。" -#: ../../faq/programming.rst:1744 +#: ../../faq/programming.rst:1751 msgid "" "The identifier can be used unchanged within the class, but to access it " "outside the class, the mangled name must be used:" msgstr "" -#: ../../faq/programming.rst:1747 +#: ../../faq/programming.rst:1754 msgid "" "class A:\n" " def __one(self):\n" @@ -3528,7 +3547,7 @@ msgstr "" "\n" "four = 4 * A()._A__one()" -#: ../../faq/programming.rst:1761 +#: ../../faq/programming.rst:1768 #, fuzzy msgid "" "In particular, this does not guarantee privacy since an outside user can " @@ -3538,23 +3557,23 @@ msgstr "" "這並不能保證隱私:外部使用者仍然可以故意存取 \"_classname__spam\" 屬性,並且" "私有值在物件的 __dict__ 中可見。許多 Python 程式員根本懶得使用私有變數名。" -#: ../../faq/programming.rst:1767 +#: ../../faq/programming.rst:1774 msgid "" "The :ref:`private name mangling specifications ` for " "details and special cases." msgstr "" -#: ../../faq/programming.rst:1771 +#: ../../faq/programming.rst:1778 #, fuzzy msgid "My class defines __del__ but it is not called when I delete the object." msgstr "我的類別定義了 __del__ 但是當我刪除物件時它沒有被呼叫。" -#: ../../faq/programming.rst:1773 +#: ../../faq/programming.rst:1780 #, fuzzy msgid "There are several possible reasons for this." msgstr "這有幾個可能的原因。" -#: ../../faq/programming.rst:1775 +#: ../../faq/programming.rst:1782 #, fuzzy msgid "" "The :keyword:`del` statement does not necessarily call :meth:`~object." @@ -3564,7 +3583,7 @@ msgstr "" ":keyword:`del` 陳述式不一定呼叫 :meth:`~object.__del__` -- 它只是減少物件的引" "用計數,如果達到零,則呼叫 :meth:`!__del__`。" -#: ../../faq/programming.rst:1779 +#: ../../faq/programming.rst:1786 #, fuzzy msgid "" "If your data structures contain circular links (e.g. a tree where each child " @@ -3586,7 +3605,7 @@ msgstr "" "行順序是任意的。你可以運行 :func:`gc.collect` 來強制收集,但*存在*永遠不會收" "集物件的病態情況。" -#: ../../faq/programming.rst:1790 +#: ../../faq/programming.rst:1797 #, fuzzy msgid "" "Despite the cycle collector, it's still a good idea to define an explicit " @@ -3601,7 +3620,7 @@ msgstr "" "性。不要直接呼叫 :meth:`!__del__` -- :meth:`!__del__` 應該呼叫 ``close()`` 並" "且 ``close()`` 應該確保它可以多次呼叫同一個物件。" -#: ../../faq/programming.rst:1797 +#: ../../faq/programming.rst:1804 #, fuzzy msgid "" "Another way to avoid cyclical references is to use the :mod:`weakref` " @@ -3613,21 +3632,20 @@ msgstr "" "的情況下指向物件。例如,樹資料結構應該對其父參照和同級參照使用弱參照(如果需" "要的話!)。" -#: ../../faq/programming.rst:1810 -#, fuzzy +#: ../../faq/programming.rst:1817 msgid "" "Finally, if your :meth:`!__del__` method raises an exception, a warning " "message is printed to :data:`sys.stderr`." msgstr "" -"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告消息印出到 :data:" +"最後,如果你的 :meth:`!__del__` 方法引發例外,則會將一條警告訊息印出到 :data:" "`sys.stderr`。" -#: ../../faq/programming.rst:1815 +#: ../../faq/programming.rst:1822 #, fuzzy msgid "How do I get a list of all instances of a given class?" msgstr "如何獲取給定類別的所有實例的 list?" -#: ../../faq/programming.rst:1817 +#: ../../faq/programming.rst:1824 #, fuzzy msgid "" "Python does not keep track of all instances of a class (or of a built-in " @@ -3637,12 +3655,11 @@ msgstr "" "Python 不會跟踪類別(或內建型別)的所有實例。你可以對類別的構造函式進行編程," "以透過保留對每個實例的弱參照list來跟踪所有實例。" -#: ../../faq/programming.rst:1823 -#, fuzzy +#: ../../faq/programming.rst:1830 msgid "Why does the result of ``id()`` appear to be not unique?" msgstr "為什麼 ``id()`` 的結果看起來不唯一?" -#: ../../faq/programming.rst:1825 +#: ../../faq/programming.rst:1832 #, fuzzy msgid "" "The :func:`id` builtin returns an integer that is guaranteed to be unique " @@ -3655,7 +3672,7 @@ msgstr "" "CPython 中,這是物件的記憶體地址,所以經常發生在從記憶體中刪除一個物件後,下" "一個新建立的物件被分配在記憶體中的相同位置。這個例子說明了這一點:" -#: ../../faq/programming.rst:1836 +#: ../../faq/programming.rst:1843 #, fuzzy msgid "" "The two ids belong to different integer objects that are created before, and " @@ -3666,18 +3683,18 @@ msgstr "" "這兩個 id 屬於之前建立的不同整數物件,並在執行 ``id()`` 呼叫後立即刪除。要確" "保你要檢查其 id 的物件仍然存在,請建立對該物件的另一個參照:" -#: ../../faq/programming.rst:1849 +#: ../../faq/programming.rst:1856 msgid "When can I rely on identity tests with the *is* operator?" msgstr "我什麼時候可以依靠 *is* 運算子進行識別性測試?" -#: ../../faq/programming.rst:1851 +#: ../../faq/programming.rst:1858 msgid "" "The ``is`` operator tests for object identity. The test ``a is b`` is " "equivalent to ``id(a) == id(b)``." msgstr "" "``is`` 運算子測試物件識別性。測試 ``a is b`` 等同於 ``id(a) == id(b)`` 。" -#: ../../faq/programming.rst:1854 +#: ../../faq/programming.rst:1861 msgid "" "The most important property of an identity test is that an object is always " "identical to itself, ``a is a`` always returns ``True``. Identity tests are " @@ -3688,7 +3705,7 @@ msgstr "" "識別性測試通常比相等性測試更快。與相等性測試不同,識別性測試保證回傳布林值 " "``True`` 或 ``False`` 。" -#: ../../faq/programming.rst:1859 +#: ../../faq/programming.rst:1866 msgid "" "However, identity tests can *only* be substituted for equality tests when " "object identity is assured. Generally, there are three circumstances where " @@ -3697,7 +3714,7 @@ msgstr "" "然而,*只有*\\ 當物件識別性得到保證時,識別性測試才能代替相等性測試。一般來" "說,保證識別性的情況有以下三種:" -#: ../../faq/programming.rst:1863 +#: ../../faq/programming.rst:1870 msgid "" "1) Assignments create new names but do not change object identity. After " "the assignment ``new = old``, it is guaranteed that ``new is old``." @@ -3705,7 +3722,7 @@ msgstr "" "1) 賦值建立新名稱但不改變物件識別性。賦值 ``new = old`` 後,保證 ``new is " "old``。" -#: ../../faq/programming.rst:1866 +#: ../../faq/programming.rst:1873 msgid "" "2) Putting an object in a container that stores object references does not " "change object identity. After the list assignment ``s[0] = x``, it is " @@ -3714,7 +3731,7 @@ msgstr "" "2) 將物件放入存儲物件參照的容器中不會改變物件識別性。在 list 賦值 ``s[0] = " "x`` 之後,保證 ``s[0] 是 x``。" -#: ../../faq/programming.rst:1870 +#: ../../faq/programming.rst:1877 #, fuzzy msgid "" "3) If an object is a singleton, it means that only one instance of that " @@ -3724,7 +3741,7 @@ msgstr "" "3)如果一個物件是單例,則意味著該物件只能存在一個實例。在賦值 ``a = None`` " "和 ``b = None`` 之後,可以保證 ``a is b`` 因為 ``None`` 是單例。" -#: ../../faq/programming.rst:1874 +#: ../../faq/programming.rst:1881 msgid "" "In most other circumstances, identity tests are inadvisable and equality " "tests are preferred. In particular, identity tests should not be used to " @@ -3734,7 +3751,7 @@ msgstr "" "在大多數其他情況下,識別性測試是不可取的,相等性測試是首選。特別是,識別性測" "試不應用於檢查常數,例如不能保證是單例的 :class:`int` 和 :class:`str`: ::" -#: ../../faq/programming.rst:1879 +#: ../../faq/programming.rst:1886 msgid "" ">>> a = 1000\n" ">>> b = 500\n" @@ -3760,12 +3777,11 @@ msgstr "" ">>> a is c\n" "False" -#: ../../faq/programming.rst:1891 -#, fuzzy +#: ../../faq/programming.rst:1898 msgid "Likewise, new instances of mutable containers are never identical::" -msgstr "同樣,可變容器的新實例永遠不會相同: ::" +msgstr "同樣地,可變容器的新實例永遠不會相同: ::" -#: ../../faq/programming.rst:1893 +#: ../../faq/programming.rst:1900 msgid "" ">>> a = []\n" ">>> b = []\n" @@ -3777,13 +3793,13 @@ msgstr "" ">>> a is b\n" "False" -#: ../../faq/programming.rst:1898 +#: ../../faq/programming.rst:1905 msgid "" "In the standard library code, you will see several common patterns for " "correctly using identity tests:" msgstr "在標準函式庫程式碼中,你將看到幾種正確使用識別性測試的常見模式:" -#: ../../faq/programming.rst:1901 +#: ../../faq/programming.rst:1908 msgid "" "1) As recommended by :pep:`8`, an identity test is the preferred way to " "check for ``None``. This reads like plain English in code and avoids " @@ -3793,7 +3809,7 @@ msgstr "" "1) 正如 :pep:`8` 所推薦的,識別性測試是檢查 ``None`` 的首選方法。這在程式碼中" "讀起來像簡單的英語,並避免與其他可能具有評估為 false 的布林值的物件混淆。" -#: ../../faq/programming.rst:1905 +#: ../../faq/programming.rst:1912 #, fuzzy msgid "" "2) Detecting optional arguments can be tricky when ``None`` is a valid input " @@ -3805,7 +3821,7 @@ msgstr "" "建立一個保證與其他物件不同的單例哨兵物件。例如,這裡是如何實作一個行為類似" "於 :meth:`dict.pop` 的方法: ::" -#: ../../faq/programming.rst:1910 +#: ../../faq/programming.rst:1917 msgid "" "_sentinel = object()\n" "\n" @@ -3829,7 +3845,7 @@ msgstr "" " raise KeyError(key)\n" " return default" -#: ../../faq/programming.rst:1921 +#: ../../faq/programming.rst:1928 msgid "" "3) Container implementations sometimes need to augment equality tests with " "identity tests. This prevents the code from being confused by objects such " @@ -3838,14 +3854,14 @@ msgstr "" "3) 容器實作有時需要透過識別性測試來增強相等性測試。這可以防止程式碼被諸如 " "float('NaN') 之類的不等於自身的物件所混淆。" -#: ../../faq/programming.rst:1925 +#: ../../faq/programming.rst:1932 msgid "" "For example, here is the implementation of :meth:`!collections.abc.Sequence." "__contains__`::" msgstr "" "例如,以下是 :meth:`!collections.abc.Sequence.__contains__` 的實作: ::" -#: ../../faq/programming.rst:1928 +#: ../../faq/programming.rst:1935 msgid "" "def __contains__(self, value):\n" " for v in self:\n" @@ -3859,12 +3875,12 @@ msgstr "" " return True\n" " return False" -#: ../../faq/programming.rst:1936 +#: ../../faq/programming.rst:1943 msgid "" "How can a subclass control what data is stored in an immutable instance?" msgstr "子類別如何控制不可變實例中存儲的資料?" -#: ../../faq/programming.rst:1938 +#: ../../faq/programming.rst:1945 #, fuzzy msgid "" "When subclassing an immutable type, override the :meth:`~object.__new__` " @@ -3876,14 +3892,14 @@ msgstr "" "`~object.__init__` 方法。後者僅在*建立實例後*運行,這為時已晚,無法更改不可變" "實例中的資料。" -#: ../../faq/programming.rst:1943 +#: ../../faq/programming.rst:1950 #, fuzzy msgid "" "All of these immutable classes have a different signature than their parent " "class:" msgstr "所有這些不可變類別都具有與其父類別不同的簽名:" -#: ../../faq/programming.rst:1946 +#: ../../faq/programming.rst:1953 msgid "" "from datetime import date\n" "\n" @@ -3907,11 +3923,11 @@ msgid "" " return super().__new__(cls, s)" msgstr "" -#: ../../faq/programming.rst:1969 +#: ../../faq/programming.rst:1976 msgid "The classes can be used like this:" msgstr "這些類別可以像這樣使用:" -#: ../../faq/programming.rst:1971 +#: ../../faq/programming.rst:1978 msgid "" ">>> FirstOfMonthDate(2012, 2, 14)\n" "FirstOfMonthDate(2012, 2, 1)\n" @@ -3931,11 +3947,11 @@ msgstr "" ">>> TitleStr('Blog: Why Python Rocks')\n" "'blog-why-python-rocks'" -#: ../../faq/programming.rst:1986 +#: ../../faq/programming.rst:1993 msgid "How do I cache method calls?" msgstr "如何快取方法呼叫?" -#: ../../faq/programming.rst:1988 +#: ../../faq/programming.rst:1995 #, fuzzy msgid "" "The two principal tools for caching methods are :func:`functools." @@ -3945,7 +3961,7 @@ msgstr "" "快取方法的兩個主要工具是 func:`functools.cached_property` 和 :func:" "`functools.lru_cache`。前者在實例級別存儲結果,後者在類別級別存儲結果。" -#: ../../faq/programming.rst:1993 +#: ../../faq/programming.rst:2000 #, fuzzy msgid "" "The *cached_property* approach only works with methods that do not take any " @@ -3955,7 +3971,7 @@ msgstr "" "*cached_property* 方法僅適用於不帶任何引數的方法。它不會建立對實例的參照。只" "要實例還活著,快取的方法結果就會被保留。" -#: ../../faq/programming.rst:1997 +#: ../../faq/programming.rst:2004 #, fuzzy msgid "" "The advantage is that when an instance is no longer used, the cached method " @@ -3966,7 +3982,7 @@ msgstr "" "好處是當一個實例不再使用時,快取的方法結果會立即釋放。缺點是如果實例累積,累" "積的方法結果也會累積。他們可以不受限制地成長。" -#: ../../faq/programming.rst:2002 +#: ../../faq/programming.rst:2009 msgid "" "The *lru_cache* approach works with methods that have :term:`hashable` " "arguments. It creates a reference to the instance unless special efforts " @@ -3975,7 +3991,7 @@ msgstr "" "*lru_cache* 方法適用於具有\\ :term:`可雜湊 `\\ 引數的方法。除非特別" "努力傳遞弱參照,否則它會建立對實例的參照。" -#: ../../faq/programming.rst:2006 +#: ../../faq/programming.rst:2013 #, fuzzy msgid "" "The advantage of the least recently used algorithm is that the cache is " @@ -3985,11 +4001,11 @@ msgstr "" "最近最少使用演算法的優點是快取受指定的 *maxsize* 限制。缺點是實例會一直保持活" "動狀態,直到它們從快取中老化或快取被清除。" -#: ../../faq/programming.rst:2011 +#: ../../faq/programming.rst:2018 msgid "This example shows the various techniques::" msgstr "這個例子展示了各種技術: ::" -#: ../../faq/programming.rst:2013 +#: ../../faq/programming.rst:2020 msgid "" "class Weather:\n" " \"Lookup weather information on a government website\"\n" @@ -4014,7 +4030,7 @@ msgid "" " # Depends on the station_id, date, and units." msgstr "" -#: ../../faq/programming.rst:2035 +#: ../../faq/programming.rst:2042 #, fuzzy msgid "" "The above example assumes that the *station_id* never changes. If the " @@ -4024,7 +4040,7 @@ msgstr "" "上面的例子假設 *station_id* 永遠不會改變。如果相關的實例屬性是可變的,則 " "*cached_property* 方法無法工作,因為它無法檢測到屬性的更改。" -#: ../../faq/programming.rst:2040 +#: ../../faq/programming.rst:2047 #, fuzzy msgid "" "To make the *lru_cache* approach work when the *station_id* is mutable, the " @@ -4035,7 +4051,7 @@ msgstr "" "`~object.__eq__` 和 :meth:`~object.__hash__` 方法,以便快取可以檢測相關屬性更" "新: ::" -#: ../../faq/programming.rst:2044 +#: ../../faq/programming.rst:2051 msgid "" "class Weather:\n" " \"Example with a mutable station identifier\"\n" @@ -4058,15 +4074,15 @@ msgid "" " # Depends on the station_id, date, and units." msgstr "" -#: ../../faq/programming.rst:2066 +#: ../../faq/programming.rst:2073 msgid "Modules" msgstr "模組" -#: ../../faq/programming.rst:2069 +#: ../../faq/programming.rst:2076 msgid "How do I create a .pyc file?" msgstr "如何建立 .pyc 檔案?" -#: ../../faq/programming.rst:2071 +#: ../../faq/programming.rst:2078 #, fuzzy msgid "" "When a module is imported for the first time (or when the source file has " @@ -4083,7 +4099,7 @@ msgstr "" "間部分依賴於特定的``python `` 建立它的二進製檔案。(有關詳細資訊,請參閱 :" "pep:`3147`。)" -#: ../../faq/programming.rst:2079 +#: ../../faq/programming.rst:2086 #, fuzzy msgid "" "One reason that a ``.pyc`` file may not be created is a permissions problem " @@ -4096,7 +4112,7 @@ msgstr "" "__pycache__ 子目錄。例如,如果你以一個使用者的身份開發但以另一個使用者的身份" "運行,例如你正在使用 Web 服務器進行測試,就會發生這種情況。" -#: ../../faq/programming.rst:2084 +#: ../../faq/programming.rst:2091 #, fuzzy msgid "" "Unless the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable is set, " @@ -4105,11 +4121,11 @@ msgid "" "``__pycache__`` subdirectory and write the compiled module to that " "subdirectory." msgstr "" -"除非:envvar:`PYTHONDONTWRITEBYTECODE` 環境變數被設定,如果你正在引入一個模組" -"並且 Python 有能力(權限,空閒空間等)建立一個 .pyc 檔案是自動的建立一個" +"除非 :envvar:`PYTHONDONTWRITEBYTECODE` 環境變數有被設定,如果你正在引入一個模" +"組並且 Python 有能力(權限、空閒空間等)建立一個 .pyc 檔案是自動的建立一個" "``__pycache__ `` 子目錄並將編譯後的模組寫入該子目錄。" -#: ../../faq/programming.rst:2089 +#: ../../faq/programming.rst:2096 #, fuzzy msgid "" "Running Python on a top level script is not considered an import and no ``." @@ -4124,26 +4140,25 @@ msgstr "" "入 ``python foo.py`` 作為一個 shell 命令),將為 xyz 建立一個 .pyc 因為引入" "了 xyz,但是不會為 foo 建立 .pyc 檔案,因為 ` `foo.py`` 沒有被引入。" -#: ../../faq/programming.rst:2096 -#, fuzzy +#: ../../faq/programming.rst:2103 msgid "" "If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a ``." "pyc`` file for a module that is not imported -- you can, using the :mod:" "`py_compile` and :mod:`compileall` modules." msgstr "" -"如果你需要為 ``foo`` 建立一個 ``.pyc`` 檔案——也就是說,為一個未引入的模組建立" -"一個 ``.pyc`` 檔案——你可以使用 :mod :`py_compile` 和 :mod:`compileall` 模組。" +"如果你需要為 ``foo`` 建立一個 ``.pyc`` 檔案 —— 也就是說,要為一個未引入的模組" +"建立一個 ``.pyc`` 檔案 —— 你可以使用 :mod:`py_compile` 和 :mod:`compileall` " +"模組。" -#: ../../faq/programming.rst:2100 -#, fuzzy +#: ../../faq/programming.rst:2107 msgid "" "The :mod:`py_compile` module can manually compile any module. One way is to " "use the ``compile()`` function in that module interactively::" msgstr "" -":mod:`py_compile` 模組可以手動編譯任何模組。一種方法是在該模組中以交互方式使" -"用 ``compile()`` 函式: ::" +":mod:`py_compile` 模組允許手動編譯任何模組。其中一種方法是在該模組中以交互方" +"式使用 ``compile()`` 函式: ::" -#: ../../faq/programming.rst:2103 +#: ../../faq/programming.rst:2110 msgid "" ">>> import py_compile\n" ">>> py_compile.compile('foo.py') " @@ -4151,17 +4166,16 @@ msgstr "" ">>> import py_compile\n" ">>> py_compile.compile('foo.py') " -#: ../../faq/programming.rst:2106 -#, fuzzy +#: ../../faq/programming.rst:2113 msgid "" "This will write the ``.pyc`` to a ``__pycache__`` subdirectory in the same " "location as ``foo.py`` (or you can override that with the optional parameter " "``cfile``)." msgstr "" -"這會將 .pyc 寫入與 foo.py 相同位置的 __pycache__ 子目錄(或者你可以使用可選參" -"數 cfile 覆蓋它)。" +"這會將 ``.pyc`` 寫入與 ``foo.py`` 相同位置的 ``__pycache__`` 子目錄(或者你可" +"以使用可選參數 ``cfile`` 覆蓋它)。" -#: ../../faq/programming.rst:2110 +#: ../../faq/programming.rst:2117 #, fuzzy msgid "" "You can also automatically compile all files in a directory or directories " @@ -4172,15 +4186,15 @@ msgstr "" "你還可以使用 :mod:`compileall` 模組自動編譯目錄中的所有檔案。你可以在 shell " "提示符下運行 ``compileall.py`` 並提供包含要編譯的 Python 檔案的目錄路徑: ::" -#: ../../faq/programming.rst:2115 +#: ../../faq/programming.rst:2122 msgid "python -m compileall ." msgstr "python -m compileall ." -#: ../../faq/programming.rst:2119 +#: ../../faq/programming.rst:2126 msgid "How do I find the current module name?" msgstr "如何找到當前模組名稱?" -#: ../../faq/programming.rst:2121 +#: ../../faq/programming.rst:2128 #, fuzzy msgid "" "A module can find out its own module name by looking at the predefined " @@ -4193,7 +4207,7 @@ msgstr "" "值為``'__main__'``,則該程式作為腳本運行。許多通常透過引入使用的模組還提供命" "令行界面或自檢,只有在檢查 ``__name__`` 後才執行此程式碼: ::" -#: ../../faq/programming.rst:2127 +#: ../../faq/programming.rst:2134 msgid "" "def main():\n" " print('Running test...')\n" @@ -4203,20 +4217,20 @@ msgid "" " main()" msgstr "" -#: ../../faq/programming.rst:2136 +#: ../../faq/programming.rst:2143 #, fuzzy msgid "How can I have modules that mutually import each other?" msgstr "我怎樣才能擁有相互引入的模組?" -#: ../../faq/programming.rst:2138 +#: ../../faq/programming.rst:2145 msgid "Suppose you have the following modules:" msgstr "假設你有以下模組:" -#: ../../faq/programming.rst:2140 +#: ../../faq/programming.rst:2147 msgid ":file:`foo.py`::" msgstr ":file:`foo.py`: ::" -#: ../../faq/programming.rst:2142 +#: ../../faq/programming.rst:2149 msgid "" "from bar import bar_var\n" "foo_var = 1" @@ -4224,11 +4238,11 @@ msgstr "" "from bar import bar_var\n" "foo_var = 1" -#: ../../faq/programming.rst:2145 +#: ../../faq/programming.rst:2152 msgid ":file:`bar.py`::" msgstr ":file:`bar.py`: ::" -#: ../../faq/programming.rst:2147 +#: ../../faq/programming.rst:2154 msgid "" "from foo import foo_var\n" "bar_var = 2" @@ -4236,56 +4250,50 @@ msgstr "" "from foo import foo_var\n" "bar_var = 2" -#: ../../faq/programming.rst:2150 -#, fuzzy +#: ../../faq/programming.rst:2157 msgid "The problem is that the interpreter will perform the following steps:" msgstr "問題是直譯器將執行以下步驟:" -#: ../../faq/programming.rst:2152 -#, fuzzy +#: ../../faq/programming.rst:2159 msgid "main imports ``foo``" msgstr "主要引入 ``foo``" -#: ../../faq/programming.rst:2153 -#, fuzzy +#: ../../faq/programming.rst:2160 msgid "Empty globals for ``foo`` are created" msgstr "建立了 ``foo`` 的空全域變數" -#: ../../faq/programming.rst:2154 +#: ../../faq/programming.rst:2161 msgid "``foo`` is compiled and starts executing" msgstr "``foo`` 被編譯並開始執行" -#: ../../faq/programming.rst:2155 +#: ../../faq/programming.rst:2162 msgid "``foo`` imports ``bar``" msgstr "``foo`` 引入 ``bar``" -#: ../../faq/programming.rst:2156 -#, fuzzy +#: ../../faq/programming.rst:2163 msgid "Empty globals for ``bar`` are created" msgstr "建立了 ``bar`` 的空全域變數" -#: ../../faq/programming.rst:2157 +#: ../../faq/programming.rst:2164 msgid "``bar`` is compiled and starts executing" msgstr "``bar`` 已被編譯並開始執行" -#: ../../faq/programming.rst:2158 -#, fuzzy +#: ../../faq/programming.rst:2165 msgid "" "``bar`` imports ``foo`` (which is a no-op since there already is a module " "named ``foo``)" msgstr "" -"``bar`` 引入 ``foo``(這是一個空操作,因為已經有一個名為 ``foo`` 的模組)" +"``bar`` 引入 ``foo``\\ (這是一個空操作,因為已經有一個名為 ``foo`` 的模組)" -#: ../../faq/programming.rst:2159 -#, fuzzy +#: ../../faq/programming.rst:2166 msgid "" "The import mechanism tries to read ``foo_var`` from ``foo`` globals, to set " "``bar.foo_var = foo.foo_var``" msgstr "" -"引入機制嘗試從 ``foo`` 全域變數中讀取 ``foo_var`` ,以設定 ``bar.foo_var = " -"foo.foo_var`` " +"引入機制嘗試從 ``foo`` 全域變數中讀取 ``foo_var``,以設定 ``bar.foo_var = " +"foo.foo_var``" -#: ../../faq/programming.rst:2161 +#: ../../faq/programming.rst:2168 #, fuzzy msgid "" "The last step fails, because Python isn't done with interpreting ``foo`` yet " @@ -4294,7 +4302,7 @@ msgstr "" "最後一步失敗了,因為 Python 還沒有完成對 ``foo`` 的直譯,而 ``foo`` 的全域符" "號字典仍然是空的。" -#: ../../faq/programming.rst:2164 +#: ../../faq/programming.rst:2171 #, fuzzy msgid "" "The same thing happens when you use ``import foo``, and then try to access " @@ -4303,11 +4311,11 @@ msgstr "" "當你使用 ``import foo``,然後嘗試在全域程式碼中存取 ``foo.foo_var`` 時,也會" "發生同樣的事情。" -#: ../../faq/programming.rst:2167 +#: ../../faq/programming.rst:2174 msgid "There are (at least) three possible workarounds for this problem." msgstr "此問題有(至少)三種可能的解決方法。" -#: ../../faq/programming.rst:2169 +#: ../../faq/programming.rst:2176 #, fuzzy msgid "" "Guido van Rossum recommends avoiding all uses of ``from import ..." @@ -4320,50 +4328,51 @@ msgstr "" "函式中。全域變數和類別變數的初始化應該只使用常數或內建函式。這意味著來自引入" "模組的所有內容都被參照為 ``.``。" -#: ../../faq/programming.rst:2174 +#: ../../faq/programming.rst:2181 msgid "" "Jim Roskind suggests performing steps in the following order in each module:" msgstr "Jim Roskind 建議在每個模組中按以下順序執行各個步驟:" -#: ../../faq/programming.rst:2176 +#: ../../faq/programming.rst:2183 #, fuzzy msgid "" "exports (globals, functions, and classes that don't need imported base " "classes)" -msgstr "導出(不需要引入基底類別的全域變數、函式和類別)" +msgstr "匯出(不需要引入基底類別的全域變數、函式和類別)" -#: ../../faq/programming.rst:2178 +#: ../../faq/programming.rst:2185 msgid "``import`` statements" msgstr "``import`` 陳述式" -#: ../../faq/programming.rst:2179 +#: ../../faq/programming.rst:2186 msgid "" "active code (including globals that are initialized from imported values)." msgstr "活躍程式碼(包括從引入值初始化的全域變數)。" -#: ../../faq/programming.rst:2181 -#, fuzzy +#: ../../faq/programming.rst:2188 msgid "" "Van Rossum doesn't like this approach much because the imports appear in a " "strange place, but it does work." msgstr "" "Van Rossum 不太喜歡這種方法,因為引入出現在一個奇怪的地方,但它確實有效。" -#: ../../faq/programming.rst:2184 +#: ../../faq/programming.rst:2191 msgid "" "Matthias Urlichs recommends restructuring your code so that the recursive " "import is not necessary in the first place." -msgstr "Matthias Urlichs 建議重構你的程式碼,以便打從一開始就不需要遞迴引入。" +msgstr "" +"Matthias Urlichs 建議重組 (restructuring) 你的程式碼,以便打從一開始就不需要" +"遞迴引入。" -#: ../../faq/programming.rst:2187 +#: ../../faq/programming.rst:2194 msgid "These solutions are not mutually exclusive." msgstr "這些方案並不衝突。" -#: ../../faq/programming.rst:2191 +#: ../../faq/programming.rst:2198 msgid "__import__('x.y.z') returns ; how do I get z?" msgstr "__import__('x.y.z') 回傳 ,那我怎麼得到 z?" -#: ../../faq/programming.rst:2193 +#: ../../faq/programming.rst:2200 #, fuzzy msgid "" "Consider using the convenience function :func:`~importlib.import_module` " @@ -4372,17 +4381,17 @@ msgstr "" "考慮使用來自 :mod:`importlib` 的便利函式 :func:`~importlib.import_module` 代" "替: ::" -#: ../../faq/programming.rst:2196 +#: ../../faq/programming.rst:2203 msgid "z = importlib.import_module('x.y.z')" msgstr "z = importlib.import_module('x.y.z')" -#: ../../faq/programming.rst:2200 +#: ../../faq/programming.rst:2207 msgid "" "When I edit an imported module and reimport it, the changes don't show up. " "Why does this happen?" msgstr "當我編輯需要引入的模組並重新引入它時,更動沒有反應出來。為什麼會這樣?" -#: ../../faq/programming.rst:2202 +#: ../../faq/programming.rst:2209 #, fuzzy msgid "" "For reasons of efficiency as well as consistency, Python only reads the " @@ -4395,7 +4404,7 @@ msgstr "" "一個由許多模組組成的程式中,每個模組都引入相同的基本模組,基本模組將被解析和" "重新解析很多次。要強制重新讀取已更改的模組,請執行以下操作: ::" -#: ../../faq/programming.rst:2208 +#: ../../faq/programming.rst:2215 msgid "" "import importlib\n" "import modname\n" @@ -4405,18 +4414,17 @@ msgstr "" "import modname\n" "importlib.reload(modname)" -#: ../../faq/programming.rst:2212 -#, fuzzy +#: ../../faq/programming.rst:2219 msgid "" "Warning: this technique is not 100% fool-proof. In particular, modules " "containing statements like ::" -msgstr "警告:此技術並非 100% 萬無一失。尤其是,包含像這樣的陳述式的模組: ::" +msgstr "警告:此技術並非 100% 萬無一失。尤其是包含像這樣陳述式的模組: ::" -#: ../../faq/programming.rst:2215 +#: ../../faq/programming.rst:2222 msgid "from modname import some_objects" msgstr "from modname import some_objects" -#: ../../faq/programming.rst:2217 +#: ../../faq/programming.rst:2224 #, fuzzy msgid "" "will continue to work with the old version of the imported objects. If the " @@ -4427,7 +4435,7 @@ msgstr "" "將繼續使用舊版本的引入物件。如果模組包含類別定義,現有的類別實例將*不會*更新" "為使用新的類別定義。這可能會導致以下自相矛盾的行為: ::" -#: ../../faq/programming.rst:2222 +#: ../../faq/programming.rst:2229 msgid "" ">>> import importlib\n" ">>> import cls\n" @@ -4438,13 +4446,13 @@ msgid "" "False" msgstr "" -#: ../../faq/programming.rst:2230 +#: ../../faq/programming.rst:2237 msgid "" "The nature of the problem is made clear if you print out the \"identity\" of " "the class objects::" msgstr "如果印出類別物件的「識別性」,問題的本質就很清楚了: ::" -#: ../../faq/programming.rst:2233 +#: ../../faq/programming.rst:2240 msgid "" ">>> hex(id(c.__class__))\n" "'0x7352a0'\n" diff --git a/faq/windows.po b/faq/windows.po index a4fa46fa95..a0659bea13 100644 --- a/faq/windows.po +++ b/faq/windows.po @@ -7,7 +7,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-11-09 17:25+0800\n" diff --git a/glossary.po b/glossary.po index 80c6a07207..a882706b5e 100644 --- a/glossary.po +++ b/glossary.po @@ -6,9 +6,9 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2023-07-02 22:47+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,63 +30,40 @@ msgstr "``>>>``" #: ../../glossary.rst:12 msgid "" -"The default Python prompt of the interactive shell. Often seen for code " -"examples which can be executed interactively in the interpreter." +"The default Python prompt of the :term:`interactive` shell. Often seen for " +"code examples which can be executed interactively in the interpreter." msgstr "" -"互動式 shell 的預設 Python 提示字元。常見於能在直譯器中以互動方式被執行的程式" -"碼範例。" +":term:`互動式 ` shell 的預設 Python 提示字元。常見於能在直譯器中" +"以互動方式被執行的程式碼範例。" -#: ../../glossary.rst:14 +#: ../../glossary.rst:15 msgid "``...``" msgstr "``...``" -#: ../../glossary.rst:16 +#: ../../glossary.rst:17 msgid "Can refer to:" msgstr "可以表示:" -#: ../../glossary.rst:18 +#: ../../glossary.rst:19 msgid "" -"The default Python prompt of the interactive shell when entering the code " -"for an indented code block, when within a pair of matching left and right " -"delimiters (parentheses, square brackets, curly braces or triple quotes), or " -"after specifying a decorator." +"The default Python prompt of the :term:`interactive` shell when entering the " +"code for an indented code block, when within a pair of matching left and " +"right delimiters (parentheses, square brackets, curly braces or triple " +"quotes), or after specifying a decorator." msgstr "" "在一個被縮排的程式碼區塊、在一對匹配的左右定界符(delimiter,例如括號、方括" "號、花括號或三引號)內部,或是在指定一個裝飾器 (decorator) 之後,要輸入程式碼" -"時,互動式 shell 顯示的預設 Python 提示字元。" +"時,:term:`互動式 ` shell 顯示的預設 Python 提示字元。" -#: ../../glossary.rst:23 +#: ../../glossary.rst:24 msgid "The :const:`Ellipsis` built-in constant." msgstr "內建常數 :const:`Ellipsis`。" -#: ../../glossary.rst:24 -msgid "2to3" -msgstr "2to3" - -#: ../../glossary.rst:26 -msgid "" -"A tool that tries to convert Python 2.x code to Python 3.x code by handling " -"most of the incompatibilities which can be detected by parsing the source " -"and traversing the parse tree." -msgstr "" -"一個試著將 Python 2.x 程式碼轉換為 Python 3.x 程式碼的工具,它是透過處理大部" -"分的不相容性來達成此目的,而這些不相容性能夠透過剖析原始碼和遍歷剖析樹而被檢" -"測出來。" - -#: ../../glossary.rst:30 -msgid "" -"2to3 is available in the standard library as :mod:`lib2to3`; a standalone " -"entry point is provided as :file:`Tools/scripts/2to3`. See :ref:`2to3-" -"reference`." -msgstr "" -"2to3 在可以標準函式庫中以 :mod:`lib2to3` 被使用;它提供了一個獨立的入口點," -"在 :file:`Tools/scripts/2to3`。請參閱 :ref:`2to3-reference`。" - -#: ../../glossary.rst:33 +#: ../../glossary.rst:25 msgid "abstract base class" msgstr "abstract base class(抽象基底類別)" -#: ../../glossary.rst:35 +#: ../../glossary.rst:27 msgid "" "Abstract base classes complement :term:`duck-typing` by providing a way to " "define interfaces when other techniques like :func:`hasattr` would be clumsy " @@ -109,11 +86,11 @@ msgstr "" "模組)及 import 尋檢器和載入器(在 :mod:`importlib.abc` 模組)。你可以使用 :" "mod:`abc` 模組建立自己的 ABC。" -#: ../../glossary.rst:46 +#: ../../glossary.rst:38 msgid "annotation" msgstr "annotation(註釋)" -#: ../../glossary.rst:48 +#: ../../glossary.rst:40 msgid "" "A label associated with a variable, a class attribute or a function " "parameter or return value, used by convention as a :term:`type hint`." @@ -121,7 +98,7 @@ msgstr "" "一個與變數、class 屬性、函式的參數或回傳值相關聯的標籤。照慣例,它被用來作" "為 :term:`type hint`\\ (型別提示)。" -#: ../../glossary.rst:52 +#: ../../glossary.rst:44 msgid "" "Annotations of local variables cannot be accessed at runtime, but " "annotations of global variables, class attributes, and functions are stored " @@ -132,7 +109,7 @@ msgstr "" "的註解,會分別被儲存在模組、class 和函式的 :attr:`__annotations__` 特殊屬性" "中。" -#: ../../glossary.rst:58 +#: ../../glossary.rst:50 msgid "" "See :term:`variable annotation`, :term:`function annotation`, :pep:`484` " "and :pep:`526`, which describe this functionality. Also see :ref:" @@ -142,11 +119,11 @@ msgstr "" "和 :pep:`526`,這些章節皆有此功能的說明。關於註釋的最佳實踐方法也請參閱 :ref:" "`annotations-howto`。" -#: ../../glossary.rst:62 +#: ../../glossary.rst:54 msgid "argument" msgstr "argument(引數)" -#: ../../glossary.rst:64 +#: ../../glossary.rst:56 msgid "" "A value passed to a :term:`function` (or :term:`method`) when calling the " "function. There are two kinds of argument:" @@ -154,7 +131,7 @@ msgstr "" "呼叫函式時被傳遞給 :term:`function`\\ (或 :term:`method`\\ )的值。引數有兩" "種:" -#: ../../glossary.rst:67 +#: ../../glossary.rst:59 msgid "" ":dfn:`keyword argument`: an argument preceded by an identifier (e.g. " "``name=``) in a function call or passed as a value in a dictionary preceded " @@ -166,13 +143,15 @@ msgstr "" "遞的引數。例如,``3`` 和 ``5`` 都是以下 :func:`complex` 呼叫中的關鍵字引" "數: ::" -#: ../../glossary.rst:72 +#: ../../glossary.rst:64 msgid "" "complex(real=3, imag=5)\n" "complex(**{'real': 3, 'imag': 5})" msgstr "" +"complex(real=3, imag=5)\n" +"complex(**{'real': 3, 'imag': 5})" -#: ../../glossary.rst:75 +#: ../../glossary.rst:67 msgid "" ":dfn:`positional argument`: an argument that is not a keyword argument. " "Positional arguments can appear at the beginning of an argument list and/or " @@ -183,13 +162,15 @@ msgstr "" "引數列表的起始處出現,和(或)作為 ``*`` 之後的 :term:`iterable`\\ (可疊代物" "件)中的元素被傳遞。例如,``3`` 和 ``5`` 都是以下呼叫中的位置引數: ::" -#: ../../glossary.rst:81 +#: ../../glossary.rst:73 msgid "" "complex(3, 5)\n" "complex(*(3, 5))" msgstr "" +"complex(3, 5)\n" +"complex(*(3, 5))" -#: ../../glossary.rst:84 +#: ../../glossary.rst:76 msgid "" "Arguments are assigned to the named local variables in a function body. See " "the :ref:`calls` section for the rules governing this assignment. " @@ -200,7 +181,7 @@ msgstr "" "\\ :ref:`calls`\\ 章節。在語法上,任何運算式都可以被用來表示一個引數;其評估" "值會被指定給區域變數。" -#: ../../glossary.rst:89 +#: ../../glossary.rst:81 msgid "" "See also the :term:`parameter` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " @@ -209,11 +190,11 @@ msgstr "" "另請參閱術語表的 :term:`parameter`\\ (參數)條目、常見問題中的\\ :ref:`引數" "和參數之間的差異 `,以及 :pep:`362`。" -#: ../../glossary.rst:92 +#: ../../glossary.rst:84 msgid "asynchronous context manager" msgstr "asynchronous context manager(非同步情境管理器)" -#: ../../glossary.rst:94 +#: ../../glossary.rst:86 msgid "" "An object which controls the environment seen in an :keyword:`async with` " "statement by defining :meth:`~object.__aenter__` and :meth:`~object." @@ -223,11 +204,11 @@ msgstr "" "meth:`~object.__aenter__` 和 :meth:`~object.__aexit__` method(方法)來控制" "的。由 :pep:`492` 引入。" -#: ../../glossary.rst:97 +#: ../../glossary.rst:89 msgid "asynchronous generator" msgstr "asynchronous generator(非同步產生器)" -#: ../../glossary.rst:99 +#: ../../glossary.rst:91 msgid "" "A function which returns an :term:`asynchronous generator iterator`. It " "looks like a coroutine function defined with :keyword:`async def` except " @@ -239,7 +220,7 @@ msgstr "" "function),但不同的是它包含了 :keyword:`yield` 運算式,能生成一系列可用於 :" "keyword:`async for` 迴圈的值。" -#: ../../glossary.rst:104 +#: ../../glossary.rst:96 msgid "" "Usually refers to an asynchronous generator function, but may refer to an " "*asynchronous generator iterator* in some contexts. In cases where the " @@ -249,7 +230,7 @@ msgstr "" "同步產生器疊代器 (asynchronous generator iterator)*。萬一想表達的意思不夠清" "楚,那就使用完整的術語,以避免歧義。" -#: ../../glossary.rst:108 +#: ../../glossary.rst:100 msgid "" "An asynchronous generator function may contain :keyword:`await` expressions " "as well as :keyword:`async for`, and :keyword:`async with` statements." @@ -257,16 +238,16 @@ msgstr "" "一個非同步產生器函式可能包含 :keyword:`await` 運算式,以及 :keyword:`async " "for` 和 :keyword:`async with` 陳述式。" -#: ../../glossary.rst:111 +#: ../../glossary.rst:103 msgid "asynchronous generator iterator" msgstr "asynchronous generator iterator(非同步產生器疊代器)" -#: ../../glossary.rst:113 +#: ../../glossary.rst:105 msgid "An object created by a :term:`asynchronous generator` function." msgstr "" "一個由 :term:`asynchronous generator`\\ (非同步產生器)函式所建立的物件。" -#: ../../glossary.rst:115 +#: ../../glossary.rst:107 msgid "" "This is an :term:`asynchronous iterator` which when called using the :meth:" "`~object.__anext__` method returns an awaitable object which will execute " @@ -278,7 +259,7 @@ msgstr "" "object),該物件將執行非同步產生器的函式主體,直到遇到下一個 :keyword:`yield` " "運算式。" -#: ../../glossary.rst:120 +#: ../../glossary.rst:112 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "location execution state (including local variables and pending try-" @@ -291,11 +272,11 @@ msgstr "" "__anext__` 回傳的可等待物件有效地回復時,它會從停止的地方繼續執行。請參閱 :" "pep:`492` 和 :pep:`525`。" -#: ../../glossary.rst:125 +#: ../../glossary.rst:117 msgid "asynchronous iterable" msgstr "asynchronous iterable(非同步可疊代物件)" -#: ../../glossary.rst:127 +#: ../../glossary.rst:119 msgid "" "An object, that can be used in an :keyword:`async for` statement. Must " "return an :term:`asynchronous iterator` from its :meth:`~object.__aiter__` " @@ -305,11 +286,11 @@ msgstr "" "`~object.__aiter__` method 回傳一個 :term:`asynchronous iterator`\\ (非同步" "疊代器)。由 :pep:`492` 引入。" -#: ../../glossary.rst:130 +#: ../../glossary.rst:122 msgid "asynchronous iterator" msgstr "asynchronous iterator(非同步疊代器)" -#: ../../glossary.rst:132 +#: ../../glossary.rst:124 msgid "" "An object that implements the :meth:`~object.__aiter__` and :meth:`~object." "__anext__` methods. :meth:`~object.__anext__` must return an :term:" @@ -323,11 +304,11 @@ msgstr "" "method 所回傳的可等待物件,直到它引發 :exc:`StopAsyncIteration` 例外。由 :" "pep:`492` 引入。" -#: ../../glossary.rst:137 +#: ../../glossary.rst:129 msgid "attribute" msgstr "attribute(屬性)" -#: ../../glossary.rst:139 +#: ../../glossary.rst:131 msgid "" "A value associated with an object which is usually referenced by name using " "dotted expressions. For example, if an object *o* has an attribute *a* it " @@ -336,7 +317,7 @@ msgstr "" "一個與某物件相關聯的值,該值大多能透過使用點分隔運算式 (dotted expression) 的" "名稱被參照。例如,如果物件 *o* 有一個屬性 *a*,則該屬性能以 *o.a* 被參照。" -#: ../../glossary.rst:144 +#: ../../glossary.rst:136 msgid "" "It is possible to give an object an attribute whose name is not an " "identifier as defined by :ref:`identifiers`, for example using :func:" @@ -348,11 +329,11 @@ msgstr "" "別符 (identifier) 的屬性是有可能的,例如使用 :func:`setattr`。像這樣的屬性將" "無法使用點分隔運算式來存取,而是需要使用 :func:`getattr` 來取得它。" -#: ../../glossary.rst:149 +#: ../../glossary.rst:141 msgid "awaitable" msgstr "awaitable(可等待物件)" -#: ../../glossary.rst:151 +#: ../../glossary.rst:143 msgid "" "An object that can be used in an :keyword:`await` expression. Can be a :" "term:`coroutine` or an object with an :meth:`~object.__await__` method. See " @@ -362,11 +343,11 @@ msgstr "" "`coroutine`\\ (協程),或是一個有 :meth:`~object.__await__` method 的物件。" "另請參閱 :pep:`492`。" -#: ../../glossary.rst:154 +#: ../../glossary.rst:146 msgid "BDFL" msgstr "BDFL" -#: ../../glossary.rst:156 +#: ../../glossary.rst:148 msgid "" "Benevolent Dictator For Life, a.k.a. `Guido van Rossum `_, Python's creator." @@ -374,11 +355,11 @@ msgstr "" "Benevolent Dictator For Life(終身仁慈獨裁者),又名 `Guido van Rossum " "`_,Python 的創造者。" -#: ../../glossary.rst:158 +#: ../../glossary.rst:150 msgid "binary file" msgstr "binary file(二進位檔案)" -#: ../../glossary.rst:160 +#: ../../glossary.rst:152 msgid "" "A :term:`file object` able to read and write :term:`bytes-like objects " "`. Examples of binary files are files opened in binary " @@ -392,7 +373,7 @@ msgstr "" "`、:data:`sys.stdout.buffer `,以及 :class:`io." "BytesIO` 和 :class:`gzip.GzipFile` 實例。" -#: ../../glossary.rst:167 +#: ../../glossary.rst:159 msgid "" "See also :term:`text file` for a file object able to read and write :class:" "`str` objects." @@ -400,11 +381,11 @@ msgstr "" "另請參閱 :term:`text file`\\ (文字檔案),它是一個能夠讀取和寫入 :class:" "`str` 物件的檔案物件。" -#: ../../glossary.rst:169 +#: ../../glossary.rst:161 msgid "borrowed reference" msgstr "borrowed reference(借用參照)" -#: ../../glossary.rst:171 +#: ../../glossary.rst:163 msgid "" "In Python's C API, a borrowed reference is a reference to an object, where " "the code using the object does not own the reference. It becomes a dangling " @@ -416,7 +397,7 @@ msgstr "" "如,一次垃圾回收 (garbage collection) 可以移除對物件的最後一個 :term:`strong " "reference`\\ (強參照),而將該物件銷毀。" -#: ../../glossary.rst:177 +#: ../../glossary.rst:169 msgid "" "Calling :c:func:`Py_INCREF` on the :term:`borrowed reference` is recommended " "to convert it to a :term:`strong reference` in-place, except when the object " @@ -429,11 +410,11 @@ msgstr "" "借用參照之前被銷毀。:c:func:`Py_NewRef` 函式可用於建立一個新的 :term:`strong " "reference`。" -#: ../../glossary.rst:182 +#: ../../glossary.rst:174 msgid "bytes-like object" msgstr "bytes-like object(類位元組串物件)" -#: ../../glossary.rst:184 +#: ../../glossary.rst:176 msgid "" "An object that supports the :ref:`bufferobjects` and can export a C-:term:" "`contiguous` buffer. This includes all :class:`bytes`, :class:`bytearray`, " @@ -447,7 +428,7 @@ msgstr "" "物件,以及許多常見的 :class:`memoryview` 物件。類位元組串物件可用於處理二進位" "資料的各種運算;這些運算包括壓縮、儲存至二進位檔案和透過 socket(插座)發送。" -#: ../../glossary.rst:191 +#: ../../glossary.rst:183 msgid "" "Some operations need the binary data to be mutable. The documentation often " "refers to these as \"read-write bytes-like objects\". Example mutable " @@ -462,11 +443,11 @@ msgstr "" "的類位元組串物件」)中;這些物件包括 :class:`bytes`,以及 :class:`bytes` 物件" "的 :class:`memoryview`。" -#: ../../glossary.rst:199 +#: ../../glossary.rst:191 msgid "bytecode" msgstr "bytecode(位元組碼)" -#: ../../glossary.rst:201 +#: ../../glossary.rst:193 msgid "" "Python source code is compiled into bytecode, the internal representation of " "a Python program in the CPython interpreter. The bytecode is also cached in " @@ -485,18 +466,18 @@ msgstr "" "上是無法在不同的 Python 虛擬機器之間運作的,也不能在不同版本的 Python 之間保" "持穩定。" -#: ../../glossary.rst:211 +#: ../../glossary.rst:203 msgid "" "A list of bytecode instructions can be found in the documentation for :ref:" "`the dis module `." msgstr "" "位元組碼的指令列表可以在 :ref:`dis 模組 `\\ 的說明文件中找到。" -#: ../../glossary.rst:213 +#: ../../glossary.rst:205 msgid "callable" msgstr "callable(可呼叫物件)" -#: ../../glossary.rst:215 +#: ../../glossary.rst:207 msgid "" "A callable is an object that can be called, possibly with a set of arguments " "(see :term:`argument`), with the following syntax::" @@ -504,11 +485,11 @@ msgstr "" "一個 callable 是可以被呼叫的物件,呼叫時可能以下列形式帶有一組引數(請見 :" "term:`argument`): ::" -#: ../../glossary.rst:218 +#: ../../glossary.rst:210 msgid "callable(argument1, argument2, argumentN)" -msgstr "" +msgstr "callable(argument1, argument2, argumentN)" -#: ../../glossary.rst:220 +#: ../../glossary.rst:212 msgid "" "A :term:`function`, and by extension a :term:`method`, is a callable. An " "instance of a class that implements the :meth:`~object.__call__` method is " @@ -517,22 +498,22 @@ msgstr "" "一個 :term:`function` 與其延伸的 :term:`method` 都是 callable。一個有實作 :" "meth:`~object.__call__` 方法的 class 之實例也是個 callable。" -#: ../../glossary.rst:223 +#: ../../glossary.rst:215 msgid "callback" msgstr "callback(回呼)" -#: ../../glossary.rst:225 +#: ../../glossary.rst:217 msgid "" "A subroutine function which is passed as an argument to be executed at some " "point in the future." msgstr "" "作為引數被傳遞的一個副程式 (subroutine) 函式,會在未來的某個時間點被執行。" -#: ../../glossary.rst:227 +#: ../../glossary.rst:219 msgid "class" msgstr "class(類別)" -#: ../../glossary.rst:229 +#: ../../glossary.rst:221 msgid "" "A template for creating user-defined objects. Class definitions normally " "contain method definitions which operate on instances of the class." @@ -540,11 +521,11 @@ msgstr "" "一個用於建立使用者定義物件的模板。Class 的定義通常會包含 method 的定義,這些 " "method 可以在 class 的實例上進行操作。" -#: ../../glossary.rst:232 +#: ../../glossary.rst:224 msgid "class variable" msgstr "class variable(類別變數)" -#: ../../glossary.rst:234 +#: ../../glossary.rst:226 msgid "" "A variable defined in a class and intended to be modified only at class " "level (i.e., not in an instance of the class)." @@ -552,11 +533,11 @@ msgstr "" "一個在 class 中被定義,且應該只能在 class 層次(意即不是在 class 的實例中)被" "修改的變數。" -#: ../../glossary.rst:236 +#: ../../glossary.rst:228 msgid "complex number" msgstr "complex number(複數)" -#: ../../glossary.rst:238 +#: ../../glossary.rst:230 msgid "" "An extension of the familiar real number system in which all numbers are " "expressed as a sum of a real part and an imaginary part. Imaginary numbers " @@ -576,11 +557,11 @@ msgstr "" "相當進階的數學功能。如果你沒有察覺到對它們的需求,那麼幾乎能確定你可以安全地" "忽略它們。" -#: ../../glossary.rst:248 +#: ../../glossary.rst:240 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../glossary.rst:250 +#: ../../glossary.rst:242 msgid "" "An object which controls the environment seen in a :keyword:`with` statement " "by defining :meth:`~object.__enter__` and :meth:`~object.__exit__` methods. " @@ -590,11 +571,11 @@ msgstr "" "`~object.__enter__` 和 :meth:`~object.__exit__` method 來控制的。請參閱 :pep:" "`343`。" -#: ../../glossary.rst:253 +#: ../../glossary.rst:245 msgid "context variable" msgstr "context variable(情境變數)" -#: ../../glossary.rst:255 +#: ../../glossary.rst:247 msgid "" "A variable which can have different values depending on its context. This is " "similar to Thread-Local Storage in which each execution thread may have a " @@ -609,11 +590,11 @@ msgstr "" "任務 (concurrent asynchronous task) 中,對於變數狀態的追蹤。請參閱 :mod:" "`contextvars`。" -#: ../../glossary.rst:262 +#: ../../glossary.rst:254 msgid "contiguous" msgstr "contiguous(連續的)" -#: ../../glossary.rst:266 +#: ../../glossary.rst:258 msgid "" "A buffer is considered contiguous exactly if it is either *C-contiguous* or " "*Fortran contiguous*. Zero-dimensional buffers are C and Fortran " @@ -630,11 +611,11 @@ msgstr "" "的順序訪問各個項目時,最後一個索引的變化最快。然而,在 Fortran contiguous 陣" "列中,第一個索引的變化最快。" -#: ../../glossary.rst:274 +#: ../../glossary.rst:266 msgid "coroutine" msgstr "coroutine(協程)" -#: ../../glossary.rst:276 +#: ../../glossary.rst:268 msgid "" "Coroutines are a more generalized form of subroutines. Subroutines are " "entered at one point and exited at another point. Coroutines can be " @@ -645,11 +626,11 @@ msgstr "" "在另一個時間點被退出。協程可以在許多不同的時間點被進入、退出和回復。它們能夠" "以 :keyword:`async def` 陳述式被實作。另請參閱 :pep:`492`。" -#: ../../glossary.rst:281 +#: ../../glossary.rst:273 msgid "coroutine function" msgstr "coroutine function(協程函式)" -#: ../../glossary.rst:283 +#: ../../glossary.rst:275 msgid "" "A function which returns a :term:`coroutine` object. A coroutine function " "may be defined with the :keyword:`async def` statement, and may contain :" @@ -660,11 +641,11 @@ msgstr "" "`async def` 陳述式被定義,並可能會包含 :keyword:`await`、:keyword:`async " "for` 和 :keyword:`async with` 關鍵字。這些關鍵字由 :pep:`492` 引入。" -#: ../../glossary.rst:288 +#: ../../glossary.rst:280 msgid "CPython" msgstr "CPython" -#: ../../glossary.rst:290 +#: ../../glossary.rst:282 msgid "" "The canonical implementation of the Python programming language, as " "distributed on `python.org `_. The term \"CPython\" " @@ -675,11 +656,11 @@ msgstr "" "`_ 上。「CPython」這個術語在必要時被使用,以區分此實" "作與其它語言的實作,例如 Jython 或 IronPython。" -#: ../../glossary.rst:294 +#: ../../glossary.rst:286 msgid "decorator" msgstr "decorator(裝飾器)" -#: ../../glossary.rst:296 +#: ../../glossary.rst:288 msgid "" "A function returning another function, usually applied as a function " "transformation using the ``@wrapper`` syntax. Common examples for " @@ -689,13 +670,13 @@ msgstr "" "式的變換 (function transformation)。裝飾器的常見範例是 :func:`classmethod` " "和 :func:`staticmethod`。" -#: ../../glossary.rst:300 +#: ../../glossary.rst:292 msgid "" "The decorator syntax is merely syntactic sugar, the following two function " "definitions are semantically equivalent::" msgstr "裝飾器語法只是語法糖。以下兩個函式定義在語義上是等效的: ::" -#: ../../glossary.rst:303 +#: ../../glossary.rst:295 msgid "" "def f(arg):\n" " ...\n" @@ -713,7 +694,7 @@ msgstr "" "def f(arg):\n" " ..." -#: ../../glossary.rst:311 +#: ../../glossary.rst:303 msgid "" "The same concept exists for classes, but is less commonly used there. See " "the documentation for :ref:`function definitions ` and :ref:`class " @@ -722,11 +703,11 @@ msgstr "" "Class 也存在相同的概念,但在那裡比較不常用。關於裝飾器的更多內容,請參閱\\ :" "ref:`函式定義 `\\ 和 :ref:`class 定義 `\\ 的說明文件。" -#: ../../glossary.rst:314 +#: ../../glossary.rst:306 msgid "descriptor" msgstr "descriptor(描述器)" -#: ../../glossary.rst:316 +#: ../../glossary.rst:308 msgid "" "Any object which defines the methods :meth:`~object.__get__`, :meth:`~object." "__set__`, or :meth:`~object.__delete__`. When a class attribute is a " @@ -746,7 +727,7 @@ msgstr "" "們是許多功能的基礎,這些功能包括函式、method、屬性 (property)、class method、" "靜態 method,以及對 super class(父類別)的參照。" -#: ../../glossary.rst:327 +#: ../../glossary.rst:319 msgid "" "For more information about descriptors' methods, see :ref:`descriptors` or " "the :ref:`Descriptor How To Guide `." @@ -754,25 +735,25 @@ msgstr "" "關於描述器 method 的更多資訊,請參閱\\ :ref:`descriptors`\\ 或\\ :ref:`描述器" "使用指南 `。" -#: ../../glossary.rst:329 +#: ../../glossary.rst:321 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../glossary.rst:331 +#: ../../glossary.rst:323 msgid "" "An associative array, where arbitrary keys are mapped to values. The keys " "can be any object with :meth:`~object.__hash__` and :meth:`~object.__eq__` " "methods. Called a hash in Perl." msgstr "" -"一個關聯陣列 (associative array),其中任意的鍵會被映射到值。鍵可以是任何帶" +"一個關聯陣列 (associative array),其中任意的鍵會被對映到值。鍵可以是任何帶" "有 :meth:`~object.__hash__` 和 :meth:`~object.__eq__` method 的物件。在 Perl " "中被稱為雜湊 (hash)。" -#: ../../glossary.rst:335 +#: ../../glossary.rst:327 msgid "dictionary comprehension" msgstr "dictionary comprehension(字典綜合運算)" -#: ../../glossary.rst:337 +#: ../../glossary.rst:329 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a dictionary with the results. ``results = {n: n ** 2 for n in " @@ -781,13 +762,13 @@ msgid "" msgstr "" "一種緊密的方法,用來處理一個可疊代物件中的全部或部分元素,並將處理結果以一個" "字典回傳。``results = {n: n ** 2 for n in range(10)}`` 會產生一個字典,它包含" -"了鍵 ``n`` 映射到值 ``n ** 2``。請參閱\\ :ref:`comprehensions`。" +"了鍵 ``n`` 對映到值 ``n ** 2``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:341 +#: ../../glossary.rst:333 msgid "dictionary view" msgstr "dictionary view(字典檢視)" -#: ../../glossary.rst:343 +#: ../../glossary.rst:335 msgid "" "The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:" "`dict.items` are called dictionary views. They provide a dynamic view on the " @@ -800,28 +781,28 @@ msgstr "" "反映這些變動。若要強制將字典檢視轉為完整的 list(串列),須使用 " "``list(dictview)``。請參閱\\ :ref:`dict-views`。" -#: ../../glossary.rst:349 +#: ../../glossary.rst:341 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../glossary.rst:351 +#: ../../glossary.rst:343 msgid "" "A string literal which appears as the first expression in a class, function " "or module. While ignored when the suite is executed, it is recognized by " -"the compiler and put into the :attr:`!__doc__` attribute of the enclosing " -"class, function or module. Since it is available via introspection, it is " -"the canonical place for documentation of the object." +"the compiler and put into the :attr:`~definition.__doc__` attribute of the " +"enclosing class, function or module. Since it is available via " +"introspection, it is the canonical place for documentation of the object." msgstr "" "一個在 class、函式或模組中,作為第一個運算式出現的字串文本。雖然它在套件執行" -"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組的 :attr:`!" -"__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏覽,因此它是物" -"件的說明文件存放的標準位置。" +"時會被忽略,但它會被編譯器辨識,並被放入所屬 class、函式或模組的 :attr:" +"`~definition.__doc__` 屬性中。由於說明字串可以透過內省 (introspection) 來瀏" +"覽,因此它是物件的說明文件存放的標準位置。" -#: ../../glossary.rst:357 +#: ../../glossary.rst:349 msgid "duck-typing" msgstr "duck-typing(鴨子型別)" -#: ../../glossary.rst:359 +#: ../../glossary.rst:351 msgid "" "A programming style which does not look at an object's type to determine if " "it has the right interface; instead, the method or attribute is simply " @@ -842,11 +823,11 @@ msgstr "" "來補充。)然而,它通常會採用 :func:`hasattr` 測試,或是 :term:`EAFP` 程式設計" "風格。" -#: ../../glossary.rst:368 +#: ../../glossary.rst:360 msgid "EAFP" msgstr "EAFP" -#: ../../glossary.rst:370 +#: ../../glossary.rst:362 msgid "" "Easier to ask for forgiveness than permission. This common Python coding " "style assumes the existence of valid keys or attributes and catches " @@ -861,11 +842,11 @@ msgstr "" "keyword:`except` 陳述式。該技術與許多其他語言(例如 C)常見的 :term:`LBYL` 風" "格形成了對比。" -#: ../../glossary.rst:376 +#: ../../glossary.rst:368 msgid "expression" msgstr "expression(運算式)" -#: ../../glossary.rst:378 +#: ../../glossary.rst:370 msgid "" "A piece of syntax which can be evaluated to some value. In other words, an " "expression is an accumulation of expression elements like literals, names, " @@ -881,11 +862,11 @@ msgstr "" "(陳述式)不能被用作運算式,例如 :keyword:`while`。賦值 (assignment) 也是陳述" "式,而不是運算式。" -#: ../../glossary.rst:385 +#: ../../glossary.rst:377 msgid "extension module" msgstr "extension module(擴充模組)" -#: ../../glossary.rst:387 +#: ../../glossary.rst:379 msgid "" "A module written in C or C++, using Python's C API to interact with the core " "and with user code." @@ -893,11 +874,11 @@ msgstr "" "一個以 C 或 C++ 編寫的模組,它使用 Python 的 C API 來與核心及使用者程式碼進行" "互動。" -#: ../../glossary.rst:389 +#: ../../glossary.rst:381 msgid "f-string" msgstr "f-string(f 字串)" -#: ../../glossary.rst:391 +#: ../../glossary.rst:383 msgid "" "String literals prefixed with ``'f'`` or ``'F'`` are commonly called \"f-" "strings\" which is short for :ref:`formatted string literals `. " @@ -906,11 +887,11 @@ msgstr "" "以 ``'f'`` 或 ``'F'`` 為前綴的字串文本通常被稱為「f 字串」,它是\\ :ref:`格式" "化的字串文本 `\\ 的縮寫。另請參閱 :pep:`498`。" -#: ../../glossary.rst:394 +#: ../../glossary.rst:386 msgid "file object" msgstr "file object(檔案物件)" -#: ../../glossary.rst:396 +#: ../../glossary.rst:388 msgid "" "An object exposing a file-oriented API (with methods such as :meth:`!read` " "or :meth:`!write`) to an underlying resource. Depending on the way it was " @@ -925,7 +906,7 @@ msgstr "" "衝區、socket(插座)、管線 (pipe) 等)的存取。檔案物件也被稱為\\ :dfn:`類檔案" "物件 (file-like object)` 或\\ :dfn:`串流 (stream)`。" -#: ../../glossary.rst:404 +#: ../../glossary.rst:396 msgid "" "There are actually three categories of file objects: raw :term:`binary files " "`, buffered :term:`binary files ` and :term:`text " @@ -937,19 +918,19 @@ msgstr "" "term:`二進位檔案 `\\ 和\\ :term:`文字檔案 `。它們的介" "面在 :mod:`io` 模組中被定義。建立檔案物件的標準方法是使用 :func:`open` 函式。" -#: ../../glossary.rst:409 +#: ../../glossary.rst:401 msgid "file-like object" msgstr "file-like object(類檔案物件)" -#: ../../glossary.rst:411 +#: ../../glossary.rst:403 msgid "A synonym for :term:`file object`." msgstr ":term:`file object`\\ (檔案物件)的同義字。" -#: ../../glossary.rst:412 +#: ../../glossary.rst:404 msgid "filesystem encoding and error handler" msgstr "filesystem encoding and error handler(檔案系統編碼和錯誤處理函式)" -#: ../../glossary.rst:414 +#: ../../glossary.rst:406 msgid "" "Encoding and error handler used by Python to decode bytes from the operating " "system and encode Unicode to the operating system." @@ -957,7 +938,7 @@ msgstr "" "Python 所使用的一種編碼和錯誤處理函式,用來解碼來自作業系統的位元組,以及將 " "Unicode 編碼到作業系統。" -#: ../../glossary.rst:417 +#: ../../glossary.rst:409 msgid "" "The filesystem encoding must guarantee to successfully decode all bytes " "below 128. If the file system encoding fails to provide this guarantee, API " @@ -966,7 +947,7 @@ msgstr "" "檔案系統編碼必須保證能成功解碼所有小於 128 的位元組。如果檔案系統編碼無法提供" "此保證,則 API 函式會引發 :exc:`UnicodeError`。" -#: ../../glossary.rst:421 +#: ../../glossary.rst:413 msgid "" "The :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors` functions can be used to get the filesystem " @@ -975,7 +956,7 @@ msgstr "" ":func:`sys.getfilesystemencoding` 和 :func:`sys.getfilesystemencodeerrors` 函" "式可用於取得檔案系統編碼和錯誤處理函式。" -#: ../../glossary.rst:425 +#: ../../glossary.rst:417 msgid "" "The :term:`filesystem encoding and error handler` are configured at Python " "startup by the :c:func:`PyConfig_Read` function: see :c:member:`~PyConfig." @@ -987,22 +968,22 @@ msgstr "" "member:`~PyConfig.filesystem_encoding`,以及 :c:type:`PyConfig` 的成員 :c:" "member:`~PyConfig.filesystem_errors`。" -#: ../../glossary.rst:430 +#: ../../glossary.rst:422 msgid "See also the :term:`locale encoding`." msgstr "另請參閱 :term:`locale encoding`\\ (區域編碼)。" -#: ../../glossary.rst:431 +#: ../../glossary.rst:423 msgid "finder" msgstr "finder(尋檢器)" -#: ../../glossary.rst:433 +#: ../../glossary.rst:425 msgid "" "An object that tries to find the :term:`loader` for a module that is being " "imported." msgstr "" "一個物件,它會嘗試為正在被 import 的模組尋找 :term:`loader`\\ (載入器)。" -#: ../../glossary.rst:436 +#: ../../glossary.rst:428 msgid "" "There are two types of finder: :term:`meta path finders ` " "for use with :data:`sys.meta_path`, and :term:`path entry finders ` 會使用 :data:`sys.meta_path`,而\\ :term:`路徑項目尋檢器 (path " "entry finder) ` 會使用 :data:`sys.path_hooks`。" -#: ../../glossary.rst:440 +#: ../../glossary.rst:432 msgid "See :ref:`importsystem` and :mod:`importlib` for much more detail." msgstr "請參閱 :ref:`importsystem` 和 :mod:`importlib` 以了解更多細節。" -#: ../../glossary.rst:441 +#: ../../glossary.rst:433 msgid "floor division" msgstr "floor division(向下取整除法)" -#: ../../glossary.rst:443 +#: ../../glossary.rst:435 msgid "" "Mathematical division that rounds down to nearest integer. The floor " "division operator is ``//``. For example, the expression ``11 // 4`` " @@ -1033,11 +1014,26 @@ msgstr "" "``2.75`` 不同。請注意,``(-11) // 4`` 的結果是 ``-3``,因為是 ``-2.75`` 被\\ " "*向下*\\ 無條件捨去。請參閱 :pep:`238`。" -#: ../../glossary.rst:448 +#: ../../glossary.rst:440 +msgid "free threading" +msgstr "free threading(自由執行緒)" + +#: ../../glossary.rst:442 +msgid "" +"A threading model where multiple threads can run Python bytecode " +"simultaneously within the same interpreter. This is in contrast to the :" +"term:`global interpreter lock` which allows only one thread to execute " +"Python bytecode at a time. See :pep:`703`." +msgstr "" +"為一種執行緒模型,多個執行緒可以在同一直譯器中同時運行 Python 位元組碼。這與" +"\\ :term:`全域直譯器鎖 `\\ 形成對比,後者一次只允許" +"一個執行緒執行 Python 位元組碼。請參閱 :pep:`703`。" + +#: ../../glossary.rst:446 msgid "function" msgstr "function(函式)" -#: ../../glossary.rst:450 +#: ../../glossary.rst:448 msgid "" "A series of statements which returns some value to a caller. It can also be " "passed zero or more :term:`arguments ` which may be used in the " @@ -1049,15 +1045,15 @@ msgstr "" "`parameter`\\ (參數)、:term:`method`\\ (方法),以及\\ :ref:`function`\\ " "章節。" -#: ../../glossary.rst:454 +#: ../../glossary.rst:452 msgid "function annotation" msgstr "function annotation(函式註釋)" -#: ../../glossary.rst:456 +#: ../../glossary.rst:454 msgid "An :term:`annotation` of a function parameter or return value." msgstr "函式參數或回傳值的一個 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:458 +#: ../../glossary.rst:456 msgid "" "Function annotations are usually used for :term:`type hints `: " "for example, this function is expected to take two :class:`int` arguments " @@ -1066,7 +1062,7 @@ msgstr "" "函式註釋通常被使用於\\ :term:`型別提示 `:例如,這個函式預期會得到" "兩個 :class:`int` 引數,並會有一個 :class:`int` 回傳值: ::" -#: ../../glossary.rst:463 +#: ../../glossary.rst:461 msgid "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" @@ -1074,11 +1070,11 @@ msgstr "" "def sum_two_numbers(a: int, b: int) -> int:\n" " return a + b" -#: ../../glossary.rst:466 +#: ../../glossary.rst:464 msgid "Function annotation syntax is explained in section :ref:`function`." msgstr "函式註釋的語法在\\ :ref:`function`\\ 章節有詳細解釋。" -#: ../../glossary.rst:468 +#: ../../glossary.rst:466 msgid "" "See :term:`variable annotation` and :pep:`484`, which describe this " "functionality. Also see :ref:`annotations-howto` for best practices on " @@ -1087,11 +1083,11 @@ msgstr "" "請參閱 :term:`variable annotation` 和 :pep:`484`,皆有此功能的描述。關於註釋" "的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:472 +#: ../../glossary.rst:470 msgid "__future__" msgstr "__future__" -#: ../../glossary.rst:474 +#: ../../glossary.rst:472 msgid "" "A :ref:`future statement `, ``from __future__ import ``, " "directs the compiler to compile the current module using syntax or semantics " @@ -1107,7 +1103,7 @@ msgstr "" "import 此模組並對其變數求值,你可以看見一個新的功能是何時首次被新增到此語言" "中,以及它何時將會(或已經)成為預設的功能: ::" -#: ../../glossary.rst:482 +#: ../../glossary.rst:480 msgid "" ">>> import __future__\n" ">>> __future__.division\n" @@ -1117,11 +1113,11 @@ msgstr "" ">>> __future__.division\n" "_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)" -#: ../../glossary.rst:485 +#: ../../glossary.rst:483 msgid "garbage collection" msgstr "garbage collection(垃圾回收)" -#: ../../glossary.rst:487 +#: ../../glossary.rst:485 msgid "" "The process of freeing memory when it is not used anymore. Python performs " "garbage collection via reference counting and a cyclic garbage collector " @@ -1133,11 +1129,11 @@ msgstr "" "垃圾回收器 (cyclic garbage collector) 來完成。垃圾回收器可以使用 :mod:`gc` 模" "組對其進行控制。" -#: ../../glossary.rst:492 ../../glossary.rst:493 +#: ../../glossary.rst:490 ../../glossary.rst:491 msgid "generator" msgstr "generator(產生器)" -#: ../../glossary.rst:495 +#: ../../glossary.rst:493 msgid "" "A function which returns a :term:`generator iterator`. It looks like a " "normal function except that it contains :keyword:`yield` expressions for " @@ -1148,7 +1144,7 @@ msgstr "" "個正常的函式,但不同的是它包含了 :keyword:`yield` 運算式,能產生一系列的值," "這些值可用於 for 迴圈,或是以 :func:`next` 函式,每次檢索其中的一個值。" -#: ../../glossary.rst:500 +#: ../../glossary.rst:498 msgid "" "Usually refers to a generator function, but may refer to a *generator " "iterator* in some contexts. In cases where the intended meaning isn't " @@ -1157,15 +1153,15 @@ msgstr "" "這個術語通常用來表示一個產生器函式,但在某些情境中,也可能是表示\\ *產生器疊" "代器*。萬一想表達的意思不夠清楚,那就使用完整的術語,以避免歧義。" -#: ../../glossary.rst:503 +#: ../../glossary.rst:501 msgid "generator iterator" msgstr "generator iterator(產生器疊代器)" -#: ../../glossary.rst:505 +#: ../../glossary.rst:503 msgid "An object created by a :term:`generator` function." msgstr "一個由 :term:`generator`\\ (產生器)函式所建立的物件。" -#: ../../glossary.rst:507 +#: ../../glossary.rst:505 msgid "" "Each :keyword:`yield` temporarily suspends processing, remembering the " "location execution state (including local variables and pending try-" @@ -1176,32 +1172,35 @@ msgstr "" "中的 try 陳述式)。當\\ *產生器疊代器*\\ 回復時,它會從停止的地方繼續執行(與" "那些每次調用時都要重新開始的函式有所不同)。" -#: ../../glossary.rst:513 ../../glossary.rst:514 +#: ../../glossary.rst:511 ../../glossary.rst:512 msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../glossary.rst:516 +#: ../../glossary.rst:514 msgid "" -"An expression that returns an iterator. It looks like a normal expression " -"followed by a :keyword:`!for` clause defining a loop variable, range, and an " -"optional :keyword:`!if` clause. The combined expression generates values " -"for an enclosing function::" +"An :term:`expression` that returns an :term:`iterator`. It looks like a " +"normal expression followed by a :keyword:`!for` clause defining a loop " +"variable, range, and an optional :keyword:`!if` clause. The combined " +"expression generates values for an enclosing function::" msgstr "" -"一個會回傳疊代器的運算式。它看起來像一個正常的運算式,後面接著一個 :keyword:" -"`!for` 子句,該子句定義了迴圈變數、範圍以及一個選擇性的 :keyword:`!if` 子句。" -"該組合運算式會為外層函式產生多個值: ::" +"一個會回傳\\ :term:`疊代器 `\\ 的\\ :term:`運算式 `。它" +"看起來像一個正常的運算式,後面接著一個 :keyword:`!for` 子句,該子句定義了迴圈" +"變數、範圍以及一個選擇性的 :keyword:`!if` 子句。該組合運算式會為外層函式產生" +"多個值: ::" -#: ../../glossary.rst:521 +#: ../../glossary.rst:519 msgid "" ">>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81\n" "285" msgstr "" +">>> sum(i*i for i in range(10)) # 平方之和 0, 1, 4, ... 81\n" +"285" -#: ../../glossary.rst:523 +#: ../../glossary.rst:521 msgid "generic function" msgstr "generic function(泛型函式)" -#: ../../glossary.rst:525 +#: ../../glossary.rst:523 msgid "" "A function composed of multiple functions implementing the same operation " "for different types. Which implementation should be used during a call is " @@ -1210,7 +1209,7 @@ msgstr "" "一個由多個函式組成的函式,該函式會對不同的型別實作相同的運算。呼叫期間應該使" "用哪種實作,是由調度演算法 (dispatch algorithm) 來決定。" -#: ../../glossary.rst:529 +#: ../../glossary.rst:527 msgid "" "See also the :term:`single dispatch` glossary entry, the :func:`functools." "singledispatch` decorator, and :pep:`443`." @@ -1218,11 +1217,11 @@ msgstr "" "另請參閱 :term:`single dispatch`\\ (單一調度)術語表條目、:func:`functools." "singledispatch` 裝飾器和 :pep:`443`。" -#: ../../glossary.rst:531 +#: ../../glossary.rst:529 msgid "generic type" msgstr "generic type(泛型型別)" -#: ../../glossary.rst:533 +#: ../../glossary.rst:531 msgid "" "A :term:`type` that can be parameterized; typically a :ref:`container " "class` such as :class:`list` or :class:`dict`. Used for :" @@ -1232,7 +1231,7 @@ msgstr "" "`容器型別 `,像是 :class:`list` 和 :class:`dict`。它被用於" "\\ :term:`型別提示 `\\ 和\\ :term:`註釋 `。" -#: ../../glossary.rst:538 +#: ../../glossary.rst:536 msgid "" "For more details, see :ref:`generic alias types`, :pep:" "`483`, :pep:`484`, :pep:`585`, and the :mod:`typing` module." @@ -1240,19 +1239,19 @@ msgstr "" "詳情請參閱\\ :ref:`泛型別名型別 `、:pep:`483`、:pep:" "`484`、:pep:`585` 和 :mod:`typing` 模組。" -#: ../../glossary.rst:540 +#: ../../glossary.rst:538 msgid "GIL" msgstr "GIL" -#: ../../glossary.rst:542 +#: ../../glossary.rst:540 msgid "See :term:`global interpreter lock`." msgstr "請參閱 :term:`global interpreter lock`\\ (全域直譯器鎖)。" -#: ../../glossary.rst:543 +#: ../../glossary.rst:541 msgid "global interpreter lock" msgstr "global interpreter lock(全域直譯器鎖)" -#: ../../glossary.rst:545 +#: ../../glossary.rst:543 msgid "" "The mechanism used by the :term:`CPython` interpreter to assure that only " "one thread executes Python :term:`bytecode` at a time. This simplifies the " @@ -1269,7 +1268,7 @@ msgstr "" "(multi-threaded),但代價是會犧牲掉多處理器的機器能夠提供的一大部分平行性 " "(parallelism)。" -#: ../../glossary.rst:554 +#: ../../glossary.rst:552 msgid "" "However, some extension modules, either standard or third-party, are " "designed so as to release the GIL when doing computationally intensive tasks " @@ -1280,23 +1279,26 @@ msgstr "" "計算密集 (computationally intensive) 的任務時,可以解除 GIL。另外,在執行 I/" "O 時,GIL 總是會被解除。" -#: ../../glossary.rst:559 +#: ../../glossary.rst:557 msgid "" -"Past efforts to create a \"free-threaded\" interpreter (one which locks " -"shared data at a much finer granularity) have not been successful because " -"performance suffered in the common single-processor case. It is believed " -"that overcoming this performance issue would make the implementation much " -"more complicated and therefore costlier to maintain." +"As of Python 3.13, the GIL can be disabled using the :option:`--disable-gil` " +"build configuration. After building Python with this option, code must be " +"run with :option:`-X gil 0 <-X>` or after setting the :envvar:`PYTHON_GIL=0 " +"` environment variable. This feature enables improved " +"performance for multi-threaded applications and makes it easier to use multi-" +"core CPUs efficiently. For more details, see :pep:`703`." msgstr "" -"過去對於建立「無限制執行緒」直譯器(以更高的精細度鎖定共享資料的直譯器)的努" -"力並未成功,因為在一般的單一處理器情況下,效能會有所損失。一般認為,若要克服" -"這個效能問題,會使實作變得複雜許多,進而付出更高的維護成本。" +"從 Python 3.13 開始可以使用 :option:`--disable-gil` 建置設定來停用 GIL。使用" +"此選項建立 Python 後,必須使用 :option:`-X gil 0 <-X>` 來執行程式碼,或者設" +"定 :envvar:`PYTHON_GIL=0 ` 環境變數後再執行程式碼。此功能可以提高" +"多執行緒應用程式的效能,並使多核心 CPU 的高效使用變得更加容易。有關更多詳細資" +"訊,請參閱 :pep:`703`。" -#: ../../glossary.rst:565 +#: ../../glossary.rst:563 msgid "hash-based pyc" msgstr "hash-based pyc(雜湊架構的 pyc)" -#: ../../glossary.rst:567 +#: ../../glossary.rst:565 msgid "" "A bytecode cache file that uses the hash rather than the last-modified time " "of the corresponding source file to determine its validity. See :ref:`pyc-" @@ -1305,11 +1307,11 @@ msgstr "" "一個位元組碼 (bytecode) 暫存檔,它使用雜湊值而不是對應原始檔案的最後修改時" "間,來確定其有效性。請參閱\\ :ref:`pyc-invalidation`。" -#: ../../glossary.rst:570 +#: ../../glossary.rst:568 msgid "hashable" msgstr "hashable(可雜湊的)" -#: ../../glossary.rst:572 +#: ../../glossary.rst:570 msgid "" "An object is *hashable* if it has a hash value which never changes during " "its lifetime (it needs a :meth:`~object.__hash__` method), and can be " @@ -1321,7 +1323,7 @@ msgstr "" "`~object.__eq__` method),那麼它就是一個\\ *可雜湊*\\ 物件。比較結果為相等的" "多個可雜湊物件,它們必須擁有相同的雜湊值。" -#: ../../glossary.rst:578 +#: ../../glossary.rst:576 msgid "" "Hashability makes an object usable as a dictionary key and a set member, " "because these data structures use the hash value internally." @@ -1329,7 +1331,7 @@ msgstr "" "可雜湊性 (hashability) 使一個物件可用作 dictionary(字典)的鍵和 set(集合)" "的成員,因為這些資料結構都在其內部使用了雜湊值。" -#: ../../glossary.rst:581 +#: ../../glossary.rst:579 msgid "" "Most of Python's immutable built-in objects are hashable; mutable containers " "(such as lists or dictionaries) are not; immutable containers (such as " @@ -1344,11 +1346,11 @@ msgstr "" "則這些物件會被預設為可雜湊的。它們在互相比較時都是不相等的(除非它們與自己比" "較),而它們的雜湊值則是衍生自它們的 :func:`id`。" -#: ../../glossary.rst:588 +#: ../../glossary.rst:586 msgid "IDLE" msgstr "IDLE" -#: ../../glossary.rst:590 +#: ../../glossary.rst:588 msgid "" "An Integrated Development and Learning Environment for Python. :ref:`idle` " "is a basic editor and interpreter environment which ships with the standard " @@ -1358,28 +1360,31 @@ msgstr "" "境)。:ref:`idle` 是一個基本的編輯器和直譯器環境,它和 Python 的標準發行版本" "一起被提供。" -#: ../../glossary.rst:593 +#: ../../glossary.rst:591 msgid "immortal" -msgstr "" +msgstr "immportal(不滅)" -#: ../../glossary.rst:595 +#: ../../glossary.rst:593 msgid "" "*Immortal objects* are a CPython implementation detail introduced in :pep:" "`683`." -msgstr "" +msgstr "*不滅物件 (Immortal objects)* 是 :pep:`683` 引入的 CPython 實作細節。" -#: ../../glossary.rst:598 +#: ../../glossary.rst:596 msgid "" "If an object is immortal, its :term:`reference count` is never modified, and " "therefore it is never deallocated while the interpreter is running. For " "example, :const:`True` and :const:`None` are immortal in CPython." msgstr "" +"如果一個物件是不滅的,它的\\ :term:`參照計數 `\\ 永遠不會被" +"修改,因此在直譯器運行時它永遠不會被釋放。例如,:const:`True` 和 :const:" +"`None` 在 CPython 中是不滅的。" -#: ../../glossary.rst:601 +#: ../../glossary.rst:599 msgid "immutable" msgstr "immutable(不可變物件)" -#: ../../glossary.rst:603 +#: ../../glossary.rst:601 msgid "" "An object with a fixed value. Immutable objects include numbers, strings " "and tuples. Such an object cannot be altered. A new object has to be " @@ -1391,11 +1396,11 @@ msgstr "" "能被改變的。如果一個不同的值必須被儲存,則必須建立一個新的物件。它們在需要恆" "定雜湊值的地方,扮演重要的角色,例如 dictionary(字典)中的一個鍵。" -#: ../../glossary.rst:608 +#: ../../glossary.rst:606 msgid "import path" msgstr "import path(引入路徑)" -#: ../../glossary.rst:610 +#: ../../glossary.rst:608 msgid "" "A list of locations (or :term:`path entries `) that are searched " "by the :term:`path based finder` for modules to import. During import, this " @@ -1407,11 +1412,11 @@ msgstr "" "的位置。在 import 期間,此位置列表通常是來自 :data:`sys.path`,但對於子套件 " "(subpackage) 而言,它也可能是來自父套件的 ``__path__`` 屬性。" -#: ../../glossary.rst:615 +#: ../../glossary.rst:613 msgid "importing" msgstr "importing(引入)" -#: ../../glossary.rst:617 +#: ../../glossary.rst:615 msgid "" "The process by which Python code in one module is made available to Python " "code in another module." @@ -1419,11 +1424,11 @@ msgstr "" "一個過程。一個模組中的 Python 程式碼可以透過此過程,被另一個模組中的 Python " "程式碼使用。" -#: ../../glossary.rst:619 +#: ../../glossary.rst:617 msgid "importer" msgstr "importer(引入器)" -#: ../../glossary.rst:621 +#: ../../glossary.rst:619 msgid "" "An object that both finds and loads a module; both a :term:`finder` and :" "term:`loader` object." @@ -1431,28 +1436,29 @@ msgstr "" "一個能夠尋找及載入模組的物件;它既是 :term:`finder`\\ (尋檢器)也是 :term:" "`loader`\\ (載入器)物件。" -#: ../../glossary.rst:623 +#: ../../glossary.rst:621 msgid "interactive" msgstr "interactive(互動的)" -#: ../../glossary.rst:625 +#: ../../glossary.rst:623 msgid "" "Python has an interactive interpreter which means you can enter statements " "and expressions at the interpreter prompt, immediately execute them and see " "their results. Just launch ``python`` with no arguments (possibly by " "selecting it from your computer's main menu). It is a very powerful way to " -"test out new ideas or inspect modules and packages (remember ``help(x)``)." +"test out new ideas or inspect modules and packages (remember ``help(x)``). " +"For more on interactive mode, see :ref:`tut-interac`." msgstr "" "Python 有一個互動式直譯器,這表示你可以在直譯器的提示字元輸入陳述式和運算式," "立即執行它們並且看到它們的結果。只要啟動 ``python``,不需要任何引數(可能藉由" "從你的電腦的主選單選擇它)。這是測試新想法或檢查模塊和包的非常強大的方法(請" -"記住help(x))。" +"記住help(x))。更多互動式模式相關資訊請見 :ref:`tut-interac`。" -#: ../../glossary.rst:631 +#: ../../glossary.rst:630 msgid "interpreted" msgstr "interpreted(直譯的)" -#: ../../glossary.rst:633 +#: ../../glossary.rst:632 msgid "" "Python is an interpreted language, as opposed to a compiled one, though the " "distinction can be blurry because of the presence of the bytecode compiler. " @@ -1466,11 +1472,11 @@ msgstr "" "一個執行檔,然後再執行它。直譯語言通常比編譯語言有更短的開發/除錯週期,不過" "它們的程式通常也運行得較慢。另請參閱 :term:`interactive`\\ (互動的)。" -#: ../../glossary.rst:640 +#: ../../glossary.rst:639 msgid "interpreter shutdown" msgstr "interpreter shutdown(直譯器關閉)" -#: ../../glossary.rst:642 +#: ../../glossary.rst:641 msgid "" "When asked to shut down, the Python interpreter enters a special phase where " "it gradually releases all allocated resources, such as modules and various " @@ -1488,18 +1494,18 @@ msgstr "" "段被執行的程式碼會遇到各種例外,因為它所依賴的資源可能不再有作用了(常見的例" "子是函式庫模組或是警告機制)。" -#: ../../glossary.rst:651 +#: ../../glossary.rst:650 msgid "" "The main reason for interpreter shutdown is that the ``__main__`` module or " "the script being run has finished executing." msgstr "" "直譯器關閉的主要原因,是 ``__main__`` 模組或正被運行的腳本已經執行完成。" -#: ../../glossary.rst:653 +#: ../../glossary.rst:652 msgid "iterable" msgstr "iterable(可疊代物件)" -#: ../../glossary.rst:655 +#: ../../glossary.rst:654 msgid "" "An object capable of returning its members one at a time. Examples of " "iterables include all sequence types (such as :class:`list`, :class:`str`, " @@ -1515,7 +1521,7 @@ msgstr "" "`sequence`\\ (序列)語意的 :meth:`~object.__getitem__` method,該物件就是可" "疊代物件。" -#: ../../glossary.rst:663 +#: ../../glossary.rst:662 msgid "" "Iterables can be used in a :keyword:`for` loop and in many other places " "where a sequence is needed (:func:`zip`, :func:`map`, ...). When an " @@ -1535,11 +1541,11 @@ msgstr "" "數,用於在迴圈期間保有該疊代器。另請參閱 :term:`iterator`\\ (疊代器)、:" "term:`sequence`\\ (序列)和 :term:`generator`\\ (產生器)。" -#: ../../glossary.rst:673 +#: ../../glossary.rst:672 msgid "iterator" msgstr "iterator(疊代器)" -#: ../../glossary.rst:675 +#: ../../glossary.rst:674 msgid "" "An object representing a stream of data. Repeated calls to the iterator's :" "meth:`~iterator.__next__` method (or passing it to the built-in function :" @@ -1568,23 +1574,25 @@ msgstr "" "此事(多遍疊代)時,只會回傳在前一遍疊代中被用過的、同一個已被用盡的疊代器物" "件,使其看起來就像一個空的容器。" -#: ../../glossary.rst:690 +#: ../../glossary.rst:689 msgid "More information can be found in :ref:`typeiter`." msgstr "在\\ :ref:`typeiter`\\ 文中可以找到更多資訊。" -#: ../../glossary.rst:694 +#: ../../glossary.rst:693 msgid "" "CPython does not consistently apply the requirement that an iterator define :" -"meth:`~iterator.__iter__`." +"meth:`~iterator.__iter__`. And also please note that the free-threading " +"CPython does not guarantee the thread-safety of iterator operations." msgstr "" "CPython 並不是始終如一地都會檢查「疊代器有定義 :meth:`~iterator." -"__iter__`\\ 」這個規定。" +"__iter__`\\ 」這個規定。另請注意,free-threading(自由執行緒)CPython 不保證" +"疊代器操作的執行緒安全。" -#: ../../glossary.rst:696 +#: ../../glossary.rst:698 msgid "key function" msgstr "key function(鍵函式)" -#: ../../glossary.rst:698 +#: ../../glossary.rst:700 msgid "" "A key function or collation function is a callable that returns a value used " "for sorting or ordering. For example, :func:`locale.strxfrm` is used to " @@ -1594,7 +1602,7 @@ msgstr "" "一個用於排序 (sorting) 或定序 (ordering) 的值。例如,:func:`locale.strxfrm` " "被用來產生一個了解區域特定排序慣例的排序鍵。" -#: ../../glossary.rst:703 +#: ../../glossary.rst:705 msgid "" "A number of tools in Python accept key functions to control how elements are " "ordered or grouped. They include :func:`min`, :func:`max`, :func:`sorted`, :" @@ -1606,7 +1614,7 @@ msgstr "" "merge`、:func:`heapq.nsmallest`、:func:`heapq.nlargest` 和 :func:`itertools." "groupby`。" -#: ../../glossary.rst:709 +#: ../../glossary.rst:711 msgid "" "There are several ways to create a key function. For example. the :meth:" "`str.lower` method can serve as a key function for case insensitive sorts. " @@ -1623,19 +1631,19 @@ msgstr "" "式 (constructor)。關於如何建立和使用鍵函式的範例,請參閱\\ :ref:`如何排序 " "`。" -#: ../../glossary.rst:716 +#: ../../glossary.rst:718 msgid "keyword argument" msgstr "keyword argument(關鍵字引數)" -#: ../../glossary.rst:718 ../../glossary.rst:1008 +#: ../../glossary.rst:720 ../../glossary.rst:1019 msgid "See :term:`argument`." msgstr "請參閱 :term:`argument`\\ (引數)。" -#: ../../glossary.rst:719 +#: ../../glossary.rst:721 msgid "lambda" msgstr "lambda" -#: ../../glossary.rst:721 +#: ../../glossary.rst:723 msgid "" "An anonymous inline function consisting of a single :term:`expression` which " "is evaluated when the function is called. The syntax to create a lambda " @@ -1645,11 +1653,11 @@ msgstr "" "function),於該函式被呼叫時求值。建立 lambda 函式的語法是 ``lambda " "[parameters]: expression``" -#: ../../glossary.rst:724 +#: ../../glossary.rst:726 msgid "LBYL" msgstr "LBYL" -#: ../../glossary.rst:726 +#: ../../glossary.rst:728 msgid "" "Look before you leap. This coding style explicitly tests for pre-conditions " "before making calls or lookups. This style contrasts with the :term:`EAFP` " @@ -1660,7 +1668,7 @@ msgstr "" "地測試先決條件。這種風格與 :term:`EAFP` 方式形成對比,且它的特色是會有許多 :" "keyword:`if` 陳述式的存在。" -#: ../../glossary.rst:731 +#: ../../glossary.rst:733 msgid "" "In a multi-threaded environment, the LBYL approach can risk introducing a " "race condition between \"the looking\" and \"the leaping\". For example, " @@ -1674,11 +1682,11 @@ msgstr "" "了 *key*,則該程式碼就會失效。這個問題可以用鎖 (lock) 或使用 EAFP 編碼方式來" "解決。" -#: ../../glossary.rst:736 +#: ../../glossary.rst:738 msgid "list" msgstr "list(串列)" -#: ../../glossary.rst:738 +#: ../../glossary.rst:740 msgid "" "A built-in Python :term:`sequence`. Despite its name it is more akin to an " "array in other languages than to a linked list since access to elements is " @@ -1688,11 +1696,11 @@ msgstr "" "似其他語言中的一個陣列 (array) 而較不像一個鏈結串列 (linked list),因為存取元" "素的時間複雜度是 *O*\\ (1)。" -#: ../../glossary.rst:741 +#: ../../glossary.rst:743 msgid "list comprehension" msgstr "list comprehension(串列綜合運算)" -#: ../../glossary.rst:743 +#: ../../glossary.rst:745 msgid "" "A compact way to process all or part of the elements in a sequence and " "return a list with the results. ``result = ['{:#04x}'.format(x) for x in " @@ -1706,11 +1714,11 @@ msgstr "" "keyword:`if` 子句是選擇性的。如果省略它,則 ``range(256)`` 中的所有元素都會被" "處理。" -#: ../../glossary.rst:749 +#: ../../glossary.rst:751 msgid "loader" msgstr "loader(載入器)" -#: ../../glossary.rst:751 +#: ../../glossary.rst:753 msgid "" "An object that loads a module. It must define a method named :meth:" "`load_module`. A loader is typically returned by a :term:`finder`. See :pep:" @@ -1722,11 +1730,11 @@ msgstr "" "`302`,關於 :term:`abstract base class`\\ (抽象基底類別),請參閱 :class:" "`importlib.abc.Loader`。" -#: ../../glossary.rst:755 +#: ../../glossary.rst:757 msgid "locale encoding" msgstr "locale encoding(區域編碼)" -#: ../../glossary.rst:757 +#: ../../glossary.rst:759 msgid "" "On Unix, it is the encoding of the LC_CTYPE locale. It can be set with :func:" "`locale.setlocale(locale.LC_CTYPE, new_locale) `." @@ -1734,36 +1742,36 @@ msgstr "" "在 Unix 上,它是 LC_CTYPE 區域設定的編碼。它可以用 :func:`locale." "setlocale(locale.LC_CTYPE, new_locale) ` 來設定。" -#: ../../glossary.rst:760 +#: ../../glossary.rst:762 msgid "On Windows, it is the ANSI code page (ex: ``\"cp1252\"``)." msgstr "在 Windows 上,它是 ANSI 代碼頁(code page,例如 ``\"cp1252\"``\\ )。" -#: ../../glossary.rst:762 +#: ../../glossary.rst:764 msgid "" "On Android and VxWorks, Python uses ``\"utf-8\"`` as the locale encoding." msgstr "在 Android 和 VxWorks 上,Python 使用 ``\"utf-8\"`` 作為區域編碼。" -#: ../../glossary.rst:764 +#: ../../glossary.rst:766 msgid ":func:`locale.getencoding` can be used to get the locale encoding." msgstr ":func:`locale.getencoding` 可以用來取得區域編碼。" -#: ../../glossary.rst:766 +#: ../../glossary.rst:768 msgid "See also the :term:`filesystem encoding and error handler`." msgstr "也請參考 :term:`filesystem encoding and error handler`。" -#: ../../glossary.rst:767 +#: ../../glossary.rst:769 msgid "magic method" msgstr "magic method(魔術方法)" -#: ../../glossary.rst:771 +#: ../../glossary.rst:773 msgid "An informal synonym for :term:`special method`." msgstr ":term:`special method`\\ (特殊方法)的一個非正式同義詞。" -#: ../../glossary.rst:772 +#: ../../glossary.rst:774 msgid "mapping" msgstr "mapping(對映)" -#: ../../glossary.rst:774 +#: ../../glossary.rst:776 msgid "" "A container object that supports arbitrary key lookups and implements the " "methods specified in the :class:`collections.abc.Mapping` or :class:" @@ -1778,11 +1786,11 @@ msgstr "" "包括 :class:`dict`、:class:`collections.defaultdict`、:class:`collections." "OrderedDict` 和 :class:`collections.Counter`。" -#: ../../glossary.rst:780 +#: ../../glossary.rst:782 msgid "meta path finder" msgstr "meta path finder(元路徑尋檢器)" -#: ../../glossary.rst:782 +#: ../../glossary.rst:784 msgid "" "A :term:`finder` returned by a search of :data:`sys.meta_path`. Meta path " "finders are related to, but different from :term:`path entry finders ` " "相關但是不同。" -#: ../../glossary.rst:786 +#: ../../glossary.rst:788 msgid "" "See :class:`importlib.abc.MetaPathFinder` for the methods that meta path " "finders implement." msgstr "" "關於元路徑尋檢器實作的 method,請參閱 :class:`importlib.abc.MetaPathFinder`。" -#: ../../glossary.rst:788 +#: ../../glossary.rst:790 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../glossary.rst:790 +#: ../../glossary.rst:792 msgid "" "The class of a class. Class definitions create a class name, a class " "dictionary, and a list of base classes. The metaclass is responsible for " @@ -1823,15 +1831,15 @@ msgstr "" "性存取、增加執行緒安全性、追蹤物件建立、實作單例模式 (singleton),以及許多其" "他的任務。" -#: ../../glossary.rst:800 +#: ../../glossary.rst:802 msgid "More information can be found in :ref:`metaclasses`." msgstr "更多資訊可以在\\ :ref:`metaclasses`\\ 章節中找到。" -#: ../../glossary.rst:769 ../../glossary.rst:801 ../../glossary.rst:1138 +#: ../../glossary.rst:771 ../../glossary.rst:803 ../../glossary.rst:1168 msgid "method" msgstr "method(方法)" -#: ../../glossary.rst:803 +#: ../../glossary.rst:805 msgid "" "A function which is defined inside a class body. If called as an attribute " "of an instance of that class, the method will get the instance object as its " @@ -1843,11 +1851,11 @@ msgstr "" "通常被稱為 ``self``)。請參閱 :term:`function`\\ (函式)和 :term:`nested " "scope`\\ (巢狀作用域)。" -#: ../../glossary.rst:807 +#: ../../glossary.rst:809 msgid "method resolution order" msgstr "method resolution order(方法解析順序)" -#: ../../glossary.rst:809 +#: ../../glossary.rst:811 msgid "" "Method Resolution Order is the order in which base classes are searched for " "a member during lookup. See :ref:`python_2.3_mro` for details of the " @@ -1856,11 +1864,11 @@ msgstr "" "方法解析順序是在查找某個成員的過程中,base class(基底類別)被搜尋的順序。關" "於 Python 自 2.3 版直譯器所使用的演算法細節,請參閱 :ref:`python_2.3_mro`。" -#: ../../glossary.rst:812 +#: ../../glossary.rst:814 msgid "module" msgstr "module(模組)" -#: ../../glossary.rst:814 +#: ../../glossary.rst:816 msgid "" "An object that serves as an organizational unit of Python code. Modules " "have a namespace containing arbitrary Python objects. Modules are loaded " @@ -1870,15 +1878,15 @@ msgstr "" "空間,它包含任意的 Python 物件。模組是藉由 :term:`importing` 的過程,被載入" "至 Python。" -#: ../../glossary.rst:818 +#: ../../glossary.rst:820 msgid "See also :term:`package`." msgstr "另請參閱 :term:`package`\\ (套件)。" -#: ../../glossary.rst:819 +#: ../../glossary.rst:821 msgid "module spec" msgstr "module spec(模組規格)" -#: ../../glossary.rst:821 +#: ../../glossary.rst:823 msgid "" "A namespace containing the import-related information used to load a module. " "An instance of :class:`importlib.machinery.ModuleSpec`." @@ -1886,19 +1894,19 @@ msgstr "" "一個命名空間,它包含用於載入模組的 import 相關資訊。它是 :class:`importlib." "machinery.ModuleSpec` 的一個實例。" -#: ../../glossary.rst:823 +#: ../../glossary.rst:825 msgid "MRO" msgstr "MRO" -#: ../../glossary.rst:825 +#: ../../glossary.rst:827 msgid "See :term:`method resolution order`." msgstr "請參閱 :term:`method resolution order`\\ (方法解析順序)。" -#: ../../glossary.rst:826 +#: ../../glossary.rst:828 msgid "mutable" msgstr "mutable(可變物件)" -#: ../../glossary.rst:828 +#: ../../glossary.rst:830 msgid "" "Mutable objects can change their value but keep their :func:`id`. See also :" "term:`immutable`." @@ -1906,11 +1914,11 @@ msgstr "" "可變物件可以改變它們的值,但維持它們的 :func:`id`。另請參閱 :term:" "`immutable`\\ (不可變物件)。" -#: ../../glossary.rst:830 +#: ../../glossary.rst:832 msgid "named tuple" msgstr "named tuple(附名元組)" -#: ../../glossary.rst:832 +#: ../../glossary.rst:834 msgid "" "The term \"named tuple\" applies to any type or class that inherits from " "tuple and whose indexable elements are also accessible using named " @@ -1920,7 +1928,7 @@ msgstr "" "索引 (indexable) 元素也可以用附名屬性來存取。這些型別或 class 也可以具有其他" "的特性。" -#: ../../glossary.rst:836 +#: ../../glossary.rst:838 msgid "" "Several built-in types are named tuples, including the values returned by :" "func:`time.localtime` and :func:`os.stat`. Another example is :data:`sys." @@ -1929,7 +1937,7 @@ msgstr "" "有些內建型別是 named tuple,包括由 :func:`time.localtime` 和 :func:`os.stat` " "回傳的值。另一個例子是 :data:`sys.float_info`: ::" -#: ../../glossary.rst:840 +#: ../../glossary.rst:842 msgid "" ">>> sys.float_info[1] # indexed access\n" "1024\n" @@ -1939,7 +1947,7 @@ msgid "" "True" msgstr "" -#: ../../glossary.rst:847 +#: ../../glossary.rst:849 msgid "" "Some named tuples are built-in types (such as the above examples). " "Alternatively, a named tuple can be created from a regular class definition " @@ -1956,11 +1964,11 @@ msgstr "" "namedtuple` 來建立。後者技術也增加了一些額外的 method,這些 method 可能是在手" "寫或內建的 named tuple 中,無法找到的。" -#: ../../glossary.rst:855 +#: ../../glossary.rst:857 msgid "namespace" msgstr "namespace(命名空間)" -#: ../../glossary.rst:857 +#: ../../glossary.rst:859 msgid "" "The place where a variable is stored. Namespaces are implemented as " "dictionaries. There are the local, global and built-in namespaces as well " @@ -1980,11 +1988,11 @@ msgstr "" "func:`itertools.islice` 明確地表示,這些函式分別是由 :mod:`random` 和 :mod:" "`itertools` 模組在實作。" -#: ../../glossary.rst:867 +#: ../../glossary.rst:869 msgid "namespace package" msgstr "namespace package(命名空間套件)" -#: ../../glossary.rst:869 +#: ../../glossary.rst:871 msgid "" "A :pep:`420` :term:`package` which serves only as a container for " "subpackages. Namespace packages may have no physical representation, and " @@ -1995,15 +2003,15 @@ msgstr "" "一個容器。命名空間套件可能沒有實體的表示法,而且具體來說它們不像是一個 :term:" "`regular package`\\ (正規套件),因為它們並沒有 ``__init__.py`` 這個檔案。" -#: ../../glossary.rst:874 +#: ../../glossary.rst:876 msgid "See also :term:`module`." msgstr "另請參閱 :term:`module`\\ (模組)。" -#: ../../glossary.rst:875 +#: ../../glossary.rst:877 msgid "nested scope" msgstr "nested scope(巢狀作用域)" -#: ../../glossary.rst:877 +#: ../../glossary.rst:879 msgid "" "The ability to refer to a variable in an enclosing definition. For " "instance, a function defined inside another function can refer to variables " @@ -2018,11 +2026,11 @@ msgstr "" "寫入。同樣地,全域變數是在全域命名空間中讀取及寫入。:keyword:`nonlocal` 容許" "對外層作用域進行寫入。" -#: ../../glossary.rst:884 +#: ../../glossary.rst:886 msgid "new-style class" msgstr "new-style class(新式類別)" -#: ../../glossary.rst:886 +#: ../../glossary.rst:888 msgid "" "Old name for the flavor of classes now used for all class objects. In " "earlier Python versions, only new-style classes could use Python's newer, " @@ -2034,11 +2042,11 @@ msgstr "" "__slots__`、描述器 (descriptor)、屬性 (property)、:meth:`~object." "__getattribute__`、class method(類別方法)和 static method(靜態方法)。" -#: ../../glossary.rst:891 +#: ../../glossary.rst:893 msgid "object" msgstr "object(物件)" -#: ../../glossary.rst:893 +#: ../../glossary.rst:895 msgid "" "Any data with state (attributes or value) and defined behavior (methods). " "Also the ultimate base class of any :term:`new-style class`." @@ -2046,11 +2054,26 @@ msgstr "" "具有狀態(屬性或值)及被定義的行為(method)的任何資料。它也是任何 :term:" "`new-style class`\\ (新式類別)的最終 base class(基底類別)。" -#: ../../glossary.rst:896 +#: ../../glossary.rst:898 +msgid "optimized scope" +msgstr "optimized scope(最佳化作用域)" + +#: ../../glossary.rst:900 +msgid "" +"A scope where target local variable names are reliably known to the compiler " +"when the code is compiled, allowing optimization of read and write access to " +"these names. The local namespaces for functions, generators, coroutines, " +"comprehensions, and generator expressions are optimized in this fashion. " +"Note: most interpreter optimizations are applied to all scopes, only those " +"relying on a known set of local and nonlocal variable names are restricted " +"to optimized scopes." +msgstr "" + +#: ../../glossary.rst:907 msgid "package" msgstr "package(套件)" -#: ../../glossary.rst:898 +#: ../../glossary.rst:909 msgid "" "A Python :term:`module` which can contain submodules or recursively, " "subpackages. Technically, a package is a Python module with a ``__path__`` " @@ -2060,17 +2083,17 @@ msgstr "" "迴的子套件 (subpackage)。技術上而言,套件就是具有 ``__path__`` 屬性的一個 " "Python 模組。" -#: ../../glossary.rst:902 +#: ../../glossary.rst:913 msgid "See also :term:`regular package` and :term:`namespace package`." msgstr "" "另請參閱 :term:`regular package`\\ (正規套件)和 :term:`namespace " "package`\\ (命名空間套件)。" -#: ../../glossary.rst:903 +#: ../../glossary.rst:914 msgid "parameter" msgstr "parameter(參數)" -#: ../../glossary.rst:905 +#: ../../glossary.rst:916 msgid "" "A named entity in a :term:`function` (or method) definition that specifies " "an :term:`argument` (or in some cases, arguments) that the function can " @@ -2080,7 +2103,7 @@ msgstr "" "它指明該函式能夠接受的一個 :term:`argument`\\ (引數),或在某些情況下指示多" "個引數。共有有五種不同的參數類型:" -#: ../../glossary.rst:909 +#: ../../glossary.rst:920 msgid "" ":dfn:`positional-or-keyword`: specifies an argument that can be passed " "either :term:`positionally ` or as a :term:`keyword argument " @@ -2091,11 +2114,11 @@ msgstr "" "置 `\\ 或是作為\\ :term:`關鍵字引數 `\\ 被傳遞的引數。這" "是參數的預設類型,例如以下的 *foo* 和 *bar*: ::" -#: ../../glossary.rst:914 +#: ../../glossary.rst:925 msgid "def func(foo, bar=None): ..." msgstr "def func(foo, bar=None): ..." -#: ../../glossary.rst:918 +#: ../../glossary.rst:929 msgid "" ":dfn:`positional-only`: specifies an argument that can be supplied only by " "position. Positional-only parameters can be defined by including a ``/`` " @@ -2106,11 +2129,11 @@ msgstr "" "式定義的參數列表中包含一個 ``/`` 字元,就可以在該字元前面定義僅限位置參數,例" "如以下的 *posonly1* 和 *posonly2*: ::" -#: ../../glossary.rst:923 +#: ../../glossary.rst:934 msgid "def func(posonly1, posonly2, /, positional_or_keyword): ..." msgstr "def func(posonly1, posonly2, /, positional_or_keyword): ..." -#: ../../glossary.rst:927 +#: ../../glossary.rst:938 msgid "" ":dfn:`keyword-only`: specifies an argument that can be supplied only by " "keyword. Keyword-only parameters can be defined by including a single var-" @@ -2123,11 +2146,11 @@ msgstr "" "單純的 ``*`` 字元,就可以在其後方定義僅限關鍵字參數,例如以下的 *kw_only1* " "和 *kw_only2*: ::" -#: ../../glossary.rst:933 +#: ../../glossary.rst:944 msgid "def func(arg, *, kw_only1, kw_only2): ..." msgstr "def func(arg, *, kw_only1, kw_only2): ..." -#: ../../glossary.rst:935 +#: ../../glossary.rst:946 msgid "" ":dfn:`var-positional`: specifies that an arbitrary sequence of positional " "arguments can be provided (in addition to any positional arguments already " @@ -2139,11 +2162,11 @@ msgstr "" "數(在已被其他參數接受的任何位置引數之外)。這類參數是透過在其參數名稱字首加" "上 ``*`` 來定義的,例如以下的 *args*: ::" -#: ../../glossary.rst:941 +#: ../../glossary.rst:952 msgid "def func(*args, **kwargs): ..." msgstr "def func(*args, **kwargs): ..." -#: ../../glossary.rst:943 +#: ../../glossary.rst:954 msgid "" ":dfn:`var-keyword`: specifies that arbitrarily many keyword arguments can be " "provided (in addition to any keyword arguments already accepted by other " @@ -2154,14 +2177,14 @@ msgstr "" "已被其他參數接受的任何關鍵字引數之外)。這類參數是透過在其參數名稱字首加上 " "``**`` 來定義的,例如上面範例中的 *kwargs*。" -#: ../../glossary.rst:949 +#: ../../glossary.rst:960 msgid "" "Parameters can specify both optional and required arguments, as well as " "default values for some optional arguments." msgstr "" "參數可以指明引數是選擇性的或必需的,也可以為一些選擇性的引數指定預設值。" -#: ../../glossary.rst:952 +#: ../../glossary.rst:963 msgid "" "See also the :term:`argument` glossary entry, the FAQ question on :ref:`the " "difference between arguments and parameters `, " @@ -2172,11 +2195,11 @@ msgstr "" "參數之間的差異 `、:class:`inspect.Parameter` " "class、:ref:`function`\\ 章節,以及 :pep:`362`。" -#: ../../glossary.rst:956 +#: ../../glossary.rst:967 msgid "path entry" msgstr "path entry(路徑項目)" -#: ../../glossary.rst:958 +#: ../../glossary.rst:969 msgid "" "A single location on the :term:`import path` which the :term:`path based " "finder` consults to find modules for importing." @@ -2184,11 +2207,11 @@ msgstr "" "在 :term:`import path`\\ (引入路徑)中的一個位置,而 :term:`path based " "finder` (基於路徑的尋檢器)會參考該位置來尋找要 import 的模組。" -#: ../../glossary.rst:960 +#: ../../glossary.rst:971 msgid "path entry finder" msgstr "path entry finder(路徑項目尋檢器)" -#: ../../glossary.rst:962 +#: ../../glossary.rst:973 msgid "" "A :term:`finder` returned by a callable on :data:`sys.path_hooks` (i.e. a :" "term:`path entry hook`) which knows how to locate modules given a :term:" @@ -2198,7 +2221,7 @@ msgstr "" "`path entry hook`\\ )所回傳的一種 :term:`finder`,它知道如何以一個 :term:" "`path entry`\\ 定位模組。" -#: ../../glossary.rst:966 +#: ../../glossary.rst:977 msgid "" "See :class:`importlib.abc.PathEntryFinder` for the methods that path entry " "finders implement." @@ -2206,11 +2229,11 @@ msgstr "" "關於路徑項目尋檢器實作的 method,請參閱 :class:`importlib.abc." "PathEntryFinder`。" -#: ../../glossary.rst:968 +#: ../../glossary.rst:979 msgid "path entry hook" msgstr "path entry hook(路徑項目鉤)" -#: ../../glossary.rst:970 +#: ../../glossary.rst:981 msgid "" "A callable on the :data:`sys.path_hooks` list which returns a :term:`path " "entry finder` if it knows how to find modules on a specific :term:`path " @@ -2220,11 +2243,11 @@ msgstr "" "個特定的 :term:`path entry` 中尋找模組,則會回傳一個 :term:`path entry " "finder`\\ (路徑項目尋檢器)。" -#: ../../glossary.rst:973 +#: ../../glossary.rst:984 msgid "path based finder" msgstr "path based finder(基於路徑的尋檢器)" -#: ../../glossary.rst:975 +#: ../../glossary.rst:986 msgid "" "One of the default :term:`meta path finders ` which " "searches an :term:`import path` for modules." @@ -2232,11 +2255,11 @@ msgstr "" "預設的\\ :term:`元路徑尋檢器 (meta path finder) ` 之一,它" "會在一個 :term:`import path` 中搜尋模組。" -#: ../../glossary.rst:977 +#: ../../glossary.rst:988 msgid "path-like object" msgstr "path-like object(類路徑物件)" -#: ../../glossary.rst:979 +#: ../../glossary.rst:990 msgid "" "An object representing a file system path. A path-like object is either a :" "class:`str` or :class:`bytes` object representing a path, or an object " @@ -2254,11 +2277,11 @@ msgstr "" "`os.fsencode` 則分別可用於確保 :class:`str` 及 :class:`bytes` 的結果。由 :" "pep:`519` 引入。" -#: ../../glossary.rst:987 +#: ../../glossary.rst:998 msgid "PEP" msgstr "PEP" -#: ../../glossary.rst:989 +#: ../../glossary.rst:1000 msgid "" "Python Enhancement Proposal. A PEP is a design document providing " "information to the Python community, or describing a new feature for Python " @@ -2269,7 +2292,7 @@ msgstr "" "為 Python 社群提供資訊,或是描述 Python 的一個新功能或該功能的程序和環境。" "PEP 應該要提供簡潔的技術規範以及被提案功能的運作原理。" -#: ../../glossary.rst:995 +#: ../../glossary.rst:1006 msgid "" "PEPs are intended to be the primary mechanisms for proposing major new " "features, for collecting community input on an issue, and for documenting " @@ -2281,15 +2304,15 @@ msgstr "" "已納入 Python 的設計決策的記錄,這些過程的主要機制。PEP 的作者要負責在社群內" "建立共識並記錄反對意見。" -#: ../../glossary.rst:1001 +#: ../../glossary.rst:1012 msgid "See :pep:`1`." msgstr "請參閱 :pep:`1`。" -#: ../../glossary.rst:1002 +#: ../../glossary.rst:1013 msgid "portion" msgstr "portion(部分)" -#: ../../glossary.rst:1004 +#: ../../glossary.rst:1015 msgid "" "A set of files in a single directory (possibly stored in a zip file) that " "contribute to a namespace package, as defined in :pep:`420`." @@ -2297,15 +2320,15 @@ msgstr "" "在單一目錄中的一組檔案(也可能儲存在一個 zip 檔中),這些檔案能對一個命名空間" "套件 (namespace package) 有所貢獻,如同 :pep:`420` 中的定義。" -#: ../../glossary.rst:1006 +#: ../../glossary.rst:1017 msgid "positional argument" msgstr "positional argument(位置引數)" -#: ../../glossary.rst:1009 +#: ../../glossary.rst:1020 msgid "provisional API" msgstr "provisional API(暫行 API)" -#: ../../glossary.rst:1011 +#: ../../glossary.rst:1022 msgid "" "A provisional API is one which has been deliberately excluded from the " "standard library's backwards compatibility guarantees. While major changes " @@ -2321,7 +2344,7 @@ msgstr "" "該介面)。這種變更並不會無端地產生——只有 API 被納入之前未察覺的嚴重基本缺陷被" "揭露時,它們才會發生。" -#: ../../glossary.rst:1020 +#: ../../glossary.rst:1031 msgid "" "Even for provisional APIs, backwards incompatible changes are seen as a " "\"solution of last resort\" - every attempt will still be made to find a " @@ -2330,7 +2353,7 @@ msgstr "" "即使對於暫行 API,向後不相容的變更也會被視為「最後的解決方案」——對於任何被發" "現的問題,仍然會盡可能找出一個向後相容的解決方案。" -#: ../../glossary.rst:1024 +#: ../../glossary.rst:1035 msgid "" "This process allows the standard library to continue to evolve over time, " "without locking in problematic design errors for extended periods of time. " @@ -2339,19 +2362,19 @@ msgstr "" "這個過程使得標準函式庫能隨著時間不斷進化,而避免耗費過長的時間去鎖定有問題的" "設計錯誤。請參閱 :pep:`411` 了解更多細節。" -#: ../../glossary.rst:1027 +#: ../../glossary.rst:1038 msgid "provisional package" msgstr "provisional package(暫行套件)" -#: ../../glossary.rst:1029 +#: ../../glossary.rst:1040 msgid "See :term:`provisional API`." msgstr "請參閱 :term:`provisional API`\\ (暫行 API)。" -#: ../../glossary.rst:1030 +#: ../../glossary.rst:1041 msgid "Python 3000" msgstr "Python 3000" -#: ../../glossary.rst:1032 +#: ../../glossary.rst:1043 msgid "" "Nickname for the Python 3.x release line (coined long ago when the release " "of version 3 was something in the distant future.) This is also abbreviated " @@ -2360,11 +2383,11 @@ msgstr "" "Python 3.x 系列版本的暱稱(很久以前創造的,當時第 3 版的發布是在遙遠的未" "來。)也可以縮寫為「Py3k」。" -#: ../../glossary.rst:1035 +#: ../../glossary.rst:1046 msgid "Pythonic" msgstr "Pythonic(Python 風格的)" -#: ../../glossary.rst:1037 +#: ../../glossary.rst:1048 msgid "" "An idea or piece of code which closely follows the most common idioms of the " "Python language, rather than implementing code using concepts common to " @@ -2378,7 +2401,7 @@ msgstr "" "keyword:`for` 陳述式,對一個可疊代物件的所有元素進行迴圈。許多其他語言並沒有" "這種類型的架構,所以不熟悉 Python 的人有時會使用一個數值計數器來代替: ::" -#: ../../glossary.rst:1044 +#: ../../glossary.rst:1055 msgid "" "for i in range(len(food)):\n" " print(food[i])" @@ -2386,11 +2409,11 @@ msgstr "" "for i in range(len(food)):\n" " print(food[i])" -#: ../../glossary.rst:1047 +#: ../../glossary.rst:1058 msgid "As opposed to the cleaner, Pythonic method::" msgstr "相較之下,以下方法更簡潔、更具有 Python 風格: ::" -#: ../../glossary.rst:1049 +#: ../../glossary.rst:1060 msgid "" "for piece in food:\n" " print(piece)" @@ -2398,11 +2421,11 @@ msgstr "" "for piece in food:\n" " print(piece)" -#: ../../glossary.rst:1051 +#: ../../glossary.rst:1062 msgid "qualified name" msgstr "qualified name(限定名稱)" -#: ../../glossary.rst:1053 +#: ../../glossary.rst:1064 msgid "" "A dotted name showing the \"path\" from a module's global scope to a class, " "function or method defined in that module, as defined in :pep:`3155`. For " @@ -2413,7 +2436,7 @@ msgstr "" "或 method 的「路徑」,如 :pep:`3155` 中的定義。對於頂層的函式和 class 而言," "限定名稱與其物件名稱相同: ::" -#: ../../glossary.rst:1058 +#: ../../glossary.rst:1069 msgid "" ">>> class C:\n" "... class D:\n" @@ -2439,7 +2462,7 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../glossary.rst:1070 +#: ../../glossary.rst:1081 msgid "" "When used to refer to modules, the *fully qualified name* means the entire " "dotted path to the module, including any parent packages, e.g. ``email.mime." @@ -2448,7 +2471,7 @@ msgstr "" "當用於引用模組時,*完全限定名稱 (fully qualified name)* 是表示該模組的完整點" "分隔路徑,包括任何的父套件,例如 ``email.mime.text``: ::" -#: ../../glossary.rst:1074 +#: ../../glossary.rst:1085 msgid "" ">>> import email.mime.text\n" ">>> email.mime.text.__name__\n" @@ -2458,31 +2481,31 @@ msgstr "" ">>> email.mime.text.__name__\n" "'email.mime.text'" -#: ../../glossary.rst:1077 +#: ../../glossary.rst:1088 msgid "reference count" msgstr "reference count(參照計數)" -#: ../../glossary.rst:1079 +#: ../../glossary.rst:1090 msgid "" "The number of references to an object. When the reference count of an " -"object drops to zero, it is deallocated. Some objects are \"immortal\" and " -"have reference counts that are never modified, and therefore the objects are " -"never deallocated. Reference counting is generally not visible to Python " -"code, but it is a key element of the :term:`CPython` implementation. " +"object drops to zero, it is deallocated. Some objects are :term:`immortal` " +"and have reference counts that are never modified, and therefore the objects " +"are never deallocated. Reference counting is generally not visible to " +"Python code, but it is a key element of the :term:`CPython` implementation. " "Programmers can call the :func:`sys.getrefcount` function to return the " "reference count for a particular object." msgstr "" "對於一個物件的參照次數。當一個物件的參照計數下降到零時,它會被解除配置 " -"(deallocated)。有些物件是「不滅的 (immortal)」並擁有不會被改變的參照計數,也" -"因此永遠不會被解除配置。參照計數通常在 Python 程式碼中看不到,但它卻是 :term:" -"`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :func:`~sys.getrefcount` 函" -"式來回傳一個特定物件的參照計數。" +"(deallocated)。有些物件是「\\ :term:`不滅的 ` (immortal)」並擁有不" +"會被改變的參照計數,也因此永遠不會被解除配置。參照計數通常在 Python 程式碼中" +"看不到,但它卻是 :term:`CPython` 實作的一個關鍵元素。程式設計師可以呼叫 :" +"func:`~sys.getrefcount` 函式來回傳一個特定物件的參照計數。" -#: ../../glossary.rst:1087 +#: ../../glossary.rst:1098 msgid "regular package" msgstr "regular package(正規套件)" -#: ../../glossary.rst:1089 +#: ../../glossary.rst:1100 msgid "" "A traditional :term:`package`, such as a directory containing an ``__init__." "py`` file." @@ -2490,15 +2513,27 @@ msgstr "" "一個傳統的 :term:`package`\\ (套件),例如一個包含 ``__init__.py`` 檔案的目" "錄。" -#: ../../glossary.rst:1092 +#: ../../glossary.rst:1103 msgid "See also :term:`namespace package`." msgstr "另請參閱 :term:`namespace package`\\ (命名空間套件)。" -#: ../../glossary.rst:1093 +#: ../../glossary.rst:1104 +msgid "REPL" +msgstr "REPL" + +#: ../../glossary.rst:1106 +msgid "" +"An acronym for the \"read–eval–print loop\", another name for the :term:" +"`interactive` interpreter shell." +msgstr "" +"「read-eval-print 迴圈 (read–eval–print loop)」的縮寫,是\\ :term:`互動式 " +"`\\ 直譯器 shell 的另一個名稱。" + +#: ../../glossary.rst:1108 msgid "__slots__" msgstr "__slots__" -#: ../../glossary.rst:1095 +#: ../../glossary.rst:1110 msgid "" "A declaration inside a class that saves memory by pre-declaring space for " "instance attributes and eliminating instance dictionaries. Though popular, " @@ -2511,11 +2546,11 @@ msgstr "" "最好保留給那種在一個記憶體關鍵 (memory-critical) 的應用程式中存在大量實例的罕" "見情況。" -#: ../../glossary.rst:1100 +#: ../../glossary.rst:1115 msgid "sequence" msgstr "sequence(序列)" -#: ../../glossary.rst:1102 +#: ../../glossary.rst:1117 msgid "" "An :term:`iterable` which supports efficient element access using integer " "indices via the :meth:`~object.__getitem__` special method and defines a :" @@ -2523,18 +2558,18 @@ msgid "" "built-in sequence types are :class:`list`, :class:`str`, :class:`tuple`, " "and :class:`bytes`. Note that :class:`dict` also supports :meth:`~object." "__getitem__` and :meth:`!__len__`, but is considered a mapping rather than a " -"sequence because the lookups use arbitrary :term:`immutable` keys rather " -"than integers." +"sequence because the lookups use arbitrary :term:`hashable` keys rather than " +"integers." msgstr "" "一個 :term:`iterable`\\ (可疊代物件),它透過 :meth:`~object.__getitem__` " "special method(特殊方法),使用整數索引來支援高效率的元素存取,並定義了一" "個 :meth:`~object.__len__` method 來回傳該序列的長度。一些內建序列型別包括 :" "class:`list`、:class:`str`、:class:`tuple` 和 :class:`bytes`。請注意,雖然 :" "class:`dict` 也支援 :meth:`~object.__getitem__` 和 :meth:`!__len__`,但它被視" -"為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`immutable` " -"鍵,而不是整數。" +"為對映 (mapping) 而不是序列,因為其查找方式是使用任意的 :term:`hashable` 鍵," +"而不是整數。" -#: ../../glossary.rst:1111 +#: ../../glossary.rst:1126 msgid "" "The :class:`collections.abc.Sequence` abstract base class defines a much " "richer interface that goes beyond just :meth:`~object.__getitem__` and :meth:" @@ -2551,11 +2586,11 @@ msgstr "" "用 :func:`~abc.ABCMeta.register` 被明確地註冊。更多關於序列方法的文件,請見" "\\ :ref:`常見序列操作 `。" -#: ../../glossary.rst:1120 +#: ../../glossary.rst:1135 msgid "set comprehension" msgstr "set comprehension(集合綜合運算)" -#: ../../glossary.rst:1122 +#: ../../glossary.rst:1137 msgid "" "A compact way to process all or part of the elements in an iterable and " "return a set with the results. ``results = {c for c in 'abracadabra' if c " @@ -2566,11 +2601,11 @@ msgstr "" "set 回傳。``results = {c for c in 'abracadabra' if c not in 'abc'}`` 會產生一" "個字串 set:``{'r', 'd'}``。請參閱\\ :ref:`comprehensions`。" -#: ../../glossary.rst:1126 +#: ../../glossary.rst:1141 msgid "single dispatch" msgstr "single dispatch(單一調度)" -#: ../../glossary.rst:1128 +#: ../../glossary.rst:1143 msgid "" "A form of :term:`generic function` dispatch where the implementation is " "chosen based on the type of a single argument." @@ -2578,11 +2613,11 @@ msgstr "" ":term:`generic function`\\ (泛型函式)調度的一種形式,在此,實作的選擇是基於" "單一引數的型別。" -#: ../../glossary.rst:1130 +#: ../../glossary.rst:1145 msgid "slice" msgstr "slice(切片)" -#: ../../glossary.rst:1132 +#: ../../glossary.rst:1147 msgid "" "An object usually containing a portion of a :term:`sequence`. A slice is " "created using the subscript notation, ``[]`` with colons between numbers " @@ -2594,11 +2629,46 @@ msgstr "" "之間使用冒號,例如 ``variable_name[1:3:5]``。在括號(下標)符號的內部,會使" "用 :class:`slice` 物件。" -#: ../../glossary.rst:1136 +#: ../../glossary.rst:1151 +msgid "soft deprecated" +msgstr "soft deprecated(軟性棄用)" + +#: ../../glossary.rst:1153 +msgid "" +"A soft deprecation can be used when using an API which should no longer be " +"used to write new code, but it remains safe to continue using it in existing " +"code. The API remains documented and tested, but will not be developed " +"further (no enhancement)." +msgstr "" +"軟性棄用代表 API 不應再用來編寫新程式碼,但在現有程式碼中繼續使用它仍然是安全" +"的。API 仍會以文件記錄並會被測試,但不會進一步開發(不會繼續改進)。" + +#: ../../glossary.rst:1158 +msgid "" +"The main difference between a \"soft\" and a (regular) \"hard\" deprecation " +"is that the soft deprecation does not imply scheduling the removal of the " +"deprecated API." +msgstr "" +"「軟性」棄用和(常規的)「硬性」棄用之間的主要區別在於,軟性棄用並不代表已經" +"確定要什麼時候刪除已棄用的 API。" + +#: ../../glossary.rst:1162 +msgid "Another difference is that a soft deprecation does not issue a warning." +msgstr "另一個區別是軟性棄用不會發出警告。" + +#: ../../glossary.rst:1164 +msgid "" +"See `PEP 387: Soft Deprecation `_." +msgstr "" +"請參閱 `PEP 387:軟性棄用 `_。" + +#: ../../glossary.rst:1166 msgid "special method" msgstr "special method(特殊方法)" -#: ../../glossary.rst:1140 +#: ../../glossary.rst:1170 msgid "" "A method that is called implicitly by Python to execute a certain operation " "on a type, such as addition. Such methods have names starting and ending " @@ -2609,11 +2679,11 @@ msgstr "" "種 method 的名稱會在開頭和結尾有兩個下底線。Special method 在\\ :ref:" "`specialnames`\\ 中有詳細說明。" -#: ../../glossary.rst:1144 +#: ../../glossary.rst:1174 msgid "statement" msgstr "statement(陳述式)" -#: ../../glossary.rst:1146 +#: ../../glossary.rst:1176 msgid "" "A statement is part of a suite (a \"block\" of code). A statement is either " "an :term:`expression` or one of several constructs with a keyword, such as :" @@ -2623,11 +2693,11 @@ msgstr "" "term:`expression`\\ (運算式),或是含有關鍵字(例如 :keyword:`if`、:keyword:" "`while` 或 :keyword:`for`\\ )的多種結構之一。" -#: ../../glossary.rst:1149 +#: ../../glossary.rst:1179 msgid "static type checker" msgstr "static type checker(靜態型別檢查器)" -#: ../../glossary.rst:1151 +#: ../../glossary.rst:1181 msgid "" "An external tool that reads Python code and analyzes it, looking for issues " "such as incorrect types. See also :term:`type hints ` and the :" @@ -2637,11 +2707,11 @@ msgstr "" "另請參閱\\ :term:`型別提示 (type hints) ` 以及 :mod:`typing` 模" "組。" -#: ../../glossary.rst:1154 +#: ../../glossary.rst:1184 msgid "strong reference" msgstr "strong reference(強參照)" -#: ../../glossary.rst:1156 +#: ../../glossary.rst:1186 msgid "" "In Python's C API, a strong reference is a reference to an object which is " "owned by the code holding the reference. The strong reference is taken by " @@ -2652,7 +2722,7 @@ msgstr "" "有。建立參照時透過呼叫 :c:func:`Py_INCREF` 來獲得強參照、刪除參照時透過 :c:" "func:`Py_DECREF` 釋放強參照。" -#: ../../glossary.rst:1162 +#: ../../glossary.rst:1192 msgid "" "The :c:func:`Py_NewRef` function can be used to create a strong reference to " "an object. Usually, the :c:func:`Py_DECREF` function must be called on the " @@ -2662,15 +2732,15 @@ msgstr "" ":c:func:`Py_NewRef` 函式可用於建立一個對物件的強參照。通常,在退出強參照的作" "用域之前,必須在該強參照上呼叫 :c:func:`Py_DECREF` 函式,以避免洩漏一個參照。" -#: ../../glossary.rst:1167 +#: ../../glossary.rst:1197 msgid "See also :term:`borrowed reference`." msgstr "另請參閱 :term:`borrowed reference`\\ (借用參照)。" -#: ../../glossary.rst:1168 +#: ../../glossary.rst:1198 msgid "text encoding" msgstr "text encoding(文字編碼)" -#: ../../glossary.rst:1170 +#: ../../glossary.rst:1200 msgid "" "A string in Python is a sequence of Unicode code points (in range " "``U+0000``--``U+10FFFF``). To store or transfer a string, it needs to be " @@ -2679,7 +2749,7 @@ msgstr "" "Python 中的字串是一個 Unicode 碼點 (code point) 的序列(範圍在 ``U+0000`` -- " "``U+10FFFF`` 之間)。若要儲存或傳送一個字串,它必須被序列化為一個位元組序列。" -#: ../../glossary.rst:1174 +#: ../../glossary.rst:1204 msgid "" "Serializing a string into a sequence of bytes is known as \"encoding\", and " "recreating the string from the sequence of bytes is known as \"decoding\"." @@ -2687,7 +2757,7 @@ msgstr "" "將一個字串序列化為位元組序列,稱為「編碼」,而從位元組序列重新建立該字串則稱" "為「解碼 (decoding)」。" -#: ../../glossary.rst:1177 +#: ../../glossary.rst:1207 msgid "" "There are a variety of different text serialization :ref:`codecs `, which are collectively referred to as \"text encodings\"." @@ -2695,11 +2765,11 @@ msgstr "" "有多種不同的文字序列化編解碼器 (:ref:`codecs `),它們被統" "稱為「文字編碼」。" -#: ../../glossary.rst:1180 +#: ../../glossary.rst:1210 msgid "text file" msgstr "text file(文字檔案)" -#: ../../glossary.rst:1182 +#: ../../glossary.rst:1212 msgid "" "A :term:`file object` able to read and write :class:`str` objects. Often, a " "text file actually accesses a byte-oriented datastream and handles the :term:" @@ -2713,7 +2783,7 @@ msgstr "" "有:以文字模式(``'r'`` 或 ``'w'``)開啟的檔案、:data:`sys.stdin`、:data:" "`sys.stdout` 以及 :class:`io.StringIO` 的實例。" -#: ../../glossary.rst:1189 +#: ../../glossary.rst:1219 msgid "" "See also :term:`binary file` for a file object able to read and write :term:" "`bytes-like objects `." @@ -2721,11 +2791,11 @@ msgstr "" "另請參閱 :term:`binary file`\\ (二進位檔案),它是一個能夠讀取和寫入\\ :" "term:`類位元組串物件 (bytes-like object) ` 的檔案物件。" -#: ../../glossary.rst:1191 +#: ../../glossary.rst:1221 msgid "triple-quoted string" msgstr "triple-quoted string(三引號內字串)" -#: ../../glossary.rst:1193 +#: ../../glossary.rst:1223 msgid "" "A string which is bound by three instances of either a quotation mark (\") " "or an apostrophe ('). While they don't provide any functionality not " @@ -2740,36 +2810,36 @@ msgstr "" "中包含未跳脫 (unescaped) 的單引號和雙引號,而且它們不需使用連續字元 " "(continuation character) 就可以跨越多行,這使得它們在編寫說明字串時特別有用。" -#: ../../glossary.rst:1200 +#: ../../glossary.rst:1230 msgid "type" msgstr "type(型別)" -#: ../../glossary.rst:1202 +#: ../../glossary.rst:1232 msgid "" "The type of a Python object determines what kind of object it is; every " -"object has a type. An object's type is accessible as its :attr:`~instance." +"object has a type. An object's type is accessible as its :attr:`~object." "__class__` attribute or can be retrieved with ``type(obj)``." msgstr "" "一個 Python 物件的型別決定了它是什麼類型的物件;每個物件都有一個型別。一個物" -"件的型別可以用它的 :attr:`~instance.__class__` 屬性來存取,或以 " -"``type(obj)`` 來檢索。" +"件的型別可以用它的 :attr:`~object.__class__` 屬性來存取,或以 ``type(obj)`` " +"來檢索。" -#: ../../glossary.rst:1206 +#: ../../glossary.rst:1236 msgid "type alias" msgstr "type alias(型別別名)" -#: ../../glossary.rst:1208 +#: ../../glossary.rst:1238 msgid "A synonym for a type, created by assigning the type to an identifier." msgstr "一個型別的同義詞,透過將型別指定給一個識別符 (identifier) 來建立。" -#: ../../glossary.rst:1210 +#: ../../glossary.rst:1240 msgid "" "Type aliases are useful for simplifying :term:`type hints `. For " "example::" msgstr "" "型別別名對於簡化\\ :term:`型別提示 (type hint) ` 很有用。例如: ::" -#: ../../glossary.rst:1213 +#: ../../glossary.rst:1243 msgid "" "def remove_gray_shades(\n" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" @@ -2779,11 +2849,11 @@ msgstr "" " colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:\n" " pass" -#: ../../glossary.rst:1217 +#: ../../glossary.rst:1247 msgid "could be made more readable like this::" msgstr "可以寫成這樣,更具有可讀性: ::" -#: ../../glossary.rst:1219 +#: ../../glossary.rst:1249 msgid "" "Color = tuple[int, int, int]\n" "\n" @@ -2795,15 +2865,15 @@ msgstr "" "def remove_gray_shades(colors: list[Color]) -> list[Color]:\n" " pass" -#: ../../glossary.rst:1224 ../../glossary.rst:1238 +#: ../../glossary.rst:1254 ../../glossary.rst:1268 msgid "See :mod:`typing` and :pep:`484`, which describe this functionality." msgstr "請參閱 :mod:`typing` 和 :pep:`484`,有此功能的描述。" -#: ../../glossary.rst:1225 +#: ../../glossary.rst:1255 msgid "type hint" msgstr "type hint(型別提示)" -#: ../../glossary.rst:1227 +#: ../../glossary.rst:1257 msgid "" "An :term:`annotation` that specifies the expected type for a variable, a " "class attribute, or a function parameter or return value." @@ -2811,7 +2881,7 @@ msgstr "" "一種 :term:`annotation`\\ (註釋),它指定一個變數、一個 class 屬性或一個函式" "的參數或回傳值的預期型別。" -#: ../../glossary.rst:1230 +#: ../../glossary.rst:1260 msgid "" "Type hints are optional and are not enforced by Python but they are useful " "to :term:`static type checkers `. They can also aid " @@ -2821,7 +2891,7 @@ msgstr "" "(static type checkers) `\\ 很有用,並能協助 IDE 完成程式" "碼的補全 (completion) 和重構 (refactoring)。" -#: ../../glossary.rst:1234 +#: ../../glossary.rst:1264 msgid "" "Type hints of global variables, class attributes, and functions, but not " "local variables, can be accessed using :func:`typing.get_type_hints`." @@ -2829,11 +2899,11 @@ msgstr "" "全域變數、class 屬性和函式(不含區域變數)的型別提示,都可以使用 :func:" "`typing.get_type_hints` 來存取。" -#: ../../glossary.rst:1239 +#: ../../glossary.rst:1269 msgid "universal newlines" msgstr "universal newlines(通用換行字元)" -#: ../../glossary.rst:1241 +#: ../../glossary.rst:1271 msgid "" "A manner of interpreting text streams in which all of the following are " "recognized as ending a line: the Unix end-of-line convention ``'\\n'``, the " @@ -2846,20 +2916,20 @@ msgstr "" "``'\\r'``。請參閱 :pep:`278` 和 :pep:`3116`,以及用於 :func:`bytes." "splitlines` 的附加用途。" -#: ../../glossary.rst:1246 +#: ../../glossary.rst:1276 msgid "variable annotation" msgstr "variable annotation(變數註釋)" -#: ../../glossary.rst:1248 +#: ../../glossary.rst:1278 msgid "An :term:`annotation` of a variable or a class attribute." msgstr "一個變數或 class 屬性的 :term:`annotation`\\ (註釋)。" -#: ../../glossary.rst:1250 +#: ../../glossary.rst:1280 msgid "" "When annotating a variable or a class attribute, assignment is optional::" msgstr "註釋變數或 class 屬性時,賦值是選擇性的: ::" -#: ../../glossary.rst:1252 +#: ../../glossary.rst:1282 msgid "" "class C:\n" " field: 'annotation'" @@ -2867,7 +2937,7 @@ msgstr "" "class C:\n" " field: 'annotation'" -#: ../../glossary.rst:1255 +#: ../../glossary.rst:1285 msgid "" "Variable annotations are usually used for :term:`type hints `: " "for example this variable is expected to take :class:`int` values::" @@ -2875,15 +2945,15 @@ msgstr "" "變數註釋通常用於\\ :term:`型別提示 (type hint) `:例如,這個變數預" "期會取得 :class:`int`\\ (整數)值: ::" -#: ../../glossary.rst:1259 +#: ../../glossary.rst:1289 msgid "count: int = 0" msgstr "count: int = 0" -#: ../../glossary.rst:1261 +#: ../../glossary.rst:1291 msgid "Variable annotation syntax is explained in section :ref:`annassign`." msgstr "變數註釋的語法在\\ :ref:`annassign`\\ 章節有詳細的解釋。" -#: ../../glossary.rst:1263 +#: ../../glossary.rst:1293 msgid "" "See :term:`function annotation`, :pep:`484` and :pep:`526`, which describe " "this functionality. Also see :ref:`annotations-howto` for best practices on " @@ -2892,11 +2962,11 @@ msgstr "" "請參閱 :term:`function annotation`\\ (函式註釋)、:pep:`484` 和 :pep:`526`," "皆有此功能的描述。關於註釋的最佳實踐方法,另請參閱 :ref:`annotations-howto`。" -#: ../../glossary.rst:1267 +#: ../../glossary.rst:1297 msgid "virtual environment" msgstr "virtual environment(虛擬環境)" -#: ../../glossary.rst:1269 +#: ../../glossary.rst:1299 msgid "" "A cooperatively isolated runtime environment that allows Python users and " "applications to install and upgrade Python distribution packages without " @@ -2907,15 +2977,15 @@ msgstr "" "程式得以安裝和升級 Python 發佈套件,而不會對同一個系統上運行的其他 Python 應" "用程式的行為產生干擾。" -#: ../../glossary.rst:1274 +#: ../../glossary.rst:1304 msgid "See also :mod:`venv`." msgstr "另請參閱 :mod:`venv`。" -#: ../../glossary.rst:1275 +#: ../../glossary.rst:1305 msgid "virtual machine" msgstr "virtual machine(虛擬機器)" -#: ../../glossary.rst:1277 +#: ../../glossary.rst:1307 msgid "" "A computer defined entirely in software. Python's virtual machine executes " "the :term:`bytecode` emitted by the bytecode compiler." @@ -2923,11 +2993,11 @@ msgstr "" "一部完全由軟體所定義的電腦 (computer)。Python 的虛擬機器會執行由 :term:" "`bytecode`\\ (位元組碼)編譯器所發出的位元組碼。" -#: ../../glossary.rst:1279 +#: ../../glossary.rst:1309 msgid "Zen of Python" msgstr "Zen of Python(Python 之禪)" -#: ../../glossary.rst:1281 +#: ../../glossary.rst:1311 msgid "" "Listing of Python design principles and philosophies that are helpful in " "understanding and using the language. The listing can be found by typing " @@ -2936,18 +3006,49 @@ msgstr "" "Python 設計原則與哲學的列表,其內容有助於理解和使用此語言。此列表可以透過在互" "動式提式字元後輸入「``import this``」來找到它。" -#: ../../glossary.rst:264 +#: ../../glossary.rst:256 msgid "C-contiguous" msgstr "C-contiguous(C 連續的)" -#: ../../glossary.rst:264 +#: ../../glossary.rst:256 msgid "Fortran contiguous" msgstr "Fortran contiguous(Fortran 連續的)" -#: ../../glossary.rst:769 +#: ../../glossary.rst:771 msgid "magic" msgstr "magic" -#: ../../glossary.rst:1138 +#: ../../glossary.rst:1168 msgid "special" msgstr "special" + +#~ msgid "2to3" +#~ msgstr "2to3" + +#~ msgid "" +#~ "A tool that tries to convert Python 2.x code to Python 3.x code by " +#~ "handling most of the incompatibilities which can be detected by parsing " +#~ "the source and traversing the parse tree." +#~ msgstr "" +#~ "一個試著將 Python 2.x 程式碼轉換為 Python 3.x 程式碼的工具,它是透過處理大" +#~ "部分的不相容性來達成此目的,而這些不相容性能夠透過剖析原始碼和遍歷剖析樹而" +#~ "被檢測出來。" + +#~ msgid "" +#~ "2to3 is available in the standard library as :mod:`lib2to3`; a standalone " +#~ "entry point is provided as :file:`Tools/scripts/2to3`. See :ref:`2to3-" +#~ "reference`." +#~ msgstr "" +#~ "2to3 在可以標準函式庫中以 :mod:`lib2to3` 被使用;它提供了一個獨立的入口" +#~ "點,在 :file:`Tools/scripts/2to3`。請參閱 :ref:`2to3-reference`。" + +#~ msgid "" +#~ "Past efforts to create a \"free-threaded\" interpreter (one which locks " +#~ "shared data at a much finer granularity) have not been successful because " +#~ "performance suffered in the common single-processor case. It is believed " +#~ "that overcoming this performance issue would make the implementation much " +#~ "more complicated and therefore costlier to maintain." +#~ msgstr "" +#~ "過去對於建立「無限制執行緒」直譯器(以更高的精細度鎖定共享資料的直譯器)的" +#~ "努力並未成功,因為在一般的單一處理器情況下,效能會有所損失。一般認為,若要" +#~ "克服這個效能問題,會使實作變得複雜許多,進而付出更高的維護成本。" diff --git a/howto/annotations.po b/howto/annotations.po index 0135a78029..67acc522c3 100644 --- a/howto/annotations.po +++ b/howto/annotations.po @@ -5,9 +5,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2023-11-08 23:11+0800\n" "Last-Translator: rockleon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -192,15 +192,15 @@ msgid "" "Your code will have to have a separate code path if the object you're " "examining is a class (``isinstance(o, type)``). In that case, best practice " "relies on an implementation detail of Python 3.9 and before: if a class has " -"annotations defined, they are stored in the class's ``__dict__`` " +"annotations defined, they are stored in the class's :attr:`~type.__dict__` " "dictionary. Since the class may or may not have annotations defined, best " -"practice is to call the ``get`` method on the class dict." +"practice is to call the :meth:`~dict.get` method on the class dict." msgstr "" "如果你正在檢查的物件是一個類別 (``isinstance(o, type)``),你的程式碼將必須有" "一個單獨的程式碼路徑。在這種情況下,最佳實踐依賴 Python 3.9 及之前版本的實作" -"細節 (implementation detail):如果一個類別定義了註釋,它們將儲存在該類別的 " -"``__dict__`` 字典中。由於類別可能定義了註釋,也可能沒有定義,因此最佳實踐是在" -"類別字典上呼叫 ``get`` 方法。" +"細節 (implementation detail):如果一個類別定義了註釋,它們將儲存在該類別的 :" +"attr:`~type.__dict__` 字典中。由於類別可能定義了註釋,也可能沒有定義,因此最" +"佳實踐是在類別字典上呼叫 :meth:`~dict.get` 方法。" #: ../../howto/annotations.rst:109 msgid "" @@ -234,13 +234,13 @@ msgstr "" #: ../../howto/annotations.rst:123 msgid "" -"Note that some exotic or malformed type objects may not have a ``__dict__`` " -"attribute, so for extra safety you may also wish to use :func:`getattr` to " -"access ``__dict__``." +"Note that some exotic or malformed type objects may not have a :attr:`~type." +"__dict__` attribute, so for extra safety you may also wish to use :func:" +"`getattr` to access :attr:`!__dict__`." msgstr "" -"請注意,某些外來 (exotic) 或格式錯誤 (malform) 的型別物件可能沒有 " -"``__dict__`` 屬性,因此為了額外的安全,你可能還希望使用 :func:`getattr` 來存" -"取 ``__dict__`` 。" +"請注意,某些外來 (exotic) 或格式錯誤 (malform) 的型別物件可能沒有 :attr:" +"`~type.__dict__` 屬性,因此為了額外的安全,你可能還希望使用 :func:`getattr` " +"來存取 :attr:`!__dict__`。" #: ../../howto/annotations.rst:129 msgid "Manually Un-Stringizing Stringized Annotations" diff --git a/howto/argparse.po b/howto/argparse.po index 21c4f4cd19..aeb863ddff 100644 --- a/howto/argparse.po +++ b/howto/argparse.po @@ -10,9 +10,9 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -871,7 +871,7 @@ msgid "" "\n" "options:\n" " -h, --help show this help message and exit\n" -" -v {0,1,2}, --verbosity {0,1,2}\n" +" -v, --verbosity {0,1,2}\n" " increase output verbosity" msgstr "" "$ python prog.py 4 -v 3\n" @@ -886,7 +886,7 @@ msgstr "" "\n" "options:\n" " -h, --help show this help message and exit\n" -" -v {0,1,2}, --verbosity {0,1,2}\n" +" -v, --verbosity {0,1,2}\n" " increase output verbosity" #: ../../howto/argparse.rst:450 diff --git a/howto/clinic.po b/howto/clinic.po index c039a32a4c..4deac0b429 100644 --- a/howto/clinic.po +++ b/howto/clinic.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-13 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" diff --git a/howto/cporting.po b/howto/cporting.po index 2735f9fcc3..97bd67e1da 100644 --- a/howto/cporting.po +++ b/howto/cporting.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-20 18:08+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" diff --git a/howto/curses.po b/howto/curses.po index 8679624e6d..d28b8e7fb1 100644 --- a/howto/curses.po +++ b/howto/curses.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" diff --git a/howto/descriptor.po b/howto/descriptor.po index b15d02417c..876ca82e89 100644 --- a/howto/descriptor.po +++ b/howto/descriptor.po @@ -5,9 +5,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -583,8 +583,9 @@ msgid "" "\n" " def validate(self, value):\n" " if value not in self.options:\n" -" raise ValueError(f'Expected {value!r} to be one of {self.options!" -"r}')\n" +" raise ValueError(\n" +" f'Expected {value!r} to be one of {self.options!r}'\n" +" )\n" "\n" "class Number(Validator):\n" "\n" @@ -629,15 +630,15 @@ msgid "" " )" msgstr "" -#: ../../howto/descriptor.rst:437 +#: ../../howto/descriptor.rst:439 msgid "Practical application" msgstr "" -#: ../../howto/descriptor.rst:439 +#: ../../howto/descriptor.rst:441 msgid "Here's how the data validators can be used in a real class:" msgstr "" -#: ../../howto/descriptor.rst:441 +#: ../../howto/descriptor.rst:443 msgid "" "class Component:\n" "\n" @@ -651,11 +652,11 @@ msgid "" " self.quantity = quantity" msgstr "" -#: ../../howto/descriptor.rst:454 +#: ../../howto/descriptor.rst:456 msgid "The descriptors prevent invalid instances from being created:" msgstr "" -#: ../../howto/descriptor.rst:456 +#: ../../howto/descriptor.rst:458 msgid "" ">>> Component('Widget', 'metal', 5) # Blocked: 'Widget' is not all " "uppercase\n" @@ -673,6 +674,7 @@ msgid "" "Traceback (most recent call last):\n" " ...\n" "ValueError: Expected -5 to be at least 0\n" +"\n" ">>> Component('WIDGET', 'metal', 'V') # Blocked: 'V' isn't a number\n" "Traceback (most recent call last):\n" " ...\n" @@ -681,37 +683,37 @@ msgid "" ">>> c = Component('WIDGET', 'metal', 5) # Allowed: The inputs are valid" msgstr "" -#: ../../howto/descriptor.rst:481 +#: ../../howto/descriptor.rst:484 msgid "Technical Tutorial" msgstr "" -#: ../../howto/descriptor.rst:483 +#: ../../howto/descriptor.rst:486 msgid "" "What follows is a more technical tutorial for the mechanics and details of " "how descriptors work." msgstr "" -#: ../../howto/descriptor.rst:488 +#: ../../howto/descriptor.rst:491 msgid "Abstract" msgstr "摘要" -#: ../../howto/descriptor.rst:490 +#: ../../howto/descriptor.rst:493 msgid "" "Defines descriptors, summarizes the protocol, and shows how descriptors are " "called. Provides an example showing how object relational mappings work." msgstr "" -#: ../../howto/descriptor.rst:493 +#: ../../howto/descriptor.rst:496 msgid "" "Learning about descriptors not only provides access to a larger toolset, it " "creates a deeper understanding of how Python works." msgstr "" -#: ../../howto/descriptor.rst:498 +#: ../../howto/descriptor.rst:501 msgid "Definition and introduction" msgstr "" -#: ../../howto/descriptor.rst:500 +#: ../../howto/descriptor.rst:503 msgid "" "In general, a descriptor is an attribute value that has one of the methods " "in the descriptor protocol. Those methods are :meth:`__get__`, :meth:" @@ -719,7 +721,7 @@ msgid "" "an attribute, it is said to be a :term:`descriptor`." msgstr "" -#: ../../howto/descriptor.rst:505 +#: ../../howto/descriptor.rst:508 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -731,7 +733,7 @@ msgid "" "methods were defined." msgstr "" -#: ../../howto/descriptor.rst:514 +#: ../../howto/descriptor.rst:517 msgid "" "Descriptors are a powerful, general purpose protocol. They are the " "mechanism behind properties, methods, static methods, class methods, and :" @@ -740,30 +742,30 @@ msgid "" "Python programs." msgstr "" -#: ../../howto/descriptor.rst:522 +#: ../../howto/descriptor.rst:525 msgid "Descriptor protocol" msgstr "描述器協定" -#: ../../howto/descriptor.rst:524 +#: ../../howto/descriptor.rst:527 msgid "``descr.__get__(self, obj, type=None)``" msgstr "``descr.__get__(self, obj, type=None)``" -#: ../../howto/descriptor.rst:526 +#: ../../howto/descriptor.rst:529 msgid "``descr.__set__(self, obj, value)``" msgstr "``descr.__set__(self, obj, value)``" -#: ../../howto/descriptor.rst:528 +#: ../../howto/descriptor.rst:531 msgid "``descr.__delete__(self, obj)``" msgstr "``descr.__delete__(self, obj)``" -#: ../../howto/descriptor.rst:530 +#: ../../howto/descriptor.rst:533 msgid "" "That is all there is to it. Define any of these methods and an object is " "considered a descriptor and can override default behavior upon being looked " "up as an attribute." msgstr "" -#: ../../howto/descriptor.rst:534 +#: ../../howto/descriptor.rst:537 msgid "" "If an object defines :meth:`__set__` or :meth:`__delete__`, it is considered " "a data descriptor. Descriptors that only define :meth:`__get__` are called " @@ -771,7 +773,7 @@ msgid "" "possible)." msgstr "" -#: ../../howto/descriptor.rst:539 +#: ../../howto/descriptor.rst:542 msgid "" "Data and non-data descriptors differ in how overrides are calculated with " "respect to entries in an instance's dictionary. If an instance's dictionary " @@ -780,7 +782,7 @@ msgid "" "name as a non-data descriptor, the dictionary entry takes precedence." msgstr "" -#: ../../howto/descriptor.rst:545 +#: ../../howto/descriptor.rst:548 msgid "" "To make a read-only data descriptor, define both :meth:`__get__` and :meth:" "`__set__` with the :meth:`__set__` raising an :exc:`AttributeError` when " @@ -788,41 +790,41 @@ msgid "" "placeholder is enough to make it a data descriptor." msgstr "" -#: ../../howto/descriptor.rst:552 +#: ../../howto/descriptor.rst:555 msgid "Overview of descriptor invocation" msgstr "" -#: ../../howto/descriptor.rst:554 +#: ../../howto/descriptor.rst:557 msgid "" "A descriptor can be called directly with ``desc.__get__(obj)`` or ``desc." "__get__(None, cls)``." msgstr "" -#: ../../howto/descriptor.rst:557 +#: ../../howto/descriptor.rst:560 msgid "" "But it is more common for a descriptor to be invoked automatically from " "attribute access." msgstr "" -#: ../../howto/descriptor.rst:560 +#: ../../howto/descriptor.rst:563 msgid "" "The expression ``obj.x`` looks up the attribute ``x`` in the chain of " "namespaces for ``obj``. If the search finds a descriptor outside of the " -"instance ``__dict__``, its :meth:`__get__` method is invoked according to " -"the precedence rules listed below." +"instance :attr:`~object.__dict__`, its :meth:`~object.__get__` method is " +"invoked according to the precedence rules listed below." msgstr "" -#: ../../howto/descriptor.rst:565 +#: ../../howto/descriptor.rst:568 msgid "" "The details of invocation depend on whether ``obj`` is an object, class, or " "instance of super." msgstr "" -#: ../../howto/descriptor.rst:570 +#: ../../howto/descriptor.rst:573 msgid "Invocation from an instance" msgstr "" -#: ../../howto/descriptor.rst:572 +#: ../../howto/descriptor.rst:575 msgid "" "Instance lookup scans through a chain of namespaces giving data descriptors " "the highest priority, followed by instance variables, then non-data " @@ -830,19 +832,19 @@ msgid "" "provided." msgstr "" -#: ../../howto/descriptor.rst:577 +#: ../../howto/descriptor.rst:580 msgid "" "If a descriptor is found for ``a.x``, then it is invoked with: ``desc." "__get__(a, type(a))``." msgstr "" -#: ../../howto/descriptor.rst:580 +#: ../../howto/descriptor.rst:583 msgid "" "The logic for a dotted lookup is in :meth:`object.__getattribute__`. Here " "is a pure Python equivalent:" msgstr "" -#: ../../howto/descriptor.rst:583 +#: ../../howto/descriptor.rst:586 msgid "" "def find_name_in_mro(cls, name, default):\n" " \"Emulate _PyType_Lookup() in Objects/typeobject.c\"\n" @@ -871,14 +873,14 @@ msgid "" " raise AttributeError(name)" msgstr "" -#: ../../howto/descriptor.rst:719 +#: ../../howto/descriptor.rst:722 msgid "" "Note, there is no :meth:`__getattr__` hook in the :meth:`__getattribute__` " "code. That is why calling :meth:`__getattribute__` directly or with " "``super().__getattribute__`` will bypass :meth:`__getattr__` entirely." msgstr "" -#: ../../howto/descriptor.rst:723 +#: ../../howto/descriptor.rst:726 msgid "" "Instead, it is the dot operator and the :func:`getattr` function that are " "responsible for invoking :meth:`__getattr__` whenever :meth:" @@ -886,7 +888,7 @@ msgid "" "encapsulated in a helper function:" msgstr "" -#: ../../howto/descriptor.rst:728 +#: ../../howto/descriptor.rst:731 msgid "" "def getattr_hook(obj, name):\n" " \"Emulate slot_tp_getattr_hook() in Objects/typeobject.c\"\n" @@ -906,11 +908,11 @@ msgstr "" " raise\n" " return type(obj).__getattr__(obj, name) # __getattr__" -#: ../../howto/descriptor.rst:773 +#: ../../howto/descriptor.rst:776 msgid "Invocation from a class" msgstr "" -#: ../../howto/descriptor.rst:775 +#: ../../howto/descriptor.rst:778 msgid "" "The logic for a dotted lookup such as ``A.x`` is in :meth:`type." "__getattribute__`. The steps are similar to those for :meth:`object." @@ -918,27 +920,27 @@ msgid "" "through the class's :term:`method resolution order`." msgstr "" -#: ../../howto/descriptor.rst:780 +#: ../../howto/descriptor.rst:783 msgid "If a descriptor is found, it is invoked with ``desc.__get__(None, A)``." msgstr "" -#: ../../howto/descriptor.rst:782 +#: ../../howto/descriptor.rst:785 msgid "" "The full C implementation can be found in :c:func:`!type_getattro` and :c:" "func:`!_PyType_Lookup` in :source:`Objects/typeobject.c`." msgstr "" -#: ../../howto/descriptor.rst:787 +#: ../../howto/descriptor.rst:790 msgid "Invocation from super" msgstr "" -#: ../../howto/descriptor.rst:789 +#: ../../howto/descriptor.rst:792 msgid "" "The logic for super's dotted lookup is in the :meth:`__getattribute__` " "method for object returned by :func:`super`." msgstr "" -#: ../../howto/descriptor.rst:792 +#: ../../howto/descriptor.rst:795 msgid "" "A dotted lookup such as ``super(A, obj).m`` searches ``obj.__class__." "__mro__`` for the base class ``B`` immediately following ``A`` and then " @@ -946,7 +948,7 @@ msgid "" "returned unchanged." msgstr "" -#: ../../howto/descriptor.rst:797 +#: ../../howto/descriptor.rst:800 msgid "" "The full C implementation can be found in :c:func:`!super_getattro` in :" "source:`Objects/typeobject.c`. A pure Python equivalent can be found in " @@ -954,37 +956,37 @@ msgid "" "#cooperation>`_." msgstr "" -#: ../../howto/descriptor.rst:804 +#: ../../howto/descriptor.rst:807 msgid "Summary of invocation logic" msgstr "" -#: ../../howto/descriptor.rst:806 +#: ../../howto/descriptor.rst:809 msgid "" "The mechanism for descriptors is embedded in the :meth:`__getattribute__` " "methods for :class:`object`, :class:`type`, and :func:`super`." msgstr "" -#: ../../howto/descriptor.rst:809 +#: ../../howto/descriptor.rst:812 msgid "The important points to remember are:" msgstr "要記住的重點是:" -#: ../../howto/descriptor.rst:811 +#: ../../howto/descriptor.rst:814 msgid "Descriptors are invoked by the :meth:`__getattribute__` method." msgstr "" -#: ../../howto/descriptor.rst:813 +#: ../../howto/descriptor.rst:816 msgid "" "Classes inherit this machinery from :class:`object`, :class:`type`, or :func:" "`super`." msgstr "" -#: ../../howto/descriptor.rst:816 +#: ../../howto/descriptor.rst:819 msgid "" "Overriding :meth:`__getattribute__` prevents automatic descriptor calls " "because all the descriptor logic is in that method." msgstr "" -#: ../../howto/descriptor.rst:819 +#: ../../howto/descriptor.rst:822 msgid "" ":meth:`object.__getattribute__` and :meth:`type.__getattribute__` make " "different calls to :meth:`__get__`. The first includes the instance and may " @@ -992,19 +994,19 @@ msgid "" "includes the class." msgstr "" -#: ../../howto/descriptor.rst:824 +#: ../../howto/descriptor.rst:827 msgid "Data descriptors always override instance dictionaries." msgstr "" -#: ../../howto/descriptor.rst:826 +#: ../../howto/descriptor.rst:829 msgid "Non-data descriptors may be overridden by instance dictionaries." msgstr "" -#: ../../howto/descriptor.rst:830 +#: ../../howto/descriptor.rst:833 msgid "Automatic name notification" msgstr "" -#: ../../howto/descriptor.rst:832 +#: ../../howto/descriptor.rst:835 msgid "" "Sometimes it is desirable for a descriptor to know what class variable name " "it was assigned to. When a new class is created, the :class:`type` " @@ -1014,38 +1016,38 @@ msgid "" "and the *name* is the class variable the descriptor was assigned to." msgstr "" -#: ../../howto/descriptor.rst:839 +#: ../../howto/descriptor.rst:842 msgid "" "The implementation details are in :c:func:`!type_new` and :c:func:`!" "set_names` in :source:`Objects/typeobject.c`." msgstr "" -#: ../../howto/descriptor.rst:842 +#: ../../howto/descriptor.rst:845 msgid "" "Since the update logic is in :meth:`type.__new__`, notifications only take " "place at the time of class creation. If descriptors are added to the class " "afterwards, :meth:`__set_name__` will need to be called manually." msgstr "" -#: ../../howto/descriptor.rst:848 +#: ../../howto/descriptor.rst:851 msgid "ORM example" msgstr "ORM 範例" -#: ../../howto/descriptor.rst:850 +#: ../../howto/descriptor.rst:853 msgid "" "The following code is a simplified skeleton showing how data descriptors " "could be used to implement an `object relational mapping `_." msgstr "" -#: ../../howto/descriptor.rst:854 +#: ../../howto/descriptor.rst:857 msgid "" "The essential idea is that the data is stored in an external database. The " "Python instances only hold keys to the database's tables. Descriptors take " "care of lookups or updates:" msgstr "" -#: ../../howto/descriptor.rst:858 +#: ../../howto/descriptor.rst:861 msgid "" "class Field:\n" "\n" @@ -1077,14 +1079,14 @@ msgstr "" " conn.execute(self.store, [value, obj.key])\n" " conn.commit()" -#: ../../howto/descriptor.rst:873 +#: ../../howto/descriptor.rst:876 msgid "" "We can use the :class:`Field` class to define `models `_ that describe the schema for each table in a " "database:" msgstr "" -#: ../../howto/descriptor.rst:877 +#: ../../howto/descriptor.rst:880 msgid "" "class Movie:\n" " table = 'Movies' # Table name\n" @@ -1106,11 +1108,11 @@ msgid "" " self.key = key" msgstr "" -#: ../../howto/descriptor.rst:898 +#: ../../howto/descriptor.rst:901 msgid "To use the models, first connect to the database::" msgstr "" -#: ../../howto/descriptor.rst:900 +#: ../../howto/descriptor.rst:903 msgid "" ">>> import sqlite3\n" ">>> conn = sqlite3.connect('entertainment.db')" @@ -1118,13 +1120,13 @@ msgstr "" ">>> import sqlite3\n" ">>> conn = sqlite3.connect('entertainment.db')" -#: ../../howto/descriptor.rst:903 +#: ../../howto/descriptor.rst:906 msgid "" "An interactive session shows how data is retrieved from the database and how " "it can be updated:" msgstr "" -#: ../../howto/descriptor.rst:931 +#: ../../howto/descriptor.rst:934 msgid "" ">>> Movie('Star Wars').director\n" "'George Lucas'\n" @@ -1152,11 +1154,11 @@ msgstr "" ">>> Movie('Star Wars').director\n" "'J.J. Abrams'" -#: ../../howto/descriptor.rst:952 +#: ../../howto/descriptor.rst:955 msgid "Pure Python Equivalents" msgstr "" -#: ../../howto/descriptor.rst:954 +#: ../../howto/descriptor.rst:957 msgid "" "The descriptor protocol is simple and offers exciting possibilities. " "Several use cases are so common that they have been prepackaged into built-" @@ -1164,27 +1166,27 @@ msgid "" "\\_\\_slots\\_\\_ are all based on the descriptor protocol." msgstr "" -#: ../../howto/descriptor.rst:961 +#: ../../howto/descriptor.rst:964 msgid "Properties" msgstr "" -#: ../../howto/descriptor.rst:963 +#: ../../howto/descriptor.rst:966 msgid "" "Calling :func:`property` is a succinct way of building a data descriptor " "that triggers a function call upon access to an attribute. Its signature " "is::" msgstr "" -#: ../../howto/descriptor.rst:966 +#: ../../howto/descriptor.rst:969 msgid "property(fget=None, fset=None, fdel=None, doc=None) -> property" msgstr "property(fget=None, fset=None, fdel=None, doc=None) -> property" -#: ../../howto/descriptor.rst:968 +#: ../../howto/descriptor.rst:971 msgid "" "The documentation shows a typical use to define a managed attribute ``x``:" msgstr "" -#: ../../howto/descriptor.rst:970 +#: ../../howto/descriptor.rst:973 msgid "" "class C:\n" " def getx(self): return self.__x\n" @@ -1198,13 +1200,14 @@ msgstr "" " def delx(self): del self.__x\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" -#: ../../howto/descriptor.rst:992 +#: ../../howto/descriptor.rst:995 msgid "" "To see how :func:`property` is implemented in terms of the descriptor " -"protocol, here is a pure Python equivalent:" +"protocol, here is a pure Python equivalent that implements most of the core " +"functionality:" msgstr "" -#: ../../howto/descriptor.rst:995 +#: ../../howto/descriptor.rst:998 msgid "" "class Property:\n" " \"Emulate PyProperty_Type() in Objects/descrobject.c\"\n" @@ -1216,61 +1219,45 @@ msgid "" " if doc is None and fget is not None:\n" " doc = fget.__doc__\n" " self.__doc__ = doc\n" -" self._name = ''\n" "\n" " def __set_name__(self, owner, name):\n" -" self._name = name\n" +" self.__name__ = name\n" "\n" " def __get__(self, obj, objtype=None):\n" " if obj is None:\n" " return self\n" " if self.fget is None:\n" -" raise AttributeError(\n" -" f'property {self._name!r} of {type(obj).__name__!r} object " -"has no getter'\n" -" )\n" +" raise AttributeError\n" " return self.fget(obj)\n" "\n" " def __set__(self, obj, value):\n" " if self.fset is None:\n" -" raise AttributeError(\n" -" f'property {self._name!r} of {type(obj).__name__!r} object " -"has no setter'\n" -" )\n" +" raise AttributeError\n" " self.fset(obj, value)\n" "\n" " def __delete__(self, obj):\n" " if self.fdel is None:\n" -" raise AttributeError(\n" -" f'property {self._name!r} of {type(obj).__name__!r} object " -"has no deleter'\n" -" )\n" +" raise AttributeError\n" " self.fdel(obj)\n" "\n" " def getter(self, fget):\n" -" prop = type(self)(fget, self.fset, self.fdel, self.__doc__)\n" -" prop._name = self._name\n" -" return prop\n" +" return type(self)(fget, self.fset, self.fdel, self.__doc__)\n" "\n" " def setter(self, fset):\n" -" prop = type(self)(self.fget, fset, self.fdel, self.__doc__)\n" -" prop._name = self._name\n" -" return prop\n" +" return type(self)(self.fget, fset, self.fdel, self.__doc__)\n" "\n" " def deleter(self, fdel):\n" -" prop = type(self)(self.fget, self.fset, fdel, self.__doc__)\n" -" prop._name = self._name\n" -" return prop" +" return type(self)(self.fget, self.fset, fdel, self.__doc__)" msgstr "" -#: ../../howto/descriptor.rst:1132 +#: ../../howto/descriptor.rst:1122 msgid "" "The :func:`property` builtin helps whenever a user interface has granted " "attribute access and then subsequent changes require the intervention of a " "method." msgstr "" -#: ../../howto/descriptor.rst:1136 +#: ../../howto/descriptor.rst:1126 msgid "" "For instance, a spreadsheet class may grant access to a cell value through " "``Cell('b10').value``. Subsequent improvements to the program require the " @@ -1280,7 +1267,7 @@ msgid "" "descriptor:" msgstr "" -#: ../../howto/descriptor.rst:1142 +#: ../../howto/descriptor.rst:1132 msgid "" "class Cell:\n" " ...\n" @@ -1292,23 +1279,23 @@ msgid "" " return self._value" msgstr "" -#: ../../howto/descriptor.rst:1153 +#: ../../howto/descriptor.rst:1143 msgid "" "Either the built-in :func:`property` or our :func:`Property` equivalent " "would work in this example." msgstr "" -#: ../../howto/descriptor.rst:1158 +#: ../../howto/descriptor.rst:1148 msgid "Functions and methods" msgstr "" -#: ../../howto/descriptor.rst:1160 +#: ../../howto/descriptor.rst:1150 msgid "" "Python's object oriented features are built upon a function based " "environment. Using non-data descriptors, the two are merged seamlessly." msgstr "" -#: ../../howto/descriptor.rst:1163 +#: ../../howto/descriptor.rst:1153 msgid "" "Functions stored in class dictionaries get turned into methods when invoked. " "Methods only differ from regular functions in that the object instance is " @@ -1316,13 +1303,13 @@ msgid "" "*self* but could be called *this* or any other variable name." msgstr "" -#: ../../howto/descriptor.rst:1168 +#: ../../howto/descriptor.rst:1158 msgid "" "Methods can be created manually with :class:`types.MethodType` which is " "roughly equivalent to:" msgstr "" -#: ../../howto/descriptor.rst:1171 +#: ../../howto/descriptor.rst:1161 msgid "" "class MethodType:\n" " \"Emulate PyMethod_Type in Objects/classobject.c\"\n" @@ -1334,10 +1321,24 @@ msgid "" " def __call__(self, *args, **kwargs):\n" " func = self.__func__\n" " obj = self.__self__\n" -" return func(obj, *args, **kwargs)" +" return func(obj, *args, **kwargs)\n" +"\n" +" def __getattribute__(self, name):\n" +" \"Emulate method_getset() in Objects/classobject.c\"\n" +" if name == '__doc__':\n" +" return self.__func__.__doc__\n" +" return object.__getattribute__(self, name)\n" +"\n" +" def __getattr__(self, name):\n" +" \"Emulate method_getattro() in Objects/classobject.c\"\n" +" return getattr(self.__func__, name)\n" +"\n" +" def __get__(self, obj, objtype=None):\n" +" \"Emulate method_descr_get() in Objects/classobject.c\"\n" +" return self" msgstr "" -#: ../../howto/descriptor.rst:1185 +#: ../../howto/descriptor.rst:1189 msgid "" "To support automatic creation of methods, functions include the :meth:" "`__get__` method for binding methods during attribute access. This means " @@ -1345,7 +1346,7 @@ msgid "" "dotted lookup from an instance. Here's how it works:" msgstr "" -#: ../../howto/descriptor.rst:1190 +#: ../../howto/descriptor.rst:1194 msgid "" "class Function:\n" " ...\n" @@ -1357,28 +1358,34 @@ msgid "" " return MethodType(self, obj)" msgstr "" -#: ../../howto/descriptor.rst:1201 +#: ../../howto/descriptor.rst:1205 msgid "" "Running the following class in the interpreter shows how the function " "descriptor works in practice:" msgstr "" -#: ../../howto/descriptor.rst:1204 +#: ../../howto/descriptor.rst:1208 msgid "" "class D:\n" -" def f(self, x):\n" -" return x" +" def f(self):\n" +" return self\n" +"\n" +"class D2:\n" +" pass" msgstr "" "class D:\n" -" def f(self, x):\n" -" return x" +" def f(self):\n" +" return self\n" +"\n" +"class D2:\n" +" pass" -#: ../../howto/descriptor.rst:1210 +#: ../../howto/descriptor.rst:1226 msgid "" "The function has a :term:`qualified name` attribute to support introspection:" msgstr "" -#: ../../howto/descriptor.rst:1212 +#: ../../howto/descriptor.rst:1228 msgid "" ">>> D.f.__qualname__\n" "'D.f'" @@ -1386,13 +1393,13 @@ msgstr "" ">>> D.f.__qualname__\n" "'D.f'" -#: ../../howto/descriptor.rst:1217 +#: ../../howto/descriptor.rst:1233 msgid "" "Accessing the function through the class dictionary does not invoke :meth:" "`__get__`. Instead, it just returns the underlying function object::" msgstr "" -#: ../../howto/descriptor.rst:1220 +#: ../../howto/descriptor.rst:1236 msgid "" ">>> D.__dict__['f']\n" "" @@ -1400,13 +1407,13 @@ msgstr "" ">>> D.__dict__['f']\n" "" -#: ../../howto/descriptor.rst:1223 +#: ../../howto/descriptor.rst:1239 msgid "" "Dotted access from a class calls :meth:`__get__` which just returns the " "underlying function unchanged::" msgstr "" -#: ../../howto/descriptor.rst:1226 +#: ../../howto/descriptor.rst:1242 msgid "" ">>> D.f\n" "" @@ -1414,13 +1421,13 @@ msgstr "" ">>> D.f\n" "" -#: ../../howto/descriptor.rst:1229 +#: ../../howto/descriptor.rst:1245 msgid "" "The interesting behavior occurs during dotted access from an instance. The " "dotted lookup calls :meth:`__get__` which returns a bound method object::" msgstr "" -#: ../../howto/descriptor.rst:1232 +#: ../../howto/descriptor.rst:1248 msgid "" ">>> d = D()\n" ">>> d.f\n" @@ -1430,13 +1437,13 @@ msgstr "" ">>> d.f\n" ">" -#: ../../howto/descriptor.rst:1236 +#: ../../howto/descriptor.rst:1252 msgid "" "Internally, the bound method stores the underlying function and the bound " "instance::" msgstr "" -#: ../../howto/descriptor.rst:1239 +#: ../../howto/descriptor.rst:1255 msgid "" ">>> d.f.__func__\n" "\n" @@ -1450,23 +1457,23 @@ msgstr "" ">>> d.f.__self__\n" "<__main__.D object at 0x00B18C90>" -#: ../../howto/descriptor.rst:1245 +#: ../../howto/descriptor.rst:1261 msgid "" "If you have ever wondered where *self* comes from in regular methods or " "where *cls* comes from in class methods, this is it!" msgstr "" -#: ../../howto/descriptor.rst:1250 +#: ../../howto/descriptor.rst:1266 msgid "Kinds of methods" msgstr "" -#: ../../howto/descriptor.rst:1252 +#: ../../howto/descriptor.rst:1268 msgid "" "Non-data descriptors provide a simple mechanism for variations on the usual " "patterns of binding functions into methods." msgstr "" -#: ../../howto/descriptor.rst:1255 +#: ../../howto/descriptor.rst:1271 msgid "" "To recap, functions have a :meth:`__get__` method so that they can be " "converted to a method when accessed as attributes. The non-data descriptor " @@ -1474,55 +1481,55 @@ msgid "" "f(*args)`` becomes ``f(*args)``." msgstr "" -#: ../../howto/descriptor.rst:1260 +#: ../../howto/descriptor.rst:1276 msgid "This chart summarizes the binding and its two most useful variants:" msgstr "" -#: ../../howto/descriptor.rst:1263 +#: ../../howto/descriptor.rst:1279 msgid "Transformation" msgstr "" -#: ../../howto/descriptor.rst:1263 +#: ../../howto/descriptor.rst:1279 msgid "Called from an object" msgstr "" -#: ../../howto/descriptor.rst:1263 +#: ../../howto/descriptor.rst:1279 msgid "Called from a class" msgstr "" -#: ../../howto/descriptor.rst:1266 +#: ../../howto/descriptor.rst:1282 msgid "function" msgstr "函式" -#: ../../howto/descriptor.rst:1266 +#: ../../howto/descriptor.rst:1282 msgid "f(obj, \\*args)" msgstr "f(obj, \\*args)" -#: ../../howto/descriptor.rst:1266 ../../howto/descriptor.rst:1268 +#: ../../howto/descriptor.rst:1282 ../../howto/descriptor.rst:1284 msgid "f(\\*args)" msgstr "f(\\*args)" -#: ../../howto/descriptor.rst:1268 +#: ../../howto/descriptor.rst:1284 msgid "staticmethod" msgstr "staticmethod" -#: ../../howto/descriptor.rst:1270 +#: ../../howto/descriptor.rst:1286 msgid "classmethod" msgstr "classmethod" -#: ../../howto/descriptor.rst:1270 +#: ../../howto/descriptor.rst:1286 msgid "f(type(obj), \\*args)" msgstr "f(type(obj), \\*args)" -#: ../../howto/descriptor.rst:1270 +#: ../../howto/descriptor.rst:1286 msgid "f(cls, \\*args)" msgstr "f(cls, \\*args)" -#: ../../howto/descriptor.rst:1275 +#: ../../howto/descriptor.rst:1291 msgid "Static methods" msgstr "" -#: ../../howto/descriptor.rst:1277 +#: ../../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." @@ -1531,13 +1538,13 @@ msgid "" "a class." msgstr "" -#: ../../howto/descriptor.rst:1283 +#: ../../howto/descriptor.rst:1299 msgid "" "Good candidates for static methods are methods that do not reference the " "``self`` variable." msgstr "" -#: ../../howto/descriptor.rst:1286 +#: ../../howto/descriptor.rst:1302 msgid "" "For instance, a statistics package may include a container class for " "experimental data. The class provides normal methods for computing the " @@ -1546,16 +1553,16 @@ msgid "" "but do not depend on the data. For instance, ``erf(x)`` is handy conversion " "routine that comes up in statistical work but does not directly depend on a " "particular dataset. It can be called either from an object or the class: " -"``s.erf(1.5) --> .9332`` or ``Sample.erf(1.5) --> .9332``." +"``s.erf(1.5) --> 0.9332`` or ``Sample.erf(1.5) --> 0.9332``." msgstr "" -#: ../../howto/descriptor.rst:1295 +#: ../../howto/descriptor.rst:1311 msgid "" "Since static methods return the underlying function with no changes, the " "example calls are unexciting:" msgstr "" -#: ../../howto/descriptor.rst:1298 +#: ../../howto/descriptor.rst:1314 msgid "" "class E:\n" " @staticmethod\n" @@ -1567,7 +1574,7 @@ msgstr "" " def f(x):\n" " return x * 10" -#: ../../howto/descriptor.rst:1305 +#: ../../howto/descriptor.rst:1321 msgid "" ">>> E.f(3)\n" "30\n" @@ -1579,13 +1586,13 @@ msgstr "" ">>> E().f(3)\n" "30" -#: ../../howto/descriptor.rst:1312 +#: ../../howto/descriptor.rst:1328 msgid "" "Using the non-data descriptor protocol, a pure Python version of :func:" "`staticmethod` would look like this:" msgstr "" -#: ../../howto/descriptor.rst:1315 +#: ../../howto/descriptor.rst:1331 msgid "" "import functools\n" "\n" @@ -1603,7 +1610,7 @@ msgid "" " return self.f(*args, **kwds)" msgstr "" -#: ../../howto/descriptor.rst:1332 +#: ../../howto/descriptor.rst:1348 msgid "" "The :func:`functools.update_wrapper` call adds a ``__wrapped__`` attribute " "that refers to the underlying function. Also it carries forward the " @@ -1612,18 +1619,18 @@ msgid "" "__doc__`, and :attr:`~function.__annotations__`." msgstr "" -#: ../../howto/descriptor.rst:1401 +#: ../../howto/descriptor.rst:1417 msgid "Class methods" msgstr "" -#: ../../howto/descriptor.rst:1403 +#: ../../howto/descriptor.rst:1419 msgid "" "Unlike static methods, class methods prepend the class reference to the " "argument list before calling the function. This format is the same for " "whether the caller is an object or a class:" msgstr "" -#: ../../howto/descriptor.rst:1407 +#: ../../howto/descriptor.rst:1423 msgid "" "class F:\n" " @classmethod\n" @@ -1635,7 +1642,7 @@ msgstr "" " def f(cls, x):\n" " return cls.__name__, x" -#: ../../howto/descriptor.rst:1414 +#: ../../howto/descriptor.rst:1430 msgid "" ">>> F.f(3)\n" "('F', 3)\n" @@ -1647,7 +1654,7 @@ msgstr "" ">>> F().f(3)\n" "('F', 3)" -#: ../../howto/descriptor.rst:1421 +#: ../../howto/descriptor.rst:1437 msgid "" "This behavior is useful whenever the method only needs to have a class " "reference and does not rely on data stored in a specific instance. One use " @@ -1656,7 +1663,7 @@ msgid "" "of keys. The pure Python equivalent is:" msgstr "" -#: ../../howto/descriptor.rst:1427 +#: ../../howto/descriptor.rst:1443 msgid "" "class Dict(dict):\n" " @classmethod\n" @@ -1668,11 +1675,11 @@ msgid "" " return d" msgstr "" -#: ../../howto/descriptor.rst:1438 +#: ../../howto/descriptor.rst:1454 msgid "Now a new dictionary of unique keys can be constructed like this:" msgstr "" -#: ../../howto/descriptor.rst:1440 +#: ../../howto/descriptor.rst:1456 msgid "" ">>> d = Dict.fromkeys('abracadabra')\n" ">>> type(d) is Dict\n" @@ -1686,13 +1693,13 @@ msgstr "" ">>> d\n" "{'a': None, 'b': None, 'r': None, 'c': None, 'd': None}" -#: ../../howto/descriptor.rst:1448 +#: ../../howto/descriptor.rst:1464 msgid "" "Using the non-data descriptor protocol, a pure Python version of :func:" "`classmethod` would look like this:" msgstr "" -#: ../../howto/descriptor.rst:1451 +#: ../../howto/descriptor.rst:1467 msgid "" "import functools\n" "\n" @@ -1706,44 +1713,10 @@ msgid "" " def __get__(self, obj, cls=None):\n" " if cls is None:\n" " cls = type(obj)\n" -" if hasattr(type(self.f), '__get__'):\n" -" # This code path was added in Python 3.9\n" -" # and was deprecated in Python 3.11.\n" -" return self.f.__get__(cls, cls)\n" " return MethodType(self.f, cls)" msgstr "" -#: ../../howto/descriptor.rst:1526 -msgid "" -"The code path for ``hasattr(type(self.f), '__get__')`` was added in Python " -"3.9 and makes it possible for :func:`classmethod` to support chained " -"decorators. For example, a classmethod and property could be chained " -"together. In Python 3.11, this functionality was deprecated." -msgstr "" - -#: ../../howto/descriptor.rst:1531 -msgid "" -"class G:\n" -" @classmethod\n" -" @property\n" -" def __doc__(cls):\n" -" return f'A doc for {cls.__name__!r}'" -msgstr "" -"class G:\n" -" @classmethod\n" -" @property\n" -" def __doc__(cls):\n" -" return f'A doc for {cls.__name__!r}'" - -#: ../../howto/descriptor.rst:1539 -msgid "" -">>> G.__doc__\n" -"\"A doc for 'G'\"" -msgstr "" -">>> G.__doc__\n" -"\"A doc for 'G'\"" - -#: ../../howto/descriptor.rst:1544 +#: ../../howto/descriptor.rst:1529 msgid "" "The :func:`functools.update_wrapper` call in ``ClassMethod`` adds a " "``__wrapped__`` attribute that refers to the underlying function. Also it " @@ -1753,24 +1726,24 @@ msgid "" "__annotations__`." msgstr "" -#: ../../howto/descriptor.rst:1553 +#: ../../howto/descriptor.rst:1538 msgid "Member objects and __slots__" msgstr "" -#: ../../howto/descriptor.rst:1555 +#: ../../howto/descriptor.rst:1540 msgid "" "When a class defines ``__slots__``, it replaces instance dictionaries with a " "fixed-length array of slot values. From a user point of view that has " "several effects:" msgstr "" -#: ../../howto/descriptor.rst:1559 +#: ../../howto/descriptor.rst:1544 msgid "" "1. Provides immediate detection of bugs due to misspelled attribute " "assignments. Only attribute names specified in ``__slots__`` are allowed:" msgstr "" -#: ../../howto/descriptor.rst:1562 +#: ../../howto/descriptor.rst:1547 msgid "" "class Vehicle:\n" " __slots__ = ('id_number', 'make', 'model')" @@ -1778,7 +1751,7 @@ msgstr "" "class Vehicle:\n" " __slots__ = ('id_number', 'make', 'model')" -#: ../../howto/descriptor.rst:1567 +#: ../../howto/descriptor.rst:1552 msgid "" ">>> auto = Vehicle()\n" ">>> auto.id_nubmer = 'VYE483814LQEX'\n" @@ -1792,13 +1765,13 @@ msgstr "" " ...\n" "AttributeError: 'Vehicle' object has no attribute 'id_nubmer'" -#: ../../howto/descriptor.rst:1575 +#: ../../howto/descriptor.rst:1560 msgid "" "2. Helps create immutable objects where descriptors manage access to private " "attributes stored in ``__slots__``:" msgstr "" -#: ../../howto/descriptor.rst:1578 +#: ../../howto/descriptor.rst:1563 msgid "" "class Immutable:\n" "\n" @@ -1818,7 +1791,7 @@ msgid "" " return self._name" msgstr "" -#: ../../howto/descriptor.rst:1596 +#: ../../howto/descriptor.rst:1581 msgid "" ">>> mark = Immutable('Botany', 'Mark Watney')\n" ">>> mark.dept\n" @@ -1844,7 +1817,7 @@ msgstr "" " ...\n" "AttributeError: 'Immutable' object has no attribute 'location'" -#: ../../howto/descriptor.rst:1610 +#: ../../howto/descriptor.rst:1595 msgid "" "3. Saves memory. On a 64-bit Linux build, an instance with two attributes " "takes 48 bytes with ``__slots__`` and 152 bytes without. This `flyweight " @@ -1852,19 +1825,19 @@ msgid "" "only matters when a large number of instances are going to be created." msgstr "" -#: ../../howto/descriptor.rst:1615 +#: ../../howto/descriptor.rst:1600 msgid "" "4. Improves speed. Reading instance variables is 35% faster with " "``__slots__`` (as measured with Python 3.10 on an Apple M1 processor)." msgstr "" -#: ../../howto/descriptor.rst:1618 +#: ../../howto/descriptor.rst:1603 msgid "" "5. Blocks tools like :func:`functools.cached_property` which require an " "instance dictionary to function correctly:" msgstr "" -#: ../../howto/descriptor.rst:1621 +#: ../../howto/descriptor.rst:1606 msgid "" "from functools import cached_property\n" "\n" @@ -1877,7 +1850,7 @@ msgid "" " for n in reversed(range(100_000)))" msgstr "" -#: ../../howto/descriptor.rst:1633 +#: ../../howto/descriptor.rst:1618 msgid "" ">>> CP().pi\n" "Traceback (most recent call last):\n" @@ -1889,7 +1862,7 @@ msgstr "" " ...\n" "TypeError: No '__dict__' attribute on 'CP' instance to cache 'pi' property." -#: ../../howto/descriptor.rst:1640 +#: ../../howto/descriptor.rst:1625 msgid "" "It is not possible to create an exact drop-in pure Python version of " "``__slots__`` because it requires direct access to C structures and control " @@ -1899,7 +1872,7 @@ msgid "" "managed by member descriptors:" msgstr "" -#: ../../howto/descriptor.rst:1647 +#: ../../howto/descriptor.rst:1632 msgid "" "null = object()\n" "\n" @@ -1938,13 +1911,13 @@ msgid "" " return f''" msgstr "" -#: ../../howto/descriptor.rst:1685 +#: ../../howto/descriptor.rst:1670 msgid "" "The :meth:`type.__new__` method takes care of adding member objects to class " "variables:" msgstr "" -#: ../../howto/descriptor.rst:1688 +#: ../../howto/descriptor.rst:1673 msgid "" "class Type(type):\n" " 'Simulate how the type metaclass adds member objects for slots'\n" @@ -1958,14 +1931,14 @@ msgid "" " return type.__new__(mcls, clsname, bases, mapping, **kwargs)" msgstr "" -#: ../../howto/descriptor.rst:1701 +#: ../../howto/descriptor.rst:1686 msgid "" "The :meth:`object.__new__` method takes care of creating instances that have " "slots instead of an instance dictionary. Here is a rough simulation in pure " "Python:" msgstr "" -#: ../../howto/descriptor.rst:1705 +#: ../../howto/descriptor.rst:1690 msgid "" "class Object:\n" " 'Simulate how object.__new__() allocates memory for __slots__'\n" @@ -1997,13 +1970,13 @@ msgid "" " super().__delattr__(name)" msgstr "" -#: ../../howto/descriptor.rst:1736 +#: ../../howto/descriptor.rst:1721 msgid "" "To use the simulation in a real class, just inherit from :class:`Object` and " "set the :term:`metaclass` to :class:`Type`:" msgstr "" -#: ../../howto/descriptor.rst:1739 +#: ../../howto/descriptor.rst:1724 msgid "" "class H(Object, metaclass=Type):\n" " 'Instance variables stored in slots'\n" @@ -2015,12 +1988,12 @@ msgid "" " self.y = y" msgstr "" -#: ../../howto/descriptor.rst:1750 +#: ../../howto/descriptor.rst:1735 msgid "" "At this point, the metaclass has loaded member objects for *x* and *y*::" msgstr "" -#: ../../howto/descriptor.rst:1752 +#: ../../howto/descriptor.rst:1737 msgid "" ">>> from pprint import pp\n" ">>> pp(dict(vars(H)))\n" @@ -2040,13 +2013,13 @@ msgstr "" " 'x': ,\n" " 'y': }" -#: ../../howto/descriptor.rst:1771 +#: ../../howto/descriptor.rst:1756 msgid "" "When instances are created, they have a ``slot_values`` list where the " "attributes are stored:" msgstr "" -#: ../../howto/descriptor.rst:1774 +#: ../../howto/descriptor.rst:1759 msgid "" ">>> h = H(10, 20)\n" ">>> vars(h)\n" @@ -2062,11 +2035,11 @@ msgstr "" ">>> vars(h)\n" "{'_slotvalues': [55, 20]}" -#: ../../howto/descriptor.rst:1783 +#: ../../howto/descriptor.rst:1768 msgid "Misspelled or unassigned attributes will raise an exception:" msgstr "" -#: ../../howto/descriptor.rst:1785 +#: ../../howto/descriptor.rst:1770 msgid "" ">>> h.xz\n" "Traceback (most recent call last):\n" @@ -2077,3 +2050,23 @@ msgstr "" "Traceback (most recent call last):\n" " ...\n" "AttributeError: 'H' object has no attribute 'xz'" + +#~ msgid "" +#~ "class G:\n" +#~ " @classmethod\n" +#~ " @property\n" +#~ " def __doc__(cls):\n" +#~ " return f'A doc for {cls.__name__!r}'" +#~ msgstr "" +#~ "class G:\n" +#~ " @classmethod\n" +#~ " @property\n" +#~ " def __doc__(cls):\n" +#~ " return f'A doc for {cls.__name__!r}'" + +#~ msgid "" +#~ ">>> G.__doc__\n" +#~ "\"A doc for 'G'\"" +#~ msgstr "" +#~ ">>> G.__doc__\n" +#~ "\"A doc for 'G'\"" diff --git a/howto/enum.po b/howto/enum.po index e3434cb185..668b2723f2 100644 --- a/howto/enum.po +++ b/howto/enum.po @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,24 +17,24 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../../howto/enum.rst:3 +#: ../../howto/enum.rst:5 msgid "Enum HOWTO" msgstr "" -#: ../../howto/enum.rst:9 +#: ../../howto/enum.rst:11 msgid "" "An :class:`Enum` is a set of symbolic names bound to unique values. They " "are similar to global variables, but they offer a more useful :func:`repr`, " "grouping, type-safety, and a few other features." msgstr "" -#: ../../howto/enum.rst:13 +#: ../../howto/enum.rst:15 msgid "" "They are most useful when you have a variable that can take one of a limited " "selection of values. For example, the days of the week::" msgstr "" -#: ../../howto/enum.rst:16 +#: ../../howto/enum.rst:18 msgid "" ">>> from enum import Enum\n" ">>> class Weekday(Enum):\n" @@ -47,11 +47,11 @@ msgid "" "... SUNDAY = 7" msgstr "" -#: ../../howto/enum.rst:26 +#: ../../howto/enum.rst:28 msgid "Or perhaps the RGB primary colors::" msgstr "" -#: ../../howto/enum.rst:28 +#: ../../howto/enum.rst:30 msgid "" ">>> from enum import Enum\n" ">>> class Color(Enum):\n" @@ -60,17 +60,17 @@ msgid "" "... BLUE = 3" msgstr "" -#: ../../howto/enum.rst:34 +#: ../../howto/enum.rst:36 msgid "" "As you can see, creating an :class:`Enum` is as simple as writing a class " "that inherits from :class:`Enum` itself." msgstr "" -#: ../../howto/enum.rst:37 +#: ../../howto/enum.rst:39 msgid "Case of Enum Members" msgstr "" -#: ../../howto/enum.rst:39 +#: ../../howto/enum.rst:41 msgid "" "Because Enums are used to represent constants, and to help avoid issues with " "name clashes between mixin-class methods/attributes and enum names, we " @@ -78,14 +78,14 @@ msgid "" "that style in our examples." msgstr "" -#: ../../howto/enum.rst:44 +#: ../../howto/enum.rst:46 msgid "" "Depending on the nature of the enum a member's value may or may not be " "important, but either way that value can be used to get the corresponding " "member::" msgstr "" -#: ../../howto/enum.rst:48 +#: ../../howto/enum.rst:50 msgid "" ">>> Weekday(3)\n" "" @@ -93,14 +93,14 @@ msgstr "" ">>> Weekday(3)\n" "" -#: ../../howto/enum.rst:51 +#: ../../howto/enum.rst:53 msgid "" "As you can see, the ``repr()`` of a member shows the enum name, the member " "name, and the value. The ``str()`` of a member shows only the enum name and " "member name::" msgstr "" -#: ../../howto/enum.rst:55 +#: ../../howto/enum.rst:57 msgid "" ">>> print(Weekday.THURSDAY)\n" "Weekday.THURSDAY" @@ -108,11 +108,11 @@ msgstr "" ">>> print(Weekday.THURSDAY)\n" "Weekday.THURSDAY" -#: ../../howto/enum.rst:58 +#: ../../howto/enum.rst:60 msgid "The *type* of an enumeration member is the enum it belongs to::" msgstr "" -#: ../../howto/enum.rst:60 +#: ../../howto/enum.rst:62 msgid "" ">>> type(Weekday.MONDAY)\n" "\n" @@ -120,11 +120,11 @@ msgid "" "True" msgstr "" -#: ../../howto/enum.rst:65 +#: ../../howto/enum.rst:67 msgid "Enum members have an attribute that contains just their :attr:`name`::" msgstr "" -#: ../../howto/enum.rst:67 +#: ../../howto/enum.rst:69 msgid "" ">>> print(Weekday.TUESDAY.name)\n" "TUESDAY" @@ -132,11 +132,11 @@ msgstr "" ">>> print(Weekday.TUESDAY.name)\n" "TUESDAY" -#: ../../howto/enum.rst:70 +#: ../../howto/enum.rst:72 msgid "Likewise, they have an attribute for their :attr:`value`::" msgstr "" -#: ../../howto/enum.rst:73 +#: ../../howto/enum.rst:75 msgid "" ">>> Weekday.WEDNESDAY.value\n" "3" @@ -144,7 +144,7 @@ msgstr "" ">>> Weekday.WEDNESDAY.value\n" "3" -#: ../../howto/enum.rst:76 +#: ../../howto/enum.rst:78 msgid "" "Unlike many languages that treat enumerations solely as name/value pairs, " "Python Enums can have behavior added. For example, :class:`datetime.date` " @@ -155,18 +155,18 @@ msgid "" "instance and return the matching enum member::" msgstr "" -#: ../../howto/enum.rst:84 +#: ../../howto/enum.rst:86 msgid "" "@classmethod\n" "def from_date(cls, date):\n" " return cls(date.isoweekday())" msgstr "" -#: ../../howto/enum.rst:88 +#: ../../howto/enum.rst:90 msgid "The complete :class:`Weekday` enum now looks like this::" msgstr "" -#: ../../howto/enum.rst:90 +#: ../../howto/enum.rst:92 msgid "" ">>> class Weekday(Enum):\n" "... MONDAY = 1\n" @@ -194,24 +194,24 @@ msgstr "" "... def from_date(cls, date):\n" "... return cls(date.isoweekday())" -#: ../../howto/enum.rst:103 +#: ../../howto/enum.rst:105 msgid "Now we can find out what today is! Observe::" msgstr "" -#: ../../howto/enum.rst:105 +#: ../../howto/enum.rst:107 msgid "" ">>> from datetime import date\n" ">>> Weekday.from_date(date.today()) \n" "" msgstr "" -#: ../../howto/enum.rst:109 +#: ../../howto/enum.rst:111 msgid "" "Of course, if you're reading this on some other day, you'll see that day " "instead." msgstr "" -#: ../../howto/enum.rst:111 +#: ../../howto/enum.rst:113 msgid "" "This :class:`Weekday` enum is great if our variable only needs one day, but " "what if we need several? Maybe we're writing a function to plot chores " @@ -219,7 +219,7 @@ msgid "" "different type of :class:`Enum`::" msgstr "" -#: ../../howto/enum.rst:116 +#: ../../howto/enum.rst:118 msgid "" ">>> from enum import Flag\n" ">>> class Weekday(Flag):\n" @@ -241,19 +241,19 @@ msgstr "" "... SATURDAY = 32\n" "... SUNDAY = 64" -#: ../../howto/enum.rst:126 +#: ../../howto/enum.rst:128 msgid "" "We've changed two things: we're inherited from :class:`Flag`, and the values " "are all powers of 2." msgstr "" -#: ../../howto/enum.rst:129 +#: ../../howto/enum.rst:131 msgid "" "Just like the original :class:`Weekday` enum above, we can have a single " "selection::" msgstr "" -#: ../../howto/enum.rst:131 +#: ../../howto/enum.rst:133 msgid "" ">>> first_week_day = Weekday.MONDAY\n" ">>> first_week_day\n" @@ -263,13 +263,13 @@ msgstr "" ">>> first_week_day\n" "" -#: ../../howto/enum.rst:135 +#: ../../howto/enum.rst:137 msgid "" "But :class:`Flag` also allows us to combine several members into a single " "variable::" msgstr "" -#: ../../howto/enum.rst:138 +#: ../../howto/enum.rst:140 msgid "" ">>> weekend = Weekday.SATURDAY | Weekday.SUNDAY\n" ">>> weekend\n" @@ -279,11 +279,11 @@ msgstr "" ">>> weekend\n" "" -#: ../../howto/enum.rst:142 +#: ../../howto/enum.rst:144 msgid "You can even iterate over a :class:`Flag` variable::" msgstr "" -#: ../../howto/enum.rst:144 +#: ../../howto/enum.rst:146 msgid "" ">>> for day in weekend:\n" "... print(day)\n" @@ -295,11 +295,11 @@ msgstr "" "Weekday.SATURDAY\n" "Weekday.SUNDAY" -#: ../../howto/enum.rst:149 +#: ../../howto/enum.rst:151 msgid "Okay, let's get some chores set up::" msgstr "" -#: ../../howto/enum.rst:151 +#: ../../howto/enum.rst:153 msgid "" ">>> chores_for_ethan = {\n" "... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday." @@ -315,11 +315,11 @@ msgstr "" "... 'answer SO questions': Weekday.SATURDAY,\n" "... }" -#: ../../howto/enum.rst:157 +#: ../../howto/enum.rst:159 msgid "And a function to display the chores for a given day::" msgstr "" -#: ../../howto/enum.rst:159 +#: ../../howto/enum.rst:161 msgid "" ">>> def show_chores(chores, day):\n" "... for chore, days in chores.items():\n" @@ -337,13 +337,13 @@ msgstr "" ">>> show_chores(chores_for_ethan, Weekday.SATURDAY)\n" "answer SO questions" -#: ../../howto/enum.rst:167 +#: ../../howto/enum.rst:169 msgid "" "In cases where the actual values of the members do not matter, you can save " "yourself some work and use :func:`auto` for the values::" msgstr "" -#: ../../howto/enum.rst:170 +#: ../../howto/enum.rst:172 msgid "" ">>> from enum import auto\n" ">>> class Weekday(Flag):\n" @@ -367,18 +367,18 @@ msgstr "" "... SUNDAY = auto()\n" "... WEEKEND = SATURDAY | SUNDAY" -#: ../../howto/enum.rst:186 +#: ../../howto/enum.rst:188 msgid "Programmatic access to enumeration members and their attributes" msgstr "" -#: ../../howto/enum.rst:188 +#: ../../howto/enum.rst:190 msgid "" "Sometimes it's useful to access members in enumerations programmatically (i." "e. situations where ``Color.RED`` won't do because the exact color is not " "known at program-writing time). ``Enum`` allows such access::" msgstr "" -#: ../../howto/enum.rst:192 +#: ../../howto/enum.rst:194 msgid "" ">>> Color(1)\n" "\n" @@ -390,11 +390,11 @@ msgstr "" ">>> Color(3)\n" "" -#: ../../howto/enum.rst:197 +#: ../../howto/enum.rst:199 msgid "If you want to access enum members by *name*, use item access::" msgstr "" -#: ../../howto/enum.rst:199 +#: ../../howto/enum.rst:201 msgid "" ">>> Color['RED']\n" "\n" @@ -406,11 +406,11 @@ msgstr "" ">>> Color['GREEN']\n" "" -#: ../../howto/enum.rst:204 +#: ../../howto/enum.rst:206 msgid "If you have an enum member and need its :attr:`name` or :attr:`value`::" msgstr "" -#: ../../howto/enum.rst:206 +#: ../../howto/enum.rst:208 msgid "" ">>> member = Color.RED\n" ">>> member.name\n" @@ -424,15 +424,15 @@ msgstr "" ">>> member.value\n" "1" -#: ../../howto/enum.rst:214 +#: ../../howto/enum.rst:216 msgid "Duplicating enum members and values" msgstr "" -#: ../../howto/enum.rst:216 +#: ../../howto/enum.rst:218 msgid "Having two enum members with the same name is invalid::" msgstr "" -#: ../../howto/enum.rst:218 +#: ../../howto/enum.rst:220 msgid "" ">>> class Shape(Enum):\n" "... SQUARE = 2\n" @@ -450,7 +450,7 @@ msgstr "" "...\n" "TypeError: 'SQUARE' already defined as 2" -#: ../../howto/enum.rst:226 +#: ../../howto/enum.rst:228 msgid "" "However, an enum member can have other names associated with it. Given two " "entries ``A`` and ``B`` with the same value (and ``A`` defined first), ``B`` " @@ -459,7 +459,7 @@ msgid "" "member ``A``. By-name lookup of ``B`` will also return the member ``A``::" msgstr "" -#: ../../howto/enum.rst:232 +#: ../../howto/enum.rst:234 msgid "" ">>> class Shape(Enum):\n" "... SQUARE = 2\n" @@ -487,24 +487,24 @@ msgstr "" ">>> Shape(2)\n" "" -#: ../../howto/enum.rst:247 +#: ../../howto/enum.rst:249 msgid "" "Attempting to create a member with the same name as an already defined " "attribute (another member, a method, etc.) or attempting to create an " "attribute with the same name as a member is not allowed." msgstr "" -#: ../../howto/enum.rst:253 +#: ../../howto/enum.rst:255 msgid "Ensuring unique enumeration values" msgstr "" -#: ../../howto/enum.rst:255 +#: ../../howto/enum.rst:257 msgid "" "By default, enumerations allow multiple names as aliases for the same value. " "When this behavior isn't desired, you can use the :func:`unique` decorator::" msgstr "" -#: ../../howto/enum.rst:258 +#: ../../howto/enum.rst:260 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -530,15 +530,15 @@ msgstr "" "...\n" "ValueError: duplicate values found in : FOUR -> THREE" -#: ../../howto/enum.rst:272 +#: ../../howto/enum.rst:274 msgid "Using automatic values" msgstr "" -#: ../../howto/enum.rst:274 +#: ../../howto/enum.rst:276 msgid "If the exact value is unimportant you can use :class:`auto`::" msgstr "" -#: ../../howto/enum.rst:276 +#: ../../howto/enum.rst:278 msgid "" ">>> from enum import Enum, auto\n" ">>> class Color(Enum):\n" @@ -558,13 +558,13 @@ msgstr "" ">>> [member.value for member in Color]\n" "[1, 2, 3]" -#: ../../howto/enum.rst:285 +#: ../../howto/enum.rst:287 msgid "" "The values are chosen by :func:`_generate_next_value_`, which can be " "overridden::" msgstr "" -#: ../../howto/enum.rst:288 +#: ../../howto/enum.rst:290 msgid "" ">>> class AutoName(Enum):\n" "... @staticmethod\n" @@ -594,20 +594,20 @@ msgstr "" ">>> [member.value for member in Ordinal]\n" "['NORTH', 'SOUTH', 'EAST', 'WEST']" -#: ../../howto/enum.rst:304 +#: ../../howto/enum.rst:306 msgid "" "The :meth:`_generate_next_value_` method must be defined before any members." msgstr "" -#: ../../howto/enum.rst:307 +#: ../../howto/enum.rst:309 msgid "Iteration" msgstr "" -#: ../../howto/enum.rst:309 +#: ../../howto/enum.rst:311 msgid "Iterating over the members of an enum does not provide the aliases::" msgstr "" -#: ../../howto/enum.rst:311 +#: ../../howto/enum.rst:313 msgid "" ">>> list(Shape)\n" "[, , ]\n" @@ -623,20 +623,20 @@ msgstr "" "THURSDAY: 8>, , , ]" -#: ../../howto/enum.rst:316 +#: ../../howto/enum.rst:318 msgid "" "Note that the aliases ``Shape.ALIAS_FOR_SQUARE`` and ``Weekday.WEEKEND`` " "aren't shown." msgstr "" -#: ../../howto/enum.rst:318 +#: ../../howto/enum.rst:320 msgid "" "The special attribute ``__members__`` is a read-only ordered mapping of " "names to members. It includes all names defined in the enumeration, " "including the aliases::" msgstr "" -#: ../../howto/enum.rst:322 +#: ../../howto/enum.rst:324 msgid "" ">>> for name, member in Shape.__members__.items():\n" "... name, member\n" @@ -654,13 +654,13 @@ msgstr "" "('CIRCLE', )\n" "('ALIAS_FOR_SQUARE', )" -#: ../../howto/enum.rst:330 +#: ../../howto/enum.rst:332 msgid "" "The ``__members__`` attribute can be used for detailed programmatic access " "to the enumeration members. For example, finding all the aliases::" msgstr "" -#: ../../howto/enum.rst:333 +#: ../../howto/enum.rst:335 msgid "" ">>> [name for name, member in Shape.__members__.items() if member.name != " "name]\n" @@ -670,21 +670,21 @@ msgstr "" "name]\n" "['ALIAS_FOR_SQUARE']" -#: ../../howto/enum.rst:338 +#: ../../howto/enum.rst:340 msgid "" "Aliases for flags include values with multiple flags set, such as ``3``, and " "no flags set, i.e. ``0``." msgstr "" -#: ../../howto/enum.rst:343 +#: ../../howto/enum.rst:345 msgid "Comparisons" msgstr "比較" -#: ../../howto/enum.rst:345 +#: ../../howto/enum.rst:347 msgid "Enumeration members are compared by identity::" msgstr "" -#: ../../howto/enum.rst:347 +#: ../../howto/enum.rst:349 msgid "" ">>> Color.RED is Color.RED\n" "True\n" @@ -700,13 +700,13 @@ msgstr "" ">>> Color.RED is not Color.BLUE\n" "True" -#: ../../howto/enum.rst:354 +#: ../../howto/enum.rst:356 msgid "" "Ordered comparisons between enumeration values are *not* supported. Enum " "members are not integers (but see `IntEnum`_ below)::" msgstr "" -#: ../../howto/enum.rst:357 +#: ../../howto/enum.rst:359 msgid "" ">>> Color.RED < Color.BLUE\n" "Traceback (most recent call last):\n" @@ -718,11 +718,11 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: '<' not supported between instances of 'Color' and 'Color'" -#: ../../howto/enum.rst:362 +#: ../../howto/enum.rst:364 msgid "Equality comparisons are defined though::" msgstr "" -#: ../../howto/enum.rst:364 +#: ../../howto/enum.rst:366 msgid "" ">>> Color.BLUE == Color.RED\n" "False\n" @@ -738,14 +738,14 @@ msgstr "" ">>> Color.BLUE == Color.BLUE\n" "True" -#: ../../howto/enum.rst:371 +#: ../../howto/enum.rst:373 msgid "" "Comparisons against non-enumeration values will always compare not equal " "(again, :class:`IntEnum` was explicitly designed to behave differently, see " "below)::" msgstr "" -#: ../../howto/enum.rst:375 +#: ../../howto/enum.rst:377 msgid "" ">>> Color.BLUE == 2\n" "False" @@ -753,18 +753,18 @@ msgstr "" ">>> Color.BLUE == 2\n" "False" -#: ../../howto/enum.rst:380 +#: ../../howto/enum.rst:382 msgid "" "It is possible to reload modules -- if a reloaded module contains enums, " "they will be recreated, and the new members may not compare identical/equal " "to the original members." msgstr "" -#: ../../howto/enum.rst:385 +#: ../../howto/enum.rst:387 msgid "Allowed members and attributes of enumerations" msgstr "" -#: ../../howto/enum.rst:387 +#: ../../howto/enum.rst:389 msgid "" "Most of the examples above use integers for enumeration values. Using " "integers is short and handy (and provided by default by the `Functional " @@ -773,13 +773,13 @@ msgid "" "*is* important, enumerations can have arbitrary values." msgstr "" -#: ../../howto/enum.rst:393 +#: ../../howto/enum.rst:395 msgid "" "Enumerations are Python classes, and can have methods and special methods as " "usual. If we have this enumeration::" msgstr "" -#: ../../howto/enum.rst:396 +#: ../../howto/enum.rst:398 msgid "" ">>> class Mood(Enum):\n" "... FUNKY = 1\n" @@ -799,11 +799,11 @@ msgid "" "..." msgstr "" -#: ../../howto/enum.rst:413 +#: ../../howto/enum.rst:415 msgid "Then::" msgstr "" -#: ../../howto/enum.rst:415 +#: ../../howto/enum.rst:417 msgid "" ">>> Mood.favorite_mood()\n" "\n" @@ -819,7 +819,7 @@ msgstr "" ">>> str(Mood.FUNKY)\n" "'my custom str! 1'" -#: ../../howto/enum.rst:422 +#: ../../howto/enum.rst:424 msgid "" "The rules for what is allowed are as follows: names that start and end with " "a single underscore are reserved by enum and cannot be used; all other " @@ -829,14 +829,14 @@ msgid "" "names listed in :attr:`_ignore_`." msgstr "" -#: ../../howto/enum.rst:429 +#: ../../howto/enum.rst:431 msgid "" "Note: if your enumeration defines :meth:`__new__` and/or :meth:`__init__`, " "any value(s) given to the enum member will be passed into those methods. See " "`Planet`_ for an example." msgstr "" -#: ../../howto/enum.rst:435 +#: ../../howto/enum.rst:437 msgid "" "The :meth:`__new__` method, if defined, is used during creation of the Enum " "members; it is then replaced by Enum's :meth:`__new__` which is used after " @@ -844,18 +844,18 @@ msgid "" "more details." msgstr "" -#: ../../howto/enum.rst:442 +#: ../../howto/enum.rst:444 msgid "Restricted Enum subclassing" msgstr "" -#: ../../howto/enum.rst:444 +#: ../../howto/enum.rst:446 msgid "" "A new :class:`Enum` class must have one base enum class, up to one concrete " "data type, and as many :class:`object`-based mixin classes as needed. The " "order of these base classes is::" msgstr "" -#: ../../howto/enum.rst:448 +#: ../../howto/enum.rst:450 msgid "" "class EnumName([mix-in, ...,] [data-type,] base-enum):\n" " pass" @@ -863,13 +863,13 @@ msgstr "" "class EnumName([mix-in, ...,] [data-type,] base-enum):\n" " pass" -#: ../../howto/enum.rst:451 +#: ../../howto/enum.rst:453 msgid "" "Also, subclassing an enumeration is allowed only if the enumeration does not " "define any members. So this is forbidden::" msgstr "" -#: ../../howto/enum.rst:454 +#: ../../howto/enum.rst:456 msgid "" ">>> class MoreColor(Color):\n" "... PINK = 17\n" @@ -885,11 +885,11 @@ msgstr "" "...\n" "TypeError: cannot extend " -#: ../../howto/enum.rst:461 +#: ../../howto/enum.rst:463 msgid "But this is allowed::" msgstr "但這是允許的:" -#: ../../howto/enum.rst:463 +#: ../../howto/enum.rst:465 msgid "" ">>> class Foo(Enum):\n" "... def some_behavior(self):\n" @@ -909,7 +909,7 @@ msgstr "" "... SAD = 2\n" "..." -#: ../../howto/enum.rst:472 +#: ../../howto/enum.rst:474 msgid "" "Allowing subclassing of enums that define members would lead to a violation " "of some important invariants of types and instances. On the other hand, it " @@ -917,17 +917,17 @@ msgid "" "enumerations. (See `OrderedEnum`_ for an example.)" msgstr "" -#: ../../howto/enum.rst:481 +#: ../../howto/enum.rst:483 msgid "Dataclass support" msgstr "" -#: ../../howto/enum.rst:483 +#: ../../howto/enum.rst:485 msgid "" "When inheriting from a :class:`~dataclasses.dataclass`, the :meth:`~Enum." "__repr__` omits the inherited class' name. For example::" msgstr "" -#: ../../howto/enum.rst:486 +#: ../../howto/enum.rst:488 msgid "" ">>> from dataclasses import dataclass, field\n" ">>> @dataclass\n" @@ -957,27 +957,48 @@ msgstr "" ">>> Creature.DOG\n" "" -#: ../../howto/enum.rst:500 +#: ../../howto/enum.rst:502 msgid "" -"Use the :func:`!dataclass` argument ``repr=False`` to use the standard :func:" -"`repr`." +"Use the :func:`~dataclasses.dataclass` argument ``repr=False`` to use the " +"standard :func:`repr`." msgstr "" -#: ../../howto/enum.rst:503 +#: ../../howto/enum.rst:505 msgid "" "Only the dataclass fields are shown in the value area, not the dataclass' " "name." msgstr "" -#: ../../howto/enum.rst:509 +#: ../../howto/enum.rst:511 +msgid "" +"Adding :func:`~dataclasses.dataclass` decorator to :class:`Enum` and its " +"subclasses is not supported. It will not raise any errors, but it will " +"produce very strange results at runtime, such as members being equal to each " +"other::" +msgstr "" + +#: ../../howto/enum.rst:516 +msgid "" +">>> @dataclass # don't do this: it does not make any sense\n" +"... class Color(Enum):\n" +"... RED = 1\n" +"... BLUE = 2\n" +"...\n" +">>> Color.RED is Color.BLUE\n" +"False\n" +">>> Color.RED == Color.BLUE # problem is here: they should not be equal\n" +"True" +msgstr "" + +#: ../../howto/enum.rst:528 msgid "Pickling" msgstr "" -#: ../../howto/enum.rst:511 +#: ../../howto/enum.rst:530 msgid "Enumerations can be pickled and unpickled::" msgstr "" -#: ../../howto/enum.rst:513 +#: ../../howto/enum.rst:532 msgid "" ">>> from test.test_enum import Fruit\n" ">>> from pickle import dumps, loads\n" @@ -989,27 +1010,27 @@ msgstr "" ">>> Fruit.TOMATO is loads(dumps(Fruit.TOMATO))\n" "True" -#: ../../howto/enum.rst:518 +#: ../../howto/enum.rst:537 msgid "" "The usual restrictions for pickling apply: picklable enums must be defined " "in the top level of a module, since unpickling requires them to be " "importable from that module." msgstr "" -#: ../../howto/enum.rst:524 +#: ../../howto/enum.rst:543 msgid "" "With pickle protocol version 4 it is possible to easily pickle enums nested " "in other classes." msgstr "" -#: ../../howto/enum.rst:527 +#: ../../howto/enum.rst:546 msgid "" "It is possible to modify how enum members are pickled/unpickled by defining :" "meth:`__reduce_ex__` in the enumeration class. The default method is by-" "value, but enums with complicated values may want to use by-name::" msgstr "" -#: ../../howto/enum.rst:531 +#: ../../howto/enum.rst:550 msgid "" ">>> import enum\n" ">>> class MyEnum(enum.Enum):\n" @@ -1019,22 +1040,22 @@ msgstr "" ">>> class MyEnum(enum.Enum):\n" "... __reduce_ex__ = enum.pickle_by_enum_name" -#: ../../howto/enum.rst:537 +#: ../../howto/enum.rst:556 msgid "" "Using by-name for flags is not recommended, as unnamed aliases will not " "unpickle." msgstr "" -#: ../../howto/enum.rst:542 +#: ../../howto/enum.rst:561 msgid "Functional API" msgstr "" -#: ../../howto/enum.rst:544 +#: ../../howto/enum.rst:563 msgid "" "The :class:`Enum` class is callable, providing the following functional API::" msgstr "" -#: ../../howto/enum.rst:546 +#: ../../howto/enum.rst:565 msgid "" ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG')\n" ">>> Animal\n" @@ -1052,13 +1073,13 @@ msgstr "" ">>> list(Animal)\n" "[, , , ]" -#: ../../howto/enum.rst:554 +#: ../../howto/enum.rst:573 msgid "" "The semantics of this API resemble :class:`~collections.namedtuple`. The " "first argument of the call to :class:`Enum` is the name of the enumeration." msgstr "" -#: ../../howto/enum.rst:557 +#: ../../howto/enum.rst:576 msgid "" "The second argument is the *source* of enumeration member names. It can be " "a whitespace-separated string of names, a sequence of names, a sequence of 2-" @@ -1070,7 +1091,7 @@ msgid "" "assignment to :class:`Animal` is equivalent to::" msgstr "" -#: ../../howto/enum.rst:566 +#: ../../howto/enum.rst:585 msgid "" ">>> class Animal(Enum):\n" "... ANT = 1\n" @@ -1086,14 +1107,14 @@ msgstr "" "... DOG = 4\n" "..." -#: ../../howto/enum.rst:573 +#: ../../howto/enum.rst:592 msgid "" "The reason for defaulting to ``1`` as the starting number and not ``0`` is " "that ``0`` is ``False`` in a boolean sense, but by default enum members all " "evaluate to ``True``." msgstr "" -#: ../../howto/enum.rst:577 +#: ../../howto/enum.rst:596 msgid "" "Pickling enums created with the functional API can be tricky as frame stack " "implementation details are used to try and figure out which module the " @@ -1102,36 +1123,36 @@ msgid "" "Jython). The solution is to specify the module name explicitly as follows::" msgstr "" -#: ../../howto/enum.rst:583 +#: ../../howto/enum.rst:602 msgid ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)" msgstr ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__)" -#: ../../howto/enum.rst:587 +#: ../../howto/enum.rst:606 msgid "" "If ``module`` is not supplied, and Enum cannot determine what it is, the new " "Enum members will not be unpicklable; to keep errors closer to the source, " "pickling will be disabled." msgstr "" -#: ../../howto/enum.rst:591 +#: ../../howto/enum.rst:610 msgid "" "The new pickle protocol 4 also, in some circumstances, relies on :attr:" -"`~definition.__qualname__` being set to the location where pickle will be " -"able to find the class. For example, if the class was made available in " -"class SomeData in the global scope::" +"`~type.__qualname__` being set to the location where pickle will be able to " +"find the class. For example, if the class was made available in class " +"SomeData in the global scope::" msgstr "" -#: ../../howto/enum.rst:596 +#: ../../howto/enum.rst:615 msgid "" ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')" msgstr "" ">>> Animal = Enum('Animal', 'ANT BEE CAT DOG', qualname='SomeData.Animal')" -#: ../../howto/enum.rst:598 +#: ../../howto/enum.rst:617 msgid "The complete signature is::" msgstr "" -#: ../../howto/enum.rst:600 +#: ../../howto/enum.rst:619 msgid "" "Enum(\n" " value='NewEnumName',\n" @@ -1153,73 +1174,73 @@ msgstr "" " start=1,\n" " )" -#: ../../howto/enum.rst:610 +#: ../../howto/enum.rst:629 msgid "*value*: What the new enum class will record as its name." msgstr "" -#: ../../howto/enum.rst:612 +#: ../../howto/enum.rst:631 msgid "" "*names*: The enum members. This can be a whitespace- or comma-separated " "string (values will start at 1 unless otherwise specified)::" msgstr "" -#: ../../howto/enum.rst:615 +#: ../../howto/enum.rst:634 msgid "'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'" msgstr "'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE'" -#: ../../howto/enum.rst:617 +#: ../../howto/enum.rst:636 msgid "or an iterator of names::" msgstr "" -#: ../../howto/enum.rst:619 +#: ../../howto/enum.rst:638 msgid "['RED', 'GREEN', 'BLUE']" msgstr "['RED', 'GREEN', 'BLUE']" -#: ../../howto/enum.rst:621 +#: ../../howto/enum.rst:640 msgid "or an iterator of (name, value) pairs::" msgstr "" -#: ../../howto/enum.rst:623 +#: ../../howto/enum.rst:642 msgid "[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]" msgstr "[('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)]" -#: ../../howto/enum.rst:625 +#: ../../howto/enum.rst:644 msgid "or a mapping::" msgstr "" -#: ../../howto/enum.rst:627 +#: ../../howto/enum.rst:646 msgid "{'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}" msgstr "{'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42}" -#: ../../howto/enum.rst:629 +#: ../../howto/enum.rst:648 msgid "*module*: name of module where new enum class can be found." msgstr "" -#: ../../howto/enum.rst:631 +#: ../../howto/enum.rst:650 msgid "*qualname*: where in module new enum class can be found." msgstr "" -#: ../../howto/enum.rst:633 +#: ../../howto/enum.rst:652 msgid "*type*: type to mix in to new enum class." msgstr "" -#: ../../howto/enum.rst:635 +#: ../../howto/enum.rst:654 msgid "*start*: number to start counting at if only names are passed in." msgstr "" -#: ../../howto/enum.rst:637 +#: ../../howto/enum.rst:656 msgid "The *start* parameter was added." msgstr "" -#: ../../howto/enum.rst:642 +#: ../../howto/enum.rst:661 msgid "Derived Enumerations" msgstr "" -#: ../../howto/enum.rst:645 +#: ../../howto/enum.rst:664 msgid "IntEnum" msgstr "" -#: ../../howto/enum.rst:647 +#: ../../howto/enum.rst:666 msgid "" "The first variation of :class:`Enum` that is provided is also a subclass of :" "class:`int`. Members of an :class:`IntEnum` can be compared to integers; by " @@ -1227,7 +1248,7 @@ msgid "" "each other::" msgstr "" -#: ../../howto/enum.rst:652 +#: ../../howto/enum.rst:671 msgid "" ">>> from enum import IntEnum\n" ">>> class Shape(IntEnum):\n" @@ -1261,13 +1282,13 @@ msgstr "" ">>> Shape.CIRCLE == Request.POST\n" "True" -#: ../../howto/enum.rst:668 +#: ../../howto/enum.rst:687 msgid "" "However, they still can't be compared to standard :class:`Enum` " "enumerations::" msgstr "" -#: ../../howto/enum.rst:670 +#: ../../howto/enum.rst:689 msgid "" ">>> class Shape(IntEnum):\n" "... CIRCLE = 1\n" @@ -1291,12 +1312,12 @@ msgstr "" ">>> Shape.CIRCLE == Color.RED\n" "False" -#: ../../howto/enum.rst:681 +#: ../../howto/enum.rst:700 msgid "" ":class:`IntEnum` values behave like integers in other ways you'd expect::" msgstr "" -#: ../../howto/enum.rst:683 +#: ../../howto/enum.rst:702 msgid "" ">>> int(Shape.CIRCLE)\n" "1\n" @@ -1312,11 +1333,11 @@ msgstr "" ">>> [i for i in range(Shape.SQUARE)]\n" "[0, 1]" -#: ../../howto/enum.rst:692 +#: ../../howto/enum.rst:711 msgid "StrEnum" msgstr "StrEnum" -#: ../../howto/enum.rst:694 +#: ../../howto/enum.rst:713 msgid "" "The second variation of :class:`Enum` that is provided is also a subclass " "of :class:`str`. Members of a :class:`StrEnum` can be compared to strings; " @@ -1324,11 +1345,11 @@ msgid "" "each other." msgstr "" -#: ../../howto/enum.rst:703 +#: ../../howto/enum.rst:722 msgid "IntFlag" msgstr "IntFlag" -#: ../../howto/enum.rst:705 +#: ../../howto/enum.rst:724 msgid "" "The next variation of :class:`Enum` provided, :class:`IntFlag`, is also " "based on :class:`int`. The difference being :class:`IntFlag` members can be " @@ -1338,23 +1359,23 @@ msgid "" "is used." msgstr "" -#: ../../howto/enum.rst:713 +#: ../../howto/enum.rst:732 msgid "" "Any operation on an :class:`IntFlag` member besides the bit-wise operations " "will lose the :class:`IntFlag` membership." msgstr "" -#: ../../howto/enum.rst:716 +#: ../../howto/enum.rst:735 msgid "" "Bit-wise operations that result in invalid :class:`IntFlag` values will lose " "the :class:`IntFlag` membership. See :class:`FlagBoundary` for details." msgstr "" -#: ../../howto/enum.rst:723 +#: ../../howto/enum.rst:742 msgid "Sample :class:`IntFlag` class::" msgstr "" -#: ../../howto/enum.rst:725 +#: ../../howto/enum.rst:744 msgid "" ">>> from enum import IntFlag\n" ">>> class Perm(IntFlag):\n" @@ -1384,11 +1405,11 @@ msgstr "" ">>> Perm.R in RW\n" "True" -#: ../../howto/enum.rst:739 +#: ../../howto/enum.rst:758 msgid "It is also possible to name the combinations::" msgstr "" -#: ../../howto/enum.rst:741 +#: ../../howto/enum.rst:760 msgid "" ">>> class Perm(IntFlag):\n" "... R = 4\n" @@ -1416,20 +1437,20 @@ msgstr "" ">>> Perm(7)\n" "" -#: ../../howto/enum.rst:756 +#: ../../howto/enum.rst:775 msgid "" "Named combinations are considered aliases. Aliases do not show up during " "iteration, but can be returned from by-value lookups." msgstr "" -#: ../../howto/enum.rst:761 +#: ../../howto/enum.rst:780 msgid "" "Another important difference between :class:`IntFlag` and :class:`Enum` is " "that if no flags are set (the value is 0), its boolean evaluation is :data:" "`False`::" msgstr "" -#: ../../howto/enum.rst:764 +#: ../../howto/enum.rst:783 msgid "" ">>> Perm.R & Perm.X\n" "\n" @@ -1441,13 +1462,13 @@ msgstr "" ">>> bool(Perm.R & Perm.X)\n" "False" -#: ../../howto/enum.rst:769 +#: ../../howto/enum.rst:788 msgid "" "Because :class:`IntFlag` members are also subclasses of :class:`int` they " "can be combined with them (but may lose :class:`IntFlag` membership::" msgstr "" -#: ../../howto/enum.rst:772 +#: ../../howto/enum.rst:791 msgid "" ">>> Perm.X | 4\n" "\n" @@ -1461,13 +1482,13 @@ msgstr "" ">>> Perm.X + 8\n" "9" -#: ../../howto/enum.rst:780 +#: ../../howto/enum.rst:799 msgid "" "The negation operator, ``~``, always returns an :class:`IntFlag` member with " "a positive value::" msgstr "" -#: ../../howto/enum.rst:783 +#: ../../howto/enum.rst:802 msgid "" ">>> (~Perm.X).value == (Perm.R|Perm.W).value == 6\n" "True" @@ -1475,11 +1496,11 @@ msgstr "" ">>> (~Perm.X).value == (Perm.R|Perm.W).value == 6\n" "True" -#: ../../howto/enum.rst:786 +#: ../../howto/enum.rst:805 msgid ":class:`IntFlag` members can also be iterated over::" msgstr "" -#: ../../howto/enum.rst:788 +#: ../../howto/enum.rst:807 msgid "" ">>> list(RW)\n" "[, ]" @@ -1487,11 +1508,11 @@ msgstr "" ">>> list(RW)\n" "[, ]" -#: ../../howto/enum.rst:795 +#: ../../howto/enum.rst:814 msgid "Flag" msgstr "Flag" -#: ../../howto/enum.rst:797 +#: ../../howto/enum.rst:816 msgid "" "The last variation is :class:`Flag`. Like :class:`IntFlag`, :class:`Flag` " "members can be combined using the bitwise operators (&, \\|, ^, ~). Unlike :" @@ -1501,13 +1522,13 @@ msgid "" "value and let :class:`Flag` select an appropriate value." msgstr "" -#: ../../howto/enum.rst:806 +#: ../../howto/enum.rst:825 msgid "" "Like :class:`IntFlag`, if a combination of :class:`Flag` members results in " "no flags being set, the boolean evaluation is :data:`False`::" msgstr "" -#: ../../howto/enum.rst:809 +#: ../../howto/enum.rst:828 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -1531,13 +1552,13 @@ msgstr "" ">>> bool(Color.RED & Color.GREEN)\n" "False" -#: ../../howto/enum.rst:820 +#: ../../howto/enum.rst:839 msgid "" "Individual flags should have values that are powers of two (1, 2, 4, " "8, ...), while combinations of flags will not::" msgstr "" -#: ../../howto/enum.rst:823 +#: ../../howto/enum.rst:842 msgid "" ">>> class Color(Flag):\n" "... RED = auto()\n" @@ -1557,13 +1578,13 @@ msgstr "" ">>> Color.WHITE\n" "" -#: ../../howto/enum.rst:832 +#: ../../howto/enum.rst:851 msgid "" "Giving a name to the \"no flags set\" condition does not change its boolean " "value::" msgstr "" -#: ../../howto/enum.rst:835 +#: ../../howto/enum.rst:854 msgid "" ">>> class Color(Flag):\n" "... BLACK = 0\n" @@ -1587,11 +1608,11 @@ msgstr "" ">>> bool(Color.BLACK)\n" "False" -#: ../../howto/enum.rst:846 +#: ../../howto/enum.rst:865 msgid ":class:`Flag` members can also be iterated over::" msgstr "" -#: ../../howto/enum.rst:848 +#: ../../howto/enum.rst:867 msgid "" ">>> purple = Color.RED | Color.BLUE\n" ">>> list(purple)\n" @@ -1601,7 +1622,7 @@ msgstr "" ">>> list(purple)\n" "[, ]" -#: ../../howto/enum.rst:856 +#: ../../howto/enum.rst:875 msgid "" "For the majority of new code, :class:`Enum` and :class:`Flag` are strongly " "recommended, since :class:`IntEnum` and :class:`IntFlag` break some semantic " @@ -1612,50 +1633,50 @@ msgid "" "enumerations, or for interoperability with other systems." msgstr "" -#: ../../howto/enum.rst:866 +#: ../../howto/enum.rst:885 msgid "Others" msgstr "其他" -#: ../../howto/enum.rst:868 +#: ../../howto/enum.rst:887 msgid "" "While :class:`IntEnum` is part of the :mod:`enum` module, it would be very " "simple to implement independently::" msgstr "" -#: ../../howto/enum.rst:871 +#: ../../howto/enum.rst:890 msgid "" -"class IntEnum(int, Enum):\n" +"class IntEnum(int, ReprEnum): # or Enum instead of ReprEnum\n" " pass" msgstr "" -"class IntEnum(int, Enum):\n" +"class IntEnum(int, ReprEnum): # 或用 Enum 取代 ReprEnum\n" " pass" -#: ../../howto/enum.rst:874 +#: ../../howto/enum.rst:893 msgid "" "This demonstrates how similar derived enumerations can be defined; for " "example a :class:`FloatEnum` that mixes in :class:`float` instead of :class:" "`int`." msgstr "" -#: ../../howto/enum.rst:877 +#: ../../howto/enum.rst:896 msgid "Some rules:" msgstr "一些規則:" -#: ../../howto/enum.rst:879 +#: ../../howto/enum.rst:898 msgid "" -"When subclassing :class:`Enum`, mix-in types must appear before :class:" -"`Enum` itself in the sequence of bases, as in the :class:`IntEnum` example " -"above." +"When subclassing :class:`Enum`, mix-in types must appear before the :class:" +"`Enum` class itself in the sequence of bases, as in the :class:`IntEnum` " +"example above." msgstr "" -#: ../../howto/enum.rst:882 +#: ../../howto/enum.rst:901 msgid "" "Mix-in types must be subclassable. For example, :class:`bool` and :class:" "`range` are not subclassable and will throw an error during Enum creation if " "used as the mix-in type." msgstr "" -#: ../../howto/enum.rst:885 +#: ../../howto/enum.rst:904 msgid "" "While :class:`Enum` can have members of any type, once you mix in an " "additional type, all the members must have values of that type, e.g. :class:" @@ -1663,57 +1684,57 @@ msgid "" "methods and don't specify another type." msgstr "" -#: ../../howto/enum.rst:889 +#: ../../howto/enum.rst:908 msgid "" "When another data type is mixed in, the :attr:`value` attribute is *not the " "same* as the enum member itself, although it is equivalent and will compare " "equal." msgstr "" -#: ../../howto/enum.rst:892 +#: ../../howto/enum.rst:911 msgid "" "A ``data type`` is a mixin that defines :meth:`__new__`, or a :class:" "`~dataclasses.dataclass`" msgstr "" -#: ../../howto/enum.rst:894 +#: ../../howto/enum.rst:913 msgid "" "%-style formatting: ``%s`` and ``%r`` call the :class:`Enum` class's :meth:" "`__str__` and :meth:`__repr__` respectively; other codes (such as ``%i`` or " "``%h`` for IntEnum) treat the enum member as its mixed-in type." msgstr "" -#: ../../howto/enum.rst:897 +#: ../../howto/enum.rst:916 msgid "" ":ref:`Formatted string literals `, :meth:`str.format`, and :func:" "`format` will use the enum's :meth:`__str__` method." msgstr "" -#: ../../howto/enum.rst:902 +#: ../../howto/enum.rst:921 msgid "" "Because :class:`IntEnum`, :class:`IntFlag`, and :class:`StrEnum` are " "designed to be drop-in replacements for existing constants, their :meth:" "`__str__` method has been reset to their data types' :meth:`__str__` method." msgstr "" -#: ../../howto/enum.rst:910 +#: ../../howto/enum.rst:929 msgid "When to use :meth:`__new__` vs. :meth:`__init__`" msgstr "" -#: ../../howto/enum.rst:912 +#: ../../howto/enum.rst:931 msgid "" ":meth:`__new__` must be used whenever you want to customize the actual value " "of the :class:`Enum` member. Any other modifications may go in either :meth:" "`__new__` or :meth:`__init__`, with :meth:`__init__` being preferred." msgstr "" -#: ../../howto/enum.rst:916 +#: ../../howto/enum.rst:935 msgid "" "For example, if you want to pass several items to the constructor, but only " "want one of them to be the value::" msgstr "" -#: ../../howto/enum.rst:919 +#: ../../howto/enum.rst:938 msgid "" ">>> class Coordinate(bytes, Enum):\n" "... \"\"\"\n" @@ -1738,99 +1759,113 @@ msgid "" "Coordinate.VY" msgstr "" -#: ../../howto/enum.rst:943 +#: ../../howto/enum.rst:962 msgid "" "*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the " "one that is found; instead, use the data type directly." msgstr "" -#: ../../howto/enum.rst:948 +#: ../../howto/enum.rst:967 msgid "Finer Points" msgstr "" -#: ../../howto/enum.rst:951 +#: ../../howto/enum.rst:970 msgid "Supported ``__dunder__`` names" msgstr "" -#: ../../howto/enum.rst:953 +#: ../../howto/enum.rst:972 msgid "" ":attr:`__members__` is a read-only ordered mapping of ``member_name``:" "``member`` items. It is only available on the class." msgstr "" -#: ../../howto/enum.rst:956 +#: ../../howto/enum.rst:975 msgid "" ":meth:`__new__`, if specified, must create and return the enum members; it " "is also a very good idea to set the member's :attr:`_value_` appropriately. " "Once all the members are created it is no longer used." msgstr "" -#: ../../howto/enum.rst:962 +#: ../../howto/enum.rst:981 msgid "Supported ``_sunder_`` names" msgstr "" -#: ../../howto/enum.rst:964 -msgid "``_name_`` -- name of the member" -msgstr "``_name_`` -- 成員的名稱" +#: ../../howto/enum.rst:983 +msgid ":attr:`~Enum._name_` -- name of the member" +msgstr ":attr:`~Enum._name_` -- 成員的名稱" + +#: ../../howto/enum.rst:984 +msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" +msgstr "" -#: ../../howto/enum.rst:965 +#: ../../howto/enum.rst:985 msgid "" -"``_value_`` -- value of the member; can be set / modified in ``__new__``" +":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " +"may be overridden" msgstr "" -#: ../../howto/enum.rst:967 +#: ../../howto/enum.rst:987 msgid "" -"``_missing_`` -- a lookup function used when a value is not found; may be " -"overridden" +":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" +"class:`str`, that will not be transformed into members, and will be removed " +"from the final class" msgstr "" -#: ../../howto/enum.rst:969 +#: ../../howto/enum.rst:990 msgid "" -"``_ignore_`` -- a list of names, either as a :class:`list` or a :class:" -"`str`, that will not be transformed into members, and will be removed from " -"the final class" +":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " +"an enum member; may be overridden" msgstr "" -#: ../../howto/enum.rst:972 +#: ../../howto/enum.rst:992 msgid "" -"``_order_`` -- used in Python 2/3 code to ensure member order is consistent " -"(class attribute, removed during class creation)" +":meth:`~Enum._add_alias_` -- adds a new name as an alias to an existing " +"member." msgstr "" -#: ../../howto/enum.rst:974 +#: ../../howto/enum.rst:994 msgid "" -"``_generate_next_value_`` -- used by the `Functional API`_ and by :class:" -"`auto` to get an appropriate value for an enum member; may be overridden" +":meth:`~Enum._add_value_alias_` -- adds a new value as an alias to an " +"existing member. See `MultiValueEnum`_ for an example." msgstr "" -#: ../../howto/enum.rst:980 +#: ../../howto/enum.rst:999 msgid "" -"For standard :class:`Enum` classes the next value chosen is the last value " -"seen incremented by one." +"For standard :class:`Enum` classes the next value chosen is the highest " +"value seen incremented by one." msgstr "" -#: ../../howto/enum.rst:983 +#: ../../howto/enum.rst:1002 msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " -"power-of-two, regardless of the last value seen." +"power-of-two." +msgstr "" + +#: ../../howto/enum.rst:1005 +msgid "" +"Prior versions would use the last seen value instead of the highest value." msgstr "" -#: ../../howto/enum.rst:986 +#: ../../howto/enum.rst:1008 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "``_missing_``、``_order_``、``_generate_next_value_``" -#: ../../howto/enum.rst:987 +#: ../../howto/enum.rst:1009 msgid "``_ignore_``" msgstr "``_ignore_``" -#: ../../howto/enum.rst:989 +#: ../../howto/enum.rst:1010 +msgid "``_add_alias_``, ``_add_value_alias_``" +msgstr "" + +#: ../../howto/enum.rst:1012 msgid "" "To help keep Python 2 / Python 3 code in sync an :attr:`_order_` attribute " "can be provided. It will be checked against the actual order of the " "enumeration and raise an error if the two do not match::" msgstr "" -#: ../../howto/enum.rst:993 +#: ../../howto/enum.rst:1016 msgid "" ">>> class Color(Enum):\n" "... _order_ = 'RED GREEN BLUE'\n" @@ -1856,27 +1891,27 @@ msgstr "" " ['RED', 'BLUE', 'GREEN']\n" " ['RED', 'GREEN', 'BLUE']" -#: ../../howto/enum.rst:1007 +#: ../../howto/enum.rst:1030 msgid "" "In Python 2 code the :attr:`_order_` attribute is necessary as definition " "order is lost before it can be recorded." msgstr "" -#: ../../howto/enum.rst:1012 +#: ../../howto/enum.rst:1035 msgid "_Private__names" msgstr "_Private__names" -#: ../../howto/enum.rst:1014 +#: ../../howto/enum.rst:1037 msgid "" ":ref:`Private names ` are not converted to enum " "members, but remain normal attributes." msgstr "" -#: ../../howto/enum.rst:1021 +#: ../../howto/enum.rst:1044 msgid "``Enum`` member type" msgstr "" -#: ../../howto/enum.rst:1023 +#: ../../howto/enum.rst:1046 msgid "" "Enum members are instances of their enum class, and are normally accessed as " "``EnumClass.member``. In certain situations, such as writing custom enum " @@ -1886,18 +1921,18 @@ msgid "" "strongly recommended." msgstr "" -#: ../../howto/enum.rst:1034 +#: ../../howto/enum.rst:1057 msgid "Creating members that are mixed with other data types" msgstr "" -#: ../../howto/enum.rst:1036 +#: ../../howto/enum.rst:1059 msgid "" "When subclassing other data types, such as :class:`int` or :class:`str`, " "with an :class:`Enum`, all values after the ``=`` are passed to that data " "type's constructor. For example::" msgstr "" -#: ../../howto/enum.rst:1040 +#: ../../howto/enum.rst:1063 msgid "" ">>> class MyEnum(IntEnum): # help(int) -> int(x, base=10) -> integer\n" "... example = '11', 16 # so x='11' and base=16\n" @@ -1905,12 +1940,17 @@ msgid "" ">>> MyEnum.example.value # and hex(11) is...\n" "17" msgstr "" +">>> class MyEnum(IntEnum): # help(int) -> int(x, base=10) -> integer\n" +"... example = '11', 16 # 所以 x='11' 且 base=16\n" +"...\n" +">>> MyEnum.example.value # 且 hex(11) 為...\n" +"17" -#: ../../howto/enum.rst:1048 +#: ../../howto/enum.rst:1071 msgid "Boolean value of ``Enum`` classes and members" msgstr "" -#: ../../howto/enum.rst:1050 +#: ../../howto/enum.rst:1073 msgid "" "Enum classes that are mixed with non-:class:`Enum` types (such as :class:" "`int`, :class:`str`, etc.) are evaluated according to the mixed-in type's " @@ -1919,7 +1959,7 @@ msgid "" "your class::" msgstr "" -#: ../../howto/enum.rst:1056 +#: ../../howto/enum.rst:1079 msgid "" "def __bool__(self):\n" " return bool(self.value)" @@ -1927,22 +1967,22 @@ msgstr "" "def __bool__(self):\n" " return bool(self.value)" -#: ../../howto/enum.rst:1059 +#: ../../howto/enum.rst:1082 msgid "Plain :class:`Enum` classes always evaluate as :data:`True`." msgstr "" -#: ../../howto/enum.rst:1063 +#: ../../howto/enum.rst:1086 msgid "``Enum`` classes with methods" msgstr "" -#: ../../howto/enum.rst:1065 +#: ../../howto/enum.rst:1088 msgid "" "If you give your enum subclass extra methods, like the `Planet`_ class " "below, those methods will show up in a :func:`dir` of the member, but not of " "the class::" msgstr "" -#: ../../howto/enum.rst:1069 +#: ../../howto/enum.rst:1092 msgid "" ">>> dir(Planet) \n" "['EARTH', 'JUPITER', 'MARS', 'MERCURY', 'NEPTUNE', 'SATURN', 'URANUS', " @@ -1958,17 +1998,17 @@ msgstr "" "['__class__', '__doc__', '__module__', 'mass', 'name', 'radius', " "'surface_gravity', 'value']" -#: ../../howto/enum.rst:1076 +#: ../../howto/enum.rst:1099 msgid "Combining members of ``Flag``" msgstr "" -#: ../../howto/enum.rst:1078 +#: ../../howto/enum.rst:1101 msgid "" "Iterating over a combination of :class:`Flag` members will only return the " "members that are comprised of a single bit::" msgstr "" -#: ../../howto/enum.rst:1081 +#: ../../howto/enum.rst:1104 msgid "" ">>> class Color(Flag):\n" "... RED = auto()\n" @@ -1984,15 +2024,15 @@ msgid "" "" msgstr "" -#: ../../howto/enum.rst:1096 +#: ../../howto/enum.rst:1119 msgid "``Flag`` and ``IntFlag`` minutia" msgstr "" -#: ../../howto/enum.rst:1098 +#: ../../howto/enum.rst:1121 msgid "Using the following snippet for our examples::" msgstr "" -#: ../../howto/enum.rst:1100 +#: ../../howto/enum.rst:1123 msgid "" ">>> class Color(IntFlag):\n" "... BLACK = 0\n" @@ -2012,23 +2052,23 @@ msgstr "" "... WHITE = RED | GREEN | BLUE\n" "..." -#: ../../howto/enum.rst:1109 +#: ../../howto/enum.rst:1132 msgid "the following are true:" msgstr "" -#: ../../howto/enum.rst:1111 +#: ../../howto/enum.rst:1134 msgid "single-bit flags are canonical" msgstr "" -#: ../../howto/enum.rst:1112 +#: ../../howto/enum.rst:1135 msgid "multi-bit and zero-bit flags are aliases" msgstr "" -#: ../../howto/enum.rst:1113 +#: ../../howto/enum.rst:1136 msgid "only canonical flags are returned during iteration::" msgstr "" -#: ../../howto/enum.rst:1115 +#: ../../howto/enum.rst:1138 msgid "" ">>> list(Color.WHITE)\n" "[, , ]" @@ -2036,13 +2076,13 @@ msgstr "" ">>> list(Color.WHITE)\n" "[, , ]" -#: ../../howto/enum.rst:1118 +#: ../../howto/enum.rst:1141 msgid "" "negating a flag or flag set returns a new flag/flag set with the " "corresponding positive integer value::" msgstr "" -#: ../../howto/enum.rst:1121 +#: ../../howto/enum.rst:1144 msgid "" ">>> Color.BLUE\n" "\n" @@ -2056,11 +2096,11 @@ msgstr "" ">>> ~Color.BLUE\n" "" -#: ../../howto/enum.rst:1127 +#: ../../howto/enum.rst:1150 msgid "names of pseudo-flags are constructed from their members' names::" msgstr "" -#: ../../howto/enum.rst:1129 +#: ../../howto/enum.rst:1152 msgid "" ">>> (Color.RED | Color.GREEN).name\n" "'RED|GREEN'\n" @@ -2074,11 +2114,11 @@ msgid "" "True" msgstr "" -#: ../../howto/enum.rst:1140 +#: ../../howto/enum.rst:1163 msgid "multi-bit flags, aka aliases, can be returned from operations::" msgstr "" -#: ../../howto/enum.rst:1142 +#: ../../howto/enum.rst:1165 msgid "" ">>> Color.RED | Color.BLUE\n" "\n" @@ -2098,13 +2138,13 @@ msgstr "" ">>> Color(0)\n" "" -#: ../../howto/enum.rst:1151 +#: ../../howto/enum.rst:1174 msgid "" "membership / containment checking: zero-valued flags are always considered " "to be contained::" msgstr "" -#: ../../howto/enum.rst:1154 +#: ../../howto/enum.rst:1177 msgid "" ">>> Color.BLACK in Color.WHITE\n" "True" @@ -2112,13 +2152,13 @@ msgstr "" ">>> Color.BLACK in Color.WHITE\n" "True" -#: ../../howto/enum.rst:1157 +#: ../../howto/enum.rst:1180 msgid "" "otherwise, only if all bits of one flag are in the other flag will True be " "returned::" msgstr "" -#: ../../howto/enum.rst:1160 +#: ../../howto/enum.rst:1183 msgid "" ">>> Color.PURPLE in Color.WHITE\n" "True\n" @@ -2132,62 +2172,62 @@ msgstr "" ">>> Color.GREEN in Color.PURPLE\n" "False" -#: ../../howto/enum.rst:1166 +#: ../../howto/enum.rst:1189 msgid "" "There is a new boundary mechanism that controls how out-of-range / invalid " "bits are handled: ``STRICT``, ``CONFORM``, ``EJECT``, and ``KEEP``:" msgstr "" -#: ../../howto/enum.rst:1169 +#: ../../howto/enum.rst:1192 msgid "STRICT --> raises an exception when presented with invalid values" msgstr "" -#: ../../howto/enum.rst:1170 +#: ../../howto/enum.rst:1193 msgid "CONFORM --> discards any invalid bits" msgstr "" -#: ../../howto/enum.rst:1171 +#: ../../howto/enum.rst:1194 msgid "EJECT --> lose Flag status and become a normal int with the given value" msgstr "" -#: ../../howto/enum.rst:1172 +#: ../../howto/enum.rst:1195 msgid "KEEP --> keep the extra bits" msgstr "" -#: ../../howto/enum.rst:1174 +#: ../../howto/enum.rst:1197 msgid "keeps Flag status and extra bits" msgstr "" -#: ../../howto/enum.rst:1175 +#: ../../howto/enum.rst:1198 msgid "extra bits do not show up in iteration" msgstr "" -#: ../../howto/enum.rst:1176 +#: ../../howto/enum.rst:1199 msgid "extra bits do show up in repr() and str()" msgstr "" -#: ../../howto/enum.rst:1178 +#: ../../howto/enum.rst:1201 msgid "" "The default for Flag is ``STRICT``, the default for ``IntFlag`` is " "``EJECT``, and the default for ``_convert_`` is ``KEEP`` (see ``ssl." "Options`` for an example of when ``KEEP`` is needed)." msgstr "" -#: ../../howto/enum.rst:1186 +#: ../../howto/enum.rst:1209 msgid "How are Enums and Flags different?" msgstr "" -#: ../../howto/enum.rst:1188 +#: ../../howto/enum.rst:1211 msgid "" "Enums have a custom metaclass that affects many aspects of both derived :" "class:`Enum` classes and their instances (members)." msgstr "" -#: ../../howto/enum.rst:1193 +#: ../../howto/enum.rst:1216 msgid "Enum Classes" -msgstr "" +msgstr "Enum 類別" -#: ../../howto/enum.rst:1195 +#: ../../howto/enum.rst:1218 msgid "" "The :class:`EnumType` metaclass is responsible for providing the :meth:" "`__contains__`, :meth:`__dir__`, :meth:`__iter__` and other methods that " @@ -2198,11 +2238,11 @@ msgid "" "`__getnewargs__`, :meth:`__str__` and :meth:`__repr__`)." msgstr "" -#: ../../howto/enum.rst:1204 +#: ../../howto/enum.rst:1227 msgid "Flag Classes" -msgstr "" +msgstr "Flag 類別" -#: ../../howto/enum.rst:1206 +#: ../../howto/enum.rst:1229 msgid "" "Flags have an expanded view of aliasing: to be canonical, the value of a " "flag needs to be a power-of-two value, and not a duplicate name. So, in " @@ -2211,11 +2251,11 @@ msgid "" "considered an alias." msgstr "" -#: ../../howto/enum.rst:1212 +#: ../../howto/enum.rst:1235 msgid "Enum Members (aka instances)" msgstr "" -#: ../../howto/enum.rst:1214 +#: ../../howto/enum.rst:1237 msgid "" "The most interesting thing about enum members is that they are singletons. :" "class:`EnumType` creates them all while it is creating the enum class " @@ -2224,17 +2264,17 @@ msgid "" "instances." msgstr "" -#: ../../howto/enum.rst:1220 +#: ../../howto/enum.rst:1243 msgid "Flag Members" -msgstr "" +msgstr "Flag 成員" -#: ../../howto/enum.rst:1222 +#: ../../howto/enum.rst:1245 msgid "" "Flag members can be iterated over just like the :class:`Flag` class, and " "only the canonical members will be returned. For example::" msgstr "" -#: ../../howto/enum.rst:1225 +#: ../../howto/enum.rst:1248 msgid "" ">>> list(Color)\n" "[, , ]" @@ -2242,17 +2282,17 @@ msgstr "" ">>> list(Color)\n" "[, , ]" -#: ../../howto/enum.rst:1228 +#: ../../howto/enum.rst:1251 msgid "(Note that ``BLACK``, ``PURPLE``, and ``WHITE`` do not show up.)" msgstr "" -#: ../../howto/enum.rst:1230 +#: ../../howto/enum.rst:1253 msgid "" "Inverting a flag member returns the corresponding positive value, rather " "than a negative value --- for example::" msgstr "" -#: ../../howto/enum.rst:1233 +#: ../../howto/enum.rst:1256 msgid "" ">>> ~Color.RED\n" "" @@ -2260,13 +2300,13 @@ msgstr "" ">>> ~Color.RED\n" "" -#: ../../howto/enum.rst:1236 +#: ../../howto/enum.rst:1259 msgid "" "Flag members have a length corresponding to the number of power-of-two " "values they contain. For example::" msgstr "" -#: ../../howto/enum.rst:1239 +#: ../../howto/enum.rst:1262 msgid "" ">>> len(Color.PURPLE)\n" "2" @@ -2274,11 +2314,11 @@ msgstr "" ">>> len(Color.PURPLE)\n" "2" -#: ../../howto/enum.rst:1246 +#: ../../howto/enum.rst:1269 msgid "Enum Cookbook" msgstr "" -#: ../../howto/enum.rst:1249 +#: ../../howto/enum.rst:1272 msgid "" "While :class:`Enum`, :class:`IntEnum`, :class:`StrEnum`, :class:`Flag`, and :" "class:`IntFlag` are expected to cover the majority of use-cases, they cannot " @@ -2286,50 +2326,50 @@ msgid "" "that can be used directly, or as examples for creating one's own." msgstr "" -#: ../../howto/enum.rst:1256 +#: ../../howto/enum.rst:1279 msgid "Omitting values" msgstr "" -#: ../../howto/enum.rst:1258 +#: ../../howto/enum.rst:1281 msgid "" "In many use-cases, one doesn't care what the actual value of an enumeration " "is. There are several ways to define this type of simple enumeration:" msgstr "" -#: ../../howto/enum.rst:1261 +#: ../../howto/enum.rst:1284 msgid "use instances of :class:`auto` for the value" msgstr "" -#: ../../howto/enum.rst:1262 +#: ../../howto/enum.rst:1285 msgid "use instances of :class:`object` as the value" msgstr "" -#: ../../howto/enum.rst:1263 +#: ../../howto/enum.rst:1286 msgid "use a descriptive string as the value" msgstr "" -#: ../../howto/enum.rst:1264 +#: ../../howto/enum.rst:1287 msgid "" "use a tuple as the value and a custom :meth:`__new__` to replace the tuple " "with an :class:`int` value" msgstr "" -#: ../../howto/enum.rst:1267 +#: ../../howto/enum.rst:1290 msgid "" "Using any of these methods signifies to the user that these values are not " "important, and also enables one to add, remove, or reorder members without " "having to renumber the remaining members." msgstr "" -#: ../../howto/enum.rst:1273 +#: ../../howto/enum.rst:1296 msgid "Using :class:`auto`" msgstr "使用 :class:`auto`" -#: ../../howto/enum.rst:1275 +#: ../../howto/enum.rst:1298 msgid "Using :class:`auto` would look like::" msgstr "" -#: ../../howto/enum.rst:1277 +#: ../../howto/enum.rst:1300 msgid "" ">>> class Color(Enum):\n" "... RED = auto()\n" @@ -2347,15 +2387,15 @@ msgstr "" ">>> Color.GREEN\n" "" -#: ../../howto/enum.rst:1287 +#: ../../howto/enum.rst:1310 msgid "Using :class:`object`" msgstr "使用 :class:`object`" -#: ../../howto/enum.rst:1289 +#: ../../howto/enum.rst:1312 msgid "Using :class:`object` would look like::" msgstr "" -#: ../../howto/enum.rst:1291 +#: ../../howto/enum.rst:1314 msgid "" ">>> class Color(Enum):\n" "... RED = object()\n" @@ -2373,13 +2413,13 @@ msgstr "" ">>> Color.GREEN \n" ">" -#: ../../howto/enum.rst:1299 +#: ../../howto/enum.rst:1322 msgid "" "This is also a good example of why you might want to write your own :meth:" "`__repr__`::" msgstr "" -#: ../../howto/enum.rst:1302 +#: ../../howto/enum.rst:1325 msgid "" ">>> class Color(Enum):\n" "... RED = object()\n" @@ -2401,15 +2441,15 @@ msgstr "" ">>> Color.GREEN\n" "" -#: ../../howto/enum.rst:1315 +#: ../../howto/enum.rst:1338 msgid "Using a descriptive string" msgstr "" -#: ../../howto/enum.rst:1317 +#: ../../howto/enum.rst:1340 msgid "Using a string as the value would look like::" msgstr "" -#: ../../howto/enum.rst:1319 +#: ../../howto/enum.rst:1342 msgid "" ">>> class Color(Enum):\n" "... RED = 'stop'\n" @@ -2427,15 +2467,15 @@ msgstr "" ">>> Color.GREEN\n" "" -#: ../../howto/enum.rst:1329 +#: ../../howto/enum.rst:1352 msgid "Using a custom :meth:`__new__`" msgstr "" -#: ../../howto/enum.rst:1331 +#: ../../howto/enum.rst:1354 msgid "Using an auto-numbering :meth:`__new__` would look like::" msgstr "" -#: ../../howto/enum.rst:1333 +#: ../../howto/enum.rst:1356 msgid "" ">>> class AutoNumber(Enum):\n" "... def __new__(cls):\n" @@ -2467,13 +2507,13 @@ msgstr "" ">>> Color.GREEN\n" "" -#: ../../howto/enum.rst:1348 +#: ../../howto/enum.rst:1371 msgid "" "To make a more general purpose ``AutoNumber``, add ``*args`` to the " "signature::" msgstr "" -#: ../../howto/enum.rst:1350 +#: ../../howto/enum.rst:1373 msgid "" ">>> class AutoNumber(Enum):\n" "... def __new__(cls, *args): # this is the only change from above\n" @@ -2484,13 +2524,13 @@ msgid "" "..." msgstr "" -#: ../../howto/enum.rst:1358 +#: ../../howto/enum.rst:1381 msgid "" "Then when you inherit from ``AutoNumber`` you can write your own " "``__init__`` to handle any extra arguments::" msgstr "" -#: ../../howto/enum.rst:1361 +#: ../../howto/enum.rst:1384 msgid "" ">>> class Swatch(AutoNumber):\n" "... def __init__(self, pantone='unknown'):\n" @@ -2507,35 +2547,35 @@ msgid "" "'unknown'" msgstr "" -#: ../../howto/enum.rst:1377 +#: ../../howto/enum.rst:1400 msgid "" "The :meth:`__new__` method, if defined, is used during creation of the Enum " "members; it is then replaced by Enum's :meth:`__new__` which is used after " "class creation for lookup of existing members." msgstr "" -#: ../../howto/enum.rst:1383 +#: ../../howto/enum.rst:1406 msgid "" "*Do not* call ``super().__new__()``, as the lookup-only ``__new__`` is the " "one that is found; instead, use the data type directly -- e.g.::" msgstr "" -#: ../../howto/enum.rst:1386 +#: ../../howto/enum.rst:1409 msgid "obj = int.__new__(cls, value)" msgstr "obj = int.__new__(cls, value)" -#: ../../howto/enum.rst:1390 +#: ../../howto/enum.rst:1413 msgid "OrderedEnum" msgstr "OrderedEnum" -#: ../../howto/enum.rst:1392 +#: ../../howto/enum.rst:1415 msgid "" "An ordered enumeration that is not based on :class:`IntEnum` and so " "maintains the normal :class:`Enum` invariants (such as not being comparable " "to other enumerations)::" msgstr "" -#: ../../howto/enum.rst:1396 +#: ../../howto/enum.rst:1419 msgid "" ">>> class OrderedEnum(Enum):\n" "... def __ge__(self, other):\n" @@ -2593,17 +2633,17 @@ msgstr "" ">>> Grade.C < Grade.A\n" "True" -#: ../../howto/enum.rst:1426 +#: ../../howto/enum.rst:1449 msgid "DuplicateFreeEnum" msgstr "DuplicateFreeEnum" -#: ../../howto/enum.rst:1428 +#: ../../howto/enum.rst:1451 msgid "" "Raises an error if a duplicate member value is found instead of creating an " "alias::" msgstr "" -#: ../../howto/enum.rst:1431 +#: ../../howto/enum.rst:1454 msgid "" ">>> class DuplicateFreeEnum(Enum):\n" "... def __init__(self, *args):\n" @@ -2627,24 +2667,52 @@ msgid "" "ValueError: aliases not allowed in DuplicateFreeEnum: 'GRENE' --> 'GREEN'" msgstr "" -#: ../../howto/enum.rst:1453 +#: ../../howto/enum.rst:1476 msgid "" "This is a useful example for subclassing Enum to add or change other " "behaviors as well as disallowing aliases. If the only desired change is " "disallowing aliases, the :func:`unique` decorator can be used instead." msgstr "" -#: ../../howto/enum.rst:1459 +#: ../../howto/enum.rst:1482 +msgid "MultiValueEnum" +msgstr "MultiValueEnum" + +#: ../../howto/enum.rst:1484 +msgid "Supports having more than one value per member::" +msgstr "" + +#: ../../howto/enum.rst:1486 +msgid "" +">>> class MultiValueEnum(Enum):\n" +"... def __new__(cls, value, *values):\n" +"... self = object.__new__(cls)\n" +"... self._value_ = value\n" +"... for v in values:\n" +"... self._add_value_alias_(v)\n" +"... return self\n" +"...\n" +">>> class DType(MultiValueEnum):\n" +"... float32 = 'f', 8\n" +"... double64 = 'd', 9\n" +"...\n" +">>> DType('f')\n" +"\n" +">>> DType(9)\n" +"" +msgstr "" + +#: ../../howto/enum.rst:1505 msgid "Planet" msgstr "" -#: ../../howto/enum.rst:1461 +#: ../../howto/enum.rst:1507 msgid "" "If :meth:`__new__` or :meth:`__init__` is defined, the value of the enum " "member will be passed to those methods::" msgstr "" -#: ../../howto/enum.rst:1464 +#: ../../howto/enum.rst:1510 msgid "" ">>> class Planet(Enum):\n" "... MERCURY = (3.303e+23, 2.4397e6)\n" @@ -2670,15 +2738,15 @@ msgid "" "9.802652743337129" msgstr "" -#: ../../howto/enum.rst:1490 +#: ../../howto/enum.rst:1536 msgid "TimePeriod" msgstr "" -#: ../../howto/enum.rst:1492 +#: ../../howto/enum.rst:1538 msgid "An example to show the :attr:`_ignore_` attribute in use::" msgstr "" -#: ../../howto/enum.rst:1494 +#: ../../howto/enum.rst:1540 msgid "" ">>> from datetime import timedelta\n" ">>> class Period(timedelta, Enum):\n" @@ -2696,11 +2764,11 @@ msgid "" "timedelta(days=366)>]" msgstr "" -#: ../../howto/enum.rst:1511 +#: ../../howto/enum.rst:1557 msgid "Subclassing EnumType" -msgstr "" +msgstr "子類別化 EnumType" -#: ../../howto/enum.rst:1513 +#: ../../howto/enum.rst:1559 msgid "" "While most enum needs can be met by customizing :class:`Enum` subclasses, " "either with class decorators or custom functions, :class:`EnumType` can be " diff --git a/howto/free-threading-extensions.po b/howto/free-threading-extensions.po new file mode 100644 index 0000000000..988740ef1d --- /dev/null +++ b/howto/free-threading-extensions.po @@ -0,0 +1,468 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../howto/free-threading-extensions.rst:7 +msgid "C API Extension Support for Free Threading" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:9 +msgid "" +"Starting with the 3.13 release, CPython has experimental support for running " +"with the :term:`global interpreter lock` (GIL) disabled in a configuration " +"called :term:`free threading`. This document describes how to adapt C API " +"extensions to support free threading." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:16 +msgid "Identifying the Free-Threaded Build in C" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:18 +msgid "" +"The CPython C API exposes the ``Py_GIL_DISABLED`` macro: in the free-" +"threaded build it's defined to ``1``, and in the regular build it's not " +"defined. You can use it to enable code that only runs under the free-" +"threaded build::" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:22 +msgid "" +"#ifdef Py_GIL_DISABLED\n" +"/* code that only runs in the free-threaded build */\n" +"#endif" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:27 +msgid "Module Initialization" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:29 +msgid "" +"Extension modules need to explicitly indicate that they support running with " +"the GIL disabled; otherwise importing the extension will raise a warning and " +"enable the GIL at runtime." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:33 +msgid "" +"There are two ways to indicate that an extension module supports running " +"with the GIL disabled depending on whether the extension uses multi-phase or " +"single-phase initialization." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:38 +msgid "Multi-Phase Initialization" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:40 +msgid "" +"Extensions that use multi-phase initialization (i.e., :c:func:" +"`PyModuleDef_Init`) should add a :c:data:`Py_mod_gil` slot in the module " +"definition. If your extension supports older versions of CPython, you " +"should guard the slot with a :c:data:`PY_VERSION_HEX` check." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:47 +msgid "" +"static struct PyModuleDef_Slot module_slots[] = {\n" +" ...\n" +"#if PY_VERSION_HEX >= 0x030D0000\n" +" {Py_mod_gil, Py_MOD_GIL_NOT_USED},\n" +"#endif\n" +" {0, NULL}\n" +"};\n" +"\n" +"static struct PyModuleDef moduledef = {\n" +" PyModuleDef_HEAD_INIT,\n" +" .m_slots = module_slots,\n" +" ...\n" +"};" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:63 +msgid "Single-Phase Initialization" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:65 +msgid "" +"Extensions that use single-phase initialization (i.e., :c:func:" +"`PyModule_Create`) should call :c:func:`PyUnstable_Module_SetGIL` to " +"indicate that they support running with the GIL disabled. The function is " +"only defined in the free-threaded build, so you should guard the call with " +"``#ifdef Py_GIL_DISABLED`` to avoid compilation errors in the regular build." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:73 +msgid "" +"static struct PyModuleDef moduledef = {\n" +" PyModuleDef_HEAD_INIT,\n" +" ...\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_mymodule(void)\n" +"{\n" +" PyObject *m = PyModule_Create(&moduledef);\n" +" if (m == NULL) {\n" +" return NULL;\n" +" }\n" +"#ifdef Py_GIL_DISABLED\n" +" PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);\n" +"#endif\n" +" return m;\n" +"}" +msgstr "" +"static struct PyModuleDef moduledef = {\n" +" PyModuleDef_HEAD_INIT,\n" +" ...\n" +"};\n" +"\n" +"PyMODINIT_FUNC\n" +"PyInit_mymodule(void)\n" +"{\n" +" PyObject *m = PyModule_Create(&moduledef);\n" +" if (m == NULL) {\n" +" return NULL;\n" +" }\n" +"#ifdef Py_GIL_DISABLED\n" +" PyUnstable_Module_SetGIL(m, Py_MOD_GIL_NOT_USED);\n" +"#endif\n" +" return m;\n" +"}" + +#: ../../howto/free-threading-extensions.rst:93 +msgid "General API Guidelines" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:95 +msgid "Most of the C API is thread-safe, but there are some exceptions." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:97 +msgid "" +"**Struct Fields**: Accessing fields in Python C API objects or structs " +"directly is not thread-safe if the field may be concurrently modified." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:99 +msgid "" +"**Macros**: Accessor macros like :c:macro:`PyList_GET_ITEM` and :c:macro:" +"`PyList_SET_ITEM` do not perform any error checking or locking. These macros " +"are not thread-safe if the container object may be modified concurrently." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:103 +msgid "" +"**Borrowed References**: C API functions that return :term:`borrowed " +"references ` may not be thread-safe if the containing " +"object is modified concurrently. See the section on :ref:`borrowed " +"references ` for more information." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:110 +msgid "Container Thread Safety" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:112 +msgid "" +"Containers like :c:struct:`PyListObject`, :c:struct:`PyDictObject`, and :c:" +"struct:`PySetObject` perform internal locking in the free-threaded build. " +"For example, the :c:func:`PyList_Append` will lock the list before appending " +"an item." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:120 +msgid "``PyDict_Next``" +msgstr "``PyDict_Next``" + +#: ../../howto/free-threading-extensions.rst:122 +msgid "" +"A notable exception is :c:func:`PyDict_Next`, which does not lock the " +"dictionary. You should use :c:macro:`Py_BEGIN_CRITICAL_SECTION` to protect " +"the dictionary while iterating over it if the dictionary may be concurrently " +"modified::" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:127 +msgid "" +"Py_BEGIN_CRITICAL_SECTION(dict);\n" +"PyObject *key, *value;\n" +"Py_ssize_t pos = 0;\n" +"while (PyDict_Next(dict, &pos, &key, &value)) {\n" +" ...\n" +"}\n" +"Py_END_CRITICAL_SECTION();" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:137 +msgid "Borrowed References" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:141 +msgid "" +"Some C API functions return :term:`borrowed references `. These APIs are not thread-safe if the containing object is " +"modified concurrently. For example, it's not safe to use :c:func:" +"`PyList_GetItem` if the list may be modified concurrently." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:146 +msgid "" +"The following table lists some borrowed reference APIs and their " +"replacements that return :term:`strong references `." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:150 +msgid "Borrowed reference API" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:150 +msgid "Strong reference API" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:152 +msgid ":c:func:`PyList_GetItem`" +msgstr ":c:func:`PyList_GetItem`" + +#: ../../howto/free-threading-extensions.rst:152 +msgid ":c:func:`PyList_GetItemRef`" +msgstr ":c:func:`PyList_GetItemRef`" + +#: ../../howto/free-threading-extensions.rst:154 +msgid ":c:func:`PyDict_GetItem`" +msgstr ":c:func:`PyDict_GetItem`" + +#: ../../howto/free-threading-extensions.rst:154 +#: ../../howto/free-threading-extensions.rst:156 +msgid ":c:func:`PyDict_GetItemRef`" +msgstr ":c:func:`PyDict_GetItemRef`" + +#: ../../howto/free-threading-extensions.rst:156 +msgid ":c:func:`PyDict_GetItemWithError`" +msgstr ":c:func:`PyDict_GetItemWithError`" + +#: ../../howto/free-threading-extensions.rst:158 +msgid ":c:func:`PyDict_GetItemString`" +msgstr ":c:func:`PyDict_GetItemString`" + +#: ../../howto/free-threading-extensions.rst:158 +msgid ":c:func:`PyDict_GetItemStringRef`" +msgstr ":c:func:`PyDict_GetItemStringRef`" + +#: ../../howto/free-threading-extensions.rst:160 +msgid ":c:func:`PyDict_SetDefault`" +msgstr ":c:func:`PyDict_SetDefault`" + +#: ../../howto/free-threading-extensions.rst:160 +msgid ":c:func:`PyDict_SetDefaultRef`" +msgstr ":c:func:`PyDict_SetDefaultRef`" + +#: ../../howto/free-threading-extensions.rst:162 +msgid ":c:func:`PyDict_Next`" +msgstr ":c:func:`PyDict_Next`" + +#: ../../howto/free-threading-extensions.rst:162 +msgid "none (see :ref:`PyDict_Next`)" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:164 +msgid ":c:func:`PyWeakref_GetObject`" +msgstr ":c:func:`PyWeakref_GetObject`" + +#: ../../howto/free-threading-extensions.rst:164 +#: ../../howto/free-threading-extensions.rst:166 +msgid ":c:func:`PyWeakref_GetRef`" +msgstr ":c:func:`PyWeakref_GetRef`" + +#: ../../howto/free-threading-extensions.rst:166 +msgid ":c:func:`PyWeakref_GET_OBJECT`" +msgstr ":c:func:`PyWeakref_GET_OBJECT`" + +#: ../../howto/free-threading-extensions.rst:168 +msgid ":c:func:`PyImport_AddModule`" +msgstr ":c:func:`PyImport_AddModule`" + +#: ../../howto/free-threading-extensions.rst:168 +msgid ":c:func:`PyImport_AddModuleRef`" +msgstr ":c:func:`PyImport_AddModuleRef`" + +#: ../../howto/free-threading-extensions.rst:171 +msgid "" +"Not all APIs that return borrowed references are problematic. For example, :" +"c:func:`PyTuple_GetItem` is safe because tuples are immutable. Similarly, " +"not all uses of the above APIs are problematic. For example, :c:func:" +"`PyDict_GetItem` is often used for parsing keyword argument dictionaries in " +"function calls; those keyword argument dictionaries are effectively private " +"(not accessible by other threads), so using borrowed references in that " +"context is safe." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:179 +msgid "" +"Some of these functions were added in Python 3.13. You can use the " +"`pythoncapi-compat `_ package " +"to provide implementations of these functions for older Python versions." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:187 +msgid "Memory Allocation APIs" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:189 +msgid "" +"Python's memory management C API provides functions in three different :ref:" +"`allocation domains `: \"raw\", \"mem\", and \"object\". " +"For thread-safety, the free-threaded build requires that only Python objects " +"are allocated using the object domain, and that all Python object are " +"allocated using that domain. This differs from the prior Python versions, " +"where this was only a best practice and not a hard requirement." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:198 +msgid "" +"Search for uses of :c:func:`PyObject_Malloc` in your extension and check " +"that the allocated memory is used for Python objects. Use :c:func:" +"`PyMem_Malloc` to allocate buffers instead of :c:func:`PyObject_Malloc`." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:205 +msgid "Thread State and GIL APIs" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:207 +msgid "" +"Python provides a set of functions and macros to manage thread state and the " +"GIL, such as:" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:210 +msgid ":c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`" +msgstr ":c:func:`PyGILState_Ensure` 和 :c:func:`PyGILState_Release`" + +#: ../../howto/free-threading-extensions.rst:211 +msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`" +msgstr ":c:func:`PyEval_SaveThread` 和 :c:func:`PyEval_RestoreThread`" + +#: ../../howto/free-threading-extensions.rst:212 +msgid ":c:macro:`Py_BEGIN_ALLOW_THREADS` and :c:macro:`Py_END_ALLOW_THREADS`" +msgstr ":c:macro:`Py_BEGIN_ALLOW_THREADS` 和 :c:macro:`Py_END_ALLOW_THREADS`" + +#: ../../howto/free-threading-extensions.rst:214 +msgid "" +"These functions should still be used in the free-threaded build to manage " +"thread state even when the :term:`GIL` is disabled. For example, if you " +"create a thread outside of Python, you must call :c:func:`PyGILState_Ensure` " +"before calling into the Python API to ensure that the thread has a valid " +"Python thread state." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:220 +msgid "" +"You should continue to call :c:func:`PyEval_SaveThread` or :c:macro:" +"`Py_BEGIN_ALLOW_THREADS` around blocking operations, such as I/O or lock " +"acquisitions, to allow other threads to run the :term:`cyclic garbage " +"collector `." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:227 +msgid "Protecting Internal Extension State" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:229 +msgid "" +"Your extension may have internal state that was previously protected by the " +"GIL. You may need to add locking to protect this state. The approach will " +"depend on your extension, but some common patterns include:" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:233 +msgid "" +"**Caches**: global caches are a common source of shared state. Consider " +"using a lock to protect the cache or disabling it in the free-threaded build " +"if the cache is not critical for performance." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:236 +msgid "" +"**Global State**: global state may need to be protected by a lock or moved " +"to thread local storage. C11 and C++11 provide the ``thread_local`` or " +"``_Thread_local`` for `thread-local storage `_." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:243 +msgid "Building Extensions for the Free-Threaded Build" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:245 +msgid "" +"C API extensions need to be built specifically for the free-threaded build. " +"The wheels, shared libraries, and binaries are indicated by a ``t`` suffix." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:248 +msgid "" +"`pypa/manylinux `_ supports the free-" +"threaded build, with the ``t`` suffix, such as ``python3.13t``." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:250 +msgid "" +"`pypa/cibuildwheel `_ supports the " +"free-threaded build if you set `CIBW_FREE_THREADED_SUPPORT `_." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:255 +msgid "Limited C API and Stable ABI" +msgstr "" + +#: ../../howto/free-threading-extensions.rst:257 +msgid "" +"The free-threaded build does not currently support the :ref:`Limited C API " +"` or the stable ABI. If you use `setuptools `_ to build your extension and " +"currently set ``py_limited_api=True`` you can use ``py_limited_api=not " +"sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` to opt out of the limited " +"API when building with the free-threaded build." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:265 +msgid "" +"You will need to build separate wheels specifically for the free-threaded " +"build. If you currently use the stable ABI, you can continue to build a " +"single wheel for multiple non-free-threaded Python versions." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:271 +msgid "Windows" +msgstr "Windows" + +#: ../../howto/free-threading-extensions.rst:273 +msgid "" +"Due to a limitation of the official Windows installer, you will need to " +"manually define ``Py_GIL_DISABLED=1`` when building extensions from source." +msgstr "" + +#: ../../howto/free-threading-extensions.rst:278 +msgid "" +"`Porting Extension Modules to Support Free-Threading `_: A community-maintained porting guide for " +"extension authors." +msgstr "" diff --git a/howto/free-threading-python.po b/howto/free-threading-python.po new file mode 100644 index 0000000000..5578166a5d --- /dev/null +++ b/howto/free-threading-python.po @@ -0,0 +1,257 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../howto/free-threading-python.rst:5 +msgid "Python experimental support for free threading" +msgstr "" + +#: ../../howto/free-threading-python.rst:7 +msgid "" +"Starting with the 3.13 release, CPython has experimental support for a build " +"of Python called :term:`free threading` where the :term:`global interpreter " +"lock` (GIL) is disabled. Free-threaded execution allows for full " +"utilization of the available processing power by running threads in parallel " +"on available CPU cores. While not all software will benefit from this " +"automatically, programs designed with threading in mind will run faster on " +"multi-core hardware." +msgstr "" + +#: ../../howto/free-threading-python.rst:14 +msgid "" +"**The free-threaded mode is experimental** and work is ongoing to improve " +"it: expect some bugs and a substantial single-threaded performance hit." +msgstr "" + +#: ../../howto/free-threading-python.rst:17 +msgid "" +"This document describes the implications of free threading for Python code. " +"See :ref:`freethreading-extensions-howto` for information on how to write C " +"extensions that support the free-threaded build." +msgstr "" + +#: ../../howto/free-threading-python.rst:23 +msgid "" +":pep:`703` – Making the Global Interpreter Lock Optional in CPython for an " +"overall description of free-threaded Python." +msgstr "" + +#: ../../howto/free-threading-python.rst:28 +msgid "Installation" +msgstr "" + +#: ../../howto/free-threading-python.rst:30 +msgid "" +"Starting with Python 3.13, the official macOS and Windows installers " +"optionally support installing free-threaded Python binaries. The installers " +"are available at https://www.python.org/downloads/." +msgstr "" + +#: ../../howto/free-threading-python.rst:34 +msgid "" +"For information on other platforms, see the `Installing a Free-Threaded " +"Python `_, a " +"community-maintained installation guide for installing free-threaded Python." +msgstr "" + +#: ../../howto/free-threading-python.rst:38 +msgid "" +"When building CPython from source, the :option:`--disable-gil` configure " +"option should be used to build a free-threaded Python interpreter." +msgstr "" + +#: ../../howto/free-threading-python.rst:43 +msgid "Identifying free-threaded Python" +msgstr "" + +#: ../../howto/free-threading-python.rst:45 +msgid "" +"To check if the current interpreter supports free-threading, :option:`python " +"-VV <-V>` and :attr:`sys.version` contain \"experimental free-threading " +"build\". The new :func:`sys._is_gil_enabled` function can be used to check " +"whether the GIL is actually disabled in the running process." +msgstr "" + +#: ../../howto/free-threading-python.rst:50 +msgid "" +"The ``sysconfig.get_config_var(\"Py_GIL_DISABLED\")`` configuration variable " +"can be used to determine whether the build supports free threading. If the " +"variable is set to ``1``, then the build supports free threading. This is " +"the recommended mechanism for decisions related to the build configuration." +msgstr "" + +#: ../../howto/free-threading-python.rst:57 +msgid "The global interpreter lock in free-threaded Python" +msgstr "" + +#: ../../howto/free-threading-python.rst:59 +msgid "" +"Free-threaded builds of CPython support optionally running with the GIL " +"enabled at runtime using the environment variable :envvar:`PYTHON_GIL` or " +"the command-line option :option:`-X gil`." +msgstr "" + +#: ../../howto/free-threading-python.rst:63 +msgid "" +"The GIL may also automatically be enabled when importing a C-API extension " +"module that is not explicitly marked as supporting free threading. A " +"warning will be printed in this case." +msgstr "" + +#: ../../howto/free-threading-python.rst:67 +msgid "" +"In addition to individual package documentation, the following websites " +"track the status of popular packages support for free threading:" +msgstr "" + +#: ../../howto/free-threading-python.rst:70 +msgid "https://py-free-threading.github.io/tracking/" +msgstr "" + +#: ../../howto/free-threading-python.rst:71 +msgid "https://hugovk.github.io/free-threaded-wheels/" +msgstr "" + +#: ../../howto/free-threading-python.rst:75 +msgid "Thread safety" +msgstr "" + +#: ../../howto/free-threading-python.rst:77 +msgid "" +"The free-threaded build of CPython aims to provide similar thread-safety " +"behavior at the Python level to the default GIL-enabled build. Built-in " +"types like :class:`dict`, :class:`list`, and :class:`set` use internal locks " +"to protect against concurrent modifications in ways that behave similarly to " +"the GIL. However, Python has not historically guaranteed specific behavior " +"for concurrent modifications to these built-in types, so this should be " +"treated as a description of the current implementation, not a guarantee of " +"current or future behavior." +msgstr "" + +#: ../../howto/free-threading-python.rst:88 +msgid "" +"It's recommended to use the :class:`threading.Lock` or other synchronization " +"primitives instead of relying on the internal locks of built-in types, when " +"possible." +msgstr "" + +#: ../../howto/free-threading-python.rst:94 +msgid "Known limitations" +msgstr "" + +#: ../../howto/free-threading-python.rst:96 +msgid "" +"This section describes known limitations of the free-threaded CPython build." +msgstr "" + +#: ../../howto/free-threading-python.rst:99 +msgid "Immortalization" +msgstr "" + +#: ../../howto/free-threading-python.rst:101 +msgid "" +"The free-threaded build of the 3.13 release makes some objects :term:" +"`immortal`. Immortal objects are not deallocated and have reference counts " +"that are never modified. This is done to avoid reference count contention " +"that would prevent efficient multi-threaded scaling." +msgstr "" + +#: ../../howto/free-threading-python.rst:106 +msgid "" +"An object will be made immortal when a new thread is started for the first " +"time after the main thread is running. The following objects are " +"immortalized:" +msgstr "" + +#: ../../howto/free-threading-python.rst:109 +msgid "" +":ref:`function ` objects declared at the module level" +msgstr "" + +#: ../../howto/free-threading-python.rst:110 +msgid ":ref:`method ` descriptors" +msgstr "" + +#: ../../howto/free-threading-python.rst:111 +msgid ":ref:`code ` objects" +msgstr "" + +#: ../../howto/free-threading-python.rst:112 +msgid ":term:`module` objects and their dictionaries" +msgstr "" + +#: ../../howto/free-threading-python.rst:113 +msgid ":ref:`classes ` (type objects)" +msgstr "" + +#: ../../howto/free-threading-python.rst:115 +msgid "" +"Because immortal objects are never deallocated, applications that create " +"many objects of these types may see increased memory usage. This is " +"expected to be addressed in the 3.14 release." +msgstr "" + +#: ../../howto/free-threading-python.rst:119 +msgid "" +"Additionally, numeric and string literals in the code as well as strings " +"returned by :func:`sys.intern` are also immortalized. This behavior is " +"expected to remain in the 3.14 free-threaded build." +msgstr "" + +#: ../../howto/free-threading-python.rst:125 +msgid "Frame objects" +msgstr "" + +#: ../../howto/free-threading-python.rst:127 +msgid "" +"It is not safe to access :ref:`frame ` objects from other " +"threads and doing so may cause your program to crash . This means that :" +"func:`sys._current_frames` is generally not safe to use in a free-threaded " +"build. Functions like :func:`inspect.currentframe` and :func:`sys." +"_getframe` are generally safe as long as the resulting frame object is not " +"passed to another thread." +msgstr "" + +#: ../../howto/free-threading-python.rst:135 +msgid "Iterators" +msgstr "" + +#: ../../howto/free-threading-python.rst:137 +msgid "" +"Sharing the same iterator object between multiple threads is generally not " +"safe and threads may see duplicate or missing elements when iterating or " +"crash the interpreter." +msgstr "" + +#: ../../howto/free-threading-python.rst:143 +msgid "Single-threaded performance" +msgstr "" + +#: ../../howto/free-threading-python.rst:145 +msgid "" +"The free-threaded build has additional overhead when executing Python code " +"compared to the default GIL-enabled build. In 3.13, this overhead is about " +"40% on the `pyperformance `_ suite. " +"Programs that spend most of their time in C extensions or I/O will see less " +"of an impact. The largest impact is because the specializing adaptive " +"interpreter (:pep:`659`) is disabled in the free-threaded build. We expect " +"to re-enable it in a thread-safe way in the 3.14 release. This overhead is " +"expected to be reduced in upcoming Python release. We are aiming for an " +"overhead of 10% or less on the pyperformance suite compared to the default " +"GIL-enabled build." +msgstr "" diff --git a/howto/functional.po b/howto/functional.po index b615ce6e3c..f55926dec9 100644 --- a/howto/functional.po +++ b/howto/functional.po @@ -5,9 +5,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: ../../howto/functional.rst:3 +#: ../../howto/functional.rst:5 msgid "Functional Programming HOWTO" msgstr "函式編程 HOWTO" @@ -26,7 +26,7 @@ msgstr "函式編程 HOWTO" msgid "Author" msgstr "作者" -#: ../../howto/functional.rst:5 +#: ../../howto/functional.rst:7 msgid "A. M. Kuchling" msgstr "A. M. Kuchling" @@ -34,11 +34,11 @@ msgstr "A. M. Kuchling" msgid "Release" msgstr "發佈版本" -#: ../../howto/functional.rst:6 +#: ../../howto/functional.rst:8 msgid "0.32" msgstr "0.32" -#: ../../howto/functional.rst:8 +#: ../../howto/functional.rst:10 msgid "" "In this document, we'll take a tour of Python's features suitable for " "implementing programs in a functional style. After an introduction to the " @@ -47,30 +47,30 @@ msgid "" "such as :mod:`itertools` and :mod:`functools`." msgstr "" -#: ../../howto/functional.rst:16 +#: ../../howto/functional.rst:18 msgid "Introduction" msgstr "簡介" -#: ../../howto/functional.rst:18 +#: ../../howto/functional.rst:20 msgid "" "This section explains the basic concept of functional programming; if you're " "just interested in learning about Python language features, skip to the next " "section on :ref:`functional-howto-iterators`." msgstr "" -#: ../../howto/functional.rst:22 +#: ../../howto/functional.rst:24 msgid "" "Programming languages support decomposing problems in several different ways:" msgstr "" -#: ../../howto/functional.rst:24 +#: ../../howto/functional.rst:26 msgid "" "Most programming languages are **procedural**: programs are lists of " "instructions that tell the computer what to do with the program's input. C, " "Pascal, and even Unix shells are procedural languages." msgstr "" -#: ../../howto/functional.rst:28 +#: ../../howto/functional.rst:30 msgid "" "In **declarative** languages, you write a specification that describes the " "problem to be solved, and the language implementation figures out how to " @@ -80,7 +80,7 @@ msgid "" "indexes, which subclauses should be performed first, etc." msgstr "" -#: ../../howto/functional.rst:35 +#: ../../howto/functional.rst:37 msgid "" "**Object-oriented** programs manipulate collections of objects. Objects " "have internal state and support methods that query or modify this internal " @@ -89,7 +89,7 @@ msgid "" "force the use of object-oriented features." msgstr "" -#: ../../howto/functional.rst:41 +#: ../../howto/functional.rst:43 msgid "" "**Functional** programming decomposes a problem into a set of functions. " "Ideally, functions only take inputs and produce outputs, and don't have any " @@ -98,7 +98,7 @@ msgid "" "other variants) and Haskell." msgstr "" -#: ../../howto/functional.rst:47 +#: ../../howto/functional.rst:49 msgid "" "The designers of some computer languages choose to emphasize one particular " "approach to programming. This often makes it difficult to write programs " @@ -111,7 +111,7 @@ msgid "" "functional, for example." msgstr "" -#: ../../howto/functional.rst:58 +#: ../../howto/functional.rst:60 msgid "" "In a functional program, input flows through a set of functions. Each " "function operates on its input and produces some output. Functional style " @@ -122,7 +122,7 @@ msgid "" "runs; every function's output must only depend on its input." msgstr "" -#: ../../howto/functional.rst:66 +#: ../../howto/functional.rst:68 msgid "" "Some languages are very strict about purity and don't even have assignment " "statements such as ``a=3`` or ``c = a + b``, but it's difficult to avoid all " @@ -133,7 +133,7 @@ msgid "" "for a second." msgstr "" -#: ../../howto/functional.rst:73 +#: ../../howto/functional.rst:75 msgid "" "Python programs written in functional style usually won't go to the extreme " "of avoiding all I/O or all assignments; instead, they'll provide a " @@ -143,7 +143,7 @@ msgid "" "other side effects." msgstr "" -#: ../../howto/functional.rst:79 +#: ../../howto/functional.rst:81 msgid "" "Functional programming can be considered the opposite of object-oriented " "programming. Objects are little capsules containing some internal state " @@ -155,40 +155,40 @@ msgid "" "objects in your application (e-mail messages, transactions, etc.)." msgstr "" -#: ../../howto/functional.rst:88 +#: ../../howto/functional.rst:90 msgid "" "Functional design may seem like an odd constraint to work under. Why should " "you avoid objects and side effects? There are theoretical and practical " "advantages to the functional style:" msgstr "" -#: ../../howto/functional.rst:92 +#: ../../howto/functional.rst:94 msgid "Formal provability." msgstr "" -#: ../../howto/functional.rst:93 +#: ../../howto/functional.rst:95 msgid "Modularity." msgstr "" -#: ../../howto/functional.rst:94 +#: ../../howto/functional.rst:96 msgid "Composability." msgstr "" -#: ../../howto/functional.rst:95 +#: ../../howto/functional.rst:97 msgid "Ease of debugging and testing." msgstr "" -#: ../../howto/functional.rst:99 +#: ../../howto/functional.rst:101 msgid "Formal provability" msgstr "" -#: ../../howto/functional.rst:101 +#: ../../howto/functional.rst:103 msgid "" "A theoretical benefit is that it's easier to construct a mathematical proof " "that a functional program is correct." msgstr "" -#: ../../howto/functional.rst:104 +#: ../../howto/functional.rst:106 msgid "" "For a long time researchers have been interested in finding ways to " "mathematically prove programs correct. This is different from testing a " @@ -198,7 +198,7 @@ msgid "" "the right result for all possible inputs." msgstr "" -#: ../../howto/functional.rst:111 +#: ../../howto/functional.rst:113 msgid "" "The technique used to prove programs correct is to write down " "**invariants**, properties of the input data and of the program's variables " @@ -209,7 +209,7 @@ msgid "" "invariants should match the desired conditions on the program's output." msgstr "" -#: ../../howto/functional.rst:119 +#: ../../howto/functional.rst:121 msgid "" "Functional programming's avoidance of assignments arose because assignments " "are difficult to handle with this technique; assignments can break " @@ -217,7 +217,7 @@ msgid "" "invariants that can be propagated onward." msgstr "" -#: ../../howto/functional.rst:124 +#: ../../howto/functional.rst:126 msgid "" "Unfortunately, proving programs correct is largely impractical and not " "relevant to Python software. Even trivial programs require proofs that are " @@ -229,11 +229,11 @@ msgid "" "wrongly believe you've proved the program correct." msgstr "" -#: ../../howto/functional.rst:135 +#: ../../howto/functional.rst:137 msgid "Modularity" msgstr "" -#: ../../howto/functional.rst:137 +#: ../../howto/functional.rst:139 msgid "" "A more practical benefit of functional programming is that it forces you to " "break apart your problem into small pieces. Programs are more modular as a " @@ -242,15 +242,15 @@ msgid "" "Small functions are also easier to read and to check for errors." msgstr "" -#: ../../howto/functional.rst:145 +#: ../../howto/functional.rst:147 msgid "Ease of debugging and testing" msgstr "" -#: ../../howto/functional.rst:147 +#: ../../howto/functional.rst:149 msgid "Testing and debugging a functional-style program is easier." msgstr "" -#: ../../howto/functional.rst:149 +#: ../../howto/functional.rst:151 msgid "" "Debugging is simplified because functions are generally small and clearly " "specified. When a program doesn't work, each function is an interface point " @@ -259,7 +259,7 @@ msgid "" "responsible for a bug." msgstr "" -#: ../../howto/functional.rst:154 +#: ../../howto/functional.rst:156 msgid "" "Testing is easier because each function is a potential subject for a unit " "test. Functions don't depend on system state that needs to be replicated " @@ -267,11 +267,11 @@ msgid "" "and then check that the output matches expectations." msgstr "" -#: ../../howto/functional.rst:161 +#: ../../howto/functional.rst:163 msgid "Composability" msgstr "" -#: ../../howto/functional.rst:163 +#: ../../howto/functional.rst:165 msgid "" "As you work on a functional-style program, you'll write a number of " "functions with varying inputs and outputs. Some of these functions will be " @@ -282,24 +282,24 @@ msgid "" "different situations." msgstr "" -#: ../../howto/functional.rst:170 +#: ../../howto/functional.rst:172 msgid "" "Over time you'll form a personal library of utilities. Often you'll " "assemble new programs by arranging existing functions in a new configuration " "and writing a few functions specialized for the current task." msgstr "" -#: ../../howto/functional.rst:178 +#: ../../howto/functional.rst:180 msgid "Iterators" msgstr "" -#: ../../howto/functional.rst:180 +#: ../../howto/functional.rst:182 msgid "" "I'll start by looking at a Python language feature that's an important " "foundation for writing functional-style programs: iterators." msgstr "" -#: ../../howto/functional.rst:183 +#: ../../howto/functional.rst:185 msgid "" "An iterator is an object representing a stream of data; this object returns " "the data one element at a time. A Python iterator must support a method " @@ -310,7 +310,7 @@ msgid "" "reasonable to write an iterator that produces an infinite stream of data." msgstr "" -#: ../../howto/functional.rst:191 +#: ../../howto/functional.rst:193 msgid "" "The built-in :func:`iter` function takes an arbitrary object and tries to " "return an iterator that will return the object's contents or elements, " @@ -320,11 +320,11 @@ msgid "" "an iterator for it." msgstr "" -#: ../../howto/functional.rst:198 +#: ../../howto/functional.rst:200 msgid "You can experiment with the iteration interface manually:" msgstr "" -#: ../../howto/functional.rst:216 +#: ../../howto/functional.rst:218 msgid "" "Python expects iterable objects in several different contexts, the most " "important being the :keyword:`for` statement. In the statement ``for X in " @@ -332,7 +332,7 @@ msgid "" "an iterator. These two statements are equivalent::" msgstr "" -#: ../../howto/functional.rst:222 +#: ../../howto/functional.rst:224 msgid "" "for i in iter(obj):\n" " print(i)\n" @@ -346,19 +346,19 @@ msgstr "" "for i in obj:\n" " print(i)" -#: ../../howto/functional.rst:228 +#: ../../howto/functional.rst:230 msgid "" "Iterators can be materialized as lists or tuples by using the :func:`list` " "or :func:`tuple` constructor functions:" msgstr "" -#: ../../howto/functional.rst:237 +#: ../../howto/functional.rst:239 msgid "" "Sequence unpacking also supports iterators: if you know an iterator will " "return N elements, you can unpack them into an N-tuple:" msgstr "" -#: ../../howto/functional.rst:246 +#: ../../howto/functional.rst:248 msgid "" "Built-in functions such as :func:`max` and :func:`min` can take a single " "iterator argument and will return the largest or smallest element. The " @@ -369,7 +369,7 @@ msgid "" "stream, the ``\"in\"`` and ``\"not in\"`` operators won't return either." msgstr "" -#: ../../howto/functional.rst:254 +#: ../../howto/functional.rst:256 msgid "" "Note that you can only go forward in an iterator; there's no way to get the " "previous element, reset the iterator, or make a copy of it. Iterator " @@ -380,24 +380,24 @@ msgid "" "new iterator." msgstr "" -#: ../../howto/functional.rst:264 +#: ../../howto/functional.rst:266 msgid "Data Types That Support Iterators" msgstr "" -#: ../../howto/functional.rst:266 +#: ../../howto/functional.rst:268 msgid "" "We've already seen how lists and tuples support iterators. In fact, any " "Python sequence type, such as strings, will automatically support creation " "of an iterator." msgstr "" -#: ../../howto/functional.rst:270 +#: ../../howto/functional.rst:272 msgid "" "Calling :func:`iter` on a dictionary returns an iterator that will loop over " "the dictionary's keys::" msgstr "" -#: ../../howto/functional.rst:273 +#: ../../howto/functional.rst:275 msgid "" ">>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,\n" "... 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}\n" @@ -433,14 +433,14 @@ msgstr "" "Nov 11\n" "Dec 12" -#: ../../howto/functional.rst:290 +#: ../../howto/functional.rst:292 msgid "" "Note that starting with Python 3.7, dictionary iteration order is guaranteed " "to be the same as the insertion order. In earlier versions, the behaviour " "was unspecified and could vary between implementations." msgstr "" -#: ../../howto/functional.rst:294 +#: ../../howto/functional.rst:296 msgid "" "Applying :func:`iter` to a dictionary always loops over the keys, but " "dictionaries have methods that return other iterators. If you want to " @@ -448,33 +448,33 @@ msgid "" "`~dict.values` or :meth:`~dict.items` methods to get an appropriate iterator." msgstr "" -#: ../../howto/functional.rst:300 +#: ../../howto/functional.rst:302 msgid "" "The :func:`dict` constructor can accept an iterator that returns a finite " "stream of ``(key, value)`` tuples:" msgstr "" -#: ../../howto/functional.rst:307 +#: ../../howto/functional.rst:309 msgid "" "Files also support iteration by calling the :meth:`~io.TextIOBase.readline` " "method until there are no more lines in the file. This means you can read " "each line of a file like this::" msgstr "" -#: ../../howto/functional.rst:311 +#: ../../howto/functional.rst:313 msgid "" "for line in file:\n" " # do something for each line\n" " ..." msgstr "" -#: ../../howto/functional.rst:315 +#: ../../howto/functional.rst:317 msgid "" "Sets can take their contents from an iterable and let you iterate over the " "set's elements::" msgstr "" -#: ../../howto/functional.rst:318 +#: ../../howto/functional.rst:320 msgid "" ">>> S = {2, 3, 5, 7, 11, 13}\n" ">>> for i in S:\n" @@ -496,11 +496,11 @@ msgstr "" "11\n" "13" -#: ../../howto/functional.rst:331 +#: ../../howto/functional.rst:333 msgid "Generator expressions and list comprehensions" msgstr "" -#: ../../howto/functional.rst:333 +#: ../../howto/functional.rst:335 msgid "" "Two common operations on an iterator's output are 1) performing some " "operation for every element, 2) selecting a subset of elements that meet " @@ -509,7 +509,7 @@ msgid "" "containing a given substring." msgstr "" -#: ../../howto/functional.rst:339 +#: ../../howto/functional.rst:341 msgid "" "List comprehensions and generator expressions (short form: \"listcomps\" and " "\"genexps\") are a concise notation for such operations, borrowed from the " @@ -517,7 +517,7 @@ msgid "" "strip all the whitespace from a stream of strings with the following code::" msgstr "" -#: ../../howto/functional.rst:344 +#: ../../howto/functional.rst:346 msgid "" ">>> line_list = [' line 1\\n', 'line 2 \\n', ' \\n', '']\n" "\n" @@ -528,12 +528,12 @@ msgid "" ">>> stripped_list = [line.strip() for line in line_list]" msgstr "" -#: ../../howto/functional.rst:352 +#: ../../howto/functional.rst:354 msgid "" "You can select only certain elements by adding an ``\"if\"`` condition::" msgstr "" -#: ../../howto/functional.rst:354 +#: ../../howto/functional.rst:356 msgid "" ">>> stripped_list = [line.strip() for line in line_list\n" "... if line != \"\"]" @@ -541,7 +541,7 @@ msgstr "" ">>> stripped_list = [line.strip() for line in line_list\n" "... if line != \"\"]" -#: ../../howto/functional.rst:357 +#: ../../howto/functional.rst:359 msgid "" "With a list comprehension, you get back a Python list; ``stripped_list`` is " "a list containing the resulting lines, not an iterator. Generator " @@ -552,14 +552,14 @@ msgid "" "preferable in these situations." msgstr "" -#: ../../howto/functional.rst:364 +#: ../../howto/functional.rst:366 msgid "" "Generator expressions are surrounded by parentheses (\"()\") and list " "comprehensions are surrounded by square brackets (\"[]\"). Generator " "expressions have the form::" msgstr "" -#: ../../howto/functional.rst:368 +#: ../../howto/functional.rst:370 msgid "" "( expression for expr in sequence1\n" " if condition1\n" @@ -581,13 +581,13 @@ msgstr "" " for exprN in sequenceN\n" " if conditionN )" -#: ../../howto/functional.rst:378 +#: ../../howto/functional.rst:380 msgid "" "Again, for a list comprehension only the outside brackets are different " "(square brackets instead of parentheses)." msgstr "" -#: ../../howto/functional.rst:381 +#: ../../howto/functional.rst:383 msgid "" "The elements of the generated output will be the successive values of " "``expression``. The ``if`` clauses are all optional; if present, " @@ -595,18 +595,18 @@ msgid "" "is true." msgstr "" -#: ../../howto/functional.rst:385 +#: ../../howto/functional.rst:387 msgid "" "Generator expressions always have to be written inside parentheses, but the " "parentheses signalling a function call also count. If you want to create an " "iterator that will be immediately passed to a function you can write::" msgstr "" -#: ../../howto/functional.rst:389 +#: ../../howto/functional.rst:391 msgid "obj_total = sum(obj.count for obj in list_all_objects())" msgstr "obj_total = sum(obj.count for obj in list_all_objects())" -#: ../../howto/functional.rst:391 +#: ../../howto/functional.rst:393 msgid "" "The ``for...in`` clauses contain the sequences to be iterated over. The " "sequences do not have to be the same length, because they are iterated over " @@ -616,13 +616,13 @@ msgid "" "``sequence2``." msgstr "" -#: ../../howto/functional.rst:397 +#: ../../howto/functional.rst:399 msgid "" "To put it another way, a list comprehension or generator expression is " "equivalent to the following Python code::" msgstr "" -#: ../../howto/functional.rst:400 +#: ../../howto/functional.rst:402 msgid "" "for expr1 in sequence1:\n" " if not (condition1):\n" @@ -639,7 +639,7 @@ msgid "" " # the expression." msgstr "" -#: ../../howto/functional.rst:414 +#: ../../howto/functional.rst:416 msgid "" "This means that when there are multiple ``for...in`` clauses but no ``if`` " "clauses, the length of the resulting output will be equal to the product of " @@ -647,14 +647,14 @@ msgid "" "output list is 9 elements long:" msgstr "" -#: ../../howto/functional.rst:426 +#: ../../howto/functional.rst:428 msgid "" "To avoid introducing an ambiguity into Python's grammar, if ``expression`` " "is creating a tuple, it must be surrounded with parentheses. The first list " "comprehension below is a syntax error, while the second one is correct::" msgstr "" -#: ../../howto/functional.rst:430 +#: ../../howto/functional.rst:432 msgid "" "# Syntax error\n" "[x, y for x in seq1 for y in seq2]\n" @@ -666,18 +666,18 @@ msgstr "" "# 正確\n" "[(x, y) for x in seq1 for y in seq2]" -#: ../../howto/functional.rst:437 +#: ../../howto/functional.rst:439 msgid "Generators" msgstr "" -#: ../../howto/functional.rst:439 +#: ../../howto/functional.rst:441 msgid "" "Generators are a special class of functions that simplify the task of " "writing iterators. Regular functions compute a value and return it, but " "generators return an iterator that returns a stream of values." msgstr "" -#: ../../howto/functional.rst:443 +#: ../../howto/functional.rst:445 msgid "" "You're doubtless familiar with how regular function calls work in Python or " "C. When you call a function, it gets a private namespace where its local " @@ -690,18 +690,18 @@ msgid "" "thought of as resumable functions." msgstr "" -#: ../../howto/functional.rst:452 +#: ../../howto/functional.rst:454 msgid "Here's the simplest example of a generator function:" msgstr "" -#: ../../howto/functional.rst:458 +#: ../../howto/functional.rst:460 msgid "" "Any function containing a :keyword:`yield` keyword is a generator function; " "this is detected by Python's :term:`bytecode` compiler which compiles the " "function specially as a result." msgstr "" -#: ../../howto/functional.rst:462 +#: ../../howto/functional.rst:464 msgid "" "When you call a generator function, it doesn't return a single value; " "instead it returns a generator object that supports the iterator protocol. " @@ -713,17 +713,17 @@ msgid "" "method, the function will resume executing." msgstr "" -#: ../../howto/functional.rst:471 +#: ../../howto/functional.rst:473 msgid "Here's a sample usage of the ``generate_ints()`` generator:" msgstr "" -#: ../../howto/functional.rst:488 +#: ../../howto/functional.rst:490 msgid "" "You could equally write ``for i in generate_ints(5)``, or ``a, b, c = " "generate_ints(3)``." msgstr "" -#: ../../howto/functional.rst:491 +#: ../../howto/functional.rst:493 msgid "" "Inside a generator function, ``return value`` causes " "``StopIteration(value)`` to be raised from the :meth:`~generator.__next__` " @@ -731,7 +731,7 @@ msgid "" "procession of values ends and the generator cannot yield any further values." msgstr "" -#: ../../howto/functional.rst:496 +#: ../../howto/functional.rst:498 msgid "" "You could achieve the effect of generators manually by writing your own " "class and storing all the local variables of the generator as instance " @@ -741,7 +741,7 @@ msgid "" "complicated generator, writing a corresponding class can be much messier." msgstr "" -#: ../../howto/functional.rst:504 +#: ../../howto/functional.rst:506 msgid "" "The test suite included with Python's library, :source:`Lib/test/" "test_generators.py`, contains a number of more interesting examples. Here's " @@ -749,7 +749,7 @@ msgid "" "generators recursively. ::" msgstr "" -#: ../../howto/functional.rst:509 +#: ../../howto/functional.rst:511 msgid "" "# A recursive generator that generates Tree leaves in in-order.\n" "def inorder(t):\n" @@ -763,7 +763,7 @@ msgid "" " yield x" msgstr "" -#: ../../howto/functional.rst:520 +#: ../../howto/functional.rst:522 msgid "" "Two other examples in ``test_generators.py`` produce solutions for the N-" "Queens problem (placing N queens on an NxN chess board so that no queen " @@ -772,11 +772,11 @@ msgid "" "twice)." msgstr "" -#: ../../howto/functional.rst:528 +#: ../../howto/functional.rst:530 msgid "Passing values into a generator" msgstr "" -#: ../../howto/functional.rst:530 +#: ../../howto/functional.rst:532 msgid "" "In Python 2.4 and earlier, generators only produced output. Once a " "generator's code was invoked to create an iterator, there was no way to pass " @@ -786,18 +786,18 @@ msgid "" "these approaches are messy." msgstr "" -#: ../../howto/functional.rst:537 +#: ../../howto/functional.rst:539 msgid "" "In Python 2.5 there's a simple way to pass values into a generator. :keyword:" "`yield` became an expression, returning a value that can be assigned to a " "variable or otherwise operated on::" msgstr "" -#: ../../howto/functional.rst:541 +#: ../../howto/functional.rst:543 msgid "val = (yield i)" msgstr "val = (yield i)" -#: ../../howto/functional.rst:543 +#: ../../howto/functional.rst:545 msgid "" "I recommend that you **always** put parentheses around a ``yield`` " "expression when you're doing something with the returned value, as in the " @@ -805,7 +805,7 @@ msgid "" "always add them instead of having to remember when they're needed." msgstr "" -#: ../../howto/functional.rst:548 +#: ../../howto/functional.rst:550 msgid "" "(:pep:`342` explains the exact rules, which are that a ``yield``-expression " "must always be parenthesized except when it occurs at the top-level " @@ -814,7 +814,7 @@ msgid "" "operation, as in ``val = (yield i) + 12``.)" msgstr "" -#: ../../howto/functional.rst:554 +#: ../../howto/functional.rst:556 msgid "" "Values are sent into a generator by calling its :meth:`send(value) " "` method. This method resumes the generator's code and the " @@ -822,13 +822,13 @@ msgid "" "`~generator.__next__` method is called, the ``yield`` returns ``None``." msgstr "" -#: ../../howto/functional.rst:559 +#: ../../howto/functional.rst:561 msgid "" "Here's a simple counter that increments by 1 and allows changing the value " "of the internal counter." msgstr "" -#: ../../howto/functional.rst:562 +#: ../../howto/functional.rst:564 msgid "" "def counter(maximum):\n" " i = 0\n" @@ -841,11 +841,11 @@ msgid "" " i += 1" msgstr "" -#: ../../howto/functional.rst:574 +#: ../../howto/functional.rst:576 msgid "And here's an example of changing the counter:" msgstr "" -#: ../../howto/functional.rst:591 +#: ../../howto/functional.rst:593 msgid "" "Because ``yield`` will often be returning ``None``, you should always check " "for this case. Don't just use its value in expressions unless you're sure " @@ -853,20 +853,20 @@ msgid "" "resume your generator function." msgstr "" -#: ../../howto/functional.rst:596 +#: ../../howto/functional.rst:598 msgid "" "In addition to :meth:`~generator.send`, there are two other methods on " "generators:" msgstr "" -#: ../../howto/functional.rst:599 +#: ../../howto/functional.rst:601 msgid "" ":meth:`throw(value) ` is used to raise an exception inside " "the generator; the exception is raised by the ``yield`` expression where the " "generator's execution is paused." msgstr "" -#: ../../howto/functional.rst:603 +#: ../../howto/functional.rst:605 msgid "" ":meth:`~generator.close` raises a :exc:`GeneratorExit` exception inside the " "generator to terminate the iteration. On receiving this exception, the " @@ -877,20 +877,20 @@ msgid "" "collected." msgstr "" -#: ../../howto/functional.rst:611 +#: ../../howto/functional.rst:613 msgid "" "If you need to run cleanup code when a :exc:`GeneratorExit` occurs, I " "suggest using a ``try: ... finally:`` suite instead of catching :exc:" "`GeneratorExit`." msgstr "" -#: ../../howto/functional.rst:614 +#: ../../howto/functional.rst:616 msgid "" "The cumulative effect of these changes is to turn generators from one-way " "producers of information into both producers and consumers." msgstr "" -#: ../../howto/functional.rst:617 +#: ../../howto/functional.rst:619 msgid "" "Generators also become **coroutines**, a more generalized form of " "subroutines. Subroutines are entered at one point and exited at another " @@ -899,36 +899,36 @@ msgid "" "statements)." msgstr "" -#: ../../howto/functional.rst:624 +#: ../../howto/functional.rst:626 msgid "Built-in functions" msgstr "內建函式" -#: ../../howto/functional.rst:626 +#: ../../howto/functional.rst:628 msgid "" "Let's look in more detail at built-in functions often used with iterators." msgstr "" -#: ../../howto/functional.rst:628 +#: ../../howto/functional.rst:630 msgid "" "Two of Python's built-in functions, :func:`map` and :func:`filter` duplicate " "the features of generator expressions:" msgstr "" -#: ../../howto/functional.rst:631 +#: ../../howto/functional.rst:633 msgid "" ":func:`map(f, iterA, iterB, ...) ` returns an iterator over the sequence" msgstr "" -#: ../../howto/functional.rst:632 +#: ../../howto/functional.rst:634 msgid "" "``f(iterA[0], iterB[0]), f(iterA[1], iterB[1]), f(iterA[2], iterB[2]), ...``." msgstr "" -#: ../../howto/functional.rst:642 +#: ../../howto/functional.rst:644 msgid "You can of course achieve the same effect with a list comprehension." msgstr "" -#: ../../howto/functional.rst:644 +#: ../../howto/functional.rst:646 msgid "" ":func:`filter(predicate, iter) ` returns an iterator over all the " "sequence elements that meet a certain condition, and is similarly duplicated " @@ -937,18 +937,18 @@ msgid "" "must take a single value." msgstr "" -#: ../../howto/functional.rst:657 +#: ../../howto/functional.rst:659 msgid "This can also be written as a list comprehension:" msgstr "" -#: ../../howto/functional.rst:663 +#: ../../howto/functional.rst:665 msgid "" ":func:`enumerate(iter, start=0) ` counts off the elements in the " "iterable returning 2-tuples containing the count (from *start*) and each " "element. ::" msgstr "" -#: ../../howto/functional.rst:667 +#: ../../howto/functional.rst:669 msgid "" ">>> for item in enumerate(['subject', 'verb', 'object']):\n" "... print(item)\n" @@ -962,13 +962,13 @@ msgstr "" "(1, 'verb')\n" "(2, 'object')" -#: ../../howto/functional.rst:673 +#: ../../howto/functional.rst:675 msgid "" ":func:`enumerate` is often used when looping through a list and recording " "the indexes at which certain conditions are met::" msgstr "" -#: ../../howto/functional.rst:676 +#: ../../howto/functional.rst:678 msgid "" "f = open('data.txt', 'r')\n" "for i, line in enumerate(f):\n" @@ -980,7 +980,7 @@ msgstr "" " if line.strip() == '':\n" " print('Blank line at line #%i' % i)" -#: ../../howto/functional.rst:681 +#: ../../howto/functional.rst:683 msgid "" ":func:`sorted(iterable, key=None, reverse=False) ` collects all the " "elements of the iterable into a list, sorts the list, and returns the sorted " @@ -988,7 +988,7 @@ msgid "" "constructed list's :meth:`~list.sort` method. ::" msgstr "" -#: ../../howto/functional.rst:686 +#: ../../howto/functional.rst:688 msgid "" ">>> import random\n" ">>> # Generate 8 random numbers between [0, 10000)\n" @@ -1001,12 +1001,12 @@ msgid "" "[9878, 9828, 8442, 7953, 6431, 6213, 2207, 769]" msgstr "" -#: ../../howto/functional.rst:696 +#: ../../howto/functional.rst:698 msgid "" "(For a more detailed discussion of sorting, see the :ref:`sortinghowto`.)" msgstr "" -#: ../../howto/functional.rst:699 +#: ../../howto/functional.rst:701 msgid "" "The :func:`any(iter) ` and :func:`all(iter) ` built-ins look at " "the truth values of an iterable's contents. :func:`any` returns ``True`` if " @@ -1014,13 +1014,13 @@ msgid "" "``True`` if all of the elements are true values:" msgstr "" -#: ../../howto/functional.rst:718 +#: ../../howto/functional.rst:720 msgid "" ":func:`zip(iterA, iterB, ...) ` takes one element from each iterable " "and returns them in a tuple::" msgstr "" -#: ../../howto/functional.rst:721 +#: ../../howto/functional.rst:723 msgid "" "zip(['a', 'b', 'c'], (1, 2, 3)) =>\n" " ('a', 1), ('b', 2), ('c', 3)" @@ -1028,7 +1028,7 @@ msgstr "" "zip(['a', 'b', 'c'], (1, 2, 3)) =>\n" " ('a', 1), ('b', 2), ('c', 3)" -#: ../../howto/functional.rst:724 +#: ../../howto/functional.rst:726 msgid "" "It doesn't construct an in-memory list and exhaust all the input iterators " "before returning; instead tuples are constructed and returned only if " @@ -1036,14 +1036,14 @@ msgid "" "evaluation `__.)" msgstr "" -#: ../../howto/functional.rst:729 +#: ../../howto/functional.rst:731 msgid "" "This iterator is intended to be used with iterables that are all of the same " "length. If the iterables are of different lengths, the resulting stream " "will be the same length as the shortest iterable. ::" msgstr "" -#: ../../howto/functional.rst:733 +#: ../../howto/functional.rst:735 msgid "" "zip(['a', 'b'], (1, 2, 3)) =>\n" " ('a', 1), ('b', 2)" @@ -1051,49 +1051,49 @@ msgstr "" "zip(['a', 'b'], (1, 2, 3)) =>\n" " ('a', 1), ('b', 2)" -#: ../../howto/functional.rst:736 +#: ../../howto/functional.rst:738 msgid "" "You should avoid doing this, though, because an element may be taken from " "the longer iterators and discarded. This means you can't go on to use the " "iterators further because you risk skipping a discarded element." msgstr "" -#: ../../howto/functional.rst:742 +#: ../../howto/functional.rst:744 msgid "The itertools module" msgstr "itertools 模組" -#: ../../howto/functional.rst:744 +#: ../../howto/functional.rst:746 msgid "" "The :mod:`itertools` module contains a number of commonly used iterators as " "well as functions for combining several iterators. This section will " "introduce the module's contents by showing small examples." msgstr "" -#: ../../howto/functional.rst:748 +#: ../../howto/functional.rst:750 msgid "The module's functions fall into a few broad classes:" msgstr "" -#: ../../howto/functional.rst:750 +#: ../../howto/functional.rst:752 msgid "Functions that create a new iterator based on an existing iterator." msgstr "" -#: ../../howto/functional.rst:751 +#: ../../howto/functional.rst:753 msgid "Functions for treating an iterator's elements as function arguments." msgstr "" -#: ../../howto/functional.rst:752 +#: ../../howto/functional.rst:754 msgid "Functions for selecting portions of an iterator's output." msgstr "" -#: ../../howto/functional.rst:753 +#: ../../howto/functional.rst:755 msgid "A function for grouping an iterator's output." msgstr "" -#: ../../howto/functional.rst:756 +#: ../../howto/functional.rst:758 msgid "Creating new iterators" msgstr "建立新的疊代器" -#: ../../howto/functional.rst:758 +#: ../../howto/functional.rst:760 msgid "" ":func:`itertools.count(start, step) ` returns an infinite " "stream of evenly spaced values. You can optionally supply the starting " @@ -1101,7 +1101,7 @@ msgid "" "defaults to 1::" msgstr "" -#: ../../howto/functional.rst:762 +#: ../../howto/functional.rst:764 msgid "" "itertools.count() =>\n" " 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...\n" @@ -1117,7 +1117,7 @@ msgstr "" "itertools.count(10, 5) =>\n" " 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, ..." -#: ../../howto/functional.rst:769 +#: ../../howto/functional.rst:771 msgid "" ":func:`itertools.cycle(iter) ` saves a copy of the contents " "of a provided iterable and returns a new iterator that returns its elements " @@ -1125,7 +1125,7 @@ msgid "" "infinitely. ::" msgstr "" -#: ../../howto/functional.rst:773 +#: ../../howto/functional.rst:775 msgid "" "itertools.cycle([1, 2, 3, 4, 5]) =>\n" " 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ..." @@ -1133,14 +1133,14 @@ msgstr "" "itertools.cycle([1, 2, 3, 4, 5]) =>\n" " 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ..." -#: ../../howto/functional.rst:776 +#: ../../howto/functional.rst:778 msgid "" ":func:`itertools.repeat(elem, [n]) ` returns the provided " "element *n* times, or returns the element endlessly if *n* is not " "provided. ::" msgstr "" -#: ../../howto/functional.rst:779 +#: ../../howto/functional.rst:781 msgid "" "itertools.repeat('abc') =>\n" " abc, abc, abc, abc, abc, abc, abc, abc, abc, abc, ...\n" @@ -1152,7 +1152,7 @@ msgstr "" "itertools.repeat('abc', 5) =>\n" " abc, abc, abc, abc, abc" -#: ../../howto/functional.rst:784 +#: ../../howto/functional.rst:786 msgid "" ":func:`itertools.chain(iterA, iterB, ...) ` takes an " "arbitrary number of iterables as input, and returns all the elements of the " @@ -1160,7 +1160,7 @@ msgid "" "the iterables have been exhausted. ::" msgstr "" -#: ../../howto/functional.rst:789 +#: ../../howto/functional.rst:791 msgid "" "itertools.chain(['a', 'b', 'c'], (1, 2, 3)) =>\n" " a, b, c, 1, 2, 3" @@ -1168,7 +1168,7 @@ msgstr "" "itertools.chain(['a', 'b', 'c'], (1, 2, 3)) =>\n" " a, b, c, 1, 2, 3" -#: ../../howto/functional.rst:792 +#: ../../howto/functional.rst:794 msgid "" ":func:`itertools.islice(iter, [start], stop, [step]) ` " "returns a stream that's a slice of the iterator. With a single *stop* " @@ -1179,7 +1179,7 @@ msgid "" "*step*. ::" msgstr "" -#: ../../howto/functional.rst:799 +#: ../../howto/functional.rst:801 msgid "" "itertools.islice(range(10), 8) =>\n" " 0, 1, 2, 3, 4, 5, 6, 7\n" @@ -1195,7 +1195,7 @@ msgstr "" "itertools.islice(range(10), 2, 8, 2) =>\n" " 2, 4, 6" -#: ../../howto/functional.rst:806 +#: ../../howto/functional.rst:808 msgid "" ":func:`itertools.tee(iter, [n]) ` replicates an iterator; it " "returns *n* independent iterators that will all return the contents of the " @@ -1205,7 +1205,7 @@ msgid "" "and one of the new iterators is consumed more than the others. ::" msgstr "" -#: ../../howto/functional.rst:814 +#: ../../howto/functional.rst:816 msgid "" "itertools.tee( itertools.count() ) =>\n" " iterA, iterB\n" @@ -1225,11 +1225,11 @@ msgstr "" "and iterB ->\n" " 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ..." -#: ../../howto/functional.rst:825 +#: ../../howto/functional.rst:827 msgid "Calling functions on elements" msgstr "" -#: ../../howto/functional.rst:827 +#: ../../howto/functional.rst:829 msgid "" "The :mod:`operator` module contains a set of functions corresponding to " "Python's operators. Some examples are :func:`operator.add(a, b) ` assumes that the " "iterable will return a stream of tuples, and calls *func* using these tuples " "as the arguments::" msgstr "" -#: ../../howto/functional.rst:837 +#: ../../howto/functional.rst:839 msgid "" "itertools.starmap(os.path.join,\n" " [('/bin', 'python'), ('/usr', 'bin', 'java'),\n" @@ -1259,24 +1259,24 @@ msgstr "" "=>\n" " /bin/python, /usr/bin/java, /usr/bin/perl, /usr/bin/ruby" -#: ../../howto/functional.rst:845 +#: ../../howto/functional.rst:847 msgid "Selecting elements" msgstr "" -#: ../../howto/functional.rst:847 +#: ../../howto/functional.rst:849 msgid "" "Another group of functions chooses a subset of an iterator's elements based " "on a predicate." msgstr "" -#: ../../howto/functional.rst:850 +#: ../../howto/functional.rst:852 msgid "" ":func:`itertools.filterfalse(predicate, iter) ` is " "the opposite of :func:`filter`, returning all elements for which the " "predicate returns false::" msgstr "" -#: ../../howto/functional.rst:854 +#: ../../howto/functional.rst:856 msgid "" "itertools.filterfalse(is_even, itertools.count()) =>\n" " 1, 3, 5, 7, 9, 11, 13, 15, ..." @@ -1284,14 +1284,14 @@ msgstr "" "itertools.filterfalse(is_even, itertools.count()) =>\n" " 1, 3, 5, 7, 9, 11, 13, 15, ..." -#: ../../howto/functional.rst:857 +#: ../../howto/functional.rst:859 msgid "" ":func:`itertools.takewhile(predicate, iter) ` returns " "elements for as long as the predicate returns true. Once the predicate " "returns false, the iterator will signal the end of its results. ::" msgstr "" -#: ../../howto/functional.rst:861 +#: ../../howto/functional.rst:863 msgid "" "def less_than_10(x):\n" " return x < 10\n" @@ -1311,14 +1311,14 @@ msgstr "" "itertools.takewhile(is_even, itertools.count()) =>\n" " 0" -#: ../../howto/functional.rst:870 +#: ../../howto/functional.rst:872 msgid "" ":func:`itertools.dropwhile(predicate, iter) ` discards " "elements while the predicate returns true, and then returns the rest of the " "iterable's results. ::" msgstr "" -#: ../../howto/functional.rst:874 +#: ../../howto/functional.rst:876 msgid "" "itertools.dropwhile(less_than_10, itertools.count()) =>\n" " 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...\n" @@ -1332,7 +1332,7 @@ msgstr "" "itertools.dropwhile(is_even, itertools.count()) =>\n" " 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ..." -#: ../../howto/functional.rst:880 +#: ../../howto/functional.rst:882 msgid "" ":func:`itertools.compress(data, selectors) ` takes two " "iterators and returns only those elements of *data* for which the " @@ -1340,7 +1340,7 @@ msgid "" "is exhausted::" msgstr "" -#: ../../howto/functional.rst:884 +#: ../../howto/functional.rst:886 msgid "" "itertools.compress([1, 2, 3, 4, 5], [True, True, False, False, True]) =>\n" " 1, 2, 5" @@ -1348,18 +1348,18 @@ msgstr "" "itertools.compress([1, 2, 3, 4, 5], [True, True, False, False, True]) =>\n" " 1, 2, 5" -#: ../../howto/functional.rst:889 +#: ../../howto/functional.rst:891 msgid "Combinatoric functions" msgstr "" -#: ../../howto/functional.rst:891 +#: ../../howto/functional.rst:893 msgid "" "The :func:`itertools.combinations(iterable, r) ` " "returns an iterator giving all possible *r*-tuple combinations of the " "elements contained in *iterable*. ::" msgstr "" -#: ../../howto/functional.rst:895 +#: ../../howto/functional.rst:897 msgid "" "itertools.combinations([1, 2, 3, 4, 5], 2) =>\n" " (1, 2), (1, 3), (1, 4), (1, 5),\n" @@ -1383,7 +1383,7 @@ msgstr "" " (2, 3, 4), (2, 3, 5), (2, 4, 5),\n" " (3, 4, 5)" -#: ../../howto/functional.rst:906 +#: ../../howto/functional.rst:908 msgid "" "The elements within each tuple remain in the same order as *iterable* " "returned them. For example, the number 1 is always before 2, 3, 4, or 5 in " @@ -1392,7 +1392,7 @@ msgid "" "constraint on the order, returning all possible arrangements of length *r*::" msgstr "" -#: ../../howto/functional.rst:913 +#: ../../howto/functional.rst:915 msgid "" "itertools.permutations([1, 2, 3, 4, 5], 2) =>\n" " (1, 2), (1, 3), (1, 4), (1, 5),\n" @@ -1418,19 +1418,19 @@ msgstr "" " ...\n" " (5, 4, 3, 2, 1)" -#: ../../howto/functional.rst:925 +#: ../../howto/functional.rst:927 msgid "" "If you don't supply a value for *r* the length of the iterable is used, " "meaning that all the elements are permuted." msgstr "" -#: ../../howto/functional.rst:928 +#: ../../howto/functional.rst:930 msgid "" "Note that these functions produce all of the possible combinations by " "position and don't require that the contents of *iterable* are unique::" msgstr "" -#: ../../howto/functional.rst:931 +#: ../../howto/functional.rst:933 msgid "" "itertools.permutations('aba', 3) =>\n" " ('a', 'b', 'a'), ('a', 'a', 'b'), ('b', 'a', 'a'),\n" @@ -1440,13 +1440,13 @@ msgstr "" " ('a', 'b', 'a'), ('a', 'a', 'b'), ('b', 'a', 'a'),\n" " ('b', 'a', 'a'), ('a', 'a', 'b'), ('a', 'b', 'a')" -#: ../../howto/functional.rst:935 +#: ../../howto/functional.rst:937 msgid "" "The identical tuple ``('a', 'a', 'b')`` occurs twice, but the two 'a' " "strings came from different positions." msgstr "" -#: ../../howto/functional.rst:938 +#: ../../howto/functional.rst:940 msgid "" "The :func:`itertools.combinations_with_replacement(iterable, r) ` function relaxes a different constraint: " @@ -1455,7 +1455,7 @@ msgid "" "the second element is selected. ::" msgstr "" -#: ../../howto/functional.rst:944 +#: ../../howto/functional.rst:946 msgid "" "itertools.combinations_with_replacement([1, 2, 3, 4, 5], 2) =>\n" " (1, 1), (1, 2), (1, 3), (1, 4), (1, 5),\n" @@ -1471,11 +1471,11 @@ msgstr "" " (4, 4), (4, 5),\n" " (5, 5)" -#: ../../howto/functional.rst:953 +#: ../../howto/functional.rst:955 msgid "Grouping elements" msgstr "" -#: ../../howto/functional.rst:955 +#: ../../howto/functional.rst:957 msgid "" "The last function I'll discuss, :func:`itertools.groupby(iter, " "key_func=None) `, is the most complicated. " @@ -1484,14 +1484,14 @@ msgid "" "key is simply each element itself." msgstr "" -#: ../../howto/functional.rst:960 +#: ../../howto/functional.rst:962 msgid "" ":func:`~itertools.groupby` collects all the consecutive elements from the " "underlying iterable that have the same key value, and returns a stream of 2-" "tuples containing a key value and an iterator for the elements with that key." msgstr "" -#: ../../howto/functional.rst:966 +#: ../../howto/functional.rst:968 msgid "" "city_list = [('Decatur', 'AL'), ('Huntsville', 'AL'), ('Selma', 'AL'),\n" " ('Anchorage', 'AK'), ('Nome', 'AK'),\n" @@ -1537,7 +1537,7 @@ msgstr "" "iterator-3 =>\n" " ('Flagstaff', 'AZ'), ('Phoenix', 'AZ'), ('Tucson', 'AZ')" -#: ../../howto/functional.rst:988 +#: ../../howto/functional.rst:990 msgid "" ":func:`~itertools.groupby` assumes that the underlying iterable's contents " "will already be sorted based on the key. Note that the returned iterators " @@ -1545,11 +1545,11 @@ msgid "" "iterator-1 before requesting iterator-2 and its corresponding key." msgstr "" -#: ../../howto/functional.rst:995 +#: ../../howto/functional.rst:997 msgid "The functools module" msgstr "functools 模組" -#: ../../howto/functional.rst:997 +#: ../../howto/functional.rst:999 msgid "" "The :mod:`functools` module contains some higher-order functions. A **higher-" "order function** takes one or more functions as input and returns a new " @@ -1557,7 +1557,7 @@ msgid "" "partial` function." msgstr "" -#: ../../howto/functional.rst:1002 +#: ../../howto/functional.rst:1004 msgid "" "For programs written in a functional style, you'll sometimes want to " "construct variants of existing functions that have some of the parameters " @@ -1567,7 +1567,7 @@ msgid "" "\"partial function application\"." msgstr "" -#: ../../howto/functional.rst:1008 +#: ../../howto/functional.rst:1010 msgid "" "The constructor for :func:`~functools.partial` takes the arguments " "``(function, arg1, arg2, ..., kwarg1=value1, kwarg2=value2)``. The " @@ -1575,11 +1575,11 @@ msgid "" "with the filled-in arguments." msgstr "" -#: ../../howto/functional.rst:1013 +#: ../../howto/functional.rst:1015 msgid "Here's a small but realistic example::" msgstr "以下是個很小但實際的範例: ::" -#: ../../howto/functional.rst:1015 +#: ../../howto/functional.rst:1017 msgid "" "import functools\n" "\n" @@ -1592,7 +1592,7 @@ msgid "" "server_log('Unable to open socket')" msgstr "" -#: ../../howto/functional.rst:1025 +#: ../../howto/functional.rst:1027 msgid "" ":func:`functools.reduce(func, iter, [initial_value]) ` " "cumulatively performs an operation on all the iterable's elements and, " @@ -1607,7 +1607,7 @@ msgid "" "``func(initial_value, A)`` is the first calculation. ::" msgstr "" -#: ../../howto/functional.rst:1037 +#: ../../howto/functional.rst:1039 msgid "" ">>> import operator, functools\n" ">>> functools.reduce(operator.concat, ['A', 'BB', 'C'])\n" @@ -1633,20 +1633,20 @@ msgstr "" ">>> functools.reduce(operator.mul, [], 1)\n" "1" -#: ../../howto/functional.rst:1049 +#: ../../howto/functional.rst:1051 msgid "" "If you use :func:`operator.add` with :func:`functools.reduce`, you'll add up " "all the elements of the iterable. This case is so common that there's a " "special built-in called :func:`sum` to compute it:" msgstr "" -#: ../../howto/functional.rst:1061 +#: ../../howto/functional.rst:1063 msgid "" "For many uses of :func:`functools.reduce`, though, it can be clearer to just " "write the obvious :keyword:`for` loop::" msgstr "" -#: ../../howto/functional.rst:1064 +#: ../../howto/functional.rst:1066 msgid "" "import functools\n" "# Instead of:\n" @@ -1658,7 +1658,7 @@ msgid "" " product *= i" msgstr "" -#: ../../howto/functional.rst:1073 +#: ../../howto/functional.rst:1075 msgid "" "A related function is :func:`itertools.accumulate(iterable, func=operator." "add) `. It performs the same calculation, but instead " @@ -1666,7 +1666,7 @@ msgid "" "iterator that also yields each partial result::" msgstr "" -#: ../../howto/functional.rst:1078 +#: ../../howto/functional.rst:1080 msgid "" "itertools.accumulate([1, 2, 3, 4, 5]) =>\n" " 1, 3, 6, 10, 15\n" @@ -1680,11 +1680,11 @@ msgstr "" "itertools.accumulate([1, 2, 3, 4, 5], operator.mul) =>\n" " 1, 2, 6, 24, 120" -#: ../../howto/functional.rst:1086 +#: ../../howto/functional.rst:1088 msgid "The operator module" msgstr "operator 模組" -#: ../../howto/functional.rst:1088 +#: ../../howto/functional.rst:1090 msgid "" "The :mod:`operator` module was mentioned earlier. It contains a set of " "functions corresponding to Python's operators. These functions are often " @@ -1692,55 +1692,55 @@ msgid "" "functions that perform a single operation." msgstr "" -#: ../../howto/functional.rst:1093 +#: ../../howto/functional.rst:1095 msgid "Some of the functions in this module are:" msgstr "" -#: ../../howto/functional.rst:1095 +#: ../../howto/functional.rst:1097 msgid "" "Math operations: ``add()``, ``sub()``, ``mul()``, ``floordiv()``, " "``abs()``, ..." msgstr "" "數學運算:``add()``、``sub()``、``mul()``、``floordiv()``、``abs()``..." -#: ../../howto/functional.rst:1096 +#: ../../howto/functional.rst:1098 msgid "Logical operations: ``not_()``, ``truth()``." msgstr "" -#: ../../howto/functional.rst:1097 +#: ../../howto/functional.rst:1099 msgid "Bitwise operations: ``and_()``, ``or_()``, ``invert()``." msgstr "" -#: ../../howto/functional.rst:1098 +#: ../../howto/functional.rst:1100 msgid "" "Comparisons: ``eq()``, ``ne()``, ``lt()``, ``le()``, ``gt()``, and ``ge()``." msgstr "" -#: ../../howto/functional.rst:1099 +#: ../../howto/functional.rst:1101 msgid "Object identity: ``is_()``, ``is_not()``." msgstr "" -#: ../../howto/functional.rst:1101 +#: ../../howto/functional.rst:1103 msgid "Consult the operator module's documentation for a complete list." msgstr "" -#: ../../howto/functional.rst:1105 +#: ../../howto/functional.rst:1107 msgid "Small functions and the lambda expression" msgstr "" -#: ../../howto/functional.rst:1107 +#: ../../howto/functional.rst:1109 msgid "" "When writing functional-style programs, you'll often need little functions " "that act as predicates or that combine elements in some way." msgstr "" -#: ../../howto/functional.rst:1110 +#: ../../howto/functional.rst:1112 msgid "" "If there's a Python built-in or a module function that's suitable, you don't " "need to define a new function at all::" msgstr "" -#: ../../howto/functional.rst:1113 +#: ../../howto/functional.rst:1115 msgid "" "stripped_lines = [line.strip() for line in lines]\n" "existing_files = filter(os.path.exists, file_list)" @@ -1748,7 +1748,7 @@ msgstr "" "stripped_lines = [line.strip() for line in lines]\n" "existing_files = filter(os.path.exists, file_list)" -#: ../../howto/functional.rst:1116 +#: ../../howto/functional.rst:1118 msgid "" "If the function you need doesn't exist, you need to write it. One way to " "write small functions is to use the :keyword:`lambda` expression. " @@ -1757,7 +1757,7 @@ msgid "" "expression::" msgstr "" -#: ../../howto/functional.rst:1121 +#: ../../howto/functional.rst:1123 msgid "" "adder = lambda x, y: x+y\n" "\n" @@ -1767,13 +1767,13 @@ msgstr "" "\n" "print_assign = lambda name, value: name + '=' + str(value)" -#: ../../howto/functional.rst:1125 +#: ../../howto/functional.rst:1127 msgid "" "An alternative is to just use the ``def`` statement and define a function in " "the usual way::" msgstr "" -#: ../../howto/functional.rst:1128 +#: ../../howto/functional.rst:1130 msgid "" "def adder(x, y):\n" " return x + y\n" @@ -1787,13 +1787,13 @@ msgstr "" "def print_assign(name, value):\n" " return name + '=' + str(value)" -#: ../../howto/functional.rst:1134 +#: ../../howto/functional.rst:1136 msgid "" "Which alternative is preferable? That's a style question; my usual course " "is to avoid using ``lambda``." msgstr "" -#: ../../howto/functional.rst:1137 +#: ../../howto/functional.rst:1139 msgid "" "One reason for my preference is that ``lambda`` is quite limited in the " "functions it can define. The result has to be computable as a single " @@ -1803,7 +1803,7 @@ msgid "" "that's hard to read. Quick, what's the following code doing? ::" msgstr "" -#: ../../howto/functional.rst:1144 +#: ../../howto/functional.rst:1146 msgid "" "import functools\n" "total = functools.reduce(lambda a, b: (0, a[1] + b[1]), items)[1]" @@ -1811,14 +1811,14 @@ msgstr "" "import functools\n" "total = functools.reduce(lambda a, b: (0, a[1] + b[1]), items)[1]" -#: ../../howto/functional.rst:1147 +#: ../../howto/functional.rst:1149 msgid "" "You can figure it out, but it takes time to disentangle the expression to " "figure out what's going on. Using a short nested ``def`` statements makes " "things a little bit better::" msgstr "" -#: ../../howto/functional.rst:1151 +#: ../../howto/functional.rst:1153 msgid "" "import functools\n" "def combine(a, b):\n" @@ -1832,11 +1832,11 @@ msgstr "" "\n" "total = functools.reduce(combine, items)[1]" -#: ../../howto/functional.rst:1157 +#: ../../howto/functional.rst:1159 msgid "But it would be best of all if I had simply used a ``for`` loop::" msgstr "" -#: ../../howto/functional.rst:1159 +#: ../../howto/functional.rst:1161 msgid "" "total = 0\n" "for a, b in items:\n" @@ -1846,59 +1846,59 @@ msgstr "" "for a, b in items:\n" " total += b" -#: ../../howto/functional.rst:1163 +#: ../../howto/functional.rst:1165 msgid "Or the :func:`sum` built-in and a generator expression::" msgstr "" -#: ../../howto/functional.rst:1165 +#: ../../howto/functional.rst:1167 msgid "total = sum(b for a, b in items)" msgstr "total = sum(b for a, b in items)" -#: ../../howto/functional.rst:1167 +#: ../../howto/functional.rst:1169 msgid "" "Many uses of :func:`functools.reduce` are clearer when written as ``for`` " "loops." msgstr "" -#: ../../howto/functional.rst:1169 +#: ../../howto/functional.rst:1171 msgid "" "Fredrik Lundh once suggested the following set of rules for refactoring uses " "of ``lambda``:" msgstr "" -#: ../../howto/functional.rst:1172 +#: ../../howto/functional.rst:1174 msgid "Write a lambda function." msgstr "" -#: ../../howto/functional.rst:1173 +#: ../../howto/functional.rst:1175 msgid "Write a comment explaining what the heck that lambda does." msgstr "" -#: ../../howto/functional.rst:1174 +#: ../../howto/functional.rst:1176 msgid "" "Study the comment for a while, and think of a name that captures the essence " "of the comment." msgstr "" -#: ../../howto/functional.rst:1176 +#: ../../howto/functional.rst:1178 msgid "Convert the lambda to a def statement, using that name." msgstr "" -#: ../../howto/functional.rst:1177 +#: ../../howto/functional.rst:1179 msgid "Remove the comment." msgstr "" -#: ../../howto/functional.rst:1179 +#: ../../howto/functional.rst:1181 msgid "" "I really like these rules, but you're free to disagree about whether this " "lambda-free style is better." msgstr "" -#: ../../howto/functional.rst:1184 +#: ../../howto/functional.rst:1186 msgid "Revision History and Acknowledgements" msgstr "" -#: ../../howto/functional.rst:1186 +#: ../../howto/functional.rst:1188 msgid "" "The author would like to thank the following people for offering " "suggestions, corrections and assistance with various drafts of this article: " @@ -1906,40 +1906,40 @@ msgid "" "Krell, Leandro Lameiro, Jussi Salmela, Collin Winter, Blake Winton." msgstr "" -#: ../../howto/functional.rst:1191 +#: ../../howto/functional.rst:1193 msgid "Version 0.1: posted June 30 2006." msgstr "" -#: ../../howto/functional.rst:1193 +#: ../../howto/functional.rst:1195 msgid "Version 0.11: posted July 1 2006. Typo fixes." msgstr "" -#: ../../howto/functional.rst:1195 +#: ../../howto/functional.rst:1197 msgid "" "Version 0.2: posted July 10 2006. Merged genexp and listcomp sections into " "one. Typo fixes." msgstr "" -#: ../../howto/functional.rst:1198 +#: ../../howto/functional.rst:1200 msgid "" "Version 0.21: Added more references suggested on the tutor mailing list." msgstr "" -#: ../../howto/functional.rst:1200 +#: ../../howto/functional.rst:1202 msgid "" "Version 0.30: Adds a section on the ``functional`` module written by Collin " "Winter; adds short section on the operator module; a few other edits." msgstr "" -#: ../../howto/functional.rst:1205 +#: ../../howto/functional.rst:1207 msgid "References" msgstr "" -#: ../../howto/functional.rst:1208 +#: ../../howto/functional.rst:1210 msgid "General" msgstr "" -#: ../../howto/functional.rst:1210 +#: ../../howto/functional.rst:1212 msgid "" "**Structure and Interpretation of Computer Programs**, by Harold Abelson and " "Gerald Jay Sussman with Julie Sussman. The book can be found at https://" @@ -1950,24 +1950,24 @@ msgid "" "functional-style Python code." msgstr "" -#: ../../howto/functional.rst:1218 +#: ../../howto/functional.rst:1220 msgid "" "https://www.defmacro.org/ramblings/fp.html: A general introduction to " "functional programming that uses Java examples and has a lengthy historical " "introduction." msgstr "" -#: ../../howto/functional.rst:1221 +#: ../../howto/functional.rst:1223 msgid "" "https://en.wikipedia.org/wiki/Functional_programming: General Wikipedia " "entry describing functional programming." msgstr "" -#: ../../howto/functional.rst:1224 +#: ../../howto/functional.rst:1226 msgid "https://en.wikipedia.org/wiki/Coroutine: Entry for coroutines." msgstr "https://en.wikipedia.org/wiki/Coroutine: 協程 (coroutines) 的條目。" -#: ../../howto/functional.rst:1226 +#: ../../howto/functional.rst:1228 msgid "" "https://en.wikipedia.org/wiki/Partial_application: Entry for the concept of " "partial function application." @@ -1975,16 +1975,16 @@ msgstr "" "https://en.wikipedia.org/wiki/Partial_application: 偏函式 (partial " "application) 概念的條目。" -#: ../../howto/functional.rst:1228 +#: ../../howto/functional.rst:1230 msgid "" "https://en.wikipedia.org/wiki/Currying: Entry for the concept of currying." msgstr "https://en.wikipedia.org/wiki/Currying: currying 概念的條目。" -#: ../../howto/functional.rst:1231 +#: ../../howto/functional.rst:1233 msgid "Python-specific" msgstr "" -#: ../../howto/functional.rst:1233 +#: ../../howto/functional.rst:1235 msgid "" "https://gnosis.cx/TPiP/: The first chapter of David Mertz's book :title-" "reference:`Text Processing in Python` discusses functional programming for " @@ -1992,7 +1992,7 @@ msgid "" "Text Processing\"." msgstr "" -#: ../../howto/functional.rst:1238 +#: ../../howto/functional.rst:1240 msgid "" "Mertz also wrote a 3-part series of articles on functional programming for " "IBM's DeveloperWorks site; see `part 1 `__," msgstr "" -#: ../../howto/functional.rst:1246 +#: ../../howto/functional.rst:1248 msgid "Python documentation" msgstr "Python 說明文件" -#: ../../howto/functional.rst:1248 +#: ../../howto/functional.rst:1250 msgid "Documentation for the :mod:`itertools` module." msgstr ":mod:`itertools` 模組的說明文件。" -#: ../../howto/functional.rst:1250 +#: ../../howto/functional.rst:1252 msgid "Documentation for the :mod:`functools` module." msgstr ":mod:`functools` 模組的說明文件。" -#: ../../howto/functional.rst:1252 +#: ../../howto/functional.rst:1254 msgid "Documentation for the :mod:`operator` module." msgstr ":mod:`operator` 模組的說明文件。" -#: ../../howto/functional.rst:1254 +#: ../../howto/functional.rst:1256 msgid ":pep:`289`: \"Generator Expressions\"" msgstr ":pep:`289`:「產生器運算式 (Generator Expressions)」" -#: ../../howto/functional.rst:1256 +#: ../../howto/functional.rst:1258 msgid "" ":pep:`342`: \"Coroutines via Enhanced Generators\" describes the new " "generator features in Python 2.5." diff --git a/howto/gdb_helpers.po b/howto/gdb_helpers.po index b838b7cb85..67e53cc2e0 100644 --- a/howto/gdb_helpers.po +++ b/howto/gdb_helpers.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-12 00:04+0000\n" "PO-Revision-Date: 2024-05-11 14:42+0800\n" diff --git a/howto/index.po b/howto/index.po index 04346d9db9..d2b94700c4 100644 --- a/howto/index.po +++ b/howto/index.po @@ -6,9 +6,9 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" "PO-Revision-Date: 2021-07-05 12:45+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,15 +26,115 @@ msgstr "Python 如何達成任務" #: ../../howto/index.rst:5 msgid "" -"Python HOWTOs are documents that cover a single, specific topic, and attempt " -"to cover it fairly completely. Modelled on the Linux Documentation Project's " -"HOWTO collection, this collection is an effort to foster documentation " -"that's more detailed than the Python Library Reference." +"Python HOWTOs are documents that cover a specific topic in-depth. Modeled on " +"the Linux Documentation Project's HOWTO collection, this collection is an " +"effort to foster documentation that's more detailed than the Python Library " +"Reference." msgstr "" -"「Python 如何達成任務 (HOWTOs)」是一系列的說明文件,其內容會盡量完整地涵蓋某" -"些單一、特定的主題。以 Linux 說明文件專案的 HOWTO 系列為模範,本系列的目標是" -"提供比 Python 函式庫參考手冊更實用的說明文件。" +"「Python 如何達成任務 (HOWTOs)」是一系列的說明文件,其內容會深度地涵蓋某些特" +"定的主題。以 Linux 說明文件專案的 HOWTO 系列為模範,本系列的目標是提供比 " +"Python 函式庫參考手冊更實用的說明文件。" -#: ../../howto/index.rst:11 -msgid "Currently, the HOWTOs are:" -msgstr "目前有以下這些任務指南:" +#: ../../howto/index.rst:38 +msgid "General:" +msgstr "" + +#: ../../howto/index.rst:40 +msgid ":ref:`annotations-howto`" +msgstr ":ref:`annotations-howto`" + +#: ../../howto/index.rst:41 +msgid ":ref:`argparse-tutorial`" +msgstr ":ref:`argparse-tutorial`" + +#: ../../howto/index.rst:42 +msgid ":ref:`descriptorhowto`" +msgstr ":ref:`descriptorhowto`" + +#: ../../howto/index.rst:43 +msgid ":ref:`enum-howto`" +msgstr ":ref:`enum-howto`" + +#: ../../howto/index.rst:44 +msgid ":ref:`functional-howto`" +msgstr ":ref:`functional-howto`" + +#: ../../howto/index.rst:45 +msgid ":ref:`ipaddress-howto`" +msgstr ":ref:`ipaddress-howto`" + +#: ../../howto/index.rst:46 +msgid ":ref:`logging-howto`" +msgstr ":ref:`logging-howto`" + +#: ../../howto/index.rst:47 +msgid ":ref:`logging-cookbook`" +msgstr ":ref:`logging-cookbook`" + +#: ../../howto/index.rst:48 +msgid ":ref:`regex-howto`" +msgstr ":ref:`regex-howto`" + +#: ../../howto/index.rst:49 +msgid ":ref:`sortinghowto`" +msgstr ":ref:`sortinghowto`" + +#: ../../howto/index.rst:50 +msgid ":ref:`unicode-howto`" +msgstr ":ref:`unicode-howto`" + +#: ../../howto/index.rst:51 +msgid ":ref:`urllib-howto`" +msgstr ":ref:`urllib-howto`" + +#: ../../howto/index.rst:53 +msgid "Advanced development:" +msgstr "" + +#: ../../howto/index.rst:55 +msgid ":ref:`curses-howto`" +msgstr ":ref:`curses-howto`" + +#: ../../howto/index.rst:56 +msgid ":ref:`freethreading-python-howto`" +msgstr ":ref:`freethreading-python-howto`" + +#: ../../howto/index.rst:57 +msgid ":ref:`freethreading-extensions-howto`" +msgstr ":ref:`freethreading-extensions-howto`" + +#: ../../howto/index.rst:58 +msgid ":ref:`isolating-extensions-howto`" +msgstr ":ref:`isolating-extensions-howto`" + +#: ../../howto/index.rst:59 +msgid ":ref:`python_2.3_mro`" +msgstr ":ref:`python_2.3_mro`" + +#: ../../howto/index.rst:60 +msgid ":ref:`socket-howto`" +msgstr ":ref:`socket-howto`" + +#: ../../howto/index.rst:61 +msgid ":ref:`timerfd-howto`" +msgstr ":ref:`timerfd-howto`" + +#: ../../howto/index.rst:62 +msgid ":ref:`cporting-howto`" +msgstr ":ref:`cporting-howto`" + +#: ../../howto/index.rst:64 +msgid "Debugging and profiling:" +msgstr "" + +#: ../../howto/index.rst:66 +msgid ":ref:`gdb`" +msgstr ":ref:`gdb`" + +#: ../../howto/index.rst:67 +msgid ":ref:`instrumentation`" +msgstr ":ref:`instrumentation`" + +#: ../../howto/index.rst:68 +msgid ":ref:`perf_profiling`" +msgstr ":ref:`perf_profiling`" diff --git a/howto/instrumentation.po b/howto/instrumentation.po index a09a97c9c3..570f39bb25 100644 --- a/howto/instrumentation.po +++ b/howto/instrumentation.po @@ -5,7 +5,7 @@ # Matt Wang msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-08-17 22:17+0800\n" diff --git a/howto/ipaddress.po b/howto/ipaddress.po index 2e0e5b2546..69bef65056 100644 --- a/howto/ipaddress.po +++ b/howto/ipaddress.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-07-20 16:09+0800\n" diff --git a/howto/isolating-extensions.po b/howto/isolating-extensions.po index 87030d9e45..b77676fcb3 100644 --- a/howto/isolating-extensions.po +++ b/howto/isolating-extensions.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/howto/logging-cookbook.po b/howto/logging-cookbook.po index dace5941c5..abe416bd57 100644 --- a/howto/logging-cookbook.po +++ b/howto/logging-cookbook.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -445,10 +445,11 @@ msgstr "" #: ../../howto/logging-cookbook.rst:335 msgid "" "This configuration does *almost* what we want, except that ``sys.stdout`` " -"would show messages of severity ``ERROR`` and above as well as ``INFO`` and " -"``WARNING`` messages. To prevent this, we can set up a filter which excludes " -"those messages and add it to the relevant handler. This can be configured by " -"adding a ``filters`` section parallel to ``formatters`` and ``handlers``:" +"would show messages of severity ``ERROR`` and only events of this severity " +"and higher will be tracked as well as ``INFO`` and ``WARNING`` messages. To " +"prevent this, we can set up a filter which excludes those messages and add " +"it to the relevant handler. This can be configured by adding a ``filters`` " +"section parallel to ``formatters`` and ``handlers``:" msgstr "" #: ../../howto/logging-cookbook.rst:341 diff --git a/howto/logging.po b/howto/logging.po index f254457fed..fa2c5628aa 100644 --- a/howto/logging.po +++ b/howto/logging.po @@ -6,9 +6,9 @@ # 文俊 高 , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:36+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -19,7 +19,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -#: ../../howto/logging.rst:3 +#: ../../howto/logging.rst:5 msgid "Logging HOWTO" msgstr "如何使用 Logging 模組" @@ -27,21 +27,21 @@ msgstr "如何使用 Logging 模組" msgid "Author" msgstr "作者" -#: ../../howto/logging.rst:5 +#: ../../howto/logging.rst:7 msgid "Vinay Sajip " msgstr "Vinay Sajip " -#: ../../howto/logging.rst:11 +#: ../../howto/logging.rst:13 msgid "" "This page contains tutorial information. For links to reference information " "and a logging cookbook, please see :ref:`tutorial-ref-links`." msgstr "" -#: ../../howto/logging.rst:15 +#: ../../howto/logging.rst:17 msgid "Basic Logging Tutorial" msgstr "基礎 Logging 指南" -#: ../../howto/logging.rst:17 +#: ../../howto/logging.rst:19 msgid "" "Logging is a means of tracking events that happen when some software runs. " "The software's developer adds logging calls to their code to indicate that " @@ -56,11 +56,11 @@ msgstr "" "述。這段訊息可能包含一些因為此事件發生而改變的資料。開發者也可以指派事件的重" "要程度,重要程度有時候也會被稱作 *程度* 或是 *嚴重性* 。" -#: ../../howto/logging.rst:26 +#: ../../howto/logging.rst:28 msgid "When to use logging" msgstr "什麼時候使用 logging" -#: ../../howto/logging.rst:28 +#: ../../howto/logging.rst:30 msgid "" "You can access logging functionality by creating a logger via ``logger = " "getLogger(__name__)``, and then calling the logger's :meth:`~Logger.debug`, :" @@ -70,158 +70,158 @@ msgid "" "each of a set of common tasks, the best tool to use for that task." msgstr "" -#: ../../howto/logging.rst:36 +#: ../../howto/logging.rst:38 msgid "Task you want to perform" msgstr "" -#: ../../howto/logging.rst:36 +#: ../../howto/logging.rst:38 msgid "The best tool for the task" msgstr "" -#: ../../howto/logging.rst:38 +#: ../../howto/logging.rst:40 msgid "" "Display console output for ordinary usage of a command line script or program" msgstr "" -#: ../../howto/logging.rst:38 +#: ../../howto/logging.rst:40 msgid ":func:`print`" msgstr ":func:`print`" -#: ../../howto/logging.rst:42 +#: ../../howto/logging.rst:44 msgid "" "Report events that occur during normal operation of a program (e.g. for " "status monitoring or fault investigation)" msgstr "" -#: ../../howto/logging.rst:42 +#: ../../howto/logging.rst:44 msgid "" "A logger's :meth:`~Logger.info` (or :meth:`~Logger.debug` method for very " "detailed output for diagnostic purposes)" msgstr "" -#: ../../howto/logging.rst:47 +#: ../../howto/logging.rst:49 msgid "Issue a warning regarding a particular runtime event" msgstr "" -#: ../../howto/logging.rst:47 +#: ../../howto/logging.rst:49 msgid "" ":func:`warnings.warn` in library code if the issue is avoidable and the " "client application should be modified to eliminate the warning" msgstr "" -#: ../../howto/logging.rst:52 +#: ../../howto/logging.rst:54 msgid "" "A logger's :meth:`~Logger.warning` method if there is nothing the client " "application can do about the situation, but the event should still be noted" msgstr "" -#: ../../howto/logging.rst:58 +#: ../../howto/logging.rst:60 msgid "Report an error regarding a particular runtime event" msgstr "" -#: ../../howto/logging.rst:58 +#: ../../howto/logging.rst:60 msgid "Raise an exception" msgstr "" -#: ../../howto/logging.rst:61 +#: ../../howto/logging.rst:63 msgid "" "Report suppression of an error without raising an exception (e.g. error " "handler in a long-running server process)" msgstr "" -#: ../../howto/logging.rst:61 +#: ../../howto/logging.rst:63 msgid "" "A logger's :meth:`~Logger.error`, :meth:`~Logger.exception` or :meth:" "`~Logger.critical` method as appropriate for the specific error and " "application domain" msgstr "" -#: ../../howto/logging.rst:68 +#: ../../howto/logging.rst:70 msgid "" "The logger methods are named after the level or severity of the events they " "are used to track. The standard levels and their applicability are described " "below (in increasing order of severity):" msgstr "" -#: ../../howto/logging.rst:75 ../../howto/logging.rst:874 +#: ../../howto/logging.rst:77 ../../howto/logging.rst:875 msgid "Level" msgstr "" -#: ../../howto/logging.rst:75 +#: ../../howto/logging.rst:77 msgid "When it's used" msgstr "" -#: ../../howto/logging.rst:77 ../../howto/logging.rst:884 +#: ../../howto/logging.rst:79 ../../howto/logging.rst:885 msgid "``DEBUG``" msgstr "``DEBUG``" -#: ../../howto/logging.rst:77 +#: ../../howto/logging.rst:79 msgid "" "Detailed information, typically of interest only when diagnosing problems." msgstr "" -#: ../../howto/logging.rst:80 ../../howto/logging.rst:882 +#: ../../howto/logging.rst:82 ../../howto/logging.rst:883 msgid "``INFO``" msgstr "``INFO``" -#: ../../howto/logging.rst:80 +#: ../../howto/logging.rst:82 msgid "Confirmation that things are working as expected." msgstr "" -#: ../../howto/logging.rst:83 ../../howto/logging.rst:880 +#: ../../howto/logging.rst:85 ../../howto/logging.rst:881 msgid "``WARNING``" msgstr "``WARNING``" -#: ../../howto/logging.rst:83 +#: ../../howto/logging.rst:85 msgid "" "An indication that something unexpected happened, or indicative of some " "problem in the near future (e.g. 'disk space low'). The software is still " "working as expected." msgstr "" -#: ../../howto/logging.rst:88 ../../howto/logging.rst:878 +#: ../../howto/logging.rst:90 ../../howto/logging.rst:879 msgid "``ERROR``" msgstr "``ERROR``" -#: ../../howto/logging.rst:88 +#: ../../howto/logging.rst:90 msgid "" "Due to a more serious problem, the software has not been able to perform " "some function." msgstr "" -#: ../../howto/logging.rst:91 ../../howto/logging.rst:876 +#: ../../howto/logging.rst:93 ../../howto/logging.rst:877 msgid "``CRITICAL``" msgstr "``CRITICAL``" -#: ../../howto/logging.rst:91 +#: ../../howto/logging.rst:93 msgid "" "A serious error, indicating that the program itself may be unable to " "continue running." msgstr "" -#: ../../howto/logging.rst:95 +#: ../../howto/logging.rst:97 msgid "" -"The default level is ``WARNING``, which means that only events of this level " -"and above will be tracked, unless the logging package is configured to do " -"otherwise." +"The default level is ``WARNING``, which means that only events of this " +"severity and higher will be tracked, unless the logging package is " +"configured to do otherwise." msgstr "" -#: ../../howto/logging.rst:99 +#: ../../howto/logging.rst:100 msgid "" "Events that are tracked can be handled in different ways. The simplest way " "of handling tracked events is to print them to the console. Another common " "way is to write them to a disk file." msgstr "" -#: ../../howto/logging.rst:107 +#: ../../howto/logging.rst:108 msgid "A simple example" msgstr "一個簡單範例" -#: ../../howto/logging.rst:109 +#: ../../howto/logging.rst:110 msgid "A very simple example is::" msgstr "一個非常簡單的例子是: ::" -#: ../../howto/logging.rst:111 +#: ../../howto/logging.rst:112 msgid "" "import logging\n" "logging.warning('Watch out!') # will print a message to the console\n" @@ -231,15 +231,15 @@ msgstr "" "logging.warning('Watch out!') # 將會印出訊息至控制台\n" "logging.info('I told you so') # 不會印出任何東西" -#: ../../howto/logging.rst:115 +#: ../../howto/logging.rst:116 msgid "If you type these lines into a script and run it, you'll see:" msgstr "" -#: ../../howto/logging.rst:117 +#: ../../howto/logging.rst:118 msgid "WARNING:root:Watch out!" msgstr "WARNING:root:Watch out!" -#: ../../howto/logging.rst:121 +#: ../../howto/logging.rst:122 msgid "" "printed out on the console. The ``INFO`` message doesn't appear because the " "default level is ``WARNING``. The printed message includes the indication of " @@ -248,7 +248,7 @@ msgid "" "need that; formatting options will also be explained later." msgstr "" -#: ../../howto/logging.rst:127 +#: ../../howto/logging.rst:128 msgid "" "Notice that in this example, we use functions directly on the ``logging`` " "module, like ``logging.debug``, rather than creating a logger and calling " @@ -260,11 +260,11 @@ msgid "" "methods." msgstr "" -#: ../../howto/logging.rst:136 +#: ../../howto/logging.rst:137 msgid "Logging to a file" msgstr "" -#: ../../howto/logging.rst:138 +#: ../../howto/logging.rst:139 msgid "" "A very common situation is that of recording logging events in a file, so " "let's look at that next. Be sure to try the following in a newly started " @@ -272,7 +272,7 @@ msgid "" "above::" msgstr "" -#: ../../howto/logging.rst:142 +#: ../../howto/logging.rst:143 msgid "" "import logging\n" "logger = logging.getLogger(__name__)\n" @@ -284,7 +284,7 @@ msgid "" "logger.error('And non-ASCII stuff, too, like Øresund and Malmö')" msgstr "" -#: ../../howto/logging.rst:150 +#: ../../howto/logging.rst:151 msgid "" "The *encoding* argument was added. In earlier Python versions, or if not " "specified, the encoding used is the default value used by :func:`open`. " @@ -293,13 +293,13 @@ msgid "" "values and the default, see the documentation for :func:`open`." msgstr "" -#: ../../howto/logging.rst:157 +#: ../../howto/logging.rst:158 msgid "" "And now if we open the file and look at what we have, we should find the log " "messages:" msgstr "" -#: ../../howto/logging.rst:160 +#: ../../howto/logging.rst:161 msgid "" "DEBUG:__main__:This message should go to the log file\n" "INFO:__main__:So should this\n" @@ -307,40 +307,40 @@ msgid "" "ERROR:__main__:And non-ASCII stuff, too, like Øresund and Malmö" msgstr "" -#: ../../howto/logging.rst:167 +#: ../../howto/logging.rst:168 msgid "" "This example also shows how you can set the logging level which acts as the " "threshold for tracking. In this case, because we set the threshold to " "``DEBUG``, all of the messages were printed." msgstr "" -#: ../../howto/logging.rst:171 +#: ../../howto/logging.rst:172 msgid "" "If you want to set the logging level from a command-line option such as:" msgstr "" -#: ../../howto/logging.rst:173 +#: ../../howto/logging.rst:174 msgid "--log=INFO" msgstr "--log=INFO" -#: ../../howto/logging.rst:177 +#: ../../howto/logging.rst:178 msgid "" "and you have the value of the parameter passed for ``--log`` in some " "variable *loglevel*, you can use::" msgstr "" -#: ../../howto/logging.rst:180 +#: ../../howto/logging.rst:181 msgid "getattr(logging, loglevel.upper())" msgstr "getattr(logging, loglevel.upper())" -#: ../../howto/logging.rst:182 +#: ../../howto/logging.rst:183 msgid "" "to get the value which you'll pass to :func:`basicConfig` via the *level* " "argument. You may want to error check any user input value, perhaps as in " "the following example::" msgstr "" -#: ../../howto/logging.rst:186 +#: ../../howto/logging.rst:187 msgid "" "# assuming loglevel is bound to the string value obtained from the\n" "# command line argument. Convert to upper case to allow the user to\n" @@ -351,14 +351,14 @@ msgid "" "logging.basicConfig(level=numeric_level, ...)" msgstr "" -#: ../../howto/logging.rst:194 +#: ../../howto/logging.rst:195 msgid "" "The call to :func:`basicConfig` should come *before* any calls to a logger's " "methods such as :meth:`~Logger.debug`, :meth:`~Logger.info`, etc. Otherwise, " "that logging event may not be handled in the desired manner." msgstr "" -#: ../../howto/logging.rst:198 +#: ../../howto/logging.rst:199 msgid "" "If you run the above script several times, the messages from successive runs " "are appended to the file *example.log*. If you want each run to start " @@ -366,7 +366,7 @@ msgid "" "*filemode* argument, by changing the call in the above example to::" msgstr "" -#: ../../howto/logging.rst:203 +#: ../../howto/logging.rst:204 msgid "" "logging.basicConfig(filename='example.log', filemode='w', level=logging." "DEBUG)" @@ -374,23 +374,23 @@ msgstr "" "logging.basicConfig(filename='example.log', filemode='w', level=logging." "DEBUG)" -#: ../../howto/logging.rst:205 +#: ../../howto/logging.rst:206 msgid "" "The output will be the same as before, but the log file is no longer " "appended to, so the messages from earlier runs are lost." msgstr "" -#: ../../howto/logging.rst:210 +#: ../../howto/logging.rst:211 msgid "Logging variable data" msgstr "" -#: ../../howto/logging.rst:212 +#: ../../howto/logging.rst:213 msgid "" "To log variable data, use a format string for the event description message " "and append the variable data as arguments. For example::" msgstr "" -#: ../../howto/logging.rst:215 +#: ../../howto/logging.rst:216 msgid "" "import logging\n" "logging.warning('%s before you %s', 'Look', 'leap!')" @@ -398,15 +398,15 @@ msgstr "" "import logging\n" "logging.warning('%s before you %s', 'Look', 'leap!')" -#: ../../howto/logging.rst:218 +#: ../../howto/logging.rst:219 msgid "will display:" msgstr "" -#: ../../howto/logging.rst:220 +#: ../../howto/logging.rst:221 msgid "WARNING:root:Look before you leap!" msgstr "WARNING:root:Look before you leap!" -#: ../../howto/logging.rst:224 +#: ../../howto/logging.rst:225 msgid "" "As you can see, merging of variable data into the event description message " "uses the old, %-style of string formatting. This is for backwards " @@ -416,17 +416,17 @@ msgid "" "tutorial: see :ref:`formatting-styles` for more information." msgstr "" -#: ../../howto/logging.rst:233 +#: ../../howto/logging.rst:234 msgid "Changing the format of displayed messages" msgstr "" -#: ../../howto/logging.rst:235 +#: ../../howto/logging.rst:236 msgid "" "To change the format which is used to display messages, you need to specify " "the format you want to use::" msgstr "" -#: ../../howto/logging.rst:238 +#: ../../howto/logging.rst:239 msgid "" "import logging\n" "logging.basicConfig(format='%(levelname)s:%(message)s', level=logging." @@ -436,18 +436,18 @@ msgid "" "logging.warning('And this, too')" msgstr "" -#: ../../howto/logging.rst:244 +#: ../../howto/logging.rst:245 msgid "which would print:" msgstr "" -#: ../../howto/logging.rst:246 +#: ../../howto/logging.rst:247 msgid "" "DEBUG:This message should appear on the console\n" "INFO:So should this\n" "WARNING:And this, too" msgstr "" -#: ../../howto/logging.rst:252 +#: ../../howto/logging.rst:253 msgid "" "Notice that the 'root' which appeared in earlier examples has disappeared. " "For a full set of things that can appear in format strings, you can refer to " @@ -457,39 +457,39 @@ msgid "" "This is described in the next section." msgstr "" -#: ../../howto/logging.rst:261 +#: ../../howto/logging.rst:262 msgid "Displaying the date/time in messages" msgstr "" -#: ../../howto/logging.rst:263 +#: ../../howto/logging.rst:264 msgid "" "To display the date and time of an event, you would place '%(asctime)s' in " "your format string::" msgstr "" -#: ../../howto/logging.rst:266 +#: ../../howto/logging.rst:267 msgid "" "import logging\n" "logging.basicConfig(format='%(asctime)s %(message)s')\n" "logging.warning('is when this event was logged.')" msgstr "" -#: ../../howto/logging.rst:270 +#: ../../howto/logging.rst:271 msgid "which should print something like this:" msgstr "" -#: ../../howto/logging.rst:272 +#: ../../howto/logging.rst:273 msgid "2010-12-12 11:41:42,612 is when this event was logged." msgstr "" -#: ../../howto/logging.rst:276 +#: ../../howto/logging.rst:277 msgid "" "The default format for date/time display (shown above) is like ISO8601 or :" "rfc:`3339`. If you need more control over the formatting of the date/time, " "provide a *datefmt* argument to ``basicConfig``, as in this example::" msgstr "" -#: ../../howto/logging.rst:280 +#: ../../howto/logging.rst:281 msgid "" "import logging\n" "logging.basicConfig(format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:" @@ -497,25 +497,25 @@ msgid "" "logging.warning('is when this event was logged.')" msgstr "" -#: ../../howto/logging.rst:284 +#: ../../howto/logging.rst:285 msgid "which would display something like this:" msgstr "" -#: ../../howto/logging.rst:286 +#: ../../howto/logging.rst:287 msgid "12/12/2010 11:46:36 AM is when this event was logged." msgstr "" -#: ../../howto/logging.rst:290 +#: ../../howto/logging.rst:291 msgid "" "The format of the *datefmt* argument is the same as supported by :func:`time." "strftime`." msgstr "" -#: ../../howto/logging.rst:295 +#: ../../howto/logging.rst:296 msgid "Next Steps" msgstr "" -#: ../../howto/logging.rst:297 +#: ../../howto/logging.rst:298 msgid "" "That concludes the basic tutorial. It should be enough to get you up and " "running with logging. There's a lot more that the logging package offers, " @@ -524,7 +524,7 @@ msgid "" "of your favourite beverage and carry on." msgstr "" -#: ../../howto/logging.rst:303 +#: ../../howto/logging.rst:304 msgid "" "If your logging needs are simple, then use the above examples to incorporate " "logging into your own scripts, and if you run into problems or don't " @@ -533,50 +533,50 @@ msgid "" "should receive help before too long." msgstr "" -#: ../../howto/logging.rst:309 +#: ../../howto/logging.rst:310 msgid "" "Still here? You can carry on reading the next few sections, which provide a " "slightly more advanced/in-depth tutorial than the basic one above. After " "that, you can take a look at the :ref:`logging-cookbook`." msgstr "" -#: ../../howto/logging.rst:317 +#: ../../howto/logging.rst:318 msgid "Advanced Logging Tutorial" msgstr "" -#: ../../howto/logging.rst:319 +#: ../../howto/logging.rst:320 msgid "" "The logging library takes a modular approach and offers several categories " "of components: loggers, handlers, filters, and formatters." msgstr "" -#: ../../howto/logging.rst:322 +#: ../../howto/logging.rst:323 msgid "Loggers expose the interface that application code directly uses." msgstr "" -#: ../../howto/logging.rst:323 +#: ../../howto/logging.rst:324 msgid "" "Handlers send the log records (created by loggers) to the appropriate " "destination." msgstr "" -#: ../../howto/logging.rst:325 +#: ../../howto/logging.rst:326 msgid "" "Filters provide a finer grained facility for determining which log records " "to output." msgstr "" -#: ../../howto/logging.rst:327 +#: ../../howto/logging.rst:328 msgid "Formatters specify the layout of log records in the final output." msgstr "" -#: ../../howto/logging.rst:329 +#: ../../howto/logging.rst:330 msgid "" "Log event information is passed between loggers, handlers, filters and " "formatters in a :class:`LogRecord` instance." msgstr "" -#: ../../howto/logging.rst:332 +#: ../../howto/logging.rst:333 msgid "" "Logging is performed by calling methods on instances of the :class:`Logger` " "class (hereafter called :dfn:`loggers`). Each instance has a name, and they " @@ -587,23 +587,23 @@ msgid "" "originates." msgstr "" -#: ../../howto/logging.rst:339 +#: ../../howto/logging.rst:340 msgid "" "A good convention to use when naming loggers is to use a module-level " "logger, in each module which uses logging, named as follows::" msgstr "" -#: ../../howto/logging.rst:342 +#: ../../howto/logging.rst:343 msgid "logger = logging.getLogger(__name__)" msgstr "logger = logging.getLogger(__name__)" -#: ../../howto/logging.rst:344 +#: ../../howto/logging.rst:345 msgid "" "This means that logger names track the package/module hierarchy, and it's " "intuitively obvious where events are logged just from the logger name." msgstr "" -#: ../../howto/logging.rst:347 +#: ../../howto/logging.rst:348 msgid "" "The root of the hierarchy of loggers is called the root logger. That's the " "logger used by the functions :func:`debug`, :func:`info`, :func:`warning`, :" @@ -612,7 +612,7 @@ msgid "" "root logger's name is printed as 'root' in the logged output." msgstr "" -#: ../../howto/logging.rst:353 +#: ../../howto/logging.rst:354 msgid "" "It is, of course, possible to log messages to different destinations. " "Support is included in the package for writing log messages to files, HTTP " @@ -623,7 +623,7 @@ msgid "" "built-in handler classes." msgstr "" -#: ../../howto/logging.rst:360 +#: ../../howto/logging.rst:361 msgid "" "By default, no destination is set for any logging messages. You can specify " "a destination (such as console or file) by using :func:`basicConfig` as in " @@ -635,36 +635,36 @@ msgid "" "message output." msgstr "" -#: ../../howto/logging.rst:368 +#: ../../howto/logging.rst:369 msgid "The default format set by :func:`basicConfig` for messages is:" msgstr "" -#: ../../howto/logging.rst:370 +#: ../../howto/logging.rst:371 msgid "severity:logger name:message" msgstr "severity:logger name:message" -#: ../../howto/logging.rst:374 +#: ../../howto/logging.rst:375 msgid "" "You can change this by passing a format string to :func:`basicConfig` with " "the *format* keyword argument. For all options regarding how a format string " "is constructed, see :ref:`formatter-objects`." msgstr "" -#: ../../howto/logging.rst:379 +#: ../../howto/logging.rst:380 msgid "Logging Flow" msgstr "" -#: ../../howto/logging.rst:381 +#: ../../howto/logging.rst:382 msgid "" "The flow of log event information in loggers and handlers is illustrated in " "the following diagram." msgstr "" -#: ../../howto/logging.rst:432 +#: ../../howto/logging.rst:433 msgid "Loggers" msgstr "" -#: ../../howto/logging.rst:434 +#: ../../howto/logging.rst:435 msgid "" ":class:`Logger` objects have a threefold job. First, they expose several " "methods to application code so that applications can log messages at " @@ -674,17 +674,17 @@ msgid "" "handlers." msgstr "" -#: ../../howto/logging.rst:440 +#: ../../howto/logging.rst:441 msgid "" "The most widely used methods on logger objects fall into two categories: " "configuration and message sending." msgstr "" -#: ../../howto/logging.rst:443 +#: ../../howto/logging.rst:444 msgid "These are the most common configuration methods:" msgstr "" -#: ../../howto/logging.rst:445 +#: ../../howto/logging.rst:446 msgid "" ":meth:`Logger.setLevel` specifies the lowest-severity log message a logger " "will handle, where debug is the lowest built-in severity level and critical " @@ -693,32 +693,32 @@ msgid "" "messages and will ignore DEBUG messages." msgstr "" -#: ../../howto/logging.rst:451 +#: ../../howto/logging.rst:452 msgid "" ":meth:`Logger.addHandler` and :meth:`Logger.removeHandler` add and remove " "handler objects from the logger object. Handlers are covered in more detail " "in :ref:`handler-basic`." msgstr "" -#: ../../howto/logging.rst:455 +#: ../../howto/logging.rst:456 msgid "" ":meth:`Logger.addFilter` and :meth:`Logger.removeFilter` add and remove " "filter objects from the logger object. Filters are covered in more detail " "in :ref:`filter`." msgstr "" -#: ../../howto/logging.rst:459 +#: ../../howto/logging.rst:460 msgid "" "You don't need to always call these methods on every logger you create. See " "the last two paragraphs in this section." msgstr "" -#: ../../howto/logging.rst:462 +#: ../../howto/logging.rst:463 msgid "" "With the logger object configured, the following methods create log messages:" msgstr "" -#: ../../howto/logging.rst:464 +#: ../../howto/logging.rst:465 msgid "" ":meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`, :meth:" "`Logger.error`, and :meth:`Logger.critical` all create log records with a " @@ -731,14 +731,14 @@ msgid "" "exception information." msgstr "" -#: ../../howto/logging.rst:474 +#: ../../howto/logging.rst:475 msgid "" ":meth:`Logger.exception` creates a log message similar to :meth:`Logger." "error`. The difference is that :meth:`Logger.exception` dumps a stack trace " "along with it. Call this method only from an exception handler." msgstr "" -#: ../../howto/logging.rst:478 +#: ../../howto/logging.rst:479 msgid "" ":meth:`Logger.log` takes a log level as an explicit argument. This is a " "little more verbose for logging messages than using the log level " @@ -746,7 +746,7 @@ msgid "" "levels." msgstr "" -#: ../../howto/logging.rst:482 +#: ../../howto/logging.rst:483 msgid "" ":func:`getLogger` returns a reference to a logger instance with the " "specified name if it is provided, or ``root`` if not. The names are period-" @@ -758,7 +758,7 @@ msgid "" "descendants of ``foo``." msgstr "" -#: ../../howto/logging.rst:490 +#: ../../howto/logging.rst:491 msgid "" "Loggers have a concept of *effective level*. If a level is not explicitly " "set on a logger, the level of its parent is used instead as its effective " @@ -770,7 +770,7 @@ msgid "" "handlers." msgstr "" -#: ../../howto/logging.rst:498 +#: ../../howto/logging.rst:499 msgid "" "Child loggers propagate messages up to the handlers associated with their " "ancestor loggers. Because of this, it is unnecessary to define and configure " @@ -780,11 +780,11 @@ msgid "" "attribute of a logger to ``False``.)" msgstr "" -#: ../../howto/logging.rst:509 +#: ../../howto/logging.rst:510 msgid "Handlers" msgstr "" -#: ../../howto/logging.rst:511 +#: ../../howto/logging.rst:512 msgid "" ":class:`~logging.Handler` objects are responsible for dispatching the " "appropriate log messages (based on the log messages' severity) to the " @@ -797,14 +797,14 @@ msgid "" "of a specific severity to a specific location." msgstr "" -#: ../../howto/logging.rst:521 +#: ../../howto/logging.rst:522 msgid "" "The standard library includes quite a few handler types (see :ref:`useful-" "handlers`); the tutorials use mainly :class:`StreamHandler` and :class:" "`FileHandler` in its examples." msgstr "" -#: ../../howto/logging.rst:525 +#: ../../howto/logging.rst:526 msgid "" "There are very few methods in a handler for application developers to " "concern themselves with. The only handler methods that seem relevant for " @@ -812,7 +812,7 @@ msgid "" "not creating custom handlers) are the following configuration methods:" msgstr "" -#: ../../howto/logging.rst:530 +#: ../../howto/logging.rst:531 msgid "" "The :meth:`~Handler.setLevel` method, just as in logger objects, specifies " "the lowest severity that will be dispatched to the appropriate destination. " @@ -822,19 +822,19 @@ msgid "" "send on." msgstr "" -#: ../../howto/logging.rst:536 +#: ../../howto/logging.rst:537 msgid "" ":meth:`~Handler.setFormatter` selects a Formatter object for this handler to " "use." msgstr "" -#: ../../howto/logging.rst:539 +#: ../../howto/logging.rst:540 msgid "" ":meth:`~Handler.addFilter` and :meth:`~Handler.removeFilter` respectively " "configure and deconfigure filter objects on handlers." msgstr "" -#: ../../howto/logging.rst:542 +#: ../../howto/logging.rst:543 msgid "" "Application code should not directly instantiate and use instances of :class:" "`Handler`. Instead, the :class:`Handler` class is a base class that defines " @@ -842,11 +842,11 @@ msgid "" "behavior that child classes can use (or override)." msgstr "" -#: ../../howto/logging.rst:549 +#: ../../howto/logging.rst:550 msgid "Formatters" msgstr "" -#: ../../howto/logging.rst:551 +#: ../../howto/logging.rst:552 msgid "" "Formatter objects configure the final order, structure, and contents of the " "log message. Unlike the base :class:`logging.Handler` class, application " @@ -856,24 +856,24 @@ msgid "" "string and a style indicator." msgstr "" -#: ../../howto/logging.rst:560 +#: ../../howto/logging.rst:561 msgid "" "If there is no message format string, the default is to use the raw " "message. If there is no date format string, the default date format is:" msgstr "" -#: ../../howto/logging.rst:563 +#: ../../howto/logging.rst:564 msgid "%Y-%m-%d %H:%M:%S" msgstr "%Y-%m-%d %H:%M:%S" -#: ../../howto/logging.rst:567 +#: ../../howto/logging.rst:568 msgid "" "with the milliseconds tacked on at the end. The ``style`` is one of ``'%'``, " "``'{'``, or ``'$'``. If one of these is not specified, then ``'%'`` will be " "used." msgstr "" -#: ../../howto/logging.rst:570 +#: ../../howto/logging.rst:571 msgid "" "If the ``style`` is ``'%'``, the message format string uses ``%()s`` styled string substitution; the possible keys are documented in :" @@ -883,22 +883,22 @@ msgid "" "should conform to what is expected by :meth:`string.Template.substitute`." msgstr "" -#: ../../howto/logging.rst:577 +#: ../../howto/logging.rst:578 msgid "Added the ``style`` parameter." msgstr "新增 ``style`` 參數。" -#: ../../howto/logging.rst:580 +#: ../../howto/logging.rst:581 msgid "" "The following message format string will log the time in a human-readable " "format, the severity of the message, and the contents of the message, in " "that order::" msgstr "" -#: ../../howto/logging.rst:584 +#: ../../howto/logging.rst:585 msgid "'%(asctime)s - %(levelname)s - %(message)s'" msgstr "" -#: ../../howto/logging.rst:586 +#: ../../howto/logging.rst:587 msgid "" "Formatters use a user-configurable function to convert the creation time of " "a record to a tuple. By default, :func:`time.localtime` is used; to change " @@ -909,40 +909,40 @@ msgid "" "in the Formatter class (to ``time.gmtime`` for GMT display)." msgstr "" -#: ../../howto/logging.rst:596 +#: ../../howto/logging.rst:597 msgid "Configuring Logging" msgstr "" -#: ../../howto/logging.rst:600 +#: ../../howto/logging.rst:601 msgid "Programmers can configure logging in three ways:" msgstr "" -#: ../../howto/logging.rst:602 +#: ../../howto/logging.rst:603 msgid "" "Creating loggers, handlers, and formatters explicitly using Python code that " "calls the configuration methods listed above." msgstr "" -#: ../../howto/logging.rst:604 +#: ../../howto/logging.rst:605 msgid "" "Creating a logging config file and reading it using the :func:`fileConfig` " "function." msgstr "" -#: ../../howto/logging.rst:606 +#: ../../howto/logging.rst:607 msgid "" "Creating a dictionary of configuration information and passing it to the :" "func:`dictConfig` function." msgstr "" -#: ../../howto/logging.rst:609 +#: ../../howto/logging.rst:610 msgid "" "For the reference documentation on the last two options, see :ref:`logging-" "config-api`. The following example configures a very simple logger, a " "console handler, and a simple formatter using Python code::" msgstr "" -#: ../../howto/logging.rst:613 +#: ../../howto/logging.rst:614 msgid "" "import logging\n" "\n" @@ -972,12 +972,12 @@ msgid "" "logger.critical('critical message')" msgstr "" -#: ../../howto/logging.rst:639 +#: ../../howto/logging.rst:640 msgid "" "Running this module from the command line produces the following output:" msgstr "" -#: ../../howto/logging.rst:641 +#: ../../howto/logging.rst:642 msgid "" "$ python simple_logging_module.py\n" "2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message\n" @@ -987,14 +987,14 @@ msgid "" "2005-03-19 15:10:26,773 - simple_example - CRITICAL - critical message" msgstr "" -#: ../../howto/logging.rst:650 +#: ../../howto/logging.rst:651 msgid "" "The following Python module creates a logger, handler, and formatter nearly " "identical to those in the example listed above, with the only difference " "being the names of the objects::" msgstr "" -#: ../../howto/logging.rst:654 +#: ../../howto/logging.rst:655 msgid "" "import logging\n" "import logging.config\n" @@ -1012,11 +1012,11 @@ msgid "" "logger.critical('critical message')" msgstr "" -#: ../../howto/logging.rst:669 +#: ../../howto/logging.rst:670 msgid "Here is the logging.conf file:" msgstr "" -#: ../../howto/logging.rst:671 +#: ../../howto/logging.rst:672 msgid "" "[loggers]\n" "keys=root,simpleExample\n" @@ -1047,12 +1047,12 @@ msgid "" "format=%(asctime)s - %(name)s - %(levelname)s - %(message)s" msgstr "" -#: ../../howto/logging.rst:701 +#: ../../howto/logging.rst:702 msgid "" "The output is nearly identical to that of the non-config-file-based example:" msgstr "" -#: ../../howto/logging.rst:703 +#: ../../howto/logging.rst:704 msgid "" "$ python simple_logging_config.py\n" "2005-03-19 15:38:55,977 - simpleExample - DEBUG - debug message\n" @@ -1062,14 +1062,14 @@ msgid "" "2005-03-19 15:38:56,130 - simpleExample - CRITICAL - critical message" msgstr "" -#: ../../howto/logging.rst:712 +#: ../../howto/logging.rst:713 msgid "" "You can see that the config file approach has a few advantages over the " "Python code approach, mainly separation of configuration and code and the " "ability of noncoders to easily modify the logging properties." msgstr "" -#: ../../howto/logging.rst:716 +#: ../../howto/logging.rst:717 msgid "" "The :func:`fileConfig` function takes a default parameter, " "``disable_existing_loggers``, which defaults to ``True`` for reasons of " @@ -1080,7 +1080,7 @@ msgid "" "information, and specify ``False`` for this parameter if you wish." msgstr "" -#: ../../howto/logging.rst:724 +#: ../../howto/logging.rst:725 msgid "" "The dictionary passed to :func:`dictConfig` can also specify a Boolean value " "with key ``disable_existing_loggers``, which if not specified explicitly in " @@ -1089,7 +1089,7 @@ msgid "" "want - in which case, provide the key explicitly with a value of ``False``." msgstr "" -#: ../../howto/logging.rst:734 +#: ../../howto/logging.rst:735 msgid "" "Note that the class names referenced in config files need to be either " "relative to the logging module, or absolute values which can be resolved " @@ -1100,7 +1100,7 @@ msgid "" "path)." msgstr "" -#: ../../howto/logging.rst:742 +#: ../../howto/logging.rst:743 msgid "" "In Python 3.2, a new means of configuring logging has been introduced, using " "dictionaries to hold configuration information. This provides a superset of " @@ -1115,13 +1115,13 @@ msgid "" "a socket, or use whatever approach makes sense for your application." msgstr "" -#: ../../howto/logging.rst:754 +#: ../../howto/logging.rst:755 msgid "" "Here's an example of the same configuration as above, in YAML format for the " "new dictionary-based approach:" msgstr "" -#: ../../howto/logging.rst:757 +#: ../../howto/logging.rst:758 msgid "" "version: 1\n" "formatters:\n" @@ -1143,24 +1143,24 @@ msgid "" " handlers: [console]" msgstr "" -#: ../../howto/logging.rst:778 +#: ../../howto/logging.rst:779 msgid "" "For more information about logging using a dictionary, see :ref:`logging-" "config-api`." msgstr "" -#: ../../howto/logging.rst:782 +#: ../../howto/logging.rst:783 msgid "What happens if no configuration is provided" msgstr "" -#: ../../howto/logging.rst:784 +#: ../../howto/logging.rst:785 msgid "" "If no logging configuration is provided, it is possible to have a situation " "where a logging event needs to be output, but no handlers can be found to " "output the event." msgstr "" -#: ../../howto/logging.rst:788 +#: ../../howto/logging.rst:789 msgid "" "The event is output using a 'handler of last resort', stored in :data:" "`lastResort`. This internal handler is not associated with any logger, and " @@ -1172,32 +1172,32 @@ msgid "" "severities will be output." msgstr "" -#: ../../howto/logging.rst:799 +#: ../../howto/logging.rst:800 msgid "For versions of Python prior to 3.2, the behaviour is as follows:" msgstr "" -#: ../../howto/logging.rst:801 +#: ../../howto/logging.rst:802 msgid "" "If :data:`raiseExceptions` is ``False`` (production mode), the event is " "silently dropped." msgstr "" -#: ../../howto/logging.rst:804 +#: ../../howto/logging.rst:805 msgid "" "If :data:`raiseExceptions` is ``True`` (development mode), a message 'No " "handlers could be found for logger X.Y.Z' is printed once." msgstr "" -#: ../../howto/logging.rst:807 +#: ../../howto/logging.rst:808 msgid "" "To obtain the pre-3.2 behaviour, :data:`lastResort` can be set to ``None``." msgstr "" -#: ../../howto/logging.rst:813 +#: ../../howto/logging.rst:814 msgid "Configuring Logging for a Library" msgstr "" -#: ../../howto/logging.rst:815 +#: ../../howto/logging.rst:816 msgid "" "When developing a library which uses logging, you should take care to " "document how the library uses logging - for example, the names of loggers " @@ -1208,7 +1208,7 @@ msgid "" "is regarded as the best default behaviour." msgstr "" -#: ../../howto/logging.rst:823 +#: ../../howto/logging.rst:824 msgid "" "If for some reason you *don't* want these messages printed in the absence of " "any logging configuration, you can attach a do-nothing handler to the top-" @@ -1220,7 +1220,7 @@ msgid "" "to those handlers, as normal." msgstr "" -#: ../../howto/logging.rst:832 +#: ../../howto/logging.rst:833 msgid "" "A do-nothing handler is included in the logging package: :class:`~logging." "NullHandler` (since Python 3.1). An instance of this handler could be added " @@ -1231,20 +1231,20 @@ msgid "" "etc. then the code::" msgstr "" -#: ../../howto/logging.rst:840 +#: ../../howto/logging.rst:841 msgid "" "import logging\n" "logging.getLogger('foo').addHandler(logging.NullHandler())" msgstr "" -#: ../../howto/logging.rst:843 +#: ../../howto/logging.rst:844 msgid "" "should have the desired effect. If an organisation produces a number of " "libraries, then the logger name specified can be 'orgname.foo' rather than " "just 'foo'." msgstr "" -#: ../../howto/logging.rst:847 +#: ../../howto/logging.rst:848 msgid "" "It is strongly advised that you *do not log to the root logger* in your " "library. Instead, use a logger with a unique and easily identifiable name, " @@ -1254,7 +1254,7 @@ msgid "" "library as they wish." msgstr "" -#: ../../howto/logging.rst:854 +#: ../../howto/logging.rst:855 msgid "" "It is strongly advised that you *do not add any handlers other than* :class:" "`~logging.NullHandler` *to your library's loggers*. This is because the " @@ -1265,11 +1265,11 @@ msgid "" "carry out unit tests and deliver logs which suit their requirements." msgstr "" -#: ../../howto/logging.rst:865 +#: ../../howto/logging.rst:866 msgid "Logging Levels" msgstr "" -#: ../../howto/logging.rst:867 +#: ../../howto/logging.rst:868 msgid "" "The numeric values of logging levels are given in the following table. These " "are primarily of interest if you want to define your own levels, and need " @@ -1278,39 +1278,39 @@ msgid "" "value; the predefined name is lost." msgstr "" -#: ../../howto/logging.rst:874 +#: ../../howto/logging.rst:875 msgid "Numeric value" msgstr "" -#: ../../howto/logging.rst:876 +#: ../../howto/logging.rst:877 msgid "50" msgstr "50" -#: ../../howto/logging.rst:878 +#: ../../howto/logging.rst:879 msgid "40" msgstr "40" -#: ../../howto/logging.rst:880 +#: ../../howto/logging.rst:881 msgid "30" msgstr "30" -#: ../../howto/logging.rst:882 +#: ../../howto/logging.rst:883 msgid "20" msgstr "20" -#: ../../howto/logging.rst:884 +#: ../../howto/logging.rst:885 msgid "10" msgstr "10" -#: ../../howto/logging.rst:886 +#: ../../howto/logging.rst:887 msgid "``NOTSET``" msgstr "``NOTSET``" -#: ../../howto/logging.rst:886 +#: ../../howto/logging.rst:887 msgid "0" msgstr "0" -#: ../../howto/logging.rst:889 +#: ../../howto/logging.rst:890 msgid "" "Levels can also be associated with loggers, being set either by the " "developer or through loading a saved logging configuration. When a logging " @@ -1320,14 +1320,14 @@ msgid "" "basic mechanism controlling the verbosity of logging output." msgstr "" -#: ../../howto/logging.rst:896 +#: ../../howto/logging.rst:897 msgid "" "Logging messages are encoded as instances of the :class:`~logging.LogRecord` " "class. When a logger decides to actually log an event, a :class:`~logging." "LogRecord` instance is created from the logging message." msgstr "" -#: ../../howto/logging.rst:900 +#: ../../howto/logging.rst:901 msgid "" "Logging messages are subjected to a dispatch mechanism through the use of :" "dfn:`handlers`, which are instances of subclasses of the :class:`Handler` " @@ -1344,7 +1344,7 @@ msgid "" "at which point the passing to ancestor handlers stops)." msgstr "" -#: ../../howto/logging.rst:914 +#: ../../howto/logging.rst:915 msgid "" "Just as for loggers, handlers can have levels associated with them. A " "handler's level acts as a filter in the same way as a logger's level does. " @@ -1354,11 +1354,11 @@ msgid "" "`~Handler.emit`." msgstr "" -#: ../../howto/logging.rst:923 +#: ../../howto/logging.rst:924 msgid "Custom Levels" msgstr "" -#: ../../howto/logging.rst:925 +#: ../../howto/logging.rst:926 msgid "" "Defining your own levels is possible, but should not be necessary, as the " "existing levels have been chosen on the basis of practical experience. " @@ -1371,27 +1371,27 @@ msgid "" "given numeric value might mean different things for different libraries." msgstr "" -#: ../../howto/logging.rst:938 +#: ../../howto/logging.rst:939 msgid "Useful Handlers" msgstr "" -#: ../../howto/logging.rst:940 +#: ../../howto/logging.rst:941 msgid "" "In addition to the base :class:`Handler` class, many useful subclasses are " "provided:" msgstr "" -#: ../../howto/logging.rst:943 +#: ../../howto/logging.rst:944 msgid "" ":class:`StreamHandler` instances send messages to streams (file-like " "objects)." msgstr "" -#: ../../howto/logging.rst:946 +#: ../../howto/logging.rst:947 msgid ":class:`FileHandler` instances send messages to disk files." msgstr "" -#: ../../howto/logging.rst:948 +#: ../../howto/logging.rst:949 msgid "" ":class:`~handlers.BaseRotatingHandler` is the base class for handlers that " "rotate log files at a certain point. It is not meant to be instantiated " @@ -1399,61 +1399,61 @@ msgid "" "`~handlers.TimedRotatingFileHandler`." msgstr "" -#: ../../howto/logging.rst:953 +#: ../../howto/logging.rst:954 msgid "" ":class:`~handlers.RotatingFileHandler` instances send messages to disk " "files, with support for maximum log file sizes and log file rotation." msgstr "" -#: ../../howto/logging.rst:956 +#: ../../howto/logging.rst:957 msgid "" ":class:`~handlers.TimedRotatingFileHandler` instances send messages to disk " "files, rotating the log file at certain timed intervals." msgstr "" -#: ../../howto/logging.rst:959 +#: ../../howto/logging.rst:960 msgid "" ":class:`~handlers.SocketHandler` instances send messages to TCP/IP sockets. " "Since 3.4, Unix domain sockets are also supported." msgstr "" -#: ../../howto/logging.rst:962 +#: ../../howto/logging.rst:963 msgid "" ":class:`~handlers.DatagramHandler` instances send messages to UDP sockets. " "Since 3.4, Unix domain sockets are also supported." msgstr "" -#: ../../howto/logging.rst:965 +#: ../../howto/logging.rst:966 msgid "" ":class:`~handlers.SMTPHandler` instances send messages to a designated email " "address." msgstr "" -#: ../../howto/logging.rst:968 +#: ../../howto/logging.rst:969 msgid "" ":class:`~handlers.SysLogHandler` instances send messages to a Unix syslog " "daemon, possibly on a remote machine." msgstr "" -#: ../../howto/logging.rst:971 +#: ../../howto/logging.rst:972 msgid "" ":class:`~handlers.NTEventLogHandler` instances send messages to a Windows " "NT/2000/XP event log." msgstr "" -#: ../../howto/logging.rst:974 +#: ../../howto/logging.rst:975 msgid "" ":class:`~handlers.MemoryHandler` instances send messages to a buffer in " "memory, which is flushed whenever specific criteria are met." msgstr "" -#: ../../howto/logging.rst:977 +#: ../../howto/logging.rst:978 msgid "" ":class:`~handlers.HTTPHandler` instances send messages to an HTTP server " "using either ``GET`` or ``POST`` semantics." msgstr "" -#: ../../howto/logging.rst:980 +#: ../../howto/logging.rst:981 msgid "" ":class:`~handlers.WatchedFileHandler` instances watch the file they are " "logging to. If the file changes, it is closed and reopened using the file " @@ -1461,13 +1461,13 @@ msgid "" "support the underlying mechanism used." msgstr "" -#: ../../howto/logging.rst:985 +#: ../../howto/logging.rst:986 msgid "" ":class:`~handlers.QueueHandler` instances send messages to a queue, such as " "those implemented in the :mod:`queue` or :mod:`multiprocessing` modules." msgstr "" -#: ../../howto/logging.rst:988 +#: ../../howto/logging.rst:989 msgid "" ":class:`NullHandler` instances do nothing with error messages. They are used " "by library developers who want to use logging, but want to avoid the 'No " @@ -1476,15 +1476,15 @@ msgid "" "more information." msgstr "" -#: ../../howto/logging.rst:994 +#: ../../howto/logging.rst:995 msgid "The :class:`NullHandler` class." msgstr "" -#: ../../howto/logging.rst:997 +#: ../../howto/logging.rst:998 msgid "The :class:`~handlers.QueueHandler` class." msgstr "" -#: ../../howto/logging.rst:1000 +#: ../../howto/logging.rst:1001 msgid "" "The :class:`NullHandler`, :class:`StreamHandler` and :class:`FileHandler` " "classes are defined in the core logging package. The other handlers are " @@ -1492,14 +1492,14 @@ msgid "" "module, :mod:`logging.config`, for configuration functionality.)" msgstr "" -#: ../../howto/logging.rst:1005 +#: ../../howto/logging.rst:1006 msgid "" "Logged messages are formatted for presentation through instances of the :" "class:`Formatter` class. They are initialized with a format string suitable " "for use with the % operator and a dictionary." msgstr "" -#: ../../howto/logging.rst:1009 +#: ../../howto/logging.rst:1010 msgid "" "For formatting multiple messages in a batch, instances of :class:" "`BufferingFormatter` can be used. In addition to the format string (which is " @@ -1507,7 +1507,7 @@ msgid "" "trailer format strings." msgstr "" -#: ../../howto/logging.rst:1014 +#: ../../howto/logging.rst:1015 msgid "" "When filtering based on logger level and/or handler level is not enough, " "instances of :class:`Filter` can be added to both :class:`Logger` and :class:" @@ -1517,18 +1517,18 @@ msgid "" "value, the message is not processed further." msgstr "" -#: ../../howto/logging.rst:1021 +#: ../../howto/logging.rst:1022 msgid "" "The basic :class:`Filter` functionality allows filtering by specific logger " "name. If this feature is used, messages sent to the named logger and its " "children are allowed through the filter, and all others dropped." msgstr "" -#: ../../howto/logging.rst:1029 +#: ../../howto/logging.rst:1030 msgid "Exceptions raised during logging" msgstr "" -#: ../../howto/logging.rst:1031 +#: ../../howto/logging.rst:1032 msgid "" "The logging package is designed to swallow exceptions which occur while " "logging in production. This is so that errors which occur while handling " @@ -1536,7 +1536,7 @@ msgid "" "errors - do not cause the application using logging to terminate prematurely." msgstr "" -#: ../../howto/logging.rst:1036 +#: ../../howto/logging.rst:1037 msgid "" ":class:`SystemExit` and :class:`KeyboardInterrupt` exceptions are never " "swallowed. Other exceptions which occur during the :meth:`~Handler.emit` " @@ -1544,7 +1544,7 @@ msgid "" "handleError` method." msgstr "" -#: ../../howto/logging.rst:1041 +#: ../../howto/logging.rst:1042 msgid "" "The default implementation of :meth:`~Handler.handleError` in :class:" "`Handler` checks to see if a module-level variable, :data:`raiseExceptions`, " @@ -1552,7 +1552,7 @@ msgid "" "the exception is swallowed." msgstr "" -#: ../../howto/logging.rst:1047 +#: ../../howto/logging.rst:1048 msgid "" "The default value of :data:`raiseExceptions` is ``True``. This is because " "during development, you typically want to be notified of any exceptions that " @@ -1560,11 +1560,11 @@ msgid "" "production usage." msgstr "" -#: ../../howto/logging.rst:1057 +#: ../../howto/logging.rst:1058 msgid "Using arbitrary objects as messages" msgstr "" -#: ../../howto/logging.rst:1059 +#: ../../howto/logging.rst:1060 msgid "" "In the preceding sections and examples, it has been assumed that the message " "passed when logging the event is a string. However, this is not the only " @@ -1576,11 +1576,11 @@ msgid "" "the wire." msgstr "" -#: ../../howto/logging.rst:1070 +#: ../../howto/logging.rst:1071 msgid "Optimization" msgstr "最佳化" -#: ../../howto/logging.rst:1072 +#: ../../howto/logging.rst:1073 msgid "" "Formatting of message arguments is deferred until it cannot be avoided. " "However, computing the arguments passed to the logging method can also be " @@ -1591,20 +1591,20 @@ msgid "" "code like this::" msgstr "" -#: ../../howto/logging.rst:1080 +#: ../../howto/logging.rst:1081 msgid "" "if logger.isEnabledFor(logging.DEBUG):\n" " logger.debug('Message with %s, %s', expensive_func1(),\n" " expensive_func2())" msgstr "" -#: ../../howto/logging.rst:1084 +#: ../../howto/logging.rst:1085 msgid "" "so that if the logger's threshold is set above ``DEBUG``, the calls to " "``expensive_func1`` and ``expensive_func2`` are never made." msgstr "" -#: ../../howto/logging.rst:1087 +#: ../../howto/logging.rst:1088 msgid "" "In some cases, :meth:`~Logger.isEnabledFor` can itself be more expensive " "than you'd like (e.g. for deeply nested loggers where an explicit level is " @@ -1616,7 +1616,7 @@ msgid "" "while the application is running (which is not all that common)." msgstr "" -#: ../../howto/logging.rst:1096 +#: ../../howto/logging.rst:1097 msgid "" "There are other optimizations which can be made for specific applications " "which need more precise control over what logging information is collected. " @@ -1624,94 +1624,94 @@ msgid "" "you don't need:" msgstr "" -#: ../../howto/logging.rst:1102 +#: ../../howto/logging.rst:1103 msgid "What you don't want to collect" msgstr "" -#: ../../howto/logging.rst:1102 +#: ../../howto/logging.rst:1103 msgid "How to avoid collecting it" msgstr "" -#: ../../howto/logging.rst:1104 +#: ../../howto/logging.rst:1105 msgid "Information about where calls were made from." msgstr "" -#: ../../howto/logging.rst:1104 +#: ../../howto/logging.rst:1105 msgid "" "Set ``logging._srcfile`` to ``None``. This avoids calling :func:`sys." "_getframe`, which may help to speed up your code in environments like PyPy " "(which can't speed up code that uses :func:`sys._getframe`)." msgstr "" -#: ../../howto/logging.rst:1110 +#: ../../howto/logging.rst:1111 msgid "Threading information." msgstr "" -#: ../../howto/logging.rst:1110 +#: ../../howto/logging.rst:1111 msgid "Set ``logging.logThreads`` to ``False``." msgstr "將 ``logging.logThreads`` 設為 ``False``。" -#: ../../howto/logging.rst:1112 +#: ../../howto/logging.rst:1113 msgid "Current process ID (:func:`os.getpid`)" msgstr "當前的行程 ID (:func:`os.getpid`)" -#: ../../howto/logging.rst:1112 +#: ../../howto/logging.rst:1113 msgid "Set ``logging.logProcesses`` to ``False``." msgstr "將 ``logging.logProcesses`` 設為 ``False``。" -#: ../../howto/logging.rst:1114 +#: ../../howto/logging.rst:1115 msgid "" "Current process name when using ``multiprocessing`` to manage multiple " "processes." msgstr "" -#: ../../howto/logging.rst:1114 +#: ../../howto/logging.rst:1115 msgid "Set ``logging.logMultiprocessing`` to ``False``." msgstr "將 ``logging.logMultiprocessing`` 設為 ``False``。" -#: ../../howto/logging.rst:1117 +#: ../../howto/logging.rst:1118 msgid "Current :class:`asyncio.Task` name when using ``asyncio``." msgstr "" -#: ../../howto/logging.rst:1117 +#: ../../howto/logging.rst:1118 msgid "Set ``logging.logAsyncioTasks`` to ``False``." msgstr "將 ``logging.logAsyncioTasks`` 設為 ``False``。" -#: ../../howto/logging.rst:1121 +#: ../../howto/logging.rst:1122 msgid "" "Also note that the core logging module only includes the basic handlers. If " "you don't import :mod:`logging.handlers` and :mod:`logging.config`, they " "won't take up any memory." msgstr "" -#: ../../howto/logging.rst:1128 +#: ../../howto/logging.rst:1129 msgid "Other resources" msgstr "其他資源" -#: ../../howto/logging.rst:1132 +#: ../../howto/logging.rst:1133 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../howto/logging.rst:1133 +#: ../../howto/logging.rst:1134 msgid "API reference for the logging module." msgstr "" -#: ../../howto/logging.rst:1135 +#: ../../howto/logging.rst:1136 msgid "Module :mod:`logging.config`" msgstr ":mod:`logging.config` 模組" -#: ../../howto/logging.rst:1136 +#: ../../howto/logging.rst:1137 msgid "Configuration API for the logging module." msgstr "" -#: ../../howto/logging.rst:1138 +#: ../../howto/logging.rst:1139 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../howto/logging.rst:1139 +#: ../../howto/logging.rst:1140 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../howto/logging.rst:1141 +#: ../../howto/logging.rst:1142 msgid ":ref:`A logging cookbook `" msgstr "" diff --git a/howto/mro.po b/howto/mro.po index e5b77714fe..ac73681c25 100644 --- a/howto/mro.po +++ b/howto/mro.po @@ -5,9 +5,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -527,7 +527,7 @@ msgstr "" msgid "" "A lazy programmer can obtain the MRO directly from Python 2.2, since in this " "case it coincides with the Python 2.3 linearization. It is enough to invoke " -"the .mro() method of class A:" +"the :meth:`~type.mro` method of class A:" msgstr "" #: ../../howto/mro.rst:345 diff --git a/howto/perf_profiling.po b/howto/perf_profiling.po index 88ead417c7..d89ee4250b 100644 --- a/howto/perf_profiling.po +++ b/howto/perf_profiling.po @@ -5,9 +5,9 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-12-09 17:39+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -403,10 +403,10 @@ msgstr "例如,使用環境變數: ::" #: ../../howto/perf_profiling.rst:165 msgid "" -"$ PYTHONPERFSUPPORT=1 python script.py\n" +"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python script.py\n" "$ perf report -g -i perf.data" msgstr "" -"$ PYTHONPERFSUPPORT=1 python script.py\n" +"$ PYTHONPERFSUPPORT=1 perf record -F 9999 -g -o perf.data python script.py\n" "$ perf report -g -i perf.data" #: ../../howto/perf_profiling.rst:168 @@ -415,10 +415,10 @@ msgstr "例如,使用 :option:`!-X` 選項: ::" #: ../../howto/perf_profiling.rst:170 msgid "" -"$ python -X perf script.py\n" +"$ perf record -F 9999 -g -o perf.data python -X perf script.py\n" "$ perf report -g -i perf.data" msgstr "" -"$ python -X perf script.py\n" +"$ perf record -F 9999 -g -o perf.data python -X perf script.py\n" "$ perf report -g -i perf.data" #: ../../howto/perf_profiling.rst:173 @@ -449,10 +449,10 @@ msgstr "...然後: ::" #: ../../howto/perf_profiling.rst:187 msgid "" -"$ python ./example.py\n" +"$ perf record -F 9999 -g -o perf.data python ./example.py\n" "$ perf report -g -i perf.data" msgstr "" -"$ python ./example.py\n" +"$ perf record -F 9999 -g -o perf.data python ./example.py\n" "$ perf report -g -i perf.data" #: ../../howto/perf_profiling.rst:192 @@ -490,3 +490,97 @@ msgid "" msgstr "" "如果你沒有看到任何輸出,則表示你的直譯器尚未使用 frame 指標進行編譯,因此它可" "能無法在 ``perf`` 的輸出中顯示 Python 函式。" + +#: ../../howto/perf_profiling.rst:211 +msgid "How to work without frame pointers" +msgstr "" + +#: ../../howto/perf_profiling.rst:213 +msgid "" +"If you are working with a Python interpreter that has been compiled without " +"frame pointers, you can still use the ``perf`` profiler, but the overhead " +"will be a bit higher because Python needs to generate unwinding information " +"for every Python function call on the fly. Additionally, ``perf`` will take " +"more time to process the data because it will need to use the DWARF " +"debugging information to unwind the stack and this is a slow process." +msgstr "" + +#: ../../howto/perf_profiling.rst:220 +msgid "" +"To enable this mode, you can use the environment variable :envvar:" +"`PYTHON_PERF_JIT_SUPPORT` or the :option:`-X perf_jit <-X>` option, which " +"will enable the JIT mode for the ``perf`` profiler." +msgstr "" + +#: ../../howto/perf_profiling.rst:226 +msgid "" +"Due to a bug in the ``perf`` tool, only ``perf`` versions higher than v6.8 " +"will work with the JIT mode. The fix was also backported to the v6.7.2 " +"version of the tool." +msgstr "" + +#: ../../howto/perf_profiling.rst:230 +msgid "" +"Note that when checking the version of the ``perf`` tool (which can be done " +"by running ``perf version``) you must take into account that some distros " +"add some custom version numbers including a ``-`` character. This means " +"that ``perf 6.7-3`` is not necessarily ``perf 6.7.3``." +msgstr "" + +#: ../../howto/perf_profiling.rst:235 +msgid "" +"When using the perf JIT mode, you need an extra step before you can run " +"``perf report``. You need to call the ``perf inject`` command to inject the " +"JIT information into the ``perf.data`` file.::" +msgstr "" + +#: ../../howto/perf_profiling.rst:239 +msgid "" +"$ perf record -F 9999 -g --call-graph dwarf -o perf.data python -Xperf_jit " +"my_script.py\n" +"$ perf inject -i perf.data --jit --output perf.jit.data\n" +"$ perf report -g -i perf.jit.data" +msgstr "" +"$ perf record -F 9999 -g --call-graph dwarf -o perf.data python -Xperf_jit " +"my_script.py\n" +"$ perf inject -i perf.data --jit --output perf.jit.data\n" +"$ perf report -g -i perf.jit.data" + +#: ../../howto/perf_profiling.rst:243 +msgid "or using the environment variable::" +msgstr "或使用環境變數: ::" + +#: ../../howto/perf_profiling.rst:245 +msgid "" +"$ PYTHON_PERF_JIT_SUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o " +"perf.data python my_script.py\n" +"$ perf inject -i perf.data --jit --output perf.jit.data\n" +"$ perf report -g -i perf.jit.data" +msgstr "" +"$ PYTHON_PERF_JIT_SUPPORT=1 perf record -F 9999 -g --call-graph dwarf -o " +"perf.data python my_script.py\n" +"$ perf inject -i perf.data --jit --output perf.jit.data\n" +"$ perf report -g -i perf.jit.data" + +#: ../../howto/perf_profiling.rst:249 +msgid "" +"``perf inject --jit`` command will read ``perf.data``, automatically pick up " +"the perf dump file that Python creates (in ``/tmp/perf-$PID.dump``), and " +"then create ``perf.jit.data`` which merges all the JIT information together. " +"It should also create a lot of ``jitted-XXXX-N.so`` files in the current " +"directory which are ELF images for all the JIT trampolines that were created " +"by Python." +msgstr "" + +#: ../../howto/perf_profiling.rst:257 +msgid "" +"Notice that when using ``--call-graph dwarf`` the ``perf`` tool will take " +"snapshots of the stack of the process being profiled and save the " +"information in the ``perf.data`` file. By default the size of the stack dump " +"is 8192 bytes but the user can change the size by passing the size after " +"comma like ``--call-graph dwarf,4096``. The size of the stack dump is " +"important because if the size is too small ``perf`` will not be able to " +"unwind the stack and the output will be incomplete. On the other hand, if " +"the size is too big, then ``perf`` won't be able to sample the process as " +"frequently as it would like as the overhead will be higher." +msgstr "" diff --git a/howto/pyporting.po b/howto/pyporting.po index 4184ecf0de..61899804cc 100644 --- a/howto/pyporting.po +++ b/howto/pyporting.po @@ -6,7 +6,7 @@ # jerrychen , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-31 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" diff --git a/howto/regex.po b/howto/regex.po index 9253bffef6..a3c0d480c8 100644 --- a/howto/regex.po +++ b/howto/regex.po @@ -7,7 +7,7 @@ # CTHua , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-02-24 16:01+0800\n" "PO-Revision-Date: 2023-03-26 18:25+0000\n" diff --git a/howto/sorting.po b/howto/sorting.po index cf6833970c..f8846e6300 100644 --- a/howto/sorting.po +++ b/howto/sorting.po @@ -5,7 +5,7 @@ # Ching-Lung Chuang, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-08-12 15:09+0800\n" diff --git a/howto/timerfd.po b/howto/timerfd.po new file mode 100644 index 0000000000..27b4768a58 --- /dev/null +++ b/howto/timerfd.po @@ -0,0 +1,285 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../howto/timerfd.rst:5 +msgid "timer file descriptor HOWTO" +msgstr "" + +#: ../../howto/timerfd.rst:0 +msgid "Release" +msgstr "" + +#: ../../howto/timerfd.rst:7 +msgid "1.13" +msgstr "" + +#: ../../howto/timerfd.rst:9 +msgid "" +"This HOWTO discusses Python's support for the linux timer file descriptor." +msgstr "" + +#: ../../howto/timerfd.rst:13 +msgid "Examples" +msgstr "" + +#: ../../howto/timerfd.rst:15 +msgid "" +"The following example shows how to use a timer file descriptor to execute a " +"function twice a second:" +msgstr "" + +#: ../../howto/timerfd.rst:18 +msgid "" +"# Practical scripts should use really use a non-blocking timer,\n" +"# we use a blocking timer here for simplicity.\n" +"import os, time\n" +"\n" +"# Create the timer file descriptor\n" +"fd = os.timerfd_create(time.CLOCK_REALTIME)\n" +"\n" +"# Start the timer in 1 second, with an interval of half a second\n" +"os.timerfd_settime(fd, initial=1, interval=0.5)\n" +"\n" +"try:\n" +" # Process timer events four times.\n" +" for _ in range(4):\n" +" # read() will block until the timer expires\n" +" _ = os.read(fd, 8)\n" +" print(\"Timer expired\")\n" +"finally:\n" +" # Remember to close the timer file descriptor!\n" +" os.close(fd)" +msgstr "" + +#: ../../howto/timerfd.rst:40 +msgid "" +"To avoid the precision loss caused by the :class:`float` type, timer file " +"descriptors allow specifying initial expiration and interval in integer " +"nanoseconds with ``_ns`` variants of the functions." +msgstr "" + +#: ../../howto/timerfd.rst:44 +msgid "" +"This example shows how :func:`~select.epoll` can be used with timer file " +"descriptors to wait until the file descriptor is ready for reading:" +msgstr "" + +#: ../../howto/timerfd.rst:47 +msgid "" +"import os, time, select, socket, sys\n" +"\n" +"# Create an epoll object\n" +"ep = select.epoll()\n" +"\n" +"# In this example, use loopback address to send \"stop\" command to the " +"server.\n" +"#\n" +"# $ telnet 127.0.0.1 1234\n" +"# Trying 127.0.0.1...\n" +"# Connected to 127.0.0.1.\n" +"# Escape character is '^]'.\n" +"# stop\n" +"# Connection closed by foreign host.\n" +"#\n" +"sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"sock.bind((\"127.0.0.1\", 1234))\n" +"sock.setblocking(False)\n" +"sock.listen(1)\n" +"ep.register(sock, select.EPOLLIN)\n" +"\n" +"# Create timer file descriptors in non-blocking mode.\n" +"num = 3\n" +"fds = []\n" +"for _ in range(num):\n" +" fd = os.timerfd_create(time.CLOCK_REALTIME, flags=os.TFD_NONBLOCK)\n" +" fds.append(fd)\n" +" # Register the timer file descriptor for read events\n" +" ep.register(fd, select.EPOLLIN)\n" +"\n" +"# Start the timer with os.timerfd_settime_ns() in nanoseconds.\n" +"# Timer 1 fires every 0.25 seconds; timer 2 every 0.5 seconds; etc\n" +"for i, fd in enumerate(fds, start=1):\n" +" one_sec_in_nsec = 10**9\n" +" i = i * one_sec_in_nsec\n" +" os.timerfd_settime_ns(fd, initial=i//4, interval=i//4)\n" +"\n" +"timeout = 3\n" +"try:\n" +" conn = None\n" +" is_active = True\n" +" while is_active:\n" +" # Wait for the timer to expire for 3 seconds.\n" +" # epoll.poll() returns a list of (fd, event) pairs.\n" +" # fd is a file descriptor.\n" +" # sock and conn[=returned value of socket.accept()] are socket " +"objects, not file descriptors.\n" +" # So use sock.fileno() and conn.fileno() to get the file " +"descriptors.\n" +" events = ep.poll(timeout)\n" +"\n" +" # If more than one timer file descriptors are ready for reading at " +"once,\n" +" # epoll.poll() returns a list of (fd, event) pairs.\n" +" #\n" +" # In this example settings,\n" +" # 1st timer fires every 0.25 seconds in 0.25 seconds. (0.25, 0.5, " +"0.75, 1.0, ...)\n" +" # 2nd timer every 0.5 seconds in 0.5 seconds. (0.5, 1.0, 1.5, " +"2.0, ...)\n" +" # 3rd timer every 0.75 seconds in 0.75 seconds. (0.75, 1.5, 2.25, " +"3.0, ...)\n" +" #\n" +" # In 0.25 seconds, only 1st timer fires.\n" +" # In 0.5 seconds, 1st timer and 2nd timer fires at once.\n" +" # In 0.75 seconds, 1st timer and 3rd timer fires at once.\n" +" # In 1.5 seconds, 1st timer, 2nd timer and 3rd timer fires at " +"once.\n" +" #\n" +" # If a timer file descriptor is signaled more than once since\n" +" # the last os.read() call, os.read() returns the number of signaled\n" +" # as host order of class bytes.\n" +" print(f\"Signaled events={events}\")\n" +" for fd, event in events:\n" +" if event & select.EPOLLIN:\n" +" if fd == sock.fileno():\n" +" # Check if there is a connection request.\n" +" print(f\"Accepting connection {fd}\")\n" +" conn, addr = sock.accept()\n" +" conn.setblocking(False)\n" +" print(f\"Accepted connection {conn} from {addr}\")\n" +" ep.register(conn, select.EPOLLIN)\n" +" elif conn and fd == conn.fileno():\n" +" # Check if there is data to read.\n" +" print(f\"Reading data {fd}\")\n" +" data = conn.recv(1024)\n" +" if data:\n" +" # You should catch UnicodeDecodeError exception for " +"safety.\n" +" cmd = data.decode()\n" +" if cmd.startswith(\"stop\"):\n" +" print(f\"Stopping server\")\n" +" is_active = False\n" +" else:\n" +" print(f\"Unknown command: {cmd}\")\n" +" else:\n" +" # No more data, close connection\n" +" print(f\"Closing connection {fd}\")\n" +" ep.unregister(conn)\n" +" conn.close()\n" +" conn = None\n" +" elif fd in fds:\n" +" print(f\"Reading timer {fd}\")\n" +" count = int.from_bytes(os.read(fd, 8), byteorder=sys." +"byteorder)\n" +" print(f\"Timer {fds.index(fd) + 1} expired {count} " +"times\")\n" +" else:\n" +" print(f\"Unknown file descriptor {fd}\")\n" +"finally:\n" +" for fd in fds:\n" +" ep.unregister(fd)\n" +" os.close(fd)\n" +" ep.close()" +msgstr "" + +#: ../../howto/timerfd.rst:153 +msgid "" +"This example shows how :func:`~select.select` can be used with timer file " +"descriptors to wait until the file descriptor is ready for reading:" +msgstr "" + +#: ../../howto/timerfd.rst:156 +msgid "" +"import os, time, select, socket, sys\n" +"\n" +"# In this example, use loopback address to send \"stop\" command to the " +"server.\n" +"#\n" +"# $ telnet 127.0.0.1 1234\n" +"# Trying 127.0.0.1...\n" +"# Connected to 127.0.0.1.\n" +"# Escape character is '^]'.\n" +"# stop\n" +"# Connection closed by foreign host.\n" +"#\n" +"sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" +"sock.bind((\"127.0.0.1\", 1234))\n" +"sock.setblocking(False)\n" +"sock.listen(1)\n" +"\n" +"# Create timer file descriptors in non-blocking mode.\n" +"num = 3\n" +"fds = [os.timerfd_create(time.CLOCK_REALTIME, flags=os.TFD_NONBLOCK)\n" +" for _ in range(num)]\n" +"select_fds = fds + [sock]\n" +"\n" +"# Start the timers with os.timerfd_settime() in seconds.\n" +"# Timer 1 fires every 0.25 seconds; timer 2 every 0.5 seconds; etc\n" +"for i, fd in enumerate(fds, start=1):\n" +" os.timerfd_settime(fd, initial=i/4, interval=i/4)\n" +"\n" +"timeout = 3\n" +"try:\n" +" conn = None\n" +" is_active = True\n" +" while is_active:\n" +" # Wait for the timer to expire for 3 seconds.\n" +" # select.select() returns a list of file descriptors or objects.\n" +" rfd, wfd, xfd = select.select(select_fds, select_fds, select_fds, " +"timeout)\n" +" for fd in rfd:\n" +" if fd == sock:\n" +" # Check if there is a connection request.\n" +" print(f\"Accepting connection {fd}\")\n" +" conn, addr = sock.accept()\n" +" conn.setblocking(False)\n" +" print(f\"Accepted connection {conn} from {addr}\")\n" +" select_fds.append(conn)\n" +" elif conn and fd == conn:\n" +" # Check if there is data to read.\n" +" print(f\"Reading data {fd}\")\n" +" data = conn.recv(1024)\n" +" if data:\n" +" # You should catch UnicodeDecodeError exception for " +"safety.\n" +" cmd = data.decode()\n" +" if cmd.startswith(\"stop\"):\n" +" print(f\"Stopping server\")\n" +" is_active = False\n" +" else:\n" +" print(f\"Unknown command: {cmd}\")\n" +" else:\n" +" # No more data, close connection\n" +" print(f\"Closing connection {fd}\")\n" +" select_fds.remove(conn)\n" +" conn.close()\n" +" conn = None\n" +" elif fd in fds:\n" +" print(f\"Reading timer {fd}\")\n" +" count = int.from_bytes(os.read(fd, 8), byteorder=sys." +"byteorder)\n" +" print(f\"Timer {fds.index(fd) + 1} expired {count} times\")\n" +" else:\n" +" print(f\"Unknown file descriptor {fd}\")\n" +"finally:\n" +" for fd in fds:\n" +" os.close(fd)\n" +" sock.close()\n" +" sock = None" +msgstr "" diff --git a/howto/unicode.po b/howto/unicode.po index eaeca2e421..b7b29e8cd1 100644 --- a/howto/unicode.po +++ b/howto/unicode.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:37+0000\n" diff --git a/howto/urllib2.po b/howto/urllib2.po index a625f8a466..4e79e88dd9 100644 --- a/howto/urllib2.po +++ b/howto/urllib2.po @@ -5,7 +5,7 @@ # Phate , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-06-27 09:36+0800\n" diff --git a/includes/wasm-notavail.po b/includes/wasm-notavail.po index e08d6b73d8..0dad50cab5 100644 --- a/includes/wasm-notavail.po +++ b/includes/wasm-notavail.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-02-13 00:17+0000\n" "PO-Revision-Date: 2022-10-16 07:40+0800\n" diff --git a/installing/index.po b/installing/index.po index 322ff93627..30e461df88 100644 --- a/installing/index.po +++ b/installing/index.po @@ -8,7 +8,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-06-27 09:37+0800\n" diff --git a/library/2to3.po b/library/2to3.po deleted file mode 100644 index 407aa22b5b..0000000000 --- a/library/2to3.po +++ /dev/null @@ -1,706 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -# jerrychen , 2016 -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2018-05-23 14:37+0000\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/2to3.rst:4 -msgid "2to3 --- Automated Python 2 to 3 code translation" -msgstr "2to3 --- 自動將 Python 2的程式碼轉成 Python 3" - -#: ../../library/2to3.rst:8 -msgid "" -"2to3 is a Python program that reads Python 2.x source code and applies a " -"series of *fixers* to transform it into valid Python 3.x code. The standard " -"library contains a rich set of fixers that will handle almost all code. " -"2to3 supporting library :mod:`lib2to3` is, however, a flexible and generic " -"library, so it is possible to write your own fixers for 2to3." -msgstr "" - -#: ../../library/2to3.rst:14 -msgid "" -"The ``lib2to3`` module was marked pending for deprecation in Python 3.9 " -"(raising :exc:`PendingDeprecationWarning` on import) and fully deprecated in " -"Python 3.11 (raising :exc:`DeprecationWarning`). The ``2to3`` tool is part " -"of that. It will be removed in Python 3.13." -msgstr "" - -#: ../../library/2to3.rst:23 -msgid "Using 2to3" -msgstr "使用 2to3" - -#: ../../library/2to3.rst:25 -msgid "" -"2to3 will usually be installed with the Python interpreter as a script. It " -"is also located in the :file:`Tools/scripts` directory of the Python root." -msgstr "" - -#: ../../library/2to3.rst:28 -msgid "" -"2to3's basic arguments are a list of files or directories to transform. The " -"directories are recursively traversed for Python sources." -msgstr "" - -#: ../../library/2to3.rst:31 -msgid "Here is a sample Python 2.x source file, :file:`example.py`::" -msgstr "這邊有簡單的 Python 2的原始檔案 :file:`example.py`::" - -#: ../../library/2to3.rst:33 -msgid "" -"def greet(name):\n" -" print \"Hello, {0}!\".format(name)\n" -"print \"What's your name?\"\n" -"name = raw_input()\n" -"greet(name)" -msgstr "" - -#: ../../library/2to3.rst:39 -msgid "It can be converted to Python 3.x code via 2to3 on the command line:" -msgstr "" - -#: ../../library/2to3.rst:41 -msgid "$ 2to3 example.py" -msgstr "$ 2to3 example.py" - -#: ../../library/2to3.rst:45 -msgid "" -"A diff against the original source file is printed. 2to3 can also write the " -"needed modifications right back to the source file. (A backup of the " -"original file is made unless :option:`!-n` is also given.) Writing the " -"changes back is enabled with the :option:`!-w` flag:" -msgstr "" - -#: ../../library/2to3.rst:50 -msgid "$ 2to3 -w example.py" -msgstr "$ 2to3 -w example.py" - -#: ../../library/2to3.rst:54 -msgid "After transformation, :file:`example.py` looks like this::" -msgstr "" - -#: ../../library/2to3.rst:56 -msgid "" -"def greet(name):\n" -" print(\"Hello, {0}!\".format(name))\n" -"print(\"What's your name?\")\n" -"name = input()\n" -"greet(name)" -msgstr "" - -#: ../../library/2to3.rst:62 -msgid "" -"Comments and exact indentation are preserved throughout the translation " -"process." -msgstr "" - -#: ../../library/2to3.rst:64 -msgid "" -"By default, 2to3 runs a set of :ref:`predefined fixers <2to3-fixers>`. The :" -"option:`!-l` flag lists all available fixers. An explicit set of fixers to " -"run can be given with :option:`!-f`. Likewise the :option:`!-x` explicitly " -"disables a fixer. The following example runs only the ``imports`` and " -"``has_key`` fixers:" -msgstr "" - -#: ../../library/2to3.rst:69 -msgid "$ 2to3 -f imports -f has_key example.py" -msgstr "$ 2to3 -f imports -f has_key example.py" - -#: ../../library/2to3.rst:73 -msgid "This command runs every fixer except the ``apply`` fixer:" -msgstr "" - -#: ../../library/2to3.rst:75 -msgid "$ 2to3 -x apply example.py" -msgstr "$ 2to3 -x apply example.py" - -#: ../../library/2to3.rst:79 -msgid "" -"Some fixers are *explicit*, meaning they aren't run by default and must be " -"listed on the command line to be run. Here, in addition to the default " -"fixers, the ``idioms`` fixer is run:" -msgstr "" - -#: ../../library/2to3.rst:83 -msgid "$ 2to3 -f all -f idioms example.py" -msgstr "$ 2to3 -f all -f idioms example.py" - -#: ../../library/2to3.rst:87 -msgid "Notice how passing ``all`` enables all default fixers." -msgstr "" - -#: ../../library/2to3.rst:89 -msgid "" -"Sometimes 2to3 will find a place in your source code that needs to be " -"changed, but 2to3 cannot fix automatically. In this case, 2to3 will print a " -"warning beneath the diff for a file. You should address the warning in " -"order to have compliant 3.x code." -msgstr "" - -#: ../../library/2to3.rst:94 -msgid "" -"2to3 can also refactor doctests. To enable this mode, use the :option:`!-d` " -"flag. Note that *only* doctests will be refactored. This also doesn't " -"require the module to be valid Python. For example, doctest like examples " -"in a reST document could also be refactored with this option." -msgstr "" - -#: ../../library/2to3.rst:99 -msgid "" -"The :option:`!-v` option enables output of more information on the " -"translation process." -msgstr "" - -#: ../../library/2to3.rst:102 -msgid "" -"Since some print statements can be parsed as function calls or statements, " -"2to3 cannot always read files containing the print function. When 2to3 " -"detects the presence of the ``from __future__ import print_function`` " -"compiler directive, it modifies its internal grammar to interpret :func:" -"`print` as a function. This change can also be enabled manually with the :" -"option:`!-p` flag. Use :option:`!-p` to run fixers on code that already has " -"had its print statements converted. Also :option:`!-e` can be used to make :" -"func:`exec` a function." -msgstr "" - -#: ../../library/2to3.rst:110 -msgid "" -"The :option:`!-o` or :option:`!--output-dir` option allows specification of " -"an alternate directory for processed output files to be written to. The :" -"option:`!-n` flag is required when using this as backup files do not make " -"sense when not overwriting the input files." -msgstr "" - -#: ../../library/2to3.rst:115 -msgid "The :option:`!-o` option was added." -msgstr "新增 :option:`!-o` 選項。" - -#: ../../library/2to3.rst:118 -msgid "" -"The :option:`!-W` or :option:`!--write-unchanged-files` flag tells 2to3 to " -"always write output files even if no changes were required to the file. " -"This is most useful with :option:`!-o` so that an entire Python source tree " -"is copied with translation from one directory to another. This option " -"implies the :option:`!-w` flag as it would not make sense otherwise." -msgstr "" - -#: ../../library/2to3.rst:124 -msgid "The :option:`!-W` flag was added." -msgstr "" - -#: ../../library/2to3.rst:127 -msgid "" -"The :option:`!--add-suffix` option specifies a string to append to all " -"output filenames. The :option:`!-n` flag is required when specifying this " -"as backups are not necessary when writing to different filenames. Example:" -msgstr "" - -#: ../../library/2to3.rst:131 -msgid "$ 2to3 -n -W --add-suffix=3 example.py" -msgstr "$ 2to3 -n -W --add-suffix=3 example.py" - -#: ../../library/2to3.rst:135 -msgid "Will cause a converted file named ``example.py3`` to be written." -msgstr "" - -#: ../../library/2to3.rst:137 -msgid "The :option:`!--add-suffix` option was added." -msgstr "" - -#: ../../library/2to3.rst:140 -msgid "To translate an entire project from one directory tree to another use:" -msgstr "" - -#: ../../library/2to3.rst:142 -msgid "$ 2to3 --output-dir=python3-version/mycode -W -n python2-version/mycode" -msgstr "" -"$ 2to3 --output-dir=python3-version/mycode -W -n python2-version/mycode" - -#: ../../library/2to3.rst:150 -msgid "Fixers" -msgstr "" - -#: ../../library/2to3.rst:152 -msgid "" -"Each step of transforming code is encapsulated in a fixer. The command " -"``2to3 -l`` lists them. As :ref:`documented above <2to3-using>`, each can " -"be turned on and off individually. They are described here in more detail." -msgstr "" - -#: ../../library/2to3.rst:159 -msgid "" -"Removes usage of :func:`apply`. For example ``apply(function, *args, " -"**kwargs)`` is converted to ``function(*args, **kwargs)``." -msgstr "" - -#: ../../library/2to3.rst:164 -msgid "Replaces deprecated :mod:`unittest` method names with the correct ones." -msgstr "" - -#: ../../library/2to3.rst:167 ../../library/2to3.rst:356 -msgid "From" -msgstr "從" - -#: ../../library/2to3.rst:167 ../../library/2to3.rst:356 -msgid "To" -msgstr "到" - -#: ../../library/2to3.rst:169 -msgid "``failUnlessEqual(a, b)``" -msgstr "``failUnlessEqual(a, b)``" - -#: ../../library/2to3.rst:169 ../../library/2to3.rst:171 -msgid ":meth:`assertEqual(a, b) `" -msgstr ":meth:`assertEqual(a, b) `" - -#: ../../library/2to3.rst:171 -msgid "``assertEquals(a, b)``" -msgstr "``assertEquals(a, b)``" - -#: ../../library/2to3.rst:173 -msgid "``failIfEqual(a, b)``" -msgstr "``failIfEqual(a, b)``" - -#: ../../library/2to3.rst:173 ../../library/2to3.rst:175 -msgid ":meth:`assertNotEqual(a, b) `" -msgstr ":meth:`assertNotEqual(a, b) `" - -#: ../../library/2to3.rst:175 -msgid "``assertNotEquals(a, b)``" -msgstr "``assertNotEquals(a, b)``" - -#: ../../library/2to3.rst:177 -msgid "``failUnless(a)``" -msgstr "``failUnless(a)``" - -#: ../../library/2to3.rst:177 ../../library/2to3.rst:179 -msgid ":meth:`assertTrue(a) `" -msgstr ":meth:`assertTrue(a) `" - -#: ../../library/2to3.rst:179 -msgid "``assert_(a)``" -msgstr "``assert_(a)``" - -#: ../../library/2to3.rst:181 -msgid "``failIf(a)``" -msgstr "``failIf(a)``" - -#: ../../library/2to3.rst:181 -msgid ":meth:`assertFalse(a) `" -msgstr ":meth:`assertFalse(a) `" - -#: ../../library/2to3.rst:183 -msgid "``failUnlessRaises(exc, cal)``" -msgstr "``failUnlessRaises(exc, cal)``" - -#: ../../library/2to3.rst:183 -msgid ":meth:`assertRaises(exc, cal) `" -msgstr ":meth:`assertRaises(exc, cal) `" - -#: ../../library/2to3.rst:185 -msgid "``failUnlessAlmostEqual(a, b)``" -msgstr "``failUnlessAlmostEqual(a, b)``" - -#: ../../library/2to3.rst:185 ../../library/2to3.rst:187 -msgid ":meth:`assertAlmostEqual(a, b) `" -msgstr ":meth:`assertAlmostEqual(a, b) `" - -#: ../../library/2to3.rst:187 -msgid "``assertAlmostEquals(a, b)``" -msgstr "``assertAlmostEquals(a, b)``" - -#: ../../library/2to3.rst:189 -msgid "``failIfAlmostEqual(a, b)``" -msgstr "``failIfAlmostEqual(a, b)``" - -#: ../../library/2to3.rst:189 ../../library/2to3.rst:191 -msgid "" -":meth:`assertNotAlmostEqual(a, b) `" -msgstr "" - -#: ../../library/2to3.rst:191 -msgid "``assertNotAlmostEquals(a, b)``" -msgstr "``assertNotAlmostEquals(a, b)``" - -#: ../../library/2to3.rst:197 -msgid "Converts :class:`basestring` to :class:`str`." -msgstr "" - -#: ../../library/2to3.rst:201 -msgid "" -"Converts :class:`buffer` to :class:`memoryview`. This fixer is optional " -"because the :class:`memoryview` API is similar but not exactly the same as " -"that of :class:`buffer`." -msgstr "" - -#: ../../library/2to3.rst:207 -msgid "" -"Fixes dictionary iteration methods. :meth:`dict.iteritems` is converted to :" -"meth:`dict.items`, :meth:`dict.iterkeys` to :meth:`dict.keys`, and :meth:" -"`dict.itervalues` to :meth:`dict.values`. Similarly, :meth:`dict." -"viewitems`, :meth:`dict.viewkeys` and :meth:`dict.viewvalues` are converted " -"respectively to :meth:`dict.items`, :meth:`dict.keys` and :meth:`dict." -"values`. It also wraps existing usages of :meth:`dict.items`, :meth:`dict." -"keys`, and :meth:`dict.values` in a call to :class:`list`." -msgstr "" - -#: ../../library/2to3.rst:217 -msgid "Converts ``except X, T`` to ``except X as T``." -msgstr "" - -#: ../../library/2to3.rst:221 -msgid "Converts the ``exec`` statement to the :func:`exec` function." -msgstr "" - -#: ../../library/2to3.rst:225 -msgid "" -"Removes usage of :func:`execfile`. The argument to :func:`execfile` is " -"wrapped in calls to :func:`open`, :func:`compile`, and :func:`exec`." -msgstr "" - -#: ../../library/2to3.rst:230 -msgid "" -"Changes assignment of :attr:`sys.exitfunc` to use of the :mod:`atexit` " -"module." -msgstr "" - -#: ../../library/2to3.rst:235 -msgid "Wraps :func:`filter` usage in a :class:`list` call." -msgstr "" - -#: ../../library/2to3.rst:239 -msgid "" -"Fixes function attributes that have been renamed. For example, " -"``my_function.func_closure`` is converted to ``my_function.__closure__``." -msgstr "" - -#: ../../library/2to3.rst:244 -msgid "Removes ``from __future__ import new_feature`` statements." -msgstr "" - -#: ../../library/2to3.rst:248 -msgid "Renames :func:`os.getcwdu` to :func:`os.getcwd`." -msgstr "" - -#: ../../library/2to3.rst:252 -msgid "Changes ``dict.has_key(key)`` to ``key in dict``." -msgstr "" - -#: ../../library/2to3.rst:256 -msgid "" -"This optional fixer performs several transformations that make Python code " -"more idiomatic. Type comparisons like ``type(x) is SomeClass`` and " -"``type(x) == SomeClass`` are converted to ``isinstance(x, SomeClass)``. " -"``while 1`` becomes ``while True``. This fixer also tries to make use of :" -"func:`sorted` in appropriate places. For example, this block ::" -msgstr "" - -#: ../../library/2to3.rst:262 -msgid "" -"L = list(some_iterable)\n" -"L.sort()" -msgstr "" -"L = list(some_iterable)\n" -"L.sort()" - -#: ../../library/2to3.rst:265 -msgid "is changed to ::" -msgstr "" - -#: ../../library/2to3.rst:267 -msgid "L = sorted(some_iterable)" -msgstr "L = sorted(some_iterable)" - -#: ../../library/2to3.rst:271 -msgid "Detects sibling imports and converts them to relative imports." -msgstr "" - -#: ../../library/2to3.rst:275 -msgid "Handles module renames in the standard library." -msgstr "" - -#: ../../library/2to3.rst:279 -msgid "" -"Handles other modules renames in the standard library. It is separate from " -"the :2to3fixer:`imports` fixer only because of technical limitations." -msgstr "" - -#: ../../library/2to3.rst:284 -msgid "Converts ``input(prompt)`` to ``eval(input(prompt))``." -msgstr "" - -#: ../../library/2to3.rst:288 -msgid "Converts :func:`intern` to :func:`sys.intern`." -msgstr "" - -#: ../../library/2to3.rst:292 -msgid "" -"Fixes duplicate types in the second argument of :func:`isinstance`. For " -"example, ``isinstance(x, (int, int))`` is converted to ``isinstance(x, " -"int)`` and ``isinstance(x, (int, float, int))`` is converted to " -"``isinstance(x, (int, float))``." -msgstr "" - -#: ../../library/2to3.rst:299 -msgid "" -"Removes imports of :func:`itertools.ifilter`, :func:`itertools.izip`, and :" -"func:`itertools.imap`. Imports of :func:`itertools.ifilterfalse` are also " -"changed to :func:`itertools.filterfalse`." -msgstr "" - -#: ../../library/2to3.rst:305 -msgid "" -"Changes usage of :func:`itertools.ifilter`, :func:`itertools.izip`, and :" -"func:`itertools.imap` to their built-in equivalents. :func:`itertools." -"ifilterfalse` is changed to :func:`itertools.filterfalse`." -msgstr "" - -#: ../../library/2to3.rst:311 -msgid "Renames :class:`long` to :class:`int`." -msgstr "" - -#: ../../library/2to3.rst:315 -msgid "" -"Wraps :func:`map` in a :class:`list` call. It also changes ``map(None, x)`` " -"to ``list(x)``. Using ``from future_builtins import map`` disables this " -"fixer." -msgstr "" - -#: ../../library/2to3.rst:321 -msgid "" -"Converts the old metaclass syntax (``__metaclass__ = Meta`` in the class " -"body) to the new (``class X(metaclass=Meta)``)." -msgstr "" - -#: ../../library/2to3.rst:326 -msgid "" -"Fixes old method attribute names. For example, ``meth.im_func`` is " -"converted to ``meth.__func__``." -msgstr "" - -#: ../../library/2to3.rst:331 -msgid "Converts the old not-equal syntax, ``<>``, to ``!=``." -msgstr "" - -#: ../../library/2to3.rst:335 -msgid "" -"Converts the use of iterator's :meth:`~iterator.next` methods to the :func:" -"`next` function. It also renames :meth:`next` methods to :meth:`~iterator." -"__next__`." -msgstr "" - -#: ../../library/2to3.rst:341 -msgid "" -"Renames definitions of methods called :meth:`__nonzero__` to :meth:`~object." -"__bool__`." -msgstr "" - -#: ../../library/2to3.rst:346 -msgid "Converts octal literals into the new syntax." -msgstr "" - -#: ../../library/2to3.rst:350 -msgid "" -"Converts calls to various functions in the :mod:`operator` module to other, " -"but equivalent, function calls. When needed, the appropriate ``import`` " -"statements are added, e.g. ``import collections.abc``. The following " -"mapping are made:" -msgstr "" - -#: ../../library/2to3.rst:358 -msgid "``operator.isCallable(obj)``" -msgstr "``operator.isCallable(obj)``" - -#: ../../library/2to3.rst:358 -msgid "``callable(obj)``" -msgstr "``callable(obj)``" - -#: ../../library/2to3.rst:359 -msgid "``operator.sequenceIncludes(obj)``" -msgstr "``operator.sequenceIncludes(obj)``" - -#: ../../library/2to3.rst:359 -msgid "``operator.contains(obj)``" -msgstr "``operator.contains(obj)``" - -#: ../../library/2to3.rst:360 -msgid "``operator.isSequenceType(obj)``" -msgstr "``operator.isSequenceType(obj)``" - -#: ../../library/2to3.rst:360 -msgid "``isinstance(obj, collections.abc.Sequence)``" -msgstr "``isinstance(obj, collections.abc.Sequence)``" - -#: ../../library/2to3.rst:361 -msgid "``operator.isMappingType(obj)``" -msgstr "``operator.isMappingType(obj)``" - -#: ../../library/2to3.rst:361 -msgid "``isinstance(obj, collections.abc.Mapping)``" -msgstr "``isinstance(obj, collections.abc.Mapping)``" - -#: ../../library/2to3.rst:362 -msgid "``operator.isNumberType(obj)``" -msgstr "``operator.isNumberType(obj)``" - -#: ../../library/2to3.rst:362 -msgid "``isinstance(obj, numbers.Number)``" -msgstr "``isinstance(obj, numbers.Number)``" - -#: ../../library/2to3.rst:363 -msgid "``operator.repeat(obj, n)``" -msgstr "``operator.repeat(obj, n)``" - -#: ../../library/2to3.rst:363 -msgid "``operator.mul(obj, n)``" -msgstr "``operator.mul(obj, n)``" - -#: ../../library/2to3.rst:364 -msgid "``operator.irepeat(obj, n)``" -msgstr "``operator.irepeat(obj, n)``" - -#: ../../library/2to3.rst:364 -msgid "``operator.imul(obj, n)``" -msgstr "``operator.imul(obj, n)``" - -#: ../../library/2to3.rst:369 -msgid "" -"Add extra parenthesis where they are required in list comprehensions. For " -"example, ``[x for x in 1, 2]`` becomes ``[x for x in (1, 2)]``." -msgstr "" - -#: ../../library/2to3.rst:374 -msgid "Converts the ``print`` statement to the :func:`print` function." -msgstr "" - -#: ../../library/2to3.rst:378 -msgid "" -"Converts ``raise E, V`` to ``raise E(V)``, and ``raise E, V, T`` to ``raise " -"E(V).with_traceback(T)``. If ``E`` is a tuple, the translation will be " -"incorrect because substituting tuples for exceptions has been removed in 3.0." -msgstr "" - -#: ../../library/2to3.rst:384 -msgid "Converts :func:`raw_input` to :func:`input`." -msgstr "" - -#: ../../library/2to3.rst:388 -msgid "Handles the move of :func:`reduce` to :func:`functools.reduce`." -msgstr "" - -#: ../../library/2to3.rst:392 -msgid "Converts :func:`reload` to :func:`importlib.reload`." -msgstr "" - -#: ../../library/2to3.rst:396 -msgid "Changes :data:`sys.maxint` to :data:`sys.maxsize`." -msgstr "" - -#: ../../library/2to3.rst:400 -msgid "Replaces backtick repr with the :func:`repr` function." -msgstr "" - -#: ../../library/2to3.rst:404 -msgid "" -"Replaces use of the :class:`set` constructor with set literals. This fixer " -"is optional." -msgstr "" - -#: ../../library/2to3.rst:409 -msgid "Renames :exc:`StandardError` to :exc:`Exception`." -msgstr "" - -#: ../../library/2to3.rst:413 -msgid "" -"Changes the deprecated :data:`sys.exc_value`, :data:`sys.exc_type`, :data:" -"`sys.exc_traceback` to use :func:`sys.exc_info`." -msgstr "" - -#: ../../library/2to3.rst:418 -msgid "Fixes the API change in generator's :meth:`throw` method." -msgstr "" - -#: ../../library/2to3.rst:422 -msgid "" -"Removes implicit tuple parameter unpacking. This fixer inserts temporary " -"variables." -msgstr "" - -#: ../../library/2to3.rst:427 -msgid "" -"Fixes code broken from the removal of some members in the :mod:`types` " -"module." -msgstr "" - -#: ../../library/2to3.rst:432 -msgid "Renames :class:`unicode` to :class:`str`." -msgstr "" - -#: ../../library/2to3.rst:436 -msgid "" -"Handles the rename of :mod:`urllib` and :mod:`urllib2` to the :mod:`urllib` " -"package." -msgstr "" - -#: ../../library/2to3.rst:441 -msgid "" -"Removes excess whitespace from comma separated items. This fixer is " -"optional." -msgstr "" - -#: ../../library/2to3.rst:446 -msgid "" -"Renames :func:`xrange` to :func:`range` and wraps existing :func:`range` " -"calls with :class:`list`." -msgstr "" - -#: ../../library/2to3.rst:451 -msgid "Changes ``for x in file.xreadlines()`` to ``for x in file``." -msgstr "" - -#: ../../library/2to3.rst:455 -msgid "" -"Wraps :func:`zip` usage in a :class:`list` call. This is disabled when " -"``from future_builtins import zip`` appears." -msgstr "" - -#: ../../library/2to3.rst:460 -msgid ":mod:`lib2to3` --- 2to3's library" -msgstr "" - -#: ../../library/2to3.rst:469 -msgid "**Source code:** :source:`Lib/lib2to3/`" -msgstr "**原始碼:**\\ :source:`Lib/lib2to3/`" - -#: ../../library/2to3.rst:473 -msgid "" -"Python 3.9 switched to a PEG parser (see :pep:`617`) while lib2to3 is using " -"a less flexible LL(1) parser. Python 3.10 includes new language syntax that " -"is not parsable by lib2to3's LL(1) parser (see :pep:`634`). The ``lib2to3`` " -"module was marked pending for deprecation in Python 3.9 (raising :exc:" -"`PendingDeprecationWarning` on import) and fully deprecated in Python 3.11 " -"(raising :exc:`DeprecationWarning`). It will be removed from the standard " -"library in Python 3.13. Consider third-party alternatives such as `LibCST`_ " -"or `parso`_." -msgstr "" - -#: ../../library/2to3.rst:485 -msgid "" -"The :mod:`lib2to3` API should be considered unstable and may change " -"drastically in the future." -msgstr "" diff --git a/library/__future__.po b/library/__future__.po index 5e55c54fc2..6c9b5f80bd 100644 --- a/library/__future__.po +++ b/library/__future__.po @@ -5,7 +5,7 @@ # Matt Wang , 2023-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-02-06 02:12+0000\n" diff --git a/library/__main__.po b/library/__main__.po index 6bf15fc1e9..ff81f21bf6 100644 --- a/library/__main__.po +++ b/library/__main__.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-12-21 14:49+0800\n" diff --git a/library/_thread.po b/library/_thread.po index e2b4e567be..c36a47a237 100644 --- a/library/_thread.po +++ b/library/_thread.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -173,14 +173,19 @@ msgstr "" "系統重新使用)。" #: ../../library/_thread.rst:123 +#, fuzzy msgid "" ":ref:`Availability `: Windows, FreeBSD, Linux, macOS, OpenBSD, " -"NetBSD, AIX, DragonFlyBSD." +"NetBSD, AIX, DragonFlyBSD, GNU/kFreeBSD." msgstr "" ":ref:`適用 `:Windows、FreeBSD、Linux、macOS、OpenBSD、NetBSD、" "AIX、DragonFlyBSD。" -#: ../../library/_thread.rst:130 +#: ../../library/_thread.rst:127 +msgid "Added support for GNU/kFreeBSD." +msgstr "" + +#: ../../library/_thread.rst:133 msgid "" "Return the thread stack size used when creating new threads. The optional " "*size* argument specifies the stack size to be used for subsequently created " @@ -208,15 +213,15 @@ msgstr "" "分配。應參考平台文檔以獲取更多訊息(4 KiB 頁面是比較普遍的;在缺乏更具體訊息" "的情況下,建議使用 4096 的倍數作為堆疊大小)。" -#: ../../library/_thread.rst:145 +#: ../../library/_thread.rst:148 msgid ":ref:`Availability `: Windows, pthreads." -msgstr ":ref:`適用 `:Windows, pthreads。" +msgstr ":ref:`適用 `:Windows、pthreads。" -#: ../../library/_thread.rst:147 +#: ../../library/_thread.rst:150 msgid "Unix platforms with POSIX threads support." msgstr "Unix 平台上支援 POSIX 執行緒。" -#: ../../library/_thread.rst:152 +#: ../../library/_thread.rst:155 msgid "" "The maximum value allowed for the *timeout* parameter of :meth:`Lock.acquire " "`. Specifying a timeout greater than this value will " @@ -225,11 +230,11 @@ msgstr "" ":meth:`Lock.acquire ` 的 *timeout* 參數所允許的最大" "值。指定超過此值的 timeout 將引發 :exc:`OverflowError` 錯誤。" -#: ../../library/_thread.rst:159 +#: ../../library/_thread.rst:162 msgid "Lock objects have the following methods:" msgstr "鎖物件具有以下方法:" -#: ../../library/_thread.rst:164 +#: ../../library/_thread.rst:167 msgid "" "Without any optional argument, this method acquires the lock " "unconditionally, if necessary waiting until it is released by another thread " @@ -239,7 +244,7 @@ msgstr "" "沒有任何可選引數時,此方法無條件地獲取鎖,必要時會等待直到被另一個執行緒釋放" "(一次只能有一個執行緒獲取鎖 --- 這正是鎖存在的原因)。" -#: ../../library/_thread.rst:168 +#: ../../library/_thread.rst:171 msgid "" "If the *blocking* argument is present, the action depends on its value: if " "it is false, the lock is only acquired if it can be acquired immediately " @@ -249,7 +254,7 @@ msgstr "" "如果存在 *blocking* 引數,則根據其值執行操作:如果為 False,只有在可以立即獲" "取鎖而無需等待的情況下才獲取鎖,而如果為 True,則像上面一樣無條件地獲取鎖。" -#: ../../library/_thread.rst:173 +#: ../../library/_thread.rst:176 msgid "" "If the floating-point *timeout* argument is present and positive, it " "specifies the maximum wait time in seconds before returning. A negative " @@ -260,40 +265,40 @@ msgstr "" "(以秒為單位)。如果 *timeout* 引數為負值,則表示等待時間會無限期地等待。如" "果 *blocking* 為 False,則你無法指定 *timeout*。" -#: ../../library/_thread.rst:178 +#: ../../library/_thread.rst:181 msgid "" "The return value is ``True`` if the lock is acquired successfully, ``False`` " "if not." msgstr "如果成功獲取鎖,回傳值為 ``True``,否則為 ``False``。" -#: ../../library/_thread.rst:181 +#: ../../library/_thread.rst:184 msgid "The *timeout* parameter is new." msgstr "新增的 *timeout* 參數。" -#: ../../library/_thread.rst:184 +#: ../../library/_thread.rst:187 msgid "Lock acquires can now be interrupted by signals on POSIX." msgstr "現在獲取鎖的操作可以被 POSIX 訊號中斷。" -#: ../../library/_thread.rst:190 +#: ../../library/_thread.rst:193 msgid "" "Releases the lock. The lock must have been acquired earlier, but not " "necessarily by the same thread." msgstr "釋放鎖。鎖必須先前被獲取,但不一定是由同一個執行緒獲取的。" -#: ../../library/_thread.rst:196 +#: ../../library/_thread.rst:199 msgid "" "Return the status of the lock: ``True`` if it has been acquired by some " "thread, ``False`` if not." msgstr "" "回傳鎖的狀態:如果鎖已被某個執行緒獲取,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/_thread.rst:199 +#: ../../library/_thread.rst:202 msgid "" "In addition to these methods, lock objects can also be used via the :keyword:" "`with` statement, e.g.::" msgstr "除了這些方法之外,鎖物件還可以透過 :keyword:`with` 語句來使用,例如:" -#: ../../library/_thread.rst:202 +#: ../../library/_thread.rst:205 msgid "" "import _thread\n" "\n" @@ -303,11 +308,11 @@ msgid "" " print(\"a_lock is locked while this executes\")" msgstr "" -#: ../../library/_thread.rst:209 +#: ../../library/_thread.rst:212 msgid "**Caveats:**" msgstr "**注意事項:**" -#: ../../library/_thread.rst:213 +#: ../../library/_thread.rst:216 msgid "" "Threads interact strangely with interrupts: the :exc:`KeyboardInterrupt` " "exception will be received by an arbitrary thread. (When the :mod:`signal` " @@ -317,7 +322,7 @@ msgstr "" "`KeyboardInterrupt` 例外。(當 :mod:`signal` 模組可用時,中斷總是會進入主執行" "緒。)" -#: ../../library/_thread.rst:217 +#: ../../library/_thread.rst:220 msgid "" "Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is " "equivalent to calling :func:`_thread.exit`." @@ -325,7 +330,7 @@ msgstr "" "呼叫 :func:`sys.exit` 函數或引發 :exc:`SystemExit` 例外等同於呼叫 :func:" "`_thread.exit` 函式。" -#: ../../library/_thread.rst:220 +#: ../../library/_thread.rst:223 msgid "" "It is not possible to interrupt the :meth:`~threading.Lock.acquire` method " "on a lock --- the :exc:`KeyboardInterrupt` exception will happen after the " @@ -334,7 +339,7 @@ msgstr "" "無法在鎖的 :meth:`~threading.Lock.acquire` 方法上中斷執行, :exc:" "`KeyboardInterrupt` 例外會在鎖被獲取後發生。" -#: ../../library/_thread.rst:224 +#: ../../library/_thread.rst:227 msgid "" "When the main thread exits, it is system defined whether the other threads " "survive. On most systems, they are killed without executing :keyword:" @@ -344,7 +349,7 @@ msgstr "" "終止,而不會執行 :keyword:`try` ... :keyword:`finally` 子句或執行物件的解構函" "式。" -#: ../../library/_thread.rst:229 +#: ../../library/_thread.rst:232 msgid "" "When the main thread exits, it does not do any of its usual cleanup (except " "that :keyword:`try` ... :keyword:`finally` clauses are honored), and the " @@ -381,10 +386,10 @@ msgstr "threads(執行緒)" msgid "POSIX" msgstr "POSIX" -#: ../../library/_thread.rst:211 +#: ../../library/_thread.rst:214 msgid "module" msgstr "module(模組)" -#: ../../library/_thread.rst:211 +#: ../../library/_thread.rst:214 msgid "signal" msgstr "signal(訊號)" diff --git a/library/abc.po b/library/abc.po index a28e811d5a..5d5dde6b3b 100644 --- a/library/abc.po +++ b/library/abc.po @@ -7,9 +7,9 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2022-11-16 03:29+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -187,12 +187,12 @@ msgid "" "Check whether *subclass* is considered a subclass of this ABC. This means " "that you can customize the behavior of :func:`issubclass` further without " "the need to call :meth:`register` on every class you want to consider a " -"subclass of the ABC. (This class method is called from the :meth:`~class." +"subclass of the ABC. (This class method is called from the :meth:`~type." "__subclasscheck__` method of the ABC.)" msgstr "" "檢查 *subclass* 是否該被認為是該 ABC 的子類別,也就是說你可以直接自訂 :func:" "`issubclass` 的行為,而不用對於那些你希望定義為該 ABC 的子類別的類別都個別呼" -"叫 :meth:`register` 方法。(這個類別方法是在 ABC 的 :meth:`~class." +"叫 :meth:`register` 方法。(這個類別方法是在 ABC 的 :meth:`~type." "__subclasscheck__` 方法中呼叫。)" #: ../../library/abc.rst:104 @@ -286,11 +286,11 @@ msgid "" "The :meth:`__subclasshook__` class method defined here says that any class " "that has an :meth:`~iterator.__iter__` method in its :attr:`~object." "__dict__` (or in that of one of its base classes, accessed via the :attr:" -"`~class.__mro__` list) is considered a ``MyIterable`` too." +"`~type.__mro__` list) is considered a ``MyIterable`` too." msgstr "" "這裡定義的 :meth:`__subclasshook__` 類別方法說明任何在其 :attr:`~object." -"__dict__` (或在其透過 :attr:`~class.__mro__` 列表訪問的基底類別) 中具有 :" -"meth:`~iterator.__iter__` 方法的類別也都會被視為 ``MyIterable``。" +"__dict__` (或在其透過 :attr:`~type.__mro__` 列表訪問的基底類別) 中具有 :meth:" +"`~iterator.__iter__` 方法的類別也都會被視為 ``MyIterable``。" #: ../../library/abc.rst:154 msgid "" diff --git a/library/aifc.po b/library/aifc.po deleted file mode 100644 index c7c6c1d8af..0000000000 --- a/library/aifc.po +++ /dev/null @@ -1,286 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" -"PO-Revision-Date: 2022-05-22 01:57+0800\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/aifc.rst:2 -msgid ":mod:`aifc` --- Read and write AIFF and AIFC files" -msgstr ":mod:`aifc` --- 讀寫 AIFF 與 AIFC 檔案" - -#: ../../library/aifc.rst:8 -msgid "**Source code:** :source:`Lib/aifc.py`" -msgstr "**原始碼:**\\ :source:`Lib/aifc.py`" - -#: ../../library/aifc.rst:16 -msgid "" -"The :mod:`aifc` module is deprecated (see :pep:`PEP 594 <594#aifc>` for " -"details)." -msgstr "" -":mod:`aifc` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#aifc>`\\ )。" - -#: ../../library/aifc.rst:22 -msgid "" -"This module provides support for reading and writing AIFF and AIFF-C files. " -"AIFF is Audio Interchange File Format, a format for storing digital audio " -"samples in a file. AIFF-C is a newer version of the format that includes " -"the ability to compress the audio data." -msgstr "" - -#: ../../library/aifc.rst:27 -msgid "" -"Audio files have a number of parameters that describe the audio data. The " -"sampling rate or frame rate is the number of times per second the sound is " -"sampled. The number of channels indicate if the audio is mono, stereo, or " -"quadro. Each frame consists of one sample per channel. The sample size is " -"the size in bytes of each sample. Thus a frame consists of ``nchannels * " -"samplesize`` bytes, and a second's worth of audio consists of ``nchannels * " -"samplesize * framerate`` bytes." -msgstr "" - -#: ../../library/aifc.rst:35 -msgid "" -"For example, CD quality audio has a sample size of two bytes (16 bits), uses " -"two channels (stereo) and has a frame rate of 44,100 frames/second. This " -"gives a frame size of 4 bytes (2\\*2), and a second's worth occupies " -"2\\*2\\*44100 bytes (176,400 bytes)." -msgstr "" - -#: ../../library/aifc.rst:40 -msgid "Module :mod:`aifc` defines the following function:" -msgstr ":mod:`aifc` 模組定義了以下函式:" - -#: ../../library/aifc.rst:45 -msgid "" -"Open an AIFF or AIFF-C file and return an object instance with methods that " -"are described below. The argument *file* is either a string naming a file " -"or a :term:`file object`. *mode* must be ``'r'`` or ``'rb'`` when the file " -"must be opened for reading, or ``'w'`` or ``'wb'`` when the file must be " -"opened for writing. If omitted, ``file.mode`` is used if it exists, " -"otherwise ``'rb'`` is used. When used for writing, the file object should " -"be seekable, unless you know ahead of time how many samples you are going to " -"write in total and use :meth:`writeframesraw` and :meth:`setnframes`. The :" -"func:`.open` function may be used in a :keyword:`with` statement. When the :" -"keyword:`!with` block completes, the :meth:`~aifc.close` method is called." -msgstr "" - -#: ../../library/aifc.rst:56 -msgid "Support for the :keyword:`with` statement was added." -msgstr "" - -#: ../../library/aifc.rst:59 -msgid "" -"Objects returned by :func:`.open` when a file is opened for reading have the " -"following methods:" -msgstr "" - -#: ../../library/aifc.rst:65 -msgid "Return the number of audio channels (1 for mono, 2 for stereo)." -msgstr "" - -#: ../../library/aifc.rst:70 -msgid "Return the size in bytes of individual samples." -msgstr "" - -#: ../../library/aifc.rst:75 -msgid "Return the sampling rate (number of audio frames per second)." -msgstr "" - -#: ../../library/aifc.rst:80 -msgid "Return the number of audio frames in the file." -msgstr "" - -#: ../../library/aifc.rst:85 -msgid "" -"Return a bytes array of length 4 describing the type of compression used in " -"the audio file. For AIFF files, the returned value is ``b'NONE'``." -msgstr "" - -#: ../../library/aifc.rst:92 -msgid "" -"Return a bytes array convertible to a human-readable description of the type " -"of compression used in the audio file. For AIFF files, the returned value " -"is ``b'not compressed'``." -msgstr "" - -#: ../../library/aifc.rst:99 -msgid "" -"Returns a :func:`~collections.namedtuple` ``(nchannels, sampwidth, " -"framerate, nframes, comptype, compname)``, equivalent to output of the :meth:" -"`get\\*` methods." -msgstr "" - -#: ../../library/aifc.rst:106 -msgid "" -"Return a list of markers in the audio file. A marker consists of a tuple of " -"three elements. The first is the mark ID (an integer), the second is the " -"mark position in frames from the beginning of the data (an integer), the " -"third is the name of the mark (a string)." -msgstr "" - -#: ../../library/aifc.rst:114 -msgid "" -"Return the tuple as described in :meth:`getmarkers` for the mark with the " -"given *id*." -msgstr "" - -#: ../../library/aifc.rst:120 -msgid "" -"Read and return the next *nframes* frames from the audio file. The returned " -"data is a string containing for each frame the uncompressed samples of all " -"channels." -msgstr "" - -#: ../../library/aifc.rst:127 -msgid "" -"Rewind the read pointer. The next :meth:`readframes` will start from the " -"beginning." -msgstr "" - -#: ../../library/aifc.rst:133 -msgid "Seek to the specified frame number." -msgstr "" - -#: ../../library/aifc.rst:138 -msgid "Return the current frame number." -msgstr "" - -#: ../../library/aifc.rst:143 -msgid "" -"Close the AIFF file. After calling this method, the object can no longer be " -"used." -msgstr "" - -#: ../../library/aifc.rst:146 -msgid "" -"Objects returned by :func:`.open` when a file is opened for writing have all " -"the above methods, except for :meth:`readframes` and :meth:`setpos`. In " -"addition the following methods exist. The :meth:`get\\*` methods can only " -"be called after the corresponding :meth:`set\\*` methods have been called. " -"Before the first :meth:`writeframes` or :meth:`writeframesraw`, all " -"parameters except for the number of frames must be filled in." -msgstr "" - -#: ../../library/aifc.rst:156 -msgid "" -"Create an AIFF file. The default is that an AIFF-C file is created, unless " -"the name of the file ends in ``'.aiff'`` in which case the default is an " -"AIFF file." -msgstr "" - -#: ../../library/aifc.rst:162 -msgid "" -"Create an AIFF-C file. The default is that an AIFF-C file is created, " -"unless the name of the file ends in ``'.aiff'`` in which case the default is " -"an AIFF file." -msgstr "" - -#: ../../library/aifc.rst:169 -msgid "Specify the number of channels in the audio file." -msgstr "" - -#: ../../library/aifc.rst:174 -msgid "Specify the size in bytes of audio samples." -msgstr "" - -#: ../../library/aifc.rst:179 -msgid "Specify the sampling frequency in frames per second." -msgstr "" - -#: ../../library/aifc.rst:184 -msgid "" -"Specify the number of frames that are to be written to the audio file. If " -"this parameter is not set, or not set correctly, the file needs to support " -"seeking." -msgstr "" - -#: ../../library/aifc.rst:195 -msgid "" -"Specify the compression type. If not specified, the audio data will not be " -"compressed. In AIFF files, compression is not possible. The name parameter " -"should be a human-readable description of the compression type as a bytes " -"array, the type parameter should be a bytes array of length 4. Currently " -"the following compression types are supported: ``b'NONE'``, ``b'ULAW'``, " -"``b'ALAW'``, ``b'G722'``." -msgstr "" - -#: ../../library/aifc.rst:205 -msgid "" -"Set all the above parameters at once. The argument is a tuple consisting of " -"the various parameters. This means that it is possible to use the result of " -"a :meth:`getparams` call as argument to :meth:`setparams`." -msgstr "" - -#: ../../library/aifc.rst:212 -msgid "" -"Add a mark with the given id (larger than 0), and the given name at the " -"given position. This method can be called at any time before :meth:`close`." -msgstr "" - -#: ../../library/aifc.rst:219 -msgid "" -"Return the current write position in the output file. Useful in combination " -"with :meth:`setmark`." -msgstr "" - -#: ../../library/aifc.rst:225 -msgid "" -"Write data to the output file. This method can only be called after the " -"audio file parameters have been set." -msgstr "" - -#: ../../library/aifc.rst:228 ../../library/aifc.rst:237 -msgid "Any :term:`bytes-like object` is now accepted." -msgstr "" - -#: ../../library/aifc.rst:234 -msgid "" -"Like :meth:`writeframes`, except that the header of the audio file is not " -"updated." -msgstr "" - -#: ../../library/aifc.rst:244 -msgid "" -"Close the AIFF file. The header of the file is updated to reflect the " -"actual size of the audio data. After calling this method, the object can no " -"longer be used." -msgstr "" - -#: ../../library/aifc.rst:10 -msgid "Audio Interchange File Format" -msgstr "Audio Interchange File Format(音訊交換檔案格式)" - -#: ../../library/aifc.rst:10 -msgid "AIFF" -msgstr "AIFF" - -#: ../../library/aifc.rst:10 -msgid "AIFF-C" -msgstr "AIFF-C" - -#: ../../library/aifc.rst:190 -msgid "u-LAW" -msgstr "u-LAW" - -#: ../../library/aifc.rst:190 -msgid "A-LAW" -msgstr "A-LAW" - -#: ../../library/aifc.rst:190 -msgid "G.722" -msgstr "G.722" diff --git a/library/allos.po b/library/allos.po index cad1734fed..59c9cddfde 100644 --- a/library/allos.po +++ b/library/allos.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-02-15 17:54+0800\n" diff --git a/library/archiving.po b/library/archiving.po index d54de5aacc..c42e38f29a 100644 --- a/library/archiving.po +++ b/library/archiving.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2023-02-18 14:22+0800\n" diff --git a/library/argparse.po b/library/argparse.po index e6458432b6..958fbaa23f 100644 --- a/library/argparse.po +++ b/library/argparse.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -514,7 +514,7 @@ msgstr "" msgid "*exit_on_error* parameter was added." msgstr "新增 *exit_on_error* 參數。" -#: ../../library/argparse.rst:244 ../../library/argparse.rst:780 +#: ../../library/argparse.rst:244 ../../library/argparse.rst:783 msgid "The following sections describe how each of these are used." msgstr "" @@ -524,14 +524,15 @@ msgstr "" #: ../../library/argparse.rst:252 msgid "" -"By default, :class:`ArgumentParser` objects use ``sys.argv[0]`` to determine " -"how to display the name of the program in help messages. This default is " -"almost always desirable because it will make the help messages match how the " -"program was invoked on the command line. For example, consider a file named " +"By default, :class:`ArgumentParser` objects use the base name (see :func:`os." +"path.basename`) of ``sys.argv[0]`` to determine how to display the name of " +"the program in help messages. This default is almost always desirable " +"because it will make the help messages match the name that was used to " +"invoke the program on the command line. For example, consider a file named " "``myprogram.py`` with the following code::" msgstr "" -#: ../../library/argparse.rst:258 ../../library/argparse.rst:678 +#: ../../library/argparse.rst:259 ../../library/argparse.rst:679 msgid "" "import argparse\n" "parser = argparse.ArgumentParser()\n" @@ -543,13 +544,13 @@ msgstr "" "parser.add_argument('--foo', help='foo help')\n" "args = parser.parse_args()" -#: ../../library/argparse.rst:263 +#: ../../library/argparse.rst:264 msgid "" "The help for this program will display ``myprogram.py`` as the program name " "(regardless of where the program was invoked from):" msgstr "" -#: ../../library/argparse.rst:266 +#: ../../library/argparse.rst:267 msgid "" "$ python myprogram.py --help\n" "usage: myprogram.py [-h] [--foo FOO]\n" @@ -579,13 +580,13 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO foo help" -#: ../../library/argparse.rst:282 +#: ../../library/argparse.rst:283 msgid "" "To change this default behavior, another value can be supplied using the " "``prog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:285 +#: ../../library/argparse.rst:286 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.print_help()\n" @@ -601,14 +602,14 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:292 +#: ../../library/argparse.rst:293 msgid "" "Note that the program name, whether determined from ``sys.argv[0]`` or from " "the ``prog=`` argument, is available to help messages using the ``%(prog)s`` " "format specifier." msgstr "" -#: ../../library/argparse.rst:298 +#: ../../library/argparse.rst:299 msgid "" ">>> parser = argparse.ArgumentParser(prog='myprogram')\n" ">>> parser.add_argument('--foo', help='foo of the %(prog)s program')\n" @@ -628,17 +629,17 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO foo of the myprogram program" -#: ../../library/argparse.rst:309 +#: ../../library/argparse.rst:310 msgid "usage" msgstr "" -#: ../../library/argparse.rst:311 +#: ../../library/argparse.rst:312 msgid "" "By default, :class:`ArgumentParser` calculates the usage message from the " "arguments it contains::" msgstr "" -#: ../../library/argparse.rst:314 +#: ../../library/argparse.rst:315 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', nargs='?', help='foo help')\n" @@ -666,12 +667,12 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo [FOO] foo help" -#: ../../library/argparse.rst:327 +#: ../../library/argparse.rst:328 msgid "" "The default message can be overridden with the ``usage=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:329 +#: ../../library/argparse.rst:330 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', usage='%(prog)s " "[options]')\n" @@ -701,17 +702,17 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo [FOO] foo help" -#: ../../library/argparse.rst:342 +#: ../../library/argparse.rst:343 msgid "" "The ``%(prog)s`` format specifier is available to fill in the program name " "in your usage messages." msgstr "" -#: ../../library/argparse.rst:349 +#: ../../library/argparse.rst:350 msgid "description" msgstr "描述" -#: ../../library/argparse.rst:351 +#: ../../library/argparse.rst:352 msgid "" "Most calls to the :class:`ArgumentParser` constructor will use the " "``description=`` keyword argument. This argument gives a brief description " @@ -720,7 +721,7 @@ msgid "" "messages for the various arguments::" msgstr "" -#: ../../library/argparse.rst:357 +#: ../../library/argparse.rst:358 msgid "" ">>> parser = argparse.ArgumentParser(description='A foo that bars')\n" ">>> parser.print_help()\n" @@ -740,24 +741,24 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:366 +#: ../../library/argparse.rst:367 msgid "" "By default, the description will be line-wrapped so that it fits within the " "given space. To change this behavior, see the formatter_class_ argument." msgstr "" -#: ../../library/argparse.rst:371 +#: ../../library/argparse.rst:372 msgid "epilog" msgstr "" -#: ../../library/argparse.rst:373 +#: ../../library/argparse.rst:374 msgid "" "Some programs like to display additional description of the program after " "the description of the arguments. Such text can be specified using the " "``epilog=`` argument to :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:377 +#: ../../library/argparse.rst:378 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... description='A foo that bars',\n" @@ -785,18 +786,18 @@ msgstr "" "\n" "And that's how you'd foo a bar" -#: ../../library/argparse.rst:390 +#: ../../library/argparse.rst:391 msgid "" "As with the description_ argument, the ``epilog=`` text is by default line-" "wrapped, but this behavior can be adjusted with the formatter_class_ " "argument to :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:396 +#: ../../library/argparse.rst:397 msgid "parents" msgstr "" -#: ../../library/argparse.rst:398 +#: ../../library/argparse.rst:399 msgid "" "Sometimes, several parsers share a common set of arguments. Rather than " "repeating the definitions of these arguments, a single parser with all the " @@ -807,7 +808,7 @@ msgid "" "object being constructed::" msgstr "" -#: ../../library/argparse.rst:405 +#: ../../library/argparse.rst:406 msgid "" ">>> parent_parser = argparse.ArgumentParser(add_help=False)\n" ">>> parent_parser.add_argument('--parent', type=int)\n" @@ -835,32 +836,32 @@ msgstr "" ">>> bar_parser.parse_args(['--bar', 'YYY'])\n" "Namespace(bar='YYY', parent=None)" -#: ../../library/argparse.rst:418 +#: ../../library/argparse.rst:419 msgid "" "Note that most parent parsers will specify ``add_help=False``. Otherwise, " "the :class:`ArgumentParser` will see two ``-h/--help`` options (one in the " "parent and one in the child) and raise an error." msgstr "" -#: ../../library/argparse.rst:423 +#: ../../library/argparse.rst:424 msgid "" "You must fully initialize the parsers before passing them via ``parents=``. " "If you change the parent parsers after the child parser, those changes will " "not be reflected in the child." msgstr "" -#: ../../library/argparse.rst:431 +#: ../../library/argparse.rst:432 msgid "formatter_class" msgstr "formatter_class" -#: ../../library/argparse.rst:433 +#: ../../library/argparse.rst:434 msgid "" ":class:`ArgumentParser` objects allow the help formatting to be customized " "by specifying an alternate formatting class. Currently, there are four such " "classes:" msgstr "" -#: ../../library/argparse.rst:442 +#: ../../library/argparse.rst:443 msgid "" ":class:`RawDescriptionHelpFormatter` and :class:`RawTextHelpFormatter` give " "more control over how textual descriptions are displayed. By default, :class:" @@ -868,7 +869,7 @@ msgid "" "command-line help messages::" msgstr "" -#: ../../library/argparse.rst:447 +#: ../../library/argparse.rst:448 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -892,14 +893,14 @@ msgid "" "will be wrapped across a couple lines" msgstr "" -#: ../../library/argparse.rst:467 +#: ../../library/argparse.rst:468 msgid "" "Passing :class:`RawDescriptionHelpFormatter` as ``formatter_class=`` " "indicates that description_ and epilog_ are already correctly formatted and " "should not be line-wrapped::" msgstr "" -#: ../../library/argparse.rst:471 +#: ../../library/argparse.rst:472 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -924,7 +925,7 @@ msgid "" " -h, --help show this help message and exit" msgstr "" -#: ../../library/argparse.rst:493 +#: ../../library/argparse.rst:494 msgid "" ":class:`RawTextHelpFormatter` maintains whitespace for all sorts of help " "text, including argument descriptions. However, multiple new lines are " @@ -932,13 +933,13 @@ msgid "" "between the newlines." msgstr "" -#: ../../library/argparse.rst:498 +#: ../../library/argparse.rst:499 msgid "" ":class:`ArgumentDefaultsHelpFormatter` automatically adds information about " "default values to each of the argument help messages::" msgstr "" -#: ../../library/argparse.rst:501 +#: ../../library/argparse.rst:502 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -970,14 +971,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO FOO! (default: 42)" -#: ../../library/argparse.rst:516 +#: ../../library/argparse.rst:517 msgid "" ":class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for " "each argument as the display name for its values (rather than using the " "dest_ as the regular formatter does)::" msgstr "" -#: ../../library/argparse.rst:520 +#: ../../library/argparse.rst:521 msgid "" ">>> parser = argparse.ArgumentParser(\n" "... prog='PROG',\n" @@ -1009,11 +1010,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo int" -#: ../../library/argparse.rst:537 +#: ../../library/argparse.rst:538 msgid "prefix_chars" msgstr "prefix_chars" -#: ../../library/argparse.rst:539 +#: ../../library/argparse.rst:540 msgid "" "Most command-line options will use ``-`` as the prefix, e.g. ``-f/--foo``. " "Parsers that need to support different or additional prefix characters, e.g. " @@ -1021,7 +1022,7 @@ msgid "" "``prefix_chars=`` argument to the ArgumentParser constructor::" msgstr "" -#: ../../library/argparse.rst:545 +#: ../../library/argparse.rst:546 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='-+')\n" ">>> parser.add_argument('+f')\n" @@ -1035,18 +1036,18 @@ msgstr "" ">>> parser.parse_args('+f X ++bar Y'.split())\n" "Namespace(bar='Y', f='X')" -#: ../../library/argparse.rst:551 +#: ../../library/argparse.rst:552 msgid "" "The ``prefix_chars=`` argument defaults to ``'-'``. Supplying a set of " "characters that does not include ``-`` will cause ``-f/--foo`` options to be " "disallowed." msgstr "" -#: ../../library/argparse.rst:557 +#: ../../library/argparse.rst:558 msgid "fromfile_prefix_chars" msgstr "fromfile_prefix_chars" -#: ../../library/argparse.rst:559 +#: ../../library/argparse.rst:560 msgid "" "Sometimes, when dealing with a particularly long argument list, it may make " "sense to keep the list of arguments in a file rather than typing it out at " @@ -1056,7 +1057,7 @@ msgid "" "by the arguments they contain. For example::" msgstr "" -#: ../../library/argparse.rst:566 +#: ../../library/argparse.rst:567 msgid "" ">>> with open('args.txt', 'w', encoding=sys.getfilesystemencoding()) as fp:\n" "... fp.write('-f\\nbar')\n" @@ -1074,7 +1075,7 @@ msgstr "" ">>> parser.parse_args(['-f', 'foo', '@args.txt'])\n" "Namespace(f='bar')" -#: ../../library/argparse.rst:574 +#: ../../library/argparse.rst:575 msgid "" "Arguments read from a file must by default be one per line (but see also :" "meth:`~ArgumentParser.convert_arg_line_to_args`) and are treated as if they " @@ -1084,19 +1085,19 @@ msgid "" "f', 'bar']``." msgstr "" -#: ../../library/argparse.rst:580 +#: ../../library/argparse.rst:581 msgid "" ":class:`ArgumentParser` uses :term:`filesystem encoding and error handler` " "to read the file containing arguments." msgstr "" -#: ../../library/argparse.rst:583 +#: ../../library/argparse.rst:584 msgid "" "The ``fromfile_prefix_chars=`` argument defaults to ``None``, meaning that " "arguments will never be treated as file references." msgstr "" -#: ../../library/argparse.rst:586 +#: ../../library/argparse.rst:587 msgid "" ":class:`ArgumentParser` changed encoding and errors to read arguments files " "from default (e.g. :func:`locale.getpreferredencoding(False) >> parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS)\n" ">>> parser.add_argument('--foo')\n" @@ -1139,22 +1140,22 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace()" -#: ../../library/argparse.rst:616 +#: ../../library/argparse.rst:617 msgid "allow_abbrev" msgstr "allow_abbrev" -#: ../../library/argparse.rst:618 +#: ../../library/argparse.rst:619 msgid "" "Normally, when you pass an argument list to the :meth:`~ArgumentParser." "parse_args` method of an :class:`ArgumentParser`, it :ref:`recognizes " "abbreviations ` of long options." msgstr "" -#: ../../library/argparse.rst:622 +#: ../../library/argparse.rst:623 msgid "This feature can be disabled by setting ``allow_abbrev`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:624 +#: ../../library/argparse.rst:625 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', allow_abbrev=False)\n" ">>> parser.add_argument('--foobar', action='store_true')\n" @@ -1170,11 +1171,11 @@ msgstr "" "usage: PROG [-h] [--foobar] [--foonley]\n" "PROG: error: unrecognized arguments: --foon" -#: ../../library/argparse.rst:635 +#: ../../library/argparse.rst:636 msgid "conflict_handler" msgstr "conflict_handler" -#: ../../library/argparse.rst:637 +#: ../../library/argparse.rst:638 msgid "" ":class:`ArgumentParser` objects do not allow two actions with the same " "option string. By default, :class:`ArgumentParser` objects raise an " @@ -1182,7 +1183,7 @@ msgid "" "that is already in use::" msgstr "" -#: ../../library/argparse.rst:642 +#: ../../library/argparse.rst:643 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo', help='old foo help')\n" @@ -1198,7 +1199,7 @@ msgstr "" " ..\n" "ArgumentError: argument --foo: conflicting option string(s): --foo" -#: ../../library/argparse.rst:649 +#: ../../library/argparse.rst:650 msgid "" "Sometimes (e.g. when using parents_) it may be useful to simply override any " "older arguments with the same option string. To get this behavior, the " @@ -1206,7 +1207,7 @@ msgid "" "of :class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:654 +#: ../../library/argparse.rst:655 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', " "conflict_handler='resolve')\n" @@ -1232,7 +1233,7 @@ msgstr "" " -f FOO old foo help\n" " --foo FOO new foo help" -#: ../../library/argparse.rst:665 +#: ../../library/argparse.rst:666 msgid "" "Note that :class:`ArgumentParser` objects only remove an action if all of " "its option strings are overridden. So, in the example above, the old ``-f/--" @@ -1240,24 +1241,24 @@ msgid "" "option string was overridden." msgstr "" -#: ../../library/argparse.rst:672 +#: ../../library/argparse.rst:673 msgid "add_help" msgstr "add_help" -#: ../../library/argparse.rst:674 +#: ../../library/argparse.rst:675 msgid "" "By default, ArgumentParser objects add an option which simply displays the " "parser's help message. For example, consider a file named ``myprogram.py`` " "containing the following code::" msgstr "" -#: ../../library/argparse.rst:683 +#: ../../library/argparse.rst:684 msgid "" "If ``-h`` or ``--help`` is supplied at the command line, the ArgumentParser " "help will be printed:" msgstr "" -#: ../../library/argparse.rst:686 +#: ../../library/argparse.rst:687 msgid "" "$ python myprogram.py --help\n" "usage: myprogram.py [-h] [--foo FOO]\n" @@ -1273,14 +1274,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO foo help" -#: ../../library/argparse.rst:695 +#: ../../library/argparse.rst:696 msgid "" "Occasionally, it may be useful to disable the addition of this help option. " "This can be achieved by passing ``False`` as the ``add_help=`` argument to :" "class:`ArgumentParser`::" msgstr "" -#: ../../library/argparse.rst:699 +#: ../../library/argparse.rst:700 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> parser.add_argument('--foo', help='foo help')\n" @@ -1298,7 +1299,7 @@ msgstr "" "options:\n" " --foo FOO foo help" -#: ../../library/argparse.rst:707 +#: ../../library/argparse.rst:708 msgid "" "The help option is typically ``-h/--help``. The exception to this is if the " "``prefix_chars=`` is specified and does not include ``-``, in which case ``-" @@ -1306,7 +1307,7 @@ msgid "" "in ``prefix_chars`` is used to prefix the help options::" msgstr "" -#: ../../library/argparse.rst:713 +#: ../../library/argparse.rst:714 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', prefix_chars='+/')\n" ">>> parser.print_help()\n" @@ -1322,24 +1323,24 @@ msgstr "" "options:\n" " +h, ++help show this help message and exit" -#: ../../library/argparse.rst:722 +#: ../../library/argparse.rst:723 msgid "exit_on_error" msgstr "exit_on_error" -#: ../../library/argparse.rst:724 +#: ../../library/argparse.rst:725 msgid "" "Normally, when you pass an invalid argument list to the :meth:" "`~ArgumentParser.parse_args` method of an :class:`ArgumentParser`, it will " "exit with error info." msgstr "" -#: ../../library/argparse.rst:727 +#: ../../library/argparse.rst:728 msgid "" "If the user would like to catch errors manually, the feature can be enabled " "by setting ``exit_on_error`` to ``False``::" msgstr "" -#: ../../library/argparse.rst:730 +#: ../../library/argparse.rst:731 msgid "" ">>> parser = argparse.ArgumentParser(exit_on_error=False)\n" ">>> parser.add_argument('--integers', type=int)\n" @@ -1365,77 +1366,81 @@ msgstr "" "...\n" "Catching an argumentError" -#: ../../library/argparse.rst:744 +#: ../../library/argparse.rst:745 msgid "The add_argument() method" msgstr "" -#: ../../library/argparse.rst:750 +#: ../../library/argparse.rst:751 msgid "" "Define how a single command-line argument should be parsed. Each parameter " "has its own more detailed description below, but in short they are:" msgstr "" -#: ../../library/argparse.rst:753 +#: ../../library/argparse.rst:754 msgid "" "`name or flags`_ - Either a name or a list of option strings, e.g. ``foo`` " "or ``-f, --foo``." msgstr "" -#: ../../library/argparse.rst:756 +#: ../../library/argparse.rst:757 msgid "" "action_ - The basic type of action to be taken when this argument is " "encountered at the command line." msgstr "" -#: ../../library/argparse.rst:759 +#: ../../library/argparse.rst:760 msgid "nargs_ - The number of command-line arguments that should be consumed." msgstr "" -#: ../../library/argparse.rst:761 +#: ../../library/argparse.rst:762 msgid "" "const_ - A constant value required by some action_ and nargs_ selections." msgstr "" -#: ../../library/argparse.rst:763 +#: ../../library/argparse.rst:764 msgid "" "default_ - The value produced if the argument is absent from the command " "line and if it is absent from the namespace object." msgstr "" -#: ../../library/argparse.rst:766 +#: ../../library/argparse.rst:767 msgid "" "type_ - The type to which the command-line argument should be converted." msgstr "" -#: ../../library/argparse.rst:768 +#: ../../library/argparse.rst:769 msgid "choices_ - A sequence of the allowable values for the argument." msgstr "" -#: ../../library/argparse.rst:770 +#: ../../library/argparse.rst:771 msgid "" "required_ - Whether or not the command-line option may be omitted (optionals " "only)." msgstr "" -#: ../../library/argparse.rst:773 +#: ../../library/argparse.rst:774 msgid "help_ - A brief description of what the argument does." msgstr "" -#: ../../library/argparse.rst:775 +#: ../../library/argparse.rst:776 msgid "metavar_ - A name for the argument in usage messages." msgstr "" -#: ../../library/argparse.rst:777 +#: ../../library/argparse.rst:778 msgid "" "dest_ - The name of the attribute to be added to the object returned by :" "meth:`parse_args`." msgstr "" -#: ../../library/argparse.rst:786 +#: ../../library/argparse.rst:781 +msgid "deprecated_ - Whether or not use of the argument is deprecated." +msgstr "" + +#: ../../library/argparse.rst:789 msgid "name or flags" msgstr "" -#: ../../library/argparse.rst:788 +#: ../../library/argparse.rst:791 msgid "" "The :meth:`~ArgumentParser.add_argument` method must know whether an " "optional argument, like ``-f`` or ``--foo``, or a positional argument, like " @@ -1444,30 +1449,30 @@ msgid "" "or a simple argument name." msgstr "" -#: ../../library/argparse.rst:794 +#: ../../library/argparse.rst:797 msgid "For example, an optional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:796 +#: ../../library/argparse.rst:799 msgid ">>> parser.add_argument('-f', '--foo')" msgstr ">>> parser.add_argument('-f', '--foo')" -#: ../../library/argparse.rst:798 +#: ../../library/argparse.rst:801 msgid "while a positional argument could be created like::" msgstr "" -#: ../../library/argparse.rst:800 +#: ../../library/argparse.rst:803 msgid ">>> parser.add_argument('bar')" msgstr ">>> parser.add_argument('bar')" -#: ../../library/argparse.rst:802 +#: ../../library/argparse.rst:805 msgid "" "When :meth:`~ArgumentParser.parse_args` is called, optional arguments will " "be identified by the ``-`` prefix, and the remaining arguments will be " "assumed to be positional::" msgstr "" -#: ../../library/argparse.rst:806 +#: ../../library/argparse.rst:809 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-f', '--foo')\n" @@ -1491,11 +1496,11 @@ msgstr "" "usage: PROG [-h] [-f FOO] bar\n" "PROG: error: the following arguments are required: bar" -#: ../../library/argparse.rst:821 +#: ../../library/argparse.rst:824 msgid "action" msgstr "" -#: ../../library/argparse.rst:823 +#: ../../library/argparse.rst:826 msgid "" ":class:`ArgumentParser` objects associate command-line arguments with " "actions. These actions can do just about anything with the command-line " @@ -1505,13 +1510,13 @@ msgid "" "be handled. The supplied actions are:" msgstr "" -#: ../../library/argparse.rst:829 +#: ../../library/argparse.rst:832 msgid "" "``'store'`` - This just stores the argument's value. This is the default " "action. For example::" msgstr "" -#: ../../library/argparse.rst:832 +#: ../../library/argparse.rst:835 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -1523,7 +1528,7 @@ msgstr "" ">>> parser.parse_args('--foo 1'.split())\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:837 +#: ../../library/argparse.rst:840 msgid "" "``'store_const'`` - This stores the value specified by the const_ keyword " "argument; note that the const_ keyword argument defaults to ``None``. The " @@ -1531,7 +1536,7 @@ msgid "" "specify some sort of flag. For example::" msgstr "" -#: ../../library/argparse.rst:842 +#: ../../library/argparse.rst:845 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_const', const=42)\n" @@ -1543,7 +1548,7 @@ msgstr "" ">>> parser.parse_args(['--foo'])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:847 +#: ../../library/argparse.rst:850 msgid "" "``'store_true'`` and ``'store_false'`` - These are special cases of " "``'store_const'`` used for storing the values ``True`` and ``False`` " @@ -1551,7 +1556,7 @@ msgid "" "``True`` respectively. For example::" msgstr "" -#: ../../library/argparse.rst:852 +#: ../../library/argparse.rst:855 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -1567,7 +1572,7 @@ msgstr "" ">>> parser.parse_args('--foo --bar'.split())\n" "Namespace(foo=True, bar=False, baz=True)" -#: ../../library/argparse.rst:859 +#: ../../library/argparse.rst:862 msgid "" "``'append'`` - This stores a list, and appends each argument value to the " "list. It is useful to allow an option to be specified multiple times. If the " @@ -1576,7 +1581,7 @@ msgid "" "after those default values. Example usage::" msgstr "" -#: ../../library/argparse.rst:865 +#: ../../library/argparse.rst:868 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='append')\n" @@ -1588,7 +1593,7 @@ msgstr "" ">>> parser.parse_args('--foo 1 --foo 2'.split())\n" "Namespace(foo=['1', '2'])" -#: ../../library/argparse.rst:870 +#: ../../library/argparse.rst:873 msgid "" "``'append_const'`` - This stores a list, and appends the value specified by " "the const_ keyword argument to the list; note that the const_ keyword " @@ -1597,7 +1602,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:876 +#: ../../library/argparse.rst:879 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--str', dest='types', action='append_const', " @@ -1615,13 +1620,13 @@ msgstr "" ">>> parser.parse_args('--str --int'.split())\n" "Namespace(types=[, ])" -#: ../../library/argparse.rst:882 +#: ../../library/argparse.rst:885 msgid "" "``'count'`` - This counts the number of times a keyword argument occurs. For " "example, this is useful for increasing verbosity levels::" msgstr "" -#: ../../library/argparse.rst:885 +#: ../../library/argparse.rst:888 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--verbose', '-v', action='count', default=0)\n" @@ -1629,11 +1634,11 @@ msgid "" "Namespace(verbose=3)" msgstr "" -#: ../../library/argparse.rst:890 +#: ../../library/argparse.rst:893 msgid "Note, the *default* will be ``None`` unless explicitly set to *0*." msgstr "" -#: ../../library/argparse.rst:892 +#: ../../library/argparse.rst:895 msgid "" "``'help'`` - This prints a complete help message for all the options in the " "current parser and then exits. By default a help action is automatically " @@ -1641,14 +1646,14 @@ msgid "" "output is created." msgstr "" -#: ../../library/argparse.rst:897 +#: ../../library/argparse.rst:900 msgid "" "``'version'`` - This expects a ``version=`` keyword argument in the :meth:" "`~ArgumentParser.add_argument` call, and prints version information and " "exits when invoked::" msgstr "" -#: ../../library/argparse.rst:901 +#: ../../library/argparse.rst:904 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -1664,13 +1669,13 @@ msgstr "" ">>> parser.parse_args(['--version'])\n" "PROG 2.0" -#: ../../library/argparse.rst:907 +#: ../../library/argparse.rst:910 msgid "" "``'extend'`` - This stores a list, and extends each argument value to the " "list. Example usage::" msgstr "" -#: ../../library/argparse.rst:911 +#: ../../library/argparse.rst:914 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\"--foo\", action=\"extend\", nargs=\"+\", " @@ -1686,7 +1691,7 @@ msgstr "" "\"f4\"])\n" "Namespace(foo=['f1', 'f2', 'f3', 'f4'])" -#: ../../library/argparse.rst:918 +#: ../../library/argparse.rst:921 msgid "" "You may also specify an arbitrary action by passing an Action subclass or " "other object that implements the same interface. The " @@ -1694,7 +1699,7 @@ msgid "" "boolean actions such as ``--foo`` and ``--no-foo``::" msgstr "" -#: ../../library/argparse.rst:923 +#: ../../library/argparse.rst:926 msgid "" ">>> import argparse\n" ">>> parser = argparse.ArgumentParser()\n" @@ -1708,18 +1713,18 @@ msgstr "" ">>> parser.parse_args(['--no-foo'])\n" "Namespace(foo=False)" -#: ../../library/argparse.rst:931 +#: ../../library/argparse.rst:934 msgid "" "The recommended way to create a custom action is to extend :class:`Action`, " "overriding the ``__call__`` method and optionally the ``__init__`` and " "``format_usage`` methods." msgstr "" -#: ../../library/argparse.rst:935 +#: ../../library/argparse.rst:938 msgid "An example of a custom action::" msgstr "" -#: ../../library/argparse.rst:937 +#: ../../library/argparse.rst:940 msgid "" ">>> class FooAction(argparse.Action):\n" "... def __init__(self, option_strings, dest, nargs=None, **kwargs):\n" @@ -1740,15 +1745,15 @@ msgid "" "Namespace(bar='1', foo='2')" msgstr "" -#: ../../library/argparse.rst:955 +#: ../../library/argparse.rst:958 msgid "For more details, see :class:`Action`." msgstr "" -#: ../../library/argparse.rst:961 +#: ../../library/argparse.rst:964 msgid "nargs" msgstr "" -#: ../../library/argparse.rst:963 +#: ../../library/argparse.rst:966 msgid "" "ArgumentParser objects usually associate a single command-line argument with " "a single action to be taken. The ``nargs`` keyword argument associates a " @@ -1756,13 +1761,13 @@ msgid "" "ref:`specifying-ambiguous-arguments`. The supported values are:" msgstr "" -#: ../../library/argparse.rst:968 +#: ../../library/argparse.rst:971 msgid "" "``N`` (an integer). ``N`` arguments from the command line will be gathered " "together into a list. For example::" msgstr "" -#: ../../library/argparse.rst:971 +#: ../../library/argparse.rst:974 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs=2)\n" @@ -1776,13 +1781,13 @@ msgstr "" ">>> parser.parse_args('c --foo a b'.split())\n" "Namespace(bar=['c'], foo=['a', 'b'])" -#: ../../library/argparse.rst:977 +#: ../../library/argparse.rst:980 msgid "" "Note that ``nargs=1`` produces a list of one item. This is different from " "the default, in which the item is produced by itself." msgstr "" -#: ../../library/argparse.rst:982 +#: ../../library/argparse.rst:985 msgid "" "``'?'``. One argument will be consumed from the command line if possible, " "and produced as a single item. If no command-line argument is present, the " @@ -1792,7 +1797,7 @@ msgid "" "produced. Some examples to illustrate this::" msgstr "" -#: ../../library/argparse.rst:989 +#: ../../library/argparse.rst:992 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='?', const='c', default='d')\n" @@ -1814,13 +1819,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(bar='d', foo='d')" -#: ../../library/argparse.rst:999 +#: ../../library/argparse.rst:1002 msgid "" "One of the more common uses of ``nargs='?'`` is to allow optional input and " "output files::" msgstr "" -#: ../../library/argparse.rst:1002 +#: ../../library/argparse.rst:1005 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', nargs='?', type=argparse.FileType('r'),\n" @@ -1846,7 +1851,7 @@ msgstr "" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>,\n" " outfile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1016 +#: ../../library/argparse.rst:1019 msgid "" "``'*'``. All command-line arguments present are gathered into a list. Note " "that it generally doesn't make much sense to have more than one positional " @@ -1854,7 +1859,7 @@ msgid "" "``nargs='*'`` is possible. For example::" msgstr "" -#: ../../library/argparse.rst:1021 +#: ../../library/argparse.rst:1024 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', nargs='*')\n" @@ -1870,14 +1875,14 @@ msgstr "" ">>> parser.parse_args('a b --foo x y --bar 1 2'.split())\n" "Namespace(bar=['1', '2'], baz=['a', 'b'], foo=['x', 'y'])" -#: ../../library/argparse.rst:1030 +#: ../../library/argparse.rst:1033 msgid "" "``'+'``. Just like ``'*'``, all command-line args present are gathered into " "a list. Additionally, an error message will be generated if there wasn't at " "least one command-line argument present. For example::" msgstr "" -#: ../../library/argparse.rst:1034 +#: ../../library/argparse.rst:1037 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('foo', nargs='+')\n" @@ -1895,7 +1900,7 @@ msgstr "" "usage: PROG [-h] foo [foo ...]\n" "PROG: error: the following arguments are required: foo" -#: ../../library/argparse.rst:1042 +#: ../../library/argparse.rst:1045 msgid "" "If the ``nargs`` keyword argument is not provided, the number of arguments " "consumed is determined by the action_. Generally this means a single " @@ -1903,11 +1908,11 @@ msgid "" "be produced." msgstr "" -#: ../../library/argparse.rst:1050 +#: ../../library/argparse.rst:1053 msgid "const" msgstr "" -#: ../../library/argparse.rst:1052 +#: ../../library/argparse.rst:1055 msgid "" "The ``const`` argument of :meth:`~ArgumentParser.add_argument` is used to " "hold constant values that are not read from the command line but are " @@ -1915,7 +1920,7 @@ msgid "" "common uses of it are:" msgstr "" -#: ../../library/argparse.rst:1056 +#: ../../library/argparse.rst:1059 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with " "``action='store_const'`` or ``action='append_const'``. These actions add " @@ -1925,7 +1930,7 @@ msgid "" "receive a default value of ``None``." msgstr "" -#: ../../library/argparse.rst:1064 +#: ../../library/argparse.rst:1067 msgid "" "When :meth:`~ArgumentParser.add_argument` is called with option strings " "(like ``-f`` or ``--foo``) and ``nargs='?'``. This creates an optional " @@ -1935,17 +1940,17 @@ msgid "" "to be ``None`` instead. See the nargs_ description for examples." msgstr "" -#: ../../library/argparse.rst:1071 +#: ../../library/argparse.rst:1074 msgid "" "``const=None`` by default, including when ``action='append_const'`` or " "``action='store_const'``." msgstr "" -#: ../../library/argparse.rst:1078 +#: ../../library/argparse.rst:1081 msgid "default" msgstr "" -#: ../../library/argparse.rst:1080 +#: ../../library/argparse.rst:1083 msgid "" "All optional arguments and some positional arguments may be omitted at the " "command line. The ``default`` keyword argument of :meth:`~ArgumentParser." @@ -1955,7 +1960,7 @@ msgid "" "command line::" msgstr "" -#: ../../library/argparse.rst:1087 +#: ../../library/argparse.rst:1090 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1971,13 +1976,13 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:1094 +#: ../../library/argparse.rst:1097 msgid "" "If the target namespace already has an attribute set, the action *default* " "will not over write it::" msgstr "" -#: ../../library/argparse.rst:1097 +#: ../../library/argparse.rst:1100 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=42)\n" @@ -1989,7 +1994,7 @@ msgstr "" ">>> parser.parse_args([], namespace=argparse.Namespace(foo=101))\n" "Namespace(foo=101)" -#: ../../library/argparse.rst:1102 +#: ../../library/argparse.rst:1105 msgid "" "If the ``default`` value is a string, the parser parses the value as if it " "were a command-line argument. In particular, the parser applies any type_ " @@ -1997,7 +2002,7 @@ msgid "" "`Namespace` return value. Otherwise, the parser uses the value as is::" msgstr "" -#: ../../library/argparse.rst:1107 +#: ../../library/argparse.rst:1110 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--length', default='10', type=int)\n" @@ -2011,13 +2016,13 @@ msgstr "" ">>> parser.parse_args()\n" "Namespace(length=10, width=10.5)" -#: ../../library/argparse.rst:1113 +#: ../../library/argparse.rst:1116 msgid "" "For positional arguments with nargs_ equal to ``?`` or ``*``, the " "``default`` value is used when no command-line argument was present::" msgstr "" -#: ../../library/argparse.rst:1116 +#: ../../library/argparse.rst:1119 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', nargs='?', default=42)\n" @@ -2033,13 +2038,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo=42)" -#: ../../library/argparse.rst:1124 +#: ../../library/argparse.rst:1126 +msgid "" +"For required_ arguments, the ``default`` value is ignored. For example, this " +"applies to positional arguments with nargs_ values other than ``?`` or " +"``*``, or optional arguments marked as ``required=True``." +msgstr "" + +#: ../../library/argparse.rst:1130 msgid "" "Providing ``default=argparse.SUPPRESS`` causes no attribute to be added if " "the command-line argument was not present::" msgstr "" -#: ../../library/argparse.rst:1127 +#: ../../library/argparse.rst:1133 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" @@ -2055,11 +2067,11 @@ msgstr "" ">>> parser.parse_args(['--foo', '1'])\n" "Namespace(foo='1')" -#: ../../library/argparse.rst:1138 +#: ../../library/argparse.rst:1144 msgid "type" msgstr "" -#: ../../library/argparse.rst:1140 +#: ../../library/argparse.rst:1146 msgid "" "By default, the parser reads command-line arguments in as simple strings. " "However, quite often the command-line string should instead be interpreted " @@ -2068,13 +2080,13 @@ msgid "" "checking and type conversions to be performed." msgstr "" -#: ../../library/argparse.rst:1146 +#: ../../library/argparse.rst:1152 msgid "" "If the type_ keyword is used with the default_ keyword, the type converter " "is only applied if the default is a string." msgstr "" -#: ../../library/argparse.rst:1149 +#: ../../library/argparse.rst:1155 msgid "" "The argument to ``type`` can be any callable that accepts a single string. " "If the function raises :exc:`ArgumentTypeError`, :exc:`TypeError`, or :exc:" @@ -2082,11 +2094,11 @@ msgid "" "is displayed. No other exception types are handled." msgstr "" -#: ../../library/argparse.rst:1154 +#: ../../library/argparse.rst:1160 msgid "Common built-in types and functions can be used as type converters:" msgstr "" -#: ../../library/argparse.rst:1156 +#: ../../library/argparse.rst:1162 msgid "" "import argparse\n" "import pathlib\n" @@ -2114,11 +2126,11 @@ msgstr "" "encoding='latin-1'))\n" "parser.add_argument('datapath', type=pathlib.Path)" -#: ../../library/argparse.rst:1170 +#: ../../library/argparse.rst:1176 msgid "User defined functions can be used as well:" msgstr "" -#: ../../library/argparse.rst:1172 +#: ../../library/argparse.rst:1178 msgid "" ">>> def hyphenated(string):\n" "... return '-'.join([word[:4] for word in string.casefold().split()])\n" @@ -2136,14 +2148,14 @@ msgstr "" ">>> parser.parse_args(['\"The Tale of Two Cities\"'])\n" "Namespace(short_title='\"the-tale-of-two-citi')" -#: ../../library/argparse.rst:1182 +#: ../../library/argparse.rst:1188 msgid "" "The :func:`bool` function is not recommended as a type converter. All it " "does is convert empty strings to ``False`` and non-empty strings to " "``True``. This is usually not what is desired." msgstr "" -#: ../../library/argparse.rst:1186 +#: ../../library/argparse.rst:1192 msgid "" "In general, the ``type`` keyword is a convenience that should only be used " "for simple conversions that can only raise one of the three supported " @@ -2151,7 +2163,7 @@ msgid "" "management should be done downstream after the arguments are parsed." msgstr "" -#: ../../library/argparse.rst:1191 +#: ../../library/argparse.rst:1197 msgid "" "For example, JSON or YAML conversions have complex error cases that require " "better reporting than can be given by the ``type`` keyword. A :exc:`~json." @@ -2159,7 +2171,7 @@ msgid "" "exception would not be handled at all." msgstr "" -#: ../../library/argparse.rst:1196 +#: ../../library/argparse.rst:1202 msgid "" "Even :class:`~argparse.FileType` has its limitations for use with the " "``type`` keyword. If one argument uses *FileType* and then a subsequent " @@ -2168,17 +2180,17 @@ msgid "" "run and then use the :keyword:`with`-statement to manage the files." msgstr "" -#: ../../library/argparse.rst:1202 +#: ../../library/argparse.rst:1208 msgid "" "For type checkers that simply check against a fixed set of values, consider " "using the choices_ keyword instead." msgstr "" -#: ../../library/argparse.rst:1209 +#: ../../library/argparse.rst:1215 msgid "choices" msgstr "" -#: ../../library/argparse.rst:1211 +#: ../../library/argparse.rst:1217 msgid "" "Some command-line arguments should be selected from a restricted set of " "values. These can be handled by passing a sequence object as the *choices* " @@ -2187,7 +2199,7 @@ msgid "" "be displayed if the argument was not one of the acceptable values::" msgstr "" -#: ../../library/argparse.rst:1217 +#: ../../library/argparse.rst:1223 msgid "" ">>> parser = argparse.ArgumentParser(prog='game.py')\n" ">>> parser.add_argument('move', choices=['rock', 'paper', 'scissors'])\n" @@ -2207,14 +2219,14 @@ msgstr "" "game.py: error: argument move: invalid choice: 'fire' (choose from 'rock',\n" "'paper', 'scissors')" -#: ../../library/argparse.rst:1226 +#: ../../library/argparse.rst:1232 msgid "" "Note that inclusion in the *choices* sequence is checked after any type_ " "conversions have been performed, so the type of the objects in the *choices* " "sequence should match the type_ specified::" msgstr "" -#: ../../library/argparse.rst:1230 +#: ../../library/argparse.rst:1236 msgid "" ">>> parser = argparse.ArgumentParser(prog='doors.py')\n" ">>> parser.add_argument('door', type=int, choices=range(1, 4))\n" @@ -2232,19 +2244,19 @@ msgstr "" "usage: doors.py [-h] {1,2,3}\n" "doors.py: error: argument door: invalid choice: 4 (choose from 1, 2, 3)" -#: ../../library/argparse.rst:1238 +#: ../../library/argparse.rst:1244 msgid "" "Any sequence can be passed as the *choices* value, so :class:`list` " "objects, :class:`tuple` objects, and custom sequences are all supported." msgstr "" -#: ../../library/argparse.rst:1241 +#: ../../library/argparse.rst:1247 msgid "" "Use of :class:`enum.Enum` is not recommended because it is difficult to " "control its appearance in usage, help, and error messages." msgstr "" -#: ../../library/argparse.rst:1244 +#: ../../library/argparse.rst:1250 msgid "" "Formatted choices override the default *metavar* which is normally derived " "from *dest*. This is usually what you want because the user never sees the " @@ -2252,11 +2264,11 @@ msgid "" "are many choices), just specify an explicit metavar_." msgstr "" -#: ../../library/argparse.rst:1253 +#: ../../library/argparse.rst:1259 msgid "required" msgstr "" -#: ../../library/argparse.rst:1255 +#: ../../library/argparse.rst:1261 msgid "" "In general, the :mod:`argparse` module assumes that flags like ``-f`` and " "``--bar`` indicate *optional* arguments, which can always be omitted at the " @@ -2264,7 +2276,7 @@ msgid "" "the ``required=`` keyword argument to :meth:`~ArgumentParser.add_argument`::" msgstr "" -#: ../../library/argparse.rst:1260 +#: ../../library/argparse.rst:1266 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', required=True)\n" @@ -2282,24 +2294,24 @@ msgstr "" "usage: [-h] --foo FOO\n" ": error: the following arguments are required: --foo" -#: ../../library/argparse.rst:1268 +#: ../../library/argparse.rst:1274 msgid "" "As the example shows, if an option is marked as ``required``, :meth:" "`~ArgumentParser.parse_args` will report an error if that option is not " "present at the command line." msgstr "" -#: ../../library/argparse.rst:1274 +#: ../../library/argparse.rst:1280 msgid "" "Required options are generally considered bad form because users expect " "*options* to be *optional*, and thus they should be avoided when possible." msgstr "" -#: ../../library/argparse.rst:1281 +#: ../../library/argparse.rst:1287 msgid "help" msgstr "幫助" -#: ../../library/argparse.rst:1283 +#: ../../library/argparse.rst:1289 msgid "" "The ``help`` value is a string containing a brief description of the " "argument. When a user requests help (usually by using ``-h`` or ``--help`` " @@ -2307,7 +2319,7 @@ msgid "" "each argument::" msgstr "" -#: ../../library/argparse.rst:1288 +#: ../../library/argparse.rst:1294 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', action='store_true',\n" @@ -2339,7 +2351,7 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo foo the bars before frobbling" -#: ../../library/argparse.rst:1303 +#: ../../library/argparse.rst:1309 msgid "" "The ``help`` strings can include various format specifiers to avoid " "repetition of things like the program name or the argument default_. The " @@ -2348,7 +2360,7 @@ msgid "" "``%(type)s``, etc.::" msgstr "" -#: ../../library/argparse.rst:1308 +#: ../../library/argparse.rst:1314 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('bar', nargs='?', type=int, default=42,\n" @@ -2374,19 +2386,19 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1320 +#: ../../library/argparse.rst:1326 msgid "" "As the help string supports %-formatting, if you want a literal ``%`` to " "appear in the help string, you must escape it as ``%%``." msgstr "" -#: ../../library/argparse.rst:1323 +#: ../../library/argparse.rst:1329 msgid "" ":mod:`argparse` supports silencing the help entry for certain options, by " "setting the ``help`` value to ``argparse.SUPPRESS``::" msgstr "" -#: ../../library/argparse.rst:1326 +#: ../../library/argparse.rst:1332 msgid "" ">>> parser = argparse.ArgumentParser(prog='frobble')\n" ">>> parser.add_argument('--foo', help=argparse.SUPPRESS)\n" @@ -2404,11 +2416,11 @@ msgstr "" "options:\n" " -h, --help show this help message and exit" -#: ../../library/argparse.rst:1338 +#: ../../library/argparse.rst:1344 msgid "metavar" msgstr "" -#: ../../library/argparse.rst:1340 +#: ../../library/argparse.rst:1346 msgid "" "When :class:`ArgumentParser` generates help messages, it needs some way to " "refer to each expected argument. By default, ArgumentParser objects use the " @@ -2420,7 +2432,7 @@ msgid "" "argument will be referred to as ``FOO``. An example::" msgstr "" -#: ../../library/argparse.rst:1349 +#: ../../library/argparse.rst:1355 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2452,11 +2464,11 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo FOO" -#: ../../library/argparse.rst:1364 +#: ../../library/argparse.rst:1370 msgid "An alternative name can be specified with ``metavar``::" msgstr "" -#: ../../library/argparse.rst:1366 +#: ../../library/argparse.rst:1372 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', metavar='YYY')\n" @@ -2488,21 +2500,21 @@ msgstr "" " -h, --help show this help message and exit\n" " --foo YYY" -#: ../../library/argparse.rst:1381 +#: ../../library/argparse.rst:1387 msgid "" "Note that ``metavar`` only changes the *displayed* name - the name of the " "attribute on the :meth:`~ArgumentParser.parse_args` object is still " "determined by the dest_ value." msgstr "" -#: ../../library/argparse.rst:1385 +#: ../../library/argparse.rst:1391 msgid "" "Different values of ``nargs`` may cause the metavar to be used multiple " "times. Providing a tuple to ``metavar`` specifies a different display for " "each of the arguments::" msgstr "" -#: ../../library/argparse.rst:1389 +#: ../../library/argparse.rst:1395 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', nargs=2)\n" @@ -2526,11 +2538,11 @@ msgstr "" " -x X X\n" " --foo bar baz" -#: ../../library/argparse.rst:1404 +#: ../../library/argparse.rst:1410 msgid "dest" msgstr "" -#: ../../library/argparse.rst:1406 +#: ../../library/argparse.rst:1412 msgid "" "Most :class:`ArgumentParser` actions add some value as an attribute of the " "object returned by :meth:`~ArgumentParser.parse_args`. The name of this " @@ -2540,7 +2552,7 @@ msgid "" "add_argument`::" msgstr "" -#: ../../library/argparse.rst:1413 +#: ../../library/argparse.rst:1419 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('bar')\n" @@ -2552,7 +2564,7 @@ msgstr "" ">>> parser.parse_args(['XXX'])\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1418 +#: ../../library/argparse.rst:1424 msgid "" "For optional argument actions, the value of ``dest`` is normally inferred " "from the option strings. :class:`ArgumentParser` generates the value of " @@ -2564,7 +2576,7 @@ msgid "" "below illustrate this behavior::" msgstr "" -#: ../../library/argparse.rst:1427 +#: ../../library/argparse.rst:1433 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('-f', '--foo-bar', '--foo')\n" @@ -2582,11 +2594,11 @@ msgstr "" ">>> parser.parse_args('--foo 1 -y 2'.split())\n" "Namespace(foo_bar='1', x='2')" -#: ../../library/argparse.rst:1435 +#: ../../library/argparse.rst:1441 msgid "``dest`` allows a custom attribute name to be provided::" msgstr "" -#: ../../library/argparse.rst:1437 +#: ../../library/argparse.rst:1443 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', dest='bar')\n" @@ -2598,11 +2610,45 @@ msgstr "" ">>> parser.parse_args('--foo XXX'.split())\n" "Namespace(bar='XXX')" -#: ../../library/argparse.rst:1443 +#: ../../library/argparse.rst:1452 +msgid "deprecated" +msgstr "" + +#: ../../library/argparse.rst:1454 +msgid "" +"During a project's lifetime, some arguments may need to be removed from the " +"command line. Before removing them, you should inform your users that the " +"arguments are deprecated and will be removed. The ``deprecated`` keyword " +"argument of :meth:`~ArgumentParser.add_argument`, which defaults to " +"``False``, specifies if the argument is deprecated and will be removed in " +"the future. For arguments, if ``deprecated`` is ``True``, then a warning " +"will be printed to :data:`sys.stderr` when the argument is used::" +msgstr "" + +#: ../../library/argparse.rst:1464 +#, fuzzy +msgid "" +">>> import argparse\n" +">>> parser = argparse.ArgumentParser(prog='snake.py')\n" +">>> parser.add_argument('--legs', default=0, type=int, deprecated=True)\n" +">>> parser.parse_args([])\n" +"Namespace(legs=0)\n" +">>> parser.parse_args(['--legs', '4']) \n" +"snake.py: warning: option '--legs' is deprecated\n" +"Namespace(legs=4)" +msgstr "" +">>> parser = argparse.ArgumentParser()\n" +">>> parser.add_argument('--foo', default=argparse.SUPPRESS)\n" +">>> parser.parse_args([])\n" +"Namespace()\n" +">>> parser.parse_args(['--foo', '1'])\n" +"Namespace(foo='1')" + +#: ../../library/argparse.rst:1477 msgid "Action classes" msgstr "" -#: ../../library/argparse.rst:1445 +#: ../../library/argparse.rst:1479 msgid "" "Action classes implement the Action API, a callable which returns a callable " "which processes arguments from the command-line. Any object which follows " @@ -2610,7 +2656,7 @@ msgid "" "add_argument`." msgstr "" -#: ../../library/argparse.rst:1454 +#: ../../library/argparse.rst:1488 msgid "" "Action objects are used by an ArgumentParser to represent the information " "needed to parse a single argument from one or more strings from the command " @@ -2619,7 +2665,7 @@ msgid "" "the ``action`` itself." msgstr "" -#: ../../library/argparse.rst:1460 +#: ../../library/argparse.rst:1494 msgid "" "Instances of Action (or return value of any callable to the ``action`` " "parameter) should have attributes \"dest\", \"option_strings\", \"default\", " @@ -2627,91 +2673,91 @@ msgid "" "these attributes are defined is to call ``Action.__init__``." msgstr "" -#: ../../library/argparse.rst:1465 +#: ../../library/argparse.rst:1499 msgid "" "Action instances should be callable, so subclasses must override the " "``__call__`` method, which should accept four parameters:" msgstr "" -#: ../../library/argparse.rst:1468 +#: ../../library/argparse.rst:1502 msgid "``parser`` - The ArgumentParser object which contains this action." msgstr "" -#: ../../library/argparse.rst:1470 +#: ../../library/argparse.rst:1504 msgid "" "``namespace`` - The :class:`Namespace` object that will be returned by :meth:" "`~ArgumentParser.parse_args`. Most actions add an attribute to this object " "using :func:`setattr`." msgstr "" -#: ../../library/argparse.rst:1474 +#: ../../library/argparse.rst:1508 msgid "" "``values`` - The associated command-line arguments, with any type " "conversions applied. Type conversions are specified with the type_ keyword " "argument to :meth:`~ArgumentParser.add_argument`." msgstr "" -#: ../../library/argparse.rst:1478 +#: ../../library/argparse.rst:1512 msgid "" "``option_string`` - The option string that was used to invoke this action. " "The ``option_string`` argument is optional, and will be absent if the action " "is associated with a positional argument." msgstr "" -#: ../../library/argparse.rst:1482 +#: ../../library/argparse.rst:1516 msgid "" "The ``__call__`` method may perform arbitrary actions, but will typically " "set attributes on the ``namespace`` based on ``dest`` and ``values``." msgstr "" -#: ../../library/argparse.rst:1485 +#: ../../library/argparse.rst:1519 msgid "" "Action subclasses can define a ``format_usage`` method that takes no " "argument and return a string which will be used when printing the usage of " "the program. If such method is not provided, a sensible default will be used." msgstr "" -#: ../../library/argparse.rst:1490 +#: ../../library/argparse.rst:1524 msgid "The parse_args() method" msgstr "" -#: ../../library/argparse.rst:1494 +#: ../../library/argparse.rst:1528 msgid "" "Convert argument strings to objects and assign them as attributes of the " "namespace. Return the populated namespace." msgstr "" -#: ../../library/argparse.rst:1497 +#: ../../library/argparse.rst:1531 msgid "" "Previous calls to :meth:`add_argument` determine exactly what objects are " "created and how they are assigned. See the documentation for :meth:" "`add_argument` for details." msgstr "" -#: ../../library/argparse.rst:1501 +#: ../../library/argparse.rst:1535 msgid "" "args_ - List of strings to parse. The default is taken from :data:`sys." "argv`." msgstr "" -#: ../../library/argparse.rst:1504 +#: ../../library/argparse.rst:1538 msgid "" "namespace_ - An object to take the attributes. The default is a new empty :" "class:`Namespace` object." msgstr "" -#: ../../library/argparse.rst:1509 +#: ../../library/argparse.rst:1543 msgid "Option value syntax" msgstr "" -#: ../../library/argparse.rst:1511 +#: ../../library/argparse.rst:1545 msgid "" "The :meth:`~ArgumentParser.parse_args` method supports several ways of " "specifying the value of an option (if it takes one). In the simplest case, " "the option and its value are passed as two separate arguments::" msgstr "" -#: ../../library/argparse.rst:1515 +#: ../../library/argparse.rst:1549 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2729,14 +2775,14 @@ msgstr "" ">>> parser.parse_args(['--foo', 'FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1523 +#: ../../library/argparse.rst:1557 msgid "" "For long options (options with names longer than a single character), the " "option and value can also be passed as a single command-line argument, using " "``=`` to separate them::" msgstr "" -#: ../../library/argparse.rst:1527 +#: ../../library/argparse.rst:1561 msgid "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" @@ -2744,13 +2790,13 @@ msgstr "" ">>> parser.parse_args(['--foo=FOO'])\n" "Namespace(foo='FOO', x=None)" -#: ../../library/argparse.rst:1530 +#: ../../library/argparse.rst:1564 msgid "" "For short options (options only one character long), the option and its " "value can be concatenated::" msgstr "" -#: ../../library/argparse.rst:1533 +#: ../../library/argparse.rst:1567 msgid "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" @@ -2758,13 +2804,13 @@ msgstr "" ">>> parser.parse_args(['-xX'])\n" "Namespace(foo=None, x='X')" -#: ../../library/argparse.rst:1536 +#: ../../library/argparse.rst:1570 msgid "" "Several short options can be joined together, using only a single ``-`` " "prefix, as long as only the last option (or none of them) requires a value::" msgstr "" -#: ../../library/argparse.rst:1539 +#: ../../library/argparse.rst:1573 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x', action='store_true')\n" @@ -2780,11 +2826,11 @@ msgstr "" ">>> parser.parse_args(['-xyzZ'])\n" "Namespace(x=True, y=True, z='Z')" -#: ../../library/argparse.rst:1548 +#: ../../library/argparse.rst:1582 msgid "Invalid arguments" msgstr "" -#: ../../library/argparse.rst:1550 +#: ../../library/argparse.rst:1584 msgid "" "While parsing the command line, :meth:`~ArgumentParser.parse_args` checks " "for a variety of errors, including ambiguous options, invalid types, invalid " @@ -2792,7 +2838,7 @@ msgid "" "an error, it exits and prints the error along with a usage message::" msgstr "" -#: ../../library/argparse.rst:1555 +#: ../../library/argparse.rst:1589 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('--foo', type=int)\n" @@ -2814,11 +2860,11 @@ msgid "" "PROG: error: extra arguments found: badger" msgstr "" -#: ../../library/argparse.rst:1576 +#: ../../library/argparse.rst:1610 msgid "Arguments containing ``-``" msgstr "" -#: ../../library/argparse.rst:1578 +#: ../../library/argparse.rst:1612 msgid "" "The :meth:`~ArgumentParser.parse_args` method attempts to give errors " "whenever the user has clearly made a mistake, but some situations are " @@ -2830,7 +2876,7 @@ msgid "" "negative numbers::" msgstr "" -#: ../../library/argparse.rst:1586 +#: ../../library/argparse.rst:1620 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-x')\n" @@ -2863,7 +2909,7 @@ msgid "" "PROG: error: argument -1: expected one argument" msgstr "" -#: ../../library/argparse.rst:1616 +#: ../../library/argparse.rst:1650 msgid "" "If you have positional arguments that must begin with ``-`` and don't look " "like negative numbers, you can insert the pseudo-argument ``'--'`` which " @@ -2871,7 +2917,7 @@ msgid "" "positional argument::" msgstr "" -#: ../../library/argparse.rst:1621 +#: ../../library/argparse.rst:1655 msgid "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" @@ -2879,24 +2925,24 @@ msgstr "" ">>> parser.parse_args(['--', '-f'])\n" "Namespace(foo='-f', one=None)" -#: ../../library/argparse.rst:1624 +#: ../../library/argparse.rst:1658 msgid "" "See also :ref:`the argparse howto on ambiguous arguments ` for more details." msgstr "" -#: ../../library/argparse.rst:1630 +#: ../../library/argparse.rst:1664 msgid "Argument abbreviations (prefix matching)" msgstr "" -#: ../../library/argparse.rst:1632 +#: ../../library/argparse.rst:1666 msgid "" "The :meth:`~ArgumentParser.parse_args` method :ref:`by default " "` allows long options to be abbreviated to a prefix, if the " "abbreviation is unambiguous (the prefix matches a unique option)::" msgstr "" -#: ../../library/argparse.rst:1636 +#: ../../library/argparse.rst:1670 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> parser.add_argument('-bacon')\n" @@ -2920,17 +2966,17 @@ msgstr "" "usage: PROG [-h] [-bacon BACON] [-badger BADGER]\n" "PROG: error: ambiguous option: -ba could match -badger, -bacon" -#: ../../library/argparse.rst:1647 +#: ../../library/argparse.rst:1681 msgid "" "An error is produced for arguments that could produce more than one options. " "This feature can be disabled by setting :ref:`allow_abbrev` to ``False``." msgstr "" -#: ../../library/argparse.rst:1653 +#: ../../library/argparse.rst:1687 msgid "Beyond ``sys.argv``" msgstr "" -#: ../../library/argparse.rst:1655 +#: ../../library/argparse.rst:1689 msgid "" "Sometimes it may be useful to have an ArgumentParser parse arguments other " "than those of :data:`sys.argv`. This can be accomplished by passing a list " @@ -2938,7 +2984,7 @@ msgid "" "testing at the interactive prompt::" msgstr "" -#: ../../library/argparse.rst:1660 +#: ../../library/argparse.rst:1694 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument(\n" @@ -2964,24 +3010,24 @@ msgstr "" ">>> parser.parse_args(['1', '2', '3', '4', '--sum'])\n" "Namespace(accumulate=, integers=[1, 2, 3, 4])" -#: ../../library/argparse.rst:1675 +#: ../../library/argparse.rst:1709 msgid "The Namespace object" msgstr "" -#: ../../library/argparse.rst:1679 +#: ../../library/argparse.rst:1713 msgid "" "Simple class used by default by :meth:`~ArgumentParser.parse_args` to create " "an object holding attributes and return it." msgstr "" -#: ../../library/argparse.rst:1682 +#: ../../library/argparse.rst:1716 msgid "" "This class is deliberately simple, just an :class:`object` subclass with a " "readable string representation. If you prefer to have dict-like view of the " "attributes, you can use the standard Python idiom, :func:`vars`::" msgstr "" -#: ../../library/argparse.rst:1686 +#: ../../library/argparse.rst:1720 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -2995,14 +3041,14 @@ msgstr "" ">>> vars(args)\n" "{'foo': 'BAR'}" -#: ../../library/argparse.rst:1692 +#: ../../library/argparse.rst:1726 msgid "" "It may also be useful to have an :class:`ArgumentParser` assign attributes " "to an already existing object, rather than a new :class:`Namespace` object. " "This can be achieved by specifying the ``namespace=`` keyword argument::" msgstr "" -#: ../../library/argparse.rst:1696 +#: ../../library/argparse.rst:1730 msgid "" ">>> class C:\n" "... pass\n" @@ -3024,15 +3070,15 @@ msgstr "" ">>> c.foo\n" "'BAR'" -#: ../../library/argparse.rst:1708 +#: ../../library/argparse.rst:1742 msgid "Other utilities" msgstr "" -#: ../../library/argparse.rst:1711 +#: ../../library/argparse.rst:1745 msgid "Sub-commands" msgstr "" -#: ../../library/argparse.rst:1718 +#: ../../library/argparse.rst:1752 msgid "" "Many programs split up their functionality into a number of sub-commands, " "for example, the ``svn`` program can invoke sub-commands like ``svn " @@ -3048,69 +3094,69 @@ msgid "" "can be modified as usual." msgstr "" -#: ../../library/argparse.rst:1730 +#: ../../library/argparse.rst:1764 msgid "Description of parameters:" msgstr "" -#: ../../library/argparse.rst:1732 +#: ../../library/argparse.rst:1766 msgid "" "title - title for the sub-parser group in help output; by default " "\"subcommands\" if description is provided, otherwise uses title for " "positional arguments" msgstr "" -#: ../../library/argparse.rst:1736 +#: ../../library/argparse.rst:1770 msgid "" "description - description for the sub-parser group in help output, by " "default ``None``" msgstr "" -#: ../../library/argparse.rst:1739 +#: ../../library/argparse.rst:1773 msgid "" "prog - usage information that will be displayed with sub-command help, by " "default the name of the program and any positional arguments before the " "subparser argument" msgstr "" -#: ../../library/argparse.rst:1743 +#: ../../library/argparse.rst:1777 msgid "" "parser_class - class which will be used to create sub-parser instances, by " "default the class of the current parser (e.g. ArgumentParser)" msgstr "" -#: ../../library/argparse.rst:1746 +#: ../../library/argparse.rst:1780 msgid "" "action_ - the basic type of action to be taken when this argument is " "encountered at the command line" msgstr "" -#: ../../library/argparse.rst:1749 +#: ../../library/argparse.rst:1783 msgid "" "dest_ - name of the attribute under which sub-command name will be stored; " "by default ``None`` and no value is stored" msgstr "" -#: ../../library/argparse.rst:1752 +#: ../../library/argparse.rst:1786 msgid "" "required_ - Whether or not a subcommand must be provided, by default " "``False`` (added in 3.7)" msgstr "" -#: ../../library/argparse.rst:1755 +#: ../../library/argparse.rst:1789 msgid "help_ - help for sub-parser group in help output, by default ``None``" msgstr "" -#: ../../library/argparse.rst:1757 +#: ../../library/argparse.rst:1791 msgid "" "metavar_ - string presenting available sub-commands in help; by default it " "is ``None`` and presents sub-commands in form {cmd1, cmd2, ..}" msgstr "" -#: ../../library/argparse.rst:1760 +#: ../../library/argparse.rst:1794 msgid "Some example usage::" msgstr "一些使用範例: ::" -#: ../../library/argparse.rst:1762 +#: ../../library/argparse.rst:1796 msgid "" ">>> # create the top-level parser\n" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" @@ -3132,7 +3178,7 @@ msgid "" "Namespace(baz='Z', foo=True)" msgstr "" -#: ../../library/argparse.rst:1781 +#: ../../library/argparse.rst:1815 msgid "" "Note that the object returned by :meth:`parse_args` will only contain " "attributes for the main parser and the subparser that was selected by the " @@ -3142,7 +3188,7 @@ msgid "" "``baz`` attributes are present." msgstr "" -#: ../../library/argparse.rst:1788 +#: ../../library/argparse.rst:1822 msgid "" "Similarly, when a help message is requested from a subparser, only the help " "for that particular parser will be printed. The help message will not " @@ -3151,7 +3197,7 @@ msgid "" "to :meth:`~_SubParsersAction.add_parser` as above.)" msgstr "" -#: ../../library/argparse.rst:1796 +#: ../../library/argparse.rst:1830 msgid "" ">>> parser.parse_args(['--help'])\n" "usage: PROG [-h] [--foo] {a,b} ...\n" @@ -3209,14 +3255,14 @@ msgstr "" " -h, --help show this help message and exit\n" " --baz {X,Y,Z} baz help" -#: ../../library/argparse.rst:1824 +#: ../../library/argparse.rst:1858 msgid "" "The :meth:`add_subparsers` method also supports ``title`` and " "``description`` keyword arguments. When either is present, the subparser's " "commands will appear in their own group in the help output. For example::" msgstr "" -#: ../../library/argparse.rst:1828 +#: ../../library/argparse.rst:1862 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(title='subcommands',\n" @@ -3252,14 +3298,15 @@ msgstr "" "\n" " {foo,bar} additional help" -#: ../../library/argparse.rst:1845 +#: ../../library/argparse.rst:1879 msgid "" -"Furthermore, ``add_parser`` supports an additional ``aliases`` argument, " -"which allows multiple strings to refer to the same subparser. This example, " -"like ``svn``, aliases ``co`` as a shorthand for ``checkout``::" +"Furthermore, :meth:`~_SubParsersAction.add_parser` supports an additional " +"*aliases* argument, which allows multiple strings to refer to the same " +"subparser. This example, like ``svn``, aliases ``co`` as a shorthand for " +"``checkout``::" msgstr "" -#: ../../library/argparse.rst:1849 +#: ../../library/argparse.rst:1884 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers()\n" @@ -3275,7 +3322,13 @@ msgstr "" ">>> parser.parse_args(['co', 'bar'])\n" "Namespace(foo='bar')" -#: ../../library/argparse.rst:1856 +#: ../../library/argparse.rst:1891 +msgid "" +":meth:`~_SubParsersAction.add_parser` supports also an additional " +"*deprecated* argument, which allows to deprecate the subparser." +msgstr "" + +#: ../../library/argparse.rst:1905 msgid "" "One particularly effective way of handling sub-commands is to combine the " "use of the :meth:`add_subparsers` method with calls to :meth:`set_defaults` " @@ -3283,7 +3336,7 @@ msgid "" "example::" msgstr "" -#: ../../library/argparse.rst:1861 +#: ../../library/argparse.rst:1910 msgid "" ">>> # sub-command functions\n" ">>> def foo(args):\n" @@ -3318,7 +3371,7 @@ msgid "" "((XYZYX))" msgstr "" -#: ../../library/argparse.rst:1893 +#: ../../library/argparse.rst:1942 msgid "" "This way, you can let :meth:`parse_args` do the job of calling the " "appropriate function after argument parsing is complete. Associating " @@ -3328,7 +3381,7 @@ msgid "" "argument to the :meth:`add_subparsers` call will work::" msgstr "" -#: ../../library/argparse.rst:1900 +#: ../../library/argparse.rst:1949 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> subparsers = parser.add_subparsers(dest='subparser_name')\n" @@ -3348,15 +3401,15 @@ msgstr "" ">>> parser.parse_args(['2', 'frobble'])\n" "Namespace(subparser_name='2', y='frobble')" -#: ../../library/argparse.rst:1909 +#: ../../library/argparse.rst:1958 msgid "New *required* keyword argument." msgstr "" -#: ../../library/argparse.rst:1914 +#: ../../library/argparse.rst:1963 msgid "FileType objects" msgstr "FileType 物件" -#: ../../library/argparse.rst:1918 +#: ../../library/argparse.rst:1967 msgid "" "The :class:`FileType` factory creates objects that can be passed to the type " "argument of :meth:`ArgumentParser.add_argument`. Arguments that have :class:" @@ -3365,7 +3418,7 @@ msgid "" "the :func:`open` function for more details)::" msgstr "" -#: ../../library/argparse.rst:1924 +#: ../../library/argparse.rst:1973 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--raw', type=argparse.FileType('wb', 0))\n" @@ -3383,14 +3436,14 @@ msgstr "" "Namespace(out=<_io.TextIOWrapper name='file.txt' mode='w' encoding='UTF-8'>, " "raw=<_io.FileIO name='raw.dat' mode='wb'>)" -#: ../../library/argparse.rst:1930 +#: ../../library/argparse.rst:1979 msgid "" "FileType objects understand the pseudo-argument ``'-'`` and automatically " "convert this into :data:`sys.stdin` for readable :class:`FileType` objects " "and :data:`sys.stdout` for writable :class:`FileType` objects::" msgstr "" -#: ../../library/argparse.rst:1934 +#: ../../library/argparse.rst:1983 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('infile', type=argparse.FileType('r'))\n" @@ -3402,15 +3455,15 @@ msgstr "" ">>> parser.parse_args(['-'])\n" "Namespace(infile=<_io.TextIOWrapper name='' encoding='UTF-8'>)" -#: ../../library/argparse.rst:1939 +#: ../../library/argparse.rst:1988 msgid "Added the *encodings* and *errors* parameters." msgstr "" -#: ../../library/argparse.rst:1944 +#: ../../library/argparse.rst:1993 msgid "Argument groups" msgstr "" -#: ../../library/argparse.rst:1948 +#: ../../library/argparse.rst:1997 msgid "" "By default, :class:`ArgumentParser` groups command-line arguments into " "\"positional arguments\" and \"options\" when displaying help messages. When " @@ -3419,7 +3472,7 @@ msgid "" "method::" msgstr "" -#: ../../library/argparse.rst:1954 +#: ../../library/argparse.rst:2003 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group = parser.add_argument_group('group')\n" @@ -3443,7 +3496,7 @@ msgstr "" " bar bar help\n" " --foo FOO foo help" -#: ../../library/argparse.rst:1965 +#: ../../library/argparse.rst:2014 msgid "" "The :meth:`add_argument_group` method returns an argument group object which " "has an :meth:`~ArgumentParser.add_argument` method just like a regular :" @@ -3454,7 +3507,7 @@ msgid "" "this display::" msgstr "" -#: ../../library/argparse.rst:1973 +#: ../../library/argparse.rst:2022 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG', add_help=False)\n" ">>> group1 = parser.add_argument_group('group1', 'group1 description')\n" @@ -3492,13 +3545,13 @@ msgstr "" "\n" " --bar BAR bar help" -#: ../../library/argparse.rst:1991 +#: ../../library/argparse.rst:2040 msgid "" "Note that any arguments not in your user-defined groups will end up back in " "the usual \"positional arguments\" and \"optional arguments\" sections." msgstr "" -#: ../../library/argparse.rst:1994 +#: ../../library/argparse.rst:2043 msgid "" "Calling :meth:`add_argument_group` on an argument group is deprecated. This " "feature was never supported and does not always work correctly. The function " @@ -3506,18 +3559,18 @@ msgid "" "future." msgstr "" -#: ../../library/argparse.rst:2002 +#: ../../library/argparse.rst:2051 msgid "Mutual exclusion" msgstr "" -#: ../../library/argparse.rst:2006 +#: ../../library/argparse.rst:2055 msgid "" "Create a mutually exclusive group. :mod:`argparse` will make sure that only " "one of the arguments in the mutually exclusive group was present on the " "command line::" msgstr "" -#: ../../library/argparse.rst:2010 +#: ../../library/argparse.rst:2059 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group()\n" @@ -3543,14 +3596,14 @@ msgstr "" "usage: PROG [-h] [--foo | --bar]\n" "PROG: error: argument --bar: not allowed with argument --foo" -#: ../../library/argparse.rst:2022 +#: ../../library/argparse.rst:2071 msgid "" "The :meth:`add_mutually_exclusive_group` method also accepts a *required* " "argument, to indicate that at least one of the mutually exclusive arguments " "is required::" msgstr "" -#: ../../library/argparse.rst:2026 +#: ../../library/argparse.rst:2075 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_mutually_exclusive_group(required=True)\n" @@ -3568,7 +3621,7 @@ msgstr "" "usage: PROG [-h] (--foo | --bar)\n" "PROG: error: one of the arguments --foo --bar is required" -#: ../../library/argparse.rst:2034 +#: ../../library/argparse.rst:2083 msgid "" "Note that currently mutually exclusive argument groups do not support the " "*title* and *description* arguments of :meth:`~ArgumentParser." @@ -3576,7 +3629,7 @@ msgid "" "argument group that has a title and description. For example::" msgstr "" -#: ../../library/argparse.rst:2040 +#: ../../library/argparse.rst:2089 msgid "" ">>> parser = argparse.ArgumentParser(prog='PROG')\n" ">>> group = parser.add_argument_group('Group title', 'Group description')\n" @@ -3612,7 +3665,7 @@ msgstr "" " --foo FOO foo help\n" " --bar BAR bar help" -#: ../../library/argparse.rst:2057 +#: ../../library/argparse.rst:2106 msgid "" "Calling :meth:`add_argument_group` or :meth:`add_mutually_exclusive_group` " "on a mutually exclusive group is deprecated. These features were never " @@ -3620,11 +3673,11 @@ msgid "" "by accident through inheritance and will be removed in the future." msgstr "" -#: ../../library/argparse.rst:2065 +#: ../../library/argparse.rst:2114 msgid "Parser defaults" msgstr "" -#: ../../library/argparse.rst:2069 +#: ../../library/argparse.rst:2118 msgid "" "Most of the time, the attributes of the object returned by :meth:" "`parse_args` will be fully determined by inspecting the command-line " @@ -3633,7 +3686,7 @@ msgid "" "command line to be added::" msgstr "" -#: ../../library/argparse.rst:2075 +#: ../../library/argparse.rst:2124 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('foo', type=int)\n" @@ -3647,12 +3700,12 @@ msgstr "" ">>> parser.parse_args(['736'])\n" "Namespace(bar=42, baz='badger', foo=736)" -#: ../../library/argparse.rst:2081 +#: ../../library/argparse.rst:2130 msgid "" "Note that parser-level defaults always override argument-level defaults::" msgstr "" -#: ../../library/argparse.rst:2083 +#: ../../library/argparse.rst:2132 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='bar')\n" @@ -3666,20 +3719,20 @@ msgstr "" ">>> parser.parse_args([])\n" "Namespace(foo='spam')" -#: ../../library/argparse.rst:2089 +#: ../../library/argparse.rst:2138 msgid "" "Parser-level defaults can be particularly useful when working with multiple " "parsers. See the :meth:`~ArgumentParser.add_subparsers` method for an " "example of this type." msgstr "" -#: ../../library/argparse.rst:2095 +#: ../../library/argparse.rst:2144 msgid "" "Get the default value for a namespace attribute, as set by either :meth:" "`~ArgumentParser.add_argument` or by :meth:`~ArgumentParser.set_defaults`::" msgstr "" -#: ../../library/argparse.rst:2099 +#: ../../library/argparse.rst:2148 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', default='badger')\n" @@ -3691,54 +3744,54 @@ msgstr "" ">>> parser.get_default('foo')\n" "'badger'" -#: ../../library/argparse.rst:2106 +#: ../../library/argparse.rst:2155 msgid "Printing help" msgstr "" -#: ../../library/argparse.rst:2108 +#: ../../library/argparse.rst:2157 msgid "" "In most typical applications, :meth:`~ArgumentParser.parse_args` will take " "care of formatting and printing any usage or error messages. However, " "several formatting methods are available:" msgstr "" -#: ../../library/argparse.rst:2114 +#: ../../library/argparse.rst:2163 msgid "" "Print a brief description of how the :class:`ArgumentParser` should be " "invoked on the command line. If *file* is ``None``, :data:`sys.stdout` is " "assumed." msgstr "" -#: ../../library/argparse.rst:2120 +#: ../../library/argparse.rst:2169 msgid "" "Print a help message, including the program usage and information about the " "arguments registered with the :class:`ArgumentParser`. If *file* is " "``None``, :data:`sys.stdout` is assumed." msgstr "" -#: ../../library/argparse.rst:2124 +#: ../../library/argparse.rst:2173 msgid "" "There are also variants of these methods that simply return a string instead " "of printing it:" msgstr "" -#: ../../library/argparse.rst:2129 +#: ../../library/argparse.rst:2178 msgid "" "Return a string containing a brief description of how the :class:" "`ArgumentParser` should be invoked on the command line." msgstr "" -#: ../../library/argparse.rst:2134 +#: ../../library/argparse.rst:2183 msgid "" "Return a string containing a help message, including the program usage and " "information about the arguments registered with the :class:`ArgumentParser`." msgstr "" -#: ../../library/argparse.rst:2139 +#: ../../library/argparse.rst:2188 msgid "Partial parsing" msgstr "" -#: ../../library/argparse.rst:2143 +#: ../../library/argparse.rst:2192 msgid "" "Sometimes a script may only parse a few of the command-line arguments, " "passing the remaining arguments on to another script or program. In these " @@ -3749,7 +3802,7 @@ msgid "" "remaining argument strings." msgstr "" -#: ../../library/argparse.rst:2152 +#: ../../library/argparse.rst:2201 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo', action='store_true')\n" @@ -3763,7 +3816,7 @@ msgstr "" ">>> parser.parse_known_args(['--foo', '--badger', 'BAR', 'spam'])\n" "(Namespace(bar='BAR', foo=True), ['--badger', 'spam'])" -#: ../../library/argparse.rst:2159 +#: ../../library/argparse.rst:2208 msgid "" ":ref:`Prefix matching ` rules apply to :meth:" "`~ArgumentParser.parse_known_args`. The parser may consume an option even if " @@ -3771,11 +3824,11 @@ msgid "" "remaining arguments list." msgstr "" -#: ../../library/argparse.rst:2166 +#: ../../library/argparse.rst:2215 msgid "Customizing file parsing" msgstr "" -#: ../../library/argparse.rst:2170 +#: ../../library/argparse.rst:2219 msgid "" "Arguments that are read from a file (see the *fromfile_prefix_chars* keyword " "argument to the :class:`ArgumentParser` constructor) are read one argument " @@ -3783,20 +3836,20 @@ msgid "" "reading." msgstr "" -#: ../../library/argparse.rst:2175 +#: ../../library/argparse.rst:2224 msgid "" "This method takes a single argument *arg_line* which is a string read from " "the argument file. It returns a list of arguments parsed from this string. " "The method is called once per line read from the argument file, in order." msgstr "" -#: ../../library/argparse.rst:2179 +#: ../../library/argparse.rst:2228 msgid "" "A useful override of this method is one that treats each space-separated " "word as an argument. The following example demonstrates how to do this::" msgstr "" -#: ../../library/argparse.rst:2182 +#: ../../library/argparse.rst:2231 msgid "" "class MyArgumentParser(argparse.ArgumentParser):\n" " def convert_arg_line_to_args(self, arg_line):\n" @@ -3806,18 +3859,18 @@ msgstr "" " def convert_arg_line_to_args(self, arg_line):\n" " return arg_line.split()" -#: ../../library/argparse.rst:2188 +#: ../../library/argparse.rst:2237 msgid "Exiting methods" msgstr "" -#: ../../library/argparse.rst:2192 +#: ../../library/argparse.rst:2241 msgid "" "This method terminates the program, exiting with the specified *status* and, " -"if given, it prints a *message* before that. The user can override this " -"method to handle these steps differently::" +"if given, it prints a *message* to :data:`sys.stderr` before that. The user " +"can override this method to handle these steps differently::" msgstr "" -#: ../../library/argparse.rst:2196 +#: ../../library/argparse.rst:2245 msgid "" "class ErrorCatchingArgumentParser(argparse.ArgumentParser):\n" " def exit(self, status=0, message=None):\n" @@ -3831,17 +3884,17 @@ msgstr "" " raise Exception(f'Exiting because of an error: {message}')\n" " exit(status)" -#: ../../library/argparse.rst:2204 +#: ../../library/argparse.rst:2253 msgid "" -"This method prints a usage message including the *message* to the standard " -"error and terminates the program with a status code of 2." +"This method prints a usage message, including the *message*, to :data:`sys." +"stderr` and terminates the program with a status code of 2." msgstr "" -#: ../../library/argparse.rst:2209 +#: ../../library/argparse.rst:2258 msgid "Intermixed parsing" msgstr "" -#: ../../library/argparse.rst:2214 +#: ../../library/argparse.rst:2263 msgid "" "A number of Unix commands allow the user to intermix optional arguments with " "positional arguments. The :meth:`~ArgumentParser.parse_intermixed_args` " @@ -3849,7 +3902,7 @@ msgid "" "parsing style." msgstr "" -#: ../../library/argparse.rst:2219 +#: ../../library/argparse.rst:2268 msgid "" "These parsers do not support all the argparse features, and will raise " "exceptions if unsupported features are used. In particular, subparsers, and " @@ -3857,7 +3910,7 @@ msgid "" "not supported." msgstr "" -#: ../../library/argparse.rst:2224 +#: ../../library/argparse.rst:2273 msgid "" "The following example shows the difference between :meth:`~ArgumentParser." "parse_known_args` and :meth:`~ArgumentParser.parse_intermixed_args`: the " @@ -3865,7 +3918,7 @@ msgid "" "collects all the positionals into ``rest``. ::" msgstr "" -#: ../../library/argparse.rst:2230 +#: ../../library/argparse.rst:2279 msgid "" ">>> parser = argparse.ArgumentParser()\n" ">>> parser.add_argument('--foo')\n" @@ -3885,7 +3938,7 @@ msgstr "" ">>> parser.parse_intermixed_args('doit 1 --foo bar 2 3'.split())\n" "Namespace(cmd='doit', foo='bar', rest=[1, 2, 3])" -#: ../../library/argparse.rst:2239 +#: ../../library/argparse.rst:2288 msgid "" ":meth:`~ArgumentParser.parse_known_intermixed_args` returns a two item tuple " "containing the populated namespace and the list of remaining argument " @@ -3893,11 +3946,11 @@ msgid "" "there are any remaining unparsed argument strings." msgstr "" -#: ../../library/argparse.rst:2249 +#: ../../library/argparse.rst:2298 msgid "Upgrading optparse code" msgstr "" -#: ../../library/argparse.rst:2251 +#: ../../library/argparse.rst:2300 msgid "" "Originally, the :mod:`argparse` module had attempted to maintain " "compatibility with :mod:`optparse`. However, :mod:`optparse` was difficult " @@ -3908,47 +3961,47 @@ msgid "" "compatibility." msgstr "" -#: ../../library/argparse.rst:2258 +#: ../../library/argparse.rst:2307 msgid "" "The :mod:`argparse` module improves on the standard library :mod:`optparse` " "module in a number of ways including:" msgstr "" -#: ../../library/argparse.rst:2261 +#: ../../library/argparse.rst:2310 msgid "Handling positional arguments." msgstr "" -#: ../../library/argparse.rst:2262 +#: ../../library/argparse.rst:2311 msgid "Supporting sub-commands." msgstr "" -#: ../../library/argparse.rst:2263 +#: ../../library/argparse.rst:2312 msgid "Allowing alternative option prefixes like ``+`` and ``/``." msgstr "" -#: ../../library/argparse.rst:2264 +#: ../../library/argparse.rst:2313 msgid "Handling zero-or-more and one-or-more style arguments." msgstr "" -#: ../../library/argparse.rst:2265 +#: ../../library/argparse.rst:2314 msgid "Producing more informative usage messages." msgstr "" -#: ../../library/argparse.rst:2266 +#: ../../library/argparse.rst:2315 msgid "Providing a much simpler interface for custom ``type`` and ``action``." msgstr "" -#: ../../library/argparse.rst:2268 +#: ../../library/argparse.rst:2317 msgid "A partial upgrade path from :mod:`optparse` to :mod:`argparse`:" msgstr "" -#: ../../library/argparse.rst:2270 +#: ../../library/argparse.rst:2319 msgid "" "Replace all :meth:`optparse.OptionParser.add_option` calls with :meth:" "`ArgumentParser.add_argument` calls." msgstr "" -#: ../../library/argparse.rst:2273 +#: ../../library/argparse.rst:2322 msgid "" "Replace ``(options, args) = parser.parse_args()`` with ``args = parser." "parse_args()`` and add additional :meth:`ArgumentParser.add_argument` calls " @@ -3956,78 +4009,78 @@ msgid "" "``options``, now in the :mod:`argparse` context is called ``args``." msgstr "" -#: ../../library/argparse.rst:2278 +#: ../../library/argparse.rst:2327 msgid "" "Replace :meth:`optparse.OptionParser.disable_interspersed_args` by using :" "meth:`~ArgumentParser.parse_intermixed_args` instead of :meth:" "`~ArgumentParser.parse_args`." msgstr "" -#: ../../library/argparse.rst:2282 +#: ../../library/argparse.rst:2331 msgid "" "Replace callback actions and the ``callback_*`` keyword arguments with " "``type`` or ``action`` arguments." msgstr "" -#: ../../library/argparse.rst:2285 +#: ../../library/argparse.rst:2334 msgid "" "Replace string names for ``type`` keyword arguments with the corresponding " "type objects (e.g. int, float, complex, etc)." msgstr "" -#: ../../library/argparse.rst:2288 +#: ../../library/argparse.rst:2337 msgid "" "Replace :class:`optparse.Values` with :class:`Namespace` and :exc:`optparse." "OptionError` and :exc:`optparse.OptionValueError` with :exc:`ArgumentError`." msgstr "" -#: ../../library/argparse.rst:2292 +#: ../../library/argparse.rst:2341 msgid "" "Replace strings with implicit arguments such as ``%default`` or ``%prog`` " "with the standard Python syntax to use dictionaries to format strings, that " "is, ``%(default)s`` and ``%(prog)s``." msgstr "" -#: ../../library/argparse.rst:2296 +#: ../../library/argparse.rst:2345 msgid "" "Replace the OptionParser constructor ``version`` argument with a call to " "``parser.add_argument('--version', action='version', version='')``." msgstr "" -#: ../../library/argparse.rst:2300 +#: ../../library/argparse.rst:2349 msgid "Exceptions" msgstr "" -#: ../../library/argparse.rst:2304 +#: ../../library/argparse.rst:2353 msgid "An error from creating or using an argument (optional or positional)." msgstr "" -#: ../../library/argparse.rst:2306 +#: ../../library/argparse.rst:2355 msgid "" "The string value of this exception is the message, augmented with " "information about the argument that caused it." msgstr "" -#: ../../library/argparse.rst:2311 +#: ../../library/argparse.rst:2360 msgid "" "Raised when something goes wrong converting a command line string to a type." msgstr "" -#: ../../library/argparse.rst:980 +#: ../../library/argparse.rst:983 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/argparse.rst:980 ../../library/argparse.rst:1014 -#: ../../library/argparse.rst:1028 +#: ../../library/argparse.rst:983 ../../library/argparse.rst:1017 +#: ../../library/argparse.rst:1031 msgid "in argparse module" msgstr "於 argparse 模組中" -#: ../../library/argparse.rst:1014 +#: ../../library/argparse.rst:1017 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/argparse.rst:1028 +#: ../../library/argparse.rst:1031 msgid "+ (plus)" msgstr "+ (加號)" diff --git a/library/array.po b/library/array.po index 9fb7774db1..8d66dac4e6 100644 --- a/library/array.po +++ b/library/array.po @@ -8,9 +8,9 @@ # Benson Chen , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-11-23 18:40+0800\n" "Last-Translator: Benson Chen \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -69,10 +69,10 @@ msgid "signed char" msgstr "signed char" #: ../../library/array.rst:21 ../../library/array.rst:23 -#: ../../library/array.rst:27 ../../library/array.rst:29 -#: ../../library/array.rst:31 ../../library/array.rst:33 -#: ../../library/array.rst:35 ../../library/array.rst:37 -#: ../../library/array.rst:39 ../../library/array.rst:41 +#: ../../library/array.rst:29 ../../library/array.rst:31 +#: ../../library/array.rst:33 ../../library/array.rst:35 +#: ../../library/array.rst:37 ../../library/array.rst:39 +#: ../../library/array.rst:41 ../../library/array.rst:43 msgid "int" msgstr "int" @@ -96,13 +96,13 @@ msgstr "``'u'``" msgid "wchar_t" msgstr "wchar_t" -#: ../../library/array.rst:25 +#: ../../library/array.rst:25 ../../library/array.rst:27 msgid "Unicode character" msgstr "Unicode character" -#: ../../library/array.rst:25 ../../library/array.rst:27 -#: ../../library/array.rst:29 ../../library/array.rst:31 -#: ../../library/array.rst:33 +#: ../../library/array.rst:25 ../../library/array.rst:29 +#: ../../library/array.rst:31 ../../library/array.rst:33 +#: ../../library/array.rst:35 msgid "2" msgstr "2" @@ -111,104 +111,112 @@ msgid "\\(1)" msgstr "\\(1)" #: ../../library/array.rst:27 +msgid "``'w'``" +msgstr "``'w'``" + +#: ../../library/array.rst:27 +msgid "Py_UCS4" +msgstr "Py_UCS4" + +#: ../../library/array.rst:27 ../../library/array.rst:37 +#: ../../library/array.rst:39 ../../library/array.rst:45 +msgid "4" +msgstr "4" + +#: ../../library/array.rst:29 msgid "``'h'``" msgstr "``'h'``" -#: ../../library/array.rst:27 +#: ../../library/array.rst:29 msgid "signed short" msgstr "signed short" -#: ../../library/array.rst:29 +#: ../../library/array.rst:31 msgid "``'H'``" msgstr "``'H'``" -#: ../../library/array.rst:29 +#: ../../library/array.rst:31 msgid "unsigned short" msgstr "unsigned short" -#: ../../library/array.rst:31 +#: ../../library/array.rst:33 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/array.rst:31 +#: ../../library/array.rst:33 msgid "signed int" msgstr "signed int" -#: ../../library/array.rst:33 +#: ../../library/array.rst:35 msgid "``'I'``" msgstr "``'I'``" -#: ../../library/array.rst:33 +#: ../../library/array.rst:35 msgid "unsigned int" msgstr "unsigned int" -#: ../../library/array.rst:35 +#: ../../library/array.rst:37 msgid "``'l'``" msgstr "``'l'``" -#: ../../library/array.rst:35 +#: ../../library/array.rst:37 msgid "signed long" msgstr "signed long" -#: ../../library/array.rst:35 ../../library/array.rst:37 -#: ../../library/array.rst:43 -msgid "4" -msgstr "4" - -#: ../../library/array.rst:37 +#: ../../library/array.rst:39 msgid "``'L'``" msgstr "``'L'``" -#: ../../library/array.rst:37 +#: ../../library/array.rst:39 msgid "unsigned long" msgstr "unsigned long" -#: ../../library/array.rst:39 +#: ../../library/array.rst:41 msgid "``'q'``" msgstr "``'q'``" -#: ../../library/array.rst:39 +#: ../../library/array.rst:41 msgid "signed long long" msgstr "signed long long" -#: ../../library/array.rst:39 ../../library/array.rst:41 -#: ../../library/array.rst:45 +#: ../../library/array.rst:41 ../../library/array.rst:43 +#: ../../library/array.rst:47 msgid "8" msgstr "8" -#: ../../library/array.rst:41 +#: ../../library/array.rst:43 msgid "``'Q'``" msgstr "``'Q'``" -#: ../../library/array.rst:41 +#: ../../library/array.rst:43 msgid "unsigned long long" msgstr "unsigned long long" -#: ../../library/array.rst:43 +#: ../../library/array.rst:45 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/array.rst:43 ../../library/array.rst:45 +#: ../../library/array.rst:45 ../../library/array.rst:47 msgid "float" msgstr "float" -#: ../../library/array.rst:45 +#: ../../library/array.rst:47 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/array.rst:45 +#: ../../library/array.rst:47 msgid "double" msgstr "double" -#: ../../library/array.rst:48 +#: ../../library/array.rst:50 msgid "Notes:" msgstr "註解:" -#: ../../library/array.rst:51 +#: ../../library/array.rst:53 msgid "It can be 16 bits or 32 bits depending on the platform." msgstr "根據平台的不同,它有可能是 16 位元或者 32 位元。" -#: ../../library/array.rst:53 +#: ../../library/array.rst:55 msgid "" "``array('u')`` now uses :c:type:`wchar_t` as C type instead of deprecated " "``Py_UNICODE``. This change doesn't affect its behavior because " @@ -218,7 +226,11 @@ msgstr "" "C type。這個異動並沒有影響到它的作用,因爲自從 Python 3.3 開始 " "``Py_UNICODE`` 即為 :c:type:`wchar_t` 的別名。" -#: ../../library/array.rst:61 +#: ../../library/array.rst:60 +msgid "Please migrate to ``'w'`` typecode." +msgstr "" + +#: ../../library/array.rst:64 msgid "" "The actual representation of values is determined by the machine " "architecture (strictly speaking, by the C implementation). The actual size " @@ -227,19 +239,19 @@ msgstr "" "實際上數值的表示方法是被機器的架構所決定(更精準地說,被 C 的實作方法決定)。" "實際的大小可以透過 :attr:`array.itemsize` 屬性存取。" -#: ../../library/array.rst:65 +#: ../../library/array.rst:68 msgid "The module defines the following item:" msgstr "這個模組定義了以下項目:" -#: ../../library/array.rst:70 +#: ../../library/array.rst:73 msgid "A string with all available type codes." msgstr "一個包含所有可用的 type codes 的字串。" -#: ../../library/array.rst:73 +#: ../../library/array.rst:76 msgid "The module defines the following type:" msgstr "這個模組定義了下方的型別:" -#: ../../library/array.rst:78 +#: ../../library/array.rst:81 msgid "" "A new array whose items are restricted by *typecode*, and initialized from " "the optional *initializer* value, which must be a :class:`bytes` or :class:" @@ -250,7 +262,7 @@ msgstr "" "*initializer* 必須是一個 :class:`bytes` 或 :class:`bytearray` 物件、一個 " "Unicode 字串或包含適當型別元素的可疊代物件 (iterable)。" -#: ../../library/array.rst:83 +#: ../../library/array.rst:86 msgid "" "If given a :class:`bytes` or :class:`bytearray` object, the initializer is " "passed to the new array's :meth:`frombytes` method; if given a Unicode " @@ -263,7 +275,7 @@ msgstr "" "方法;其他情況時, 一個 initializer 的可疊代物件將被傳入 :meth:`extend` 方法" "之中來將初始項目新增至陣列。" -#: ../../library/array.rst:90 +#: ../../library/array.rst:93 msgid "" "Array objects support the ordinary sequence operations of indexing, slicing, " "concatenation, and multiplication. When using slice assignment, the " @@ -278,7 +290,7 @@ msgstr "" "了緩衝區介面,可以在任何支援 :term:`bytes-like objects ` " "的地方使用。" -#: ../../library/array.rst:96 +#: ../../library/array.rst:99 msgid "" "Raises an :ref:`auditing event ` ``array.__new__`` with arguments " "``typecode``, ``initializer``." @@ -286,19 +298,19 @@ msgstr "" "引發\\ :ref:`稽核事件 (auditing event) ` ``array.__new__`` 並附帶引" "數 ``typecode``、``initializer``。" -#: ../../library/array.rst:101 +#: ../../library/array.rst:104 msgid "The typecode character used to create the array." msgstr "typecode 字元被用在建立陣列時。" -#: ../../library/array.rst:106 +#: ../../library/array.rst:109 msgid "The length in bytes of one array item in the internal representation." msgstr "陣列當中的一個元素在內部需要的位元組長度。" -#: ../../library/array.rst:111 +#: ../../library/array.rst:114 msgid "Append a new item with value *x* to the end of the array." msgstr "新增一個元素 *x* 到陣列的最尾端。" -#: ../../library/array.rst:116 +#: ../../library/array.rst:119 msgid "" "Return a tuple ``(address, length)`` giving the current memory address and " "the length in elements of the buffer used to hold array's contents. The " @@ -315,7 +327,7 @@ msgstr "" "用,例如 :c:func:`!ioctl` 指令。只要陣列存在且沒有使用任何更改長度的操作時," "回傳的數值就有效。" -#: ../../library/array.rst:126 +#: ../../library/array.rst:129 msgid "" "When using array objects from code written in C or C++ (the only way to " "effectively make use of this information), it makes more sense to use the " @@ -327,7 +339,7 @@ msgstr "" "適當的做法是使用陣列物件支援的緩衝區介面。這個方法維護了向後兼容性,並應該在" "新的程式碼中避免。關於緩衝區介面的文件在\\ :ref:`bufferobjects`。" -#: ../../library/array.rst:135 +#: ../../library/array.rst:138 msgid "" "\"Byteswap\" all items of the array. This is only supported for values " "which are 1, 2, 4, or 8 bytes in size; for other types of values, :exc:" @@ -338,11 +350,11 @@ msgstr "" "列,其他型別的值會導致 :exc:`RuntimeError`。這在從機器讀取位元順序不同的檔案" "時很有用。" -#: ../../library/array.rst:143 +#: ../../library/array.rst:146 msgid "Return the number of occurrences of *x* in the array." msgstr "回傳 *x* 在陣列中出現了幾次。" -#: ../../library/array.rst:148 +#: ../../library/array.rst:151 msgid "" "Append items from *iterable* to the end of the array. If *iterable* is " "another array, it must have *exactly* the same type code; if not, :exc:" @@ -354,7 +366,7 @@ msgstr "" "個陣列,它必須可以被疊代 (iterable) 且其中的元素必須是可以被加入陣列中的正確" "型別。" -#: ../../library/array.rst:156 +#: ../../library/array.rst:159 msgid "" "Appends items from the :term:`bytes-like object`, interpreting its content " "as an array of machine values (as if it had been read from a file using the :" @@ -363,11 +375,11 @@ msgstr "" "從 :term:`bytes-like object` 中新增元素。讀取時會將其內容當作一個機器數值組成" "的陣列(就像從檔案中使用 :meth:`fromfile` 方法讀出的資料)。" -#: ../../library/array.rst:160 +#: ../../library/array.rst:163 msgid ":meth:`!fromstring` is renamed to :meth:`frombytes` for clarity." msgstr "將 :meth:`!fromstring` 更名為 :meth:`frombytes`,使其更加清晰易懂。" -#: ../../library/array.rst:166 +#: ../../library/array.rst:169 msgid "" "Read *n* items (as machine values) from the :term:`file object` *f* and " "append them to the end of the array. If less than *n* items are available, :" @@ -378,7 +390,7 @@ msgstr "" "入陣列的最尾端。如果只有少於 *n* 個有效的元素會導致 :exc:`EOFError`,但有效的" "元素仍然會被加入陣列中。" -#: ../../library/array.rst:174 +#: ../../library/array.rst:177 msgid "" "Append items from the list. This is equivalent to ``for x in list: a." "append(x)`` except that if there is a type error, the array is unchanged." @@ -386,18 +398,19 @@ msgstr "" "從 list 中新增元素。這等價於 ``for x in list: a.append(x)``,除了有型別錯誤產" "生時,陣列會保持原狀不會被更改。" -#: ../../library/array.rst:180 +#: ../../library/array.rst:183 +#, fuzzy msgid "" "Extends this array with data from the given Unicode string. The array must " -"have type code ``'u'``; otherwise a :exc:`ValueError` is raised. Use ``array." -"frombytes(unicodestring.encode(enc))`` to append Unicode data to an array of " -"some other type." +"have type code ``'u'`` or ``'w'``; otherwise a :exc:`ValueError` is raised. " +"Use ``array.frombytes(unicodestring.encode(enc))`` to append Unicode data to " +"an array of some other type." msgstr "" "用給定的 Unicode 字串擴展這個陣列。陣列的 type code 必須是 ``u``;其他的型別" "會導致 :exc:`ValueError` 被引發。使用 ``array.frombytes(unicodestring." "encode(enc))`` 來新增 Unicode 資料到一個其他型別的陣列。" -#: ../../library/array.rst:188 +#: ../../library/array.rst:191 msgid "" "Return the smallest *i* such that *i* is the index of the first occurrence " "of *x* in the array. The optional arguments *start* and *stop* can be " @@ -408,17 +421,17 @@ msgstr "" "數 *start* 及 *stop* 則可以被用來在指定的陣列空間中搜尋 *x*。如果 *x* 不存在" "將導致 :exc:`ValueError`。" -#: ../../library/array.rst:193 +#: ../../library/array.rst:196 msgid "Added optional *start* and *stop* parameters." msgstr "新增選擇性的參數 *start* 及 *stop*。" -#: ../../library/array.rst:199 +#: ../../library/array.rst:202 msgid "" "Insert a new item with value *x* in the array before position *i*. Negative " "values are treated as being relative to the end of the array." msgstr "在位置 *i* 之前插入一個元素 *x*。負數的索引值會從陣列尾端開始數。" -#: ../../library/array.rst:205 +#: ../../library/array.rst:208 msgid "" "Removes the item with the index *i* from the array and returns it. The " "optional argument defaults to ``-1``, so that by default the last item is " @@ -427,15 +440,20 @@ msgstr "" "移除並回傳陣列索引值 *i* 的元素。選擇性的引數 *i* 預設為 ``-1``,所以預設會刪" "除並回傳最後一個元素。" -#: ../../library/array.rst:212 +#: ../../library/array.rst:215 msgid "Remove the first occurrence of *x* from the array." msgstr "從陣列中刪除第一個出現的 *x*。" -#: ../../library/array.rst:217 +#: ../../library/array.rst:220 +#, fuzzy +msgid "Remove all elements from the array." +msgstr "從陣列中刪除第一個出現的 *x*。" + +#: ../../library/array.rst:227 msgid "Reverse the order of the items in the array." msgstr "反轉陣列中元素的順序。" -#: ../../library/array.rst:222 +#: ../../library/array.rst:232 msgid "" "Convert the array to an array of machine values and return the bytes " "representation (the same sequence of bytes that would be written to a file " @@ -444,38 +462,41 @@ msgstr "" "將陣列轉為另一個機器數值組成的陣列並回傳它的位元組表示(跟用 :meth:`tofile` " "方法寫入檔案時的位元序列相同)。" -#: ../../library/array.rst:226 +#: ../../library/array.rst:236 msgid ":meth:`!tostring` is renamed to :meth:`tobytes` for clarity." msgstr "為了明確性,過去的 :meth:`!tostring` 已更名為 :meth:`tobytes`。" -#: ../../library/array.rst:232 +#: ../../library/array.rst:242 msgid "Write all items (as machine values) to the :term:`file object` *f*." msgstr "將所有元素(作為機器數值)寫入 :term:`file object` *f*。" -#: ../../library/array.rst:237 +#: ../../library/array.rst:247 msgid "Convert the array to an ordinary list with the same items." msgstr "不更改元素,將陣列轉為一般的 list。" -#: ../../library/array.rst:242 +#: ../../library/array.rst:252 +#, fuzzy msgid "" -"Convert the array to a Unicode string. The array must have a type ``'u'``; " -"otherwise a :exc:`ValueError` is raised. Use ``array.tobytes().decode(enc)`` " -"to obtain a Unicode string from an array of some other type." +"Convert the array to a Unicode string. The array must have a type ``'u'`` " +"or ``'w'``; otherwise a :exc:`ValueError` is raised. Use ``array.tobytes()." +"decode(enc)`` to obtain a Unicode string from an array of some other type." msgstr "" "將陣列轉為一個 Unicode 字串。陣列的型別必須為 ``u``。其他型別的陣列會導致 :" "exc:`ValueError` 錯誤。請使用 ``array.tobytes().decode(enc)`` 來為其他型別的" "陣列轉為 Unicode 字串。" -#: ../../library/array.rst:247 +#: ../../library/array.rst:257 +#, fuzzy msgid "" "The string representation of array objects has the form ``array(typecode, " "initializer)``. The *initializer* is omitted if the array is empty, " -"otherwise it is a Unicode string if the *typecode* is ``'u'``, otherwise it " -"is a list of numbers. The string representation is guaranteed to be able to " -"be converted back to an array with the same type and value using :func:" -"`eval`, so long as the :class:`~array.array` class has been imported using " -"``from array import array``. Variables ``inf`` and ``nan`` must also be " -"defined if it contains corresponding floating-point values. Examples::" +"otherwise it is a Unicode string if the *typecode* is ``'u'`` or ``'w'``, " +"otherwise it is a list of numbers. The string representation is guaranteed " +"to be able to be converted back to an array with the same type and value " +"using :func:`eval`, so long as the :class:`~array.array` class has been " +"imported using ``from array import array``. Variables ``inf`` and ``nan`` " +"must also be defined if it contains corresponding floating-point values. " +"Examples::" msgstr "" "陣列物件的字串表示形式為 ``array(typecode, initializer)``。若為空陣列則參數 " "*initializer* 被省略,若 *typecode* 是 ``'u'`` 將被表示為 Unicode 字串,其他" @@ -483,10 +504,11 @@ msgstr "" "過 ``from array import array`` 的方式引入,便能確保該字串表示能透過 :func:" "`eval` 轉換回一個擁有相同型別及數值的陣列。範例: ::" -#: ../../library/array.rst:259 +#: ../../library/array.rst:269 +#, fuzzy msgid "" "array('l')\n" -"array('u', 'hello \\u2641')\n" +"array('w', 'hello \\u2641')\n" "array('l', [1, 2, 3, 4, 5])\n" "array('d', [1.0, 2.0, 3.14, -inf, nan])" msgstr "" @@ -495,31 +517,19 @@ msgstr "" "array('l', [1, 2, 3, 4, 5])\n" "array('d', [1.0, 2.0, 3.14, -inf, nan])" -#: ../../library/array.rst:267 +#: ../../library/array.rst:277 msgid "Module :mod:`struct`" msgstr ":mod:`struct` 模組" -#: ../../library/array.rst:268 +#: ../../library/array.rst:278 msgid "Packing and unpacking of heterogeneous binary data." msgstr "將包含不同資料類型的二進位資料包裝與解開包裝。" -#: ../../library/array.rst:270 -msgid "Module :mod:`xdrlib`" -msgstr ":mod:`xdrlib` 模組" - -#: ../../library/array.rst:271 -msgid "" -"Packing and unpacking of External Data Representation (XDR) data as used in " -"some remote procedure call systems." -msgstr "" -"將 External Data Representation (XDR) 的資料包裝與解開包裝,這用在一些遠端操" -"作的系統 (remote procedure call systems)。" - -#: ../../library/array.rst:274 +#: ../../library/array.rst:280 msgid "`NumPy `_" msgstr "`NumPy `_" -#: ../../library/array.rst:275 +#: ../../library/array.rst:281 msgid "The NumPy package defines another array type." msgstr "NumPy 套件定義了另一個陣列型別" diff --git a/library/ast.po b/library/ast.po index c58533b4e9..bf6a46b3ed 100644 --- a/library/ast.po +++ b/library/ast.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:38+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -224,9 +224,9 @@ msgid "" "\n" " type_ignore = TypeIgnore(int lineno, string tag)\n" "\n" -" type_param = TypeVar(identifier name, expr? bound)\n" -" | ParamSpec(identifier name)\n" -" | TypeVarTuple(identifier name)\n" +" type_param = TypeVar(identifier name, expr? bound, expr? default_value)\n" +" | ParamSpec(identifier name, expr? default_value)\n" +" | TypeVarTuple(identifier name, expr? default_value)\n" " attributes (int lineno, int col_offset, int end_lineno, int " "end_col_offset)\n" "}\n" @@ -265,9 +265,9 @@ msgstr "" #: ../../library/ast.rst:64 msgid "" -"Each concrete class has an attribute :attr:`_fields` which gives the names " +"Each concrete class has an attribute :attr:`!_fields` which gives the names " "of all child nodes." -msgstr "每個具體類別都有一個屬性 :attr:`_fields`,它會給出所有子節點的名稱。" +msgstr "每個具體類別都有一個屬性 :attr:`!_fields`,它會給出所有子節點的名稱。" #: ../../library/ast.rst:67 msgid "" @@ -290,8 +290,26 @@ msgstr "" "可以有零個或多個值(用星號標記),則這些值將表示為 Python 串列。使用 :func:" "`compile` 編譯 AST 時,所有可能的屬性都必須存在並且具有有效值。" +#: ../../library/ast.rst:79 +msgid "" +"The :attr:`!_field_types` attribute on each concrete class is a dictionary " +"mapping field names (as also listed in :attr:`_fields`) to their types." +msgstr "" +"每個具體類別上的 :attr:`!_field_types` 屬性是將欄位名稱(也在 :attr:" +"`_fields` 中列出)對映到其型別的字典。" + #: ../../library/ast.rst:82 msgid "" +">>> ast.TypeVar._field_types\n" +"{'name': , 'bound': ast.expr | None, 'default_value': ast.expr " +"| None}" +msgstr "" +">>> ast.TypeVar._field_types\n" +"{'name': , 'bound': ast.expr | None, 'default_value': ast.expr " +"| None}" + +#: ../../library/ast.rst:94 +msgid "" "Instances of :class:`ast.expr` and :class:`ast.stmt` subclasses have :attr:" "`lineno`, :attr:`col_offset`, :attr:`end_lineno`, and :attr:`end_col_offset` " "attributes. The :attr:`lineno` and :attr:`end_lineno` are the first and " @@ -308,7 +326,7 @@ msgstr "" "`end_col_offset` 是生成節點的第一個和最後一個標記對應的 UTF-8 位元組偏移量。" "會記錄 UTF-8 偏移量是因為剖析器 (parser) 內部使用 UTF-8。" -#: ../../library/ast.rst:91 +#: ../../library/ast.rst:103 msgid "" "Note that the end positions are not required by the compiler and are " "therefore optional. The end offset is *after* the last symbol, for example " @@ -319,12 +337,12 @@ msgstr "" "之後*,例如可以使用 ``source_line[node.col_offset : node.end_col_offset]`` 來" "獲取單列運算式節點 (expression node) 的原始片段。" -#: ../../library/ast.rst:96 +#: ../../library/ast.rst:108 msgid "" "The constructor of a class :class:`ast.T` parses its arguments as follows:" msgstr ":class:`ast.T` 類別的建構函式按以下方式剖析其引數:" -#: ../../library/ast.rst:98 +#: ../../library/ast.rst:110 msgid "" "If there are positional arguments, there must be as many as there are items " "in :attr:`T._fields`; they will be assigned as attributes of these names." @@ -332,44 +350,20 @@ msgstr "" "如果有位置引數,則必須與 :attr:`T._fields` 中的項目一樣多;它們將被賦値為這些" "名稱的屬性。" -#: ../../library/ast.rst:100 +#: ../../library/ast.rst:112 msgid "" "If there are keyword arguments, they will set the attributes of the same " "names to the given values." msgstr "如果有關鍵字引數,它們會將相同名稱的屬性設定為給定值。" -#: ../../library/ast.rst:103 +#: ../../library/ast.rst:115 msgid "" "For example, to create and populate an :class:`ast.UnaryOp` node, you could " "use ::" msgstr "" "例如,要建立並填充 (populate) :class:`ast.UnaryOp` 節點,你可以使用: ::" -#: ../../library/ast.rst:106 -msgid "" -"node = ast.UnaryOp()\n" -"node.op = ast.USub()\n" -"node.operand = ast.Constant()\n" -"node.operand.value = 5\n" -"node.operand.lineno = 0\n" -"node.operand.col_offset = 0\n" -"node.lineno = 0\n" -"node.col_offset = 0" -msgstr "" -"node = ast.UnaryOp()\n" -"node.op = ast.USub()\n" -"node.operand = ast.Constant()\n" -"node.operand.value = 5\n" -"node.operand.lineno = 0\n" -"node.operand.col_offset = 0\n" -"node.lineno = 0\n" -"node.col_offset = 0" - -#: ../../library/ast.rst:115 -msgid "or the more compact ::" -msgstr "或更簡潔的: ::" - -#: ../../library/ast.rst:117 +#: ../../library/ast.rst:118 msgid "" "node = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, col_offset=0),\n" " lineno=0, col_offset=0)" @@ -377,17 +371,32 @@ msgstr "" "node = ast.UnaryOp(ast.USub(), ast.Constant(5, lineno=0, col_offset=0),\n" " lineno=0, col_offset=0)" -#: ../../library/ast.rst:122 +#: ../../library/ast.rst:121 +msgid "" +"If a field that is optional in the grammar is omitted from the constructor, " +"it defaults to ``None``. If a list field is omitted, it defaults to the " +"empty list. If a field of type :class:`!ast.expr_context` is omitted, it " +"defaults to :class:`Load() `. If any other field is omitted, a :" +"exc:`DeprecationWarning` is raised and the AST node will not have this " +"field. In Python 3.15, this condition will raise an error." +msgstr "" +"如果建構函式中省略了文法中可選的欄位,則它預設為 ``None``。如果省略串列欄位," +"則預設為空串列。如果省略 :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." msgstr ":class:`ast.Constant` 類別現在用於所有常數。" -#: ../../library/ast.rst:126 +#: ../../library/ast.rst:134 msgid "" "Simple indices are represented by their value, extended slices are " "represented as tuples." msgstr "以它們的值表示簡單索引,擴充切片 (slice) 則以元組 (tuple) 表示。" -#: ../../library/ast.rst:131 +#: ../../library/ast.rst:139 msgid "" "Old classes :class:`!ast.Num`, :class:`!ast.Str`, :class:`!ast.Bytes`, :" "class:`!ast.NameConstant` and :class:`!ast.Ellipsis` are still available, " @@ -398,7 +407,7 @@ msgstr "" "ast.NameConstant` 和 :class:`!ast.Ellipsis` 仍然可用,但它們將在未來的 " "Python 釋出版本中移除。與此同時,實例化它們將回傳不同類別的實例。" -#: ../../library/ast.rst:138 +#: ../../library/ast.rst:146 msgid "" "Old classes :class:`!ast.Index` and :class:`!ast.ExtSlice` are still " "available, but they will be removed in future Python releases. In the " @@ -407,7 +416,19 @@ msgstr "" "舊的類別 :class:`!ast.Index` 和 :class:`!ast.ExtSlice` 仍然可用,但它們將在未" "來的 Python 版本中刪除。同時,實例化它們會回傳不同類別的實例。" -#: ../../library/ast.rst:144 +#: ../../library/ast.rst:153 +msgid "" +"Previous versions of Python allowed the creation of AST nodes that were " +"missing required fields. Similarly, AST node constructors allowed arbitrary " +"keyword arguments that were set as attributes of the AST node, even if they " +"did not match any of the fields of the AST node. This behavior is deprecated " +"and will be removed in Python 3.15." +msgstr "" +"先前版本的 Python 允許建立缺少必填欄位的 AST 節點。同樣地,AST 節點建構函式允" +"許將任意關鍵字引數設為 AST 節點的屬性,即使它們與 AST 節點的任何欄位都不匹" +"配。此行為已被棄用,並將在 Python 3.15 中刪除。" + +#: ../../library/ast.rst:160 msgid "" "The descriptions of the specific node classes displayed here were initially " "adapted from the fantastic `Green Tree Snakes `__ 專案和所有貢獻者那裡改編而來" "的。" -#: ../../library/ast.rst:153 +#: ../../library/ast.rst:169 msgid "Root nodes" msgstr "根節點" -#: ../../library/ast.rst:157 +#: ../../library/ast.rst:173 msgid "" "A Python module, as with :ref:`file input `. Node type generated " "by :func:`ast.parse` in the default ``\"exec\"`` *mode*." @@ -429,19 +450,19 @@ msgstr "" "一個 Python 模組,與\\ :ref:`檔案輸入 ` 一樣。由 :func:`ast." "parse` 在預設的 ``\"exec\"`` *mode* 下生成的節點型別。" -#: ../../library/ast.rst:160 -msgid "*body* is a :class:`list` of the module's :ref:`ast-statements`." -msgstr "*body* 是模組的\\ :ref:`ast-statements` 的一個 :class:`list`。" +#: ../../library/ast.rst:176 +msgid "``body`` is a :class:`list` of the module's :ref:`ast-statements`." +msgstr "``body`` 是模組的\\ :ref:`ast-statements` 的一個 :class:`list`。" -#: ../../library/ast.rst:162 +#: ../../library/ast.rst:178 msgid "" -"*type_ignores* is a :class:`list` of the module's type ignore comments; see :" -"func:`ast.parse` for more details." +"``type_ignores`` is a :class:`list` of the module's type ignore comments; " +"see :func:`ast.parse` for more details." msgstr "" -"*type_ignores* 是模組的忽略型別註解的 :class:`list`;有關更多詳細資訊,請參" +"``type_ignores`` 是模組的忽略型別註解的 :class:`list`;有關更多詳細資訊,請參" "閱 :func:`ast.parse`。" -#: ../../library/ast.rst:165 +#: ../../library/ast.rst:181 msgid "" ">>> print(ast.dump(ast.parse('x = 1'), indent=4))\n" "Module(\n" @@ -449,8 +470,7 @@ msgid "" " Assign(\n" " targets=[\n" " Name(id='x', ctx=Store())],\n" -" value=Constant(value=1))],\n" -" type_ignores=[])" +" value=Constant(value=1))])" msgstr "" ">>> print(ast.dump(ast.parse('x = 1'), indent=4))\n" "Module(\n" @@ -458,10 +478,9 @@ msgstr "" " Assign(\n" " targets=[\n" " Name(id='x', ctx=Store())],\n" -" value=Constant(value=1))],\n" -" type_ignores=[])" +" value=Constant(value=1))])" -#: ../../library/ast.rst:179 +#: ../../library/ast.rst:194 msgid "" "A single Python :ref:`expression input `. Node type " "generated by :func:`ast.parse` when *mode* is ``\"eval\"``." @@ -469,14 +488,14 @@ msgstr "" "單個 Python :ref:`運算式輸入 `。當 *mode* 是 ``\"eval\"`` " "時節點型別由 :func:`ast.parse` 生成。" -#: ../../library/ast.rst:182 +#: ../../library/ast.rst:197 msgid "" -"*body* is a single node, one of the :ref:`expression types `." msgstr "" -"*body* 是單個節點,是\\ :ref:`運算式型別 `\\ 的其中之一。" +"``body`` 是單個節點,是\\ :ref:`運算式型別 `\\ 的其中之一。" -#: ../../library/ast.rst:185 ../../library/ast.rst:255 +#: ../../library/ast.rst:200 ../../library/ast.rst:270 msgid "" ">>> print(ast.dump(ast.parse('123', mode='eval'), indent=4))\n" "Expression(\n" @@ -486,7 +505,7 @@ msgstr "" "Expression(\n" " body=Constant(value=123))" -#: ../../library/ast.rst:194 +#: ../../library/ast.rst:209 msgid "" "A single :ref:`interactive input `, like in :ref:`tut-interac`. " "Node type generated by :func:`ast.parse` when *mode* is ``\"single\"``." @@ -494,13 +513,13 @@ msgstr "" "單個\\ :ref:`互動式輸入 `,和\\ :ref:`tut-interac`\\ 中所述的相" "似。當 *mode* 是 ``\"single\"`` 時節點型別由 :func:`ast.parse` 生成。" -#: ../../library/ast.rst:197 -msgid "*body* is a :class:`list` of :ref:`statement nodes `." +#: ../../library/ast.rst:212 +msgid "``body`` is a :class:`list` of :ref:`statement nodes `." msgstr "" -"*body* 是\\ :ref:`陳述式節點 (statement nodes) ` 的 :class:" +"``body`` 是\\ :ref:`陳述式節點 (statement nodes) ` 的 :class:" "`list`。" -#: ../../library/ast.rst:199 +#: ../../library/ast.rst:214 msgid "" ">>> print(ast.dump(ast.parse('x = 1; y = 2', mode='single'), indent=4))\n" "Interactive(\n" @@ -526,7 +545,7 @@ msgstr "" " Name(id='y', ctx=Store())],\n" " value=Constant(value=2))])" -#: ../../library/ast.rst:216 +#: ../../library/ast.rst:231 msgid "" "A representation of an old-style type comments for functions, as Python " "versions prior to 3.5 didn't support :pep:`484` annotations. Node type " @@ -535,11 +554,11 @@ msgstr "" "函式的舊式型別註解的表示法,因為 3.5 之前的 Python 版本不支援 :pep:`484` 註" "釋。當 *mode* 是 ``\"func_type\"`` 時節點型別由 :func:`ast.parse` 生成。" -#: ../../library/ast.rst:220 +#: ../../library/ast.rst:235 msgid "Such type comments would look like this::" msgstr "這種型別的註解看起來像這樣: ::" -#: ../../library/ast.rst:222 +#: ../../library/ast.rst:237 msgid "" "def sum_two_number(a, b):\n" " # type: (int, int) -> int\n" @@ -549,17 +568,17 @@ msgstr "" " # type: (int, int) -> int\n" " return a + b" -#: ../../library/ast.rst:226 +#: ../../library/ast.rst:241 msgid "" -"*argtypes* is a :class:`list` of :ref:`expression nodes `." +"``argtypes`` is a :class:`list` of :ref:`expression nodes `." msgstr "" -"*argtypes* 是\\ :ref:`運算式節點 `\\ 的 :class:`list`。" +"``argtypes`` 是\\ :ref:`運算式節點 `\\ 的 :class:`list`。" -#: ../../library/ast.rst:228 -msgid "*returns* is a single :ref:`expression node `." -msgstr "*returns* 是單個\\ :ref:`運算式節點 `。" +#: ../../library/ast.rst:243 +msgid "``returns`` is a single :ref:`expression node `." +msgstr "``returns`` 是單個\\ :ref:`運算式節點 `。" -#: ../../library/ast.rst:230 +#: ../../library/ast.rst:245 msgid "" ">>> print(ast.dump(ast.parse('(int, str) -> List[int]', mode='func_type'), " "indent=4))\n" @@ -583,11 +602,11 @@ msgstr "" " slice=Name(id='int', ctx=Load()),\n" " ctx=Load()))" -#: ../../library/ast.rst:246 +#: ../../library/ast.rst:261 msgid "Literals" msgstr "文本 (Literals)" -#: ../../library/ast.rst:250 +#: ../../library/ast.rst:265 msgid "" "A constant value. The ``value`` attribute of the ``Constant`` literal " "contains the Python object it represents. The values represented can be " @@ -599,7 +618,7 @@ msgstr "" "示的值可以是簡單型別,例如數字、字串或 ``None``,但如果它們的所有元素都是常" "數,也可以是不可變的 (immutable) 容器型別(元組和凍結集合 (frozensets))。" -#: ../../library/ast.rst:264 +#: ../../library/ast.rst:279 msgid "" "Node representing a single formatting field in an f-string. If the string " "contains a single formatting field and nothing else the node can be isolated " @@ -609,33 +628,33 @@ msgstr "" "沒有其他內容,則可以隔離 (isolate) 該節點,否則它將出現在 :class:`JoinedStr` " "中。" -#: ../../library/ast.rst:268 +#: ../../library/ast.rst:283 msgid "" "``value`` is any expression node (such as a literal, a variable, or a " "function call)." msgstr "``value`` 為任何運算式節點(例如文字、變數或函式呼叫)。" -#: ../../library/ast.rst:270 +#: ../../library/ast.rst:285 msgid "``conversion`` is an integer:" msgstr "``conversion`` 是一個整數:" -#: ../../library/ast.rst:272 +#: ../../library/ast.rst:287 msgid "-1: no formatting" msgstr "-1: 無格式化" -#: ../../library/ast.rst:273 +#: ../../library/ast.rst:288 msgid "115: ``!s`` string formatting" msgstr "115: ``!s`` 字串格式化" -#: ../../library/ast.rst:274 +#: ../../library/ast.rst:289 msgid "114: ``!r`` repr formatting" msgstr "114:``!r`` 重複格式化化" -#: ../../library/ast.rst:275 +#: ../../library/ast.rst:290 msgid "97: ``!a`` ascii formatting" msgstr "97: ``!a`` ascii 格式化" -#: ../../library/ast.rst:277 +#: ../../library/ast.rst:292 msgid "" "``format_spec`` is a :class:`JoinedStr` node representing the formatting of " "the value, or ``None`` if no format was specified. Both ``conversion`` and " @@ -644,14 +663,14 @@ msgstr "" "``format_spec`` 是一個 :class:`JoinedStr` 節點,表示值的格式,若未指定格式則" "為 ``None``。``conversion`` 和 ``format_spec`` 可以同時設定。" -#: ../../library/ast.rst:284 +#: ../../library/ast.rst:299 msgid "" "An f-string, comprising a series of :class:`FormattedValue` and :class:" "`Constant` nodes." msgstr "" "一個 f 字串,包含一系列 :class:`FormattedValue` 和 :class:`Constant` 節點。" -#: ../../library/ast.rst:287 +#: ../../library/ast.rst:302 msgid "" ">>> print(ast.dump(ast.parse('f\"sin({a}) is {sin(a):.3}\"', mode='eval'), " "indent=4))\n" @@ -667,8 +686,7 @@ msgid "" " value=Call(\n" " func=Name(id='sin', ctx=Load()),\n" " args=[\n" -" Name(id='a', ctx=Load())],\n" -" keywords=[]),\n" +" Name(id='a', ctx=Load())]),\n" " conversion=-1,\n" " format_spec=JoinedStr(\n" " values=[\n" @@ -688,14 +706,13 @@ msgstr "" " value=Call(\n" " func=Name(id='sin', ctx=Load()),\n" " args=[\n" -" Name(id='a', ctx=Load())],\n" -" keywords=[]),\n" +" Name(id='a', ctx=Load())]),\n" " conversion=-1,\n" " format_spec=JoinedStr(\n" " values=[\n" " Constant(value='.3')]))]))" -#: ../../library/ast.rst:313 +#: ../../library/ast.rst:327 msgid "" "A list or tuple. ``elts`` holds a list of nodes representing the elements. " "``ctx`` is :class:`Store` if the container is an assignment target (i.e. " @@ -704,7 +721,7 @@ msgstr "" "串列或元組。``elts`` 保存表示元素的節點串列。如果容器是賦值目標(即 ``(x," "y)=something`` ),則 ``ctx`` 是 :class:`Store`,否則是 :class:`Load`。" -#: ../../library/ast.rst:317 +#: ../../library/ast.rst:331 msgid "" ">>> print(ast.dump(ast.parse('[1, 2, 3]', mode='eval'), indent=4))\n" "Expression(\n" @@ -740,11 +757,11 @@ msgstr "" " Constant(value=3)],\n" " ctx=Load()))" -#: ../../library/ast.rst:339 +#: ../../library/ast.rst:353 msgid "A set. ``elts`` holds a list of nodes representing the set's elements." msgstr "一個集合。``elts`` 保存表示集合之元素的節點串列。" -#: ../../library/ast.rst:341 +#: ../../library/ast.rst:355 msgid "" ">>> print(ast.dump(ast.parse('{1, 2, 3}', mode='eval'), indent=4))\n" "Expression(\n" @@ -762,7 +779,7 @@ msgstr "" " Constant(value=2),\n" " Constant(value=3)]))" -#: ../../library/ast.rst:354 +#: ../../library/ast.rst:368 msgid "" "A dictionary. ``keys`` and ``values`` hold lists of nodes representing the " "keys and the values respectively, in matching order (what would be returned " @@ -772,7 +789,7 @@ msgstr "" "節點串列(為呼叫 :code:`dictionary.keys()` 和 :code:`dictionary.values()` 時" "將回傳的內容)。" -#: ../../library/ast.rst:358 +#: ../../library/ast.rst:372 msgid "" "When doing dictionary unpacking using dictionary literals the expression to " "be expanded goes in the ``values`` list, with a ``None`` at the " @@ -781,7 +798,7 @@ msgstr "" "當使用字典文本進行字典解包 (unpack) 時,要擴充的運算式位於 ``values`` 串列" "中,在 ``keys`` 中的相應位置有一個 ``None``。" -#: ../../library/ast.rst:362 +#: ../../library/ast.rst:376 msgid "" ">>> print(ast.dump(ast.parse('{\"a\":1, **d}', mode='eval'), indent=4))\n" "Expression(\n" @@ -803,17 +820,17 @@ msgstr "" " Constant(value=1),\n" " Name(id='d', ctx=Load())]))" -#: ../../library/ast.rst:376 +#: ../../library/ast.rst:390 msgid "Variables" msgstr "變數" -#: ../../library/ast.rst:380 +#: ../../library/ast.rst:394 msgid "" "A variable name. ``id`` holds the name as a string, and ``ctx`` is one of " "the following types." msgstr "一個變數名稱。``id`` 將名稱以字串形式保存,且 ``ctx`` 是以下型別之一。" -#: ../../library/ast.rst:388 +#: ../../library/ast.rst:402 msgid "" "Variable references can be used to load the value of a variable, to assign a " "new value to it, or to delete it. Variable references are given a context to " @@ -822,14 +839,13 @@ msgstr "" "變數參照可用於載入變數的值、為其分配新值或刪除它。變數參照被賦予情境 " "(context) 來區分這些情況。" -#: ../../library/ast.rst:392 +#: ../../library/ast.rst:406 msgid "" ">>> print(ast.dump(ast.parse('a'), indent=4))\n" "Module(\n" " body=[\n" " Expr(\n" -" value=Name(id='a', ctx=Load()))],\n" -" type_ignores=[])\n" +" value=Name(id='a', ctx=Load()))])\n" "\n" ">>> print(ast.dump(ast.parse('a = 1'), indent=4))\n" "Module(\n" @@ -837,23 +853,20 @@ msgid "" " Assign(\n" " targets=[\n" " Name(id='a', ctx=Store())],\n" -" value=Constant(value=1))],\n" -" type_ignores=[])\n" +" value=Constant(value=1))])\n" "\n" ">>> print(ast.dump(ast.parse('del a'), indent=4))\n" "Module(\n" " body=[\n" " Delete(\n" " targets=[\n" -" Name(id='a', ctx=Del())])],\n" -" type_ignores=[])" +" Name(id='a', ctx=Del())])])" msgstr "" ">>> print(ast.dump(ast.parse('a'), indent=4))\n" "Module(\n" " body=[\n" " Expr(\n" -" value=Name(id='a', ctx=Load()))],\n" -" type_ignores=[])\n" +" value=Name(id='a', ctx=Load()))])\n" "\n" ">>> print(ast.dump(ast.parse('a = 1'), indent=4))\n" "Module(\n" @@ -861,18 +874,16 @@ msgstr "" " Assign(\n" " targets=[\n" " Name(id='a', ctx=Store())],\n" -" value=Constant(value=1))],\n" -" type_ignores=[])\n" +" value=Constant(value=1))])\n" "\n" ">>> print(ast.dump(ast.parse('del a'), indent=4))\n" "Module(\n" " body=[\n" " Delete(\n" " targets=[\n" -" Name(id='a', ctx=Del())])],\n" -" type_ignores=[])" +" Name(id='a', ctx=Del())])])" -#: ../../library/ast.rst:421 +#: ../../library/ast.rst:432 msgid "" "A ``*var`` variable reference. ``value`` holds the variable, typically a :" "class:`Name` node. This type must be used when building a :class:`Call` node " @@ -881,7 +892,7 @@ msgstr "" "一個 ``*var`` 變數參照。``value`` 保存變數,通常是一個 :class:`Name` 節點。在" "使用 ``*args`` 建置 :class:`Call` 節點時必須使用此型別。" -#: ../../library/ast.rst:425 +#: ../../library/ast.rst:436 msgid "" ">>> print(ast.dump(ast.parse('a, *b = it'), indent=4))\n" "Module(\n" @@ -895,8 +906,7 @@ msgid "" " value=Name(id='b', ctx=Store()),\n" " ctx=Store())],\n" " ctx=Store())],\n" -" value=Name(id='it', ctx=Load()))],\n" -" type_ignores=[])" +" value=Name(id='it', ctx=Load()))])" msgstr "" ">>> print(ast.dump(ast.parse('a, *b = it'), indent=4))\n" "Module(\n" @@ -910,14 +920,13 @@ msgstr "" " value=Name(id='b', ctx=Store()),\n" " ctx=Store())],\n" " ctx=Store())],\n" -" value=Name(id='it', ctx=Load()))],\n" -" type_ignores=[])" +" value=Name(id='it', ctx=Load()))])" -#: ../../library/ast.rst:446 +#: ../../library/ast.rst:456 msgid "Expressions" msgstr "運算式" -#: ../../library/ast.rst:450 +#: ../../library/ast.rst:460 msgid "" "When an expression, such as a function call, appears as a statement by " "itself with its return value not used or stored, it is wrapped in this " @@ -930,7 +939,7 @@ msgstr "" "`Constant`、:class:`Name`、:class:`Lambda`、:class:`Yield` 或 :class:" "`YieldFrom`" -#: ../../library/ast.rst:455 +#: ../../library/ast.rst:465 msgid "" ">>> print(ast.dump(ast.parse('-a'), indent=4))\n" "Module(\n" @@ -938,8 +947,7 @@ msgid "" " Expr(\n" " value=UnaryOp(\n" " op=USub(),\n" -" operand=Name(id='a', ctx=Load())))],\n" -" type_ignores=[])" +" operand=Name(id='a', ctx=Load())))])" msgstr "" ">>> print(ast.dump(ast.parse('-a'), indent=4))\n" "Module(\n" @@ -947,17 +955,16 @@ msgstr "" " Expr(\n" " value=UnaryOp(\n" " op=USub(),\n" -" operand=Name(id='a', ctx=Load())))],\n" -" type_ignores=[])" +" operand=Name(id='a', ctx=Load())))])" -#: ../../library/ast.rst:469 +#: ../../library/ast.rst:478 msgid "" "A unary operation. ``op`` is the operator, and ``operand`` any expression " "node." msgstr "" "一元運算 (unary operation)。``op`` 是運算子,``operand`` 是任何運算式節點。" -#: ../../library/ast.rst:478 +#: ../../library/ast.rst:487 msgid "" "Unary operator tokens. :class:`Not` is the ``not`` keyword, :class:`Invert` " "is the ``~`` operator." @@ -965,7 +972,7 @@ msgstr "" "一元運算子標記。 :class:`Not` 是 ``not`` 關鍵字、:class:`Invert` 是 ``~`` 運" "算子。" -#: ../../library/ast.rst:481 +#: ../../library/ast.rst:490 msgid "" ">>> print(ast.dump(ast.parse('not x', mode='eval'), indent=4))\n" "Expression(\n" @@ -979,7 +986,7 @@ msgstr "" " op=Not(),\n" " operand=Name(id='x', ctx=Load())))" -#: ../../library/ast.rst:492 +#: ../../library/ast.rst:501 msgid "" "A binary operation (like addition or division). ``op`` is the operator, and " "``left`` and ``right`` are any expression nodes." @@ -987,7 +994,7 @@ msgstr "" "二元運算 (binary operation)(如加法或除法)。 ``op`` 是運算子、``left`` 和 " "``right`` 是任意運算式節點。" -#: ../../library/ast.rst:495 +#: ../../library/ast.rst:504 msgid "" ">>> print(ast.dump(ast.parse('x + y', mode='eval'), indent=4))\n" "Expression(\n" @@ -1003,11 +1010,11 @@ msgstr "" " op=Add(),\n" " right=Name(id='y', ctx=Load())))" -#: ../../library/ast.rst:519 +#: ../../library/ast.rst:528 msgid "Binary operator tokens." msgstr "二元運算子 token。" -#: ../../library/ast.rst:524 +#: ../../library/ast.rst:533 msgid "" "A boolean operation, 'or' or 'and'. ``op`` is :class:`Or` or :class:`And`. " "``values`` are the values involved. Consecutive operations with the same " @@ -1018,11 +1025,11 @@ msgstr "" "有所涉及的值。使用同一運算子的連續操作(例如 ``a or b or c``\\ )會被折疊為具" "有多個值的一個節點。" -#: ../../library/ast.rst:529 +#: ../../library/ast.rst:538 msgid "This doesn't include ``not``, which is a :class:`UnaryOp`." msgstr "這不包括 ``not``,它是一個 :class:`UnaryOp`。" -#: ../../library/ast.rst:531 +#: ../../library/ast.rst:540 msgid "" ">>> print(ast.dump(ast.parse('x or y', mode='eval'), indent=4))\n" "Expression(\n" @@ -1040,11 +1047,11 @@ msgstr "" " Name(id='x', ctx=Load()),\n" " Name(id='y', ctx=Load())]))" -#: ../../library/ast.rst:545 +#: ../../library/ast.rst:554 msgid "Boolean operator tokens." msgstr "布林運算子 token。" -#: ../../library/ast.rst:550 +#: ../../library/ast.rst:559 msgid "" "A comparison of two or more values. ``left`` is the first value in the " "comparison, ``ops`` the list of operators, and ``comparators`` the list of " @@ -1053,7 +1060,7 @@ msgstr "" "兩個或多個值的比較。``left`` 是比較中的第一個值、``ops`` 是運算子串列、" "``comparators`` 是要比較的第一個元素之後值的串列。" -#: ../../library/ast.rst:554 +#: ../../library/ast.rst:563 msgid "" ">>> print(ast.dump(ast.parse('1 <= a < 10', mode='eval'), indent=4))\n" "Expression(\n" @@ -1077,11 +1084,11 @@ msgstr "" " Name(id='a', ctx=Load()),\n" " Constant(value=10)]))" -#: ../../library/ast.rst:579 +#: ../../library/ast.rst:588 msgid "Comparison operator tokens." msgstr "比較運算子 token。" -#: ../../library/ast.rst:584 +#: ../../library/ast.rst:593 msgid "" "A function call. ``func`` is the function, which will often be a :class:" "`Name` or :class:`Attribute` object. Of the arguments:" @@ -1089,25 +1096,24 @@ msgstr "" "一個函式呼叫。``func`` 是該函式,通常是一個 :class:`Name` 或 :class:" "`Attribute` 物件。而在引數中:" -#: ../../library/ast.rst:587 +#: ../../library/ast.rst:596 msgid "``args`` holds a list of the arguments passed by position." msgstr "``args`` 保存按位置傳遞的引數串列。" -#: ../../library/ast.rst:588 +#: ../../library/ast.rst:597 msgid "" "``keywords`` holds a list of :class:`.keyword` objects representing " "arguments passed by keyword." msgstr "" "``keywords`` 保存一個 :class:`.keyword` 物件串列,表示透過關鍵字傳遞的引數。" -#: ../../library/ast.rst:591 +#: ../../library/ast.rst:600 msgid "" -"When creating a ``Call`` node, ``args`` and ``keywords`` are required, but " -"they can be empty lists." -msgstr "" -"建立 ``Call`` 節點時會需要 ``args`` 和 ``keywords``,但它們可以是空串列。" +"The ``args`` and ``keywords`` arguments are optional and default to empty " +"lists." +msgstr "``args`` 和 ``keywords`` 引數是可選的,預設為空串列。" -#: ../../library/ast.rst:594 +#: ../../library/ast.rst:602 msgid "" ">>> print(ast.dump(ast.parse('func(a, b=c, *d, **e)', mode='eval'), " "indent=4))\n" @@ -1143,7 +1149,7 @@ msgstr "" " keyword(\n" " value=Name(id='e', ctx=Load()))]))" -#: ../../library/ast.rst:615 +#: ../../library/ast.rst:623 msgid "" "A keyword argument to a function call or class definition. ``arg`` is a raw " "string of the parameter name, ``value`` is a node to pass in." @@ -1151,7 +1157,7 @@ msgstr "" "函式呼叫或類別定義的關鍵字引數。``arg`` 是參數名稱的原始字串,``value`` 是要" "傳入的節點。" -#: ../../library/ast.rst:621 +#: ../../library/ast.rst:629 msgid "" "An expression such as ``a if b else c``. Each field holds a single node, so " "in the following example, all three are :class:`Name` nodes." @@ -1159,7 +1165,7 @@ msgstr "" "像是 ``a if b else c`` 之類的運算式。每個欄位都保存一個節點,因此在以下範例" "中,所有三個都是 :class:`Name` 節點。" -#: ../../library/ast.rst:624 +#: ../../library/ast.rst:632 msgid "" ">>> print(ast.dump(ast.parse('a if b else c', mode='eval'), indent=4))\n" "Expression(\n" @@ -1175,7 +1181,7 @@ msgstr "" " body=Name(id='a', ctx=Load()),\n" " orelse=Name(id='c', ctx=Load())))" -#: ../../library/ast.rst:636 +#: ../../library/ast.rst:644 msgid "" "Attribute access, e.g. ``d.keys``. ``value`` is a node, typically a :class:" "`Name`. ``attr`` is a bare string giving the name of the attribute, and " @@ -1186,7 +1192,7 @@ msgstr "" "``attr`` 是一個屬性名稱的字串,``ctx`` 根據屬性的作用方式可能是 :class:" "`Load`、:class:`Store` 或 :class:`Del`。" -#: ../../library/ast.rst:641 +#: ../../library/ast.rst:649 msgid "" ">>> print(ast.dump(ast.parse('snake.colour', mode='eval'), indent=4))\n" "Expression(\n" @@ -1202,7 +1208,7 @@ msgstr "" " attr='colour',\n" " ctx=Load()))" -#: ../../library/ast.rst:653 +#: ../../library/ast.rst:661 msgid "" "A named expression. This AST node is produced by the assignment expressions " "operator (also known as the walrus operator). As opposed to the :class:" @@ -1213,7 +1219,7 @@ msgstr "" "運算子)產生。相對於 :class:`Assign` 節點之第一個引數可為多個節點,在這種情況" "下 ``target`` 和 ``value`` 都必須是單個節點。" -#: ../../library/ast.rst:658 +#: ../../library/ast.rst:666 msgid "" ">>> print(ast.dump(ast.parse('(x := 4)', mode='eval'), indent=4))\n" "Expression(\n" @@ -1227,11 +1233,11 @@ msgstr "" " target=Name(id='x', ctx=Store()),\n" " value=Constant(value=4)))" -#: ../../library/ast.rst:669 +#: ../../library/ast.rst:677 msgid "Subscripting" msgstr "下標 (Subscripting)" -#: ../../library/ast.rst:673 +#: ../../library/ast.rst:681 msgid "" "A subscript, such as ``l[1]``. ``value`` is the subscripted object (usually " "sequence or mapping). ``slice`` is an index, slice or key. It can be a :" @@ -1243,7 +1249,7 @@ msgstr "" "下標執行的操作不同,``ctx`` 可以是 :class:`Load`、:class:`Store` 或 :class:" "`Del`。" -#: ../../library/ast.rst:679 +#: ../../library/ast.rst:687 msgid "" ">>> print(ast.dump(ast.parse('l[1:2, 3]', mode='eval'), indent=4))\n" "Expression(\n" @@ -1271,7 +1277,7 @@ msgstr "" " ctx=Load()),\n" " ctx=Load()))" -#: ../../library/ast.rst:697 +#: ../../library/ast.rst:705 msgid "" "Regular slicing (on the form ``lower:upper`` or ``lower:upper:step``). Can " "occur only inside the *slice* field of :class:`Subscript`, either directly " @@ -1280,7 +1286,7 @@ msgstr "" "常規切片(形式為 ``lower:upper`` 或 ``lower:upper:step``\\ )。只能直接或者或" "者作為 :class:`Tuple` 的元素出現在 :class:`Subscript` 的 *slice* 欄位內。" -#: ../../library/ast.rst:701 +#: ../../library/ast.rst:709 msgid "" ">>> print(ast.dump(ast.parse('l[1:2]', mode='eval'), indent=4))\n" "Expression(\n" @@ -1300,11 +1306,11 @@ msgstr "" " upper=Constant(value=2)),\n" " ctx=Load()))" -#: ../../library/ast.rst:714 +#: ../../library/ast.rst:722 msgid "Comprehensions" msgstr "綜合運算式 (comprehensions)" -#: ../../library/ast.rst:721 +#: ../../library/ast.rst:729 msgid "" "List and set comprehensions, generator expressions, and dictionary " "comprehensions. ``elt`` (or ``key`` and ``value``) is a single node " @@ -1313,14 +1319,16 @@ msgstr "" "串列和集合綜合運算、生成器運算式和字典綜合運算。``elt``\\ (或 ``key`` 和 " "``value``\\ )是單個節點,表示各個項目會被求值 (evaluate) 的部分。" -#: ../../library/ast.rst:725 +#: ../../library/ast.rst:733 msgid "``generators`` is a list of :class:`comprehension` nodes." msgstr "``generators`` 是一個 :class:`comprehension` 節點的串列。" -#: ../../library/ast.rst:727 +#: ../../library/ast.rst:735 msgid "" -">>> print(ast.dump(ast.parse('[x for x in numbers]', mode='eval'), " -"indent=4))\n" +">>> print(ast.dump(\n" +"... ast.parse('[x for x in numbers]', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" "Expression(\n" " body=ListComp(\n" " elt=Name(id='x', ctx=Load()),\n" @@ -1328,10 +1336,11 @@ msgid "" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" " is_async=0)]))\n" -">>> print(ast.dump(ast.parse('{x: x**2 for x in numbers}', mode='eval'), " -"indent=4))\n" +">>> print(ast.dump(\n" +"... ast.parse('{x: x**2 for x in numbers}', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" "Expression(\n" " body=DictComp(\n" " key=Name(id='x', ctx=Load()),\n" @@ -1343,10 +1352,11 @@ msgid "" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" " is_async=0)]))\n" -">>> print(ast.dump(ast.parse('{x for x in numbers}', mode='eval'), " -"indent=4))\n" +">>> print(ast.dump(\n" +"... ast.parse('{x for x in numbers}', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" "Expression(\n" " body=SetComp(\n" " elt=Name(id='x', ctx=Load()),\n" @@ -1354,11 +1364,12 @@ msgid "" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" " is_async=0)]))" msgstr "" -">>> print(ast.dump(ast.parse('[x for x in numbers]', mode='eval'), " -"indent=4))\n" +">>> print(ast.dump(\n" +"... ast.parse('[x for x in numbers]', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" "Expression(\n" " body=ListComp(\n" " elt=Name(id='x', ctx=Load()),\n" @@ -1366,10 +1377,11 @@ msgstr "" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" " is_async=0)]))\n" -">>> print(ast.dump(ast.parse('{x: x**2 for x in numbers}', mode='eval'), " -"indent=4))\n" +">>> print(ast.dump(\n" +"... ast.parse('{x: x**2 for x in numbers}', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" "Expression(\n" " body=DictComp(\n" " key=Name(id='x', ctx=Load()),\n" @@ -1381,10 +1393,11 @@ msgstr "" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" " is_async=0)]))\n" -">>> print(ast.dump(ast.parse('{x for x in numbers}', mode='eval'), " -"indent=4))\n" +">>> print(ast.dump(\n" +"... ast.parse('{x for x in numbers}', mode='eval'),\n" +"... indent=4,\n" +"... ))\n" "Expression(\n" " body=SetComp(\n" " elt=Name(id='x', ctx=Load()),\n" @@ -1392,10 +1405,9 @@ msgstr "" " comprehension(\n" " target=Name(id='x', ctx=Store()),\n" " iter=Name(id='numbers', ctx=Load()),\n" -" ifs=[],\n" " is_async=0)]))" -#: ../../library/ast.rst:767 +#: ../../library/ast.rst:781 msgid "" "One ``for`` clause in a comprehension. ``target`` is the reference to use " "for each element - typically a :class:`Name` or :class:`Tuple` node. " @@ -1406,7 +1418,7 @@ msgstr "" "class:`Name` 或 :class:`Tuple` 節點。``iter`` 是要疊代的物件。``ifs`` 是測試" "運算式的串列:每個 ``for`` 子句可以有多個 ``ifs``。" -#: ../../library/ast.rst:772 +#: ../../library/ast.rst:786 msgid "" "``is_async`` indicates a comprehension is asynchronous (using an ``async " "for`` instead of ``for``). The value is an integer (0 or 1)." @@ -1414,7 +1426,7 @@ msgstr "" "``is_async`` 表示綜合運算式是非同步的(使用 ``async for`` 而不是 ``for`` )。" "該值為整數(0 或 1)。" -#: ../../library/ast.rst:775 +#: ../../library/ast.rst:789 msgid "" ">>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', " "mode='eval'),\n" @@ -1424,18 +1436,15 @@ msgid "" " elt=Call(\n" " func=Name(id='ord', ctx=Load()),\n" " args=[\n" -" Name(id='c', ctx=Load())],\n" -" keywords=[]),\n" +" Name(id='c', ctx=Load())]),\n" " generators=[\n" " comprehension(\n" " target=Name(id='line', ctx=Store()),\n" " iter=Name(id='file', ctx=Load()),\n" -" ifs=[],\n" " is_async=0),\n" " comprehension(\n" " target=Name(id='c', ctx=Store()),\n" " iter=Name(id='line', ctx=Load()),\n" -" ifs=[],\n" " is_async=0)]))\n" "\n" ">>> print(ast.dump(ast.parse('(n**2 for n in it if n>5 if n<10)', " @@ -1475,21 +1484,77 @@ msgid "" " comprehension(\n" " target=Name(id='i', ctx=Store()),\n" " iter=Name(id='soc', ctx=Load()),\n" -" ifs=[],\n" " is_async=1)]))" msgstr "" +">>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', " +"mode='eval'),\n" +"... indent=4)) # Multiple comprehensions in one.\n" +"Expression(\n" +" body=ListComp(\n" +" elt=Call(\n" +" func=Name(id='ord', ctx=Load()),\n" +" args=[\n" +" Name(id='c', ctx=Load())]),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='line', ctx=Store()),\n" +" iter=Name(id='file', ctx=Load()),\n" +" is_async=0),\n" +" comprehension(\n" +" target=Name(id='c', ctx=Store()),\n" +" iter=Name(id='line', ctx=Load()),\n" +" is_async=0)]))\n" +"\n" +">>> print(ast.dump(ast.parse('(n**2 for n in it if n>5 if n<10)', " +"mode='eval'),\n" +"... indent=4)) # generator comprehension\n" +"Expression(\n" +" body=GeneratorExp(\n" +" elt=BinOp(\n" +" left=Name(id='n', ctx=Load()),\n" +" op=Pow(),\n" +" right=Constant(value=2)),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='n', ctx=Store()),\n" +" iter=Name(id='it', ctx=Load()),\n" +" ifs=[\n" +" Compare(\n" +" left=Name(id='n', ctx=Load()),\n" +" ops=[\n" +" Gt()],\n" +" comparators=[\n" +" Constant(value=5)]),\n" +" Compare(\n" +" left=Name(id='n', ctx=Load()),\n" +" ops=[\n" +" Lt()],\n" +" comparators=[\n" +" Constant(value=10)])],\n" +" is_async=0)]))\n" +"\n" +">>> print(ast.dump(ast.parse('[i async for i in soc]', mode='eval'),\n" +"... indent=4)) # Async comprehension\n" +"Expression(\n" +" body=ListComp(\n" +" elt=Name(id='i', ctx=Load()),\n" +" generators=[\n" +" comprehension(\n" +" target=Name(id='i', ctx=Store()),\n" +" iter=Name(id='soc', ctx=Load()),\n" +" is_async=1)]))" -#: ../../library/ast.rst:841 +#: ../../library/ast.rst:851 msgid "Statements" msgstr "陳述式" -#: ../../library/ast.rst:845 +#: ../../library/ast.rst:855 msgid "" "An assignment. ``targets`` is a list of nodes, and ``value`` is a single " "node." msgstr "一個賦值。``targets`` 是節點串列,``value`` 是單個節點。" -#: ../../library/ast.rst:847 +#: ../../library/ast.rst:857 msgid "" "Multiple nodes in ``targets`` represents assigning the same value to each. " "Unpacking is represented by putting a :class:`Tuple` or :class:`List` within " @@ -1498,13 +1563,13 @@ msgstr "" "``targets`` 中的多個節點表示為每個節點分配相同的值。解包是透過在 ``targets`` " "中放置一個 :class:`Tuple` 或 :class:`List` 來表示的。" -#: ../../library/ast.rst:853 ../../library/ast.rst:1165 -#: ../../library/ast.rst:1370 ../../library/ast.rst:1895 +#: ../../library/ast.rst:863 ../../library/ast.rst:1158 +#: ../../library/ast.rst:1352 ../../library/ast.rst:1881 msgid "" "``type_comment`` is an optional string with the type annotation as a comment." msgstr "``type_comment`` 是一個可選字串,其中的註解為型別註釋。" -#: ../../library/ast.rst:855 +#: ../../library/ast.rst:865 msgid "" ">>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment\n" "Module(\n" @@ -1513,8 +1578,7 @@ msgid "" " targets=[\n" " Name(id='a', ctx=Store()),\n" " Name(id='b', ctx=Store())],\n" -" value=Constant(value=1))],\n" -" type_ignores=[])\n" +" value=Constant(value=1))])\n" "\n" ">>> print(ast.dump(ast.parse('a,b = c'), indent=4)) # Unpacking\n" "Module(\n" @@ -1526,11 +1590,30 @@ msgid "" " Name(id='a', ctx=Store()),\n" " Name(id='b', ctx=Store())],\n" " ctx=Store())],\n" -" value=Name(id='c', ctx=Load()))],\n" -" type_ignores=[])" +" value=Name(id='c', ctx=Load()))])" msgstr "" +">>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Name(id='a', ctx=Store()),\n" +" Name(id='b', ctx=Store())],\n" +" value=Constant(value=1))])\n" +"\n" +">>> print(ast.dump(ast.parse('a,b = c'), indent=4)) # Unpacking\n" +"Module(\n" +" body=[\n" +" Assign(\n" +" targets=[\n" +" Tuple(\n" +" elts=[\n" +" Name(id='a', ctx=Store()),\n" +" Name(id='b', ctx=Store())],\n" +" ctx=Store())],\n" +" value=Name(id='c', ctx=Load()))])" -#: ../../library/ast.rst:883 +#: ../../library/ast.rst:891 msgid "" "An assignment with a type annotation. ``target`` is a single node and can be " "a :class:`Name`, an :class:`Attribute` or a :class:`Subscript`. " @@ -1541,7 +1624,7 @@ msgstr "" "`Attribute` 或 :class:`Subscript`。``annotation`` 是註釋,例如 :class:" "`Constant` 或 :class:`Name` 節點。``value`` 是單個可選節點。" -#: ../../library/ast.rst:888 +#: ../../library/ast.rst:896 msgid "" "``simple`` is always either 0 (indicating a \"complex\" target) or 1 " "(indicating a \"simple\" target). A \"simple\" target consists solely of a :" @@ -1554,7 +1637,7 @@ msgstr "" "被視為是複雜的。只有簡單目標會出現在模組和類別的 :attr:`__annotations__` 字典" "中。" -#: ../../library/ast.rst:894 +#: ../../library/ast.rst:902 msgid "" ">>> print(ast.dump(ast.parse('c: int'), indent=4))\n" "Module(\n" @@ -1562,8 +1645,7 @@ msgid "" " AnnAssign(\n" " target=Name(id='c', ctx=Store()),\n" " annotation=Name(id='int', ctx=Load()),\n" -" simple=1)],\n" -" type_ignores=[])\n" +" simple=1)])\n" "\n" ">>> print(ast.dump(ast.parse('(a): int = 1'), indent=4)) # Annotation with " "parenthesis\n" @@ -1573,8 +1655,7 @@ msgid "" " target=Name(id='a', ctx=Store()),\n" " annotation=Name(id='int', ctx=Load()),\n" " value=Constant(value=1),\n" -" simple=0)],\n" -" type_ignores=[])\n" +" simple=0)])\n" "\n" ">>> print(ast.dump(ast.parse('a.b: int'), indent=4)) # Attribute annotation\n" "Module(\n" @@ -1585,8 +1666,7 @@ msgid "" " attr='b',\n" " ctx=Store()),\n" " annotation=Name(id='int', ctx=Load()),\n" -" simple=0)],\n" -" type_ignores=[])\n" +" simple=0)])\n" "\n" ">>> print(ast.dump(ast.parse('a[1]: int'), indent=4)) # Subscript " "annotation\n" @@ -1598,11 +1678,50 @@ msgid "" " slice=Constant(value=1),\n" " ctx=Store()),\n" " annotation=Name(id='int', ctx=Load()),\n" -" simple=0)],\n" -" type_ignores=[])" +" simple=0)])" msgstr "" +">>> print(ast.dump(ast.parse('c: int'), indent=4))\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Name(id='c', ctx=Store()),\n" +" annotation=Name(id='int', ctx=Load()),\n" +" simple=1)])\n" +"\n" +">>> print(ast.dump(ast.parse('(a): int = 1'), indent=4)) # Annotation with " +"parenthesis\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Name(id='a', ctx=Store()),\n" +" annotation=Name(id='int', ctx=Load()),\n" +" value=Constant(value=1),\n" +" simple=0)])\n" +"\n" +">>> print(ast.dump(ast.parse('a.b: int'), indent=4)) # Attribute annotation\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Attribute(\n" +" value=Name(id='a', ctx=Load()),\n" +" attr='b',\n" +" ctx=Store()),\n" +" annotation=Name(id='int', ctx=Load()),\n" +" simple=0)])\n" +"\n" +">>> print(ast.dump(ast.parse('a[1]: int'), indent=4)) # Subscript " +"annotation\n" +"Module(\n" +" body=[\n" +" AnnAssign(\n" +" target=Subscript(\n" +" value=Name(id='a', ctx=Load()),\n" +" slice=Constant(value=1),\n" +" ctx=Store()),\n" +" annotation=Name(id='int', ctx=Load()),\n" +" simple=0)])" -#: ../../library/ast.rst:942 +#: ../../library/ast.rst:946 msgid "" "Augmented assignment, such as ``a += 1``. In the following example, " "``target`` is a :class:`Name` node for ``x`` (with the :class:`Store` " @@ -1613,7 +1732,7 @@ msgstr "" "是 ``x`` 的 :class:`Name` 節點(帶有 :class:`Store` 情境),``op`` 是 :class:" "`Add`,``value`` 是一個值為 1 的 :class:`Constant`。" -#: ../../library/ast.rst:947 +#: ../../library/ast.rst:951 msgid "" "The ``target`` attribute cannot be of class :class:`Tuple` or :class:`List`, " "unlike the targets of :class:`Assign`." @@ -1621,7 +1740,7 @@ msgstr "" "與 :class:`Assign` 的目標不同,``target`` 屬性不能屬於 :class:`Tuple` 或 :" "class:`List` 類別。" -#: ../../library/ast.rst:950 +#: ../../library/ast.rst:954 msgid "" ">>> print(ast.dump(ast.parse('x += 2'), indent=4))\n" "Module(\n" @@ -1629,8 +1748,7 @@ msgid "" " AugAssign(\n" " target=Name(id='x', ctx=Store()),\n" " op=Add(),\n" -" value=Constant(value=2))],\n" -" type_ignores=[])" +" value=Constant(value=2))])" msgstr "" ">>> print(ast.dump(ast.parse('x += 2'), indent=4))\n" "Module(\n" @@ -1638,10 +1756,9 @@ msgstr "" " AugAssign(\n" " target=Name(id='x', ctx=Store()),\n" " op=Add(),\n" -" value=Constant(value=2))],\n" -" type_ignores=[])" +" value=Constant(value=2))])" -#: ../../library/ast.rst:964 +#: ../../library/ast.rst:967 msgid "" "A ``raise`` statement. ``exc`` is the exception object to be raised, " "normally a :class:`Call` or :class:`Name`, or ``None`` for a standalone " @@ -1651,25 +1768,23 @@ msgstr "" "class:`Name`,若是獨立的 ``raise`` 則為 ``None``。``cause`` 是 ``raise x " "from y`` 中的可選部分 ``y``。" -#: ../../library/ast.rst:968 +#: ../../library/ast.rst:971 msgid "" ">>> print(ast.dump(ast.parse('raise x from y'), indent=4))\n" "Module(\n" " body=[\n" " Raise(\n" " exc=Name(id='x', ctx=Load()),\n" -" cause=Name(id='y', ctx=Load()))],\n" -" type_ignores=[])" +" cause=Name(id='y', ctx=Load()))])" msgstr "" ">>> print(ast.dump(ast.parse('raise x from y'), indent=4))\n" "Module(\n" " body=[\n" " Raise(\n" " exc=Name(id='x', ctx=Load()),\n" -" cause=Name(id='y', ctx=Load()))],\n" -" type_ignores=[])" +" cause=Name(id='y', ctx=Load()))])" -#: ../../library/ast.rst:981 +#: ../../library/ast.rst:983 msgid "" "An assertion. ``test`` holds the condition, such as a :class:`Compare` node. " "``msg`` holds the failure message." @@ -1677,25 +1792,23 @@ msgstr "" "一個斷言 (assertion)。``test`` 保存條件,例如 :class:`Compare` 節點。``msg`` " "保存失敗訊息。" -#: ../../library/ast.rst:984 +#: ../../library/ast.rst:986 msgid "" ">>> print(ast.dump(ast.parse('assert x,y'), indent=4))\n" "Module(\n" " body=[\n" " Assert(\n" " test=Name(id='x', ctx=Load()),\n" -" msg=Name(id='y', ctx=Load()))],\n" -" type_ignores=[])" +" msg=Name(id='y', ctx=Load()))])" msgstr "" ">>> print(ast.dump(ast.parse('assert x,y'), indent=4))\n" "Module(\n" " body=[\n" " Assert(\n" " test=Name(id='x', ctx=Load()),\n" -" msg=Name(id='y', ctx=Load()))],\n" -" type_ignores=[])" +" msg=Name(id='y', ctx=Load()))])" -#: ../../library/ast.rst:997 +#: ../../library/ast.rst:998 msgid "" "Represents a ``del`` statement. ``targets`` is a list of nodes, such as :" "class:`Name`, :class:`Attribute` or :class:`Subscript` nodes." @@ -1703,7 +1816,7 @@ msgstr "" "代表一個 ``del`` 陳述式。``targets`` 是節點串列,例如 :class:`Name`、:class:" "`Attribute` 或 :class:`Subscript` 節點。" -#: ../../library/ast.rst:1000 +#: ../../library/ast.rst:1001 msgid "" ">>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\n" "Module(\n" @@ -1712,8 +1825,7 @@ msgid "" " targets=[\n" " Name(id='x', ctx=Del()),\n" " Name(id='y', ctx=Del()),\n" -" Name(id='z', ctx=Del())])],\n" -" type_ignores=[])" +" Name(id='z', ctx=Del())])])" msgstr "" ">>> print(ast.dump(ast.parse('del x,y,z'), indent=4))\n" "Module(\n" @@ -1722,8 +1834,7 @@ msgstr "" " targets=[\n" " Name(id='x', ctx=Del()),\n" " Name(id='y', ctx=Del()),\n" -" Name(id='z', ctx=Del())])],\n" -" type_ignores=[])" +" Name(id='z', ctx=Del())])])" #: ../../library/ast.rst:1015 msgid "A ``pass`` statement." @@ -1734,16 +1845,14 @@ msgid "" ">>> print(ast.dump(ast.parse('pass'), indent=4))\n" "Module(\n" " body=[\n" -" Pass()],\n" -" type_ignores=[])" +" Pass()])" msgstr "" ">>> print(ast.dump(ast.parse('pass'), indent=4))\n" "Module(\n" " body=[\n" -" Pass()],\n" -" type_ignores=[])" +" Pass()])" -#: ../../library/ast.rst:1028 +#: ../../library/ast.rst:1027 msgid "" "A :ref:`type alias ` created through the :keyword:`type` " "statement. ``name`` is the name of the alias, ``type_params`` is a list of :" @@ -1754,41 +1863,37 @@ msgstr "" "aliases>`。``name`` 是別名的名稱、``type_params`` 是\\ :ref:`型別參數 (type " "parameter) ` 的串列、``value`` 是型別別名的值。" -#: ../../library/ast.rst:1033 +#: ../../library/ast.rst:1032 msgid "" ">>> print(ast.dump(ast.parse('type Alias = int'), indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" " name=Name(id='Alias', ctx=Store()),\n" -" type_params=[],\n" -" value=Name(id='int', ctx=Load()))],\n" -" type_ignores=[])" +" value=Name(id='int', ctx=Load()))])" msgstr "" ">>> print(ast.dump(ast.parse('type Alias = int'), indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" " name=Name(id='Alias', ctx=Store()),\n" -" type_params=[],\n" -" value=Name(id='int', ctx=Load()))],\n" -" type_ignores=[])" +" value=Name(id='int', ctx=Load()))])" -#: ../../library/ast.rst:1046 +#: ../../library/ast.rst:1043 msgid "" "Other statements which are only applicable inside functions or loops are " "described in other sections." msgstr "其他僅適用於函式或迴圈內部的陳述式將在其他部分中描述。" -#: ../../library/ast.rst:1050 +#: ../../library/ast.rst:1047 msgid "Imports" msgstr "引入 (imports)" -#: ../../library/ast.rst:1054 +#: ../../library/ast.rst:1051 msgid "An import statement. ``names`` is a list of :class:`alias` nodes." msgstr "一個 import 陳述式。``names`` 是 :class:`alias` 節點的串列。" -#: ../../library/ast.rst:1056 +#: ../../library/ast.rst:1053 msgid "" ">>> print(ast.dump(ast.parse('import x,y,z'), indent=4))\n" "Module(\n" @@ -1797,8 +1902,7 @@ msgid "" " names=[\n" " alias(name='x'),\n" " alias(name='y'),\n" -" alias(name='z')])],\n" -" type_ignores=[])" +" alias(name='z')])])" msgstr "" ">>> print(ast.dump(ast.parse('import x,y,z'), indent=4))\n" "Module(\n" @@ -1807,10 +1911,9 @@ msgstr "" " names=[\n" " alias(name='x'),\n" " alias(name='y'),\n" -" alias(name='z')])],\n" -" type_ignores=[])" +" alias(name='z')])])" -#: ../../library/ast.rst:1071 +#: ../../library/ast.rst:1067 msgid "" "Represents ``from x import y``. ``module`` is a raw string of the 'from' " "name, without any leading dots, or ``None`` for statements such as ``from . " @@ -1821,7 +1924,7 @@ msgstr "" "點 (dot),或者對於諸如 ``from . import foo`` 之類的陳述式則為 ``None``。" "``level`` 是一個整數,保存相對引入的級別(0 表示絕對引入)。" -#: ../../library/ast.rst:1076 +#: ../../library/ast.rst:1072 msgid "" ">>> print(ast.dump(ast.parse('from y import x,y,z'), indent=4))\n" "Module(\n" @@ -1832,8 +1935,7 @@ msgid "" " alias(name='x'),\n" " alias(name='y'),\n" " alias(name='z')],\n" -" level=0)],\n" -" type_ignores=[])" +" level=0)])" msgstr "" ">>> print(ast.dump(ast.parse('from y import x,y,z'), indent=4))\n" "Module(\n" @@ -1844,10 +1946,9 @@ msgstr "" " alias(name='x'),\n" " alias(name='y'),\n" " alias(name='z')],\n" -" level=0)],\n" -" type_ignores=[])" +" level=0)])" -#: ../../library/ast.rst:1093 +#: ../../library/ast.rst:1088 msgid "" "Both parameters are raw strings of the names. ``asname`` can be ``None`` if " "the regular name is to be used." @@ -1855,7 +1956,7 @@ msgstr "" "這兩個參數都是名稱的原始字串。如果要使用常規名稱,``asname`` 可以為 " "``None``。" -#: ../../library/ast.rst:1096 +#: ../../library/ast.rst:1091 msgid "" ">>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4))\n" "Module(\n" @@ -1865,8 +1966,7 @@ msgid "" " names=[\n" " alias(name='a', asname='b'),\n" " alias(name='c')],\n" -" level=2)],\n" -" type_ignores=[])" +" level=2)])" msgstr "" ">>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4))\n" "Module(\n" @@ -1876,20 +1976,19 @@ msgstr "" " names=[\n" " alias(name='a', asname='b'),\n" " alias(name='c')],\n" -" level=2)],\n" -" type_ignores=[])" +" level=2)])" -#: ../../library/ast.rst:1110 +#: ../../library/ast.rst:1104 msgid "Control flow" msgstr "流程控制" -#: ../../library/ast.rst:1113 +#: ../../library/ast.rst:1107 msgid "" "Optional clauses such as ``else`` are stored as an empty list if they're not " "present." msgstr "諸如 ``else`` 之類的可選子句如果不存在,則將被儲存為空串列。" -#: ../../library/ast.rst:1118 +#: ../../library/ast.rst:1112 msgid "" "An ``if`` statement. ``test`` holds a single node, such as a :class:" "`Compare` node. ``body`` and ``orelse`` each hold a list of nodes." @@ -1897,7 +1996,7 @@ msgstr "" "一個 ``if`` 陳述式。``test`` 保存單個節點,例如 :class:`Compare` 節點。" "``body`` 和 ``orelse`` 各自保存一個節點串列。" -#: ../../library/ast.rst:1121 +#: ../../library/ast.rst:1115 msgid "" "``elif`` clauses don't have a special representation in the AST, but rather " "appear as extra :class:`If` nodes within the ``orelse`` section of the " @@ -1906,7 +2005,7 @@ msgstr "" "``elif`` 子句在 AST 中沒有特殊表示,而是在前一個子句的 ``orelse`` 部分中作為" "額外的 :class:`If` 節點出現。" -#: ../../library/ast.rst:1125 +#: ../../library/ast.rst:1119 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... if x:\n" @@ -1931,8 +2030,7 @@ msgid "" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... if x:\n" @@ -1957,10 +2055,9 @@ msgstr "" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1156 +#: ../../library/ast.rst:1149 msgid "" "A ``for`` loop. ``target`` holds the variable(s) the loop assigns to, as a " "single :class:`Name`, :class:`Tuple`, :class:`List`, :class:`Attribute` or :" @@ -1975,7 +2072,7 @@ msgstr "" "行的節點串列。如果迴圈正常完成,則執行 ``orelse`` 中的內容,而不是透過 " "``break`` 陳述式執行。" -#: ../../library/ast.rst:1167 +#: ../../library/ast.rst:1160 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... for x in y:\n" @@ -1993,8 +2090,7 @@ msgid "" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... for x in y:\n" @@ -2012,16 +2108,15 @@ msgstr "" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])" -#: ../../library/ast.rst:1191 +#: ../../library/ast.rst:1183 msgid "" "A ``while`` loop. ``test`` holds the condition, such as a :class:`Compare` " "node." msgstr "一個 ``while`` 迴圈。``test`` 保存條件,例如 :class:`Compare` 節點。" -#: ../../library/ast.rst:1194 +#: ../../library/ast.rst:1186 msgid "" ">> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" @@ -2038,8 +2133,7 @@ msgid "" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])" msgstr "" ">> print(ast.dump(ast.parse(\"\"\"\n" "... while x:\n" @@ -2056,14 +2150,13 @@ msgstr "" " value=Constant(value=Ellipsis))],\n" " orelse=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])" -#: ../../library/ast.rst:1218 +#: ../../library/ast.rst:1209 msgid "The ``break`` and ``continue`` statements." msgstr "``break`` 和 ``continue`` 陳述式。" -#: ../../library/ast.rst:1220 +#: ../../library/ast.rst:1211 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... for a in b:\n" @@ -2089,9 +2182,7 @@ msgid "" " body=[\n" " Break()],\n" " orelse=[\n" -" Continue()])],\n" -" orelse=[])],\n" -" type_ignores=[])" +" Continue()])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... for a in b:\n" @@ -2117,11 +2208,9 @@ msgstr "" " body=[\n" " Break()],\n" " orelse=[\n" -" Continue()])],\n" -" orelse=[])],\n" -" type_ignores=[])" +" Continue()])])])" -#: ../../library/ast.rst:1253 +#: ../../library/ast.rst:1242 msgid "" "``try`` blocks. All attributes are list of nodes to execute, except for " "``handlers``, which is a list of :class:`ExceptHandler` nodes." @@ -2129,7 +2218,7 @@ msgstr "" "``try`` 區塊。除 ``handlers`` 是 :class:`ExceptHandler` 節點的串列外,其他所" "有屬性都是要執行之節點的串列。" -#: ../../library/ast.rst:1256 +#: ../../library/ast.rst:1245 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2166,8 +2255,7 @@ msgid "" " value=Constant(value=Ellipsis))],\n" " finalbody=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2204,10 +2292,9 @@ msgstr "" " value=Constant(value=Ellipsis))],\n" " finalbody=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])" -#: ../../library/ast.rst:1299 +#: ../../library/ast.rst:1287 msgid "" "``try`` blocks which are followed by ``except*`` clauses. The attributes are " "the same as for :class:`Try` but the :class:`ExceptHandler` nodes in " @@ -2217,7 +2304,7 @@ msgstr "" "``handlers`` 中的 :class:`ExceptHandler` 節點被直譯 (interpret) 為 " "``except*`` 區塊而不是 ``except``。" -#: ../../library/ast.rst:1303 +#: ../../library/ast.rst:1291 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2236,10 +2323,7 @@ msgid "" " type=Name(id='Exception', ctx=Load()),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" orelse=[],\n" -" finalbody=[])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... try:\n" @@ -2258,12 +2342,9 @@ msgstr "" " type=Name(id='Exception', ctx=Load()),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])],\n" -" orelse=[],\n" -" finalbody=[])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1331 +#: ../../library/ast.rst:1316 msgid "" "A single ``except`` clause. ``type`` is the exception type it will match, " "typically a :class:`Name` node (or ``None`` for a catch-all ``except:`` " @@ -2275,7 +2356,7 @@ msgstr "" "``name`` 是用於保存例外的名稱之原始字串,如果子句沒有 ``as foo`` ,則為 " "``None``。``body`` 是節點串列。" -#: ../../library/ast.rst:1336 +#: ../../library/ast.rst:1321 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... try:\n" @@ -2296,10 +2377,7 @@ msgid "" " ExceptHandler(\n" " type=Name(id='TypeError', ctx=Load()),\n" " body=[\n" -" Pass()])],\n" -" orelse=[],\n" -" finalbody=[])],\n" -" type_ignores=[])" +" Pass()])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... try:\n" @@ -2320,12 +2398,9 @@ msgstr "" " ExceptHandler(\n" " type=Name(id='TypeError', ctx=Load()),\n" " body=[\n" -" Pass()])],\n" -" orelse=[],\n" -" finalbody=[])],\n" -" type_ignores=[])" +" Pass()])])])" -#: ../../library/ast.rst:1365 +#: ../../library/ast.rst:1347 msgid "" "A ``with`` block. ``items`` is a list of :class:`withitem` nodes " "representing the context managers, and ``body`` is the indented block inside " @@ -2334,7 +2409,7 @@ msgstr "" "一個 ``with`` 區塊。``items`` 是表示情境管理器的 :class:`withitem` 節點串列," "``body`` 是情境內的縮進區塊。" -#: ../../library/ast.rst:1375 +#: ../../library/ast.rst:1357 msgid "" "A single context manager in a ``with`` block. ``context_expr`` is the " "context manager, often a :class:`Call` node. ``optional_vars`` is a :class:" @@ -2345,7 +2420,7 @@ msgstr "" "class:`Call` 節點。``Optional_vars`` 是 ``as foo`` 部分的 :class:`Name`、:" "class:`Tuple` 或 :class:`List`,或者如果不使用則為 ``None`` 。" -#: ../../library/ast.rst:1380 +#: ../../library/ast.rst:1362 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... with a as b, c as d:\n" @@ -2367,9 +2442,7 @@ msgid "" " func=Name(id='something', ctx=Load()),\n" " args=[\n" " Name(id='b', ctx=Load()),\n" -" Name(id='d', ctx=Load())],\n" -" keywords=[]))])],\n" -" type_ignores=[])" +" Name(id='d', ctx=Load())]))])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... with a as b, c as d:\n" @@ -2391,15 +2464,13 @@ msgstr "" " func=Name(id='something', ctx=Load()),\n" " args=[\n" " Name(id='b', ctx=Load()),\n" -" Name(id='d', ctx=Load())],\n" -" keywords=[]))])],\n" -" type_ignores=[])" +" Name(id='d', ctx=Load())]))])])" -#: ../../library/ast.rst:1408 +#: ../../library/ast.rst:1388 msgid "Pattern matching" msgstr "模式匹配 (pattern matching)" -#: ../../library/ast.rst:1413 +#: ../../library/ast.rst:1393 msgid "" "A ``match`` statement. ``subject`` holds the subject of the match (the " "object that is being matched against the cases) and ``cases`` contains an " @@ -2408,7 +2479,7 @@ msgstr "" "一個 ``match`` 陳述式。``subject`` 保存匹配的主題(與案例匹配的物件)," "``cases`` 包含具有不同案例的 :class:`match_case` 節點的可疊代物件。" -#: ../../library/ast.rst:1421 +#: ../../library/ast.rst:1401 msgid "" "A single case pattern in a ``match`` statement. ``pattern`` contains the " "match pattern that the subject will be matched against. Note that the :class:" @@ -2419,13 +2490,13 @@ msgstr "" "請注意,為模式生成的 :class:`AST` 節點與為運算式生成的節點不同,即使它們共享" "相同的語法。" -#: ../../library/ast.rst:1426 +#: ../../library/ast.rst:1406 msgid "" "The ``guard`` attribute contains an expression that will be evaluated if the " "pattern matches the subject." msgstr "``guard`` 屬性包含一個運算式,如果模式與主題匹配,則將對該運算式求值。" -#: ../../library/ast.rst:1429 +#: ../../library/ast.rst:1409 msgid "" "``body`` contains a list of nodes to execute if the pattern matches and the " "result of evaluating the guard expression is true." @@ -2433,7 +2504,7 @@ msgstr "" "``body`` 包含一個節點串列,如果模式匹配並且為防護運算式 (guard expression) 的" "求值 (evaluate) 結果為真,則會執行該節點串列。" -#: ../../library/ast.rst:1432 +#: ../../library/ast.rst:1412 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2462,14 +2533,10 @@ msgid "" " value=Constant(value=Ellipsis))]),\n" " match_case(\n" " pattern=MatchClass(\n" -" cls=Name(id='tuple', ctx=Load()),\n" -" patterns=[],\n" -" kwd_attrs=[],\n" -" kwd_patterns=[]),\n" +" cls=Name(id='tuple', ctx=Load())),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2498,16 +2565,12 @@ msgstr "" " value=Constant(value=Ellipsis))]),\n" " match_case(\n" " pattern=MatchClass(\n" -" cls=Name(id='tuple', ctx=Load()),\n" -" patterns=[],\n" -" kwd_attrs=[],\n" -" kwd_patterns=[]),\n" +" cls=Name(id='tuple', ctx=Load())),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1474 +#: ../../library/ast.rst:1450 msgid "" "A match literal or value pattern that compares by equality. ``value`` is an " "expression node. Permitted value nodes are restricted as described in the " @@ -2517,7 +2580,7 @@ msgstr "" "以相等性進行比較的匹配文本或值的模式。``value`` 是一個運算式節點。允許值節點" "受到匹配陳述式文件中所述的限制。如果匹配主題等於求出值,則此模式成功。" -#: ../../library/ast.rst:1479 +#: ../../library/ast.rst:1455 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2534,8 +2597,7 @@ msgid "" " value=Constant(value='Relevant')),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2552,10 +2614,9 @@ msgstr "" " value=Constant(value='Relevant')),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1503 +#: ../../library/ast.rst:1478 msgid "" "A match literal pattern that compares by identity. ``value`` is the " "singleton to be compared against: ``None``, ``True``, or ``False``. This " @@ -2565,7 +2626,7 @@ msgstr "" "``True`` 或 ``False`` 進行比較的單例 (singleton)。如果匹配主題是給定的常數," "則此模式成功。" -#: ../../library/ast.rst:1507 +#: ../../library/ast.rst:1482 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2581,8 +2642,7 @@ msgid "" " pattern=MatchSingleton(value=None),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2598,10 +2658,9 @@ msgstr "" " pattern=MatchSingleton(value=None),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1530 +#: ../../library/ast.rst:1504 msgid "" "A match sequence pattern. ``patterns`` contains the patterns to be matched " "against the subject elements if the subject is a sequence. Matches a " @@ -2611,7 +2670,7 @@ msgstr "" "匹配序列模式。如果主題是一個序列,``patterns`` 包含與主題元素匹配的模式。如果" "子模式之一是 ``MatchStar`` 節點,則匹配可變長度序列,否則匹配固定長度序列。" -#: ../../library/ast.rst:1535 +#: ../../library/ast.rst:1509 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2632,8 +2691,7 @@ msgid "" " value=Constant(value=2))]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2654,10 +2712,9 @@ msgstr "" " value=Constant(value=2))]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1563 +#: ../../library/ast.rst:1536 msgid "" "Matches the rest of the sequence in a variable length match sequence " "pattern. If ``name`` is not ``None``, a list containing the remaining " @@ -2667,7 +2724,7 @@ msgstr "" "以可變長度匹配序列模式匹配序列的其餘部分。如果 ``name`` 不是 ``None``,則如果" "整體序列模式成功,則包含其餘序列元素的串列將綁定到該名稱。" -#: ../../library/ast.rst:1567 +#: ../../library/ast.rst:1540 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2698,8 +2755,7 @@ msgid "" " MatchStar()]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2730,10 +2786,9 @@ msgstr "" " MatchStar()]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1605 +#: ../../library/ast.rst:1577 msgid "" "A match mapping pattern. ``keys`` is a sequence of expression nodes. " "``patterns`` is a corresponding sequence of pattern nodes. ``rest`` is an " @@ -2745,7 +2800,7 @@ msgstr "" "列。``rest`` 是一個可選名稱,可以指定它來捕獲剩餘的對映元素。允許的鍵運算式受" "到匹配陳述式文件中所述的限制。" -#: ../../library/ast.rst:1611 +#: ../../library/ast.rst:1583 msgid "" "This pattern succeeds if the subject is a mapping, all evaluated key " "expressions are present in the mapping, and the value corresponding to each " @@ -2757,7 +2812,7 @@ msgstr "" "應的子模式匹配,則此模式成功。如果 ``rest`` 不是 ``None``,則如果整體對映模式" "成功,則包含其餘對映元素的字典將綁定到該名稱。" -#: ../../library/ast.rst:1617 +#: ../../library/ast.rst:1589 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2783,12 +2838,10 @@ msgid "" " Expr(\n" " value=Constant(value=Ellipsis))]),\n" " match_case(\n" -" pattern=MatchMapping(keys=[], patterns=[], " -"rest='rest'),\n" +" pattern=MatchMapping(rest='rest'),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2814,14 +2867,12 @@ msgstr "" " Expr(\n" " value=Constant(value=Ellipsis))]),\n" " match_case(\n" -" pattern=MatchMapping(keys=[], patterns=[], " -"rest='rest'),\n" +" pattern=MatchMapping(rest='rest'),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1653 +#: ../../library/ast.rst:1624 msgid "" "A match class pattern. ``cls`` is an expression giving the nominal class to " "be matched. ``patterns`` is a sequence of pattern nodes to be matched " @@ -2836,7 +2887,7 @@ msgstr "" "``kwd_attrs`` 是要匹配的附加屬性序列(在類別模式中指定為關鍵字引數)," "``kwd_patterns`` 是相應的模式(在類別模式中指定為關鍵字的值)。" -#: ../../library/ast.rst:1660 +#: ../../library/ast.rst:1631 msgid "" "This pattern succeeds if the subject is an instance of the nominated class, " "all positional patterns match the corresponding class-defined attributes, " @@ -2845,7 +2896,7 @@ msgstr "" "如果主題是指定類別的實例,所有位置模式都與相應的類別定義屬性匹配,並且任何指" "定的關鍵字屬性與其相應模式匹配,則此模式成功。" -#: ../../library/ast.rst:1664 +#: ../../library/ast.rst:1635 msgid "" "Note: classes may define a property that returns self in order to match a " "pattern node against the instance being matched. Several builtin types are " @@ -2854,7 +2905,7 @@ msgstr "" "注意:類別可以定義一個回傳 self 的特性 (property),以便將模式節點與正在匹配的" "實例進行匹配。一些內建型別也以這種方式匹配,如同匹配陳述式文件中所述。" -#: ../../library/ast.rst:1668 +#: ../../library/ast.rst:1639 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2875,16 +2926,13 @@ msgid "" " MatchValue(\n" " value=Constant(value=0)),\n" " MatchValue(\n" -" value=Constant(value=0))],\n" -" kwd_attrs=[],\n" -" kwd_patterns=[]),\n" +" value=Constant(value=0))]),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))]),\n" " match_case(\n" " pattern=MatchClass(\n" " cls=Name(id='Point3D', ctx=Load()),\n" -" patterns=[],\n" " kwd_attrs=[\n" " 'x',\n" " 'y',\n" @@ -2898,8 +2946,7 @@ msgid "" " value=Constant(value=0))]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2920,16 +2967,13 @@ msgstr "" " MatchValue(\n" " value=Constant(value=0)),\n" " MatchValue(\n" -" value=Constant(value=0))],\n" -" kwd_attrs=[],\n" -" kwd_patterns=[]),\n" +" value=Constant(value=0))]),\n" " body=[\n" " Expr(\n" " value=Constant(value=Ellipsis))]),\n" " match_case(\n" " pattern=MatchClass(\n" " cls=Name(id='Point3D', ctx=Load()),\n" -" patterns=[],\n" " kwd_attrs=[\n" " 'x',\n" " 'y',\n" @@ -2943,10 +2987,9 @@ msgstr "" " value=Constant(value=0))]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1719 +#: ../../library/ast.rst:1686 msgid "" "A match \"as-pattern\", capture pattern or wildcard pattern. ``pattern`` " "contains the match pattern that the subject will be matched against. If the " @@ -2957,7 +3000,7 @@ msgstr "" "(wildcard pattern)。``pattern`` 包含主題將與之匹配的匹配模式。如果模式為 " "``None``,則該節點代表捕獲模式(即裸名 (bare name))並且始終會成功。" -#: ../../library/ast.rst:1724 +#: ../../library/ast.rst:1691 msgid "" "The ``name`` attribute contains the name that will be bound if the pattern " "is successful. If ``name`` is ``None``, ``pattern`` must also be ``None`` " @@ -2966,7 +3009,7 @@ msgstr "" "``name`` 屬性包含模式成功時將綁定的名稱。如果 ``name`` 為 ``None``,則 " "``pattern`` 也必須為 ``None``,並且節點代表通配模式。" -#: ../../library/ast.rst:1728 +#: ../../library/ast.rst:1695 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -2993,8 +3036,7 @@ msgid "" " pattern=MatchAs(),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3021,10 +3063,9 @@ msgstr "" " pattern=MatchAs(),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1762 +#: ../../library/ast.rst:1728 msgid "" "A match \"or-pattern\". An or-pattern matches each of its subpatterns in " "turn to the subject, until one succeeds. The or-pattern is then deemed to " @@ -3036,7 +3077,7 @@ msgstr "" "到成功為止,然後 or 模式就會被認為是成功的。如果沒有一個子模式成功,則 or 模" "式將失敗。 ``patterns`` 屬性包含將與主題進行匹配的匹配模式節點串列。" -#: ../../library/ast.rst:1768 +#: ../../library/ast.rst:1734 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3057,8 +3098,7 @@ msgid "" " MatchAs(name='y')]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\n" "... match x:\n" @@ -3079,32 +3119,35 @@ msgstr "" " MatchAs(name='y')]),\n" " body=[\n" " Expr(\n" -" value=Constant(value=Ellipsis))])])],\n" -" type_ignores=[])" +" value=Constant(value=Ellipsis))])])])" -#: ../../library/ast.rst:1797 +#: ../../library/ast.rst:1762 msgid "Type parameters" msgstr "型別參數 (type parameters)" -#: ../../library/ast.rst:1799 +#: ../../library/ast.rst:1764 msgid "" ":ref:`Type parameters ` can exist on classes, functions, and " "type aliases." msgstr ":ref:`型別參數 `\\ 可以存在於類別、函式和型別別名上。" -#: ../../library/ast.rst:1804 +#: ../../library/ast.rst:1769 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." +"`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`,它代表約束;否則它代表界限。" +"`Tuple`,它代表約束;否則它代表界限。``default_value`` 為預設值;如果 :class:" +"`!TypeVar` 沒有預設值,那此屬性會被設為 ``None``。" -#: ../../library/ast.rst:1808 +#: ../../library/ast.rst:1775 msgid "" -">>> print(ast.dump(ast.parse(\"type Alias[T: int] = list[T]\"), indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[T: int = bool] = list[T]\"), " +"indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" @@ -3112,14 +3155,15 @@ msgid "" " type_params=[\n" " TypeVar(\n" " name='T',\n" -" bound=Name(id='int', ctx=Load()))],\n" +" bound=Name(id='int', ctx=Load()),\n" +" default_value=Name(id='bool', ctx=Load()))],\n" " value=Subscript(\n" " value=Name(id='list', ctx=Load()),\n" " slice=Name(id='T', ctx=Load()),\n" -" ctx=Load()))],\n" -" type_ignores=[])" +" ctx=Load()))])" msgstr "" -">>> print(ast.dump(ast.parse(\"type Alias[T: int] = list[T]\"), indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[T: int = bool] = list[T]\"), " +"indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" @@ -3127,29 +3171,43 @@ msgstr "" " type_params=[\n" " TypeVar(\n" " name='T',\n" -" bound=Name(id='int', ctx=Load()))],\n" +" bound=Name(id='int', ctx=Load()),\n" +" default_value=Name(id='bool', ctx=Load()))],\n" " value=Subscript(\n" " value=Name(id='list', ctx=Load()),\n" " slice=Name(id='T', ctx=Load()),\n" -" ctx=Load()))],\n" -" type_ignores=[])" +" ctx=Load()))])" + +#: ../../library/ast.rst:1794 ../../library/ast.rst:1829 +#: ../../library/ast.rst:1861 +msgid "Added the *default_value* parameter." +msgstr "新增 *default_value* 參數。" -#: ../../library/ast.rst:1829 +#: ../../library/ast.rst:1799 msgid "" "A :class:`typing.ParamSpec`. ``name`` is the name of the parameter " -"specification." -msgstr "A :class:`typing.ParamSpec`。``name`` 是參數規範的名稱。" +"specification. ``default_value`` is the default value; if the :class:`!" +"ParamSpec` has no default, this attribute will be set to ``None``." +msgstr "" +"一個 :class:`typing.ParamSpec`。``name`` 是參數規範的名稱。``default_value`` " +"是預設值;如果 :class:`!ParamSpec` 沒有預設值,則該屬性將設定為 ``None``。" -#: ../../library/ast.rst:1831 +#: ../../library/ast.rst:1803 msgid "" -">>> print(ast.dump(ast.parse(\"type Alias[**P] = Callable[P, int]\"), " -"indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[**P = (int, str)] = Callable[P, " +"int]\"), indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" " name=Name(id='Alias', ctx=Store()),\n" " type_params=[\n" -" ParamSpec(name='P')],\n" +" ParamSpec(\n" +" name='P',\n" +" default_value=Tuple(\n" +" elts=[\n" +" Name(id='int', ctx=Load()),\n" +" Name(id='str', ctx=Load())],\n" +" ctx=Load()))],\n" " value=Subscript(\n" " value=Name(id='Callable', ctx=Load()),\n" " slice=Tuple(\n" @@ -3157,17 +3215,22 @@ msgid "" " Name(id='P', ctx=Load()),\n" " Name(id='int', ctx=Load())],\n" " ctx=Load()),\n" -" ctx=Load()))],\n" -" type_ignores=[])" +" ctx=Load()))])" msgstr "" -">>> print(ast.dump(ast.parse(\"type Alias[**P] = Callable[P, int]\"), " -"indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[**P = (int, str)] = Callable[P, " +"int]\"), indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" " name=Name(id='Alias', ctx=Store()),\n" " type_params=[\n" -" ParamSpec(name='P')],\n" +" ParamSpec(\n" +" name='P',\n" +" default_value=Tuple(\n" +" elts=[\n" +" Name(id='int', ctx=Load()),\n" +" Name(id='str', ctx=Load())],\n" +" ctx=Load()))],\n" " value=Subscript(\n" " value=Name(id='Callable', ctx=Load()),\n" " slice=Tuple(\n" @@ -3175,24 +3238,30 @@ msgstr "" " Name(id='P', ctx=Load()),\n" " Name(id='int', ctx=Load())],\n" " ctx=Load()),\n" -" ctx=Load()))],\n" -" type_ignores=[])" +" ctx=Load()))])" -#: ../../library/ast.rst:1854 +#: ../../library/ast.rst:1834 msgid "" "A :class:`typing.TypeVarTuple`. ``name`` is the name of the type variable " -"tuple." -msgstr "一個 :class:`typing.TypeVarTuple`。``name`` 是型別變數元組的名稱。" +"tuple. ``default_value`` is the default value; if the :class:`!TypeVarTuple` " +"has no default, this attribute will be set to ``None``." +msgstr "" +"一個 :class:`typing.TypeVarTuple`。``name`` 是型別變數元組的名稱。" +"``default_value`` 為預設值;如果 :class:`!TypeVarTuple` 沒有預設值,那此屬性" +"會被設為 ``None``。" -#: ../../library/ast.rst:1856 +#: ../../library/ast.rst:1838 msgid "" -">>> print(ast.dump(ast.parse(\"type Alias[*Ts] = tuple[*Ts]\"), indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[*Ts = ()] = tuple[*Ts]\"), " +"indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" " name=Name(id='Alias', ctx=Store()),\n" " type_params=[\n" -" TypeVarTuple(name='Ts')],\n" +" TypeVarTuple(\n" +" name='Ts',\n" +" default_value=Tuple(ctx=Load()))],\n" " value=Subscript(\n" " value=Name(id='tuple', ctx=Load()),\n" " slice=Tuple(\n" @@ -3201,16 +3270,18 @@ msgid "" " value=Name(id='Ts', ctx=Load()),\n" " ctx=Load())],\n" " ctx=Load()),\n" -" ctx=Load()))],\n" -" type_ignores=[])" +" ctx=Load()))])" msgstr "" -">>> print(ast.dump(ast.parse(\"type Alias[*Ts] = tuple[*Ts]\"), indent=4))\n" +">>> print(ast.dump(ast.parse(\"type Alias[*Ts = ()] = tuple[*Ts]\"), " +"indent=4))\n" "Module(\n" " body=[\n" " TypeAlias(\n" " name=Name(id='Alias', ctx=Store()),\n" " type_params=[\n" -" TypeVarTuple(name='Ts')],\n" +" TypeVarTuple(\n" +" name='Ts',\n" +" default_value=Tuple(ctx=Load()))],\n" " value=Subscript(\n" " value=Name(id='tuple', ctx=Load()),\n" " slice=Tuple(\n" @@ -3219,30 +3290,29 @@ msgstr "" " value=Name(id='Ts', ctx=Load()),\n" " ctx=Load())],\n" " ctx=Load()),\n" -" ctx=Load()))],\n" -" type_ignores=[])" +" ctx=Load()))])" -#: ../../library/ast.rst:1879 +#: ../../library/ast.rst:1865 msgid "Function and class definitions" msgstr "函式和類別定義" -#: ../../library/ast.rst:1883 +#: ../../library/ast.rst:1869 msgid "A function definition." msgstr "一個函式定義。" -#: ../../library/ast.rst:1885 +#: ../../library/ast.rst:1871 msgid "``name`` is a raw string of the function name." msgstr "``name`` 是函式名稱的原始字串。" -#: ../../library/ast.rst:1886 +#: ../../library/ast.rst:1872 msgid "``args`` is an :class:`arguments` node." msgstr "``args`` 是一個 :class:`arguments` 節點。" -#: ../../library/ast.rst:1887 +#: ../../library/ast.rst:1873 msgid "``body`` is the list of nodes inside the function." msgstr "``body`` 是函式內節點的串列。" -#: ../../library/ast.rst:1888 +#: ../../library/ast.rst:1874 msgid "" "``decorator_list`` is the list of decorators to be applied, stored outermost " "first (i.e. the first in the list will be applied last)." @@ -3250,20 +3320,20 @@ msgstr "" "``decorator_list`` 是要應用的裝飾器串列,在最外層者會被儲存在首位(即串列中首" "位將會是最後一個被應用的那個)。" -#: ../../library/ast.rst:1890 +#: ../../library/ast.rst:1876 msgid "``returns`` is the return annotation." msgstr "``returns`` 是回傳註釋。" -#: ../../library/ast.rst:1891 ../../library/ast.rst:2067 +#: ../../library/ast.rst:1877 ../../library/ast.rst:2040 msgid "``type_params`` is a list of :ref:`type parameters `." msgstr "``type_params`` 是\\ :ref:`型別參數 `\\ 的串列。" -#: ../../library/ast.rst:1897 ../../library/ast.rst:2096 -#: ../../library/ast.rst:2107 +#: ../../library/ast.rst:1883 ../../library/ast.rst:2067 +#: ../../library/ast.rst:2078 msgid "Added ``type_params``." msgstr "新增了 ``type_params``。" -#: ../../library/ast.rst:1903 +#: ../../library/ast.rst:1889 msgid "" "``lambda`` is a minimal function definition that can be used inside an " "expression. Unlike :class:`FunctionDef`, ``body`` holds a single node." @@ -3271,7 +3341,7 @@ msgstr "" "``lambda`` 是可以在運算式內使用的最小函式定義。與 :class:`FunctionDef` 不同," "``body`` 保存單個節點。" -#: ../../library/ast.rst:1906 +#: ../../library/ast.rst:1892 msgid "" ">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" "Module(\n" @@ -3279,15 +3349,10 @@ msgid "" " Expr(\n" " value=Lambda(\n" " args=arguments(\n" -" posonlyargs=[],\n" " args=[\n" " arg(arg='x'),\n" -" arg(arg='y')],\n" -" kwonlyargs=[],\n" -" kw_defaults=[],\n" -" defaults=[]),\n" -" body=Constant(value=Ellipsis)))],\n" -" type_ignores=[])" +" arg(arg='y')]),\n" +" body=Constant(value=Ellipsis)))])" msgstr "" ">>> print(ast.dump(ast.parse('lambda x,y: ...'), indent=4))\n" "Module(\n" @@ -3295,27 +3360,22 @@ msgstr "" " Expr(\n" " value=Lambda(\n" " args=arguments(\n" -" posonlyargs=[],\n" " args=[\n" " arg(arg='x'),\n" -" arg(arg='y')],\n" -" kwonlyargs=[],\n" -" kw_defaults=[],\n" -" defaults=[]),\n" -" body=Constant(value=Ellipsis)))],\n" -" type_ignores=[])" +" arg(arg='y')]),\n" +" body=Constant(value=Ellipsis)))])" -#: ../../library/ast.rst:1927 +#: ../../library/ast.rst:1908 msgid "The arguments for a function." msgstr "函式的引數。" -#: ../../library/ast.rst:1929 +#: ../../library/ast.rst:1910 msgid "" "``posonlyargs``, ``args`` and ``kwonlyargs`` are lists of :class:`arg` nodes." msgstr "" "``posonlyargs``、``args`` 和 ``kwonlyargs`` 是 :class:`arg` 節點的串列。" -#: ../../library/ast.rst:1930 +#: ../../library/ast.rst:1911 msgid "" "``vararg`` and ``kwarg`` are single :class:`arg` nodes, referring to the " "``*args, **kwargs`` parameters." @@ -3323,7 +3383,7 @@ msgstr "" "``vararg`` 和 ``kwarg`` 是單個 :class:`arg` 節點,指的是 ``*args, **kwargs`` " "參數。" -#: ../../library/ast.rst:1932 +#: ../../library/ast.rst:1913 msgid "" "``kw_defaults`` is a list of default values for keyword-only arguments. If " "one is ``None``, the corresponding argument is required." @@ -3331,7 +3391,7 @@ msgstr "" "``kw_defaults`` 是僅限關鍵字引數的預設值串列。如果其中某個為 ``None``,則相應" "參數就會是必要的。" -#: ../../library/ast.rst:1934 +#: ../../library/ast.rst:1915 msgid "" "``defaults`` is a list of default values for arguments that can be passed " "positionally. If there are fewer defaults, they correspond to the last n " @@ -3340,7 +3400,7 @@ msgstr "" "``defaults`` 是可以按位置傳遞的引數的預設值串列。如果預設值較少,則它們對應於" "最後 n 個引數。" -#: ../../library/ast.rst:1941 +#: ../../library/ast.rst:1922 msgid "" "A single argument in a list. ``arg`` is a raw string of the argument name; " "``annotation`` is its annotation, such as a :class:`Name` node." @@ -3348,12 +3408,12 @@ msgstr "" "串列中的單個引數。``arg`` 是引數名稱的原始字串,``annotation`` 是它的註釋,例" "如 :class:`Name` 節點。" -#: ../../library/ast.rst:1946 +#: ../../library/ast.rst:1927 msgid "" "``type_comment`` is an optional string with the type annotation as a comment" msgstr "``type_comment`` 是一個可選字串,其註解為型別註釋" -#: ../../library/ast.rst:1948 +#: ../../library/ast.rst:1929 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3367,7 +3427,6 @@ msgid "" " FunctionDef(\n" " name='f',\n" " args=arguments(\n" -" posonlyargs=[],\n" " args=[\n" " arg(\n" " arg='a',\n" @@ -3390,9 +3449,7 @@ msgid "" " decorator_list=[\n" " Name(id='decorator1', ctx=Load()),\n" " Name(id='decorator2', ctx=Load())],\n" -" returns=Constant(value='return annotation'),\n" -" type_params=[])],\n" -" type_ignores=[])" +" returns=Constant(value='return annotation'))])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3406,7 +3463,6 @@ msgstr "" " FunctionDef(\n" " name='f',\n" " args=arguments(\n" -" posonlyargs=[],\n" " args=[\n" " arg(\n" " arg='a',\n" @@ -3429,31 +3485,27 @@ msgstr "" " decorator_list=[\n" " Name(id='decorator1', ctx=Load()),\n" " Name(id='decorator2', ctx=Load())],\n" -" returns=Constant(value='return annotation'),\n" -" type_params=[])],\n" -" type_ignores=[])" +" returns=Constant(value='return annotation'))])" -#: ../../library/ast.rst:1991 +#: ../../library/ast.rst:1969 msgid "A ``return`` statement." msgstr "一個 ``return`` 陳述式。" -#: ../../library/ast.rst:1993 +#: ../../library/ast.rst:1971 msgid "" ">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" "Module(\n" " body=[\n" " Return(\n" -" value=Constant(value=4))],\n" -" type_ignores=[])" +" value=Constant(value=4))])" msgstr "" ">>> print(ast.dump(ast.parse('return 4'), indent=4))\n" "Module(\n" " body=[\n" " Return(\n" -" value=Constant(value=4))],\n" -" type_ignores=[])" +" value=Constant(value=4))])" -#: ../../library/ast.rst:2006 +#: ../../library/ast.rst:1983 msgid "" "A ``yield`` or ``yield from`` expression. Because these are expressions, " "they must be wrapped in an :class:`Expr` node if the value sent back is not " @@ -3462,46 +3514,42 @@ msgstr "" "一個 ``yield`` 或 ``yield from`` 運算式。因為這些是運算式,所以如果不使用發送" "回來的值,則必須將它們包裝在 :class:`Expr` 節點中。" -#: ../../library/ast.rst:2009 +#: ../../library/ast.rst:1986 msgid "" ">>> print(ast.dump(ast.parse('yield x'), indent=4))\n" "Module(\n" " body=[\n" " Expr(\n" " value=Yield(\n" -" value=Name(id='x', ctx=Load())))],\n" -" type_ignores=[])\n" +" value=Name(id='x', ctx=Load())))])\n" "\n" ">>> print(ast.dump(ast.parse('yield from x'), indent=4))\n" "Module(\n" " body=[\n" " Expr(\n" " value=YieldFrom(\n" -" value=Name(id='x', ctx=Load())))],\n" -" type_ignores=[])" +" value=Name(id='x', ctx=Load())))])" msgstr "" ">>> print(ast.dump(ast.parse('yield x'), indent=4))\n" "Module(\n" " body=[\n" " Expr(\n" " value=Yield(\n" -" value=Name(id='x', ctx=Load())))],\n" -" type_ignores=[])\n" +" value=Name(id='x', ctx=Load())))])\n" "\n" ">>> print(ast.dump(ast.parse('yield from x'), indent=4))\n" "Module(\n" " body=[\n" " Expr(\n" " value=YieldFrom(\n" -" value=Name(id='x', ctx=Load())))],\n" -" type_ignores=[])" +" value=Name(id='x', ctx=Load())))])" -#: ../../library/ast.rst:2031 +#: ../../library/ast.rst:2006 msgid "" "``global`` and ``nonlocal`` statements. ``names`` is a list of raw strings." msgstr "``global`` 和 ``nonlocal`` 陳述式。``names`` 是原始字串的串列。" -#: ../../library/ast.rst:2033 +#: ../../library/ast.rst:2008 msgid "" ">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n" "Module(\n" @@ -3510,8 +3558,7 @@ msgid "" " names=[\n" " 'x',\n" " 'y',\n" -" 'z'])],\n" -" type_ignores=[])\n" +" 'z'])])\n" "\n" ">>> print(ast.dump(ast.parse('nonlocal x,y,z'), indent=4))\n" "Module(\n" @@ -3520,8 +3567,7 @@ msgid "" " names=[\n" " 'x',\n" " 'y',\n" -" 'z'])],\n" -" type_ignores=[])" +" 'z'])])" msgstr "" ">>> print(ast.dump(ast.parse('global x,y,z'), indent=4))\n" "Module(\n" @@ -3530,8 +3576,7 @@ msgstr "" " names=[\n" " 'x',\n" " 'y',\n" -" 'z'])],\n" -" type_ignores=[])\n" +" 'z'])])\n" "\n" ">>> print(ast.dump(ast.parse('nonlocal x,y,z'), indent=4))\n" "Module(\n" @@ -3540,22 +3585,21 @@ msgstr "" " names=[\n" " 'x',\n" " 'y',\n" -" 'z'])],\n" -" type_ignores=[])" +" 'z'])])" -#: ../../library/ast.rst:2058 +#: ../../library/ast.rst:2031 msgid "A class definition." msgstr "一個類別定義。" -#: ../../library/ast.rst:2060 +#: ../../library/ast.rst:2033 msgid "``name`` is a raw string for the class name" msgstr "``name`` 是類別名的原始字串" -#: ../../library/ast.rst:2061 +#: ../../library/ast.rst:2034 msgid "``bases`` is a list of nodes for explicitly specified base classes." msgstr "``bases`` 是被顯式指定的基底類別節點串列。" -#: ../../library/ast.rst:2062 +#: ../../library/ast.rst:2035 msgid "" "``keywords`` is a list of :class:`.keyword` nodes, principally for " "'metaclass'. Other keywords will be passed to the metaclass, as per :pep:" @@ -3564,17 +3608,17 @@ msgstr "" "``keywords`` 是一個 :class:`.keyword` 節點的串列,主要用於 'metaclass'(元類" "別)。如 :pep:`3115` 所述,其他關鍵字將被傳遞到 metaclass。" -#: ../../library/ast.rst:2064 +#: ../../library/ast.rst:2037 msgid "" "``body`` is a list of nodes representing the code within the class " "definition." msgstr "``body`` 是表示類別定義中程式碼的節點串列。" -#: ../../library/ast.rst:2066 +#: ../../library/ast.rst:2039 msgid "``decorator_list`` is a list of nodes, as in :class:`FunctionDef`." msgstr "``decorator_list`` 是一個節點串列,如 :class:`FunctionDef` 中所示。" -#: ../../library/ast.rst:2069 +#: ../../library/ast.rst:2042 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3597,9 +3641,7 @@ msgid "" " Pass()],\n" " decorator_list=[\n" " Name(id='decorator1', ctx=Load()),\n" -" Name(id='decorator2', ctx=Load())],\n" -" type_params=[])],\n" -" type_ignores=[])" +" Name(id='decorator2', ctx=Load())])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... @decorator1\n" @@ -3622,21 +3664,19 @@ msgstr "" " Pass()],\n" " decorator_list=[\n" " Name(id='decorator1', ctx=Load()),\n" -" Name(id='decorator2', ctx=Load())],\n" -" type_params=[])],\n" -" type_ignores=[])" +" Name(id='decorator2', ctx=Load())])])" -#: ../../library/ast.rst:2100 +#: ../../library/ast.rst:2071 msgid "Async and await" msgstr "async 和 await" -#: ../../library/ast.rst:2104 +#: ../../library/ast.rst:2075 msgid "" "An ``async def`` function definition. Has the same fields as :class:" "`FunctionDef`." msgstr "一個 ``async def`` 函式定義。與 :class:`FunctionDef` 具有相同的欄位。" -#: ../../library/ast.rst:2113 +#: ../../library/ast.rst:2084 msgid "" "An ``await`` expression. ``value`` is what it waits for. Only valid in the " "body of an :class:`AsyncFunctionDef`." @@ -3644,7 +3684,7 @@ msgstr "" "一個 ``await`` 運算式。``value`` 是它等待的東西。僅在 :class:" "`AsyncFunctionDef` 主體 (body) 中有效。" -#: ../../library/ast.rst:2116 +#: ../../library/ast.rst:2087 msgid "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -3654,22 +3694,12 @@ msgid "" " body=[\n" " AsyncFunctionDef(\n" " name='f',\n" -" args=arguments(\n" -" posonlyargs=[],\n" -" args=[],\n" -" kwonlyargs=[],\n" -" kw_defaults=[],\n" -" defaults=[]),\n" +" args=arguments(),\n" " body=[\n" " Expr(\n" " value=Await(\n" " value=Call(\n" -" func=Name(id='other_func', ctx=Load()),\n" -" args=[],\n" -" keywords=[])))],\n" -" decorator_list=[],\n" -" type_params=[])],\n" -" type_ignores=[])" +" func=Name(id='other_func', ctx=Load()))))])])" msgstr "" ">>> print(ast.dump(ast.parse(\"\"\"\\\n" "... async def f():\n" @@ -3679,24 +3709,14 @@ msgstr "" " body=[\n" " AsyncFunctionDef(\n" " name='f',\n" -" args=arguments(\n" -" posonlyargs=[],\n" -" args=[],\n" -" kwonlyargs=[],\n" -" kw_defaults=[],\n" -" defaults=[]),\n" +" args=arguments(),\n" " body=[\n" " Expr(\n" " value=Await(\n" " value=Call(\n" -" func=Name(id='other_func', ctx=Load()),\n" -" args=[],\n" -" keywords=[])))],\n" -" decorator_list=[],\n" -" type_params=[])],\n" -" type_ignores=[])" +" func=Name(id='other_func', ctx=Load()))))])])" -#: ../../library/ast.rst:2147 +#: ../../library/ast.rst:2108 msgid "" "``async for`` loops and ``async with`` context managers. They have the same " "fields as :class:`For` and :class:`With`, respectively. Only valid in the " @@ -3705,7 +3725,7 @@ msgstr "" "``async for`` 迴圈和 ``async with`` 情境管理器。它們分別具有與 :class:`For` " "和 :class:`With` 相同的欄位。僅在 :class:`AsyncFunctionDef` 主體中有效。" -#: ../../library/ast.rst:2152 +#: ../../library/ast.rst:2113 msgid "" "When a string is parsed by :func:`ast.parse`, operator nodes (subclasses of :" "class:`ast.operator`, :class:`ast.unaryop`, :class:`ast.cmpop`, :class:`ast." @@ -3718,11 +3738,11 @@ msgstr "" "boolop` 和 :class:`ast.expr_context`\\ )將是單例。對其中之一的更改將反映在所" "有其他出現的相同值中(例如 :class:`ast.Add`\\ )。" -#: ../../library/ast.rst:2160 +#: ../../library/ast.rst:2121 msgid ":mod:`ast` Helpers" msgstr ":mod:`ast` 輔助程式" -#: ../../library/ast.rst:2162 +#: ../../library/ast.rst:2123 msgid "" "Apart from the node classes, the :mod:`ast` module defines these utility " "functions and classes for traversing abstract syntax trees:" @@ -3730,15 +3750,18 @@ msgstr "" "除了節點類別之外,:mod:`ast` 模組還定義了這些用於遍歷 (traverse) 抽象語法樹的" "實用函式和類別:" -#: ../../library/ast.rst:2167 +#: ../../library/ast.rst:2128 msgid "" "Parse the source into an AST node. Equivalent to ``compile(source, " -"filename, mode, ast.PyCF_ONLY_AST)``." +"filename, mode, flags=FLAGS_VALUE, optimize=optimize)``, where " +"``FLAGS_VALUE`` is ``ast.PyCF_ONLY_AST`` if ``optimize <= 0`` and ``ast." +"PyCF_OPTIMIZED_AST`` otherwise." msgstr "" -"將原始碼剖析為 AST 節點。相當於 ``compile(source, filename, mode, ast." -"PyCF_ONLY_AST)``。" +"將原始碼剖析為 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:2170 +#: ../../library/ast.rst:2133 msgid "" "If ``type_comments=True`` is given, the parser is modified to check and " "return type comments as specified by :pep:`484` and :pep:`526`. This is " @@ -3757,7 +3780,7 @@ msgstr "" "``None``。此外,``# type: ignore`` 註釋的位置將作為 :class:`Module` 的 " "``type_ignores`` 屬性回傳(否則它始終是一個空串列)。" -#: ../../library/ast.rst:2180 +#: ../../library/ast.rst:2143 msgid "" "In addition, if ``mode`` is ``'func_type'``, the input syntax is modified to " "correspond to :pep:`484` \"signature type comments\", e.g. ``(str, int) -> " @@ -3767,13 +3790,13 @@ msgstr "" "名型別註解 (signature type comments)」而被修改,例如 ``(str, int) -> " "List[str]``。" -#: ../../library/ast.rst:2184 +#: ../../library/ast.rst:2147 msgid "" "Setting ``feature_version`` to a tuple ``(major, minor)`` will result in a " "\"best-effort\" attempt to parse using that Python version's grammar. For " "example, setting ``feature_version=(3, 9)`` will attempt to disallow parsing " "of :keyword:`match` statements. Currently ``major`` must equal to ``3``. The " -"lowest supported version is ``(3, 4)`` (and this may increase in future " +"lowest supported version is ``(3, 7)`` (and this may increase in future " "Python versions); the highest is ``sys.version_info[0:2]``. \"Best-effort\" " "attempt means there is no guarantee that the parse (or success of the parse) " "is the same as when run on the Python version corresponding to " @@ -3781,18 +3804,18 @@ msgid "" msgstr "" "將 ``feature_version`` 設定為元組 ``(major, minor)`` 將「盡可能」嘗試使用該 " "Python 版本的文法進行剖析。當前 ``major`` 必須等於 ``3``。例如,設定 " -"``feature_version=(3, 4)`` 將嘗試禁止剖析 :keyword:`match` 陳述式。目前 " -"``major`` 必須為 ``3``、支援的最低版本為 ``(3, 4)``\\ (這在未來的 Python 版" +"``feature_version=(3, 9)`` 將嘗試禁止剖析 :keyword:`match` 陳述式。目前 " +"``major`` 必須為 ``3``、支援的最低版本為 ``(3, 7)``\\ (這在未來的 Python 版" "本中可能會增加);最高的是 ``sys.version_info[0:2]``。「盡可能」嘗試意味著不" "能保證剖析(或剖析的成功)與在與 ``feature_version`` 對應的 Python 版本上運行" "時相同。" -#: ../../library/ast.rst:2194 +#: ../../library/ast.rst:2157 msgid "" "If source contains a null character (``\\0``), :exc:`ValueError` is raised." msgstr "如果來源包含 null 字元 (``\\0``),則會引發 :exc:`ValueError`。" -#: ../../library/ast.rst:2197 +#: ../../library/ast.rst:2160 msgid "" "Note that successfully parsing source code into an AST object doesn't " "guarantee that the source code provided is valid Python code that can be " @@ -3806,14 +3829,14 @@ msgstr "" "原始的 ``return 42`` 為 return 陳述式生成一個有效的 AST 節點,但它不能單獨編" "譯(它需要位於函式節點內)。" -#: ../../library/ast.rst:2204 +#: ../../library/ast.rst:2167 msgid "" "In particular, :func:`ast.parse` won't do any scoping checks, which the " "compilation step does." msgstr "" "特別是 :func:`ast.parse` 不會執行任何範圍檢查,而編譯步驟才會執行此操作。" -#: ../../library/ast.rst:2208 +#: ../../library/ast.rst:2171 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string due to stack depth limitations in Python's AST compiler." @@ -3821,11 +3844,19 @@ msgstr "" "由於 Python AST 編譯器中的堆疊 (stack) 深度限制,太大或太複雜的字串可能會導" "致 Python 直譯器崩潰。" -#: ../../library/ast.rst:2212 +#: ../../library/ast.rst:2175 msgid "Added ``type_comments``, ``mode='func_type'`` and ``feature_version``." msgstr "新增 ``type_comments``、``mode='func_type'`` 與 ``feature_version``。" -#: ../../library/ast.rst:2218 +#: ../../library/ast.rst:2178 +msgid "" +"The minimum supported version for ``feature_version`` is now ``(3, 7)``. The " +"``optimize`` argument was added." +msgstr "" +"``feature_version`` 的最低支援版本現在是 ``(3, 7)``。新增了 ``optimize`` 引" +"數。" + +#: ../../library/ast.rst:2185 msgid "" "Unparse an :class:`ast.AST` object and generate a string with code that " "would produce an equivalent :class:`ast.AST` object if parsed back with :" @@ -3834,7 +3865,7 @@ msgstr "" "反剖析 :class:`ast.AST` 物件並生成一個帶有程式碼的字串,如果使用 :func:`ast." "parse` 剖析回來,該程式碼將生成等效的 :class:`ast.AST` 物件。" -#: ../../library/ast.rst:2223 +#: ../../library/ast.rst:2190 msgid "" "The produced code string will not necessarily be equal to the original code " "that generated the :class:`ast.AST` object (without any compiler " @@ -3843,13 +3874,13 @@ msgstr "" "生成的程式碼字串不一定等於生成 :class:`ast.AST` 物件的原始程式碼(沒有任何編" "譯器最佳化,例如常數元組/凍結集合)。" -#: ../../library/ast.rst:2228 +#: ../../library/ast.rst:2195 msgid "" "Trying to unparse a highly complex expression would result with :exc:" "`RecursionError`." msgstr "嘗試剖析高度複雜的運算式會導致 :exc:`RecursionError`。" -#: ../../library/ast.rst:2236 +#: ../../library/ast.rst:2203 msgid "" "Evaluate an expression node or a string containing only a Python literal or " "container display. The string or node provided may only consist of the " @@ -3860,7 +3891,7 @@ msgstr "" "能包含以下 Python 文本結構:字串、位元組、數字、元組、串列、字典、集合、布林" "值、``None`` 和 ``Ellipsis``。" -#: ../../library/ast.rst:2241 +#: ../../library/ast.rst:2208 msgid "" "This can be used for evaluating strings containing Python values without the " "need to parse the values oneself. It is not capable of evaluating " @@ -3869,7 +3900,7 @@ msgstr "" "這可用於為包含 Python 值的字串求值,而無需自己剖析這些值。它無法計算任意複雜" "的運算式,例如涉及運算子或索引。" -#: ../../library/ast.rst:2246 +#: ../../library/ast.rst:2213 msgid "" "This function had been documented as \"safe\" in the past without defining " "what that meant. That was misleading. This is specifically designed not to " @@ -3886,13 +3917,13 @@ msgstr "" "盡或 C 堆疊耗盡,從而導致行程崩潰。某些輸入也可能會出現 CPU 消耗過多而導致拒" "絕服務的情況。因此不建議在不受信任的資料上呼叫它。" -#: ../../library/ast.rst:2256 +#: ../../library/ast.rst:2223 msgid "" "It is possible to crash the Python interpreter due to stack depth " "limitations in Python's AST compiler." msgstr "由於 Python AST 編譯器的堆疊深度限制,Python 直譯器可能會崩潰。" -#: ../../library/ast.rst:2259 +#: ../../library/ast.rst:2226 msgid "" "It can raise :exc:`ValueError`, :exc:`TypeError`, :exc:`SyntaxError`, :exc:" "`MemoryError` and :exc:`RecursionError` depending on the malformed input." @@ -3900,19 +3931,19 @@ msgstr "" "它可能會引發 :exc:`ValueError`、:exc:`TypeError`、:exc:`SyntaxError`、:exc:" "`MemoryError` 和 :exc:`RecursionError`,具體取決於格式錯誤的輸入。" -#: ../../library/ast.rst:2263 +#: ../../library/ast.rst:2230 msgid "Now allows bytes and set literals." msgstr "現在允許位元組和集合文本 (set literal)。" -#: ../../library/ast.rst:2266 +#: ../../library/ast.rst:2233 msgid "Now supports creating empty sets with ``'set()'``." msgstr "現在支援使用 ``'set()'`` 建立空集合。" -#: ../../library/ast.rst:2269 +#: ../../library/ast.rst:2236 msgid "For string inputs, leading spaces and tabs are now stripped." msgstr "對於字串輸入,前導空格和定位字元 (tab) 現在已被去除。" -#: ../../library/ast.rst:2275 +#: ../../library/ast.rst:2242 msgid "" "Return the docstring of the given *node* (which must be a :class:" "`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`, or :class:" @@ -3924,11 +3955,11 @@ msgstr "" "件字串則為 ``None``。如果 *clean* 為 true,則使用 :func:`inspect.cleandoc` 清" "理文件字串的縮排。" -#: ../../library/ast.rst:2281 +#: ../../library/ast.rst:2248 msgid ":class:`AsyncFunctionDef` is now supported." msgstr "目前已支援 :class:`AsyncFunctionDef`。" -#: ../../library/ast.rst:2287 +#: ../../library/ast.rst:2254 msgid "" "Get source code segment of the *source* that generated *node*. If some " "location information (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.end_lineno`, :" @@ -3939,7 +3970,7 @@ msgstr "" "lineno`、:attr:`~ast.AST.end_lineno`、:attr:`~ast.AST.col_offset` 或 :attr:" "`~ast.AST.end_col_offset`\\ )遺漏,則回傳 ``None``。" -#: ../../library/ast.rst:2291 +#: ../../library/ast.rst:2258 msgid "" "If *padded* is ``True``, the first line of a multi-line statement will be " "padded with spaces to match its original position." @@ -3947,7 +3978,7 @@ msgstr "" "如果 *padded* 為 ``True``,則多列陳述式的第一列將用空格填充 (padded) 以匹配其" "原始位置。" -#: ../../library/ast.rst:2299 +#: ../../library/ast.rst:2266 msgid "" "When you compile a node tree with :func:`compile`, the compiler expects :" "attr:`~ast.AST.lineno` and :attr:`~ast.AST.col_offset` attributes for every " @@ -3961,7 +3992,7 @@ msgstr "" "要存在。填入生成的節點相當繁瑣,因此該輔助工具透過將這些屬性設定為父節點的" "值,在尚未設定的地方遞迴地新增這些屬性。它從 *node* 開始遞迴地作用。" -#: ../../library/ast.rst:2308 +#: ../../library/ast.rst:2275 msgid "" "Increment the line number and end line number of each node in the tree " "starting at *node* by *n*. This is useful to \"move code\" to a different " @@ -3970,7 +4001,7 @@ msgstr "" "將樹中從 *node* 開始的每個節點的列號和結束列號增加 *n*。這對於「移動程式碼」" "到檔案中的不同位置很有用。" -#: ../../library/ast.rst:2315 +#: ../../library/ast.rst:2282 msgid "" "Copy source location (:attr:`~ast.AST.lineno`, :attr:`~ast.AST.col_offset`, :" "attr:`~ast.AST.end_lineno`, and :attr:`~ast.AST.end_col_offset`) from " @@ -3980,7 +4011,7 @@ msgstr "" "attr:`~ast.AST.end_lineno` 和 :attr:`~ast.AST.end_col_offset` )從 " "*old_node* 複製到 *new_node*,並回傳 *new_node* 。" -#: ../../library/ast.rst:2322 +#: ../../library/ast.rst:2289 msgid "" "Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` " "that is present on *node*." @@ -3988,7 +4019,7 @@ msgstr "" "為 *node* 上存在的 ``node._fields`` 中的每個欄位生成一個 ``(fieldname, " "value)`` 元組。" -#: ../../library/ast.rst:2328 +#: ../../library/ast.rst:2295 msgid "" "Yield all direct child nodes of *node*, that is, all fields that are nodes " "and all items of fields that are lists of nodes." @@ -3996,7 +4027,7 @@ msgstr "" "生成 *node* 的所有直接子節點,即作為節點的所有欄位以及作為節點串列欄位的所有" "項目。" -#: ../../library/ast.rst:2334 +#: ../../library/ast.rst:2301 msgid "" "Recursively yield all descendant nodes in the tree starting at *node* " "(including *node* itself), in no specified order. This is useful if you " @@ -4005,7 +4036,7 @@ msgstr "" "遞迴地生成樹中從 *node* 開始的所有後代節點(包括 *node* 本身),不按指定順" "序。如果你只想就地修改節點而不關心情境,這非常有用。" -#: ../../library/ast.rst:2341 +#: ../../library/ast.rst:2308 msgid "" "A node visitor base class that walks the abstract syntax tree and calls a " "visitor function for every node found. This function may return a value " @@ -4014,13 +4045,13 @@ msgstr "" "節點訪問者基底類別,它遍歷抽象語法樹並為找到的每個節點呼叫訪問者函式。該函式" "可能會回傳一個由 :meth:`visit` 方法轉發的值。" -#: ../../library/ast.rst:2345 +#: ../../library/ast.rst:2312 msgid "" "This class is meant to be subclassed, with the subclass adding visitor " "methods." msgstr "這個類別應該被子類別化,子類別新增訪問者方法。" -#: ../../library/ast.rst:2350 +#: ../../library/ast.rst:2317 msgid "" "Visit a node. The default implementation calls the method called :samp:" "`self.visit_{classname}` where *classname* is the name of the node class, " @@ -4030,11 +4061,11 @@ msgstr "" "*classname* 是節點類別的名稱,或者在該方法不存在時呼叫 :meth:" "`generic_visit`。" -#: ../../library/ast.rst:2356 +#: ../../library/ast.rst:2323 msgid "This visitor calls :meth:`visit` on all children of the node." msgstr "該訪問者對該節點的所有子節點呼叫 :meth:`visit`。" -#: ../../library/ast.rst:2358 +#: ../../library/ast.rst:2325 msgid "" "Note that child nodes of nodes that have a custom visitor method won't be " "visited unless the visitor calls :meth:`generic_visit` or visits them itself." @@ -4042,11 +4073,11 @@ msgstr "" "請注意,除非訪問者呼叫 :meth:`generic_visit` 或訪問它們本身,否則不會訪問具有" "自定義訪問者方法的節點之子節點。" -#: ../../library/ast.rst:2364 +#: ../../library/ast.rst:2331 msgid "Handles all constant nodes." msgstr "處理所有常數節點。" -#: ../../library/ast.rst:2366 +#: ../../library/ast.rst:2333 msgid "" "Don't use the :class:`NodeVisitor` if you want to apply changes to nodes " "during traversal. For this a special visitor exists (:class:" @@ -4056,7 +4087,7 @@ msgstr "" "`NodeVisitor`。為此,有個允許修改的特殊遍歷訪問者工具 :class:" "`NodeTransformer`。" -#: ../../library/ast.rst:2372 +#: ../../library/ast.rst:2339 msgid "" "Methods :meth:`!visit_Num`, :meth:`!visit_Str`, :meth:`!visit_Bytes`, :meth:" "`!visit_NameConstant` and :meth:`!visit_Ellipsis` are deprecated now and " @@ -4067,13 +4098,13 @@ msgstr "" "visit_NameConstant` 和 :meth:`!visit_Ellipsis` 方法現已棄用,並且不會在未來的" "Python 版本中被呼叫。新增 :meth:`visit_Constant` 方法來處理所有常數節點。" -#: ../../library/ast.rst:2380 +#: ../../library/ast.rst:2347 msgid "" "A :class:`NodeVisitor` subclass that walks the abstract syntax tree and " "allows modification of nodes." msgstr "一個 :class:`NodeVisitor` 子類別,它會遍歷抽象語法樹並允許修改節點。" -#: ../../library/ast.rst:2383 +#: ../../library/ast.rst:2350 msgid "" "The :class:`NodeTransformer` will walk the AST and use the return value of " "the visitor methods to replace or remove the old node. If the return value " @@ -4085,7 +4116,7 @@ msgstr "" "點。如果訪問者方法的回傳值為 ``None``,則該節點將從其位置中刪除,否則將被替換" "為回傳值。回傳值可能是原始節點,在這種情況下不會發生替換。" -#: ../../library/ast.rst:2389 +#: ../../library/ast.rst:2356 msgid "" "Here is an example transformer that rewrites all occurrences of name lookups " "(``foo``) to ``data['foo']``::" @@ -4093,7 +4124,7 @@ msgstr "" "下面是一個示範用的 transformer,它將查找所有出現名稱 (``foo``) 並改寫為 " "``data['foo']``: ::" -#: ../../library/ast.rst:2392 +#: ../../library/ast.rst:2359 msgid "" "class RewriteName(NodeTransformer):\n" "\n" @@ -4113,7 +4144,7 @@ msgstr "" " ctx=node.ctx\n" " )" -#: ../../library/ast.rst:2401 +#: ../../library/ast.rst:2368 msgid "" "Keep in mind that if the node you're operating on has child nodes you must " "either transform the child nodes yourself or call the :meth:`~ast." @@ -4122,7 +4153,7 @@ msgstr "" "請記住,如果你正在操作的節點有子節點,你必須自己轉換子節點或先呼叫該節點的 :" "meth:`~ast.NodeVisitor.generic_visit` 方法。" -#: ../../library/ast.rst:2405 +#: ../../library/ast.rst:2372 msgid "" "For nodes that were part of a collection of statements (that applies to all " "statement nodes), the visitor may also return a list of nodes rather than " @@ -4131,7 +4162,7 @@ msgstr "" "對於屬於陳述式總集 (collection) 一部分的節點(適用於所有陳述式節點),訪問者" "還可以回傳節點串列,而不僅僅是單個節點。" -#: ../../library/ast.rst:2409 +#: ../../library/ast.rst:2376 msgid "" "If :class:`NodeTransformer` introduces new nodes (that weren't part of " "original tree) without giving them location information (such as :attr:`~ast." @@ -4142,7 +4173,7 @@ msgstr "" "它們提供位置資訊(例如 :attr:`~ast.AST.lineno`\\ ),則應使用新的子樹呼叫 :" "func:`fix_missing_locations` 以重新計算位置資訊: ::" -#: ../../library/ast.rst:2414 +#: ../../library/ast.rst:2381 msgid "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" @@ -4150,15 +4181,15 @@ msgstr "" "tree = ast.parse('foo', mode='eval')\n" "new_tree = fix_missing_locations(RewriteName().visit(tree))" -#: ../../library/ast.rst:2417 +#: ../../library/ast.rst:2384 msgid "Usually you use the transformer like this::" msgstr "你通常會像這樣使用 transformer: ::" -#: ../../library/ast.rst:2419 +#: ../../library/ast.rst:2386 msgid "node = YourTransformer().visit(node)" msgstr "node = YourTransformer().visit(node)" -#: ../../library/ast.rst:2424 +#: ../../library/ast.rst:2391 msgid "" "Return a formatted dump of the tree in *node*. This is mainly useful for " "debugging purposes. If *annotate_fields* is true (by default), the returned " @@ -4174,7 +4205,7 @@ msgstr "" "潔。預設情況下,不會傾印列號和行偏移量等屬性。如果需要,可以設定 " "*include_attributes* 為 true。" -#: ../../library/ast.rst:2432 +#: ../../library/ast.rst:2399 msgid "" "If *indent* is a non-negative integer or string, then the tree will be " "pretty-printed with that indent level. An indent level of 0, negative, or " @@ -4188,10 +4219,74 @@ msgstr "" "(預設值)代表選擇單列表示。使用正整數縮排可以在每個級別縮排相同數量的空格。" "如果 *indent* 是一個字串(例如 ``\"\\t\"``\\ ),則該字串用於縮排每個級別。" -#: ../../library/ast.rst:2439 +#: ../../library/ast.rst:2406 +msgid "" +"If *show_empty* is ``False`` (the default), empty lists and fields that are " +"``None`` will be omitted from the output." +msgstr "" +"如果 *show_empty* 為 ``False`` (預設值),則輸出中將省略 ``False`` 的空串列" +"和欄位。" + +#: ../../library/ast.rst:2409 msgid "Added the *indent* option." msgstr "新增 *indent* 選項。" +#: ../../library/ast.rst:2412 +msgid "Added the *show_empty* option." +msgstr "新增 *show_empty* 選項。" + +#: ../../library/ast.rst:2415 +msgid "" +">>> print(ast.dump(ast.parse(\"\"\"\\\n" +"... async def f():\n" +"... await other_func()\n" +"... \"\"\"), indent=4, show_empty=True))\n" +"Module(\n" +" body=[\n" +" AsyncFunctionDef(\n" +" name='f',\n" +" args=arguments(\n" +" posonlyargs=[],\n" +" args=[],\n" +" kwonlyargs=[],\n" +" kw_defaults=[],\n" +" defaults=[]),\n" +" body=[\n" +" Expr(\n" +" value=Await(\n" +" value=Call(\n" +" func=Name(id='other_func', ctx=Load()),\n" +" args=[],\n" +" keywords=[])))],\n" +" decorator_list=[],\n" +" type_params=[])],\n" +" type_ignores=[])" +msgstr "" +">>> print(ast.dump(ast.parse(\"\"\"\\\n" +"... async def f():\n" +"... await other_func()\n" +"... \"\"\"), indent=4, show_empty=True))\n" +"Module(\n" +" body=[\n" +" AsyncFunctionDef(\n" +" name='f',\n" +" args=arguments(\n" +" posonlyargs=[],\n" +" args=[],\n" +" kwonlyargs=[],\n" +" kw_defaults=[],\n" +" defaults=[]),\n" +" body=[\n" +" Expr(\n" +" value=Await(\n" +" value=Call(\n" +" func=Name(id='other_func', ctx=Load()),\n" +" args=[],\n" +" keywords=[])))],\n" +" decorator_list=[],\n" +" type_params=[])],\n" +" type_ignores=[])" + #: ../../library/ast.rst:2446 msgid "Compiler Flags" msgstr "編譯器旗標" @@ -4218,53 +4313,61 @@ msgstr "生成並回傳抽象語法樹,而不是回傳已編譯的程式碼物 #: ../../library/ast.rst:2465 msgid "" +"The returned AST is optimized according to the *optimize* argument in :func:" +"`compile` or :func:`ast.parse`." +msgstr "" +"回傳的 AST 會根據 :func:`compile` 或 :func:`ast.parse` 中的 *optimize* 引數進" +"行最佳化。" + +#: ../../library/ast.rst:2472 +msgid "" "Enables support for :pep:`484` and :pep:`526` style type comments (``# type: " "``, ``# type: ignore ``)." msgstr "" "啟用對 :pep:`484` 和 :pep:`526` 樣式型別註釋的支援 (``# type: ``, ``# " "type: ignore ``)。" -#: ../../library/ast.rst:2474 +#: ../../library/ast.rst:2481 msgid "Command-Line Usage" msgstr "命令列用法" -#: ../../library/ast.rst:2478 +#: ../../library/ast.rst:2485 msgid "" "The :mod:`ast` module can be executed as a script from the command line. It " "is as simple as:" msgstr ":mod:`ast` 模組可以作為腳本從命令列執行,可以像這樣簡單地做到:" -#: ../../library/ast.rst:2481 +#: ../../library/ast.rst:2488 msgid "python -m ast [-m ] [-a] [infile]" msgstr "python -m ast [-m ] [-a] [infile]" -#: ../../library/ast.rst:2485 +#: ../../library/ast.rst:2492 msgid "The following options are accepted:" msgstr "以下選項可被接受:" -#: ../../library/ast.rst:2491 +#: ../../library/ast.rst:2498 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/ast.rst:2496 +#: ../../library/ast.rst:2503 msgid "" "Specify what kind of code must be compiled, like the *mode* argument in :" "func:`parse`." msgstr "指定必須編譯哪種類型的程式碼,像是 :func:`parse` 中的 *mode* 引數。" -#: ../../library/ast.rst:2501 +#: ../../library/ast.rst:2508 msgid "Don't parse type comments." msgstr "不要剖析型別註解。" -#: ../../library/ast.rst:2505 +#: ../../library/ast.rst:2512 msgid "Include attributes such as line numbers and column offsets." msgstr "包括列號和行偏移量等屬性。" -#: ../../library/ast.rst:2510 +#: ../../library/ast.rst:2517 msgid "Indentation of nodes in AST (number of spaces)." msgstr "AST 中節點的縮進(空格數)。" -#: ../../library/ast.rst:2512 +#: ../../library/ast.rst:2519 msgid "" "If :file:`infile` is specified its contents are parsed to AST and dumped to " "stdout. Otherwise, the content is read from stdin." @@ -4272,7 +4375,7 @@ msgstr "" "如果指定了 :file:`infile`,則其內容將被剖析為 AST 並傾印 (dump) 到 stdout。否" "則會從 stdin 讀取內容。" -#: ../../library/ast.rst:2518 +#: ../../library/ast.rst:2525 msgid "" "`Green Tree Snakes `_, an external " "documentation resource, has good details on working with Python ASTs." @@ -4280,7 +4383,7 @@ msgstr "" "`Green Tree Snakes `_ 是一個外部文件" "資源,提供了有關使用 Python AST 的詳細資訊。" -#: ../../library/ast.rst:2521 +#: ../../library/ast.rst:2528 msgid "" "`ASTTokens `_ " "annotates Python ASTs with the positions of tokens and text in the source " @@ -4291,7 +4394,7 @@ msgstr "" "用生成它們的原始碼中的標記和文本的位置來註釋 Python AST。這對於進行原始碼轉換" "的工具很有幫助。" -#: ../../library/ast.rst:2526 +#: ../../library/ast.rst:2533 msgid "" "`leoAst.py `_ unifies the token-based and parse-tree-based views of python programs " @@ -4301,7 +4404,7 @@ msgstr "" "py>`_ 透過在 token 和 ast 節點之間插入雙向鏈結,統一了 python 程式的基於 " "token 和基於剖析樹的視圖。" -#: ../../library/ast.rst:2531 +#: ../../library/ast.rst:2538 msgid "" "`LibCST `_ parses code as a Concrete Syntax " "Tree that looks like an ast tree and keeps all formatting details. It's " @@ -4311,7 +4414,7 @@ msgstr "" "(Concrete Syntax Tree),看起來像 ast 樹並保留所有格式詳細資訊。它對於建置自動" "重構 (codemod) 應用程式和 linter 非常有用。" -#: ../../library/ast.rst:2536 +#: ../../library/ast.rst:2543 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 a69cf76a68..1530baa6c8 100644 --- a/library/asyncio-api-index.po +++ b/library/asyncio-api-index.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-10-31 08:13+0000\n" "PO-Revision-Date: 2022-01-27 21:25+0800\n" diff --git a/library/asyncio-dev.po b/library/asyncio-dev.po index 97a689f12a..7362cbb454 100644 --- a/library/asyncio-dev.po +++ b/library/asyncio-dev.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-02-18 14:17+0800\n" diff --git a/library/asyncio-eventloop.po b/library/asyncio-eventloop.po index 80d65813b7..3e07964e9d 100644 --- a/library/asyncio-eventloop.po +++ b/library/asyncio-eventloop.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-02-20 12:36+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -296,8 +296,8 @@ msgid "" msgstr "請注意,使用 :func:`asyncio.run` 時不需要呼叫此函式。" #: ../../library/asyncio-eventloop.rst:176 -#: ../../library/asyncio-eventloop.rst:1253 -#: ../../library/asyncio-eventloop.rst:1671 +#: ../../library/asyncio-eventloop.rst:1269 +#: ../../library/asyncio-eventloop.rst:1712 msgid "Example::" msgstr "範例: ::" @@ -647,8 +647,8 @@ msgid "The socket type will be :py:const:`~socket.SOCK_STREAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_STREAM`。" #: ../../library/asyncio-eventloop.rst:412 -#: ../../library/asyncio-eventloop.rst:1164 #: ../../library/asyncio-eventloop.rst:1180 +#: ../../library/asyncio-eventloop.rst:1196 msgid "" "*protocol_factory* must be a callable returning an :ref:`asyncio protocol " "` implementation." @@ -788,7 +788,7 @@ msgstr "" #: ../../library/asyncio-eventloop.rst:482 #: ../../library/asyncio-eventloop.rst:597 -#: ../../library/asyncio-eventloop.rst:825 +#: ../../library/asyncio-eventloop.rst:841 msgid "" "The *sock* argument transfers ownership of the socket to the transport " "created. To close the socket, call the transport's :meth:`~asyncio." @@ -808,7 +808,7 @@ msgstr "" "式類似於 *host* 和 *port*。" #: ../../library/asyncio-eventloop.rst:490 -#: ../../library/asyncio-eventloop.rst:919 +#: ../../library/asyncio-eventloop.rst:935 msgid "" "*ssl_handshake_timeout* is (for a TLS connection) the time in seconds to " "wait for the TLS handshake to complete before aborting the connection. " @@ -819,9 +819,9 @@ msgstr "" "秒。" #: ../../library/asyncio-eventloop.rst:494 -#: ../../library/asyncio-eventloop.rst:742 -#: ../../library/asyncio-eventloop.rst:836 -#: ../../library/asyncio-eventloop.rst:923 +#: ../../library/asyncio-eventloop.rst:750 +#: ../../library/asyncio-eventloop.rst:852 +#: ../../library/asyncio-eventloop.rst:939 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " @@ -845,7 +845,7 @@ msgstr "" "包含所有例外的 ``ExceptionGroup`` (即使只有一個例外)。" #: ../../library/asyncio-eventloop.rst:508 -#: ../../library/asyncio-eventloop.rst:754 +#: ../../library/asyncio-eventloop.rst:762 msgid "Added support for SSL/TLS in :class:`ProactorEventLoop`." msgstr "新增 :class:`ProactorEventLoop` 中的 SSL/TLS 支援。" @@ -858,7 +858,7 @@ msgstr "" "socket 選項。" #: ../../library/asyncio-eventloop.rst:517 -#: ../../library/asyncio-eventloop.rst:846 +#: ../../library/asyncio-eventloop.rst:862 msgid "Added the *ssl_handshake_timeout* parameter." msgstr "增加 *ssl_handshake_timeout* 參數。" @@ -888,10 +888,10 @@ msgstr "更多資訊請見: https://datatracker.ietf.org/doc/html/rfc6555" #: ../../library/asyncio-eventloop.rst:536 #: ../../library/asyncio-eventloop.rst:660 -#: ../../library/asyncio-eventloop.rst:768 -#: ../../library/asyncio-eventloop.rst:803 -#: ../../library/asyncio-eventloop.rst:850 -#: ../../library/asyncio-eventloop.rst:931 +#: ../../library/asyncio-eventloop.rst:776 +#: ../../library/asyncio-eventloop.rst:815 +#: ../../library/asyncio-eventloop.rst:866 +#: ../../library/asyncio-eventloop.rst:947 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "增加 *ssl_shutdown_timeout* 參數。" @@ -927,8 +927,8 @@ msgid "The socket type will be :py:const:`~socket.SOCK_DGRAM`." msgstr "Socket 類型將為 :py:const:`~socket.SOCK_DGRAM`。" #: ../../library/asyncio-eventloop.rst:561 -#: ../../library/asyncio-eventloop.rst:685 -#: ../../library/asyncio-eventloop.rst:817 +#: ../../library/asyncio-eventloop.rst:686 +#: ../../library/asyncio-eventloop.rst:833 msgid "" "*protocol_factory* must be a callable returning a :ref:`protocol ` implementation." @@ -1085,8 +1085,8 @@ msgstr "" "有關此方法的引數資訊,請參閱 :meth:`loop.create_connection` 方法的文件。" #: ../../library/asyncio-eventloop.rst:652 -#: ../../library/asyncio-eventloop.rst:794 -#: ../../library/asyncio-eventloop.rst:1233 +#: ../../library/asyncio-eventloop.rst:806 +#: ../../library/asyncio-eventloop.rst:1249 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" @@ -1102,7 +1102,7 @@ msgstr "" msgid "Creating network servers" msgstr "建立網路伺服器" -#: ../../library/asyncio-eventloop.rst:678 +#: ../../library/asyncio-eventloop.rst:679 msgid "" "Create a TCP server (socket type :const:`~socket.SOCK_STREAM`) listening on " "*port* of the *host* address." @@ -1110,33 +1110,33 @@ msgstr "" "建立一個 TCP 伺服器(socket 類型 :const:`~socket.SOCK_STREAM`\\ ),監聽 " "*host* 位址的 *port*。" -#: ../../library/asyncio-eventloop.rst:681 +#: ../../library/asyncio-eventloop.rst:682 msgid "Returns a :class:`Server` object." msgstr "回傳一個 :class:`Server` 物件。" -#: ../../library/asyncio-eventloop.rst:683 +#: ../../library/asyncio-eventloop.rst:684 msgid "Arguments:" msgstr "引數:" -#: ../../library/asyncio-eventloop.rst:688 +#: ../../library/asyncio-eventloop.rst:689 msgid "" "The *host* parameter can be set to several types which determine where the " "server would be listening:" msgstr "可以將 *host* 參數設為幾種類型,以確定伺服器將監聽的位置:" -#: ../../library/asyncio-eventloop.rst:691 +#: ../../library/asyncio-eventloop.rst:692 msgid "" "If *host* is a string, the TCP server is bound to a single network interface " "specified by *host*." msgstr "如果 *host* 是字串,則 TCP 伺服器綁定到由 *host* 指定的單個網路介面。" -#: ../../library/asyncio-eventloop.rst:694 +#: ../../library/asyncio-eventloop.rst:695 msgid "" "If *host* is a sequence of strings, the TCP server is bound to all network " "interfaces specified by the sequence." msgstr "如果 *host* 是字串序列,則 TCP 伺服器綁定到序列指定的所有網路介面。" -#: ../../library/asyncio-eventloop.rst:697 +#: ../../library/asyncio-eventloop.rst:698 msgid "" "If *host* is an empty string or ``None``, all interfaces are assumed and a " "list of multiple sockets will be returned (most likely one for IPv4 and " @@ -1145,7 +1145,7 @@ msgstr "" "若 *host* 是空字串或 ``None``,則所有介面都被假定並回傳多個 socket 的清單(可" "能一個用於 IPv4,另一個用於 IPv6)。" -#: ../../library/asyncio-eventloop.rst:701 +#: ../../library/asyncio-eventloop.rst:702 msgid "" "The *port* parameter can be set to specify which port the server should " "listen on. If ``0`` or ``None`` (the default), a random unused port will be " @@ -1156,7 +1156,7 @@ msgstr "" "設值),將隨機選擇一個未使用的埠(請注意,如果 *host* 解析為多個網路介面,將" "為每個介面隨機選擇不同的隨機埠)。" -#: ../../library/asyncio-eventloop.rst:706 +#: ../../library/asyncio-eventloop.rst:707 msgid "" "*family* can be set to either :const:`socket.AF_INET` or :const:`~socket." "AF_INET6` to force the socket to use IPv4 or IPv6. If not set, the *family* " @@ -1166,11 +1166,11 @@ msgstr "" "制使用 IPv4 或 IPv6。如果未設定,*family* 將從主機名稱決定(預設為 :const:" "`~socket.AF_UNSPEC`\\ )。" -#: ../../library/asyncio-eventloop.rst:711 +#: ../../library/asyncio-eventloop.rst:712 msgid "*flags* is a bitmask for :meth:`getaddrinfo`." msgstr "*flags* 是 :meth:`getaddrinfo` 的位元遮罩。" -#: ../../library/asyncio-eventloop.rst:713 +#: ../../library/asyncio-eventloop.rst:714 msgid "" "*sock* can optionally be specified in order to use a preexisting socket " "object. If specified, *host* and *port* must not be specified." @@ -1178,7 +1178,7 @@ msgstr "" "可以可選地指定 *sock* 以使用現有的 socket 物件。如果指定了,*host* 和 *port* " "不能指定。" -#: ../../library/asyncio-eventloop.rst:718 +#: ../../library/asyncio-eventloop.rst:719 msgid "" "The *sock* argument transfers ownership of the socket to the server created. " "To close the socket, call the server's :meth:`~asyncio.Server.close` method." @@ -1186,7 +1186,7 @@ msgstr "" "*sock* 引數將 socket 的所有權轉移給建立的伺服器。要關閉 socket,請呼叫伺服器" "的 :meth:`~asyncio.Server.close` 方法。" -#: ../../library/asyncio-eventloop.rst:722 +#: ../../library/asyncio-eventloop.rst:723 msgid "" "*backlog* is the maximum number of queued connections passed to :meth:" "`~socket.socket.listen` (defaults to 100)." @@ -1194,14 +1194,14 @@ msgstr "" "*backlog* 是傳遞給 :meth:`~socket.socket.listen` 的最大佇列連線數(預設為 " "100)。" -#: ../../library/asyncio-eventloop.rst:725 +#: ../../library/asyncio-eventloop.rst:726 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` instance to enable TLS over " "the accepted connections." msgstr "" "*ssl* 可以設定為 :class:`~ssl.SSLContext` 實例以在接受的連線上啟用 TLS。" -#: ../../library/asyncio-eventloop.rst:728 +#: ../../library/asyncio-eventloop.rst:729 msgid "" "*reuse_address* tells the kernel to reuse a local socket in ``TIME_WAIT`` " "state, without waiting for its natural timeout to expire. If not specified " @@ -1210,7 +1210,7 @@ msgstr "" "*reuse_address* 告訴內核重用 ``TIME_WAIT`` 狀態下的本地 socket,而不等待其自" "然超時過期。如果未指定,在 Unix 上將自動設置為 ``True``。" -#: ../../library/asyncio-eventloop.rst:733 +#: ../../library/asyncio-eventloop.rst:734 msgid "" "*reuse_port* tells the kernel to allow this endpoint to be bound to the same " "port as other existing endpoints are bound to, so long as they all set this " @@ -1219,7 +1219,18 @@ msgstr "" "*reuse_port* 告訴內核允許此端點繫結到與其他現有端點繫結的相同埠,只要它們在建" "立時都設置了此旗標。此選項在旗標 Windows 上不受支援。" -#: ../../library/asyncio-eventloop.rst:738 +#: ../../library/asyncio-eventloop.rst:739 +msgid "" +"*keep_alive* set to ``True`` keeps connections active by enabling the " +"periodic transmission of messages." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:744 +#, fuzzy +msgid "Added the *keep_alive* parameter." +msgstr "加入 *name* 參數。" + +#: ../../library/asyncio-eventloop.rst:746 msgid "" "*ssl_handshake_timeout* is (for a TLS server) the time in seconds to wait " "for the TLS handshake to complete before aborting the connection. ``60.0`` " @@ -1228,7 +1239,7 @@ msgstr "" "(對於 TLS 伺服器)\\ *ssl_handshake_timeout* 是在中斷連線之前等待 TLS 握手完" "成的時間(以秒為單位)。如果為 ``None``\\ (預設),則為 ``60.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:746 +#: ../../library/asyncio-eventloop.rst:754 msgid "" "*start_serving* set to ``True`` (the default) causes the created server to " "start accepting connections immediately. When set to ``False``, the user " @@ -1239,11 +1250,11 @@ msgstr "" "接。當設置為 ``False`` 時,用戶應該等待 :meth:`Server.start_serving` 或 :" "meth:`Server.serve_forever` 來使伺服器開始接受連線。" -#: ../../library/asyncio-eventloop.rst:758 +#: ../../library/asyncio-eventloop.rst:766 msgid "The *host* parameter can be a sequence of strings." msgstr "*host* 參數可以是字串序列。" -#: ../../library/asyncio-eventloop.rst:762 +#: ../../library/asyncio-eventloop.rst:770 msgid "" "Added *ssl_handshake_timeout* and *start_serving* parameters. The socket " "option :ref:`socket.TCP_NODELAY ` is set by default " @@ -1252,7 +1263,7 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。所有 TCP 連線都預設有 :" "ref:`socket.TCP_NODELAY ` socket 選項。" -#: ../../library/asyncio-eventloop.rst:772 +#: ../../library/asyncio-eventloop.rst:780 msgid "" "The :func:`start_server` function is a higher-level alternative API that " "returns a pair of :class:`StreamReader` and :class:`StreamWriter` that can " @@ -1261,7 +1272,7 @@ msgstr "" ":func:`start_server` 函式是一個更高階的替代 API,它回傳一對 :class:" "`StreamReader` 和 :class:`StreamWriter`,可以在 async/await 程式碼中使用。" -#: ../../library/asyncio-eventloop.rst:783 +#: ../../library/asyncio-eventloop.rst:791 msgid "" "Similar to :meth:`loop.create_server` but works with the :py:const:`~socket." "AF_UNIX` socket family." @@ -1269,7 +1280,7 @@ msgstr "" "類似 :meth:`loop.create_server`,但適用於 :py:const:`~socket.AF_UNIX` socket " "家族。" -#: ../../library/asyncio-eventloop.rst:786 +#: ../../library/asyncio-eventloop.rst:794 msgid "" "*path* is the name of a Unix domain socket, and is required, unless a *sock* " "argument is provided. Abstract Unix sockets, :class:`str`, :class:`bytes`, " @@ -1279,13 +1290,20 @@ msgstr "" "象 Unix sockets、:class:`str`、:class:`bytes` 和 :class:`~pathlib.Path` 路" "徑。" -#: ../../library/asyncio-eventloop.rst:791 +#: ../../library/asyncio-eventloop.rst:799 +msgid "" +"If *cleanup_socket* is true then the Unix socket will automatically be " +"removed from the filesystem when the server is closed, unless the socket has " +"been replaced after the server has been created." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:803 msgid "" "See the documentation of the :meth:`loop.create_server` method for " "information about arguments to this method." msgstr "有關此方法的引數資訊,請參閱 :meth:`loop.create_server` 方法的文件。" -#: ../../library/asyncio-eventloop.rst:798 +#: ../../library/asyncio-eventloop.rst:810 msgid "" "Added the *ssl_handshake_timeout* and *start_serving* parameters. The *path* " "parameter can now be a :class:`~pathlib.Path` object." @@ -1293,22 +1311,27 @@ msgstr "" "新增 *ssl_handshake_timeout* 與 *start_serving* 參數。*path* 參數現在可為一" "個 :class:`~pathlib.Path` 物件。" -#: ../../library/asyncio-eventloop.rst:810 +#: ../../library/asyncio-eventloop.rst:819 +#, fuzzy +msgid "Added the *cleanup_socket* parameter." +msgstr "加入 *context* 參數。" + +#: ../../library/asyncio-eventloop.rst:826 msgid "Wrap an already accepted connection into a transport/protocol pair." msgstr "將已接受的連線包裝成傳輸層/協議對。" -#: ../../library/asyncio-eventloop.rst:812 +#: ../../library/asyncio-eventloop.rst:828 msgid "" "This method can be used by servers that accept connections outside of " "asyncio but that use asyncio to handle them." msgstr "此方法可以由在 asyncio 外接受連線但使用 asyncio 處理連線的伺服器使用。" -#: ../../library/asyncio-eventloop.rst:815 -#: ../../library/asyncio-eventloop.rst:905 +#: ../../library/asyncio-eventloop.rst:831 +#: ../../library/asyncio-eventloop.rst:921 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-eventloop.rst:820 +#: ../../library/asyncio-eventloop.rst:836 msgid "" "*sock* is a preexisting socket object returned from :meth:`socket.accept " "`." @@ -1316,13 +1339,13 @@ msgstr "" "*sock* 是從 :meth:`socket.accept ` 回傳的預先存在的 " "socket 物件。" -#: ../../library/asyncio-eventloop.rst:829 +#: ../../library/asyncio-eventloop.rst:845 msgid "" "*ssl* can be set to an :class:`~ssl.SSLContext` to enable SSL over the " "accepted connections." msgstr "*ssl* 可以設置為 :class:`~ssl.SSLContext` 以在已接受的連線上啟用 SSL。" -#: ../../library/asyncio-eventloop.rst:832 +#: ../../library/asyncio-eventloop.rst:848 msgid "" "*ssl_handshake_timeout* is (for an SSL connection) the time in seconds to " "wait for the SSL handshake to complete before aborting the connection. " @@ -1331,29 +1354,29 @@ msgstr "" "(對於 SSL 連線)\\ *ssl_handshake_timeout* 是在中斷連線之前等待 SSL 握手完成" "的時間(以秒為單位)。如果為 ``None``\\ (預設),則為 ``60.0`` 秒。" -#: ../../library/asyncio-eventloop.rst:840 +#: ../../library/asyncio-eventloop.rst:856 msgid "Returns a ``(transport, protocol)`` pair." msgstr "回傳 ``(transport, protocol)`` 對。" -#: ../../library/asyncio-eventloop.rst:854 +#: ../../library/asyncio-eventloop.rst:870 msgid "Transferring files" msgstr "傳輸檔案" -#: ../../library/asyncio-eventloop.rst:859 +#: ../../library/asyncio-eventloop.rst:875 msgid "" "Send a *file* over a *transport*. Return the total number of bytes sent." msgstr "通過 *transport* 發送 *file*。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:862 +#: ../../library/asyncio-eventloop.rst:878 msgid "The method uses high-performance :meth:`os.sendfile` if available." msgstr "如果可用,該方法使用高性能 :meth:`os.sendfile`。" -#: ../../library/asyncio-eventloop.rst:864 +#: ../../library/asyncio-eventloop.rst:880 msgid "*file* must be a regular file object opened in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:866 -#: ../../library/asyncio-eventloop.rst:1111 +#: ../../library/asyncio-eventloop.rst:882 +#: ../../library/asyncio-eventloop.rst:1127 msgid "" "*offset* tells from where to start reading the file. If specified, *count* " "is the total number of bytes to transmit as opposed to sending the file " @@ -1365,7 +1388,7 @@ msgstr "" "不是發送檔案直到達到 EOF。即使此方法引發錯誤時,檔案位置也始終更新,可以使" "用 :meth:`file.tell() ` 取得實際發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:873 +#: ../../library/asyncio-eventloop.rst:889 msgid "" "*fallback* set to ``True`` makes asyncio to manually read and send the file " "when the platform does not support the sendfile system call (e.g. Windows or " @@ -1374,7 +1397,7 @@ msgstr "" "將 *fallback* 設置為 ``True`` 會使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:877 +#: ../../library/asyncio-eventloop.rst:893 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support the " "*sendfile* syscall and *fallback* is ``False``." @@ -1382,15 +1405,15 @@ msgstr "" "如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,則引發 :exc:" "`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:884 +#: ../../library/asyncio-eventloop.rst:900 msgid "TLS Upgrade" msgstr "TLS 升級" -#: ../../library/asyncio-eventloop.rst:891 +#: ../../library/asyncio-eventloop.rst:907 msgid "Upgrade an existing transport-based connection to TLS." msgstr "將基於傳輸的現有連線升級到 TLS。" -#: ../../library/asyncio-eventloop.rst:893 +#: ../../library/asyncio-eventloop.rst:909 msgid "" "Create a TLS coder/decoder instance and insert it between the *transport* " "and the *protocol*. The coder/decoder implements both *transport*-facing " @@ -1399,7 +1422,7 @@ msgstr "" "建立 TLS 編解碼器實例並在 *transport* 和 *protocol* 之間插入它。編解碼器既實" "作了對於 *transport* 的協議,也實作了對於 *protocol* 的傳輸。" -#: ../../library/asyncio-eventloop.rst:897 +#: ../../library/asyncio-eventloop.rst:913 msgid "" "Return the created two-interface instance. After *await*, the *protocol* " "must stop using the original *transport* and communicate with the returned " @@ -1410,13 +1433,13 @@ msgstr "" "*transport*,僅與回傳的物件通信,因為編碼器快取了 *protocol* 端的資料,並且" "與 *transport* 間歇性地交換額外的 TLS session 封包。" -#: ../../library/asyncio-eventloop.rst:902 +#: ../../library/asyncio-eventloop.rst:918 msgid "" "In some situations (e.g. when the passed transport is already closing) this " "may return ``None``." msgstr "在某些情況下(例如傳入的傳輸已經關閉),此函式可能回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:907 +#: ../../library/asyncio-eventloop.rst:923 msgid "" "*transport* and *protocol* instances that methods like :meth:`~loop." "create_server` and :meth:`~loop.create_connection` return." @@ -1424,11 +1447,11 @@ msgstr "" "*transport* 和 *protocol* 實例,由像 :meth:`~loop.create_server` 和 :meth:" "`~loop.create_connection` 等方法回傳。" -#: ../../library/asyncio-eventloop.rst:911 +#: ../../library/asyncio-eventloop.rst:927 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "*sslcontext*:配置好的 :class:`~ssl.SSLContext` 實例。" -#: ../../library/asyncio-eventloop.rst:913 +#: ../../library/asyncio-eventloop.rst:929 msgid "" "*server_side* pass ``True`` when a server-side connection is being upgraded " "(like the one created by :meth:`~loop.create_server`)." @@ -1436,17 +1459,17 @@ msgstr "" "當升級伺服器端連線時(像由 :meth:`~loop.create_server` 建立的那樣)傳遞 " "``True``。" -#: ../../library/asyncio-eventloop.rst:916 +#: ../../library/asyncio-eventloop.rst:932 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "*server_hostname*:設置或覆蓋將用於匹配目標伺服器憑證的主機名。" -#: ../../library/asyncio-eventloop.rst:936 +#: ../../library/asyncio-eventloop.rst:952 msgid "Watching file descriptors" msgstr "監視檔案描述器" -#: ../../library/asyncio-eventloop.rst:940 +#: ../../library/asyncio-eventloop.rst:956 msgid "" "Start monitoring the *fd* file descriptor for read availability and invoke " "*callback* with the specified arguments once *fd* is available for reading." @@ -1454,7 +1477,7 @@ msgstr "" "開始監視 *fd* 檔案描述器的讀取可用性,一但 *fd* 可讀取,使用指定引數呼叫 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:946 +#: ../../library/asyncio-eventloop.rst:962 msgid "" "Stop monitoring the *fd* file descriptor for read availability. Returns " "``True`` if *fd* was previously being monitored for reads." @@ -1462,7 +1485,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的讀取可用性。如果 *fd* 之前正在監視讀取,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:951 +#: ../../library/asyncio-eventloop.rst:967 msgid "" "Start monitoring the *fd* file descriptor for write availability and invoke " "*callback* with the specified arguments once *fd* is available for writing." @@ -1470,8 +1493,8 @@ msgstr "" "開始監視 *fd* 檔案描述器的寫入可用性,一旦 *fd* 可寫入,使用指定引數呼叫 " "*callback*。" -#: ../../library/asyncio-eventloop.rst:955 -#: ../../library/asyncio-eventloop.rst:1220 +#: ../../library/asyncio-eventloop.rst:971 +#: ../../library/asyncio-eventloop.rst:1236 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *callback*." @@ -1479,7 +1502,7 @@ msgstr "" "使用 :func:`functools.partial` 向 *callback* :ref:`傳送關鍵字引數 `。" -#: ../../library/asyncio-eventloop.rst:960 +#: ../../library/asyncio-eventloop.rst:976 msgid "" "Stop monitoring the *fd* file descriptor for write availability. Returns " "``True`` if *fd* was previously being monitored for writes." @@ -1487,7 +1510,7 @@ msgstr "" "停止監視 *fd* 檔案描述器的寫入可用性。如果 *fd* 之前正在監視寫入,則回傳 " "``True``。" -#: ../../library/asyncio-eventloop.rst:963 +#: ../../library/asyncio-eventloop.rst:979 msgid "" "See also :ref:`Platform Support ` section for some " "limitations of these methods." @@ -1495,11 +1518,11 @@ msgstr "" "另請參閱\\ :ref:`平台支援 `\\ 部分以了解這些方法的" "一些限制。" -#: ../../library/asyncio-eventloop.rst:968 +#: ../../library/asyncio-eventloop.rst:984 msgid "Working with socket objects directly" msgstr "直接使用 socket 物件" -#: ../../library/asyncio-eventloop.rst:970 +#: ../../library/asyncio-eventloop.rst:986 msgid "" "In general, protocol implementations that use transport-based APIs such as :" "meth:`loop.create_connection` and :meth:`loop.create_server` are faster than " @@ -1511,7 +1534,7 @@ msgstr "" "`loop.create_server`\\ )的協議實作比直接使用 socket 的實作更快。然而在某些情" "況下性能不是關鍵,直接使用 :class:`~socket.socket` 物件更方便。" -#: ../../library/asyncio-eventloop.rst:979 +#: ../../library/asyncio-eventloop.rst:995 msgid "" "Receive up to *nbytes* from *sock*. Asynchronous version of :meth:`socket." "recv() `." @@ -1519,23 +1542,23 @@ msgstr "" "從 *sock* 接收最多 *nbytes*。:meth:`socket.recv() ` 的非" "同步版本。" -#: ../../library/asyncio-eventloop.rst:982 +#: ../../library/asyncio-eventloop.rst:998 msgid "Return the received data as a bytes object." msgstr "將接收到的資料作為 bytes 物件回傳。" -#: ../../library/asyncio-eventloop.rst:984 -#: ../../library/asyncio-eventloop.rst:998 -#: ../../library/asyncio-eventloop.rst:1009 -#: ../../library/asyncio-eventloop.rst:1021 -#: ../../library/asyncio-eventloop.rst:1036 -#: ../../library/asyncio-eventloop.rst:1051 -#: ../../library/asyncio-eventloop.rst:1061 -#: ../../library/asyncio-eventloop.rst:1087 -#: ../../library/asyncio-eventloop.rst:1125 +#: ../../library/asyncio-eventloop.rst:1000 +#: ../../library/asyncio-eventloop.rst:1014 +#: ../../library/asyncio-eventloop.rst:1025 +#: ../../library/asyncio-eventloop.rst:1037 +#: ../../library/asyncio-eventloop.rst:1052 +#: ../../library/asyncio-eventloop.rst:1067 +#: ../../library/asyncio-eventloop.rst:1077 +#: ../../library/asyncio-eventloop.rst:1103 +#: ../../library/asyncio-eventloop.rst:1141 msgid "*sock* must be a non-blocking socket." msgstr "*sock* 必須是非阻塞 socket。" -#: ../../library/asyncio-eventloop.rst:986 +#: ../../library/asyncio-eventloop.rst:1002 msgid "" "Even though this method was always documented as a coroutine method, " "releases before Python 3.7 returned a :class:`Future`. Since Python 3.7 this " @@ -1544,7 +1567,7 @@ msgstr "" "儘管此方法一直記錄為協程方法,但 Python 3.7 之前的版本回傳 :class:`Future`。" "自 Python 3.7 起,這是 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:993 +#: ../../library/asyncio-eventloop.rst:1009 msgid "" "Receive data from *sock* into the *buf* buffer. Modeled after the blocking :" "meth:`socket.recv_into() ` method." @@ -1552,11 +1575,11 @@ msgstr "" "從 *sock* 接收資料到 *buf* 緩衝區。仿照阻塞 :meth:`socket.recv_into() " "` 方法。" -#: ../../library/asyncio-eventloop.rst:996 +#: ../../library/asyncio-eventloop.rst:1012 msgid "Return the number of bytes written to the buffer." msgstr "回傳寫入緩衝區位元組的數目。" -#: ../../library/asyncio-eventloop.rst:1004 +#: ../../library/asyncio-eventloop.rst:1020 msgid "" "Receive a datagram of up to *bufsize* from *sock*. Asynchronous version of :" "meth:`socket.recvfrom() `." @@ -1564,11 +1587,11 @@ msgstr "" "從 *sock* 接收最多 *bufsize* 大小的資料單元。:meth:`socket.recvfrom() " "` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1007 +#: ../../library/asyncio-eventloop.rst:1023 msgid "Return a tuple of (received data, remote address)." msgstr "回傳一個元組 (received data, remote address)。" -#: ../../library/asyncio-eventloop.rst:1015 +#: ../../library/asyncio-eventloop.rst:1031 msgid "" "Receive a datagram of up to *nbytes* from *sock* into *buf*. Asynchronous " "version of :meth:`socket.recvfrom_into() `." @@ -1576,11 +1599,11 @@ msgstr "" "從 *sock* 接收最多 *nbytes* 大小的資料單元到 *buf*。:meth:`socket." "recvfrom_into() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1019 +#: ../../library/asyncio-eventloop.rst:1035 msgid "Return a tuple of (number of bytes received, remote address)." msgstr "回傳一個元組 (number of bytes received, remote address)。" -#: ../../library/asyncio-eventloop.rst:1027 +#: ../../library/asyncio-eventloop.rst:1043 msgid "" "Send *data* to the *sock* socket. Asynchronous version of :meth:`socket." "sendall() `." @@ -1588,7 +1611,7 @@ msgstr "" "將 *data* 發送到 *sock* socket。:meth:`socket.sendall() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1030 +#: ../../library/asyncio-eventloop.rst:1046 msgid "" "This method continues to send to the socket until either all data in *data* " "has been sent or an error occurs. ``None`` is returned on success. On " @@ -1600,8 +1623,8 @@ msgstr "" "回傳 ``None``。錯誤時引發例外。此外,沒有辦法確定接收端成功處理了多少資料(如" "果有的話)。" -#: ../../library/asyncio-eventloop.rst:1038 -#: ../../library/asyncio-eventloop.rst:1089 +#: ../../library/asyncio-eventloop.rst:1054 +#: ../../library/asyncio-eventloop.rst:1105 msgid "" "Even though the method was always documented as a coroutine method, before " "Python 3.7 it returned a :class:`Future`. Since Python 3.7, this is an " @@ -1610,7 +1633,7 @@ msgstr "" "儘管該方法一直被記錄為協程方法,但在 Python 3.7 之前它回傳 :class:`Future`。" "從 Python 3.7 開始,這是一個 ``async def`` 方法。" -#: ../../library/asyncio-eventloop.rst:1045 +#: ../../library/asyncio-eventloop.rst:1061 msgid "" "Send a datagram from *sock* to *address*. Asynchronous version of :meth:" "`socket.sendto() `." @@ -1618,20 +1641,20 @@ msgstr "" "從 *sock* 向 *address* 發送一個資料單元。:meth:`socket.sendto() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1049 +#: ../../library/asyncio-eventloop.rst:1065 msgid "Return the number of bytes sent." msgstr "回傳發送的位元組數。" -#: ../../library/asyncio-eventloop.rst:1057 +#: ../../library/asyncio-eventloop.rst:1073 msgid "Connect *sock* to a remote socket at *address*." msgstr "將 *sock* 連線到位於 *address* 的遠端 socket。" -#: ../../library/asyncio-eventloop.rst:1059 +#: ../../library/asyncio-eventloop.rst:1075 msgid "" "Asynchronous version of :meth:`socket.connect() `." msgstr ":meth:`socket.connect() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1063 +#: ../../library/asyncio-eventloop.rst:1079 msgid "" "``address`` no longer needs to be resolved. ``sock_connect`` will try to " "check if the *address* is already resolved by calling :func:`socket." @@ -1642,7 +1665,7 @@ msgstr "" "inet_pton` 檢查 *address* 是否已解析。如果沒有,將使用 :meth:`loop." "getaddrinfo` 解析 *address*。" -#: ../../library/asyncio-eventloop.rst:1072 +#: ../../library/asyncio-eventloop.rst:1088 msgid "" ":meth:`loop.create_connection` and :func:`asyncio.open_connection() " "`." @@ -1650,7 +1673,7 @@ msgstr "" ":meth:`loop.create_connection` 和 :func:`asyncio.open_connection() " "`。" -#: ../../library/asyncio-eventloop.rst:1078 +#: ../../library/asyncio-eventloop.rst:1094 msgid "" "Accept a connection. Modeled after the blocking :meth:`socket.accept() " "` method." @@ -1658,7 +1681,7 @@ msgstr "" "接受一個連線。模擬阻塞的 :meth:`socket.accept() ` 方" "法。" -#: ../../library/asyncio-eventloop.rst:1081 +#: ../../library/asyncio-eventloop.rst:1097 msgid "" "The socket must be bound to an address and listening for connections. The " "return value is a pair ``(conn, address)`` where *conn* is a *new* socket " @@ -1669,34 +1692,34 @@ msgstr "" "中 *conn* 是一個 *新* socket 物件,可在連線上發送和接收資料,*address* 是連接" "另一端對應的 socket 地址。" -#: ../../library/asyncio-eventloop.rst:1096 +#: ../../library/asyncio-eventloop.rst:1112 msgid ":meth:`loop.create_server` and :func:`start_server`." msgstr ":meth:`loop.create_server` 和 :func:`start_server`。" -#: ../../library/asyncio-eventloop.rst:1101 +#: ../../library/asyncio-eventloop.rst:1117 msgid "" "Send a file using high-performance :mod:`os.sendfile` if possible. Return " "the total number of bytes sent." msgstr "" "如果可行,使用高性能 :mod:`os.sendfile` 發送檔案。回傳發送的總位元組數。" -#: ../../library/asyncio-eventloop.rst:1104 +#: ../../library/asyncio-eventloop.rst:1120 msgid "" "Asynchronous version of :meth:`socket.sendfile() `." msgstr ":meth:`socket.sendfile() ` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1106 +#: ../../library/asyncio-eventloop.rst:1122 msgid "" "*sock* must be a non-blocking :const:`socket.SOCK_STREAM` :class:`~socket." "socket`." msgstr "" "*sock* 必須是非阻塞的 :const:`socket.SOCK_STREAM` :class:`~socket.socket`。" -#: ../../library/asyncio-eventloop.rst:1109 +#: ../../library/asyncio-eventloop.rst:1125 msgid "*file* must be a regular file object open in binary mode." msgstr "*file* 必須是以二進位模式打開的常規檔案物件。" -#: ../../library/asyncio-eventloop.rst:1118 +#: ../../library/asyncio-eventloop.rst:1134 msgid "" "*fallback*, when set to ``True``, makes asyncio manually read and send the " "file when the platform does not support the sendfile syscall (e.g. Windows " @@ -1705,7 +1728,7 @@ msgstr "" "當設置為 ``True`` 時,*fallback* 使 asyncio 在平台不支援 sendfile 系統呼叫時" "(例如 Windows 或 Unix 上的 SSL socket)手動讀取和發送檔案。" -#: ../../library/asyncio-eventloop.rst:1122 +#: ../../library/asyncio-eventloop.rst:1138 msgid "" "Raise :exc:`SendfileNotAvailableError` if the system does not support " "*sendfile* syscall and *fallback* is ``False``." @@ -1713,19 +1736,19 @@ msgstr "" "如果系統不支援 *sendfile* 系統呼叫且 *fallback* 為 ``False``,引發 :exc:" "`SendfileNotAvailableError`。" -#: ../../library/asyncio-eventloop.rst:1131 +#: ../../library/asyncio-eventloop.rst:1147 msgid "DNS" msgstr "DNS" -#: ../../library/asyncio-eventloop.rst:1136 +#: ../../library/asyncio-eventloop.rst:1152 msgid "Asynchronous version of :meth:`socket.getaddrinfo`." msgstr ":meth:`socket.getaddrinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1140 +#: ../../library/asyncio-eventloop.rst:1156 msgid "Asynchronous version of :meth:`socket.getnameinfo`." msgstr ":meth:`socket.getnameinfo` 的非同步版本。" -#: ../../library/asyncio-eventloop.rst:1143 +#: ../../library/asyncio-eventloop.rst:1159 msgid "" "Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous " "versions through the loop's default thread pool executor. When this executor " @@ -1735,7 +1758,7 @@ msgid "" "executor with a larger number of workers." msgstr "" -#: ../../library/asyncio-eventloop.rst:1150 +#: ../../library/asyncio-eventloop.rst:1166 msgid "" "Both *getaddrinfo* and *getnameinfo* methods were always documented to " "return a coroutine, but prior to Python 3.7 they were, in fact, returning :" @@ -1746,19 +1769,19 @@ msgstr "" "它們實際上回傳 :class:`asyncio.Future` 物件。從 Python 3.7 開始,兩個方法都是" "協程。" -#: ../../library/asyncio-eventloop.rst:1158 +#: ../../library/asyncio-eventloop.rst:1174 msgid "Working with pipes" msgstr "使用管道" -#: ../../library/asyncio-eventloop.rst:1162 +#: ../../library/asyncio-eventloop.rst:1178 msgid "Register the read end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的讀取端。" -#: ../../library/asyncio-eventloop.rst:1167 +#: ../../library/asyncio-eventloop.rst:1183 msgid "*pipe* is a :term:`file-like object `." msgstr "*pipe* 是 :term:`類檔案物件 `。" -#: ../../library/asyncio-eventloop.rst:1169 +#: ../../library/asyncio-eventloop.rst:1185 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports the :class:" "`ReadTransport` interface and *protocol* is an object instantiated by the " @@ -1767,22 +1790,22 @@ msgstr "" "回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" "`ReadTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1173 #: ../../library/asyncio-eventloop.rst:1189 +#: ../../library/asyncio-eventloop.rst:1205 msgid "" "With :class:`SelectorEventLoop` event loop, the *pipe* is set to non-" "blocking mode." msgstr "使用 :class:`SelectorEventLoop` 事件迴圈時,*pipe* 設置為非阻塞模式。" -#: ../../library/asyncio-eventloop.rst:1178 +#: ../../library/asyncio-eventloop.rst:1194 msgid "Register the write end of *pipe* in the event loop." msgstr "在事件迴圈中註冊 *pipe* 的寫入端。" -#: ../../library/asyncio-eventloop.rst:1183 +#: ../../library/asyncio-eventloop.rst:1199 msgid "*pipe* is :term:`file-like object `." msgstr "*pipe* 是 :term:`file-like object `。" -#: ../../library/asyncio-eventloop.rst:1185 +#: ../../library/asyncio-eventloop.rst:1201 msgid "" "Return pair ``(transport, protocol)``, where *transport* supports :class:" "`WriteTransport` interface and *protocol* is an object instantiated by the " @@ -1791,7 +1814,7 @@ msgstr "" "回傳 ``(transport, protocol)`` 對,其中 *transport* 支援 :class:" "`WriteTransport` 介面,*protocol* 是由 *protocol_factory* 實例化的物件。" -#: ../../library/asyncio-eventloop.rst:1194 +#: ../../library/asyncio-eventloop.rst:1210 msgid "" ":class:`SelectorEventLoop` does not support the above methods on Windows. " "Use :class:`ProactorEventLoop` instead for Windows." @@ -1799,20 +1822,20 @@ msgstr "" ":class:`SelectorEventLoop` 在 Windows 上不支援上述方法。對於 Windows 請使用 :" "class:`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1199 +#: ../../library/asyncio-eventloop.rst:1215 msgid "" "The :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` methods." msgstr ":meth:`loop.subprocess_exec` 和 :meth:`loop.subprocess_shell` 方法。" -#: ../../library/asyncio-eventloop.rst:1204 +#: ../../library/asyncio-eventloop.rst:1220 msgid "Unix signals" msgstr "Unix 訊號" -#: ../../library/asyncio-eventloop.rst:1210 +#: ../../library/asyncio-eventloop.rst:1226 msgid "Set *callback* as the handler for the *signum* signal." msgstr "將 *callback* 設置為 *signum* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1212 +#: ../../library/asyncio-eventloop.rst:1228 msgid "" "The callback will be invoked by *loop*, along with other queued callbacks " "and runnable coroutines of that event loop. Unlike signal handlers " @@ -1823,7 +1846,7 @@ msgstr "" "用 :func:`signal.signal` 註冊的訊號處理程式不同,使用此函式註冊的回呼允許與事" "件迴圈進行互動。" -#: ../../library/asyncio-eventloop.rst:1217 +#: ../../library/asyncio-eventloop.rst:1233 msgid "" "Raise :exc:`ValueError` if the signal number is invalid or uncatchable. " "Raise :exc:`RuntimeError` if there is a problem setting up the handler." @@ -1831,16 +1854,16 @@ msgstr "" "如果訊號號無效或不可捕獲,引發 :exc:`ValueError`。如果設定處理程序有問題,拋" "出 :exc:`RuntimeError`。" -#: ../../library/asyncio-eventloop.rst:1223 +#: ../../library/asyncio-eventloop.rst:1239 msgid "" "Like :func:`signal.signal`, this function must be invoked in the main thread." msgstr "像 :func:`signal.signal` 一樣,此函式必須在主執行緒中呼叫。" -#: ../../library/asyncio-eventloop.rst:1228 +#: ../../library/asyncio-eventloop.rst:1244 msgid "Remove the handler for the *sig* signal." msgstr "移除 *sig* 訊號的處理程式。" -#: ../../library/asyncio-eventloop.rst:1230 +#: ../../library/asyncio-eventloop.rst:1246 msgid "" "Return ``True`` if the signal handler was removed, or ``False`` if no " "handler was set for the given signal." @@ -1848,19 +1871,19 @@ msgstr "" "如果訊號處理程式被移除,回傳 ``True``;如果給定訊號沒有設置處理程式,回傳 " "``False``。" -#: ../../library/asyncio-eventloop.rst:1237 +#: ../../library/asyncio-eventloop.rst:1253 msgid "The :mod:`signal` module." msgstr ":mod:`signal` 模組。" -#: ../../library/asyncio-eventloop.rst:1241 +#: ../../library/asyncio-eventloop.rst:1257 msgid "Executing code in thread or process pools" msgstr "在執行緒池或行程池中執行程式碼" -#: ../../library/asyncio-eventloop.rst:1245 +#: ../../library/asyncio-eventloop.rst:1261 msgid "Arrange for *func* to be called in the specified executor." msgstr "安排在指定的執行器中呼叫 *func*。" -#: ../../library/asyncio-eventloop.rst:1247 +#: ../../library/asyncio-eventloop.rst:1263 msgid "" "The *executor* argument should be an :class:`concurrent.futures.Executor` " "instance. The default executor is used if *executor* is ``None``. The " @@ -1869,7 +1892,7 @@ msgid "" "and used by :func:`run_in_executor` if needed." msgstr "" -#: ../../library/asyncio-eventloop.rst:1255 +#: ../../library/asyncio-eventloop.rst:1271 msgid "" "import asyncio\n" "import concurrent.futures\n" @@ -1912,7 +1935,7 @@ msgid "" " asyncio.run(main())" msgstr "" -#: ../../library/asyncio-eventloop.rst:1295 +#: ../../library/asyncio-eventloop.rst:1311 msgid "" "Note that the entry point guard (``if __name__ == '__main__'``) is required " "for option 3 due to the peculiarities of :mod:`multiprocessing`, which is " @@ -1924,11 +1947,11 @@ msgstr "" "== '__main__'``\\ )。請參閱\\ :ref:`主模組的安全引入 `。" -#: ../../library/asyncio-eventloop.rst:1300 +#: ../../library/asyncio-eventloop.rst:1316 msgid "This method returns a :class:`asyncio.Future` object." msgstr "此方法回傳 :class:`asyncio.Future` 物件。" -#: ../../library/asyncio-eventloop.rst:1302 +#: ../../library/asyncio-eventloop.rst:1318 msgid "" "Use :func:`functools.partial` :ref:`to pass keyword arguments ` to *func*." @@ -1936,7 +1959,7 @@ msgstr "" "使用 :func:`functools.partial` 將來\\ :ref:`關鍵字引數傳遞 `\\ 給 *func*。" -#: ../../library/asyncio-eventloop.rst:1305 +#: ../../library/asyncio-eventloop.rst:1321 msgid "" ":meth:`loop.run_in_executor` no longer configures the ``max_workers`` of the " "thread pool executor it creates, instead leaving it up to the thread pool " @@ -1947,7 +1970,7 @@ msgstr "" "``max_workers``,而是讓執行緒池執行器(\\ :class:`~concurrent.futures." "ThreadPoolExecutor`)設定預設值。" -#: ../../library/asyncio-eventloop.rst:1314 +#: ../../library/asyncio-eventloop.rst:1330 msgid "" "Set *executor* as the default executor used by :meth:`run_in_executor`. " "*executor* must be an instance of :class:`~concurrent.futures." @@ -1956,26 +1979,26 @@ msgstr "" "將 *executor* 設置為 :meth:`run_in_executor` 使用的預設執行器。*executor* 必" "須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1318 +#: ../../library/asyncio-eventloop.rst:1334 msgid "" "*executor* must be an instance of :class:`~concurrent.futures." "ThreadPoolExecutor`." msgstr "" "*executor* 必須是 :class:`~concurrent.futures.ThreadPoolExecutor` 的實例。" -#: ../../library/asyncio-eventloop.rst:1324 +#: ../../library/asyncio-eventloop.rst:1340 msgid "Error Handling API" msgstr "錯誤處理 API" -#: ../../library/asyncio-eventloop.rst:1326 +#: ../../library/asyncio-eventloop.rst:1342 msgid "Allows customizing how exceptions are handled in the event loop." msgstr "允許自定義事件迴圈中的例外處理方式。" -#: ../../library/asyncio-eventloop.rst:1330 +#: ../../library/asyncio-eventloop.rst:1346 msgid "Set *handler* as the new event loop exception handler." msgstr "將 *handler* 設定為新的事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1332 +#: ../../library/asyncio-eventloop.rst:1348 msgid "" "If *handler* is ``None``, the default exception handler will be set. " "Otherwise, *handler* must be a callable with the signature matching ``(loop, " @@ -1988,7 +2011,7 @@ msgstr "" "圈的,``context`` 是包含例外詳細資訊的 ``dict`` 物件(有關情境的詳細資訊,請" "參閱 :meth:`call_exception_handler` 文件)。" -#: ../../library/asyncio-eventloop.rst:1340 +#: ../../library/asyncio-eventloop.rst:1356 msgid "" "If the handler is called on behalf of a :class:`~asyncio.Task` or :class:" "`~asyncio.Handle`, it is run in the :class:`contextvars.Context` of that " @@ -1997,7 +2020,7 @@ msgstr "" "如果代表 :class:`~asyncio.Task` 或 :class:`~asyncio.Handle` 呼叫處理程式,它" "將在該任務或回呼處理程式的 :class:`contextvars.Context` 中運行。" -#: ../../library/asyncio-eventloop.rst:1346 +#: ../../library/asyncio-eventloop.rst:1362 msgid "" "The handler may be called in the :class:`~contextvars.Context` of the task " "or handle where the exception originated." @@ -2005,18 +2028,18 @@ msgstr "" "處理程式可能在引發例外的任務或處理程式的 :class:`~contextvars.Context` 中被呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1351 +#: ../../library/asyncio-eventloop.rst:1367 msgid "" "Return the current exception handler, or ``None`` if no custom exception " "handler was set." msgstr "" "回傳當前的例外處理程式,如果未設置自定義例外處理程式,則回傳 ``None``。" -#: ../../library/asyncio-eventloop.rst:1358 +#: ../../library/asyncio-eventloop.rst:1374 msgid "Default exception handler." msgstr "預設例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1360 +#: ../../library/asyncio-eventloop.rst:1376 msgid "" "This is called when an exception occurs and no exception handler is set. " "This can be called by a custom exception handler that wants to defer to the " @@ -2025,17 +2048,17 @@ msgstr "" "當發生例外且未設置例外處理程式時呼叫此函式。自定義例外處理程式可以呼叫此函式" "以轉由預設處理程式處理。" -#: ../../library/asyncio-eventloop.rst:1364 +#: ../../library/asyncio-eventloop.rst:1380 msgid "" "*context* parameter has the same meaning as in :meth:" "`call_exception_handler`." msgstr "*context* 參數與 :meth:`call_exception_handler` 中的意思相同。" -#: ../../library/asyncio-eventloop.rst:1369 +#: ../../library/asyncio-eventloop.rst:1385 msgid "Call the current event loop exception handler." msgstr "呼叫當前事件迴圈例外處理程式。" -#: ../../library/asyncio-eventloop.rst:1371 +#: ../../library/asyncio-eventloop.rst:1387 msgid "" "*context* is a ``dict`` object containing the following keys (new keys may " "be introduced in future Python versions):" @@ -2043,47 +2066,47 @@ msgstr "" "*context* 是一個包含以下鍵的 ``dict`` 物件(未來的 Python 版本中可能會引入新" "的鍵):" -#: ../../library/asyncio-eventloop.rst:1374 +#: ../../library/asyncio-eventloop.rst:1390 msgid "'message': Error message;" msgstr "'message':錯誤訊息;" -#: ../../library/asyncio-eventloop.rst:1375 +#: ../../library/asyncio-eventloop.rst:1391 msgid "'exception' (optional): Exception object;" msgstr "'exception'(可選):例外物件;" -#: ../../library/asyncio-eventloop.rst:1376 +#: ../../library/asyncio-eventloop.rst:1392 msgid "'future' (optional): :class:`asyncio.Future` instance;" msgstr "'future'(可選): :class:`asyncio.Future` 實例;" -#: ../../library/asyncio-eventloop.rst:1377 +#: ../../library/asyncio-eventloop.rst:1393 msgid "'task' (optional): :class:`asyncio.Task` instance;" msgstr "'task'(可選): :class:`asyncio.Task` 實例;" -#: ../../library/asyncio-eventloop.rst:1378 +#: ../../library/asyncio-eventloop.rst:1394 msgid "'handle' (optional): :class:`asyncio.Handle` instance;" msgstr "'handle'(可選): :class:`asyncio.Handle` 實例;" -#: ../../library/asyncio-eventloop.rst:1379 +#: ../../library/asyncio-eventloop.rst:1395 msgid "'protocol' (optional): :ref:`Protocol ` instance;" msgstr "'protocol'(可選): :ref:`Protocol ` 實例;" -#: ../../library/asyncio-eventloop.rst:1380 +#: ../../library/asyncio-eventloop.rst:1396 msgid "'transport' (optional): :ref:`Transport ` instance;" msgstr "'transport'(可選): :ref:`Transport ` 實例;" -#: ../../library/asyncio-eventloop.rst:1381 +#: ../../library/asyncio-eventloop.rst:1397 msgid "'socket' (optional): :class:`socket.socket` instance;" msgstr "'socket'(可選): :class:`socket.socket` 實例;" -#: ../../library/asyncio-eventloop.rst:1382 +#: ../../library/asyncio-eventloop.rst:1398 msgid "'asyncgen' (optional): Asynchronous generator that caused" msgstr "'asyncgen'(可選): 非同步產生器引發" -#: ../../library/asyncio-eventloop.rst:1383 +#: ../../library/asyncio-eventloop.rst:1399 msgid "the exception." msgstr "例外。" -#: ../../library/asyncio-eventloop.rst:1387 +#: ../../library/asyncio-eventloop.rst:1403 msgid "" "This method should not be overloaded in subclassed event loops. For custom " "exception handling, use the :meth:`set_exception_handler` method." @@ -2091,15 +2114,15 @@ msgstr "" "此方法不應在子類別事件迴圈中被覆寫。為了自定義例外處理,請使用 :meth:" "`set_exception_handler` 方法。" -#: ../../library/asyncio-eventloop.rst:1392 +#: ../../library/asyncio-eventloop.rst:1408 msgid "Enabling debug mode" msgstr "啟用除錯模式" -#: ../../library/asyncio-eventloop.rst:1396 +#: ../../library/asyncio-eventloop.rst:1412 msgid "Get the debug mode (:class:`bool`) of the event loop." msgstr "取得事件迴圈的除錯模式(\\ :class:`bool`\\ )。" -#: ../../library/asyncio-eventloop.rst:1398 +#: ../../library/asyncio-eventloop.rst:1414 msgid "" "The default value is ``True`` if the environment variable :envvar:" "`PYTHONASYNCIODEBUG` is set to a non-empty string, ``False`` otherwise." @@ -2107,17 +2130,17 @@ msgstr "" "如果環境變數 :envvar:`PYTHONASYNCIODEBUG` 被設定為非空字串,則預設值為 " "``True``,否則為 ``False``。" -#: ../../library/asyncio-eventloop.rst:1404 +#: ../../library/asyncio-eventloop.rst:1420 msgid "Set the debug mode of the event loop." msgstr "設定事件迴圈的除錯模式。" -#: ../../library/asyncio-eventloop.rst:1408 +#: ../../library/asyncio-eventloop.rst:1424 msgid "" "The new :ref:`Python Development Mode ` can now also be used to " "enable the debug mode." msgstr "現在也可以使用新的 :ref:`Python 開發模式 ` 啟用除錯模式。" -#: ../../library/asyncio-eventloop.rst:1413 +#: ../../library/asyncio-eventloop.rst:1429 msgid "" "This attribute can be used to set the minimum execution duration in seconds " "that is considered \"slow\". When debug mode is enabled, \"slow\" callbacks " @@ -2126,19 +2149,19 @@ msgstr "" "此屬性可用於設定被視為\"慢\"的最短執行時間(以秒為單位)。啟用偵錯模式" "後,\"慢\"回呼將被記錄。" -#: ../../library/asyncio-eventloop.rst:1417 +#: ../../library/asyncio-eventloop.rst:1433 msgid "Default value is 100 milliseconds." msgstr "預設值為 100 毫秒" -#: ../../library/asyncio-eventloop.rst:1421 +#: ../../library/asyncio-eventloop.rst:1437 msgid "The :ref:`debug mode of asyncio `." msgstr ":ref:`asyncio 的除錯模式 `。" -#: ../../library/asyncio-eventloop.rst:1425 +#: ../../library/asyncio-eventloop.rst:1441 msgid "Running Subprocesses" msgstr "運行子行程" -#: ../../library/asyncio-eventloop.rst:1427 +#: ../../library/asyncio-eventloop.rst:1443 msgid "" "Methods described in this subsections are low-level. In regular async/await " "code consider using the high-level :func:`asyncio.create_subprocess_shell` " @@ -2148,7 +2171,7 @@ msgstr "" "func:`asyncio.create_subprocess_shell` 和 :func:`asyncio." "create_subprocess_exec` 輔助功能而不是。" -#: ../../library/asyncio-eventloop.rst:1434 +#: ../../library/asyncio-eventloop.rst:1450 msgid "" "On Windows, the default event loop :class:`ProactorEventLoop` supports " "subprocesses, whereas :class:`SelectorEventLoop` does not. See :ref:" @@ -2158,26 +2181,26 @@ msgstr "" "`SelectorEventLoop` 不支援。詳細資訊請參見 :ref:`Windows 上對於子行程的支援 " "`。" -#: ../../library/asyncio-eventloop.rst:1445 +#: ../../library/asyncio-eventloop.rst:1461 msgid "" "Create a subprocess from one or more string arguments specified by *args*." msgstr "從 *args* 指定的一個或多個字串引數建立子行程。" -#: ../../library/asyncio-eventloop.rst:1448 +#: ../../library/asyncio-eventloop.rst:1464 msgid "*args* must be a list of strings represented by:" msgstr "*args* 必須是由以下項表示的字串串列:" -#: ../../library/asyncio-eventloop.rst:1450 +#: ../../library/asyncio-eventloop.rst:1466 msgid ":class:`str`;" msgstr ":class:`str`;" -#: ../../library/asyncio-eventloop.rst:1451 +#: ../../library/asyncio-eventloop.rst:1467 msgid "" "or :class:`bytes`, encoded to the :ref:`filesystem encoding `." msgstr "或 :class:`bytes`,編碼為 :ref:`檔案系統編碼 `。" -#: ../../library/asyncio-eventloop.rst:1454 +#: ../../library/asyncio-eventloop.rst:1470 msgid "" "The first string specifies the program executable, and the remaining strings " "specify the arguments. Together, string arguments form the ``argv`` of the " @@ -2186,7 +2209,7 @@ msgstr "" "第一個字串指定程序可執行檔案,其餘字串指定引數。字串引數一起組成程序的 " "``argv``。" -#: ../../library/asyncio-eventloop.rst:1458 +#: ../../library/asyncio-eventloop.rst:1474 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=False`` and the list of strings passed as the first " @@ -2197,7 +2220,7 @@ msgstr "" "字串串列作為第一個引數傳遞;然而,:class:`~subprocess.Popen` 接受單個字串串列" "引數,*subprocess_exec* 接受多個字串引數。" -#: ../../library/asyncio-eventloop.rst:1464 +#: ../../library/asyncio-eventloop.rst:1480 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`asyncio.SubprocessProtocol` class." @@ -2205,67 +2228,67 @@ msgstr "" "*protocol_factory* 必須是回傳 :class:`asyncio.SubprocessProtocol` 子類別的可" "呼叫物件。" -#: ../../library/asyncio-eventloop.rst:1467 +#: ../../library/asyncio-eventloop.rst:1483 msgid "Other parameters:" msgstr "其他參數:" -#: ../../library/asyncio-eventloop.rst:1469 +#: ../../library/asyncio-eventloop.rst:1485 msgid "*stdin* can be any of these:" msgstr "*stdin* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1471 -#: ../../library/asyncio-eventloop.rst:1482 -#: ../../library/asyncio-eventloop.rst:1492 +#: ../../library/asyncio-eventloop.rst:1487 +#: ../../library/asyncio-eventloop.rst:1498 +#: ../../library/asyncio-eventloop.rst:1508 msgid "a file-like object" msgstr "類檔案物件" -#: ../../library/asyncio-eventloop.rst:1472 +#: ../../library/asyncio-eventloop.rst:1488 msgid "" "an existing file descriptor (a positive integer), for example those created " "with :meth:`os.pipe`" msgstr "現有的檔案描述器(正整數),例如用 :meth:`os.pipe` 建立的" -#: ../../library/asyncio-eventloop.rst:1473 -#: ../../library/asyncio-eventloop.rst:1483 -#: ../../library/asyncio-eventloop.rst:1493 +#: ../../library/asyncio-eventloop.rst:1489 +#: ../../library/asyncio-eventloop.rst:1499 +#: ../../library/asyncio-eventloop.rst:1509 msgid "" "the :const:`subprocess.PIPE` constant (default) which will create a new pipe " "and connect it," msgstr ":const:`subprocess.PIPE` 常數(預設),它將建立一個新的管道並連線," -#: ../../library/asyncio-eventloop.rst:1475 -#: ../../library/asyncio-eventloop.rst:1485 -#: ../../library/asyncio-eventloop.rst:1495 +#: ../../library/asyncio-eventloop.rst:1491 +#: ../../library/asyncio-eventloop.rst:1501 +#: ../../library/asyncio-eventloop.rst:1511 msgid "" "the value ``None`` which will make the subprocess inherit the file " "descriptor from this process" msgstr "值 ``None`` 將使子行程從此行程繼承檔案描述器" -#: ../../library/asyncio-eventloop.rst:1477 -#: ../../library/asyncio-eventloop.rst:1487 -#: ../../library/asyncio-eventloop.rst:1497 +#: ../../library/asyncio-eventloop.rst:1493 +#: ../../library/asyncio-eventloop.rst:1503 +#: ../../library/asyncio-eventloop.rst:1513 msgid "" "the :const:`subprocess.DEVNULL` constant which indicates that the special :" "data:`os.devnull` file will be used" msgstr "" ":const:`subprocess.DEVNULL` 常數,表示將使用特殊的 :data:`os.devnull` 檔案" -#: ../../library/asyncio-eventloop.rst:1480 +#: ../../library/asyncio-eventloop.rst:1496 msgid "*stdout* can be any of these:" msgstr "*stdout* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1490 +#: ../../library/asyncio-eventloop.rst:1506 msgid "*stderr* can be any of these:" msgstr "*stderr* 可以是以下任意一個:" -#: ../../library/asyncio-eventloop.rst:1499 +#: ../../library/asyncio-eventloop.rst:1515 msgid "" "the :const:`subprocess.STDOUT` constant which will connect the standard " "error stream to the process' standard output stream" msgstr "" ":const:`subprocess.STDOUT` 常數,它將標準錯誤串流連線到行程的標準輸出串流" -#: ../../library/asyncio-eventloop.rst:1502 +#: ../../library/asyncio-eventloop.rst:1518 msgid "" "All other keyword arguments are passed to :class:`subprocess.Popen` without " "interpretation, except for *bufsize*, *universal_newlines*, *shell*, *text*, " @@ -2275,7 +2298,7 @@ msgstr "" "*bufsize*、*universal_newlines*、*shell*、*text*、*encoding* 和 *errors* 除" "外,這些不應該指定。" -#: ../../library/asyncio-eventloop.rst:1507 +#: ../../library/asyncio-eventloop.rst:1523 msgid "" "The ``asyncio`` subprocess API does not support decoding the streams as " "text. :func:`bytes.decode` can be used to convert the bytes returned from " @@ -2284,7 +2307,7 @@ msgstr "" "``asyncio`` 子行程 API 不支援將串流解碼為文本。可以使用 :func:`bytes.decode` " "將從串流回傳的位元組轉換為文本。" -#: ../../library/asyncio-eventloop.rst:1511 +#: ../../library/asyncio-eventloop.rst:1527 msgid "" "If a file-like object passed as *stdin*, *stdout* or *stderr* represents a " "pipe, then the other side of this pipe should be registered with :meth:" @@ -2295,13 +2318,13 @@ msgstr "" "端應該使用 :meth:`~loop.connect_write_pipe` 或 :meth:`~loop." "connect_read_pipe` 註冊到事件迴圈中。" -#: ../../library/asyncio-eventloop.rst:1516 +#: ../../library/asyncio-eventloop.rst:1532 msgid "" "See the constructor of the :class:`subprocess.Popen` class for documentation " "on other arguments." msgstr "有關其他引數的文件,請參閱 :class:`subprocess.Popen` 類別的建構函式。" -#: ../../library/asyncio-eventloop.rst:1519 +#: ../../library/asyncio-eventloop.rst:1535 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`asyncio.SubprocessTransport` base class and *protocol* is an " @@ -2311,7 +2334,7 @@ msgstr "" "SubprocessTransport` 基底類別,*protocol* 是由 *protocol_factory* 實例化的物" "件。" -#: ../../library/asyncio-eventloop.rst:1527 +#: ../../library/asyncio-eventloop.rst:1543 msgid "" "Create a subprocess from *cmd*, which can be a :class:`str` or a :class:" "`bytes` string encoded to the :ref:`filesystem encoding ` 的 :class:`bytes` 字串。" -#: ../../library/asyncio-eventloop.rst:1532 +#: ../../library/asyncio-eventloop.rst:1548 msgid "" "This is similar to the standard library :class:`subprocess.Popen` class " "called with ``shell=True``." @@ -2328,7 +2351,7 @@ msgstr "" "這類似於標準函式庫中的 :class:`subprocess.Popen` 類別,使用 ``shell=True`` 呼" "叫。" -#: ../../library/asyncio-eventloop.rst:1535 +#: ../../library/asyncio-eventloop.rst:1551 msgid "" "The *protocol_factory* must be a callable returning a subclass of the :class:" "`SubprocessProtocol` class." @@ -2336,13 +2359,13 @@ msgstr "" "*protocol_factory* 必須是回傳 :class:`SubprocessProtocol` 子類別的可呼叫物" "件。" -#: ../../library/asyncio-eventloop.rst:1538 +#: ../../library/asyncio-eventloop.rst:1554 msgid "" "See :meth:`~loop.subprocess_exec` for more details about the remaining " "arguments." msgstr "有關其餘引數的更多詳細資訊,請參閱 :meth:`~loop.subprocess_exec`。" -#: ../../library/asyncio-eventloop.rst:1541 +#: ../../library/asyncio-eventloop.rst:1557 msgid "" "Returns a pair of ``(transport, protocol)``, where *transport* conforms to " "the :class:`SubprocessTransport` base class and *protocol* is an object " @@ -2352,7 +2375,7 @@ msgstr "" "`SubprocessTransport` 基底類別,而 *protocol* 是由 *protocol_factory* 實例化" "的物件。" -#: ../../library/asyncio-eventloop.rst:1546 +#: ../../library/asyncio-eventloop.rst:1562 msgid "" "It is the application's responsibility to ensure that all whitespace and " "special characters are quoted appropriately to avoid `shell injection " @@ -2365,11 +2388,11 @@ msgstr "" "wikipedia.org/wiki/Shell_injection#Shell_injection>`_\\ 風險。可以使用 :func:" "`shlex.quote` 函式來正確跳脫用於構建 shell 命令的字串中的空白和特殊字元。" -#: ../../library/asyncio-eventloop.rst:1555 +#: ../../library/asyncio-eventloop.rst:1571 msgid "Callback Handles" msgstr "回呼處理" -#: ../../library/asyncio-eventloop.rst:1559 +#: ../../library/asyncio-eventloop.rst:1575 msgid "" "A callback wrapper object returned by :meth:`loop.call_soon`, :meth:`loop." "call_soon_threadsafe`." @@ -2377,46 +2400,46 @@ msgstr "" "由 :meth:`loop.call_soon` 和 :meth:`loop.call_soon_threadsafe` 回傳的回呼包裝" "器。" -#: ../../library/asyncio-eventloop.rst:1564 +#: ../../library/asyncio-eventloop.rst:1580 msgid "" "Return the :class:`contextvars.Context` object associated with the handle." msgstr "回傳與處理相關聯的 :class:`contextvars.Context` 物件。" -#: ../../library/asyncio-eventloop.rst:1571 +#: ../../library/asyncio-eventloop.rst:1587 msgid "" "Cancel the callback. If the callback has already been canceled or executed, " "this method has no effect." msgstr "取消回呼。如果回呼已被取消或執行,此方法將不起作用。" -#: ../../library/asyncio-eventloop.rst:1576 +#: ../../library/asyncio-eventloop.rst:1592 msgid "Return ``True`` if the callback was cancelled." msgstr "如果回呼已被取消,回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1582 +#: ../../library/asyncio-eventloop.rst:1598 msgid "" "A callback wrapper object returned by :meth:`loop.call_later`, and :meth:" "`loop.call_at`." msgstr "由 :meth:`loop.call_later` 和 :meth:`loop.call_at` 回傳的回呼包裝器。" -#: ../../library/asyncio-eventloop.rst:1585 +#: ../../library/asyncio-eventloop.rst:1601 msgid "This class is a subclass of :class:`Handle`." msgstr "這個類別是 :class:`Handle` 的子類別。" -#: ../../library/asyncio-eventloop.rst:1589 +#: ../../library/asyncio-eventloop.rst:1605 msgid "Return a scheduled callback time as :class:`float` seconds." msgstr "回傳預定的回呼時間,以 :class:`float` 秒為單位。" -#: ../../library/asyncio-eventloop.rst:1591 +#: ../../library/asyncio-eventloop.rst:1607 msgid "" "The time is an absolute timestamp, using the same time reference as :meth:" "`loop.time`." msgstr "時間是一個絕對的時間戳,使用與 :meth:`loop.time` 相同的時間參照。" -#: ../../library/asyncio-eventloop.rst:1598 +#: ../../library/asyncio-eventloop.rst:1614 msgid "Server Objects" msgstr "Server 物件" -#: ../../library/asyncio-eventloop.rst:1600 +#: ../../library/asyncio-eventloop.rst:1616 msgid "" "Server objects are created by :meth:`loop.create_server`, :meth:`loop." "create_unix_server`, :func:`start_server`, and :func:`start_unix_server` " @@ -2426,11 +2449,11 @@ msgstr "" "create_unix_server`、:func:`start_server` 和 :func:`start_unix_server` 函式所" "建立。" -#: ../../library/asyncio-eventloop.rst:1604 +#: ../../library/asyncio-eventloop.rst:1620 msgid "Do not instantiate the :class:`Server` class directly." msgstr "請勿直接實例化 :class:`Server` 類別。" -#: ../../library/asyncio-eventloop.rst:1608 +#: ../../library/asyncio-eventloop.rst:1624 msgid "" "*Server* objects are asynchronous context managers. When used in an ``async " "with`` statement, it's guaranteed that the Server object is closed and not " @@ -2439,7 +2462,7 @@ msgstr "" "*Server* 物件是非同步情境管理器。當在 ``async with`` 陳述中使用時,可以保證在" "完成 ``async with`` 陳述時,Server 物件將會關閉並停止接受新的連線: ::" -#: ../../library/asyncio-eventloop.rst:1613 +#: ../../library/asyncio-eventloop.rst:1629 msgid "" "srv = await loop.create_server(...)\n" "\n" @@ -2449,30 +2472,30 @@ msgid "" "# At this point, srv is closed and no longer accepts new connections." msgstr "" -#: ../../library/asyncio-eventloop.rst:1621 +#: ../../library/asyncio-eventloop.rst:1637 msgid "Server object is an asynchronous context manager since Python 3.7." msgstr "自 Python 3.7 起,Server 物件是非同步情境管理器。" -#: ../../library/asyncio-eventloop.rst:1624 +#: ../../library/asyncio-eventloop.rst:1640 msgid "" "This class was exposed publicly as ``asyncio.Server`` in Python 3.9.11, " "3.10.3 and 3.11." msgstr "" "此類別在 Python 3.9.11、3.10.3 和 3.11 中以 ``asyncio.Server`` 的形式被公開。" -#: ../../library/asyncio-eventloop.rst:1629 +#: ../../library/asyncio-eventloop.rst:1645 msgid "" "Stop serving: close listening sockets and set the :attr:`sockets` attribute " "to ``None``." msgstr "停止服務:關閉監聽的 sockets 並將 :attr:`sockets` 屬性設為 ``None``。" -#: ../../library/asyncio-eventloop.rst:1632 +#: ../../library/asyncio-eventloop.rst:1648 msgid "" "The sockets that represent existing incoming client connections are left " "open." msgstr "代表現有傳入用戶端連線的 sockets 仍然保持開啟。" -#: ../../library/asyncio-eventloop.rst:1635 +#: ../../library/asyncio-eventloop.rst:1651 msgid "" "The server is closed asynchronously; use the :meth:`wait_closed` coroutine " "to wait until the server is closed (and no more connections are active)." @@ -2480,21 +2503,54 @@ msgstr "" "伺服器以非同步方式關閉;使用 :meth:`wait_close` 協程等待伺服器關閉(不再有活" "躍連線)。" -#: ../../library/asyncio-eventloop.rst:1641 +#: ../../library/asyncio-eventloop.rst:1657 +#, fuzzy +msgid "Close all existing incoming client connections." +msgstr "代表現有傳入用戶端連線的 sockets 仍然保持開啟。" + +#: ../../library/asyncio-eventloop.rst:1659 +msgid "" +"Calls :meth:`~asyncio.BaseTransport.close` on all associated transports." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1662 +msgid "" +":meth:`close` should be called before :meth:`close_clients` when closing the " +"server to avoid races with new clients connecting." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1669 +msgid "" +"Close all existing incoming client connections immediately, without waiting " +"for pending operations to complete." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1672 +msgid "" +"Calls :meth:`~asyncio.WriteTransport.abort` on all associated transports." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1675 +msgid "" +":meth:`close` should be called before :meth:`abort_clients` when closing the " +"server to avoid races with new clients connecting." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1682 msgid "Return the event loop associated with the server object." msgstr "回傳與伺服器物件關聯的事件迴圈。" -#: ../../library/asyncio-eventloop.rst:1647 +#: ../../library/asyncio-eventloop.rst:1688 msgid "Start accepting connections." msgstr "開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1649 +#: ../../library/asyncio-eventloop.rst:1690 msgid "" "This method is idempotent, so it can be called when the server is already " "serving." msgstr "此方法是幂等的,因此可以在伺服器已經運行時呼叫。" -#: ../../library/asyncio-eventloop.rst:1652 +#: ../../library/asyncio-eventloop.rst:1693 msgid "" "The *start_serving* keyword-only parameter to :meth:`loop.create_server` " "and :meth:`asyncio.start_server` allows creating a Server object that is not " @@ -2507,14 +2563,14 @@ msgstr "" "種情況下,可以使用 ``Server.start_serving()`` 或 :meth:`Server." "serve_forever` 來使 Server 開始接受連線。" -#: ../../library/asyncio-eventloop.rst:1663 +#: ../../library/asyncio-eventloop.rst:1704 msgid "" "Start accepting connections until the coroutine is cancelled. Cancellation " "of ``serve_forever`` task causes the server to be closed." msgstr "" "開始接受連線,直到協程被取消。取消 ``serve_forever`` 任務會導致伺服器關閉。" -#: ../../library/asyncio-eventloop.rst:1667 +#: ../../library/asyncio-eventloop.rst:1708 msgid "" "This method can be called if the server is already accepting connections. " "Only one ``serve_forever`` task can exist per one *Server* object." @@ -2522,7 +2578,7 @@ msgstr "" "如果伺服器已經接受連線,則可以呼叫此方法。每個 *Server* 物件只能存在一個 " "``serve_forever`` 任務。" -#: ../../library/asyncio-eventloop.rst:1673 +#: ../../library/asyncio-eventloop.rst:1714 msgid "" "async def client_connected(reader, writer):\n" " # Communicate with the client with\n" @@ -2537,24 +2593,24 @@ msgid "" "asyncio.run(main('127.0.0.1', 0))" msgstr "" -#: ../../library/asyncio-eventloop.rst:1689 +#: ../../library/asyncio-eventloop.rst:1730 msgid "Return ``True`` if the server is accepting new connections." msgstr "如果伺服器正在接受新連線,則回傳 ``True``。" -#: ../../library/asyncio-eventloop.rst:1695 +#: ../../library/asyncio-eventloop.rst:1736 msgid "" "Wait until the :meth:`close` method completes and all active connections " "have finished." msgstr "等待 :meth:`close` 方法完成且所有活動連線都已結束。" -#: ../../library/asyncio-eventloop.rst:1700 +#: ../../library/asyncio-eventloop.rst:1741 msgid "" "List of socket-like objects, ``asyncio.trsock.TransportSocket``, which the " "server is listening on." msgstr "" "伺服器正在監聽的類似 socket 的物件串列,``asyncio.trsock.TransportSocket``。" -#: ../../library/asyncio-eventloop.rst:1703 +#: ../../library/asyncio-eventloop.rst:1744 msgid "" "Prior to Python 3.7 ``Server.sockets`` used to return an internal list of " "server sockets directly. In 3.7 a copy of that list is returned." @@ -2562,11 +2618,11 @@ msgstr "" "在 Python 3.7 之前,``Server.sockets`` 曾經直接回傳內部伺服器 sockets 的串" "列。在 3.7 中回傳了該串列的副本。" -#: ../../library/asyncio-eventloop.rst:1713 +#: ../../library/asyncio-eventloop.rst:1754 msgid "Event Loop Implementations" msgstr "事件迴圈實作" -#: ../../library/asyncio-eventloop.rst:1715 +#: ../../library/asyncio-eventloop.rst:1756 msgid "" "asyncio ships with two different event loop implementations: :class:" "`SelectorEventLoop` and :class:`ProactorEventLoop`." @@ -2574,19 +2630,21 @@ msgstr "" "asyncio 內附兩個不同的事件迴圈實作::class:`SelectorEventLoop` 和 :class:" "`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1718 -msgid "" -"By default asyncio is configured to use :class:`SelectorEventLoop` on Unix " -"and :class:`ProactorEventLoop` on Windows." +#: ../../library/asyncio-eventloop.rst:1759 +#, fuzzy +msgid "By default asyncio is configured to use :class:`EventLoop`." msgstr "" "預設情況下,asyncio 配置為在 Unix 上使用 :class:`SelectorEventLoop`,在 " "Windows 上使用 :class:`ProactorEventLoop`。" -#: ../../library/asyncio-eventloop.rst:1724 -msgid "An event loop based on the :mod:`selectors` module." +#: ../../library/asyncio-eventloop.rst:1764 +#, fuzzy +msgid "" +"A subclass of :class:`AbstractEventLoop` based on the :mod:`selectors` " +"module." msgstr "基於 :mod:`selectors` 模組的事件迴圈。" -#: ../../library/asyncio-eventloop.rst:1726 +#: ../../library/asyncio-eventloop.rst:1767 msgid "" "Uses the most efficient *selector* available for the given platform. It is " "also possible to manually configure the exact selector implementation to be " @@ -2595,7 +2653,7 @@ msgstr "" "使用特定平台上最有效的 *selector*。也可以手動配置要使用的確切 selector 實" "作: ::" -#: ../../library/asyncio-eventloop.rst:1730 +#: ../../library/asyncio-eventloop.rst:1771 msgid "" "import asyncio\n" "import selectors\n" @@ -2617,19 +2675,22 @@ msgstr "" "\n" "asyncio.set_event_loop_policy(MyPolicy())" -#: ../../library/asyncio-eventloop.rst:1741 +#: ../../library/asyncio-eventloop.rst:1782 msgid ":ref:`Availability `: Unix, Windows." msgstr ":ref:`適用 `:Unix、Windows。" -#: ../../library/asyncio-eventloop.rst:1746 -msgid "An event loop for Windows that uses \"I/O Completion Ports\" (IOCP)." +#: ../../library/asyncio-eventloop.rst:1787 +#, fuzzy +msgid "" +"A subclass of :class:`AbstractEventLoop` for Windows that uses \"I/O " +"Completion Ports\" (IOCP)." msgstr "用於 Windows 的事件迴圈,使用\"I/O 完成埠\"(IOCP)。" -#: ../../library/asyncio-eventloop.rst:1748 +#: ../../library/asyncio-eventloop.rst:1789 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/asyncio-eventloop.rst:1752 +#: ../../library/asyncio-eventloop.rst:1793 msgid "" "`MSDN documentation on I/O Completion Ports `_." @@ -2637,11 +2698,26 @@ msgstr "" "`I/O 完成埠(I/O Completion Ports)的 MSDN 文件 `_。" -#: ../../library/asyncio-eventloop.rst:1758 +#: ../../library/asyncio-eventloop.rst:1798 +msgid "" +"An alias to the most efficient available subclass of :class:" +"`AbstractEventLoop` for the given platform." +msgstr "" + +#: ../../library/asyncio-eventloop.rst:1801 +#, fuzzy +msgid "" +"It is an alias to :class:`SelectorEventLoop` on Unix and :class:" +"`ProactorEventLoop` on Windows." +msgstr "" +"預設情況下,asyncio 配置為在 Unix 上使用 :class:`SelectorEventLoop`,在 " +"Windows 上使用 :class:`ProactorEventLoop`。" + +#: ../../library/asyncio-eventloop.rst:1807 msgid "Abstract base class for asyncio-compliant event loops." msgstr "為符合 asyncio 標準的事件迴圈的抽象基礎類別。" -#: ../../library/asyncio-eventloop.rst:1760 +#: ../../library/asyncio-eventloop.rst:1809 msgid "" "The :ref:`asyncio-event-loop-methods` section lists all methods that an " "alternative implementation of ``AbstractEventLoop`` should have defined." @@ -2649,11 +2725,11 @@ msgstr "" ":ref:`asyncio-event-loop-methods` 部分列出了替代 ``AbstractEventLoop`` 實作應" "該定義的所有方法。" -#: ../../library/asyncio-eventloop.rst:1766 +#: ../../library/asyncio-eventloop.rst:1815 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-eventloop.rst:1768 +#: ../../library/asyncio-eventloop.rst:1817 msgid "" "Note that all examples in this section **purposefully** show how to use the " "low-level event loop APIs, such as :meth:`loop.run_forever` and :meth:`loop." @@ -2664,11 +2740,11 @@ msgstr "" "`loop.run_forever` 和 :meth:`loop.call_soon`。現代 asyncio 應用程式很少需要這" "種方式撰寫;請考慮使用高階的函式,如 :func:`asyncio.run`。" -#: ../../library/asyncio-eventloop.rst:1778 +#: ../../library/asyncio-eventloop.rst:1827 msgid "Hello World with call_soon()" msgstr "使用 call_soon() 的 Hello World 範例" -#: ../../library/asyncio-eventloop.rst:1780 +#: ../../library/asyncio-eventloop.rst:1829 msgid "" "An example using the :meth:`loop.call_soon` method to schedule a callback. " "The callback displays ``\"Hello World\"`` and then stops the event loop::" @@ -2676,7 +2752,7 @@ msgstr "" "使用 :meth:`loop.call_soon` 方法排程回呼的範例。回呼會顯示 ``\"Hello " "World\"``,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1784 +#: ../../library/asyncio-eventloop.rst:1833 msgid "" "import asyncio\n" "\n" @@ -2697,18 +2773,18 @@ msgid "" " loop.close()" msgstr "" -#: ../../library/asyncio-eventloop.rst:1804 +#: ../../library/asyncio-eventloop.rst:1853 msgid "" "A similar :ref:`Hello World ` example created with a coroutine " "and the :func:`run` function." msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`Hello World ` 範例。" -#: ../../library/asyncio-eventloop.rst:1811 +#: ../../library/asyncio-eventloop.rst:1860 msgid "Display the current date with call_later()" msgstr "使用 call_later() 顯示目前日期" -#: ../../library/asyncio-eventloop.rst:1813 +#: ../../library/asyncio-eventloop.rst:1862 msgid "" "An example of a callback displaying the current date every second. The " "callback uses the :meth:`loop.call_later` method to reschedule itself after " @@ -2717,7 +2793,7 @@ msgstr "" "一個回呼的範例,每秒顯示目前日期。回呼使用 :meth:`loop.call_later` 方法在 5 " "秒後重新排程自己,然後停止事件迴圈: ::" -#: ../../library/asyncio-eventloop.rst:1817 +#: ../../library/asyncio-eventloop.rst:1866 msgid "" "import asyncio\n" "import datetime\n" @@ -2742,7 +2818,7 @@ msgid "" " loop.close()" msgstr "" -#: ../../library/asyncio-eventloop.rst:1841 +#: ../../library/asyncio-eventloop.rst:1890 msgid "" "A similar :ref:`current date ` example created with a " "coroutine and the :func:`run` function." @@ -2750,11 +2826,11 @@ msgstr "" "使用協程和 :func:`run` 函式建立的類似 :ref:`current date " "` 範例。" -#: ../../library/asyncio-eventloop.rst:1848 +#: ../../library/asyncio-eventloop.rst:1897 msgid "Watch a file descriptor for read events" msgstr "監聽檔案描述器以進行讀取事件" -#: ../../library/asyncio-eventloop.rst:1850 +#: ../../library/asyncio-eventloop.rst:1899 msgid "" "Wait until a file descriptor received some data using the :meth:`loop." "add_reader` method and then close the event loop::" @@ -2762,7 +2838,7 @@ msgstr "" "使用 :meth:`loop.add_reader` 方法等待檔案描述器接收到某些資料,然後關閉事件迴" "圈: ::" -#: ../../library/asyncio-eventloop.rst:1853 +#: ../../library/asyncio-eventloop.rst:1902 msgid "" "import asyncio\n" "from socket import socketpair\n" @@ -2798,7 +2874,7 @@ msgid "" " loop.close()" msgstr "" -#: ../../library/asyncio-eventloop.rst:1888 +#: ../../library/asyncio-eventloop.rst:1937 msgid "" "A similar :ref:`example ` using " "transports, protocols, and the :meth:`loop.create_connection` method." @@ -2806,7 +2882,7 @@ msgstr "" "使用傳輸、協定和 :meth:`loop.create_connection` 方法的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:1892 +#: ../../library/asyncio-eventloop.rst:1941 msgid "" "Another similar :ref:`example ` " "using the high-level :func:`asyncio.open_connection` function and streams." @@ -2814,15 +2890,15 @@ msgstr "" "另一個使用高階 :func:`asyncio.open_connection` 函式和串流的類似 :ref:`範例 " "`。" -#: ../../library/asyncio-eventloop.rst:1900 +#: ../../library/asyncio-eventloop.rst:1949 msgid "Set signal handlers for SIGINT and SIGTERM" msgstr "設定 SIGINT 和 SIGTERM 的訊號處理程式" -#: ../../library/asyncio-eventloop.rst:1902 +#: ../../library/asyncio-eventloop.rst:1951 msgid "(This ``signals`` example only works on Unix.)" msgstr "(此 ``signals`` 範例僅在 Unix 上運作。)" -#: ../../library/asyncio-eventloop.rst:1904 +#: ../../library/asyncio-eventloop.rst:1953 msgid "" "Register handlers for signals :const:`~signal.SIGINT` and :const:`~signal." "SIGTERM` using the :meth:`loop.add_signal_handler` method::" @@ -2830,7 +2906,7 @@ msgstr "" "使用 :meth:`loop.add_signal_handler` 方法註冊訊號 :py:data:`SIGINT` 和 :py:" "data:`SIGTERM` 的處理程式: ::" -#: ../../library/asyncio-eventloop.rst:1907 +#: ../../library/asyncio-eventloop.rst:1956 msgid "" "import asyncio\n" "import functools\n" diff --git a/library/asyncio-exceptions.po b/library/asyncio-exceptions.po index edf7cb0316..e08327656e 100644 --- a/library/asyncio-exceptions.po +++ b/library/asyncio-exceptions.po @@ -6,7 +6,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-06 00:19+0000\n" "PO-Revision-Date: 2022-01-31 21:41+0800\n" diff --git a/library/asyncio-extending.po b/library/asyncio-extending.po index 630ff63a24..506947aa5f 100644 --- a/library/asyncio-extending.po +++ b/library/asyncio-extending.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 10:36+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/asyncio-future.po b/library/asyncio-future.po index fb7a7be464..b208eeee6a 100644 --- a/library/asyncio-future.po +++ b/library/asyncio-future.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-01-25 01:29+0800\n" diff --git a/library/asyncio-llapi-index.po b/library/asyncio-llapi-index.po index 8cd2352ae1..ad64842802 100644 --- a/library/asyncio-llapi-index.po +++ b/library/asyncio-llapi-index.po @@ -6,7 +6,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-10-11 17:13+0000\n" "PO-Revision-Date: 2023-10-12 11:27+0800\n" diff --git a/library/asyncio-platforms.po b/library/asyncio-platforms.po index 9d39d00beb..cc9f8570c6 100644 --- a/library/asyncio-platforms.po +++ b/library/asyncio-platforms.po @@ -8,7 +8,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-01-17 11:37+0800\n" diff --git a/library/asyncio-policy.po b/library/asyncio-policy.po index 3902da6867..78b1176d70 100644 --- a/library/asyncio-policy.po +++ b/library/asyncio-policy.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/asyncio-protocol.po b/library/asyncio-protocol.po index 58e37add6f..9b58685f3e 100644 --- a/library/asyncio-protocol.po +++ b/library/asyncio-protocol.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -501,7 +501,14 @@ msgid "" "the target address given on transport creation." msgstr "" -#: ../../library/asyncio-protocol.rst:367 +#: ../../library/asyncio-protocol.rst:365 +msgid "" +"This method can be called with an empty bytes object to send a zero-length " +"datagram. The buffer size calculation used for flow control is also updated " +"to account for the datagram header." +msgstr "" + +#: ../../library/asyncio-protocol.rst:372 msgid "" "Close the transport immediately, without waiting for pending operations to " "complete. Buffered data will be lost. No more data will be received. The " @@ -509,110 +516,110 @@ msgid "" "method will eventually be called with :const:`None` as its argument." msgstr "" -#: ../../library/asyncio-protocol.rst:377 +#: ../../library/asyncio-protocol.rst:382 msgid "Subprocess Transports" msgstr "" -#: ../../library/asyncio-protocol.rst:381 +#: ../../library/asyncio-protocol.rst:386 msgid "Return the subprocess process id as an integer." msgstr "" -#: ../../library/asyncio-protocol.rst:385 +#: ../../library/asyncio-protocol.rst:390 msgid "" "Return the transport for the communication pipe corresponding to the integer " "file descriptor *fd*:" msgstr "" -#: ../../library/asyncio-protocol.rst:388 +#: ../../library/asyncio-protocol.rst:393 msgid "" "``0``: readable streaming transport of the standard input (*stdin*), or :" "const:`None` if the subprocess was not created with ``stdin=PIPE``" msgstr "" -#: ../../library/asyncio-protocol.rst:390 +#: ../../library/asyncio-protocol.rst:395 msgid "" "``1``: writable streaming transport of the standard output (*stdout*), or :" "const:`None` if the subprocess was not created with ``stdout=PIPE``" msgstr "" -#: ../../library/asyncio-protocol.rst:392 +#: ../../library/asyncio-protocol.rst:397 msgid "" "``2``: writable streaming transport of the standard error (*stderr*), or :" "const:`None` if the subprocess was not created with ``stderr=PIPE``" msgstr "" -#: ../../library/asyncio-protocol.rst:394 +#: ../../library/asyncio-protocol.rst:399 msgid "other *fd*: :const:`None`" msgstr "" -#: ../../library/asyncio-protocol.rst:398 +#: ../../library/asyncio-protocol.rst:403 msgid "" "Return the subprocess return code as an integer or :const:`None` if it " "hasn't returned, which is similar to the :attr:`subprocess.Popen.returncode` " "attribute." msgstr "" -#: ../../library/asyncio-protocol.rst:404 +#: ../../library/asyncio-protocol.rst:409 msgid "Kill the subprocess." msgstr "" -#: ../../library/asyncio-protocol.rst:406 +#: ../../library/asyncio-protocol.rst:411 msgid "" "On POSIX systems, the function sends SIGKILL to the subprocess. On Windows, " "this method is an alias for :meth:`terminate`." msgstr "" -#: ../../library/asyncio-protocol.rst:409 +#: ../../library/asyncio-protocol.rst:414 msgid "See also :meth:`subprocess.Popen.kill`." msgstr "另請參閱 :meth:`subprocess.Popen.kill`。" -#: ../../library/asyncio-protocol.rst:413 +#: ../../library/asyncio-protocol.rst:418 msgid "" "Send the *signal* number to the subprocess, as in :meth:`subprocess.Popen." "send_signal`." msgstr "" -#: ../../library/asyncio-protocol.rst:418 +#: ../../library/asyncio-protocol.rst:423 msgid "Stop the subprocess." msgstr "" -#: ../../library/asyncio-protocol.rst:420 +#: ../../library/asyncio-protocol.rst:425 msgid "" "On POSIX systems, this method sends :py:const:`~signal.SIGTERM` to the " "subprocess. On Windows, the Windows API function :c:func:`!TerminateProcess` " "is called to stop the subprocess." msgstr "" -#: ../../library/asyncio-protocol.rst:424 +#: ../../library/asyncio-protocol.rst:429 msgid "See also :meth:`subprocess.Popen.terminate`." msgstr "另請參閱 :meth:`subprocess.Popen.terminate`。" -#: ../../library/asyncio-protocol.rst:428 +#: ../../library/asyncio-protocol.rst:433 msgid "Kill the subprocess by calling the :meth:`kill` method." msgstr "" -#: ../../library/asyncio-protocol.rst:430 +#: ../../library/asyncio-protocol.rst:435 msgid "" "If the subprocess hasn't returned yet, and close transports of *stdin*, " "*stdout*, and *stderr* pipes." msgstr "" -#: ../../library/asyncio-protocol.rst:437 +#: ../../library/asyncio-protocol.rst:442 msgid "Protocols" msgstr "" -#: ../../library/asyncio-protocol.rst:439 +#: ../../library/asyncio-protocol.rst:444 msgid "**Source code:** :source:`Lib/asyncio/protocols.py`" msgstr "**原始碼:**\\ :source:`Lib/asyncio/protocols.py`" -#: ../../library/asyncio-protocol.rst:443 +#: ../../library/asyncio-protocol.rst:448 msgid "" "asyncio provides a set of abstract base classes that should be used to " "implement network protocols. Those classes are meant to be used together " "with :ref:`transports `." msgstr "" -#: ../../library/asyncio-protocol.rst:447 +#: ../../library/asyncio-protocol.rst:452 msgid "" "Subclasses of abstract base protocol classes may implement some or all " "methods. All these methods are callbacks: they are called by transports on " @@ -620,117 +627,117 @@ msgid "" "method should be called by the corresponding transport." msgstr "" -#: ../../library/asyncio-protocol.rst:454 +#: ../../library/asyncio-protocol.rst:459 msgid "Base Protocols" msgstr "" -#: ../../library/asyncio-protocol.rst:458 +#: ../../library/asyncio-protocol.rst:463 msgid "Base protocol with methods that all protocols share." msgstr "" -#: ../../library/asyncio-protocol.rst:462 +#: ../../library/asyncio-protocol.rst:467 msgid "" "The base class for implementing streaming protocols (TCP, Unix sockets, etc)." msgstr "" -#: ../../library/asyncio-protocol.rst:467 +#: ../../library/asyncio-protocol.rst:472 msgid "" "A base class for implementing streaming protocols with manual control of the " "receive buffer." msgstr "" -#: ../../library/asyncio-protocol.rst:472 +#: ../../library/asyncio-protocol.rst:477 msgid "The base class for implementing datagram (UDP) protocols." msgstr "" -#: ../../library/asyncio-protocol.rst:476 +#: ../../library/asyncio-protocol.rst:481 msgid "" "The base class for implementing protocols communicating with child processes " "(unidirectional pipes)." msgstr "" -#: ../../library/asyncio-protocol.rst:481 +#: ../../library/asyncio-protocol.rst:486 msgid "Base Protocol" msgstr "" -#: ../../library/asyncio-protocol.rst:483 +#: ../../library/asyncio-protocol.rst:488 msgid "All asyncio protocols can implement Base Protocol callbacks." msgstr "" -#: ../../library/asyncio-protocol.rst:486 +#: ../../library/asyncio-protocol.rst:491 msgid "Connection Callbacks" msgstr "" -#: ../../library/asyncio-protocol.rst:487 +#: ../../library/asyncio-protocol.rst:492 msgid "" "Connection callbacks are called on all protocols, exactly once per a " "successful connection. All other protocol callbacks can only be called " "between those two methods." msgstr "" -#: ../../library/asyncio-protocol.rst:493 +#: ../../library/asyncio-protocol.rst:498 msgid "Called when a connection is made." msgstr "" -#: ../../library/asyncio-protocol.rst:495 +#: ../../library/asyncio-protocol.rst:500 msgid "" "The *transport* argument is the transport representing the connection. The " "protocol is responsible for storing the reference to its transport." msgstr "" -#: ../../library/asyncio-protocol.rst:501 +#: ../../library/asyncio-protocol.rst:506 msgid "Called when the connection is lost or closed." msgstr "" -#: ../../library/asyncio-protocol.rst:503 +#: ../../library/asyncio-protocol.rst:508 msgid "" "The argument is either an exception object or :const:`None`. The latter " "means a regular EOF is received, or the connection was aborted or closed by " "this side of the connection." msgstr "" -#: ../../library/asyncio-protocol.rst:509 +#: ../../library/asyncio-protocol.rst:514 msgid "Flow Control Callbacks" msgstr "" -#: ../../library/asyncio-protocol.rst:510 +#: ../../library/asyncio-protocol.rst:515 msgid "" "Flow control callbacks can be called by transports to pause or resume " "writing performed by the protocol." msgstr "" -#: ../../library/asyncio-protocol.rst:513 +#: ../../library/asyncio-protocol.rst:518 msgid "" "See the documentation of the :meth:`~WriteTransport.set_write_buffer_limits` " "method for more details." msgstr "" -#: ../../library/asyncio-protocol.rst:518 +#: ../../library/asyncio-protocol.rst:523 msgid "Called when the transport's buffer goes over the high watermark." msgstr "" -#: ../../library/asyncio-protocol.rst:522 +#: ../../library/asyncio-protocol.rst:527 msgid "Called when the transport's buffer drains below the low watermark." msgstr "" -#: ../../library/asyncio-protocol.rst:524 +#: ../../library/asyncio-protocol.rst:529 msgid "" "If the buffer size equals the high watermark, :meth:`~BaseProtocol." "pause_writing` is not called: the buffer size must go strictly over." msgstr "" -#: ../../library/asyncio-protocol.rst:528 +#: ../../library/asyncio-protocol.rst:533 msgid "" "Conversely, :meth:`~BaseProtocol.resume_writing` is called when the buffer " "size is equal or lower than the low watermark. These end conditions are " "important to ensure that things go as expected when either mark is zero." msgstr "" -#: ../../library/asyncio-protocol.rst:535 +#: ../../library/asyncio-protocol.rst:540 msgid "Streaming Protocols" msgstr "" -#: ../../library/asyncio-protocol.rst:537 +#: ../../library/asyncio-protocol.rst:542 msgid "" "Event methods, such as :meth:`loop.create_server`, :meth:`loop." "create_unix_server`, :meth:`loop.create_connection`, :meth:`loop." @@ -739,13 +746,13 @@ msgid "" "that return streaming protocols." msgstr "" -#: ../../library/asyncio-protocol.rst:545 +#: ../../library/asyncio-protocol.rst:550 msgid "" "Called when some data is received. *data* is a non-empty bytes object " "containing the incoming data." msgstr "" -#: ../../library/asyncio-protocol.rst:548 +#: ../../library/asyncio-protocol.rst:553 msgid "" "Whether the data is buffered, chunked or reassembled depends on the " "transport. In general, you shouldn't rely on specific semantics and instead " @@ -753,27 +760,27 @@ msgid "" "the correct order." msgstr "" -#: ../../library/asyncio-protocol.rst:553 +#: ../../library/asyncio-protocol.rst:558 msgid "" "The method can be called an arbitrary number of times while a connection is " "open." msgstr "" -#: ../../library/asyncio-protocol.rst:556 +#: ../../library/asyncio-protocol.rst:561 msgid "" "However, :meth:`protocol.eof_received() ` is called " "at most once. Once ``eof_received()`` is called, ``data_received()`` is not " "called anymore." msgstr "" -#: ../../library/asyncio-protocol.rst:562 +#: ../../library/asyncio-protocol.rst:567 msgid "" "Called when the other end signals it won't send any more data (for example " "by calling :meth:`transport.write_eof() `, if the " "other end also uses asyncio)." msgstr "" -#: ../../library/asyncio-protocol.rst:567 +#: ../../library/asyncio-protocol.rst:572 msgid "" "This method may return a false value (including ``None``), in which case the " "transport will close itself. Conversely, if this method returns a true " @@ -782,19 +789,19 @@ msgid "" "connection." msgstr "" -#: ../../library/asyncio-protocol.rst:573 +#: ../../library/asyncio-protocol.rst:578 msgid "" "Some transports, including SSL, don't support half-closed connections, in " "which case returning true from this method will result in the connection " "being closed." msgstr "" -#: ../../library/asyncio-protocol.rst:578 -#: ../../library/asyncio-protocol.rst:636 +#: ../../library/asyncio-protocol.rst:583 +#: ../../library/asyncio-protocol.rst:641 msgid "State machine:" msgstr "" -#: ../../library/asyncio-protocol.rst:580 +#: ../../library/asyncio-protocol.rst:585 msgid "" "start -> connection_made\n" " [-> data_received]*\n" @@ -806,17 +813,17 @@ msgstr "" " [-> eof_received]?\n" "-> connection_lost -> end" -#: ../../library/asyncio-protocol.rst:589 +#: ../../library/asyncio-protocol.rst:594 msgid "Buffered Streaming Protocols" msgstr "" -#: ../../library/asyncio-protocol.rst:593 +#: ../../library/asyncio-protocol.rst:598 msgid "" "Buffered Protocols can be used with any event loop method that supports " "`Streaming Protocols`_." msgstr "" -#: ../../library/asyncio-protocol.rst:596 +#: ../../library/asyncio-protocol.rst:601 msgid "" "``BufferedProtocol`` implementations allow explicit manual allocation and " "control of the receive buffer. Event loops can then use the buffer provided " @@ -826,16 +833,16 @@ msgid "" "number of buffer allocations." msgstr "" -#: ../../library/asyncio-protocol.rst:603 +#: ../../library/asyncio-protocol.rst:608 msgid "" "The following callbacks are called on :class:`BufferedProtocol` instances:" msgstr "" -#: ../../library/asyncio-protocol.rst:608 +#: ../../library/asyncio-protocol.rst:613 msgid "Called to allocate a new receive buffer." msgstr "" -#: ../../library/asyncio-protocol.rst:610 +#: ../../library/asyncio-protocol.rst:615 msgid "" "*sizehint* is the recommended minimum size for the returned buffer. It is " "acceptable to return smaller or larger buffers than what *sizehint* " @@ -843,27 +850,27 @@ msgid "" "to return a buffer with a zero size." msgstr "" -#: ../../library/asyncio-protocol.rst:615 +#: ../../library/asyncio-protocol.rst:620 msgid "" "``get_buffer()`` must return an object implementing the :ref:`buffer " "protocol `." msgstr "" -#: ../../library/asyncio-protocol.rst:620 +#: ../../library/asyncio-protocol.rst:625 msgid "Called when the buffer was updated with the received data." msgstr "" -#: ../../library/asyncio-protocol.rst:622 +#: ../../library/asyncio-protocol.rst:627 msgid "*nbytes* is the total number of bytes that were written to the buffer." msgstr "" -#: ../../library/asyncio-protocol.rst:626 +#: ../../library/asyncio-protocol.rst:631 msgid "" "See the documentation of the :meth:`protocol.eof_received() ` method." msgstr "" -#: ../../library/asyncio-protocol.rst:630 +#: ../../library/asyncio-protocol.rst:635 msgid "" ":meth:`~BufferedProtocol.get_buffer` can be called an arbitrary number of " "times during a connection. However, :meth:`protocol.eof_received() " @@ -872,7 +879,7 @@ msgid "" "won't be called after it." msgstr "" -#: ../../library/asyncio-protocol.rst:638 +#: ../../library/asyncio-protocol.rst:643 msgid "" "start -> connection_made\n" " [-> get_buffer\n" @@ -888,44 +895,44 @@ msgstr "" " [-> eof_received]?\n" "-> connection_lost -> end" -#: ../../library/asyncio-protocol.rst:649 +#: ../../library/asyncio-protocol.rst:654 msgid "Datagram Protocols" msgstr "" -#: ../../library/asyncio-protocol.rst:651 +#: ../../library/asyncio-protocol.rst:656 msgid "" "Datagram Protocol instances should be constructed by protocol factories " "passed to the :meth:`loop.create_datagram_endpoint` method." msgstr "" -#: ../../library/asyncio-protocol.rst:656 +#: ../../library/asyncio-protocol.rst:661 msgid "" "Called when a datagram is received. *data* is a bytes object containing the " "incoming data. *addr* is the address of the peer sending the data; the " "exact format depends on the transport." msgstr "" -#: ../../library/asyncio-protocol.rst:662 +#: ../../library/asyncio-protocol.rst:667 msgid "" "Called when a previous send or receive operation raises an :class:" "`OSError`. *exc* is the :class:`OSError` instance." msgstr "" -#: ../../library/asyncio-protocol.rst:665 +#: ../../library/asyncio-protocol.rst:670 msgid "" "This method is called in rare conditions, when the transport (e.g. UDP) " "detects that a datagram could not be delivered to its recipient. In many " "conditions though, undeliverable datagrams will be silently dropped." msgstr "" -#: ../../library/asyncio-protocol.rst:672 +#: ../../library/asyncio-protocol.rst:677 msgid "" "On BSD systems (macOS, FreeBSD, etc.) flow control is not supported for " "datagram protocols, because there is no reliable way to detect send failures " "caused by writing too many packets." msgstr "" -#: ../../library/asyncio-protocol.rst:676 +#: ../../library/asyncio-protocol.rst:681 msgid "" "The socket always appears 'ready' and excess packets are dropped. An :class:" "`OSError` with ``errno`` set to :const:`errno.ENOBUFS` may or may not be " @@ -933,64 +940,64 @@ msgid "" "error_received` but otherwise ignored." msgstr "" -#: ../../library/asyncio-protocol.rst:685 +#: ../../library/asyncio-protocol.rst:690 msgid "Subprocess Protocols" msgstr "" -#: ../../library/asyncio-protocol.rst:687 +#: ../../library/asyncio-protocol.rst:692 msgid "" "Subprocess Protocol instances should be constructed by protocol factories " "passed to the :meth:`loop.subprocess_exec` and :meth:`loop.subprocess_shell` " "methods." msgstr "" -#: ../../library/asyncio-protocol.rst:693 +#: ../../library/asyncio-protocol.rst:698 msgid "" "Called when the child process writes data into its stdout or stderr pipe." msgstr "" -#: ../../library/asyncio-protocol.rst:696 +#: ../../library/asyncio-protocol.rst:701 msgid "*fd* is the integer file descriptor of the pipe." msgstr "" -#: ../../library/asyncio-protocol.rst:698 +#: ../../library/asyncio-protocol.rst:703 msgid "*data* is a non-empty bytes object containing the received data." msgstr "" -#: ../../library/asyncio-protocol.rst:702 +#: ../../library/asyncio-protocol.rst:707 msgid "" "Called when one of the pipes communicating with the child process is closed." msgstr "" -#: ../../library/asyncio-protocol.rst:705 +#: ../../library/asyncio-protocol.rst:710 msgid "*fd* is the integer file descriptor that was closed." msgstr "" -#: ../../library/asyncio-protocol.rst:709 +#: ../../library/asyncio-protocol.rst:714 msgid "Called when the child process has exited." msgstr "" -#: ../../library/asyncio-protocol.rst:711 +#: ../../library/asyncio-protocol.rst:716 msgid "" "It can be called before :meth:`~SubprocessProtocol.pipe_data_received` and :" "meth:`~SubprocessProtocol.pipe_connection_lost` methods." msgstr "" -#: ../../library/asyncio-protocol.rst:716 +#: ../../library/asyncio-protocol.rst:721 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-protocol.rst:721 +#: ../../library/asyncio-protocol.rst:726 msgid "TCP Echo Server" msgstr "" -#: ../../library/asyncio-protocol.rst:723 +#: ../../library/asyncio-protocol.rst:728 msgid "" "Create a TCP echo server using the :meth:`loop.create_server` method, send " "back received data, and close the connection::" msgstr "" -#: ../../library/asyncio-protocol.rst:726 +#: ../../library/asyncio-protocol.rst:731 msgid "" "import asyncio\n" "\n" @@ -1018,7 +1025,7 @@ msgid "" " loop = asyncio.get_running_loop()\n" "\n" " server = await loop.create_server(\n" -" lambda: EchoServerProtocol(),\n" +" EchoServerProtocol,\n" " '127.0.0.1', 8888)\n" "\n" " async with server:\n" @@ -1028,23 +1035,23 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-protocol.rst:764 +#: ../../library/asyncio-protocol.rst:769 msgid "" "The :ref:`TCP echo server using streams ` " "example uses the high-level :func:`asyncio.start_server` function." msgstr "" -#: ../../library/asyncio-protocol.rst:770 +#: ../../library/asyncio-protocol.rst:775 msgid "TCP Echo Client" msgstr "" -#: ../../library/asyncio-protocol.rst:772 +#: ../../library/asyncio-protocol.rst:777 msgid "" "A TCP echo client using the :meth:`loop.create_connection` method, sends " "data, and waits until the connection is closed::" msgstr "" -#: ../../library/asyncio-protocol.rst:775 +#: ../../library/asyncio-protocol.rst:780 msgid "" "import asyncio\n" "\n" @@ -1089,23 +1096,23 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-protocol.rst:820 +#: ../../library/asyncio-protocol.rst:825 msgid "" "The :ref:`TCP echo client using streams ` " "example uses the high-level :func:`asyncio.open_connection` function." msgstr "" -#: ../../library/asyncio-protocol.rst:827 +#: ../../library/asyncio-protocol.rst:832 msgid "UDP Echo Server" msgstr "" -#: ../../library/asyncio-protocol.rst:829 +#: ../../library/asyncio-protocol.rst:834 msgid "" "A UDP echo server, using the :meth:`loop.create_datagram_endpoint` method, " "sends back received data::" msgstr "" -#: ../../library/asyncio-protocol.rst:832 +#: ../../library/asyncio-protocol.rst:837 msgid "" "import asyncio\n" "\n" @@ -1131,7 +1138,7 @@ msgid "" " # One protocol instance will be created to serve all\n" " # client requests.\n" " transport, protocol = await loop.create_datagram_endpoint(\n" -" lambda: EchoServerProtocol(),\n" +" EchoServerProtocol,\n" " local_addr=('127.0.0.1', 9999))\n" "\n" " try:\n" @@ -1143,17 +1150,17 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-protocol.rst:871 +#: ../../library/asyncio-protocol.rst:876 msgid "UDP Echo Client" msgstr "" -#: ../../library/asyncio-protocol.rst:873 +#: ../../library/asyncio-protocol.rst:878 msgid "" "A UDP echo client, using the :meth:`loop.create_datagram_endpoint` method, " "sends data and closes the transport when it receives the answer::" msgstr "" -#: ../../library/asyncio-protocol.rst:876 +#: ../../library/asyncio-protocol.rst:881 msgid "" "import asyncio\n" "\n" @@ -1204,17 +1211,17 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-protocol.rst:928 +#: ../../library/asyncio-protocol.rst:933 msgid "Connecting Existing Sockets" msgstr "" -#: ../../library/asyncio-protocol.rst:930 +#: ../../library/asyncio-protocol.rst:935 msgid "" "Wait until a socket receives data using the :meth:`loop.create_connection` " "method with a protocol::" msgstr "" -#: ../../library/asyncio-protocol.rst:933 +#: ../../library/asyncio-protocol.rst:938 msgid "" "import asyncio\n" "import socket\n" @@ -1266,35 +1273,35 @@ msgid "" "asyncio.run(main())" msgstr "" -#: ../../library/asyncio-protocol.rst:984 +#: ../../library/asyncio-protocol.rst:989 msgid "" "The :ref:`watch a file descriptor for read events " "` example uses the low-level :meth:`loop." "add_reader` method to register an FD." msgstr "" -#: ../../library/asyncio-protocol.rst:988 +#: ../../library/asyncio-protocol.rst:993 msgid "" "The :ref:`register an open socket to wait for data using streams " "` example uses high-level streams " "created by the :func:`open_connection` function in a coroutine." msgstr "" -#: ../../library/asyncio-protocol.rst:995 +#: ../../library/asyncio-protocol.rst:1000 msgid "loop.subprocess_exec() and SubprocessProtocol" msgstr "" -#: ../../library/asyncio-protocol.rst:997 +#: ../../library/asyncio-protocol.rst:1002 msgid "" "An example of a subprocess protocol used to get the output of a subprocess " "and to wait for the subprocess exit." msgstr "" -#: ../../library/asyncio-protocol.rst:1000 +#: ../../library/asyncio-protocol.rst:1005 msgid "The subprocess is created by the :meth:`loop.subprocess_exec` method::" msgstr "" -#: ../../library/asyncio-protocol.rst:1002 +#: ../../library/asyncio-protocol.rst:1007 msgid "" "import asyncio\n" "import sys\n" @@ -1355,7 +1362,7 @@ msgid "" "print(f\"Current date: {date}\")" msgstr "" -#: ../../library/asyncio-protocol.rst:1060 +#: ../../library/asyncio-protocol.rst:1065 msgid "" "See also the :ref:`same example ` " "written using high-level APIs." diff --git a/library/asyncio-queue.po b/library/asyncio-queue.po index 09bf4b429e..088dea0967 100644 --- a/library/asyncio-queue.po +++ b/library/asyncio-queue.po @@ -6,9 +6,9 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-02-20 18:34+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -109,16 +109,22 @@ msgid "" "item is available." msgstr "從佇列中刪除並回傳一個元素。如果佇列為空,則持續等待直到佇列中有元素。" -#: ../../library/asyncio-queue.rst:67 +#: ../../library/asyncio-queue.rst:65 +msgid "" +"Raises :exc:`QueueShutDown` if the queue has been shut down and is empty, or " +"if the queue has been shut down immediately." +msgstr "" + +#: ../../library/asyncio-queue.rst:70 msgid "" "Return an item if one is immediately available, else raise :exc:`QueueEmpty`." msgstr "如果佇列內有值則立即回傳佇列中的元素,否則引發 :exc:`QueueEmpty`。" -#: ../../library/asyncio-queue.rst:72 +#: ../../library/asyncio-queue.rst:75 msgid "Block until all items in the queue have been received and processed." msgstr "持續阻塞直到佇列中所有的元素都被接收和處理完畢。" -#: ../../library/asyncio-queue.rst:74 +#: ../../library/asyncio-queue.rst:77 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " "queue. The count goes down whenever a consumer coroutine calls :meth:" @@ -131,7 +137,7 @@ msgstr "" "成,未完成任務計數就會減少。當未完成計數降到零的時候,:meth:`join` 阻塞會被解" "除 (unblock)。" -#: ../../library/asyncio-queue.rst:82 +#: ../../library/asyncio-queue.rst:85 msgid "" "Put an item into the queue. If the queue is full, wait until a free slot is " "available before adding the item." @@ -139,23 +145,48 @@ msgstr "" "將一個元素放進佇列。如果佇列滿了,在新增元素之前,會持續等待直到有空閒插槽 " "(free slot) 能被使用。" -#: ../../library/asyncio-queue.rst:87 +#: ../../library/asyncio-queue.rst:88 +msgid "Raises :exc:`QueueShutDown` if the queue has been shut down." +msgstr "" + +#: ../../library/asyncio-queue.rst:92 msgid "Put an item into the queue without blocking." msgstr "不阻塞地將一個元素放入佇列。" -#: ../../library/asyncio-queue.rst:89 +#: ../../library/asyncio-queue.rst:94 msgid "If no free slot is immediately available, raise :exc:`QueueFull`." msgstr "如果沒有立即可用的空閒插槽,引發 :exc:`QueueFull`。" -#: ../../library/asyncio-queue.rst:93 +#: ../../library/asyncio-queue.rst:98 msgid "Return the number of items in the queue." msgstr "回傳佇列中的元素數量。" -#: ../../library/asyncio-queue.rst:97 +#: ../../library/asyncio-queue.rst:102 +msgid "" +"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` raise :" +"exc:`QueueShutDown`." +msgstr "" + +#: ../../library/asyncio-queue.rst:105 +msgid "" +"By default, :meth:`~Queue.get` on a shut down queue will only raise once the " +"queue is empty. Set *immediate* to true to make :meth:`~Queue.get` raise " +"immediately instead." +msgstr "" + +#: ../../library/asyncio-queue.rst:109 +msgid "" +"All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be " +"unblocked. If *immediate* is true, a task will be marked as done for each " +"remaining item in the queue, which may unblock callers of :meth:`~Queue." +"join`." +msgstr "" + +#: ../../library/asyncio-queue.rst:118 msgid "Indicate that a formerly enqueued task is complete." msgstr "表示前面一個排隊的任務已經完成。" -#: ../../library/asyncio-queue.rst:99 +#: ../../library/asyncio-queue.rst:120 msgid "" "Used by queue consumers. For each :meth:`~Queue.get` used to fetch a task, a " "subsequent call to :meth:`task_done` tells the queue that the processing on " @@ -164,7 +195,7 @@ msgstr "" "由佇列消耗者使用。對於每個用於獲取一個任務的 :meth:`~Queue.get`,接續的 :" "meth:`task_done` 呼叫會告訴佇列這個任務的處理已經完成。" -#: ../../library/asyncio-queue.rst:103 +#: ../../library/asyncio-queue.rst:124 msgid "" "If a :meth:`join` is currently blocking, it will resume when all items have " "been processed (meaning that a :meth:`task_done` call was received for every " @@ -173,47 +204,53 @@ msgstr "" "如果 :meth:`join` 當前正在阻塞,在所有項目都被處理後會解除阻塞(意味著每個" "以 :meth:`~Queue.put` 放進佇列的條目都會收到一個 :meth:`task_done`\\ )。" -#: ../../library/asyncio-queue.rst:108 +#: ../../library/asyncio-queue.rst:129 +msgid "" +"``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining item " +"in the queue." +msgstr "" + +#: ../../library/asyncio-queue.rst:132 msgid "" "Raises :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "如果被呼叫的次數多於放入佇列中的項目數量,將引發 :exc:`ValueError`。" -#: ../../library/asyncio-queue.rst:113 +#: ../../library/asyncio-queue.rst:137 msgid "Priority Queue" msgstr "Priority Queue(優先佇列)" -#: ../../library/asyncio-queue.rst:117 +#: ../../library/asyncio-queue.rst:141 msgid "" "A variant of :class:`Queue`; retrieves entries in priority order (lowest " "first)." msgstr ":class:`Queue` 的變形;按優先順序取出條目 (最小的先取出)。" -#: ../../library/asyncio-queue.rst:120 +#: ../../library/asyncio-queue.rst:144 msgid "Entries are typically tuples of the form ``(priority_number, data)``." msgstr "條目通常是 ``(priority_number, data)`` 形式的 tuple(元組)。" -#: ../../library/asyncio-queue.rst:125 +#: ../../library/asyncio-queue.rst:149 msgid "LIFO Queue" msgstr "LIFO Queue" -#: ../../library/asyncio-queue.rst:129 +#: ../../library/asyncio-queue.rst:153 msgid "" "A variant of :class:`Queue` that retrieves most recently added entries first " "(last in, first out)." msgstr ":class:`Queue` 的變形,先取出最近新增的條目(後進先出)。" -#: ../../library/asyncio-queue.rst:134 +#: ../../library/asyncio-queue.rst:158 msgid "Exceptions" msgstr "例外" -#: ../../library/asyncio-queue.rst:138 +#: ../../library/asyncio-queue.rst:162 msgid "" "This exception is raised when the :meth:`~Queue.get_nowait` method is called " "on an empty queue." msgstr "當佇列為空的時候,呼叫 :meth:`~Queue.get_nowait` 方法會引發這個例外。" -#: ../../library/asyncio-queue.rst:144 +#: ../../library/asyncio-queue.rst:168 msgid "" "Exception raised when the :meth:`~Queue.put_nowait` method is called on a " "queue that has reached its *maxsize*." @@ -221,16 +258,25 @@ msgstr "" "當佇列中條目數量已經達到它的 *maxsize* 時,呼叫 :meth:`~Queue.put_nowait` 方" "法會引發這個例外。" -#: ../../library/asyncio-queue.rst:149 +#: ../../library/asyncio-queue.rst:174 +#, fuzzy +msgid "" +"Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " +"a queue which has been shut down." +msgstr "" +"當佇列中條目數量已經達到它的 *maxsize* 時,呼叫 :meth:`~Queue.put_nowait` 方" +"法會引發這個例外。" + +#: ../../library/asyncio-queue.rst:181 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-queue.rst:153 +#: ../../library/asyncio-queue.rst:185 msgid "" "Queues can be used to distribute workload between several concurrent tasks::" msgstr "佇列能被用於多個並行任務的工作分配:" -#: ../../library/asyncio-queue.rst:156 +#: ../../library/asyncio-queue.rst:188 msgid "" "import asyncio\n" "import random\n" diff --git a/library/asyncio-runner.po b/library/asyncio-runner.po index 40885e75a9..0dd0adb9cc 100644 --- a/library/asyncio-runner.po +++ b/library/asyncio-runner.po @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -54,13 +54,13 @@ msgstr "" "這個函式負責運行被傳入的協程、管理 asyncio 的事件迴圈、*終結非同步產生器*,以" "及關閉執行器。" -#: ../../library/asyncio-runner.rst:33 ../../library/asyncio-runner.rst:113 +#: ../../library/asyncio-runner.rst:33 ../../library/asyncio-runner.rst:115 msgid "" "This function cannot be called when another asyncio event loop is running in " "the same thread." msgstr "當另一個非同步事件迴圈在同一執行緒中執行時,無法呼叫此函式。" -#: ../../library/asyncio-runner.rst:36 ../../library/asyncio-runner.rst:83 +#: ../../library/asyncio-runner.rst:36 ../../library/asyncio-runner.rst:85 msgid "" "If *debug* is ``True``, the event loop will be run in debug mode. ``False`` " "disables debug mode explicitly. ``None`` is used to respect the global :ref:" @@ -71,30 +71,32 @@ msgstr "" "定。" #: ../../library/asyncio-runner.rst:40 +#, fuzzy msgid "" "If *loop_factory* is not ``None``, it is used to create a new event loop; " "otherwise :func:`asyncio.new_event_loop` is used. The loop is closed at the " "end. This function should be used as a main entry point for asyncio " "programs, and should ideally only be called once. It is recommended to use " -"*loop_factory* to configure the event loop instead of policies." +"*loop_factory* to configure the event loop instead of policies. Passing :" +"class:`asyncio.EventLoop` allows running asyncio without the policy system." msgstr "" "如果 *loop_factory* 不為 ``None``,它會被用於建立一個新的事件迴圈;否則會改" "用 :func:`asyncio.new_event_loop`。迴圈會在最後關閉。這個函式應該要作為" "asyncio 程式的主要進入點,且理想上僅會被呼叫一次。推薦使用 *loop_factory* 來" "設定事件迴圈時而不是使用 policies(政策)。" -#: ../../library/asyncio-runner.rst:46 +#: ../../library/asyncio-runner.rst:48 msgid "" "The executor is given a timeout duration of 5 minutes to shutdown. If the " "executor hasn't finished within that duration, a warning is emitted and the " "executor is closed." msgstr "" -#: ../../library/asyncio-runner.rst:50 +#: ../../library/asyncio-runner.rst:52 msgid "Example::" msgstr "範例: ::" -#: ../../library/asyncio-runner.rst:52 +#: ../../library/asyncio-runner.rst:54 msgid "" "async def main():\n" " await asyncio.sleep(1)\n" @@ -108,36 +110,36 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../library/asyncio-runner.rst:60 +#: ../../library/asyncio-runner.rst:62 msgid "Updated to use :meth:`loop.shutdown_default_executor`." msgstr "" -#: ../../library/asyncio-runner.rst:65 +#: ../../library/asyncio-runner.rst:67 msgid "" "*debug* is ``None`` by default to respect the global debug mode settings." msgstr "" -#: ../../library/asyncio-runner.rst:69 +#: ../../library/asyncio-runner.rst:71 msgid "Added *loop_factory* parameter." msgstr "新增 *loop_factory* 參數。" -#: ../../library/asyncio-runner.rst:73 +#: ../../library/asyncio-runner.rst:75 msgid "Runner context manager" msgstr "" -#: ../../library/asyncio-runner.rst:77 +#: ../../library/asyncio-runner.rst:79 msgid "" "A context manager that simplifies *multiple* async function calls in the " "same context." msgstr "" -#: ../../library/asyncio-runner.rst:80 +#: ../../library/asyncio-runner.rst:82 msgid "" "Sometimes several top-level async functions should be called in the same :" "ref:`event loop ` and :class:`contextvars.Context`." msgstr "" -#: ../../library/asyncio-runner.rst:87 +#: ../../library/asyncio-runner.rst:89 msgid "" "*loop_factory* could be used for overriding the loop creation. It is the " "responsibility of the *loop_factory* to set the created loop as the current " @@ -145,13 +147,13 @@ msgid "" "event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``." msgstr "" -#: ../../library/asyncio-runner.rst:92 +#: ../../library/asyncio-runner.rst:94 msgid "" "Basically, :func:`asyncio.run` example can be rewritten with the runner " "usage::" msgstr "" -#: ../../library/asyncio-runner.rst:94 +#: ../../library/asyncio-runner.rst:96 msgid "" "async def main():\n" " await asyncio.sleep(1)\n" @@ -167,52 +169,52 @@ msgstr "" "with asyncio.Runner() as runner:\n" " runner.run(main())" -#: ../../library/asyncio-runner.rst:105 +#: ../../library/asyncio-runner.rst:107 msgid "Run a :term:`coroutine ` *coro* in the embedded loop." msgstr "" -#: ../../library/asyncio-runner.rst:107 +#: ../../library/asyncio-runner.rst:109 msgid "Return the coroutine's result or raise its exception." msgstr "" -#: ../../library/asyncio-runner.rst:109 +#: ../../library/asyncio-runner.rst:111 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *coro* to run in. The runner's default " "context is used if ``None``." msgstr "" -#: ../../library/asyncio-runner.rst:118 +#: ../../library/asyncio-runner.rst:120 msgid "Close the runner." msgstr "" -#: ../../library/asyncio-runner.rst:120 +#: ../../library/asyncio-runner.rst:122 msgid "" "Finalize asynchronous generators, shutdown default executor, close the event " "loop and release embedded :class:`contextvars.Context`." msgstr "" -#: ../../library/asyncio-runner.rst:125 +#: ../../library/asyncio-runner.rst:127 msgid "Return the event loop associated with the runner instance." msgstr "" -#: ../../library/asyncio-runner.rst:129 +#: ../../library/asyncio-runner.rst:131 msgid "" ":class:`Runner` uses the lazy initialization strategy, its constructor " "doesn't initialize underlying low-level structures." msgstr "" -#: ../../library/asyncio-runner.rst:132 +#: ../../library/asyncio-runner.rst:134 msgid "" "Embedded *loop* and *context* are created at the :keyword:`with` body " "entering or the first call of :meth:`run` or :meth:`get_loop`." msgstr "" -#: ../../library/asyncio-runner.rst:137 +#: ../../library/asyncio-runner.rst:139 msgid "Handling Keyboard Interruption" msgstr "" -#: ../../library/asyncio-runner.rst:141 +#: ../../library/asyncio-runner.rst:143 msgid "" "When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, :exc:" "`KeyboardInterrupt` exception is raised in the main thread by default. " @@ -220,26 +222,26 @@ msgid "" "asyncio internals and can hang the program from exiting." msgstr "" -#: ../../library/asyncio-runner.rst:146 +#: ../../library/asyncio-runner.rst:148 msgid "" "To mitigate this issue, :mod:`asyncio` handles :const:`signal.SIGINT` as " "follows:" msgstr "" -#: ../../library/asyncio-runner.rst:148 +#: ../../library/asyncio-runner.rst:150 msgid "" ":meth:`asyncio.Runner.run` installs a custom :const:`signal.SIGINT` handler " "before any user code is executed and removes it when exiting from the " "function." msgstr "" -#: ../../library/asyncio-runner.rst:150 +#: ../../library/asyncio-runner.rst:152 msgid "" "The :class:`~asyncio.Runner` creates the main task for the passed coroutine " "for its execution." msgstr "" -#: ../../library/asyncio-runner.rst:152 +#: ../../library/asyncio-runner.rst:154 msgid "" "When :const:`signal.SIGINT` is raised by :kbd:`Ctrl-C`, the custom signal " "handler cancels the main task by calling :meth:`asyncio.Task.cancel` which " @@ -249,7 +251,7 @@ msgid "" "Runner.run` raises :exc:`KeyboardInterrupt`." msgstr "" -#: ../../library/asyncio-runner.rst:158 +#: ../../library/asyncio-runner.rst:160 msgid "" "A user could write a tight loop which cannot be interrupted by :meth:" "`asyncio.Task.cancel`, in which case the second following :kbd:`Ctrl-C` " diff --git a/library/asyncio-stream.po b/library/asyncio-stream.po index a64d70e90e..a89301bcf9 100644 --- a/library/asyncio-stream.po +++ b/library/asyncio-stream.po @@ -6,9 +6,9 @@ # Matt Wang , 2022-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-10-31 16:28+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,7 +42,7 @@ msgstr "" msgid "Here is an example of a TCP echo client written using asyncio streams::" msgstr "這是一個使用 asyncio 串流編寫的 TCP echo 客戶端範例: ::" -#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:404 +#: ../../library/asyncio-stream.rst:22 ../../library/asyncio-stream.rst:415 msgid "" "import asyncio\n" "\n" @@ -146,7 +146,7 @@ msgstr "移除 *loop* 參數。" #: ../../library/asyncio-stream.rst:86 ../../library/asyncio-stream.rst:128 #: ../../library/asyncio-stream.rst:160 ../../library/asyncio-stream.rst:190 -#: ../../library/asyncio-stream.rst:372 +#: ../../library/asyncio-stream.rst:383 msgid "Added the *ssl_shutdown_timeout* parameter." msgstr "新增 *ssl_shutdown_timeout* 參數。" @@ -352,20 +352,32 @@ msgstr "" "`IncompleteReadError` 例外,且內部緩衝區會被重置。:attr:`IncompleteReadError." "partial` 屬性可能包含一部分的 separator。" -#: ../../library/asyncio-stream.rst:267 +#: ../../library/asyncio-stream.rst:263 +msgid "" +"The *separator* may also be a tuple of separators. In this case the return " +"value will be the shortest possible that has any separator as the suffix. " +"For the purposes of :exc:`LimitOverrunError`, the shortest possible " +"separator is considered to be the one that matched." +msgstr "" + +#: ../../library/asyncio-stream.rst:273 +msgid "The *separator* parameter may now be a :class:`tuple` of separators." +msgstr "" + +#: ../../library/asyncio-stream.rst:278 msgid "Return ``True`` if the buffer is empty and :meth:`feed_eof` was called." msgstr "如果緩衝區是空的且 :meth:`feed_eof` 曾被呼叫則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:272 +#: ../../library/asyncio-stream.rst:283 msgid "StreamWriter" msgstr "StreamWriter" -#: ../../library/asyncio-stream.rst:276 +#: ../../library/asyncio-stream.rst:287 msgid "" "Represents a writer object that provides APIs to write data to the IO stream." msgstr "表示一個有提供 API 來將資料寫入 IO 串流的 writer 物件。" -#: ../../library/asyncio-stream.rst:279 +#: ../../library/asyncio-stream.rst:290 msgid "" "It is not recommended to instantiate *StreamWriter* objects directly; use :" "func:`open_connection` and :func:`start_server` instead." @@ -373,7 +385,7 @@ msgstr "" "不建議直接實例化 *StreamWriter* 物件;使用 :func:`open_connection` 和 :func:" "`start_server` 會是較好的做法。" -#: ../../library/asyncio-stream.rst:285 +#: ../../library/asyncio-stream.rst:296 msgid "" "The method attempts to write the *data* to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " @@ -382,11 +394,11 @@ msgstr "" "此方法會嘗試立即將 *data* 寫入到底層的 socket。如果失敗,資料會被放到內部寫入" "緩衝中排隊等待 (queue),直到它可被發送。" -#: ../../library/asyncio-stream.rst:289 ../../library/asyncio-stream.rst:301 +#: ../../library/asyncio-stream.rst:300 ../../library/asyncio-stream.rst:312 msgid "The method should be used along with the ``drain()`` method::" msgstr "此方法應當與 ``drain()`` 方法一起使用: ::" -#: ../../library/asyncio-stream.rst:291 +#: ../../library/asyncio-stream.rst:302 msgid "" "stream.write(data)\n" "await stream.drain()" @@ -394,7 +406,7 @@ msgstr "" "stream.write(data)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:296 +#: ../../library/asyncio-stream.rst:307 msgid "" "The method writes a list (or any iterable) of bytes to the underlying socket " "immediately. If that fails, the data is queued in an internal write buffer " @@ -403,7 +415,7 @@ msgstr "" "此方法會立即嘗試將一個位元組 list(或任何可疊代物件 (iterable))寫入到底層的 " "socket。如果失敗,資料會被放到內部寫入緩衝中排隊等待,直到它可被發送。" -#: ../../library/asyncio-stream.rst:303 +#: ../../library/asyncio-stream.rst:314 msgid "" "stream.writelines(lines)\n" "await stream.drain()" @@ -411,17 +423,17 @@ msgstr "" "stream.writelines(lines)\n" "await stream.drain()" -#: ../../library/asyncio-stream.rst:308 +#: ../../library/asyncio-stream.rst:319 msgid "The method closes the stream and the underlying socket." msgstr "此方法會關閉串流以及底層的 socket。" -#: ../../library/asyncio-stream.rst:310 +#: ../../library/asyncio-stream.rst:321 msgid "" "The method should be used, though not mandatory, along with the " "``wait_closed()`` method::" msgstr "此方法應與 ``wait_closed()`` 方法一起使用,但並非強制: ::" -#: ../../library/asyncio-stream.rst:313 +#: ../../library/asyncio-stream.rst:324 msgid "" "stream.close()\n" "await stream.wait_closed()" @@ -429,7 +441,7 @@ msgstr "" "stream.close()\n" "await stream.wait_closed()" -#: ../../library/asyncio-stream.rst:318 +#: ../../library/asyncio-stream.rst:329 msgid "" "Return ``True`` if the underlying transport supports the :meth:`write_eof` " "method, ``False`` otherwise." @@ -437,26 +449,26 @@ msgstr "" "如果底層的傳輸支援 :meth:`write_eof` 方法就回傳 ``True``,否則回傳 " "``False``。" -#: ../../library/asyncio-stream.rst:323 +#: ../../library/asyncio-stream.rst:334 msgid "" "Close the write end of the stream after the buffered write data is flushed." msgstr "在已緩衝的寫入資料被清理 (flush) 後關閉串流的寫入端。" -#: ../../library/asyncio-stream.rst:328 +#: ../../library/asyncio-stream.rst:339 msgid "Return the underlying asyncio transport." msgstr "回傳底層的 asyncio 傳輸。" -#: ../../library/asyncio-stream.rst:332 +#: ../../library/asyncio-stream.rst:343 msgid "" "Access optional transport information; see :meth:`BaseTransport." "get_extra_info` for details." msgstr "存取可選的傳輸資訊;詳情請見 :meth:`BaseTransport.get_extra_info`。" -#: ../../library/asyncio-stream.rst:337 +#: ../../library/asyncio-stream.rst:348 msgid "Wait until it is appropriate to resume writing to the stream. Example::" msgstr "等待直到可以繼續寫入到串流。範例: ::" -#: ../../library/asyncio-stream.rst:340 +#: ../../library/asyncio-stream.rst:351 msgid "" "writer.write(data)\n" "await writer.drain()" @@ -464,7 +476,7 @@ msgstr "" "writer.write(data)\n" "await writer.drain()" -#: ../../library/asyncio-stream.rst:343 +#: ../../library/asyncio-stream.rst:354 msgid "" "This is a flow control method that interacts with the underlying IO write " "buffer. When the size of the buffer reaches the high watermark, *drain()* " @@ -476,48 +488,48 @@ msgstr "" "(high watermark) 時,*drain()* 會阻塞直到緩衝區大小減少至最低標記位 (low " "watermark) 以便繼續寫入。當沒有要等待的資料時,:meth:`drain` 會立即回傳。" -#: ../../library/asyncio-stream.rst:353 +#: ../../library/asyncio-stream.rst:364 msgid "Upgrade an existing stream-based connection to TLS." msgstr "" -#: ../../library/asyncio-stream.rst:355 +#: ../../library/asyncio-stream.rst:366 msgid "Parameters:" msgstr "參數:" -#: ../../library/asyncio-stream.rst:357 +#: ../../library/asyncio-stream.rst:368 msgid "*sslcontext*: a configured instance of :class:`~ssl.SSLContext`." msgstr "" -#: ../../library/asyncio-stream.rst:359 +#: ../../library/asyncio-stream.rst:370 msgid "" "*server_hostname*: sets or overrides the host name that the target server's " "certificate will be matched against." msgstr "" -#: ../../library/asyncio-stream.rst:362 +#: ../../library/asyncio-stream.rst:373 msgid "" "*ssl_handshake_timeout* is the time in seconds to wait for the TLS handshake " "to complete before aborting the connection. ``60.0`` seconds if ``None`` " "(default)." msgstr "" -#: ../../library/asyncio-stream.rst:366 +#: ../../library/asyncio-stream.rst:377 msgid "" "*ssl_shutdown_timeout* is the time in seconds to wait for the SSL shutdown " "to complete before aborting the connection. ``30.0`` seconds if ``None`` " "(default)." msgstr "" -#: ../../library/asyncio-stream.rst:378 +#: ../../library/asyncio-stream.rst:389 msgid "" "Return ``True`` if the stream is closed or in the process of being closed." msgstr "如果串流已被關閉或正在被關閉則回傳 ``True``。" -#: ../../library/asyncio-stream.rst:385 +#: ../../library/asyncio-stream.rst:396 msgid "Wait until the stream is closed." msgstr "等待直到串流被關閉。" -#: ../../library/asyncio-stream.rst:387 +#: ../../library/asyncio-stream.rst:398 msgid "" "Should be called after :meth:`close` to wait until the underlying connection " "is closed, ensuring that all data has been flushed before e.g. exiting the " @@ -526,19 +538,19 @@ msgstr "" "應當在 :meth:`close` 之後才被呼叫,這會持續等待直到底層的連線被關閉,以確保在" "這之前(例如在程式退出前)所有資料都已經被清空" -#: ../../library/asyncio-stream.rst:395 +#: ../../library/asyncio-stream.rst:406 msgid "Examples" msgstr "範例" -#: ../../library/asyncio-stream.rst:400 +#: ../../library/asyncio-stream.rst:411 msgid "TCP echo client using streams" msgstr "使用串流的 TCP echo 客戶端" -#: ../../library/asyncio-stream.rst:402 +#: ../../library/asyncio-stream.rst:413 msgid "TCP echo client using the :func:`asyncio.open_connection` function::" msgstr "使用 :func:`asyncio.open_connection` 函式的 TCP echo 客戶端: ::" -#: ../../library/asyncio-stream.rst:426 +#: ../../library/asyncio-stream.rst:437 msgid "" "The :ref:`TCP echo client protocol " "` example uses the low-level :meth:" @@ -547,15 +559,15 @@ msgstr "" "使用低階 :meth:`loop.create_connection` 方法的 :ref:`TCP echo 客戶端協定 " "`\\ 範例。" -#: ../../library/asyncio-stream.rst:433 +#: ../../library/asyncio-stream.rst:444 msgid "TCP echo server using streams" msgstr "使用串流的 TCP echo 伺服器" -#: ../../library/asyncio-stream.rst:435 +#: ../../library/asyncio-stream.rst:446 msgid "TCP echo server using the :func:`asyncio.start_server` function::" msgstr "TCP echo 伺服器使用 :func:`asyncio.start_server` 函式: ::" -#: ../../library/asyncio-stream.rst:437 +#: ../../library/asyncio-stream.rst:448 msgid "" "import asyncio\n" "\n" @@ -615,7 +627,7 @@ msgstr "" "\n" "asyncio.run(main())" -#: ../../library/asyncio-stream.rst:469 +#: ../../library/asyncio-stream.rst:480 msgid "" "The :ref:`TCP echo server protocol " "` example uses the :meth:`loop." @@ -624,16 +636,16 @@ msgstr "" "使用 :meth:`loop.create_server` 方法的 :ref:`TCP echo 伺服器協定 " "` 範例。" -#: ../../library/asyncio-stream.rst:474 +#: ../../library/asyncio-stream.rst:485 msgid "Get HTTP headers" msgstr "獲取 HTTP 標頭" -#: ../../library/asyncio-stream.rst:476 +#: ../../library/asyncio-stream.rst:487 msgid "" "Simple example querying HTTP headers of the URL passed on the command line::" msgstr "查詢自命令列傳入之 URL 所帶有 HTTP 標頭的簡單範例: ::" -#: ../../library/asyncio-stream.rst:478 +#: ../../library/asyncio-stream.rst:489 msgid "" "import asyncio\n" "import urllib.parse\n" @@ -672,34 +684,34 @@ msgid "" "asyncio.run(print_http_headers(url))" msgstr "" -#: ../../library/asyncio-stream.rst:515 +#: ../../library/asyncio-stream.rst:526 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-stream.rst:517 +#: ../../library/asyncio-stream.rst:528 msgid "python example.py http://example.com/path/page.html" msgstr "python example.py http://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:519 +#: ../../library/asyncio-stream.rst:530 msgid "or with HTTPS::" msgstr "或使用 HTTPS: ::" -#: ../../library/asyncio-stream.rst:521 +#: ../../library/asyncio-stream.rst:532 msgid "python example.py https://example.com/path/page.html" msgstr "python example.py https://example.com/path/page.html" -#: ../../library/asyncio-stream.rst:527 +#: ../../library/asyncio-stream.rst:538 msgid "Register an open socket to wait for data using streams" msgstr "註冊一個使用串流來等待資料的開放 socket" -#: ../../library/asyncio-stream.rst:529 +#: ../../library/asyncio-stream.rst:540 msgid "" "Coroutine waiting until a socket receives data using the :func:" "`open_connection` function::" msgstr "" "等待直到 socket 透過使用 :func:`open_connection` 函式接收到資料的協程: ::" -#: ../../library/asyncio-stream.rst:532 +#: ../../library/asyncio-stream.rst:543 msgid "" "import asyncio\n" "import socket\n" @@ -732,7 +744,7 @@ msgid "" "asyncio.run(wait_for_data())" msgstr "" -#: ../../library/asyncio-stream.rst:564 +#: ../../library/asyncio-stream.rst:575 msgid "" "The :ref:`register an open socket to wait for data using a protocol " "` example uses a low-level protocol and " @@ -742,7 +754,7 @@ msgstr "" "`\\ 範例中,有使用了低階協定以及 :meth:" "`loop.create_connection` 方法。" -#: ../../library/asyncio-stream.rst:568 +#: ../../library/asyncio-stream.rst:579 msgid "" "The :ref:`watch a file descriptor for read events " "` example uses the low-level :meth:`loop." diff --git a/library/asyncio-subprocess.po b/library/asyncio-subprocess.po index 363fa836b1..a3ffe6d7bf 100644 --- a/library/asyncio-subprocess.po +++ b/library/asyncio-subprocess.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" diff --git a/library/asyncio-sync.po b/library/asyncio-sync.po index f7a90d4efe..ffee4a801a 100644 --- a/library/asyncio-sync.po +++ b/library/asyncio-sync.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-02-09 19:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -109,7 +109,7 @@ msgid "" msgstr "" #: ../../library/asyncio-sync.rst:56 ../../library/asyncio-sync.rst:199 -#: ../../library/asyncio-sync.rst:298 +#: ../../library/asyncio-sync.rst:304 msgid "which is equivalent to::" msgstr "這等價於: ::" @@ -126,8 +126,8 @@ msgid "" msgstr "" #: ../../library/asyncio-sync.rst:67 ../../library/asyncio-sync.rst:112 -#: ../../library/asyncio-sync.rst:187 ../../library/asyncio-sync.rst:286 -#: ../../library/asyncio-sync.rst:341 +#: ../../library/asyncio-sync.rst:187 ../../library/asyncio-sync.rst:292 +#: ../../library/asyncio-sync.rst:347 msgid "Removed the *loop* parameter." msgstr "移除 ``loop`` 參數。" @@ -201,7 +201,7 @@ msgstr "" "wait` 方法會被阻塞 (block) 直到該旗標被設為 *true*。該旗標初始設置為 " "*false*。" -#: ../../library/asyncio-sync.rst:117 ../../library/asyncio-sync.rst:365 +#: ../../library/asyncio-sync.rst:117 ../../library/asyncio-sync.rst:371 msgid "Example::" msgstr "範例: ::" @@ -340,9 +340,10 @@ msgstr "" "``True``。" #: ../../library/asyncio-sync.rst:219 +#, fuzzy msgid "" -"Wake up at most *n* tasks (1 by default) waiting on this condition. The " -"method is no-op if no tasks are waiting." +"Wake up *n* tasks (1 by default) waiting on this condition. If fewer than " +"*n* tasks are waiting they are all awakened." msgstr "" "喚醒至多 *n* 個正在等待此條件的任務(預設為 1),如果沒有正在等待的任務則此方" "法為空操作 (no-op)。" @@ -398,27 +399,36 @@ msgstr "" "`notify_all` 的呼叫所喚醒。一但被喚醒,Condition 會重新獲取該鎖且此方法會回" "傳 ``True``。" -#: ../../library/asyncio-sync.rst:262 +#: ../../library/asyncio-sync.rst:260 +msgid "" +"Note that a task *may* return from this call spuriously, which is why the " +"caller should always re-check the state and be prepared to :meth:`wait` " +"again. For this reason, you may prefer to use :meth:`wait_for` instead." +msgstr "" + +#: ../../library/asyncio-sync.rst:267 msgid "Wait until a predicate becomes *true*." msgstr "持續等待直到謂語 (predicate) 成為 *true*。" -#: ../../library/asyncio-sync.rst:264 +#: ../../library/asyncio-sync.rst:269 +#, fuzzy msgid "" "The predicate must be a callable which result will be interpreted as a " -"boolean value. The final value is the return value." +"boolean value. The method will repeatedly :meth:`wait` until the predicate " +"evaluates to *true*. The final value is the return value." msgstr "" "謂語必須是一個結果可被直譯為一個 boolean 值的可呼叫物件 (callable)。最終值為" "回傳值。" -#: ../../library/asyncio-sync.rst:270 +#: ../../library/asyncio-sync.rst:276 msgid "Semaphore" msgstr "Semaphore" -#: ../../library/asyncio-sync.rst:274 +#: ../../library/asyncio-sync.rst:280 msgid "A Semaphore object. Not thread-safe." msgstr "一個旗號 (semaphore) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:276 +#: ../../library/asyncio-sync.rst:282 msgid "" "A semaphore manages an internal counter which is decremented by each :meth:" "`acquire` call and incremented by each :meth:`release` call. The counter can " @@ -429,7 +439,7 @@ msgstr "" "呼叫 :meth:`release` 時增加一。此計數器永遠不會少於零;當 :meth:`acquire` 發" "現它是零時,它會持續阻塞並等待某任務呼叫 :meth:`release`。" -#: ../../library/asyncio-sync.rst:282 +#: ../../library/asyncio-sync.rst:288 msgid "" "The optional *value* argument gives the initial value for the internal " "counter (``1`` by default). If the given value is less than ``0`` a :exc:" @@ -438,12 +448,12 @@ msgstr "" "可選的 *value* 引數給定了內部計數器的初始值(預設為 ``1``\\ )。如給定的值少" "於 ``0`` 則 :exc:`ValueError` 會被引發。" -#: ../../library/asyncio-sync.rst:289 +#: ../../library/asyncio-sync.rst:295 msgid "" "The preferred way to use a Semaphore is an :keyword:`async with` statement::" msgstr "使用 Semaphore 的推薦方式是透過 :keyword:`async with` 陳述式: ::" -#: ../../library/asyncio-sync.rst:292 +#: ../../library/asyncio-sync.rst:298 msgid "" "sem = asyncio.Semaphore(10)\n" "\n" @@ -452,7 +462,7 @@ msgid "" " # work with shared resource" msgstr "" -#: ../../library/asyncio-sync.rst:300 +#: ../../library/asyncio-sync.rst:306 msgid "" "sem = asyncio.Semaphore(10)\n" "\n" @@ -464,11 +474,11 @@ msgid "" " sem.release()" msgstr "" -#: ../../library/asyncio-sync.rst:311 +#: ../../library/asyncio-sync.rst:317 msgid "Acquire a semaphore." msgstr "獲取一個旗號。" -#: ../../library/asyncio-sync.rst:313 +#: ../../library/asyncio-sync.rst:319 msgid "" "If the internal counter is greater than zero, decrement it by one and return " "``True`` immediately. If it is zero, wait until a :meth:`release` is called " @@ -477,11 +487,11 @@ msgstr "" "如果內部計數器大於零,將其減一並立刻回傳 ``True``。如果為零,則持續等待直到 :" "meth:`release` 被呼叫,並回傳 ``True``。" -#: ../../library/asyncio-sync.rst:319 +#: ../../library/asyncio-sync.rst:325 msgid "Returns ``True`` if semaphore can not be acquired immediately." msgstr "如果旗號無法立即被取得則回傳 ``True``。" -#: ../../library/asyncio-sync.rst:323 +#: ../../library/asyncio-sync.rst:329 msgid "" "Release a semaphore, incrementing the internal counter by one. Can wake up a " "task waiting to acquire the semaphore." @@ -489,7 +499,7 @@ msgstr "" "釋放一個旗號,並為其內部的計數器數值增加一。可以把一個正在等待獲取旗號的任務" "叫醒。" -#: ../../library/asyncio-sync.rst:326 +#: ../../library/asyncio-sync.rst:332 msgid "" "Unlike :class:`BoundedSemaphore`, :class:`Semaphore` allows making more " "``release()`` calls than ``acquire()`` calls." @@ -497,15 +507,15 @@ msgstr "" "和 :class:`BoundedSemaphore` 不同,:class:`Semaphore` 允許 ``release()`` 的呼" "叫次數多於 ``acquire()``。" -#: ../../library/asyncio-sync.rst:331 +#: ../../library/asyncio-sync.rst:337 msgid "BoundedSemaphore" msgstr "BoundedSemaphore" -#: ../../library/asyncio-sync.rst:335 +#: ../../library/asyncio-sync.rst:341 msgid "A bounded semaphore object. Not thread-safe." msgstr "一個有界的旗號物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:337 +#: ../../library/asyncio-sync.rst:343 msgid "" "Bounded Semaphore is a version of :class:`Semaphore` that raises a :exc:" "`ValueError` in :meth:`~Semaphore.release` if it increases the internal " @@ -515,15 +525,15 @@ msgstr "" "加至大於初始 *value* 值的話,:exc:`ValueError` 會在 :meth:`~Semaphore." "release` 時被引發。" -#: ../../library/asyncio-sync.rst:346 +#: ../../library/asyncio-sync.rst:352 msgid "Barrier" msgstr "Barrier" -#: ../../library/asyncio-sync.rst:350 +#: ../../library/asyncio-sync.rst:356 msgid "A barrier object. Not thread-safe." msgstr "一個屏障 (barrier) 物件。不支援執行緒安全。" -#: ../../library/asyncio-sync.rst:352 +#: ../../library/asyncio-sync.rst:358 msgid "" "A barrier is a simple synchronization primitive that allows to block until " "*parties* number of tasks are waiting on it. Tasks can wait on the :meth:" @@ -532,17 +542,17 @@ msgid "" "waiting tasks would unblock simultaneously." msgstr "" -#: ../../library/asyncio-sync.rst:358 +#: ../../library/asyncio-sync.rst:364 msgid "" ":keyword:`async with` can be used as an alternative to awaiting on :meth:" "`~Barrier.wait`." msgstr "" -#: ../../library/asyncio-sync.rst:361 +#: ../../library/asyncio-sync.rst:367 msgid "The barrier can be reused any number of times." msgstr "" -#: ../../library/asyncio-sync.rst:367 +#: ../../library/asyncio-sync.rst:373 msgid "" "async def example_barrier():\n" " # barrier with 3 parties\n" @@ -566,11 +576,11 @@ msgid "" "asyncio.run(example_barrier())" msgstr "" -#: ../../library/asyncio-sync.rst:388 +#: ../../library/asyncio-sync.rst:394 msgid "Result of this example is::" msgstr "" -#: ../../library/asyncio-sync.rst:390 +#: ../../library/asyncio-sync.rst:396 msgid "" "\n" "\n" @@ -582,27 +592,27 @@ msgstr "" "barrier passed\n" "" -#: ../../library/asyncio-sync.rst:399 +#: ../../library/asyncio-sync.rst:405 msgid "" "Pass the barrier. When all the tasks party to the barrier have called this " "function, they are all unblocked simultaneously." msgstr "" -#: ../../library/asyncio-sync.rst:402 +#: ../../library/asyncio-sync.rst:408 msgid "" "When a waiting or blocked task in the barrier is cancelled, this task exits " "the barrier which stays in the same state. If the state of the barrier is " "\"filling\", the number of waiting task decreases by 1." msgstr "" -#: ../../library/asyncio-sync.rst:407 +#: ../../library/asyncio-sync.rst:413 msgid "" "The return value is an integer in the range of 0 to ``parties-1``, different " "for each task. This can be used to select a task to do some special " "housekeeping, e.g.::" msgstr "" -#: ../../library/asyncio-sync.rst:411 +#: ../../library/asyncio-sync.rst:417 msgid "" "...\n" "async with barrier as position:\n" @@ -611,51 +621,51 @@ msgid "" " print('End of *draining phase*')" msgstr "" -#: ../../library/asyncio-sync.rst:417 +#: ../../library/asyncio-sync.rst:423 msgid "" "This method may raise a :class:`BrokenBarrierError` exception if the barrier " "is broken or reset while a task is waiting. It could raise a :exc:" "`CancelledError` if a task is cancelled." msgstr "" -#: ../../library/asyncio-sync.rst:423 +#: ../../library/asyncio-sync.rst:429 msgid "" "Return the barrier to the default, empty state. Any tasks waiting on it " "will receive the :class:`BrokenBarrierError` exception." msgstr "" -#: ../../library/asyncio-sync.rst:426 +#: ../../library/asyncio-sync.rst:432 msgid "" "If a barrier is broken it may be better to just leave it and create a new " "one." msgstr "" -#: ../../library/asyncio-sync.rst:430 +#: ../../library/asyncio-sync.rst:436 msgid "" "Put the barrier into a broken state. This causes any active or future calls " "to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for " "example if one of the tasks needs to abort, to avoid infinite waiting tasks." msgstr "" -#: ../../library/asyncio-sync.rst:437 +#: ../../library/asyncio-sync.rst:443 msgid "The number of tasks required to pass the barrier." msgstr "" -#: ../../library/asyncio-sync.rst:441 +#: ../../library/asyncio-sync.rst:447 msgid "The number of tasks currently waiting in the barrier while filling." msgstr "" -#: ../../library/asyncio-sync.rst:445 +#: ../../library/asyncio-sync.rst:451 msgid "A boolean that is ``True`` if the barrier is in the broken state." msgstr "" -#: ../../library/asyncio-sync.rst:450 +#: ../../library/asyncio-sync.rst:456 msgid "" "This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" "`Barrier` object is reset or broken." msgstr "" -#: ../../library/asyncio-sync.rst:458 +#: ../../library/asyncio-sync.rst:464 msgid "" "Acquiring a lock using ``await lock`` or ``yield from lock`` and/or :keyword:" "`with` statement (``with await lock``, ``with (yield from lock)``) was " diff --git a/library/asyncio-task.po b/library/asyncio-task.po index 60e5050715..b4dd13ea2f 100644 --- a/library/asyncio-task.po +++ b/library/asyncio-task.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -226,7 +226,7 @@ msgstr "" #: ../../library/asyncio-task.rst:130 msgid ":class:`asyncio.TaskGroup`." -msgstr "" +msgstr ":class:`asyncio.TaskGroup`。" #: ../../library/asyncio-task.rst:137 msgid "Awaitables" @@ -435,11 +435,11 @@ msgid "" " task.add_done_callback(background_tasks.discard)" msgstr "" -#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1075 +#: ../../library/asyncio-task.rst:287 ../../library/asyncio-task.rst:1188 msgid "Added the *name* parameter." msgstr "新增 *name* 參數。" -#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1082 +#: ../../library/asyncio-task.rst:290 ../../library/asyncio-task.rst:1195 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" @@ -493,17 +493,22 @@ msgstr "" #: ../../library/asyncio-task.rst:335 msgid "" "Create a task in this task group. The signature matches that of :func:" -"`asyncio.create_task`." +"`asyncio.create_task`. If the task group is inactive (e.g. not yet entered, " +"already finished, or in the process of shutting down), we will close the " +"given ``coro``." +msgstr "" + +#: ../../library/asyncio-task.rst:343 +msgid "Close the given coroutine if the task group is not active." msgstr "" -#: ../../library/asyncio-task.rst:338 ../../library/asyncio-task.rst:472 -#: ../../library/asyncio-task.rst:645 ../../library/asyncio-task.rst:703 -#: ../../library/asyncio-task.rst:729 ../../library/asyncio-task.rst:769 -#: ../../library/asyncio-task.rst:868 +#: ../../library/asyncio-task.rst:345 ../../library/asyncio-task.rst:550 +#: ../../library/asyncio-task.rst:723 ../../library/asyncio-task.rst:781 +#: ../../library/asyncio-task.rst:807 ../../library/asyncio-task.rst:847 msgid "Example::" msgstr "範例: ::" -#: ../../library/asyncio-task.rst:340 +#: ../../library/asyncio-task.rst:347 msgid "" "async def main():\n" " async with asyncio.TaskGroup() as tg:\n" @@ -513,7 +518,7 @@ msgid "" "result()}\")" msgstr "" -#: ../../library/asyncio-task.rst:346 +#: ../../library/asyncio-task.rst:353 msgid "" "The ``async with`` statement will wait for all tasks in the group to finish. " "While waiting, new tasks may still be added to the group (for example, by " @@ -522,7 +527,7 @@ msgid "" "block is exited, no new tasks may be added to the group." msgstr "" -#: ../../library/asyncio-task.rst:353 +#: ../../library/asyncio-task.rst:360 msgid "" "The first time any of the tasks belonging to the group fails with an " "exception other than :exc:`asyncio.CancelledError`, the remaining tasks in " @@ -534,7 +539,7 @@ msgid "" "bubble out of the containing ``async with`` statement." msgstr "" -#: ../../library/asyncio-task.rst:363 +#: ../../library/asyncio-task.rst:370 msgid "" "Once all tasks have finished, if any tasks have failed with an exception " "other than :exc:`asyncio.CancelledError`, those exceptions are combined in " @@ -542,7 +547,7 @@ msgid "" "their documentation) which is then raised." msgstr "" -#: ../../library/asyncio-task.rst:370 +#: ../../library/asyncio-task.rst:377 msgid "" "Two base exceptions are treated specially: If any task fails with :exc:" "`KeyboardInterrupt` or :exc:`SystemExit`, the task group still cancels the " @@ -551,7 +556,7 @@ msgid "" "`ExceptionGroup` or :exc:`BaseExceptionGroup`." msgstr "" -#: ../../library/asyncio-task.rst:376 +#: ../../library/asyncio-task.rst:383 msgid "" "If the body of the ``async with`` statement exits with an exception (so :" "meth:`~object.__aexit__` is called with an exception set), this is treated " @@ -563,38 +568,124 @@ msgid "" "`KeyboardInterrupt` and :exc:`SystemExit` as in the previous paragraph." msgstr "" -#: ../../library/asyncio-task.rst:390 +#: ../../library/asyncio-task.rst:395 +msgid "" +"Task groups are careful not to mix up the internal cancellation used to " +"\"wake up\" their :meth:`~object.__aexit__` with cancellation requests for " +"the task in which they are running made by other parties. In particular, " +"when one task group is syntactically nested in another, and both experience " +"an exception in one of their child tasks simultaneously, the inner task " +"group will process its exceptions, and then the outer task group will " +"receive another cancellation and process its own exceptions." +msgstr "" + +#: ../../library/asyncio-task.rst:403 +msgid "" +"In the case where a task group is cancelled externally and also must raise " +"an :exc:`ExceptionGroup`, it will call the parent task's :meth:`~asyncio." +"Task.cancel` method. This ensures that a :exc:`asyncio.CancelledError` will " +"be raised at the next :keyword:`await`, so the cancellation is not lost." +msgstr "" + +#: ../../library/asyncio-task.rst:409 +msgid "" +"Task groups preserve the cancellation count reported by :meth:`asyncio.Task." +"cancelling`." +msgstr "" + +#: ../../library/asyncio-task.rst:414 +msgid "" +"Improved handling of simultaneous internal and external cancellations and " +"correct preservation of cancellation counts." +msgstr "" + +#: ../../library/asyncio-task.rst:418 +msgid "Terminating a Task Group" +msgstr "" + +#: ../../library/asyncio-task.rst:420 +msgid "" +"While terminating a task group is not natively supported by the standard " +"library, termination can be achieved by adding an exception-raising task to " +"the task group and ignoring the raised exception:" +msgstr "" + +#: ../../library/asyncio-task.rst:424 +msgid "" +"import asyncio\n" +"from asyncio import TaskGroup\n" +"\n" +"class TerminateTaskGroup(Exception):\n" +" \"\"\"Exception raised to terminate a task group.\"\"\"\n" +"\n" +"async def force_terminate_task_group():\n" +" \"\"\"Used to force termination of a task group.\"\"\"\n" +" raise TerminateTaskGroup()\n" +"\n" +"async def job(task_id, sleep_time):\n" +" print(f'Task {task_id}: start')\n" +" await asyncio.sleep(sleep_time)\n" +" print(f'Task {task_id}: done')\n" +"\n" +"async def main():\n" +" try:\n" +" async with TaskGroup() as group:\n" +" # spawn some tasks\n" +" group.create_task(job(1, 0.5))\n" +" group.create_task(job(2, 1.5))\n" +" # sleep for 1 second\n" +" await asyncio.sleep(1)\n" +" # add an exception-raising task to force the group to terminate\n" +" group.create_task(force_terminate_task_group())\n" +" except* TerminateTaskGroup:\n" +" pass\n" +"\n" +"asyncio.run(main())" +msgstr "" + +#: ../../library/asyncio-task.rst:456 +msgid "Expected output:" +msgstr "預期的輸出: ::" + +#: ../../library/asyncio-task.rst:458 +msgid "" +"Task 1: start\n" +"Task 2: start\n" +"Task 1: done" +msgstr "" + +#: ../../library/asyncio-task.rst:465 msgid "Sleeping" msgstr "" -#: ../../library/asyncio-task.rst:394 +#: ../../library/asyncio-task.rst:469 msgid "Block for *delay* seconds." msgstr "" -#: ../../library/asyncio-task.rst:396 +#: ../../library/asyncio-task.rst:471 msgid "" "If *result* is provided, it is returned to the caller when the coroutine " "completes." msgstr "" -#: ../../library/asyncio-task.rst:399 +#: ../../library/asyncio-task.rst:474 msgid "" "``sleep()`` always suspends the current task, allowing other tasks to run." msgstr "" -#: ../../library/asyncio-task.rst:402 +#: ../../library/asyncio-task.rst:477 msgid "" "Setting the delay to 0 provides an optimized path to allow other tasks to " "run. This can be used by long-running functions to avoid blocking the event " "loop for the full duration of the function call." msgstr "" -#: ../../library/asyncio-task.rst:408 +#: ../../library/asyncio-task.rst:483 msgid "" "Example of coroutine displaying the current date every second for 5 seconds::" msgstr "" -#: ../../library/asyncio-task.rst:411 +#: ../../library/asyncio-task.rst:486 msgid "" "import asyncio\n" "import datetime\n" @@ -624,36 +715,40 @@ msgstr "" "\n" "asyncio.run(display_date())" -#: ../../library/asyncio-task.rst:426 ../../library/asyncio-task.rst:521 -#: ../../library/asyncio-task.rst:620 ../../library/asyncio-task.rst:794 -#: ../../library/asyncio-task.rst:848 ../../library/asyncio-task.rst:874 +#: ../../library/asyncio-task.rst:501 ../../library/asyncio-task.rst:599 +#: ../../library/asyncio-task.rst:698 ../../library/asyncio-task.rst:872 +#: ../../library/asyncio-task.rst:926 ../../library/asyncio-task.rst:983 msgid "Removed the *loop* parameter." msgstr "移除 *loop* 參數。" -#: ../../library/asyncio-task.rst:431 +#: ../../library/asyncio-task.rst:504 +msgid "Raises :exc:`ValueError` if *delay* is :data:`~math.nan`." +msgstr "" + +#: ../../library/asyncio-task.rst:509 msgid "Running Tasks Concurrently" msgstr "" -#: ../../library/asyncio-task.rst:435 +#: ../../library/asyncio-task.rst:513 msgid "" "Run :ref:`awaitable objects ` in the *aws* sequence " "*concurrently*." msgstr "" -#: ../../library/asyncio-task.rst:438 +#: ../../library/asyncio-task.rst:516 msgid "" "If any awaitable in *aws* is a coroutine, it is automatically scheduled as a " "Task." msgstr "" -#: ../../library/asyncio-task.rst:441 +#: ../../library/asyncio-task.rst:519 msgid "" "If all awaitables are completed successfully, the result is an aggregate " "list of returned values. The order of result values corresponds to the " "order of awaitables in *aws*." msgstr "" -#: ../../library/asyncio-task.rst:445 +#: ../../library/asyncio-task.rst:523 msgid "" "If *return_exceptions* is ``False`` (default), the first raised exception is " "immediately propagated to the task that awaits on ``gather()``. Other " @@ -661,19 +756,19 @@ msgid "" "run." msgstr "" -#: ../../library/asyncio-task.rst:450 +#: ../../library/asyncio-task.rst:528 msgid "" "If *return_exceptions* is ``True``, exceptions are treated the same as " "successful results, and aggregated in the result list." msgstr "" -#: ../../library/asyncio-task.rst:453 +#: ../../library/asyncio-task.rst:531 msgid "" "If ``gather()`` is *cancelled*, all submitted awaitables (that have not " "completed yet) are also *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:456 +#: ../../library/asyncio-task.rst:534 msgid "" "If any Task or Future from the *aws* sequence is *cancelled*, it is treated " "as if it raised :exc:`CancelledError` -- the ``gather()`` call is **not** " @@ -681,7 +776,7 @@ msgid "" "submitted Task/Future to cause other Tasks/Futures to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:463 +#: ../../library/asyncio-task.rst:541 msgid "" "A new alternative to create and run tasks concurrently and wait for their " "completion is :class:`asyncio.TaskGroup`. *TaskGroup* provides stronger " @@ -691,7 +786,7 @@ msgid "" "tasks)." msgstr "" -#: ../../library/asyncio-task.rst:474 +#: ../../library/asyncio-task.rst:552 msgid "" "import asyncio\n" "\n" @@ -730,7 +825,7 @@ msgid "" "# [2, 6, 24]" msgstr "" -#: ../../library/asyncio-task.rst:510 +#: ../../library/asyncio-task.rst:588 msgid "" "If *return_exceptions* is false, cancelling gather() after it has been " "marked done won't cancel any submitted awaitables. For instance, gather can " @@ -739,28 +834,28 @@ msgid "" "the awaitables) from gather won't cancel any other awaitables." msgstr "" -#: ../../library/asyncio-task.rst:517 +#: ../../library/asyncio-task.rst:595 msgid "" "If the *gather* itself is cancelled, the cancellation is propagated " "regardless of *return_exceptions*." msgstr "" -#: ../../library/asyncio-task.rst:524 +#: ../../library/asyncio-task.rst:602 msgid "" "Deprecation warning is emitted if no positional arguments are provided or " "not all positional arguments are Future-like objects and there is no running " "event loop." msgstr "" -#: ../../library/asyncio-task.rst:533 +#: ../../library/asyncio-task.rst:611 msgid "Eager Task Factory" msgstr "" -#: ../../library/asyncio-task.rst:537 +#: ../../library/asyncio-task.rst:615 msgid "A task factory for eager task execution." msgstr "" -#: ../../library/asyncio-task.rst:539 +#: ../../library/asyncio-task.rst:617 msgid "" "When using this factory (via :meth:`loop.set_task_factory(asyncio." "eager_task_factory) `), coroutines begin execution " @@ -770,13 +865,13 @@ msgid "" "synchronously." msgstr "" -#: ../../library/asyncio-task.rst:545 +#: ../../library/asyncio-task.rst:623 msgid "" "A common example where this is beneficial is coroutines which employ caching " "or memoization to avoid actual I/O when possible." msgstr "" -#: ../../library/asyncio-task.rst:550 +#: ../../library/asyncio-task.rst:628 msgid "" "Immediate execution of the coroutine is a semantic change. If the coroutine " "returns or raises, the task is never scheduled to the event loop. If the " @@ -785,46 +880,46 @@ msgid "" "the application's task execution order is likely to change." msgstr "" -#: ../../library/asyncio-task.rst:561 +#: ../../library/asyncio-task.rst:639 msgid "" "Create an eager task factory, similar to :func:`eager_task_factory`, using " "the provided *custom_task_constructor* when creating a new task instead of " "the default :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:565 +#: ../../library/asyncio-task.rst:643 msgid "" "*custom_task_constructor* must be a *callable* with the signature matching " "the signature of :class:`Task.__init__ `. The callable must return a :" "class:`asyncio.Task`-compatible object." msgstr "" -#: ../../library/asyncio-task.rst:569 +#: ../../library/asyncio-task.rst:647 msgid "" "This function returns a *callable* intended to be used as a task factory of " "an event loop via :meth:`loop.set_task_factory(factory) `)." msgstr "" -#: ../../library/asyncio-task.rst:576 +#: ../../library/asyncio-task.rst:654 msgid "Shielding From Cancellation" msgstr "" -#: ../../library/asyncio-task.rst:580 +#: ../../library/asyncio-task.rst:658 msgid "" "Protect an :ref:`awaitable object ` from being :meth:" "`cancelled `." msgstr "" -#: ../../library/asyncio-task.rst:583 ../../library/asyncio-task.rst:749 +#: ../../library/asyncio-task.rst:661 ../../library/asyncio-task.rst:827 msgid "If *aw* is a coroutine it is automatically scheduled as a Task." msgstr "" -#: ../../library/asyncio-task.rst:585 +#: ../../library/asyncio-task.rst:663 msgid "The statement::" msgstr "" -#: ../../library/asyncio-task.rst:587 +#: ../../library/asyncio-task.rst:665 msgid "" "task = asyncio.create_task(something())\n" "res = await shield(task)" @@ -832,15 +927,15 @@ msgstr "" "task = asyncio.create_task(something())\n" "res = await shield(task)" -#: ../../library/asyncio-task.rst:590 +#: ../../library/asyncio-task.rst:668 msgid "is equivalent to::" msgstr "" -#: ../../library/asyncio-task.rst:592 +#: ../../library/asyncio-task.rst:670 msgid "res = await something()" msgstr "res = await something()" -#: ../../library/asyncio-task.rst:594 +#: ../../library/asyncio-task.rst:672 msgid "" "*except* that if the coroutine containing it is cancelled, the Task running " "in ``something()`` is not cancelled. From the point of view of " @@ -849,20 +944,20 @@ msgid "" "`CancelledError`." msgstr "" -#: ../../library/asyncio-task.rst:600 +#: ../../library/asyncio-task.rst:678 msgid "" "If ``something()`` is cancelled by other means (i.e. from within itself) " "that would also cancel ``shield()``." msgstr "" -#: ../../library/asyncio-task.rst:603 +#: ../../library/asyncio-task.rst:681 msgid "" "If it is desired to completely ignore cancellation (not recommended) the " "``shield()`` function should be combined with a try/except clause, as " "follows::" msgstr "" -#: ../../library/asyncio-task.rst:607 +#: ../../library/asyncio-task.rst:685 msgid "" "task = asyncio.create_task(something())\n" "try:\n" @@ -876,7 +971,7 @@ msgstr "" "except CancelledError:\n" " res = None" -#: ../../library/asyncio-task.rst:615 +#: ../../library/asyncio-task.rst:693 msgid "" "Save a reference to tasks passed to this function, to avoid a task " "disappearing mid-execution. The event loop only keeps weak references to " @@ -884,36 +979,36 @@ msgid "" "any time, even before it's done." msgstr "" -#: ../../library/asyncio-task.rst:623 +#: ../../library/asyncio-task.rst:701 msgid "" "Deprecation warning is emitted if *aw* is not Future-like object and there " "is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:629 +#: ../../library/asyncio-task.rst:707 msgid "Timeouts" msgstr "" -#: ../../library/asyncio-task.rst:633 +#: ../../library/asyncio-task.rst:711 msgid "" "Return an :ref:`asynchronous context manager ` that " "can be used to limit the amount of time spent waiting on something." msgstr "" -#: ../../library/asyncio-task.rst:637 +#: ../../library/asyncio-task.rst:715 msgid "" "*delay* can either be ``None``, or a float/int number of seconds to wait. If " "*delay* is ``None``, no time limit will be applied; this can be useful if " "the delay is unknown when the context manager is created." msgstr "" -#: ../../library/asyncio-task.rst:642 +#: ../../library/asyncio-task.rst:720 msgid "" "In either case, the context manager can be rescheduled after creation using :" "meth:`Timeout.reschedule`." msgstr "" -#: ../../library/asyncio-task.rst:647 +#: ../../library/asyncio-task.rst:725 msgid "" "async def main():\n" " async with asyncio.timeout(10):\n" @@ -923,7 +1018,7 @@ msgstr "" " async with asyncio.timeout(10):\n" " await long_running_task()" -#: ../../library/asyncio-task.rst:651 +#: ../../library/asyncio-task.rst:729 msgid "" "If ``long_running_task`` takes more than 10 seconds to complete, the context " "manager will cancel the current task and handle the resulting :exc:`asyncio." @@ -931,18 +1026,18 @@ msgid "" "can be caught and handled." msgstr "" -#: ../../library/asyncio-task.rst:658 +#: ../../library/asyncio-task.rst:736 msgid "" "The :func:`asyncio.timeout` context manager is what transforms the :exc:" "`asyncio.CancelledError` into a :exc:`TimeoutError`, which means the :exc:" "`TimeoutError` can only be caught *outside* of the context manager." msgstr "" -#: ../../library/asyncio-task.rst:663 +#: ../../library/asyncio-task.rst:741 msgid "Example of catching :exc:`TimeoutError`::" msgstr "" -#: ../../library/asyncio-task.rst:665 +#: ../../library/asyncio-task.rst:743 msgid "" "async def main():\n" " try:\n" @@ -954,48 +1049,48 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:674 +#: ../../library/asyncio-task.rst:752 msgid "" "The context manager produced by :func:`asyncio.timeout` can be rescheduled " "to a different deadline and inspected." msgstr "" -#: ../../library/asyncio-task.rst:679 +#: ../../library/asyncio-task.rst:757 msgid "" "An :ref:`asynchronous context manager ` for " "cancelling overdue coroutines." msgstr "" -#: ../../library/asyncio-task.rst:682 +#: ../../library/asyncio-task.rst:760 msgid "" "``when`` should be an absolute time at which the context should time out, as " "measured by the event loop's clock:" msgstr "" -#: ../../library/asyncio-task.rst:685 +#: ../../library/asyncio-task.rst:763 msgid "If ``when`` is ``None``, the timeout will never trigger." msgstr "" -#: ../../library/asyncio-task.rst:686 +#: ../../library/asyncio-task.rst:764 msgid "" "If ``when < loop.time()``, the timeout will trigger on the next iteration of " "the event loop." msgstr "" -#: ../../library/asyncio-task.rst:691 +#: ../../library/asyncio-task.rst:769 msgid "" "Return the current deadline, or ``None`` if the current deadline is not set." msgstr "" -#: ../../library/asyncio-task.rst:696 +#: ../../library/asyncio-task.rst:774 msgid "Reschedule the timeout." msgstr "" -#: ../../library/asyncio-task.rst:700 +#: ../../library/asyncio-task.rst:778 msgid "Return whether the context manager has exceeded its deadline (expired)." msgstr "" -#: ../../library/asyncio-task.rst:705 +#: ../../library/asyncio-task.rst:783 msgid "" "async def main():\n" " try:\n" @@ -1013,17 +1108,17 @@ msgid "" " print(\"Looks like we haven't finished on time.\")" msgstr "" -#: ../../library/asyncio-task.rst:720 +#: ../../library/asyncio-task.rst:798 msgid "Timeout context managers can be safely nested." msgstr "" -#: ../../library/asyncio-task.rst:726 +#: ../../library/asyncio-task.rst:804 msgid "" "Similar to :func:`asyncio.timeout`, except *when* is the absolute time to " "stop waiting, or ``None``." msgstr "" -#: ../../library/asyncio-task.rst:731 +#: ../../library/asyncio-task.rst:809 msgid "" "async def main():\n" " loop = get_running_loop()\n" @@ -1037,41 +1132,41 @@ msgid "" " print(\"This statement will run regardless.\")" msgstr "" -#: ../../library/asyncio-task.rst:746 +#: ../../library/asyncio-task.rst:824 msgid "" "Wait for the *aw* :ref:`awaitable ` to complete with a " "timeout." msgstr "" -#: ../../library/asyncio-task.rst:751 +#: ../../library/asyncio-task.rst:829 msgid "" "*timeout* can either be ``None`` or a float or int number of seconds to wait " "for. If *timeout* is ``None``, block until the future completes." msgstr "" -#: ../../library/asyncio-task.rst:755 +#: ../../library/asyncio-task.rst:833 msgid "" "If a timeout occurs, it cancels the task and raises :exc:`TimeoutError`." msgstr "" -#: ../../library/asyncio-task.rst:758 +#: ../../library/asyncio-task.rst:836 msgid "" "To avoid the task :meth:`cancellation `, wrap it in :func:" "`shield`." msgstr "" -#: ../../library/asyncio-task.rst:761 +#: ../../library/asyncio-task.rst:839 msgid "" "The function will wait until the future is actually cancelled, so the total " "wait time may exceed the *timeout*. If an exception happens during " "cancellation, it is propagated." msgstr "" -#: ../../library/asyncio-task.rst:765 +#: ../../library/asyncio-task.rst:843 msgid "If the wait is cancelled, the future *aw* is also cancelled." msgstr "" -#: ../../library/asyncio-task.rst:771 +#: ../../library/asyncio-task.rst:849 msgid "" "async def eternity():\n" " # Sleep for one hour\n" @@ -1092,137 +1187,186 @@ msgid "" "# timeout!" msgstr "" -#: ../../library/asyncio-task.rst:789 +#: ../../library/asyncio-task.rst:867 msgid "" "When *aw* is cancelled due to a timeout, ``wait_for`` waits for *aw* to be " "cancelled. Previously, it raised :exc:`TimeoutError` immediately." msgstr "" -#: ../../library/asyncio-task.rst:797 +#: ../../library/asyncio-task.rst:875 msgid "Raises :exc:`TimeoutError` instead of :exc:`asyncio.TimeoutError`." msgstr "引發 :exc:`TimeoutError` 而不是 :exc:`asyncio.TimeoutError`。" -#: ../../library/asyncio-task.rst:802 +#: ../../library/asyncio-task.rst:880 msgid "Waiting Primitives" msgstr "" -#: ../../library/asyncio-task.rst:806 +#: ../../library/asyncio-task.rst:884 msgid "" "Run :class:`~asyncio.Future` and :class:`~asyncio.Task` instances in the " "*aws* iterable concurrently and block until the condition specified by " "*return_when*." msgstr "" -#: ../../library/asyncio-task.rst:810 +#: ../../library/asyncio-task.rst:888 msgid "The *aws* iterable must not be empty." msgstr "" -#: ../../library/asyncio-task.rst:812 +#: ../../library/asyncio-task.rst:890 msgid "Returns two sets of Tasks/Futures: ``(done, pending)``." msgstr "" -#: ../../library/asyncio-task.rst:814 +#: ../../library/asyncio-task.rst:892 msgid "Usage::" msgstr "用法: ::" -#: ../../library/asyncio-task.rst:816 +#: ../../library/asyncio-task.rst:894 msgid "done, pending = await asyncio.wait(aws)" msgstr "done, pending = await asyncio.wait(aws)" -#: ../../library/asyncio-task.rst:818 +#: ../../library/asyncio-task.rst:896 msgid "" "*timeout* (a float or int), if specified, can be used to control the maximum " "number of seconds to wait before returning." msgstr "" -#: ../../library/asyncio-task.rst:821 +#: ../../library/asyncio-task.rst:899 msgid "" "Note that this function does not raise :exc:`TimeoutError`. Futures or Tasks " "that aren't done when the timeout occurs are simply returned in the second " "set." msgstr "" -#: ../../library/asyncio-task.rst:825 +#: ../../library/asyncio-task.rst:903 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "" -#: ../../library/asyncio-task.rst:831 +#: ../../library/asyncio-task.rst:909 msgid "Constant" msgstr "常數" -#: ../../library/asyncio-task.rst:832 +#: ../../library/asyncio-task.rst:910 msgid "Description" msgstr "描述" -#: ../../library/asyncio-task.rst:835 +#: ../../library/asyncio-task.rst:913 msgid "The function will return when any future finishes or is cancelled." msgstr "" -#: ../../library/asyncio-task.rst:838 +#: ../../library/asyncio-task.rst:916 msgid "" "The function will return when any future finishes by raising an exception. " "If no future raises an exception then it is equivalent to :const:" "`ALL_COMPLETED`." msgstr "" -#: ../../library/asyncio-task.rst:843 +#: ../../library/asyncio-task.rst:921 msgid "The function will return when all futures finish or are cancelled." msgstr "" -#: ../../library/asyncio-task.rst:845 +#: ../../library/asyncio-task.rst:923 msgid "" "Unlike :func:`~asyncio.wait_for`, ``wait()`` does not cancel the futures " "when a timeout occurs." msgstr "" -#: ../../library/asyncio-task.rst:851 +#: ../../library/asyncio-task.rst:929 msgid "Passing coroutine objects to ``wait()`` directly is forbidden." msgstr "" -#: ../../library/asyncio-task.rst:854 ../../library/asyncio-task.rst:881 +#: ../../library/asyncio-task.rst:932 ../../library/asyncio-task.rst:990 msgid "Added support for generators yielding tasks." msgstr "" -#: ../../library/asyncio-task.rst:860 +#: ../../library/asyncio-task.rst:938 msgid "" "Run :ref:`awaitable objects ` in the *aws* iterable " -"concurrently. Return an iterator of coroutines. Each coroutine returned can " -"be awaited to get the earliest next result from the iterable of the " -"remaining awaitables." +"concurrently. The returned object can be iterated to obtain the results of " +"the awaitables as they finish." +msgstr "" + +#: ../../library/asyncio-task.rst:942 +msgid "" +"The object returned by ``as_completed()`` can be iterated as an :term:" +"`asynchronous iterator` or a plain :term:`iterator`. When asynchronous " +"iteration is used, the originally-supplied awaitables are yielded if they " +"are tasks or futures. This makes it easy to correlate previously-scheduled " +"tasks with their results. Example::" msgstr "" -#: ../../library/asyncio-task.rst:865 +#: ../../library/asyncio-task.rst:948 msgid "" -"Raises :exc:`TimeoutError` if the timeout occurs before all Futures are done." +"ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" +"ipv6_connect = create_task(open_connection(\"::1\", 80))\n" +"tasks = [ipv4_connect, ipv6_connect]\n" +"\n" +"async for earliest_connect in as_completed(tasks):\n" +" # earliest_connect is done. The result can be obtained by\n" +" # awaiting it or calling earliest_connect.result()\n" +" reader, writer = await earliest_connect\n" +"\n" +" if earliest_connect is ipv6_connect:\n" +" print(\"IPv6 connection established.\")\n" +" else:\n" +" print(\"IPv4 connection established.\")" msgstr "" -#: ../../library/asyncio-task.rst:870 +#: ../../library/asyncio-task.rst:962 msgid "" -"for coro in as_completed(aws):\n" -" earliest_result = await coro\n" -" # ..." +"During asynchronous iteration, implicitly-created tasks will be yielded for " +"supplied awaitables that aren't tasks or futures." msgstr "" -"for coro in as_completed(aws):\n" -" earliest_result = await coro\n" -" # ..." -#: ../../library/asyncio-task.rst:877 +#: ../../library/asyncio-task.rst:965 +msgid "" +"When used as a plain iterator, each iteration yields a new coroutine that " +"returns the result or raises the exception of the next completed awaitable. " +"This pattern is compatible with Python versions older than 3.13::" +msgstr "" + +#: ../../library/asyncio-task.rst:969 +msgid "" +"ipv4_connect = create_task(open_connection(\"127.0.0.1\", 80))\n" +"ipv6_connect = create_task(open_connection(\"::1\", 80))\n" +"tasks = [ipv4_connect, ipv6_connect]\n" +"\n" +"for next_connect in as_completed(tasks):\n" +" # next_connect is not one of the original task objects. It must be\n" +" # awaited to obtain the result value or raise the exception of the\n" +" # awaitable that finishes next.\n" +" reader, writer = await next_connect" +msgstr "" + +#: ../../library/asyncio-task.rst:979 +msgid "" +"A :exc:`TimeoutError` is raised if the timeout occurs before all awaitables " +"are done. This is raised by the ``async for`` loop during asynchronous " +"iteration or by the coroutines yielded during plain iteration." +msgstr "" + +#: ../../library/asyncio-task.rst:986 msgid "" "Deprecation warning is emitted if not all awaitable objects in the *aws* " "iterable are Future-like objects and there is no running event loop." msgstr "" -#: ../../library/asyncio-task.rst:886 +#: ../../library/asyncio-task.rst:993 +msgid "" +"The result can now be used as either an :term:`asynchronous iterator` or as " +"a plain :term:`iterator` (previously it was only a plain iterator)." +msgstr "" + +#: ../../library/asyncio-task.rst:999 msgid "Running in Threads" msgstr "" -#: ../../library/asyncio-task.rst:890 +#: ../../library/asyncio-task.rst:1003 msgid "Asynchronously run function *func* in a separate thread." msgstr "" -#: ../../library/asyncio-task.rst:892 +#: ../../library/asyncio-task.rst:1005 msgid "" "Any \\*args and \\*\\*kwargs supplied for this function are directly passed " "to *func*. Also, the current :class:`contextvars.Context` is propagated, " @@ -1230,19 +1374,19 @@ msgid "" "separate thread." msgstr "" -#: ../../library/asyncio-task.rst:897 +#: ../../library/asyncio-task.rst:1010 msgid "" "Return a coroutine that can be awaited to get the eventual result of *func*." msgstr "" -#: ../../library/asyncio-task.rst:899 +#: ../../library/asyncio-task.rst:1012 msgid "" "This coroutine function is primarily intended to be used for executing IO-" "bound functions/methods that would otherwise block the event loop if they " "were run in the main thread. For example::" msgstr "" -#: ../../library/asyncio-task.rst:903 +#: ../../library/asyncio-task.rst:1016 msgid "" "def blocking_io():\n" " print(f\"start blocking_io at {time.strftime('%X')}\")\n" @@ -1271,7 +1415,7 @@ msgid "" "# finished main at 19:50:54" msgstr "" -#: ../../library/asyncio-task.rst:929 +#: ../../library/asyncio-task.rst:1042 msgid "" "Directly calling ``blocking_io()`` in any coroutine would block the event " "loop for its duration, resulting in an additional 1 second of run time. " @@ -1279,7 +1423,7 @@ msgid "" "thread without blocking the event loop." msgstr "" -#: ../../library/asyncio-task.rst:936 +#: ../../library/asyncio-task.rst:1049 msgid "" "Due to the :term:`GIL`, ``asyncio.to_thread()`` can typically only be used " "to make IO-bound functions non-blocking. However, for extension modules that " @@ -1287,27 +1431,27 @@ msgid "" "``asyncio.to_thread()`` can also be used for CPU-bound functions." msgstr "" -#: ../../library/asyncio-task.rst:945 +#: ../../library/asyncio-task.rst:1058 msgid "Scheduling From Other Threads" msgstr "" -#: ../../library/asyncio-task.rst:949 +#: ../../library/asyncio-task.rst:1062 msgid "Submit a coroutine to the given event loop. Thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:951 +#: ../../library/asyncio-task.rst:1064 msgid "" "Return a :class:`concurrent.futures.Future` to wait for the result from " "another OS thread." msgstr "" -#: ../../library/asyncio-task.rst:954 +#: ../../library/asyncio-task.rst:1067 msgid "" "This function is meant to be called from a different OS thread than the one " "where the event loop is running. Example::" msgstr "" -#: ../../library/asyncio-task.rst:957 +#: ../../library/asyncio-task.rst:1070 msgid "" "# Create a coroutine\n" "coro = asyncio.sleep(1, result=3)\n" @@ -1319,13 +1463,13 @@ msgid "" "assert future.result(timeout) == 3" msgstr "" -#: ../../library/asyncio-task.rst:966 +#: ../../library/asyncio-task.rst:1079 msgid "" "If an exception is raised in the coroutine, the returned Future will be " "notified. It can also be used to cancel the task in the event loop::" msgstr "" -#: ../../library/asyncio-task.rst:970 +#: ../../library/asyncio-task.rst:1083 msgid "" "try:\n" " result = future.result(timeout)\n" @@ -1338,59 +1482,59 @@ msgid "" " print(f'The coroutine returned: {result!r}')" msgstr "" -#: ../../library/asyncio-task.rst:980 +#: ../../library/asyncio-task.rst:1093 msgid "" "See the :ref:`concurrency and multithreading ` " "section of the documentation." msgstr "" -#: ../../library/asyncio-task.rst:983 +#: ../../library/asyncio-task.rst:1096 msgid "" "Unlike other asyncio functions this function requires the *loop* argument to " "be passed explicitly." msgstr "" -#: ../../library/asyncio-task.rst:990 +#: ../../library/asyncio-task.rst:1103 msgid "Introspection" msgstr "" -#: ../../library/asyncio-task.rst:995 +#: ../../library/asyncio-task.rst:1108 msgid "" "Return the currently running :class:`Task` instance, or ``None`` if no task " "is running." msgstr "" -#: ../../library/asyncio-task.rst:998 +#: ../../library/asyncio-task.rst:1111 msgid "" "If *loop* is ``None`` :func:`get_running_loop` is used to get the current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1006 +#: ../../library/asyncio-task.rst:1119 msgid "Return a set of not yet finished :class:`Task` objects run by the loop." msgstr "" -#: ../../library/asyncio-task.rst:1009 +#: ../../library/asyncio-task.rst:1122 msgid "" "If *loop* is ``None``, :func:`get_running_loop` is used for getting current " "loop." msgstr "" -#: ../../library/asyncio-task.rst:1017 +#: ../../library/asyncio-task.rst:1130 msgid "Return ``True`` if *obj* is a coroutine object." msgstr "" -#: ../../library/asyncio-task.rst:1023 +#: ../../library/asyncio-task.rst:1136 msgid "Task Object" msgstr "" -#: ../../library/asyncio-task.rst:1027 +#: ../../library/asyncio-task.rst:1140 msgid "" "A :class:`Future-like ` object that runs a Python :ref:`coroutine " "`. Not thread-safe." msgstr "" -#: ../../library/asyncio-task.rst:1030 +#: ../../library/asyncio-task.rst:1143 msgid "" "Tasks are used to run coroutines in event loops. If a coroutine awaits on a " "Future, the Task suspends the execution of the coroutine and waits for the " @@ -1398,21 +1542,21 @@ msgid "" "wrapped coroutine resumes." msgstr "" -#: ../../library/asyncio-task.rst:1036 +#: ../../library/asyncio-task.rst:1149 msgid "" "Event loops use cooperative scheduling: an event loop runs one Task at a " "time. While a Task awaits for the completion of a Future, the event loop " "runs other Tasks, callbacks, or performs IO operations." msgstr "" -#: ../../library/asyncio-task.rst:1041 +#: ../../library/asyncio-task.rst:1154 msgid "" "Use the high-level :func:`asyncio.create_task` function to create Tasks, or " "the low-level :meth:`loop.create_task` or :func:`ensure_future` functions. " "Manual instantiation of Tasks is discouraged." msgstr "" -#: ../../library/asyncio-task.rst:1046 +#: ../../library/asyncio-task.rst:1159 msgid "" "To cancel a running Task use the :meth:`cancel` method. Calling it will " "cause the Task to throw a :exc:`CancelledError` exception into the wrapped " @@ -1420,20 +1564,20 @@ msgid "" "cancellation, the Future object will be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1051 +#: ../../library/asyncio-task.rst:1164 msgid "" ":meth:`cancelled` can be used to check if the Task was cancelled. The method " "returns ``True`` if the wrapped coroutine did not suppress the :exc:" "`CancelledError` exception and was actually cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1056 +#: ../../library/asyncio-task.rst:1169 msgid "" ":class:`asyncio.Task` inherits from :class:`Future` all of its APIs except :" "meth:`Future.set_result` and :meth:`Future.set_exception`." msgstr "" -#: ../../library/asyncio-task.rst:1060 +#: ../../library/asyncio-task.rst:1173 msgid "" "An optional keyword-only *context* argument allows specifying a custom :" "class:`contextvars.Context` for the *coro* to run in. If no *context* is " @@ -1441,7 +1585,7 @@ msgid "" "in the copied context." msgstr "" -#: ../../library/asyncio-task.rst:1065 +#: ../../library/asyncio-task.rst:1178 msgid "" "An optional keyword-only *eager_start* argument allows eagerly starting the " "execution of the :class:`asyncio.Task` at task creation time. If set to " @@ -1451,96 +1595,96 @@ msgid "" "eagerly and will skip scheduling to the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1072 +#: ../../library/asyncio-task.rst:1185 msgid "Added support for the :mod:`contextvars` module." msgstr "" -#: ../../library/asyncio-task.rst:1078 +#: ../../library/asyncio-task.rst:1191 msgid "" "Deprecation warning is emitted if *loop* is not specified and there is no " "running event loop." msgstr "" -#: ../../library/asyncio-task.rst:1085 +#: ../../library/asyncio-task.rst:1198 msgid "Added the *eager_start* parameter." msgstr "新增 *eager_start* 參數。" -#: ../../library/asyncio-task.rst:1090 +#: ../../library/asyncio-task.rst:1203 msgid "Return ``True`` if the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1092 +#: ../../library/asyncio-task.rst:1205 msgid "" "A Task is *done* when the wrapped coroutine either returned a value, raised " "an exception, or the Task was cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1097 +#: ../../library/asyncio-task.rst:1210 msgid "Return the result of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1099 +#: ../../library/asyncio-task.rst:1212 msgid "" "If the Task is *done*, the result of the wrapped coroutine is returned (or " "if the coroutine raised an exception, that exception is re-raised.)" msgstr "" -#: ../../library/asyncio-task.rst:1103 ../../library/asyncio-task.rst:1117 +#: ../../library/asyncio-task.rst:1216 ../../library/asyncio-task.rst:1230 msgid "" "If the Task has been *cancelled*, this method raises a :exc:`CancelledError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1106 +#: ../../library/asyncio-task.rst:1219 msgid "" "If the Task's result isn't yet available, this method raises an :exc:" "`InvalidStateError` exception." msgstr "" -#: ../../library/asyncio-task.rst:1111 +#: ../../library/asyncio-task.rst:1224 msgid "Return the exception of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1113 +#: ../../library/asyncio-task.rst:1226 msgid "" "If the wrapped coroutine raised an exception that exception is returned. If " "the wrapped coroutine returned normally this method returns ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1120 +#: ../../library/asyncio-task.rst:1233 msgid "" "If the Task isn't *done* yet, this method raises an :exc:`InvalidStateError` " "exception." msgstr "" -#: ../../library/asyncio-task.rst:1125 +#: ../../library/asyncio-task.rst:1238 msgid "Add a callback to be run when the Task is *done*." msgstr "" -#: ../../library/asyncio-task.rst:1127 ../../library/asyncio-task.rst:1136 +#: ../../library/asyncio-task.rst:1240 ../../library/asyncio-task.rst:1249 msgid "This method should only be used in low-level callback-based code." msgstr "" -#: ../../library/asyncio-task.rst:1129 +#: ../../library/asyncio-task.rst:1242 msgid "" "See the documentation of :meth:`Future.add_done_callback` for more details." msgstr "" -#: ../../library/asyncio-task.rst:1134 +#: ../../library/asyncio-task.rst:1247 msgid "Remove *callback* from the callbacks list." msgstr "" -#: ../../library/asyncio-task.rst:1138 +#: ../../library/asyncio-task.rst:1251 msgid "" "See the documentation of :meth:`Future.remove_done_callback` for more " "details." msgstr "" -#: ../../library/asyncio-task.rst:1143 +#: ../../library/asyncio-task.rst:1256 msgid "Return the list of stack frames for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1145 +#: ../../library/asyncio-task.rst:1258 msgid "" "If the wrapped coroutine is not done, this returns the stack where it is " "suspended. If the coroutine has completed successfully or was cancelled, " @@ -1548,15 +1692,15 @@ msgid "" "this returns the list of traceback frames." msgstr "" -#: ../../library/asyncio-task.rst:1151 +#: ../../library/asyncio-task.rst:1264 msgid "The frames are always ordered from oldest to newest." msgstr "" -#: ../../library/asyncio-task.rst:1153 +#: ../../library/asyncio-task.rst:1266 msgid "Only one stack frame is returned for a suspended coroutine." msgstr "" -#: ../../library/asyncio-task.rst:1155 +#: ../../library/asyncio-task.rst:1268 msgid "" "The optional *limit* argument sets the maximum number of frames to return; " "by default all available frames are returned. The ordering of the returned " @@ -1565,81 +1709,81 @@ msgid "" "are returned. (This matches the behavior of the traceback module.)" msgstr "" -#: ../../library/asyncio-task.rst:1164 +#: ../../library/asyncio-task.rst:1277 msgid "Print the stack or traceback for this Task." msgstr "" -#: ../../library/asyncio-task.rst:1166 +#: ../../library/asyncio-task.rst:1279 msgid "" "This produces output similar to that of the traceback module for the frames " "retrieved by :meth:`get_stack`." msgstr "" -#: ../../library/asyncio-task.rst:1169 +#: ../../library/asyncio-task.rst:1282 msgid "The *limit* argument is passed to :meth:`get_stack` directly." msgstr "" -#: ../../library/asyncio-task.rst:1171 +#: ../../library/asyncio-task.rst:1284 msgid "" "The *file* argument is an I/O stream to which the output is written; by " "default output is written to :data:`sys.stdout`." msgstr "" -#: ../../library/asyncio-task.rst:1176 +#: ../../library/asyncio-task.rst:1289 msgid "Return the coroutine object wrapped by the :class:`Task`." msgstr "" -#: ../../library/asyncio-task.rst:1180 +#: ../../library/asyncio-task.rst:1293 msgid "" "This will return ``None`` for Tasks which have already completed eagerly. " "See the :ref:`Eager Task Factory `." msgstr "" -#: ../../library/asyncio-task.rst:1187 +#: ../../library/asyncio-task.rst:1300 msgid "Newly added eager task execution means result may be ``None``." msgstr "" -#: ../../library/asyncio-task.rst:1191 +#: ../../library/asyncio-task.rst:1304 msgid "" "Return the :class:`contextvars.Context` object associated with the task." msgstr "" -#: ../../library/asyncio-task.rst:1198 +#: ../../library/asyncio-task.rst:1311 msgid "Return the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1200 +#: ../../library/asyncio-task.rst:1313 msgid "" "If no name has been explicitly assigned to the Task, the default asyncio " "Task implementation generates a default name during instantiation." msgstr "" -#: ../../library/asyncio-task.rst:1208 +#: ../../library/asyncio-task.rst:1321 msgid "Set the name of the Task." msgstr "" -#: ../../library/asyncio-task.rst:1210 +#: ../../library/asyncio-task.rst:1323 msgid "" "The *value* argument can be any object, which is then converted to a string." msgstr "" -#: ../../library/asyncio-task.rst:1213 +#: ../../library/asyncio-task.rst:1326 msgid "" "In the default Task implementation, the name will be visible in the :func:" "`repr` output of a task object." msgstr "" -#: ../../library/asyncio-task.rst:1220 +#: ../../library/asyncio-task.rst:1333 msgid "Request the Task to be cancelled." msgstr "" -#: ../../library/asyncio-task.rst:1222 +#: ../../library/asyncio-task.rst:1335 msgid "" "This arranges for a :exc:`CancelledError` exception to be thrown into the " "wrapped coroutine on the next cycle of the event loop." msgstr "" -#: ../../library/asyncio-task.rst:1225 +#: ../../library/asyncio-task.rst:1338 msgid "" "The coroutine then has a chance to clean up or even deny the request by " "suppressing the exception with a :keyword:`try` ... ... ``except " @@ -1651,21 +1795,21 @@ msgid "" "addition to catching the exception." msgstr "" -#: ../../library/asyncio-task.rst:1235 +#: ../../library/asyncio-task.rst:1348 msgid "Added the *msg* parameter." msgstr "新增 *msg* 參數。" -#: ../../library/asyncio-task.rst:1238 +#: ../../library/asyncio-task.rst:1351 msgid "The ``msg`` parameter is propagated from cancelled task to its awaiter." msgstr "" -#: ../../library/asyncio-task.rst:1243 +#: ../../library/asyncio-task.rst:1356 msgid "" "The following example illustrates how coroutines can intercept the " "cancellation request::" msgstr "" -#: ../../library/asyncio-task.rst:1246 +#: ../../library/asyncio-task.rst:1359 msgid "" "async def cancel_me():\n" " print('cancel_me(): before sleep')\n" @@ -1702,32 +1846,32 @@ msgid "" "# main(): cancel_me is cancelled now" msgstr "" -#: ../../library/asyncio-task.rst:1282 +#: ../../library/asyncio-task.rst:1395 msgid "Return ``True`` if the Task is *cancelled*." msgstr "" -#: ../../library/asyncio-task.rst:1284 +#: ../../library/asyncio-task.rst:1397 msgid "" "The Task is *cancelled* when the cancellation was requested with :meth:" "`cancel` and the wrapped coroutine propagated the :exc:`CancelledError` " "exception thrown into it." msgstr "" -#: ../../library/asyncio-task.rst:1290 +#: ../../library/asyncio-task.rst:1403 msgid "Decrement the count of cancellation requests to this Task." msgstr "" -#: ../../library/asyncio-task.rst:1292 +#: ../../library/asyncio-task.rst:1405 msgid "Returns the remaining number of cancellation requests." msgstr "" -#: ../../library/asyncio-task.rst:1294 +#: ../../library/asyncio-task.rst:1407 msgid "" "Note that once execution of a cancelled task completed, further calls to :" "meth:`uncancel` are ineffective." msgstr "" -#: ../../library/asyncio-task.rst:1299 +#: ../../library/asyncio-task.rst:1412 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. In particular, if a Task gets successfully uncancelled, this " @@ -1736,7 +1880,7 @@ msgid "" "respective structured block. For example::" msgstr "" -#: ../../library/asyncio-task.rst:1306 +#: ../../library/asyncio-task.rst:1419 msgid "" "async def make_request_with_timeout():\n" " try:\n" @@ -1750,7 +1894,7 @@ msgid "" " await unrelated_code()" msgstr "" -#: ../../library/asyncio-task.rst:1317 +#: ../../library/asyncio-task.rst:1430 msgid "" "While the block with ``make_request()`` and ``make_another_request()`` might " "get cancelled due to the timeout, ``unrelated_code()`` should continue " @@ -1759,20 +1903,33 @@ msgid "" "similar fashion." msgstr "" -#: ../../library/asyncio-task.rst:1323 +#: ../../library/asyncio-task.rst:1436 msgid "" "If end-user code is, for some reason, suppressing cancellation by catching :" "exc:`CancelledError`, it needs to call this method to remove the " "cancellation state." msgstr "" -#: ../../library/asyncio-task.rst:1329 +#: ../../library/asyncio-task.rst:1440 +msgid "" +"When this method decrements the cancellation count to zero, the method " +"checks if a previous :meth:`cancel` call had arranged for :exc:" +"`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 +msgid "Changed to rescind pending cancellation requests upon reaching zero." +msgstr "" + +#: ../../library/asyncio-task.rst:1451 msgid "" "Return the number of pending cancellation requests to this Task, i.e., the " "number of calls to :meth:`cancel` less the number of :meth:`uncancel` calls." msgstr "" -#: ../../library/asyncio-task.rst:1333 +#: ../../library/asyncio-task.rst:1455 msgid "" "Note that if this number is greater than zero but the Task is still " "executing, :meth:`cancelled` will still return ``False``. This is because " @@ -1781,12 +1938,21 @@ msgid "" "to zero." msgstr "" -#: ../../library/asyncio-task.rst:1339 +#: ../../library/asyncio-task.rst:1461 msgid "" "This method is used by asyncio's internals and isn't expected to be used by " "end-user code. See :meth:`uncancel` for more details." msgstr "" +#~ msgid "" +#~ "for coro in as_completed(aws):\n" +#~ " earliest_result = await coro\n" +#~ " # ..." +#~ msgstr "" +#~ "for coro in as_completed(aws):\n" +#~ " earliest_result = await coro\n" +#~ " # ..." + #~ msgid ":const:`FIRST_COMPLETED`" #~ msgstr ":const:`FIRST_COMPLETED`" diff --git a/library/asyncio.po b/library/asyncio.po index 6fd394fb11..56727e33e5 100644 --- a/library/asyncio.po +++ b/library/asyncio.po @@ -7,9 +7,9 @@ # Leo Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-11-23 12:40+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -21,15 +21,15 @@ msgstr "" "Plural-Forms: nplurals=1; plural=0;\n" "X-Generator: Poedit 3.0\n" -#: ../../library/asyncio.rst:87 +#: ../../library/asyncio.rst:91 msgid "High-level APIs" msgstr "高階 API" -#: ../../library/asyncio.rst:99 +#: ../../library/asyncio.rst:103 msgid "Low-level APIs" msgstr "低階 API" -#: ../../library/asyncio.rst:110 +#: ../../library/asyncio.rst:114 msgid "Guides and Tutorials" msgstr "指南與教學" @@ -148,24 +148,26 @@ msgstr "" "based) 的函式庫與程式碼。" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上不起作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/asyncio.rst:64 msgid "asyncio REPL" msgstr "" #: ../../library/asyncio.rst:65 -msgid "You can experiment with an ``asyncio`` concurrent context in the REPL:" +#, fuzzy +msgid "" +"You can experiment with an ``asyncio`` concurrent context in the :term:" +"`REPL`:" msgstr "你能在 REPL 中對一個 ``asyncio`` 的並行情境 (context) 進行實驗:" #: ../../library/asyncio.rst:67 @@ -198,10 +200,16 @@ msgstr "" msgid "(also 3.11.10, 3.10.15, 3.9.20, and 3.8.20) Emits audit events." msgstr "" -#: ../../library/asyncio.rst:86 +#: ../../library/asyncio.rst:82 +msgid "" +"Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also " +"executed. Emits audit events." +msgstr "" + +#: ../../library/asyncio.rst:90 msgid "Reference" msgstr "參閱" -#: ../../library/asyncio.rst:119 +#: ../../library/asyncio.rst:123 msgid "The source code for asyncio can be found in :source:`Lib/asyncio/`." msgstr "asyncio 的原始碼可以在 :source:`Lib/asyncio/` 中找到。" diff --git a/library/atexit.po b/library/atexit.po index de07b4ee11..d671623db5 100644 --- a/library/atexit.po +++ b/library/atexit.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-01-31 07:13+0000\n" diff --git a/library/audioop.po b/library/audioop.po deleted file mode 100644 index c835baaa18..0000000000 --- a/library/audioop.po +++ /dev/null @@ -1,367 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-05-22 02:00+0800\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/audioop.rst:2 -msgid ":mod:`audioop` --- Manipulate raw audio data" -msgstr ":mod:`audioop` --- 操作原始聲音檔案" - -#: ../../library/audioop.rst:8 -msgid "" -"The :mod:`audioop` module is deprecated (see :pep:`PEP 594 <594#audioop>` " -"for details)." -msgstr "" -":mod:`audioop` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 " -"<594#audioop>`\\ )。" - -#: ../../library/audioop.rst:14 -msgid "" -"The :mod:`audioop` module contains some useful operations on sound " -"fragments. It operates on sound fragments consisting of signed integer " -"samples 8, 16, 24 or 32 bits wide, stored in :term:`bytes-like objects " -"`. All scalar items are integers, unless specified " -"otherwise." -msgstr "" - -#: ../../library/audioop.rst:19 -msgid "" -"Support for 24-bit samples was added. All functions now accept any :term:" -"`bytes-like object`. String input now results in an immediate error." -msgstr "" - -#: ../../library/audioop.rst:30 -msgid "" -"This module provides support for a-LAW, u-LAW and Intel/DVI ADPCM encodings." -msgstr "" - -#: ../../library/audioop.rst:34 -msgid "" -"A few of the more complicated operations only take 16-bit samples, otherwise " -"the sample size (in bytes) is always a parameter of the operation." -msgstr "" - -#: ../../library/audioop.rst:37 -msgid "The module defines the following variables and functions:" -msgstr "" - -#: ../../library/audioop.rst:42 -msgid "" -"This exception is raised on all errors, such as unknown number of bytes per " -"sample, etc." -msgstr "" - -#: ../../library/audioop.rst:48 -msgid "" -"Return a fragment which is the addition of the two samples passed as " -"parameters. *width* is the sample width in bytes, either ``1``, ``2``, ``3`` " -"or ``4``. Both fragments should have the same length. Samples are " -"truncated in case of overflow." -msgstr "" - -#: ../../library/audioop.rst:55 -msgid "" -"Decode an Intel/DVI ADPCM coded fragment to a linear fragment. See the " -"description of :func:`lin2adpcm` for details on ADPCM coding. Return a tuple " -"``(sample, newstate)`` where the sample has the width specified in *width*." -msgstr "" - -#: ../../library/audioop.rst:62 -msgid "" -"Convert sound fragments in a-LAW encoding to linearly encoded sound " -"fragments. a-LAW encoding always uses 8 bits samples, so *width* refers only " -"to the sample width of the output fragment here." -msgstr "" - -#: ../../library/audioop.rst:69 -msgid "Return the average over all samples in the fragment." -msgstr "" - -#: ../../library/audioop.rst:74 -msgid "" -"Return the average peak-peak value over all samples in the fragment. No " -"filtering is done, so the usefulness of this routine is questionable." -msgstr "" - -#: ../../library/audioop.rst:80 -msgid "" -"Return a fragment that is the original fragment with a bias added to each " -"sample. Samples wrap around in case of overflow." -msgstr "" - -#: ../../library/audioop.rst:86 -msgid "" -"\"Byteswap\" all samples in a fragment and returns the modified fragment. " -"Converts big-endian samples to little-endian and vice versa." -msgstr "" - -#: ../../library/audioop.rst:94 -msgid "" -"Return the number of zero crossings in the fragment passed as an argument." -msgstr "" - -#: ../../library/audioop.rst:99 -msgid "" -"Return a factor *F* such that ``rms(add(fragment, mul(reference, -F)))`` is " -"minimal, i.e., return the factor with which you should multiply *reference* " -"to make it match as well as possible to *fragment*. The fragments should " -"both contain 2-byte samples." -msgstr "" - -#: ../../library/audioop.rst:104 -msgid "The time taken by this routine is proportional to ``len(fragment)``." -msgstr "" - -#: ../../library/audioop.rst:109 -msgid "" -"Try to match *reference* as well as possible to a portion of *fragment* " -"(which should be the longer fragment). This is (conceptually) done by " -"taking slices out of *fragment*, using :func:`findfactor` to compute the " -"best match, and minimizing the result. The fragments should both contain 2-" -"byte samples. Return a tuple ``(offset, factor)`` where *offset* is the " -"(integer) offset into *fragment* where the optimal match started and " -"*factor* is the (floating-point) factor as per :func:`findfactor`." -msgstr "" - -#: ../../library/audioop.rst:120 -msgid "" -"Search *fragment* for a slice of length *length* samples (not bytes!) with " -"maximum energy, i.e., return *i* for which ``rms(fragment[i*2:" -"(i+length)*2])`` is maximal. The fragments should both contain 2-byte " -"samples." -msgstr "" - -#: ../../library/audioop.rst:124 -msgid "The routine takes time proportional to ``len(fragment)``." -msgstr "" - -#: ../../library/audioop.rst:129 -msgid "Return the value of sample *index* from the fragment." -msgstr "" - -#: ../../library/audioop.rst:134 -msgid "" -"Convert samples to 4 bit Intel/DVI ADPCM encoding. ADPCM coding is an " -"adaptive coding scheme, whereby each 4 bit number is the difference between " -"one sample and the next, divided by a (varying) step. The Intel/DVI ADPCM " -"algorithm has been selected for use by the IMA, so it may well become a " -"standard." -msgstr "" - -#: ../../library/audioop.rst:139 -msgid "" -"*state* is a tuple containing the state of the coder. The coder returns a " -"tuple ``(adpcmfrag, newstate)``, and the *newstate* should be passed to the " -"next call of :func:`lin2adpcm`. In the initial call, ``None`` can be passed " -"as the state. *adpcmfrag* is the ADPCM coded fragment packed 2 4-bit values " -"per byte." -msgstr "" - -#: ../../library/audioop.rst:147 -msgid "" -"Convert samples in the audio fragment to a-LAW encoding and return this as a " -"bytes object. a-LAW is an audio encoding format whereby you get a dynamic " -"range of about 13 bits using only 8 bit samples. It is used by the Sun " -"audio hardware, among others." -msgstr "" - -#: ../../library/audioop.rst:155 -msgid "Convert samples between 1-, 2-, 3- and 4-byte formats." -msgstr "" - -#: ../../library/audioop.rst:159 -msgid "" -"In some audio formats, such as .WAV files, 16, 24 and 32 bit samples are " -"signed, but 8 bit samples are unsigned. So when converting to 8 bit wide " -"samples for these formats, you need to also add 128 to the result::" -msgstr "" - -#: ../../library/audioop.rst:163 -msgid "" -"new_frames = audioop.lin2lin(frames, old_width, 1)\n" -"new_frames = audioop.bias(new_frames, 1, 128)" -msgstr "" - -#: ../../library/audioop.rst:166 -msgid "" -"The same, in reverse, has to be applied when converting from 8 to 16, 24 or " -"32 bit width samples." -msgstr "" - -#: ../../library/audioop.rst:172 -msgid "" -"Convert samples in the audio fragment to u-LAW encoding and return this as a " -"bytes object. u-LAW is an audio encoding format whereby you get a dynamic " -"range of about 14 bits using only 8 bit samples. It is used by the Sun " -"audio hardware, among others." -msgstr "" - -#: ../../library/audioop.rst:180 -msgid "" -"Return the maximum of the *absolute value* of all samples in a fragment." -msgstr "" - -#: ../../library/audioop.rst:185 -msgid "Return the maximum peak-peak value in the sound fragment." -msgstr "" - -#: ../../library/audioop.rst:190 -msgid "" -"Return a tuple consisting of the minimum and maximum values of all samples " -"in the sound fragment." -msgstr "" - -#: ../../library/audioop.rst:196 -msgid "" -"Return a fragment that has all samples in the original fragment multiplied " -"by the floating-point value *factor*. Samples are truncated in case of " -"overflow." -msgstr "" - -#: ../../library/audioop.rst:202 -msgid "Convert the frame rate of the input fragment." -msgstr "" - -#: ../../library/audioop.rst:204 -msgid "" -"*state* is a tuple containing the state of the converter. The converter " -"returns a tuple ``(newfragment, newstate)``, and *newstate* should be passed " -"to the next call of :func:`ratecv`. The initial call should pass ``None`` " -"as the state." -msgstr "" - -#: ../../library/audioop.rst:208 -msgid "" -"The *weightA* and *weightB* arguments are parameters for a simple digital " -"filter and default to ``1`` and ``0`` respectively." -msgstr "" - -#: ../../library/audioop.rst:214 -msgid "Reverse the samples in a fragment and returns the modified fragment." -msgstr "" - -#: ../../library/audioop.rst:219 -msgid "" -"Return the root-mean-square of the fragment, i.e. ``sqrt(sum(S_i^2)/n)``." -msgstr "" - -#: ../../library/audioop.rst:221 -msgid "This is a measure of the power in an audio signal." -msgstr "" - -#: ../../library/audioop.rst:226 -msgid "" -"Convert a stereo fragment to a mono fragment. The left channel is " -"multiplied by *lfactor* and the right channel by *rfactor* before adding the " -"two channels to give a mono signal." -msgstr "" - -#: ../../library/audioop.rst:233 -msgid "" -"Generate a stereo fragment from a mono fragment. Each pair of samples in " -"the stereo fragment are computed from the mono sample, whereby left channel " -"samples are multiplied by *lfactor* and right channel samples by *rfactor*." -msgstr "" - -#: ../../library/audioop.rst:240 -msgid "" -"Convert sound fragments in u-LAW encoding to linearly encoded sound " -"fragments. u-LAW encoding always uses 8 bits samples, so *width* refers only " -"to the sample width of the output fragment here." -msgstr "" - -#: ../../library/audioop.rst:244 -msgid "" -"Note that operations such as :func:`.mul` or :func:`.max` make no " -"distinction between mono and stereo fragments, i.e. all samples are treated " -"equal. If this is a problem the stereo fragment should be split into two " -"mono fragments first and recombined later. Here is an example of how to do " -"that::" -msgstr "" - -#: ../../library/audioop.rst:249 -msgid "" -"def mul_stereo(sample, width, lfactor, rfactor):\n" -" lsample = audioop.tomono(sample, width, 1, 0)\n" -" rsample = audioop.tomono(sample, width, 0, 1)\n" -" lsample = audioop.mul(lsample, width, lfactor)\n" -" rsample = audioop.mul(rsample, width, rfactor)\n" -" lsample = audioop.tostereo(lsample, width, 1, 0)\n" -" rsample = audioop.tostereo(rsample, width, 0, 1)\n" -" return audioop.add(lsample, rsample, width)" -msgstr "" - -#: ../../library/audioop.rst:258 -msgid "" -"If you use the ADPCM coder to build network packets and you want your " -"protocol to be stateless (i.e. to be able to tolerate packet loss) you " -"should not only transmit the data but also the state. Note that you should " -"send the *initial* state (the one you passed to :func:`lin2adpcm`) along to " -"the decoder, not the final state (as returned by the coder). If you want to " -"use :class:`struct.Struct` to store the state in binary you can code the " -"first element (the predicted value) in 16 bits and the second (the delta " -"index) in 8." -msgstr "" - -#: ../../library/audioop.rst:266 -msgid "" -"The ADPCM coders have never been tried against other ADPCM coders, only " -"against themselves. It could well be that I misinterpreted the standards in " -"which case they will not be interoperable with the respective standards." -msgstr "" - -#: ../../library/audioop.rst:270 -msgid "" -"The :func:`find\\*` routines might look a bit funny at first sight. They are " -"primarily meant to do echo cancellation. A reasonably fast way to do this " -"is to pick the most energetic piece of the output sample, locate that in the " -"input sample and subtract the whole output sample from the input sample::" -msgstr "" - -#: ../../library/audioop.rst:275 -msgid "" -"def echocancel(outputdata, inputdata):\n" -" pos = audioop.findmax(outputdata, 800) # one tenth second\n" -" out_test = outputdata[pos*2:]\n" -" in_test = inputdata[pos*2:]\n" -" ipos, factor = audioop.findfit(in_test, out_test)\n" -" # Optional (for better cancellation):\n" -" # factor = audioop.findfactor(in_test[ipos*2:ipos*2+len(out_test)],\n" -" # out_test)\n" -" prefill = '\\0'*(pos+ipos)*2\n" -" postfill = '\\0'*(len(inputdata)-len(prefill)-len(outputdata))\n" -" outputdata = prefill + audioop.mul(outputdata, 2, -factor) + postfill\n" -" return audioop.add(inputdata, outputdata, 2)" -msgstr "" - -#: ../../library/audioop.rst:24 -msgid "Intel/DVI ADPCM" -msgstr "Intel/DVI ADPCM" - -#: ../../library/audioop.rst:24 -msgid "ADPCM, Intel/DVI" -msgstr "ADPCM, Intel/DVI" - -#: ../../library/audioop.rst:24 -msgid "a-LAW" -msgstr "a-LAW" - -#: ../../library/audioop.rst:24 -msgid "u-LAW" -msgstr "u-LAW" diff --git a/library/audit_events.po b/library/audit_events.po index 935f0dbc57..46114bbe00 100644 --- a/library/audit_events.po +++ b/library/audit_events.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-03-06 00:03+0000\n" "PO-Revision-Date: 2021-12-06 21:50+0800\n" diff --git a/library/base64.po b/library/base64.po index d386fecf1f..6a500d7382 100644 --- a/library/base64.po +++ b/library/base64.po @@ -6,9 +6,9 @@ # Inndy, 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-29 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -400,11 +400,31 @@ msgstr "" "解碼經過 base85 編碼的\\ :term:`類位元組物件 `\\ 或 ASCII " "字串 *b*,並回傳解碼後的 :class:`bytes`。必要時會隱式移除填充。" -#: ../../library/base64.rst:247 +#: ../../library/base64.rst:249 +#, fuzzy +msgid "" +"Encode the :term:`bytes-like object` *s* using Z85 (as used in ZeroMQ) and " +"return the encoded :class:`bytes`. See `Z85 specification `_ for more information." +msgstr "" +"使用 Base85(例如,git 風格的二進位差異 (binary diff))對\\ :term:`類位元組物" +"件 ` *b* 進行編碼,並回傳編碼後的 :class:`bytes`。" + +#: ../../library/base64.rst:258 +#, fuzzy +msgid "" +"Decode the Z85-encoded :term:`bytes-like object` or ASCII string *s* and " +"return the decoded :class:`bytes`. See `Z85 specification `_ for more information." +msgstr "" +"解碼經過 base85 編碼的\\ :term:`類位元組物件 `\\ 或 ASCII " +"字串 *b*,並回傳解碼後的 :class:`bytes`。必要時會隱式移除填充。" + +#: ../../library/base64.rst:265 msgid "The legacy interface:" msgstr "舊版介面:" -#: ../../library/base64.rst:251 +#: ../../library/base64.rst:269 msgid "" "Decode the contents of the binary *input* file and write the resulting " "binary data to the *output* file. *input* and *output* must be :term:`file " @@ -415,7 +435,7 @@ msgstr "" "*input* 和 *output* 必須是\\ :term:`檔案物件 `。*input* 將被讀" "取,直到 ``input.readline()`` 回傳一個空的 bytes 物件為止。" -#: ../../library/base64.rst:259 +#: ../../library/base64.rst:277 msgid "" "Decode the :term:`bytes-like object` *s*, which must contain one or more " "lines of base64 encoded data, and return the decoded :class:`bytes`." @@ -423,7 +443,7 @@ msgstr "" "解碼必須包含一行或多行的 base64 編碼資料\\ :term:`類位元組物件 ` *s*,並回傳解碼後的 :class:`bytes`。" -#: ../../library/base64.rst:267 +#: ../../library/base64.rst:285 msgid "" "Encode the contents of the binary *input* file and write the resulting " "base64 encoded data to the *output* file. *input* and *output* must be :term:" @@ -438,7 +458,7 @@ msgstr "" "出的每 76 個位元組之後插入一個換行字元 (``b'\\n'``),並確保輸出始終以換行字元" "結尾,符合 :rfc:`2045` (MIME) 的規定。" -#: ../../library/base64.rst:277 +#: ../../library/base64.rst:295 msgid "" "Encode the :term:`bytes-like object` *s*, which can contain arbitrary binary " "data, and return :class:`bytes` containing the base64-encoded data, with " @@ -449,15 +469,15 @@ msgstr "" "碼,並回傳包含 base64 編碼資料 :class:`bytes`,在每 76 個輸出位元組後插入換行" "字元 (``b'\\n'``) ,並確保有尾隨換行字元,符合 :rfc:`2045` (MIME) 的規定。" -#: ../../library/base64.rst:285 +#: ../../library/base64.rst:303 msgid "An example usage of the module:" msgstr "模組的一個範例用法:" -#: ../../library/base64.rst:298 +#: ../../library/base64.rst:316 msgid "Security Considerations" msgstr "安全性注意事項" -#: ../../library/base64.rst:300 +#: ../../library/base64.rst:318 msgid "" "A new security considerations section was added to :rfc:`4648` (section 12); " "it's recommended to review the security section for any code deployed to " @@ -466,18 +486,18 @@ msgstr "" ":rfc:`4648`\\ (第 12 節)中添加了一個新的安全性考量部分;建議對部署到正式環" "境的任何程式碼進行安全性部分的審查。" -#: ../../library/base64.rst:305 +#: ../../library/base64.rst:323 msgid "Module :mod:`binascii`" msgstr ":mod:`binascii` 模組" -#: ../../library/base64.rst:306 +#: ../../library/base64.rst:324 msgid "" "Support module containing ASCII-to-binary and binary-to-ASCII conversions." msgstr "" "支援模組中包含 ASCII 到二進位 (ASCII-to-binary) 和二進位到 ASCII (binary-to-" "ASCII) 的轉換功能。" -#: ../../library/base64.rst:308 +#: ../../library/base64.rst:326 msgid "" ":rfc:`1521` - MIME (Multipurpose Internet Mail Extensions) Part One: " "Mechanisms for Specifying and Describing the Format of Internet Message " @@ -486,7 +506,7 @@ msgstr "" ":rfc:`1521` - MIME(多用途網際網路郵件擴展)第一部分:指定和描述網際網路主體" "格式的機制。" -#: ../../library/base64.rst:309 +#: ../../library/base64.rst:327 msgid "" "Section 5.2, \"Base64 Content-Transfer-Encoding,\" provides the definition " "of the base64 encoding." diff --git a/library/bdb.po b/library/bdb.po index dc99fb79d8..5f1e59843e 100644 --- a/library/bdb.po +++ b/library/bdb.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -415,57 +415,63 @@ msgid "" "from caller's frame." msgstr "" -#: ../../library/bdb.rst:294 +#: ../../library/bdb.rst:292 +msgid "" +":func:`set_trace` will enter the debugger immediately, rather than on the " +"next line of code to be executed." +msgstr "" + +#: ../../library/bdb.rst:298 msgid "" "Stop only at breakpoints or when finished. If there are no breakpoints, set " "the system trace function to ``None``." msgstr "" -#: ../../library/bdb.rst:301 +#: ../../library/bdb.rst:305 msgid "" "Set the :attr:`!quitting` attribute to ``True``. This raises :exc:`BdbQuit` " "in the next call to one of the :meth:`!dispatch_\\*` methods." msgstr "" -#: ../../library/bdb.rst:305 +#: ../../library/bdb.rst:309 msgid "" "Derived classes and clients can call the following methods to manipulate " "breakpoints. These methods return a string containing an error message if " "something went wrong, or ``None`` if all is well." msgstr "" -#: ../../library/bdb.rst:311 +#: ../../library/bdb.rst:315 msgid "" "Set a new breakpoint. If the *lineno* line doesn't exist for the *filename* " "passed as argument, return an error message. The *filename* should be in " "canonical form, as described in the :meth:`canonic` method." msgstr "" -#: ../../library/bdb.rst:317 +#: ../../library/bdb.rst:321 msgid "" "Delete the breakpoints in *filename* and *lineno*. If none were set, return " "an error message." msgstr "" -#: ../../library/bdb.rst:322 +#: ../../library/bdb.rst:326 msgid "" "Delete the breakpoint which has the index *arg* in the :attr:`Breakpoint." "bpbynumber`. If *arg* is not numeric or out of range, return an error " "message." msgstr "" -#: ../../library/bdb.rst:328 +#: ../../library/bdb.rst:332 msgid "" "Delete all breakpoints in *filename*. If none were set, return an error " "message." msgstr "" -#: ../../library/bdb.rst:333 +#: ../../library/bdb.rst:337 msgid "" "Delete all existing breakpoints. If none were set, return an error message." msgstr "" -#: ../../library/bdb.rst:338 +#: ../../library/bdb.rst:342 msgid "" "Return a breakpoint specified by the given number. If *arg* is a string, it " "will be converted to a number. If *arg* is a non-numeric string, if the " @@ -473,103 +479,103 @@ msgid "" "raised." msgstr "" -#: ../../library/bdb.rst:347 +#: ../../library/bdb.rst:351 msgid "Return ``True`` if there is a breakpoint for *lineno* in *filename*." msgstr "" -#: ../../library/bdb.rst:351 +#: ../../library/bdb.rst:355 msgid "" "Return all breakpoints for *lineno* in *filename*, or an empty list if none " "are set." msgstr "" -#: ../../library/bdb.rst:356 +#: ../../library/bdb.rst:360 msgid "Return all breakpoints in *filename*, or an empty list if none are set." msgstr "" -#: ../../library/bdb.rst:360 +#: ../../library/bdb.rst:364 msgid "Return all breakpoints that are set." msgstr "" -#: ../../library/bdb.rst:363 +#: ../../library/bdb.rst:367 msgid "" "Derived classes and clients can call the following methods to get a data " "structure representing a stack trace." msgstr "" -#: ../../library/bdb.rst:368 +#: ../../library/bdb.rst:372 msgid "Return a list of (frame, lineno) tuples in a stack trace, and a size." msgstr "" -#: ../../library/bdb.rst:370 +#: ../../library/bdb.rst:374 msgid "" "The most recently called frame is last in the list. The size is the number " "of frames below the frame where the debugger was invoked." msgstr "" -#: ../../library/bdb.rst:375 +#: ../../library/bdb.rst:379 msgid "" "Return a string with information about a stack entry, which is a ``(frame, " "lineno)`` tuple. The return string contains:" msgstr "" -#: ../../library/bdb.rst:378 +#: ../../library/bdb.rst:382 msgid "The canonical filename which contains the frame." msgstr "" -#: ../../library/bdb.rst:379 +#: ../../library/bdb.rst:383 msgid "The function name or ``\"\"``." msgstr "函式名稱或 ``\"\"``。" -#: ../../library/bdb.rst:380 +#: ../../library/bdb.rst:384 msgid "The input arguments." msgstr "輸入引數。" -#: ../../library/bdb.rst:381 +#: ../../library/bdb.rst:385 msgid "The return value." msgstr "回傳值。" -#: ../../library/bdb.rst:382 +#: ../../library/bdb.rst:386 msgid "The line of code (if it exists)." msgstr "" -#: ../../library/bdb.rst:385 +#: ../../library/bdb.rst:389 msgid "" "The following two methods can be called by clients to use a debugger to " "debug a :term:`statement`, given as a string." msgstr "" -#: ../../library/bdb.rst:390 +#: ../../library/bdb.rst:394 msgid "" "Debug a statement executed via the :func:`exec` function. *globals* " "defaults to :attr:`!__main__.__dict__`, *locals* defaults to *globals*." msgstr "" -#: ../../library/bdb.rst:395 +#: ../../library/bdb.rst:399 msgid "" "Debug an expression executed via the :func:`eval` function. *globals* and " "*locals* have the same meaning as in :meth:`run`." msgstr "" -#: ../../library/bdb.rst:400 +#: ../../library/bdb.rst:404 msgid "For backwards compatibility. Calls the :meth:`run` method." msgstr "" -#: ../../library/bdb.rst:404 +#: ../../library/bdb.rst:408 msgid "Debug a single function call, and return its result." msgstr "" -#: ../../library/bdb.rst:407 +#: ../../library/bdb.rst:411 msgid "Finally, the module defines the following functions:" msgstr "" -#: ../../library/bdb.rst:411 +#: ../../library/bdb.rst:415 msgid "" "Return ``True`` if we should break here, depending on the way the :class:" "`Breakpoint` *b* was set." msgstr "" -#: ../../library/bdb.rst:414 +#: ../../library/bdb.rst:418 msgid "" "If it was set via line number, it checks if :attr:`b.line ` is the same as the one in *frame*. If the breakpoint was set via :" @@ -578,13 +584,13 @@ msgid "" "line." msgstr "" -#: ../../library/bdb.rst:423 +#: ../../library/bdb.rst:427 msgid "" "Return ``(active breakpoint, delete temporary flag)`` or ``(None, None)`` as " "the breakpoint to act upon." msgstr "" -#: ../../library/bdb.rst:426 +#: ../../library/bdb.rst:430 msgid "" "The *active breakpoint* is the first entry in :attr:`bplist ` for the (:attr:`file `, :attr:`line ` count is ignored)." msgstr "" -#: ../../library/bdb.rst:437 +#: ../../library/bdb.rst:441 msgid "If no such entry exists, then ``(None, None)`` is returned." msgstr "" -#: ../../library/bdb.rst:442 +#: ../../library/bdb.rst:446 msgid "Start debugging with a :class:`Bdb` instance from caller's frame." msgstr "" -#: ../../library/bdb.rst:299 +#: ../../library/bdb.rst:303 msgid "quitting (bdb.Bdb attribute)" msgstr "" diff --git a/library/binary.po b/library/binary.po index edeb5839ed..5c36e1bf9c 100644 --- a/library/binary.po +++ b/library/binary.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/binascii.po b/library/binascii.po index ecfcd38b8d..2aa9b51367 100644 --- a/library/binascii.po +++ b/library/binascii.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:39+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,17 +22,16 @@ msgstr "" msgid ":mod:`!binascii` --- Convert between binary and ASCII" msgstr ":mod:`!binascii` --- 在二進位制和 ASCII 之間轉換" -#: ../../library/binascii.rst:14 +#: ../../library/binascii.rst:13 msgid "" "The :mod:`binascii` module contains a number of methods to convert between " "binary and various ASCII-encoded binary representations. Normally, you will " -"not use these functions directly but use wrapper modules like :mod:`uu` or :" -"mod:`base64` instead. The :mod:`binascii` module contains low-level " -"functions written in C for greater speed that are used by the higher-level " -"modules." +"not use these functions directly but use wrapper modules like :mod:`base64` " +"instead. The :mod:`binascii` module contains low-level functions written in " +"C for greater speed that are used by the higher-level modules." msgstr "" -#: ../../library/binascii.rst:23 +#: ../../library/binascii.rst:22 msgid "" "``a2b_*`` functions accept Unicode strings containing only ASCII characters. " "Other functions only accept :term:`bytes-like objects ` " @@ -40,22 +39,22 @@ msgid "" "the buffer protocol)." msgstr "" -#: ../../library/binascii.rst:28 +#: ../../library/binascii.rst:27 msgid "ASCII-only unicode strings are now accepted by the ``a2b_*`` functions." msgstr "" -#: ../../library/binascii.rst:32 +#: ../../library/binascii.rst:31 msgid "The :mod:`binascii` module defines the following functions:" msgstr "" -#: ../../library/binascii.rst:37 +#: ../../library/binascii.rst:36 msgid "" "Convert a single line of uuencoded data back to binary and return the binary " "data. Lines normally contain 45 (binary) bytes, except for the last line. " "Line data may be followed by whitespace." msgstr "" -#: ../../library/binascii.rst:44 +#: ../../library/binascii.rst:43 msgid "" "Convert binary data to a line of ASCII characters, the return value is the " "converted line, including a newline char. The length of *data* should be at " @@ -63,67 +62,67 @@ msgid "" "spaces." msgstr "" -#: ../../library/binascii.rst:48 +#: ../../library/binascii.rst:47 msgid "Added the *backtick* parameter." msgstr "新增 *backtick* 參數。" -#: ../../library/binascii.rst:54 +#: ../../library/binascii.rst:53 msgid "" "Convert a block of base64 data back to binary and return the binary data. " "More than one line may be passed at a time." msgstr "" -#: ../../library/binascii.rst:57 +#: ../../library/binascii.rst:56 msgid "" "If *strict_mode* is true, only valid base64 data will be converted. Invalid " "base64 data will raise :exc:`binascii.Error`." msgstr "" -#: ../../library/binascii.rst:60 +#: ../../library/binascii.rst:59 msgid "Valid base64:" msgstr "" -#: ../../library/binascii.rst:62 +#: ../../library/binascii.rst:61 msgid "Conforms to :rfc:`3548`." msgstr "" -#: ../../library/binascii.rst:63 +#: ../../library/binascii.rst:62 msgid "Contains only characters from the base64 alphabet." msgstr "" -#: ../../library/binascii.rst:64 +#: ../../library/binascii.rst:63 msgid "" "Contains no excess data after padding (including excess padding, newlines, " "etc.)." msgstr "" -#: ../../library/binascii.rst:65 +#: ../../library/binascii.rst:64 msgid "Does not start with a padding." msgstr "" -#: ../../library/binascii.rst:67 +#: ../../library/binascii.rst:66 msgid "Added the *strict_mode* parameter." msgstr "新增 *strict_mode* 參數。" -#: ../../library/binascii.rst:73 +#: ../../library/binascii.rst:72 msgid "" "Convert binary data to a line of ASCII characters in base64 coding. The " "return value is the converted line, including a newline char if *newline* is " "true. The output of this function conforms to :rfc:`3548`." msgstr "" -#: ../../library/binascii.rst:77 +#: ../../library/binascii.rst:76 msgid "Added the *newline* parameter." msgstr "新增 *newline* 參數。" -#: ../../library/binascii.rst:83 +#: ../../library/binascii.rst:82 msgid "" "Convert a block of quoted-printable data back to binary and return the " "binary data. More than one line may be passed at a time. If the optional " "argument *header* is present and true, underscores will be decoded as spaces." msgstr "" -#: ../../library/binascii.rst:90 +#: ../../library/binascii.rst:89 msgid "" "Convert binary data to a line(s) of ASCII characters in quoted-printable " "encoding. The return value is the converted line(s). If the optional " @@ -136,7 +135,7 @@ msgid "" "might corrupt the binary data stream." msgstr "" -#: ../../library/binascii.rst:103 +#: ../../library/binascii.rst:102 msgid "" "Compute a 16-bit CRC value of *data*, starting with *value* as the initial " "CRC, and return the result. This uses the CRC-CCITT polynomial *x*:sup:`16` " @@ -144,7 +143,7 @@ msgid "" "used in the binhex4 format." msgstr "" -#: ../../library/binascii.rst:111 +#: ../../library/binascii.rst:110 msgid "" "Compute CRC-32, the unsigned 32-bit checksum of *data*, starting with an " "initial CRC of *value*. The default initial CRC is zero. The algorithm is " @@ -153,7 +152,7 @@ msgid "" "algorithm. Use as follows::" msgstr "" -#: ../../library/binascii.rst:117 +#: ../../library/binascii.rst:116 msgid "" "print(binascii.crc32(b\"hello world\"))\n" "# Or, in two pieces:\n" @@ -162,24 +161,24 @@ msgid "" "print('crc32 = {:#010x}'.format(crc))" msgstr "" -#: ../../library/binascii.rst:123 +#: ../../library/binascii.rst:122 msgid "The result is always unsigned." msgstr "" -#: ../../library/binascii.rst:129 +#: ../../library/binascii.rst:128 msgid "" "Return the hexadecimal representation of the binary *data*. Every byte of " "*data* is converted into the corresponding 2-digit hex representation. The " "returned bytes object is therefore twice as long as the length of *data*." msgstr "" -#: ../../library/binascii.rst:133 +#: ../../library/binascii.rst:132 msgid "" "Similar functionality (but returning a text string) is also conveniently " "accessible using the :meth:`bytes.hex` method." msgstr "" -#: ../../library/binascii.rst:136 +#: ../../library/binascii.rst:135 msgid "" "If *sep* is specified, it must be a single character str or bytes object. It " "will be inserted in the output after every *bytes_per_sep* input bytes. " @@ -187,11 +186,11 @@ msgid "" "if you wish to count from the left, supply a negative *bytes_per_sep* value." msgstr "" -#: ../../library/binascii.rst:151 +#: ../../library/binascii.rst:150 msgid "The *sep* and *bytes_per_sep* parameters were added." msgstr "新增 *sep* 與 *bytes_per_sep* 參數。" -#: ../../library/binascii.rst:157 +#: ../../library/binascii.rst:156 msgid "" "Return the binary data represented by the hexadecimal string *hexstr*. This " "function is the inverse of :func:`b2a_hex`. *hexstr* must contain an even " @@ -199,45 +198,37 @@ msgid "" "an :exc:`Error` exception is raised." msgstr "" -#: ../../library/binascii.rst:162 +#: ../../library/binascii.rst:161 msgid "" "Similar functionality (accepting only text string arguments, but more " "liberal towards whitespace) is also accessible using the :meth:`bytes." "fromhex` class method." msgstr "" -#: ../../library/binascii.rst:168 +#: ../../library/binascii.rst:167 msgid "Exception raised on errors. These are usually programming errors." msgstr "" -#: ../../library/binascii.rst:173 +#: ../../library/binascii.rst:172 msgid "" "Exception raised on incomplete data. These are usually not programming " "errors, but may be handled by reading a little more data and trying again." msgstr "" -#: ../../library/binascii.rst:179 +#: ../../library/binascii.rst:178 msgid "Module :mod:`base64`" msgstr ":mod:`base64` 模組" -#: ../../library/binascii.rst:180 +#: ../../library/binascii.rst:179 msgid "" "Support for RFC compliant base64-style encoding in base 16, 32, 64, and 85." msgstr "" -#: ../../library/binascii.rst:183 -msgid "Module :mod:`uu`" -msgstr ":mod:`uu` 模組" - -#: ../../library/binascii.rst:184 -msgid "Support for UU encoding used on Unix." -msgstr "" - -#: ../../library/binascii.rst:186 +#: ../../library/binascii.rst:182 msgid "Module :mod:`quopri`" msgstr ":mod:`quopri` 模組" -#: ../../library/binascii.rst:187 +#: ../../library/binascii.rst:183 msgid "Support for quoted-printable encoding used in MIME email messages." msgstr "" @@ -245,10 +236,12 @@ msgstr "" msgid "module" msgstr "module(模組)" -#: ../../library/binascii.rst:8 -msgid "uu" -msgstr "uu" - #: ../../library/binascii.rst:8 msgid "base64" msgstr "base64" + +#~ msgid "Module :mod:`uu`" +#~ msgstr ":mod:`uu` 模組" + +#~ msgid "uu" +#~ msgstr "uu" diff --git a/library/bisect.po b/library/bisect.po index d5aae2fa8c..6e3bcf9931 100644 --- a/library/bisect.po +++ b/library/bisect.po @@ -8,7 +8,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-08-01 12:53+0800\n" diff --git a/library/builtins.po b/library/builtins.po index ef5628bb84..d2a6cc577f 100644 --- a/library/builtins.po +++ b/library/builtins.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-02-15 20:55+0800\n" diff --git a/library/bz2.po b/library/bz2.po index 94b9f0a99f..9424d42055 100644 --- a/library/bz2.po +++ b/library/bz2.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -99,11 +99,11 @@ msgid "" "handling behavior, and line ending(s)." msgstr "" -#: ../../library/bz2.rst:59 ../../library/bz2.rst:162 +#: ../../library/bz2.rst:59 ../../library/bz2.rst:175 msgid "The ``'x'`` (exclusive creation) mode was added." msgstr "" -#: ../../library/bz2.rst:62 ../../library/bz2.rst:169 +#: ../../library/bz2.rst:62 ../../library/bz2.rst:182 msgid "Accepts a :term:`path-like object`." msgstr "" @@ -153,7 +153,7 @@ msgid "" msgstr "" #: ../../library/bz2.rst:94 -msgid ":class:`BZ2File` also provides the following methods:" +msgid ":class:`BZ2File` also provides the following methods and attributes:" msgstr "" #: ../../library/bz2.rst:98 @@ -206,93 +206,103 @@ msgstr "" msgid "Returns the number of bytes read (0 for EOF)." msgstr "" -#: ../../library/bz2.rst:152 +#: ../../library/bz2.rst:153 +msgid "``'rb'`` for reading and ``'wb'`` for writing." +msgstr "" + +#: ../../library/bz2.rst:159 +msgid "" +"The bzip2 file name. Equivalent to the :attr:`~io.FileIO.name` attribute of " +"the underlying :term:`file object`." +msgstr "" + +#: ../../library/bz2.rst:165 msgid "Support for the :keyword:`with` statement was added." msgstr "" -#: ../../library/bz2.rst:155 +#: ../../library/bz2.rst:168 msgid "" "Support was added for *filename* being a :term:`file object` instead of an " "actual filename." msgstr "" -#: ../../library/bz2.rst:159 +#: ../../library/bz2.rst:172 msgid "" "The ``'a'`` (append) mode was added, along with support for reading multi-" "stream files." msgstr "" -#: ../../library/bz2.rst:165 +#: ../../library/bz2.rst:178 msgid "" "The :meth:`~io.BufferedIOBase.read` method now accepts an argument of " "``None``." msgstr "" -#: ../../library/bz2.rst:172 +#: ../../library/bz2.rst:185 msgid "" "The *buffering* parameter has been removed. It was ignored and deprecated " "since Python 3.0. Pass an open file object to control how the file is opened." msgstr "" -#: ../../library/bz2.rst:177 +#: ../../library/bz2.rst:190 msgid "The *compresslevel* parameter became keyword-only." msgstr "" -#: ../../library/bz2.rst:179 +#: ../../library/bz2.rst:192 msgid "" "This class is thread unsafe in the face of multiple simultaneous readers or " "writers, just like its equivalent classes in :mod:`gzip` and :mod:`lzma` " "have always been." msgstr "" -#: ../../library/bz2.rst:186 +#: ../../library/bz2.rst:199 msgid "Incremental (de)compression" msgstr "" -#: ../../library/bz2.rst:190 +#: ../../library/bz2.rst:203 msgid "" "Create a new compressor object. This object may be used to compress data " "incrementally. For one-shot compression, use the :func:`compress` function " "instead." msgstr "" -#: ../../library/bz2.rst:194 ../../library/bz2.rst:282 +#: ../../library/bz2.rst:207 ../../library/bz2.rst:295 msgid "" "*compresslevel*, if given, must be an integer between ``1`` and ``9``. The " "default is ``9``." msgstr "" -#: ../../library/bz2.rst:199 +#: ../../library/bz2.rst:212 msgid "" "Provide data to the compressor object. Returns a chunk of compressed data if " "possible, or an empty byte string otherwise." msgstr "" -#: ../../library/bz2.rst:202 +#: ../../library/bz2.rst:215 msgid "" "When you have finished providing data to the compressor, call the :meth:" "`flush` method to finish the compression process." msgstr "" -#: ../../library/bz2.rst:208 +#: ../../library/bz2.rst:221 msgid "" "Finish the compression process. Returns the compressed data left in internal " "buffers." msgstr "" -#: ../../library/bz2.rst:211 +#: ../../library/bz2.rst:224 msgid "" "The compressor object may not be used after this method has been called." msgstr "" -#: ../../library/bz2.rst:216 +#: ../../library/bz2.rst:229 msgid "" "Create a new decompressor object. This object may be used to decompress data " "incrementally. For one-shot compression, use the :func:`decompress` function " "instead." msgstr "" -#: ../../library/bz2.rst:221 +#: ../../library/bz2.rst:234 msgid "" "This class does not transparently handle inputs containing multiple " "compressed streams, unlike :func:`decompress` and :class:`BZ2File`. If you " @@ -300,7 +310,7 @@ msgid "" "must use a new decompressor for each stream." msgstr "" -#: ../../library/bz2.rst:228 +#: ../../library/bz2.rst:241 msgid "" "Decompress *data* (a :term:`bytes-like object`), returning uncompressed data " "as bytes. Some of *data* may be buffered internally, for use in later calls " @@ -308,7 +318,7 @@ msgid "" "output of any previous calls to :meth:`decompress`." msgstr "" -#: ../../library/bz2.rst:234 +#: ../../library/bz2.rst:247 msgid "" "If *max_length* is nonnegative, returns at most *max_length* bytes of " "decompressed data. If this limit is reached and further output can be " @@ -317,99 +327,99 @@ msgid "" "``b''`` to obtain more of the output." msgstr "" -#: ../../library/bz2.rst:241 +#: ../../library/bz2.rst:254 msgid "" "If all of the input data was decompressed and returned (either because this " "was less than *max_length* bytes, or because *max_length* was negative), " "the :attr:`~.needs_input` attribute will be set to ``True``." msgstr "" -#: ../../library/bz2.rst:246 +#: ../../library/bz2.rst:259 msgid "" "Attempting to decompress data after the end of stream is reached raises an :" "exc:`EOFError`. Any data found after the end of the stream is ignored and " "saved in the :attr:`~.unused_data` attribute." msgstr "" -#: ../../library/bz2.rst:250 +#: ../../library/bz2.rst:263 msgid "Added the *max_length* parameter." msgstr "新增 *max_length* 參數。" -#: ../../library/bz2.rst:255 +#: ../../library/bz2.rst:268 msgid "``True`` if the end-of-stream marker has been reached." msgstr "" -#: ../../library/bz2.rst:262 +#: ../../library/bz2.rst:275 msgid "Data found after the end of the compressed stream." msgstr "" -#: ../../library/bz2.rst:264 +#: ../../library/bz2.rst:277 msgid "" "If this attribute is accessed before the end of the stream has been reached, " "its value will be ``b''``." msgstr "" -#: ../../library/bz2.rst:269 +#: ../../library/bz2.rst:282 msgid "" "``False`` if the :meth:`.decompress` method can provide more decompressed " "data before requiring new uncompressed input." msgstr "" -#: ../../library/bz2.rst:276 +#: ../../library/bz2.rst:289 msgid "One-shot (de)compression" msgstr "" -#: ../../library/bz2.rst:280 +#: ../../library/bz2.rst:293 msgid "Compress *data*, a :term:`bytes-like object `." msgstr "" -#: ../../library/bz2.rst:285 +#: ../../library/bz2.rst:298 msgid "For incremental compression, use a :class:`BZ2Compressor` instead." msgstr "" -#: ../../library/bz2.rst:290 +#: ../../library/bz2.rst:303 msgid "Decompress *data*, a :term:`bytes-like object `." msgstr "" -#: ../../library/bz2.rst:292 +#: ../../library/bz2.rst:305 msgid "" "If *data* is the concatenation of multiple compressed streams, decompress " "all of the streams." msgstr "" -#: ../../library/bz2.rst:295 +#: ../../library/bz2.rst:308 msgid "For incremental decompression, use a :class:`BZ2Decompressor` instead." msgstr "" -#: ../../library/bz2.rst:297 +#: ../../library/bz2.rst:310 msgid "Support for multi-stream inputs was added." msgstr "" -#: ../../library/bz2.rst:303 +#: ../../library/bz2.rst:316 msgid "Examples of usage" msgstr "用法範例" -#: ../../library/bz2.rst:305 +#: ../../library/bz2.rst:318 msgid "Below are some examples of typical usage of the :mod:`bz2` module." msgstr "" -#: ../../library/bz2.rst:307 +#: ../../library/bz2.rst:320 msgid "" "Using :func:`compress` and :func:`decompress` to demonstrate round-trip " "compression:" msgstr "" -#: ../../library/bz2.rst:325 +#: ../../library/bz2.rst:338 msgid "Using :class:`BZ2Compressor` for incremental compression:" msgstr "" -#: ../../library/bz2.rst:343 +#: ../../library/bz2.rst:356 msgid "" "The example above uses a very \"nonrandom\" stream of data (a stream of " "``b\"z\"`` chunks). Random data tends to compress poorly, while ordered, " "repetitive data usually yields a high compression ratio." msgstr "" -#: ../../library/bz2.rst:347 +#: ../../library/bz2.rst:360 msgid "Writing and reading a bzip2-compressed file in binary mode:" msgstr "" diff --git a/library/calendar.po b/library/calendar.po index 7ed55e4591..564f71a8d6 100644 --- a/library/calendar.po +++ b/library/calendar.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-26 00:13+0000\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -532,22 +532,24 @@ msgid "The :mod:`calendar` module exports the following data attributes:" msgstr ":mod:`calendar` 模組匯出以下資料屬性:" #: ../../library/calendar.rst:396 -msgid "An array that represents the days of the week in the current locale." -msgstr "以目前語系來表示的一週每一天名稱的陣列。" +msgid "" +"A sequence that represents the days of the week in the current locale, where " +"Monday is day number 0." +msgstr "以目前語系來表示的一週每一天名稱的序列,其中週一是第 0 天。" -#: ../../library/calendar.rst:401 +#: ../../library/calendar.rst:406 msgid "" -"An array that represents the abbreviated days of the week in the current " -"locale." -msgstr "以目前語系來表示的一週每一天縮寫名稱的陣列。" +"A sequence that represents the abbreviated days of the week in the current " +"locale, where Mon is day number 0." +msgstr "以目前語系來表示的一週每一天縮寫名稱的序列,其中 Mon 是第 0 天。" -#: ../../library/calendar.rst:412 +#: ../../library/calendar.rst:421 msgid "" "Aliases for the days of the week, where ``MONDAY`` is ``0`` and ``SUNDAY`` " "is ``6``." msgstr "一週每一天的別名,其中 ``MONDAY`` 是 ``0`` 而 ``SUNDAY`` 是 ``6``。" -#: ../../library/calendar.rst:420 +#: ../../library/calendar.rst:429 msgid "" "Enumeration defining days of the week as integer constants. The members of " "this enumeration are exported to the module scope as :data:`MONDAY` through :" @@ -556,32 +558,32 @@ msgstr "" "將一週中的幾天定義為整數常數的列舉。此列舉的成員將作為 :data:`MONDAY` 到 :" "data:`SUNDAY` 匯出到模組作用域。" -#: ../../library/calendar.rst:429 +#: ../../library/calendar.rst:438 msgid "" -"An array that represents the months of the year in the current locale. This " -"follows normal convention of January being month number 1, so it has a " +"A sequence that represents the months of the year in the current locale. " +"This follows normal convention of January being month number 1, so it has a " "length of 13 and ``month_name[0]`` is the empty string." msgstr "" -"以目前語系來表示的一年每個月份名稱的陣列。它按照一般慣例以數字 1 代表一月,因" +"以目前語系來表示的一年每個月份名稱的序列。它按照一般慣例以數字 1 代表一月,因" "此它的長度為 13,而 ``month_name[0]`` 是空字串。" -#: ../../library/calendar.rst:436 +#: ../../library/calendar.rst:449 msgid "" -"An array that represents the abbreviated months of the year in the current " +"A sequence that represents the abbreviated months of the year in the current " "locale. This follows normal convention of January being month number 1, so " "it has a length of 13 and ``month_abbr[0]`` is the empty string." msgstr "" -"以目前語系來表示的一年每個月份縮寫名稱的陣列。它按照一般慣例以數字 1 代表一" +"以目前語系來表示的一年每個月份縮寫名稱的序列。它按照一般慣例以數字 1 代表一" "月,因此它的長度為 13,而 ``month_abbr[0]`` 是空字串。" -#: ../../library/calendar.rst:454 +#: ../../library/calendar.rst:470 msgid "" "Aliases for the months of the year, where ``JANUARY`` is ``1`` and " "``DECEMBER`` is ``12``." msgstr "" "一年內每個月的別名,其中 ``JANUARY`` 是 ``ㄅ`` 而 ``DECEMBER`` 是 ``12``。" -#: ../../library/calendar.rst:462 +#: ../../library/calendar.rst:478 msgid "" "Enumeration defining months of the year as integer constants. The members of " "this enumeration are exported to the module scope as :data:`JANUARY` " @@ -590,75 +592,75 @@ msgstr "" "將一年中的月份定義為整數常數的列舉。此列舉的成員將作為 :data:`JANUARY` 到 :" "data:`DECEMBER` 匯出到模組作用域。" -#: ../../library/calendar.rst:469 +#: ../../library/calendar.rst:485 msgid "The :mod:`calendar` module defines the following exceptions:" msgstr ":mod:`calendar` 模組定義了以下例外:" -#: ../../library/calendar.rst:473 +#: ../../library/calendar.rst:489 msgid "" "A subclass of :exc:`ValueError`, raised when the given month number is " "outside of the range 1-12 (inclusive)." msgstr "" ":exc:`ValueError` 的子類別,當給定的月份數字超出 1-12 範圍(含)時引發。" -#: ../../library/calendar.rst:478 +#: ../../library/calendar.rst:494 msgid "The invalid month number." msgstr "無效的月份號。" -#: ../../library/calendar.rst:483 +#: ../../library/calendar.rst:499 msgid "" "A subclass of :exc:`ValueError`, raised when the given weekday number is " "outside of the range 0-6 (inclusive)." msgstr "" ":exc:`ValueError` 的子類別,當給定的週幾的數字超出 0-6(含)範圍時引發。" -#: ../../library/calendar.rst:488 +#: ../../library/calendar.rst:504 msgid "The invalid weekday number." msgstr "無效的週幾編號。" -#: ../../library/calendar.rst:493 +#: ../../library/calendar.rst:509 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/calendar.rst:494 +#: ../../library/calendar.rst:510 msgid "" "Object-oriented interface to dates and times with similar functionality to " "the :mod:`time` module." msgstr "日期與時間的物件導向介面,和 :mod:`time` 模組有相似的功能。" -#: ../../library/calendar.rst:497 +#: ../../library/calendar.rst:513 msgid "Module :mod:`time`" msgstr ":mod:`time` 模組" -#: ../../library/calendar.rst:498 +#: ../../library/calendar.rst:514 msgid "Low-level time related functions." msgstr "底層的時間相關函式。" -#: ../../library/calendar.rst:504 +#: ../../library/calendar.rst:520 msgid "Command-Line Usage" msgstr "命令列用法" -#: ../../library/calendar.rst:508 +#: ../../library/calendar.rst:524 msgid "" "The :mod:`calendar` module can be executed as a script from the command line " "to interactively print a calendar." msgstr ":mod:`calendar` 模組可以作為腳本從命令列執行,並以互動方式列印日曆。" -#: ../../library/calendar.rst:511 +#: ../../library/calendar.rst:527 msgid "" "python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" -" [year] [month]" +" [-f FIRST_WEEKDAY] [year] [month]" msgstr "" "python -m calendar [-h] [-L LOCALE] [-e ENCODING] [-t {text,html}]\n" " [-w WIDTH] [-l LINES] [-s SPACING] [-m MONTHS] [-c CSS]\n" -" [year] [month]" +" [-f FIRST_WEEKDAY] [year] [month]" -#: ../../library/calendar.rst:518 +#: ../../library/calendar.rst:534 msgid "For example, to print a calendar for the year 2000:" msgstr "例如,要列印 2000 年的日曆:" -#: ../../library/calendar.rst:520 +#: ../../library/calendar.rst:536 msgid "" "$ python -m calendar 2000\n" " 2000\n" @@ -736,36 +738,40 @@ msgstr "" "23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31\n" "30 31" -#: ../../library/calendar.rst:561 +#: ../../library/calendar.rst:577 msgid "The following options are accepted:" msgstr "接受以下選項:" -#: ../../library/calendar.rst:568 +#: ../../library/calendar.rst:584 msgid "Show the help message and exit." msgstr "顯示幫助訊息並退出。" -#: ../../library/calendar.rst:573 +#: ../../library/calendar.rst:589 msgid "The locale to use for month and weekday names. Defaults to English." msgstr "用於月份和週幾名稱的語系。預設為英語。" -#: ../../library/calendar.rst:579 +#: ../../library/calendar.rst:595 msgid "" "The encoding to use for output. :option:`--encoding` is required if :option:" "`--locale` is set." msgstr "" "用於輸出的編碼。如有設定 :option:`--locale` 則必須給定 :option:`--encoding`。" -#: ../../library/calendar.rst:585 +#: ../../library/calendar.rst:601 msgid "Print the calendar to the terminal as text, or as an HTML document." msgstr "將日曆以文字或 HTML 文件的形式印出到終端機。" -#: ../../library/calendar.rst:591 +#: ../../library/calendar.rst:607 msgid "" -"The year to print the calendar for. Must be a number between 1 and 9999. " -"Defaults to the current year." -msgstr "印出日曆的年份。必須是 1 到 9999 之間的數字。預設為當前年份。" +"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 +msgid "The year to print the calendar for. Defaults to the current year." +msgstr "印出日曆的年份。預設為當前年份。" -#: ../../library/calendar.rst:598 +#: ../../library/calendar.rst:621 msgid "" "The month of the specified :option:`year` to print the calendar for. Must be " "a number between 1 and 12, and may only be used in text mode. Defaults to " @@ -774,11 +780,11 @@ msgstr "" "要列印日曆的指定 :option:`year` 的月份。必須是 1 到 12 之間的數字,並且只能在" "文字模式下使用。預設列印全年日曆。" -#: ../../library/calendar.rst:604 +#: ../../library/calendar.rst:627 msgid "*Text-mode options:*" msgstr "*文字模式選項:*" -#: ../../library/calendar.rst:608 +#: ../../library/calendar.rst:631 msgid "" "The width of the date column in terminal columns. The date is printed " "centred in the column. Any value lower than 2 is ignored. Defaults to 2." @@ -786,7 +792,7 @@ msgstr "" "終端機行中日期行的寬度。日期印出在行的中央。任何小於 2 的值都會被忽略。預設" "為 2。" -#: ../../library/calendar.rst:616 +#: ../../library/calendar.rst:639 msgid "" "The number of lines for each week in terminal rows. The date is printed top-" "aligned. Any value lower than 1 is ignored. Defaults to 1." @@ -794,21 +800,21 @@ msgstr "" "終端機列中每週的列數。日期印出時頂部會對齊。任何小於 1 的值都會被忽略。預設" "為 1。" -#: ../../library/calendar.rst:624 +#: ../../library/calendar.rst:647 msgid "" "The space between months in columns. Any value lower than 2 is ignored. " "Defaults to 6." msgstr "行中月份之間的間距。任何小於 2 的值都會被忽略。預設為 6。" -#: ../../library/calendar.rst:631 +#: ../../library/calendar.rst:654 msgid "The number of months printed per row. Defaults to 3." msgstr "每列印出的月份數量。預設為 3。" -#: ../../library/calendar.rst:635 +#: ../../library/calendar.rst:658 msgid "*HTML-mode options:*" msgstr "*HTML 模式選項:*" -#: ../../library/calendar.rst:639 +#: ../../library/calendar.rst:662 msgid "" "The path of a CSS stylesheet to use for the calendar. This must either be " "relative to the generated HTML, or an absolute HTTP or ``file:///`` URL." diff --git a/library/cgi.po b/library/cgi.po deleted file mode 100644 index fcea153eae..0000000000 --- a/library/cgi.po +++ /dev/null @@ -1,889 +0,0 @@ -# Copyright (C) 2001-2024, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-05-22 02:01+0800\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/cgi.rst:2 -msgid ":mod:`cgi` --- Common Gateway Interface support" -msgstr ":mod:`cgi` --- 通用閘道器介面支援" - -#: ../../library/cgi.rst:8 -msgid "**Source code:** :source:`Lib/cgi.py`" -msgstr "**原始碼:**\\ :source:`Lib/cgi.py`" - -#: ../../library/cgi.rst:18 -msgid "" -"The :mod:`cgi` module is deprecated (see :pep:`PEP 594 <594#cgi>` for " -"details and alternatives)." -msgstr "" -":mod:`cgi` 模組 (module) 即將被棄用(詳情與替代方案請見 :pep:`PEP 594 " -"<594#cgi>`\\ )。" - -#: ../../library/cgi.rst:22 -msgid "" -"The :class:`FieldStorage` class can typically be replaced with :func:`urllib." -"parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." -"message` module or :pypi:`multipart` for ``POST`` and ``PUT``. Most :ref:" -"`utility functions ` have replacements." -msgstr "" - -#: ../../library/cgi.rst:30 -msgid "Support module for Common Gateway Interface (CGI) scripts." -msgstr "" - -#: ../../library/cgi.rst:32 -msgid "" -"This module defines a number of utilities for use by CGI scripts written in " -"Python." -msgstr "" - -#: ../../library/cgi.rst:35 -msgid "" -"The global variable ``maxlen`` can be set to an integer indicating the " -"maximum size of a POST request. POST requests larger than this size will " -"result in a :exc:`ValueError` being raised during parsing. The default value " -"of this variable is ``0``, meaning the request size is unlimited." -msgstr "" - -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: ../../includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" - -#: ../../library/cgi.rst:43 -msgid "Introduction" -msgstr "簡介" - -#: ../../library/cgi.rst:47 -msgid "" -"A CGI script is invoked by an HTTP server, usually to process user input " -"submitted through an HTML ``
`` or ```` element." -msgstr "" - -#: ../../library/cgi.rst:50 -msgid "" -"Most often, CGI scripts live in the server's special :file:`cgi-bin` " -"directory. The HTTP server places all sorts of information about the request " -"(such as the client's hostname, the requested URL, the query string, and " -"lots of other goodies) in the script's shell environment, executes the " -"script, and sends the script's output back to the client." -msgstr "" - -#: ../../library/cgi.rst:56 -msgid "" -"The script's input is connected to the client too, and sometimes the form " -"data is read this way; at other times the form data is passed via the " -"\"query string\" part of the URL. This module is intended to take care of " -"the different cases and provide a simpler interface to the Python script. " -"It also provides a number of utilities that help in debugging scripts, and " -"the latest addition is support for file uploads from a form (if your browser " -"supports it)." -msgstr "" - -#: ../../library/cgi.rst:63 -msgid "" -"The output of a CGI script should consist of two sections, separated by a " -"blank line. The first section contains a number of headers, telling the " -"client what kind of data is following. Python code to generate a minimal " -"header section looks like this::" -msgstr "" - -#: ../../library/cgi.rst:68 -msgid "" -"print(\"Content-Type: text/html\") # HTML is following\n" -"print() # blank line, end of headers" -msgstr "" - -#: ../../library/cgi.rst:71 -msgid "" -"The second section is usually HTML, which allows the client software to " -"display nicely formatted text with header, in-line images, etc. Here's " -"Python code that prints a simple piece of HTML::" -msgstr "" - -#: ../../library/cgi.rst:75 -msgid "" -"print(\"CGI script output\")\n" -"print(\"

This is my first CGI script

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

This is my first CGI script

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

Error

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

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

addr:\", form[\"addr\"].value)\n" -"...further form processing here..." -msgstr "" - -#: ../../library/cgi.rst:136 -msgid "" -"Here the fields, accessed through ``form[key]``, are themselves instances " -"of :class:`FieldStorage` (or :class:`MiniFieldStorage`, depending on the " -"form encoding). The :attr:`~FieldStorage.value` attribute of the instance " -"yields the string value of the field. The :meth:`~FieldStorage.getvalue` " -"method returns this string value directly; it also accepts an optional " -"second argument as a default to return if the requested key is not present." -msgstr "" - -#: ../../library/cgi.rst:143 -msgid "" -"If the submitted form data contains more than one field with the same name, " -"the object retrieved by ``form[key]`` is not a :class:`FieldStorage` or :" -"class:`MiniFieldStorage` instance but a list of such instances. Similarly, " -"in this situation, ``form.getvalue(key)`` would return a list of strings. If " -"you expect this possibility (when your HTML form contains multiple fields " -"with the same name), use the :meth:`~FieldStorage.getlist` method, which " -"always returns a list of values (so that you do not need to special-case the " -"single item case). For example, this code concatenates any number of " -"username fields, separated by commas::" -msgstr "" - -#: ../../library/cgi.rst:153 -msgid "" -"value = form.getlist(\"username\")\n" -"usernames = \",\".join(value)" -msgstr "" -"value = form.getlist(\"username\")\n" -"usernames = \",\".join(value)" - -#: ../../library/cgi.rst:156 -msgid "" -"If a field represents an uploaded file, accessing the value via the :attr:" -"`~FieldStorage.value` attribute or the :meth:`~FieldStorage.getvalue` method " -"reads the entire file in memory as bytes. This may not be what you want. " -"You can test for an uploaded file by testing either the :attr:`~FieldStorage." -"filename` attribute or the :attr:`~FieldStorage.file` attribute. You can " -"then read the data from the :attr:`!file` attribute before it is " -"automatically closed as part of the garbage collection of the :class:" -"`FieldStorage` instance (the :func:`~io.RawIOBase.read` and :func:`~io." -"IOBase.readline` methods will return bytes)::" -msgstr "" - -#: ../../library/cgi.rst:167 -msgid "" -"fileitem = form[\"userfile\"]\n" -"if fileitem.file:\n" -" # It's an uploaded file; count lines\n" -" linecount = 0\n" -" while True:\n" -" line = fileitem.file.readline()\n" -" if not line: break\n" -" linecount = linecount + 1" -msgstr "" - -#: ../../library/cgi.rst:176 -msgid "" -":class:`FieldStorage` objects also support being used in a :keyword:`with` " -"statement, which will automatically close them when done." -msgstr "" - -#: ../../library/cgi.rst:179 -msgid "" -"If an error is encountered when obtaining the contents of an uploaded file " -"(for example, when the user interrupts the form submission by clicking on a " -"Back or Cancel button) the :attr:`~FieldStorage.done` attribute of the " -"object for the field will be set to the value -1." -msgstr "" - -#: ../../library/cgi.rst:184 -msgid "" -"The file upload draft standard entertains the possibility of uploading " -"multiple files from one field (using a recursive :mimetype:`multipart/\\*` " -"encoding). When this occurs, the item will be a dictionary-like :class:" -"`FieldStorage` item. This can be determined by testing its :attr:`!type` " -"attribute, which should be :mimetype:`multipart/form-data` (or perhaps " -"another MIME type matching :mimetype:`multipart/\\*`). In this case, it can " -"be iterated over recursively just like the top-level form object." -msgstr "" - -#: ../../library/cgi.rst:192 -msgid "" -"When a form is submitted in the \"old\" format (as the query string or as a " -"single data part of type :mimetype:`application/x-www-form-urlencoded`), the " -"items will actually be instances of the class :class:`MiniFieldStorage`. In " -"this case, the :attr:`!list`, :attr:`!file`, and :attr:`filename` attributes " -"are always ``None``." -msgstr "" - -#: ../../library/cgi.rst:197 -msgid "" -"A form submitted via POST that also has a query string will contain both :" -"class:`FieldStorage` and :class:`MiniFieldStorage` items." -msgstr "" - -#: ../../library/cgi.rst:200 -msgid "" -"The :attr:`~FieldStorage.file` attribute is automatically closed upon the " -"garbage collection of the creating :class:`FieldStorage` instance." -msgstr "" - -#: ../../library/cgi.rst:204 -msgid "" -"Added support for the context management protocol to the :class:" -"`FieldStorage` class." -msgstr "" - -#: ../../library/cgi.rst:210 -msgid "Higher Level Interface" -msgstr "" - -#: ../../library/cgi.rst:212 -msgid "" -"The previous section explains how to read CGI form data using the :class:" -"`FieldStorage` class. This section describes a higher level interface which " -"was added to this class to allow one to do it in a more readable and " -"intuitive way. The interface doesn't make the techniques described in " -"previous sections obsolete --- they are still useful to process file uploads " -"efficiently, for example." -msgstr "" - -#: ../../library/cgi.rst:221 -msgid "" -"The interface consists of two simple methods. Using the methods you can " -"process form data in a generic way, without the need to worry whether only " -"one or more values were posted under one name." -msgstr "" - -#: ../../library/cgi.rst:225 -msgid "" -"In the previous section, you learned to write following code anytime you " -"expected a user to post more than one value under one name::" -msgstr "" - -#: ../../library/cgi.rst:228 -msgid "" -"item = form.getvalue(\"item\")\n" -"if isinstance(item, list):\n" -" # The user is requesting more than one item.\n" -"else:\n" -" # The user is requesting only one item." -msgstr "" - -#: ../../library/cgi.rst:234 -msgid "" -"This situation is common for example when a form contains a group of " -"multiple checkboxes with the same name::" -msgstr "" - -#: ../../library/cgi.rst:237 -msgid "" -"\n" -"" -msgstr "" -"\n" -"" - -#: ../../library/cgi.rst:240 -msgid "" -"In most situations, however, there's only one form control with a particular " -"name in a form and then you expect and need only one value associated with " -"this name. So you write a script containing for example this code::" -msgstr "" - -#: ../../library/cgi.rst:244 -msgid "user = form.getvalue(\"user\").upper()" -msgstr "user = form.getvalue(\"user\").upper()" - -#: ../../library/cgi.rst:246 -msgid "" -"The problem with the code is that you should never expect that a client will " -"provide valid input to your scripts. For example, if a curious user appends " -"another ``user=foo`` pair to the query string, then the script would crash, " -"because in this situation the ``getvalue(\"user\")`` method call returns a " -"list instead of a string. Calling the :meth:`~str.upper` method on a list " -"is not valid (since lists do not have a method of this name) and results in " -"an :exc:`AttributeError` exception." -msgstr "" - -#: ../../library/cgi.rst:254 -msgid "" -"Therefore, the appropriate way to read form data values was to always use " -"the code which checks whether the obtained value is a single value or a list " -"of values. That's annoying and leads to less readable scripts." -msgstr "" - -#: ../../library/cgi.rst:258 -msgid "" -"A more convenient approach is to use the methods :meth:`~FieldStorage." -"getfirst` and :meth:`~FieldStorage.getlist` provided by this higher level " -"interface." -msgstr "" - -#: ../../library/cgi.rst:264 -msgid "" -"This method always returns only one value associated with form field *name*. " -"The method returns only the first value in case that more values were posted " -"under such name. Please note that the order in which the values are " -"received may vary from browser to browser and should not be counted on. " -"[#]_ If no such form field or value exists then the method returns the " -"value specified by the optional parameter *default*. This parameter " -"defaults to ``None`` if not specified." -msgstr "" - -#: ../../library/cgi.rst:275 -msgid "" -"This method always returns a list of values associated with form field " -"*name*. The method returns an empty list if no such form field or value " -"exists for *name*. It returns a list consisting of one item if only one " -"such value exists." -msgstr "" - -#: ../../library/cgi.rst:279 -msgid "Using these methods you can write nice compact code::" -msgstr "" - -#: ../../library/cgi.rst:281 -msgid "" -"import cgi\n" -"form = cgi.FieldStorage()\n" -"user = form.getfirst(\"user\", \"\").upper() # This way it's safe.\n" -"for item in form.getlist(\"item\"):\n" -" do_something(item)" -msgstr "" -"import cgi\n" -"form = cgi.FieldStorage()\n" -"user = form.getfirst(\"user\", \"\").upper() # 這是安全的方式。\n" -"for item in form.getlist(\"item\"):\n" -" do_something(item)" - -#: ../../library/cgi.rst:291 -msgid "Functions" -msgstr "函式" - -#: ../../library/cgi.rst:293 -msgid "" -"These are useful if you want more control, or if you want to employ some of " -"the algorithms implemented in this module in other circumstances." -msgstr "" - -#: ../../library/cgi.rst:299 -msgid "" -"Parse a query in the environment or from a file (the file defaults to ``sys." -"stdin``). The *keep_blank_values*, *strict_parsing* and *separator* " -"parameters are passed to :func:`urllib.parse.parse_qs` unchanged." -msgstr "" - -#: ../../library/cgi.rst:303 -msgid "" -"This function, like the rest of the :mod:`cgi` module, is deprecated. It can " -"be replaced by calling :func:`urllib.parse.parse_qs` directly on the desired " -"query string (except for ``multipart/form-data`` input, which can be handled " -"as described for :func:`parse_multipart`)." -msgstr "" - -#: ../../library/cgi.rst:312 -msgid "" -"Parse input of type :mimetype:`multipart/form-data` (for file uploads). " -"Arguments are *fp* for the input file, *pdict* for a dictionary containing " -"other parameters in the :mailheader:`Content-Type` header, and *encoding*, " -"the request encoding." -msgstr "" - -#: ../../library/cgi.rst:317 -msgid "" -"Returns a dictionary just like :func:`urllib.parse.parse_qs`: keys are the " -"field names, each value is a list of values for that field. For non-file " -"fields, the value is a list of strings." -msgstr "" - -#: ../../library/cgi.rst:321 -msgid "" -"This is easy to use but not much good if you are expecting megabytes to be " -"uploaded --- in that case, use the :class:`FieldStorage` class instead which " -"is much more flexible." -msgstr "" - -#: ../../library/cgi.rst:325 -msgid "" -"Added the *encoding* and *errors* parameters. For non-file fields, the " -"value is now a list of strings, not bytes." -msgstr "" - -#: ../../library/cgi.rst:329 -msgid "Added the *separator* parameter." -msgstr "新增 *separator* 參數。" - -#: ../../library/cgi.rst:332 -msgid "" -"This function, like the rest of the :mod:`cgi` module, is deprecated. It can " -"be replaced with the functionality in the :mod:`email` package (e.g. :class:" -"`email.message.EmailMessage`/:class:`email.message.Message`) which " -"implements the same MIME RFCs, or with the :pypi:`multipart` PyPI project." -msgstr "" - -#: ../../library/cgi.rst:342 -msgid "" -"Parse a MIME header (such as :mailheader:`Content-Type`) into a main value " -"and a dictionary of parameters." -msgstr "" - -#: ../../library/cgi.rst:345 -msgid "" -"This function, like the rest of the :mod:`cgi` module, is deprecated. It can " -"be replaced with the functionality in the :mod:`email` package, which " -"implements the same MIME RFCs." -msgstr "" - -#: ../../library/cgi.rst:350 -msgid "For example, with :class:`email.message.EmailMessage`::" -msgstr "" - -#: ../../library/cgi.rst:352 -msgid "" -"from email.message import EmailMessage\n" -"msg = EmailMessage()\n" -"msg['content-type'] = 'application/json; charset=\"utf8\"'\n" -"main, params = msg.get_content_type(), msg['content-type'].params" -msgstr "" -"from email.message import EmailMessage\n" -"msg = EmailMessage()\n" -"msg['content-type'] = 'application/json; charset=\"utf8\"'\n" -"main, params = msg.get_content_type(), msg['content-type'].params" - -#: ../../library/cgi.rst:360 -msgid "" -"Robust test CGI script, usable as main program. Writes minimal HTTP headers " -"and formats all information provided to the script in HTML format." -msgstr "" - -#: ../../library/cgi.rst:366 -msgid "Format the shell environment in HTML." -msgstr "" - -#: ../../library/cgi.rst:371 -msgid "Format a form in HTML." -msgstr "" - -#: ../../library/cgi.rst:376 -msgid "Format the current directory in HTML." -msgstr "" - -#: ../../library/cgi.rst:381 -msgid "Print a list of useful (used by CGI) environment variables in HTML." -msgstr "" - -#: ../../library/cgi.rst:387 -msgid "Caring about security" -msgstr "" - -#: ../../library/cgi.rst:391 -msgid "" -"There's one important rule: if you invoke an external program (via :func:`os." -"system`, :func:`os.popen` or other functions with similar functionality), " -"make very sure you don't pass arbitrary strings received from the client to " -"the shell. This is a well-known security hole whereby clever hackers " -"anywhere on the web can exploit a gullible CGI script to invoke arbitrary " -"shell commands. Even parts of the URL or field names cannot be trusted, " -"since the request doesn't have to come from your form!" -msgstr "" - -#: ../../library/cgi.rst:399 -msgid "" -"To be on the safe side, if you must pass a string gotten from a form to a " -"shell command, you should make sure the string contains only alphanumeric " -"characters, dashes, underscores, and periods." -msgstr "" - -#: ../../library/cgi.rst:405 -msgid "Installing your CGI script on a Unix system" -msgstr "" - -#: ../../library/cgi.rst:407 -msgid "" -"Read the documentation for your HTTP server and check with your local system " -"administrator to find the directory where CGI scripts should be installed; " -"usually this is in a directory :file:`cgi-bin` in the server tree." -msgstr "" - -#: ../../library/cgi.rst:411 -msgid "" -"Make sure that your script is readable and executable by \"others\"; the " -"Unix file mode should be ``0o755`` octal (use ``chmod 0755 filename``). " -"Make sure that the first line of the script contains ``#!`` starting in " -"column 1 followed by the pathname of the Python interpreter, for instance::" -msgstr "" - -#: ../../library/cgi.rst:416 -msgid "#!/usr/local/bin/python" -msgstr "#!/usr/local/bin/python" - -#: ../../library/cgi.rst:418 -msgid "" -"Make sure the Python interpreter exists and is executable by \"others\"." -msgstr "" - -#: ../../library/cgi.rst:420 -msgid "" -"Make sure that any files your script needs to read or write are readable or " -"writable, respectively, by \"others\" --- their mode should be ``0o644`` for " -"readable and ``0o666`` for writable. This is because, for security reasons, " -"the HTTP server executes your script as user \"nobody\", without any special " -"privileges. It can only read (write, execute) files that everybody can read " -"(write, execute). The current directory at execution time is also different " -"(it is usually the server's cgi-bin directory) and the set of environment " -"variables is also different from what you get when you log in. In " -"particular, don't count on the shell's search path for executables (:envvar:" -"`PATH`) or the Python module search path (:envvar:`PYTHONPATH`) to be set to " -"anything interesting." -msgstr "" - -#: ../../library/cgi.rst:431 -msgid "" -"If you need to load modules from a directory which is not on Python's " -"default module search path, you can change the path in your script, before " -"importing other modules. For example::" -msgstr "" - -#: ../../library/cgi.rst:435 -msgid "" -"import sys\n" -"sys.path.insert(0, \"/usr/home/joe/lib/python\")\n" -"sys.path.insert(0, \"/usr/local/lib/python\")" -msgstr "" -"import sys\n" -"sys.path.insert(0, \"/usr/home/joe/lib/python\")\n" -"sys.path.insert(0, \"/usr/local/lib/python\")" - -#: ../../library/cgi.rst:439 -msgid "(This way, the directory inserted last will be searched first!)" -msgstr "" - -#: ../../library/cgi.rst:441 -msgid "" -"Instructions for non-Unix systems will vary; check your HTTP server's " -"documentation (it will usually have a section on CGI scripts)." -msgstr "" - -#: ../../library/cgi.rst:446 -msgid "Testing your CGI script" -msgstr "" - -#: ../../library/cgi.rst:448 -msgid "" -"Unfortunately, a CGI script will generally not run when you try it from the " -"command line, and a script that works perfectly from the command line may " -"fail mysteriously when run from the server. There's one reason why you " -"should still test your script from the command line: if it contains a syntax " -"error, the Python interpreter won't execute it at all, and the HTTP server " -"will most likely send a cryptic error to the client." -msgstr "" - -#: ../../library/cgi.rst:455 -msgid "" -"Assuming your script has no syntax errors, yet it does not work, you have no " -"choice but to read the next section." -msgstr "" - -#: ../../library/cgi.rst:460 -msgid "Debugging CGI scripts" -msgstr "" - -#: ../../library/cgi.rst:464 -msgid "" -"First of all, check for trivial installation errors --- reading the section " -"above on installing your CGI script carefully can save you a lot of time. " -"If you wonder whether you have understood the installation procedure " -"correctly, try installing a copy of this module file (:file:`cgi.py`) as a " -"CGI script. When invoked as a script, the file will dump its environment " -"and the contents of the form in HTML format. Give it the right mode etc., " -"and send it a request. If it's installed in the standard :file:`cgi-bin` " -"directory, it should be possible to send it a request by entering a URL into " -"your browser of the form:" -msgstr "" - -#: ../../library/cgi.rst:473 -msgid "http://yourhostname/cgi-bin/cgi.py?name=Joe+Blow&addr=At+Home" -msgstr "http://yourhostname/cgi-bin/cgi.py?name=Joe+Blow&addr=At+Home" - -#: ../../library/cgi.rst:477 -msgid "" -"If this gives an error of type 404, the server cannot find the script -- " -"perhaps you need to install it in a different directory. If it gives " -"another error, there's an installation problem that you should fix before " -"trying to go any further. If you get a nicely formatted listing of the " -"environment and form content (in this example, the fields should be listed " -"as \"addr\" with value \"At Home\" and \"name\" with value \"Joe Blow\"), " -"the :file:`cgi.py` script has been installed correctly. If you follow the " -"same procedure for your own script, you should now be able to debug it." -msgstr "" - -#: ../../library/cgi.rst:486 -msgid "" -"The next step could be to call the :mod:`cgi` module's :func:`test` function " -"from your script: replace its main code with the single statement ::" -msgstr "" - -#: ../../library/cgi.rst:489 -msgid "cgi.test()" -msgstr "cgi.test()" - -#: ../../library/cgi.rst:491 -msgid "" -"This should produce the same results as those gotten from installing the :" -"file:`cgi.py` file itself." -msgstr "" - -#: ../../library/cgi.rst:494 -msgid "" -"When an ordinary Python script raises an unhandled exception (for whatever " -"reason: of a typo in a module name, a file that can't be opened, etc.), the " -"Python interpreter prints a nice traceback and exits. While the Python " -"interpreter will still do this when your CGI script raises an exception, " -"most likely the traceback will end up in one of the HTTP server's log files, " -"or be discarded altogether." -msgstr "" - -#: ../../library/cgi.rst:501 -msgid "" -"Fortunately, once you have managed to get your script to execute *some* " -"code, you can easily send tracebacks to the web browser using the :mod:" -"`cgitb` module. If you haven't done so already, just add the lines::" -msgstr "" - -#: ../../library/cgi.rst:508 -msgid "" -"to the top of your script. Then try running it again; when a problem " -"occurs, you should see a detailed report that will likely make apparent the " -"cause of the crash." -msgstr "" - -#: ../../library/cgi.rst:512 -msgid "" -"If you suspect that there may be a problem in importing the :mod:`cgitb` " -"module, you can use an even more robust approach (which only uses built-in " -"modules)::" -msgstr "" - -#: ../../library/cgi.rst:515 -msgid "" -"import sys\n" -"sys.stderr = sys.stdout\n" -"print(\"Content-Type: text/plain\")\n" -"print()\n" -"...your code here..." -msgstr "" - -#: ../../library/cgi.rst:521 -msgid "" -"This relies on the Python interpreter to print the traceback. The content " -"type of the output is set to plain text, which disables all HTML " -"processing. If your script works, the raw HTML will be displayed by your " -"client. If it raises an exception, most likely after the first two lines " -"have been printed, a traceback will be displayed. Because no HTML " -"interpretation is going on, the traceback will be readable." -msgstr "" - -#: ../../library/cgi.rst:530 -msgid "Common problems and solutions" -msgstr "" - -#: ../../library/cgi.rst:532 -msgid "" -"Most HTTP servers buffer the output from CGI scripts until the script is " -"completed. This means that it is not possible to display a progress report " -"on the client's display while the script is running." -msgstr "" - -#: ../../library/cgi.rst:536 -msgid "Check the installation instructions above." -msgstr "" - -#: ../../library/cgi.rst:538 -msgid "" -"Check the HTTP server's log files. (``tail -f logfile`` in a separate " -"window may be useful!)" -msgstr "" - -#: ../../library/cgi.rst:541 -msgid "" -"Always check a script for syntax errors first, by doing something like " -"``python script.py``." -msgstr "" - -#: ../../library/cgi.rst:544 -msgid "" -"If your script does not have any syntax errors, try adding ``import cgitb; " -"cgitb.enable()`` to the top of the script." -msgstr "" - -#: ../../library/cgi.rst:547 -msgid "" -"When invoking external programs, make sure they can be found. Usually, this " -"means using absolute path names --- :envvar:`PATH` is usually not set to a " -"very useful value in a CGI script." -msgstr "" - -#: ../../library/cgi.rst:551 -msgid "" -"When reading or writing external files, make sure they can be read or " -"written by the userid under which your CGI script will be running: this is " -"typically the userid under which the web server is running, or some " -"explicitly specified userid for a web server's ``suexec`` feature." -msgstr "" - -#: ../../library/cgi.rst:556 -msgid "" -"Don't try to give a CGI script a set-uid mode. This doesn't work on most " -"systems, and is a security liability as well." -msgstr "" - -#: ../../library/cgi.rst:560 -msgid "Footnotes" -msgstr "註解" - -#: ../../library/cgi.rst:561 -msgid "" -"Note that some recent versions of the HTML specification do state what order " -"the field values should be supplied in, but knowing whether a request was " -"received from a conforming browser, or even from a browser at all, is " -"tedious and error-prone." -msgstr "" - -#: ../../library/cgi.rst:10 -msgid "WWW" -msgstr "WWW" - -#: ../../library/cgi.rst:10 -msgid "server" -msgstr "server(伺服器)" - -#: ../../library/cgi.rst:10 ../../library/cgi.rst:389 ../../library/cgi.rst:462 -msgid "CGI" -msgstr "CGI" - -#: ../../library/cgi.rst:10 -msgid "protocol" -msgstr "protocol(協定)" - -#: ../../library/cgi.rst:10 -msgid "HTTP" -msgstr "HTTP" - -#: ../../library/cgi.rst:10 -msgid "MIME" -msgstr "MIME" - -#: ../../library/cgi.rst:10 -msgid "headers" -msgstr "headers(標頭)" - -#: ../../library/cgi.rst:10 -msgid "URL" -msgstr "URL(統一資源定位器)" - -#: ../../library/cgi.rst:10 -msgid "Common Gateway Interface" -msgstr "Common Gateway Interface(通用閘道器介面)" - -#: ../../library/cgi.rst:389 -msgid "security" -msgstr "security(安全)" - -#: ../../library/cgi.rst:462 -msgid "debugging" -msgstr "debugging(除錯)" diff --git a/library/cgitb.po b/library/cgitb.po deleted file mode 100644 index e297a5cfee..0000000000 --- a/library/cgitb.po +++ /dev/null @@ -1,137 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-05-22 02:02+0800\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/cgitb.rst:2 -msgid ":mod:`cgitb` --- Traceback manager for CGI scripts" -msgstr ":mod:`cgitb` --- CGI 腳本的回溯 (traceback) 管理程式" - -#: ../../library/cgitb.rst:11 -msgid "**Source code:** :source:`Lib/cgitb.py`" -msgstr "**原始碼:**\\ :source:`Lib/cgitb.py`" - -#: ../../library/cgitb.rst:19 -msgid "" -"The :mod:`cgitb` module is deprecated (see :pep:`PEP 594 <594#cgitb>` for " -"details)." -msgstr "" -":mod:`cgitb` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#cgitb>`\\ )。" - -#: ../../library/cgitb.rst:25 -msgid "" -"The :mod:`cgitb` module provides a special exception handler for Python " -"scripts. (Its name is a bit misleading. It was originally designed to " -"display extensive traceback information in HTML for CGI scripts. It was " -"later generalized to also display this information in plain text.) After " -"this module is activated, if an uncaught exception occurs, a detailed, " -"formatted report will be displayed. The report includes a traceback showing " -"excerpts of the source code for each level, as well as the values of the " -"arguments and local variables to currently running functions, to help you " -"debug the problem. Optionally, you can save this information to a file " -"instead of sending it to the browser." -msgstr "" - -#: ../../library/cgitb.rst:35 -msgid "To enable this feature, simply add this to the top of your CGI script::" -msgstr "" - -#: ../../library/cgitb.rst:37 -msgid "" -"import cgitb\n" -"cgitb.enable()" -msgstr "" -"import cgitb\n" -"cgitb.enable()" - -#: ../../library/cgitb.rst:40 -msgid "" -"The options to the :func:`enable` function control whether the report is " -"displayed in the browser and whether the report is logged to a file for " -"later analysis." -msgstr "" - -#: ../../library/cgitb.rst:49 -msgid "" -"This function causes the :mod:`cgitb` module to take over the interpreter's " -"default handling for exceptions by setting the value of :attr:`sys." -"excepthook`." -msgstr "" - -#: ../../library/cgitb.rst:52 -msgid "" -"The optional argument *display* defaults to ``1`` and can be set to ``0`` to " -"suppress sending the traceback to the browser. If the argument *logdir* is " -"present, the traceback reports are written to files. The value of *logdir* " -"should be a directory where these files will be placed. The optional " -"argument *context* is the number of lines of context to display around the " -"current line of source code in the traceback; this defaults to ``5``. If the " -"optional argument *format* is ``\"html\"``, the output is formatted as " -"HTML. Any other value forces plain text output. The default value is " -"``\"html\"``." -msgstr "" - -#: ../../library/cgitb.rst:64 -msgid "" -"This function handles the exception described by *info* (a 3-tuple " -"containing the result of :func:`sys.exc_info`), formatting its traceback as " -"text and returning the result as a string. The optional argument *context* " -"is the number of lines of context to display around the current line of " -"source code in the traceback; this defaults to ``5``." -msgstr "" - -#: ../../library/cgitb.rst:73 -msgid "" -"This function handles the exception described by *info* (a 3-tuple " -"containing the result of :func:`sys.exc_info`), formatting its traceback as " -"HTML and returning the result as a string. The optional argument *context* " -"is the number of lines of context to display around the current line of " -"source code in the traceback; this defaults to ``5``." -msgstr "" - -#: ../../library/cgitb.rst:82 -msgid "" -"This function handles an exception using the default settings (that is, show " -"a report in the browser, but don't log to a file). This can be used when " -"you've caught an exception and want to report it using :mod:`cgitb`. The " -"optional *info* argument should be a 3-tuple containing an exception type, " -"exception value, and traceback object, exactly like the tuple returned by :" -"func:`sys.exc_info`. If the *info* argument is not supplied, the current " -"exception is obtained from :func:`sys.exc_info`." -msgstr "" - -#: ../../library/cgitb.rst:13 -msgid "CGI" -msgstr "CGI" - -#: ../../library/cgitb.rst:13 -msgid "exceptions" -msgstr "exceptions(例外)" - -#: ../../library/cgitb.rst:13 -msgid "tracebacks" -msgstr "tracebacks(回溯)" - -#: ../../library/cgitb.rst:13 -msgid "in CGI scripts" -msgstr "於 CGI 腳本中" - -#: ../../library/cgitb.rst:47 -msgid "excepthook() (in module sys)" -msgstr "excepthook() (sys 模組中)" diff --git a/library/chunk.po b/library/chunk.po deleted file mode 100644 index 23d9a59322..0000000000 --- a/library/chunk.po +++ /dev/null @@ -1,225 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" -"PO-Revision-Date: 2022-05-22 02:03+0800\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/chunk.rst:2 -msgid ":mod:`chunk` --- Read IFF chunked data" -msgstr ":mod:`chunk` --- 讀取 IFF 分塊資料" - -#: ../../library/chunk.rst:11 -msgid "**Source code:** :source:`Lib/chunk.py`" -msgstr "**原始碼:**\\ :source:`Lib/chunk.py`" - -#: ../../library/chunk.rst:20 -msgid "" -"The :mod:`chunk` module is deprecated (see :pep:`PEP 594 <594#chunk>` for " -"details)." -msgstr "" -":mod:`chunk` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#chunk>`\\ )。" - -#: ../../library/chunk.rst:26 -msgid "" -"This module provides an interface for reading files that use EA IFF 85 " -"chunks. [#]_ This format is used in at least the Audio Interchange File " -"Format (AIFF/AIFF-C) and the Real Media File Format (RMFF). The WAVE audio " -"file format is closely related and can also be read using this module." -msgstr "" - -#: ../../library/chunk.rst:31 -msgid "A chunk has the following structure:" -msgstr "" - -#: ../../library/chunk.rst:34 -msgid "Offset" -msgstr "" - -#: ../../library/chunk.rst:34 -msgid "Length" -msgstr "長度" - -#: ../../library/chunk.rst:34 -msgid "Contents" -msgstr "內容" - -#: ../../library/chunk.rst:36 -msgid "0" -msgstr "0" - -#: ../../library/chunk.rst:36 ../../library/chunk.rst:38 -msgid "4" -msgstr "4" - -#: ../../library/chunk.rst:36 -msgid "Chunk ID" -msgstr "" - -#: ../../library/chunk.rst:38 -msgid "Size of chunk in big-endian byte order, not including the header" -msgstr "" - -#: ../../library/chunk.rst:42 -msgid "8" -msgstr "8" - -#: ../../library/chunk.rst:42 -msgid "*n*" -msgstr "*n*" - -#: ../../library/chunk.rst:42 -msgid "Data bytes, where *n* is the size given in the preceding field" -msgstr "" - -#: ../../library/chunk.rst:46 -msgid "8 + *n*" -msgstr "8 + *n*" - -#: ../../library/chunk.rst:46 -msgid "0 or 1" -msgstr "0 或 1" - -#: ../../library/chunk.rst:46 -msgid "Pad byte needed if *n* is odd and chunk alignment is used" -msgstr "" - -#: ../../library/chunk.rst:50 -msgid "The ID is a 4-byte string which identifies the type of chunk." -msgstr "" - -#: ../../library/chunk.rst:52 -msgid "" -"The size field (a 32-bit value, encoded using big-endian byte order) gives " -"the size of the chunk data, not including the 8-byte header." -msgstr "" - -#: ../../library/chunk.rst:55 -msgid "" -"Usually an IFF-type file consists of one or more chunks. The proposed usage " -"of the :class:`Chunk` class defined here is to instantiate an instance at " -"the start of each chunk and read from the instance until it reaches the end, " -"after which a new instance can be instantiated. At the end of the file, " -"creating a new instance will fail with an :exc:`EOFError` exception." -msgstr "" - -#: ../../library/chunk.rst:64 -msgid "" -"Class which represents a chunk. The *file* argument is expected to be a " -"file-like object. An instance of this class is specifically allowed. The " -"only method that is needed is :meth:`~io.IOBase.read`. If the methods :meth:" -"`~io.IOBase.seek` and :meth:`~io.IOBase.tell` are present and don't raise an " -"exception, they are also used. If these methods are present and raise an " -"exception, they are expected to not have altered the object. If the " -"optional argument *align* is true, chunks are assumed to be aligned on 2-" -"byte boundaries. If *align* is false, no alignment is assumed. The default " -"value is true. If the optional argument *bigendian* is false, the chunk " -"size is assumed to be in little-endian order. This is needed for WAVE audio " -"files. The default value is true. If the optional argument *inclheader* is " -"true, the size given in the chunk header includes the size of the header. " -"The default value is false." -msgstr "" - -#: ../../library/chunk.rst:78 -msgid "A :class:`Chunk` object supports the following methods:" -msgstr "" - -#: ../../library/chunk.rst:83 -msgid "" -"Returns the name (ID) of the chunk. This is the first 4 bytes of the chunk." -msgstr "" - -#: ../../library/chunk.rst:89 -msgid "Returns the size of the chunk." -msgstr "" - -#: ../../library/chunk.rst:94 -msgid "" -"Close and skip to the end of the chunk. This does not close the underlying " -"file." -msgstr "" - -#: ../../library/chunk.rst:97 -msgid "" -"The remaining methods will raise :exc:`OSError` if called after the :meth:" -"`close` method has been called. Before Python 3.3, they used to raise :exc:" -"`IOError`, now an alias of :exc:`OSError`." -msgstr "" - -#: ../../library/chunk.rst:104 -msgid "Returns ``False``." -msgstr "" - -#: ../../library/chunk.rst:109 -msgid "" -"Set the chunk's current position. The *whence* argument is optional and " -"defaults to ``0`` (absolute file positioning); other values are ``1`` (seek " -"relative to the current position) and ``2`` (seek relative to the file's " -"end). There is no return value. If the underlying file does not allow seek, " -"only forward seeks are allowed." -msgstr "" - -#: ../../library/chunk.rst:118 -msgid "Return the current position into the chunk." -msgstr "" - -#: ../../library/chunk.rst:123 -msgid "" -"Read at most *size* bytes from the chunk (less if the read hits the end of " -"the chunk before obtaining *size* bytes). If the *size* argument is " -"negative or omitted, read all data until the end of the chunk. An empty " -"bytes object is returned when the end of the chunk is encountered " -"immediately." -msgstr "" - -#: ../../library/chunk.rst:132 -msgid "" -"Skip to the end of the chunk. All further calls to :meth:`read` for the " -"chunk will return ``b''``. If you are not interested in the contents of the " -"chunk, this method should be called so that the file points to the start of " -"the next chunk." -msgstr "" - -#: ../../library/chunk.rst:139 -msgid "Footnotes" -msgstr "註解" - -#: ../../library/chunk.rst:140 -msgid "" -"\"EA IFF 85\" Standard for Interchange Format Files, Jerry Morrison, " -"Electronic Arts, January 1985." -msgstr "" - -#: ../../library/chunk.rst:13 -msgid "Audio Interchange File Format" -msgstr "Audio Interchange File Format(音訊交換檔案格式)" - -#: ../../library/chunk.rst:13 -msgid "AIFF" -msgstr "AIFF" - -#: ../../library/chunk.rst:13 -msgid "AIFF-C" -msgstr "AIFF-C" - -#: ../../library/chunk.rst:13 -msgid "Real Media File Format" -msgstr "Real Media File Format(Real Media 檔案格式)" - -#: ../../library/chunk.rst:13 -msgid "RMFF" -msgstr "RMFF" diff --git a/library/cmath.po b/library/cmath.po index ae115ae058..40159235bf 100644 --- a/library/cmath.po +++ b/library/cmath.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-03-14 09:26+0800\n" diff --git a/library/cmd.po b/library/cmd.po index 5a014217df..5a99032492 100644 --- a/library/cmd.po +++ b/library/cmd.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -53,41 +53,54 @@ msgstr "" #: ../../library/cmd.rst:29 msgid "" +"The default, ``'tab'``, is treated specially, so that it refers to the :kbd:" +"`Tab` key on every :data:`readline.backend`. Specifically, if :data:" +"`readline.backend` is ``editline``, ``Cmd`` will use ``'^I'`` instead of " +"``'tab'``. Note that other values are not treated this way, and might only " +"work with a specific backend." +msgstr "" + +#: ../../library/cmd.rst:36 +msgid "" "The optional arguments *stdin* and *stdout* specify the input and output " "file objects that the Cmd instance or subclass instance will use for input " "and output. If not specified, they will default to :data:`sys.stdin` and :" "data:`sys.stdout`." msgstr "" -#: ../../library/cmd.rst:34 +#: ../../library/cmd.rst:41 msgid "" "If you want a given *stdin* to be used, make sure to set the instance's :" "attr:`use_rawinput` attribute to ``False``, otherwise *stdin* will be " "ignored." msgstr "" -#: ../../library/cmd.rst:42 +#: ../../library/cmd.rst:45 +msgid "``completekey='tab'`` is replaced by ``'^I'`` for ``editline``." +msgstr "" + +#: ../../library/cmd.rst:52 msgid "Cmd Objects" msgstr "Cmd 物件" -#: ../../library/cmd.rst:44 +#: ../../library/cmd.rst:54 msgid "A :class:`Cmd` instance has the following methods:" msgstr "" -#: ../../library/cmd.rst:49 +#: ../../library/cmd.rst:59 msgid "" "Repeatedly issue a prompt, accept input, parse an initial prefix off the " "received input, and dispatch to action methods, passing them the remainder " "of the line as argument." msgstr "" -#: ../../library/cmd.rst:53 +#: ../../library/cmd.rst:63 msgid "" "The optional argument is a banner or intro string to be issued before the " "first prompt (this overrides the :attr:`intro` class attribute)." msgstr "" -#: ../../library/cmd.rst:56 +#: ../../library/cmd.rst:66 msgid "" "If the :mod:`readline` module is loaded, input will automatically inherit :" "program:`bash`\\ -like history-list editing (e.g. :kbd:`Control-P` scrolls " @@ -96,11 +109,11 @@ msgid "" "B` moves the cursor to the left non-destructively, etc.)." msgstr "" -#: ../../library/cmd.rst:62 +#: ../../library/cmd.rst:72 msgid "An end-of-file on input is passed back as the string ``'EOF'``." msgstr "" -#: ../../library/cmd.rst:68 +#: ../../library/cmd.rst:78 msgid "" "An interpreter instance will recognize a command name ``foo`` if and only if " "it has a method :meth:`!do_foo`. As a special case, a line beginning with " @@ -109,14 +122,14 @@ msgid "" "dispatched to the method :meth:`!do_shell` (if such a method is defined)." msgstr "" -#: ../../library/cmd.rst:74 +#: ../../library/cmd.rst:84 msgid "" "This method will return when the :meth:`postcmd` method returns a true " "value. The *stop* argument to :meth:`postcmd` is the return value from the " "command's corresponding :meth:`!do_\\*` method." msgstr "" -#: ../../library/cmd.rst:78 +#: ../../library/cmd.rst:88 msgid "" "If completion is enabled, completing commands will be done automatically, " "and completing of commands args is done by calling :meth:`!complete_foo` " @@ -128,7 +141,7 @@ msgid "" "the argument is in." msgstr "" -#: ../../library/cmd.rst:89 +#: ../../library/cmd.rst:99 msgid "" "All subclasses of :class:`Cmd` inherit a predefined :meth:`!do_help`. This " "method, called with an argument ``'bar'``, invokes the corresponding method :" @@ -139,7 +152,7 @@ msgid "" "undocumented commands." msgstr "" -#: ../../library/cmd.rst:100 +#: ../../library/cmd.rst:110 msgid "" "Interpret the argument as though it had been typed in response to the " "prompt. This may be overridden, but should not normally need to be; see the :" @@ -150,32 +163,32 @@ msgid "" "return value from the :meth:`default` method is returned." msgstr "" -#: ../../library/cmd.rst:111 +#: ../../library/cmd.rst:121 msgid "" "Method called when an empty line is entered in response to the prompt. If " "this method is not overridden, it repeats the last nonempty command entered." msgstr "" -#: ../../library/cmd.rst:117 +#: ../../library/cmd.rst:127 msgid "" "Method called on an input line when the command prefix is not recognized. If " "this method is not overridden, it prints an error message and returns." msgstr "" -#: ../../library/cmd.rst:123 +#: ../../library/cmd.rst:133 msgid "" "Method called to complete an input line when no command-specific :meth:`!" "complete_\\*` method is available. By default, it returns an empty list." msgstr "" -#: ../../library/cmd.rst:129 +#: ../../library/cmd.rst:139 msgid "" "Method called to display a list of strings as a compact set of columns. Each " "column is only as wide as necessary. Columns are separated by two spaces for " "readability." msgstr "" -#: ../../library/cmd.rst:136 +#: ../../library/cmd.rst:146 msgid "" "Hook method executed just before the command line *line* is interpreted, but " "after the input prompt is generated and issued. This method is a stub in :" @@ -185,7 +198,7 @@ msgid "" "*line* unchanged." msgstr "" -#: ../../library/cmd.rst:146 +#: ../../library/cmd.rst:156 msgid "" "Hook method executed just after a command dispatch is finished. This method " "is a stub in :class:`Cmd`; it exists to be overridden by subclasses. *line* " @@ -196,74 +209,74 @@ msgid "" "corresponds to *stop*; returning false will cause interpretation to continue." msgstr "" -#: ../../library/cmd.rst:157 +#: ../../library/cmd.rst:167 msgid "" "Hook method executed once when :meth:`cmdloop` is called. This method is a " "stub in :class:`Cmd`; it exists to be overridden by subclasses." msgstr "" -#: ../../library/cmd.rst:163 +#: ../../library/cmd.rst:173 msgid "" "Hook method executed once when :meth:`cmdloop` is about to return. This " "method is a stub in :class:`Cmd`; it exists to be overridden by subclasses." msgstr "" -#: ../../library/cmd.rst:167 +#: ../../library/cmd.rst:177 msgid "" "Instances of :class:`Cmd` subclasses have some public instance variables:" msgstr "" -#: ../../library/cmd.rst:171 +#: ../../library/cmd.rst:181 msgid "The prompt issued to solicit input." msgstr "" -#: ../../library/cmd.rst:176 +#: ../../library/cmd.rst:186 msgid "The string of characters accepted for the command prefix." msgstr "" -#: ../../library/cmd.rst:181 +#: ../../library/cmd.rst:191 msgid "The last nonempty command prefix seen." msgstr "" -#: ../../library/cmd.rst:186 +#: ../../library/cmd.rst:196 msgid "" "A list of queued input lines. The cmdqueue list is checked in :meth:" "`cmdloop` when new input is needed; if it is nonempty, its elements will be " "processed in order, as if entered at the prompt." msgstr "" -#: ../../library/cmd.rst:193 +#: ../../library/cmd.rst:203 msgid "" "A string to issue as an intro or banner. May be overridden by giving the :" "meth:`cmdloop` method an argument." msgstr "" -#: ../../library/cmd.rst:199 +#: ../../library/cmd.rst:209 msgid "" "The header to issue if the help output has a section for documented commands." msgstr "" -#: ../../library/cmd.rst:204 +#: ../../library/cmd.rst:214 msgid "" "The header to issue if the help output has a section for miscellaneous help " "topics (that is, there are :meth:`!help_\\*` methods without corresponding :" "meth:`!do_\\*` methods)." msgstr "" -#: ../../library/cmd.rst:211 +#: ../../library/cmd.rst:221 msgid "" "The header to issue if the help output has a section for undocumented " "commands (that is, there are :meth:`!do_\\*` methods without corresponding :" "meth:`!help_\\*` methods)." msgstr "" -#: ../../library/cmd.rst:218 +#: ../../library/cmd.rst:228 msgid "" "The character used to draw separator lines under the help-message headers. " "If empty, no ruler line is drawn. It defaults to ``'='``." msgstr "" -#: ../../library/cmd.rst:224 +#: ../../library/cmd.rst:234 msgid "" "A flag, defaulting to true. If true, :meth:`cmdloop` uses :func:`input` to " "display a prompt and read the next command; if false, :data:`sys.stdout." @@ -273,23 +286,23 @@ msgid "" "editing and command-history keystrokes.)" msgstr "" -#: ../../library/cmd.rst:234 +#: ../../library/cmd.rst:244 msgid "Cmd Example" msgstr "" -#: ../../library/cmd.rst:238 +#: ../../library/cmd.rst:248 msgid "" "The :mod:`cmd` module is mainly useful for building custom shells that let a " "user work with a program interactively." msgstr "" -#: ../../library/cmd.rst:241 +#: ../../library/cmd.rst:251 msgid "" "This section presents a simple example of how to build a shell around a few " "of the commands in the :mod:`turtle` module." msgstr "" -#: ../../library/cmd.rst:244 +#: ../../library/cmd.rst:254 msgid "" "Basic turtle commands such as :meth:`~turtle.forward` are added to a :class:" "`Cmd` subclass with method named :meth:`!do_forward`. The argument is " @@ -297,7 +310,7 @@ msgid "" "used in the help utility provided by the shell." msgstr "" -#: ../../library/cmd.rst:249 +#: ../../library/cmd.rst:259 msgid "" "The example also includes a basic record and playback facility implemented " "with the :meth:`~Cmd.precmd` method which is responsible for converting the " @@ -306,7 +319,7 @@ msgid "" "attr:`~Cmd.cmdqueue` for immediate playback::" msgstr "" -#: ../../library/cmd.rst:255 +#: ../../library/cmd.rst:265 msgid "" "import cmd, sys\n" "from turtle import *\n" @@ -386,14 +399,14 @@ msgid "" " TurtleShell().cmdloop()" msgstr "" -#: ../../library/cmd.rst:330 +#: ../../library/cmd.rst:340 msgid "" "Here is a sample session with the turtle shell showing the help functions, " "using blank lines to repeat commands, and the simple record and playback " "facility:" msgstr "" -#: ../../library/cmd.rst:333 +#: ../../library/cmd.rst:343 msgid "" "Welcome to the turtle shell. Type help or ? to list commands.\n" "\n" @@ -511,14 +524,14 @@ msgstr "" "(turtle) bye\n" "Thank you for using Turtle" -#: ../../library/cmd.rst:64 +#: ../../library/cmd.rst:74 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/cmd.rst:64 +#: ../../library/cmd.rst:74 msgid "in a command interpreter" msgstr "於 command interpreter(指令直譯器)中" -#: ../../library/cmd.rst:64 +#: ../../library/cmd.rst:74 msgid "! (exclamation)" msgstr "! (驚嘆號)" diff --git a/library/cmdline.po b/library/cmdline.po index 5f894724f8..51d4a6fe87 100644 --- a/library/cmdline.po +++ b/library/cmdline.po @@ -5,9 +5,9 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-10-12 00:03+0000\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2023-10-14 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -154,73 +154,81 @@ msgid ":mod:`quopri`" msgstr ":mod:`quopri`" #: ../../library/cmdline.rst:39 +msgid ":ref:`random `" +msgstr ":ref:`random `" + +#: ../../library/cmdline.rst:40 msgid ":mod:`runpy`" msgstr ":mod:`runpy`" -#: ../../library/cmdline.rst:40 +#: ../../library/cmdline.rst:41 msgid ":ref:`site `" msgstr ":ref:`site `" -#: ../../library/cmdline.rst:41 +#: ../../library/cmdline.rst:42 msgid ":ref:`sqlite3 `" msgstr ":ref:`sqlite3 `" -#: ../../library/cmdline.rst:42 +#: ../../library/cmdline.rst:43 +msgid ":ref:`symtable `" +msgstr ":ref:`symtable `" + +#: ../../library/cmdline.rst:44 msgid ":ref:`sysconfig `" msgstr ":ref:`sysconfig `" -#: ../../library/cmdline.rst:43 +#: ../../library/cmdline.rst:45 msgid ":mod:`tabnanny`" msgstr ":mod:`tabnanny`" -#: ../../library/cmdline.rst:44 +#: ../../library/cmdline.rst:46 msgid ":ref:`tarfile `" msgstr ":ref:`tarfile `" -#: ../../library/cmdline.rst:45 +#: ../../library/cmdline.rst:47 msgid ":mod:`!this`" msgstr ":mod:`!this`" -#: ../../library/cmdline.rst:46 +#: ../../library/cmdline.rst:48 msgid ":ref:`timeit `" msgstr ":ref:`timeit `" -#: ../../library/cmdline.rst:47 +#: ../../library/cmdline.rst:49 msgid ":ref:`tokenize `" msgstr ":ref:`tokenize `" -#: ../../library/cmdline.rst:48 +#: ../../library/cmdline.rst:50 msgid ":ref:`trace `" msgstr ":ref:`trace `" -#: ../../library/cmdline.rst:49 +#: ../../library/cmdline.rst:51 msgid ":mod:`turtledemo`" msgstr ":mod:`turtledemo`" -#: ../../library/cmdline.rst:50 +#: ../../library/cmdline.rst:52 msgid ":ref:`unittest `" msgstr ":ref:`unittest `" -#: ../../library/cmdline.rst:51 +#: ../../library/cmdline.rst:53 msgid ":ref:`uuid `" msgstr ":ref:`uuid `" -#: ../../library/cmdline.rst:52 +#: ../../library/cmdline.rst:54 msgid ":mod:`venv`" msgstr ":mod:`venv`" -#: ../../library/cmdline.rst:53 +#: ../../library/cmdline.rst:55 msgid ":mod:`webbrowser`" msgstr ":mod:`webbrowser`" -#: ../../library/cmdline.rst:54 +#: ../../library/cmdline.rst:56 msgid ":ref:`zipapp `" msgstr ":ref:`zipapp `" -#: ../../library/cmdline.rst:55 +#: ../../library/cmdline.rst:57 msgid ":ref:`zipfile `" msgstr ":ref:`zipfile `" -#: ../../library/cmdline.rst:57 +#: ../../library/cmdline.rst:59 msgid "See also the :ref:`Python command-line interface `." msgstr "另請見 :ref:`Python 命令列介面 `。" diff --git a/library/code.po b/library/code.po index 2e2f496e04..b424c1a11c 100644 --- a/library/code.po +++ b/library/code.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,35 +38,43 @@ msgid "" "This class deals with parsing and interpreter state (the user's namespace); " "it does not deal with input buffering or prompting or input file naming (the " "filename is always passed in explicitly). The optional *locals* argument " -"specifies the dictionary in which code will be executed; it defaults to a " -"newly created dictionary with key ``'__name__'`` set to ``'__console__'`` " -"and key ``'__doc__'`` set to ``None``." +"specifies a mapping to use as the namespace in which code will be executed; " +"it defaults to a newly created dictionary with key ``'__name__'`` set to " +"``'__console__'`` and key ``'__doc__'`` set to ``None``." msgstr "" #: ../../library/code.rst:28 msgid "" "Closely emulate the behavior of the interactive Python interpreter. This " "class builds on :class:`InteractiveInterpreter` and adds prompting using the " -"familiar ``sys.ps1`` and ``sys.ps2``, and input buffering." +"familiar ``sys.ps1`` and ``sys.ps2``, and input buffering. If *local_exit* " +"is true, ``exit()`` and ``quit()`` in the console will not raise :exc:" +"`SystemExit`, but instead return to the calling code." msgstr "" -#: ../../library/code.rst:35 +#: ../../library/code.rst:34 ../../library/code.rst:52 +#, fuzzy +msgid "Added *local_exit* parameter." +msgstr "新增 *exitmsg* 參數。" + +#: ../../library/code.rst:39 msgid "" "Convenience function to run a read-eval-print loop. This creates a new " "instance of :class:`InteractiveConsole` and sets *readfunc* to be used as " "the :meth:`InteractiveConsole.raw_input` method, if provided. If *local* is " "provided, it is passed to the :class:`InteractiveConsole` constructor for " -"use as the default namespace for the interpreter loop. The :meth:" -"`~InteractiveConsole.interact` method of the instance is then run with " +"use as the default namespace for the interpreter loop. If *local_exit* is " +"provided, it is passed to the :class:`InteractiveConsole` constructor. The :" +"meth:`~InteractiveConsole.interact` method of the instance is then run with " "*banner* and *exitmsg* passed as the banner and exit message to use, if " "provided. The console object is discarded after use." msgstr "" -#: ../../library/code.rst:44 +#: ../../library/code.rst:49 msgid "Added *exitmsg* parameter." msgstr "新增 *exitmsg* 參數。" -#: ../../library/code.rst:50 +#: ../../library/code.rst:57 msgid "" "This function is useful for programs that want to emulate Python's " "interpreter main loop (a.k.a. the read-eval-print loop). The tricky part is " @@ -76,7 +84,7 @@ msgid "" "real interpreter main loop." msgstr "" -#: ../../library/code.rst:57 +#: ../../library/code.rst:64 msgid "" "*source* is the source string; *filename* is the optional filename from " "which source was read, defaulting to ``''``; and *symbol* is the " @@ -84,7 +92,7 @@ msgid "" "``'eval'`` or ``'exec'``." msgstr "" -#: ../../library/code.rst:62 +#: ../../library/code.rst:69 msgid "" "Returns a code object (the same as ``compile(source, filename, symbol)``) if " "the command is complete and valid; ``None`` if the command is incomplete; " @@ -93,18 +101,18 @@ msgid "" "contains an invalid literal." msgstr "" -#: ../../library/code.rst:72 +#: ../../library/code.rst:79 msgid "Interactive Interpreter Objects" msgstr "" -#: ../../library/code.rst:77 +#: ../../library/code.rst:84 msgid "" "Compile and run some source in the interpreter. Arguments are the same as " "for :func:`compile_command`; the default for *filename* is ``''``, " "and for *symbol* is ``'single'``. One of several things can happen:" msgstr "" -#: ../../library/code.rst:81 +#: ../../library/code.rst:88 msgid "" "The input is incorrect; :func:`compile_command` raised an exception (:exc:" "`SyntaxError` or :exc:`OverflowError`). A syntax traceback will be printed " @@ -112,13 +120,13 @@ msgid "" "``False``." msgstr "" -#: ../../library/code.rst:86 +#: ../../library/code.rst:93 msgid "" "The input is incomplete, and more input is required; :func:`compile_command` " "returned ``None``. :meth:`runsource` returns ``True``." msgstr "" -#: ../../library/code.rst:89 +#: ../../library/code.rst:96 msgid "" "The input is complete; :func:`compile_command` returned a code object. The " "code is executed by calling the :meth:`runcode` (which also handles run-time " @@ -126,27 +134,27 @@ msgid "" "``False``." msgstr "" -#: ../../library/code.rst:93 +#: ../../library/code.rst:100 msgid "" "The return value can be used to decide whether to use ``sys.ps1`` or ``sys." "ps2`` to prompt the next line." msgstr "" -#: ../../library/code.rst:99 +#: ../../library/code.rst:106 msgid "" "Execute a code object. When an exception occurs, :meth:`showtraceback` is " "called to display a traceback. All exceptions are caught except :exc:" "`SystemExit`, which is allowed to propagate." msgstr "" -#: ../../library/code.rst:103 +#: ../../library/code.rst:110 msgid "" "A note about :exc:`KeyboardInterrupt`: this exception may occur elsewhere in " "this code, and may not always be caught. The caller should be prepared to " "deal with it." msgstr "" -#: ../../library/code.rst:110 +#: ../../library/code.rst:117 msgid "" "Display the syntax error that just occurred. This does not display a stack " "trace because there isn't one for syntax errors. If *filename* is given, it " @@ -155,38 +163,38 @@ msgid "" "string. The output is written by the :meth:`write` method." msgstr "" -#: ../../library/code.rst:119 +#: ../../library/code.rst:126 msgid "" "Display the exception that just occurred. We remove the first stack item " "because it is within the interpreter object implementation. The output is " "written by the :meth:`write` method." msgstr "" -#: ../../library/code.rst:123 +#: ../../library/code.rst:130 msgid "" "The full chained traceback is displayed instead of just the primary " "traceback." msgstr "" -#: ../../library/code.rst:129 +#: ../../library/code.rst:136 msgid "" "Write a string to the standard error stream (``sys.stderr``). Derived " "classes should override this to provide the appropriate output handling as " "needed." msgstr "" -#: ../../library/code.rst:136 +#: ../../library/code.rst:143 msgid "Interactive Console Objects" msgstr "" -#: ../../library/code.rst:138 +#: ../../library/code.rst:145 msgid "" "The :class:`InteractiveConsole` class is a subclass of :class:" "`InteractiveInterpreter`, and so offers all the methods of the interpreter " "objects as well as the following additions." msgstr "" -#: ../../library/code.rst:145 +#: ../../library/code.rst:152 msgid "" "Closely emulate the interactive Python console. The optional *banner* " "argument specify the banner to print before the first interaction; by " @@ -196,22 +204,22 @@ msgid "" "close!)." msgstr "" -#: ../../library/code.rst:151 +#: ../../library/code.rst:158 msgid "" "The optional *exitmsg* argument specifies an exit message printed when " "exiting. Pass the empty string to suppress the exit message. If *exitmsg* is " "not given or ``None``, a default message is printed." msgstr "" -#: ../../library/code.rst:155 +#: ../../library/code.rst:162 msgid "To suppress printing any banner, pass an empty string." msgstr "" -#: ../../library/code.rst:158 +#: ../../library/code.rst:165 msgid "Print an exit message when exiting." msgstr "" -#: ../../library/code.rst:164 +#: ../../library/code.rst:171 msgid "" "Push a line of source text to the interpreter. The line should not have a " "trailing newline; it may have internal newlines. The line is appended to a " @@ -224,11 +232,11 @@ msgid "" "same as :meth:`!runsource`)." msgstr "" -#: ../../library/code.rst:176 +#: ../../library/code.rst:183 msgid "Remove any unhandled source text from the input buffer." msgstr "" -#: ../../library/code.rst:181 +#: ../../library/code.rst:188 msgid "" "Write a prompt and read a line. The returned line does not include the " "trailing newline. When the user enters the EOF key sequence, :exc:" diff --git a/library/codecs.po b/library/codecs.po index fe49b0fa68..aa60cd8b84 100644 --- a/library/codecs.po +++ b/library/codecs.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:40+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -369,8 +369,8 @@ msgid "Value" msgstr "" #: ../../library/codecs.rst:330 ../../library/codecs.rst:373 -#: ../../library/codecs.rst:393 ../../library/codecs.rst:1330 -#: ../../library/codecs.rst:1398 ../../library/codecs.rst:1455 +#: ../../library/codecs.rst:393 ../../library/codecs.rst:1331 +#: ../../library/codecs.rst:1399 ../../library/codecs.rst:1454 msgid "Meaning" msgstr "含義" @@ -1369,13 +1369,13 @@ msgstr "" msgid "an IBM PC code page, which is ASCII compatible" msgstr "" -#: ../../library/codecs.rst:1075 ../../library/codecs.rst:1330 -#: ../../library/codecs.rst:1398 ../../library/codecs.rst:1455 +#: ../../library/codecs.rst:1075 ../../library/codecs.rst:1331 +#: ../../library/codecs.rst:1399 ../../library/codecs.rst:1454 msgid "Codec" msgstr "" -#: ../../library/codecs.rst:1075 ../../library/codecs.rst:1330 -#: ../../library/codecs.rst:1398 ../../library/codecs.rst:1455 +#: ../../library/codecs.rst:1075 ../../library/codecs.rst:1331 +#: ../../library/codecs.rst:1399 ../../library/codecs.rst:1454 msgid "Aliases" msgstr "" @@ -1405,7 +1405,7 @@ msgid "big5-tw, csbig5" msgstr "big5-tw, csbig5" #: ../../library/codecs.rst:1079 ../../library/codecs.rst:1081 -#: ../../library/codecs.rst:1139 +#: ../../library/codecs.rst:1140 msgid "Traditional Chinese" msgstr "繁體中文" @@ -1446,8 +1446,8 @@ msgid "EBCDIC-CP-HE, IBM424" msgstr "EBCDIC-CP-HE, IBM424" #: ../../library/codecs.rst:1089 ../../library/codecs.rst:1109 -#: ../../library/codecs.rst:1119 ../../library/codecs.rst:1162 -#: ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1119 ../../library/codecs.rst:1163 +#: ../../library/codecs.rst:1226 msgid "Hebrew" msgstr "希伯來文" @@ -1468,9 +1468,9 @@ msgid "EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500" msgstr "EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500" #: ../../library/codecs.rst:1093 ../../library/codecs.rst:1102 -#: ../../library/codecs.rst:1113 ../../library/codecs.rst:1149 -#: ../../library/codecs.rst:1156 ../../library/codecs.rst:1209 -#: ../../library/codecs.rst:1237 ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1113 ../../library/codecs.rst:1150 +#: ../../library/codecs.rst:1157 ../../library/codecs.rst:1210 +#: ../../library/codecs.rst:1238 ../../library/codecs.rst:1266 msgid "Western Europe" msgstr "" @@ -1479,7 +1479,7 @@ msgid "cp720" msgstr "cp720" #: ../../library/codecs.rst:1096 ../../library/codecs.rst:1123 -#: ../../library/codecs.rst:1164 ../../library/codecs.rst:1221 +#: ../../library/codecs.rst:1165 ../../library/codecs.rst:1222 msgid "Arabic" msgstr "阿拉伯文" @@ -1488,8 +1488,8 @@ msgid "cp737" msgstr "cp737" #: ../../library/codecs.rst:1098 ../../library/codecs.rst:1129 -#: ../../library/codecs.rst:1133 ../../library/codecs.rst:1158 -#: ../../library/codecs.rst:1223 ../../library/codecs.rst:1258 +#: ../../library/codecs.rst:1133 ../../library/codecs.rst:1159 +#: ../../library/codecs.rst:1224 ../../library/codecs.rst:1259 msgid "Greek" msgstr "希臘文" @@ -1501,8 +1501,8 @@ msgstr "cp775" msgid "IBM775" msgstr "IBM775" -#: ../../library/codecs.rst:1100 ../../library/codecs.rst:1166 -#: ../../library/codecs.rst:1216 ../../library/codecs.rst:1233 +#: ../../library/codecs.rst:1100 ../../library/codecs.rst:1167 +#: ../../library/codecs.rst:1217 ../../library/codecs.rst:1234 msgid "Baltic languages" msgstr "" @@ -1522,8 +1522,8 @@ msgstr "cp852" msgid "852, IBM852" msgstr "852, IBM852" -#: ../../library/codecs.rst:1104 ../../library/codecs.rst:1151 -#: ../../library/codecs.rst:1212 ../../library/codecs.rst:1262 +#: ../../library/codecs.rst:1104 ../../library/codecs.rst:1152 +#: ../../library/codecs.rst:1213 ../../library/codecs.rst:1263 msgid "Central and Eastern Europe" msgstr "" @@ -1535,8 +1535,8 @@ msgstr "cp855" msgid "855, IBM855" msgstr "855, IBM855" -#: ../../library/codecs.rst:1106 ../../library/codecs.rst:1153 -#: ../../library/codecs.rst:1218 ../../library/codecs.rst:1255 +#: ../../library/codecs.rst:1106 ../../library/codecs.rst:1154 +#: ../../library/codecs.rst:1219 ../../library/codecs.rst:1256 msgid "Bulgarian, Byelorussian, Macedonian, Russian, Serbian" msgstr "" @@ -1552,9 +1552,9 @@ msgstr "cp857" msgid "857, IBM857" msgstr "857, IBM857" -#: ../../library/codecs.rst:1111 ../../library/codecs.rst:1143 -#: ../../library/codecs.rst:1160 ../../library/codecs.rst:1227 -#: ../../library/codecs.rst:1267 +#: ../../library/codecs.rst:1111 ../../library/codecs.rst:1144 +#: ../../library/codecs.rst:1161 ../../library/codecs.rst:1228 +#: ../../library/codecs.rst:1268 msgid "Turkish" msgstr "土耳其文" @@ -1586,7 +1586,7 @@ msgstr "cp861" msgid "861, CP-IS, IBM861" msgstr "861, CP-IS, IBM861" -#: ../../library/codecs.rst:1117 ../../library/codecs.rst:1260 +#: ../../library/codecs.rst:1117 ../../library/codecs.rst:1261 msgid "Icelandic" msgstr "" @@ -1638,7 +1638,7 @@ msgstr "cp866" msgid "866, IBM866" msgstr "866, IBM866" -#: ../../library/codecs.rst:1127 ../../library/codecs.rst:1243 +#: ../../library/codecs.rst:1127 ../../library/codecs.rst:1244 msgid "Russian" msgstr "俄羅斯文" @@ -1667,188 +1667,189 @@ msgid "cp932" msgstr "cp932" #: ../../library/codecs.rst:1135 -msgid "932, ms932, mskanji, ms-kanji" +#, fuzzy +msgid "932, ms932, mskanji, ms-kanji, windows-31j" msgstr "932, ms932, mskanji, ms-kanji" -#: ../../library/codecs.rst:1135 ../../library/codecs.rst:1170 -#: ../../library/codecs.rst:1172 ../../library/codecs.rst:1174 -#: ../../library/codecs.rst:1191 ../../library/codecs.rst:1194 -#: ../../library/codecs.rst:1199 ../../library/codecs.rst:1202 -#: ../../library/codecs.rst:1204 ../../library/codecs.rst:1272 -#: ../../library/codecs.rst:1275 ../../library/codecs.rst:1278 +#: ../../library/codecs.rst:1135 ../../library/codecs.rst:1171 +#: ../../library/codecs.rst:1173 ../../library/codecs.rst:1175 +#: ../../library/codecs.rst:1192 ../../library/codecs.rst:1195 +#: ../../library/codecs.rst:1200 ../../library/codecs.rst:1203 +#: ../../library/codecs.rst:1205 ../../library/codecs.rst:1273 +#: ../../library/codecs.rst:1276 ../../library/codecs.rst:1279 msgid "Japanese" msgstr "日文" -#: ../../library/codecs.rst:1137 +#: ../../library/codecs.rst:1138 msgid "cp949" msgstr "cp949" -#: ../../library/codecs.rst:1137 +#: ../../library/codecs.rst:1138 msgid "949, ms949, uhc" msgstr "949, ms949, uhc" -#: ../../library/codecs.rst:1137 ../../library/codecs.rst:1176 -#: ../../library/codecs.rst:1206 ../../library/codecs.rst:1241 +#: ../../library/codecs.rst:1138 ../../library/codecs.rst:1177 +#: ../../library/codecs.rst:1207 ../../library/codecs.rst:1242 msgid "Korean" msgstr "韓文" -#: ../../library/codecs.rst:1139 +#: ../../library/codecs.rst:1140 msgid "cp950" msgstr "cp950" -#: ../../library/codecs.rst:1139 +#: ../../library/codecs.rst:1140 msgid "950, ms950" msgstr "950, ms950" -#: ../../library/codecs.rst:1141 +#: ../../library/codecs.rst:1142 msgid "cp1006" msgstr "cp1006" -#: ../../library/codecs.rst:1141 +#: ../../library/codecs.rst:1142 msgid "Urdu" msgstr "" -#: ../../library/codecs.rst:1143 +#: ../../library/codecs.rst:1144 msgid "cp1026" msgstr "cp1026" -#: ../../library/codecs.rst:1143 +#: ../../library/codecs.rst:1144 msgid "ibm1026" msgstr "ibm1026" -#: ../../library/codecs.rst:1145 +#: ../../library/codecs.rst:1146 msgid "cp1125" msgstr "cp1125" -#: ../../library/codecs.rst:1145 +#: ../../library/codecs.rst:1146 msgid "1125, ibm1125, cp866u, ruscii" msgstr "1125, ibm1125, cp866u, ruscii" -#: ../../library/codecs.rst:1145 ../../library/codecs.rst:1249 +#: ../../library/codecs.rst:1146 ../../library/codecs.rst:1250 msgid "Ukrainian" msgstr "烏克蘭文" -#: ../../library/codecs.rst:1149 +#: ../../library/codecs.rst:1150 msgid "cp1140" msgstr "cp1140" -#: ../../library/codecs.rst:1149 +#: ../../library/codecs.rst:1150 msgid "ibm1140" msgstr "ibm1140" -#: ../../library/codecs.rst:1151 +#: ../../library/codecs.rst:1152 msgid "cp1250" msgstr "cp1250" -#: ../../library/codecs.rst:1151 +#: ../../library/codecs.rst:1152 msgid "windows-1250" msgstr "windows-1250" -#: ../../library/codecs.rst:1153 +#: ../../library/codecs.rst:1154 msgid "cp1251" msgstr "cp1251" -#: ../../library/codecs.rst:1153 +#: ../../library/codecs.rst:1154 msgid "windows-1251" msgstr "windows-1251" -#: ../../library/codecs.rst:1156 +#: ../../library/codecs.rst:1157 msgid "cp1252" msgstr "cp1252" -#: ../../library/codecs.rst:1156 +#: ../../library/codecs.rst:1157 msgid "windows-1252" msgstr "windows-1252" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1159 msgid "cp1253" msgstr "cp1253" -#: ../../library/codecs.rst:1158 +#: ../../library/codecs.rst:1159 msgid "windows-1253" msgstr "windows-1253" -#: ../../library/codecs.rst:1160 +#: ../../library/codecs.rst:1161 msgid "cp1254" msgstr "cp1254" -#: ../../library/codecs.rst:1160 +#: ../../library/codecs.rst:1161 msgid "windows-1254" msgstr "windows-1254" -#: ../../library/codecs.rst:1162 +#: ../../library/codecs.rst:1163 msgid "cp1255" msgstr "cp1255" -#: ../../library/codecs.rst:1162 +#: ../../library/codecs.rst:1163 msgid "windows-1255" msgstr "windows-1255" -#: ../../library/codecs.rst:1164 +#: ../../library/codecs.rst:1165 msgid "cp1256" msgstr "cp1256" -#: ../../library/codecs.rst:1164 +#: ../../library/codecs.rst:1165 msgid "windows-1256" msgstr "windows-1256" -#: ../../library/codecs.rst:1166 +#: ../../library/codecs.rst:1167 msgid "cp1257" msgstr "cp1257" -#: ../../library/codecs.rst:1166 +#: ../../library/codecs.rst:1167 msgid "windows-1257" msgstr "windows-1257" -#: ../../library/codecs.rst:1168 +#: ../../library/codecs.rst:1169 msgid "cp1258" msgstr "cp1258" -#: ../../library/codecs.rst:1168 +#: ../../library/codecs.rst:1169 msgid "windows-1258" msgstr "windows-1258" -#: ../../library/codecs.rst:1168 +#: ../../library/codecs.rst:1169 msgid "Vietnamese" msgstr "越南文" -#: ../../library/codecs.rst:1170 +#: ../../library/codecs.rst:1171 msgid "euc_jp" msgstr "euc_jp" -#: ../../library/codecs.rst:1170 +#: ../../library/codecs.rst:1171 msgid "eucjp, ujis, u-jis" msgstr "eucjp, ujis, u-jis" -#: ../../library/codecs.rst:1172 +#: ../../library/codecs.rst:1173 msgid "euc_jis_2004" msgstr "euc_jis_2004" -#: ../../library/codecs.rst:1172 +#: ../../library/codecs.rst:1173 msgid "jisx0213, eucjis2004" msgstr "jisx0213, eucjis2004" -#: ../../library/codecs.rst:1174 +#: ../../library/codecs.rst:1175 msgid "euc_jisx0213" msgstr "euc_jisx0213" -#: ../../library/codecs.rst:1174 +#: ../../library/codecs.rst:1175 msgid "eucjisx0213" msgstr "eucjisx0213" -#: ../../library/codecs.rst:1176 +#: ../../library/codecs.rst:1177 msgid "euc_kr" msgstr "euc_kr" -#: ../../library/codecs.rst:1176 +#: ../../library/codecs.rst:1177 msgid "euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001" msgstr "euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001" -#: ../../library/codecs.rst:1180 +#: ../../library/codecs.rst:1181 msgid "gb2312" msgstr "gb2312" -#: ../../library/codecs.rst:1180 +#: ../../library/codecs.rst:1181 msgid "" "chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, " "gb2312-80, iso-ir-58" @@ -1856,446 +1857,446 @@ msgstr "" "chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, " "gb2312-80, iso-ir-58" -#: ../../library/codecs.rst:1180 ../../library/codecs.rst:1189 +#: ../../library/codecs.rst:1181 ../../library/codecs.rst:1190 msgid "Simplified Chinese" msgstr "簡體中文" -#: ../../library/codecs.rst:1185 +#: ../../library/codecs.rst:1186 msgid "gbk" msgstr "gbk" -#: ../../library/codecs.rst:1185 +#: ../../library/codecs.rst:1186 msgid "936, cp936, ms936" msgstr "936, cp936, ms936" -#: ../../library/codecs.rst:1185 ../../library/codecs.rst:1187 +#: ../../library/codecs.rst:1186 ../../library/codecs.rst:1188 msgid "Unified Chinese" msgstr "" -#: ../../library/codecs.rst:1187 +#: ../../library/codecs.rst:1188 msgid "gb18030" msgstr "gb18030" -#: ../../library/codecs.rst:1187 +#: ../../library/codecs.rst:1188 msgid "gb18030-2000" msgstr "gb18030-2000" -#: ../../library/codecs.rst:1189 +#: ../../library/codecs.rst:1190 msgid "hz" msgstr "" -#: ../../library/codecs.rst:1189 +#: ../../library/codecs.rst:1190 msgid "hzgb, hz-gb, hz-gb-2312" msgstr "hzgb, hz-gb, hz-gb-2312" -#: ../../library/codecs.rst:1191 +#: ../../library/codecs.rst:1192 msgid "iso2022_jp" msgstr "iso2022_jp" -#: ../../library/codecs.rst:1191 +#: ../../library/codecs.rst:1192 msgid "csiso2022jp, iso2022jp, iso-2022-jp" msgstr "csiso2022jp, iso2022jp, iso-2022-jp" -#: ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1195 msgid "iso2022_jp_1" msgstr "iso2022_jp_1" -#: ../../library/codecs.rst:1194 +#: ../../library/codecs.rst:1195 msgid "iso2022jp-1, iso-2022-jp-1" msgstr "iso2022jp-1, iso-2022-jp-1" -#: ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1197 msgid "iso2022_jp_2" msgstr "iso2022_jp_2" -#: ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1197 msgid "iso2022jp-2, iso-2022-jp-2" msgstr "iso2022jp-2, iso-2022-jp-2" -#: ../../library/codecs.rst:1196 +#: ../../library/codecs.rst:1197 msgid "Japanese, Korean, Simplified Chinese, Western Europe, Greek" msgstr "" -#: ../../library/codecs.rst:1199 +#: ../../library/codecs.rst:1200 msgid "iso2022_jp_2004" msgstr "iso2022_jp_2004" -#: ../../library/codecs.rst:1199 +#: ../../library/codecs.rst:1200 msgid "iso2022jp-2004, iso-2022-jp-2004" msgstr "iso2022jp-2004, iso-2022-jp-2004" -#: ../../library/codecs.rst:1202 +#: ../../library/codecs.rst:1203 msgid "iso2022_jp_3" msgstr "iso2022_jp_3" -#: ../../library/codecs.rst:1202 +#: ../../library/codecs.rst:1203 msgid "iso2022jp-3, iso-2022-jp-3" msgstr "iso2022jp-3, iso-2022-jp-3" -#: ../../library/codecs.rst:1204 +#: ../../library/codecs.rst:1205 msgid "iso2022_jp_ext" msgstr "iso2022_jp_ext" -#: ../../library/codecs.rst:1204 +#: ../../library/codecs.rst:1205 msgid "iso2022jp-ext, iso-2022-jp-ext" msgstr "iso2022jp-ext, iso-2022-jp-ext" -#: ../../library/codecs.rst:1206 +#: ../../library/codecs.rst:1207 msgid "iso2022_kr" msgstr "iso2022_kr" -#: ../../library/codecs.rst:1206 +#: ../../library/codecs.rst:1207 msgid "csiso2022kr, iso2022kr, iso-2022-kr" msgstr "csiso2022kr, iso2022kr, iso-2022-kr" -#: ../../library/codecs.rst:1209 +#: ../../library/codecs.rst:1210 msgid "latin_1" msgstr "latin_1" -#: ../../library/codecs.rst:1209 +#: ../../library/codecs.rst:1210 msgid "iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1" msgstr "iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1" -#: ../../library/codecs.rst:1212 +#: ../../library/codecs.rst:1213 msgid "iso8859_2" msgstr "iso8859_2" -#: ../../library/codecs.rst:1212 +#: ../../library/codecs.rst:1213 msgid "iso-8859-2, latin2, L2" msgstr "iso-8859-2, latin2, L2" -#: ../../library/codecs.rst:1214 +#: ../../library/codecs.rst:1215 msgid "iso8859_3" msgstr "iso8859_3" -#: ../../library/codecs.rst:1214 +#: ../../library/codecs.rst:1215 msgid "iso-8859-3, latin3, L3" msgstr "iso-8859-3, latin3, L3" -#: ../../library/codecs.rst:1214 +#: ../../library/codecs.rst:1215 msgid "Esperanto, Maltese" msgstr "" -#: ../../library/codecs.rst:1216 +#: ../../library/codecs.rst:1217 msgid "iso8859_4" msgstr "iso8859_4" -#: ../../library/codecs.rst:1216 +#: ../../library/codecs.rst:1217 msgid "iso-8859-4, latin4, L4" msgstr "iso-8859-4, latin4, L4" -#: ../../library/codecs.rst:1218 +#: ../../library/codecs.rst:1219 msgid "iso8859_5" msgstr "iso8859_5" -#: ../../library/codecs.rst:1218 +#: ../../library/codecs.rst:1219 msgid "iso-8859-5, cyrillic" msgstr "iso-8859-5, cyrillic" -#: ../../library/codecs.rst:1221 +#: ../../library/codecs.rst:1222 msgid "iso8859_6" msgstr "iso8859_6" -#: ../../library/codecs.rst:1221 +#: ../../library/codecs.rst:1222 msgid "iso-8859-6, arabic" msgstr "iso-8859-6, arabic" -#: ../../library/codecs.rst:1223 +#: ../../library/codecs.rst:1224 msgid "iso8859_7" msgstr "iso8859_7" -#: ../../library/codecs.rst:1223 +#: ../../library/codecs.rst:1224 msgid "iso-8859-7, greek, greek8" msgstr "iso-8859-7, greek, greek8" -#: ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1226 msgid "iso8859_8" msgstr "iso8859_8" -#: ../../library/codecs.rst:1225 +#: ../../library/codecs.rst:1226 msgid "iso-8859-8, hebrew" msgstr "iso-8859-8, hebrew" -#: ../../library/codecs.rst:1227 +#: ../../library/codecs.rst:1228 msgid "iso8859_9" msgstr "iso8859_9" -#: ../../library/codecs.rst:1227 +#: ../../library/codecs.rst:1228 msgid "iso-8859-9, latin5, L5" msgstr "iso-8859-9, latin5, L5" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1230 msgid "iso8859_10" msgstr "iso8859_10" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1230 msgid "iso-8859-10, latin6, L6" msgstr "iso-8859-10, latin6, L6" -#: ../../library/codecs.rst:1229 +#: ../../library/codecs.rst:1230 msgid "Nordic languages" msgstr "" -#: ../../library/codecs.rst:1231 +#: ../../library/codecs.rst:1232 msgid "iso8859_11" msgstr "iso8859_11" -#: ../../library/codecs.rst:1231 +#: ../../library/codecs.rst:1232 msgid "iso-8859-11, thai" msgstr "iso-8859-11, thai" -#: ../../library/codecs.rst:1231 +#: ../../library/codecs.rst:1232 msgid "Thai languages" msgstr "" -#: ../../library/codecs.rst:1233 +#: ../../library/codecs.rst:1234 msgid "iso8859_13" msgstr "iso8859_13" -#: ../../library/codecs.rst:1233 +#: ../../library/codecs.rst:1234 msgid "iso-8859-13, latin7, L7" msgstr "iso-8859-13, latin7, L7" -#: ../../library/codecs.rst:1235 +#: ../../library/codecs.rst:1236 msgid "iso8859_14" msgstr "iso8859_14" -#: ../../library/codecs.rst:1235 +#: ../../library/codecs.rst:1236 msgid "iso-8859-14, latin8, L8" msgstr "iso-8859-14, latin8, L8" -#: ../../library/codecs.rst:1235 +#: ../../library/codecs.rst:1236 msgid "Celtic languages" msgstr "" -#: ../../library/codecs.rst:1237 +#: ../../library/codecs.rst:1238 msgid "iso8859_15" msgstr "iso8859_15" -#: ../../library/codecs.rst:1237 +#: ../../library/codecs.rst:1238 msgid "iso-8859-15, latin9, L9" msgstr "iso-8859-15, latin9, L9" -#: ../../library/codecs.rst:1239 +#: ../../library/codecs.rst:1240 msgid "iso8859_16" msgstr "iso8859_16" -#: ../../library/codecs.rst:1239 +#: ../../library/codecs.rst:1240 msgid "iso-8859-16, latin10, L10" msgstr "iso-8859-16, latin10, L10" -#: ../../library/codecs.rst:1239 +#: ../../library/codecs.rst:1240 msgid "South-Eastern Europe" msgstr "" -#: ../../library/codecs.rst:1241 +#: ../../library/codecs.rst:1242 msgid "johab" msgstr "" -#: ../../library/codecs.rst:1241 +#: ../../library/codecs.rst:1242 msgid "cp1361, ms1361" msgstr "cp1361, ms1361" -#: ../../library/codecs.rst:1243 +#: ../../library/codecs.rst:1244 msgid "koi8_r" msgstr "koi8_r" -#: ../../library/codecs.rst:1245 +#: ../../library/codecs.rst:1246 msgid "koi8_t" msgstr "koi8_t" -#: ../../library/codecs.rst:1245 +#: ../../library/codecs.rst:1246 msgid "Tajik" msgstr "" -#: ../../library/codecs.rst:1249 +#: ../../library/codecs.rst:1250 msgid "koi8_u" msgstr "koi8_u" -#: ../../library/codecs.rst:1251 +#: ../../library/codecs.rst:1252 msgid "kz1048" msgstr "kz1048" -#: ../../library/codecs.rst:1251 +#: ../../library/codecs.rst:1252 msgid "kz_1048, strk1048_2002, rk1048" msgstr "kz_1048, strk1048_2002, rk1048" -#: ../../library/codecs.rst:1251 ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1252 ../../library/codecs.rst:1270 msgid "Kazakh" msgstr "" -#: ../../library/codecs.rst:1255 +#: ../../library/codecs.rst:1256 msgid "mac_cyrillic" msgstr "mac_cyrillic" -#: ../../library/codecs.rst:1255 +#: ../../library/codecs.rst:1256 msgid "maccyrillic" msgstr "" -#: ../../library/codecs.rst:1258 +#: ../../library/codecs.rst:1259 msgid "mac_greek" msgstr "mac_greek" -#: ../../library/codecs.rst:1258 +#: ../../library/codecs.rst:1259 msgid "macgreek" msgstr "" -#: ../../library/codecs.rst:1260 +#: ../../library/codecs.rst:1261 msgid "mac_iceland" msgstr "mac_iceland" -#: ../../library/codecs.rst:1260 +#: ../../library/codecs.rst:1261 msgid "maciceland" msgstr "" -#: ../../library/codecs.rst:1262 +#: ../../library/codecs.rst:1263 msgid "mac_latin2" msgstr "mac_latin2" -#: ../../library/codecs.rst:1262 +#: ../../library/codecs.rst:1263 msgid "maclatin2, maccentraleurope, mac_centeuro" msgstr "maclatin2, maccentraleurope, mac_centeuro" -#: ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1266 msgid "mac_roman" msgstr "mac_roman" -#: ../../library/codecs.rst:1265 +#: ../../library/codecs.rst:1266 msgid "macroman, macintosh" msgstr "macroman, macintosh" -#: ../../library/codecs.rst:1267 +#: ../../library/codecs.rst:1268 msgid "mac_turkish" msgstr "mac_turkish" -#: ../../library/codecs.rst:1267 +#: ../../library/codecs.rst:1268 msgid "macturkish" msgstr "" -#: ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1270 msgid "ptcp154" msgstr "ptcp154" -#: ../../library/codecs.rst:1269 +#: ../../library/codecs.rst:1270 msgid "csptcp154, pt154, cp154, cyrillic-asian" msgstr "csptcp154, pt154, cp154, cyrillic-asian" -#: ../../library/codecs.rst:1272 +#: ../../library/codecs.rst:1273 msgid "shift_jis" msgstr "shift_jis" -#: ../../library/codecs.rst:1272 +#: ../../library/codecs.rst:1273 msgid "csshiftjis, shiftjis, sjis, s_jis" msgstr "csshiftjis, shiftjis, sjis, s_jis" -#: ../../library/codecs.rst:1275 +#: ../../library/codecs.rst:1276 msgid "shift_jis_2004" msgstr "shift_jis_2004" -#: ../../library/codecs.rst:1275 +#: ../../library/codecs.rst:1276 msgid "shiftjis2004, sjis_2004, sjis2004" msgstr "shiftjis2004, sjis_2004, sjis2004" -#: ../../library/codecs.rst:1278 +#: ../../library/codecs.rst:1279 msgid "shift_jisx0213" msgstr "shift_jisx0213" -#: ../../library/codecs.rst:1278 +#: ../../library/codecs.rst:1279 msgid "shiftjisx0213, sjisx0213, s_jisx0213" msgstr "shiftjisx0213, sjisx0213, s_jisx0213" -#: ../../library/codecs.rst:1281 +#: ../../library/codecs.rst:1282 msgid "utf_32" msgstr "utf_32" -#: ../../library/codecs.rst:1281 +#: ../../library/codecs.rst:1282 msgid "U32, utf32" msgstr "U32, utf32" -#: ../../library/codecs.rst:1281 ../../library/codecs.rst:1283 -#: ../../library/codecs.rst:1285 ../../library/codecs.rst:1287 -#: ../../library/codecs.rst:1289 ../../library/codecs.rst:1291 -#: ../../library/codecs.rst:1293 ../../library/codecs.rst:1295 -#: ../../library/codecs.rst:1297 +#: ../../library/codecs.rst:1282 ../../library/codecs.rst:1284 +#: ../../library/codecs.rst:1286 ../../library/codecs.rst:1288 +#: ../../library/codecs.rst:1290 ../../library/codecs.rst:1292 +#: ../../library/codecs.rst:1294 ../../library/codecs.rst:1296 +#: ../../library/codecs.rst:1298 msgid "all languages" msgstr "" -#: ../../library/codecs.rst:1283 +#: ../../library/codecs.rst:1284 msgid "utf_32_be" msgstr "utf_32_be" -#: ../../library/codecs.rst:1283 +#: ../../library/codecs.rst:1284 msgid "UTF-32BE" msgstr "UTF-32BE" -#: ../../library/codecs.rst:1285 +#: ../../library/codecs.rst:1286 msgid "utf_32_le" msgstr "utf_32_le" -#: ../../library/codecs.rst:1285 +#: ../../library/codecs.rst:1286 msgid "UTF-32LE" msgstr "UTF-32LE" -#: ../../library/codecs.rst:1287 +#: ../../library/codecs.rst:1288 msgid "utf_16" msgstr "utf_16" -#: ../../library/codecs.rst:1287 +#: ../../library/codecs.rst:1288 msgid "U16, utf16" msgstr "U16, utf16" -#: ../../library/codecs.rst:1289 +#: ../../library/codecs.rst:1290 msgid "utf_16_be" msgstr "utf_16_be" -#: ../../library/codecs.rst:1289 +#: ../../library/codecs.rst:1290 msgid "UTF-16BE" msgstr "UTF-16BE" -#: ../../library/codecs.rst:1291 +#: ../../library/codecs.rst:1292 msgid "utf_16_le" msgstr "utf_16_le" -#: ../../library/codecs.rst:1291 +#: ../../library/codecs.rst:1292 msgid "UTF-16LE" msgstr "UTF-16LE" -#: ../../library/codecs.rst:1293 +#: ../../library/codecs.rst:1294 msgid "utf_7" msgstr "utf_7" -#: ../../library/codecs.rst:1293 +#: ../../library/codecs.rst:1294 msgid "U7, unicode-1-1-utf-7" msgstr "U7, unicode-1-1-utf-7" -#: ../../library/codecs.rst:1295 +#: ../../library/codecs.rst:1296 msgid "utf_8" msgstr "utf_8" -#: ../../library/codecs.rst:1295 +#: ../../library/codecs.rst:1296 msgid "U8, UTF, utf8, cp65001" msgstr "U8, UTF, utf8, cp65001" -#: ../../library/codecs.rst:1297 +#: ../../library/codecs.rst:1298 msgid "utf_8_sig" msgstr "utf_8_sig" -#: ../../library/codecs.rst:1300 +#: ../../library/codecs.rst:1301 msgid "" "The utf-16\\* and utf-32\\* encoders no longer allow surrogate code points " "(``U+D800``--``U+DFFF``) to be encoded. The utf-32\\* decoders no longer " "decode byte sequences that correspond to surrogate code points." msgstr "" -#: ../../library/codecs.rst:1306 +#: ../../library/codecs.rst:1307 msgid "``cp65001`` is now an alias to ``utf_8``." msgstr "" -#: ../../library/codecs.rst:1311 +#: ../../library/codecs.rst:1312 msgid "Python Specific Encodings" msgstr "" -#: ../../library/codecs.rst:1313 +#: ../../library/codecs.rst:1314 msgid "" "A number of predefined codecs are specific to Python, so their codec names " "have no meaning outside Python. These are listed in the tables below based " @@ -2305,274 +2306,268 @@ msgid "" "asymmetric codecs, the stated meaning describes the encoding direction." msgstr "" -#: ../../library/codecs.rst:1321 +#: ../../library/codecs.rst:1322 msgid "Text Encodings" msgstr "" -#: ../../library/codecs.rst:1323 +#: ../../library/codecs.rst:1324 msgid "" "The following codecs provide :class:`str` to :class:`bytes` encoding and :" "term:`bytes-like object` to :class:`str` decoding, similar to the Unicode " "text encodings." msgstr "" -#: ../../library/codecs.rst:1332 +#: ../../library/codecs.rst:1333 msgid "idna" msgstr "idna" -#: ../../library/codecs.rst:1332 +#: ../../library/codecs.rst:1333 msgid "" "Implement :rfc:`3490`, see also :mod:`encodings.idna`. Only " "``errors='strict'`` is supported." msgstr "" -#: ../../library/codecs.rst:1338 +#: ../../library/codecs.rst:1339 msgid "mbcs" msgstr "mbcs" -#: ../../library/codecs.rst:1338 +#: ../../library/codecs.rst:1339 msgid "ansi, dbcs" msgstr "ansi, dbcs" -#: ../../library/codecs.rst:1338 +#: ../../library/codecs.rst:1339 msgid "" "Windows only: Encode the operand according to the ANSI codepage (CP_ACP)." msgstr "" -#: ../../library/codecs.rst:1342 +#: ../../library/codecs.rst:1343 msgid "oem" msgstr "oem" -#: ../../library/codecs.rst:1342 +#: ../../library/codecs.rst:1343 msgid "" "Windows only: Encode the operand according to the OEM codepage (CP_OEMCP)." msgstr "" -#: ../../library/codecs.rst:1348 +#: ../../library/codecs.rst:1349 msgid "palmos" msgstr "" -#: ../../library/codecs.rst:1348 +#: ../../library/codecs.rst:1349 msgid "Encoding of PalmOS 3.5." msgstr "" -#: ../../library/codecs.rst:1350 +#: ../../library/codecs.rst:1351 msgid "punycode" msgstr "" -#: ../../library/codecs.rst:1350 +#: ../../library/codecs.rst:1351 msgid "Implement :rfc:`3492`. Stateful codecs are not supported." msgstr "" -#: ../../library/codecs.rst:1354 +#: ../../library/codecs.rst:1355 msgid "raw_unicode_escape" msgstr "raw_unicode_escape" -#: ../../library/codecs.rst:1354 +#: ../../library/codecs.rst:1355 msgid "" "Latin-1 encoding with :samp:`\\\\u{XXXX}` and :samp:`\\\\U{XXXXXXXX}` for " "other code points. Existing backslashes are not escaped in any way. It is " "used in the Python pickle protocol." msgstr "" -#: ../../library/codecs.rst:1364 +#: ../../library/codecs.rst:1365 msgid "undefined" msgstr "" -#: ../../library/codecs.rst:1364 +#: ../../library/codecs.rst:1365 msgid "" "Raise an exception for all conversions, even empty strings. The error " "handler is ignored." msgstr "" -#: ../../library/codecs.rst:1369 +#: ../../library/codecs.rst:1370 msgid "unicode_escape" msgstr "unicode_escape" -#: ../../library/codecs.rst:1369 +#: ../../library/codecs.rst:1370 msgid "" "Encoding suitable as the contents of a Unicode literal in ASCII-encoded " "Python source code, except that quotes are not escaped. Decode from Latin-1 " "source code. Beware that Python source code actually uses UTF-8 by default." msgstr "" -#: ../../library/codecs.rst:1381 +#: ../../library/codecs.rst:1382 msgid "\"unicode_internal\" codec is removed." msgstr "" -#: ../../library/codecs.rst:1388 +#: ../../library/codecs.rst:1389 msgid "Binary Transforms" msgstr "" -#: ../../library/codecs.rst:1390 +#: ../../library/codecs.rst:1391 msgid "" "The following codecs provide binary transforms: :term:`bytes-like object` " "to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode` " "(which only produces :class:`str` output)." msgstr "" -#: ../../library/codecs.rst:1398 +#: ../../library/codecs.rst:1399 msgid "Encoder / decoder" msgstr "" -#: ../../library/codecs.rst:1400 +#: ../../library/codecs.rst:1401 msgid "base64_codec [#b64]_" msgstr "base64_codec [#b64]_" -#: ../../library/codecs.rst:1400 +#: ../../library/codecs.rst:1401 msgid "base64, base_64" msgstr "base64, base_64" -#: ../../library/codecs.rst:1400 +#: ../../library/codecs.rst:1401 msgid "" "Convert the operand to multiline MIME base64 (the result always includes a " "trailing ``'\\n'``)." msgstr "" -#: ../../library/codecs.rst:1405 +#: ../../library/codecs.rst:1406 msgid "" "accepts any :term:`bytes-like object` as input for encoding and decoding" msgstr "" -#: ../../library/codecs.rst:1400 +#: ../../library/codecs.rst:1401 msgid ":meth:`base64.encodebytes` / :meth:`base64.decodebytes`" msgstr ":meth:`base64.encodebytes` / :meth:`base64.decodebytes`" -#: ../../library/codecs.rst:1411 +#: ../../library/codecs.rst:1412 msgid "bz2_codec" msgstr "bz2_codec" -#: ../../library/codecs.rst:1411 +#: ../../library/codecs.rst:1412 msgid "bz2" msgstr "bz2" -#: ../../library/codecs.rst:1411 +#: ../../library/codecs.rst:1412 msgid "Compress the operand using bz2." msgstr "" -#: ../../library/codecs.rst:1411 +#: ../../library/codecs.rst:1412 msgid ":meth:`bz2.compress` / :meth:`bz2.decompress`" msgstr ":meth:`bz2.compress` / :meth:`bz2.decompress`" -#: ../../library/codecs.rst:1414 +#: ../../library/codecs.rst:1415 msgid "hex_codec" msgstr "hex_codec" -#: ../../library/codecs.rst:1414 +#: ../../library/codecs.rst:1415 msgid "hex" msgstr "hex" -#: ../../library/codecs.rst:1414 +#: ../../library/codecs.rst:1415 msgid "" "Convert the operand to hexadecimal representation, with two digits per byte." msgstr "" -#: ../../library/codecs.rst:1414 +#: ../../library/codecs.rst:1415 msgid ":meth:`binascii.b2a_hex` / :meth:`binascii.a2b_hex`" msgstr ":meth:`binascii.b2a_hex` / :meth:`binascii.a2b_hex`" -#: ../../library/codecs.rst:1419 +#: ../../library/codecs.rst:1420 msgid "quopri_codec" msgstr "quopri_codec" -#: ../../library/codecs.rst:1419 +#: ../../library/codecs.rst:1420 msgid "quopri, quotedprintable, quoted_printable" msgstr "quopri, quotedprintable, quoted_printable" -#: ../../library/codecs.rst:1419 +#: ../../library/codecs.rst:1420 msgid "Convert the operand to MIME quoted printable." msgstr "" -#: ../../library/codecs.rst:1419 +#: ../../library/codecs.rst:1420 msgid ":meth:`quopri.encode` with ``quotetabs=True`` / :meth:`quopri.decode`" msgstr ":meth:`quopri.encode` with ``quotetabs=True`` / :meth:`quopri.decode`" -#: ../../library/codecs.rst:1423 +#: ../../library/codecs.rst:1424 msgid "uu_codec" msgstr "uu_codec" -#: ../../library/codecs.rst:1423 +#: ../../library/codecs.rst:1424 msgid "uu" msgstr "uu" -#: ../../library/codecs.rst:1423 +#: ../../library/codecs.rst:1424 msgid "Convert the operand using uuencode." msgstr "" -#: ../../library/codecs.rst:1423 -#, fuzzy -msgid "" -":meth:`!uu.encode` / :meth:`!uu.decode` (Note: :mod:`uu` is deprecated.)" -msgstr ":meth:`uu.encode` / :meth:`uu.decode`" - -#: ../../library/codecs.rst:1428 +#: ../../library/codecs.rst:1427 msgid "zlib_codec" msgstr "zlib_codec" -#: ../../library/codecs.rst:1428 +#: ../../library/codecs.rst:1427 msgid "zip, zlib" msgstr "zip, zlib" -#: ../../library/codecs.rst:1428 +#: ../../library/codecs.rst:1427 msgid "Compress the operand using gzip." msgstr "" -#: ../../library/codecs.rst:1428 +#: ../../library/codecs.rst:1427 msgid ":meth:`zlib.compress` / :meth:`zlib.decompress`" msgstr ":meth:`zlib.compress` / :meth:`zlib.decompress`" -#: ../../library/codecs.rst:1432 +#: ../../library/codecs.rst:1431 msgid "" "In addition to :term:`bytes-like objects `, " "``'base64_codec'`` also accepts ASCII-only instances of :class:`str` for " "decoding" msgstr "" -#: ../../library/codecs.rst:1436 +#: ../../library/codecs.rst:1435 msgid "Restoration of the binary transforms." msgstr "" -#: ../../library/codecs.rst:1439 +#: ../../library/codecs.rst:1438 msgid "Restoration of the aliases for the binary transforms." msgstr "" -#: ../../library/codecs.rst:1446 +#: ../../library/codecs.rst:1445 msgid "Text Transforms" msgstr "" -#: ../../library/codecs.rst:1448 +#: ../../library/codecs.rst:1447 msgid "" "The following codec provides a text transform: a :class:`str` to :class:" "`str` mapping. It is not supported by :meth:`str.encode` (which only " "produces :class:`bytes` output)." msgstr "" -#: ../../library/codecs.rst:1457 +#: ../../library/codecs.rst:1456 msgid "rot_13" msgstr "rot_13" -#: ../../library/codecs.rst:1457 +#: ../../library/codecs.rst:1456 msgid "rot13" msgstr "" -#: ../../library/codecs.rst:1457 +#: ../../library/codecs.rst:1456 msgid "Return the Caesar-cypher encryption of the operand." msgstr "" -#: ../../library/codecs.rst:1462 +#: ../../library/codecs.rst:1461 msgid "Restoration of the ``rot_13`` text transform." msgstr "" -#: ../../library/codecs.rst:1465 +#: ../../library/codecs.rst:1464 msgid "Restoration of the ``rot13`` alias." msgstr "" -#: ../../library/codecs.rst:1470 +#: ../../library/codecs.rst:1469 msgid "" ":mod:`encodings.idna` --- Internationalized Domain Names in Applications" msgstr "" -#: ../../library/codecs.rst:1476 +#: ../../library/codecs.rst:1475 msgid "" "This module implements :rfc:`3490` (Internationalized Domain Names in " "Applications) and :rfc:`3492` (Nameprep: A Stringprep Profile for " @@ -2580,13 +2575,13 @@ msgid "" "encoding and :mod:`stringprep`." msgstr "" -#: ../../library/codecs.rst:1481 +#: ../../library/codecs.rst:1480 msgid "" "If you need the IDNA 2008 standard from :rfc:`5891` and :rfc:`5895`, use the " "third-party :pypi:`idna` module." msgstr "" -#: ../../library/codecs.rst:1484 +#: ../../library/codecs.rst:1483 msgid "" "These RFCs together define a protocol to support non-ASCII characters in " "domain names. A domain name containing non-ASCII characters (such as ``www." @@ -2600,7 +2595,7 @@ msgid "" "presenting them to the user." msgstr "" -#: ../../library/codecs.rst:1495 +#: ../../library/codecs.rst:1494 msgid "" "Python supports this conversion in several ways: the ``idna`` codec " "performs conversion between Unicode and ACE, separating an input string into " @@ -2617,14 +2612,14 @@ msgid "" "sends that field at all)." msgstr "" -#: ../../library/codecs.rst:1508 +#: ../../library/codecs.rst:1507 msgid "" "When receiving host names from the wire (such as in reverse name lookup), no " "automatic conversion to Unicode is performed: applications wishing to " "present such host names to the user should decode them to Unicode." msgstr "" -#: ../../library/codecs.rst:1512 +#: ../../library/codecs.rst:1511 msgid "" "The module :mod:`encodings.idna` also implements the nameprep procedure, " "which performs certain normalizations on host names, to achieve case-" @@ -2632,49 +2627,49 @@ msgid "" "characters. The nameprep functions can be used directly if desired." msgstr "" -#: ../../library/codecs.rst:1520 +#: ../../library/codecs.rst:1519 msgid "" "Return the nameprepped version of *label*. The implementation currently " "assumes query strings, so ``AllowUnassigned`` is true." msgstr "" -#: ../../library/codecs.rst:1526 +#: ../../library/codecs.rst:1525 msgid "" "Convert a label to ASCII, as specified in :rfc:`3490`. ``UseSTD3ASCIIRules`` " "is assumed to be false." msgstr "" -#: ../../library/codecs.rst:1532 +#: ../../library/codecs.rst:1531 msgid "Convert a label to Unicode, as specified in :rfc:`3490`." msgstr "" -#: ../../library/codecs.rst:1536 +#: ../../library/codecs.rst:1535 msgid ":mod:`encodings.mbcs` --- Windows ANSI codepage" msgstr "" -#: ../../library/codecs.rst:1541 +#: ../../library/codecs.rst:1540 msgid "This module implements the ANSI codepage (CP_ACP)." msgstr "" -#: ../../library/codecs.rst:1543 +#: ../../library/codecs.rst:1542 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/codecs.rst:1545 +#: ../../library/codecs.rst:1544 msgid "" "Before 3.2, the *errors* argument was ignored; ``'replace'`` was always used " "to encode, and ``'ignore'`` to decode." msgstr "" -#: ../../library/codecs.rst:1549 +#: ../../library/codecs.rst:1548 msgid "Support any error handler." msgstr "" -#: ../../library/codecs.rst:1554 +#: ../../library/codecs.rst:1553 msgid ":mod:`encodings.utf_8_sig` --- UTF-8 codec with BOM signature" msgstr "" -#: ../../library/codecs.rst:1560 +#: ../../library/codecs.rst:1559 msgid "" "This module implements a variant of the UTF-8 codec. On encoding, a UTF-8 " "encoded BOM will be prepended to the UTF-8 encoded bytes. For the stateful " @@ -2771,3 +2766,8 @@ msgstr "\\N" #: ../../library/codecs.rst:387 msgid "surrogatepass" msgstr "surrogatepass" + +#, fuzzy +#~ msgid "" +#~ ":meth:`!uu.encode` / :meth:`!uu.decode` (Note: :mod:`uu` is deprecated.)" +#~ msgstr ":meth:`uu.encode` / :meth:`uu.decode`" diff --git a/library/codeop.po b/library/codeop.po index bdb19c3cca..36b73d432c 100644 --- a/library/codeop.po +++ b/library/codeop.po @@ -1,15 +1,16 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Liang-Bo Wang , 2016 +# Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" -"PO-Revision-Date: 2016-11-19 00:28+0000\n" -"Last-Translator: Liang-Bo Wang \n" +"PO-Revision-Date: 2024-09-24 20:28+0000\n" +"Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -34,32 +35,41 @@ msgid "" "include such a loop in your program you probably want to use the :mod:`code` " "module instead." msgstr "" +":mod:`codeop` 模組提供了可以模擬 Python read-eval-print 循環的工具程式 " +"(utilities),就像在 :mod:`code` 模組中所做的那樣。因此你可能不想直接使用該模" +"組;如果你想在程式中包含這樣的循環,你可能需要使用 :mod:`code` 模組。" #: ../../library/codeop.rst:20 msgid "There are two parts to this job:" -msgstr "" +msgstr "這個任務有兩個部分:" #: ../../library/codeop.rst:22 msgid "" "Being able to tell if a line of input completes a Python statement: in " "short, telling whether to print '``>>>``' or '``...``' next." msgstr "" +"能夠判斷一列輸入是否完成了一項 Python 陳述式:簡而言之,判斷接下來是列印 " +"'``>>>``' 還是 '``...``'。" #: ../../library/codeop.rst:25 msgid "" "Remembering which future statements the user has entered, so subsequent " "input can be compiled with these in effect." msgstr "" +"記住使用者輸入了哪些未來陳述式,以便後續輸入可以在這些陳述式生效的情況下進行" +"編譯。" #: ../../library/codeop.rst:28 msgid "" "The :mod:`codeop` module provides a way of doing each of these things, and a " "way of doing them both." msgstr "" +":mod:`codeop` 模組提供了一種完成上述每項任務的方法,以及同時完成這兩項任務的" +"方法。" #: ../../library/codeop.rst:31 msgid "To do just the former:" -msgstr "" +msgstr "只做前者:" #: ../../library/codeop.rst:35 msgid "" @@ -69,6 +79,10 @@ msgid "" "``''``. Returns ``None`` if *source* is *not* valid Python code, but " "is a prefix of valid Python code." msgstr "" +"嘗試編譯 *source*,它應該是 Python 程式碼的字串,如果 *source* 是有效的 " +"Python 程式碼,則回傳一個程式碼物件 (code object)。在這種情況下,程式碼物件的" +"檔案名稱屬性將為 *filename*,預設為 ``''``。如果 *source* 不是有效的 " +"Python 程式碼,而是有效 Python 程式碼的前綴,則回傳 ``None``。" #: ../../library/codeop.rst:41 msgid "" @@ -76,6 +90,9 @@ msgid "" "`SyntaxError` is raised if there is invalid Python syntax, and :exc:" "`OverflowError` or :exc:`ValueError` if there is an invalid literal." msgstr "" +"如果 *source* 有問題,就會引發例外。如果存在無效的 Python 語法則會引發 :exc:" +"`SyntaxError`;如果存在無效的文字 (literal),則會引發 :exc:`OverflowError` " +"或 :exc:`ValueError`。" #: ../../library/codeop.rst:45 msgid "" @@ -84,6 +101,9 @@ msgid "" "or as an :term:`expression` (``'eval'``). Any other value will cause :exc:" "`ValueError` to be raised." msgstr "" +"*symbol* 引數決定 *source* 是否編譯為陳述式(``'single'``,為預設值)、為\\ :" +"term:`陳述式 `\\ 序列 (``'exec'``) 或為\\ :term:`運算式 " +"` (``'eval'``)。任何其他值都會導致引發 :exc:`ValueError`。" #: ../../library/codeop.rst:52 msgid "" @@ -93,6 +113,10 @@ msgid "" "backslash followed by two newlines may be followed by arbitrary garbage. " "This will be fixed once the API for the parser is better." msgstr "" +"剖析器 (parser) 有可能(但通常不會)在到達原始碼的結尾之前停止剖析並獲得成功" +"的結果;在這種情況下,尾隨符號可能會被忽略而不是導致錯誤。例如,反斜線後面加" +"上兩個換行符號後可以是任意的無意義符號。這個問題在未來會因為剖析器 API 的改善" +"而被解決。" #: ../../library/codeop.rst:61 msgid "" @@ -102,6 +126,9 @@ msgid "" "statement, the instance 'remembers' and compiles all subsequent program " "texts with the statement in force." msgstr "" +"此類別的實例具有 :meth:`~object.__call__` 方法,其簽名與內建函式 :func:" +"`compile` 相同,區別在於如果實例編譯包含 :mod:`__future__` 陳述式的程式文本," +"實例會「記住」並使用該陳述式開始編譯所有後續程式文本。" #: ../../library/codeop.rst:70 msgid "" @@ -111,3 +138,6 @@ msgid "" "'remembers' and compiles all subsequent program texts with the statement in " "force." msgstr "" +"此類別的實例具有 :meth:`~object.__call__` 方法,其簽名與內建函式 :func:" +"`compile_command` 相同,區別在於如果實例編譯包含 :mod:`__future__` 陳述式的程" +"式文本,實例會「記住」並使用該陳述式開始編譯所有後續程式文本。" diff --git a/library/collections.abc.po b/library/collections.abc.po index 7d3b69e86f..0012205941 100644 --- a/library/collections.abc.po +++ b/library/collections.abc.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" diff --git a/library/collections.po b/library/collections.po index 6ec399fe02..b2cd7486d9 100644 --- a/library/collections.po +++ b/library/collections.po @@ -8,9 +8,9 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2024-01-22 21:42+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -612,7 +612,7 @@ msgid "" "list(c) # list unique elements\n" "set(c) # convert to a set\n" "dict(c) # convert to a regular dictionary\n" -"c.items() # convert to a list of (elem, cnt) pairs\n" +"c.items() # access the (elem, cnt) pairs\n" "Counter(dict(list_of_pairs)) # convert from a list of (elem, cnt) pairs\n" "c.most_common()[:-n-1:-1] # n least common elements\n" "+c # remove zero and negative counts" @@ -1207,7 +1207,7 @@ msgstr "" "此屬性為 :meth:`__missing__` 方法所使用。如果有引數被傳入建構函式,則此屬性會" "被初始化成第一個引數,如未提供引數則被初始化為 ``None``。" -#: ../../library/collections.rst:765 ../../library/collections.rst:1182 +#: ../../library/collections.rst:765 ../../library/collections.rst:1191 msgid "" "Added merge (``|``) and update (``|=``) operators, specified in :pep:`584`." msgstr "新增合併 (``|``) 和更新 (``|=``) 運算子,請見 :pep:`584`。" @@ -1357,10 +1357,11 @@ msgstr "" #: ../../library/collections.rst:877 msgid "" -"If *module* is defined, the ``__module__`` attribute of the named tuple is " -"set to that value." +"If *module* is defined, the :attr:`~type.__module__` attribute of the named " +"tuple is set to that value." msgstr "" -"如果 *module* 值有被定義,named tuple 的 ``__module__`` 屬性就被設定為該值。" +"如果 *module* 值有被定義,named tuple 的 :attr:`~type.__module__` 屬性就被設" +"定為該值。" #: ../../library/collections.rst:880 msgid "" @@ -1539,15 +1540,26 @@ msgstr "" "... inventory[partnum] = record._replace(price=newprices[partnum], " "timestamp=time.now())" +#: ../../library/collections.rst:982 +msgid "" +"Named tuples are also supported by generic function :func:`copy.replace`." +msgstr "" + #: ../../library/collections.rst:984 msgid "" +"Raise :exc:`TypeError` instead of :exc:`ValueError` for invalid keyword " +"arguments." +msgstr "" + +#: ../../library/collections.rst:990 +msgid "" "Tuple of strings listing the field names. Useful for introspection and for " "creating new named tuple types from existing named tuples." msgstr "" "列出 tuple 欄位名稱的字串,用於自我檢查或是從現有 named tuple 建立一個新的 " "named tuple 型別。" -#: ../../library/collections.rst:987 +#: ../../library/collections.rst:993 msgid "" ">>> p._fields # view the field names\n" "('x', 'y')\n" @@ -1558,11 +1570,11 @@ msgid "" "Pixel(x=11, y=22, red=128, green=255, blue=0)" msgstr "" -#: ../../library/collections.rst:999 +#: ../../library/collections.rst:1005 msgid "Dictionary mapping field names to default values." msgstr "將欄位名稱對映至預設值的字典。" -#: ../../library/collections.rst:1001 +#: ../../library/collections.rst:1007 msgid "" ">>> Account = namedtuple('Account', ['type', 'balance'], defaults=[0])\n" ">>> Account._field_defaults\n" @@ -1576,13 +1588,13 @@ msgstr "" ">>> Account('premium')\n" "Account(type='premium', balance=0)" -#: ../../library/collections.rst:1009 +#: ../../library/collections.rst:1015 msgid "" "To retrieve a field whose name is stored in a string, use the :func:" "`getattr` function:" msgstr "要取得這個名稱存於字串的欄位,要使用 :func:`getattr` 函式:" -#: ../../library/collections.rst:1015 +#: ../../library/collections.rst:1021 msgid "" "To convert a dictionary to a named tuple, use the double-star-operator (as " "described in :ref:`tut-unpacking-arguments`):" @@ -1590,7 +1602,7 @@ msgstr "" "(如\\ :ref:`tut-unpacking-arguments`\\ 所述)將一個字典轉換成 named tuple," "要使用 \\*\\* 雙星號運算子:" -#: ../../library/collections.rst:1022 +#: ../../library/collections.rst:1028 msgid "" "Since a named tuple is a regular Python class, it is easy to add or change " "functionality with a subclass. Here is how to add a calculated field and a " @@ -1599,7 +1611,7 @@ msgstr "" "因為一個 named tuple 是一個常規的 Python 類別,我們可以很容易的透過子類別來新" "增或更改功能,以下是如何新增一個計算得到的欄位和固定寬度的輸出列印格式:" -#: ../../library/collections.rst:1026 +#: ../../library/collections.rst:1032 msgid "" ">>> class Point(namedtuple('Point', ['x', 'y'])):\n" "... __slots__ = ()\n" @@ -1629,7 +1641,7 @@ msgstr "" "Point: x= 3.000 y= 4.000 hypot= 5.000\n" "Point: x=14.000 y= 0.714 hypot=14.018" -#: ../../library/collections.rst:1041 +#: ../../library/collections.rst:1047 msgid "" "The subclass shown above sets ``__slots__`` to an empty tuple. This helps " "keep memory requirements low by preventing the creation of instance " @@ -1638,7 +1650,7 @@ msgstr "" "上面的子類別將 ``__slots__`` 設定為空 tuple,這樣一來就防止了字典實例被建立," "因而保持了較低的記憶體用量。" -#: ../../library/collections.rst:1044 +#: ../../library/collections.rst:1050 msgid "" "Subclassing is not useful for adding new, stored fields. Instead, simply " "create a new named tuple type from the :attr:`~somenamedtuple._fields` " @@ -1647,17 +1659,17 @@ msgstr "" "子類別化無法用於增加新的、已被儲存的欄位,應當透過 :attr:`~somenamedtuple." "_fields` 屬性以建立一個新的 named tuple 來實現:" -#: ../../library/collections.rst:1049 +#: ../../library/collections.rst:1055 msgid "" "Docstrings can be customized by making direct assignments to the ``__doc__`` " "fields:" msgstr "透過直接賦值給 ``__doc__``,可以自訂說明文件字串:" -#: ../../library/collections.rst:1058 +#: ../../library/collections.rst:1064 msgid "Property docstrings became writeable." msgstr "文件字串屬性變成可寫入。" -#: ../../library/collections.rst:1063 +#: ../../library/collections.rst:1069 msgid "" "See :class:`typing.NamedTuple` for a way to add type hints for named " "tuples. It also provides an elegant notation using the :keyword:`class` " @@ -1666,7 +1678,7 @@ msgstr "" "關於為 named tuple 新增型別提示的方法,請參閱 :class:`typing.NamedTuple`,它" "運用 :keyword:`class` 關鍵字以提供了一個簡潔的表示法: ::" -#: ../../library/collections.rst:1067 +#: ../../library/collections.rst:1073 msgid "" "class Component(NamedTuple):\n" " part_number: int\n" @@ -1678,7 +1690,7 @@ msgstr "" " weight: float\n" " description: Optional[str] = None" -#: ../../library/collections.rst:1072 +#: ../../library/collections.rst:1078 msgid "" "See :meth:`types.SimpleNamespace` for a mutable namespace based on an " "underlying dictionary instead of a tuple." @@ -1686,7 +1698,7 @@ msgstr "" "關於以 dict 而非 tuple 為底層的可變命名空間,請參考 :meth:`types." "SimpleNamespace`。" -#: ../../library/collections.rst:1075 +#: ../../library/collections.rst:1081 msgid "" "The :mod:`dataclasses` module provides a decorator and functions for " "automatically adding generated special methods to user-defined classes." @@ -1694,11 +1706,11 @@ msgstr "" ":mod:`dataclasses` 模組提供了一個裝飾器和一些函式,用於自動將被生成的特殊方法" "新增到使用者定義的類別中。" -#: ../../library/collections.rst:1080 +#: ../../library/collections.rst:1086 msgid ":class:`OrderedDict` objects" msgstr ":class:`OrderedDict` 物件" -#: ../../library/collections.rst:1082 +#: ../../library/collections.rst:1088 msgid "" "Ordered dictionaries are just like regular dictionaries but have some extra " "capabilities relating to ordering operations. They have become less " @@ -1709,11 +1721,11 @@ msgstr "" "功能,但由於內建的 :class:`dict` 類別現在已經有記憶插入順序的能力(Python " "3.7 中確保了這種新行為),它們變得不那麼重要了。" -#: ../../library/collections.rst:1088 +#: ../../library/collections.rst:1094 msgid "Some differences from :class:`dict` still remain:" msgstr "仍存在一些與 :class:`dict` 的不同之處:" -#: ../../library/collections.rst:1090 +#: ../../library/collections.rst:1096 msgid "" "The regular :class:`dict` was designed to be very good at mapping " "operations. Tracking insertion order was secondary." @@ -1721,7 +1733,7 @@ msgstr "" "常規的 :class:`dict` 被設計成非常擅長於對映相關操作,追蹤插入的順序為次要目" "標。" -#: ../../library/collections.rst:1093 +#: ../../library/collections.rst:1099 msgid "" "The :class:`OrderedDict` was designed to be good at reordering operations. " "Space efficiency, iteration speed, and the performance of update operations " @@ -1730,7 +1742,7 @@ msgstr "" ":class:`OrderedDict` 則被設計成擅長於重新排序相關的操作,空間效率、疊代速度和" "更新操作的效能則為次要設計目標。" -#: ../../library/collections.rst:1097 +#: ../../library/collections.rst:1103 msgid "" "The :class:`OrderedDict` algorithm can handle frequent reordering operations " "better than :class:`dict`. As shown in the recipes below, this makes it " @@ -1739,12 +1751,12 @@ msgstr "" ":class:`OrderedDict` 比起 :class:`dict` 更適合處理頻繁的重新排序操作,如在下" "方用法中所示,這讓它適合用於多種 LRU cache 的實作中。" -#: ../../library/collections.rst:1101 +#: ../../library/collections.rst:1107 msgid "" "The equality operation for :class:`OrderedDict` checks for matching order." msgstr ":class:`OrderedDict` 之相等性運算會檢查順序是否相同。" -#: ../../library/collections.rst:1103 +#: ../../library/collections.rst:1109 msgid "" "A regular :class:`dict` can emulate the order sensitive equality test with " "``p == q and all(k1 == k2 for k1, k2 in zip(p, q))``." @@ -1752,7 +1764,7 @@ msgstr "" "一個一般的 :class:`dict` 可以用 ``p == q and all(k1 == k2 for k1, k2 in " "zip(p, q))`` 來效仿有檢查順序的相等性運算。" -#: ../../library/collections.rst:1106 +#: ../../library/collections.rst:1112 msgid "" "The :meth:`popitem` method of :class:`OrderedDict` has a different " "signature. It accepts an optional argument to specify which item is popped." @@ -1760,7 +1772,7 @@ msgstr "" ":class:`OrderedDict` 類別的 :meth:`popitem` 方法有不同的函式簽名 " "(signature),它接受傳入一個選擇性引數來指定要移除哪個元素。" -#: ../../library/collections.rst:1109 +#: ../../library/collections.rst:1115 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=True)`` " "with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item." @@ -1768,7 +1780,7 @@ msgstr "" "一個一般的 :class:`dict` 可以用 ``d.popitem()`` 來效仿 OrderedDict 的 ``od." "popitem(last=True)``,這保證會移除最右邊(最後一個)的元素。" -#: ../../library/collections.rst:1112 +#: ../../library/collections.rst:1118 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=False)`` " "with ``(k := next(iter(d)), d.pop(k))`` which will return and remove the " @@ -1778,7 +1790,7 @@ msgstr "" "OrderedDict 的 ``od.popitem(last=False)``,若最左邊(第一個)的元素存在,則將" "其回傳並移除。" -#: ../../library/collections.rst:1116 +#: ../../library/collections.rst:1122 msgid "" ":class:`OrderedDict` has a :meth:`move_to_end` method to efficiently " "reposition an element to an endpoint." @@ -1786,7 +1798,7 @@ msgstr "" ":class:`OrderedDict` 有個 :meth:`move_to_end` 方法可有效率地將一個元素重新排" "列到任一端。" -#: ../../library/collections.rst:1119 +#: ../../library/collections.rst:1125 msgid "" "A regular :class:`dict` can emulate OrderedDict's ``od.move_to_end(k, " "last=True)`` with ``d[k] = d.pop(k)`` which will move the key and its " @@ -1796,7 +1808,7 @@ msgstr "" "``od.move_to_end(k, last=True)``,這會將該鍵與其對應到的值移動至最右(最後" "面)的位置。" -#: ../../library/collections.rst:1123 +#: ../../library/collections.rst:1129 msgid "" "A regular :class:`dict` does not have an efficient equivalent for " "OrderedDict's ``od.move_to_end(k, last=False)`` which moves the key and its " @@ -1806,18 +1818,18 @@ msgstr "" "last=False)`` 等價的有效方式,這是將鍵與其對應到的值移動至最左(最前面)位置" "的方法。" -#: ../../library/collections.rst:1127 +#: ../../library/collections.rst:1133 msgid "Until Python 3.8, :class:`dict` lacked a :meth:`__reversed__` method." msgstr "在 Python 3.8 之前,:class:`dict` 並沒有 :meth:`__reversed__` 方法。" -#: ../../library/collections.rst:1132 +#: ../../library/collections.rst:1138 msgid "" "Return an instance of a :class:`dict` subclass that has methods specialized " "for rearranging dictionary order." msgstr "" "回傳一個 :class:`dict` 子類別的實例,它具有專門用於重新排列字典順序的方法。" -#: ../../library/collections.rst:1139 +#: ../../library/collections.rst:1145 msgid "" "The :meth:`popitem` method for ordered dictionaries returns and removes a " "(key, value) pair. The pairs are returned in :abbr:`LIFO (last-in, first-" @@ -1829,7 +1841,7 @@ msgstr "" "回傳鍵值對,否則就按 :abbr:`FIFO (first-in, first-out)` 先進先出的順序回傳鍵" "值對。" -#: ../../library/collections.rst:1146 +#: ../../library/collections.rst:1152 msgid "" "Move an existing *key* to either end of an ordered dictionary. The item is " "moved to the right end if *last* is true (the default) or to the beginning " @@ -1839,7 +1851,7 @@ msgstr "" "設值)則將元素移至右端;如果 *last* 為假值則將元素移至左端。如果 *key* 不存在" "則會引發 :exc:`KeyError`:" -#: ../../library/collections.rst:1151 +#: ../../library/collections.rst:1157 msgid "" ">>> d = OrderedDict.fromkeys('abcde')\n" ">>> d.move_to_end('b')\n" @@ -1857,7 +1869,7 @@ msgstr "" ">>> ''.join(d)\n" "'bacde'" -#: ../../library/collections.rst:1163 +#: ../../library/collections.rst:1169 msgid "" "In addition to the usual mapping methods, ordered dictionaries also support " "reverse iteration using :func:`reversed`." @@ -1865,21 +1877,26 @@ msgstr "" "除了普通的對映方法,ordered dictionary 還支援了透過 :func:`reversed` 來做倒序" "疊代。" -#: ../../library/collections.rst:1166 +#: ../../library/collections.rst:1174 msgid "" "Equality tests between :class:`OrderedDict` objects are order-sensitive and " -"are implemented as ``list(od1.items())==list(od2.items())``. Equality tests " -"between :class:`OrderedDict` objects and other :class:`~collections.abc." -"Mapping` objects are order-insensitive like regular dictionaries. This " -"allows :class:`OrderedDict` objects to be substituted anywhere a regular " -"dictionary is used." +"are roughly equivalent to ``list(od1.items())==list(od2.items())``." msgstr "" -":class:`OrderedDict` 物件之間的相等性運算是會檢查順序是否相同的,是透過 " -"``list(od1.items())==list(od2.items())`` 來實現。:class:`OrderedDict` 物件和" -"其他 :class:`~collections.abc.Mapping` 物件間的相等性運算則像普通字典一樣不考" -"慮順序性,這使得 :class:`OrderedDict` 可於任何字典可使用的時機中被替換掉。" +":class:`OrderedDict` 物件之間的相等性運算是會檢查順序是否相同的,大致等價於 " +"``list(od1.items())==list(od2.items())``。" -#: ../../library/collections.rst:1173 +#: ../../library/collections.rst:1177 +msgid "" +"Equality tests between :class:`OrderedDict` objects and other :class:" +"`~collections.abc.Mapping` objects are order-insensitive like regular " +"dictionaries. This allows :class:`OrderedDict` objects to be substituted " +"anywhere a regular dictionary is used." +msgstr "" +":class:`OrderedDict` 物件和其他 :class:`~collections.abc.Mapping` 物件間的相" +"等性運算則像普通字典一樣不考慮順序性,這使得 :class:`OrderedDict` 可於任何字" +"典可使用的時機中被替換掉。" + +#: ../../library/collections.rst:1182 msgid "" "The items, keys, and values :term:`views ` of :class:" "`OrderedDict` now support reverse iteration using :func:`reversed`." @@ -1887,7 +1904,7 @@ msgstr "" ":class:`OrderedDict` 的項 (item)、鍵與值之\\ :term:`視圖 `\\ 現在可透過 :func:`reversed` 來倒序疊代。" -#: ../../library/collections.rst:1177 +#: ../../library/collections.rst:1186 msgid "" "With the acceptance of :pep:`468`, order is retained for keyword arguments " "passed to the :class:`OrderedDict` constructor and its :meth:`update` method." @@ -1895,11 +1912,11 @@ msgstr "" "隨著 :pep:`468` 被核可,被傳入給 :class:`OrderedDict` 建構函式與其 :meth:" "`update` 方法的關鍵字引數之順序被保留了下來。" -#: ../../library/collections.rst:1187 +#: ../../library/collections.rst:1196 msgid ":class:`OrderedDict` Examples and Recipes" msgstr ":class:`OrderedDict` 範例與用法" -#: ../../library/collections.rst:1189 +#: ../../library/collections.rst:1198 msgid "" "It is straightforward to create an ordered dictionary variant that remembers " "the order the keys were *last* inserted. If a new entry overwrites an " @@ -1909,7 +1926,7 @@ msgstr "" "建立一個能夠記住鍵\\ *最後*\\ 插入順序的 ordered dictionary 變體很簡單。如果" "新條目覆蓋了現有條目,則原本插入位置會被更改並移動至末端: ::" -#: ../../library/collections.rst:1194 +#: ../../library/collections.rst:1203 msgid "" "class LastUpdatedOrderedDict(OrderedDict):\n" " 'Store items in the order the keys were last added'\n" @@ -1919,7 +1936,7 @@ msgid "" " self.move_to_end(key)" msgstr "" -#: ../../library/collections.rst:1201 +#: ../../library/collections.rst:1210 msgid "" "An :class:`OrderedDict` would also be useful for implementing variants of :" "func:`functools.lru_cache`:" @@ -1927,7 +1944,7 @@ msgstr "" ":class:`OrderedDict` 在實現一個 :func:`functools.lru_cache` 的變形版本時也非" "常有用:" -#: ../../library/collections.rst:1204 +#: ../../library/collections.rst:1213 msgid "" "from collections import OrderedDict\n" "from time import time\n" @@ -1950,11 +1967,11 @@ msgid "" " result = self.func(*args)\n" " self.cache[args] = time(), result\n" " if len(self.cache) > self.maxsize:\n" -" self.cache.popitem(0)\n" +" self.cache.popitem(last=False)\n" " return result" msgstr "" -#: ../../library/collections.rst:1231 +#: ../../library/collections.rst:1240 msgid "" "class MultiHitLRUCache:\n" " \"\"\" LRU cache that defers caching a result until\n" @@ -1983,20 +2000,20 @@ msgid "" " if self.requests[args] <= self.cache_after:\n" " self.requests.move_to_end(args)\n" " if len(self.requests) > self.maxrequests:\n" -" self.requests.popitem(0)\n" +" self.requests.popitem(last=False)\n" " else:\n" " self.requests.pop(args, None)\n" " self.cache[args] = result\n" " if len(self.cache) > self.maxsize:\n" -" self.cache.popitem(0)\n" +" self.cache.popitem(last=False)\n" " return result" msgstr "" -#: ../../library/collections.rst:1300 +#: ../../library/collections.rst:1309 msgid ":class:`UserDict` objects" msgstr ":class:`UserDict` 物件" -#: ../../library/collections.rst:1302 +#: ../../library/collections.rst:1311 msgid "" "The class, :class:`UserDict` acts as a wrapper around dictionary objects. " "The need for this class has been partially supplanted by the ability to " @@ -2007,7 +2024,7 @@ msgstr "" "`dict` 建立子類別,這個類別的需求已部分被滿足,不過這個類別使用起來更方便,因" "為被包裝的字典可以作為其屬性來存取。" -#: ../../library/collections.rst:1310 +#: ../../library/collections.rst:1319 msgid "" "Class that simulates a dictionary. The instance's contents are kept in a " "regular dictionary, which is accessible via the :attr:`data` attribute of :" @@ -2019,23 +2036,23 @@ msgstr "" "`data` 屬性來做存取。如果有提供 *initialdata*,:attr:`data` 屬性會被初始化為" "其值;要注意指到 *initialdata* 的參照不會被保留,使其可被用於其他目的。" -#: ../../library/collections.rst:1316 +#: ../../library/collections.rst:1325 msgid "" "In addition to supporting the methods and operations of mappings, :class:" "`UserDict` instances provide the following attribute:" msgstr "" "除了支援作為對映所需的方法與操作,:class:`UserDict` 實例提供了以下屬性:" -#: ../../library/collections.rst:1321 +#: ../../library/collections.rst:1330 msgid "" "A real dictionary used to store the contents of the :class:`UserDict` class." msgstr "一個真實的字典,用於儲存 :class:`UserDict` 類別的資料內容。" -#: ../../library/collections.rst:1327 +#: ../../library/collections.rst:1336 msgid ":class:`UserList` objects" msgstr ":class:`UserList` 物件" -#: ../../library/collections.rst:1329 +#: ../../library/collections.rst:1338 msgid "" "This class acts as a wrapper around list objects. It is a useful base class " "for your own list-like classes which can inherit from them and override " @@ -2046,7 +2063,7 @@ msgstr "" "入新方法來定義你所需的一個類似於 list 的類別。如此一來,我們可以為 list 加入" "新的特性。" -#: ../../library/collections.rst:1334 +#: ../../library/collections.rst:1343 msgid "" "The need for this class has been partially supplanted by the ability to " "subclass directly from :class:`list`; however, this class can be easier to " @@ -2055,7 +2072,7 @@ msgstr "" "因為已經可以直接自 :class:`list` 建立子類別,這個類別的需求已部分被滿足,不過" "這個類別使用起來更方便,因為被包裝的 list 可以作為其屬性來存取。" -#: ../../library/collections.rst:1340 +#: ../../library/collections.rst:1349 msgid "" "Class that simulates a list. The instance's contents are kept in a regular " "list, which is accessible via the :attr:`data` attribute of :class:" @@ -2068,20 +2085,20 @@ msgstr "" "list ``[]``。*list* 可以是任何 iterable,例如一個真實的 Python list 或是一" "個 :class:`UserList` 物件。" -#: ../../library/collections.rst:1346 +#: ../../library/collections.rst:1355 msgid "" "In addition to supporting the methods and operations of mutable sequences, :" "class:`UserList` instances provide the following attribute:" msgstr "除了支援可變序列的方法與操作,:class:`UserList` 實例提供了以下屬性:" -#: ../../library/collections.rst:1351 +#: ../../library/collections.rst:1360 msgid "" "A real :class:`list` object used to store the contents of the :class:" "`UserList` class." msgstr "" "一個真實的 :class:`list` 物件,用於儲存 :class:`UserList` 類別的資料內容。" -#: ../../library/collections.rst:1354 +#: ../../library/collections.rst:1363 msgid "" "**Subclassing requirements:** Subclasses of :class:`UserList` are expected " "to offer a constructor which can be called with either no arguments or one " @@ -2095,7 +2112,7 @@ msgstr "" "例,為了達成上述目的,它假設建構函式可傳入單一參數來呼叫,該參數即是做為數據" "來源的一個序列物件。" -#: ../../library/collections.rst:1361 +#: ../../library/collections.rst:1370 msgid "" "If a derived class does not wish to comply with this requirement, all of the " "special methods supported by this class will need to be overridden; please " @@ -2105,11 +2122,11 @@ msgstr "" "如果希望一個自此獲得的子類別不遵從上述要求,那所有該類別支援的特殊方法則必須" "被覆寫;請參考原始碼來理解在這情況下哪些方法是必須提供的。" -#: ../../library/collections.rst:1367 +#: ../../library/collections.rst:1376 msgid ":class:`UserString` objects" msgstr ":class:`UserString` 物件" -#: ../../library/collections.rst:1369 +#: ../../library/collections.rst:1378 msgid "" "The class, :class:`UserString` acts as a wrapper around string objects. The " "need for this class has been partially supplanted by the ability to subclass " @@ -2120,7 +2137,7 @@ msgstr "" "建立子類別,這個類別的需求已經部分被滿足,不過這個類別使用起來更方便,因為被" "包裝的字串可以作為其屬性來存取。" -#: ../../library/collections.rst:1377 +#: ../../library/collections.rst:1386 msgid "" "Class that simulates a string object. The instance's content is kept in a " "regular string object, which is accessible via the :attr:`data` attribute " @@ -2132,21 +2149,21 @@ msgstr "" "的 :attr:`data` 屬性來做存取。實例內容被初始化為 *seq* 的複製,*seq* 引數可以" "是任何可被內建函式 :func:`str` 轉換成字串的物件。" -#: ../../library/collections.rst:1384 +#: ../../library/collections.rst:1393 msgid "" "In addition to supporting the methods and operations of strings, :class:" "`UserString` instances provide the following attribute:" msgstr "" "除了支援字串的方法和操作以外,:class:`UserString` 實例也提供了以下屬性:" -#: ../../library/collections.rst:1389 +#: ../../library/collections.rst:1398 msgid "" "A real :class:`str` object used to store the contents of the :class:" "`UserString` class." msgstr "" "一個真實的 :class:`str` 物件,用來儲存 :class:`UserString` 類別的資料內容。" -#: ../../library/collections.rst:1392 +#: ../../library/collections.rst:1401 msgid "" "New methods ``__getnewargs__``, ``__rmod__``, ``casefold``, ``format_map``, " "``isprintable``, and ``maketrans``." diff --git a/library/colorsys.po b/library/colorsys.po index 2cc404f6b8..3bf0334312 100644 --- a/library/colorsys.po +++ b/library/colorsys.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-02-15 20:58+0800\n" diff --git a/library/compileall.po b/library/compileall.po index c21e67b18b..78cbc5fb98 100644 --- a/library/compileall.po +++ b/library/compileall.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,17 +36,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/compileall.rst:22 msgid "Command-line use" @@ -128,7 +127,7 @@ msgstr "" #: ../../library/compileall.rst:92 msgid "" "Use *N* workers to compile the files within the given directory. If ``0`` is " -"used, then the result of :func:`os.cpu_count` will be used." +"used, then the result of :func:`os.process_cpu_count` will be used." msgstr "" #: ../../library/compileall.rst:98 diff --git a/library/concurrency.po b/library/concurrency.po index 51f96db2f4..fc7278d186 100644 --- a/library/concurrency.po +++ b/library/concurrency.po @@ -6,7 +6,7 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-13 00:11+0000\n" "PO-Revision-Date: 2021-11-23 13:36+0800\n" diff --git a/library/concurrent.futures.po b/library/concurrent.futures.po index d9a8e7b4a3..1a8ea4d243 100644 --- a/library/concurrent.futures.po +++ b/library/concurrent.futures.po @@ -5,9 +5,9 @@ # Matt Wang , 2023-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-01-24 03:33+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -51,17 +51,16 @@ msgstr "" "相同的介面,該介面由抽象的 :class:`Executor` 類別定義。" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上沒有作用" -"或不可使用。更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/concurrent.futures.rst:25 msgid "Executor Objects" @@ -338,7 +337,7 @@ msgstr "" "thread) 的 :class:`threading.Thread` 名稱,以便於除錯。" #: ../../library/concurrent.futures.rst:179 -#: ../../library/concurrent.futures.rst:283 +#: ../../library/concurrent.futures.rst:287 msgid "Added the *initializer* and *initargs* arguments." msgstr "新增 *initializer* 與 *initargs* 引數。" @@ -361,11 +360,17 @@ msgstr "" "ThreadPoolExecutor 現在在啟動 *max_workers* 工作執行緒之前會重用 (reuse) 空閒" "的工作執行緒。" -#: ../../library/concurrent.futures.rst:195 +#: ../../library/concurrent.futures.rst:191 +msgid "" +"Default value of *max_workers* is changed to ``min(32, (os." +"process_cpu_count() or 1) + 4)``." +msgstr "" + +#: ../../library/concurrent.futures.rst:199 msgid "ThreadPoolExecutor Example" msgstr "ThreadPoolExecutor 範例" -#: ../../library/concurrent.futures.rst:198 +#: ../../library/concurrent.futures.rst:202 msgid "" "import concurrent.futures\n" "import urllib.request\n" @@ -396,11 +401,11 @@ msgid "" " print('%r page is %d bytes' % (url, len(data)))" msgstr "" -#: ../../library/concurrent.futures.rst:227 +#: ../../library/concurrent.futures.rst:231 msgid "ProcessPoolExecutor" msgstr "ProcessPoolExecutor" -#: ../../library/concurrent.futures.rst:229 +#: ../../library/concurrent.futures.rst:233 msgid "" "The :class:`ProcessPoolExecutor` class is an :class:`Executor` subclass that " "uses a pool of processes to execute calls asynchronously. :class:" @@ -415,7 +420,7 @@ msgstr "" "Interpreter Lock) `,但也意味著只能執行和回傳可被 " "pickle 的 (picklable) 物件。" -#: ../../library/concurrent.futures.rst:236 +#: ../../library/concurrent.futures.rst:240 msgid "" "The ``__main__`` module must be importable by worker subprocesses. This " "means that :class:`ProcessPoolExecutor` will not work in the interactive " @@ -425,7 +430,7 @@ msgstr "" "class:`ProcessPoolExecutor` 將無法在交互式直譯器 (interactive interpreter) 中" "工作。" -#: ../../library/concurrent.futures.rst:239 +#: ../../library/concurrent.futures.rst:243 msgid "" "Calling :class:`Executor` or :class:`Future` methods from a callable " "submitted to a :class:`ProcessPoolExecutor` will result in deadlock." @@ -433,19 +438,20 @@ msgstr "" "從提交給 :class:`ProcessPoolExecutor` 的可呼叫物件中呼叫 :class:`Executor` " "或 :class:`Future` 方法將導致死鎖。" -#: ../../library/concurrent.futures.rst:244 +#: ../../library/concurrent.futures.rst:248 +#, fuzzy msgid "" "An :class:`Executor` subclass that executes calls asynchronously using a " "pool of at most *max_workers* processes. If *max_workers* is ``None`` or " -"not given, it will default to the number of processors on the machine. If " -"*max_workers* is less than or equal to ``0``, then a :exc:`ValueError` will " -"be raised. On Windows, *max_workers* must be less than or equal to ``61``. " -"If it is not then :exc:`ValueError` will be raised. If *max_workers* is " -"``None``, then the default chosen will be at most ``61``, even if more " -"processors are available. *mp_context* can be a :mod:`multiprocessing` " -"context or ``None``. It will be used to launch the workers. If *mp_context* " -"is ``None`` or not given, the default :mod:`multiprocessing` context is " -"used. See :ref:`multiprocessing-start-methods`." +"not given, it will default to :func:`os.process_cpu_count`. If *max_workers* " +"is less than or equal to ``0``, then a :exc:`ValueError` will be raised. On " +"Windows, *max_workers* must be less than or equal to ``61``. If it is not " +"then :exc:`ValueError` will be raised. If *max_workers* is ``None``, then " +"the default chosen will be at most ``61``, even if more processors are " +"available. *mp_context* can be a :mod:`multiprocessing` context or ``None``. " +"It will be used to launch the workers. If *mp_context* is ``None`` or not " +"given, the default :mod:`multiprocessing` context is used. See :ref:" +"`multiprocessing-start-methods`." msgstr "" "一個 :class:`Executor` 子類別,它使用了最多有 *max_workers* 個行程的池來非同" "步地執行呼叫。如果 *max_workers* 為 ``None`` 或未給定,它將被預設為機器上的處" @@ -457,7 +463,7 @@ msgstr "" "預設的 :mod:`multiprocessing` 情境。請見 :ref:`multiprocessing-start-" "methods`。" -#: ../../library/concurrent.futures.rst:258 +#: ../../library/concurrent.futures.rst:262 msgid "" "*initializer* is an optional callable that is called at the start of each " "worker process; *initargs* is a tuple of arguments passed to the " @@ -470,7 +476,7 @@ msgstr "" "外,所有當前未定的作業以及任何向池中提交更多作業的嘗試都將引發 :exc:" "`~concurrent.futures.process.BrokenProcessPool`。" -#: ../../library/concurrent.futures.rst:264 +#: ../../library/concurrent.futures.rst:268 msgid "" "*max_tasks_per_child* is an optional argument that specifies the maximum " "number of tasks a single process can execute before it will exit and be " @@ -486,7 +492,7 @@ msgstr "" "數的情況下,將預設使用 \"spawn\" 做為 multiprocessing 啟動方法。此功能與 " "\"fork\" 啟動方法不相容。" -#: ../../library/concurrent.futures.rst:272 +#: ../../library/concurrent.futures.rst:276 msgid "" "When one of the worker processes terminates abruptly, a :exc:`~concurrent." "futures.process.BrokenProcessPool` error is now raised. Previously, " @@ -497,14 +503,14 @@ msgstr "" "BrokenProcessPool` 錯誤。在過去,此行為是未定義的 (undefined),但對 executor " "或其 future 的操作經常會發生凍結或死鎖。" -#: ../../library/concurrent.futures.rst:279 +#: ../../library/concurrent.futures.rst:283 msgid "" "The *mp_context* argument was added to allow users to control the " "start_method for worker processes created by the pool." msgstr "" "新增了 *mp_context* 引數以允許使用者控制由池所建立的工作行程的 start_method。" -#: ../../library/concurrent.futures.rst:286 +#: ../../library/concurrent.futures.rst:290 msgid "" "The default :mod:`multiprocessing` start method (see :ref:`multiprocessing-" "start-methods`) will change away from *fork* in Python 3.14. Code that " @@ -517,14 +523,14 @@ msgstr "" "`ProcessPoolExecutor` 的程式碼應透過傳遞 ``mp_context=multiprocessing." "get_context(\"fork\")`` 參數來明確指定。" -#: ../../library/concurrent.futures.rst:293 +#: ../../library/concurrent.futures.rst:297 msgid "" "The *max_tasks_per_child* argument was added to allow users to control the " "lifetime of workers in the pool." msgstr "" "新增了 *max_tasks_per_child* 引數以允許使用者控制池中 worker 的生命週期。" -#: ../../library/concurrent.futures.rst:297 +#: ../../library/concurrent.futures.rst:301 msgid "" "On POSIX systems, if your application has multiple threads and the :mod:" "`multiprocessing` context uses the ``\"fork\"`` start method: The :func:`os." @@ -537,11 +543,17 @@ msgstr "" "能會引發 :exc:`DeprecationWarning`。傳遞一個 *mp_context* 以配置為使用不同的" "啟動方法。更多說明請參閱 :func:`os.fork` 文件。" -#: ../../library/concurrent.futures.rst:308 +#: ../../library/concurrent.futures.rst:309 +msgid "" +"*max_workers* uses :func:`os.process_cpu_count` by default, instead of :func:" +"`os.cpu_count`." +msgstr "" + +#: ../../library/concurrent.futures.rst:316 msgid "ProcessPoolExecutor Example" msgstr "ProcessPoolExecutor 範例" -#: ../../library/concurrent.futures.rst:311 +#: ../../library/concurrent.futures.rst:319 msgid "" "import concurrent.futures\n" "import math\n" @@ -609,11 +621,11 @@ msgstr "" "if __name__ == '__main__':\n" " main()" -#: ../../library/concurrent.futures.rst:346 +#: ../../library/concurrent.futures.rst:354 msgid "Future Objects" msgstr "Future 物件" -#: ../../library/concurrent.futures.rst:348 +#: ../../library/concurrent.futures.rst:356 msgid "" "The :class:`Future` class encapsulates the asynchronous execution of a " "callable. :class:`Future` instances are created by :meth:`Executor.submit`." @@ -621,7 +633,7 @@ msgstr "" ":class:`Future` 類別封裝了可呼叫物件的非同步執行。:class:`Future` 實例由 :" "meth:`Executor.submit` 建立。" -#: ../../library/concurrent.futures.rst:353 +#: ../../library/concurrent.futures.rst:361 msgid "" "Encapsulates the asynchronous execution of a callable. :class:`Future` " "instances are created by :meth:`Executor.submit` and should not be created " @@ -630,7 +642,7 @@ msgstr "" "封裝可呼叫物件的非同步執行。:class:`Future` 實例由 :meth:`Executor.submit` 建" "立,且除測試外不應直接建立。" -#: ../../library/concurrent.futures.rst:359 +#: ../../library/concurrent.futures.rst:367 msgid "" "Attempt to cancel the call. If the call is currently being executed or " "finished running and cannot be cancelled then the method will return " @@ -640,22 +652,22 @@ msgstr "" "嘗試取消呼叫。如果呼叫當前正在執行或已完成運行且無法取消,則該方法將回傳 " "``False``,否則呼叫將被取消並且該方法將回傳 ``True``。" -#: ../../library/concurrent.futures.rst:366 +#: ../../library/concurrent.futures.rst:374 msgid "Return ``True`` if the call was successfully cancelled." msgstr "如果該呼叫成功被取消,則回傳 ``True``。" -#: ../../library/concurrent.futures.rst:370 +#: ../../library/concurrent.futures.rst:378 msgid "" "Return ``True`` if the call is currently being executed and cannot be " "cancelled." msgstr "如果呼叫正在執行且無法取消,則回傳 ``True``。" -#: ../../library/concurrent.futures.rst:375 +#: ../../library/concurrent.futures.rst:383 msgid "" "Return ``True`` if the call was successfully cancelled or finished running." msgstr "如果呼叫成功被取消或結束運行,則回傳 ``True``。" -#: ../../library/concurrent.futures.rst:380 +#: ../../library/concurrent.futures.rst:388 msgid "" "Return the value returned by the call. If the call hasn't yet completed then " "this method will wait up to *timeout* seconds. If the call hasn't completed " @@ -667,19 +679,19 @@ msgstr "" "叫在 *timeout* 秒內未完成,則會引發 :exc:`TimeoutError`。*timeout* 可以是整數" "或浮點數。如果未指定 *timeout* 或為 ``None``,則等待時間就不會有限制。" -#: ../../library/concurrent.futures.rst:387 -#: ../../library/concurrent.futures.rst:401 +#: ../../library/concurrent.futures.rst:395 +#: ../../library/concurrent.futures.rst:409 msgid "" "If the future is cancelled before completing then :exc:`.CancelledError` " "will be raised." msgstr "如果 future 在完成之前被取消,那麼 :exc:`.CancelledError` 將被引發。" -#: ../../library/concurrent.futures.rst:390 +#: ../../library/concurrent.futures.rst:398 msgid "" "If the call raised an exception, this method will raise the same exception." msgstr "如果該呼叫引發了例外,此方法將引發相同的例外。" -#: ../../library/concurrent.futures.rst:394 +#: ../../library/concurrent.futures.rst:402 msgid "" "Return the exception raised by the call. If the call hasn't yet completed " "then this method will wait up to *timeout* seconds. If the call hasn't " @@ -691,11 +703,11 @@ msgstr "" "呼叫在 *timeout* 秒內未完成,則會引發 :exc:`TimeoutError`。 *timeout* 可以是" "整數或浮點數。如果未指定 *timeout* 或為 ``None``,則等待時間就不會有限制。" -#: ../../library/concurrent.futures.rst:404 +#: ../../library/concurrent.futures.rst:412 msgid "If the call completed without raising, ``None`` is returned." msgstr "如果呼叫在沒有引發的情況下完成,則回傳 ``None``。" -#: ../../library/concurrent.futures.rst:408 +#: ../../library/concurrent.futures.rst:416 msgid "" "Attaches the callable *fn* to the future. *fn* will be called, with the " "future as its only argument, when the future is cancelled or finishes " @@ -704,7 +716,7 @@ msgstr "" "將可呼叫的 *fn* 附加到 future 上。當 future 被取消或完成運行時,*fn* 將被以 " "future 作為其唯一引數來呼叫。" -#: ../../library/concurrent.futures.rst:412 +#: ../../library/concurrent.futures.rst:420 msgid "" "Added callables are called in the order that they were added and are always " "called in a thread belonging to the process that added them. If the " @@ -716,19 +728,19 @@ msgstr "" "如果可呼叫物件引發 :exc:`Exception` 子類別,它將被記錄 (log) 並忽略。如果可呼" "叫物件引發 :exc:`BaseException` 子類別,該行為未定義。" -#: ../../library/concurrent.futures.rst:418 +#: ../../library/concurrent.futures.rst:426 msgid "" "If the future has already completed or been cancelled, *fn* will be called " "immediately." msgstr "如果 future 已經完成或被取消,*fn* 將立即被呼叫。" -#: ../../library/concurrent.futures.rst:421 +#: ../../library/concurrent.futures.rst:429 msgid "" "The following :class:`Future` methods are meant for use in unit tests and :" "class:`Executor` implementations." msgstr "以下 :class:`Future` 方法旨在用於單元測試和 :class:`Executor` 實作。" -#: ../../library/concurrent.futures.rst:426 +#: ../../library/concurrent.futures.rst:434 msgid "" "This method should only be called by :class:`Executor` implementations " "before executing the work associated with the :class:`Future` and by unit " @@ -737,7 +749,7 @@ msgstr "" "此方法只能在與 :class:`Future` 關聯的工作被執行之前於 :class:`Executor` 實作" "中呼叫,或者在單元測試中呼叫。" -#: ../../library/concurrent.futures.rst:430 +#: ../../library/concurrent.futures.rst:438 msgid "" "If the method returns ``False`` then the :class:`Future` was cancelled, i." "e. :meth:`Future.cancel` was called and returned ``True``. Any threads " @@ -748,7 +760,7 @@ msgstr "" "cancel` 被呼叫並回傳 ``True``。任何等待 :class:`Future` 完成的執行緒(即透" "過 :func:`as_completed` 或 :func:`wait`)將被喚醒。" -#: ../../library/concurrent.futures.rst:435 +#: ../../library/concurrent.futures.rst:443 msgid "" "If the method returns ``True`` then the :class:`Future` was not cancelled " "and has been put in the running state, i.e. calls to :meth:`Future.running` " @@ -757,7 +769,7 @@ msgstr "" "如果該方法回傳 ``True`` 則代表 :class:`Future` 未被取消並已進入運行狀態,意即" "呼叫 :meth:`Future.running` 將回傳 ``True``。" -#: ../../library/concurrent.futures.rst:439 +#: ../../library/concurrent.futures.rst:447 msgid "" "This method can only be called once and cannot be called after :meth:`Future." "set_result` or :meth:`Future.set_exception` have been called." @@ -765,20 +777,20 @@ msgstr "" "此方法只能呼叫一次,且不能在呼叫 :meth:`Future.set_result` 或 :meth:`Future." "set_exception` 之後呼叫。" -#: ../../library/concurrent.futures.rst:445 +#: ../../library/concurrent.futures.rst:453 msgid "" "Sets the result of the work associated with the :class:`Future` to *result*." msgstr "將與 :class:`Future` 關聯的工作結果設定為 *result*。" -#: ../../library/concurrent.futures.rst:448 -#: ../../library/concurrent.futures.rst:461 +#: ../../library/concurrent.futures.rst:456 +#: ../../library/concurrent.futures.rst:469 msgid "" "This method should only be used by :class:`Executor` implementations and " "unit tests." msgstr "此方法只能在 :class:`Executor` 實作中和單元測試中使用。" -#: ../../library/concurrent.futures.rst:451 -#: ../../library/concurrent.futures.rst:464 +#: ../../library/concurrent.futures.rst:459 +#: ../../library/concurrent.futures.rst:472 msgid "" "This method raises :exc:`concurrent.futures.InvalidStateError` if the :class:" "`Future` is already done." @@ -786,18 +798,18 @@ msgstr "" "如果 :class:`Future` 已經完成,此方法會引發 :exc:`concurrent.futures." "InvalidStateError`。" -#: ../../library/concurrent.futures.rst:458 +#: ../../library/concurrent.futures.rst:466 msgid "" "Sets the result of the work associated with the :class:`Future` to the :" "class:`Exception` *exception*." msgstr "" "將與 :class:`Future` 關聯的工作結果設定為 :class:`Exception` *exception*。" -#: ../../library/concurrent.futures.rst:470 +#: ../../library/concurrent.futures.rst:478 msgid "Module Functions" msgstr "模組函式" -#: ../../library/concurrent.futures.rst:474 +#: ../../library/concurrent.futures.rst:482 msgid "" "Wait for the :class:`Future` instances (possibly created by different :class:" "`Executor` instances) given by *fs* to complete. Duplicate futures given to " @@ -813,7 +825,7 @@ msgstr "" "完成的 future(已完成或被取消的 future)。第二組名為 ``not_done``,包含未完成" "的 future(未定或運行中的 future)。" -#: ../../library/concurrent.futures.rst:482 +#: ../../library/concurrent.futures.rst:490 msgid "" "*timeout* can be used to control the maximum number of seconds to wait " "before returning. *timeout* can be an int or float. If *timeout* is not " @@ -822,25 +834,25 @@ msgstr "" "*timeout* 可用於控制回傳前等待的最大秒數。*timeout* 可以是整數或浮點數。如果" "未指定 *timeout* 或為 ``None``,則等待時間就沒有限制。" -#: ../../library/concurrent.futures.rst:486 +#: ../../library/concurrent.futures.rst:494 msgid "" "*return_when* indicates when this function should return. It must be one of " "the following constants:" msgstr "*return_when* 表示此函式應回傳的時間。它必須是以下常數之一:" -#: ../../library/concurrent.futures.rst:492 +#: ../../library/concurrent.futures.rst:500 msgid "Constant" msgstr "常數" -#: ../../library/concurrent.futures.rst:493 +#: ../../library/concurrent.futures.rst:501 msgid "Description" msgstr "描述" -#: ../../library/concurrent.futures.rst:496 +#: ../../library/concurrent.futures.rst:504 msgid "The function will return when any future finishes or is cancelled." msgstr "當任何 future 完成或被取消時,該函式就會回傳。" -#: ../../library/concurrent.futures.rst:499 +#: ../../library/concurrent.futures.rst:507 msgid "" "The function will return when any future finishes by raising an exception. " "If no future raises an exception then it is equivalent to :const:" @@ -849,11 +861,11 @@ msgstr "" "該函式會在任何 future 透過引發例外而完結時回傳。如果 future 沒有引發例外,那" "麼它等同於 :const:`ALL_COMPLETED`。" -#: ../../library/concurrent.futures.rst:504 +#: ../../library/concurrent.futures.rst:512 msgid "The function will return when all futures finish or are cancelled." msgstr "當所有 future 都完成或被取消時,該函式才會回傳。" -#: ../../library/concurrent.futures.rst:508 +#: ../../library/concurrent.futures.rst:516 msgid "" "Returns an iterator over the :class:`Future` instances (possibly created by " "different :class:`Executor` instances) given by *fs* that yields futures as " @@ -873,36 +885,36 @@ msgstr "" "`TimeoutError`。*timeout* 可以是整數或浮點數。如果未指定 *timeout* 或為 " "``None``,則等待時間就沒有限制。" -#: ../../library/concurrent.futures.rst:521 +#: ../../library/concurrent.futures.rst:529 msgid ":pep:`3148` -- futures - execute computations asynchronously" msgstr ":pep:`3148` -- futures - 非同步地執行運算" -#: ../../library/concurrent.futures.rst:522 +#: ../../library/concurrent.futures.rst:530 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "描述此功能並提出被包含於 Python 標準函式庫中的提案。" -#: ../../library/concurrent.futures.rst:527 +#: ../../library/concurrent.futures.rst:535 msgid "Exception classes" msgstr "例外類別" -#: ../../library/concurrent.futures.rst:533 +#: ../../library/concurrent.futures.rst:541 msgid "Raised when a future is cancelled." msgstr "當 future 被取消時引發。" -#: ../../library/concurrent.futures.rst:537 +#: ../../library/concurrent.futures.rst:545 msgid "" "A deprecated alias of :exc:`TimeoutError`, raised when a future operation " "exceeds the given timeout." msgstr "" ":exc:`TimeoutError` 的棄用別名,在 future 操作超過給定超時 (timeout) 時引發。" -#: ../../library/concurrent.futures.rst:542 +#: ../../library/concurrent.futures.rst:550 msgid "This class was made an alias of :exc:`TimeoutError`." msgstr "這個類別是 :exc:`TimeoutError` 的別名。" -#: ../../library/concurrent.futures.rst:547 +#: ../../library/concurrent.futures.rst:555 msgid "" "Derived from :exc:`RuntimeError`, this exception class is raised when an " "executor is broken for some reason, and cannot be used to submit or execute " @@ -911,13 +923,13 @@ msgstr "" "衍生自 :exc:`RuntimeError`,當執行器因某種原因損壞時會引發此例外類別,並且不" "能用於提交或執行新任務。" -#: ../../library/concurrent.futures.rst:555 +#: ../../library/concurrent.futures.rst:563 msgid "" "Raised when an operation is performed on a future that is not allowed in the " "current state." msgstr "當前狀態下不允許的 future 操作被執行時而引發。" -#: ../../library/concurrent.futures.rst:564 +#: ../../library/concurrent.futures.rst:572 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor`, this exception class " "is raised when one of the workers of a :class:`~concurrent.futures." @@ -926,7 +938,7 @@ msgstr "" "衍生自 :exc:`~concurrent.futures.BrokenExecutor`,當 :class:`~concurrent." "futures.ThreadPoolExecutor` 的其中一個 worker 初始化失敗時會引發此例外類別。" -#: ../../library/concurrent.futures.rst:575 +#: ../../library/concurrent.futures.rst:583 msgid "" "Derived from :exc:`~concurrent.futures.BrokenExecutor` (formerly :exc:" "`RuntimeError`), this exception class is raised when one of the workers of " diff --git a/library/concurrent.po b/library/concurrent.po index bfa5989eb2..43635439de 100644 --- a/library/concurrent.po +++ b/library/concurrent.po @@ -6,7 +6,7 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 10:36+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/configparser.po b/library/configparser.po index 47e50b76fd..0943f36e02 100644 --- a/library/configparser.po +++ b/library/configparser.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -187,7 +187,7 @@ msgid "" "and stored in lowercase [1]_." msgstr "" -#: ../../library/configparser.rst:147 ../../library/configparser.rst:966 +#: ../../library/configparser.rst:147 ../../library/configparser.rst:992 msgid "" "It is possible to read several configurations into a single :class:" "`ConfigParser`, where the most recently added configuration has the highest " @@ -197,7 +197,7 @@ msgid "" "``example.ini`` file." msgstr "" -#: ../../library/configparser.rst:154 ../../library/configparser.rst:973 +#: ../../library/configparser.rst:154 ../../library/configparser.rst:999 msgid "" "[DEFAULT]\n" "ServerAliveInterval = -1" @@ -205,7 +205,7 @@ msgstr "" "[DEFAULT]\n" "ServerAliveInterval = -1" -#: ../../library/configparser.rst:159 ../../library/configparser.rst:978 +#: ../../library/configparser.rst:159 ../../library/configparser.rst:1004 msgid "" ">>> config_override = configparser.ConfigParser()\n" ">>> config_override['DEFAULT'] = {'ServerAliveInterval': '-1'}\n" @@ -403,16 +403,24 @@ msgstr "" #: ../../library/configparser.rst:282 msgid "" +"The first section name may be omitted if the parser is configured to allow " +"an unnamed top level section with ``allow_unnamed_section=True``. In this " +"case, the keys/values may be retrieved by :const:`UNNAMED_SECTION` as in " +"``config[UNNAMED_SECTION]``." +msgstr "" + +#: ../../library/configparser.rst:287 +msgid "" "Configuration files may include comments, prefixed by specific characters " "(``#`` and ``;`` by default [1]_). Comments may appear on their own on an " "otherwise empty line, possibly indented. [1]_" msgstr "" -#: ../../library/configparser.rst:286 ../../library/configparser.rst:349 +#: ../../library/configparser.rst:291 ../../library/configparser.rst:375 msgid "For example:" msgstr "舉例來說:" -#: ../../library/configparser.rst:288 +#: ../../library/configparser.rst:293 msgid "" "[Simple Values]\n" "key=value\n" @@ -457,18 +465,42 @@ msgid "" " # Did I mention we can indent comments, too?" msgstr "" -#: ../../library/configparser.rst:334 +#: ../../library/configparser.rst:341 +msgid "Unnamed Sections" +msgstr "" + +#: ../../library/configparser.rst:343 +msgid "" +"The name of the first section (or unique) may be omitted and values " +"retrieved by the :const:`UNNAMED_SECTION` attribute." +msgstr "" + +#: ../../library/configparser.rst:346 +msgid "" +">>> config = \"\"\"\n" +"... option = value\n" +"...\n" +"... [ Section 2 ]\n" +"... another = val\n" +"... \"\"\"\n" +">>> unnamed = configparser.ConfigParser(allow_unnamed_section=True)\n" +">>> unnamed.read_string(config)\n" +">>> unnamed.get(configparser.UNNAMED_SECTION, 'option')\n" +"'value'" +msgstr "" + +#: ../../library/configparser.rst:360 msgid "Interpolation of values" msgstr "" -#: ../../library/configparser.rst:336 +#: ../../library/configparser.rst:362 msgid "" "On top of the core functionality, :class:`ConfigParser` supports " "interpolation. This means values can be preprocessed before returning them " "from ``get()`` calls." msgstr "" -#: ../../library/configparser.rst:344 +#: ../../library/configparser.rst:370 msgid "" "The default implementation used by :class:`ConfigParser`. It enables values " "to contain format strings which refer to other values in the same section, " @@ -476,7 +508,7 @@ msgid "" "can be provided on initialization." msgstr "" -#: ../../library/configparser.rst:351 +#: ../../library/configparser.rst:377 msgid "" "[Paths]\n" "home_dir: /Users\n" @@ -489,7 +521,7 @@ msgid "" "gain: 80%%" msgstr "" -#: ../../library/configparser.rst:362 +#: ../../library/configparser.rst:388 msgid "" "In the example above, :class:`ConfigParser` with *interpolation* set to " "``BasicInterpolation()`` would resolve ``%(home_dir)s`` to the value of " @@ -499,14 +531,14 @@ msgid "" "specific order in the configuration file." msgstr "" -#: ../../library/configparser.rst:369 +#: ../../library/configparser.rst:395 msgid "" "With ``interpolation`` set to ``None``, the parser would simply return " "``%(my_dir)s/Pictures`` as the value of ``my_pictures`` and ``%(home_dir)s/" "lumberjack`` as the value of ``my_dir``." msgstr "" -#: ../../library/configparser.rst:377 +#: ../../library/configparser.rst:403 msgid "" "An alternative handler for interpolation which implements a more advanced " "syntax, used for instance in ``zc.buildout``. Extended interpolation is " @@ -516,13 +548,13 @@ msgid "" "possibly the default values from the special section)." msgstr "" -#: ../../library/configparser.rst:384 +#: ../../library/configparser.rst:410 msgid "" "For example, the configuration specified above with basic interpolation, " "would look like this with extended interpolation:" msgstr "" -#: ../../library/configparser.rst:387 +#: ../../library/configparser.rst:413 msgid "" "[Paths]\n" "home_dir: /Users\n" @@ -535,11 +567,11 @@ msgid "" "cost: $$80" msgstr "" -#: ../../library/configparser.rst:398 +#: ../../library/configparser.rst:424 msgid "Values from other sections can be fetched as well:" msgstr "" -#: ../../library/configparser.rst:400 +#: ../../library/configparser.rst:426 msgid "" "[Common]\n" "home_dir: /Users\n" @@ -575,11 +607,11 @@ msgstr "" "my_pictures: ${my_dir}/Pictures\n" "python_dir: ${Frameworks:path}/Python/Versions/${Frameworks:Python}" -#: ../../library/configparser.rst:420 +#: ../../library/configparser.rst:446 msgid "Mapping Protocol Access" msgstr "" -#: ../../library/configparser.rst:424 +#: ../../library/configparser.rst:450 msgid "" "Mapping protocol access is a generic name for functionality that enables " "using custom objects as if they were dictionaries. In case of :mod:" @@ -587,7 +619,7 @@ msgid "" "``parser['section']['option']`` notation." msgstr "" -#: ../../library/configparser.rst:429 +#: ../../library/configparser.rst:455 msgid "" "``parser['section']`` in particular returns a proxy for the section's data " "in the parser. This means that the values are not copied but they are taken " @@ -596,7 +628,7 @@ msgid "" "original parser." msgstr "" -#: ../../library/configparser.rst:435 +#: ../../library/configparser.rst:461 msgid "" ":mod:`configparser` objects behave as close to actual dictionaries as " "possible. The mapping interface is complete and adheres to the :class:" @@ -604,7 +636,7 @@ msgid "" "that should be taken into account:" msgstr "" -#: ../../library/configparser.rst:440 +#: ../../library/configparser.rst:466 msgid "" "By default, all keys in sections are accessible in a case-insensitive manner " "[1]_. E.g. ``for option in parser[\"section\"]`` yields only " @@ -613,7 +645,7 @@ msgid "" "expressions return ``True``::" msgstr "" -#: ../../library/configparser.rst:445 +#: ../../library/configparser.rst:471 msgid "" "\"a\" in parser[\"section\"]\n" "\"A\" in parser[\"section\"]" @@ -621,7 +653,7 @@ msgstr "" "\"a\" in parser[\"section\"]\n" "\"A\" in parser[\"section\"]" -#: ../../library/configparser.rst:448 +#: ../../library/configparser.rst:474 msgid "" "All sections include ``DEFAULTSECT`` values as well which means that ``." "clear()`` on a section may not leave the section visibly empty. This is " @@ -631,30 +663,30 @@ msgid "" "default value causes a :exc:`KeyError`." msgstr "" -#: ../../library/configparser.rst:455 +#: ../../library/configparser.rst:481 msgid "``DEFAULTSECT`` cannot be removed from the parser:" msgstr "" -#: ../../library/configparser.rst:457 +#: ../../library/configparser.rst:483 msgid "trying to delete it raises :exc:`ValueError`," msgstr "" -#: ../../library/configparser.rst:459 +#: ../../library/configparser.rst:485 msgid "``parser.clear()`` leaves it intact," msgstr "" -#: ../../library/configparser.rst:461 +#: ../../library/configparser.rst:487 msgid "``parser.popitem()`` never returns it." msgstr "" -#: ../../library/configparser.rst:463 +#: ../../library/configparser.rst:489 msgid "" "``parser.get(section, option, **kwargs)`` - the second argument is **not** a " "fallback value. Note however that the section-level ``get()`` methods are " "compatible both with the mapping protocol and the classic configparser API." msgstr "" -#: ../../library/configparser.rst:467 +#: ../../library/configparser.rst:493 msgid "" "``parser.items()`` is compatible with the mapping protocol (returns a list " "of *section_name*, *section_proxy* pairs including the DEFAULTSECT). " @@ -664,18 +696,18 @@ msgid "" "(unless ``raw=True`` is provided)." msgstr "" -#: ../../library/configparser.rst:474 +#: ../../library/configparser.rst:500 msgid "" "The mapping protocol is implemented on top of the existing legacy API so " "that subclasses overriding the original interface still should have mappings " "working as expected." msgstr "" -#: ../../library/configparser.rst:480 +#: ../../library/configparser.rst:506 msgid "Customizing Parser Behaviour" msgstr "" -#: ../../library/configparser.rst:482 +#: ../../library/configparser.rst:508 msgid "" "There are nearly as many INI format variants as there are applications using " "it. :mod:`configparser` goes a long way to provide support for the largest " @@ -684,17 +716,17 @@ msgid "" "customize some of the features." msgstr "" -#: ../../library/configparser.rst:488 +#: ../../library/configparser.rst:514 msgid "" "The most common way to change the way a specific config parser works is to " "use the :meth:`!__init__` options:" msgstr "" -#: ../../library/configparser.rst:491 +#: ../../library/configparser.rst:517 msgid "*defaults*, default value: ``None``" msgstr "" -#: ../../library/configparser.rst:493 +#: ../../library/configparser.rst:519 msgid "" "This option accepts a dictionary of key-value pairs which will be initially " "put in the ``DEFAULT`` section. This makes for an elegant way to support " @@ -702,17 +734,17 @@ msgid "" "the documented default." msgstr "" -#: ../../library/configparser.rst:498 +#: ../../library/configparser.rst:524 msgid "" "Hint: if you want to specify default values for a specific section, use :" "meth:`~ConfigParser.read_dict` before you read the actual file." msgstr "" -#: ../../library/configparser.rst:501 +#: ../../library/configparser.rst:527 msgid "*dict_type*, default value: :class:`dict`" msgstr "" -#: ../../library/configparser.rst:503 +#: ../../library/configparser.rst:529 msgid "" "This option has a major impact on how the mapping protocol will behave and " "how the written configuration files look. With the standard dictionary, " @@ -720,20 +752,20 @@ msgid "" "goes for options within sections." msgstr "" -#: ../../library/configparser.rst:508 +#: ../../library/configparser.rst:534 msgid "" "An alternative dictionary type can be used for example to sort sections and " "options on write-back." msgstr "" -#: ../../library/configparser.rst:511 +#: ../../library/configparser.rst:537 msgid "" "Please note: there are ways to add a set of key-value pairs in a single " "operation. When you use a regular dictionary in those operations, the order " "of the keys will be ordered. For example:" msgstr "" -#: ../../library/configparser.rst:515 +#: ../../library/configparser.rst:541 msgid "" ">>> parser = configparser.ConfigParser()\n" ">>> parser.read_dict({'section1': {'key1': 'value1',\n" @@ -767,11 +799,11 @@ msgstr "" ">>> [option for option in parser['section3']]\n" "['foo', 'bar', 'baz']" -#: ../../library/configparser.rst:533 +#: ../../library/configparser.rst:559 msgid "*allow_no_value*, default value: ``False``" msgstr "" -#: ../../library/configparser.rst:535 +#: ../../library/configparser.rst:561 msgid "" "Some configuration files are known to include settings without values, but " "which otherwise conform to the syntax supported by :mod:`configparser`. The " @@ -779,7 +811,7 @@ msgid "" "such values should be accepted:" msgstr "" -#: ../../library/configparser.rst:540 +#: ../../library/configparser.rst:566 msgid "" ">>> import configparser\n" "\n" @@ -810,32 +842,32 @@ msgid "" "KeyError: 'does-not-exist'" msgstr "" -#: ../../library/configparser.rst:570 +#: ../../library/configparser.rst:596 msgid "*delimiters*, default value: ``('=', ':')``" msgstr "" -#: ../../library/configparser.rst:572 +#: ../../library/configparser.rst:598 msgid "" "Delimiters are substrings that delimit keys from values within a section. " "The first occurrence of a delimiting substring on a line is considered a " "delimiter. This means values (but not keys) can contain the delimiters." msgstr "" -#: ../../library/configparser.rst:576 +#: ../../library/configparser.rst:602 msgid "" "See also the *space_around_delimiters* argument to :meth:`ConfigParser." "write`." msgstr "" -#: ../../library/configparser.rst:579 +#: ../../library/configparser.rst:605 msgid "*comment_prefixes*, default value: ``('#', ';')``" msgstr "" -#: ../../library/configparser.rst:581 +#: ../../library/configparser.rst:607 msgid "*inline_comment_prefixes*, default value: ``None``" msgstr "" -#: ../../library/configparser.rst:583 +#: ../../library/configparser.rst:609 msgid "" "Comment prefixes are strings that indicate the start of a valid comment " "within a config file. *comment_prefixes* are used only on otherwise empty " @@ -845,13 +877,13 @@ msgid "" "used as prefixes for whole line comments." msgstr "" -#: ../../library/configparser.rst:590 +#: ../../library/configparser.rst:616 msgid "" "In previous versions of :mod:`configparser` behaviour matched " "``comment_prefixes=('#',';')`` and ``inline_comment_prefixes=(';',)``." msgstr "" -#: ../../library/configparser.rst:594 +#: ../../library/configparser.rst:620 msgid "" "Please note that config parsers don't support escaping of comment prefixes " "so using *inline_comment_prefixes* may prevent users from specifying option " @@ -861,7 +893,7 @@ msgid "" "values is to interpolate the prefix, for example::" msgstr "" -#: ../../library/configparser.rst:601 +#: ../../library/configparser.rst:627 msgid "" ">>> from configparser import ConfigParser, ExtendedInterpolation\n" ">>> parser = ConfigParser(interpolation=ExtendedInterpolation())\n" @@ -903,11 +935,11 @@ msgid "" "line #3" msgstr "" -#: ../../library/configparser.rst:640 +#: ../../library/configparser.rst:666 msgid "*strict*, default value: ``True``" msgstr "" -#: ../../library/configparser.rst:642 +#: ../../library/configparser.rst:668 msgid "" "When set to ``True``, the parser will not allow for any section or option " "duplicates while reading from a single source (using :meth:`~ConfigParser." @@ -915,17 +947,17 @@ msgid "" "read_dict`). It is recommended to use strict parsers in new applications." msgstr "" -#: ../../library/configparser.rst:647 +#: ../../library/configparser.rst:673 msgid "" "In previous versions of :mod:`configparser` behaviour matched " "``strict=False``." msgstr "" -#: ../../library/configparser.rst:651 +#: ../../library/configparser.rst:677 msgid "*empty_lines_in_values*, default value: ``True``" msgstr "" -#: ../../library/configparser.rst:653 +#: ../../library/configparser.rst:679 msgid "" "In config parsers, values can span multiple lines as long as they are " "indented more than the key that holds them. By default parsers also let " @@ -935,7 +967,7 @@ msgid "" "lose track of the file structure. Take for instance:" msgstr "" -#: ../../library/configparser.rst:660 +#: ../../library/configparser.rst:686 msgid "" "[Section]\n" "key = multiline\n" @@ -944,7 +976,7 @@ msgid "" " this = is still a part of the multiline value of 'key'" msgstr "" -#: ../../library/configparser.rst:668 +#: ../../library/configparser.rst:694 msgid "" "This can be especially problematic for the user to see if she's using a " "proportional font to edit the file. That is why when your application does " @@ -953,13 +985,13 @@ msgid "" "would produce two keys, ``key`` and ``this``." msgstr "" -#: ../../library/configparser.rst:674 +#: ../../library/configparser.rst:700 msgid "" "*default_section*, default value: ``configparser.DEFAULTSECT`` (that is: " "``\"DEFAULT\"``)" msgstr "" -#: ../../library/configparser.rst:677 +#: ../../library/configparser.rst:703 msgid "" "The convention of allowing a special section of default values for other " "sections or interpolation purposes is a powerful concept of this library, " @@ -973,11 +1005,11 @@ msgid "" "files from one format to another)." msgstr "" -#: ../../library/configparser.rst:688 +#: ../../library/configparser.rst:714 msgid "*interpolation*, default value: ``configparser.BasicInterpolation``" msgstr "" -#: ../../library/configparser.rst:690 +#: ../../library/configparser.rst:716 msgid "" "Interpolation behaviour may be customized by providing a custom handler " "through the *interpolation* argument. ``None`` can be used to turn off " @@ -987,11 +1019,11 @@ msgid "" "`RawConfigParser` has a default value of ``None``." msgstr "" -#: ../../library/configparser.rst:697 +#: ../../library/configparser.rst:723 msgid "*converters*, default value: not set" msgstr "" -#: ../../library/configparser.rst:699 +#: ../../library/configparser.rst:725 msgid "" "Config parsers provide option value getters that perform type conversion. " "By default :meth:`~ConfigParser.getint`, :meth:`~ConfigParser.getfloat`, " @@ -1005,7 +1037,7 @@ msgid "" "``parser_instance['section'].getdecimal('key', 0)``." msgstr "" -#: ../../library/configparser.rst:710 +#: ../../library/configparser.rst:736 msgid "" "If the converter needs to access the state of the parser, it can be " "implemented as a method on a config parser subclass. If the name of this " @@ -1013,14 +1045,14 @@ msgid "" "the dict-compatible form (see the ``getdecimal()`` example above)." msgstr "" -#: ../../library/configparser.rst:715 +#: ../../library/configparser.rst:741 msgid "" "More advanced customization may be achieved by overriding default values of " "these parser attributes. The defaults are defined on the classes, so they " "may be overridden by subclasses or by attribute assignment." msgstr "" -#: ../../library/configparser.rst:721 +#: ../../library/configparser.rst:747 msgid "" "By default when using :meth:`~ConfigParser.getboolean`, config parsers " "consider the following values ``True``: ``'1'``, ``'yes'``, ``'true'``, " @@ -1029,7 +1061,7 @@ msgid "" "strings and their Boolean outcomes. For example:" msgstr "" -#: ../../library/configparser.rst:727 +#: ../../library/configparser.rst:753 msgid "" ">>> custom = configparser.ConfigParser()\n" ">>> custom['section1'] = {'funky': 'nope'}\n" @@ -1051,13 +1083,13 @@ msgstr "" ">>> custom['section1'].getboolean('funky')\n" "False" -#: ../../library/configparser.rst:739 +#: ../../library/configparser.rst:765 msgid "" "Other typical Boolean pairs include ``accept``/``reject`` or ``enabled``/" "``disabled``." msgstr "" -#: ../../library/configparser.rst:745 +#: ../../library/configparser.rst:771 msgid "" "This method transforms option names on every read, get, or set operation. " "The default converts the name to lowercase. This also means that when a " @@ -1065,7 +1097,7 @@ msgid "" "method if that's unsuitable. For example:" msgstr "" -#: ../../library/configparser.rst:751 +#: ../../library/configparser.rst:777 msgid "" ">>> config = \"\"\"\n" "... [Section1]\n" @@ -1109,14 +1141,14 @@ msgstr "" ">>> list(custom['Section2'].keys())\n" "['AnotherKey']" -#: ../../library/configparser.rst:775 +#: ../../library/configparser.rst:801 msgid "" "The optionxform function transforms option names to a canonical form. This " "should be an idempotent function: if the name is already in canonical form, " "it should be returned unchanged." msgstr "" -#: ../../library/configparser.rst:782 +#: ../../library/configparser.rst:808 msgid "" "A compiled regular expression used to parse section headers. The default " "matches ``[section]`` to the name ``\"section\"``. Whitespace is considered " @@ -1125,7 +1157,7 @@ msgid "" "example:" msgstr "" -#: ../../library/configparser.rst:788 +#: ../../library/configparser.rst:814 msgid "" ">>> import re\n" ">>> config = \"\"\"\n" @@ -1163,18 +1195,18 @@ msgstr "" ">>> custom.sections()\n" "['Section 1', 'Section 2']" -#: ../../library/configparser.rst:810 +#: ../../library/configparser.rst:836 msgid "" "While ConfigParser objects also use an ``OPTCRE`` attribute for recognizing " "option lines, it's not recommended to override it because that would " "interfere with constructor options *allow_no_value* and *delimiters*." msgstr "" -#: ../../library/configparser.rst:816 +#: ../../library/configparser.rst:842 msgid "Legacy API Examples" msgstr "" -#: ../../library/configparser.rst:818 +#: ../../library/configparser.rst:844 msgid "" "Mainly because of backwards compatibility concerns, :mod:`configparser` " "provides also a legacy API with explicit ``get``/``set`` methods. While " @@ -1183,11 +1215,11 @@ msgid "" "advanced, low-level and downright counterintuitive." msgstr "" -#: ../../library/configparser.rst:824 +#: ../../library/configparser.rst:850 msgid "An example of writing to a configuration file::" msgstr "" -#: ../../library/configparser.rst:826 +#: ../../library/configparser.rst:852 msgid "" "import configparser\n" "\n" @@ -1211,11 +1243,11 @@ msgid "" " config.write(configfile)" msgstr "" -#: ../../library/configparser.rst:847 +#: ../../library/configparser.rst:873 msgid "An example of reading the configuration file again::" msgstr "" -#: ../../library/configparser.rst:849 +#: ../../library/configparser.rst:875 msgid "" "import configparser\n" "\n" @@ -1234,11 +1266,11 @@ msgid "" " print(config.get('Section1', 'foo'))" msgstr "" -#: ../../library/configparser.rst:865 +#: ../../library/configparser.rst:891 msgid "To get interpolation, use :class:`ConfigParser`::" msgstr "" -#: ../../library/configparser.rst:867 +#: ../../library/configparser.rst:893 msgid "" "import configparser\n" "\n" @@ -1273,13 +1305,13 @@ msgid "" " # -> None" msgstr "" -#: ../../library/configparser.rst:898 +#: ../../library/configparser.rst:924 msgid "" "Default values are available in both types of ConfigParsers. They are used " "in interpolation if an option used is not defined elsewhere. ::" msgstr "" -#: ../../library/configparser.rst:901 +#: ../../library/configparser.rst:927 msgid "" "import configparser\n" "\n" @@ -1293,11 +1325,11 @@ msgid "" "print(config.get('Section1', 'foo')) # -> \"Life is hard!\"" msgstr "" -#: ../../library/configparser.rst:916 +#: ../../library/configparser.rst:942 msgid "ConfigParser Objects" msgstr "ConfigParser 物件" -#: ../../library/configparser.rst:920 +#: ../../library/configparser.rst:946 msgid "" "The main configuration parser. When *defaults* is given, it is initialized " "into the dictionary of intrinsic defaults. When *dict_type* is given, it " @@ -1305,7 +1337,7 @@ msgid "" "the options within a section, and for the default values." msgstr "" -#: ../../library/configparser.rst:925 +#: ../../library/configparser.rst:951 msgid "" "When *delimiters* is given, it is used as the set of substrings that divide " "keys from values. When *comment_prefixes* is given, it will be used as the " @@ -1314,7 +1346,7 @@ msgid "" "as the set of substrings that prefix comments in non-empty lines." msgstr "" -#: ../../library/configparser.rst:931 +#: ../../library/configparser.rst:957 msgid "" "When *strict* is ``True`` (the default), the parser won't allow for any " "section or option duplicates while reading from a single source (file, " @@ -1327,7 +1359,7 @@ msgid "" "without the trailing delimiter." msgstr "" -#: ../../library/configparser.rst:941 +#: ../../library/configparser.rst:967 msgid "" "When *default_section* is given, it specifies the name for the special " "section holding default values for other sections and interpolation purposes " @@ -1337,7 +1369,7 @@ msgid "" "settings to a new config file." msgstr "" -#: ../../library/configparser.rst:948 +#: ../../library/configparser.rst:974 msgid "" "Interpolation behaviour may be customized by providing a custom handler " "through the *interpolation* argument. ``None`` can be used to turn off " @@ -1346,7 +1378,7 @@ msgid "" "`dedicated documentation section <#interpolation-of-values>`_." msgstr "" -#: ../../library/configparser.rst:954 +#: ../../library/configparser.rst:980 msgid "" "All option names used in interpolation will be passed through the :meth:" "`optionxform` method just like any other option name reference. For " @@ -1355,7 +1387,7 @@ msgid "" "%(BAR)s`` are equivalent." msgstr "" -#: ../../library/configparser.rst:960 +#: ../../library/configparser.rst:986 msgid "" "When *converters* is given, it should be a dictionary where each key " "represents the name of a type converter and each value is a callable " @@ -1364,44 +1396,50 @@ msgid "" "object and section proxies." msgstr "" -#: ../../library/configparser.rst:991 +#: ../../library/configparser.rst:1017 msgid "The default *dict_type* is :class:`collections.OrderedDict`." msgstr "" -#: ../../library/configparser.rst:994 +#: ../../library/configparser.rst:1020 msgid "" "*allow_no_value*, *delimiters*, *comment_prefixes*, *strict*, " "*empty_lines_in_values*, *default_section* and *interpolation* were added." msgstr "" -#: ../../library/configparser.rst:999 +#: ../../library/configparser.rst:1025 msgid "The *converters* argument was added." msgstr "新增 *converters* 引數。" -#: ../../library/configparser.rst:1002 +#: ../../library/configparser.rst:1028 msgid "" "The *defaults* argument is read with :meth:`read_dict`, providing consistent " "behavior across the parser: non-string keys and values are implicitly " "converted to strings." msgstr "" -#: ../../library/configparser.rst:1007 ../../library/configparser.rst:1270 +#: ../../library/configparser.rst:1033 ../../library/configparser.rst:1305 msgid "" "The default *dict_type* is :class:`dict`, since it now preserves insertion " "order." msgstr "" -#: ../../library/configparser.rst:1013 +#: ../../library/configparser.rst:1037 +msgid "" +"Raise a :exc:`MultilineContinuationError` when *allow_no_value* is ``True``, " +"and a key without a value is continued with an indented line." +msgstr "" + +#: ../../library/configparser.rst:1043 msgid "Return a dictionary containing the instance-wide defaults." msgstr "" -#: ../../library/configparser.rst:1018 +#: ../../library/configparser.rst:1048 msgid "" "Return a list of the sections available; the *default section* is not " "included in the list." msgstr "" -#: ../../library/configparser.rst:1024 +#: ../../library/configparser.rst:1054 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " @@ -1409,34 +1447,34 @@ msgid "" "the section must be a string; if not, :exc:`TypeError` is raised." msgstr "" -#: ../../library/configparser.rst:1029 +#: ../../library/configparser.rst:1059 msgid "Non-string section names raise :exc:`TypeError`." msgstr "" -#: ../../library/configparser.rst:1035 +#: ../../library/configparser.rst:1065 msgid "" "Indicates whether the named *section* is present in the configuration. The " "*default section* is not acknowledged." msgstr "" -#: ../../library/configparser.rst:1041 +#: ../../library/configparser.rst:1071 msgid "Return a list of options available in the specified *section*." msgstr "" -#: ../../library/configparser.rst:1046 +#: ../../library/configparser.rst:1076 msgid "" "If the given *section* exists, and contains the given *option*, return :" "const:`True`; otherwise return :const:`False`. If the specified *section* " "is :const:`None` or an empty string, DEFAULT is assumed." msgstr "" -#: ../../library/configparser.rst:1053 +#: ../../library/configparser.rst:1083 msgid "" "Attempt to read and parse an iterable of filenames, returning a list of " "filenames which were successfully parsed." msgstr "" -#: ../../library/configparser.rst:1056 +#: ../../library/configparser.rst:1086 msgid "" "If *filenames* is a string, a :class:`bytes` object or a :term:`path-like " "object`, it is treated as a single filename. If a file named in *filenames* " @@ -1447,7 +1485,7 @@ msgid "" "be read." msgstr "" -#: ../../library/configparser.rst:1065 +#: ../../library/configparser.rst:1095 msgid "" "If none of the named files exist, the :class:`ConfigParser` instance will " "contain an empty dataset. An application which requires initial values to " @@ -1455,7 +1493,7 @@ msgid "" "`read_file` before calling :meth:`read` for any optional files::" msgstr "" -#: ../../library/configparser.rst:1071 +#: ../../library/configparser.rst:1101 msgid "" "import configparser, os\n" "\n" @@ -1471,49 +1509,49 @@ msgstr "" "config.read(['site.cfg', os.path.expanduser('~/.myapp.cfg')],\n" " encoding='cp1250')" -#: ../../library/configparser.rst:1078 +#: ../../library/configparser.rst:1108 msgid "" "Added the *encoding* parameter. Previously, all files were read using the " "default encoding for :func:`open`." msgstr "" -#: ../../library/configparser.rst:1082 +#: ../../library/configparser.rst:1112 msgid "The *filenames* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/configparser.rst:1085 +#: ../../library/configparser.rst:1115 msgid "The *filenames* parameter accepts a :class:`bytes` object." msgstr "" -#: ../../library/configparser.rst:1091 +#: ../../library/configparser.rst:1121 msgid "" "Read and parse configuration data from *f* which must be an iterable " "yielding Unicode strings (for example files opened in text mode)." msgstr "" -#: ../../library/configparser.rst:1094 +#: ../../library/configparser.rst:1124 msgid "" "Optional argument *source* specifies the name of the file being read. If " "not given and *f* has a :attr:`!name` attribute, that is used for *source*; " "the default is ``''``." msgstr "" -#: ../../library/configparser.rst:1098 +#: ../../library/configparser.rst:1128 msgid "Replaces :meth:`!readfp`." msgstr "取代 :meth:`!readfp`。" -#: ../../library/configparser.rst:1103 +#: ../../library/configparser.rst:1133 msgid "Parse configuration data from a string." msgstr "" -#: ../../library/configparser.rst:1105 +#: ../../library/configparser.rst:1135 msgid "" "Optional argument *source* specifies a context-specific name of the string " "passed. If not given, ``''`` is used. This should commonly be a " "filesystem path or a URL." msgstr "" -#: ../../library/configparser.rst:1114 +#: ../../library/configparser.rst:1144 msgid "" "Load configuration from any object that provides a dict-like ``items()`` " "method. Keys are section names, values are dictionaries with keys and " @@ -1522,17 +1560,17 @@ msgid "" "automatically converted to strings." msgstr "" -#: ../../library/configparser.rst:1120 +#: ../../library/configparser.rst:1150 msgid "" "Optional argument *source* specifies a context-specific name of the " "dictionary passed. If not given, ```` is used." msgstr "" -#: ../../library/configparser.rst:1123 +#: ../../library/configparser.rst:1153 msgid "This method can be used to copy state between parsers." msgstr "" -#: ../../library/configparser.rst:1130 +#: ../../library/configparser.rst:1160 msgid "" "Get an *option* value for the named *section*. If *vars* is provided, it " "must be a dictionary. The *option* is looked up in *vars* (if provided), " @@ -1541,35 +1579,35 @@ msgid "" "provided as a *fallback* value." msgstr "" -#: ../../library/configparser.rst:1136 +#: ../../library/configparser.rst:1166 msgid "" "All the ``'%'`` interpolations are expanded in the return values, unless the " "*raw* argument is true. Values for interpolation keys are looked up in the " "same manner as the option." msgstr "" -#: ../../library/configparser.rst:1140 +#: ../../library/configparser.rst:1170 msgid "" "Arguments *raw*, *vars* and *fallback* are keyword only to protect users " "from trying to use the third argument as the *fallback* fallback (especially " "when using the mapping protocol)." msgstr "" -#: ../../library/configparser.rst:1148 +#: ../../library/configparser.rst:1178 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to an integer. See :meth:`get` for explanation of *raw*, *vars* and " "*fallback*." msgstr "" -#: ../../library/configparser.rst:1155 +#: ../../library/configparser.rst:1185 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a floating-point number. See :meth:`get` for explanation of *raw*, " "*vars* and *fallback*." msgstr "" -#: ../../library/configparser.rst:1162 +#: ../../library/configparser.rst:1192 msgid "" "A convenience method which coerces the *option* in the specified *section* " "to a Boolean value. Note that the accepted values for the option are " @@ -1581,34 +1619,34 @@ msgid "" "*fallback*." msgstr "" -#: ../../library/configparser.rst:1175 +#: ../../library/configparser.rst:1205 msgid "" "When *section* is not given, return a list of *section_name*, " "*section_proxy* pairs, including DEFAULTSECT." msgstr "" -#: ../../library/configparser.rst:1178 +#: ../../library/configparser.rst:1208 msgid "" "Otherwise, return a list of *name*, *value* pairs for the options in the " "given *section*. Optional arguments have the same meaning as for the :meth:" "`get` method." msgstr "" -#: ../../library/configparser.rst:1182 +#: ../../library/configparser.rst:1212 msgid "" "Items present in *vars* no longer appear in the result. The previous " "behaviour mixed actual parser options with variables provided for " "interpolation." msgstr "" -#: ../../library/configparser.rst:1190 +#: ../../library/configparser.rst:1220 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. *option* and *value* must be " "strings; if not, :exc:`TypeError` is raised." msgstr "" -#: ../../library/configparser.rst:1197 +#: ../../library/configparser.rst:1227 msgid "" "Write a representation of the configuration to the specified :term:`file " "object`, which must be opened in text mode (accepting strings). This " @@ -1617,27 +1655,27 @@ msgid "" "surrounded by spaces." msgstr "" -#: ../../library/configparser.rst:1205 +#: ../../library/configparser.rst:1235 msgid "" "Comments in the original configuration file are not preserved when writing " "the configuration back. What is considered a comment, depends on the given " "values for *comment_prefix* and *inline_comment_prefix*." msgstr "" -#: ../../library/configparser.rst:1213 +#: ../../library/configparser.rst:1243 msgid "" "Remove the specified *option* from the specified *section*. If the section " "does not exist, raise :exc:`NoSectionError`. If the option existed to be " "removed, return :const:`True`; otherwise return :const:`False`." msgstr "" -#: ../../library/configparser.rst:1221 +#: ../../library/configparser.rst:1251 msgid "" "Remove the specified *section* from the configuration. If the section in " "fact existed, return ``True``. Otherwise return ``False``." msgstr "" -#: ../../library/configparser.rst:1227 +#: ../../library/configparser.rst:1257 msgid "" "Transforms the option name *option* as found in an input file or as passed " "in by client code to the form that should be used in the internal " @@ -1646,7 +1684,7 @@ msgid "" "of this name on instances to affect this behavior." msgstr "" -#: ../../library/configparser.rst:1233 +#: ../../library/configparser.rst:1263 msgid "" "You don't need to subclass the parser to use this method, you can also set " "it on an instance, to a function that takes a string argument and returns a " @@ -1654,7 +1692,7 @@ msgid "" "sensitive::" msgstr "" -#: ../../library/configparser.rst:1238 +#: ../../library/configparser.rst:1268 msgid "" "cfgparser = ConfigParser()\n" "cfgparser.optionxform = str" @@ -1662,24 +1700,30 @@ msgstr "" "cfgparser = ConfigParser()\n" "cfgparser.optionxform = str" -#: ../../library/configparser.rst:1241 +#: ../../library/configparser.rst:1271 msgid "" "Note that when reading configuration files, whitespace around the option " "names is stripped before :meth:`optionxform` is called." msgstr "" -#: ../../library/configparser.rst:1247 +#: ../../library/configparser.rst:1277 +msgid "" +"A special object representing a section name used to reference the unnamed " +"section (see :ref:`unnamed-sections`)." +msgstr "" + +#: ../../library/configparser.rst:1282 msgid "" "The maximum depth for recursive interpolation for :meth:`~configparser." "ConfigParser.get` when the *raw* parameter is false. This is relevant only " "when the default *interpolation* is used." msgstr "" -#: ../../library/configparser.rst:1255 +#: ../../library/configparser.rst:1290 msgid "RawConfigParser Objects" msgstr "RawConfigParser 物件" -#: ../../library/configparser.rst:1265 +#: ../../library/configparser.rst:1300 msgid "" "Legacy variant of the :class:`ConfigParser`. It has interpolation disabled " "by default and allows for non-string section names, option names, and values " @@ -1687,27 +1731,27 @@ msgid "" "``defaults=`` keyword argument handling." msgstr "" -#: ../../library/configparser.rst:1275 +#: ../../library/configparser.rst:1310 msgid "" "Consider using :class:`ConfigParser` instead which checks types of the " "values to be stored internally. If you don't want interpolation, you can " "use ``ConfigParser(interpolation=None)``." msgstr "" -#: ../../library/configparser.rst:1282 +#: ../../library/configparser.rst:1317 msgid "" "Add a section named *section* to the instance. If a section by the given " "name already exists, :exc:`DuplicateSectionError` is raised. If the " "*default section* name is passed, :exc:`ValueError` is raised." msgstr "" -#: ../../library/configparser.rst:1286 +#: ../../library/configparser.rst:1321 msgid "" "Type of *section* is not checked which lets users create non-string named " "sections. This behaviour is unsupported and may cause internal errors." msgstr "" -#: ../../library/configparser.rst:1292 +#: ../../library/configparser.rst:1327 msgid "" "If the given section exists, set the given option to the specified value; " "otherwise raise :exc:`NoSectionError`. While it is possible to use :class:" @@ -1717,7 +1761,7 @@ msgid "" "string values." msgstr "" -#: ../../library/configparser.rst:1299 +#: ../../library/configparser.rst:1334 msgid "" "This method lets users assign non-string values to keys internally. This " "behaviour is unsupported and will cause errors when attempting to write to a " @@ -1725,32 +1769,32 @@ msgid "" "not allow such assignments to take place." msgstr "" -#: ../../library/configparser.rst:1306 +#: ../../library/configparser.rst:1341 msgid "Exceptions" msgstr "例外" -#: ../../library/configparser.rst:1310 +#: ../../library/configparser.rst:1345 msgid "Base class for all other :mod:`configparser` exceptions." msgstr "" -#: ../../library/configparser.rst:1315 +#: ../../library/configparser.rst:1350 msgid "Exception raised when a specified section is not found." msgstr "" -#: ../../library/configparser.rst:1320 +#: ../../library/configparser.rst:1355 msgid "" "Exception raised if :meth:`~ConfigParser.add_section` is called with the " "name of a section that is already present or in strict parsers when a " "section if found more than once in a single input file, string or dictionary." msgstr "" -#: ../../library/configparser.rst:1324 +#: ../../library/configparser.rst:1359 msgid "" "Added the optional *source* and *lineno* attributes and parameters to :meth:" "`!__init__`." msgstr "" -#: ../../library/configparser.rst:1331 +#: ../../library/configparser.rst:1366 msgid "" "Exception raised by strict parsers if a single option appears twice during " "reading from a single file, string or dictionary. This catches misspellings " @@ -1758,58 +1802,64 @@ msgid "" "representing the same case-insensitive configuration key." msgstr "" -#: ../../library/configparser.rst:1339 +#: ../../library/configparser.rst:1374 msgid "" "Exception raised when a specified option is not found in the specified " "section." msgstr "" -#: ../../library/configparser.rst:1345 +#: ../../library/configparser.rst:1380 msgid "" "Base class for exceptions raised when problems occur performing string " "interpolation." msgstr "" -#: ../../library/configparser.rst:1351 +#: ../../library/configparser.rst:1386 msgid "" "Exception raised when string interpolation cannot be completed because the " "number of iterations exceeds :const:`MAX_INTERPOLATION_DEPTH`. Subclass of :" "exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1358 +#: ../../library/configparser.rst:1393 msgid "" "Exception raised when an option referenced from a value does not exist. " "Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1364 +#: ../../library/configparser.rst:1399 msgid "" "Exception raised when the source text into which substitutions are made does " "not conform to the required syntax. Subclass of :exc:`InterpolationError`." msgstr "" -#: ../../library/configparser.rst:1370 +#: ../../library/configparser.rst:1405 msgid "" "Exception raised when attempting to parse a file which has no section " "headers." msgstr "" -#: ../../library/configparser.rst:1376 +#: ../../library/configparser.rst:1411 msgid "Exception raised when errors occur attempting to parse a file." msgstr "" -#: ../../library/configparser.rst:1378 +#: ../../library/configparser.rst:1413 msgid "" "The ``filename`` attribute and :meth:`!__init__` constructor argument were " "removed. They have been available using the name ``source`` since 3.2." msgstr "" -#: ../../library/configparser.rst:1383 +#: ../../library/configparser.rst:1419 +msgid "" +"Exception raised when a key without a corresponding value is continued with " +"an indented line." +msgstr "" + +#: ../../library/configparser.rst:1425 msgid "Footnotes" msgstr "註解" -#: ../../library/configparser.rst:1384 +#: ../../library/configparser.rst:1426 msgid "" "Config parsers allow for heavy customization. If you are interested in " "changing the behaviour outlined by the footnote reference, consult the " @@ -1836,14 +1886,14 @@ msgstr "ini file(ini 檔案)" msgid "Windows ini file" msgstr "Windows ini file(Windows ini 檔案)" -#: ../../library/configparser.rst:340 +#: ../../library/configparser.rst:366 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/configparser.rst:340 ../../library/configparser.rst:373 +#: ../../library/configparser.rst:366 ../../library/configparser.rst:399 msgid "interpolation in configuration files" msgstr "interpolation in configuration files(設定檔中的插值)" -#: ../../library/configparser.rst:373 +#: ../../library/configparser.rst:399 msgid "$ (dollar)" msgstr "$ (金錢符號)" diff --git a/library/constants.po b/library/constants.po index 4c7fe0034e..9fd1624475 100644 --- a/library/constants.po +++ b/library/constants.po @@ -7,7 +7,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: 2021-11-19 23:36+0800\n" diff --git a/library/contextlib.po b/library/contextlib.po index be7d46b7e0..5785f5506e 100644 --- a/library/contextlib.po +++ b/library/contextlib.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:41+0000\n" diff --git a/library/contextvars.po b/library/contextvars.po index 97e1b5cfd8..8f8fe6b9cd 100644 --- a/library/contextvars.po +++ b/library/contextvars.po @@ -3,9 +3,9 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-11 21:40+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" diff --git a/library/copy.po b/library/copy.po index df91a7a329..71812c86b4 100644 --- a/library/copy.po +++ b/library/copy.po @@ -6,9 +6,9 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-01-20 18:49+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,18 +46,26 @@ msgid "Interface summary:" msgstr "介面摘要:" #: ../../library/copy.rst:22 -msgid "Return a shallow copy of *x*." +#, fuzzy +msgid "Return a shallow copy of *obj*." msgstr "回傳 *x* 的淺層複製。" #: ../../library/copy.rst:27 -msgid "Return a deep copy of *x*." +#, fuzzy +msgid "Return a deep copy of *obj*." msgstr "回傳 *x* 的深層複製。" #: ../../library/copy.rst:32 +msgid "" +"Creates a new object of the same type as *obj*, replacing fields with values " +"from *changes*." +msgstr "" + +#: ../../library/copy.rst:40 msgid "Raised for module specific errors." msgstr "引發針對特定模組的錯誤。" -#: ../../library/copy.rst:36 +#: ../../library/copy.rst:44 msgid "" "The difference between shallow and deep copying is only relevant for " "compound objects (objects that contain other objects, like lists or class " @@ -66,7 +74,7 @@ msgstr "" "淺層與深層複製的區別僅與複合物件(即包含 list 或類別的實例等其他物件的物件)" "相關:" -#: ../../library/copy.rst:39 +#: ../../library/copy.rst:47 msgid "" "A *shallow copy* constructs a new compound object and then (to the extent " "possible) inserts *references* into it to the objects found in the original." @@ -74,7 +82,7 @@ msgstr "" "*淺層複製*\\ 建構一個新的複合物件,然後(在儘可能的範圍內)將原始物件中找到的" "物件的\\ *參照*\\ 插入其中。" -#: ../../library/copy.rst:42 +#: ../../library/copy.rst:50 msgid "" "A *deep copy* constructs a new compound object and then, recursively, " "inserts *copies* into it of the objects found in the original." @@ -82,19 +90,19 @@ msgstr "" "*深層複製*\\ 建構一個新的複合物件,然後遞迴地將在原始物件裡找到的物件的\\ *副" "本*\\ 插入其中。" -#: ../../library/copy.rst:45 +#: ../../library/copy.rst:53 msgid "" "Two problems often exist with deep copy operations that don't exist with " "shallow copy operations:" msgstr "深層複製操作通常存在兩個問題,而淺層複製操作並不存在這些問題:" -#: ../../library/copy.rst:48 +#: ../../library/copy.rst:56 msgid "" "Recursive objects (compound objects that, directly or indirectly, contain a " "reference to themselves) may cause a recursive loop." msgstr "遞迴物件(直接或間接包含對自身參照的複合物件)可能會導致遞迴迴圈。" -#: ../../library/copy.rst:51 +#: ../../library/copy.rst:59 msgid "" "Because deep copy copies everything it may copy too much, such as data which " "is intended to be shared between copies." @@ -102,23 +110,23 @@ msgstr "" "由於深層複製會複製所有內容,因此可能會有過多複製(例如應該在副本之間共享的資" "料)。" -#: ../../library/copy.rst:54 +#: ../../library/copy.rst:62 msgid "The :func:`deepcopy` function avoids these problems by:" msgstr ":func:`deepcopy` 函式用以下方式避免了這些問題:" -#: ../../library/copy.rst:56 +#: ../../library/copy.rst:64 msgid "" "keeping a ``memo`` dictionary of objects already copied during the current " "copying pass; and" msgstr "保留在當前複製過程中已複製的物件的 ``memo`` 字典;以及" -#: ../../library/copy.rst:59 +#: ../../library/copy.rst:67 msgid "" "letting user-defined classes override the copying operation or the set of " "components copied." msgstr "允許使用者定義的類別複寫 (override) 複製操作或複製的元件集合。" -#: ../../library/copy.rst:62 +#: ../../library/copy.rst:70 msgid "" "This module does not copy types like module, method, stack trace, stack " "frame, file, socket, window, or any similar types. It does \"copy\" " @@ -131,7 +139,7 @@ msgstr "" "(淺層或深層地)\"複製\"函式和類別;這與 :mod:`pickle` 模組處理這類問題的方式" "是相似的。" -#: ../../library/copy.rst:67 +#: ../../library/copy.rst:75 msgid "" "Shallow copies of dictionaries can be made using :meth:`dict.copy`, and of " "lists by assigning a slice of the entire list, for example, ``copied_list = " @@ -140,7 +148,7 @@ msgstr "" "字典的淺層複製可以使用 :meth:`dict.copy`\\,而 list 的淺層複製可以透過賦值整" "個 list 的切片 (slice) 完成,例如,``copied_list = original_list[:]``。" -#: ../../library/copy.rst:73 +#: ../../library/copy.rst:81 msgid "" "Classes can use the same interfaces to control copying that they use to " "control pickling. See the description of module :mod:`pickle` for " @@ -151,17 +159,26 @@ msgstr "" "參考 :mod:`pickle` 模組。實際上,:mod:`copy` 模組使用的正是從 :mod:`copyreg` " "模組中註冊的 pickle 函式。" -#: ../../library/copy.rst:82 +#: ../../library/copy.rst:92 msgid "" "In order for a class to define its own copy implementation, it can define " -"special methods :meth:`__copy__` and :meth:`__deepcopy__`. The former is " -"called to implement the shallow copy operation; no additional arguments are " -"passed. The latter is called to implement the deep copy operation; it is " -"passed one argument, the ``memo`` dictionary. If the :meth:`__deepcopy__` " -"implementation needs to make a deep copy of a component, it should call the :" -"func:`deepcopy` function with the component as first argument and the memo " -"dictionary as second argument. The memo dictionary should be treated as an " -"opaque object." +"special methods :meth:`~object.__copy__` and :meth:`~object.__deepcopy__`." +msgstr "" + +#: ../../library/copy.rst:98 +msgid "" +"Called to implement the shallow copy operation; no additional arguments are " +"passed." +msgstr "" + +#: ../../library/copy.rst:104 +#, fuzzy +msgid "" +"Called to implement the deep copy operation; it is passed one argument, the " +"*memo* dictionary. If the ``__deepcopy__`` implementation needs to make a " +"deep copy of a component, it should call the :func:`~copy.deepcopy` function " +"with the component as first argument and the *memo* dictionary as second " +"argument. The *memo* dictionary should be treated as an opaque object." msgstr "" "想要為一個類別定義它自己的複製操作實作,可以透過定義特殊方法 :meth:" "`__copy__` 和 :meth:`__deepcopy__`。呼叫前者以實現淺層複製操作;不必傳入額外" @@ -170,11 +187,25 @@ msgstr "" "`deepcopy` 函式並以該元件作為第一個引數、以該 memo 字典作為第二個引數。memo " "字典應當被當作不透明物件 (opaque object) 來處理。" -#: ../../library/copy.rst:94 +#: ../../library/copy.rst:114 +msgid "" +"Function :func:`!copy.replace` is more limited than :func:`~copy.copy` and :" +"func:`~copy.deepcopy`, and only supports named tuples created by :func:" +"`~collections.namedtuple`, :mod:`dataclasses`, and other classes which " +"define method :meth:`~object.__replace__`." +msgstr "" + +#: ../../library/copy.rst:122 +msgid "" +"This method should create a new object of the same type, replacing fields " +"with values from *changes*." +msgstr "" + +#: ../../library/copy.rst:128 msgid "Module :mod:`pickle`" msgstr ":mod:`pickle` 模組" -#: ../../library/copy.rst:95 +#: ../../library/copy.rst:129 msgid "" "Discussion of the special methods used to support object state retrieval and " "restoration." @@ -182,18 +213,23 @@ msgstr "" "支援物件之狀態檢索 (state retrieval) 和恢復 (restoration) 相關特殊方法的討" "論。" -#: ../../library/copy.rst:71 +#: ../../library/copy.rst:79 msgid "module" msgstr "module(模組)" -#: ../../library/copy.rst:71 +#: ../../library/copy.rst:79 msgid "pickle" msgstr "pickle" -#: ../../library/copy.rst:78 +#: ../../library/copy.rst:86 msgid "__copy__() (copy protocol)" msgstr "__copy__() (複製協定)" -#: ../../library/copy.rst:78 +#: ../../library/copy.rst:86 msgid "__deepcopy__() (copy protocol)" msgstr "__deepcopy__() (複製協定)" + +#: ../../library/copy.rst:111 +#, fuzzy +msgid "__replace__() (replace protocol)" +msgstr "__deepcopy__() (複製協定)" diff --git a/library/copyreg.po b/library/copyreg.po index dfcce84f49..d0f8976f36 100644 --- a/library/copyreg.po +++ b/library/copyreg.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2023-12-29 00:29+0000\n" diff --git a/library/crypt.po b/library/crypt.po deleted file mode 100644 index ac517bce84..0000000000 --- a/library/crypt.po +++ /dev/null @@ -1,277 +0,0 @@ -# Copyright (C) 2001-2024, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2018-05-23 14:42+0000\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/crypt.rst:2 -msgid ":mod:`crypt` --- Function to check Unix passwords" -msgstr ":mod:`crypt` --- 用於檢查 Unix 密碼的函式" - -#: ../../library/crypt.rst:13 -msgid "**Source code:** :source:`Lib/crypt.py`" -msgstr "**原始碼:**\\ :source:`Lib/crypt.py`" - -#: ../../library/crypt.rst:19 -msgid "" -"The :mod:`crypt` module is deprecated (see :pep:`PEP 594 <594#crypt>` for " -"details and alternatives). The :mod:`hashlib` module is a potential " -"replacement for certain use cases. The :pypi:`passlib` package can replace " -"all use cases of this module." -msgstr "" - -#: ../../library/crypt.rst:27 -msgid "" -"This module implements an interface to the :manpage:`crypt(3)` routine, " -"which is a one-way hash function based upon a modified DES algorithm; see " -"the Unix man page for further details. Possible uses include storing hashed " -"passwords so you can check passwords without storing the actual password, or " -"attempting to crack Unix passwords with a dictionary." -msgstr "" - -#: ../../library/crypt.rst:35 -msgid "" -"Notice that the behavior of this module depends on the actual " -"implementation of the :manpage:`crypt(3)` routine in the running system. " -"Therefore, any extensions available on the current implementation will also " -"be available on this module." -msgstr "" - -#: ../../library/crypt.rst:40 -msgid ":ref:`Availability `: Unix, not VxWorks." -msgstr ":ref:`適用 `:Unix,非 VxWorks。" - -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: ../../includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" - -#: ../../library/crypt.rst:45 -msgid "Hashing Methods" -msgstr "雜湊方法" - -#: ../../library/crypt.rst:49 -msgid "" -"The :mod:`crypt` module defines the list of hashing methods (not all methods " -"are available on all platforms):" -msgstr "" - -#: ../../library/crypt.rst:54 -msgid "" -"A Modular Crypt Format method with 16 character salt and 86 character hash " -"based on the SHA-512 hash function. This is the strongest method." -msgstr "" - -#: ../../library/crypt.rst:59 -msgid "" -"Another Modular Crypt Format method with 16 character salt and 43 character " -"hash based on the SHA-256 hash function." -msgstr "" - -#: ../../library/crypt.rst:64 -msgid "" -"Another Modular Crypt Format method with 22 character salt and 31 character " -"hash based on the Blowfish cipher." -msgstr "" - -#: ../../library/crypt.rst:71 -msgid "" -"Another Modular Crypt Format method with 8 character salt and 22 character " -"hash based on the MD5 hash function." -msgstr "" - -#: ../../library/crypt.rst:76 -msgid "" -"The traditional method with a 2 character salt and 13 characters of hash. " -"This is the weakest method." -msgstr "" - -#: ../../library/crypt.rst:81 -msgid "Module Attributes" -msgstr "模組屬性" - -#: ../../library/crypt.rst:87 -msgid "" -"A list of available password hashing algorithms, as ``crypt.METHOD_*`` " -"objects. This list is sorted from strongest to weakest." -msgstr "" - -#: ../../library/crypt.rst:93 -msgid "Module Functions" -msgstr "模組函式" - -#: ../../library/crypt.rst:95 -msgid "The :mod:`crypt` module defines the following functions:" -msgstr ":mod:`crypt` 模組定義了以下函式:" - -#: ../../library/crypt.rst:99 -msgid "" -"*word* will usually be a user's password as typed at a prompt or in a " -"graphical interface. The optional *salt* is either a string as returned " -"from :func:`mksalt`, one of the ``crypt.METHOD_*`` values (though not all " -"may be available on all platforms), or a full encrypted password including " -"salt, as returned by this function. If *salt* is not provided, the " -"strongest method available in :attr:`methods` will be used." -msgstr "" - -#: ../../library/crypt.rst:106 -msgid "" -"Checking a password is usually done by passing the plain-text password as " -"*word* and the full results of a previous :func:`crypt` call, which should " -"be the same as the results of this call." -msgstr "" - -#: ../../library/crypt.rst:110 -msgid "" -"*salt* (either a random 2 or 16 character string, possibly prefixed with " -"``$digit$`` to indicate the method) which will be used to perturb the " -"encryption algorithm. The characters in *salt* must be in the set ``[./a-zA-" -"Z0-9]``, with the exception of Modular Crypt Format which prefixes a " -"``$digit$``." -msgstr "" - -#: ../../library/crypt.rst:116 -msgid "" -"Returns the hashed password as a string, which will be composed of " -"characters from the same alphabet as the salt." -msgstr "" - -#: ../../library/crypt.rst:121 -msgid "" -"Since a few :manpage:`crypt(3)` extensions allow different values, with " -"different sizes in the *salt*, it is recommended to use the full crypted " -"password as salt when checking for a password." -msgstr "" - -#: ../../library/crypt.rst:125 -msgid "Accept ``crypt.METHOD_*`` values in addition to strings for *salt*." -msgstr "" - -#: ../../library/crypt.rst:131 -msgid "" -"Return a randomly generated salt of the specified method. If no *method* is " -"given, the strongest method available in :attr:`methods` is used." -msgstr "" - -#: ../../library/crypt.rst:135 -msgid "" -"The return value is a string suitable for passing as the *salt* argument to :" -"func:`crypt`." -msgstr "" - -#: ../../library/crypt.rst:138 -msgid "" -"*rounds* specifies the number of rounds for ``METHOD_SHA256``, " -"``METHOD_SHA512`` and ``METHOD_BLOWFISH``. For ``METHOD_SHA256`` and " -"``METHOD_SHA512`` it must be an integer between ``1000`` and " -"``999_999_999``, the default is ``5000``. For ``METHOD_BLOWFISH`` it must " -"be a power of two between ``16`` (2\\ :sup:`4`) and ``2_147_483_648`` (2\\ :" -"sup:`31`), the default is ``4096`` (2\\ :sup:`12`)." -msgstr "" - -#: ../../library/crypt.rst:148 -msgid "Added the *rounds* parameter." -msgstr "新增 *rounds* 參數。" - -#: ../../library/crypt.rst:153 -msgid "Examples" -msgstr "範例" - -#: ../../library/crypt.rst:155 -msgid "" -"A simple example illustrating typical use (a constant-time comparison " -"operation is needed to limit exposure to timing attacks. :func:`hmac." -"compare_digest` is suitable for this purpose)::" -msgstr "" - -#: ../../library/crypt.rst:159 -msgid "" -"import pwd\n" -"import crypt\n" -"import getpass\n" -"from hmac import compare_digest as compare_hash\n" -"\n" -"def login():\n" -" username = input('Python login: ')\n" -" cryptedpasswd = pwd.getpwnam(username)[1]\n" -" if cryptedpasswd:\n" -" if cryptedpasswd == 'x' or cryptedpasswd == '*':\n" -" raise ValueError('no support for shadow passwords')\n" -" cleartext = getpass.getpass()\n" -" return compare_hash(crypt.crypt(cleartext, cryptedpasswd), " -"cryptedpasswd)\n" -" else:\n" -" return True" -msgstr "" -"import pwd\n" -"import crypt\n" -"import getpass\n" -"from hmac import compare_digest as compare_hash\n" -"\n" -"def login():\n" -" username = input('Python login: ')\n" -" cryptedpasswd = pwd.getpwnam(username)[1]\n" -" if cryptedpasswd:\n" -" if cryptedpasswd == 'x' or cryptedpasswd == '*':\n" -" raise ValueError('no support for shadow passwords')\n" -" cleartext = getpass.getpass()\n" -" return compare_hash(crypt.crypt(cleartext, cryptedpasswd), " -"cryptedpasswd)\n" -" else:\n" -" return True" - -#: ../../library/crypt.rst:175 -msgid "" -"To generate a hash of a password using the strongest available method and " -"check it against the original::" -msgstr "" - -#: ../../library/crypt.rst:178 -msgid "" -"import crypt\n" -"from hmac import compare_digest as compare_hash\n" -"\n" -"hashed = crypt.crypt(plaintext)\n" -"if not compare_hash(hashed, crypt.crypt(plaintext, hashed)):\n" -" raise ValueError(\"hashed version doesn't validate against original\")" -msgstr "" -"import crypt\n" -"from hmac import compare_digest as compare_hash\n" -"\n" -"hashed = crypt.crypt(plaintext)\n" -"if not compare_hash(hashed, crypt.crypt(plaintext, hashed)):\n" -" raise ValueError(\"hashed version doesn't validate against original\")" - -#: ../../library/crypt.rst:15 ../../library/crypt.rst:33 -#: ../../library/crypt.rst:119 -msgid "crypt(3)" -msgstr "crypt(3)" - -#: ../../library/crypt.rst:15 -msgid "cipher" -msgstr "cipher" - -#: ../../library/crypt.rst:15 -msgid "DES" -msgstr "DES" diff --git a/library/crypto.po b/library/crypto.po index e033e505e4..fcccdac384 100644 --- a/library/crypto.po +++ b/library/crypto.po @@ -5,9 +5,9 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-02-15 18:06+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,11 +24,11 @@ msgid "Cryptographic Services" msgstr "加密服務" #: ../../library/crypto.rst:9 +#, fuzzy msgid "" "The modules described in this chapter implement various algorithms of a " "cryptographic nature. They are available at the discretion of the " -"installation. On Unix systems, the :mod:`crypt` module may also be " -"available. Here's an overview:" +"installation. Here's an overview:" msgstr "" "本章所描述的模組 (module) 實作了多種加密演算法。它們可以在安裝時選擇是否一同" "安裝。在 Unix 系統上,:mod:`crypt` 模組也有機會能夠被使用。以下為概述:" diff --git a/library/csv.po b/library/csv.po index eeed223b19..05f0cd536c 100644 --- a/library/csv.po +++ b/library/csv.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-11-08 15:06+0800\n" diff --git a/library/ctypes.po b/library/ctypes.po index 44e245a243..4d41b963bb 100644 --- a/library/ctypes.po +++ b/library/ctypes.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-14 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-04-26 02:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -366,7 +366,7 @@ msgid "" "calls. ``None`` is passed as a C ``NULL`` pointer, bytes objects and strings " "are passed as pointer to the memory block that contains their data (:c:expr:" "`char *` or :c:expr:`wchar_t *`). Python integers are passed as the " -"platforms default C :c:expr:`int` type, their value is masked to fit into " +"platform's default C :c:expr:`int` type, their value is masked to fit into " "the C type." msgstr "" @@ -376,7 +376,7 @@ msgid "" "learn more about :mod:`ctypes` data types." msgstr "" -#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2198 +#: ../../library/ctypes.rst:212 ../../library/ctypes.rst:2203 msgid "Fundamental data types" msgstr "" @@ -740,6 +740,7 @@ msgid "" msgstr "" #: ../../library/ctypes.rst:351 +#, fuzzy msgid "" ">>> printf = libc.printf\n" ">>> printf(b\"Hello, %s\\n\", b\"World!\")\n" @@ -754,7 +755,8 @@ msgid "" ">>> printf(b\"%f bottles of beer\\n\", 42.5)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"ArgumentError: argument 2: TypeError: Don't know how to convert parameter 2\n" +"ctypes.ArgumentError: argument 2: TypeError: Don't know how to convert " +"parameter 2\n" ">>>" msgstr "" ">>> printf = libc.printf\n" @@ -904,11 +906,13 @@ msgid "" msgstr "" #: ../../library/ctypes.rst:445 +#, fuzzy msgid "" ">>> printf(b\"%d %d %d\", 1, 2, 3)\n" "Traceback (most recent call last):\n" " File \"\", line 1, in \n" -"ArgumentError: argument 2: TypeError: wrong type\n" +"ctypes.ArgumentError: argument 2: TypeError: 'int' object cannot be " +"interpreted as ctypes.c_char_p\n" ">>> printf(b\"%s %d %f\\n\", b\"X\", 2, 3)\n" "X 2 3.000000\n" "13\n" @@ -1304,10 +1308,14 @@ msgid "" "compiler does it. It is possible to override this behavior by specifying a :" "attr:`~Structure._pack_` class attribute in the subclass definition. This " "must be set to a positive integer and specifies the maximum alignment for " -"the fields. This is what ``#pragma pack(n)`` also does in MSVC." +"the fields. This is what ``#pragma pack(n)`` also does in MSVC. It is also " +"possible to set a minimum alignment for how the subclass itself is packed in " +"the same way ``#pragma align(n)`` works in MSVC. This can be achieved by " +"specifying a ::attr:`~Structure._align_` class attribute in the subclass " +"definition." msgstr "" -#: ../../library/ctypes.rst:673 +#: ../../library/ctypes.rst:677 msgid "" ":mod:`ctypes` uses the native byte order for Structures and Unions. To " "build structures with non-native byte order, you can use one of the :class:" @@ -1316,18 +1324,18 @@ msgid "" "classes cannot contain pointer fields." msgstr "" -#: ../../library/ctypes.rst:683 +#: ../../library/ctypes.rst:687 msgid "Bit fields in structures and unions" msgstr "" -#: ../../library/ctypes.rst:685 +#: ../../library/ctypes.rst:689 msgid "" "It is possible to create structures and unions containing bit fields. Bit " "fields are only possible for integer fields, the bit width is specified as " "the third item in the :attr:`~Structure._fields_` tuples::" msgstr "" -#: ../../library/ctypes.rst:689 +#: ../../library/ctypes.rst:693 msgid "" ">>> class Int(Structure):\n" "... _fields_ = [(\"first_16\", c_int, 16),\n" @@ -1349,33 +1357,33 @@ msgstr "" "\n" ">>>" -#: ../../library/ctypes.rst:703 +#: ../../library/ctypes.rst:707 msgid "Arrays" msgstr "" -#: ../../library/ctypes.rst:705 +#: ../../library/ctypes.rst:709 msgid "" "Arrays are sequences, containing a fixed number of instances of the same " "type." msgstr "" -#: ../../library/ctypes.rst:707 +#: ../../library/ctypes.rst:711 msgid "" "The recommended way to create array types is by multiplying a data type with " "a positive integer::" msgstr "" -#: ../../library/ctypes.rst:710 +#: ../../library/ctypes.rst:714 msgid "TenPointsArrayType = POINT * 10" msgstr "" -#: ../../library/ctypes.rst:712 +#: ../../library/ctypes.rst:716 msgid "" "Here is an example of a somewhat artificial data type, a structure " "containing 4 POINTs among other stuff::" msgstr "" -#: ../../library/ctypes.rst:715 +#: ../../library/ctypes.rst:719 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -1403,28 +1411,28 @@ msgstr "" "4\n" ">>>" -#: ../../library/ctypes.rst:728 +#: ../../library/ctypes.rst:732 msgid "Instances are created in the usual way, by calling the class::" msgstr "" -#: ../../library/ctypes.rst:730 +#: ../../library/ctypes.rst:734 msgid "" "arr = TenPointsArrayType()\n" "for pt in arr:\n" " print(pt.x, pt.y)" msgstr "" -#: ../../library/ctypes.rst:734 +#: ../../library/ctypes.rst:738 msgid "" "The above code print a series of ``0 0`` lines, because the array contents " "is initialized to zeros." msgstr "" -#: ../../library/ctypes.rst:737 +#: ../../library/ctypes.rst:741 msgid "Initializers of the correct type can also be specified::" msgstr "" -#: ../../library/ctypes.rst:739 +#: ../../library/ctypes.rst:743 msgid "" ">>> from ctypes import *\n" ">>> TenIntegers = c_int * 10\n" @@ -1446,17 +1454,17 @@ msgstr "" "1 2 3 4 5 6 7 8 9 10\n" ">>>" -#: ../../library/ctypes.rst:753 +#: ../../library/ctypes.rst:757 msgid "Pointers" msgstr "" -#: ../../library/ctypes.rst:755 +#: ../../library/ctypes.rst:759 msgid "" "Pointer instances are created by calling the :func:`pointer` function on a :" "mod:`ctypes` type::" msgstr "" -#: ../../library/ctypes.rst:758 +#: ../../library/ctypes.rst:762 msgid "" ">>> from ctypes import *\n" ">>> i = c_int(42)\n" @@ -1468,13 +1476,13 @@ msgstr "" ">>> pi = pointer(i)\n" ">>>" -#: ../../library/ctypes.rst:763 +#: ../../library/ctypes.rst:767 msgid "" "Pointer instances have a :attr:`~_Pointer.contents` attribute which returns " "the object to which the pointer points, the ``i`` object above::" msgstr "" -#: ../../library/ctypes.rst:766 +#: ../../library/ctypes.rst:770 msgid "" ">>> pi.contents\n" "c_long(42)\n" @@ -1484,13 +1492,13 @@ msgstr "" "c_long(42)\n" ">>>" -#: ../../library/ctypes.rst:770 +#: ../../library/ctypes.rst:774 msgid "" "Note that :mod:`ctypes` does not have OOR (original object return), it " "constructs a new, equivalent object each time you retrieve an attribute::" msgstr "" -#: ../../library/ctypes.rst:773 +#: ../../library/ctypes.rst:777 msgid "" ">>> pi.contents is i\n" "False\n" @@ -1504,14 +1512,14 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:779 +#: ../../library/ctypes.rst:783 msgid "" "Assigning another :class:`c_int` instance to the pointer's contents " "attribute would cause the pointer to point to the memory location where this " "is stored::" msgstr "" -#: ../../library/ctypes.rst:782 +#: ../../library/ctypes.rst:786 msgid "" ">>> i = c_int(99)\n" ">>> pi.contents = i\n" @@ -1525,11 +1533,11 @@ msgstr "" "c_long(99)\n" ">>>" -#: ../../library/ctypes.rst:791 +#: ../../library/ctypes.rst:795 msgid "Pointer instances can also be indexed with integers::" msgstr "" -#: ../../library/ctypes.rst:793 +#: ../../library/ctypes.rst:797 msgid "" ">>> pi[0]\n" "99\n" @@ -1539,11 +1547,11 @@ msgstr "" "99\n" ">>>" -#: ../../library/ctypes.rst:797 +#: ../../library/ctypes.rst:801 msgid "Assigning to an integer index changes the pointed to value::" msgstr "" -#: ../../library/ctypes.rst:799 +#: ../../library/ctypes.rst:803 msgid "" ">>> print(i)\n" "c_long(99)\n" @@ -1559,7 +1567,7 @@ msgstr "" "c_long(22)\n" ">>>" -#: ../../library/ctypes.rst:806 +#: ../../library/ctypes.rst:810 msgid "" "It is also possible to use indexes different from 0, but you must know what " "you're doing, just as in C: You can access or change arbitrary memory " @@ -1568,7 +1576,7 @@ msgid "" "instead of a single item." msgstr "" -#: ../../library/ctypes.rst:812 +#: ../../library/ctypes.rst:816 msgid "" "Behind the scenes, the :func:`pointer` function does more than simply create " "pointer instances, it has to create pointer *types* first. This is done with " @@ -1576,7 +1584,7 @@ msgid "" "returns a new type::" msgstr "" -#: ../../library/ctypes.rst:817 +#: ../../library/ctypes.rst:821 msgid "" ">>> PI = POINTER(c_int)\n" ">>> PI\n" @@ -1600,13 +1608,13 @@ msgstr "" "\n" ">>>" -#: ../../library/ctypes.rst:828 +#: ../../library/ctypes.rst:832 msgid "" "Calling the pointer type without an argument creates a ``NULL`` pointer. " "``NULL`` pointers have a ``False`` boolean value::" msgstr "" -#: ../../library/ctypes.rst:831 +#: ../../library/ctypes.rst:835 msgid "" ">>> null_ptr = POINTER(c_int)()\n" ">>> print(bool(null_ptr))\n" @@ -1618,13 +1626,13 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:836 +#: ../../library/ctypes.rst:840 msgid "" ":mod:`ctypes` checks for ``NULL`` when dereferencing pointers (but " "dereferencing invalid non-\\ ``NULL`` pointers would crash Python)::" msgstr "" -#: ../../library/ctypes.rst:839 +#: ../../library/ctypes.rst:843 msgid "" ">>> null_ptr[0]\n" "Traceback (most recent call last):\n" @@ -1650,11 +1658,11 @@ msgstr "" "ValueError: NULL pointer access\n" ">>>" -#: ../../library/ctypes.rst:855 +#: ../../library/ctypes.rst:859 msgid "Type conversions" msgstr "" -#: ../../library/ctypes.rst:857 +#: ../../library/ctypes.rst:861 msgid "" "Usually, ctypes does strict type checking. This means, if you have " "``POINTER(c_int)`` in the :attr:`~_FuncPtr.argtypes` list of a function or " @@ -1665,7 +1673,7 @@ msgid "" "ctypes accepts an array of c_int::" msgstr "" -#: ../../library/ctypes.rst:864 +#: ../../library/ctypes.rst:868 msgid "" ">>> class Bar(Structure):\n" "... _fields_ = [(\"count\", c_int), (\"values\", POINTER(c_int))]\n" @@ -1695,7 +1703,7 @@ msgstr "" "3\n" ">>>" -#: ../../library/ctypes.rst:878 +#: ../../library/ctypes.rst:882 msgid "" "In addition, if a function argument is explicitly declared to be a pointer " "type (such as ``POINTER(c_int)``) in :attr:`~_FuncPtr.argtypes`, an object " @@ -1704,11 +1712,11 @@ msgid "" "automatically." msgstr "" -#: ../../library/ctypes.rst:883 +#: ../../library/ctypes.rst:887 msgid "To set a POINTER type field to ``NULL``, you can assign ``None``::" msgstr "" -#: ../../library/ctypes.rst:885 +#: ../../library/ctypes.rst:889 msgid "" ">>> bar.values = None\n" ">>>" @@ -1716,7 +1724,7 @@ msgstr "" ">>> bar.values = None\n" ">>>" -#: ../../library/ctypes.rst:890 +#: ../../library/ctypes.rst:894 msgid "" "Sometimes you have instances of incompatible types. In C, you can cast one " "type into another type. :mod:`ctypes` provides a :func:`cast` function " @@ -1725,7 +1733,7 @@ msgid "" "``values`` field, but not instances of other types::" msgstr "" -#: ../../library/ctypes.rst:896 +#: ../../library/ctypes.rst:900 msgid "" ">>> bar.values = (c_byte * 4)()\n" "Traceback (most recent call last):\n" @@ -1741,11 +1749,11 @@ msgstr "" "instance\n" ">>>" -#: ../../library/ctypes.rst:902 +#: ../../library/ctypes.rst:906 msgid "For these cases, the :func:`cast` function is handy." msgstr "" -#: ../../library/ctypes.rst:904 +#: ../../library/ctypes.rst:908 msgid "" "The :func:`cast` function can be used to cast a ctypes instance into a " "pointer to a different ctypes data type. :func:`cast` takes two parameters, " @@ -1754,7 +1762,7 @@ msgid "" "references the same memory block as the first argument::" msgstr "" -#: ../../library/ctypes.rst:910 +#: ../../library/ctypes.rst:914 msgid "" ">>> a = (c_byte * 4)()\n" ">>> cast(a, POINTER(c_int))\n" @@ -1766,13 +1774,13 @@ msgstr "" "\n" ">>>" -#: ../../library/ctypes.rst:915 +#: ../../library/ctypes.rst:919 msgid "" "So, :func:`cast` can be used to assign to the ``values`` field of ``Bar`` " "the structure::" msgstr "" -#: ../../library/ctypes.rst:918 +#: ../../library/ctypes.rst:922 msgid "" ">>> bar = Bar()\n" ">>> bar.values = cast((c_byte * 4)(), POINTER(c_int))\n" @@ -1786,18 +1794,18 @@ msgstr "" "0\n" ">>>" -#: ../../library/ctypes.rst:928 +#: ../../library/ctypes.rst:932 msgid "Incomplete Types" msgstr "" -#: ../../library/ctypes.rst:930 +#: ../../library/ctypes.rst:934 msgid "" "*Incomplete Types* are structures, unions or arrays whose members are not " "yet specified. In C, they are specified by forward declarations, which are " "defined later::" msgstr "" -#: ../../library/ctypes.rst:934 +#: ../../library/ctypes.rst:938 msgid "" "struct cell; /* forward declaration */\n" "\n" @@ -1807,13 +1815,13 @@ msgid "" "};" msgstr "" -#: ../../library/ctypes.rst:941 +#: ../../library/ctypes.rst:945 msgid "" "The straightforward translation into ctypes code would be this, but it does " "not work::" msgstr "" -#: ../../library/ctypes.rst:944 +#: ../../library/ctypes.rst:948 msgid "" ">>> class cell(Structure):\n" "... _fields_ = [(\"name\", c_char_p),\n" @@ -1835,14 +1843,14 @@ msgstr "" "NameError: name 'cell' is not defined\n" ">>>" -#: ../../library/ctypes.rst:954 +#: ../../library/ctypes.rst:958 msgid "" "because the new ``class cell`` is not available in the class statement " "itself. In :mod:`ctypes`, we can define the ``cell`` class and set the :attr:" "`~Structure._fields_` attribute later, after the class statement::" msgstr "" -#: ../../library/ctypes.rst:958 +#: ../../library/ctypes.rst:962 msgid "" ">>> from ctypes import *\n" ">>> class cell(Structure):\n" @@ -1860,13 +1868,13 @@ msgstr "" "... (\"next\", POINTER(cell))]\n" ">>>" -#: ../../library/ctypes.rst:966 +#: ../../library/ctypes.rst:970 msgid "" "Let's try it. We create two instances of ``cell``, and let them point to " "each other, and finally follow the pointer chain a few times::" msgstr "" -#: ../../library/ctypes.rst:969 +#: ../../library/ctypes.rst:973 msgid "" ">>> c1 = cell()\n" ">>> c1.name = b\"foo\"\n" @@ -1896,24 +1904,24 @@ msgstr "" "foo bar foo bar foo bar foo bar\n" ">>>" -#: ../../library/ctypes.rst:987 +#: ../../library/ctypes.rst:991 msgid "Callback functions" msgstr "回呼函式" -#: ../../library/ctypes.rst:989 +#: ../../library/ctypes.rst:993 msgid "" ":mod:`ctypes` allows creating C callable function pointers from Python " "callables. These are sometimes called *callback functions*." msgstr "" -#: ../../library/ctypes.rst:992 +#: ../../library/ctypes.rst:996 msgid "" "First, you must create a class for the callback function. The class knows " "the calling convention, the return type, and the number and types of " "arguments this function will receive." msgstr "" -#: ../../library/ctypes.rst:996 +#: ../../library/ctypes.rst:1000 msgid "" "The :func:`CFUNCTYPE` factory function creates types for callback functions " "using the ``cdecl`` calling convention. On Windows, the :func:`WINFUNCTYPE` " @@ -1921,21 +1929,21 @@ msgid "" "calling convention." msgstr "" -#: ../../library/ctypes.rst:1001 +#: ../../library/ctypes.rst:1005 msgid "" "Both of these factory functions are called with the result type as first " "argument, and the callback functions expected argument types as the " "remaining arguments." msgstr "" -#: ../../library/ctypes.rst:1005 +#: ../../library/ctypes.rst:1009 msgid "" "I will present an example here which uses the standard C library's :c:func:`!" "qsort` function, that is used to sort items with the help of a callback " "function. :c:func:`!qsort` will be used to sort an array of integers::" msgstr "" -#: ../../library/ctypes.rst:1009 +#: ../../library/ctypes.rst:1013 msgid "" ">>> IntArray5 = c_int * 5\n" ">>> ia = IntArray5(5, 1, 7, 33, 99)\n" @@ -1949,7 +1957,7 @@ msgstr "" ">>> qsort.restype = None\n" ">>>" -#: ../../library/ctypes.rst:1015 +#: ../../library/ctypes.rst:1019 msgid "" ":func:`!qsort` must be called with a pointer to the data to sort, the number " "of items in the data array, the size of one item, and a pointer to the " @@ -1959,13 +1967,13 @@ msgid "" "otherwise." msgstr "" -#: ../../library/ctypes.rst:1021 +#: ../../library/ctypes.rst:1025 msgid "" "So our callback function receives pointers to integers, and must return an " "integer. First we create the ``type`` for the callback function::" msgstr "" -#: ../../library/ctypes.rst:1024 +#: ../../library/ctypes.rst:1028 msgid "" ">>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" ">>>" @@ -1973,13 +1981,13 @@ msgstr "" ">>> CMPFUNC = CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" ">>>" -#: ../../library/ctypes.rst:1027 +#: ../../library/ctypes.rst:1031 msgid "" "To get started, here is a simple callback that shows the values it gets " "passed::" msgstr "" -#: ../../library/ctypes.rst:1030 +#: ../../library/ctypes.rst:1034 msgid "" ">>> def py_cmp_func(a, b):\n" "... print(\"py_cmp_func\", a[0], b[0])\n" @@ -1995,11 +2003,11 @@ msgstr "" ">>> cmp_func = CMPFUNC(py_cmp_func)\n" ">>>" -#: ../../library/ctypes.rst:1037 +#: ../../library/ctypes.rst:1041 msgid "The result::" msgstr "結果為: ::" -#: ../../library/ctypes.rst:1039 +#: ../../library/ctypes.rst:1043 msgid "" ">>> qsort(ia, len(ia), sizeof(c_int), cmp_func) \n" "py_cmp_func 5 1\n" @@ -2017,11 +2025,11 @@ msgstr "" "py_cmp_func 1 7\n" ">>>" -#: ../../library/ctypes.rst:1047 +#: ../../library/ctypes.rst:1051 msgid "Now we can actually compare the two items and return a useful result::" msgstr "" -#: ../../library/ctypes.rst:1049 +#: ../../library/ctypes.rst:1053 msgid "" ">>> def py_cmp_func(a, b):\n" "... print(\"py_cmp_func\", a[0], b[0])\n" @@ -2049,11 +2057,11 @@ msgstr "" "py_cmp_func 5 7\n" ">>>" -#: ../../library/ctypes.rst:1062 +#: ../../library/ctypes.rst:1066 msgid "As we can easily check, our array is sorted now::" msgstr "" -#: ../../library/ctypes.rst:1064 +#: ../../library/ctypes.rst:1068 msgid "" ">>> for i in ia: print(i, end=\" \")\n" "...\n" @@ -2065,13 +2073,13 @@ msgstr "" "1 5 7 33 99\n" ">>>" -#: ../../library/ctypes.rst:1069 +#: ../../library/ctypes.rst:1073 msgid "" "The function factories can be used as decorator factories, so we may as well " "write::" msgstr "" -#: ../../library/ctypes.rst:1072 +#: ../../library/ctypes.rst:1076 msgid "" ">>> @CFUNCTYPE(c_int, POINTER(c_int), POINTER(c_int))\n" "... def py_cmp_func(a, b):\n" @@ -2099,14 +2107,14 @@ msgstr "" "py_cmp_func 5 7\n" ">>>" -#: ../../library/ctypes.rst:1087 +#: ../../library/ctypes.rst:1091 msgid "" "Make sure you keep references to :func:`CFUNCTYPE` objects as long as they " "are used from C code. :mod:`ctypes` doesn't, and if you don't, they may be " "garbage collected, crashing your program when a callback is made." msgstr "" -#: ../../library/ctypes.rst:1091 +#: ../../library/ctypes.rst:1095 msgid "" "Also, note that if the callback function is called in a thread created " "outside of Python's control (e.g. by the foreign code that calls the " @@ -2116,25 +2124,25 @@ msgid "" "even when those calls are made from the same C thread." msgstr "" -#: ../../library/ctypes.rst:1101 +#: ../../library/ctypes.rst:1105 msgid "Accessing values exported from dlls" msgstr "" -#: ../../library/ctypes.rst:1103 +#: ../../library/ctypes.rst:1107 msgid "" "Some shared libraries not only export functions, they also export variables. " "An example in the Python library itself is the :c:data:`Py_Version`, Python " "runtime version number encoded in a single constant integer." msgstr "" -#: ../../library/ctypes.rst:1107 +#: ../../library/ctypes.rst:1111 msgid "" ":mod:`ctypes` can access values like this with the :meth:`~_CData.in_dll` " "class methods of the type. *pythonapi* is a predefined symbol giving access " "to the Python C api::" msgstr "" -#: ../../library/ctypes.rst:1111 +#: ../../library/ctypes.rst:1115 msgid "" ">>> version = ctypes.c_int.in_dll(ctypes.pythonapi, \"Py_Version\")\n" ">>> print(hex(version.value))\n" @@ -2144,17 +2152,17 @@ msgstr "" ">>> print(hex(version.value))\n" "0x30c00a0" -#: ../../library/ctypes.rst:1115 +#: ../../library/ctypes.rst:1119 msgid "" "An extended example which also demonstrates the use of pointers accesses " "the :c:data:`PyImport_FrozenModules` pointer exported by Python." msgstr "" -#: ../../library/ctypes.rst:1118 +#: ../../library/ctypes.rst:1122 msgid "Quoting the docs for that value:" msgstr "" -#: ../../library/ctypes.rst:1120 +#: ../../library/ctypes.rst:1124 msgid "" "This pointer is initialized to point to an array of :c:struct:`_frozen` " "records, terminated by one whose members are all ``NULL`` or zero. When a " @@ -2163,13 +2171,13 @@ msgid "" "frozen modules." msgstr "" -#: ../../library/ctypes.rst:1125 +#: ../../library/ctypes.rst:1129 msgid "" "So manipulating this pointer could even prove useful. To restrict the " "example size, we show only how this table can be read with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1128 +#: ../../library/ctypes.rst:1132 msgid "" ">>> from ctypes import *\n" ">>>\n" @@ -2193,13 +2201,13 @@ msgstr "" "...\n" ">>>" -#: ../../library/ctypes.rst:1139 +#: ../../library/ctypes.rst:1143 msgid "" "We have defined the :c:struct:`_frozen` data type, so we can get the pointer " "to the table::" msgstr "" -#: ../../library/ctypes.rst:1142 +#: ../../library/ctypes.rst:1146 msgid "" ">>> FrozenTable = POINTER(struct_frozen)\n" ">>> table = FrozenTable.in_dll(pythonapi, \"_PyImport_FrozenBootstrap\")\n" @@ -2209,7 +2217,7 @@ msgstr "" ">>> table = FrozenTable.in_dll(pythonapi, \"_PyImport_FrozenBootstrap\")\n" ">>>" -#: ../../library/ctypes.rst:1146 +#: ../../library/ctypes.rst:1150 msgid "" "Since ``table`` is a ``pointer`` to the array of ``struct_frozen`` records, " "we can iterate over it, but we just have to make sure that our loop " @@ -2218,7 +2226,7 @@ msgid "" "the loop when we hit the ``NULL`` entry::" msgstr "" -#: ../../library/ctypes.rst:1152 +#: ../../library/ctypes.rst:1156 msgid "" ">>> for item in table:\n" "... if item.name is None:\n" @@ -2240,28 +2248,28 @@ msgstr "" "zipimport 12345\n" ">>>" -#: ../../library/ctypes.rst:1162 +#: ../../library/ctypes.rst:1166 msgid "" "The fact that standard Python has a frozen module and a frozen package " "(indicated by the negative ``size`` member) is not well known, it is only " "used for testing. Try it out with ``import __hello__`` for example." msgstr "" -#: ../../library/ctypes.rst:1170 +#: ../../library/ctypes.rst:1174 msgid "Surprises" msgstr "" -#: ../../library/ctypes.rst:1172 +#: ../../library/ctypes.rst:1176 msgid "" "There are some edges in :mod:`ctypes` where you might expect something other " "than what actually happens." msgstr "" -#: ../../library/ctypes.rst:1175 +#: ../../library/ctypes.rst:1179 msgid "Consider the following example::" msgstr "" -#: ../../library/ctypes.rst:1177 +#: ../../library/ctypes.rst:1181 msgid "" ">>> from ctypes import *\n" ">>> class POINT(Structure):\n" @@ -2299,13 +2307,13 @@ msgstr "" "3 4 3 4\n" ">>>" -#: ../../library/ctypes.rst:1195 +#: ../../library/ctypes.rst:1199 msgid "" "Hm. We certainly expected the last statement to print ``3 4 1 2``. What " "happened? Here are the steps of the ``rc.a, rc.b = rc.b, rc.a`` line above::" msgstr "" -#: ../../library/ctypes.rst:1198 +#: ../../library/ctypes.rst:1202 msgid "" ">>> temp0, temp1 = rc.b, rc.a\n" ">>> rc.a = temp0\n" @@ -2317,7 +2325,7 @@ msgstr "" ">>> rc.b = temp1\n" ">>>" -#: ../../library/ctypes.rst:1203 +#: ../../library/ctypes.rst:1207 msgid "" "Note that ``temp0`` and ``temp1`` are objects still using the internal " "buffer of the ``rc`` object above. So executing ``rc.a = temp0`` copies the " @@ -2326,20 +2334,20 @@ msgid "" "have the expected effect." msgstr "" -#: ../../library/ctypes.rst:1209 +#: ../../library/ctypes.rst:1213 msgid "" "Keep in mind that retrieving sub-objects from Structure, Unions, and Arrays " "doesn't *copy* the sub-object, instead it retrieves a wrapper object " "accessing the root-object's underlying buffer." msgstr "" -#: ../../library/ctypes.rst:1213 +#: ../../library/ctypes.rst:1217 msgid "" "Another example that may behave differently from what one would expect is " "this::" msgstr "" -#: ../../library/ctypes.rst:1215 +#: ../../library/ctypes.rst:1219 msgid "" ">>> s = c_char_p()\n" ">>> s.value = b\"abc def ghi\"\n" @@ -2357,13 +2365,13 @@ msgstr "" "False\n" ">>>" -#: ../../library/ctypes.rst:1225 +#: ../../library/ctypes.rst:1229 msgid "" "Objects instantiated from :class:`c_char_p` can only have their value set to " "bytes or integers." msgstr "" -#: ../../library/ctypes.rst:1228 +#: ../../library/ctypes.rst:1232 msgid "" "Why is it printing ``False``? ctypes instances are objects containing a " "memory block plus some :term:`descriptor`\\s accessing the contents of the " @@ -2372,16 +2380,16 @@ msgid "" "the contents again constructs a new Python object each time!" msgstr "" -#: ../../library/ctypes.rst:1238 +#: ../../library/ctypes.rst:1242 msgid "Variable-sized data types" msgstr "" -#: ../../library/ctypes.rst:1240 +#: ../../library/ctypes.rst:1244 msgid "" ":mod:`ctypes` provides some support for variable-sized arrays and structures." msgstr "" -#: ../../library/ctypes.rst:1242 +#: ../../library/ctypes.rst:1246 msgid "" "The :func:`resize` function can be used to resize the memory buffer of an " "existing ctypes object. The function takes the object as first argument, " @@ -2390,7 +2398,7 @@ msgid "" "objects type, a :exc:`ValueError` is raised if this is tried::" msgstr "" -#: ../../library/ctypes.rst:1248 +#: ../../library/ctypes.rst:1252 msgid "" ">>> short_array = (c_short * 4)()\n" ">>> print(sizeof(short_array))\n" @@ -2420,14 +2428,14 @@ msgstr "" "8\n" ">>>" -#: ../../library/ctypes.rst:1262 +#: ../../library/ctypes.rst:1266 msgid "" "This is nice and fine, but how would one access the additional elements " "contained in this array? Since the type still only knows about 4 elements, " "we get errors accessing other elements::" msgstr "" -#: ../../library/ctypes.rst:1266 +#: ../../library/ctypes.rst:1270 msgid "" ">>> short_array[:]\n" "[0, 0, 0, 0]\n" @@ -2445,28 +2453,28 @@ msgstr "" "IndexError: invalid index\n" ">>>" -#: ../../library/ctypes.rst:1274 +#: ../../library/ctypes.rst:1278 msgid "" "Another way to use variable-sized data types with :mod:`ctypes` is to use " "the dynamic nature of Python, and (re-)define the data type after the " "required size is already known, on a case by case basis." msgstr "" -#: ../../library/ctypes.rst:1282 +#: ../../library/ctypes.rst:1286 msgid "ctypes reference" msgstr "" -#: ../../library/ctypes.rst:1288 +#: ../../library/ctypes.rst:1292 msgid "Finding shared libraries" msgstr "" -#: ../../library/ctypes.rst:1290 +#: ../../library/ctypes.rst:1294 msgid "" "When programming in a compiled language, shared libraries are accessed when " "compiling/linking a program, and when the program is run." msgstr "" -#: ../../library/ctypes.rst:1293 +#: ../../library/ctypes.rst:1297 msgid "" "The purpose of the :func:`~ctypes.util.find_library` function is to locate a " "library in a way similar to what the compiler or runtime loader does (on " @@ -2475,13 +2483,13 @@ msgid "" "and call the runtime loader directly." msgstr "" -#: ../../library/ctypes.rst:1299 +#: ../../library/ctypes.rst:1303 msgid "" "The :mod:`!ctypes.util` module provides a function which can help to " "determine the library to load." msgstr "" -#: ../../library/ctypes.rst:1307 +#: ../../library/ctypes.rst:1311 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like *lib*, suffix like ``.so``, ``.dylib`` or version " @@ -2489,29 +2497,29 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1312 ../../library/ctypes.rst:1972 +#: ../../library/ctypes.rst:1316 ../../library/ctypes.rst:1977 msgid "The exact functionality is system dependent." msgstr "" -#: ../../library/ctypes.rst:1314 +#: ../../library/ctypes.rst:1318 msgid "" "On Linux, :func:`~ctypes.util.find_library` tries to run external programs " "(``/sbin/ldconfig``, ``gcc``, ``objdump`` and ``ld``) to find the library " "file. It returns the filename of the library file." msgstr "" -#: ../../library/ctypes.rst:1318 +#: ../../library/ctypes.rst:1322 msgid "" "On Linux, the value of the environment variable ``LD_LIBRARY_PATH`` is used " "when searching for libraries, if a library cannot be found by any other " "means." msgstr "" -#: ../../library/ctypes.rst:1322 +#: ../../library/ctypes.rst:1326 msgid "Here are some examples::" msgstr "以下是一些範例: ::" -#: ../../library/ctypes.rst:1324 +#: ../../library/ctypes.rst:1328 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"m\")\n" @@ -2531,14 +2539,14 @@ msgstr "" "'libbz2.so.1.0'\n" ">>>" -#: ../../library/ctypes.rst:1333 +#: ../../library/ctypes.rst:1337 msgid "" -"On macOS, :func:`~ctypes.util.find_library` tries several predefined naming " -"schemes and paths to locate the library, and returns a full pathname if " -"successful::" +"On macOS and Android, :func:`~ctypes.util.find_library` uses the system's " +"standard naming schemes and paths to locate the library, and returns a full " +"pathname if successful::" msgstr "" -#: ../../library/ctypes.rst:1336 +#: ../../library/ctypes.rst:1341 msgid "" ">>> from ctypes.util import find_library\n" ">>> find_library(\"c\")\n" @@ -2562,7 +2570,7 @@ msgstr "" "'/System/Library/Frameworks/AGL.framework/AGL'\n" ">>>" -#: ../../library/ctypes.rst:1347 +#: ../../library/ctypes.rst:1352 msgid "" "On Windows, :func:`~ctypes.util.find_library` searches along the system " "search path, and returns the full pathname, but since there is no predefined " @@ -2570,7 +2578,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/ctypes.rst:1351 +#: ../../library/ctypes.rst:1356 msgid "" "If wrapping a shared library with :mod:`ctypes`, it *may* be better to " "determine the shared library name at development time, and hardcode that " @@ -2578,24 +2586,24 @@ msgid "" "to locate the library at runtime." msgstr "" -#: ../../library/ctypes.rst:1359 +#: ../../library/ctypes.rst:1364 msgid "Loading shared libraries" msgstr "" -#: ../../library/ctypes.rst:1361 +#: ../../library/ctypes.rst:1366 msgid "" "There are several ways to load shared libraries into the Python process. " "One way is to instantiate one of the following classes:" msgstr "" -#: ../../library/ctypes.rst:1367 +#: ../../library/ctypes.rst:1372 msgid "" "Instances of this class represent loaded shared libraries. Functions in " "these libraries use the standard C calling convention, and are assumed to " "return :c:expr:`int`." msgstr "" -#: ../../library/ctypes.rst:1371 +#: ../../library/ctypes.rst:1376 msgid "" "On Windows creating a :class:`CDLL` instance may fail even if the DLL name " "exists. When a dependent DLL of the loaded DLL is not found, a :exc:" @@ -2607,18 +2615,18 @@ msgid "" "determine which one is not found using Windows debugging and tracing tools." msgstr "" -#: ../../library/ctypes.rst:1383 ../../library/ctypes.rst:1406 -#: ../../library/ctypes.rst:1417 ../../library/ctypes.rst:1434 +#: ../../library/ctypes.rst:1388 ../../library/ctypes.rst:1411 +#: ../../library/ctypes.rst:1422 ../../library/ctypes.rst:1439 msgid "The *name* parameter can now be a :term:`path-like object`." msgstr "" -#: ../../library/ctypes.rst:1387 +#: ../../library/ctypes.rst:1392 msgid "" "`Microsoft DUMPBIN tool `_ -- A tool to find DLL dependents." msgstr "" -#: ../../library/ctypes.rst:1393 +#: ../../library/ctypes.rst:1398 msgid "" "Windows only: Instances of this class represent loaded shared libraries, " "functions in these libraries use the ``stdcall`` calling convention, and are " @@ -2628,26 +2636,26 @@ msgid "" "value signals a failure, an :class:`OSError` is automatically raised." msgstr "" -#: ../../library/ctypes.rst:1400 +#: ../../library/ctypes.rst:1405 msgid "" ":exc:`WindowsError` used to be raised, which is now an alias of :exc:" "`OSError`." msgstr "" -#: ../../library/ctypes.rst:1411 +#: ../../library/ctypes.rst:1416 msgid "" "Windows only: Instances of this class represent loaded shared libraries, " "functions in these libraries use the ``stdcall`` calling convention, and are " "assumed to return :c:expr:`int` by default." msgstr "" -#: ../../library/ctypes.rst:1419 +#: ../../library/ctypes.rst:1424 msgid "" "The Python :term:`global interpreter lock` is released before calling any " "function exported by these libraries, and reacquired afterwards." msgstr "" -#: ../../library/ctypes.rst:1425 +#: ../../library/ctypes.rst:1430 msgid "" "Instances of this class behave like :class:`CDLL` instances, except that the " "Python GIL is *not* released during the function call, and after the " @@ -2655,21 +2663,21 @@ msgid "" "set, a Python exception is raised." msgstr "" -#: ../../library/ctypes.rst:1430 +#: ../../library/ctypes.rst:1435 msgid "Thus, this is only useful to call Python C api functions directly." msgstr "" -#: ../../library/ctypes.rst:1436 +#: ../../library/ctypes.rst:1441 msgid "" "All these classes can be instantiated by calling them with at least one " "argument, the pathname of the shared library. If you have an existing " "handle to an already loaded shared library, it can be passed as the " -"``handle`` named parameter, otherwise the underlying platforms :c:func:`!" +"``handle`` named parameter, otherwise the underlying platform's :c:func:`!" "dlopen` or :c:func:`!LoadLibrary` function is used to load the library into " "the process, and to get a handle to it." msgstr "" -#: ../../library/ctypes.rst:1443 +#: ../../library/ctypes.rst:1448 msgid "" "The *mode* parameter can be used to specify how the library is loaded. For " "details, consult the :manpage:`dlopen(3)` manpage. On Windows, *mode* is " @@ -2677,24 +2685,24 @@ msgid "" "configurable." msgstr "" -#: ../../library/ctypes.rst:1448 +#: ../../library/ctypes.rst:1453 msgid "" "The *use_errno* parameter, when set to true, enables a ctypes mechanism that " "allows accessing the system :data:`errno` error number in a safe way. :mod:" -"`ctypes` maintains a thread-local copy of the systems :data:`errno` " +"`ctypes` maintains a thread-local copy of the system's :data:`errno` " "variable; if you call foreign functions created with ``use_errno=True`` then " "the :data:`errno` value before the function call is swapped with the ctypes " "private copy, the same happens immediately after the function call." msgstr "" -#: ../../library/ctypes.rst:1455 +#: ../../library/ctypes.rst:1460 msgid "" "The function :func:`ctypes.get_errno` returns the value of the ctypes " "private copy, and the function :func:`ctypes.set_errno` changes the ctypes " "private copy to a new value and returns the former value." msgstr "" -#: ../../library/ctypes.rst:1459 +#: ../../library/ctypes.rst:1464 msgid "" "The *use_last_error* parameter, when set to true, enables the same mechanism " "for the Windows error code which is managed by the :func:`GetLastError` and :" @@ -2703,7 +2711,7 @@ msgid "" "private copy of the windows error code." msgstr "" -#: ../../library/ctypes.rst:1465 +#: ../../library/ctypes.rst:1470 msgid "" "The *winmode* parameter is used on Windows to specify how the library is " "loaded (since *mode* is ignored). It takes any value that is valid for the " @@ -2713,29 +2721,29 @@ msgid "" "ensure the correct library and dependencies are loaded." msgstr "" -#: ../../library/ctypes.rst:1472 +#: ../../library/ctypes.rst:1477 msgid "Added *winmode* parameter." msgstr "新增 *winmode* 參數。" -#: ../../library/ctypes.rst:1479 +#: ../../library/ctypes.rst:1484 msgid "" "Flag to use as *mode* parameter. On platforms where this flag is not " "available, it is defined as the integer zero." msgstr "" -#: ../../library/ctypes.rst:1486 +#: ../../library/ctypes.rst:1491 msgid "" "Flag to use as *mode* parameter. On platforms where this is not available, " "it is the same as *RTLD_GLOBAL*." msgstr "" -#: ../../library/ctypes.rst:1493 +#: ../../library/ctypes.rst:1498 msgid "" "The default mode which is used to load shared libraries. On OSX 10.3, this " "is *RTLD_GLOBAL*, otherwise it is the same as *RTLD_LOCAL*." msgstr "" -#: ../../library/ctypes.rst:1496 +#: ../../library/ctypes.rst:1501 msgid "" "Instances of these classes have no public methods. Functions exported by " "the shared library can be accessed as attributes or by index. Please note " @@ -2744,7 +2752,7 @@ msgid "" "other hand, accessing it through an index returns a new object each time::" msgstr "" -#: ../../library/ctypes.rst:1502 +#: ../../library/ctypes.rst:1507 msgid "" ">>> from ctypes import CDLL\n" ">>> libc = CDLL(\"libc.so.6\") # On Linux\n" @@ -2760,21 +2768,21 @@ msgstr "" ">>> libc['time'] == libc['time']\n" "False" -#: ../../library/ctypes.rst:1509 +#: ../../library/ctypes.rst:1514 msgid "" "The following public attributes are available, their name starts with an " "underscore to not clash with exported function names:" msgstr "" -#: ../../library/ctypes.rst:1515 +#: ../../library/ctypes.rst:1520 msgid "The system handle used to access the library." msgstr "" -#: ../../library/ctypes.rst:1520 +#: ../../library/ctypes.rst:1525 msgid "The name of the library passed in the constructor." msgstr "" -#: ../../library/ctypes.rst:1522 +#: ../../library/ctypes.rst:1527 msgid "" "Shared libraries can also be loaded by using one of the prefabricated " "objects, which are instances of the :class:`LibraryLoader` class, either by " @@ -2782,13 +2790,13 @@ msgid "" "library as attribute of the loader instance." msgstr "" -#: ../../library/ctypes.rst:1530 +#: ../../library/ctypes.rst:1535 msgid "" "Class which loads shared libraries. *dlltype* should be one of the :class:" "`CDLL`, :class:`PyDLL`, :class:`WinDLL`, or :class:`OleDLL` types." msgstr "" -#: ../../library/ctypes.rst:1533 +#: ../../library/ctypes.rst:1538 msgid "" ":meth:`!__getattr__` has special behavior: It allows loading a shared " "library by accessing it as attribute of a library loader instance. The " @@ -2796,39 +2804,39 @@ msgid "" "each time." msgstr "" -#: ../../library/ctypes.rst:1539 +#: ../../library/ctypes.rst:1544 msgid "" "Load a shared library into the process and return it. This method always " "returns a new instance of the library." msgstr "" -#: ../../library/ctypes.rst:1543 +#: ../../library/ctypes.rst:1548 msgid "These prefabricated library loaders are available:" msgstr "" -#: ../../library/ctypes.rst:1548 +#: ../../library/ctypes.rst:1553 msgid "Creates :class:`CDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1554 +#: ../../library/ctypes.rst:1559 msgid "Windows only: Creates :class:`WinDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1560 +#: ../../library/ctypes.rst:1565 msgid "Windows only: Creates :class:`OleDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1566 +#: ../../library/ctypes.rst:1571 msgid "Creates :class:`PyDLL` instances." msgstr "" -#: ../../library/ctypes.rst:1569 +#: ../../library/ctypes.rst:1574 msgid "" "For accessing the C Python api directly, a ready-to-use Python shared " "library object is available:" msgstr "" -#: ../../library/ctypes.rst:1575 +#: ../../library/ctypes.rst:1580 msgid "" "An instance of :class:`PyDLL` that exposes Python C API functions as " "attributes. Note that all these functions are assumed to return C :c:expr:" @@ -2836,32 +2844,32 @@ msgid "" "correct :attr:`!restype` attribute to use these functions." msgstr "" -#: ../../library/ctypes.rst:1580 ../../library/ctypes.rst:1582 +#: ../../library/ctypes.rst:1585 ../../library/ctypes.rst:1587 msgid "" "Loading a library through any of these objects raises an :ref:`auditing " "event ` ``ctypes.dlopen`` with string argument ``name``, the name " "used to load the library." msgstr "" -#: ../../library/ctypes.rst:1586 ../../library/ctypes.rst:1588 +#: ../../library/ctypes.rst:1591 ../../library/ctypes.rst:1593 msgid "" "Accessing a function on a loaded library raises an auditing event ``ctypes." "dlsym`` with arguments ``library`` (the library object) and ``name`` (the " "symbol's name as a string or integer)." msgstr "" -#: ../../library/ctypes.rst:1592 ../../library/ctypes.rst:1594 +#: ../../library/ctypes.rst:1597 ../../library/ctypes.rst:1599 msgid "" "In cases when only the library handle is available rather than the object, " "accessing a function raises an auditing event ``ctypes.dlsym/handle`` with " "arguments ``handle`` (the raw library handle) and ``name``." msgstr "" -#: ../../library/ctypes.rst:1601 +#: ../../library/ctypes.rst:1606 msgid "Foreign functions" msgstr "" -#: ../../library/ctypes.rst:1603 +#: ../../library/ctypes.rst:1608 msgid "" "As explained in the previous section, foreign functions can be accessed as " "attributes of loaded shared libraries. The function objects created in this " @@ -2870,29 +2878,29 @@ msgid "" "library loader. They are instances of a private class:" msgstr "" -#: ../../library/ctypes.rst:1612 +#: ../../library/ctypes.rst:1617 msgid "Base class for C callable foreign functions." msgstr "" -#: ../../library/ctypes.rst:1614 +#: ../../library/ctypes.rst:1619 msgid "" "Instances of foreign functions are also C compatible data types; they " "represent C function pointers." msgstr "" -#: ../../library/ctypes.rst:1617 +#: ../../library/ctypes.rst:1622 msgid "" "This behavior can be customized by assigning to special attributes of the " "foreign function object." msgstr "" -#: ../../library/ctypes.rst:1622 +#: ../../library/ctypes.rst:1627 msgid "" "Assign a ctypes type to specify the result type of the foreign function. Use " "``None`` for :c:expr:`void`, a function not returning anything." msgstr "" -#: ../../library/ctypes.rst:1625 +#: ../../library/ctypes.rst:1630 msgid "" "It is possible to assign a callable Python object that is not a ctypes type, " "in this case the function is assumed to return a C :c:expr:`int`, and the " @@ -2902,7 +2910,7 @@ msgid "" "callable to the :attr:`errcheck` attribute." msgstr "" -#: ../../library/ctypes.rst:1634 +#: ../../library/ctypes.rst:1639 msgid "" "Assign a tuple of ctypes types to specify the argument types that the " "function accepts. Functions using the ``stdcall`` calling convention can " @@ -2911,7 +2919,7 @@ msgid "" "unspecified arguments as well." msgstr "" -#: ../../library/ctypes.rst:1640 +#: ../../library/ctypes.rst:1645 msgid "" "When a foreign function is called, each actual argument is passed to the :" "meth:`~_CData.from_param` class method of the items in the :attr:`argtypes` " @@ -2921,7 +2929,7 @@ msgid "" "object using ctypes conversion rules." msgstr "" -#: ../../library/ctypes.rst:1647 +#: ../../library/ctypes.rst:1652 msgid "" "New: It is now possible to put items in argtypes which are not ctypes types, " "but each item must have a :meth:`~_CData.from_param` method which returns a " @@ -2929,44 +2937,44 @@ msgid "" "defining adapters that can adapt custom objects as function parameters." msgstr "" -#: ../../library/ctypes.rst:1654 +#: ../../library/ctypes.rst:1659 msgid "" "Assign a Python function or another callable to this attribute. The callable " "will be called with three or more arguments:" msgstr "" -#: ../../library/ctypes.rst:1661 +#: ../../library/ctypes.rst:1666 msgid "" "*result* is what the foreign function returns, as specified by the :attr:`!" "restype` attribute." msgstr "" -#: ../../library/ctypes.rst:1664 +#: ../../library/ctypes.rst:1669 msgid "" "*func* is the foreign function object itself, this allows reusing the same " "callable object to check or post process the results of several functions." msgstr "" -#: ../../library/ctypes.rst:1668 +#: ../../library/ctypes.rst:1673 msgid "" "*arguments* is a tuple containing the parameters originally passed to the " "function call, this allows specializing the behavior on the arguments used." msgstr "" -#: ../../library/ctypes.rst:1672 +#: ../../library/ctypes.rst:1677 msgid "" "The object that this function returns will be returned from the foreign " "function call, but it can also check the result value and raise an exception " "if the foreign function call failed." msgstr "" -#: ../../library/ctypes.rst:1679 +#: ../../library/ctypes.rst:1684 msgid "" "This exception is raised when a foreign function call cannot convert one of " "the passed arguments." msgstr "" -#: ../../library/ctypes.rst:1683 ../../library/ctypes.rst:1685 +#: ../../library/ctypes.rst:1688 ../../library/ctypes.rst:1690 msgid "" "On Windows, when a foreign function call raises a system exception (for " "example, due to an access violation), it will be captured and replaced with " @@ -2975,18 +2983,18 @@ msgid "" "hook to replace the exception with its own." msgstr "" -#: ../../library/ctypes.rst:1691 ../../library/ctypes.rst:1693 +#: ../../library/ctypes.rst:1696 ../../library/ctypes.rst:1698 msgid "" "Some ways to invoke foreign function calls may raise an auditing event " "``ctypes.call_function`` with arguments ``function pointer`` and " "``arguments``." msgstr "" -#: ../../library/ctypes.rst:1699 +#: ../../library/ctypes.rst:1704 msgid "Function prototypes" msgstr "" -#: ../../library/ctypes.rst:1701 +#: ../../library/ctypes.rst:1706 msgid "" "Foreign functions can also be created by instantiating function prototypes. " "Function prototypes are similar to function prototypes in C; they describe a " @@ -2997,7 +3005,7 @@ msgid "" "``@wrapper`` syntax. See :ref:`ctypes-callback-functions` for examples." msgstr "" -#: ../../library/ctypes.rst:1712 +#: ../../library/ctypes.rst:1717 msgid "" "The returned function prototype creates functions that use the standard C " "calling convention. The function will release the GIL during the call. If " @@ -3006,37 +3014,37 @@ msgid "" "after the call; *use_last_error* does the same for the Windows error code." msgstr "" -#: ../../library/ctypes.rst:1722 +#: ../../library/ctypes.rst:1727 msgid "" "Windows only: The returned function prototype creates functions that use the " "``stdcall`` calling convention. The function will release the GIL during " "the call. *use_errno* and *use_last_error* have the same meaning as above." msgstr "" -#: ../../library/ctypes.rst:1730 +#: ../../library/ctypes.rst:1735 msgid "" "The returned function prototype creates functions that use the Python " "calling convention. The function will *not* release the GIL during the call." msgstr "" -#: ../../library/ctypes.rst:1733 +#: ../../library/ctypes.rst:1738 msgid "" "Function prototypes created by these factory functions can be instantiated " "in different ways, depending on the type and number of the parameters in the " "call:" msgstr "" -#: ../../library/ctypes.rst:1740 +#: ../../library/ctypes.rst:1745 msgid "" "Returns a foreign function at the specified address which must be an integer." msgstr "" -#: ../../library/ctypes.rst:1747 +#: ../../library/ctypes.rst:1752 msgid "" "Create a C callable function (a callback function) from a Python *callable*." msgstr "" -#: ../../library/ctypes.rst:1754 +#: ../../library/ctypes.rst:1759 msgid "" "Returns a foreign function exported by a shared library. *func_spec* must be " "a 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the " @@ -3044,7 +3052,7 @@ msgid "" "small integer. The second item is the shared library instance." msgstr "" -#: ../../library/ctypes.rst:1764 +#: ../../library/ctypes.rst:1769 msgid "" "Returns a foreign function that will call a COM method. *vtbl_index* is the " "index into the virtual function table, a small non-negative integer. *name* " @@ -3052,79 +3060,79 @@ msgid "" "identifier which is used in extended error reporting." msgstr "" -#: ../../library/ctypes.rst:1769 +#: ../../library/ctypes.rst:1774 msgid "" "COM methods use a special calling convention: They require a pointer to the " "COM interface as first argument, in addition to those parameters that are " "specified in the :attr:`!argtypes` tuple." msgstr "" -#: ../../library/ctypes.rst:1773 +#: ../../library/ctypes.rst:1778 msgid "" "The optional *paramflags* parameter creates foreign function wrappers with " "much more functionality than the features described above." msgstr "" -#: ../../library/ctypes.rst:1776 +#: ../../library/ctypes.rst:1781 msgid "" "*paramflags* must be a tuple of the same length as :attr:`~_FuncPtr." "argtypes`." msgstr "" -#: ../../library/ctypes.rst:1778 +#: ../../library/ctypes.rst:1783 msgid "" "Each item in this tuple contains further information about a parameter, it " "must be a tuple containing one, two, or three items." msgstr "" -#: ../../library/ctypes.rst:1781 +#: ../../library/ctypes.rst:1786 msgid "" "The first item is an integer containing a combination of direction flags for " "the parameter:" msgstr "" -#: ../../library/ctypes.rst:1784 +#: ../../library/ctypes.rst:1789 msgid "1" msgstr "1" -#: ../../library/ctypes.rst:1785 +#: ../../library/ctypes.rst:1790 msgid "Specifies an input parameter to the function." msgstr "" -#: ../../library/ctypes.rst:1787 +#: ../../library/ctypes.rst:1792 msgid "2" msgstr "2" -#: ../../library/ctypes.rst:1788 +#: ../../library/ctypes.rst:1793 msgid "Output parameter. The foreign function fills in a value." msgstr "" -#: ../../library/ctypes.rst:1790 +#: ../../library/ctypes.rst:1795 msgid "4" msgstr "4" -#: ../../library/ctypes.rst:1791 +#: ../../library/ctypes.rst:1796 msgid "Input parameter which defaults to the integer zero." msgstr "" -#: ../../library/ctypes.rst:1793 +#: ../../library/ctypes.rst:1798 msgid "" "The optional second item is the parameter name as string. If this is " "specified, the foreign function can be called with named parameters." msgstr "" -#: ../../library/ctypes.rst:1796 +#: ../../library/ctypes.rst:1801 msgid "The optional third item is the default value for this parameter." msgstr "" -#: ../../library/ctypes.rst:1799 +#: ../../library/ctypes.rst:1804 msgid "" "The following example demonstrates how to wrap the Windows ``MessageBoxW`` " "function so that it supports default parameters and named arguments. The C " "declaration from the windows header file is this::" msgstr "" -#: ../../library/ctypes.rst:1803 +#: ../../library/ctypes.rst:1808 msgid "" "WINUSERAPI int WINAPI\n" "MessageBoxW(\n" @@ -3140,11 +3148,11 @@ msgstr "" " LPCWSTR lpCaption,\n" " UINT uType);" -#: ../../library/ctypes.rst:1810 ../../library/ctypes.rst:1833 +#: ../../library/ctypes.rst:1815 ../../library/ctypes.rst:1838 msgid "Here is the wrapping with :mod:`ctypes`::" msgstr "" -#: ../../library/ctypes.rst:1812 +#: ../../library/ctypes.rst:1817 msgid "" ">>> from ctypes import c_int, WINFUNCTYPE, windll\n" ">>> from ctypes.wintypes import HWND, LPCWSTR, UINT\n" @@ -3160,11 +3168,11 @@ msgstr "" "\"Hello from ctypes\"), (1, \"flags\", 0)\n" ">>> MessageBox = prototype((\"MessageBoxW\", windll.user32), paramflags)" -#: ../../library/ctypes.rst:1818 +#: ../../library/ctypes.rst:1823 msgid "The ``MessageBox`` foreign function can now be called in these ways::" msgstr "" -#: ../../library/ctypes.rst:1820 +#: ../../library/ctypes.rst:1825 msgid "" ">>> MessageBox()\n" ">>> MessageBox(text=\"Spam, spam, spam\")\n" @@ -3174,7 +3182,7 @@ msgstr "" ">>> MessageBox(text=\"Spam, spam, spam\")\n" ">>> MessageBox(flags=2, text=\"foo bar\")" -#: ../../library/ctypes.rst:1824 +#: ../../library/ctypes.rst:1829 msgid "" "A second example demonstrates output parameters. The win32 " "``GetWindowRect`` function retrieves the dimensions of a specified window by " @@ -3182,7 +3190,7 @@ msgid "" "the C declaration::" msgstr "" -#: ../../library/ctypes.rst:1828 +#: ../../library/ctypes.rst:1833 msgid "" "WINUSERAPI BOOL WINAPI\n" "GetWindowRect(\n" @@ -3194,7 +3202,7 @@ msgstr "" " HWND hWnd,\n" " LPRECT lpRect);" -#: ../../library/ctypes.rst:1835 +#: ../../library/ctypes.rst:1840 msgid "" ">>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError\n" ">>> from ctypes.wintypes import BOOL, HWND, RECT\n" @@ -3212,7 +3220,7 @@ msgstr "" "paramflags)\n" ">>>" -#: ../../library/ctypes.rst:1842 +#: ../../library/ctypes.rst:1847 msgid "" "Functions with output parameters will automatically return the output " "parameter value if there is a single one, or a tuple containing the output " @@ -3220,7 +3228,7 @@ msgid "" "now returns a RECT instance, when called." msgstr "" -#: ../../library/ctypes.rst:1847 +#: ../../library/ctypes.rst:1852 msgid "" "Output parameters can be combined with the :attr:`~_FuncPtr.errcheck` " "protocol to do further output processing and error checking. The win32 " @@ -3229,7 +3237,7 @@ msgid "" "exception when the api call failed::" msgstr "" -#: ../../library/ctypes.rst:1852 +#: ../../library/ctypes.rst:1857 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3247,7 +3255,7 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:1860 +#: ../../library/ctypes.rst:1865 msgid "" "If the :attr:`~_FuncPtr.errcheck` function returns the argument tuple it " "receives unchanged, :mod:`ctypes` continues the normal processing it does on " @@ -3256,7 +3264,7 @@ msgid "" "and return them instead, the normal processing will no longer take place::" msgstr "" -#: ../../library/ctypes.rst:1866 +#: ../../library/ctypes.rst:1871 msgid "" ">>> def errcheck(result, func, args):\n" "... if not result:\n" @@ -3276,17 +3284,17 @@ msgstr "" ">>> GetWindowRect.errcheck = errcheck\n" ">>>" -#: ../../library/ctypes.rst:1879 +#: ../../library/ctypes.rst:1884 msgid "Utility functions" msgstr "" -#: ../../library/ctypes.rst:1883 +#: ../../library/ctypes.rst:1888 msgid "" "Returns the address of the memory buffer as integer. *obj* must be an " "instance of a ctypes type." msgstr "" -#: ../../library/ctypes.rst:1886 +#: ../../library/ctypes.rst:1891 msgid "" "Raises an :ref:`auditing event ` ``ctypes.addressof`` with " "argument ``obj``." @@ -3294,34 +3302,34 @@ msgstr "" "引發一個附帶引數 ``obj`` 的\\ :ref:`稽核事件 ` ``ctypes." "addressof``。" -#: ../../library/ctypes.rst:1891 +#: ../../library/ctypes.rst:1896 msgid "" "Returns the alignment requirements of a ctypes type. *obj_or_type* must be a " "ctypes type or instance." msgstr "" -#: ../../library/ctypes.rst:1897 +#: ../../library/ctypes.rst:1902 msgid "" "Returns a light-weight pointer to *obj*, which must be an instance of a " "ctypes type. *offset* defaults to zero, and must be an integer that will be " "added to the internal pointer value." msgstr "" -#: ../../library/ctypes.rst:1901 +#: ../../library/ctypes.rst:1906 msgid "``byref(obj, offset)`` corresponds to this C code::" msgstr "" -#: ../../library/ctypes.rst:1903 +#: ../../library/ctypes.rst:1908 msgid "(((char *)&obj) + offset)" msgstr "(((char *)&obj) + offset)" -#: ../../library/ctypes.rst:1905 +#: ../../library/ctypes.rst:1910 msgid "" "The returned object can only be used as a foreign function call parameter. " "It behaves similar to ``pointer(obj)``, but the construction is a lot faster." msgstr "" -#: ../../library/ctypes.rst:1911 +#: ../../library/ctypes.rst:1916 msgid "" "This function is similar to the cast operator in C. It returns a new " "instance of *type* which points to the same memory block as *obj*. *type* " @@ -3329,19 +3337,19 @@ msgid "" "as a pointer." msgstr "" -#: ../../library/ctypes.rst:1919 +#: ../../library/ctypes.rst:1924 msgid "" "This function creates a mutable character buffer. The returned object is a " "ctypes array of :class:`c_char`." msgstr "" -#: ../../library/ctypes.rst:1922 +#: ../../library/ctypes.rst:1927 msgid "" "*init_or_size* must be an integer which specifies the size of the array, or " "a bytes object which will be used to initialize the array items." msgstr "" -#: ../../library/ctypes.rst:1925 +#: ../../library/ctypes.rst:1930 msgid "" "If a bytes object is specified as first argument, the buffer is made one " "item larger than its length so that the last element in the array is a NUL " @@ -3350,7 +3358,7 @@ msgid "" "not be used." msgstr "" -#: ../../library/ctypes.rst:1930 +#: ../../library/ctypes.rst:1935 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_string_buffer`` " "with arguments ``init``, ``size``." @@ -3358,19 +3366,19 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_string_buffer``。" -#: ../../library/ctypes.rst:1935 +#: ../../library/ctypes.rst:1940 msgid "" "This function creates a mutable unicode character buffer. The returned " "object is a ctypes array of :class:`c_wchar`." msgstr "" -#: ../../library/ctypes.rst:1938 +#: ../../library/ctypes.rst:1943 msgid "" "*init_or_size* must be an integer which specifies the size of the array, or " "a string which will be used to initialize the array items." msgstr "" -#: ../../library/ctypes.rst:1941 +#: ../../library/ctypes.rst:1946 msgid "" "If a string is specified as first argument, the buffer is made one item " "larger than the length of the string so that the last element in the array " @@ -3379,7 +3387,7 @@ msgid "" "should not be used." msgstr "" -#: ../../library/ctypes.rst:1947 +#: ../../library/ctypes.rst:1952 msgid "" "Raises an :ref:`auditing event ` ``ctypes.create_unicode_buffer`` " "with arguments ``init``, ``size``." @@ -3387,21 +3395,21 @@ msgstr "" "引發一個附帶引數 ``init`` 與 ``size`` 的\\ :ref:`稽核事件 ` " "``ctypes.create_unicode_buffer``。" -#: ../../library/ctypes.rst:1952 +#: ../../library/ctypes.rst:1957 msgid "" "Windows only: This function is a hook which allows implementing in-process " "COM servers with ctypes. It is called from the DllCanUnloadNow function " "that the _ctypes extension dll exports." msgstr "" -#: ../../library/ctypes.rst:1959 +#: ../../library/ctypes.rst:1964 msgid "" "Windows only: This function is a hook which allows implementing in-process " "COM servers with ctypes. It is called from the DllGetClassObject function " "that the ``_ctypes`` extension dll exports." msgstr "" -#: ../../library/ctypes.rst:1967 +#: ../../library/ctypes.rst:1972 msgid "" "Try to find a library and return a pathname. *name* is the library name " "without any prefix like ``lib``, suffix like ``.so``, ``.dylib`` or version " @@ -3409,94 +3417,94 @@ msgid "" "If no library can be found, returns ``None``." msgstr "" -#: ../../library/ctypes.rst:1978 +#: ../../library/ctypes.rst:1983 msgid "" "Windows only: return the filename of the VC runtime library used by Python, " "and by the extension modules. If the name of the library cannot be " "determined, ``None`` is returned." msgstr "" -#: ../../library/ctypes.rst:1982 +#: ../../library/ctypes.rst:1987 msgid "" "If you need to free memory, for example, allocated by an extension module " "with a call to the ``free(void *)``, it is important that you use the " "function in the same library that allocated the memory." msgstr "" -#: ../../library/ctypes.rst:1989 +#: ../../library/ctypes.rst:1994 msgid "" "Windows only: Returns a textual description of the error code *code*. If no " "error code is specified, the last error code is used by calling the Windows " "api function GetLastError." msgstr "" -#: ../../library/ctypes.rst:1996 +#: ../../library/ctypes.rst:2001 msgid "" "Windows only: Returns the last error code set by Windows in the calling " "thread. This function calls the Windows ``GetLastError()`` function " "directly, it does not return the ctypes-private copy of the error code." msgstr "" -#: ../../library/ctypes.rst:2002 +#: ../../library/ctypes.rst:2007 msgid "" "Returns the current value of the ctypes-private copy of the system :data:" "`errno` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2005 +#: ../../library/ctypes.rst:2010 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_errno`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_errno``。" -#: ../../library/ctypes.rst:2009 +#: ../../library/ctypes.rst:2014 msgid "" "Windows only: returns the current value of the ctypes-private copy of the " "system :data:`!LastError` variable in the calling thread." msgstr "" -#: ../../library/ctypes.rst:2012 +#: ../../library/ctypes.rst:2017 msgid "" "Raises an :ref:`auditing event ` ``ctypes.get_last_error`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``ctypes.get_last_error``。" -#: ../../library/ctypes.rst:2016 +#: ../../library/ctypes.rst:2021 msgid "" "Same as the standard C memmove library function: copies *count* bytes from " "*src* to *dst*. *dst* and *src* must be integers or ctypes instances that " "can be converted to pointers." msgstr "" -#: ../../library/ctypes.rst:2023 +#: ../../library/ctypes.rst:2028 msgid "" "Same as the standard C memset library function: fills the memory block at " "address *dst* with *count* bytes of value *c*. *dst* must be an integer " "specifying an address, or a ctypes instance." msgstr "" -#: ../../library/ctypes.rst:2030 +#: ../../library/ctypes.rst:2035 msgid "" "Create and return a new ctypes pointer type. Pointer types are cached and " "reused internally, so calling this function repeatedly is cheap. *type* must " "be a ctypes type." msgstr "" -#: ../../library/ctypes.rst:2037 +#: ../../library/ctypes.rst:2042 msgid "" "Create a new pointer instance, pointing to *obj*. The returned object is of " "the type ``POINTER(type(obj))``." msgstr "" -#: ../../library/ctypes.rst:2040 +#: ../../library/ctypes.rst:2045 msgid "" "Note: If you just want to pass a pointer to an object to a foreign function " "call, you should use ``byref(obj)`` which is much faster." msgstr "" -#: ../../library/ctypes.rst:2046 +#: ../../library/ctypes.rst:2051 msgid "" "This function resizes the internal memory buffer of *obj*, which must be an " "instance of a ctypes type. It is not possible to make the buffer smaller " @@ -3504,13 +3512,13 @@ msgid "" "but it is possible to enlarge the buffer." msgstr "" -#: ../../library/ctypes.rst:2054 +#: ../../library/ctypes.rst:2059 msgid "" "Set the current value of the ctypes-private copy of the system :data:`errno` " "variable in the calling thread to *value* and return the previous value." msgstr "" -#: ../../library/ctypes.rst:2057 +#: ../../library/ctypes.rst:2062 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_errno`` with " "argument ``errno``." @@ -3518,14 +3526,14 @@ msgstr "" "引發一個附帶引數 ``errno`` 的\\ :ref:`稽核事件 ` ``ctypes." "set_errno``。" -#: ../../library/ctypes.rst:2062 +#: ../../library/ctypes.rst:2067 msgid "" "Windows only: set the current value of the ctypes-private copy of the " "system :data:`!LastError` variable in the calling thread to *value* and " "return the previous value." msgstr "" -#: ../../library/ctypes.rst:2066 +#: ../../library/ctypes.rst:2071 msgid "" "Raises an :ref:`auditing event ` ``ctypes.set_last_error`` with " "argument ``error``." @@ -3533,19 +3541,19 @@ msgstr "" "引發一個附帶引數 ``error`` 的\\ :ref:`稽核事件 ` ``ctypes." "set_last_error``。" -#: ../../library/ctypes.rst:2071 +#: ../../library/ctypes.rst:2076 msgid "" "Returns the size in bytes of a ctypes type or instance memory buffer. Does " "the same as the C ``sizeof`` operator." msgstr "" -#: ../../library/ctypes.rst:2077 +#: ../../library/ctypes.rst:2082 msgid "" "Return the byte string at *void \\*ptr*. If *size* is specified, it is used " "as size, otherwise the string is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2081 +#: ../../library/ctypes.rst:2086 msgid "" "Raises an :ref:`auditing event ` ``ctypes.string_at`` with " "arguments ``ptr``, ``size``." @@ -3553,7 +3561,7 @@ msgstr "" "引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." "string_at``。" -#: ../../library/ctypes.rst:2086 +#: ../../library/ctypes.rst:2091 msgid "" "Windows only: this function is probably the worst-named thing in ctypes. It " "creates an instance of :exc:`OSError`. If *code* is not specified, " @@ -3562,20 +3570,20 @@ msgid "" "error." msgstr "" -#: ../../library/ctypes.rst:2092 +#: ../../library/ctypes.rst:2097 msgid "" "An instance of :exc:`WindowsError` used to be created, which is now an alias " "of :exc:`OSError`." msgstr "" -#: ../../library/ctypes.rst:2099 +#: ../../library/ctypes.rst:2104 msgid "" "Return the wide-character string at *void \\*ptr*. If *size* is specified, " "it is used as the number of characters of the string, otherwise the string " "is assumed to be zero-terminated." msgstr "" -#: ../../library/ctypes.rst:2104 +#: ../../library/ctypes.rst:2109 msgid "" "Raises an :ref:`auditing event ` ``ctypes.wstring_at`` with " "arguments ``ptr``, ``size``." @@ -3583,11 +3591,11 @@ msgstr "" "引發一個附帶引數 ``ptr``、``size`` 的\\ :ref:`稽核事件 ` ``ctypes." "wstring_at``。" -#: ../../library/ctypes.rst:2110 +#: ../../library/ctypes.rst:2115 msgid "Data types" msgstr "" -#: ../../library/ctypes.rst:2115 +#: ../../library/ctypes.rst:2120 msgid "" "This non-public class is the common base class of all ctypes data types. " "Among other things, all ctypes type instances contain a memory block that " @@ -3597,13 +3605,13 @@ msgid "" "alive in case the memory block contains pointers." msgstr "" -#: ../../library/ctypes.rst:2122 +#: ../../library/ctypes.rst:2127 msgid "" "Common methods of ctypes data types, these are all class methods (to be " "exact, they are methods of the :term:`metaclass`):" msgstr "" -#: ../../library/ctypes.rst:2127 +#: ../../library/ctypes.rst:2132 msgid "" "This method returns a ctypes instance that shares the buffer of the *source* " "object. The *source* object must support the writeable buffer interface. " @@ -3612,7 +3620,7 @@ msgid "" "exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2133 ../../library/ctypes.rst:2143 +#: ../../library/ctypes.rst:2138 ../../library/ctypes.rst:2148 msgid "" "Raises an :ref:`auditing event ` ``ctypes.cdata/buffer`` with " "arguments ``pointer``, ``size``, ``offset``." @@ -3620,7 +3628,7 @@ msgstr "" "引發一個附帶引數 ``pointer``、``size``、``offset`` 的\\ :ref:`稽核事件 " "` ``ctypes.cdata/buffer``。" -#: ../../library/ctypes.rst:2137 +#: ../../library/ctypes.rst:2142 msgid "" "This method creates a ctypes instance, copying the buffer from the *source* " "object buffer which must be readable. The optional *offset* parameter " @@ -3628,19 +3636,19 @@ msgid "" "If the source buffer is not large enough a :exc:`ValueError` is raised." msgstr "" -#: ../../library/ctypes.rst:2147 +#: ../../library/ctypes.rst:2152 msgid "" "This method returns a ctypes type instance using the memory specified by " "*address* which must be an integer." msgstr "" -#: ../../library/ctypes.rst:2150 ../../library/ctypes.rst:2152 +#: ../../library/ctypes.rst:2155 ../../library/ctypes.rst:2157 msgid "" "This method, and others that indirectly call this method, raises an :ref:" "`auditing event ` ``ctypes.cdata`` with argument ``address``." msgstr "" -#: ../../library/ctypes.rst:2158 +#: ../../library/ctypes.rst:2163 msgid "" "This method adapts *obj* to a ctypes type. It is called with the actual " "object used in a foreign function call when the type is present in the " @@ -3648,25 +3656,25 @@ msgid "" "object that can be used as a function call parameter." msgstr "" -#: ../../library/ctypes.rst:2163 +#: ../../library/ctypes.rst:2168 msgid "" "All ctypes data types have a default implementation of this classmethod that " "normally returns *obj* if that is an instance of the type. Some types " "accept other objects as well." msgstr "" -#: ../../library/ctypes.rst:2169 +#: ../../library/ctypes.rst:2174 msgid "" "This method returns a ctypes type instance exported by a shared library. " "*name* is the name of the symbol that exports the data, *library* is the " "loaded shared library." msgstr "" -#: ../../library/ctypes.rst:2173 +#: ../../library/ctypes.rst:2178 msgid "Common instance variables of ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2177 +#: ../../library/ctypes.rst:2182 msgid "" "Sometimes ctypes data instances do not own the memory block they contain, " "instead they share part of the memory block of a base object. The :attr:" @@ -3674,13 +3682,13 @@ msgid "" "block." msgstr "" -#: ../../library/ctypes.rst:2184 +#: ../../library/ctypes.rst:2189 msgid "" "This read-only variable is true when the ctypes data instance has allocated " "the memory block itself, false otherwise." msgstr "" -#: ../../library/ctypes.rst:2189 +#: ../../library/ctypes.rst:2194 msgid "" "This member is either ``None`` or a dictionary containing Python objects " "that need to be kept alive so that the memory block contents is kept valid. " @@ -3688,7 +3696,7 @@ msgid "" "dictionary." msgstr "" -#: ../../library/ctypes.rst:2202 +#: ../../library/ctypes.rst:2207 msgid "" "This non-public class is the base class of all fundamental ctypes data " "types. It is mentioned here because it contains the common attributes of the " @@ -3697,11 +3705,11 @@ msgid "" "types that are not and do not contain pointers can now be pickled." msgstr "" -#: ../../library/ctypes.rst:2208 +#: ../../library/ctypes.rst:2213 msgid "Instances have a single attribute:" msgstr "" -#: ../../library/ctypes.rst:2212 +#: ../../library/ctypes.rst:2217 msgid "" "This attribute contains the actual value of the instance. For integer and " "pointer types, it is an integer, for character types, it is a single " @@ -3709,7 +3717,7 @@ msgid "" "bytes object or string." msgstr "" -#: ../../library/ctypes.rst:2217 +#: ../../library/ctypes.rst:2222 msgid "" "When the ``value`` attribute is retrieved from a ctypes instance, usually a " "new object is returned each time. :mod:`ctypes` does *not* implement " @@ -3717,7 +3725,7 @@ msgid "" "true for all other ctypes object instances." msgstr "" -#: ../../library/ctypes.rst:2223 +#: ../../library/ctypes.rst:2228 msgid "" "Fundamental data types, when returned as foreign function call results, or, " "for example, by retrieving structure field members or array items, are " @@ -3727,7 +3735,7 @@ msgid "" "instance." msgstr "" -#: ../../library/ctypes.rst:2231 +#: ../../library/ctypes.rst:2236 msgid "" "Subclasses of fundamental data types do *not* inherit this behavior. So, if " "a foreign functions :attr:`!restype` is a subclass of :class:`c_void_p`, you " @@ -3735,25 +3743,25 @@ msgid "" "you can get the value of the pointer by accessing the ``value`` attribute." msgstr "" -#: ../../library/ctypes.rst:2236 +#: ../../library/ctypes.rst:2241 msgid "These are the fundamental ctypes data types:" msgstr "" -#: ../../library/ctypes.rst:2240 +#: ../../library/ctypes.rst:2245 msgid "" "Represents the C :c:expr:`signed char` datatype, and interprets the value as " "small integer. The constructor accepts an optional integer initializer; no " "overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2247 +#: ../../library/ctypes.rst:2252 msgid "" "Represents the C :c:expr:`char` datatype, and interprets the value as a " "single character. The constructor accepts an optional string initializer, " "the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2254 +#: ../../library/ctypes.rst:2259 msgid "" "Represents the C :c:expr:`char *` datatype when it points to a zero-" "terminated string. For a general character pointer that may also point to " @@ -3761,182 +3769,182 @@ msgid "" "integer address, or a bytes object." msgstr "" -#: ../../library/ctypes.rst:2262 +#: ../../library/ctypes.rst:2267 msgid "" "Represents the C :c:expr:`double` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2268 +#: ../../library/ctypes.rst:2273 msgid "" "Represents the C :c:expr:`long double` datatype. The constructor accepts an " "optional float initializer. On platforms where ``sizeof(long double) == " "sizeof(double)`` it is an alias to :class:`c_double`." msgstr "" -#: ../../library/ctypes.rst:2274 +#: ../../library/ctypes.rst:2279 msgid "" "Represents the C :c:expr:`float` datatype. The constructor accepts an " "optional float initializer." msgstr "" -#: ../../library/ctypes.rst:2280 +#: ../../library/ctypes.rst:2285 msgid "" "Represents the C :c:expr:`signed int` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias to :class:`c_long`." msgstr "" -#: ../../library/ctypes.rst:2287 +#: ../../library/ctypes.rst:2292 msgid "" "Represents the C 8-bit :c:expr:`signed int` datatype. Usually an alias for :" "class:`c_byte`." msgstr "" -#: ../../library/ctypes.rst:2293 +#: ../../library/ctypes.rst:2298 msgid "" "Represents the C 16-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_short`." msgstr "" -#: ../../library/ctypes.rst:2299 +#: ../../library/ctypes.rst:2304 msgid "" "Represents the C 32-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_int`." msgstr "" -#: ../../library/ctypes.rst:2305 +#: ../../library/ctypes.rst:2310 msgid "" "Represents the C 64-bit :c:expr:`signed int` datatype. Usually an alias " "for :class:`c_longlong`." msgstr "" -#: ../../library/ctypes.rst:2311 +#: ../../library/ctypes.rst:2316 msgid "" "Represents the C :c:expr:`signed long` datatype. The constructor accepts an " "optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2317 +#: ../../library/ctypes.rst:2322 msgid "" "Represents the C :c:expr:`signed long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2323 +#: ../../library/ctypes.rst:2328 msgid "" "Represents the C :c:expr:`signed short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2329 +#: ../../library/ctypes.rst:2334 msgid "Represents the C :c:type:`size_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2334 +#: ../../library/ctypes.rst:2339 msgid "Represents the C :c:type:`ssize_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2341 +#: ../../library/ctypes.rst:2346 msgid "Represents the C :c:type:`time_t` datatype." msgstr "" -#: ../../library/ctypes.rst:2348 +#: ../../library/ctypes.rst:2353 msgid "" "Represents the C :c:expr:`unsigned char` datatype, it interprets the value " "as small integer. The constructor accepts an optional integer initializer; " "no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2355 +#: ../../library/ctypes.rst:2360 msgid "" "Represents the C :c:expr:`unsigned int` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done. On platforms " "where ``sizeof(int) == sizeof(long)`` it is an alias for :class:`c_ulong`." msgstr "" -#: ../../library/ctypes.rst:2362 +#: ../../library/ctypes.rst:2367 msgid "" "Represents the C 8-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ubyte`." msgstr "" -#: ../../library/ctypes.rst:2368 +#: ../../library/ctypes.rst:2373 msgid "" "Represents the C 16-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ushort`." msgstr "" -#: ../../library/ctypes.rst:2374 +#: ../../library/ctypes.rst:2379 msgid "" "Represents the C 32-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_uint`." msgstr "" -#: ../../library/ctypes.rst:2380 +#: ../../library/ctypes.rst:2385 msgid "" "Represents the C 64-bit :c:expr:`unsigned int` datatype. Usually an alias " "for :class:`c_ulonglong`." msgstr "" -#: ../../library/ctypes.rst:2386 +#: ../../library/ctypes.rst:2391 msgid "" "Represents the C :c:expr:`unsigned long` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2392 +#: ../../library/ctypes.rst:2397 msgid "" "Represents the C :c:expr:`unsigned long long` datatype. The constructor " "accepts an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2398 +#: ../../library/ctypes.rst:2403 msgid "" "Represents the C :c:expr:`unsigned short` datatype. The constructor accepts " "an optional integer initializer; no overflow checking is done." msgstr "" -#: ../../library/ctypes.rst:2404 +#: ../../library/ctypes.rst:2409 msgid "" "Represents the C :c:expr:`void *` type. The value is represented as " "integer. The constructor accepts an optional integer initializer." msgstr "" -#: ../../library/ctypes.rst:2410 +#: ../../library/ctypes.rst:2415 msgid "" "Represents the C :c:type:`wchar_t` datatype, and interprets the value as a " "single character unicode string. The constructor accepts an optional string " "initializer, the length of the string must be exactly one character." msgstr "" -#: ../../library/ctypes.rst:2417 +#: ../../library/ctypes.rst:2422 msgid "" "Represents the C :c:expr:`wchar_t *` datatype, which must be a pointer to a " "zero-terminated wide character string. The constructor accepts an integer " "address, or a string." msgstr "" -#: ../../library/ctypes.rst:2424 +#: ../../library/ctypes.rst:2429 msgid "" "Represent the C :c:expr:`bool` datatype (more accurately, :c:expr:`_Bool` " "from C99). Its value can be ``True`` or ``False``, and the constructor " "accepts any object that has a truth value." msgstr "" -#: ../../library/ctypes.rst:2431 +#: ../../library/ctypes.rst:2436 msgid "" "Windows only: Represents a :c:type:`!HRESULT` value, which contains success " "or error information for a function or method call." msgstr "" -#: ../../library/ctypes.rst:2437 +#: ../../library/ctypes.rst:2442 msgid "" "Represents the C :c:expr:`PyObject *` datatype. Calling this without an " "argument creates a ``NULL`` :c:expr:`PyObject *` pointer." msgstr "" -#: ../../library/ctypes.rst:2440 +#: ../../library/ctypes.rst:2445 msgid "" "The :mod:`!ctypes.wintypes` module provides quite some other Windows " "specific data types, for example :c:type:`!HWND`, :c:type:`!WPARAM`, or :c:" @@ -3944,41 +3952,41 @@ msgid "" "are also defined." msgstr "" -#: ../../library/ctypes.rst:2448 +#: ../../library/ctypes.rst:2453 msgid "Structured data types" msgstr "" -#: ../../library/ctypes.rst:2453 +#: ../../library/ctypes.rst:2458 msgid "Abstract base class for unions in native byte order." msgstr "" -#: ../../library/ctypes.rst:2458 +#: ../../library/ctypes.rst:2463 msgid "Abstract base class for unions in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2464 +#: ../../library/ctypes.rst:2469 msgid "Abstract base class for unions in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2470 +#: ../../library/ctypes.rst:2475 msgid "Abstract base class for structures in *big endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2475 +#: ../../library/ctypes.rst:2480 msgid "Abstract base class for structures in *little endian* byte order." msgstr "" -#: ../../library/ctypes.rst:2477 +#: ../../library/ctypes.rst:2482 msgid "" "Structures and unions with non-native byte order cannot contain pointer type " "fields, or any other data types containing pointer type fields." msgstr "" -#: ../../library/ctypes.rst:2483 +#: ../../library/ctypes.rst:2488 msgid "Abstract base class for structures in *native* byte order." msgstr "" -#: ../../library/ctypes.rst:2485 +#: ../../library/ctypes.rst:2490 msgid "" "Concrete structure and union types must be created by subclassing one of " "these types, and at least define a :attr:`_fields_` class variable. :mod:" @@ -3986,34 +3994,34 @@ msgid "" "the fields by direct attribute accesses. These are the" msgstr "" -#: ../../library/ctypes.rst:2493 +#: ../../library/ctypes.rst:2498 msgid "" "A sequence defining the structure fields. The items must be 2-tuples or 3-" "tuples. The first item is the name of the field, the second item specifies " "the type of the field; it can be any ctypes data type." msgstr "" -#: ../../library/ctypes.rst:2497 +#: ../../library/ctypes.rst:2502 msgid "" "For integer type fields like :class:`c_int`, a third optional item can be " "given. It must be a small positive integer defining the bit width of the " "field." msgstr "" -#: ../../library/ctypes.rst:2501 +#: ../../library/ctypes.rst:2506 msgid "" "Field names must be unique within one structure or union. This is not " "checked, only one field can be accessed when names are repeated." msgstr "" -#: ../../library/ctypes.rst:2504 +#: ../../library/ctypes.rst:2509 msgid "" "It is possible to define the :attr:`_fields_` class variable *after* the " "class statement that defines the Structure subclass, this allows creating " "data types that directly or indirectly reference themselves::" msgstr "" -#: ../../library/ctypes.rst:2508 +#: ../../library/ctypes.rst:2513 msgid "" "class List(Structure):\n" " pass\n" @@ -4027,7 +4035,7 @@ msgstr "" " ...\n" " ]" -#: ../../library/ctypes.rst:2514 +#: ../../library/ctypes.rst:2519 msgid "" "The :attr:`_fields_` class variable must, however, be defined before the " "type is first used (an instance is created, :func:`sizeof` is called on it, " @@ -4035,14 +4043,14 @@ msgid "" "raise an AttributeError." msgstr "" -#: ../../library/ctypes.rst:2519 +#: ../../library/ctypes.rst:2524 msgid "" "It is possible to define sub-subclasses of structure types, they inherit the " "fields of the base class plus the :attr:`_fields_` defined in the sub-" "subclass, if any." msgstr "" -#: ../../library/ctypes.rst:2526 +#: ../../library/ctypes.rst:2531 msgid "" "An optional small integer that allows overriding the alignment of structure " "fields in the instance. :attr:`_pack_` must already be defined when :attr:" @@ -4050,14 +4058,21 @@ msgid "" "attribute to 0 is the same as not setting it at all." msgstr "" -#: ../../library/ctypes.rst:2534 +#: ../../library/ctypes.rst:2539 +msgid "" +"An optional small integer that allows overriding the alignment of the " +"structure when being packed or unpacked to/from memory. Setting this " +"attribute to 0 is the same as not setting it at all." +msgstr "" + +#: ../../library/ctypes.rst:2545 msgid "" "An optional sequence that lists the names of unnamed (anonymous) fields. :" "attr:`_anonymous_` must be already defined when :attr:`_fields_` is " "assigned, otherwise it will have no effect." msgstr "" -#: ../../library/ctypes.rst:2538 +#: ../../library/ctypes.rst:2549 msgid "" "The fields listed in this variable must be structure or union type fields. :" "mod:`ctypes` will create descriptors in the structure type that allows " @@ -4065,11 +4080,11 @@ msgid "" "structure or union field." msgstr "" -#: ../../library/ctypes.rst:2543 +#: ../../library/ctypes.rst:2554 msgid "Here is an example type (Windows)::" msgstr "" -#: ../../library/ctypes.rst:2545 +#: ../../library/ctypes.rst:2556 msgid "" "class _U(Union):\n" " _fields_ = [(\"lptdesc\", POINTER(TYPEDESC)),\n" @@ -4091,7 +4106,7 @@ msgstr "" " _fields_ = [(\"u\", _U),\n" " (\"vt\", VARTYPE)]" -#: ../../library/ctypes.rst:2556 +#: ../../library/ctypes.rst:2567 msgid "" "The ``TYPEDESC`` structure describes a COM data type, the ``vt`` field " "specifies which one of the union fields is valid. Since the ``u`` field is " @@ -4101,7 +4116,7 @@ msgid "" "temporary union instance::" msgstr "" -#: ../../library/ctypes.rst:2563 +#: ../../library/ctypes.rst:2574 msgid "" "td = TYPEDESC()\n" "td.vt = VT_PTR\n" @@ -4113,7 +4128,7 @@ msgstr "" "td.lptdesc = POINTER(some_type)\n" "td.u.lptdesc = POINTER(some_type)" -#: ../../library/ctypes.rst:2568 +#: ../../library/ctypes.rst:2579 msgid "" "It is possible to define sub-subclasses of structures, they inherit the " "fields of the base class. If the subclass definition has a separate :attr:" @@ -4121,7 +4136,7 @@ msgid "" "of the base class." msgstr "" -#: ../../library/ctypes.rst:2573 +#: ../../library/ctypes.rst:2584 msgid "" "Structure and union constructors accept both positional and keyword " "arguments. Positional arguments are used to initialize member fields in the " @@ -4131,15 +4146,15 @@ msgid "" "names not present in :attr:`_fields_`." msgstr "" -#: ../../library/ctypes.rst:2584 +#: ../../library/ctypes.rst:2595 msgid "Arrays and pointers" msgstr "" -#: ../../library/ctypes.rst:2588 +#: ../../library/ctypes.rst:2599 msgid "Abstract base class for arrays." msgstr "" -#: ../../library/ctypes.rst:2590 +#: ../../library/ctypes.rst:2601 msgid "" "The recommended way to create concrete array types is by multiplying any :" "mod:`ctypes` data type with a non-negative integer. Alternatively, you can " @@ -4149,34 +4164,46 @@ msgid "" "an :class:`Array`." msgstr "" -#: ../../library/ctypes.rst:2600 +#: ../../library/ctypes.rst:2611 msgid "" "A positive integer specifying the number of elements in the array. Out-of-" "range subscripts result in an :exc:`IndexError`. Will be returned by :func:" "`len`." msgstr "" -#: ../../library/ctypes.rst:2607 +#: ../../library/ctypes.rst:2618 msgid "Specifies the type of each element in the array." msgstr "" -#: ../../library/ctypes.rst:2610 +#: ../../library/ctypes.rst:2621 msgid "" "Array subclass constructors accept positional arguments, used to initialize " "the elements in order." msgstr "" -#: ../../library/ctypes.rst:2616 +#: ../../library/ctypes.rst:2626 +msgid "" +"Create an array. Equivalent to ``type * length``, where *type* is a :mod:" +"`ctypes` data type and *length* an integer." +msgstr "" + +#: ../../library/ctypes.rst:2630 +msgid "" +"This function is :term:`soft deprecated` in favor of multiplication. There " +"are no plans to remove it." +msgstr "" + +#: ../../library/ctypes.rst:2636 msgid "Private, abstract base class for pointers." msgstr "" -#: ../../library/ctypes.rst:2618 +#: ../../library/ctypes.rst:2638 msgid "" "Concrete pointer types are created by calling :func:`POINTER` with the type " "that will be pointed to; this is done automatically by :func:`pointer`." msgstr "" -#: ../../library/ctypes.rst:2622 +#: ../../library/ctypes.rst:2642 msgid "" "If a pointer points to an array, its elements can be read and written using " "standard subscript and slice accesses. Pointer objects have no size, so :" @@ -4185,11 +4212,11 @@ msgid "" "probably crash with an access violation (if you're lucky)." msgstr "" -#: ../../library/ctypes.rst:2632 +#: ../../library/ctypes.rst:2652 msgid "Specifies the type pointed to." msgstr "" -#: ../../library/ctypes.rst:2636 +#: ../../library/ctypes.rst:2656 msgid "" "Returns the object to which to pointer points. Assigning to this attribute " "changes the pointer to point to the assigned object." diff --git a/library/curses.ascii.po b/library/curses.ascii.po index a57da1b4cd..9c57ae467b 100644 --- a/library/curses.ascii.po +++ b/library/curses.ascii.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" diff --git a/library/curses.panel.po b/library/curses.panel.po index 056c06f519..728c5cee24 100644 --- a/library/curses.panel.po +++ b/library/curses.panel.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" diff --git a/library/curses.po b/library/curses.po index bb5c9bc23c..0640ee51c5 100644 --- a/library/curses.po +++ b/library/curses.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-27 00:03+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -40,80 +40,92 @@ msgid "" "curses library hosted on Linux and the BSD variants of Unix." msgstr "" -#: ../../library/curses.rst:26 +#: ../../includes/wasm-mobile-notavail.rst:3 +msgid ":ref:`Availability `: not Android, not iOS, not WASI." +msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" + +#: ../../includes/wasm-mobile-notavail.rst:5 +msgid "" +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." +msgstr "" +"此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" +"台 `\\ 上不支援。" + +#: ../../library/curses.rst:28 msgid "" "Whenever the documentation mentions a *character* it can be specified as an " "integer, a one-character Unicode string or a one-byte byte string." msgstr "" -#: ../../library/curses.rst:29 +#: ../../library/curses.rst:31 msgid "" "Whenever the documentation mentions a *character string* it can be specified " "as a Unicode string or a byte string." msgstr "" -#: ../../library/curses.rst:34 +#: ../../library/curses.rst:36 msgid "Module :mod:`curses.ascii`" msgstr ":mod:`curses.ascii` 模組" -#: ../../library/curses.rst:35 +#: ../../library/curses.rst:37 msgid "" "Utilities for working with ASCII characters, regardless of your locale " "settings." msgstr "" -#: ../../library/curses.rst:37 +#: ../../library/curses.rst:39 msgid "Module :mod:`curses.panel`" msgstr ":mod:`curses.panel` 模組" -#: ../../library/curses.rst:38 +#: ../../library/curses.rst:40 msgid "A panel stack extension that adds depth to curses windows." msgstr "" -#: ../../library/curses.rst:40 +#: ../../library/curses.rst:42 msgid "Module :mod:`curses.textpad`" msgstr ":mod:`curses.textpad` 模組" -#: ../../library/curses.rst:41 +#: ../../library/curses.rst:43 msgid "" "Editable text widget for curses supporting :program:`Emacs`\\ -like " "bindings." msgstr "" -#: ../../library/curses.rst:43 +#: ../../library/curses.rst:45 msgid ":ref:`curses-howto`" msgstr ":ref:`curses-howto`" -#: ../../library/curses.rst:44 +#: ../../library/curses.rst:46 msgid "" "Tutorial material on using curses with Python, by Andrew Kuchling and Eric " "Raymond." msgstr "" -#: ../../library/curses.rst:51 +#: ../../library/curses.rst:53 msgid "Functions" msgstr "函式" -#: ../../library/curses.rst:53 +#: ../../library/curses.rst:55 msgid "The module :mod:`curses` defines the following exception:" msgstr "" -#: ../../library/curses.rst:58 +#: ../../library/curses.rst:60 msgid "Exception raised when a curses library function returns an error." msgstr "" -#: ../../library/curses.rst:62 +#: ../../library/curses.rst:64 msgid "" "Whenever *x* or *y* arguments to a function or a method are optional, they " "default to the current cursor location. Whenever *attr* is optional, it " "defaults to :const:`A_NORMAL`." msgstr "" -#: ../../library/curses.rst:66 +#: ../../library/curses.rst:68 msgid "The module :mod:`curses` defines the following functions:" msgstr "" -#: ../../library/curses.rst:71 +#: ../../library/curses.rst:73 msgid "" "Return the output speed of the terminal in bits per second. On software " "terminal emulators it will have a fixed high value. Included for historical " @@ -121,17 +133,17 @@ msgid "" "and occasionally to change interfaces depending on the line speed." msgstr "" -#: ../../library/curses.rst:79 +#: ../../library/curses.rst:81 msgid "Emit a short attention sound." msgstr "" -#: ../../library/curses.rst:84 +#: ../../library/curses.rst:86 msgid "" "Return ``True`` or ``False``, depending on whether the programmer can change " "the colors displayed by the terminal." msgstr "" -#: ../../library/curses.rst:90 +#: ../../library/curses.rst:92 msgid "" "Enter cbreak mode. In cbreak mode (sometimes called \"rare\" mode) normal " "tty line buffering is turned off and characters are available to be read one " @@ -141,7 +153,7 @@ msgid "" "terminal in cbreak mode." msgstr "" -#: ../../library/curses.rst:99 +#: ../../library/curses.rst:101 msgid "" "Return the intensity of the red, green, and blue (RGB) components in the " "color *color_number*, which must be between ``0`` and ``COLORS - 1``. " @@ -150,7 +162,7 @@ msgid "" "component)." msgstr "" -#: ../../library/curses.rst:107 +#: ../../library/curses.rst:109 msgid "" "Return the attribute value for displaying text in the specified color pair. " "Only the first 256 color pairs are supported. This attribute value can be " @@ -159,7 +171,7 @@ msgid "" "function." msgstr "" -#: ../../library/curses.rst:116 +#: ../../library/curses.rst:118 msgid "" "Set the cursor state. *visibility* can be set to ``0``, ``1``, or ``2``, " "for invisible, normal, or very visible. If the terminal supports the " @@ -168,7 +180,7 @@ msgid "" "and the \"very visible\" mode is a block cursor." msgstr "" -#: ../../library/curses.rst:125 +#: ../../library/curses.rst:127 msgid "" "Save the current terminal mode as the \"program\" mode, the mode when the " "running program is using curses. (Its counterpart is the \"shell\" mode, " @@ -176,7 +188,7 @@ msgid "" "`reset_prog_mode` will restore this mode." msgstr "" -#: ../../library/curses.rst:133 +#: ../../library/curses.rst:135 msgid "" "Save the current terminal mode as the \"shell\" mode, the mode when the " "running program is not using curses. (Its counterpart is the \"program\" " @@ -184,11 +196,11 @@ msgid "" "func:`reset_shell_mode` will restore this mode." msgstr "" -#: ../../library/curses.rst:141 +#: ../../library/curses.rst:143 msgid "Insert an *ms* millisecond pause in output." msgstr "" -#: ../../library/curses.rst:146 +#: ../../library/curses.rst:148 msgid "" "Update the physical screen. The curses library keeps two data structures, " "one representing the current physical screen contents and a virtual screen " @@ -196,7 +208,7 @@ msgid "" "the physical screen to match the virtual screen." msgstr "" -#: ../../library/curses.rst:151 +#: ../../library/curses.rst:153 msgid "" "The virtual screen may be updated by a :meth:`~window.noutrefresh` call " "after write operations such as :meth:`~window.addstr` have been performed on " @@ -207,24 +219,24 @@ msgid "" "func:`!doupdate`." msgstr "" -#: ../../library/curses.rst:161 +#: ../../library/curses.rst:163 msgid "" "Enter echo mode. In echo mode, each character input is echoed to the screen " "as it is entered." msgstr "" -#: ../../library/curses.rst:167 +#: ../../library/curses.rst:169 msgid "De-initialize the library, and return terminal to normal status." msgstr "" -#: ../../library/curses.rst:172 +#: ../../library/curses.rst:174 msgid "" "Return the user's current erase character as a one-byte bytes object. Under " "Unix operating systems this is a property of the controlling tty of the " "curses program, and is not set by the curses library itself." msgstr "" -#: ../../library/curses.rst:179 +#: ../../library/curses.rst:181 msgid "" "The :func:`.filter` routine, if used, must be called before :func:`initscr` " "is called. The effect is that, during those calls, :envvar:`LINES` is set " @@ -235,20 +247,20 @@ msgid "" "time line editing without touching the rest of the screen." msgstr "" -#: ../../library/curses.rst:189 +#: ../../library/curses.rst:191 msgid "" "Flash the screen. That is, change it to reverse-video and then change it " "back in a short interval. Some people prefer such as 'visible bell' to the " "audible attention signal produced by :func:`beep`." msgstr "" -#: ../../library/curses.rst:196 +#: ../../library/curses.rst:198 msgid "" "Flush all input buffers. This throws away any typeahead that has been " "typed by the user and has not yet been processed by the program." msgstr "" -#: ../../library/curses.rst:202 +#: ../../library/curses.rst:204 msgid "" "After :meth:`~window.getch` returns :const:`KEY_MOUSE` to signal a mouse " "event, this method should be called to retrieve the queued mouse event, " @@ -263,51 +275,51 @@ msgid "" "const:`BUTTON_ALT`." msgstr "" -#: ../../library/curses.rst:213 ../../library/curses.rst:1774 +#: ../../library/curses.rst:215 ../../library/curses.rst:1776 msgid "" "The ``BUTTON5_*`` constants are now exposed if they are provided by the " "underlying curses library." msgstr "" -#: ../../library/curses.rst:220 +#: ../../library/curses.rst:222 msgid "" "Return the current coordinates of the virtual screen cursor as a tuple ``(y, " "x)``. If :meth:`leaveok ` is currently ``True``, then " "return ``(-1, -1)``." msgstr "" -#: ../../library/curses.rst:226 +#: ../../library/curses.rst:228 msgid "" "Read window related data stored in the file by an earlier :func:`window." "putwin` call. The routine then creates and initializes a new window using " "that data, returning the new window object." msgstr "" -#: ../../library/curses.rst:233 +#: ../../library/curses.rst:235 msgid "" "Return ``True`` if the terminal can display colors; otherwise, return " "``False``." msgstr "" -#: ../../library/curses.rst:237 +#: ../../library/curses.rst:239 msgid "" "Return ``True`` if the module supports extended colors; otherwise, return " "``False``. Extended color support allows more than 256 color pairs for " "terminals that support more than 16 colors (e.g. xterm-256color)." msgstr "" -#: ../../library/curses.rst:241 +#: ../../library/curses.rst:243 msgid "Extended color support requires ncurses version 6.1 or later." msgstr "" -#: ../../library/curses.rst:247 +#: ../../library/curses.rst:249 msgid "" "Return ``True`` if the terminal has insert- and delete-character " "capabilities. This function is included for historical reasons only, as all " "modern software terminal emulators have such capabilities." msgstr "" -#: ../../library/curses.rst:254 +#: ../../library/curses.rst:256 msgid "" "Return ``True`` if the terminal has insert- and delete-line capabilities, or " "can simulate them using scrolling regions. This function is included for " @@ -315,13 +327,13 @@ msgid "" "capabilities." msgstr "" -#: ../../library/curses.rst:262 +#: ../../library/curses.rst:264 msgid "" "Take a key value *ch*, and return ``True`` if the current terminal type " "recognizes a key with that value." msgstr "" -#: ../../library/curses.rst:268 +#: ../../library/curses.rst:270 msgid "" "Used for half-delay mode, which is similar to cbreak mode in that characters " "typed by the user are immediately available to the program. However, after " @@ -330,7 +342,7 @@ msgid "" "``255``. Use :func:`nocbreak` to leave half-delay mode." msgstr "" -#: ../../library/curses.rst:277 +#: ../../library/curses.rst:279 msgid "" "Change the definition of a color, taking the number of the color to be " "changed followed by three RGB values (for the amounts of red, green, and " @@ -342,7 +354,7 @@ msgid "" "``True``." msgstr "" -#: ../../library/curses.rst:288 +#: ../../library/curses.rst:290 msgid "" "Change the definition of a color-pair. It takes three arguments: the number " "of the color-pair to be changed, the foreground color number, and the " @@ -355,31 +367,31 @@ msgid "" "definition." msgstr "" -#: ../../library/curses.rst:301 +#: ../../library/curses.rst:303 msgid "" "Initialize the library. Return a :ref:`window ` " "object which represents the whole screen." msgstr "" -#: ../../library/curses.rst:306 +#: ../../library/curses.rst:308 msgid "" "If there is an error opening the terminal, the underlying curses library may " "cause the interpreter to exit." msgstr "" -#: ../../library/curses.rst:312 +#: ../../library/curses.rst:314 msgid "" "Return ``True`` if :func:`resize_term` would modify the window structure, " "``False`` otherwise." msgstr "" -#: ../../library/curses.rst:318 +#: ../../library/curses.rst:320 msgid "" "Return ``True`` if :func:`endwin` has been called (that is, the curses " "library has been deinitialized)." msgstr "" -#: ../../library/curses.rst:324 +#: ../../library/curses.rst:326 msgid "" "Return the name of the key numbered *k* as a bytes object. The name of a " "key generating printable ASCII character is the key's character. The name " @@ -390,27 +402,27 @@ msgid "" "character." msgstr "" -#: ../../library/curses.rst:334 +#: ../../library/curses.rst:336 msgid "" "Return the user's current line kill character as a one-byte bytes object. " "Under Unix operating systems this is a property of the controlling tty of " "the curses program, and is not set by the curses library itself." msgstr "" -#: ../../library/curses.rst:341 +#: ../../library/curses.rst:343 msgid "" "Return a bytes object containing the terminfo long name field describing the " "current terminal. The maximum length of a verbose description is 128 " "characters. It is defined only after the call to :func:`initscr`." msgstr "" -#: ../../library/curses.rst:348 +#: ../../library/curses.rst:350 msgid "" "If *flag* is ``True``, allow 8-bit characters to be input. If *flag* is " "``False``, allow only 7-bit chars." msgstr "" -#: ../../library/curses.rst:354 +#: ../../library/curses.rst:356 msgid "" "Set the maximum time in milliseconds that can elapse between press and " "release events in order for them to be recognized as a click, and return the " @@ -418,7 +430,7 @@ msgid "" "fifth of a second." msgstr "" -#: ../../library/curses.rst:361 +#: ../../library/curses.rst:363 msgid "" "Set the mouse events to be reported, and return a tuple ``(availmask, " "oldmask)``. *availmask* indicates which of the specified mouse events can " @@ -427,17 +439,17 @@ msgid "" "never called, no mouse events are ever reported." msgstr "" -#: ../../library/curses.rst:370 +#: ../../library/curses.rst:372 msgid "Sleep for *ms* milliseconds." msgstr "" -#: ../../library/curses.rst:375 +#: ../../library/curses.rst:377 msgid "" "Create and return a pointer to a new pad data structure with the given " "number of lines and columns. Return a pad as a window object." msgstr "" -#: ../../library/curses.rst:378 +#: ../../library/curses.rst:380 msgid "" "A pad is like a window, except that it is not restricted by the screen size, " "and is not necessarily associated with a particular part of the screen. " @@ -453,35 +465,35 @@ msgid "" "to be displayed." msgstr "" -#: ../../library/curses.rst:394 +#: ../../library/curses.rst:396 msgid "" "Return a new :ref:`window `, whose left-upper corner " "is at ``(begin_y, begin_x)``, and whose height/width is *nlines*/*ncols*." msgstr "" -#: ../../library/curses.rst:397 +#: ../../library/curses.rst:399 msgid "" "By default, the window will extend from the specified position to the lower " "right corner of the screen." msgstr "" -#: ../../library/curses.rst:403 +#: ../../library/curses.rst:405 msgid "" "Enter newline mode. This mode translates the return key into newline on " "input, and translates newline into return and line-feed on output. Newline " "mode is initially on." msgstr "" -#: ../../library/curses.rst:410 +#: ../../library/curses.rst:412 msgid "" "Leave cbreak mode. Return to normal \"cooked\" mode with line buffering." msgstr "" -#: ../../library/curses.rst:415 +#: ../../library/curses.rst:417 msgid "Leave echo mode. Echoing of input characters is turned off." msgstr "" -#: ../../library/curses.rst:420 +#: ../../library/curses.rst:422 msgid "" "Leave newline mode. Disable translation of return into newline on input, " "and disable low-level translation of newline into newline/return on output " @@ -491,7 +503,7 @@ msgid "" "also, it will be able to detect the return key on input." msgstr "" -#: ../../library/curses.rst:430 +#: ../../library/curses.rst:432 msgid "" "When the :func:`!noqiflush` routine is used, normal flush of input and " "output queues associated with the ``INTR``, ``QUIT`` and ``SUSP`` characters " @@ -500,63 +512,63 @@ msgid "" "occurred, after the handler exits." msgstr "" -#: ../../library/curses.rst:438 +#: ../../library/curses.rst:440 msgid "Leave raw mode. Return to normal \"cooked\" mode with line buffering." msgstr "" -#: ../../library/curses.rst:443 +#: ../../library/curses.rst:445 msgid "" "Return a tuple ``(fg, bg)`` containing the colors for the requested color " "pair. The value of *pair_number* must be between ``0`` and ``COLOR_PAIRS - " "1``." msgstr "" -#: ../../library/curses.rst:449 +#: ../../library/curses.rst:451 msgid "" "Return the number of the color-pair set by the attribute value *attr*. :func:" "`color_pair` is the counterpart to this function." msgstr "" -#: ../../library/curses.rst:455 +#: ../../library/curses.rst:457 msgid "" "Equivalent to ``tputs(str, 1, putchar)``; emit the value of a specified " "terminfo capability for the current terminal. Note that the output of :func:" "`putp` always goes to standard output." msgstr "" -#: ../../library/curses.rst:462 +#: ../../library/curses.rst:464 msgid "" "If *flag* is ``False``, the effect is the same as calling :func:`noqiflush`. " "If *flag* is ``True``, or no argument is provided, the queues will be " "flushed when these control characters are read." msgstr "" -#: ../../library/curses.rst:469 +#: ../../library/curses.rst:471 msgid "" "Enter raw mode. In raw mode, normal line buffering and processing of " "interrupt, quit, suspend, and flow control keys are turned off; characters " "are presented to curses input functions one by one." msgstr "" -#: ../../library/curses.rst:476 +#: ../../library/curses.rst:478 msgid "" "Restore the terminal to \"program\" mode, as previously saved by :func:" "`def_prog_mode`." msgstr "" -#: ../../library/curses.rst:482 +#: ../../library/curses.rst:484 msgid "" "Restore the terminal to \"shell\" mode, as previously saved by :func:" "`def_shell_mode`." msgstr "" -#: ../../library/curses.rst:488 +#: ../../library/curses.rst:490 msgid "" "Restore the state of the terminal modes to what it was at the last call to :" "func:`savetty`." msgstr "" -#: ../../library/curses.rst:494 +#: ../../library/curses.rst:496 msgid "" "Backend function used by :func:`resizeterm`, performing most of the work; " "when resizing the windows, :func:`resize_term` blank-fills the areas that " @@ -566,47 +578,47 @@ msgid "" "to resize these without additional interaction with the application." msgstr "" -#: ../../library/curses.rst:504 +#: ../../library/curses.rst:506 msgid "" "Resize the standard and current windows to the specified dimensions, and " "adjusts other bookkeeping data used by the curses library that record the " "window dimensions (in particular the SIGWINCH handler)." msgstr "" -#: ../../library/curses.rst:511 +#: ../../library/curses.rst:513 msgid "" "Save the current state of the terminal modes in a buffer, usable by :func:" "`resetty`." msgstr "" -#: ../../library/curses.rst:516 +#: ../../library/curses.rst:518 msgid "Retrieves the value set by :func:`set_escdelay`." msgstr "" -#: ../../library/curses.rst:522 +#: ../../library/curses.rst:524 msgid "" "Sets the number of milliseconds to wait after reading an escape character, " "to distinguish between an individual escape character entered on the " "keyboard from escape sequences sent by cursor and function keys." msgstr "" -#: ../../library/curses.rst:530 +#: ../../library/curses.rst:532 msgid "Retrieves the value set by :func:`set_tabsize`." msgstr "" -#: ../../library/curses.rst:536 +#: ../../library/curses.rst:538 msgid "" "Sets the number of columns used by the curses library when converting a tab " "character to spaces as it adds the tab to a window." msgstr "" -#: ../../library/curses.rst:543 +#: ../../library/curses.rst:545 msgid "" "Set the virtual screen cursor to *y*, *x*. If *y* and *x* are both ``-1``, " "then :meth:`leaveok ` is set ``True``." msgstr "" -#: ../../library/curses.rst:549 +#: ../../library/curses.rst:551 msgid "" "Initialize the terminal. *term* is a string giving the terminal name, or " "``None``; if omitted or ``None``, the value of the :envvar:`TERM` " @@ -615,14 +627,14 @@ msgid "" "descriptor for ``sys.stdout`` will be used." msgstr "" -#: ../../library/curses.rst:558 +#: ../../library/curses.rst:560 msgid "" "Must be called if the programmer wants to use colors, and before any other " "color manipulation routine is called. It is good practice to call this " "routine right after :func:`initscr`." msgstr "" -#: ../../library/curses.rst:562 +#: ../../library/curses.rst:564 msgid "" ":func:`start_color` initializes eight basic colors (black, red, green, " "yellow, blue, magenta, cyan, and white), and two global variables in the :" @@ -632,20 +644,20 @@ msgid "" "terminal was just turned on." msgstr "" -#: ../../library/curses.rst:571 +#: ../../library/curses.rst:573 msgid "" "Return a logical OR of all video attributes supported by the terminal. This " "information is useful when a curses program needs complete control over the " "appearance of the screen." msgstr "" -#: ../../library/curses.rst:578 +#: ../../library/curses.rst:580 msgid "" "Return the value of the environment variable :envvar:`TERM`, as a bytes " "object, truncated to 14 characters." msgstr "" -#: ../../library/curses.rst:584 +#: ../../library/curses.rst:586 msgid "" "Return the value of the Boolean capability corresponding to the terminfo " "capability name *capname* as an integer. Return the value ``-1`` if " @@ -653,7 +665,7 @@ msgid "" "from the terminal description." msgstr "" -#: ../../library/curses.rst:592 +#: ../../library/curses.rst:594 msgid "" "Return the value of the numeric capability corresponding to the terminfo " "capability name *capname* as an integer. Return the value ``-2`` if " @@ -661,7 +673,7 @@ msgid "" "from the terminal description." msgstr "" -#: ../../library/curses.rst:600 +#: ../../library/curses.rst:602 msgid "" "Return the value of the string capability corresponding to the terminfo " "capability name *capname* as a bytes object. Return ``None`` if *capname* " @@ -669,7 +681,7 @@ msgid "" "terminal description." msgstr "" -#: ../../library/curses.rst:608 +#: ../../library/curses.rst:610 msgid "" "Instantiate the bytes object *str* with the supplied parameters, where *str* " "should be a parameterized string obtained from the terminfo database. E.g. " @@ -677,13 +689,13 @@ msgid "" "exact result depending on terminal type." msgstr "" -#: ../../library/curses.rst:616 +#: ../../library/curses.rst:618 msgid "" "Specify that the file descriptor *fd* be used for typeahead checking. If " "*fd* is ``-1``, then no typeahead checking is done." msgstr "" -#: ../../library/curses.rst:619 +#: ../../library/curses.rst:621 msgid "" "The curses library does \"line-breakout optimization\" by looking for " "typeahead periodically while updating the screen. If input is found, and it " @@ -693,7 +705,7 @@ msgid "" "typeahead checking." msgstr "" -#: ../../library/curses.rst:628 +#: ../../library/curses.rst:630 msgid "" "Return a bytes object which is a printable representation of the character " "*ch*. Control characters are represented as a caret followed by the " @@ -701,35 +713,35 @@ msgid "" "are." msgstr "" -#: ../../library/curses.rst:635 +#: ../../library/curses.rst:637 msgid "Push *ch* so the next :meth:`~window.getch` will return it." msgstr "" -#: ../../library/curses.rst:639 +#: ../../library/curses.rst:641 msgid "Only one *ch* can be pushed before :meth:`!getch` is called." msgstr "" -#: ../../library/curses.rst:644 +#: ../../library/curses.rst:646 msgid "" "Update the :const:`LINES` and :const:`COLS` module variables. Useful for " "detecting manual screen resize." msgstr "" -#: ../../library/curses.rst:652 +#: ../../library/curses.rst:654 msgid "Push *ch* so the next :meth:`~window.get_wch` will return it." msgstr "" -#: ../../library/curses.rst:656 +#: ../../library/curses.rst:658 msgid "Only one *ch* can be pushed before :meth:`!get_wch` is called." msgstr "" -#: ../../library/curses.rst:663 +#: ../../library/curses.rst:665 msgid "" "Push a :const:`KEY_MOUSE` event onto the input queue, associating the given " "state data with it." msgstr "" -#: ../../library/curses.rst:669 +#: ../../library/curses.rst:671 msgid "" "If used, this function should be called before :func:`initscr` or newterm " "are called. When *flag* is ``False``, the values of lines and columns " @@ -739,7 +751,7 @@ msgid "" "to use the window size if :envvar:`LINES` and :envvar:`COLUMNS` are not set)." msgstr "" -#: ../../library/curses.rst:679 +#: ../../library/curses.rst:681 msgid "" "Allow use of default values for colors on terminals supporting this feature. " "Use this to support transparency in your application. The default color is " @@ -748,7 +760,7 @@ msgid "" "*x* to a red foreground color on the default background." msgstr "" -#: ../../library/curses.rst:688 +#: ../../library/curses.rst:690 msgid "" "Initialize curses and call another callable object, *func*, which should be " "the rest of your curses-using application. If the application raises an " @@ -762,50 +774,50 @@ msgid "" "echo, and disables the terminal keypad." msgstr "" -#: ../../library/curses.rst:702 +#: ../../library/curses.rst:704 msgid "Window Objects" msgstr "" -#: ../../library/curses.rst:704 +#: ../../library/curses.rst:706 msgid "" "Window objects, as returned by :func:`initscr` and :func:`newwin` above, " "have the following methods and attributes:" msgstr "" -#: ../../library/curses.rst:711 +#: ../../library/curses.rst:713 msgid "" "Paint character *ch* at ``(y, x)`` with attributes *attr*, overwriting any " "character previously painted at that location. By default, the character " "position and attributes are the current settings for the window object." msgstr "" -#: ../../library/curses.rst:717 +#: ../../library/curses.rst:719 msgid "" "Writing outside the window, subwindow, or pad raises a :exc:`curses.error`. " "Attempting to write to the lower right corner of a window, subwindow, or pad " "will cause an exception to be raised after the character is printed." msgstr "" -#: ../../library/curses.rst:725 +#: ../../library/curses.rst:727 msgid "" "Paint at most *n* characters of the character string *str* at ``(y, x)`` " "with attributes *attr*, overwriting anything previously on the display." msgstr "" -#: ../../library/curses.rst:733 +#: ../../library/curses.rst:735 msgid "" "Paint the character string *str* at ``(y, x)`` with attributes *attr*, " "overwriting anything previously on the display." msgstr "" -#: ../../library/curses.rst:738 +#: ../../library/curses.rst:740 msgid "" "Writing outside the window, subwindow, or pad raises :exc:`curses.error`. " "Attempting to write to the lower right corner of a window, subwindow, or pad " "will cause an exception to be raised after the string is printed." msgstr "" -#: ../../library/curses.rst:742 +#: ../../library/curses.rst:744 msgid "" "A `bug in ncurses `_, the backend for " "this Python module, can cause SegFaults when resizing windows. This is fixed " @@ -815,44 +827,44 @@ msgid "" "line." msgstr "" -#: ../../library/curses.rst:752 +#: ../../library/curses.rst:754 msgid "" "Remove attribute *attr* from the \"background\" set applied to all writes to " "the current window." msgstr "" -#: ../../library/curses.rst:758 +#: ../../library/curses.rst:760 msgid "" "Add attribute *attr* from the \"background\" set applied to all writes to " "the current window." msgstr "" -#: ../../library/curses.rst:764 +#: ../../library/curses.rst:766 msgid "" "Set the \"background\" set of attributes to *attr*. This set is initially " "``0`` (no attributes)." msgstr "" -#: ../../library/curses.rst:770 +#: ../../library/curses.rst:772 msgid "" "Set the background property of the window to the character *ch*, with " "attributes *attr*. The change is then applied to every character position " "in that window:" msgstr "" -#: ../../library/curses.rst:774 +#: ../../library/curses.rst:776 msgid "" "The attribute of every character in the window is changed to the new " "background attribute." msgstr "" -#: ../../library/curses.rst:777 +#: ../../library/curses.rst:779 msgid "" "Wherever the former background character appears, it is changed to the new " "background character." msgstr "" -#: ../../library/curses.rst:783 +#: ../../library/curses.rst:785 msgid "" "Set the window's background. A window's background consists of a character " "and any combination of attributes. The attribute part of the background is " @@ -863,128 +875,128 @@ msgid "" "delete line/character operations." msgstr "" -#: ../../library/curses.rst:793 +#: ../../library/curses.rst:795 msgid "" "Draw a border around the edges of the window. Each parameter specifies the " "character to use for a specific part of the border; see the table below for " "more details." msgstr "" -#: ../../library/curses.rst:799 +#: ../../library/curses.rst:801 msgid "" "A ``0`` value for any parameter will cause the default character to be used " "for that parameter. Keyword parameters can *not* be used. The defaults are " "listed in this table:" msgstr "" -#: ../../library/curses.rst:804 +#: ../../library/curses.rst:806 msgid "Parameter" msgstr "參數" -#: ../../library/curses.rst:804 +#: ../../library/curses.rst:806 msgid "Description" msgstr "描述" -#: ../../library/curses.rst:804 +#: ../../library/curses.rst:806 msgid "Default value" msgstr "" -#: ../../library/curses.rst:806 +#: ../../library/curses.rst:808 msgid "*ls*" msgstr "*ls*" -#: ../../library/curses.rst:806 +#: ../../library/curses.rst:808 msgid "Left side" msgstr "" -#: ../../library/curses.rst:806 ../../library/curses.rst:808 +#: ../../library/curses.rst:808 ../../library/curses.rst:810 msgid ":const:`ACS_VLINE`" msgstr ":const:`ACS_VLINE`" -#: ../../library/curses.rst:808 +#: ../../library/curses.rst:810 msgid "*rs*" msgstr "*rs*" -#: ../../library/curses.rst:808 +#: ../../library/curses.rst:810 msgid "Right side" msgstr "" -#: ../../library/curses.rst:810 +#: ../../library/curses.rst:812 msgid "*ts*" msgstr "*ts*" -#: ../../library/curses.rst:810 +#: ../../library/curses.rst:812 msgid "Top" msgstr "" -#: ../../library/curses.rst:810 ../../library/curses.rst:812 +#: ../../library/curses.rst:812 ../../library/curses.rst:814 msgid ":const:`ACS_HLINE`" msgstr ":const:`ACS_HLINE`" -#: ../../library/curses.rst:812 +#: ../../library/curses.rst:814 msgid "*bs*" msgstr "*bs*" -#: ../../library/curses.rst:812 +#: ../../library/curses.rst:814 msgid "Bottom" msgstr "" -#: ../../library/curses.rst:814 +#: ../../library/curses.rst:816 msgid "*tl*" msgstr "*tl*" -#: ../../library/curses.rst:814 +#: ../../library/curses.rst:816 msgid "Upper-left corner" msgstr "" -#: ../../library/curses.rst:814 +#: ../../library/curses.rst:816 msgid ":const:`ACS_ULCORNER`" msgstr ":const:`ACS_ULCORNER`" -#: ../../library/curses.rst:816 +#: ../../library/curses.rst:818 msgid "*tr*" msgstr "*tr*" -#: ../../library/curses.rst:816 +#: ../../library/curses.rst:818 msgid "Upper-right corner" msgstr "" -#: ../../library/curses.rst:816 +#: ../../library/curses.rst:818 msgid ":const:`ACS_URCORNER`" msgstr ":const:`ACS_URCORNER`" -#: ../../library/curses.rst:818 +#: ../../library/curses.rst:820 msgid "*bl*" msgstr "*bl*" -#: ../../library/curses.rst:818 +#: ../../library/curses.rst:820 msgid "Bottom-left corner" msgstr "" -#: ../../library/curses.rst:818 +#: ../../library/curses.rst:820 msgid ":const:`ACS_LLCORNER`" msgstr ":const:`ACS_LLCORNER`" -#: ../../library/curses.rst:820 +#: ../../library/curses.rst:822 msgid "*br*" msgstr "*br*" -#: ../../library/curses.rst:820 +#: ../../library/curses.rst:822 msgid "Bottom-right corner" msgstr "" -#: ../../library/curses.rst:820 +#: ../../library/curses.rst:822 msgid ":const:`ACS_LRCORNER`" msgstr ":const:`ACS_LRCORNER`" -#: ../../library/curses.rst:826 +#: ../../library/curses.rst:828 msgid "" "Similar to :meth:`border`, but both *ls* and *rs* are *vertch* and both *ts* " "and *bs* are *horch*. The default corner characters are always used by this " "function." msgstr "" -#: ../../library/curses.rst:835 +#: ../../library/curses.rst:837 msgid "" "Set the attributes of *num* characters at the current cursor position, or at " "position ``(y, x)`` if supplied. If *num* is not given or is ``-1``, the " @@ -994,45 +1006,45 @@ msgid "" "be redisplayed by the next window refresh." msgstr "" -#: ../../library/curses.rst:845 +#: ../../library/curses.rst:847 msgid "" "Like :meth:`erase`, but also cause the whole window to be repainted upon " "next call to :meth:`refresh`." msgstr "" -#: ../../library/curses.rst:851 +#: ../../library/curses.rst:853 msgid "" "If *flag* is ``True``, the next call to :meth:`refresh` will clear the " "window completely." msgstr "" -#: ../../library/curses.rst:857 +#: ../../library/curses.rst:859 msgid "" "Erase from cursor to the end of the window: all lines below the cursor are " "deleted, and then the equivalent of :meth:`clrtoeol` is performed." msgstr "" -#: ../../library/curses.rst:863 +#: ../../library/curses.rst:865 msgid "Erase from cursor to the end of the line." msgstr "" -#: ../../library/curses.rst:868 +#: ../../library/curses.rst:870 msgid "" "Update the current cursor position of all the ancestors of the window to " "reflect the current cursor position of the window." msgstr "" -#: ../../library/curses.rst:874 +#: ../../library/curses.rst:876 msgid "Delete any character at ``(y, x)``." msgstr "" -#: ../../library/curses.rst:879 +#: ../../library/curses.rst:881 msgid "" "Delete the line under the cursor. All following lines are moved up by one " "line." msgstr "" -#: ../../library/curses.rst:885 +#: ../../library/curses.rst:887 msgid "" "An abbreviation for \"derive window\", :meth:`derwin` is the same as " "calling :meth:`subwin`, except that *begin_y* and *begin_x* are relative to " @@ -1040,13 +1052,13 @@ msgid "" "a window object for the derived window." msgstr "" -#: ../../library/curses.rst:893 +#: ../../library/curses.rst:895 msgid "" "Add character *ch* with attribute *attr*, and immediately call :meth:" "`refresh` on the window." msgstr "" -#: ../../library/curses.rst:899 +#: ../../library/curses.rst:901 msgid "" "Test whether the given pair of screen-relative character-cell coordinates " "are enclosed by the given window, returning ``True`` or ``False``. It is " @@ -1054,11 +1066,11 @@ msgid "" "location of a mouse event." msgstr "" -#: ../../library/curses.rst:904 +#: ../../library/curses.rst:906 msgid "Previously it returned ``1`` or ``0`` instead of ``True`` or ``False``." msgstr "" -#: ../../library/curses.rst:910 +#: ../../library/curses.rst:912 msgid "" "Encoding used to encode method arguments (Unicode strings and characters). " "The encoding attribute is inherited from the parent window when a subwindow " @@ -1066,19 +1078,19 @@ msgid "" "locale encoding is used (see :func:`locale.getencoding`)." msgstr "" -#: ../../library/curses.rst:920 +#: ../../library/curses.rst:922 msgid "Clear the window." msgstr "" -#: ../../library/curses.rst:925 +#: ../../library/curses.rst:927 msgid "Return a tuple ``(y, x)`` of coordinates of upper-left corner." msgstr "" -#: ../../library/curses.rst:930 +#: ../../library/curses.rst:932 msgid "Return the given window's current background character/attribute pair." msgstr "" -#: ../../library/curses.rst:935 +#: ../../library/curses.rst:937 msgid "" "Get a character. Note that the integer returned does *not* have to be in " "ASCII range: function keys, keypad keys and so on are represented by numbers " @@ -1086,14 +1098,14 @@ msgid "" "otherwise wait until a key is pressed." msgstr "" -#: ../../library/curses.rst:943 +#: ../../library/curses.rst:945 msgid "" "Get a wide character. Return a character for most keys, or an integer for " "function keys, keypad keys, and other special keys. In no-delay mode, raise " "an exception if there is no input." msgstr "" -#: ../../library/curses.rst:952 +#: ../../library/curses.rst:954 msgid "" "Get a character, returning a string instead of an integer, as :meth:`getch` " "does. Function keys, keypad keys and other special keys return a multibyte " @@ -1101,35 +1113,35 @@ msgid "" "there is no input." msgstr "" -#: ../../library/curses.rst:960 +#: ../../library/curses.rst:962 msgid "Return a tuple ``(y, x)`` of the height and width of the window." msgstr "" -#: ../../library/curses.rst:965 +#: ../../library/curses.rst:967 msgid "" "Return the beginning coordinates of this window relative to its parent " "window as a tuple ``(y, x)``. Return ``(-1, -1)`` if this window has no " "parent." msgstr "" -#: ../../library/curses.rst:975 +#: ../../library/curses.rst:977 msgid "" "Read a bytes object from the user, with primitive line editing capacity." msgstr "" -#: ../../library/curses.rst:980 +#: ../../library/curses.rst:982 msgid "" "Return a tuple ``(y, x)`` of current cursor position relative to the " "window's upper-left corner." msgstr "" -#: ../../library/curses.rst:987 +#: ../../library/curses.rst:989 msgid "" "Display a horizontal line starting at ``(y, x)`` with length *n* consisting " "of the character *ch*." msgstr "" -#: ../../library/curses.rst:993 +#: ../../library/curses.rst:995 msgid "" "If *flag* is ``False``, curses no longer considers using the hardware insert/" "delete character feature of the terminal; if *flag* is ``True``, use of " @@ -1137,13 +1149,13 @@ msgid "" "initialized, use of character insert/delete is enabled by default." msgstr "" -#: ../../library/curses.rst:1001 +#: ../../library/curses.rst:1003 msgid "" "If *flag* is ``True``, :mod:`curses` will try and use hardware line editing " "facilities. Otherwise, line insertion/deletion are disabled." msgstr "" -#: ../../library/curses.rst:1007 +#: ../../library/curses.rst:1009 msgid "" "If *flag* is ``True``, any change in the window image automatically causes " "the window to be refreshed; you no longer have to call :meth:`refresh` " @@ -1151,19 +1163,19 @@ msgid "" "calls to wrefresh. This option is disabled by default." msgstr "" -#: ../../library/curses.rst:1015 +#: ../../library/curses.rst:1017 msgid "" "Return the character at the given position in the window. The bottom 8 bits " "are the character proper, and upper bits are the attributes." msgstr "" -#: ../../library/curses.rst:1022 +#: ../../library/curses.rst:1024 msgid "" "Paint character *ch* at ``(y, x)`` with attributes *attr*, moving the line " "from position *x* right by one character." msgstr "" -#: ../../library/curses.rst:1028 +#: ../../library/curses.rst:1030 msgid "" "Insert *nlines* lines into the specified window above the current line. The " "*nlines* bottom lines are lost. For negative *nlines*, delete *nlines* " @@ -1172,13 +1184,13 @@ msgid "" "remains the same." msgstr "" -#: ../../library/curses.rst:1037 +#: ../../library/curses.rst:1039 msgid "" "Insert a blank line under the cursor. All following lines are moved down by " "one line." msgstr "" -#: ../../library/curses.rst:1044 +#: ../../library/curses.rst:1046 msgid "" "Insert a character string (as many characters as will fit on the line) " "before the character under the cursor, up to *n* characters. If *n* is " @@ -1188,7 +1200,7 @@ msgid "" "if specified)." msgstr "" -#: ../../library/curses.rst:1054 +#: ../../library/curses.rst:1056 msgid "" "Insert a character string (as many characters as will fit on the line) " "before the character under the cursor. All characters to the right of the " @@ -1197,7 +1209,7 @@ msgid "" "specified)." msgstr "" -#: ../../library/curses.rst:1063 +#: ../../library/curses.rst:1065 msgid "" "Return a bytes object of characters, extracted from the window starting at " "the current cursor position, or at *y*, *x* if specified. Attributes are " @@ -1205,76 +1217,76 @@ msgid "" "string at most *n* characters long (exclusive of the trailing NUL)." msgstr "" -#: ../../library/curses.rst:1071 +#: ../../library/curses.rst:1073 msgid "" "Return ``True`` if the specified line was modified since the last call to :" "meth:`refresh`; otherwise return ``False``. Raise a :exc:`curses.error` " "exception if *line* is not valid for the given window." msgstr "" -#: ../../library/curses.rst:1078 +#: ../../library/curses.rst:1080 msgid "" "Return ``True`` if the specified window was modified since the last call to :" "meth:`refresh`; otherwise return ``False``." msgstr "" -#: ../../library/curses.rst:1084 +#: ../../library/curses.rst:1086 msgid "" "If *flag* is ``True``, escape sequences generated by some keys (keypad, " "function keys) will be interpreted by :mod:`curses`. If *flag* is ``False``, " "escape sequences will be left as is in the input stream." msgstr "" -#: ../../library/curses.rst:1091 +#: ../../library/curses.rst:1093 msgid "" "If *flag* is ``True``, cursor is left where it is on update, instead of " "being at \"cursor position.\" This reduces cursor movement where possible. " "If possible the cursor will be made invisible." msgstr "" -#: ../../library/curses.rst:1095 +#: ../../library/curses.rst:1097 msgid "" "If *flag* is ``False``, cursor will always be at \"cursor position\" after " "an update." msgstr "" -#: ../../library/curses.rst:1100 +#: ../../library/curses.rst:1102 msgid "Move cursor to ``(new_y, new_x)``." msgstr "" -#: ../../library/curses.rst:1105 +#: ../../library/curses.rst:1107 msgid "" "Move the window inside its parent window. The screen-relative parameters of " "the window are not changed. This routine is used to display different parts " "of the parent window at the same physical position on the screen." msgstr "" -#: ../../library/curses.rst:1112 +#: ../../library/curses.rst:1114 msgid "Move the window so its upper-left corner is at ``(new_y, new_x)``." msgstr "" -#: ../../library/curses.rst:1117 +#: ../../library/curses.rst:1119 msgid "If *flag* is ``True``, :meth:`getch` will be non-blocking." msgstr "" -#: ../../library/curses.rst:1122 +#: ../../library/curses.rst:1124 msgid "If *flag* is ``True``, escape sequences will not be timed out." msgstr "" -#: ../../library/curses.rst:1124 +#: ../../library/curses.rst:1126 msgid "" "If *flag* is ``False``, after a few milliseconds, an escape sequence will " "not be interpreted, and will be left in the input stream as is." msgstr "" -#: ../../library/curses.rst:1130 +#: ../../library/curses.rst:1132 msgid "" "Mark for refresh but wait. This function updates the data structure " "representing the desired state of the window, but does not force an update " "of the physical screen. To accomplish that, call :func:`doupdate`." msgstr "" -#: ../../library/curses.rst:1137 +#: ../../library/curses.rst:1139 msgid "" "Overlay the window on top of *destwin*. The windows need not be the same " "size, only the overlapping region is copied. This copy is non-destructive, " @@ -1282,7 +1294,7 @@ msgid "" "contents of *destwin*." msgstr "" -#: ../../library/curses.rst:1142 +#: ../../library/curses.rst:1144 msgid "" "To get fine-grained control over the copied region, the second form of :meth:" "`overlay` can be used. *sminrow* and *smincol* are the upper-left " @@ -1290,7 +1302,7 @@ msgid "" "in the destination window." msgstr "" -#: ../../library/curses.rst:1150 +#: ../../library/curses.rst:1152 msgid "" "Overwrite the window on top of *destwin*. The windows need not be the same " "size, in which case only the overlapping region is copied. This copy is " @@ -1298,7 +1310,7 @@ msgid "" "the old contents of *destwin*." msgstr "" -#: ../../library/curses.rst:1155 +#: ../../library/curses.rst:1157 msgid "" "To get fine-grained control over the copied region, the second form of :meth:" "`overwrite` can be used. *sminrow* and *smincol* are the upper-left " @@ -1306,31 +1318,31 @@ msgid "" "the destination window." msgstr "" -#: ../../library/curses.rst:1163 +#: ../../library/curses.rst:1165 msgid "" "Write all data associated with the window into the provided file object. " "This information can be later retrieved using the :func:`getwin` function." msgstr "" -#: ../../library/curses.rst:1169 +#: ../../library/curses.rst:1171 msgid "" "Indicate that the *num* screen lines, starting at line *beg*, are corrupted " "and should be completely redrawn on the next :meth:`refresh` call." msgstr "" -#: ../../library/curses.rst:1175 +#: ../../library/curses.rst:1177 msgid "" "Touch the entire window, causing it to be completely redrawn on the next :" "meth:`refresh` call." msgstr "" -#: ../../library/curses.rst:1181 +#: ../../library/curses.rst:1183 msgid "" "Update the display immediately (sync actual screen with previous drawing/" "deleting methods)." msgstr "" -#: ../../library/curses.rst:1184 +#: ../../library/curses.rst:1186 msgid "" "The 6 optional arguments can only be specified when the window is a pad " "created with :func:`newpad`. The additional parameters are needed to " @@ -1345,7 +1357,7 @@ msgid "" "*smincol* are treated as if they were zero." msgstr "" -#: ../../library/curses.rst:1198 +#: ../../library/curses.rst:1200 msgid "" "Reallocate storage for a curses window to adjust its dimensions to the " "specified values. If either dimension is larger than the current values, " @@ -1353,11 +1365,11 @@ msgid "" "rendition (as set by :meth:`bkgdset`) merged into them." msgstr "" -#: ../../library/curses.rst:1206 +#: ../../library/curses.rst:1208 msgid "Scroll the screen or scrolling region upward by *lines* lines." msgstr "" -#: ../../library/curses.rst:1211 +#: ../../library/curses.rst:1213 msgid "" "Control what happens when the cursor of a window is moved off the edge of " "the window or scrolling region, either as a result of a newline action on " @@ -1367,54 +1379,54 @@ msgid "" "scrolling effect on the terminal, it is also necessary to call :meth:`idlok`." msgstr "" -#: ../../library/curses.rst:1221 +#: ../../library/curses.rst:1223 msgid "" "Set the scrolling region from line *top* to line *bottom*. All scrolling " "actions will take place in this region." msgstr "" -#: ../../library/curses.rst:1227 +#: ../../library/curses.rst:1229 msgid "" "Turn off the standout attribute. On some terminals this has the side effect " "of turning off all attributes." msgstr "" -#: ../../library/curses.rst:1233 +#: ../../library/curses.rst:1235 msgid "Turn on attribute *A_STANDOUT*." msgstr "" -#: ../../library/curses.rst:1239 ../../library/curses.rst:1246 +#: ../../library/curses.rst:1241 ../../library/curses.rst:1248 msgid "" "Return a sub-window, whose upper-left corner is at ``(begin_y, begin_x)``, " "and whose width/height is *ncols*/*nlines*." msgstr "" -#: ../../library/curses.rst:1249 +#: ../../library/curses.rst:1251 msgid "" "By default, the sub-window will extend from the specified position to the " "lower right corner of the window." msgstr "" -#: ../../library/curses.rst:1255 +#: ../../library/curses.rst:1257 msgid "" "Touch each location in the window that has been touched in any of its " "ancestor windows. This routine is called by :meth:`refresh`, so it should " "almost never be necessary to call it manually." msgstr "" -#: ../../library/curses.rst:1262 +#: ../../library/curses.rst:1264 msgid "" "If *flag* is ``True``, then :meth:`syncup` is called automatically whenever " "there is a change in the window." msgstr "" -#: ../../library/curses.rst:1268 +#: ../../library/curses.rst:1270 msgid "" "Touch all locations in ancestors of the window that have been changed in " "the window." msgstr "" -#: ../../library/curses.rst:1274 +#: ../../library/curses.rst:1276 msgid "" "Set blocking or non-blocking read behavior for the window. If *delay* is " "negative, blocking read is used (which will wait indefinitely for input). " @@ -1424,7 +1436,7 @@ msgid "" "still no input at the end of that time." msgstr "" -#: ../../library/curses.rst:1284 +#: ../../library/curses.rst:1286 msgid "" "Pretend *count* lines have been changed, starting with line *start*. If " "*changed* is supplied, it specifies whether the affected lines are marked as " @@ -1432,49 +1444,49 @@ msgid "" "``=False``)." msgstr "" -#: ../../library/curses.rst:1291 +#: ../../library/curses.rst:1293 msgid "" "Pretend the whole window has been changed, for purposes of drawing " "optimizations." msgstr "" -#: ../../library/curses.rst:1297 +#: ../../library/curses.rst:1299 msgid "" "Mark all lines in the window as unchanged since the last call to :meth:" "`refresh`." msgstr "" -#: ../../library/curses.rst:1304 +#: ../../library/curses.rst:1306 msgid "" "Display a vertical line starting at ``(y, x)`` with length *n* consisting of " "the character *ch* with attributes *attr*." msgstr "" -#: ../../library/curses.rst:1309 +#: ../../library/curses.rst:1311 msgid "Constants" msgstr "" -#: ../../library/curses.rst:1311 +#: ../../library/curses.rst:1313 msgid "The :mod:`curses` module defines the following data members:" msgstr "" -#: ../../library/curses.rst:1316 +#: ../../library/curses.rst:1318 msgid "" "Some curses routines that return an integer, such as :meth:`~window." "getch`, return :const:`ERR` upon failure." msgstr "" -#: ../../library/curses.rst:1322 +#: ../../library/curses.rst:1324 msgid "" "Some curses routines that return an integer, such as :func:`napms`, " "return :const:`OK` upon success." msgstr "" -#: ../../library/curses.rst:1329 +#: ../../library/curses.rst:1331 msgid "A bytes object representing the current version of the module." msgstr "" -#: ../../library/curses.rst:1334 +#: ../../library/curses.rst:1336 msgid "" "A named tuple containing the three components of the ncurses library " "version: *major*, *minor*, and *patch*. All values are integers. The " @@ -1482,536 +1494,536 @@ msgid "" "is equivalent to ``curses.ncurses_version.major`` and so on." msgstr "" -#: ../../library/curses.rst:1339 +#: ../../library/curses.rst:1341 msgid "Availability: if the ncurses library is used." msgstr "" -#: ../../library/curses.rst:1345 +#: ../../library/curses.rst:1347 msgid "" "The maximum number of colors the terminal can support. It is defined only " "after the call to :func:`start_color`." msgstr "" -#: ../../library/curses.rst:1350 +#: ../../library/curses.rst:1352 msgid "" "The maximum number of color pairs the terminal can support. It is defined " "only after the call to :func:`start_color`." msgstr "" -#: ../../library/curses.rst:1355 +#: ../../library/curses.rst:1357 msgid "" "The width of the screen, i.e., the number of columns. It is defined only " "after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" "func:`resizeterm` and :func:`resize_term`." msgstr "" -#: ../../library/curses.rst:1362 +#: ../../library/curses.rst:1364 msgid "" "The height of the screen, i.e., the number of lines. It is defined only " "after the call to :func:`initscr`. Updated by :func:`update_lines_cols`, :" "func:`resizeterm` and :func:`resize_term`." msgstr "" -#: ../../library/curses.rst:1368 +#: ../../library/curses.rst:1370 msgid "" "Some constants are available to specify character cell attributes. The exact " "constants available are system dependent." msgstr "" -#: ../../library/curses.rst:1372 +#: ../../library/curses.rst:1374 msgid "Attribute" msgstr "" -#: ../../library/curses.rst:1372 ../../library/curses.rst:1417 -#: ../../library/curses.rst:1663 ../../library/curses.rst:1755 +#: ../../library/curses.rst:1374 ../../library/curses.rst:1419 +#: ../../library/curses.rst:1665 ../../library/curses.rst:1757 msgid "Meaning" msgstr "含義" -#: ../../library/curses.rst:1374 +#: ../../library/curses.rst:1376 msgid "Alternate character set mode" msgstr "" -#: ../../library/curses.rst:1376 +#: ../../library/curses.rst:1378 msgid "Blink mode" msgstr "" -#: ../../library/curses.rst:1378 +#: ../../library/curses.rst:1380 msgid "Bold mode" msgstr "" -#: ../../library/curses.rst:1380 +#: ../../library/curses.rst:1382 msgid "Dim mode" msgstr "" -#: ../../library/curses.rst:1382 +#: ../../library/curses.rst:1384 msgid "Invisible or blank mode" msgstr "" -#: ../../library/curses.rst:1384 +#: ../../library/curses.rst:1386 msgid "Italic mode" msgstr "" -#: ../../library/curses.rst:1386 +#: ../../library/curses.rst:1388 msgid "Normal attribute" msgstr "" -#: ../../library/curses.rst:1388 +#: ../../library/curses.rst:1390 msgid "Protected mode" msgstr "" -#: ../../library/curses.rst:1390 +#: ../../library/curses.rst:1392 msgid "Reverse background and foreground colors" msgstr "" -#: ../../library/curses.rst:1393 +#: ../../library/curses.rst:1395 msgid "Standout mode" msgstr "" -#: ../../library/curses.rst:1395 +#: ../../library/curses.rst:1397 msgid "Underline mode" msgstr "" -#: ../../library/curses.rst:1397 +#: ../../library/curses.rst:1399 msgid "Horizontal highlight" msgstr "" -#: ../../library/curses.rst:1399 +#: ../../library/curses.rst:1401 msgid "Left highlight" msgstr "" -#: ../../library/curses.rst:1401 +#: ../../library/curses.rst:1403 msgid "Low highlight" msgstr "" -#: ../../library/curses.rst:1403 +#: ../../library/curses.rst:1405 msgid "Right highlight" msgstr "" -#: ../../library/curses.rst:1405 +#: ../../library/curses.rst:1407 msgid "Top highlight" msgstr "" -#: ../../library/curses.rst:1407 +#: ../../library/curses.rst:1409 msgid "Vertical highlight" msgstr "" -#: ../../library/curses.rst:1410 +#: ../../library/curses.rst:1412 msgid "``A_ITALIC`` was added." msgstr "" -#: ../../library/curses.rst:1413 +#: ../../library/curses.rst:1415 msgid "" "Several constants are available to extract corresponding attributes returned " "by some methods." msgstr "" -#: ../../library/curses.rst:1417 +#: ../../library/curses.rst:1419 msgid "Bit-mask" msgstr "" -#: ../../library/curses.rst:1419 +#: ../../library/curses.rst:1421 msgid "Bit-mask to extract attributes" msgstr "" -#: ../../library/curses.rst:1422 +#: ../../library/curses.rst:1424 msgid "Bit-mask to extract a character" msgstr "" -#: ../../library/curses.rst:1425 +#: ../../library/curses.rst:1427 msgid "Bit-mask to extract color-pair field information" msgstr "" -#: ../../library/curses.rst:1429 +#: ../../library/curses.rst:1431 msgid "" "Keys are referred to by integer constants with names starting with " "``KEY_``. The exact keycaps available are system dependent." msgstr "" -#: ../../library/curses.rst:1435 +#: ../../library/curses.rst:1437 msgid "Key constant" msgstr "" -#: ../../library/curses.rst:1435 +#: ../../library/curses.rst:1437 msgid "Key" msgstr "" -#: ../../library/curses.rst:1437 +#: ../../library/curses.rst:1439 msgid "Minimum key value" msgstr "" -#: ../../library/curses.rst:1439 +#: ../../library/curses.rst:1441 msgid "Break key (unreliable)" msgstr "" -#: ../../library/curses.rst:1441 +#: ../../library/curses.rst:1443 msgid "Down-arrow" msgstr "" -#: ../../library/curses.rst:1443 +#: ../../library/curses.rst:1445 msgid "Up-arrow" msgstr "" -#: ../../library/curses.rst:1445 +#: ../../library/curses.rst:1447 msgid "Left-arrow" msgstr "" -#: ../../library/curses.rst:1447 +#: ../../library/curses.rst:1449 msgid "Right-arrow" msgstr "" -#: ../../library/curses.rst:1449 +#: ../../library/curses.rst:1451 msgid "Home key (upward+left arrow)" msgstr "" -#: ../../library/curses.rst:1451 +#: ../../library/curses.rst:1453 msgid "Backspace (unreliable)" msgstr "" -#: ../../library/curses.rst:1453 +#: ../../library/curses.rst:1455 msgid "Function keys. Up to 64 function keys are supported." msgstr "" -#: ../../library/curses.rst:1456 +#: ../../library/curses.rst:1458 msgid "Value of function key *n*" msgstr "" -#: ../../library/curses.rst:1458 +#: ../../library/curses.rst:1460 msgid "Delete line" msgstr "" -#: ../../library/curses.rst:1460 +#: ../../library/curses.rst:1462 msgid "Insert line" msgstr "" -#: ../../library/curses.rst:1462 +#: ../../library/curses.rst:1464 msgid "Delete character" msgstr "" -#: ../../library/curses.rst:1464 +#: ../../library/curses.rst:1466 msgid "Insert char or enter insert mode" msgstr "" -#: ../../library/curses.rst:1466 +#: ../../library/curses.rst:1468 msgid "Exit insert char mode" msgstr "" -#: ../../library/curses.rst:1468 +#: ../../library/curses.rst:1470 msgid "Clear screen" msgstr "" -#: ../../library/curses.rst:1470 +#: ../../library/curses.rst:1472 msgid "Clear to end of screen" msgstr "" -#: ../../library/curses.rst:1472 +#: ../../library/curses.rst:1474 msgid "Clear to end of line" msgstr "" -#: ../../library/curses.rst:1474 +#: ../../library/curses.rst:1476 msgid "Scroll 1 line forward" msgstr "" -#: ../../library/curses.rst:1476 +#: ../../library/curses.rst:1478 msgid "Scroll 1 line backward (reverse)" msgstr "" -#: ../../library/curses.rst:1478 +#: ../../library/curses.rst:1480 msgid "Next page" msgstr "" -#: ../../library/curses.rst:1480 +#: ../../library/curses.rst:1482 msgid "Previous page" msgstr "" -#: ../../library/curses.rst:1482 +#: ../../library/curses.rst:1484 msgid "Set tab" msgstr "" -#: ../../library/curses.rst:1484 +#: ../../library/curses.rst:1486 msgid "Clear tab" msgstr "" -#: ../../library/curses.rst:1486 +#: ../../library/curses.rst:1488 msgid "Clear all tabs" msgstr "" -#: ../../library/curses.rst:1488 +#: ../../library/curses.rst:1490 msgid "Enter or send (unreliable)" msgstr "" -#: ../../library/curses.rst:1490 +#: ../../library/curses.rst:1492 msgid "Soft (partial) reset (unreliable)" msgstr "" -#: ../../library/curses.rst:1492 +#: ../../library/curses.rst:1494 msgid "Reset or hard reset (unreliable)" msgstr "" -#: ../../library/curses.rst:1494 +#: ../../library/curses.rst:1496 msgid "Print" msgstr "" -#: ../../library/curses.rst:1496 +#: ../../library/curses.rst:1498 msgid "Home down or bottom (lower left)" msgstr "" -#: ../../library/curses.rst:1498 +#: ../../library/curses.rst:1500 msgid "Upper left of keypad" msgstr "" -#: ../../library/curses.rst:1500 +#: ../../library/curses.rst:1502 msgid "Upper right of keypad" msgstr "" -#: ../../library/curses.rst:1502 +#: ../../library/curses.rst:1504 msgid "Center of keypad" msgstr "" -#: ../../library/curses.rst:1504 +#: ../../library/curses.rst:1506 msgid "Lower left of keypad" msgstr "" -#: ../../library/curses.rst:1506 +#: ../../library/curses.rst:1508 msgid "Lower right of keypad" msgstr "" -#: ../../library/curses.rst:1508 +#: ../../library/curses.rst:1510 msgid "Back tab" msgstr "" -#: ../../library/curses.rst:1510 +#: ../../library/curses.rst:1512 msgid "Beg (beginning)" msgstr "" -#: ../../library/curses.rst:1512 +#: ../../library/curses.rst:1514 msgid "Cancel" msgstr "" -#: ../../library/curses.rst:1514 +#: ../../library/curses.rst:1516 msgid "Close" msgstr "" -#: ../../library/curses.rst:1516 +#: ../../library/curses.rst:1518 msgid "Cmd (command)" msgstr "" -#: ../../library/curses.rst:1518 +#: ../../library/curses.rst:1520 msgid "Copy" msgstr "" -#: ../../library/curses.rst:1520 +#: ../../library/curses.rst:1522 msgid "Create" msgstr "" -#: ../../library/curses.rst:1522 +#: ../../library/curses.rst:1524 msgid "End" msgstr "" -#: ../../library/curses.rst:1524 +#: ../../library/curses.rst:1526 msgid "Exit" msgstr "" -#: ../../library/curses.rst:1526 +#: ../../library/curses.rst:1528 msgid "Find" msgstr "" -#: ../../library/curses.rst:1528 +#: ../../library/curses.rst:1530 msgid "Help" msgstr "" -#: ../../library/curses.rst:1530 +#: ../../library/curses.rst:1532 msgid "Mark" msgstr "" -#: ../../library/curses.rst:1532 +#: ../../library/curses.rst:1534 msgid "Message" msgstr "" -#: ../../library/curses.rst:1534 +#: ../../library/curses.rst:1536 msgid "Move" msgstr "" -#: ../../library/curses.rst:1536 +#: ../../library/curses.rst:1538 msgid "Next" msgstr "" -#: ../../library/curses.rst:1538 +#: ../../library/curses.rst:1540 msgid "Open" msgstr "" -#: ../../library/curses.rst:1540 +#: ../../library/curses.rst:1542 msgid "Options" msgstr "" -#: ../../library/curses.rst:1542 +#: ../../library/curses.rst:1544 msgid "Prev (previous)" msgstr "" -#: ../../library/curses.rst:1544 +#: ../../library/curses.rst:1546 msgid "Redo" msgstr "" -#: ../../library/curses.rst:1546 +#: ../../library/curses.rst:1548 msgid "Ref (reference)" msgstr "" -#: ../../library/curses.rst:1548 +#: ../../library/curses.rst:1550 msgid "Refresh" msgstr "" -#: ../../library/curses.rst:1550 +#: ../../library/curses.rst:1552 msgid "Replace" msgstr "" -#: ../../library/curses.rst:1552 +#: ../../library/curses.rst:1554 msgid "Restart" msgstr "" -#: ../../library/curses.rst:1554 +#: ../../library/curses.rst:1556 msgid "Resume" msgstr "" -#: ../../library/curses.rst:1556 +#: ../../library/curses.rst:1558 msgid "Save" msgstr "" -#: ../../library/curses.rst:1558 +#: ../../library/curses.rst:1560 msgid "Shifted Beg (beginning)" msgstr "" -#: ../../library/curses.rst:1560 +#: ../../library/curses.rst:1562 msgid "Shifted Cancel" msgstr "" -#: ../../library/curses.rst:1562 +#: ../../library/curses.rst:1564 msgid "Shifted Command" msgstr "" -#: ../../library/curses.rst:1564 +#: ../../library/curses.rst:1566 msgid "Shifted Copy" msgstr "" -#: ../../library/curses.rst:1566 +#: ../../library/curses.rst:1568 msgid "Shifted Create" msgstr "" -#: ../../library/curses.rst:1568 +#: ../../library/curses.rst:1570 msgid "Shifted Delete char" msgstr "" -#: ../../library/curses.rst:1570 +#: ../../library/curses.rst:1572 msgid "Shifted Delete line" msgstr "" -#: ../../library/curses.rst:1572 +#: ../../library/curses.rst:1574 msgid "Select" msgstr "" -#: ../../library/curses.rst:1574 +#: ../../library/curses.rst:1576 msgid "Shifted End" msgstr "" -#: ../../library/curses.rst:1576 +#: ../../library/curses.rst:1578 msgid "Shifted Clear line" msgstr "" -#: ../../library/curses.rst:1578 +#: ../../library/curses.rst:1580 msgid "Shifted Exit" msgstr "" -#: ../../library/curses.rst:1580 +#: ../../library/curses.rst:1582 msgid "Shifted Find" msgstr "" -#: ../../library/curses.rst:1582 +#: ../../library/curses.rst:1584 msgid "Shifted Help" msgstr "" -#: ../../library/curses.rst:1584 +#: ../../library/curses.rst:1586 msgid "Shifted Home" msgstr "" -#: ../../library/curses.rst:1586 +#: ../../library/curses.rst:1588 msgid "Shifted Input" msgstr "" -#: ../../library/curses.rst:1588 +#: ../../library/curses.rst:1590 msgid "Shifted Left arrow" msgstr "" -#: ../../library/curses.rst:1590 +#: ../../library/curses.rst:1592 msgid "Shifted Message" msgstr "" -#: ../../library/curses.rst:1592 +#: ../../library/curses.rst:1594 msgid "Shifted Move" msgstr "" -#: ../../library/curses.rst:1594 +#: ../../library/curses.rst:1596 msgid "Shifted Next" msgstr "" -#: ../../library/curses.rst:1596 +#: ../../library/curses.rst:1598 msgid "Shifted Options" msgstr "" -#: ../../library/curses.rst:1598 +#: ../../library/curses.rst:1600 msgid "Shifted Prev" msgstr "" -#: ../../library/curses.rst:1600 +#: ../../library/curses.rst:1602 msgid "Shifted Print" msgstr "" -#: ../../library/curses.rst:1602 +#: ../../library/curses.rst:1604 msgid "Shifted Redo" msgstr "" -#: ../../library/curses.rst:1604 +#: ../../library/curses.rst:1606 msgid "Shifted Replace" msgstr "" -#: ../../library/curses.rst:1606 +#: ../../library/curses.rst:1608 msgid "Shifted Right arrow" msgstr "" -#: ../../library/curses.rst:1608 +#: ../../library/curses.rst:1610 msgid "Shifted Resume" msgstr "" -#: ../../library/curses.rst:1610 +#: ../../library/curses.rst:1612 msgid "Shifted Save" msgstr "" -#: ../../library/curses.rst:1612 +#: ../../library/curses.rst:1614 msgid "Shifted Suspend" msgstr "" -#: ../../library/curses.rst:1614 +#: ../../library/curses.rst:1616 msgid "Shifted Undo" msgstr "" -#: ../../library/curses.rst:1616 +#: ../../library/curses.rst:1618 msgid "Suspend" msgstr "" -#: ../../library/curses.rst:1618 +#: ../../library/curses.rst:1620 msgid "Undo" msgstr "" -#: ../../library/curses.rst:1620 +#: ../../library/curses.rst:1622 msgid "Mouse event has occurred" msgstr "" -#: ../../library/curses.rst:1622 +#: ../../library/curses.rst:1624 msgid "Terminal resize event" msgstr "" -#: ../../library/curses.rst:1624 +#: ../../library/curses.rst:1626 msgid "Maximum key value" msgstr "" -#: ../../library/curses.rst:1627 +#: ../../library/curses.rst:1629 msgid "" "On VT100s and their software emulations, such as X terminal emulators, there " "are normally at least four function keys (:const:`KEY_F1 `, :const:" @@ -2023,64 +2035,64 @@ msgid "" "keypad mappings are standard:" msgstr "" -#: ../../library/curses.rst:1636 +#: ../../library/curses.rst:1638 msgid "Keycap" msgstr "" -#: ../../library/curses.rst:1636 ../../library/curses.rst:1781 -#: ../../library/curses.rst:1905 +#: ../../library/curses.rst:1638 ../../library/curses.rst:1783 +#: ../../library/curses.rst:1907 msgid "Constant" msgstr "" -#: ../../library/curses.rst:1638 +#: ../../library/curses.rst:1640 msgid ":kbd:`Insert`" msgstr ":kbd:`Insert`" -#: ../../library/curses.rst:1638 +#: ../../library/curses.rst:1640 msgid "KEY_IC" msgstr "KEY_IC" -#: ../../library/curses.rst:1640 +#: ../../library/curses.rst:1642 msgid ":kbd:`Delete`" msgstr ":kbd:`Delete`" -#: ../../library/curses.rst:1640 +#: ../../library/curses.rst:1642 msgid "KEY_DC" msgstr "KEY_DC" -#: ../../library/curses.rst:1642 +#: ../../library/curses.rst:1644 msgid ":kbd:`Home`" msgstr ":kbd:`Home`" -#: ../../library/curses.rst:1642 +#: ../../library/curses.rst:1644 msgid "KEY_HOME" msgstr "KEY_HOME" -#: ../../library/curses.rst:1644 +#: ../../library/curses.rst:1646 msgid ":kbd:`End`" msgstr ":kbd:`End`" -#: ../../library/curses.rst:1644 +#: ../../library/curses.rst:1646 msgid "KEY_END" msgstr "KEY_END" -#: ../../library/curses.rst:1646 +#: ../../library/curses.rst:1648 msgid ":kbd:`Page Up`" msgstr ":kbd:`Page Up`" -#: ../../library/curses.rst:1646 +#: ../../library/curses.rst:1648 msgid "KEY_PPAGE" msgstr "KEY_PPAGE" -#: ../../library/curses.rst:1648 +#: ../../library/curses.rst:1650 msgid ":kbd:`Page Down`" msgstr ":kbd:`Page Down`" -#: ../../library/curses.rst:1648 +#: ../../library/curses.rst:1650 msgid "KEY_NPAGE" msgstr "KEY_NPAGE" -#: ../../library/curses.rst:1653 +#: ../../library/curses.rst:1655 msgid "" "The following table lists characters from the alternate character set. These " "are inherited from the VT100 terminal, and will generally be available on " @@ -2088,268 +2100,268 @@ msgid "" "available, curses falls back on a crude printable ASCII approximation." msgstr "" -#: ../../library/curses.rst:1660 +#: ../../library/curses.rst:1662 msgid "These are available only after :func:`initscr` has been called." msgstr "" -#: ../../library/curses.rst:1663 +#: ../../library/curses.rst:1665 msgid "ACS code" msgstr "" -#: ../../library/curses.rst:1665 +#: ../../library/curses.rst:1667 msgid "alternate name for upper right corner" msgstr "" -#: ../../library/curses.rst:1667 +#: ../../library/curses.rst:1669 msgid "solid square block" msgstr "" -#: ../../library/curses.rst:1669 +#: ../../library/curses.rst:1671 msgid "board of squares" msgstr "" -#: ../../library/curses.rst:1671 +#: ../../library/curses.rst:1673 msgid "alternate name for horizontal line" msgstr "" -#: ../../library/curses.rst:1673 +#: ../../library/curses.rst:1675 msgid "alternate name for upper left corner" msgstr "" -#: ../../library/curses.rst:1675 +#: ../../library/curses.rst:1677 msgid "alternate name for top tee" msgstr "" -#: ../../library/curses.rst:1677 +#: ../../library/curses.rst:1679 msgid "bottom tee" msgstr "" -#: ../../library/curses.rst:1679 +#: ../../library/curses.rst:1681 msgid "bullet" msgstr "" -#: ../../library/curses.rst:1681 +#: ../../library/curses.rst:1683 msgid "checker board (stipple)" msgstr "" -#: ../../library/curses.rst:1683 +#: ../../library/curses.rst:1685 msgid "arrow pointing down" msgstr "" -#: ../../library/curses.rst:1685 +#: ../../library/curses.rst:1687 msgid "degree symbol" msgstr "" -#: ../../library/curses.rst:1687 +#: ../../library/curses.rst:1689 msgid "diamond" msgstr "" -#: ../../library/curses.rst:1689 +#: ../../library/curses.rst:1691 msgid "greater-than-or-equal-to" msgstr "" -#: ../../library/curses.rst:1691 +#: ../../library/curses.rst:1693 msgid "horizontal line" msgstr "" -#: ../../library/curses.rst:1693 +#: ../../library/curses.rst:1695 msgid "lantern symbol" msgstr "" -#: ../../library/curses.rst:1695 +#: ../../library/curses.rst:1697 msgid "left arrow" msgstr "" -#: ../../library/curses.rst:1697 +#: ../../library/curses.rst:1699 msgid "less-than-or-equal-to" msgstr "" -#: ../../library/curses.rst:1699 +#: ../../library/curses.rst:1701 msgid "lower left-hand corner" msgstr "" -#: ../../library/curses.rst:1701 +#: ../../library/curses.rst:1703 msgid "lower right-hand corner" msgstr "" -#: ../../library/curses.rst:1703 +#: ../../library/curses.rst:1705 msgid "left tee" msgstr "" -#: ../../library/curses.rst:1705 +#: ../../library/curses.rst:1707 msgid "not-equal sign" msgstr "" -#: ../../library/curses.rst:1707 +#: ../../library/curses.rst:1709 msgid "letter pi" msgstr "" -#: ../../library/curses.rst:1709 +#: ../../library/curses.rst:1711 msgid "plus-or-minus sign" msgstr "" -#: ../../library/curses.rst:1711 +#: ../../library/curses.rst:1713 msgid "big plus sign" msgstr "" -#: ../../library/curses.rst:1713 +#: ../../library/curses.rst:1715 msgid "right arrow" msgstr "" -#: ../../library/curses.rst:1715 +#: ../../library/curses.rst:1717 msgid "right tee" msgstr "" -#: ../../library/curses.rst:1717 +#: ../../library/curses.rst:1719 msgid "scan line 1" msgstr "" -#: ../../library/curses.rst:1719 +#: ../../library/curses.rst:1721 msgid "scan line 3" msgstr "" -#: ../../library/curses.rst:1721 +#: ../../library/curses.rst:1723 msgid "scan line 7" msgstr "" -#: ../../library/curses.rst:1723 +#: ../../library/curses.rst:1725 msgid "scan line 9" msgstr "" -#: ../../library/curses.rst:1725 +#: ../../library/curses.rst:1727 msgid "alternate name for lower right corner" msgstr "" -#: ../../library/curses.rst:1727 +#: ../../library/curses.rst:1729 msgid "alternate name for vertical line" msgstr "" -#: ../../library/curses.rst:1729 +#: ../../library/curses.rst:1731 msgid "alternate name for right tee" msgstr "" -#: ../../library/curses.rst:1731 +#: ../../library/curses.rst:1733 msgid "alternate name for lower left corner" msgstr "" -#: ../../library/curses.rst:1733 +#: ../../library/curses.rst:1735 msgid "alternate name for bottom tee" msgstr "" -#: ../../library/curses.rst:1735 +#: ../../library/curses.rst:1737 msgid "alternate name for left tee" msgstr "" -#: ../../library/curses.rst:1737 +#: ../../library/curses.rst:1739 msgid "alternate name for crossover or big plus" msgstr "" -#: ../../library/curses.rst:1739 +#: ../../library/curses.rst:1741 msgid "pound sterling" msgstr "" -#: ../../library/curses.rst:1741 +#: ../../library/curses.rst:1743 msgid "top tee" msgstr "" -#: ../../library/curses.rst:1743 +#: ../../library/curses.rst:1745 msgid "up arrow" msgstr "" -#: ../../library/curses.rst:1745 +#: ../../library/curses.rst:1747 msgid "upper left corner" msgstr "" -#: ../../library/curses.rst:1747 +#: ../../library/curses.rst:1749 msgid "upper right corner" msgstr "" -#: ../../library/curses.rst:1749 +#: ../../library/curses.rst:1751 msgid "vertical line" msgstr "" -#: ../../library/curses.rst:1752 +#: ../../library/curses.rst:1754 msgid "" "The following table lists mouse button constants used by :meth:`getmouse`:" msgstr "" -#: ../../library/curses.rst:1755 +#: ../../library/curses.rst:1757 msgid "Mouse button constant" msgstr "" -#: ../../library/curses.rst:1757 +#: ../../library/curses.rst:1759 msgid "Mouse button *n* pressed" msgstr "" -#: ../../library/curses.rst:1759 +#: ../../library/curses.rst:1761 msgid "Mouse button *n* released" msgstr "" -#: ../../library/curses.rst:1761 +#: ../../library/curses.rst:1763 msgid "Mouse button *n* clicked" msgstr "" -#: ../../library/curses.rst:1763 +#: ../../library/curses.rst:1765 msgid "Mouse button *n* double clicked" msgstr "" -#: ../../library/curses.rst:1765 +#: ../../library/curses.rst:1767 msgid "Mouse button *n* triple clicked" msgstr "" -#: ../../library/curses.rst:1767 +#: ../../library/curses.rst:1769 msgid "Shift was down during button state change" msgstr "" -#: ../../library/curses.rst:1769 ../../library/curses.rst:1771 +#: ../../library/curses.rst:1771 ../../library/curses.rst:1773 msgid "Control was down during button state change" msgstr "" -#: ../../library/curses.rst:1778 +#: ../../library/curses.rst:1780 msgid "The following table lists the predefined colors:" msgstr "" -#: ../../library/curses.rst:1781 +#: ../../library/curses.rst:1783 msgid "Color" msgstr "顏色" -#: ../../library/curses.rst:1783 +#: ../../library/curses.rst:1785 msgid "Black" msgstr "黑" -#: ../../library/curses.rst:1785 +#: ../../library/curses.rst:1787 msgid "Blue" msgstr "藍" -#: ../../library/curses.rst:1787 +#: ../../library/curses.rst:1789 msgid "Cyan (light greenish blue)" msgstr "" -#: ../../library/curses.rst:1789 +#: ../../library/curses.rst:1791 msgid "Green" msgstr "綠" -#: ../../library/curses.rst:1791 +#: ../../library/curses.rst:1793 msgid "Magenta (purplish red)" msgstr "" -#: ../../library/curses.rst:1793 +#: ../../library/curses.rst:1795 msgid "Red" msgstr "紅" -#: ../../library/curses.rst:1795 +#: ../../library/curses.rst:1797 msgid "White" msgstr "白" -#: ../../library/curses.rst:1797 +#: ../../library/curses.rst:1799 msgid "Yellow" msgstr "" -#: ../../library/curses.rst:1802 +#: ../../library/curses.rst:1804 msgid ":mod:`curses.textpad` --- Text input widget for curses programs" msgstr "" -#: ../../library/curses.rst:1810 +#: ../../library/curses.rst:1812 msgid "" "The :mod:`curses.textpad` module provides a :class:`Textbox` class that " "handles elementary text editing in a curses window, supporting a set of " @@ -2359,11 +2371,11 @@ msgid "" "purposes." msgstr "" -#: ../../library/curses.rst:1816 +#: ../../library/curses.rst:1818 msgid "The module :mod:`curses.textpad` defines the following function:" msgstr "" -#: ../../library/curses.rst:1821 +#: ../../library/curses.rst:1823 msgid "" "Draw a rectangle. The first argument must be a window object; the remaining " "arguments are coordinates relative to that window. The second and third " @@ -2375,15 +2387,15 @@ msgid "" "will be drawn with ASCII dashes, vertical bars, and plus signs." msgstr "" -#: ../../library/curses.rst:1834 +#: ../../library/curses.rst:1836 msgid "Textbox objects" msgstr "" -#: ../../library/curses.rst:1836 +#: ../../library/curses.rst:1838 msgid "You can instantiate a :class:`Textbox` object as follows:" msgstr "" -#: ../../library/curses.rst:1841 +#: ../../library/curses.rst:1843 msgid "" "Return a textbox widget object. The *win* argument should be a curses :ref:" "`window ` object in which the textbox is to be " @@ -2392,11 +2404,11 @@ msgid "" "instance's :attr:`stripspaces` flag is initially on." msgstr "" -#: ../../library/curses.rst:1847 +#: ../../library/curses.rst:1849 msgid ":class:`Textbox` objects have the following methods:" msgstr "" -#: ../../library/curses.rst:1852 +#: ../../library/curses.rst:1854 msgid "" "This is the entry point you will normally use. It accepts editing " "keystrokes until one of the termination keystrokes is entered. If " @@ -2407,167 +2419,167 @@ msgid "" "`stripspaces` attribute." msgstr "" -#: ../../library/curses.rst:1863 +#: ../../library/curses.rst:1865 msgid "" "Process a single command keystroke. Here are the supported special " "keystrokes:" msgstr "" -#: ../../library/curses.rst:1867 ../../library/curses.rst:1905 +#: ../../library/curses.rst:1869 ../../library/curses.rst:1907 msgid "Keystroke" msgstr "" -#: ../../library/curses.rst:1867 +#: ../../library/curses.rst:1869 msgid "Action" msgstr "" -#: ../../library/curses.rst:1869 +#: ../../library/curses.rst:1871 msgid ":kbd:`Control-A`" msgstr ":kbd:`Control-A`" -#: ../../library/curses.rst:1869 +#: ../../library/curses.rst:1871 msgid "Go to left edge of window." msgstr "" -#: ../../library/curses.rst:1871 ../../library/curses.rst:1907 +#: ../../library/curses.rst:1873 ../../library/curses.rst:1909 msgid ":kbd:`Control-B`" msgstr ":kbd:`Control-B`" -#: ../../library/curses.rst:1871 +#: ../../library/curses.rst:1873 msgid "Cursor left, wrapping to previous line if appropriate." msgstr "" -#: ../../library/curses.rst:1874 +#: ../../library/curses.rst:1876 msgid ":kbd:`Control-D`" msgstr ":kbd:`Control-D`" -#: ../../library/curses.rst:1874 +#: ../../library/curses.rst:1876 msgid "Delete character under cursor." msgstr "" -#: ../../library/curses.rst:1876 +#: ../../library/curses.rst:1878 msgid ":kbd:`Control-E`" msgstr ":kbd:`Control-E`" -#: ../../library/curses.rst:1876 +#: ../../library/curses.rst:1878 msgid "Go to right edge (stripspaces off) or end of line (stripspaces on)." msgstr "" -#: ../../library/curses.rst:1879 ../../library/curses.rst:1909 +#: ../../library/curses.rst:1881 ../../library/curses.rst:1911 msgid ":kbd:`Control-F`" msgstr ":kbd:`Control-F`" -#: ../../library/curses.rst:1879 +#: ../../library/curses.rst:1881 msgid "Cursor right, wrapping to next line when appropriate." msgstr "" -#: ../../library/curses.rst:1882 +#: ../../library/curses.rst:1884 msgid ":kbd:`Control-G`" msgstr ":kbd:`Control-G`" -#: ../../library/curses.rst:1882 +#: ../../library/curses.rst:1884 msgid "Terminate, returning the window contents." msgstr "" -#: ../../library/curses.rst:1884 +#: ../../library/curses.rst:1886 msgid ":kbd:`Control-H`" msgstr ":kbd:`Control-H`" -#: ../../library/curses.rst:1884 +#: ../../library/curses.rst:1886 msgid "Delete character backward." msgstr "" -#: ../../library/curses.rst:1886 +#: ../../library/curses.rst:1888 msgid ":kbd:`Control-J`" msgstr ":kbd:`Control-J`" -#: ../../library/curses.rst:1886 +#: ../../library/curses.rst:1888 msgid "Terminate if the window is 1 line, otherwise insert newline." msgstr "" -#: ../../library/curses.rst:1889 +#: ../../library/curses.rst:1891 msgid ":kbd:`Control-K`" msgstr ":kbd:`Control-K`" -#: ../../library/curses.rst:1889 +#: ../../library/curses.rst:1891 msgid "If line is blank, delete it, otherwise clear to end of line." msgstr "" -#: ../../library/curses.rst:1892 +#: ../../library/curses.rst:1894 msgid ":kbd:`Control-L`" msgstr ":kbd:`Control-L`" -#: ../../library/curses.rst:1892 +#: ../../library/curses.rst:1894 msgid "Refresh screen." msgstr "" -#: ../../library/curses.rst:1894 ../../library/curses.rst:1913 +#: ../../library/curses.rst:1896 ../../library/curses.rst:1915 msgid ":kbd:`Control-N`" msgstr ":kbd:`Control-N`" -#: ../../library/curses.rst:1894 +#: ../../library/curses.rst:1896 msgid "Cursor down; move down one line." msgstr "" -#: ../../library/curses.rst:1896 +#: ../../library/curses.rst:1898 msgid ":kbd:`Control-O`" msgstr ":kbd:`Control-O`" -#: ../../library/curses.rst:1896 +#: ../../library/curses.rst:1898 msgid "Insert a blank line at cursor location." msgstr "" -#: ../../library/curses.rst:1898 ../../library/curses.rst:1911 +#: ../../library/curses.rst:1900 ../../library/curses.rst:1913 msgid ":kbd:`Control-P`" msgstr ":kbd:`Control-P`" -#: ../../library/curses.rst:1898 +#: ../../library/curses.rst:1900 msgid "Cursor up; move up one line." msgstr "" -#: ../../library/curses.rst:1901 +#: ../../library/curses.rst:1903 msgid "" "Move operations do nothing if the cursor is at an edge where the movement is " "not possible. The following synonyms are supported where possible:" msgstr "" -#: ../../library/curses.rst:1907 +#: ../../library/curses.rst:1909 msgid ":const:`~curses.KEY_LEFT`" msgstr ":const:`~curses.KEY_LEFT`" -#: ../../library/curses.rst:1909 +#: ../../library/curses.rst:1911 msgid ":const:`~curses.KEY_RIGHT`" msgstr ":const:`~curses.KEY_RIGHT`" -#: ../../library/curses.rst:1911 +#: ../../library/curses.rst:1913 msgid ":const:`~curses.KEY_UP`" msgstr ":const:`~curses.KEY_UP`" -#: ../../library/curses.rst:1913 +#: ../../library/curses.rst:1915 msgid ":const:`~curses.KEY_DOWN`" msgstr ":const:`~curses.KEY_DOWN`" -#: ../../library/curses.rst:1915 +#: ../../library/curses.rst:1917 msgid ":const:`~curses.KEY_BACKSPACE`" msgstr ":const:`~curses.KEY_BACKSPACE`" -#: ../../library/curses.rst:1915 +#: ../../library/curses.rst:1917 msgid ":kbd:`Control-h`" msgstr ":kbd:`Control-h`" -#: ../../library/curses.rst:1918 +#: ../../library/curses.rst:1920 msgid "" "All other keystrokes are treated as a command to insert the given character " "and move right (with line wrapping)." msgstr "" -#: ../../library/curses.rst:1924 +#: ../../library/curses.rst:1926 msgid "" "Return the window contents as a string; whether blanks in the window are " "included is affected by the :attr:`stripspaces` member." msgstr "" -#: ../../library/curses.rst:1930 +#: ../../library/curses.rst:1932 msgid "" "This attribute is a flag which controls the interpretation of blanks in the " "window. When it is on, trailing blanks on each line are ignored; any cursor " diff --git a/library/custominterp.po b/library/custominterp.po index c3d74e02e4..8d39942bdf 100644 --- a/library/custominterp.po +++ b/library/custominterp.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-07-06 00:17+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/dataclasses.po b/library/dataclasses.po index 3cfb596bad..f6f692492e 100644 --- a/library/dataclasses.po +++ b/library/dataclasses.po @@ -2,9 +2,9 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-02-11 15:02+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -584,7 +584,7 @@ msgid "" "mechanism. Multiple third-parties can each have their own key, to use as a " "namespace in the metadata." msgstr "" -"*metadata*:這可以是映射或無。 None 被視為空字典。此值包含在 :func:`~types." +"*metadata*:這可以是對映或無。 None 被視為空字典。此值包含在 :func:`~types." "MappingProxyType` 中以使其成為只讀的,並暴露在 :class:`Field` 對像上。它根本" "不被資料類別使用,而是作為第三方擴充機制提供的。多個第三方可以各自擁有自己的" "密鑰,用作元資料中的命名空間。" @@ -889,7 +889,13 @@ msgstr "" "造函式可能是明智的,或者可能是處理實例複製的自定義:func:`!replace` (或類似命" "名的)方法。" -#: ../../library/dataclasses.rst:474 +#: ../../library/dataclasses.rst:472 +msgid "" +"Dataclass instances are also supported by generic function :func:`copy." +"replace`." +msgstr "" + +#: ../../library/dataclasses.rst:476 #, fuzzy msgid "" "Return ``True`` if its parameter is a dataclass (including subclasses of a " @@ -897,7 +903,7 @@ msgid "" msgstr "" "如果它的參數是一個資料類別或一個實例,則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/dataclasses.rst:477 +#: ../../library/dataclasses.rst:479 #, fuzzy msgid "" "If you need to know if a class is an instance of a dataclass (and not a " @@ -907,18 +913,18 @@ msgstr "" "如果你需要知道一個類是否是資料類別的實例(而不是資料類別本身),那麼新增一個" "進一步的檢查 ``not isinstance(obj, type)``: ::" -#: ../../library/dataclasses.rst:481 +#: ../../library/dataclasses.rst:483 msgid "" "def is_dataclass_instance(obj):\n" " return is_dataclass(obj) and not isinstance(obj, type)" msgstr "" -#: ../../library/dataclasses.rst:486 +#: ../../library/dataclasses.rst:488 #, fuzzy msgid "A sentinel value signifying a missing default or default_factory." msgstr "表示缺少 default 或 default_factory 的標記值。" -#: ../../library/dataclasses.rst:490 +#: ../../library/dataclasses.rst:492 #, fuzzy msgid "" "A sentinel value used as a type annotation. Any fields after a pseudo-field " @@ -934,14 +940,14 @@ msgstr "" "類欄位的名稱。按照慣例,名稱 ``_`` 用於 :const:`!KW_ONLY` 欄位。僅關鍵字欄位" "表示 :meth:`~object.__init__` 參數,在實例化類時必須將其指定為關鍵字。" -#: ../../library/dataclasses.rst:499 +#: ../../library/dataclasses.rst:501 #, fuzzy msgid "" "In this example, the fields ``y`` and ``z`` will be marked as keyword-only " "fields::" msgstr "在此示例中,欄位 ``y`` 和 ``z`` 將被標記為僅關鍵字欄位: ::" -#: ../../library/dataclasses.rst:501 +#: ../../library/dataclasses.rst:503 msgid "" "@dataclass\n" "class Point:\n" @@ -953,14 +959,14 @@ msgid "" "p = Point(0, y=1.5, z=2.0)" msgstr "" -#: ../../library/dataclasses.rst:510 +#: ../../library/dataclasses.rst:512 #, fuzzy msgid "" "In a single dataclass, it is an error to specify more than one field whose " "type is :const:`!KW_ONLY`." msgstr "在單個資料類別中,指定多個型別為 :const:`!KW_ONLY` 的欄位是錯誤的。" -#: ../../library/dataclasses.rst:517 +#: ../../library/dataclasses.rst:519 #, fuzzy msgid "" "Raised when an implicitly defined :meth:`~object.__setattr__` or :meth:" @@ -970,12 +976,12 @@ msgstr "" "當在使用 frozen=True 定義的資料類別上呼叫隱式定義的 :meth:`__setattr__` 或 :" "meth:`__delattr__` 時引發。它是 :exc:`AttributeError` 的子類別。" -#: ../../library/dataclasses.rst:524 +#: ../../library/dataclasses.rst:526 #, fuzzy msgid "Post-init processing" msgstr "初始化後處理" -#: ../../library/dataclasses.rst:528 +#: ../../library/dataclasses.rst:530 #, fuzzy msgid "" "When defined on the class, it will be called by the generated :meth:`~object." @@ -991,14 +997,14 @@ msgstr "" "按照它們在類中定義的順序傳遞給 :meth:`!__post_init__` 。如果沒有生成 :meth:`!" "__init__` 方法,那麼 :meth:`!__post_init__` 將不會被自動呼叫。" -#: ../../library/dataclasses.rst:535 +#: ../../library/dataclasses.rst:537 #, fuzzy msgid "" "Among other uses, this allows for initializing field values that depend on " "one or more other fields. For example::" msgstr "在其他用途中,這允許初始化依賴於一個或多個其他欄位的欄位值。例如: ::" -#: ../../library/dataclasses.rst:538 +#: ../../library/dataclasses.rst:540 msgid "" "@dataclass\n" "class C:\n" @@ -1010,7 +1016,7 @@ msgid "" " self.c = self.a + self.b" msgstr "" -#: ../../library/dataclasses.rst:547 +#: ../../library/dataclasses.rst:549 #, fuzzy msgid "" "The :meth:`~object.__init__` method generated by :func:`@dataclass " @@ -1022,12 +1028,12 @@ msgstr "" "類別 :meth:`!__init__` 方法。如果基底類別有一個必須呼叫的 :meth:`!__init__` " "方法,通常在 :meth:`__post_init__` 方法中呼叫此方法: ::" -#: ../../library/dataclasses.rst:552 +#: ../../library/dataclasses.rst:554 msgid "" "class Rectangle:\n" " def __init__(self, height, width):\n" -" self.height = height\n" -" self.width = width\n" +" self.height = height\n" +" self.width = width\n" "\n" "@dataclass\n" "class Square(Rectangle):\n" @@ -1037,7 +1043,7 @@ msgid "" " super().__init__(self.side, self.side)" msgstr "" -#: ../../library/dataclasses.rst:564 +#: ../../library/dataclasses.rst:566 #, fuzzy msgid "" "Note, however, that in general the dataclass-generated :meth:`!__init__` " @@ -1047,7 +1053,7 @@ msgstr "" "但是請注意,通常不需要呼叫資料類別生成的 :meth:`!__init__` 方法,因為派生資料" "類別將負責初始化作為資料類別本身的任何基底類別的所有欄位。" -#: ../../library/dataclasses.rst:568 +#: ../../library/dataclasses.rst:570 #, fuzzy msgid "" "See the section below on init-only variables for ways to pass parameters to :" @@ -1057,11 +1063,11 @@ msgstr "" "請參閱下面有關僅初始化變數的部分,了解將參數傳遞給 :meth:`!__post_init__` 的" "方法。另請參閱有關 :func:`replace` 如何處理 ``init=False`` 欄位的警告。" -#: ../../library/dataclasses.rst:575 +#: ../../library/dataclasses.rst:577 msgid "Class variables" msgstr "類別變數" -#: ../../library/dataclasses.rst:577 +#: ../../library/dataclasses.rst:579 #, fuzzy msgid "" "One of the few places where :func:`@dataclass ` actually inspects " @@ -1078,12 +1084,12 @@ msgstr "" "外,並被資料類別機制忽略。模組級 :func:`fields` 函式不會回傳此類別 " "``ClassVar`` 偽欄位。" -#: ../../library/dataclasses.rst:588 +#: ../../library/dataclasses.rst:590 #, fuzzy msgid "Init-only variables" msgstr "僅初始化變數" -#: ../../library/dataclasses.rst:590 +#: ../../library/dataclasses.rst:592 #, fuzzy msgid "" "Another place where :func:`@dataclass ` inspects a type " @@ -1103,14 +1109,14 @@ msgstr "" "的 :meth:`~object.__init__` 方法,並傳遞給可選的 :meth:`__post_init__` 方法。" "它們不被資料類使用。" -#: ../../library/dataclasses.rst:600 +#: ../../library/dataclasses.rst:602 #, fuzzy msgid "" "For example, suppose a field will be initialized from a database, if a value " "is not provided when creating the class::" msgstr "例如,假設一個欄位將從資料庫中初始化,如果在建立類時沒有提供值: ::" -#: ../../library/dataclasses.rst:603 +#: ../../library/dataclasses.rst:605 msgid "" "@dataclass\n" "class C:\n" @@ -1125,7 +1131,7 @@ msgid "" "c = C(10, database=my_database)" msgstr "" -#: ../../library/dataclasses.rst:615 +#: ../../library/dataclasses.rst:617 #, fuzzy msgid "" "In this case, :func:`fields` will return :class:`Field` objects for :attr:`!" @@ -1134,11 +1140,11 @@ msgstr "" "在這種情況下,:func:`fields` 將為 :attr:`!i` 和 :attr:`!j` 回傳 :class:" "`Field` 物件,但不會為 :attr:`!database` 回傳。" -#: ../../library/dataclasses.rst:621 +#: ../../library/dataclasses.rst:623 msgid "Frozen instances" msgstr "凍結實例" -#: ../../library/dataclasses.rst:623 +#: ../../library/dataclasses.rst:625 #, fuzzy msgid "" "It is not possible to create truly immutable Python objects. However, by " @@ -1152,7 +1158,7 @@ msgstr "" "別將向類新增 :meth:`~object.__setattr__` 和 :meth:`~object.__delattr__` 方" "法。這些方法在呼叫時會引發 :exc:`FrozenInstanceError`。" -#: ../../library/dataclasses.rst:629 +#: ../../library/dataclasses.rst:631 #, fuzzy msgid "" "There is a tiny performance penalty when using ``frozen=True``: :meth:" @@ -1162,11 +1168,11 @@ msgstr "" "使用 ``frozen=True`` 時有一個微小的性能損失::meth:`~object.__init__` 不能使" "用簡單賦值來初始化欄位,必須使用 :meth:`!object.__setattr__`。" -#: ../../library/dataclasses.rst:638 +#: ../../library/dataclasses.rst:640 msgid "Inheritance" msgstr "繼承" -#: ../../library/dataclasses.rst:640 +#: ../../library/dataclasses.rst:642 #, fuzzy msgid "" "When the dataclass is being created by the :func:`@dataclass ` " @@ -1180,11 +1186,11 @@ msgid "" msgstr "" "當 :func:`@dataclass ` 裝飾器建立資料類別時,它會以反向 MRO(即" "從 :class:`object` 開始)查看該類的所有基底類別,並且對於它找到的每個資料類" -"別,將該基底類別中的欄位新增到欄位的有序映射中。新增所有基底類別欄位後,它會" -"將自己的欄位新增到有序映射中。所有生成的方法都將使用這種組合的、計算的有序欄" -"位映射。因為欄位是按插入順序排列的,所以派生類會覆蓋基底類別。一個例子: ::" +"別,將該基底類別中的欄位新增到欄位的有序對映中。新增所有基底類別欄位後,它會" +"將自己的欄位新增到有序對映中。所有生成的方法都將使用這種組合的、計算的有序欄" +"位對映。因為欄位是按插入順序排列的,所以派生類會覆蓋基底類別。一個例子: ::" -#: ../../library/dataclasses.rst:650 +#: ../../library/dataclasses.rst:652 msgid "" "@dataclass\n" "class Base:\n" @@ -1197,7 +1203,7 @@ msgid "" " x: int = 15" msgstr "" -#: ../../library/dataclasses.rst:660 +#: ../../library/dataclasses.rst:662 #, fuzzy msgid "" "The final list of fields is, in order, :attr:`!x`, :attr:`!y`, :attr:`!z`. " @@ -1207,23 +1213,23 @@ msgstr "" "最終的欄位列表按順序為 :attr:`!x`、:attr:`!y`、:attr:`!z`。:attr:`!x` 的最終" "型別是 :class:`int`,如類別 :class:`!C` 中指定的那樣。" -#: ../../library/dataclasses.rst:663 +#: ../../library/dataclasses.rst:665 #, fuzzy msgid "" "The generated :meth:`~object.__init__` method for :class:`!C` will look " "like::" msgstr "為 :class:`!C` 生成的 :meth:`~object.__init__` 方法將如下所示: ::" -#: ../../library/dataclasses.rst:665 +#: ../../library/dataclasses.rst:667 msgid "def __init__(self, x: int = 15, y: int = 0, z: int = 10):" msgstr "" -#: ../../library/dataclasses.rst:668 +#: ../../library/dataclasses.rst:670 #, fuzzy msgid "Re-ordering of keyword-only parameters in :meth:`!__init__`" msgstr ":meth:`!__init__` 中僅關鍵字參數的重新排序" -#: ../../library/dataclasses.rst:670 +#: ../../library/dataclasses.rst:672 #, fuzzy msgid "" "After the parameters needed for :meth:`~object.__init__` are computed, any " @@ -1235,7 +1241,7 @@ msgstr "" "僅關鍵字)參數之後。這是如何在 Python 中實作僅關鍵字參數的要求:它們必須位於" "非僅關鍵字參數之後。" -#: ../../library/dataclasses.rst:676 +#: ../../library/dataclasses.rst:678 #, fuzzy msgid "" "In this example, :attr:`!Base.y`, :attr:`!Base.w`, and :attr:`!D.t` are " @@ -1245,7 +1251,7 @@ msgstr "" "在此示例中,:attr:`!Base.y`、:attr:`!Base.w` 和 :attr:`!D.t` 是僅限關鍵字的欄" "位,:attr:`!Base.x` 和 :attr:`!D.z` 是常規欄位: ::" -#: ../../library/dataclasses.rst:679 +#: ../../library/dataclasses.rst:681 msgid "" "@dataclass\n" "class Base:\n" @@ -1260,18 +1266,18 @@ msgid "" " t: int = field(kw_only=True, default=0)" msgstr "" -#: ../../library/dataclasses.rst:691 +#: ../../library/dataclasses.rst:693 #, fuzzy msgid "The generated :meth:`!__init__` method for :class:`!D` will look like::" msgstr "為 :class:`!D` 生成的 :meth:`!__init__` 方法將如下所示: ::" -#: ../../library/dataclasses.rst:693 +#: ../../library/dataclasses.rst:695 msgid "" "def __init__(self, x: Any = 15.0, z: int = 10, *, y: int = 0, w: int = 1, t: " "int = 0):" msgstr "" -#: ../../library/dataclasses.rst:695 +#: ../../library/dataclasses.rst:697 #, fuzzy msgid "" "Note that the parameters have been re-ordered from how they appear in the " @@ -1281,18 +1287,18 @@ msgstr "" "請注意,參數已根據它們在欄位列表中的顯示方式重新排序:從常規欄位派生的參數後" "跟從僅關鍵字欄位派生的參數。" -#: ../../library/dataclasses.rst:699 +#: ../../library/dataclasses.rst:701 #, fuzzy msgid "" "The relative ordering of keyword-only parameters is maintained in the re-" "ordered :meth:`!__init__` parameter list." msgstr "僅關鍵字參數的相對順序在重新排序的 :meth:`!__init__` 參數列表中維護。" -#: ../../library/dataclasses.rst:704 +#: ../../library/dataclasses.rst:706 msgid "Default factory functions" msgstr "預設工廠函式" -#: ../../library/dataclasses.rst:706 +#: ../../library/dataclasses.rst:708 #, fuzzy msgid "" "If a :func:`field` specifies a *default_factory*, it is called with zero " @@ -1302,11 +1308,11 @@ msgstr "" "如果 :func:`field` 指定了 *default_factory*,當需要該欄位的預設值時,它會以零" "引數呼叫。例如,要建立列表的新實例,請使用: ::" -#: ../../library/dataclasses.rst:710 +#: ../../library/dataclasses.rst:712 msgid "mylist: list = field(default_factory=list)" msgstr "" -#: ../../library/dataclasses.rst:712 +#: ../../library/dataclasses.rst:714 #, fuzzy msgid "" "If a field is excluded from :meth:`~object.__init__` (using ``init=False``) " @@ -1319,11 +1325,11 @@ msgstr "" "位還指定了 ``default_factory``,那麼預設工廠函式將始終從生成的 :meth:" "`__init__ 中呼叫`功能。發生這種情況是因為沒有其他方法可以為該欄位賦予初始值。" -#: ../../library/dataclasses.rst:719 +#: ../../library/dataclasses.rst:721 msgid "Mutable default values" msgstr "可變預設值" -#: ../../library/dataclasses.rst:721 +#: ../../library/dataclasses.rst:723 #, fuzzy msgid "" "Python stores default member variable values in class attributes. Consider " @@ -1331,7 +1337,7 @@ msgid "" msgstr "" "Python 將預設成員變數值存儲在類別屬性中。考慮這個例子,不使用資料類別: ::" -#: ../../library/dataclasses.rst:724 +#: ../../library/dataclasses.rst:726 msgid "" "class C:\n" " x = []\n" @@ -1346,7 +1352,7 @@ msgid "" "assert o1.x is o2.x" msgstr "" -#: ../../library/dataclasses.rst:736 +#: ../../library/dataclasses.rst:738 #, fuzzy msgid "" "Note that the two instances of class :class:`!C` share the same class " @@ -1355,12 +1361,12 @@ msgstr "" "請注意,類別 :class:`!C` 的兩個實例共享同一個類別變數 :attr:`!x`,正如預期的" "那樣。" -#: ../../library/dataclasses.rst:739 +#: ../../library/dataclasses.rst:741 #, fuzzy msgid "Using dataclasses, *if* this code was valid::" msgstr "使用資料類別,*如果*此程式碼有效: ::" -#: ../../library/dataclasses.rst:741 +#: ../../library/dataclasses.rst:743 msgid "" "@dataclass\n" "class D:\n" @@ -1369,11 +1375,11 @@ msgid "" " self.x.append(element)" msgstr "" -#: ../../library/dataclasses.rst:747 +#: ../../library/dataclasses.rst:749 msgid "it would generate code similar to::" msgstr "它會生成類似的程式碼: ::" -#: ../../library/dataclasses.rst:749 +#: ../../library/dataclasses.rst:751 msgid "" "class D:\n" " x = []\n" @@ -1385,7 +1391,7 @@ msgid "" "assert D().x is D().x" msgstr "" -#: ../../library/dataclasses.rst:758 +#: ../../library/dataclasses.rst:760 #, fuzzy msgid "" "This has the same issue as the original example using class :class:`!C`. " @@ -1405,14 +1411,14 @@ msgstr "" "到不可散列的預設參數,它將引發 :exc:`TypeError`。假設是如果一個值是不可散列" "的,那麼它就是可變的。這是一個部分解決方案,但它確實可以防止許多常見錯誤。" -#: ../../library/dataclasses.rst:769 +#: ../../library/dataclasses.rst:771 #, fuzzy msgid "" "Using default factory functions is a way to create new instances of mutable " "types as default values for fields::" msgstr "使用預設工廠函式是一種建立可變型別的新實例作為欄位預設值的方法: ::" -#: ../../library/dataclasses.rst:772 +#: ../../library/dataclasses.rst:774 msgid "" "@dataclass\n" "class D:\n" @@ -1421,7 +1427,7 @@ msgid "" "assert D().x is not D().x" msgstr "" -#: ../../library/dataclasses.rst:778 +#: ../../library/dataclasses.rst:780 #, fuzzy msgid "" "Instead of looking for and disallowing objects of type :class:`list`, :class:" @@ -1431,12 +1437,12 @@ msgstr "" "不再查找和禁止型別為 :class:`list`、:class:`dict` 或 :class:`set` 的物件,現" "在不允許使用不可散列的對像作為預設值。不可散列性用於近似可變性。" -#: ../../library/dataclasses.rst:785 +#: ../../library/dataclasses.rst:787 #, fuzzy msgid "Descriptor-typed fields" msgstr "描述器型別的欄位" -#: ../../library/dataclasses.rst:787 +#: ../../library/dataclasses.rst:789 #, fuzzy msgid "" "Fields that are assigned :ref:`descriptor objects ` as their " @@ -1444,7 +1450,7 @@ msgid "" msgstr "" "指定為\\ :ref:`描述器物件 `\\ 作為預設值的欄位具有以下特殊行為:" -#: ../../library/dataclasses.rst:790 +#: ../../library/dataclasses.rst:792 #, fuzzy msgid "" "The value for the field passed to the dataclass's :meth:`~object.__init__` " @@ -1454,7 +1460,7 @@ msgstr "" "傳遞給資料類別的 :meth:`~object.__init__` 方法的欄位值被傳遞給描述器的 :meth:" "`~object.__set__` 方法,而不是覆蓋描述器物件。" -#: ../../library/dataclasses.rst:794 +#: ../../library/dataclasses.rst:796 #, fuzzy msgid "" "Similarly, when getting or setting the field, the descriptor's :meth:" @@ -1464,7 +1470,7 @@ msgstr "" "同樣,在獲取或設定欄位時,將呼叫描述器的 :meth:`~object.__get__` 或 :meth:`!" "__set__` 方法,而不是回傳或覆蓋描述器物件。" -#: ../../library/dataclasses.rst:798 +#: ../../library/dataclasses.rst:800 #, fuzzy msgid "" "To determine whether a field contains a default value, :func:`@dataclass " @@ -1480,7 +1486,7 @@ msgstr "" "面,如果描述器在這種情況下引發 :exc:`AttributeError`,則不會為該欄位提供預設" "值。" -#: ../../library/dataclasses.rst:808 +#: ../../library/dataclasses.rst:810 msgid "" "class IntConversionDescriptor:\n" " def __init__(self, *, default):\n" @@ -1509,7 +1515,7 @@ msgid "" "print(i.quantity_on_hand) # 2" msgstr "" -#: ../../library/dataclasses.rst:833 +#: ../../library/dataclasses.rst:835 #, fuzzy msgid "" "Note that if a field is annotated with a descriptor type, but is not " diff --git a/library/datatypes.po b/library/datatypes.po index 03aca0edd2..82edc28c58 100644 --- a/library/datatypes.po +++ b/library/datatypes.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-20 18:08+0800\n" "PO-Revision-Date: 2022-02-11 12:12+0800\n" diff --git a/library/datetime.po b/library/datetime.po index cb850b9d8b..21b3d8a2d7 100644 --- a/library/datetime.po +++ b/library/datetime.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" "PO-Revision-Date: 2023-08-07 10:20+0800\n" "Last-Translator: Griiid \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -422,9 +422,9 @@ msgstr "" ">>> (d.days, d.seconds, d.microseconds)\n" "(-1, 86399, 999999)" -#: ../../library/datetime.rst:265 ../../library/datetime.rst:552 -#: ../../library/datetime.rst:1071 ../../library/datetime.rst:1702 -#: ../../library/datetime.rst:2304 +#: ../../library/datetime.rst:265 ../../library/datetime.rst:566 +#: ../../library/datetime.rst:1122 ../../library/datetime.rst:1760 +#: ../../library/datetime.rst:2365 msgid "Class attributes:" msgstr "類別屬性:" @@ -451,8 +451,8 @@ msgid "" "`timedelta` object." msgstr "" -#: ../../library/datetime.rst:287 ../../library/datetime.rst:570 -#: ../../library/datetime.rst:1091 ../../library/datetime.rst:1722 +#: ../../library/datetime.rst:287 ../../library/datetime.rst:584 +#: ../../library/datetime.rst:1142 ../../library/datetime.rst:1780 msgid "Instance attributes (read-only):" msgstr "" @@ -464,194 +464,217 @@ msgstr "在 -999,999,999 到 999,999,999 (含)之間" msgid "Between 0 and 86,399 inclusive." msgstr "在 0 到 86,399 (含)之間" -#: ../../library/datetime.rst:301 +#: ../../library/datetime.rst:300 +msgid "" +"It is a somewhat common bug for code to unintentionally use this attribute " +"when it is actually intended to get a :meth:`~timedelta.total_seconds` value " +"instead:" +msgstr "" + +#: ../../library/datetime.rst:304 +msgid "" +">>> from datetime import timedelta\n" +">>> duration = timedelta(seconds=11235813)\n" +">>> duration.days, duration.seconds\n" +"(130, 3813)\n" +">>> duration.total_seconds()\n" +"11235813.0" +msgstr "" +">>> from datetime import timedelta\n" +">>> duration = timedelta(seconds=11235813)\n" +">>> duration.days, duration.seconds\n" +"(130, 3813)\n" +">>> duration.total_seconds()\n" +"11235813.0" + +#: ../../library/datetime.rst:315 msgid "Between 0 and 999,999 inclusive." msgstr "在 0 到 999,999 (含)之間" -#: ../../library/datetime.rst:304 ../../library/datetime.rst:587 -#: ../../library/datetime.rst:1144 +#: ../../library/datetime.rst:318 ../../library/datetime.rst:601 +#: ../../library/datetime.rst:1195 msgid "Supported operations:" msgstr "" -#: ../../library/datetime.rst:309 ../../library/datetime.rst:590 -#: ../../library/datetime.rst:1147 +#: ../../library/datetime.rst:323 ../../library/datetime.rst:604 +#: ../../library/datetime.rst:1198 msgid "Operation" msgstr "" -#: ../../library/datetime.rst:309 ../../library/datetime.rst:590 -#: ../../library/datetime.rst:1147 +#: ../../library/datetime.rst:323 ../../library/datetime.rst:604 +#: ../../library/datetime.rst:1198 msgid "Result" msgstr "" -#: ../../library/datetime.rst:311 +#: ../../library/datetime.rst:325 msgid "``t1 = t2 + t3``" msgstr "``t1 = t2 + t3``" -#: ../../library/datetime.rst:311 +#: ../../library/datetime.rst:325 msgid "" "Sum of ``t2`` and ``t3``. Afterwards ``t1 - t2 == t3`` and ``t1 - t3 == t2`` " "are true. (1)" msgstr "" -#: ../../library/datetime.rst:315 +#: ../../library/datetime.rst:329 msgid "``t1 = t2 - t3``" msgstr "``t1 = t2 - t3``" -#: ../../library/datetime.rst:315 +#: ../../library/datetime.rst:329 msgid "" "Difference of ``t2`` and ``t3``. Afterwards ``t1 == t2 - t3`` and ``t2 == " "t1 + t3`` are true. (1)(6)" msgstr "" -#: ../../library/datetime.rst:319 +#: ../../library/datetime.rst:333 msgid "``t1 = t2 * i or t1 = i * t2``" msgstr "``t1 = t2 * i or t1 = i * t2``" -#: ../../library/datetime.rst:319 +#: ../../library/datetime.rst:333 msgid "" "Delta multiplied by an integer. Afterwards ``t1 // i == t2`` is true, " "provided ``i != 0``." msgstr "" -#: ../../library/datetime.rst:323 +#: ../../library/datetime.rst:337 msgid "In general, ``t1 * i == t1 * (i-1) + t1`` is true. (1)" msgstr "" -#: ../../library/datetime.rst:326 +#: ../../library/datetime.rst:340 msgid "``t1 = t2 * f or t1 = f * t2``" msgstr "``t1 = t2 * f or t1 = f * t2``" -#: ../../library/datetime.rst:326 +#: ../../library/datetime.rst:340 msgid "" "Delta multiplied by a float. The result is rounded to the nearest multiple " "of timedelta.resolution using round-half-to-even." msgstr "" -#: ../../library/datetime.rst:330 +#: ../../library/datetime.rst:344 msgid "``f = t2 / t3``" msgstr "``f = t2 / t3``" -#: ../../library/datetime.rst:330 +#: ../../library/datetime.rst:344 msgid "" "Division (3) of overall duration ``t2`` by interval unit ``t3``. Returns a :" "class:`float` object." msgstr "" -#: ../../library/datetime.rst:334 +#: ../../library/datetime.rst:348 msgid "``t1 = t2 / f or t1 = t2 / i``" msgstr "``t1 = t2 / f or t1 = t2 / i``" -#: ../../library/datetime.rst:334 +#: ../../library/datetime.rst:348 msgid "" "Delta divided by a float or an int. The result is rounded to the nearest " "multiple of timedelta.resolution using round-half-to-even." msgstr "" -#: ../../library/datetime.rst:338 +#: ../../library/datetime.rst:352 msgid "``t1 = t2 // i`` or ``t1 = t2 // t3``" msgstr "``t1 = t2 // i`` or ``t1 = t2 // t3``" -#: ../../library/datetime.rst:338 +#: ../../library/datetime.rst:352 msgid "" "The floor is computed and the remainder (if any) is thrown away. In the " "second case, an integer is returned. (3)" msgstr "" -#: ../../library/datetime.rst:342 +#: ../../library/datetime.rst:356 msgid "``t1 = t2 % t3``" msgstr "``t1 = t2 % t3``" -#: ../../library/datetime.rst:342 +#: ../../library/datetime.rst:356 msgid "The remainder is computed as a :class:`timedelta` object. (3)" msgstr "" -#: ../../library/datetime.rst:345 +#: ../../library/datetime.rst:359 msgid "``q, r = divmod(t1, t2)``" msgstr "``q, r = divmod(t1, t2)``" -#: ../../library/datetime.rst:345 +#: ../../library/datetime.rst:359 msgid "" "Computes the quotient and the remainder: ``q = t1 // t2`` (3) and ``r = t1 % " "t2``. q is an integer and r is a :class:`timedelta` object." msgstr "" -#: ../../library/datetime.rst:350 +#: ../../library/datetime.rst:364 msgid "``+t1``" msgstr "``+t1``" -#: ../../library/datetime.rst:350 +#: ../../library/datetime.rst:364 msgid "Returns a :class:`timedelta` object with the same value. (2)" msgstr "" -#: ../../library/datetime.rst:353 +#: ../../library/datetime.rst:367 msgid "``-t1``" msgstr "``-t1``" -#: ../../library/datetime.rst:353 +#: ../../library/datetime.rst:367 msgid "" -"Equivalent to ``timedelta(-t1.days, -t1.seconds*, -t1.microseconds)``, and " -"to ``t1 * -1``. (1)(4)" +"Equivalent to ``timedelta(-t1.days, -t1.seconds, -t1.microseconds)``, and to " +"``t1 * -1``. (1)(4)" msgstr "" -#: ../../library/datetime.rst:357 +#: ../../library/datetime.rst:371 msgid "``abs(t)``" msgstr "``abs(t)``" -#: ../../library/datetime.rst:357 +#: ../../library/datetime.rst:371 msgid "" "Equivalent to ``+t`` when ``t.days >= 0``, and to ``-t`` when ``t.days < " "0``. (2)" msgstr "" -#: ../../library/datetime.rst:360 +#: ../../library/datetime.rst:374 msgid "``str(t)``" msgstr "``str(t)``" -#: ../../library/datetime.rst:360 +#: ../../library/datetime.rst:374 msgid "" "Returns a string in the form ``[D day[s], ][H]H:MM:SS[.UUUUUU]``, where D is " "negative for negative ``t``. (5)" msgstr "" -#: ../../library/datetime.rst:364 +#: ../../library/datetime.rst:378 msgid "``repr(t)``" msgstr "``repr(t)``" -#: ../../library/datetime.rst:364 +#: ../../library/datetime.rst:378 msgid "" "Returns a string representation of the :class:`timedelta` object as a " "constructor call with canonical attribute values." msgstr "" -#: ../../library/datetime.rst:370 ../../library/datetime.rst:609 -#: ../../library/datetime.rst:2535 +#: ../../library/datetime.rst:384 ../../library/datetime.rst:623 +#: ../../library/datetime.rst:2596 msgid "Notes:" msgstr "註解:" -#: ../../library/datetime.rst:373 +#: ../../library/datetime.rst:387 msgid "This is exact but may overflow." msgstr "這是精確的,但可能會溢位。" -#: ../../library/datetime.rst:376 +#: ../../library/datetime.rst:390 msgid "This is exact and cannot overflow." msgstr "這是精確的,且不會溢位。" -#: ../../library/datetime.rst:379 +#: ../../library/datetime.rst:393 msgid "Division by zero raises :exc:`ZeroDivisionError`." msgstr "" -#: ../../library/datetime.rst:382 +#: ../../library/datetime.rst:396 msgid "``-timedelta.max`` is not representable as a :class:`timedelta` object." msgstr "" -#: ../../library/datetime.rst:385 +#: ../../library/datetime.rst:399 msgid "" "String representations of :class:`timedelta` objects are normalized " "similarly to their internal representation. This leads to somewhat unusual " "results for negative timedeltas. For example::" msgstr "" -#: ../../library/datetime.rst:389 +#: ../../library/datetime.rst:403 msgid "" ">>> timedelta(hours=-5)\n" "datetime.timedelta(days=-1, seconds=68400)\n" @@ -663,21 +686,21 @@ msgstr "" ">>> print(_)\n" "-1 day, 19:00:00" -#: ../../library/datetime.rst:395 +#: ../../library/datetime.rst:409 msgid "" "The expression ``t2 - t3`` will always be equal to the expression ``t2 + (-" "t3)`` except when t3 is equal to ``timedelta.max``; in that case the former " "will produce a result while the latter will overflow." msgstr "" -#: ../../library/datetime.rst:399 +#: ../../library/datetime.rst:413 msgid "" "In addition to the operations listed above, :class:`timedelta` objects " "support certain additions and subtractions with :class:`date` and :class:`." "datetime` objects (see below)." msgstr "" -#: ../../library/datetime.rst:403 +#: ../../library/datetime.rst:417 msgid "" "Floor division and true division of a :class:`timedelta` object by another :" "class:`timedelta` object are now supported, as are remainder operations and " @@ -685,43 +708,43 @@ msgid "" "`timedelta` object by a :class:`float` object are now supported." msgstr "" -#: ../../library/datetime.rst:409 +#: ../../library/datetime.rst:423 msgid ":class:`timedelta` objects support equality and order comparisons." msgstr "" -#: ../../library/datetime.rst:411 +#: ../../library/datetime.rst:425 msgid "" "In Boolean contexts, a :class:`timedelta` object is considered to be true if " "and only if it isn't equal to ``timedelta(0)``." msgstr "" -#: ../../library/datetime.rst:414 ../../library/datetime.rst:635 -#: ../../library/datetime.rst:1230 ../../library/datetime.rst:1829 +#: ../../library/datetime.rst:428 ../../library/datetime.rst:665 +#: ../../library/datetime.rst:1285 ../../library/datetime.rst:1887 msgid "Instance methods:" msgstr "實例方法:" -#: ../../library/datetime.rst:418 +#: ../../library/datetime.rst:432 msgid "" "Return the total number of seconds contained in the duration. Equivalent to " "``td / timedelta(seconds=1)``. For interval units other than seconds, use " "the division form directly (e.g. ``td / timedelta(microseconds=1)``)." msgstr "" -#: ../../library/datetime.rst:422 +#: ../../library/datetime.rst:436 msgid "" "Note that for very large time intervals (greater than 270 years on most " "platforms) this method will lose microsecond accuracy." msgstr "" -#: ../../library/datetime.rst:428 +#: ../../library/datetime.rst:442 msgid "Examples of usage: :class:`timedelta`" msgstr "用法範例::class:`timedelta`" -#: ../../library/datetime.rst:430 +#: ../../library/datetime.rst:444 msgid "An additional example of normalization::" msgstr "" -#: ../../library/datetime.rst:432 +#: ../../library/datetime.rst:446 msgid "" ">>> # Components of another_year add up to exactly 365 days\n" ">>> from datetime import timedelta\n" @@ -734,11 +757,11 @@ msgid "" "31536000.0" msgstr "" -#: ../../library/datetime.rst:442 +#: ../../library/datetime.rst:456 msgid "Examples of :class:`timedelta` arithmetic::" msgstr "" -#: ../../library/datetime.rst:444 +#: ../../library/datetime.rst:458 msgid "" ">>> from datetime import timedelta\n" ">>> year = timedelta(days=365)\n" @@ -768,65 +791,65 @@ msgstr "" ">>> three_years, three_years.days // 365\n" "(datetime.timedelta(days=1095), 3)" -#: ../../library/datetime.rst:461 +#: ../../library/datetime.rst:475 msgid ":class:`date` Objects" msgstr ":class:`date` 物件" -#: ../../library/datetime.rst:463 +#: ../../library/datetime.rst:477 msgid "" "A :class:`date` object represents a date (year, month and day) in an " "idealized calendar, the current Gregorian calendar indefinitely extended in " "both directions." msgstr "" -#: ../../library/datetime.rst:467 +#: ../../library/datetime.rst:481 msgid "" "January 1 of year 1 is called day number 1, January 2 of year 1 is called " "day number 2, and so on. [#]_" msgstr "" -#: ../../library/datetime.rst:472 +#: ../../library/datetime.rst:486 msgid "" "All arguments are required. Arguments must be integers, in the following " "ranges:" msgstr "" -#: ../../library/datetime.rst:475 +#: ../../library/datetime.rst:489 msgid "``MINYEAR <= year <= MAXYEAR``" msgstr "``MINYEAR <= year <= MAXYEAR``" -#: ../../library/datetime.rst:476 +#: ../../library/datetime.rst:490 msgid "``1 <= month <= 12``" msgstr "``1 <= month <= 12``" -#: ../../library/datetime.rst:477 +#: ../../library/datetime.rst:491 msgid "``1 <= day <= number of days in the given month and year``" msgstr "" -#: ../../library/datetime.rst:479 ../../library/datetime.rst:850 +#: ../../library/datetime.rst:493 ../../library/datetime.rst:883 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised." msgstr "" -#: ../../library/datetime.rst:482 ../../library/datetime.rst:855 +#: ../../library/datetime.rst:496 ../../library/datetime.rst:888 msgid "Other constructors, all class methods:" msgstr "" -#: ../../library/datetime.rst:486 +#: ../../library/datetime.rst:500 msgid "Return the current local date." msgstr "回傳目前的本地日期。" -#: ../../library/datetime.rst:488 +#: ../../library/datetime.rst:502 msgid "This is equivalent to ``date.fromtimestamp(time.time())``." msgstr "這等同於 ``date.fromtimestamp(time.time())``。" -#: ../../library/datetime.rst:492 +#: ../../library/datetime.rst:506 msgid "" "Return the local date corresponding to the POSIX timestamp, such as is " "returned by :func:`time.time`." msgstr "" -#: ../../library/datetime.rst:495 +#: ../../library/datetime.rst:509 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " "values supported by the platform C :c:func:`localtime` function, and :exc:" @@ -836,7 +859,7 @@ msgid "" "ignored by :meth:`fromtimestamp`." msgstr "" -#: ../../library/datetime.rst:502 +#: ../../library/datetime.rst:516 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -844,45 +867,45 @@ msgid "" "`localtime` failure." msgstr "" -#: ../../library/datetime.rst:511 +#: ../../library/datetime.rst:525 msgid "" "Return the date corresponding to the proleptic Gregorian ordinal, where " "January 1 of year 1 has ordinal 1." msgstr "" -#: ../../library/datetime.rst:514 +#: ../../library/datetime.rst:528 msgid "" ":exc:`ValueError` is raised unless ``1 <= ordinal <= date.max.toordinal()``. " "For any date *d*, ``date.fromordinal(d.toordinal()) == d``." msgstr "" -#: ../../library/datetime.rst:521 +#: ../../library/datetime.rst:535 msgid "" "Return a :class:`date` corresponding to a *date_string* given in any valid " "ISO 8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:524 ../../library/datetime.rst:1011 +#: ../../library/datetime.rst:538 ../../library/datetime.rst:1044 msgid "" "Reduced precision dates are not currently supported (``YYYY-MM``, ``YYYY``)." msgstr "" -#: ../../library/datetime.rst:526 ../../library/datetime.rst:1013 +#: ../../library/datetime.rst:540 ../../library/datetime.rst:1046 msgid "" "Extended date representations are not currently supported (``±YYYYYY-MM-" "DD``)." msgstr "" -#: ../../library/datetime.rst:528 ../../library/datetime.rst:1015 +#: ../../library/datetime.rst:542 ../../library/datetime.rst:1048 msgid "Ordinal dates are not currently supported (``YYYY-OOO``)." msgstr "" -#: ../../library/datetime.rst:530 ../../library/datetime.rst:1017 -#: ../../library/datetime.rst:1458 +#: ../../library/datetime.rst:544 ../../library/datetime.rst:1050 +#: ../../library/datetime.rst:1516 msgid "Examples::" msgstr "範例: ::" -#: ../../library/datetime.rst:532 +#: ../../library/datetime.rst:546 msgid "" ">>> from datetime import date\n" ">>> date.fromisoformat('2019-12-04')\n" @@ -900,64 +923,64 @@ msgstr "" ">>> date.fromisoformat('2021-W01-1')\n" "datetime.date(2021, 1, 4)" -#: ../../library/datetime.rst:541 +#: ../../library/datetime.rst:555 msgid "Previously, this method only supported the format ``YYYY-MM-DD``." msgstr "" -#: ../../library/datetime.rst:546 +#: ../../library/datetime.rst:560 msgid "" "Return a :class:`date` corresponding to the ISO calendar date specified by " "year, week and day. This is the inverse of the function :meth:`date." "isocalendar`." msgstr "" -#: ../../library/datetime.rst:556 +#: ../../library/datetime.rst:570 msgid "The earliest representable date, ``date(MINYEAR, 1, 1)``." msgstr "" -#: ../../library/datetime.rst:561 +#: ../../library/datetime.rst:575 msgid "The latest representable date, ``date(MAXYEAR, 12, 31)``." msgstr "" -#: ../../library/datetime.rst:566 +#: ../../library/datetime.rst:580 msgid "" "The smallest possible difference between non-equal date objects, " "``timedelta(days=1)``." msgstr "" -#: ../../library/datetime.rst:574 ../../library/datetime.rst:1095 +#: ../../library/datetime.rst:588 ../../library/datetime.rst:1146 msgid "Between :const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: ../../library/datetime.rst:579 ../../library/datetime.rst:1100 +#: ../../library/datetime.rst:593 ../../library/datetime.rst:1151 msgid "Between 1 and 12 inclusive." msgstr "在 1 到 12 (含)之間。" -#: ../../library/datetime.rst:584 ../../library/datetime.rst:1105 +#: ../../library/datetime.rst:598 ../../library/datetime.rst:1156 msgid "Between 1 and the number of days in the given month of the given year." msgstr "" -#: ../../library/datetime.rst:592 +#: ../../library/datetime.rst:606 msgid "``date2 = date1 + timedelta``" msgstr "``date2 = date1 + timedelta``" -#: ../../library/datetime.rst:592 +#: ../../library/datetime.rst:606 msgid "``date2`` will be ``timedelta.days`` days after ``date1``. (1)" msgstr "" -#: ../../library/datetime.rst:595 +#: ../../library/datetime.rst:609 msgid "``date2 = date1 - timedelta``" msgstr "``date2 = date1 - timedelta``" -#: ../../library/datetime.rst:595 +#: ../../library/datetime.rst:609 msgid "Computes ``date2`` such that ``date2 + timedelta == date1``. (2)" msgstr "" -#: ../../library/datetime.rst:598 +#: ../../library/datetime.rst:612 msgid "``timedelta = date1 - date2``" msgstr "``timedelta = date1 - date2``" -#: ../../library/datetime.rst:598 ../../library/datetime.rst:1153 +#: ../../library/datetime.rst:612 ../../library/datetime.rst:1204 msgid "\\(3)" msgstr "\\(3)" @@ -969,7 +992,7 @@ msgstr "``date1 == date2``" msgid "``date1 != date2``" msgstr "``date1 != date2``" -#: ../../library/datetime.rst:600 ../../library/datetime.rst:1155 +#: ../../library/datetime.rst:614 ../../library/datetime.rst:1206 msgid "Equality comparison. (4)" msgstr "" @@ -989,11 +1012,11 @@ msgstr "``date1 <= date2``" msgid "``date1 >= date2``" msgstr "``date1 >= date2``" -#: ../../library/datetime.rst:603 ../../library/datetime.rst:1158 +#: ../../library/datetime.rst:617 ../../library/datetime.rst:1209 msgid "Order comparison. (5)" msgstr "" -#: ../../library/datetime.rst:612 +#: ../../library/datetime.rst:626 msgid "" "*date2* is moved forward in time if ``timedelta.days > 0``, or backward if " "``timedelta.days < 0``. Afterward ``date2 - date1 == timedelta.days``. " @@ -1002,43 +1025,65 @@ msgid "" "`MINYEAR` or larger than :const:`MAXYEAR`." msgstr "" -#: ../../library/datetime.rst:619 +#: ../../library/datetime.rst:633 msgid "``timedelta.seconds`` and ``timedelta.microseconds`` are ignored." msgstr "``timedelta.seconds`` 和 ``timedelta.microseconds`` 被忽略。" -#: ../../library/datetime.rst:622 +#: ../../library/datetime.rst:636 msgid "" "This is exact, and cannot overflow. ``timedelta.seconds`` and ``timedelta." "microseconds`` are 0, and ``date2 + timedelta == date1`` after." msgstr "" -#: ../../library/datetime.rst:626 +#: ../../library/datetime.rst:640 msgid ":class:`date` objects are equal if they represent the same date." msgstr "" -#: ../../library/datetime.rst:629 +#: ../../library/datetime.rst:642 +msgid "" +":class:`!date` objects that are not also :class:`.datetime` instances are " +"never equal to :class:`!datetime` objects, even if they represent the same " +"date." +msgstr "" + +#: ../../library/datetime.rst:647 msgid "" "*date1* is considered less than *date2* when *date1* precedes *date2* in " "time. In other words, ``date1 < date2`` if and only if ``date1.toordinal() < " "date2.toordinal()``." msgstr "" -#: ../../library/datetime.rst:633 +#: ../../library/datetime.rst:651 +msgid "" +"Order comparison between a :class:`!date` object that is not also a :class:`." +"datetime` instance and a :class:`!datetime` object raises :exc:`TypeError`." +msgstr "" + +#: ../../library/datetime.rst:655 ../../library/datetime.rst:1277 +msgid "" +"Comparison between :class:`.datetime` object and an instance of the :class:" +"`date` subclass that is not a :class:`!datetime` subclass no longer converts " +"the latter to :class:`!date`, ignoring the time part and the time zone. The " +"default behavior can be changed by overriding the special comparison methods " +"in subclasses." +msgstr "" + +#: ../../library/datetime.rst:663 msgid "" "In Boolean contexts, all :class:`date` objects are considered to be true." msgstr "" -#: ../../library/datetime.rst:639 +#: ../../library/datetime.rst:669 msgid "" "Return a date with the same value, except for those parameters given new " "values by whichever keyword arguments are specified." msgstr "" -#: ../../library/datetime.rst:642 ../../library/datetime.rst:1872 +#: ../../library/datetime.rst:672 ../../library/datetime.rst:1933 msgid "Example::" msgstr "範例: ::" -#: ../../library/datetime.rst:644 +#: ../../library/datetime.rst:674 msgid "" ">>> from datetime import date\n" ">>> d = date(2002, 12, 31)\n" @@ -1050,41 +1095,47 @@ msgstr "" ">>> d.replace(day=26)\n" "datetime.date(2002, 12, 26)" -#: ../../library/datetime.rst:652 ../../library/datetime.rst:1343 +#: ../../library/datetime.rst:679 +msgid "" +":class:`date` objects are also supported by generic function :func:`copy." +"replace`." +msgstr "" + +#: ../../library/datetime.rst:685 ../../library/datetime.rst:1401 msgid "" "Return a :class:`time.struct_time` such as returned by :func:`time." "localtime`." msgstr "" "回傳一個 :class:`time.struct_time`,如同 :func:`time.localtime` 所回傳。" -#: ../../library/datetime.rst:654 +#: ../../library/datetime.rst:687 msgid "The hours, minutes and seconds are 0, and the DST flag is -1." msgstr "" -#: ../../library/datetime.rst:656 ../../library/datetime.rst:1345 +#: ../../library/datetime.rst:689 ../../library/datetime.rst:1403 msgid "``d.timetuple()`` is equivalent to::" msgstr "``d.timetuple()`` 等價於: ::" -#: ../../library/datetime.rst:658 +#: ../../library/datetime.rst:691 msgid "" "time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" msgstr "" "time.struct_time((d.year, d.month, d.day, 0, 0, 0, d.weekday(), yday, -1))" -#: ../../library/datetime.rst:660 +#: ../../library/datetime.rst:693 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " "day number within the current year starting with 1 for January 1st." msgstr "" -#: ../../library/datetime.rst:666 +#: ../../library/datetime.rst:699 msgid "" "Return the proleptic Gregorian ordinal of the date, where January 1 of year " "1 has ordinal 1. For any :class:`date` object *d*, ``date.fromordinal(d." "toordinal()) == d``." msgstr "" -#: ../../library/datetime.rst:673 +#: ../../library/datetime.rst:706 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "For example, ``date(2002, 12, 4).weekday() == 2``, a Wednesday. See also :" @@ -1093,25 +1144,25 @@ msgstr "" "回傳一個代表星期幾的整數,星期一為 0、星期日為 6。例如 ``date(2002, 12, 4)." "weekday() == 2`` 為星期三。也請參考 :meth:`isoweekday`。" -#: ../../library/datetime.rst:680 +#: ../../library/datetime.rst:713 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " "For example, ``date(2002, 12, 4).isoweekday() == 3``, a Wednesday. See also :" "meth:`weekday`, :meth:`isocalendar`." msgstr "" -#: ../../library/datetime.rst:687 +#: ../../library/datetime.rst:720 msgid "" "Return a :term:`named tuple` object with three components: ``year``, " "``week`` and ``weekday``." msgstr "" -#: ../../library/datetime.rst:690 +#: ../../library/datetime.rst:723 msgid "" "The ISO calendar is a widely used variant of the Gregorian calendar. [#]_" msgstr "" -#: ../../library/datetime.rst:692 +#: ../../library/datetime.rst:725 msgid "" "The ISO year consists of 52 or 53 full weeks, and where a week starts on a " "Monday and ends on a Sunday. The first week of an ISO year is the first " @@ -1120,13 +1171,13 @@ msgid "" "Gregorian year." msgstr "" -#: ../../library/datetime.rst:697 +#: ../../library/datetime.rst:730 msgid "" "For example, 2004 begins on a Thursday, so the first week of ISO year 2004 " "begins on Monday, 29 Dec 2003 and ends on Sunday, 4 Jan 2004::" msgstr "" -#: ../../library/datetime.rst:700 +#: ../../library/datetime.rst:733 msgid "" ">>> from datetime import date\n" ">>> date(2003, 12, 29).isocalendar()\n" @@ -1140,16 +1191,16 @@ msgstr "" ">>> date(2004, 1, 4).isocalendar()\n" "datetime.IsoCalendarDate(year=2004, week=1, weekday=7)" -#: ../../library/datetime.rst:706 +#: ../../library/datetime.rst:739 msgid "Result changed from a tuple to a :term:`named tuple`." msgstr "" -#: ../../library/datetime.rst:711 +#: ../../library/datetime.rst:744 msgid "" "Return a string representing the date in ISO 8601 format, ``YYYY-MM-DD``::" msgstr "回傳一以 ISO 8601 格式 ``YYYY-MM-DD`` 表示的日期字串: ::" -#: ../../library/datetime.rst:713 +#: ../../library/datetime.rst:746 msgid "" ">>> from datetime import date\n" ">>> date(2002, 12, 4).isoformat()\n" @@ -1159,15 +1210,15 @@ msgstr "" ">>> date(2002, 12, 4).isoformat()\n" "'2002-12-04'" -#: ../../library/datetime.rst:719 +#: ../../library/datetime.rst:752 msgid "For a date *d*, ``str(d)`` is equivalent to ``d.isoformat()``." msgstr "" -#: ../../library/datetime.rst:724 +#: ../../library/datetime.rst:757 msgid "Return a string representing the date::" msgstr "" -#: ../../library/datetime.rst:726 +#: ../../library/datetime.rst:759 msgid "" ">>> from datetime import date\n" ">>> date(2002, 12, 4).ctime()\n" @@ -1177,22 +1228,22 @@ msgstr "" ">>> date(2002, 12, 4).ctime()\n" "'Wed Dec 4 00:00:00 2002'" -#: ../../library/datetime.rst:730 ../../library/datetime.rst:1529 +#: ../../library/datetime.rst:763 ../../library/datetime.rst:1587 msgid "``d.ctime()`` is equivalent to::" msgstr "``d.ctime()`` 等價於: ::" -#: ../../library/datetime.rst:732 ../../library/datetime.rst:1531 +#: ../../library/datetime.rst:765 ../../library/datetime.rst:1589 msgid "time.ctime(time.mktime(d.timetuple()))" msgstr "time.ctime(time.mktime(d.timetuple()))" -#: ../../library/datetime.rst:734 +#: ../../library/datetime.rst:767 msgid "" "on platforms where the native C :c:func:`ctime` function (which :func:`time." "ctime` invokes, but which :meth:`date.ctime` does not invoke) conforms to " "the C standard." msgstr "" -#: ../../library/datetime.rst:741 +#: ../../library/datetime.rst:774 msgid "" "Return a string representing the date, controlled by an explicit format " "string. Format codes referring to hours, minutes or seconds will see 0 " @@ -1200,7 +1251,7 @@ msgid "" "isoformat`." msgstr "" -#: ../../library/datetime.rst:748 +#: ../../library/datetime.rst:781 msgid "" "Same as :meth:`.date.strftime`. This makes it possible to specify a format " "string for a :class:`.date` object in :ref:`formatted string literals >> import time\n" ">>> from datetime import date\n" @@ -1252,11 +1303,11 @@ msgstr "" ">>> time_to_birthday.days\n" "202" -#: ../../library/datetime.rst:775 +#: ../../library/datetime.rst:808 msgid "More examples of working with :class:`date`:" msgstr "更多 :class:`date` 的用法範例:" -#: ../../library/datetime.rst:777 +#: ../../library/datetime.rst:810 msgid "" ">>> from datetime import date\n" ">>> d = date.fromordinal(730920) # 730920th day after 1. 1. 0001\n" @@ -1300,17 +1351,17 @@ msgid "" "datetime.date(2005, 3, 11)" msgstr "" -#: ../../library/datetime.rst:824 +#: ../../library/datetime.rst:857 msgid ":class:`.datetime` Objects" msgstr ":class:`.datetime` 物件" -#: ../../library/datetime.rst:826 +#: ../../library/datetime.rst:859 msgid "" "A :class:`.datetime` object is a single object containing all the " "information from a :class:`date` object and a :class:`.time` object." msgstr "" -#: ../../library/datetime.rst:829 +#: ../../library/datetime.rst:862 msgid "" "Like a :class:`date` object, :class:`.datetime` assumes the current " "Gregorian calendar extended in both directions; like a :class:`.time` " @@ -1318,81 +1369,81 @@ msgid "" "every day." msgstr "" -#: ../../library/datetime.rst:833 +#: ../../library/datetime.rst:866 msgid "Constructor:" msgstr "" -#: ../../library/datetime.rst:837 +#: ../../library/datetime.rst:870 msgid "" "The *year*, *month* and *day* arguments are required. *tzinfo* may be " "``None``, or an instance of a :class:`tzinfo` subclass. The remaining " "arguments must be integers in the following ranges:" msgstr "" -#: ../../library/datetime.rst:841 +#: ../../library/datetime.rst:874 msgid "``MINYEAR <= year <= MAXYEAR``," msgstr "``MINYEAR <= year <= MAXYEAR``," -#: ../../library/datetime.rst:842 +#: ../../library/datetime.rst:875 msgid "``1 <= month <= 12``," msgstr "``1 <= month <= 12``," -#: ../../library/datetime.rst:843 +#: ../../library/datetime.rst:876 msgid "``1 <= day <= number of days in the given month and year``," msgstr "" -#: ../../library/datetime.rst:844 ../../library/datetime.rst:1693 +#: ../../library/datetime.rst:877 ../../library/datetime.rst:1751 msgid "``0 <= hour < 24``," msgstr "``0 <= hour < 24``," -#: ../../library/datetime.rst:845 ../../library/datetime.rst:1694 +#: ../../library/datetime.rst:878 ../../library/datetime.rst:1752 msgid "``0 <= minute < 60``," msgstr "``0 <= minute < 60``," -#: ../../library/datetime.rst:846 ../../library/datetime.rst:1695 +#: ../../library/datetime.rst:879 ../../library/datetime.rst:1753 msgid "``0 <= second < 60``," msgstr "``0 <= second < 60``," -#: ../../library/datetime.rst:847 ../../library/datetime.rst:1696 +#: ../../library/datetime.rst:880 ../../library/datetime.rst:1754 msgid "``0 <= microsecond < 1000000``," msgstr "``0 <= microsecond < 1000000``," -#: ../../library/datetime.rst:848 ../../library/datetime.rst:1697 +#: ../../library/datetime.rst:881 ../../library/datetime.rst:1755 msgid "``fold in [0, 1]``." msgstr "" -#: ../../library/datetime.rst:852 ../../library/datetime.rst:1264 -#: ../../library/datetime.rst:1839 +#: ../../library/datetime.rst:885 ../../library/datetime.rst:1322 +#: ../../library/datetime.rst:1900 msgid "Added the *fold* parameter." msgstr "新增 *fold* 參數。" -#: ../../library/datetime.rst:859 +#: ../../library/datetime.rst:892 msgid "Return the current local date and time, with :attr:`.tzinfo` ``None``." msgstr "回傳目前的本地日期與時間,且 :attr:`.tzinfo` 為 ``None``。" -#: ../../library/datetime.rst:861 +#: ../../library/datetime.rst:894 msgid "Equivalent to::" msgstr "等價於: ::" -#: ../../library/datetime.rst:863 +#: ../../library/datetime.rst:896 msgid "datetime.fromtimestamp(time.time())" msgstr "datetime.fromtimestamp(time.time())" -#: ../../library/datetime.rst:865 +#: ../../library/datetime.rst:898 msgid "See also :meth:`now`, :meth:`fromtimestamp`." msgstr "也請見 :meth:`now`、:meth:`fromtimestamp`。" -#: ../../library/datetime.rst:867 +#: ../../library/datetime.rst:900 msgid "" "This method is functionally equivalent to :meth:`now`, but without a ``tz`` " "parameter." msgstr "" -#: ../../library/datetime.rst:872 +#: ../../library/datetime.rst:905 msgid "Return the current local date and time." msgstr "" -#: ../../library/datetime.rst:874 +#: ../../library/datetime.rst:907 msgid "" "If optional argument *tz* is ``None`` or not specified, this is like :meth:" "`today`, but, if possible, supplies more precision than can be gotten from " @@ -1403,28 +1454,28 @@ msgstr "" "供比透過 :func:`time.time` 取得的時間戳記更多位數的資訊(例如,這在有提供 C :" "c:func:`gettimeofday` 函式的平台上可能可行)。" -#: ../../library/datetime.rst:880 +#: ../../library/datetime.rst:913 msgid "" "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " "subclass, and the current date and time are converted to *tz*’s time zone." msgstr "" -#: ../../library/datetime.rst:883 +#: ../../library/datetime.rst:916 msgid "This function is preferred over :meth:`today` and :meth:`utcnow`." msgstr "" -#: ../../library/datetime.rst:888 +#: ../../library/datetime.rst:921 msgid "Return the current UTC date and time, with :attr:`.tzinfo` ``None``." msgstr "" -#: ../../library/datetime.rst:890 +#: ../../library/datetime.rst:923 msgid "" "This is like :meth:`now`, but returns the current UTC date and time, as a " "naive :class:`.datetime` object. An aware current UTC datetime can be " "obtained by calling ``datetime.now(timezone.utc)``. See also :meth:`now`." msgstr "" -#: ../../library/datetime.rst:896 +#: ../../library/datetime.rst:929 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1432,11 +1483,11 @@ msgid "" "current time in UTC is by calling ``datetime.now(timezone.utc)``." msgstr "" -#: ../../library/datetime.rst:903 +#: ../../library/datetime.rst:936 msgid "Use :meth:`datetime.now` with :attr:`UTC` instead." msgstr "" -#: ../../library/datetime.rst:908 +#: ../../library/datetime.rst:941 msgid "" "Return the local date and time corresponding to the POSIX timestamp, such as " "is returned by :func:`time.time`. If optional argument *tz* is ``None`` or " @@ -1444,13 +1495,13 @@ msgid "" "time, and the returned :class:`.datetime` object is naive." msgstr "" -#: ../../library/datetime.rst:913 +#: ../../library/datetime.rst:946 msgid "" "If *tz* is not ``None``, it must be an instance of a :class:`tzinfo` " "subclass, and the timestamp is converted to *tz*’s time zone." msgstr "" -#: ../../library/datetime.rst:916 +#: ../../library/datetime.rst:949 msgid "" ":meth:`fromtimestamp` may raise :exc:`OverflowError`, if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -1463,7 +1514,7 @@ msgid "" "preferred over :meth:`utcfromtimestamp`." msgstr "" -#: ../../library/datetime.rst:927 +#: ../../library/datetime.rst:960 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`localtime` " @@ -1471,17 +1522,17 @@ msgid "" "`ValueError` on :c:func:`localtime` or :c:func:`gmtime` failure." msgstr "" -#: ../../library/datetime.rst:934 +#: ../../library/datetime.rst:967 msgid ":meth:`fromtimestamp` may return instances with :attr:`.fold` set to 1." msgstr "" -#: ../../library/datetime.rst:939 +#: ../../library/datetime.rst:972 msgid "" "Return the UTC :class:`.datetime` corresponding to the POSIX timestamp, " "with :attr:`.tzinfo` ``None``. (The resulting object is naive.)" msgstr "" -#: ../../library/datetime.rst:942 +#: ../../library/datetime.rst:975 msgid "" "This may raise :exc:`OverflowError`, if the timestamp is out of the range of " "values supported by the platform C :c:func:`gmtime` function, and :exc:" @@ -1489,33 +1540,33 @@ msgid "" "to years in 1970 through 2038." msgstr "" -#: ../../library/datetime.rst:947 +#: ../../library/datetime.rst:980 msgid "To get an aware :class:`.datetime` object, call :meth:`fromtimestamp`::" msgstr "" -#: ../../library/datetime.rst:949 +#: ../../library/datetime.rst:982 msgid "datetime.fromtimestamp(timestamp, timezone.utc)" msgstr "datetime.fromtimestamp(timestamp, timezone.utc)" -#: ../../library/datetime.rst:951 +#: ../../library/datetime.rst:984 msgid "" "On the POSIX compliant platforms, it is equivalent to the following " "expression::" msgstr "" -#: ../../library/datetime.rst:954 +#: ../../library/datetime.rst:987 msgid "" "datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" msgstr "" "datetime(1970, 1, 1, tzinfo=timezone.utc) + timedelta(seconds=timestamp)" -#: ../../library/datetime.rst:956 +#: ../../library/datetime.rst:989 msgid "" "except the latter formula always supports the full years range: between :" "const:`MINYEAR` and :const:`MAXYEAR` inclusive." msgstr "" -#: ../../library/datetime.rst:961 +#: ../../library/datetime.rst:994 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -1524,7 +1575,7 @@ msgid "" "tz=timezone.utc)``." msgstr "" -#: ../../library/datetime.rst:967 +#: ../../library/datetime.rst:1000 msgid "" "Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is " "out of the range of values supported by the platform C :c:func:`gmtime` " @@ -1532,11 +1583,11 @@ msgid "" "`gmtime` failure." msgstr "" -#: ../../library/datetime.rst:975 +#: ../../library/datetime.rst:1008 msgid "Use :meth:`datetime.fromtimestamp` with :attr:`UTC` instead." msgstr "" -#: ../../library/datetime.rst:980 +#: ../../library/datetime.rst:1013 msgid "" "Return the :class:`.datetime` corresponding to the proleptic Gregorian " "ordinal, where January 1 of year 1 has ordinal 1. :exc:`ValueError` is " @@ -1545,7 +1596,7 @@ msgid "" "is ``None``." msgstr "" -#: ../../library/datetime.rst:988 +#: ../../library/datetime.rst:1021 msgid "" "Return a new :class:`.datetime` object whose date components are equal to " "the given :class:`date` object's, and whose time components are equal to the " @@ -1556,35 +1607,35 @@ msgid "" "attr:`.tzinfo` attributes are ignored." msgstr "" -#: ../../library/datetime.rst:996 +#: ../../library/datetime.rst:1029 msgid "" "For any :class:`.datetime` object *d*, ``d == datetime.combine(d.date(), d." "time(), d.tzinfo)``." msgstr "" -#: ../../library/datetime.rst:999 +#: ../../library/datetime.rst:1032 msgid "Added the *tzinfo* argument." msgstr "新增 *tzinfo* 引數。" -#: ../../library/datetime.rst:1005 +#: ../../library/datetime.rst:1038 msgid "" "Return a :class:`.datetime` corresponding to a *date_string* in any valid " "ISO 8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:1008 ../../library/datetime.rst:1793 +#: ../../library/datetime.rst:1041 ../../library/datetime.rst:1851 msgid "Time zone offsets may have fractional seconds." msgstr "" -#: ../../library/datetime.rst:1009 +#: ../../library/datetime.rst:1042 msgid "The ``T`` separator may be replaced by any single unicode character." msgstr "" -#: ../../library/datetime.rst:1010 ../../library/datetime.rst:1798 +#: ../../library/datetime.rst:1043 ../../library/datetime.rst:1856 msgid "Fractional hours and minutes are not supported." msgstr "" -#: ../../library/datetime.rst:1019 +#: ../../library/datetime.rst:1052 msgid "" ">>> from datetime import datetime\n" ">>> datetime.fromisoformat('2011-11-04')\n" @@ -1630,13 +1681,13 @@ msgstr "" "datetime.datetime(2011, 11, 4, 0, 5, 23,\n" " tzinfo=datetime.timezone(datetime.timedelta(seconds=14400)))" -#: ../../library/datetime.rst:1041 +#: ../../library/datetime.rst:1074 msgid "" "Previously, this method only supported formats that could be emitted by :" "meth:`date.isoformat` or :meth:`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1048 +#: ../../library/datetime.rst:1081 msgid "" "Return a :class:`.datetime` corresponding to the ISO calendar date specified " "by year, week and day. The non-date components of the datetime are populated " @@ -1644,23 +1695,23 @@ msgid "" "`datetime.isocalendar`." msgstr "" -#: ../../library/datetime.rst:1057 +#: ../../library/datetime.rst:1090 msgid "" "Return a :class:`.datetime` corresponding to *date_string*, parsed according " "to *format*." msgstr "" -#: ../../library/datetime.rst:1060 +#: ../../library/datetime.rst:1093 msgid "" "If *format* does not contain microseconds or time zone information, this is " "equivalent to::" msgstr "" -#: ../../library/datetime.rst:1062 ../../library/datetime.rst:2515 +#: ../../library/datetime.rst:1095 ../../library/datetime.rst:2576 msgid "datetime(*(time.strptime(date_string, format)[0:6]))" msgstr "datetime(*(time.strptime(date_string, format)[0:6]))" -#: ../../library/datetime.rst:1064 +#: ../../library/datetime.rst:1097 msgid "" ":exc:`ValueError` is raised if the date_string and format can't be parsed " "by :func:`time.strptime` or if it returns a value which isn't a time tuple. " @@ -1668,44 +1719,65 @@ msgid "" "fromisoformat`." msgstr "" -#: ../../library/datetime.rst:1075 +#: ../../library/datetime.rst:1104 +msgid "" +"If *format* specifies a day of month without a year a :exc:" +"`DeprecationWarning` is now emitted. This is to avoid a quadrennial leap " +"year bug in code seeking to parse only a month and day as the default year " +"used in absence of one in the format is not a leap year. Such *format* " +"values may raise an error as of Python 3.15. The workaround is to always " +"include a year in your *format*. If parsing *date_string* values that do " +"not have a year, explicitly add a year that is a leap year before parsing:" +msgstr "" + +#: ../../library/datetime.rst:1113 +msgid "" +">>> from datetime import datetime\n" +">>> date_string = \"02/29\"\n" +">>> when = datetime.strptime(f\"{date_string};1984\", \"%m/%d;%Y\") # " +"Avoids leap year bug.\n" +">>> when.strftime(\"%B %d\") \n" +"'February 29'" +msgstr "" + +#: ../../library/datetime.rst:1126 msgid "" "The earliest representable :class:`.datetime`, ``datetime(MINYEAR, 1, 1, " "tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1081 +#: ../../library/datetime.rst:1132 msgid "" "The latest representable :class:`.datetime`, ``datetime(MAXYEAR, 12, 31, 23, " "59, 59, 999999, tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1087 +#: ../../library/datetime.rst:1138 msgid "" "The smallest possible difference between non-equal :class:`.datetime` " "objects, ``timedelta(microseconds=1)``." msgstr "" -#: ../../library/datetime.rst:1110 ../../library/datetime.rst:1726 +#: ../../library/datetime.rst:1161 ../../library/datetime.rst:1784 msgid "In ``range(24)``." msgstr "" -#: ../../library/datetime.rst:1115 ../../library/datetime.rst:1120 -#: ../../library/datetime.rst:1731 ../../library/datetime.rst:1736 +#: ../../library/datetime.rst:1166 ../../library/datetime.rst:1171 +#: ../../library/datetime.rst:1789 ../../library/datetime.rst:1794 msgid "In ``range(60)``." msgstr "" -#: ../../library/datetime.rst:1125 ../../library/datetime.rst:1741 +#: ../../library/datetime.rst:1176 ../../library/datetime.rst:1799 msgid "In ``range(1000000)``." msgstr "" -#: ../../library/datetime.rst:1130 +#: ../../library/datetime.rst:1181 msgid "" "The object passed as the *tzinfo* argument to the :class:`.datetime` " "constructor, or ``None`` if none was passed." msgstr "" -#: ../../library/datetime.rst:1136 ../../library/datetime.rst:1752 +#: ../../library/datetime.rst:1187 ../../library/datetime.rst:1810 msgid "" "In ``[0, 1]``. Used to disambiguate wall times during a repeated interval. " "(A repeated interval occurs when clocks are rolled back at the end of " @@ -1715,26 +1787,26 @@ msgid "" "time representation." msgstr "" -#: ../../library/datetime.rst:1149 +#: ../../library/datetime.rst:1200 msgid "``datetime2 = datetime1 + timedelta``" msgstr "``datetime2 = datetime1 + timedelta``" -#: ../../library/datetime.rst:1149 ../../library/datetime.rst:2362 -#: ../../library/datetime.rst:2367 ../../library/datetime.rst:2379 -#: ../../library/datetime.rst:2384 ../../library/datetime.rst:2444 -#: ../../library/datetime.rst:2449 ../../library/datetime.rst:2453 +#: ../../library/datetime.rst:1200 ../../library/datetime.rst:2423 +#: ../../library/datetime.rst:2428 ../../library/datetime.rst:2440 +#: ../../library/datetime.rst:2445 ../../library/datetime.rst:2505 +#: ../../library/datetime.rst:2510 ../../library/datetime.rst:2514 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/datetime.rst:1151 +#: ../../library/datetime.rst:1202 msgid "``datetime2 = datetime1 - timedelta``" msgstr "``datetime2 = datetime1 - timedelta``" -#: ../../library/datetime.rst:1151 ../../library/datetime.rst:2395 +#: ../../library/datetime.rst:1202 ../../library/datetime.rst:2456 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/datetime.rst:1153 +#: ../../library/datetime.rst:1204 msgid "``timedelta = datetime1 - datetime2``" msgstr "``timedelta = datetime1 - datetime2``" @@ -1762,7 +1834,7 @@ msgstr "``datetime1 <= datetime2``" msgid "``datetime1 >= datetime2``" msgstr "``datetime1 >= datetime2``" -#: ../../library/datetime.rst:1165 +#: ../../library/datetime.rst:1216 msgid "" "``datetime2`` is a duration of ``timedelta`` removed from ``datetime1``, " "moving forward in time if ``timedelta.days > 0``, or backward if ``timedelta." @@ -1773,7 +1845,7 @@ msgid "" "adjustments are done even if the input is an aware object." msgstr "" -#: ../../library/datetime.rst:1174 +#: ../../library/datetime.rst:1225 msgid "" "Computes the ``datetime2`` such that ``datetime2 + timedelta == datetime1``. " "As for addition, the result has the same :attr:`~.datetime.tzinfo` attribute " @@ -1781,14 +1853,14 @@ msgid "" "input is aware." msgstr "" -#: ../../library/datetime.rst:1179 +#: ../../library/datetime.rst:1230 msgid "" "Subtraction of a :class:`.datetime` from a :class:`.datetime` is defined " "only if both operands are naive, or if both are aware. If one is aware and " "the other is naive, :exc:`TypeError` is raised." msgstr "" -#: ../../library/datetime.rst:1183 +#: ../../library/datetime.rst:1234 msgid "" "If both are naive, or both are aware and have the same :attr:`~.datetime." "tzinfo` attribute, the :attr:`~.datetime.tzinfo` attributes are ignored, and " @@ -1796,7 +1868,7 @@ msgid "" "datetime1``. No time zone adjustments are done in this case." msgstr "" -#: ../../library/datetime.rst:1188 +#: ../../library/datetime.rst:1239 msgid "" "If both are aware and have different :attr:`~.datetime.tzinfo` attributes, " "``a-b`` acts as if *a* and *b* were first converted to naive UTC datetimes. " @@ -1805,20 +1877,17 @@ msgid "" "overflows." msgstr "" -#: ../../library/datetime.rst:1194 +#: ../../library/datetime.rst:1245 msgid "" ":class:`.datetime` objects are equal if they represent the same date and " "time, taking into account the time zone." msgstr "" -#: ../../library/datetime.rst:1197 -msgid "" -"Naive and aware :class:`!datetime` objects are never equal. :class:`!" -"datetime` objects are never equal to :class:`date` objects that are not " -"also :class:`!datetime` instances, even if they represent the same date." +#: ../../library/datetime.rst:1248 +msgid "Naive and aware :class:`!datetime` objects are never equal." msgstr "" -#: ../../library/datetime.rst:1202 +#: ../../library/datetime.rst:1250 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -1829,20 +1898,19 @@ msgid "" "interval are never equal to :class:`!datetime` instances in other time zone." msgstr "" -#: ../../library/datetime.rst:1212 +#: ../../library/datetime.rst:1260 msgid "" "*datetime1* is considered less than *datetime2* when *datetime1* precedes " "*datetime2* in time, taking into account the time zone." msgstr "" -#: ../../library/datetime.rst:1215 +#: ../../library/datetime.rst:1263 msgid "" -"Order comparison between naive and aware :class:`.datetime` objects, as well " -"as a :class:`!datetime` object and a :class:`!date` object that is not also " -"a :class:`!datetime` instance, raises :exc:`TypeError`." +"Order comparison between naive and aware :class:`.datetime` objects raises :" +"exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1219 +#: ../../library/datetime.rst:1266 msgid "" "If both comparands are aware, and have the same :attr:`!tzinfo` attribute, " "the :attr:`!tzinfo` and :attr:`~.datetime.fold` attributes are ignored and " @@ -1852,33 +1920,33 @@ msgid "" "implementation never overflows." msgstr "" -#: ../../library/datetime.rst:1226 +#: ../../library/datetime.rst:1273 msgid "" "Equality comparisons between aware and naive :class:`.datetime` instances " "don't raise :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1234 +#: ../../library/datetime.rst:1289 msgid "Return :class:`date` object with same year, month and day." msgstr "" -#: ../../library/datetime.rst:1239 +#: ../../library/datetime.rst:1294 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond and " "fold. :attr:`.tzinfo` is ``None``. See also method :meth:`timetz`." msgstr "" -#: ../../library/datetime.rst:1242 ../../library/datetime.rst:1251 +#: ../../library/datetime.rst:1297 ../../library/datetime.rst:1306 msgid "The fold value is copied to the returned :class:`.time` object." msgstr "" -#: ../../library/datetime.rst:1248 +#: ../../library/datetime.rst:1303 msgid "" "Return :class:`.time` object with same hour, minute, second, microsecond, " "fold, and tzinfo attributes. See also method :meth:`time`." msgstr "" -#: ../../library/datetime.rst:1259 +#: ../../library/datetime.rst:1314 msgid "" "Return a datetime with the same attributes, except for those attributes " "given new values by whichever keyword arguments are specified. Note that " @@ -1886,21 +1954,27 @@ msgid "" "datetime with no conversion of date and time data." msgstr "" -#: ../../library/datetime.rst:1270 +#: ../../library/datetime.rst:1319 +msgid "" +":class:`.datetime` objects are also supported by generic function :func:" +"`copy.replace`." +msgstr "" + +#: ../../library/datetime.rst:1328 msgid "" "Return a :class:`.datetime` object with new :attr:`.tzinfo` attribute *tz*, " "adjusting the date and time data so the result is the same UTC time as " "*self*, but in *tz*'s local time." msgstr "" -#: ../../library/datetime.rst:1274 +#: ../../library/datetime.rst:1332 msgid "" "If provided, *tz* must be an instance of a :class:`tzinfo` subclass, and " "its :meth:`utcoffset` and :meth:`dst` methods must not return ``None``. If " "*self* is naive, it is presumed to represent time in the system time zone." msgstr "" -#: ../../library/datetime.rst:1278 +#: ../../library/datetime.rst:1336 msgid "" "If called without arguments (or with ``tz=None``) the system local time zone " "is assumed for the target time zone. The ``.tzinfo`` attribute of the " @@ -1908,7 +1982,7 @@ msgid "" "with the zone name and offset obtained from the OS." msgstr "" -#: ../../library/datetime.rst:1283 +#: ../../library/datetime.rst:1341 msgid "" "If ``self.tzinfo`` is *tz*, ``self.astimezone(tz)`` is equal to *self*: no " "adjustment of date or time data is performed. Else the result is local time " @@ -1917,7 +1991,7 @@ msgid "" "date and time data as ``dt - dt.utcoffset()``." msgstr "" -#: ../../library/datetime.rst:1289 +#: ../../library/datetime.rst:1347 msgid "" "If you merely want to attach a :class:`timezone` object *tz* to a datetime " "*dt* without adjustment of date and time data, use ``dt." @@ -1926,14 +2000,14 @@ msgid "" "use ``dt.replace(tzinfo=None)``." msgstr "" -#: ../../library/datetime.rst:1294 +#: ../../library/datetime.rst:1352 msgid "" "Note that the default :meth:`tzinfo.fromutc` method can be overridden in a :" "class:`tzinfo` subclass to affect the result returned by :meth:`astimezone`. " "Ignoring error cases, :meth:`astimezone` acts like::" msgstr "" -#: ../../library/datetime.rst:1298 +#: ../../library/datetime.rst:1356 msgid "" "def astimezone(self, tz):\n" " if self.tzinfo is tz:\n" @@ -1944,49 +2018,49 @@ msgid "" " return tz.fromutc(utc)" msgstr "" -#: ../../library/datetime.rst:1306 +#: ../../library/datetime.rst:1364 msgid "*tz* now can be omitted." msgstr "" -#: ../../library/datetime.rst:1309 +#: ../../library/datetime.rst:1367 msgid "" "The :meth:`astimezone` method can now be called on naive instances that are " "presumed to represent system local time." msgstr "" -#: ../../library/datetime.rst:1316 +#: ../../library/datetime.rst:1374 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "utcoffset(self)``, and raises an exception if the latter doesn't return " "``None`` or a :class:`timedelta` object with magnitude less than one day." msgstr "" -#: ../../library/datetime.rst:1320 ../../library/datetime.rst:1912 -#: ../../library/datetime.rst:2019 ../../library/datetime.rst:2264 -#: ../../library/datetime.rst:2276 ../../library/datetime.rst:2588 +#: ../../library/datetime.rst:1378 ../../library/datetime.rst:1973 +#: ../../library/datetime.rst:2080 ../../library/datetime.rst:2325 +#: ../../library/datetime.rst:2337 ../../library/datetime.rst:2649 msgid "The UTC offset is not restricted to a whole number of minutes." msgstr "" -#: ../../library/datetime.rst:1326 +#: ../../library/datetime.rst:1384 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "dst(self)``, and raises an exception if the latter doesn't return ``None`` " "or a :class:`timedelta` object with magnitude less than one day." msgstr "" -#: ../../library/datetime.rst:1330 ../../library/datetime.rst:1922 -#: ../../library/datetime.rst:2073 +#: ../../library/datetime.rst:1388 ../../library/datetime.rst:1983 +#: ../../library/datetime.rst:2134 msgid "The DST offset is not restricted to a whole number of minutes." msgstr "" -#: ../../library/datetime.rst:1336 +#: ../../library/datetime.rst:1394 msgid "" "If :attr:`.tzinfo` is ``None``, returns ``None``, else returns ``self.tzinfo." "tzname(self)``, raises an exception if the latter doesn't return ``None`` or " "a string object," msgstr "" -#: ../../library/datetime.rst:1347 +#: ../../library/datetime.rst:1405 msgid "" "time.struct_time((d.year, d.month, d.day,\n" " d.hour, d.minute, d.second,\n" @@ -1996,7 +2070,7 @@ msgstr "" " d.hour, d.minute, d.second,\n" " d.weekday(), yday, dst))" -#: ../../library/datetime.rst:1351 +#: ../../library/datetime.rst:1409 msgid "" "where ``yday = d.toordinal() - date(d.year, 1, 1).toordinal() + 1`` is the " "day number within the current year starting with 1 for January 1st. The :" @@ -2007,7 +2081,7 @@ msgid "" "to 0." msgstr "" -#: ../../library/datetime.rst:1362 +#: ../../library/datetime.rst:1420 msgid "" "If :class:`.datetime` instance *d* is naive, this is the same as ``d." "timetuple()`` except that :attr:`~.time.struct_time.tm_isdst` is forced to 0 " @@ -2015,7 +2089,7 @@ msgid "" "time." msgstr "" -#: ../../library/datetime.rst:1366 +#: ../../library/datetime.rst:1424 msgid "" "If *d* is aware, *d* is normalized to UTC time, by subtracting ``d." "utcoffset()``, and a :class:`time.struct_time` for the normalized time is " @@ -2024,7 +2098,7 @@ msgid "" "and UTC adjustment spills over a year boundary." msgstr "" -#: ../../library/datetime.rst:1375 +#: ../../library/datetime.rst:1433 msgid "" "Because naive ``datetime`` objects are treated by many ``datetime`` methods " "as local times, it is preferred to use aware datetimes to represent times in " @@ -2034,20 +2108,20 @@ msgid "" "meth:`.datetime.timetuple`." msgstr "" -#: ../../library/datetime.rst:1384 +#: ../../library/datetime.rst:1442 msgid "" "Return the proleptic Gregorian ordinal of the date. The same as ``self." "date().toordinal()``." msgstr "" -#: ../../library/datetime.rst:1389 +#: ../../library/datetime.rst:1447 msgid "" "Return POSIX timestamp corresponding to the :class:`.datetime` instance. The " "return value is a :class:`float` similar to that returned by :func:`time." "time`." msgstr "" -#: ../../library/datetime.rst:1393 +#: ../../library/datetime.rst:1451 msgid "" "Naive :class:`.datetime` instances are assumed to represent local time and " "this method relies on the platform C :c:func:`mktime` function to perform " @@ -2057,22 +2131,22 @@ msgid "" "future." msgstr "" -#: ../../library/datetime.rst:1400 +#: ../../library/datetime.rst:1458 msgid "" "For aware :class:`.datetime` instances, the return value is computed as::" msgstr "" -#: ../../library/datetime.rst:1403 +#: ../../library/datetime.rst:1461 msgid "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" msgstr "(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()" -#: ../../library/datetime.rst:1407 +#: ../../library/datetime.rst:1465 msgid "" "The :meth:`timestamp` method uses the :attr:`.fold` attribute to " "disambiguate the times during a repeated interval." msgstr "" -#: ../../library/datetime.rst:1413 +#: ../../library/datetime.rst:1471 msgid "" "There is no method to obtain the POSIX timestamp directly from a naive :" "class:`.datetime` instance representing UTC time. If your application uses " @@ -2080,57 +2154,57 @@ msgid "" "the POSIX timestamp by supplying ``tzinfo=timezone.utc``::" msgstr "" -#: ../../library/datetime.rst:1419 +#: ../../library/datetime.rst:1477 msgid "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" msgstr "timestamp = dt.replace(tzinfo=timezone.utc).timestamp()" -#: ../../library/datetime.rst:1421 +#: ../../library/datetime.rst:1479 msgid "or by calculating the timestamp directly::" msgstr "" -#: ../../library/datetime.rst:1423 +#: ../../library/datetime.rst:1481 msgid "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" msgstr "timestamp = (dt - datetime(1970, 1, 1)) / timedelta(seconds=1)" -#: ../../library/datetime.rst:1427 +#: ../../library/datetime.rst:1485 msgid "" "Return the day of the week as an integer, where Monday is 0 and Sunday is 6. " "The same as ``self.date().weekday()``. See also :meth:`isoweekday`." msgstr "" -#: ../../library/datetime.rst:1433 +#: ../../library/datetime.rst:1491 msgid "" "Return the day of the week as an integer, where Monday is 1 and Sunday is 7. " "The same as ``self.date().isoweekday()``. See also :meth:`weekday`, :meth:" "`isocalendar`." msgstr "" -#: ../../library/datetime.rst:1440 +#: ../../library/datetime.rst:1498 msgid "" "Return a :term:`named tuple` with three components: ``year``, ``week`` and " "``weekday``. The same as ``self.date().isocalendar()``." msgstr "" -#: ../../library/datetime.rst:1446 +#: ../../library/datetime.rst:1504 msgid "Return a string representing the date and time in ISO 8601 format:" msgstr "" -#: ../../library/datetime.rst:1448 +#: ../../library/datetime.rst:1506 msgid "``YYYY-MM-DDTHH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "``YYYY-MM-DDTHH:MM:SS.ffffff``,如果 :attr:`microsecond` 不是 0" -#: ../../library/datetime.rst:1449 +#: ../../library/datetime.rst:1507 msgid "``YYYY-MM-DDTHH:MM:SS``, if :attr:`microsecond` is 0" msgstr "``YYYY-MM-DDTHH:MM:SS``,如果 :attr:`microsecond` 是 0" -#: ../../library/datetime.rst:1451 +#: ../../library/datetime.rst:1509 msgid "" "If :meth:`utcoffset` does not return ``None``, a string is appended, giving " "the UTC offset:" msgstr "" "如果 :meth:`utcoffset` 没有回傳 ``None``,則會附加一个字串,給出 UTC 偏移:" -#: ../../library/datetime.rst:1454 +#: ../../library/datetime.rst:1512 msgid "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` " "is not 0" @@ -2138,13 +2212,13 @@ msgstr "" "``YYYY-MM-DDTHH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``,如果 :attr:`microsecond` " "不是 0" -#: ../../library/datetime.rst:1456 +#: ../../library/datetime.rst:1514 msgid "" "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0" msgstr "" "``YYYY-MM-DDTHH:MM:SS+HH:MM[:SS[.ffffff]]``,如果 :attr:`microsecond` 是 0" -#: ../../library/datetime.rst:1460 +#: ../../library/datetime.rst:1518 msgid "" ">>> from datetime import datetime, timezone\n" ">>> datetime(2019, 5, 18, 15, 17, 8, 132263).isoformat()\n" @@ -2158,13 +2232,13 @@ msgstr "" ">>> datetime(2019, 5, 18, 15, 17, tzinfo=timezone.utc).isoformat()\n" "'2019-05-18T15:17:00+00:00'" -#: ../../library/datetime.rst:1466 +#: ../../library/datetime.rst:1524 msgid "" "The optional argument *sep* (default ``'T'``) is a one-character separator, " "placed between the date and time portions of the result. For example::" msgstr "" -#: ../../library/datetime.rst:1469 +#: ../../library/datetime.rst:1527 msgid "" ">>> from datetime import tzinfo, timedelta, datetime\n" ">>> class TZ(tzinfo):\n" @@ -2178,53 +2252,53 @@ msgid "" "'2009-11-27T00:00:00.000100-06:39'" msgstr "" -#: ../../library/datetime.rst:1480 ../../library/datetime.rst:1852 +#: ../../library/datetime.rst:1538 ../../library/datetime.rst:1913 msgid "" "The optional argument *timespec* specifies the number of additional " "components of the time to include (the default is ``'auto'``). It can be one " "of the following:" msgstr "" -#: ../../library/datetime.rst:1484 ../../library/datetime.rst:1856 +#: ../../library/datetime.rst:1542 ../../library/datetime.rst:1917 msgid "" "``'auto'``: Same as ``'seconds'`` if :attr:`microsecond` is 0, same as " "``'microseconds'`` otherwise." msgstr "" -#: ../../library/datetime.rst:1486 ../../library/datetime.rst:1858 +#: ../../library/datetime.rst:1544 ../../library/datetime.rst:1919 msgid "``'hours'``: Include the :attr:`hour` in the two-digit ``HH`` format." msgstr "" -#: ../../library/datetime.rst:1487 ../../library/datetime.rst:1859 +#: ../../library/datetime.rst:1545 ../../library/datetime.rst:1920 msgid "" "``'minutes'``: Include :attr:`hour` and :attr:`minute` in ``HH:MM`` format." msgstr "" -#: ../../library/datetime.rst:1488 ../../library/datetime.rst:1860 +#: ../../library/datetime.rst:1546 ../../library/datetime.rst:1921 msgid "" "``'seconds'``: Include :attr:`hour`, :attr:`minute`, and :attr:`second` in " "``HH:MM:SS`` format." msgstr "" -#: ../../library/datetime.rst:1490 ../../library/datetime.rst:1862 +#: ../../library/datetime.rst:1548 ../../library/datetime.rst:1923 msgid "" "``'milliseconds'``: Include full time, but truncate fractional second part " "to milliseconds. ``HH:MM:SS.sss`` format." msgstr "" -#: ../../library/datetime.rst:1492 ../../library/datetime.rst:1864 +#: ../../library/datetime.rst:1550 ../../library/datetime.rst:1925 msgid "``'microseconds'``: Include full time in ``HH:MM:SS.ffffff`` format." msgstr "" -#: ../../library/datetime.rst:1496 ../../library/datetime.rst:1868 +#: ../../library/datetime.rst:1554 ../../library/datetime.rst:1929 msgid "Excluded time components are truncated, not rounded." msgstr "" -#: ../../library/datetime.rst:1498 +#: ../../library/datetime.rst:1556 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument::" msgstr "" -#: ../../library/datetime.rst:1501 +#: ../../library/datetime.rst:1559 msgid "" ">>> from datetime import datetime\n" ">>> datetime.now().isoformat(timespec='minutes') \n" @@ -2240,21 +2314,21 @@ msgstr "" ">>> dt.isoformat(timespec='microseconds')\n" "'2015-01-01T12:30:59.000000'" -#: ../../library/datetime.rst:1508 ../../library/datetime.rst:1883 +#: ../../library/datetime.rst:1566 ../../library/datetime.rst:1944 msgid "Added the *timespec* parameter." msgstr "新增 *timespec* 參數。" -#: ../../library/datetime.rst:1514 +#: ../../library/datetime.rst:1572 msgid "" "For a :class:`.datetime` instance *d*, ``str(d)`` is equivalent to ``d." "isoformat(' ')``." msgstr "" -#: ../../library/datetime.rst:1520 +#: ../../library/datetime.rst:1578 msgid "Return a string representing the date and time::" msgstr "" -#: ../../library/datetime.rst:1522 +#: ../../library/datetime.rst:1580 msgid "" ">>> from datetime import datetime\n" ">>> datetime(2002, 12, 4, 20, 30, 40).ctime()\n" @@ -2264,27 +2338,27 @@ msgstr "" ">>> datetime(2002, 12, 4, 20, 30, 40).ctime()\n" "'Wed Dec 4 20:30:40 2002'" -#: ../../library/datetime.rst:1526 +#: ../../library/datetime.rst:1584 msgid "" "The output string will *not* include time zone information, regardless of " "whether the input is aware or naive." msgstr "" -#: ../../library/datetime.rst:1533 +#: ../../library/datetime.rst:1591 msgid "" "on platforms where the native C :c:func:`ctime` function (which :func:`time." "ctime` invokes, but which :meth:`datetime.ctime` does not invoke) conforms " "to the C standard." msgstr "" -#: ../../library/datetime.rst:1540 +#: ../../library/datetime.rst:1598 msgid "" "Return a string representing the date and time, controlled by an explicit " "format string. See also :ref:`strftime-strptime-behavior` and :meth:" "`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1547 +#: ../../library/datetime.rst:1605 msgid "" "Same as :meth:`.datetime.strftime`. This makes it possible to specify a " "format string for a :class:`.datetime` object in :ref:`formatted string " @@ -2292,15 +2366,15 @@ msgid "" "`strftime-strptime-behavior` and :meth:`datetime.isoformat`." msgstr "" -#: ../../library/datetime.rst:1554 +#: ../../library/datetime.rst:1612 msgid "Examples of Usage: :class:`.datetime`" msgstr "用法範例::class:`.datetime`" -#: ../../library/datetime.rst:1556 +#: ../../library/datetime.rst:1614 msgid "Examples of working with :class:`.datetime` objects:" msgstr "更多 :class:`.datetime` 的用法範例:" -#: ../../library/datetime.rst:1558 +#: ../../library/datetime.rst:1616 msgid "" ">>> from datetime import datetime, date, time, timezone\n" "\n" @@ -2354,14 +2428,14 @@ msgid "" "'The day is 21, the month is November, the time is 04:30PM.'" msgstr "" -#: ../../library/datetime.rst:1609 +#: ../../library/datetime.rst:1667 msgid "" "The example below defines a :class:`tzinfo` subclass capturing time zone " "information for Kabul, Afghanistan, which used +4 UTC until 1945 and then " "+4:30 UTC thereafter::" msgstr "" -#: ../../library/datetime.rst:1613 +#: ../../library/datetime.rst:1671 msgid "" "from datetime import timedelta, datetime, tzinfo, timezone\n" "\n" @@ -2408,11 +2482,11 @@ msgid "" " return \"+04\"" msgstr "" -#: ../../library/datetime.rst:1656 +#: ../../library/datetime.rst:1714 msgid "Usage of ``KabulTz`` from above::" msgstr "" -#: ../../library/datetime.rst:1658 +#: ../../library/datetime.rst:1716 msgid "" ">>> tz1 = KabulTz()\n" "\n" @@ -2436,63 +2510,63 @@ msgid "" "True" msgstr "" -#: ../../library/datetime.rst:1682 +#: ../../library/datetime.rst:1740 msgid ":class:`.time` Objects" msgstr ":class:`.time` 物件" -#: ../../library/datetime.rst:1684 +#: ../../library/datetime.rst:1742 msgid "" "A :class:`.time` object represents a (local) time of day, independent of any " "particular day, and subject to adjustment via a :class:`tzinfo` object." msgstr "" -#: ../../library/datetime.rst:1689 +#: ../../library/datetime.rst:1747 msgid "" "All arguments are optional. *tzinfo* may be ``None``, or an instance of a :" "class:`tzinfo` subclass. The remaining arguments must be integers in the " "following ranges:" msgstr "" -#: ../../library/datetime.rst:1699 +#: ../../library/datetime.rst:1757 msgid "" "If an argument outside those ranges is given, :exc:`ValueError` is raised. " "All default to 0 except *tzinfo*, which defaults to ``None``." msgstr "" -#: ../../library/datetime.rst:1707 +#: ../../library/datetime.rst:1765 msgid "The earliest representable :class:`.time`, ``time(0, 0, 0, 0)``." msgstr "" -#: ../../library/datetime.rst:1712 +#: ../../library/datetime.rst:1770 msgid "The latest representable :class:`.time`, ``time(23, 59, 59, 999999)``." msgstr "" -#: ../../library/datetime.rst:1717 +#: ../../library/datetime.rst:1775 msgid "" "The smallest possible difference between non-equal :class:`.time` objects, " "``timedelta(microseconds=1)``, although note that arithmetic on :class:`." "time` objects is not supported." msgstr "" -#: ../../library/datetime.rst:1746 +#: ../../library/datetime.rst:1804 msgid "" "The object passed as the tzinfo argument to the :class:`.time` constructor, " "or ``None`` if none was passed." msgstr "" -#: ../../library/datetime.rst:1760 +#: ../../library/datetime.rst:1818 msgid "" ":class:`.time` objects support equality and order comparisons, where *a* is " "considered less than *b* when *a* precedes *b* in time." msgstr "" -#: ../../library/datetime.rst:1763 +#: ../../library/datetime.rst:1821 msgid "" "Naive and aware :class:`!time` objects are never equal. Order comparison " "between naive and aware :class:`!time` objects raises :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1767 +#: ../../library/datetime.rst:1825 msgid "" "If both comparands are aware, and have the same :attr:`~.time.tzinfo` " "attribute, the :attr:`!tzinfo` and :attr:`!fold` attributes are ignored and " @@ -2501,18 +2575,18 @@ msgid "" "subtracting their UTC offsets (obtained from ``self.utcoffset()``)." msgstr "" -#: ../../library/datetime.rst:1773 +#: ../../library/datetime.rst:1831 msgid "" "Equality comparisons between aware and naive :class:`.time` instances don't " "raise :exc:`TypeError`." msgstr "" -#: ../../library/datetime.rst:1777 +#: ../../library/datetime.rst:1835 msgid "" "In Boolean contexts, a :class:`.time` object is always considered to be true." msgstr "" -#: ../../library/datetime.rst:1779 +#: ../../library/datetime.rst:1837 msgid "" "Before Python 3.5, a :class:`.time` object was considered to be false if it " "represented midnight in UTC. This behavior was considered obscure and error-" @@ -2520,33 +2594,33 @@ msgid "" "details." msgstr "" -#: ../../library/datetime.rst:1786 +#: ../../library/datetime.rst:1844 msgid "Other constructor:" msgstr "" -#: ../../library/datetime.rst:1790 +#: ../../library/datetime.rst:1848 msgid "" "Return a :class:`.time` corresponding to a *time_string* in any valid ISO " "8601 format, with the following exceptions:" msgstr "" -#: ../../library/datetime.rst:1794 +#: ../../library/datetime.rst:1852 msgid "" "The leading ``T``, normally required in cases where there may be ambiguity " "between a date and a time, is not required." msgstr "" -#: ../../library/datetime.rst:1796 +#: ../../library/datetime.rst:1854 msgid "" "Fractional seconds may have any number of digits (anything beyond 6 will be " "truncated)." msgstr "" -#: ../../library/datetime.rst:1800 +#: ../../library/datetime.rst:1858 msgid "Examples:" msgstr "範例: ::" -#: ../../library/datetime.rst:1802 +#: ../../library/datetime.rst:1860 msgid "" ">>> from datetime import time\n" ">>> time.fromisoformat('04:23:01')\n" @@ -2586,13 +2660,13 @@ msgstr "" ">>> time.fromisoformat('04:23:01+00:00')\n" "datetime.time(4, 23, 1, tzinfo=datetime.timezone.utc)" -#: ../../library/datetime.rst:1824 +#: ../../library/datetime.rst:1882 msgid "" "Previously, this method only supported formats that could be emitted by :" "meth:`time.isoformat`." msgstr "" -#: ../../library/datetime.rst:1834 +#: ../../library/datetime.rst:1892 msgid "" "Return a :class:`.time` with the same value, except for those attributes " "given new values by whichever keyword arguments are specified. Note that " @@ -2600,35 +2674,41 @@ msgid "" "aware :class:`.time`, without conversion of the time data." msgstr "" -#: ../../library/datetime.rst:1845 +#: ../../library/datetime.rst:1897 +msgid "" +":class:`.time` objects are also supported by generic function :func:`copy." +"replace`." +msgstr "" + +#: ../../library/datetime.rst:1906 msgid "Return a string representing the time in ISO 8601 format, one of:" msgstr "" -#: ../../library/datetime.rst:1847 +#: ../../library/datetime.rst:1908 msgid "``HH:MM:SS.ffffff``, if :attr:`microsecond` is not 0" msgstr "" -#: ../../library/datetime.rst:1848 +#: ../../library/datetime.rst:1909 msgid "``HH:MM:SS``, if :attr:`microsecond` is 0" msgstr "" -#: ../../library/datetime.rst:1849 +#: ../../library/datetime.rst:1910 msgid "" "``HH:MM:SS.ffffff+HH:MM[:SS[.ffffff]]``, if :meth:`utcoffset` does not " "return ``None``" msgstr "" -#: ../../library/datetime.rst:1850 +#: ../../library/datetime.rst:1911 msgid "" "``HH:MM:SS+HH:MM[:SS[.ffffff]]``, if :attr:`microsecond` is 0 and :meth:" "`utcoffset` does not return ``None``" msgstr "" -#: ../../library/datetime.rst:1870 +#: ../../library/datetime.rst:1931 msgid ":exc:`ValueError` will be raised on an invalid *timespec* argument." msgstr "" -#: ../../library/datetime.rst:1874 +#: ../../library/datetime.rst:1935 msgid "" ">>> from datetime import time\n" ">>> time(hour=12, minute=34, second=56, microsecond=123456)." @@ -2650,18 +2730,18 @@ msgstr "" ">>> dt.isoformat(timespec='auto')\n" "'12:34:56'" -#: ../../library/datetime.rst:1889 +#: ../../library/datetime.rst:1950 msgid "For a time *t*, ``str(t)`` is equivalent to ``t.isoformat()``." msgstr "" -#: ../../library/datetime.rst:1894 +#: ../../library/datetime.rst:1955 msgid "" "Return a string representing the time, controlled by an explicit format " "string. See also :ref:`strftime-strptime-behavior` and :meth:`time." "isoformat`." msgstr "" -#: ../../library/datetime.rst:1900 +#: ../../library/datetime.rst:1961 msgid "" "Same as :meth:`.time.strftime`. This makes it possible to specify a format " "string for a :class:`.time` object in :ref:`formatted string literals >> from datetime import time, tzinfo, timedelta\n" ">>> class TZ1(tzinfo):\n" @@ -2750,18 +2830,18 @@ msgstr "" ">>> 'The {} is {:%H:%M}.'.format(\"time\", t)\n" "'The time is 12:10.'" -#: ../../library/datetime.rst:1965 +#: ../../library/datetime.rst:2026 msgid ":class:`tzinfo` Objects" msgstr ":class:`tzinfo` 物件" -#: ../../library/datetime.rst:1969 +#: ../../library/datetime.rst:2030 msgid "" "This is an abstract base class, meaning that this class should not be " "instantiated directly. Define a subclass of :class:`tzinfo` to capture " "information about a particular time zone." msgstr "" -#: ../../library/datetime.rst:1973 +#: ../../library/datetime.rst:2034 msgid "" "An instance of (a concrete subclass of) :class:`tzinfo` can be passed to the " "constructors for :class:`.datetime` and :class:`.time` objects. The latter " @@ -2771,7 +2851,7 @@ msgid "" "object passed to them." msgstr "" -#: ../../library/datetime.rst:1979 +#: ../../library/datetime.rst:2040 msgid "" "You need to derive a concrete subclass, and (at least) supply " "implementations of the standard :class:`tzinfo` methods needed by the :class:" @@ -2781,7 +2861,7 @@ msgid "" "American EST and EDT." msgstr "" -#: ../../library/datetime.rst:1986 +#: ../../library/datetime.rst:2047 msgid "" "Special requirement for pickling: A :class:`tzinfo` subclass must have an :" "meth:`~object.__init__` method that can be called with no arguments, " @@ -2789,20 +2869,20 @@ msgid "" "technical requirement that may be relaxed in the future." msgstr "" -#: ../../library/datetime.rst:1992 +#: ../../library/datetime.rst:2053 msgid "" "A concrete subclass of :class:`tzinfo` may need to implement the following " "methods. Exactly which methods are needed depends on the uses made of aware :" "mod:`!datetime` objects. If in doubt, simply implement all of them." msgstr "" -#: ../../library/datetime.rst:1999 +#: ../../library/datetime.rst:2060 msgid "" "Return offset of local time from UTC, as a :class:`timedelta` object that is " "positive east of UTC. If local time is west of UTC, this should be negative." msgstr "" -#: ../../library/datetime.rst:2002 +#: ../../library/datetime.rst:2063 msgid "" "This represents the *total* offset from UTC; for example, if a :class:" "`tzinfo` object represents both time zone and DST adjustments, :meth:" @@ -2813,31 +2893,31 @@ msgid "" "meth:`utcoffset` will probably look like one of these two::" msgstr "" -#: ../../library/datetime.rst:2010 +#: ../../library/datetime.rst:2071 msgid "" "return CONSTANT # fixed-offset class\n" "return CONSTANT + self.dst(dt) # daylight-aware class" msgstr "" -#: ../../library/datetime.rst:2013 +#: ../../library/datetime.rst:2074 msgid "" "If :meth:`utcoffset` does not return ``None``, :meth:`dst` should not return " "``None`` either." msgstr "" -#: ../../library/datetime.rst:2016 +#: ../../library/datetime.rst:2077 msgid "" "The default implementation of :meth:`utcoffset` raises :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2025 +#: ../../library/datetime.rst:2086 msgid "" "Return the daylight saving time (DST) adjustment, as a :class:`timedelta` " "object or ``None`` if DST information isn't known." msgstr "" -#: ../../library/datetime.rst:2029 +#: ../../library/datetime.rst:2090 msgid "" "Return ``timedelta(0)`` if DST is not in effect. If DST is in effect, return " "the offset as a :class:`timedelta` object (see :meth:`utcoffset` for " @@ -2850,17 +2930,17 @@ msgid "" "to account for DST changes when crossing time zones." msgstr "" -#: ../../library/datetime.rst:2039 +#: ../../library/datetime.rst:2100 msgid "" "An instance *tz* of a :class:`tzinfo` subclass that models both standard and " "daylight times must be consistent in this sense:" msgstr "" -#: ../../library/datetime.rst:2042 +#: ../../library/datetime.rst:2103 msgid "``tz.utcoffset(dt) - tz.dst(dt)``" msgstr "``tz.utcoffset(dt) - tz.dst(dt)``" -#: ../../library/datetime.rst:2044 +#: ../../library/datetime.rst:2105 msgid "" "must return the same result for every :class:`.datetime` *dt* with ``dt." "tzinfo == tz``. For sane :class:`tzinfo` subclasses, this expression yields " @@ -2873,24 +2953,24 @@ msgid "" "astimezone` regardless." msgstr "" -#: ../../library/datetime.rst:2053 +#: ../../library/datetime.rst:2114 msgid "" "Most implementations of :meth:`dst` will probably look like one of these " "two::" msgstr "" -#: ../../library/datetime.rst:2055 +#: ../../library/datetime.rst:2116 msgid "" "def dst(self, dt):\n" " # a fixed-offset class: doesn't account for DST\n" " return timedelta(0)" msgstr "" -#: ../../library/datetime.rst:2059 +#: ../../library/datetime.rst:2120 msgid "or::" msgstr "或是: ::" -#: ../../library/datetime.rst:2061 +#: ../../library/datetime.rst:2122 msgid "" "def dst(self, dt):\n" " # Code to set dston and dstoff to the time zone's DST\n" @@ -2903,12 +2983,12 @@ msgid "" " return timedelta(0)" msgstr "" -#: ../../library/datetime.rst:2071 +#: ../../library/datetime.rst:2132 msgid "" "The default implementation of :meth:`dst` raises :exc:`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2079 +#: ../../library/datetime.rst:2140 msgid "" "Return the time zone name corresponding to the :class:`.datetime` object " "*dt*, as a string. Nothing about string names is defined by the :mod:`!" @@ -2922,13 +3002,13 @@ msgid "" "accounting for daylight time." msgstr "" -#: ../../library/datetime.rst:2089 +#: ../../library/datetime.rst:2150 msgid "" "The default implementation of :meth:`tzname` raises :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/datetime.rst:2092 +#: ../../library/datetime.rst:2153 msgid "" "These methods are called by a :class:`.datetime` or :class:`.time` object, " "in response to their methods of the same names. A :class:`.datetime` object " @@ -2938,7 +3018,7 @@ msgid "" "datetime`." msgstr "" -#: ../../library/datetime.rst:2098 +#: ../../library/datetime.rst:2159 msgid "" "When ``None`` is passed, it's up to the class designer to decide the best " "response. For example, returning ``None`` is appropriate if the class wishes " @@ -2947,7 +3027,7 @@ msgid "" "offset, as there is no other convention for discovering the standard offset." msgstr "" -#: ../../library/datetime.rst:2104 +#: ../../library/datetime.rst:2165 msgid "" "When a :class:`.datetime` object is passed in response to a :class:`." "datetime` method, ``dt.tzinfo`` is the same object as *self*. :class:" @@ -2957,13 +3037,13 @@ msgid "" "zones." msgstr "" -#: ../../library/datetime.rst:2110 +#: ../../library/datetime.rst:2171 msgid "" "There is one more :class:`tzinfo` method that a subclass may wish to " "override:" msgstr "" -#: ../../library/datetime.rst:2115 +#: ../../library/datetime.rst:2176 msgid "" "This is called from the default :meth:`datetime.astimezone` implementation. " "When called from that, ``dt.tzinfo`` is *self*, and *dt*'s date and time " @@ -2972,7 +3052,7 @@ msgid "" "datetime in *self*'s local time." msgstr "" -#: ../../library/datetime.rst:2121 +#: ../../library/datetime.rst:2182 msgid "" "Most :class:`tzinfo` subclasses should be able to inherit the default :meth:" "`fromutc` implementation without problems. It's strong enough to handle " @@ -2987,13 +3067,13 @@ msgid "" "offset changes." msgstr "" -#: ../../library/datetime.rst:2132 +#: ../../library/datetime.rst:2193 msgid "" "Skipping code for error cases, the default :meth:`fromutc` implementation " "acts like::" msgstr "" -#: ../../library/datetime.rst:2135 +#: ../../library/datetime.rst:2196 msgid "" "def fromutc(self, dt):\n" " # raise ValueError error if dt.tzinfo is not self\n" @@ -3011,13 +3091,13 @@ msgid "" " return dt" msgstr "" -#: ../../library/datetime.rst:2150 +#: ../../library/datetime.rst:2211 msgid "" "In the following :download:`tzinfo_examples.py <../includes/tzinfo_examples." "py>` file there are some examples of :class:`tzinfo` classes:" msgstr "" -#: ../../library/datetime.rst:2154 +#: ../../library/datetime.rst:2215 msgid "" "from datetime import tzinfo, timedelta, datetime\n" "\n" @@ -3197,7 +3277,7 @@ msgid "" "Pacific = USTimeZone(-8, \"Pacific\", \"PST\", \"PDT\")\n" msgstr "" -#: ../../library/datetime.rst:2156 +#: ../../library/datetime.rst:2217 msgid "" "Note that there are unavoidable subtleties twice per year in a :class:" "`tzinfo` subclass accounting for both standard and daylight time, at the DST " @@ -3206,7 +3286,7 @@ msgid "" "ends the minute after 1:59 (EDT) on the first Sunday in November::" msgstr "" -#: ../../library/datetime.rst:2162 +#: ../../library/datetime.rst:2223 msgid "" " UTC 3:MM 4:MM 5:MM 6:MM 7:MM 8:MM\n" " EST 22:MM 23:MM 0:MM 1:MM 2:MM 3:MM\n" @@ -3224,7 +3304,7 @@ msgstr "" "\n" " end 23:MM 0:MM 1:MM 1:MM 2:MM 3:MM" -#: ../../library/datetime.rst:2170 +#: ../../library/datetime.rst:2231 msgid "" "When DST starts (the \"start\" line), the local wall clock leaps from 1:59 " "to 3:00. A wall time of the form 2:MM doesn't really make sense on that day, " @@ -3233,7 +3313,7 @@ msgid "" "get::" msgstr "" -#: ../../library/datetime.rst:2175 +#: ../../library/datetime.rst:2236 msgid "" ">>> from datetime import datetime, timezone\n" ">>> from tzinfo_examples import HOUR, Eastern\n" @@ -3261,7 +3341,7 @@ msgstr "" "07:00:00 UTC = 03:00:00 EDT\n" "08:00:00 UTC = 04:00:00 EDT" -#: ../../library/datetime.rst:2189 +#: ../../library/datetime.rst:2250 msgid "" "When DST ends (the \"end\" line), there's a potentially worse problem: " "there's an hour that can't be spelled unambiguously in local wall time: the " @@ -3276,7 +3356,7 @@ msgid "" "Fall back transition of 2016, we get::" msgstr "" -#: ../../library/datetime.rst:2200 +#: ../../library/datetime.rst:2261 msgid "" ">>> u0 = datetime(2016, 11, 6, 4, tzinfo=timezone.utc)\n" ">>> for i in range(4):\n" @@ -3300,13 +3380,13 @@ msgstr "" "06:00:00 UTC = 01:00:00 EST 1\n" "07:00:00 UTC = 02:00:00 EST 0" -#: ../../library/datetime.rst:2211 +#: ../../library/datetime.rst:2272 msgid "" "Note that the :class:`.datetime` instances that differ only by the value of " "the :attr:`~.datetime.fold` attribute are considered equal in comparisons." msgstr "" -#: ../../library/datetime.rst:2214 +#: ../../library/datetime.rst:2275 msgid "" "Applications that can't bear wall-time ambiguities should explicitly check " "the value of the :attr:`~.datetime.fold` attribute or avoid using hybrid :" @@ -3316,28 +3396,28 @@ msgid "" "offset -4 hours))." msgstr "" -#: ../../library/datetime.rst:2222 +#: ../../library/datetime.rst:2283 msgid ":mod:`zoneinfo`" msgstr ":mod:`zoneinfo`" -#: ../../library/datetime.rst:2223 +#: ../../library/datetime.rst:2284 msgid "" "The :mod:`!datetime` module has a basic :class:`timezone` class (for " "handling arbitrary fixed offsets from UTC) and its :attr:`timezone.utc` " "attribute (a UTC :class:`!timezone` instance)." msgstr "" -#: ../../library/datetime.rst:2227 +#: ../../library/datetime.rst:2288 msgid "" "``zoneinfo`` brings the *IANA time zone database* (also known as the Olson " "database) to Python, and its usage is recommended." msgstr "" -#: ../../library/datetime.rst:2230 +#: ../../library/datetime.rst:2291 msgid "`IANA time zone database `_" msgstr "`IANA 時區資料庫 `_" -#: ../../library/datetime.rst:2231 +#: ../../library/datetime.rst:2292 msgid "" "The Time Zone Database (often called tz, tzdata or zoneinfo) contains code " "and data that represent the history of local time for many representative " @@ -3346,24 +3426,24 @@ msgid "" "saving rules." msgstr "" -#: ../../library/datetime.rst:2241 +#: ../../library/datetime.rst:2302 msgid ":class:`timezone` Objects" msgstr ":class:`timezone` 物件" -#: ../../library/datetime.rst:2243 +#: ../../library/datetime.rst:2304 msgid "" "The :class:`timezone` class is a subclass of :class:`tzinfo`, each instance " "of which represents a time zone defined by a fixed offset from UTC." msgstr "" -#: ../../library/datetime.rst:2247 +#: ../../library/datetime.rst:2308 msgid "" "Objects of this class cannot be used to represent time zone information in " "the locations where different offsets are used in different days of the year " "or where historical changes have been made to civil time." msgstr "" -#: ../../library/datetime.rst:2254 +#: ../../library/datetime.rst:2315 msgid "" "The *offset* argument must be specified as a :class:`timedelta` object " "representing the difference between the local time and UTC. It must be " @@ -3371,25 +3451,25 @@ msgid "" "otherwise :exc:`ValueError` is raised." msgstr "" -#: ../../library/datetime.rst:2259 +#: ../../library/datetime.rst:2320 msgid "" "The *name* argument is optional. If specified it must be a string that will " "be used as the value returned by the :meth:`datetime.tzname` method." msgstr "" -#: ../../library/datetime.rst:2270 ../../library/datetime.rst:2281 +#: ../../library/datetime.rst:2331 ../../library/datetime.rst:2342 msgid "" "Return the fixed value specified when the :class:`timezone` instance is " "constructed." msgstr "" -#: ../../library/datetime.rst:2273 +#: ../../library/datetime.rst:2334 msgid "" "The *dt* argument is ignored. The return value is a :class:`timedelta` " "instance equal to the difference between the local time and UTC." msgstr "" -#: ../../library/datetime.rst:2284 +#: ../../library/datetime.rst:2345 msgid "" "If *name* is not provided in the constructor, the name returned by " "``tzname(dt)`` is generated from the value of the ``offset`` as follows. If " @@ -3398,119 +3478,119 @@ msgid "" "are two digits of ``offset.hours`` and ``offset.minutes`` respectively." msgstr "" -#: ../../library/datetime.rst:2290 +#: ../../library/datetime.rst:2351 msgid "" "Name generated from ``offset=timedelta(0)`` is now plain ``'UTC'``, not " "``'UTC+00:00'``." msgstr "" -#: ../../library/datetime.rst:2297 +#: ../../library/datetime.rst:2358 msgid "Always returns ``None``." msgstr "總是回傳 ``None``。" -#: ../../library/datetime.rst:2301 +#: ../../library/datetime.rst:2362 msgid "" "Return ``dt + offset``. The *dt* argument must be an aware :class:`." "datetime` instance, with ``tzinfo`` set to ``self``." msgstr "" -#: ../../library/datetime.rst:2308 +#: ../../library/datetime.rst:2369 msgid "The UTC time zone, ``timezone(timedelta(0))``." msgstr "UTC 時區,``timezone(timedelta(0))``。" -#: ../../library/datetime.rst:2317 +#: ../../library/datetime.rst:2378 msgid ":meth:`~.datetime.strftime` and :meth:`~.datetime.strptime` Behavior" msgstr ":meth:`~.datetime.strftime` 與 :meth:`~.datetime.strptime` 的行為" -#: ../../library/datetime.rst:2319 +#: ../../library/datetime.rst:2380 msgid "" ":class:`date`, :class:`.datetime`, and :class:`.time` objects all support a " "``strftime(format)`` method, to create a string representing the time under " "the control of an explicit format string." msgstr "" -#: ../../library/datetime.rst:2323 +#: ../../library/datetime.rst:2384 msgid "" "Conversely, the :meth:`datetime.strptime` class method creates a :class:`." "datetime` object from a string representing a date and time and a " "corresponding format string." msgstr "" -#: ../../library/datetime.rst:2327 +#: ../../library/datetime.rst:2388 msgid "" "The table below provides a high-level comparison of :meth:`~.datetime." "strftime` versus :meth:`~.datetime.strptime`:" msgstr "" -#: ../../library/datetime.rst:2331 +#: ../../library/datetime.rst:2392 msgid "``strftime``" msgstr "``strftime``" -#: ../../library/datetime.rst:2331 +#: ../../library/datetime.rst:2392 msgid "``strptime``" msgstr "``strptime``" -#: ../../library/datetime.rst:2333 +#: ../../library/datetime.rst:2394 msgid "Usage" msgstr "用法" -#: ../../library/datetime.rst:2333 +#: ../../library/datetime.rst:2394 msgid "Convert object to a string according to a given format" msgstr "" -#: ../../library/datetime.rst:2333 +#: ../../library/datetime.rst:2394 msgid "" "Parse a string into a :class:`.datetime` object given a corresponding format" msgstr "" -#: ../../library/datetime.rst:2335 +#: ../../library/datetime.rst:2396 msgid "Type of method" msgstr "" -#: ../../library/datetime.rst:2335 +#: ../../library/datetime.rst:2396 msgid "Instance method" msgstr "實例方法" -#: ../../library/datetime.rst:2335 +#: ../../library/datetime.rst:2396 msgid "Class method" msgstr "類別方法" -#: ../../library/datetime.rst:2337 +#: ../../library/datetime.rst:2398 msgid "Method of" msgstr "" -#: ../../library/datetime.rst:2337 +#: ../../library/datetime.rst:2398 msgid ":class:`date`; :class:`.datetime`; :class:`.time`" msgstr ":class:`date`; :class:`.datetime`; :class:`.time`" -#: ../../library/datetime.rst:2337 +#: ../../library/datetime.rst:2398 msgid ":class:`.datetime`" msgstr ":class:`.datetime`" -#: ../../library/datetime.rst:2339 +#: ../../library/datetime.rst:2400 msgid "Signature" msgstr "" -#: ../../library/datetime.rst:2339 +#: ../../library/datetime.rst:2400 msgid "``strftime(format)``" msgstr "``strftime(format)``" -#: ../../library/datetime.rst:2339 +#: ../../library/datetime.rst:2400 msgid "``strptime(date_string, format)``" msgstr "``strptime(date_string, format)``" -#: ../../library/datetime.rst:2346 +#: ../../library/datetime.rst:2407 msgid "" ":meth:`~.datetime.strftime` and :meth:`~.datetime.strptime` Format Codes" msgstr ":meth:`~.datetime.strftime` 與 :meth:`~.datetime.strptime` 格式碼" -#: ../../library/datetime.rst:2348 +#: ../../library/datetime.rst:2409 msgid "" "These methods accept format codes that can be used to parse and format " "dates::" msgstr "" -#: ../../library/datetime.rst:2350 +#: ../../library/datetime.rst:2411 msgid "" ">>> datetime.strptime('31/01/22 23:59:59.999999',\n" "... '%d/%m/%y %H:%M:%S.%f')\n" @@ -3524,33 +3604,33 @@ msgstr "" ">>> _.strftime('%a %d %b %Y, %I:%M%p')\n" "'Mon 31 Jan 2022, 11:59PM'" -#: ../../library/datetime.rst:2356 +#: ../../library/datetime.rst:2417 msgid "" "The following is a list of all the format codes that the 1989 C standard " "requires, and these work on all platforms with a standard C implementation." msgstr "" -#: ../../library/datetime.rst:2360 ../../library/datetime.rst:2463 +#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 msgid "Directive" msgstr "" -#: ../../library/datetime.rst:2360 ../../library/datetime.rst:2463 +#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 msgid "Meaning" msgstr "含義" -#: ../../library/datetime.rst:2360 ../../library/datetime.rst:2463 +#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 msgid "Example" msgstr "範例" -#: ../../library/datetime.rst:2360 ../../library/datetime.rst:2463 +#: ../../library/datetime.rst:2421 ../../library/datetime.rst:2524 msgid "Notes" msgstr "註解" -#: ../../library/datetime.rst:2362 +#: ../../library/datetime.rst:2423 msgid "``%a``" msgstr "``%a``" -#: ../../library/datetime.rst:2362 +#: ../../library/datetime.rst:2423 msgid "Weekday as locale's abbreviated name." msgstr "" @@ -3562,11 +3642,11 @@ msgstr "" msgid "So, Mo, ..., Sa (de_DE)" msgstr "" -#: ../../library/datetime.rst:2367 +#: ../../library/datetime.rst:2428 msgid "``%A``" msgstr "``%A``" -#: ../../library/datetime.rst:2367 +#: ../../library/datetime.rst:2428 msgid "Weekday as locale's full name." msgstr "" @@ -3578,42 +3658,42 @@ msgstr "" msgid "Sonntag, Montag, ..., Samstag (de_DE)" msgstr "" -#: ../../library/datetime.rst:2372 +#: ../../library/datetime.rst:2433 msgid "``%w``" msgstr "``%w``" -#: ../../library/datetime.rst:2372 +#: ../../library/datetime.rst:2433 msgid "Weekday as a decimal number, where 0 is Sunday and 6 is Saturday." msgstr "" -#: ../../library/datetime.rst:2372 +#: ../../library/datetime.rst:2433 msgid "0, 1, ..., 6" msgstr "0, 1, ..., 6" -#: ../../library/datetime.rst:2376 +#: ../../library/datetime.rst:2437 msgid "``%d``" msgstr "``%d``" -#: ../../library/datetime.rst:2376 +#: ../../library/datetime.rst:2437 msgid "Day of the month as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2376 +#: ../../library/datetime.rst:2437 msgid "01, 02, ..., 31" msgstr "01, 02, ..., 31" -#: ../../library/datetime.rst:2376 ../../library/datetime.rst:2389 -#: ../../library/datetime.rst:2392 ../../library/datetime.rst:2398 -#: ../../library/datetime.rst:2401 ../../library/datetime.rst:2407 -#: ../../library/datetime.rst:2425 +#: ../../library/datetime.rst:2437 ../../library/datetime.rst:2450 +#: ../../library/datetime.rst:2453 ../../library/datetime.rst:2459 +#: ../../library/datetime.rst:2462 ../../library/datetime.rst:2468 +#: ../../library/datetime.rst:2486 msgid "\\(9)" msgstr "\\(9)" -#: ../../library/datetime.rst:2379 +#: ../../library/datetime.rst:2440 msgid "``%b``" msgstr "``%b``" -#: ../../library/datetime.rst:2379 +#: ../../library/datetime.rst:2440 msgid "Month as locale's abbreviated name." msgstr "" @@ -3625,11 +3705,11 @@ msgstr "" msgid "Jan, Feb, ..., Dez (de_DE)" msgstr "" -#: ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2445 msgid "``%B``" msgstr "``%B``" -#: ../../library/datetime.rst:2384 +#: ../../library/datetime.rst:2445 msgid "Month as locale's full name." msgstr "" @@ -3641,67 +3721,67 @@ msgstr "" msgid "Januar, Februar, ..., Dezember (de_DE)" msgstr "" -#: ../../library/datetime.rst:2389 +#: ../../library/datetime.rst:2450 msgid "``%m``" msgstr "``%m``" -#: ../../library/datetime.rst:2389 +#: ../../library/datetime.rst:2450 msgid "Month as a zero-padded decimal number." msgstr "以零填充的並以十進位數字表示的月份。" -#: ../../library/datetime.rst:2389 ../../library/datetime.rst:2401 +#: ../../library/datetime.rst:2450 ../../library/datetime.rst:2462 msgid "01, 02, ..., 12" msgstr "01, 02, ..., 12" -#: ../../library/datetime.rst:2392 +#: ../../library/datetime.rst:2453 msgid "``%y``" msgstr "``%y``" -#: ../../library/datetime.rst:2392 +#: ../../library/datetime.rst:2453 msgid "Year without century as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2392 +#: ../../library/datetime.rst:2453 msgid "00, 01, ..., 99" msgstr "00, 01, ..., 99" -#: ../../library/datetime.rst:2395 +#: ../../library/datetime.rst:2456 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/datetime.rst:2395 +#: ../../library/datetime.rst:2456 msgid "Year with century as a decimal number." msgstr "" -#: ../../library/datetime.rst:2395 ../../library/datetime.rst:2465 +#: ../../library/datetime.rst:2456 ../../library/datetime.rst:2526 msgid "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" msgstr "0001, 0002, ..., 2013, 2014, ..., 9998, 9999" -#: ../../library/datetime.rst:2398 +#: ../../library/datetime.rst:2459 msgid "``%H``" msgstr "``%H``" -#: ../../library/datetime.rst:2398 +#: ../../library/datetime.rst:2459 msgid "Hour (24-hour clock) as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2398 +#: ../../library/datetime.rst:2459 msgid "00, 01, ..., 23" msgstr "00, 01, ..., 23" -#: ../../library/datetime.rst:2401 +#: ../../library/datetime.rst:2462 msgid "``%I``" msgstr "``%I``" -#: ../../library/datetime.rst:2401 +#: ../../library/datetime.rst:2462 msgid "Hour (12-hour clock) as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2404 +#: ../../library/datetime.rst:2465 msgid "``%p``" msgstr "``%p``" -#: ../../library/datetime.rst:2404 +#: ../../library/datetime.rst:2465 msgid "Locale's equivalent of either AM or PM." msgstr "" @@ -3713,128 +3793,128 @@ msgstr "AM, PM (en_US);" msgid "am, pm (de_DE)" msgstr "am, pm (de_DE)" -#: ../../library/datetime.rst:2404 +#: ../../library/datetime.rst:2465 msgid "\\(1), \\(3)" msgstr "\\(1), \\(3)" -#: ../../library/datetime.rst:2407 +#: ../../library/datetime.rst:2468 msgid "``%M``" msgstr "``%M``" -#: ../../library/datetime.rst:2407 +#: ../../library/datetime.rst:2468 msgid "Minute as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2407 ../../library/datetime.rst:2410 +#: ../../library/datetime.rst:2468 ../../library/datetime.rst:2471 msgid "00, 01, ..., 59" msgstr "00, 01, ..., 59" -#: ../../library/datetime.rst:2410 +#: ../../library/datetime.rst:2471 msgid "``%S``" msgstr "``%S``" -#: ../../library/datetime.rst:2410 +#: ../../library/datetime.rst:2471 msgid "Second as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2410 +#: ../../library/datetime.rst:2471 msgid "\\(4), \\(9)" msgstr "\\(4), \\(9)" -#: ../../library/datetime.rst:2413 +#: ../../library/datetime.rst:2474 msgid "``%f``" msgstr "``%f``" -#: ../../library/datetime.rst:2413 +#: ../../library/datetime.rst:2474 msgid "Microsecond as a decimal number, zero-padded to 6 digits." msgstr "" -#: ../../library/datetime.rst:2413 +#: ../../library/datetime.rst:2474 msgid "000000, 000001, ..., 999999" msgstr "000000, 000001, ..., 999999" -#: ../../library/datetime.rst:2413 +#: ../../library/datetime.rst:2474 msgid "\\(5)" msgstr "\\(5)" -#: ../../library/datetime.rst:2417 ../../library/datetime.rst:2576 +#: ../../library/datetime.rst:2478 ../../library/datetime.rst:2637 msgid "``%z``" msgstr "``%z``" -#: ../../library/datetime.rst:2417 +#: ../../library/datetime.rst:2478 msgid "" "UTC offset in the form ``±HHMM[SS[.ffffff]]`` (empty string if the object is " "naive)." msgstr "" -#: ../../library/datetime.rst:2417 +#: ../../library/datetime.rst:2478 msgid "(empty), +0000, -0400, +1030, +063415, -030712.345216" msgstr "" -#: ../../library/datetime.rst:2417 ../../library/datetime.rst:2422 -#: ../../library/datetime.rst:2479 +#: ../../library/datetime.rst:2478 ../../library/datetime.rst:2483 +#: ../../library/datetime.rst:2540 msgid "\\(6)" msgstr "\\(6)" -#: ../../library/datetime.rst:2422 ../../library/datetime.rst:2602 +#: ../../library/datetime.rst:2483 ../../library/datetime.rst:2663 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/datetime.rst:2422 +#: ../../library/datetime.rst:2483 msgid "Time zone name (empty string if the object is naive)." msgstr "" -#: ../../library/datetime.rst:2422 +#: ../../library/datetime.rst:2483 msgid "(empty), UTC, GMT" msgstr "" -#: ../../library/datetime.rst:2425 +#: ../../library/datetime.rst:2486 msgid "``%j``" msgstr "``%j``" -#: ../../library/datetime.rst:2425 +#: ../../library/datetime.rst:2486 msgid "Day of the year as a zero-padded decimal number." msgstr "" -#: ../../library/datetime.rst:2425 +#: ../../library/datetime.rst:2486 msgid "001, 002, ..., 366" msgstr "001, 002, ..., 366" -#: ../../library/datetime.rst:2428 +#: ../../library/datetime.rst:2489 msgid "``%U``" msgstr "``%U``" -#: ../../library/datetime.rst:2428 +#: ../../library/datetime.rst:2489 msgid "" "Week number of the year (Sunday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Sunday are " "considered to be in week 0." msgstr "" -#: ../../library/datetime.rst:2428 ../../library/datetime.rst:2436 +#: ../../library/datetime.rst:2489 ../../library/datetime.rst:2497 msgid "00, 01, ..., 53" msgstr "00, 01, ..., 53" -#: ../../library/datetime.rst:2428 ../../library/datetime.rst:2436 +#: ../../library/datetime.rst:2489 ../../library/datetime.rst:2497 msgid "\\(7), \\(9)" msgstr "\\(7), \\(9)" -#: ../../library/datetime.rst:2436 +#: ../../library/datetime.rst:2497 msgid "``%W``" msgstr "``%W``" -#: ../../library/datetime.rst:2436 +#: ../../library/datetime.rst:2497 msgid "" "Week number of the year (Monday as the first day of the week) as a zero-" "padded decimal number. All days in a new year preceding the first Monday are " "considered to be in week 0." msgstr "" -#: ../../library/datetime.rst:2444 +#: ../../library/datetime.rst:2505 msgid "``%c``" msgstr "``%c``" -#: ../../library/datetime.rst:2444 +#: ../../library/datetime.rst:2505 msgid "Locale's appropriate date and time representation." msgstr "" @@ -3846,11 +3926,11 @@ msgstr "" msgid "Di 16 Aug 21:30:00 1988 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2449 +#: ../../library/datetime.rst:2510 msgid "``%x``" msgstr "``%x``" -#: ../../library/datetime.rst:2449 +#: ../../library/datetime.rst:2510 msgid "Locale's appropriate date representation." msgstr "" @@ -3866,11 +3946,11 @@ msgstr "" msgid "16.08.1988 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2453 +#: ../../library/datetime.rst:2514 msgid "``%X``" msgstr "``%X``" -#: ../../library/datetime.rst:2453 +#: ../../library/datetime.rst:2514 msgid "Locale's appropriate time representation." msgstr "" @@ -3882,83 +3962,83 @@ msgstr "" msgid "21:30:00 (de_DE)" msgstr "" -#: ../../library/datetime.rst:2456 +#: ../../library/datetime.rst:2517 msgid "``%%``" msgstr "``%%``" -#: ../../library/datetime.rst:2456 +#: ../../library/datetime.rst:2517 msgid "A literal ``'%'`` character." msgstr "" -#: ../../library/datetime.rst:2456 +#: ../../library/datetime.rst:2517 msgid "%" msgstr "%" -#: ../../library/datetime.rst:2459 +#: ../../library/datetime.rst:2520 msgid "" "Several additional directives not required by the C89 standard are included " "for convenience. These parameters all correspond to ISO 8601 date values." msgstr "" -#: ../../library/datetime.rst:2465 +#: ../../library/datetime.rst:2526 msgid "``%G``" msgstr "``%G``" -#: ../../library/datetime.rst:2465 +#: ../../library/datetime.rst:2526 msgid "" "ISO 8601 year with century representing the year that contains the greater " "part of the ISO week (``%V``)." msgstr "" -#: ../../library/datetime.rst:2465 +#: ../../library/datetime.rst:2526 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/datetime.rst:2470 +#: ../../library/datetime.rst:2531 msgid "``%u``" msgstr "``%u``" -#: ../../library/datetime.rst:2470 +#: ../../library/datetime.rst:2531 msgid "ISO 8601 weekday as a decimal number where 1 is Monday." msgstr "" -#: ../../library/datetime.rst:2470 +#: ../../library/datetime.rst:2531 msgid "1, 2, ..., 7" msgstr "1, 2, ..., 7" -#: ../../library/datetime.rst:2473 +#: ../../library/datetime.rst:2534 msgid "``%V``" msgstr "``%V``" -#: ../../library/datetime.rst:2473 +#: ../../library/datetime.rst:2534 msgid "" "ISO 8601 week as a decimal number with Monday as the first day of the week. " "Week 01 is the week containing Jan 4." msgstr "" -#: ../../library/datetime.rst:2473 +#: ../../library/datetime.rst:2534 msgid "01, 02, ..., 53" msgstr "01, 02, ..., 53" -#: ../../library/datetime.rst:2473 +#: ../../library/datetime.rst:2534 msgid "\\(8), \\(9)" msgstr "\\(8), \\(9)" -#: ../../library/datetime.rst:2479 ../../library/datetime.rst:2598 +#: ../../library/datetime.rst:2540 ../../library/datetime.rst:2659 msgid "``%:z``" msgstr "``%:z``" -#: ../../library/datetime.rst:2479 +#: ../../library/datetime.rst:2540 msgid "" "UTC offset in the form ``±HH:MM[:SS[.ffffff]]`` (empty string if the object " "is naive)." msgstr "" -#: ../../library/datetime.rst:2479 +#: ../../library/datetime.rst:2540 msgid "(empty), +00:00, -04:00, +10:30, +06:34:15, -03:07:12.345216" msgstr "" -#: ../../library/datetime.rst:2485 +#: ../../library/datetime.rst:2546 msgid "" "These may not be available on all platforms when used with the :meth:`~." "datetime.strftime` method. The ISO 8601 year and ISO 8601 week directives " @@ -3967,7 +4047,7 @@ msgid "" "directives will raise a :exc:`ValueError`." msgstr "" -#: ../../library/datetime.rst:2490 +#: ../../library/datetime.rst:2551 msgid "" "The full set of format codes supported varies across platforms, because " "Python calls the platform C library's :c:func:`strftime` function, and " @@ -3977,44 +4057,44 @@ msgid "" "unsupported format specifiers." msgstr "" -#: ../../library/datetime.rst:2496 +#: ../../library/datetime.rst:2557 msgid "``%G``, ``%u`` and ``%V`` were added." msgstr "新增 ``%G``、``%u`` 與 ``%V``。" -#: ../../library/datetime.rst:2499 +#: ../../library/datetime.rst:2560 msgid "``%:z`` was added." msgstr "新增 ``%:z``。" -#: ../../library/datetime.rst:2503 +#: ../../library/datetime.rst:2564 msgid "Technical Detail" msgstr "技術細節" -#: ../../library/datetime.rst:2505 +#: ../../library/datetime.rst:2566 msgid "" "Broadly speaking, ``d.strftime(fmt)`` acts like the :mod:`time` module's " "``time.strftime(fmt, d.timetuple())`` although not all objects support a :" "meth:`~date.timetuple` method." msgstr "" -#: ../../library/datetime.rst:2509 +#: ../../library/datetime.rst:2570 msgid "" "For the :meth:`.datetime.strptime` class method, the default value is " "``1900-01-01T00:00:00.000``: any components not specified in the format " "string will be pulled from the default value. [#]_" msgstr "" -#: ../../library/datetime.rst:2513 +#: ../../library/datetime.rst:2574 msgid "Using ``datetime.strptime(date_string, format)`` is equivalent to::" msgstr "" -#: ../../library/datetime.rst:2517 +#: ../../library/datetime.rst:2578 msgid "" "except when the format includes sub-second components or time zone offset " "information, which are supported in ``datetime.strptime`` but are discarded " "by ``time.strptime``." msgstr "" -#: ../../library/datetime.rst:2521 +#: ../../library/datetime.rst:2582 msgid "" "For :class:`.time` objects, the format codes for year, month, and day should " "not be used, as :class:`!time` objects have no such values. If they're used " @@ -4024,7 +4104,7 @@ msgstr "" "time` 物件並沒有這些值。如果使用這些格式碼,年份會以 1900 代替、月及日會以 1 " "代替。" -#: ../../library/datetime.rst:2525 +#: ../../library/datetime.rst:2586 msgid "" "For :class:`date` objects, the format codes for hours, minutes, seconds, and " "microseconds should not be used, as :class:`date` objects have no such " @@ -4033,7 +4113,7 @@ msgstr "" "對 :class:`.date` 物件來說,不應該使用時、分、秒、微秒的格式碼,因為 :class:" "`date` 物件並沒有這些值。如果使用這些格式碼,這些值都會以 0 代替。" -#: ../../library/datetime.rst:2529 +#: ../../library/datetime.rst:2590 msgid "" "For the same reason, handling of format strings containing Unicode code " "points that can't be represented in the charset of the current locale is " @@ -4042,7 +4122,7 @@ msgid "" "`UnicodeError` or return an empty string instead." msgstr "" -#: ../../library/datetime.rst:2538 +#: ../../library/datetime.rst:2599 msgid "" "Because the format depends on the current locale, care should be taken when " "making assumptions about the output value. Field orderings will vary (for " @@ -4050,38 +4130,38 @@ msgid "" "contain non-ASCII characters." msgstr "" -#: ../../library/datetime.rst:2544 +#: ../../library/datetime.rst:2605 msgid "" "The :meth:`~.datetime.strptime` method can parse years in the full [1, 9999] " "range, but years < 1000 must be zero-filled to 4-digit width." msgstr "" -#: ../../library/datetime.rst:2547 +#: ../../library/datetime.rst:2608 msgid "" "In previous versions, :meth:`~.datetime.strftime` method was restricted to " "years >= 1900." msgstr "" -#: ../../library/datetime.rst:2551 +#: ../../library/datetime.rst:2612 msgid "" "In version 3.2, :meth:`~.datetime.strftime` method was restricted to years " ">= 1000." msgstr "" -#: ../../library/datetime.rst:2556 +#: ../../library/datetime.rst:2617 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%p`` directive " "only affects the output hour field if the ``%I`` directive is used to parse " "the hour." msgstr "" -#: ../../library/datetime.rst:2560 +#: ../../library/datetime.rst:2621 msgid "" "Unlike the :mod:`time` module, the :mod:`!datetime` module does not support " "leap seconds." msgstr "" -#: ../../library/datetime.rst:2564 +#: ../../library/datetime.rst:2625 msgid "" "When used with the :meth:`~.datetime.strptime` method, the ``%f`` directive " "accepts from one to six digits and zero pads on the right. ``%f`` is an " @@ -4089,17 +4169,17 @@ msgid "" "separately in datetime objects, and therefore always available)." msgstr "" -#: ../../library/datetime.rst:2571 +#: ../../library/datetime.rst:2632 msgid "" "For a naive object, the ``%z``, ``%:z`` and ``%Z`` format codes are replaced " "by empty strings." msgstr "" -#: ../../library/datetime.rst:2574 +#: ../../library/datetime.rst:2635 msgid "For an aware object:" msgstr "" -#: ../../library/datetime.rst:2577 +#: ../../library/datetime.rst:2638 msgid "" ":meth:`~.datetime.utcoffset` is transformed into a string of the form " "``±HHMM[SS[.ffffff]]``, where ``HH`` is a 2-digit string giving the number " @@ -4113,7 +4193,7 @@ msgid "" "replaced with the string ``'-0330'``." msgstr "" -#: ../../library/datetime.rst:2591 +#: ../../library/datetime.rst:2652 msgid "" "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " "method, the UTC offsets can have a colon as a separator between hours, " @@ -4122,53 +4202,53 @@ msgid "" "``'+00:00'``." msgstr "" -#: ../../library/datetime.rst:2599 +#: ../../library/datetime.rst:2660 msgid "" "Behaves exactly as ``%z``, but has a colon separator added between hours, " "minutes and seconds." msgstr "" -#: ../../library/datetime.rst:2603 +#: ../../library/datetime.rst:2664 msgid "" "In :meth:`~.datetime.strftime`, ``%Z`` is replaced by an empty string if :" "meth:`~.datetime.tzname` returns ``None``; otherwise ``%Z`` is replaced by " "the returned value, which must be a string." msgstr "" -#: ../../library/datetime.rst:2607 +#: ../../library/datetime.rst:2668 msgid ":meth:`~.datetime.strptime` only accepts certain values for ``%Z``:" msgstr "" -#: ../../library/datetime.rst:2609 +#: ../../library/datetime.rst:2670 msgid "any value in ``time.tzname`` for your machine's locale" msgstr "" -#: ../../library/datetime.rst:2610 +#: ../../library/datetime.rst:2671 msgid "the hard-coded values ``UTC`` and ``GMT``" msgstr "" -#: ../../library/datetime.rst:2612 +#: ../../library/datetime.rst:2673 msgid "" "So someone living in Japan may have ``JST``, ``UTC``, and ``GMT`` as valid " "values, but probably not ``EST``. It will raise ``ValueError`` for invalid " "values." msgstr "" -#: ../../library/datetime.rst:2616 +#: ../../library/datetime.rst:2677 msgid "" "When the ``%z`` directive is provided to the :meth:`~.datetime.strptime` " "method, an aware :class:`.datetime` object will be produced. The ``tzinfo`` " "of the result will be set to a :class:`timezone` instance." msgstr "" -#: ../../library/datetime.rst:2622 +#: ../../library/datetime.rst:2683 msgid "" "When used with the :meth:`~.datetime.strptime` method, ``%U`` and ``%W`` are " "only used in calculations when the day of the week and the calendar year " "(``%Y``) are specified." msgstr "" -#: ../../library/datetime.rst:2627 +#: ../../library/datetime.rst:2688 msgid "" "Similar to ``%U`` and ``%W``, ``%V`` is only used in calculations when the " "day of the week and the ISO year (``%G``) are specified in a :meth:`~." @@ -4176,7 +4256,7 @@ msgid "" "interchangeable." msgstr "" -#: ../../library/datetime.rst:2633 +#: ../../library/datetime.rst:2694 msgid "" "When used with the :meth:`~.datetime.strptime` method, the leading zero is " "optional for formats ``%d``, ``%m``, ``%H``, ``%I``, ``%M``, ``%S``, " @@ -4184,15 +4264,40 @@ msgid "" "zero." msgstr "" -#: ../../library/datetime.rst:2638 +#: ../../library/datetime.rst:2699 +msgid "" +"When parsing a month and day using :meth:`~.datetime.strptime`, always " +"include a year in the format. If the value you need to parse lacks a year, " +"append an explicit dummy leap year. Otherwise your code will raise an " +"exception when it encounters leap day because the default year used by the " +"parser is not a leap year. Users run into this bug every four years..." +msgstr "" + +#: ../../library/datetime.rst:2705 +msgid "" +">>> month_day = \"02/29\"\n" +">>> datetime.strptime(f\"{month_day};1984\", \"%m/%d;%Y\") # No leap year " +"bug.\n" +"datetime.datetime(1984, 2, 29, 0, 0)" +msgstr "" + +#: ../../library/datetime.rst:2711 +msgid "" +":meth:`~.datetime.strptime` calls using a format string containing a day of " +"month without a year now emit a :exc:`DeprecationWarning`. In 3.15 or later " +"we may change this into an error or change the default year to a leap year. " +"See :gh:`70647`." +msgstr "" + +#: ../../library/datetime.rst:2718 msgid "Footnotes" msgstr "註解" -#: ../../library/datetime.rst:2639 +#: ../../library/datetime.rst:2719 msgid "If, that is, we ignore the effects of Relativity" msgstr "也就是說,我們會忽略相對論的效應" -#: ../../library/datetime.rst:2641 +#: ../../library/datetime.rst:2721 msgid "" "This matches the definition of the \"proleptic Gregorian\" calendar in " "Dershowitz and Reingold's book *Calendrical Calculations*, where it's the " @@ -4201,23 +4306,23 @@ msgid "" "systems." msgstr "" -#: ../../library/datetime.rst:2647 +#: ../../library/datetime.rst:2727 msgid "" "See R. H. van Gent's `guide to the mathematics of the ISO 8601 calendar " "`_ for a good explanation." msgstr "" -#: ../../library/datetime.rst:2651 +#: ../../library/datetime.rst:2731 msgid "" "Passing ``datetime.strptime('Feb 29', '%b %d')`` will fail since 1900 is not " "a leap year." msgstr "" -#: ../../library/datetime.rst:2311 +#: ../../library/datetime.rst:2372 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/datetime.rst:2311 +#: ../../library/datetime.rst:2372 msgid "datetime format" msgstr "datetime format(日期時間格式)" diff --git a/library/dbm.po b/library/dbm.po index 0fb484fbbd..d8cdda7b2e 100644 --- a/library/dbm.po +++ b/library/dbm.po @@ -5,9 +5,9 @@ # jerrychen , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 14:42+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,52 +27,66 @@ msgid "**Source code:** :source:`Lib/dbm/__init__.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/__init__.py`" #: ../../library/dbm.rst:11 +msgid ":mod:`dbm` is a generic interface to variants of the DBM database:" +msgstr "" + +#: ../../library/dbm.rst:13 +msgid ":mod:`dbm.sqlite3`" +msgstr ":mod:`dbm.sqlite3`" + +#: ../../library/dbm.rst:14 +msgid ":mod:`dbm.gnu`" +msgstr ":mod:`dbm.gnu`" + +#: ../../library/dbm.rst:15 +msgid ":mod:`dbm.ndbm`" +msgstr ":mod:`dbm.ndbm`" + +#: ../../library/dbm.rst:17 msgid "" -":mod:`dbm` is a generic interface to variants of the DBM database --- :mod:" -"`dbm.gnu` or :mod:`dbm.ndbm`. If none of these modules is installed, the " -"slow-but-simple implementation in module :mod:`dbm.dumb` will be used. " -"There is a `third party interface `_ to the Oracle Berkeley DB." +"If none of these modules are installed, the slow-but-simple implementation " +"in module :mod:`dbm.dumb` will be used. There is a `third party interface " +"`_ to the Oracle Berkeley DB." msgstr "" -#: ../../library/dbm.rst:20 +#: ../../library/dbm.rst:24 msgid "" "A tuple containing the exceptions that can be raised by each of the " "supported modules, with a unique exception also named :exc:`dbm.error` as " "the first item --- the latter is used when :exc:`dbm.error` is raised." msgstr "" -#: ../../library/dbm.rst:27 +#: ../../library/dbm.rst:31 msgid "" "This function attempts to guess which of the several simple database modules " -"available --- :mod:`dbm.gnu`, :mod:`dbm.ndbm` or :mod:`dbm.dumb` --- should " -"be used to open a given file." +"available --- :mod:`dbm.sqlite3`, :mod:`dbm.gnu`, :mod:`dbm.ndbm`, or :mod:" +"`dbm.dumb` --- should be used to open a given file." msgstr "" -#: ../../library/dbm.rst:31 +#: ../../library/dbm.rst:35 msgid "Return one of the following values:" msgstr "回傳以下其中一個值:" -#: ../../library/dbm.rst:33 +#: ../../library/dbm.rst:37 msgid "" "``None`` if the file can't be opened because it's unreadable or doesn't exist" msgstr "" -#: ../../library/dbm.rst:34 +#: ../../library/dbm.rst:38 msgid "the empty string (``''``) if the file's format can't be guessed" msgstr "" -#: ../../library/dbm.rst:35 +#: ../../library/dbm.rst:39 msgid "" "a string containing the required module name, such as ``'dbm.ndbm'`` or " "``'dbm.gnu'``" msgstr "" -#: ../../library/dbm.rst:37 ../../library/dbm.rst:202 ../../library/dbm.rst:386 +#: ../../library/dbm.rst:41 ../../library/dbm.rst:250 ../../library/dbm.rst:448 msgid "*filename* accepts a :term:`path-like object`." msgstr "" -#: ../../library/dbm.rst:61 +#: ../../library/dbm.rst:65 msgid "Open a database and return the corresponding database object." msgstr "" @@ -80,7 +94,7 @@ msgstr "" msgid "Parameters" msgstr "參數" -#: ../../library/dbm.rst:63 +#: ../../library/dbm.rst:67 msgid "" "The database file to open. If the database file already exists, the :func:" "`whichdb` function is used to determine its type and the appropriate module " @@ -88,18 +102,18 @@ msgid "" "imported is used." msgstr "" -#: ../../library/dbm.rst:64 ../../library/dbm.rst:174 +#: ../../library/dbm.rst:68 ../../library/dbm.rst:222 msgid "The database file to open." msgstr "要打開的資料庫檔案" -#: ../../library/dbm.rst:66 +#: ../../library/dbm.rst:70 msgid "" "If the database file already exists, the :func:`whichdb` function is used to " "determine its type and the appropriate module is used; if it does not exist, " "the first submodule listed above that can be imported is used." msgstr "" -#: ../../library/dbm.rst:71 ../../library/dbm.rst:297 +#: ../../library/dbm.rst:75 ../../library/dbm.rst:178 ../../library/dbm.rst:353 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n|" @@ -107,34 +121,36 @@ msgstr "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n|" -#: ../../library/dbm.rst:72 ../../library/dbm.rst:179 ../../library/dbm.rst:298 +#: ../../library/dbm.rst:76 ../../library/dbm.rst:180 ../../library/dbm.rst:227 +#: ../../library/dbm.rst:354 msgid "``'r'`` (default): |flag_r|" msgstr "``'r'`` (default): |flag_r|" -#: ../../library/dbm.rst:73 ../../library/dbm.rst:180 ../../library/dbm.rst:299 -#: ../../library/dbm.rst:367 +#: ../../library/dbm.rst:77 ../../library/dbm.rst:181 ../../library/dbm.rst:228 +#: ../../library/dbm.rst:355 ../../library/dbm.rst:429 msgid "``'w'``: |flag_w|" msgstr "``'w'``: |flag_w|" -#: ../../library/dbm.rst:74 ../../library/dbm.rst:181 ../../library/dbm.rst:300 +#: ../../library/dbm.rst:78 ../../library/dbm.rst:182 ../../library/dbm.rst:229 +#: ../../library/dbm.rst:356 msgid "``'c'``: |flag_c|" msgstr "``'c'``: |flag_c|" -#: ../../library/dbm.rst:75 ../../library/dbm.rst:182 ../../library/dbm.rst:301 -#: ../../library/dbm.rst:369 +#: ../../library/dbm.rst:79 ../../library/dbm.rst:183 ../../library/dbm.rst:230 +#: ../../library/dbm.rst:357 ../../library/dbm.rst:431 msgid "``'n'``: |flag_n|" msgstr "``'n'``: |flag_n|" -#: ../../library/dbm.rst:77 ../../library/dbm.rst:196 ../../library/dbm.rst:303 -#: ../../library/dbm.rst:371 +#: ../../library/dbm.rst:81 ../../library/dbm.rst:244 ../../library/dbm.rst:359 +#: ../../library/dbm.rst:433 msgid "|mode_param_doc|" msgstr "|mode_param_doc|" -#: ../../library/dbm.rst:80 +#: ../../library/dbm.rst:84 msgid "*file* accepts a :term:`path-like object`." msgstr "*file* 接受一個\\ :term:`類路徑物件 `。" -#: ../../library/dbm.rst:83 +#: ../../library/dbm.rst:87 msgid "" "The object returned by :func:`~dbm.open` supports the same basic " "functionality as a :class:`dict`; keys and their corresponding values can be " @@ -143,44 +159,44 @@ msgid "" "setdefault` methods." msgstr "" -#: ../../library/dbm.rst:88 +#: ../../library/dbm.rst:92 msgid "" "Key and values are always stored as :class:`bytes`. This means that when " "strings are used they are implicitly converted to the default encoding " "before being stored." msgstr "" -#: ../../library/dbm.rst:92 +#: ../../library/dbm.rst:96 msgid "" "These objects also support being used in a :keyword:`with` statement, which " "will automatically close them when done." msgstr "" -#: ../../library/dbm.rst:95 +#: ../../library/dbm.rst:99 msgid "" ":meth:`!get` and :meth:`!setdefault` methods are now available for all :mod:" "`dbm` backends." msgstr "" -#: ../../library/dbm.rst:99 +#: ../../library/dbm.rst:103 msgid "" "Added native support for the context management protocol to the objects " "returned by :func:`~dbm.open`." msgstr "" -#: ../../library/dbm.rst:103 +#: ../../library/dbm.rst:107 msgid "" "Deleting a key from a read-only database raises a database module specific " "exception instead of :exc:`KeyError`." msgstr "" -#: ../../library/dbm.rst:107 +#: ../../library/dbm.rst:111 msgid "" "The following example records some hostnames and a corresponding title, and " "then prints out the contents of the database::" msgstr "" -#: ../../library/dbm.rst:110 +#: ../../library/dbm.rst:114 msgid "" "import dbm\n" "\n" @@ -207,51 +223,108 @@ msgid "" "# db is automatically closed when leaving the with statement." msgstr "" -#: ../../library/dbm.rst:137 +#: ../../library/dbm.rst:141 msgid "Module :mod:`shelve`" msgstr ":mod:`shelve` 模組" -#: ../../library/dbm.rst:138 +#: ../../library/dbm.rst:142 msgid "Persistence module which stores non-string data." msgstr "" -#: ../../library/dbm.rst:141 +#: ../../library/dbm.rst:145 msgid "The individual submodules are described in the following sections." msgstr "" -#: ../../library/dbm.rst:145 +#: ../../library/dbm.rst:148 +msgid ":mod:`dbm.sqlite3` --- SQLite backend for dbm" +msgstr "" + +#: ../../library/dbm.rst:156 +msgid "**Source code:** :source:`Lib/dbm/sqlite3.py`" +msgstr "**原始碼:**\\ :source:`Lib/dbm/sqlite3.py`" + +#: ../../library/dbm.rst:160 +msgid "" +"This module uses the standard library :mod:`sqlite3` module to provide an " +"SQLite backend for the :mod:`dbm` module. The files created by :mod:`dbm." +"sqlite3` can thus be opened by :mod:`sqlite3`, or any other SQLite browser, " +"including the SQLite CLI." +msgstr "" + +#: ../../includes/wasm-notavail.rst:3 +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" + +#: ../../includes/wasm-notavail.rst:5 +msgid "" +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." +msgstr "" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" + +#: ../../library/dbm.rst:169 +msgid "" +"Open an SQLite database. The returned object behaves like a :term:`mapping`, " +"implements a :meth:`!close` method, and supports a \"closing\" context " +"manager via the :keyword:`with` keyword." +msgstr "" + +#: ../../library/dbm.rst:174 +msgid "The path to the database to be opened." +msgstr "要打開的資料庫路徑" + +#: ../../library/dbm.rst:185 +msgid "" +"The Unix file access mode of the file (default: octal ``0o666``), used only " +"when the database has to be created." +msgstr "" + +#: ../../library/dbm.rst:191 msgid ":mod:`dbm.gnu` --- GNU database manager" msgstr ":mod:`dbm.gnu` --- GNU 資料庫管理器" -#: ../../library/dbm.rst:151 +#: ../../library/dbm.rst:197 msgid "**Source code:** :source:`Lib/dbm/gnu.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/gnu.py`" -#: ../../library/dbm.rst:155 +#: ../../library/dbm.rst:201 msgid "" "The :mod:`dbm.gnu` module provides an interface to the :abbr:`GDBM (GNU " "dbm)` library, similar to the :mod:`dbm.ndbm` module, but with additional " "functionality like crash tolerance." msgstr "" -#: ../../library/dbm.rst:161 ../../library/dbm.rst:267 +#: ../../library/dbm.rst:207 ../../library/dbm.rst:321 msgid "" "The file formats created by :mod:`dbm.gnu` and :mod:`dbm.ndbm` are " "incompatible and can not be used interchangeably." msgstr "" -#: ../../library/dbm.rst:166 +#: ../../includes/wasm-mobile-notavail.rst:3 +msgid ":ref:`Availability `: not Android, not iOS, not WASI." +msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" + +#: ../../includes/wasm-mobile-notavail.rst:5 +msgid "" +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." +msgstr "" +"此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" +"台 `\\ 上不支援。" + +#: ../../library/dbm.rst:214 msgid "" "Raised on :mod:`dbm.gnu`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: ../../library/dbm.rst:172 +#: ../../library/dbm.rst:220 msgid "Open a GDBM database and return a :class:`!gdbm` object." msgstr "" -#: ../../library/dbm.rst:178 +#: ../../library/dbm.rst:226 msgid "" "* ``'r'`` (default): |flag_r| * ``'w'``: |flag_w| * ``'c'``: |flag_c| * " "``'n'``: |flag_n| The following additional characters may be appended to " @@ -263,29 +336,29 @@ msgid "" "flag characters." msgstr "" -#: ../../library/dbm.rst:184 +#: ../../library/dbm.rst:232 msgid "" "The following additional characters may be appended to control how the " "database is opened:" msgstr "" -#: ../../library/dbm.rst:187 +#: ../../library/dbm.rst:235 msgid "" "``'f'``: Open the database in fast mode. Writes to the database will not be " "synchronized." msgstr "" -#: ../../library/dbm.rst:189 +#: ../../library/dbm.rst:237 msgid "" "``'s'``: Synchronized mode. Changes to the database will be written " "immediately to the file." msgstr "" -#: ../../library/dbm.rst:191 +#: ../../library/dbm.rst:239 msgid "``'u'``: Do not lock database." msgstr "``'u'``: 不要鎖住資料庫。" -#: ../../library/dbm.rst:193 +#: ../../library/dbm.rst:241 msgid "" "Not all flags are valid for all versions of GDBM. See the :data:`open_flags` " "member for a list of supported flag characters." @@ -295,24 +368,24 @@ msgstr "" msgid "Raises" msgstr "引發" -#: ../../library/dbm.rst:199 +#: ../../library/dbm.rst:247 msgid "If an invalid *flag* argument is passed." msgstr "如果一個無效的 *flag* 引數被傳入。" -#: ../../library/dbm.rst:207 +#: ../../library/dbm.rst:255 msgid "" "A string of characters the *flag* parameter of :meth:`~dbm.gnu.open` " "supports." msgstr "" -#: ../../library/dbm.rst:209 +#: ../../library/dbm.rst:257 msgid "" ":class:`!gdbm` objects behave similar to :term:`mappings `, but :" "meth:`!items` and :meth:`!values` methods are not supported. The following " "methods are also provided:" msgstr "" -#: ../../library/dbm.rst:215 +#: ../../library/dbm.rst:263 msgid "" "It's possible to loop over every key in the database using this method and " "the :meth:`nextkey` method. The traversal is ordered by GDBM's internal " @@ -320,14 +393,14 @@ msgid "" "starting key." msgstr "" -#: ../../library/dbm.rst:222 +#: ../../library/dbm.rst:270 msgid "" "Returns the key that follows *key* in the traversal. The following code " "prints every key in the database ``db``, without having to create a list in " "memory that contains them all::" msgstr "" -#: ../../library/dbm.rst:226 +#: ../../library/dbm.rst:274 msgid "" "k = db.firstkey()\n" "while k is not None:\n" @@ -339,7 +412,7 @@ msgstr "" " print(k)\n" " k = db.nextkey(k)" -#: ../../library/dbm.rst:233 +#: ../../library/dbm.rst:281 msgid "" "If you have carried out a lot of deletions and would like to shrink the " "space used by the GDBM file, this routine will reorganize the database. :" @@ -348,32 +421,36 @@ msgid "" "reused as new (key, value) pairs are added." msgstr "" -#: ../../library/dbm.rst:241 +#: ../../library/dbm.rst:289 msgid "" "When the database has been opened in fast mode, this method forces any " "unwritten data to be written to the disk." msgstr "" -#: ../../library/dbm.rst:246 +#: ../../library/dbm.rst:294 msgid "Close the GDBM database." msgstr "關閉 GDBM 資料庫。" -#: ../../library/dbm.rst:250 +#: ../../library/dbm.rst:298 +msgid "Remove all items from the GDBM database." +msgstr "移除 GDBM 資料庫中所有項目。" + +#: ../../library/dbm.rst:304 msgid ":mod:`dbm.ndbm` --- New Database Manager" msgstr ":mod:`dbm.ndbm` --- 新資料庫管理器" -#: ../../library/dbm.rst:256 +#: ../../library/dbm.rst:310 msgid "**Source code:** :source:`Lib/dbm/ndbm.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/ndbm.py`" -#: ../../library/dbm.rst:260 +#: ../../library/dbm.rst:314 msgid "" "The :mod:`dbm.ndbm` module provides an interface to the :abbr:`NDBM (New " "Database Manager)` library. This module can be used with the \"classic\" " "NDBM interface or the :abbr:`GDBM (GNU dbm)` compatibility interface." msgstr "" -#: ../../library/dbm.rst:272 +#: ../../library/dbm.rst:326 msgid "" "The NDBM library shipped as part of macOS has an undocumented limitation on " "the size of values, which can result in corrupted database files when " @@ -381,51 +458,55 @@ msgid "" "result in a hard crash (segmentation fault)." msgstr "" -#: ../../library/dbm.rst:279 +#: ../../library/dbm.rst:335 msgid "" "Raised on :mod:`dbm.ndbm`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: ../../library/dbm.rst:285 +#: ../../library/dbm.rst:341 msgid "Name of the NDBM implementation library used." msgstr "" -#: ../../library/dbm.rst:290 +#: ../../library/dbm.rst:346 msgid "Open an NDBM database and return an :class:`!ndbm` object." msgstr "" -#: ../../library/dbm.rst:292 +#: ../../library/dbm.rst:348 msgid "" "The basename of the database file (without the :file:`.dir` or :file:`.pag` " "extensions)." msgstr "" -#: ../../library/dbm.rst:306 +#: ../../library/dbm.rst:362 msgid "" ":class:`!ndbm` objects behave similar to :term:`mappings `, but :" "meth:`!items` and :meth:`!values` methods are not supported. The following " "methods are also provided:" msgstr "" -#: ../../library/dbm.rst:310 +#: ../../library/dbm.rst:366 msgid "Accepts :term:`path-like object` for filename." msgstr "" -#: ../../library/dbm.rst:315 +#: ../../library/dbm.rst:371 msgid "Close the NDBM database." msgstr "關閉 NDBM 資料庫。" -#: ../../library/dbm.rst:319 +#: ../../library/dbm.rst:375 +msgid "Remove all items from the NDBM database." +msgstr "移除 NDBM 資料庫中所有項目。" + +#: ../../library/dbm.rst:381 msgid ":mod:`dbm.dumb` --- Portable DBM implementation" msgstr ":mod:`dbm.dumb` --- 可攜式 DBM 實作" -#: ../../library/dbm.rst:324 +#: ../../library/dbm.rst:386 msgid "**Source code:** :source:`Lib/dbm/dumb.py`" msgstr "**原始碼:**\\ :source:`Lib/dbm/dumb.py`" -#: ../../library/dbm.rst:330 +#: ../../library/dbm.rst:392 msgid "" "The :mod:`dbm.dumb` module is intended as a last resort fallback for the :" "mod:`dbm` module when a more robust module is not available. The :mod:`dbm." @@ -433,53 +514,53 @@ msgid "" "the other database modules." msgstr "" -#: ../../library/dbm.rst:337 +#: ../../library/dbm.rst:399 msgid "" "The :mod:`dbm.dumb` module provides a persistent :class:`dict`-like " "interface which is written entirely in Python. Unlike other :mod:`dbm` " "backends, such as :mod:`dbm.gnu`, no external library is required." msgstr "" -#: ../../library/dbm.rst:342 +#: ../../library/dbm.rst:404 msgid "The :mod:`!dbm.dumb` module defines the following:" msgstr ":mod:`!dbm.dumb` 模組定義了以下項目:" -#: ../../library/dbm.rst:346 +#: ../../library/dbm.rst:408 msgid "" "Raised on :mod:`dbm.dumb`-specific errors, such as I/O errors. :exc:" "`KeyError` is raised for general mapping errors like specifying an incorrect " "key." msgstr "" -#: ../../library/dbm.rst:352 +#: ../../library/dbm.rst:414 msgid "" "Open a :mod:`!dbm.dumb` database. The returned database object behaves " "similar to a :term:`mapping`, in addition to providing :meth:`~dumbdbm.sync` " "and :meth:`~dumbdbm.close` methods." msgstr "" -#: ../../library/dbm.rst:357 +#: ../../library/dbm.rst:419 msgid "" "The basename of the database file (without extensions). A new database " "creates the following files: - :file:`{filename}.dat` - :file:`{filename}." "dir`" msgstr "" -#: ../../library/dbm.rst:358 +#: ../../library/dbm.rst:420 msgid "" "The basename of the database file (without extensions). A new database " "creates the following files:" msgstr "" -#: ../../library/dbm.rst:361 +#: ../../library/dbm.rst:423 msgid ":file:`{filename}.dat`" msgstr ":file:`{filename}.dat`" -#: ../../library/dbm.rst:362 +#: ../../library/dbm.rst:424 msgid ":file:`{filename}.dir`" msgstr ":file:`{filename}.dir`" -#: ../../library/dbm.rst:365 +#: ../../library/dbm.rst:427 msgid "" "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " "``'n'``: |flag_n|" @@ -487,49 +568,49 @@ msgstr "" "* ``'r'``: |flag_r| * ``'w'``: |flag_w| * ``'c'`` (default): |flag_c| * " "``'n'``: |flag_n|" -#: ../../library/dbm.rst:366 +#: ../../library/dbm.rst:428 msgid "``'r'``: |flag_r|" msgstr "``'r'``: |flag_r|" -#: ../../library/dbm.rst:368 +#: ../../library/dbm.rst:430 msgid "``'c'`` (default): |flag_c|" msgstr "``'c'`` (default): |flag_c|" -#: ../../library/dbm.rst:375 +#: ../../library/dbm.rst:437 msgid "" "It is possible to crash the Python interpreter when loading a database with " "a sufficiently large/complex entry due to stack depth limitations in " "Python's AST compiler." msgstr "" -#: ../../library/dbm.rst:379 +#: ../../library/dbm.rst:441 msgid "" ":func:`~dbm.dumb.open` always creates a new database when *flag* is ``'n'``." msgstr "" -#: ../../library/dbm.rst:382 +#: ../../library/dbm.rst:444 msgid "" "A database opened read-only if *flag* is ``'r'``. A database is not created " "if it does not exist if *flag* is ``'r'`` or ``'w'``." msgstr "" -#: ../../library/dbm.rst:389 +#: ../../library/dbm.rst:451 msgid "" "In addition to the methods provided by the :class:`collections.abc." "MutableMapping` class, the following methods are provided:" msgstr "" -#: ../../library/dbm.rst:395 +#: ../../library/dbm.rst:457 msgid "" "Synchronize the on-disk directory and data files. This method is called by " "the :meth:`Shelve.sync` method." msgstr "" -#: ../../library/dbm.rst:400 +#: ../../library/dbm.rst:462 msgid "Close the database." msgstr "關閉資料庫。" -#: ../../library/dbm.rst:326 +#: ../../library/dbm.rst:388 msgid "databases" msgstr "databases(資料庫)" diff --git a/library/debug.po b/library/debug.po index df784f61d1..e6d1cd5339 100644 --- a/library/debug.po +++ b/library/debug.po @@ -6,7 +6,7 @@ # Liang-Bo Wang , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-06-20 18:08+0800\n" "PO-Revision-Date: 2021-12-08 00:47+0800\n" diff --git a/library/decimal.po b/library/decimal.po index aae7de001e..0ab719a400 100644 --- a/library/decimal.po +++ b/library/decimal.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" diff --git a/library/development.po b/library/development.po index b993383ee9..0272023235 100644 --- a/library/development.po +++ b/library/development.po @@ -6,9 +6,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-06-20 18:08+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,10 +29,12 @@ msgid "" "the :mod:`pydoc` module takes a module and generates documentation based on " "the module's contents. The :mod:`doctest` and :mod:`unittest` modules " "contains frameworks for writing unit tests that automatically exercise code " -"and verify that the expected output is produced. :program:`2to3` can " -"translate Python 2.x source code into valid Python 3.x code." +"and verify that the expected output is produced." msgstr "" +"本章所描述的模組可以幫助你編寫軟體。例如 :mod:`pydoc` 模組可以根據模組的內容" +"生成文件;:mod:`doctest` 和 :mod:`unittest` 模組則包含編寫單元測試的框架,這" +"些測試程式碼會自動執行並驗證輸出結果是否正確。" -#: ../../library/development.rst:14 +#: ../../library/development.rst:13 msgid "The list of modules described in this chapter is:" -msgstr "" +msgstr "本章節所描述的模組列表為:" diff --git a/library/devmode.po b/library/devmode.po index 5449742012..d624765024 100644 --- a/library/devmode.po +++ b/library/devmode.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2024-05-03 02:14+0800\n" diff --git a/library/dialog.po b/library/dialog.po index dbe0255950..3460865467 100644 --- a/library/dialog.po +++ b/library/dialog.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-13 00:11+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/difflib.po b/library/difflib.po index b426822ce8..f637faac83 100644 --- a/library/difflib.po +++ b/library/difflib.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-11-19 00:29+0000\n" diff --git a/library/dis.po b/library/dis.po index 8892ecafa3..1d488345c8 100644 --- a/library/dis.po +++ b/library/dis.po @@ -5,9 +5,9 @@ # splasky Chang , 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-07-27 16:55+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -82,10 +82,17 @@ msgid "" msgstr "" #: ../../library/dis.rst:54 +msgid "" +"The output shows logical labels rather than instruction offsets for jump " +"targets and exception handlers. The ``-O`` command line option and the " +"``show_offsets`` argument were added." +msgstr "" + +#: ../../library/dis.rst:59 msgid "Example: Given the function :func:`!myfunc`::" msgstr "" -#: ../../library/dis.rst:56 +#: ../../library/dis.rst:61 msgid "" "def myfunc(alist):\n" " return len(alist)" @@ -93,87 +100,95 @@ msgstr "" "def myfunc(alist):\n" " return len(alist)" -#: ../../library/dis.rst:59 +#: ../../library/dis.rst:64 msgid "" "the following command can be used to display the disassembly of :func:`!" "myfunc`:" msgstr "" -#: ../../library/dis.rst:62 +#: ../../library/dis.rst:67 msgid "" ">>> dis.dis(myfunc)\n" -" 2 0 RESUME 0\n" +" 2 RESUME 0\n" "\n" -" 3 2 LOAD_GLOBAL 1 (NULL + len)\n" -" 12 LOAD_FAST 0 (alist)\n" -" 14 CALL 1\n" -" 22 RETURN_VALUE" +" 3 LOAD_GLOBAL 1 (len + NULL)\n" +" LOAD_FAST 0 (alist)\n" +" CALL 1\n" +" RETURN_VALUE" msgstr "" ">>> dis.dis(myfunc)\n" -" 2 0 RESUME 0\n" +" 2 RESUME 0\n" "\n" -" 3 2 LOAD_GLOBAL 1 (NULL + len)\n" -" 12 LOAD_FAST 0 (alist)\n" -" 14 CALL 1\n" -" 22 RETURN_VALUE" +" 3 LOAD_GLOBAL 1 (len + NULL)\n" +" LOAD_FAST 0 (alist)\n" +" CALL 1\n" +" RETURN_VALUE" -#: ../../library/dis.rst:72 +#: ../../library/dis.rst:77 msgid "(The \"2\" is a line number)." msgstr "" -#: ../../library/dis.rst:77 +#: ../../library/dis.rst:82 msgid "Command-line interface" msgstr "" -#: ../../library/dis.rst:79 +#: ../../library/dis.rst:84 msgid "The :mod:`dis` module can be invoked as a script from the command line:" msgstr "" -#: ../../library/dis.rst:81 -msgid "python -m dis [-h] [infile]" -msgstr "python -m dis [-h] [infile]" +#: ../../library/dis.rst:86 +msgid "python -m dis [-h] [-C] [-O] [infile]" +msgstr "python -m dis [-h] [-C] [-O] [infile]" -#: ../../library/dis.rst:85 +#: ../../library/dis.rst:90 msgid "The following options are accepted:" msgstr "" -#: ../../library/dis.rst:91 +#: ../../library/dis.rst:96 msgid "Display usage and exit." msgstr "" -#: ../../library/dis.rst:93 +#: ../../library/dis.rst:100 +msgid "Show inline caches." +msgstr "" + +#: ../../library/dis.rst:104 +msgid "Show offsets of instructions." +msgstr "" + +#: ../../library/dis.rst:106 msgid "" "If :file:`infile` is specified, its disassembled code will be written to " -"stdout. Otherwise, disassembly is performed on compiled source code recieved " +"stdout. Otherwise, disassembly is performed on compiled source code received " "from stdin." msgstr "" -#: ../../library/dis.rst:97 +#: ../../library/dis.rst:110 msgid "Bytecode analysis" msgstr "" -#: ../../library/dis.rst:101 +#: ../../library/dis.rst:114 msgid "" "The bytecode analysis API allows pieces of Python code to be wrapped in a :" "class:`Bytecode` object that provides easy access to details of the compiled " "code." msgstr "" -#: ../../library/dis.rst:108 +#: ../../library/dis.rst:121 msgid "" "Analyse the bytecode corresponding to a function, generator, asynchronous " "generator, coroutine, method, string of source code, or a code object (as " "returned by :func:`compile`)." msgstr "" -#: ../../library/dis.rst:112 +#: ../../library/dis.rst:125 msgid "" "This is a convenience wrapper around many of the functions listed below, " "most notably :func:`get_instructions`, as iterating over a :class:`Bytecode` " "instance yields the bytecode operations as :class:`Instruction` instances." msgstr "" -#: ../../library/dis.rst:116 ../../library/dis.rst:304 +#: ../../library/dis.rst:129 ../../library/dis.rst:326 msgid "" "If *first_line* is not ``None``, it indicates the line number that should be " "reported for the first source line in the disassembled code. Otherwise, the " @@ -181,67 +196,73 @@ msgid "" "code object." msgstr "" -#: ../../library/dis.rst:121 +#: ../../library/dis.rst:134 msgid "" "If *current_offset* is not ``None``, it refers to an instruction offset in " "the disassembled code. Setting this means :meth:`.dis` will display a " "\"current instruction\" marker against the specified opcode." msgstr "" -#: ../../library/dis.rst:125 +#: ../../library/dis.rst:138 msgid "" "If *show_caches* is ``True``, :meth:`.dis` will display inline cache entries " "used by the interpreter to specialize the bytecode." msgstr "" -#: ../../library/dis.rst:128 +#: ../../library/dis.rst:141 msgid "" "If *adaptive* is ``True``, :meth:`.dis` will display specialized bytecode " "that may be different from the original bytecode." msgstr "" -#: ../../library/dis.rst:133 +#: ../../library/dis.rst:144 +msgid "" +"If *show_offsets* is ``True``, :meth:`.dis` will include instruction offsets " +"in the output." +msgstr "" + +#: ../../library/dis.rst:149 msgid "" "Construct a :class:`Bytecode` instance from the given traceback, setting " "*current_offset* to the instruction responsible for the exception." msgstr "" -#: ../../library/dis.rst:138 +#: ../../library/dis.rst:154 msgid "The compiled code object." msgstr "" -#: ../../library/dis.rst:142 +#: ../../library/dis.rst:158 msgid "The first source line of the code object (if available)" msgstr "" -#: ../../library/dis.rst:146 +#: ../../library/dis.rst:162 msgid "" "Return a formatted view of the bytecode operations (the same as printed by :" "func:`dis.dis`, but returned as a multi-line string)." msgstr "" -#: ../../library/dis.rst:151 +#: ../../library/dis.rst:167 msgid "" "Return a formatted multi-line string with detailed information about the " "code object, like :func:`code_info`." msgstr "" -#: ../../library/dis.rst:154 ../../library/dis.rst:194 -#: ../../library/dis.rst:246 +#: ../../library/dis.rst:170 ../../library/dis.rst:210 +#: ../../library/dis.rst:262 msgid "This can now handle coroutine and asynchronous generator objects." msgstr "" -#: ../../library/dis.rst:157 ../../library/dis.rst:249 -#: ../../library/dis.rst:265 ../../library/dis.rst:292 -#: ../../library/dis.rst:313 +#: ../../library/dis.rst:173 ../../library/dis.rst:265 +#: ../../library/dis.rst:282 ../../library/dis.rst:312 +#: ../../library/dis.rst:335 msgid "Added the *show_caches* and *adaptive* parameters." msgstr "新增 *show_caches* 與 *adaptive* 參數。" -#: ../../library/dis.rst:160 +#: ../../library/dis.rst:176 msgid "Example:" msgstr "範例:" -#: ../../library/dis.rst:162 +#: ../../library/dis.rst:178 msgid "" ">>> bytecode = dis.Bytecode(myfunc)\n" ">>> for instr in bytecode:\n" @@ -263,11 +284,11 @@ msgstr "" "CALL\n" "RETURN_VALUE" -#: ../../library/dis.rst:176 +#: ../../library/dis.rst:192 msgid "Analysis functions" msgstr "" -#: ../../library/dis.rst:178 +#: ../../library/dis.rst:194 msgid "" "The :mod:`dis` module also defines the following analysis functions that " "convert the input directly to the desired output. They can be useful if only " @@ -275,39 +296,39 @@ msgid "" "isn't useful:" msgstr "" -#: ../../library/dis.rst:184 +#: ../../library/dis.rst:200 msgid "" "Return a formatted multi-line string with detailed code object information " "for the supplied function, generator, asynchronous generator, coroutine, " "method, source code string or code object." msgstr "" -#: ../../library/dis.rst:188 +#: ../../library/dis.rst:204 msgid "" "Note that the exact contents of code info strings are highly implementation " "dependent and they may change arbitrarily across Python VMs or Python " "releases." msgstr "" -#: ../../library/dis.rst:200 +#: ../../library/dis.rst:216 msgid "" "Print detailed code object information for the supplied function, method, " "source code string or code object to *file* (or ``sys.stdout`` if *file* is " "not specified)." msgstr "" -#: ../../library/dis.rst:204 +#: ../../library/dis.rst:220 msgid "" "This is a convenient shorthand for ``print(code_info(x), file=file)``, " "intended for interactive exploration at the interpreter prompt." msgstr "" -#: ../../library/dis.rst:209 ../../library/dis.rst:240 -#: ../../library/dis.rst:262 ../../library/dis.rst:289 +#: ../../library/dis.rst:225 ../../library/dis.rst:256 +#: ../../library/dis.rst:279 ../../library/dis.rst:309 msgid "Added *file* parameter." msgstr "新增 *file* 參數。" -#: ../../library/dis.rst:215 +#: ../../library/dis.rst:231 msgid "" "Disassemble the *x* object. *x* can denote either a module, a class, a " "method, a function, a generator, an asynchronous generator, a coroutine, a " @@ -323,100 +344,111 @@ msgid "" "disassembles the last traceback." msgstr "" -#: ../../library/dis.rst:228 ../../library/dis.rst:259 -#: ../../library/dis.rst:286 +#: ../../library/dis.rst:244 ../../library/dis.rst:276 +#: ../../library/dis.rst:306 msgid "" "The disassembly is written as text to the supplied *file* argument if " "provided and to ``sys.stdout`` otherwise." msgstr "" -#: ../../library/dis.rst:231 +#: ../../library/dis.rst:247 msgid "" "The maximal depth of recursion is limited by *depth* unless it is ``None``. " "``depth=0`` means no recursion." msgstr "" -#: ../../library/dis.rst:234 +#: ../../library/dis.rst:250 msgid "" "If *show_caches* is ``True``, this function will display inline cache " "entries used by the interpreter to specialize the bytecode." msgstr "" -#: ../../library/dis.rst:237 +#: ../../library/dis.rst:253 msgid "" "If *adaptive* is ``True``, this function will display specialized bytecode " "that may be different from the original bytecode." msgstr "" -#: ../../library/dis.rst:243 +#: ../../library/dis.rst:259 msgid "Implemented recursive disassembling and added *depth* parameter." msgstr "" -#: ../../library/dis.rst:255 +#: ../../library/dis.rst:272 msgid "" "Disassemble the top-of-stack function of a traceback, using the last " "traceback if none was passed. The instruction causing the exception is " "indicated." msgstr "" -#: ../../library/dis.rst:272 +#: ../../library/dis.rst:285 ../../library/dis.rst:315 +msgid "Added the *show_offsets* parameter." +msgstr "新增 *show_offsets* 參數。" + +#: ../../library/dis.rst:292 msgid "" "Disassemble a code object, indicating the last instruction if *lasti* was " "provided. The output is divided in the following columns:" msgstr "" -#: ../../library/dis.rst:275 +#: ../../library/dis.rst:295 msgid "the line number, for the first instruction of each line" msgstr "" -#: ../../library/dis.rst:276 +#: ../../library/dis.rst:296 msgid "the current instruction, indicated as ``-->``," msgstr "" -#: ../../library/dis.rst:277 +#: ../../library/dis.rst:297 msgid "a labelled instruction, indicated with ``>>``," msgstr "" -#: ../../library/dis.rst:278 +#: ../../library/dis.rst:298 msgid "the address of the instruction," msgstr "" -#: ../../library/dis.rst:279 +#: ../../library/dis.rst:299 msgid "the operation code name," msgstr "" -#: ../../library/dis.rst:280 +#: ../../library/dis.rst:300 msgid "operation parameters, and" msgstr "" -#: ../../library/dis.rst:281 +#: ../../library/dis.rst:301 msgid "interpretation of the parameters in parentheses." msgstr "" -#: ../../library/dis.rst:283 +#: ../../library/dis.rst:303 msgid "" "The parameter interpretation recognizes local and global variable names, " "constant values, branch targets, and compare operators." msgstr "" -#: ../../library/dis.rst:298 +#: ../../library/dis.rst:320 msgid "" "Return an iterator over the instructions in the supplied function, method, " "source code string or code object." msgstr "" -#: ../../library/dis.rst:301 +#: ../../library/dis.rst:323 msgid "" "The iterator generates a series of :class:`Instruction` named tuples giving " "the details of each operation in the supplied code." msgstr "" -#: ../../library/dis.rst:309 +#: ../../library/dis.rst:331 +msgid "The *adaptive* parameter works as it does in :func:`dis`." +msgstr "" + +#: ../../library/dis.rst:338 msgid "" -"The *show_caches* and *adaptive* parameters work as they do in :func:`dis`." +"The *show_caches* parameter is deprecated and has no effect. The iterator " +"generates the :class:`Instruction` instances with the *cache_info* field " +"populated (regardless of the value of *show_caches*) and it no longer " +"generates separate items for the cache entries." msgstr "" -#: ../../library/dis.rst:319 +#: ../../library/dis.rst:346 msgid "" "This generator function uses the :meth:`~codeobject.co_lines` method of the :" "ref:`code object ` *code* to find the offsets which are starts " @@ -424,28 +456,33 @@ msgid "" "pairs." msgstr "" -#: ../../library/dis.rst:324 +#: ../../library/dis.rst:351 msgid "Line numbers can be decreasing. Before, they were always increasing." msgstr "" -#: ../../library/dis.rst:327 +#: ../../library/dis.rst:354 msgid "" "The :pep:`626` :meth:`~codeobject.co_lines` method is used instead of the :" "attr:`~codeobject.co_firstlineno` and :attr:`~codeobject.co_lnotab` " "attributes of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:335 +#: ../../library/dis.rst:359 +msgid "" +"Line numbers can be ``None`` for bytecode that does not map to source lines." +msgstr "" + +#: ../../library/dis.rst:365 msgid "" "Detect all offsets in the raw compiled bytecode string *code* which are jump " "targets, and return a list of these offsets." msgstr "" -#: ../../library/dis.rst:341 +#: ../../library/dis.rst:371 msgid "Compute the stack effect of *opcode* with argument *oparg*." msgstr "" -#: ../../library/dis.rst:343 +#: ../../library/dis.rst:373 msgid "" "If the code has a jump target and *jump* is ``True``, :func:`~stack_effect` " "will return the stack effect of jumping. If *jump* is ``False``, it will " @@ -453,122 +490,182 @@ msgid "" "it will return the maximal stack effect of both cases." msgstr "" -#: ../../library/dis.rst:350 +#: ../../library/dis.rst:380 msgid "Added *jump* parameter." msgstr "新增 *jump* 參數。" -#: ../../library/dis.rst:357 +#: ../../library/dis.rst:383 +msgid "" +"If ``oparg`` is omitted (or ``None``), the stack effect is now returned for " +"``oparg=0``. Previously this was an error for opcodes that use their arg. It " +"is also no longer an error to pass an integer ``oparg`` when the ``opcode`` " +"does not use it; the ``oparg`` in this case is ignored." +msgstr "" + +#: ../../library/dis.rst:393 msgid "Python Bytecode Instructions" msgstr "" -#: ../../library/dis.rst:359 +#: ../../library/dis.rst:395 msgid "" "The :func:`get_instructions` function and :class:`Bytecode` class provide " "details of bytecode instructions as :class:`Instruction` instances:" msgstr "" -#: ../../library/dis.rst:364 +#: ../../library/dis.rst:400 msgid "Details for a bytecode operation" msgstr "" -#: ../../library/dis.rst:368 +#: ../../library/dis.rst:404 msgid "" "numeric code for operation, corresponding to the opcode values listed below " "and the bytecode values in the :ref:`opcode_collections`." msgstr "" -#: ../../library/dis.rst:374 +#: ../../library/dis.rst:410 msgid "human readable name for operation" msgstr "" -#: ../../library/dis.rst:379 +#: ../../library/dis.rst:415 +msgid "" +"numeric code for the base operation if operation is specialized; otherwise " +"equal to :data:`opcode`" +msgstr "" + +#: ../../library/dis.rst:421 +msgid "" +"human readable name for the base operation if operation is specialized; " +"otherwise equal to :data:`opname`" +msgstr "" + +#: ../../library/dis.rst:427 msgid "numeric argument to operation (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:384 +#: ../../library/dis.rst:431 +msgid "alias for :data:`arg`" +msgstr "" + +#: ../../library/dis.rst:435 msgid "resolved arg value (if any), otherwise ``None``" msgstr "" -#: ../../library/dis.rst:389 +#: ../../library/dis.rst:440 msgid "" "human readable description of operation argument (if any), otherwise an " "empty string." msgstr "" -#: ../../library/dis.rst:395 +#: ../../library/dis.rst:446 msgid "start index of operation within bytecode sequence" msgstr "" -#: ../../library/dis.rst:400 -msgid "line started by this opcode (if any), otherwise ``None``" +#: ../../library/dis.rst:451 +msgid "" +"start index of operation within bytecode sequence, including prefixed " +"``EXTENDED_ARG`` operations if present; otherwise equal to :data:`offset`" +msgstr "" + +#: ../../library/dis.rst:457 +msgid "start index of the cache entries following the operation" +msgstr "" + +#: ../../library/dis.rst:462 +msgid "end index of the cache entries following the operation" +msgstr "" + +#: ../../library/dis.rst:467 +msgid "``True`` if this opcode starts a source line, otherwise ``False``" msgstr "" -#: ../../library/dis.rst:405 +#: ../../library/dis.rst:472 +msgid "" +"source line number associated with this opcode (if any), otherwise ``None``" +msgstr "" + +#: ../../library/dis.rst:477 msgid "``True`` if other code jumps to here, otherwise ``False``" msgstr "" -#: ../../library/dis.rst:410 +#: ../../library/dis.rst:482 +msgid "" +"bytecode index of the jump target if this is a jump operation, otherwise " +"``None``" +msgstr "" + +#: ../../library/dis.rst:488 msgid "" ":class:`dis.Positions` object holding the start and end locations that are " "covered by this instruction." msgstr "" -#: ../../library/dis.rst:417 +#: ../../library/dis.rst:503 msgid "Field ``positions`` is added." msgstr "" -#: ../../library/dis.rst:422 +#: ../../library/dis.rst:507 +msgid "Changed field ``starts_line``." +msgstr "" + +#: ../../library/dis.rst:509 +msgid "" +"Added fields ``start_offset``, ``cache_offset``, ``end_offset``, " +"``baseopname``, ``baseopcode``, ``jump_target``, ``oparg``, ``line_number`` " +"and ``cache_info``." +msgstr "" + +#: ../../library/dis.rst:516 msgid "" "In case the information is not available, some fields might be ``None``." msgstr "" -#: ../../library/dis.rst:432 +#: ../../library/dis.rst:526 msgid "" "The Python compiler currently generates the following bytecode instructions." msgstr "" -#: ../../library/dis.rst:435 +#: ../../library/dis.rst:529 msgid "**General instructions**" msgstr "" -#: ../../library/dis.rst:437 +#: ../../library/dis.rst:531 msgid "" "In the following, We will refer to the interpreter stack as ``STACK`` and " "describe operations on it as if it was a Python list. The top of the stack " "corresponds to ``STACK[-1]`` in this language." msgstr "" -#: ../../library/dis.rst:443 +#: ../../library/dis.rst:537 msgid "" "Do nothing code. Used as a placeholder by the bytecode optimizer, and to " "generate line tracing events." msgstr "" -#: ../../library/dis.rst:449 +#: ../../library/dis.rst:543 msgid "Removes the top-of-stack item::" msgstr "" -#: ../../library/dis.rst:451 +#: ../../library/dis.rst:545 msgid "STACK.pop()" msgstr "STACK.pop()" -#: ../../library/dis.rst:456 +#: ../../library/dis.rst:550 msgid "" -"Removes the top two values from the stack. Equivalent to ``POP_TOP``; " -"``POP_TOP``. Used to clean up at the end of loops, hence the name." +"Removes the top-of-stack item. Equivalent to ``POP_TOP``. Used to clean up " +"at the end of loops, hence the name." msgstr "" -#: ../../library/dis.rst:465 +#: ../../library/dis.rst:559 msgid "Implements ``del STACK[-2]``. Used to clean up when a generator exits." msgstr "" -#: ../../library/dis.rst:473 +#: ../../library/dis.rst:567 msgid "" "Push the i-th item to the top of the stack without removing it from its " "original location::" msgstr "" -#: ../../library/dis.rst:476 +#: ../../library/dis.rst:570 msgid "" "assert i > 0\n" "STACK.append(STACK[-i])" @@ -576,15 +673,15 @@ msgstr "" "assert i > 0\n" "STACK.append(STACK[-i])" -#: ../../library/dis.rst:484 +#: ../../library/dis.rst:578 msgid "Swap the top of the stack with the i-th element::" msgstr "" -#: ../../library/dis.rst:486 +#: ../../library/dis.rst:580 msgid "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" msgstr "STACK[-i], STACK[-1] = STACK[-1], STACK[-i]" -#: ../../library/dis.rst:493 +#: ../../library/dis.rst:587 msgid "" "Rather than being an actual instruction, this opcode is used to mark extra " "space for the interpreter to cache useful data directly in the bytecode " @@ -592,77 +689,86 @@ msgid "" "viewed with ``show_caches=True``." msgstr "" -#: ../../library/dis.rst:498 +#: ../../library/dis.rst:592 msgid "" "Logically, this space is part of the preceding instruction. Many opcodes " "expect to be followed by an exact number of caches, and will instruct the " "interpreter to skip over them at runtime." msgstr "" -#: ../../library/dis.rst:502 +#: ../../library/dis.rst:596 msgid "" "Populated caches can look like arbitrary instructions, so great care should " "be taken when reading or modifying raw, adaptive bytecode containing " "quickened data." msgstr "" -#: ../../library/dis.rst:509 +#: ../../library/dis.rst:603 msgid "**Unary operations**" msgstr "" -#: ../../library/dis.rst:511 +#: ../../library/dis.rst:605 msgid "" "Unary operations take the top of the stack, apply the operation, and push " "the result back on the stack." msgstr "" -#: ../../library/dis.rst:517 +#: ../../library/dis.rst:611 msgid "Implements ``STACK[-1] = -STACK[-1]``." msgstr "" -#: ../../library/dis.rst:522 +#: ../../library/dis.rst:616 msgid "Implements ``STACK[-1] = not STACK[-1]``." msgstr "" -#: ../../library/dis.rst:527 +#: ../../library/dis.rst:618 ../../library/dis.rst:1313 +#: ../../library/dis.rst:1329 +msgid "This instruction now requires an exact :class:`bool` operand." +msgstr "" + +#: ../../library/dis.rst:624 msgid "Implements ``STACK[-1] = ~STACK[-1]``." msgstr "" -#: ../../library/dis.rst:532 +#: ../../library/dis.rst:629 msgid "Implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:537 +#: ../../library/dis.rst:634 msgid "" "If ``STACK[-1]`` is a :term:`generator iterator` or :term:`coroutine` object " "it is left as is. Otherwise, implements ``STACK[-1] = iter(STACK[-1])``." msgstr "" -#: ../../library/dis.rst:543 +#: ../../library/dis.rst:642 +msgid "Implements ``STACK[-1] = bool(STACK[-1])``." +msgstr "" + +#: ../../library/dis.rst:647 msgid "**Binary and in-place operations**" msgstr "" -#: ../../library/dis.rst:545 +#: ../../library/dis.rst:649 msgid "" "Binary operations remove the top two items from the stack (``STACK[-1]`` and " "``STACK[-2]``). They perform the operation, then put the result back on the " "stack." msgstr "" -#: ../../library/dis.rst:548 +#: ../../library/dis.rst:652 msgid "" "In-place operations are like binary operations, but the operation is done in-" "place when ``STACK[-2]`` supports it, and the resulting ``STACK[-1]`` may be " "(but does not have to be) the original ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:555 +#: ../../library/dis.rst:659 msgid "" "Implements the binary and in-place operators (depending on the value of " "*op*)::" msgstr "" -#: ../../library/dis.rst:558 +#: ../../library/dis.rst:662 msgid "" "rhs = STACK.pop()\n" "lhs = STACK.pop()\n" @@ -672,17 +778,17 @@ msgstr "" "lhs = STACK.pop()\n" "STACK.append(lhs op rhs)" -#: ../../library/dis.rst:567 ../../library/dis.rst:576 -#: ../../library/dis.rst:586 ../../library/dis.rst:594 -#: ../../library/dis.rst:606 ../../library/dis.rst:694 -#: ../../library/dis.rst:704 ../../library/dis.rst:714 -#: ../../library/dis.rst:934 ../../library/dis.rst:945 -#: ../../library/dis.rst:1049 ../../library/dis.rst:1061 -#: ../../library/dis.rst:1073 +#: ../../library/dis.rst:671 ../../library/dis.rst:680 +#: ../../library/dis.rst:690 ../../library/dis.rst:698 +#: ../../library/dis.rst:710 ../../library/dis.rst:798 +#: ../../library/dis.rst:808 ../../library/dis.rst:818 +#: ../../library/dis.rst:1041 ../../library/dis.rst:1052 +#: ../../library/dis.rst:1156 ../../library/dis.rst:1168 +#: ../../library/dis.rst:1180 msgid "Implements::" msgstr "" -#: ../../library/dis.rst:569 +#: ../../library/dis.rst:673 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -692,7 +798,7 @@ msgstr "" "container = STACK.pop()\n" "STACK.append(container[key])" -#: ../../library/dis.rst:578 +#: ../../library/dis.rst:682 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -704,7 +810,7 @@ msgstr "" "value = STACK.pop()\n" "container[key] = value" -#: ../../library/dis.rst:588 +#: ../../library/dis.rst:692 msgid "" "key = STACK.pop()\n" "container = STACK.pop()\n" @@ -714,7 +820,7 @@ msgstr "" "container = STACK.pop()\n" "del container[key]" -#: ../../library/dis.rst:596 +#: ../../library/dis.rst:700 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -726,7 +832,7 @@ msgstr "" "container = STACK.pop()\n" "STACK.append(container[start:end])" -#: ../../library/dis.rst:608 +#: ../../library/dis.rst:712 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" @@ -740,11 +846,11 @@ msgstr "" "values = STACK.pop()\n" "container[start:end] = value" -#: ../../library/dis.rst:617 +#: ../../library/dis.rst:721 msgid "**Coroutine opcodes**" msgstr "" -#: ../../library/dis.rst:621 +#: ../../library/dis.rst:725 msgid "" "Implements ``STACK[-1] = get_awaitable(STACK[-1])``, where " "``get_awaitable(o)`` returns ``o`` if ``o`` is a coroutine object or a " @@ -752,39 +858,39 @@ msgid "" "resolves ``o.__await__``." msgstr "" -#: ../../library/dis.rst:626 +#: ../../library/dis.rst:730 msgid "" "If the ``where`` operand is nonzero, it indicates where the instruction " "occurs:" msgstr "" -#: ../../library/dis.rst:629 +#: ../../library/dis.rst:733 msgid "``1``: After a call to ``__aenter__``" msgstr "" -#: ../../library/dis.rst:630 +#: ../../library/dis.rst:734 msgid "``2``: After a call to ``__aexit__``" msgstr "" -#: ../../library/dis.rst:634 +#: ../../library/dis.rst:738 msgid "Previously, this instruction did not have an oparg." msgstr "" -#: ../../library/dis.rst:640 +#: ../../library/dis.rst:744 msgid "Implements ``STACK[-1] = STACK[-1].__aiter__()``." msgstr "" -#: ../../library/dis.rst:643 +#: ../../library/dis.rst:747 msgid "Returning awaitable objects from ``__aiter__`` is no longer supported." msgstr "" -#: ../../library/dis.rst:650 +#: ../../library/dis.rst:754 msgid "" "Implement ``STACK.append(get_awaitable(STACK[-1].__anext__()))`` to the " "stack. See ``GET_AWAITABLE`` for details about ``get_awaitable``." msgstr "" -#: ../../library/dis.rst:658 +#: ../../library/dis.rst:762 msgid "" "Terminates an :keyword:`async for` loop. Handles an exception raised when " "awaiting a next item. The stack contains the async iterable in ``STACK[-2]`` " @@ -792,13 +898,13 @@ msgid "" "is not :exc:`StopAsyncIteration`, it is re-raised." msgstr "" -#: ../../library/dis.rst:665 ../../library/dis.rst:770 -#: ../../library/dis.rst:781 +#: ../../library/dis.rst:769 ../../library/dis.rst:877 +#: ../../library/dis.rst:888 msgid "" "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:671 +#: ../../library/dis.rst:775 msgid "" "Handles an exception raised during a :meth:`~generator.throw` or :meth:" "`~generator.close` call through the current frame. If ``STACK[-1]`` is an " @@ -806,21 +912,21 @@ msgid "" "its ``value`` member. Otherwise, re-raise ``STACK[-1]``." msgstr "" -#: ../../library/dis.rst:681 +#: ../../library/dis.rst:785 msgid "" "Resolves ``__aenter__`` and ``__aexit__`` from ``STACK[-1]``. Pushes " "``__aexit__`` and result of ``__aenter__()`` to the stack::" msgstr "" -#: ../../library/dis.rst:684 +#: ../../library/dis.rst:788 msgid "STACK.extend((__aexit__, __aenter__())" msgstr "STACK.extend((__aexit__, __aenter__())" -#: ../../library/dis.rst:690 +#: ../../library/dis.rst:794 msgid "**Miscellaneous opcodes**" msgstr "" -#: ../../library/dis.rst:696 +#: ../../library/dis.rst:800 msgid "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" @@ -828,11 +934,11 @@ msgstr "" "item = STACK.pop()\n" "set.add(STACK[-i], item)" -#: ../../library/dis.rst:699 +#: ../../library/dis.rst:803 msgid "Used to implement set comprehensions." msgstr "" -#: ../../library/dis.rst:706 +#: ../../library/dis.rst:810 msgid "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" @@ -840,11 +946,11 @@ msgstr "" "item = STACK.pop()\n" "list.append(STACK[-i], item)" -#: ../../library/dis.rst:709 +#: ../../library/dis.rst:813 msgid "Used to implement list comprehensions." msgstr "" -#: ../../library/dis.rst:716 +#: ../../library/dis.rst:820 msgid "" "value = STACK.pop()\n" "key = STACK.pop()\n" @@ -854,17 +960,17 @@ msgstr "" "key = STACK.pop()\n" "dict.__setitem__(STACK[-i], key, value)" -#: ../../library/dis.rst:720 +#: ../../library/dis.rst:824 msgid "Used to implement dict comprehensions." msgstr "" -#: ../../library/dis.rst:723 +#: ../../library/dis.rst:827 msgid "" "Map value is ``STACK[-1]`` and map key is ``STACK[-2]``. Before, those were " "reversed." msgstr "" -#: ../../library/dis.rst:727 +#: ../../library/dis.rst:831 msgid "" "For all of the :opcode:`SET_ADD`, :opcode:`LIST_APPEND` and :opcode:" "`MAP_ADD` instructions, while the added value or key/value pair is popped " @@ -872,29 +978,35 @@ msgid "" "further iterations of the loop." msgstr "" -#: ../../library/dis.rst:735 +#: ../../library/dis.rst:839 msgid "Returns with ``STACK[-1]`` to the caller of the function." msgstr "" -#: ../../library/dis.rst:740 +#: ../../library/dis.rst:844 msgid "Returns with ``co_consts[consti]`` to the caller of the function." msgstr "" -#: ../../library/dis.rst:747 +#: ../../library/dis.rst:851 msgid "Yields ``STACK.pop()`` from a :term:`generator`." msgstr "" -#: ../../library/dis.rst:749 +#: ../../library/dis.rst:853 msgid "oparg set to be the stack depth." msgstr "" -#: ../../library/dis.rst:752 +#: ../../library/dis.rst:856 msgid "" "oparg set to be the exception block depth, for efficient closing of " "generators." msgstr "" -#: ../../library/dis.rst:758 +#: ../../library/dis.rst:859 +msgid "" +"oparg is ``1`` if this instruction is part of a yield-from or await, and " +"``0`` otherwise." +msgstr "" + +#: ../../library/dis.rst:865 msgid "" "Checks whether ``__annotations__`` is defined in ``locals()``, if not it is " "set up to an empty ``dict``. This opcode is only emitted if a class or " @@ -902,39 +1014,39 @@ msgid "" "statically." msgstr "" -#: ../../library/dis.rst:768 +#: ../../library/dis.rst:875 msgid "" "Pops a value from the stack, which is used to restore the exception state." msgstr "" -#: ../../library/dis.rst:775 +#: ../../library/dis.rst:882 msgid "" "Re-raises the exception currently on top of the stack. If oparg is non-zero, " "pops an additional value from the stack which is used to set :attr:`~frame." "f_lasti` of the current frame." msgstr "" -#: ../../library/dis.rst:786 +#: ../../library/dis.rst:893 msgid "" "Pops a value from the stack. Pushes the current exception to the top of the " "stack. Pushes the value originally popped back to the stack. Used in " "exception handlers." msgstr "" -#: ../../library/dis.rst:794 +#: ../../library/dis.rst:901 msgid "" "Performs exception matching for ``except``. Tests whether the ``STACK[-2]`` " "is an exception matching ``STACK[-1]``. Pops ``STACK[-1]`` and pushes the " "boolean result of the test." msgstr "" -#: ../../library/dis.rst:802 +#: ../../library/dis.rst:909 msgid "" "Performs exception matching for ``except*``. Applies ``split(STACK[-1])`` on " "the exception group representing ``STACK[-2]``." msgstr "" -#: ../../library/dis.rst:805 +#: ../../library/dis.rst:912 msgid "" "In case of a match, pops two items from the stack and pushes the non-" "matching subgroup (``None`` in case of full match) followed by the matching " @@ -942,7 +1054,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/dis.rst:814 +#: ../../library/dis.rst:921 msgid "" "Calls the function in position 4 on the stack with arguments (type, val, tb) " "representing the exception at the top of the stack. Used to implement the " @@ -950,25 +1062,25 @@ msgid "" "occurred in a :keyword:`with` statement." msgstr "" -#: ../../library/dis.rst:821 +#: ../../library/dis.rst:928 msgid "" "The ``__exit__`` function is in position 4 of the stack rather than 7. " "Exception representation on the stack now consist of one, not three, items." msgstr "" -#: ../../library/dis.rst:828 +#: ../../library/dis.rst:935 msgid "" "Pushes :exc:`AssertionError` onto the stack. Used by the :keyword:`assert` " "statement." msgstr "" -#: ../../library/dis.rst:836 +#: ../../library/dis.rst:943 msgid "" "Pushes :func:`!builtins.__build_class__` onto the stack. It is later called " "to construct a class." msgstr "" -#: ../../library/dis.rst:842 +#: ../../library/dis.rst:949 msgid "" "This opcode performs several operations before a with block starts. First, " "it loads :meth:`~object.__exit__` from the context manager and pushes it " @@ -977,11 +1089,11 @@ msgid "" "``__enter__()`` method is pushed onto the stack." msgstr "" -#: ../../library/dis.rst:853 +#: ../../library/dis.rst:960 msgid "Perform ``STACK.append(len(STACK[-1]))``." msgstr "" -#: ../../library/dis.rst:860 +#: ../../library/dis.rst:967 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Mapping` (or, " "more technically: if it has the :c:macro:`Py_TPFLAGS_MAPPING` flag set in " @@ -989,7 +1101,7 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:870 +#: ../../library/dis.rst:977 msgid "" "If ``STACK[-1]`` is an instance of :class:`collections.abc.Sequence` and is " "*not* an instance of :class:`str`/:class:`bytes`/:class:`bytearray` (or, " @@ -998,20 +1110,20 @@ msgid "" "Otherwise, push ``False``." msgstr "" -#: ../../library/dis.rst:880 +#: ../../library/dis.rst:987 msgid "" "``STACK[-1]`` is a tuple of mapping keys, and ``STACK[-2]`` is the match " "subject. If ``STACK[-2]`` contains all of the keys in ``STACK[-1]``, push a :" "class:`tuple` containing the corresponding values. Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:886 ../../library/dis.rst:1520 +#: ../../library/dis.rst:993 ../../library/dis.rst:1664 msgid "" "Previously, this instruction also pushed a boolean value indicating success " "(``True``) or failure (``False``)." msgstr "" -#: ../../library/dis.rst:893 +#: ../../library/dis.rst:1000 msgid "" "Implements ``name = STACK.pop()``. *namei* is the index of *name* in the " "attribute :attr:`~codeobject.co_names` of the :ref:`code object `." msgstr "" -#: ../../library/dis.rst:906 +#: ../../library/dis.rst:1013 msgid "" "Unpacks ``STACK[-1]`` into *count* individual values, which are put onto the " "stack right-to-left. Require there to be exactly *count* values.::" msgstr "" -#: ../../library/dis.rst:909 +#: ../../library/dis.rst:1016 msgid "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" @@ -1039,7 +1151,7 @@ msgstr "" "assert(len(STACK[-1]) == count)\n" "STACK.extend(STACK.pop()[:-count-1:-1])" -#: ../../library/dis.rst:915 +#: ../../library/dis.rst:1022 msgid "" "Implements assignment with a starred target: Unpacks an iterable in " "``STACK[-1]`` into individual values, where the total number of values can " @@ -1047,11 +1159,11 @@ msgid "" "will be a list of all leftover items." msgstr "" -#: ../../library/dis.rst:920 +#: ../../library/dis.rst:1027 msgid "The number of values before and after the list value is limited to 255." msgstr "" -#: ../../library/dis.rst:922 +#: ../../library/dis.rst:1029 msgid "" "The number of values before the list value is encoded in the argument of the " "opcode. The number of values after the list if any is encoded using an " @@ -1060,13 +1172,13 @@ msgid "" "list value, the high byte of *counts* the number of values after it." msgstr "" -#: ../../library/dis.rst:928 +#: ../../library/dis.rst:1035 msgid "" "The extracted values are put onto the stack right-to-left, i.e. ``a, *b, c = " "d`` will be stored after execution as ``STACK.extend((a, b, c))``." msgstr "" -#: ../../library/dis.rst:936 +#: ../../library/dis.rst:1043 msgid "" "obj = STACK.pop()\n" "value = STACK.pop()\n" @@ -1076,13 +1188,13 @@ msgstr "" "value = STACK.pop()\n" "obj.name = value" -#: ../../library/dis.rst:940 +#: ../../library/dis.rst:1047 msgid "" "where *namei* is the index of name in :attr:`~codeobject.co_names` of the :" "ref:`code object `." msgstr "" -#: ../../library/dis.rst:947 +#: ../../library/dis.rst:1054 msgid "" "obj = STACK.pop()\n" "del obj.name" @@ -1090,38 +1202,38 @@ msgstr "" "obj = STACK.pop()\n" "del obj.name" -#: ../../library/dis.rst:950 +#: ../../library/dis.rst:1057 msgid "" "where *namei* is the index of name into :attr:`~codeobject.co_names` of the :" "ref:`code object `." msgstr "" -#: ../../library/dis.rst:956 +#: ../../library/dis.rst:1063 msgid "Works as :opcode:`STORE_NAME`, but stores the name as a global." msgstr "" -#: ../../library/dis.rst:961 +#: ../../library/dis.rst:1068 msgid "Works as :opcode:`DELETE_NAME`, but deletes a global name." msgstr "" -#: ../../library/dis.rst:966 +#: ../../library/dis.rst:1073 msgid "Pushes ``co_consts[consti]`` onto the stack." msgstr "" -#: ../../library/dis.rst:971 +#: ../../library/dis.rst:1078 msgid "" "Pushes the value associated with ``co_names[namei]`` onto the stack. The " "name is looked up within the locals, then the globals, then the builtins." msgstr "" -#: ../../library/dis.rst:977 +#: ../../library/dis.rst:1084 msgid "" "Pushes a reference to the locals dictionary onto the stack. This is used to " "prepare namespace dictionaries for :opcode:`LOAD_FROM_DICT_OR_DEREF` and :" "opcode:`LOAD_FROM_DICT_OR_GLOBALS`." msgstr "" -#: ../../library/dis.rst:986 +#: ../../library/dis.rst:1093 msgid "" "Pops a mapping off the stack and looks up the value for ``co_names[namei]``. " "If the name is not found there, looks it up in the globals and then the " @@ -1130,13 +1242,13 @@ msgid "" "bodies." msgstr "" -#: ../../library/dis.rst:997 +#: ../../library/dis.rst:1104 msgid "" "Creates a tuple consuming *count* items from the stack, and pushes the " "resulting tuple onto the stack::" msgstr "" -#: ../../library/dis.rst:1000 +#: ../../library/dis.rst:1107 msgid "" "if count == 0:\n" " value = ()\n" @@ -1154,41 +1266,41 @@ msgstr "" "\n" "STACK.append(value)" -#: ../../library/dis.rst:1011 +#: ../../library/dis.rst:1118 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a list." msgstr "" -#: ../../library/dis.rst:1016 +#: ../../library/dis.rst:1123 msgid "Works as :opcode:`BUILD_TUPLE`, but creates a set." msgstr "" -#: ../../library/dis.rst:1021 +#: ../../library/dis.rst:1128 msgid "" "Pushes a new dictionary object onto the stack. Pops ``2 * count`` items so " "that the dictionary holds *count* entries: ``{..., STACK[-4]: STACK[-3], " "STACK[-2]: STACK[-1]}``." msgstr "" -#: ../../library/dis.rst:1025 +#: ../../library/dis.rst:1132 msgid "" "The dictionary is created from stack items instead of creating an empty " "dictionary pre-sized to hold *count* items." msgstr "" -#: ../../library/dis.rst:1032 +#: ../../library/dis.rst:1139 msgid "" "The version of :opcode:`BUILD_MAP` specialized for constant keys. Pops the " "top element on the stack which contains a tuple of keys, then starting from " "``STACK[-2]``, pops *count* values to form values in the built dictionary." msgstr "" -#: ../../library/dis.rst:1041 +#: ../../library/dis.rst:1148 msgid "" "Concatenates *count* strings from the stack and pushes the resulting string " "onto the stack." msgstr "" -#: ../../library/dis.rst:1051 +#: ../../library/dis.rst:1158 msgid "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" @@ -1196,11 +1308,11 @@ msgstr "" "seq = STACK.pop()\n" "list.extend(STACK[-i], seq)" -#: ../../library/dis.rst:1054 +#: ../../library/dis.rst:1161 msgid "Used to build lists." msgstr "" -#: ../../library/dis.rst:1063 +#: ../../library/dis.rst:1170 msgid "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" @@ -1208,11 +1320,11 @@ msgstr "" "seq = STACK.pop()\n" "set.update(STACK[-i], seq)" -#: ../../library/dis.rst:1066 +#: ../../library/dis.rst:1173 msgid "Used to build sets." msgstr "" -#: ../../library/dis.rst:1075 +#: ../../library/dis.rst:1182 msgid "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" @@ -1220,91 +1332,102 @@ msgstr "" "map = STACK.pop()\n" "dict.update(STACK[-i], map)" -#: ../../library/dis.rst:1078 +#: ../../library/dis.rst:1185 msgid "Used to build dicts." msgstr "" -#: ../../library/dis.rst:1085 +#: ../../library/dis.rst:1192 msgid "Like :opcode:`DICT_UPDATE` but raises an exception for duplicate keys." msgstr "" -#: ../../library/dis.rst:1092 +#: ../../library/dis.rst:1199 msgid "" "If the low bit of ``namei`` is not set, this replaces ``STACK[-1]`` with " "``getattr(STACK[-1], co_names[namei>>1])``." msgstr "" -#: ../../library/dis.rst:1095 +#: ../../library/dis.rst:1202 msgid "" "If the low bit of ``namei`` is set, this will attempt to load a method named " "``co_names[namei>>1]`` from the ``STACK[-1]`` object. ``STACK[-1]`` is " "popped. This bytecode distinguishes two cases: if ``STACK[-1]`` has a method " "with the correct name, the bytecode pushes the unbound method and " "``STACK[-1]``. ``STACK[-1]`` will be used as the first argument (``self``) " -"by :opcode:`CALL` when calling the unbound method. Otherwise, ``NULL`` and " -"the object returned by the attribute lookup are pushed." +"by :opcode:`CALL` or :opcode:`CALL_KW` when calling the unbound method. " +"Otherwise, ``NULL`` and the object returned by the attribute lookup are " +"pushed." msgstr "" -#: ../../library/dis.rst:1103 +#: ../../library/dis.rst:1211 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is pushed to " "the stack before the attribute or unbound method respectively." msgstr "" -#: ../../library/dis.rst:1110 +#: ../../library/dis.rst:1218 msgid "" "This opcode implements :func:`super`, both in its zero-argument and two-" "argument forms (e.g. ``super().method()``, ``super().attr`` and ``super(cls, " "self).method()``, ``super(cls, self).attr``)." msgstr "" -#: ../../library/dis.rst:1114 -msgid "" -"It pops three values from the stack (from top of stack down): - ``self``: " -"the first argument to the current method - ``cls``: the class within which " -"the current method was defined - the global ``super``" +#: ../../library/dis.rst:1222 +msgid "It pops three values from the stack (from top of stack down):" +msgstr "" + +#: ../../library/dis.rst:1224 +msgid "``self``: the first argument to the current method" +msgstr "" + +#: ../../library/dis.rst:1225 +msgid "``cls``: the class within which the current method was defined" +msgstr "" + +#: ../../library/dis.rst:1226 +msgid "the global ``super``" msgstr "" -#: ../../library/dis.rst:1119 +#: ../../library/dis.rst:1228 msgid "" "With respect to its argument, it works similarly to :opcode:`LOAD_ATTR`, " "except that ``namei`` is shifted left by 2 bits instead of 1." msgstr "" -#: ../../library/dis.rst:1122 +#: ../../library/dis.rst:1231 msgid "" "The low bit of ``namei`` signals to attempt a method load, as with :opcode:" "`LOAD_ATTR`, which results in pushing ``NULL`` and the loaded method. When " "it is unset a single value is pushed to the stack." msgstr "" -#: ../../library/dis.rst:1126 +#: ../../library/dis.rst:1235 msgid "" "The second-low bit of ``namei``, if set, means that this was a two-argument " "call to :func:`super` (unset means zero-argument)." msgstr "" -#: ../../library/dis.rst:1134 +#: ../../library/dis.rst:1243 msgid "" "Performs a Boolean operation. The operation name can be found in " -"``cmp_op[opname >> 4]``." +"``cmp_op[opname >> 5]``. If the fifth-lowest bit of ``opname`` is set " +"(``opname & 16``), the result should be coerced to ``bool``." msgstr "" -#: ../../library/dis.rst:1137 +#: ../../library/dis.rst:1247 msgid "" -"The cmp_op index is now stored in the four-highest bits of oparg instead of " -"the four-lowest bits of oparg." +"The fifth-lowest bit of the oparg now indicates a forced conversion to :" +"class:`bool`." msgstr "" -#: ../../library/dis.rst:1143 +#: ../../library/dis.rst:1254 msgid "Performs ``is`` comparison, or ``is not`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1150 +#: ../../library/dis.rst:1261 msgid "Performs ``in`` comparison, or ``not in`` if ``invert`` is 1." msgstr "" -#: ../../library/dis.rst:1157 +#: ../../library/dis.rst:1268 msgid "" "Imports the module ``co_names[namei]``. ``STACK[-1]`` and ``STACK[-2]`` are " "popped and provide the *fromlist* and *level* arguments of :func:" @@ -1313,68 +1436,68 @@ msgid "" "opcode:`STORE_FAST` instruction modifies the namespace." msgstr "" -#: ../../library/dis.rst:1165 +#: ../../library/dis.rst:1276 msgid "" "Loads the attribute ``co_names[namei]`` from the module found in " "``STACK[-1]``. The resulting object is pushed onto the stack, to be " "subsequently stored by a :opcode:`STORE_FAST` instruction." msgstr "" -#: ../../library/dis.rst:1172 +#: ../../library/dis.rst:1283 msgid "Increments bytecode counter by *delta*." msgstr "" -#: ../../library/dis.rst:1177 +#: ../../library/dis.rst:1288 msgid "Decrements bytecode counter by *delta*. Checks for interrupts." msgstr "" -#: ../../library/dis.rst:1184 +#: ../../library/dis.rst:1295 msgid "Decrements bytecode counter by *delta*. Does not check for interrupts." msgstr "" -#: ../../library/dis.rst:1191 +#: ../../library/dis.rst:1302 msgid "" "If ``STACK[-1]`` is true, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1194 ../../library/dis.rst:1207 +#: ../../library/dis.rst:1305 ../../library/dis.rst:1321 msgid "" "The oparg is now a relative delta rather than an absolute target. This " "opcode is a pseudo-instruction, replaced in final bytecode by the directed " "versions (forward/backward)." msgstr "" -#: ../../library/dis.rst:1199 ../../library/dis.rst:1212 -#: ../../library/dis.rst:1225 ../../library/dis.rst:1239 +#: ../../library/dis.rst:1310 ../../library/dis.rst:1326 +#: ../../library/dis.rst:1342 ../../library/dis.rst:1356 msgid "This is no longer a pseudo-instruction." msgstr "" -#: ../../library/dis.rst:1204 +#: ../../library/dis.rst:1318 msgid "" "If ``STACK[-1]`` is false, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1217 +#: ../../library/dis.rst:1334 msgid "" "If ``STACK[-1]`` is not ``None``, increments the bytecode counter by " "*delta*. ``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1220 ../../library/dis.rst:1234 +#: ../../library/dis.rst:1337 ../../library/dis.rst:1351 msgid "" "This opcode is a pseudo-instruction, replaced in final bytecode by the " "directed versions (forward/backward)." msgstr "" -#: ../../library/dis.rst:1231 +#: ../../library/dis.rst:1348 msgid "" "If ``STACK[-1]`` is ``None``, increments the bytecode counter by *delta*. " "``STACK[-1]`` is popped." msgstr "" -#: ../../library/dis.rst:1244 +#: ../../library/dis.rst:1361 msgid "" "``STACK[-1]`` is an :term:`iterator`. Call its :meth:`~iterator.__next__` " "method. If this yields a new value, push it on the stack (leaving the " @@ -1382,88 +1505,72 @@ msgid "" "code counter is incremented by *delta*." msgstr "" -#: ../../library/dis.rst:1249 +#: ../../library/dis.rst:1366 msgid "Up until 3.11 the iterator was popped when it was exhausted." msgstr "" -#: ../../library/dis.rst:1254 +#: ../../library/dis.rst:1371 msgid "Loads the global named ``co_names[namei>>1]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1256 +#: ../../library/dis.rst:1373 msgid "" "If the low bit of ``namei`` is set, then a ``NULL`` is pushed to the stack " "before the global variable." msgstr "" -#: ../../library/dis.rst:1262 +#: ../../library/dis.rst:1379 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack." msgstr "" -#: ../../library/dis.rst:1264 +#: ../../library/dis.rst:1381 msgid "" "This opcode is now only used in situations where the local variable is " "guaranteed to be initialized. It cannot raise :exc:`UnboundLocalError`." msgstr "" -#: ../../library/dis.rst:1270 +#: ../../library/dis.rst:1387 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack, " "raising an :exc:`UnboundLocalError` if the local variable has not been " "initialized." msgstr "" -#: ../../library/dis.rst:1278 +#: ../../library/dis.rst:1395 msgid "" "Pushes a reference to the local ``co_varnames[var_num]`` onto the stack (or " "pushes ``NULL`` onto the stack if the local variable has not been " "initialized) and sets ``co_varnames[var_num]`` to ``NULL``." msgstr "" -#: ../../library/dis.rst:1286 +#: ../../library/dis.rst:1403 msgid "Stores ``STACK.pop()`` into the local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1291 +#: ../../library/dis.rst:1408 msgid "Deletes local ``co_varnames[var_num]``." msgstr "" -#: ../../library/dis.rst:1296 +#: ../../library/dis.rst:1413 msgid "" "Creates a new cell in slot ``i``. If that slot is nonempty then that value " "is stored into the new cell." msgstr "" -#: ../../library/dis.rst:1304 -msgid "" -"Pushes a reference to the cell contained in slot ``i`` of the \"fast " -"locals\" storage. The name of the variable is ``co_fastlocalnames[i]``." -msgstr "" - -#: ../../library/dis.rst:1307 -msgid "" -"Note that ``LOAD_CLOSURE`` is effectively an alias for ``LOAD_FAST``. It " -"exists to keep bytecode a little more readable." -msgstr "" - -#: ../../library/dis.rst:1310 -msgid "``i`` is no longer offset by the length of ``co_varnames``." -msgstr "" - -#: ../../library/dis.rst:1316 +#: ../../library/dis.rst:1421 msgid "" "Loads the cell contained in slot ``i`` of the \"fast locals\" storage. " "Pushes a reference to the object the cell contains on the stack." msgstr "" -#: ../../library/dis.rst:1319 ../../library/dis.rst:1341 -#: ../../library/dis.rst:1352 +#: ../../library/dis.rst:1424 ../../library/dis.rst:1446 +#: ../../library/dis.rst:1457 msgid "" "``i`` is no longer offset by the length of :attr:`~codeobject.co_varnames`." msgstr "" -#: ../../library/dis.rst:1325 +#: ../../library/dis.rst:1430 msgid "" "Pops a mapping off the stack and looks up the name associated with slot " "``i`` of the \"fast locals\" storage in this mapping. If the name is not " @@ -1473,94 +1580,111 @@ msgid "" "scopes ` within class bodies." msgstr "" -#: ../../library/dis.rst:1338 +#: ../../library/dis.rst:1443 msgid "" "Stores ``STACK.pop()`` into the cell contained in slot ``i`` of the \"fast " "locals\" storage." msgstr "" -#: ../../library/dis.rst:1347 +#: ../../library/dis.rst:1452 msgid "" "Empties the cell contained in slot ``i`` of the \"fast locals\" storage. " "Used by the :keyword:`del` statement." msgstr "" -#: ../../library/dis.rst:1358 +#: ../../library/dis.rst:1463 msgid "" "Copies the ``n`` free variables from the closure into the frame. Removes the " "need for special code on the caller's side when calling closures." msgstr "" -#: ../../library/dis.rst:1367 +#: ../../library/dis.rst:1472 msgid "" "Raises an exception using one of the 3 forms of the ``raise`` statement, " "depending on the value of *argc*:" msgstr "" -#: ../../library/dis.rst:1370 +#: ../../library/dis.rst:1475 msgid "0: ``raise`` (re-raise previous exception)" msgstr "" -#: ../../library/dis.rst:1371 +#: ../../library/dis.rst:1476 msgid "" "1: ``raise STACK[-1]`` (raise exception instance or type at ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1372 +#: ../../library/dis.rst:1477 msgid "" "2: ``raise STACK[-2] from STACK[-1]`` (raise exception instance or type at " "``STACK[-2]`` with ``__cause__`` set to ``STACK[-1]``)" msgstr "" -#: ../../library/dis.rst:1378 +#: ../../library/dis.rst:1483 msgid "" -"Calls a callable object with the number of arguments specified by ``argc``, " -"including the named arguments specified by the preceding :opcode:`KW_NAMES`, " -"if any. On the stack are (in ascending order), either:" +"Calls a callable object with the number of arguments specified by ``argc``. " +"On the stack are (in ascending order):" msgstr "" -#: ../../library/dis.rst:1383 -msgid "NULL" +#: ../../library/dis.rst:1486 ../../library/dis.rst:1510 +msgid "The callable" msgstr "" -#: ../../library/dis.rst:1384 ../../library/dis.rst:1390 -msgid "The callable" +#: ../../library/dis.rst:1487 ../../library/dis.rst:1511 +msgid "``self`` or ``NULL``" msgstr "" -#: ../../library/dis.rst:1385 -msgid "The positional arguments" +#: ../../library/dis.rst:1488 ../../library/dis.rst:1512 +msgid "The remaining positional arguments" msgstr "" -#: ../../library/dis.rst:1386 ../../library/dis.rst:1393 -msgid "The named arguments" +#: ../../library/dis.rst:1490 +msgid "``argc`` is the total of the positional arguments, excluding ``self``." msgstr "" -#: ../../library/dis.rst:1388 -msgid "or:" -msgstr "或:" +#: ../../library/dis.rst:1492 +msgid "" +"``CALL`` pops all arguments and the callable object off the stack, calls the " +"callable object with those arguments, and pushes the return value returned " +"by the callable object." +msgstr "" -#: ../../library/dis.rst:1391 -msgid "``self``" -msgstr "``self``" +#: ../../library/dis.rst:1498 +msgid "The callable now always appears at the same position on the stack." +msgstr "" -#: ../../library/dis.rst:1392 -msgid "The remaining positional arguments" +#: ../../library/dis.rst:1501 +msgid "Calls with keyword arguments are now handled by :opcode:`CALL_KW`." msgstr "" -#: ../../library/dis.rst:1395 +#: ../../library/dis.rst:1507 +msgid "" +"Calls a callable object with the number of arguments specified by ``argc``, " +"including one or more named arguments. On the stack are (in ascending order):" +msgstr "" + +#: ../../library/dis.rst:1513 +msgid "The named arguments" +msgstr "" + +#: ../../library/dis.rst:1514 +msgid "A :class:`tuple` of keyword argument names" +msgstr "" + +#: ../../library/dis.rst:1516 msgid "" "``argc`` is the total of the positional and named arguments, excluding " -"``self`` when a ``NULL`` is not present." +"``self``. The length of the tuple of keyword argument names is the number of " +"named arguments." msgstr "" -#: ../../library/dis.rst:1398 +#: ../../library/dis.rst:1519 msgid "" -"``CALL`` pops all arguments and the callable object off the stack, calls the " -"callable object with those arguments, and pushes the return value returned " -"by the callable object." +"``CALL_KW`` pops all arguments, the keyword names, and the callable object " +"off the stack, calls the callable object with those arguments, and pushes " +"the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1407 +#: ../../library/dis.rst:1528 msgid "" "Calls a callable object with variable set of positional and keyword " "arguments. If the lowest bit of *flags* is set, the top of the stack " @@ -1572,73 +1696,76 @@ msgid "" "arguments, and pushes the return value returned by the callable object." msgstr "" -#: ../../library/dis.rst:1422 +#: ../../library/dis.rst:1543 msgid "" "Pushes a ``NULL`` to the stack. Used in the call sequence to match the " "``NULL`` pushed by :opcode:`LOAD_METHOD` for non-method calls." msgstr "" -#: ../../library/dis.rst:1431 +#: ../../library/dis.rst:1552 msgid "" -"Prefixes :opcode:`CALL`. Stores a reference to ``co_consts[consti]`` into an " -"internal variable for use by :opcode:`CALL`. ``co_consts[consti]`` must be a " -"tuple of strings." +"Pushes a new function object on the stack built from the code object at " +"``STACK[1]``." +msgstr "" + +#: ../../library/dis.rst:1554 +msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" msgstr "" -#: ../../library/dis.rst:1440 +#: ../../library/dis.rst:1557 +msgid "Qualified name at ``STACK[-1]`` was removed." +msgstr "" + +#: ../../library/dis.rst:1560 msgid "" -"Pushes a new function object on the stack. From bottom to top, the consumed " -"stack must consist of values if the argument carries a specified flag value" +"Extra function attributes on the stack, signaled by oparg flags, were " +"removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`." msgstr "" -#: ../../library/dis.rst:1443 +#: ../../library/dis.rst:1567 +msgid "" +"Sets an attribute on a function object. Expects the function at " +"``STACK[-1]`` and the attribute value to set at ``STACK[-2]``; consumes both " +"and leaves the function at ``STACK[-1]``. The flag determines which " +"attribute to set:" +msgstr "" + +#: ../../library/dis.rst:1571 msgid "" "``0x01`` a tuple of default values for positional-only and positional-or-" "keyword parameters in positional order" msgstr "" -#: ../../library/dis.rst:1445 +#: ../../library/dis.rst:1573 msgid "``0x02`` a dictionary of keyword-only parameters' default values" msgstr "" -#: ../../library/dis.rst:1446 +#: ../../library/dis.rst:1574 msgid "``0x04`` a tuple of strings containing parameters' annotations" msgstr "" -#: ../../library/dis.rst:1447 +#: ../../library/dis.rst:1575 msgid "``0x08`` a tuple containing cells for free variables, making a closure" msgstr "" -#: ../../library/dis.rst:1448 -msgid "the code associated with the function (at ``STACK[-1]``)" -msgstr "" - -#: ../../library/dis.rst:1450 -msgid "Flag value ``0x04`` is a tuple of strings instead of dictionary" -msgstr "" - -#: ../../library/dis.rst:1453 -msgid "Qualified name at ``STACK[-1]`` was removed." -msgstr "" - -#: ../../library/dis.rst:1461 +#: ../../library/dis.rst:1584 msgid "" "Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, " "implements::" msgstr "" -#: ../../library/dis.rst:1463 +#: ../../library/dis.rst:1586 msgid "" "end = STACK.pop()\n" "start = STACK.pop()\n" "STACK.append(slice(start, end))" msgstr "" -#: ../../library/dis.rst:1467 +#: ../../library/dis.rst:1590 msgid "if it is 3, implements::" msgstr "" -#: ../../library/dis.rst:1469 +#: ../../library/dis.rst:1592 msgid "" "step = STACK.pop()\n" "end = STACK.pop()\n" @@ -1650,11 +1777,11 @@ msgstr "" "start = STACK.pop()\n" "STACK.append(slice(start, end, step))" -#: ../../library/dis.rst:1474 +#: ../../library/dis.rst:1597 msgid "See the :func:`slice` built-in function for more information." msgstr "" -#: ../../library/dis.rst:1479 +#: ../../library/dis.rst:1602 msgid "" "Prefixes any opcode which has an argument too big to fit into the default " "one byte. *ext* holds an additional byte which act as higher bits in the " @@ -1662,54 +1789,75 @@ msgid "" "allowed, forming an argument from two-byte to four-byte." msgstr "" -#: ../../library/dis.rst:1487 +#: ../../library/dis.rst:1610 +msgid "Convert value to a string, depending on ``oparg``::" +msgstr "" + +#: ../../library/dis.rst:1612 msgid "" -"Used for implementing formatted literal strings (f-strings). Pops an " -"optional *fmt_spec* from the stack, then a required *value*. *flags* is " -"interpreted as follows:" +"value = STACK.pop()\n" +"result = func(value)\n" +"STACK.append(result)" msgstr "" +"value = STACK.pop()\n" +"result = func(value)\n" +"STACK.append(result)" -#: ../../library/dis.rst:1491 -msgid "``(flags & 0x03) == 0x00``: *value* is formatted as-is." +#: ../../library/dis.rst:1616 +msgid "``oparg == 1``: call :func:`str` on *value*" msgstr "" -#: ../../library/dis.rst:1492 -msgid "" -"``(flags & 0x03) == 0x01``: call :func:`str` on *value* before formatting it." +#: ../../library/dis.rst:1617 +msgid "``oparg == 2``: call :func:`repr` on *value*" msgstr "" -#: ../../library/dis.rst:1494 -msgid "" -"``(flags & 0x03) == 0x02``: call :func:`repr` on *value* before formatting " -"it." +#: ../../library/dis.rst:1618 +msgid "``oparg == 3``: call :func:`ascii` on *value*" msgstr "" -#: ../../library/dis.rst:1496 -msgid "" -"``(flags & 0x03) == 0x03``: call :func:`ascii` on *value* before formatting " -"it." +#: ../../library/dis.rst:1620 ../../library/dis.rst:1633 +#: ../../library/dis.rst:1646 +msgid "Used for implementing formatted literal strings (f-strings)." msgstr "" -#: ../../library/dis.rst:1498 +#: ../../library/dis.rst:1627 +msgid "Formats the value on top of stack::" +msgstr "" + +#: ../../library/dis.rst:1629 msgid "" -"``(flags & 0x04) == 0x04``: pop *fmt_spec* from the stack and use it, else " -"use an empty *fmt_spec*." +"value = STACK.pop()\n" +"result = value.__format__(\"\")\n" +"STACK.append(result)" msgstr "" +"value = STACK.pop()\n" +"result = value.__format__(\"\")\n" +"STACK.append(result)" -#: ../../library/dis.rst:1501 +#: ../../library/dis.rst:1639 +msgid "Formats the given value with the given format spec::" +msgstr "" + +#: ../../library/dis.rst:1641 msgid "" -"Formatting is performed using :c:func:`PyObject_Format`. The result is " -"pushed on the stack." +"spec = STACK.pop()\n" +"value = STACK.pop()\n" +"result = value.__format__(spec)\n" +"STACK.append(result)" msgstr "" +"spec = STACK.pop()\n" +"value = STACK.pop()\n" +"result = value.__format__(spec)\n" +"STACK.append(result)" -#: ../../library/dis.rst:1509 +#: ../../library/dis.rst:1653 msgid "" "``STACK[-1]`` is a tuple of keyword attribute names, ``STACK[-2]`` is the " "class being matched against, and ``STACK[-3]`` is the match subject. " "*count* is the number of positional sub-patterns." msgstr "" -#: ../../library/dis.rst:1513 +#: ../../library/dis.rst:1657 msgid "" "Pop ``STACK[-1]``, ``STACK[-2]``, and ``STACK[-3]``. If ``STACK[-3]`` is an " "instance of ``STACK[-2]`` and has the positional and keyword attributes " @@ -1717,269 +1865,285 @@ msgid "" "Otherwise, push ``None``." msgstr "" -#: ../../library/dis.rst:1527 +#: ../../library/dis.rst:1671 msgid "A no-op. Performs internal tracing, debugging and optimization checks." msgstr "" -#: ../../library/dis.rst:1529 -msgid "The ``where`` operand marks where the ``RESUME`` occurs:" +#: ../../library/dis.rst:1673 +msgid "" +"The ``context`` oparand consists of two parts. The lowest two bits indicate " +"where the ``RESUME`` occurs:" msgstr "" -#: ../../library/dis.rst:1531 +#: ../../library/dis.rst:1676 msgid "" "``0`` The start of a function, which is neither a generator, coroutine nor " "an async generator" msgstr "" -#: ../../library/dis.rst:1533 +#: ../../library/dis.rst:1678 msgid "``1`` After a ``yield`` expression" msgstr "" -#: ../../library/dis.rst:1534 +#: ../../library/dis.rst:1679 msgid "``2`` After a ``yield from`` expression" msgstr "" -#: ../../library/dis.rst:1535 +#: ../../library/dis.rst:1680 msgid "``3`` After an ``await`` expression" msgstr "" -#: ../../library/dis.rst:1542 +#: ../../library/dis.rst:1682 +msgid "" +"The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` " +"otherwise." +msgstr "" + +#: ../../library/dis.rst:1687 +msgid "The oparg value changed to include information about except-depth" +msgstr "" + +#: ../../library/dis.rst:1693 msgid "" "Create a generator, coroutine, or async generator from the current frame. " "Used as first opcode of in code object for the above mentioned callables. " "Clear the current frame and return the newly created generator." msgstr "" -#: ../../library/dis.rst:1551 +#: ../../library/dis.rst:1702 msgid "" "Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])``. Used in ``yield " "from`` and ``await`` statements." msgstr "" -#: ../../library/dis.rst:1554 +#: ../../library/dis.rst:1705 msgid "" "If the call raises :exc:`StopIteration`, pop the top value from the stack, " "push the exception's ``value`` attribute, and increment the bytecode counter " "by *delta*." msgstr "" -#: ../../library/dis.rst:1563 +#: ../../library/dis.rst:1714 msgid "" "This is not really an opcode. It identifies the dividing line between " "opcodes in the range [0,255] which don't use their argument and those that " "do (``< HAVE_ARGUMENT`` and ``>= HAVE_ARGUMENT``, respectively)." msgstr "" -#: ../../library/dis.rst:1567 +#: ../../library/dis.rst:1718 msgid "" -"If your application uses pseudo instructions, use the :data:`hasarg` " -"collection instead." +"If your application uses pseudo instructions or specialized instructions, " +"use the :data:`hasarg` collection instead." msgstr "" -#: ../../library/dis.rst:1570 +#: ../../library/dis.rst:1721 msgid "" "Now every instruction has an argument, but opcodes ``< HAVE_ARGUMENT`` " "ignore it. Before, only opcodes ``>= HAVE_ARGUMENT`` had an argument." msgstr "" -#: ../../library/dis.rst:1574 +#: ../../library/dis.rst:1725 msgid "" "Pseudo instructions were added to the :mod:`dis` module, and for them it is " "not true that comparison with ``HAVE_ARGUMENT`` indicates whether they use " "their arg." msgstr "" -#: ../../library/dis.rst:1582 +#: ../../library/dis.rst:1730 +msgid "Use :data:`hasarg` instead." +msgstr "" + +#: ../../library/dis.rst:1735 msgid "" "Calls an intrinsic function with one argument. Passes ``STACK[-1]`` as the " "argument and sets ``STACK[-1]`` to the result. Used to implement " "functionality that is not performance critical." msgstr "" -#: ../../library/dis.rst:1586 ../../library/dis.rst:1640 +#: ../../library/dis.rst:1739 ../../library/dis.rst:1793 msgid "The operand determines which intrinsic function is called:" msgstr "" -#: ../../library/dis.rst:1589 ../../library/dis.rst:1643 +#: ../../library/dis.rst:1742 ../../library/dis.rst:1796 msgid "Operand" msgstr "" -#: ../../library/dis.rst:1589 ../../library/dis.rst:1643 +#: ../../library/dis.rst:1742 ../../library/dis.rst:1796 msgid "Description" msgstr "" -#: ../../library/dis.rst:1591 +#: ../../library/dis.rst:1744 msgid "``INTRINSIC_1_INVALID``" msgstr "``INTRINSIC_1_INVALID``" -#: ../../library/dis.rst:1591 ../../library/dis.rst:1645 +#: ../../library/dis.rst:1744 ../../library/dis.rst:1798 msgid "Not valid" msgstr "" -#: ../../library/dis.rst:1593 +#: ../../library/dis.rst:1746 msgid "``INTRINSIC_PRINT``" msgstr "``INTRINSIC_PRINT``" -#: ../../library/dis.rst:1593 +#: ../../library/dis.rst:1746 msgid "Prints the argument to standard out. Used in the REPL." msgstr "" -#: ../../library/dis.rst:1596 +#: ../../library/dis.rst:1749 msgid "``INTRINSIC_IMPORT_STAR``" msgstr "``INTRINSIC_IMPORT_STAR``" -#: ../../library/dis.rst:1596 +#: ../../library/dis.rst:1749 msgid "Performs ``import *`` for the named module." msgstr "" -#: ../../library/dis.rst:1599 +#: ../../library/dis.rst:1752 msgid "``INTRINSIC_STOPITERATION_ERROR``" msgstr "``INTRINSIC_STOPITERATION_ERROR``" -#: ../../library/dis.rst:1599 +#: ../../library/dis.rst:1752 msgid "Extracts the return value from a ``StopIteration`` exception." msgstr "" -#: ../../library/dis.rst:1602 +#: ../../library/dis.rst:1755 msgid "``INTRINSIC_ASYNC_GEN_WRAP``" msgstr "``INTRINSIC_ASYNC_GEN_WRAP``" -#: ../../library/dis.rst:1602 +#: ../../library/dis.rst:1755 msgid "Wraps an async generator value" msgstr "" -#: ../../library/dis.rst:1604 +#: ../../library/dis.rst:1757 msgid "``INTRINSIC_UNARY_POSITIVE``" msgstr "``INTRINSIC_UNARY_POSITIVE``" -#: ../../library/dis.rst:1604 +#: ../../library/dis.rst:1757 msgid "Performs the unary ``+`` operation" msgstr "" -#: ../../library/dis.rst:1607 +#: ../../library/dis.rst:1760 msgid "``INTRINSIC_LIST_TO_TUPLE``" msgstr "``INTRINSIC_LIST_TO_TUPLE``" -#: ../../library/dis.rst:1607 +#: ../../library/dis.rst:1760 msgid "Converts a list to a tuple" msgstr "" -#: ../../library/dis.rst:1609 +#: ../../library/dis.rst:1762 msgid "``INTRINSIC_TYPEVAR``" msgstr "``INTRINSIC_TYPEVAR``" -#: ../../library/dis.rst:1609 +#: ../../library/dis.rst:1762 msgid "Creates a :class:`typing.TypeVar`" msgstr "" -#: ../../library/dis.rst:1611 +#: ../../library/dis.rst:1764 msgid "``INTRINSIC_PARAMSPEC``" msgstr "``INTRINSIC_PARAMSPEC``" -#: ../../library/dis.rst:1611 +#: ../../library/dis.rst:1764 msgid "Creates a :class:`typing.ParamSpec`" msgstr "" -#: ../../library/dis.rst:1614 +#: ../../library/dis.rst:1767 msgid "``INTRINSIC_TYPEVARTUPLE``" msgstr "``INTRINSIC_TYPEVARTUPLE``" -#: ../../library/dis.rst:1614 +#: ../../library/dis.rst:1767 msgid "Creates a :class:`typing.TypeVarTuple`" msgstr "" -#: ../../library/dis.rst:1617 +#: ../../library/dis.rst:1770 msgid "``INTRINSIC_SUBSCRIPT_GENERIC``" msgstr "``INTRINSIC_SUBSCRIPT_GENERIC``" -#: ../../library/dis.rst:1617 +#: ../../library/dis.rst:1770 msgid "Returns :class:`typing.Generic` subscripted with the argument" msgstr "" -#: ../../library/dis.rst:1620 +#: ../../library/dis.rst:1773 msgid "``INTRINSIC_TYPEALIAS``" msgstr "``INTRINSIC_TYPEALIAS``" -#: ../../library/dis.rst:1620 +#: ../../library/dis.rst:1773 msgid "" "Creates a :class:`typing.TypeAliasType`; used in the :keyword:`type` " "statement. The argument is a tuple of the type alias's name, type " "parameters, and value." msgstr "" -#: ../../library/dis.rst:1632 +#: ../../library/dis.rst:1785 msgid "" "Calls an intrinsic function with two arguments. Used to implement " "functionality that is not performance critical::" msgstr "" -#: ../../library/dis.rst:1635 +#: ../../library/dis.rst:1788 msgid "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" "result = intrinsic2(arg1, arg2)\n" -"STACK.push(result)" +"STACK.append(result)" msgstr "" "arg2 = STACK.pop()\n" "arg1 = STACK.pop()\n" "result = intrinsic2(arg1, arg2)\n" -"STACK.push(result)" +"STACK.append(result)" -#: ../../library/dis.rst:1645 +#: ../../library/dis.rst:1798 msgid "``INTRINSIC_2_INVALID``" msgstr "``INTRINSIC_2_INVALID``" -#: ../../library/dis.rst:1647 +#: ../../library/dis.rst:1800 msgid "``INTRINSIC_PREP_RERAISE_STAR``" msgstr "``INTRINSIC_PREP_RERAISE_STAR``" -#: ../../library/dis.rst:1647 +#: ../../library/dis.rst:1800 msgid "Calculates the :exc:`ExceptionGroup` to raise from a ``try-except*``." msgstr "" -#: ../../library/dis.rst:1651 +#: ../../library/dis.rst:1804 msgid "``INTRINSIC_TYPEVAR_WITH_BOUND``" msgstr "``INTRINSIC_TYPEVAR_WITH_BOUND``" -#: ../../library/dis.rst:1651 +#: ../../library/dis.rst:1804 msgid "Creates a :class:`typing.TypeVar` with a bound." msgstr "" -#: ../../library/dis.rst:1654 +#: ../../library/dis.rst:1807 msgid "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" msgstr "``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS``" -#: ../../library/dis.rst:1654 +#: ../../library/dis.rst:1807 msgid "Creates a :class:`typing.TypeVar` with constraints." msgstr "" -#: ../../library/dis.rst:1658 +#: ../../library/dis.rst:1811 msgid "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" msgstr "``INTRINSIC_SET_FUNCTION_TYPE_PARAMS``" -#: ../../library/dis.rst:1658 +#: ../../library/dis.rst:1811 msgid "Sets the ``__type_params__`` attribute of a function." msgstr "" -#: ../../library/dis.rst:1665 +#: ../../library/dis.rst:1818 msgid "**Pseudo-instructions**" msgstr "" -#: ../../library/dis.rst:1667 +#: ../../library/dis.rst:1820 msgid "" "These opcodes do not appear in Python bytecode. They are used by the " "compiler but are replaced by real opcodes or removed before bytecode is " "generated." msgstr "" -#: ../../library/dis.rst:1672 +#: ../../library/dis.rst:1825 msgid "" "Set up an exception handler for the following code block. If an exception " "occurs, the value stack level is restored to its current state and control " "is transferred to the exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1679 +#: ../../library/dis.rst:1832 msgid "" "Like ``SETUP_FINALLY``, but in case of an exception also pushes the last " "instruction (``lasti``) to the stack so that ``RERAISE`` can restore it. If " @@ -1988,76 +2152,91 @@ msgid "" "exception handler at ``target``." msgstr "" -#: ../../library/dis.rst:1688 +#: ../../library/dis.rst:1841 msgid "" "Like ``SETUP_CLEANUP``, but in case of an exception one more item is popped " "from the stack before control is transferred to the exception handler at " "``target``." msgstr "" -#: ../../library/dis.rst:1692 +#: ../../library/dis.rst:1845 msgid "" "This variant is used in :keyword:`with` and :keyword:`async with` " "constructs, which push the return value of the context manager's :meth:" "`~object.__enter__` or :meth:`~object.__aenter__` to the stack." msgstr "" -#: ../../library/dis.rst:1699 +#: ../../library/dis.rst:1852 msgid "" "Marks the end of the code block associated with the last ``SETUP_FINALLY``, " "``SETUP_CLEANUP`` or ``SETUP_WITH``." msgstr "" -#: ../../library/dis.rst:1705 +#: ../../library/dis.rst:1858 msgid "" "Undirected relative jump instructions which are replaced by their directed " "(forward/backward) counterparts by the assembler." msgstr "" -#: ../../library/dis.rst:1710 +#: ../../library/dis.rst:1863 +msgid "" +"Pushes a reference to the cell contained in slot ``i`` of the \"fast " +"locals\" storage." +msgstr "" + +#: ../../library/dis.rst:1866 +msgid "" +"Note that ``LOAD_CLOSURE`` is replaced with ``LOAD_FAST`` in the assembler." +msgstr "" + +#: ../../library/dis.rst:1868 +msgid "This opcode is now a pseudo-instruction." +msgstr "" + +#: ../../library/dis.rst:1874 msgid "" "Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode with a " "flag set in the arg." msgstr "" -#: ../../library/dis.rst:1717 +#: ../../library/dis.rst:1881 msgid "Opcode collections" msgstr "" -#: ../../library/dis.rst:1719 +#: ../../library/dis.rst:1883 msgid "" "These collections are provided for automatic introspection of bytecode " "instructions:" msgstr "" -#: ../../library/dis.rst:1722 +#: ../../library/dis.rst:1886 msgid "" "The collections now contain pseudo instructions and instrumented " "instructions as well. These are opcodes with values ``>= MIN_PSEUDO_OPCODE`` " "and ``>= MIN_INSTRUMENTED_OPCODE``." msgstr "" -#: ../../library/dis.rst:1729 +#: ../../library/dis.rst:1893 msgid "Sequence of operation names, indexable using the bytecode." msgstr "" -#: ../../library/dis.rst:1734 +#: ../../library/dis.rst:1898 msgid "Dictionary mapping operation names to bytecodes." msgstr "" -#: ../../library/dis.rst:1739 +#: ../../library/dis.rst:1903 msgid "Sequence of all compare operation names." msgstr "" -#: ../../library/dis.rst:1744 +#: ../../library/dis.rst:1908 msgid "Sequence of bytecodes that use their argument." msgstr "" -#: ../../library/dis.rst:1751 +#: ../../library/dis.rst:1915 msgid "Sequence of bytecodes that access a constant." msgstr "" -#: ../../library/dis.rst:1756 +#: ../../library/dis.rst:1920 msgid "" "Sequence of bytecodes that access a free variable. 'free' in this context " "refers to names in the current scope that are referenced by inner scopes or " @@ -2065,34 +2244,52 @@ msgid "" "include references to global or builtin scopes." msgstr "" -#: ../../library/dis.rst:1764 +#: ../../library/dis.rst:1928 msgid "Sequence of bytecodes that access an attribute by name." msgstr "" -#: ../../library/dis.rst:1769 -msgid "Sequence of bytecodes that have a relative jump target." -msgstr "" - -#: ../../library/dis.rst:1774 -msgid "Sequence of bytecodes that have an absolute jump target." +#: ../../library/dis.rst:1933 +msgid "Sequence of bytecodes that have a jump target. All jumps are relative." msgstr "" -#: ../../library/dis.rst:1779 +#: ../../library/dis.rst:1940 msgid "Sequence of bytecodes that access a local variable." msgstr "" -#: ../../library/dis.rst:1784 +#: ../../library/dis.rst:1945 msgid "Sequence of bytecodes of Boolean operations." msgstr "" -#: ../../library/dis.rst:1788 +#: ../../library/dis.rst:1949 msgid "Sequence of bytecodes that set an exception handler." msgstr "" -#: ../../library/dis.rst:1459 +#: ../../library/dis.rst:1956 +msgid "Sequence of bytecodes that have a relative jump target." +msgstr "" + +#: ../../library/dis.rst:1958 +msgid "All jumps are now relative. Use :data:`hasjump`." +msgstr "" + +#: ../../library/dis.rst:1964 +msgid "Sequence of bytecodes that have an absolute jump target." +msgstr "" + +#: ../../library/dis.rst:1966 +msgid "All jumps are now relative. This list is empty." +msgstr "" + +#: ../../library/dis.rst:1582 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/dis.rst:1459 +#: ../../library/dis.rst:1582 msgid "slice" msgstr "slice(切片)" + +#~ msgid "or:" +#~ msgstr "或:" + +#~ msgid "``self``" +#~ msgstr "``self``" diff --git a/library/distribution.po b/library/distribution.po index 290a362914..ef9d7dfdf8 100644 --- a/library/distribution.po +++ b/library/distribution.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" @@ -30,3 +30,6 @@ msgid "" "Package Index `__, they can also be used with a local " "index server, or without any index server at all." msgstr "" +"這些函式庫可以幫助你發布和安裝 Python 軟體。雖然這些模組設計是為了與 `Python " +"套件索引 (Python Package Index) `__ 結合使用,但它們也可以" +"搭配本地索引伺服器,甚至可以在沒有任何索引伺服器的情況下使用。" diff --git a/library/doctest.po b/library/doctest.po index 869c6cfb34..fda2f389c6 100644 --- a/library/doctest.po +++ b/library/doctest.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -166,6 +166,7 @@ msgid "And so on, eventually ending with:" msgstr "" #: ../../library/doctest.rst:116 +#, fuzzy msgid "" "Trying:\n" " factorial(1e100)\n" @@ -175,10 +176,10 @@ msgid "" " OverflowError: n too large\n" "ok\n" "2 items passed all tests:\n" -" 1 tests in __main__\n" -" 8 tests in __main__.factorial\n" -"9 tests in 2 items.\n" -"9 passed and 0 failed.\n" +" 1 test in __main__\n" +" 6 tests in __main__.factorial\n" +"7 tests in 2 items.\n" +"7 passed.\n" "Test passed.\n" "$" msgstr "" @@ -1397,14 +1398,14 @@ msgid "" "continue running examples." msgstr "" -#: ../../library/doctest.rst:930 ../../library/doctest.rst:1071 +#: ../../library/doctest.rst:930 ../../library/doctest.rst:1072 msgid "" "Optional argument *parser* specifies a :class:`DocTestParser` (or subclass) " "that should be used to extract tests from the files. It defaults to a " "normal parser (i.e., ``DocTestParser()``)." msgstr "" -#: ../../library/doctest.rst:934 ../../library/doctest.rst:1075 +#: ../../library/doctest.rst:934 ../../library/doctest.rst:1076 msgid "" "Optional argument *encoding* specifies an encoding that should be used to " "convert the file to unicode." @@ -1552,24 +1553,26 @@ msgid "" "framework and runs the interactive examples in each file. If an example in " "any file fails, then the synthesized unit test fails, and a :exc:" "`failureException` exception is raised showing the name of the file " -"containing the test and a (sometimes approximate) line number." +"containing the test and a (sometimes approximate) line number. If all the " +"examples in a file are skipped, then the synthesized unit test is also " +"marked as skipped." msgstr "" -#: ../../library/doctest.rst:1026 +#: ../../library/doctest.rst:1027 msgid "Pass one or more paths (as strings) to text files to be examined." msgstr "" -#: ../../library/doctest.rst:1028 +#: ../../library/doctest.rst:1029 msgid "Options may be provided as keyword arguments:" msgstr "" -#: ../../library/doctest.rst:1030 +#: ../../library/doctest.rst:1031 msgid "" "Optional argument *module_relative* specifies how the filenames in *paths* " "should be interpreted:" msgstr "" -#: ../../library/doctest.rst:1033 +#: ../../library/doctest.rst:1034 msgid "" "If *module_relative* is ``True`` (the default), then each filename in " "*paths* specifies an OS-independent module-relative path. By default, this " @@ -1580,14 +1583,14 @@ msgid "" "``)." msgstr "" -#: ../../library/doctest.rst:1041 +#: ../../library/doctest.rst:1042 msgid "" "If *module_relative* is ``False``, then each filename in *paths* specifies " "an OS-specific path. The path may be absolute or relative; relative paths " "are resolved with respect to the current working directory." msgstr "" -#: ../../library/doctest.rst:1045 +#: ../../library/doctest.rst:1046 msgid "" "Optional argument *package* is a Python package or the name of a Python " "package whose directory should be used as the base directory for module-" @@ -1597,7 +1600,7 @@ msgid "" "``False``." msgstr "" -#: ../../library/doctest.rst:1052 +#: ../../library/doctest.rst:1053 msgid "" "Optional argument *setUp* specifies a set-up function for the test suite. " "This is called before running the tests in each file. The *setUp* function " @@ -1605,7 +1608,7 @@ msgid "" "test globals as the *globs* attribute of the test passed." msgstr "" -#: ../../library/doctest.rst:1057 +#: ../../library/doctest.rst:1058 msgid "" "Optional argument *tearDown* specifies a tear-down function for the test " "suite. This is called after running the tests in each file. The *tearDown* " @@ -1613,14 +1616,14 @@ msgid "" "access the test globals as the *globs* attribute of the test passed." msgstr "" -#: ../../library/doctest.rst:1062 ../../library/doctest.rst:1096 +#: ../../library/doctest.rst:1063 ../../library/doctest.rst:1098 msgid "" "Optional argument *globs* is a dictionary containing the initial global " "variables for the tests. A new copy of this dictionary is created for each " "test. By default, *globs* is a new empty dictionary." msgstr "" -#: ../../library/doctest.rst:1066 +#: ../../library/doctest.rst:1067 msgid "" "Optional argument *optionflags* specifies the default doctest options for " "the tests, created by or-ing together individual option flags. See section :" @@ -1628,61 +1631,62 @@ msgid "" "for a better way to set reporting options." msgstr "" -#: ../../library/doctest.rst:1078 +#: ../../library/doctest.rst:1079 msgid "" "The global ``__file__`` is added to the globals provided to doctests loaded " "from a text file using :func:`DocFileSuite`." msgstr "" -#: ../../library/doctest.rst:1084 +#: ../../library/doctest.rst:1085 msgid "Convert doctest tests for a module to a :class:`unittest.TestSuite`." msgstr "" -#: ../../library/doctest.rst:1086 +#: ../../library/doctest.rst:1087 msgid "" "The returned :class:`unittest.TestSuite` is to be run by the unittest " "framework and runs each doctest in the module. If any of the doctests fail, " "then the synthesized unit test fails, and a :exc:`failureException` " "exception is raised showing the name of the file containing the test and a " -"(sometimes approximate) line number." +"(sometimes approximate) line number. If all the examples in a docstring are " +"skipped, then the synthesized unit test is also marked as skipped." msgstr "" -#: ../../library/doctest.rst:1092 +#: ../../library/doctest.rst:1094 msgid "" "Optional argument *module* provides the module to be tested. It can be a " "module object or a (possibly dotted) module name. If not specified, the " "module calling this function is used." msgstr "" -#: ../../library/doctest.rst:1100 +#: ../../library/doctest.rst:1102 msgid "" "Optional argument *extraglobs* specifies an extra set of global variables, " "which is merged into *globs*. By default, no extra globals are used." msgstr "" -#: ../../library/doctest.rst:1103 +#: ../../library/doctest.rst:1105 msgid "" "Optional argument *test_finder* is the :class:`DocTestFinder` object (or a " "drop-in replacement) that is used to extract doctests from the module." msgstr "" -#: ../../library/doctest.rst:1106 +#: ../../library/doctest.rst:1108 msgid "" "Optional arguments *setUp*, *tearDown*, and *optionflags* are the same as " "for function :func:`DocFileSuite` above." msgstr "" -#: ../../library/doctest.rst:1109 +#: ../../library/doctest.rst:1111 msgid "This function uses the same search technique as :func:`testmod`." msgstr "" -#: ../../library/doctest.rst:1111 +#: ../../library/doctest.rst:1113 msgid "" ":func:`DocTestSuite` returns an empty :class:`unittest.TestSuite` if " "*module* contains no docstrings instead of raising :exc:`ValueError`." msgstr "" -#: ../../library/doctest.rst:1117 +#: ../../library/doctest.rst:1119 msgid "" "When doctests which have been converted to unit tests by :func:" "`DocFileSuite` or :func:`DocTestSuite` fail, this exception is raised " @@ -1690,7 +1694,7 @@ msgid "" "approximate) line number." msgstr "" -#: ../../library/doctest.rst:1121 +#: ../../library/doctest.rst:1123 msgid "" "Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` " "out of :class:`!doctest.DocTestCase` instances, and :class:`!DocTestCase` is " @@ -1699,14 +1703,14 @@ msgid "" "questions about the exact details of :mod:`unittest` integration." msgstr "" -#: ../../library/doctest.rst:1127 +#: ../../library/doctest.rst:1129 msgid "" "Similarly, :func:`DocFileSuite` creates a :class:`unittest.TestSuite` out " "of :class:`!doctest.DocFileCase` instances, and :class:`!DocFileCase` is a " "subclass of :class:`!DocTestCase`." msgstr "" -#: ../../library/doctest.rst:1131 +#: ../../library/doctest.rst:1133 msgid "" "So both ways of creating a :class:`unittest.TestSuite` run instances of :" "class:`!DocTestCase`. This is important for a subtle reason: when you run :" @@ -1719,23 +1723,23 @@ msgid "" "through :mod:`unittest` to :mod:`doctest` test runners." msgstr "" -#: ../../library/doctest.rst:1141 +#: ../../library/doctest.rst:1143 msgid "" "For this reason, :mod:`doctest` also supports a notion of :mod:`doctest` " "reporting flags specific to :mod:`unittest` support, via this function:" msgstr "" -#: ../../library/doctest.rst:1147 +#: ../../library/doctest.rst:1149 msgid "Set the :mod:`doctest` reporting flags to use." msgstr "" -#: ../../library/doctest.rst:1149 +#: ../../library/doctest.rst:1151 msgid "" "Argument *flags* takes the :ref:`bitwise OR ` of option flags. See " "section :ref:`doctest-options`. Only \"reporting flags\" can be used." msgstr "" -#: ../../library/doctest.rst:1152 +#: ../../library/doctest.rst:1154 msgid "" "This is a module-global setting, and affects all future doctests run by " "module :mod:`unittest`: the :meth:`!runTest` method of :class:`!" @@ -1749,17 +1753,17 @@ msgid "" "`!doctest`'s :mod:`unittest` reporting flags are ignored." msgstr "" -#: ../../library/doctest.rst:1163 +#: ../../library/doctest.rst:1165 msgid "" "The value of the :mod:`unittest` reporting flags in effect before the " "function was called is returned by the function." msgstr "" -#: ../../library/doctest.rst:1170 +#: ../../library/doctest.rst:1172 msgid "Advanced API" msgstr "" -#: ../../library/doctest.rst:1172 +#: ../../library/doctest.rst:1174 msgid "" "The basic API is a simple wrapper that's intended to make doctest easy to " "use. It is fairly flexible, and should meet most users' needs; however, if " @@ -1767,62 +1771,62 @@ msgid "" "doctest's capabilities, then you should use the advanced API." msgstr "" -#: ../../library/doctest.rst:1177 +#: ../../library/doctest.rst:1179 msgid "" "The advanced API revolves around two container classes, which are used to " "store the interactive examples extracted from doctest cases:" msgstr "" -#: ../../library/doctest.rst:1180 +#: ../../library/doctest.rst:1182 msgid "" ":class:`Example`: A single Python :term:`statement`, paired with its " "expected output." msgstr "" -#: ../../library/doctest.rst:1183 +#: ../../library/doctest.rst:1185 msgid "" ":class:`DocTest`: A collection of :class:`Example`\\ s, typically extracted " "from a single docstring or text file." msgstr "" -#: ../../library/doctest.rst:1186 +#: ../../library/doctest.rst:1188 msgid "" "Additional processing classes are defined to find, parse, and run, and check " "doctest examples:" msgstr "" -#: ../../library/doctest.rst:1189 +#: ../../library/doctest.rst:1191 msgid "" ":class:`DocTestFinder`: Finds all docstrings in a given module, and uses a :" "class:`DocTestParser` to create a :class:`DocTest` from every docstring that " "contains interactive examples." msgstr "" -#: ../../library/doctest.rst:1193 +#: ../../library/doctest.rst:1195 msgid "" ":class:`DocTestParser`: Creates a :class:`DocTest` object from a string " "(such as an object's docstring)." msgstr "" -#: ../../library/doctest.rst:1196 +#: ../../library/doctest.rst:1198 msgid "" ":class:`DocTestRunner`: Executes the examples in a :class:`DocTest`, and " "uses an :class:`OutputChecker` to verify their output." msgstr "" -#: ../../library/doctest.rst:1199 +#: ../../library/doctest.rst:1201 msgid "" ":class:`OutputChecker`: Compares the actual output from a doctest example " "with the expected output, and decides whether they match." msgstr "" -#: ../../library/doctest.rst:1202 +#: ../../library/doctest.rst:1204 msgid "" "The relationships among these processing classes are summarized in the " "following diagram::" msgstr "" -#: ../../library/doctest.rst:1205 +#: ../../library/doctest.rst:1207 msgid "" " list of:\n" "+------+ +---------+\n" @@ -1842,30 +1846,30 @@ msgstr "" " DocTestParser | Example | OutputChecker\n" " +---------+" -#: ../../library/doctest.rst:1218 +#: ../../library/doctest.rst:1220 msgid "DocTest Objects" msgstr "DocTest 物件" -#: ../../library/doctest.rst:1223 +#: ../../library/doctest.rst:1225 msgid "" "A collection of doctest examples that should be run in a single namespace. " "The constructor arguments are used to initialize the attributes of the same " "names." msgstr "" -#: ../../library/doctest.rst:1227 +#: ../../library/doctest.rst:1229 msgid "" ":class:`DocTest` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1233 +#: ../../library/doctest.rst:1235 msgid "" "A list of :class:`Example` objects encoding the individual interactive " "Python examples that should be run by this test." msgstr "" -#: ../../library/doctest.rst:1239 +#: ../../library/doctest.rst:1241 msgid "" "The namespace (aka globals) that the examples should be run in. This is a " "dictionary mapping names to values. Any changes to the namespace made by " @@ -1873,57 +1877,57 @@ msgid "" "`globs` after the test is run." msgstr "" -#: ../../library/doctest.rst:1247 +#: ../../library/doctest.rst:1249 msgid "" "A string name identifying the :class:`DocTest`. Typically, this is the name " "of the object or file that the test was extracted from." msgstr "" -#: ../../library/doctest.rst:1253 +#: ../../library/doctest.rst:1255 msgid "" "The name of the file that this :class:`DocTest` was extracted from; or " "``None`` if the filename is unknown, or if the :class:`DocTest` was not " "extracted from a file." msgstr "" -#: ../../library/doctest.rst:1260 +#: ../../library/doctest.rst:1262 msgid "" "The line number within :attr:`filename` where this :class:`DocTest` begins, " "or ``None`` if the line number is unavailable. This line number is zero-" "based with respect to the beginning of the file." msgstr "" -#: ../../library/doctest.rst:1267 +#: ../../library/doctest.rst:1269 msgid "" "The string that the test was extracted from, or ``None`` if the string is " "unavailable, or if the test was not extracted from a string." msgstr "" -#: ../../library/doctest.rst:1274 +#: ../../library/doctest.rst:1276 msgid "Example Objects" msgstr "Example 物件" -#: ../../library/doctest.rst:1279 +#: ../../library/doctest.rst:1281 msgid "" "A single interactive example, consisting of a Python statement and its " "expected output. The constructor arguments are used to initialize the " "attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1284 +#: ../../library/doctest.rst:1286 msgid "" ":class:`Example` defines the following attributes. They are initialized by " "the constructor, and should not be modified directly." msgstr "" -#: ../../library/doctest.rst:1290 +#: ../../library/doctest.rst:1292 msgid "" "A string containing the example's source code. This source code consists of " "a single Python statement, and always ends with a newline; the constructor " "adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1297 +#: ../../library/doctest.rst:1299 msgid "" "The expected output from running the example's source code (either from " "stdout, or a traceback in case of exception). :attr:`want` ends with a " @@ -1931,7 +1935,7 @@ msgid "" "The constructor adds a newline when necessary." msgstr "" -#: ../../library/doctest.rst:1305 +#: ../../library/doctest.rst:1307 msgid "" "The exception message generated by the example, if the example is expected " "to generate an exception; or ``None`` if it is not expected to generate an " @@ -1940,20 +1944,20 @@ msgid "" "unless it's ``None``. The constructor adds a newline if needed." msgstr "" -#: ../../library/doctest.rst:1314 +#: ../../library/doctest.rst:1316 msgid "" "The line number within the string containing this example where the example " "begins. This line number is zero-based with respect to the beginning of the " "containing string." msgstr "" -#: ../../library/doctest.rst:1321 +#: ../../library/doctest.rst:1323 msgid "" "The example's indentation in the containing string, i.e., the number of " "space characters that precede the example's first prompt." msgstr "" -#: ../../library/doctest.rst:1327 +#: ../../library/doctest.rst:1329 msgid "" "A dictionary mapping from option flags to ``True`` or ``False``, which is " "used to override default options for this example. Any option flags not " @@ -1962,11 +1966,11 @@ msgid "" "default, no options are set." msgstr "" -#: ../../library/doctest.rst:1337 +#: ../../library/doctest.rst:1339 msgid "DocTestFinder objects" msgstr "DocTestFinder 物件" -#: ../../library/doctest.rst:1342 +#: ../../library/doctest.rst:1344 msgid "" "A processing class used to extract the :class:`DocTest`\\ s that are " "relevant to a given object, from its docstring and the docstrings of its " @@ -1974,48 +1978,48 @@ msgid "" "classes, functions, methods, staticmethods, classmethods, and properties." msgstr "" -#: ../../library/doctest.rst:1347 +#: ../../library/doctest.rst:1349 msgid "" "The optional argument *verbose* can be used to display the objects searched " "by the finder. It defaults to ``False`` (no output)." msgstr "" -#: ../../library/doctest.rst:1350 +#: ../../library/doctest.rst:1352 msgid "" "The optional argument *parser* specifies the :class:`DocTestParser` object " "(or a drop-in replacement) that is used to extract doctests from docstrings." msgstr "" -#: ../../library/doctest.rst:1353 +#: ../../library/doctest.rst:1355 msgid "" "If the optional argument *recurse* is false, then :meth:`DocTestFinder.find` " "will only examine the given object, and not any contained objects." msgstr "" -#: ../../library/doctest.rst:1356 +#: ../../library/doctest.rst:1358 msgid "" "If the optional argument *exclude_empty* is false, then :meth:`DocTestFinder." "find` will include tests for objects with empty docstrings." msgstr "" -#: ../../library/doctest.rst:1360 +#: ../../library/doctest.rst:1362 msgid ":class:`DocTestFinder` defines the following method:" msgstr "" -#: ../../library/doctest.rst:1365 +#: ../../library/doctest.rst:1367 msgid "" "Return a list of the :class:`DocTest`\\ s that are defined by *obj*'s " "docstring, or by any of its contained objects' docstrings." msgstr "" -#: ../../library/doctest.rst:1368 +#: ../../library/doctest.rst:1370 msgid "" "The optional argument *name* specifies the object's name; this name will be " "used to construct names for the returned :class:`DocTest`\\ s. If *name* is " "not specified, then ``obj.__name__`` is used." msgstr "" -#: ../../library/doctest.rst:1372 +#: ../../library/doctest.rst:1374 msgid "" "The optional parameter *module* is the module that contains the given " "object. If the module is not specified or is ``None``, then the test finder " @@ -2023,26 +2027,26 @@ msgid "" "module is used:" msgstr "" -#: ../../library/doctest.rst:1376 +#: ../../library/doctest.rst:1378 msgid "As a default namespace, if *globs* is not specified." msgstr "" -#: ../../library/doctest.rst:1378 +#: ../../library/doctest.rst:1380 msgid "" "To prevent the DocTestFinder from extracting DocTests from objects that are " "imported from other modules. (Contained objects with modules other than " "*module* are ignored.)" msgstr "" -#: ../../library/doctest.rst:1382 +#: ../../library/doctest.rst:1384 msgid "To find the name of the file containing the object." msgstr "" -#: ../../library/doctest.rst:1384 +#: ../../library/doctest.rst:1386 msgid "To help find the line number of the object within its file." msgstr "" -#: ../../library/doctest.rst:1386 +#: ../../library/doctest.rst:1388 msgid "" "If *module* is ``False``, no attempt to find the module will be made. This " "is obscure, of use mostly in testing doctest itself: if *module* is " @@ -2051,7 +2055,7 @@ msgid "" "contained objects will (recursively) be searched for doctests." msgstr "" -#: ../../library/doctest.rst:1392 +#: ../../library/doctest.rst:1394 msgid "" "The globals for each :class:`DocTest` is formed by combining *globs* and " "*extraglobs* (bindings in *extraglobs* override bindings in *globs*). A new " @@ -2061,34 +2065,34 @@ msgid "" "defaults to ``{}``." msgstr "" -#: ../../library/doctest.rst:1403 +#: ../../library/doctest.rst:1405 msgid "DocTestParser objects" msgstr "DocTestParser 物件" -#: ../../library/doctest.rst:1408 +#: ../../library/doctest.rst:1410 msgid "" "A processing class used to extract interactive examples from a string, and " "use them to create a :class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1412 +#: ../../library/doctest.rst:1414 msgid ":class:`DocTestParser` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1417 +#: ../../library/doctest.rst:1419 msgid "" "Extract all doctest examples from the given string, and collect them into a :" "class:`DocTest` object." msgstr "" -#: ../../library/doctest.rst:1420 +#: ../../library/doctest.rst:1422 msgid "" "*globs*, *name*, *filename*, and *lineno* are attributes for the new :class:" "`DocTest` object. See the documentation for :class:`DocTest` for more " "information." msgstr "" -#: ../../library/doctest.rst:1427 +#: ../../library/doctest.rst:1429 msgid "" "Extract all doctest examples from the given string, and return them as a " "list of :class:`Example` objects. Line numbers are 0-based. The optional " @@ -2096,7 +2100,7 @@ msgid "" "error messages." msgstr "" -#: ../../library/doctest.rst:1434 +#: ../../library/doctest.rst:1436 msgid "" "Divide the given string into examples and intervening text, and return them " "as a list of alternating :class:`Example`\\ s and strings. Line numbers for " @@ -2105,16 +2109,33 @@ msgid "" msgstr "" #: ../../library/doctest.rst:1443 +#, fuzzy +msgid "TestResults objects" +msgstr "DocTestRunner 物件" + +#: ../../library/doctest.rst:1450 +msgid "Number of failed tests." +msgstr "" + +#: ../../library/doctest.rst:1454 +msgid "Number of attempted tests." +msgstr "" + +#: ../../library/doctest.rst:1458 +msgid "Number of skipped tests." +msgstr "" + +#: ../../library/doctest.rst:1466 msgid "DocTestRunner objects" msgstr "DocTestRunner 物件" -#: ../../library/doctest.rst:1448 +#: ../../library/doctest.rst:1471 msgid "" "A processing class used to execute and verify the interactive examples in a :" "class:`DocTest`." msgstr "" -#: ../../library/doctest.rst:1451 +#: ../../library/doctest.rst:1474 msgid "" "The comparison between expected outputs and actual outputs is done by an :" "class:`OutputChecker`. This comparison may be customized with a number of " @@ -2124,7 +2145,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/doctest.rst:1457 +#: ../../library/doctest.rst:1480 msgid "" "The test runner's display output can be controlled in two ways. First, an " "output function can be passed to :meth:`run`; this function will be called " @@ -2135,14 +2156,14 @@ msgid "" "`report_unexpected_exception`, and :meth:`report_failure`." msgstr "" -#: ../../library/doctest.rst:1465 +#: ../../library/doctest.rst:1488 msgid "" "The optional keyword argument *checker* specifies the :class:`OutputChecker` " "object (or drop-in replacement) that should be used to compare the expected " "outputs to the actual outputs of doctest examples." msgstr "" -#: ../../library/doctest.rst:1469 +#: ../../library/doctest.rst:1492 msgid "" "The optional keyword argument *verbose* controls the :class:" "`DocTestRunner`'s verbosity. If *verbose* is ``True``, then information is " @@ -2151,60 +2172,68 @@ msgid "" "verbose output is used iff the command-line switch ``-v`` is used." msgstr "" -#: ../../library/doctest.rst:1475 +#: ../../library/doctest.rst:1498 msgid "" "The optional keyword argument *optionflags* can be used to control how the " "test runner compares expected output to actual output, and how it displays " "failures. For more information, see section :ref:`doctest-options`." msgstr "" -#: ../../library/doctest.rst:1480 +#: ../../library/doctest.rst:1502 +msgid "" +"The test runner accumulates statistics. The aggregated number of attempted, " +"failed and skipped examples is also available via the :attr:`tries`, :attr:" +"`failures` and :attr:`skips` attributes. The :meth:`run` and :meth:" +"`summarize` methods return a :class:`TestResults` instance." +msgstr "" + +#: ../../library/doctest.rst:1507 msgid ":class:`DocTestRunner` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1485 +#: ../../library/doctest.rst:1512 msgid "" "Report that the test runner is about to process the given example. This " "method is provided to allow subclasses of :class:`DocTestRunner` to " "customize their output; it should not be called directly." msgstr "" -#: ../../library/doctest.rst:1489 +#: ../../library/doctest.rst:1516 msgid "" "*example* is the example about to be processed. *test* is the test " "*containing example*. *out* is the output function that was passed to :meth:" "`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1496 +#: ../../library/doctest.rst:1523 msgid "" "Report that the given example ran successfully. This method is provided to " "allow subclasses of :class:`DocTestRunner` to customize their output; it " "should not be called directly." msgstr "" -#: ../../library/doctest.rst:1500 ../../library/doctest.rst:1511 +#: ../../library/doctest.rst:1527 ../../library/doctest.rst:1538 msgid "" "*example* is the example about to be processed. *got* is the actual output " "from the example. *test* is the test containing *example*. *out* is the " "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1507 +#: ../../library/doctest.rst:1534 msgid "" "Report that the given example failed. This method is provided to allow " "subclasses of :class:`DocTestRunner` to customize their output; it should " "not be called directly." msgstr "" -#: ../../library/doctest.rst:1518 +#: ../../library/doctest.rst:1545 msgid "" "Report that the given example raised an unexpected exception. This method is " "provided to allow subclasses of :class:`DocTestRunner` to customize their " "output; it should not be called directly." msgstr "" -#: ../../library/doctest.rst:1522 +#: ../../library/doctest.rst:1549 msgid "" "*example* is the example about to be processed. *exc_info* is a tuple " "containing information about the unexpected exception (as returned by :func:" @@ -2212,13 +2241,14 @@ msgid "" "output function that was passed to :meth:`DocTestRunner.run`." msgstr "" -#: ../../library/doctest.rst:1530 +#: ../../library/doctest.rst:1557 msgid "" "Run the examples in *test* (a :class:`DocTest` object), and display the " -"results using the writer function *out*." +"results using the writer function *out*. Return a :class:`TestResults` " +"instance." msgstr "" -#: ../../library/doctest.rst:1533 +#: ../../library/doctest.rst:1561 msgid "" "The examples are run in the namespace ``test.globs``. If *clear_globs* is " "true (the default), then this namespace will be cleared after the test runs, " @@ -2226,39 +2256,55 @@ msgid "" "after the test completes, then use *clear_globs=False*." msgstr "" -#: ../../library/doctest.rst:1538 +#: ../../library/doctest.rst:1566 msgid "" "*compileflags* gives the set of flags that should be used by the Python " "compiler when running the examples. If not specified, then it will default " "to the set of future-import flags that apply to *globs*." msgstr "" -#: ../../library/doctest.rst:1542 +#: ../../library/doctest.rst:1570 msgid "" "The output of each example is checked using the :class:`DocTestRunner`'s " "output checker, and the results are formatted by the :meth:`!DocTestRunner." "report_\\*` methods." msgstr "" -#: ../../library/doctest.rst:1549 +#: ../../library/doctest.rst:1577 msgid "" "Print a summary of all the test cases that have been run by this " -"DocTestRunner, and return a :term:`named tuple` ``TestResults(failed, " -"attempted)``." +"DocTestRunner, and return a :class:`TestResults` instance." msgstr "" -#: ../../library/doctest.rst:1552 +#: ../../library/doctest.rst:1580 msgid "" "The optional *verbose* argument controls how detailed the summary is. If " "the verbosity is not specified, then the :class:`DocTestRunner`'s verbosity " "is used." msgstr "" -#: ../../library/doctest.rst:1559 +#: ../../library/doctest.rst:1584 +#, fuzzy +msgid ":class:`DocTestParser` has the following attributes:" +msgstr ":exc:`DocTestFailure` 定義了以下屬性:" + +#: ../../library/doctest.rst:1588 +msgid "Number of attempted examples." +msgstr "" + +#: ../../library/doctest.rst:1592 +msgid "Number of failed examples." +msgstr "" + +#: ../../library/doctest.rst:1596 +msgid "Number of skipped examples." +msgstr "" + +#: ../../library/doctest.rst:1604 msgid "OutputChecker objects" msgstr "OutputChecker 物件" -#: ../../library/doctest.rst:1564 +#: ../../library/doctest.rst:1609 msgid "" "A class used to check the whether the actual output from a doctest example " "matches the expected output. :class:`OutputChecker` defines two methods: :" @@ -2267,11 +2313,11 @@ msgid "" "string describing the differences between two outputs." msgstr "" -#: ../../library/doctest.rst:1571 +#: ../../library/doctest.rst:1616 msgid ":class:`OutputChecker` defines the following methods:" msgstr "" -#: ../../library/doctest.rst:1575 +#: ../../library/doctest.rst:1620 msgid "" "Return ``True`` iff the actual output from an example (*got*) matches the " "expected output (*want*). These strings are always considered to match if " @@ -2280,28 +2326,28 @@ msgid "" "`doctest-options` for more information about option flags." msgstr "" -#: ../../library/doctest.rst:1584 +#: ../../library/doctest.rst:1629 msgid "" "Return a string describing the differences between the expected output for a " "given example (*example*) and the actual output (*got*). *optionflags* is " "the set of option flags used to compare *want* and *got*." msgstr "" -#: ../../library/doctest.rst:1592 +#: ../../library/doctest.rst:1637 msgid "Debugging" msgstr "" -#: ../../library/doctest.rst:1594 +#: ../../library/doctest.rst:1639 msgid "Doctest provides several mechanisms for debugging doctest examples:" msgstr "" -#: ../../library/doctest.rst:1596 +#: ../../library/doctest.rst:1641 msgid "" "Several functions convert doctests to executable Python programs, which can " "be run under the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1599 +#: ../../library/doctest.rst:1644 msgid "" "The :class:`DebugRunner` class is a subclass of :class:`DocTestRunner` that " "raises an exception for the first failing example, containing information " @@ -2309,13 +2355,13 @@ msgid "" "debugging on the example." msgstr "" -#: ../../library/doctest.rst:1604 +#: ../../library/doctest.rst:1649 msgid "" "The :mod:`unittest` cases generated by :func:`DocTestSuite` support the :" "meth:`debug` method defined by :class:`unittest.TestCase`." msgstr "" -#: ../../library/doctest.rst:1607 +#: ../../library/doctest.rst:1652 msgid "" "You can add a call to :func:`pdb.set_trace` in a doctest example, and you'll " "drop into the Python debugger when that line is executed. Then you can " @@ -2323,7 +2369,7 @@ msgid "" "`a.py` contains just this module docstring::" msgstr "" -#: ../../library/doctest.rst:1612 +#: ../../library/doctest.rst:1657 msgid "" "\"\"\"\n" ">>> def f(x):\n" @@ -2345,11 +2391,11 @@ msgstr "" "9\n" "\"\"\"" -#: ../../library/doctest.rst:1622 +#: ../../library/doctest.rst:1667 msgid "Then an interactive Python session may look like this::" msgstr "" -#: ../../library/doctest.rst:1624 +#: ../../library/doctest.rst:1669 msgid "" ">>> import a, doctest\n" ">>> doctest.testmod(a)\n" @@ -2411,17 +2457,17 @@ msgstr "" "(0, 3)\n" ">>>" -#: ../../library/doctest.rst:1655 +#: ../../library/doctest.rst:1700 msgid "" "Functions that convert doctests to Python code, and possibly run the " "synthesized code under the debugger:" msgstr "" -#: ../../library/doctest.rst:1661 +#: ../../library/doctest.rst:1706 msgid "Convert text with examples to a script." msgstr "" -#: ../../library/doctest.rst:1663 +#: ../../library/doctest.rst:1708 msgid "" "Argument *s* is a string containing doctest examples. The string is " "converted to a Python script, where doctest examples in *s* are converted to " @@ -2429,7 +2475,7 @@ msgid "" "generated script is returned as a string. For example, ::" msgstr "" -#: ../../library/doctest.rst:1668 +#: ../../library/doctest.rst:1713 msgid "" "import doctest\n" "print(doctest.script_from_examples(r\"\"\"\n" @@ -2442,11 +2488,11 @@ msgid "" "\"\"\"))" msgstr "" -#: ../../library/doctest.rst:1678 +#: ../../library/doctest.rst:1723 msgid "displays::" msgstr "" -#: ../../library/doctest.rst:1680 +#: ../../library/doctest.rst:1725 msgid "" "# Set x and y to 1 and 2.\n" "x, y = 1, 2\n" @@ -2457,18 +2503,18 @@ msgid "" "## 3" msgstr "" -#: ../../library/doctest.rst:1688 +#: ../../library/doctest.rst:1733 msgid "" "This function is used internally by other functions (see below), but can " "also be useful when you want to transform an interactive Python session into " "a Python script." msgstr "" -#: ../../library/doctest.rst:1695 +#: ../../library/doctest.rst:1740 msgid "Convert the doctest for an object to a script." msgstr "" -#: ../../library/doctest.rst:1697 +#: ../../library/doctest.rst:1742 msgid "" "Argument *module* is a module object, or dotted name of a module, containing " "the object whose doctests are of interest. Argument *name* is the name " @@ -2478,7 +2524,7 @@ msgid "" "module :file:`a.py` contains a top-level function :func:`!f`, then ::" msgstr "" -#: ../../library/doctest.rst:1704 +#: ../../library/doctest.rst:1749 msgid "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" @@ -2486,17 +2532,17 @@ msgstr "" "import a, doctest\n" "print(doctest.testsource(a, \"a.f\"))" -#: ../../library/doctest.rst:1707 +#: ../../library/doctest.rst:1752 msgid "" "prints a script version of function :func:`!f`'s docstring, with doctests " "converted to code, and the rest placed in comments." msgstr "" -#: ../../library/doctest.rst:1713 +#: ../../library/doctest.rst:1758 msgid "Debug the doctests for an object." msgstr "" -#: ../../library/doctest.rst:1715 +#: ../../library/doctest.rst:1760 msgid "" "The *module* and *name* arguments are the same as for function :func:" "`testsource` above. The synthesized Python script for the named object's " @@ -2504,13 +2550,13 @@ msgid "" "the control of the Python debugger, :mod:`pdb`." msgstr "" -#: ../../library/doctest.rst:1720 +#: ../../library/doctest.rst:1765 msgid "" "A shallow copy of ``module.__dict__`` is used for both local and global " "execution context." msgstr "" -#: ../../library/doctest.rst:1723 +#: ../../library/doctest.rst:1768 msgid "" "Optional argument *pm* controls whether post-mortem debugging is used. If " "*pm* has a true value, the script file is run directly, and the debugger " @@ -2522,30 +2568,30 @@ msgid "" "to :func:`pdb.run`." msgstr "" -#: ../../library/doctest.rst:1734 +#: ../../library/doctest.rst:1779 msgid "Debug the doctests in a string." msgstr "" -#: ../../library/doctest.rst:1736 +#: ../../library/doctest.rst:1781 msgid "" "This is like function :func:`debug` above, except that a string containing " "doctest examples is specified directly, via the *src* argument." msgstr "" -#: ../../library/doctest.rst:1739 +#: ../../library/doctest.rst:1784 msgid "" "Optional argument *pm* has the same meaning as in function :func:`debug` " "above." msgstr "" -#: ../../library/doctest.rst:1741 +#: ../../library/doctest.rst:1786 msgid "" "Optional argument *globs* gives a dictionary to use as both local and global " "execution context. If not specified, or ``None``, an empty dictionary is " "used. If specified, a shallow copy of the dictionary is used." msgstr "" -#: ../../library/doctest.rst:1746 +#: ../../library/doctest.rst:1791 msgid "" "The :class:`DebugRunner` class, and the special exceptions it may raise, are " "of most interest to testing framework authors, and will only be sketched " @@ -2553,7 +2599,7 @@ msgid "" "(which is a doctest!) for more details:" msgstr "" -#: ../../library/doctest.rst:1754 +#: ../../library/doctest.rst:1799 msgid "" "A subclass of :class:`DocTestRunner` that raises an exception as soon as a " "failure is encountered. If an unexpected exception occurs, an :exc:" @@ -2563,89 +2609,89 @@ msgid "" "the actual output." msgstr "" -#: ../../library/doctest.rst:1761 +#: ../../library/doctest.rst:1806 msgid "" "For information about the constructor parameters and methods, see the " "documentation for :class:`DocTestRunner` in section :ref:`doctest-advanced-" "api`." msgstr "" -#: ../../library/doctest.rst:1764 +#: ../../library/doctest.rst:1809 msgid "" "There are two exceptions that may be raised by :class:`DebugRunner` " "instances:" msgstr "" -#: ../../library/doctest.rst:1769 +#: ../../library/doctest.rst:1814 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example's actual output did not match its expected output. The constructor " "arguments are used to initialize the attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1773 +#: ../../library/doctest.rst:1818 msgid ":exc:`DocTestFailure` defines the following attributes:" msgstr ":exc:`DocTestFailure` 定義了以下屬性:" -#: ../../library/doctest.rst:1778 ../../library/doctest.rst:1802 +#: ../../library/doctest.rst:1823 ../../library/doctest.rst:1847 msgid "The :class:`DocTest` object that was being run when the example failed." msgstr "" -#: ../../library/doctest.rst:1783 ../../library/doctest.rst:1807 +#: ../../library/doctest.rst:1828 ../../library/doctest.rst:1852 msgid "The :class:`Example` that failed." msgstr "" -#: ../../library/doctest.rst:1788 +#: ../../library/doctest.rst:1833 msgid "The example's actual output." msgstr "" -#: ../../library/doctest.rst:1793 +#: ../../library/doctest.rst:1838 msgid "" "An exception raised by :class:`DocTestRunner` to signal that a doctest " "example raised an unexpected exception. The constructor arguments are used " "to initialize the attributes of the same names." msgstr "" -#: ../../library/doctest.rst:1797 +#: ../../library/doctest.rst:1842 msgid ":exc:`UnexpectedException` defines the following attributes:" msgstr "" -#: ../../library/doctest.rst:1812 +#: ../../library/doctest.rst:1857 msgid "" "A tuple containing information about the unexpected exception, as returned " "by :func:`sys.exc_info`." msgstr "" -#: ../../library/doctest.rst:1819 +#: ../../library/doctest.rst:1864 msgid "Soapbox" msgstr "" -#: ../../library/doctest.rst:1821 +#: ../../library/doctest.rst:1866 msgid "" "As mentioned in the introduction, :mod:`doctest` has grown to have three " "primary uses:" msgstr "" -#: ../../library/doctest.rst:1824 +#: ../../library/doctest.rst:1869 msgid "Checking examples in docstrings." msgstr "" -#: ../../library/doctest.rst:1826 +#: ../../library/doctest.rst:1871 msgid "Regression testing." msgstr "" -#: ../../library/doctest.rst:1828 +#: ../../library/doctest.rst:1873 msgid "Executable documentation / literate testing." msgstr "" -#: ../../library/doctest.rst:1830 +#: ../../library/doctest.rst:1875 msgid "" "These uses have different requirements, and it is important to distinguish " "them. In particular, filling your docstrings with obscure test cases makes " "for bad documentation." msgstr "" -#: ../../library/doctest.rst:1834 +#: ../../library/doctest.rst:1879 msgid "" "When writing a docstring, choose docstring examples with care. There's an " "art to this that needs to be learned---it may not be natural at first. " @@ -2657,7 +2703,7 @@ msgid "" "\"harmless\" change." msgstr "" -#: ../../library/doctest.rst:1842 +#: ../../library/doctest.rst:1887 msgid "" "Doctest also makes an excellent tool for regression testing, especially if " "you don't skimp on explanatory text. By interleaving prose and examples, it " @@ -2678,13 +2724,13 @@ msgid "" "different results, blurring the distinction between testing and explaining." msgstr "" -#: ../../library/doctest.rst:1860 +#: ../../library/doctest.rst:1905 msgid "" "Regression testing is best confined to dedicated objects or files. There " "are several options for organizing tests:" msgstr "" -#: ../../library/doctest.rst:1863 +#: ../../library/doctest.rst:1908 msgid "" "Write text files containing test cases as interactive examples, and test the " "files using :func:`testfile` or :func:`DocFileSuite`. This is recommended, " @@ -2692,7 +2738,7 @@ msgid "" "doctest." msgstr "" -#: ../../library/doctest.rst:1868 +#: ../../library/doctest.rst:1913 msgid "" "Define functions named ``_regrtest_topic`` that consist of single " "docstrings, containing test cases for the named topics. These functions can " @@ -2700,13 +2746,13 @@ msgid "" "test file." msgstr "" -#: ../../library/doctest.rst:1872 +#: ../../library/doctest.rst:1917 msgid "" "Define a ``__test__`` dictionary mapping from regression test topics to " "docstrings containing test cases." msgstr "" -#: ../../library/doctest.rst:1875 +#: ../../library/doctest.rst:1920 msgid "" "When you have placed your tests in a module, the module can itself be the " "test runner. When a test fails, you can arrange for your test runner to re-" @@ -2714,7 +2760,8 @@ msgid "" "example of such a test runner::" msgstr "" -#: ../../library/doctest.rst:1880 +#: ../../library/doctest.rst:1925 +#, fuzzy msgid "" "if __name__ == '__main__':\n" " import doctest\n" @@ -2729,7 +2776,7 @@ msgid "" " optionflags=flags)\n" " else:\n" " fail, total = doctest.testmod(optionflags=flags)\n" -" print(\"{} failures out of {} tests\".format(fail, total))" +" print(f\"{fail} failures out of {total} tests\")" msgstr "" "if __name__ == '__main__':\n" " import doctest\n" @@ -2746,11 +2793,11 @@ msgstr "" " fail, total = doctest.testmod(optionflags=flags)\n" " print(\"{} failures out of {} tests\".format(fail, total))" -#: ../../library/doctest.rst:1897 +#: ../../library/doctest.rst:1942 msgid "Footnotes" msgstr "註解" -#: ../../library/doctest.rst:1898 +#: ../../library/doctest.rst:1943 msgid "" "Examples containing both expected output and an exception are not supported. " "Trying to guess where one ends and the other begins is too error-prone, and " diff --git a/library/email.charset.po b/library/email.charset.po index 4800e31096..ccca6d4771 100644 --- a/library/email.charset.po +++ b/library/email.charset.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" diff --git a/library/email.compat32-message.po b/library/email.compat32-message.po index adb3d3208e..3d8265d6fc 100644 --- a/library/email.compat32-message.po +++ b/library/email.compat32-message.po @@ -2,7 +2,7 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" diff --git a/library/email.contentmanager.po b/library/email.contentmanager.po index 7462046454..a03eead9b1 100644 --- a/library/email.contentmanager.po +++ b/library/email.contentmanager.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:43+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -98,46 +98,46 @@ msgid "" msgstr "" #: ../../library/email.contentmanager.rst:61 -msgid "the type's qualname (``typ.__qualname__``)" +msgid "the type's :attr:`qualname ` (``typ.__qualname__``)" msgstr "" #: ../../library/email.contentmanager.rst:62 -msgid "the type's name (``typ.__name__``)." +msgid "the type's :attr:`name ` (``typ.__name__``)." msgstr "" #: ../../library/email.contentmanager.rst:64 msgid "" "If none of the above match, repeat all of the checks above for each of the " -"types in the :term:`MRO` (``typ.__mro__``). Finally, if no other key yields " -"a handler, check for a handler for the key ``None``. If there is no handler " -"for ``None``, raise a :exc:`KeyError` for the fully qualified name of the " -"type." +"types in the :term:`MRO` (:attr:`typ.__mro__ `). Finally, if " +"no other key yields a handler, check for a handler for the key ``None``. If " +"there is no handler for ``None``, raise a :exc:`KeyError` for the fully " +"qualified name of the type." msgstr "" -#: ../../library/email.contentmanager.rst:70 +#: ../../library/email.contentmanager.rst:71 msgid "" "Also add a :mailheader:`MIME-Version` header if one is not present (see " "also :class:`.MIMEPart`)." msgstr "" -#: ../../library/email.contentmanager.rst:76 +#: ../../library/email.contentmanager.rst:77 msgid "" "Record the function *handler* as the handler for *key*. For the possible " "values of *key*, see :meth:`get_content`." msgstr "" -#: ../../library/email.contentmanager.rst:82 +#: ../../library/email.contentmanager.rst:83 msgid "" "Record *handler* as the function to call when an object of a type matching " "*typekey* is passed to :meth:`set_content`. For the possible values of " "*typekey*, see :meth:`set_content`." msgstr "" -#: ../../library/email.contentmanager.rst:88 +#: ../../library/email.contentmanager.rst:89 msgid "Content Manager Instances" msgstr "" -#: ../../library/email.contentmanager.rst:90 +#: ../../library/email.contentmanager.rst:91 msgid "" "Currently the email package provides only one concrete content manager, :" "data:`raw_data_manager`, although more may be added in the future. :data:" @@ -145,7 +145,7 @@ msgid "" "provided by :attr:`~email.policy.EmailPolicy` and its derivatives." msgstr "" -#: ../../library/email.contentmanager.rst:99 +#: ../../library/email.contentmanager.rst:100 msgid "" "This content manager provides only a minimum interface beyond that provided " "by :class:`~email.message.Message` itself: it deals only with text, raw " @@ -158,7 +158,7 @@ msgid "" "simplifying the creation of multipart messages." msgstr "" -#: ../../library/email.contentmanager.rst:111 +#: ../../library/email.contentmanager.rst:112 msgid "" "Return the payload of the part as either a string (for ``text`` parts), an :" "class:`~email.message.EmailMessage` object (for ``message/rfc822`` parts), " @@ -168,28 +168,28 @@ msgid "" "to unicode. The default error handler is ``replace``." msgstr "" -#: ../../library/email.contentmanager.rst:130 +#: ../../library/email.contentmanager.rst:131 msgid "Add headers and payload to *msg*:" msgstr "" -#: ../../library/email.contentmanager.rst:132 +#: ../../library/email.contentmanager.rst:133 msgid "" "Add a :mailheader:`Content-Type` header with a ``maintype/subtype`` value." msgstr "" -#: ../../library/email.contentmanager.rst:135 +#: ../../library/email.contentmanager.rst:136 msgid "" "For ``str``, set the MIME ``maintype`` to ``text``, and set the subtype to " "*subtype* if it is specified, or ``plain`` if it is not." msgstr "" -#: ../../library/email.contentmanager.rst:137 +#: ../../library/email.contentmanager.rst:138 msgid "" "For ``bytes``, use the specified *maintype* and *subtype*, or raise a :exc:" "`TypeError` if they are not specified." msgstr "" -#: ../../library/email.contentmanager.rst:139 +#: ../../library/email.contentmanager.rst:140 msgid "" "For :class:`~email.message.EmailMessage` objects, set the maintype to " "``message``, and set the subtype to *subtype* if it is specified or " @@ -197,7 +197,7 @@ msgid "" "(``bytes`` objects must be used to construct ``message/partial`` parts)." msgstr "" -#: ../../library/email.contentmanager.rst:145 +#: ../../library/email.contentmanager.rst:146 msgid "" "If *charset* is provided (which is valid only for ``str``), encode the " "string to bytes using the specified character set. The default is " @@ -205,7 +205,7 @@ msgid "" "charset name, use the standard charset instead." msgstr "" -#: ../../library/email.contentmanager.rst:150 +#: ../../library/email.contentmanager.rst:151 msgid "" "If *cte* is set, encode the payload using the specified content transfer " "encoding, and set the :mailheader:`Content-Transfer-Encoding` header to that " @@ -215,13 +215,13 @@ msgid "" "that contains non-ASCII values), raise a :exc:`ValueError`." msgstr "" -#: ../../library/email.contentmanager.rst:158 +#: ../../library/email.contentmanager.rst:159 msgid "" "For ``str`` objects, if *cte* is not set use heuristics to determine the " "most compact encoding." msgstr "" -#: ../../library/email.contentmanager.rst:160 +#: ../../library/email.contentmanager.rst:161 msgid "" "For :class:`~email.message.EmailMessage`, per :rfc:`2046`, raise an error if " "a *cte* of ``quoted-printable`` or ``base64`` is requested for *subtype* " @@ -230,14 +230,14 @@ msgid "" "For all other values of *subtype*, use ``7bit``." msgstr "" -#: ../../library/email.contentmanager.rst:167 +#: ../../library/email.contentmanager.rst:168 msgid "" "A *cte* of ``binary`` does not actually work correctly yet. The " "``EmailMessage`` object as modified by ``set_content`` is correct, but :" "class:`~email.generator.BytesGenerator` does not serialize it correctly." msgstr "" -#: ../../library/email.contentmanager.rst:172 +#: ../../library/email.contentmanager.rst:173 msgid "" "If *disposition* is set, use it as the value of the :mailheader:`Content-" "Disposition` header. If not specified, and *filename* is specified, add the " @@ -246,37 +246,37 @@ msgid "" "values for *disposition* are ``attachment`` and ``inline``." msgstr "" -#: ../../library/email.contentmanager.rst:179 +#: ../../library/email.contentmanager.rst:180 msgid "" "If *filename* is specified, use it as the value of the ``filename`` " "parameter of the :mailheader:`Content-Disposition` header." msgstr "" -#: ../../library/email.contentmanager.rst:182 +#: ../../library/email.contentmanager.rst:183 msgid "" "If *cid* is specified, add a :mailheader:`Content-ID` header with *cid* as " "its value." msgstr "" -#: ../../library/email.contentmanager.rst:185 +#: ../../library/email.contentmanager.rst:186 msgid "" "If *params* is specified, iterate its ``items`` method and use the resulting " "``(key, value)`` pairs to set additional parameters on the :mailheader:" "`Content-Type` header." msgstr "" -#: ../../library/email.contentmanager.rst:189 +#: ../../library/email.contentmanager.rst:190 msgid "" "If *headers* is specified and is a list of strings of the form ``headername: " "headervalue`` or a list of ``header`` objects (distinguished from strings by " "having a ``name`` attribute), add the headers to *msg*." msgstr "" -#: ../../library/email.contentmanager.rst:196 +#: ../../library/email.contentmanager.rst:197 msgid "Footnotes" msgstr "註解" -#: ../../library/email.contentmanager.rst:197 +#: ../../library/email.contentmanager.rst:198 msgid "" "Originally added in 3.4 as a :term:`provisional module `" msgstr "" diff --git a/library/email.encoders.po b/library/email.encoders.po index b30b4da3e9..851f162ded 100644 --- a/library/email.encoders.po +++ b/library/email.encoders.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 10:36+0000\n" "PO-Revision-Date: 2024-05-03 03:44+0000\n" diff --git a/library/email.errors.po b/library/email.errors.po index b9ac58c595..4e9e91bc1f 100644 --- a/library/email.errors.po +++ b/library/email.errors.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-08-07 00:03+0000\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" diff --git a/library/email.examples.po b/library/email.examples.po index fb1ded2ecc..fe74e43133 100644 --- a/library/email.examples.po +++ b/library/email.examples.po @@ -3,9 +3,9 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -197,7 +197,7 @@ msgid "" " # Guess the content type based on the file's extension. Encoding\n" " # will be ignored, although we should check for simple things like\n" " # gzip'd or compressed files.\n" -" ctype, encoding = mimetypes.guess_type(path)\n" +" ctype, encoding = mimetypes.guess_file_type(path)\n" " if ctype is None or encoding is not None:\n" " # No guess could be made, or the file is encoded (compressed), " "so\n" @@ -306,14 +306,14 @@ msgid "" "\n" "# Create the base text message.\n" "msg = EmailMessage()\n" -"msg['Subject'] = \"Ayons asperges pour le déjeuner\"\n" +"msg['Subject'] = \"Pourquoi pas des asperges pour ce midi ?\"\n" "msg['From'] = Address(\"Pepé Le Pew\", \"pepe\", \"example.com\")\n" "msg['To'] = (Address(\"Penelope Pussycat\", \"penelope\", \"example.com\"),\n" " Address(\"Fabrette Pussycat\", \"fabrette\", \"example.com\"))\n" "msg.set_content(\"\"\"\\\n" "Salut!\n" "\n" -"Cela ressemble à un excellent recipie[1] déjeuner.\n" +"Cette recette [1] sera sûrement un très bon repas.\n" "\n" "[1] http://www.yummly.com/recipe/Roasted-Asparagus-Epicurious-203718\n" "\n" @@ -331,11 +331,11 @@ msgid "" " \n" " \n" "

Salut!

\n" -"

Cela ressemble à un excellent\n" +"

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

\n" " \n" " \n" @@ -463,11 +463,11 @@ msgid "" "To: Penelope Pussycat , Fabrette Pussycat " "\n" "From: Pepé Le Pew \n" -"Subject: Ayons asperges pour le déjeuner\n" +"Subject: Pourquoi pas des asperges pour ce midi ?\n" "\n" "Salut!\n" "\n" -"Cela ressemble à un excellent recipie[1] déjeuner." +"Cette recette [1] sera sûrement un très bon repas." msgstr "" #: ../../library/email.examples.rst:66 diff --git a/library/email.generator.po b/library/email.generator.po index b0ae12d0f7..64c675911d 100644 --- a/library/email.generator.po +++ b/library/email.generator.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,9 +31,9 @@ msgid "" "One of the most common tasks is to generate the flat (serialized) version of " "the email message represented by a message object structure. You will need " "to do this if you want to send your message via :meth:`smtplib.SMTP." -"sendmail` or the :mod:`nntplib` module, or print the message on the " -"console. Taking a message object structure and producing a serialized " -"representation is the job of the generator classes." +"sendmail`, or print the message on the console. Taking a message object " +"structure and producing a serialized representation is the job of the " +"generator classes." msgstr "" #: ../../library/email.generator.rst:18 diff --git a/library/email.header.po b/library/email.header.po index 1e9c38a9c8..ab91339aba 100644 --- a/library/email.header.po +++ b/library/email.header.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" diff --git a/library/email.headerregistry.po b/library/email.headerregistry.po index 4fedfdee9a..7d6b290f43 100644 --- a/library/email.headerregistry.po +++ b/library/email.headerregistry.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -390,7 +390,7 @@ msgid "" "class. When *use_default_map* is ``True`` (the default), the standard " "mapping of header names to classes is copied in to the registry during " "initialization. *base_class* is always the last class in the generated " -"class's ``__bases__`` list." +"class's :class:`~type.__bases__` list." msgstr "" #: ../../library/email.headerregistry.rst:322 diff --git a/library/email.iterators.po b/library/email.iterators.po index 4b12cddefb..71843281fb 100644 --- a/library/email.iterators.po +++ b/library/email.iterators.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-11-19 00:30+0000\n" diff --git a/library/email.message.po b/library/email.message.po index 8d8317321b..49155f42d7 100644 --- a/library/email.message.po +++ b/library/email.message.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 14:44+0000\n" diff --git a/library/email.mime.po b/library/email.mime.po index 1f45a7bcc2..2cd526c301 100644 --- a/library/email.mime.po +++ b/library/email.mime.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:00+0000\n" diff --git a/library/email.parser.po b/library/email.parser.po index ff3c7597c1..69565e928d 100644 --- a/library/email.parser.po +++ b/library/email.parser.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/email.po b/library/email.po index 1592968c73..da6d04ebe5 100644 --- a/library/email.po +++ b/library/email.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,10 +31,10 @@ msgid "" "The :mod:`email` package is a library for managing email messages. It is " "specifically *not* designed to do any sending of email messages to SMTP (:" "rfc:`2821`), NNTP, or other servers; those are functions of modules such as :" -"mod:`smtplib` and :mod:`nntplib`. The :mod:`email` package attempts to be " -"as RFC-compliant as possible, supporting :rfc:`5322` and :rfc:`6532`, as " -"well as such MIME-related RFCs as :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, :" -"rfc:`2183`, and :rfc:`2231`." +"mod:`smtplib`. The :mod:`email` package attempts to be as RFC-compliant as " +"possible, supporting :rfc:`5322` and :rfc:`6532`, as well as such MIME-" +"related RFCs as :rfc:`2045`, :rfc:`2046`, :rfc:`2047`, :rfc:`2183`, and :rfc:" +"`2231`." msgstr "" #: ../../library/email.rst:23 @@ -181,22 +181,17 @@ msgid "IMAP (Internet Message Access Protocol) client" msgstr "" #: ../../library/email.rst:144 -msgid "Module :mod:`nntplib`" -msgstr ":mod:`nntplib` 模組" - -#: ../../library/email.rst:145 -msgid "NNTP (Net News Transport Protocol) client" -msgstr "" - -#: ../../library/email.rst:147 msgid "Module :mod:`mailbox`" msgstr ":mod:`mailbox` 模組" -#: ../../library/email.rst:148 +#: ../../library/email.rst:145 msgid "" "Tools for creating, reading, and managing collections of messages on disk " "using a variety standard formats." msgstr "" +#~ msgid "Module :mod:`nntplib`" +#~ msgstr ":mod:`nntplib` 模組" + #~ msgid "Module :mod:`smtpd`" #~ msgstr ":mod:`smtpd` 模組" diff --git a/library/email.policy.po b/library/email.policy.po index fecb843622..20f6c5e82b 100644 --- a/library/email.policy.po +++ b/library/email.policy.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/email.utils.po b/library/email.utils.po index 81afcaf3dd..eb6c4dec6b 100644 --- a/library/email.utils.po +++ b/library/email.utils.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-07 03:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/ensurepip.po b/library/ensurepip.po index 151641a7b2..0c3867c9a3 100644 --- a/library/ensurepip.po +++ b/library/ensurepip.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -75,18 +75,17 @@ msgstr ":pep:`453`: 在 Python 安裝中的 pip 明確初始建置" msgid "The original rationale and specification for this module." msgstr "此模組的最初設計理念與規範。" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +#: ../../includes/wasm-mobile-notavail.rst:3 +msgid ":ref:`Availability `: not Android, not iOS, not WASI." +msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" -#: ../../includes/wasm-notavail.rst:5 +#: ../../includes/wasm-mobile-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" +"台 `\\ 上不支援。" #: ../../library/ensurepip.rst:44 msgid "Command line interface" @@ -271,3 +270,13 @@ msgstr "" "初始建置的過程也許會安裝 ``pip`` 所需要的額外的模組,但其他軟體不應該假設這些" "相依 (dependency) 總是預設存在(因為這些相依很可能會在未來版本的 ``pip`` 中被" "移除)。" + +#, fuzzy +#~ msgid "" +#~ "This module does not work or is not available on WebAssembly platforms, " +#~ "or on iOS. See :ref:`wasm-availability` for more information on WASM " +#~ "availability; see :ref:`iOS-availability` for more information on iOS " +#~ "availability." +#~ msgstr "" +#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" +#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/enum.po b/library/enum.po index caa8b89d13..d67a0bd1b5 100644 --- a/library/enum.po +++ b/library/enum.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-09-11 14:08+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -335,11 +335,12 @@ msgstr "" "節請參考 :ref:`建立 EnumType 的子類別 `。" #: ../../library/enum.rst:168 +#, fuzzy msgid "" -"*EnumType* is responsible for setting the correct :meth:`!__repr__`, :meth:`!" -"__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the final " -"*enum*, as well as creating the enum members, properly handling duplicates, " -"providing iteration over the enum class, etc." +"``EnumType`` is responsible for setting the correct :meth:`!__repr__`, :meth:" +"`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the " +"final *enum*, as well as creating the enum members, properly handling " +"duplicates, providing iteration over the enum class, etc." msgstr "" "*EnumType* 負責在最後的\\ *列舉*\\ 上面設定正確的 :meth:`!__repr__`、:meth:`!" "__str__`、:meth:`!__format__` 及 :meth:`!__reduce__` 方法,以及建立列舉成員," @@ -529,19 +530,34 @@ msgstr "" "[, , ]" #: ../../library/enum.rst:251 -msgid "Before 3.11 ``enum`` used ``EnumMeta`` type, which is kept as an alias." +msgid "" +"Adds a new name as an alias to an existing member. Raises a :exc:" +"`NameError` if the name is already assigned to a different member." msgstr "" -"在 3.11 之前,``enum`` 使用 ``EnumMeta`` 類型,目前保留此類型當作別名。" #: ../../library/enum.rst:256 +msgid "" +"Adds a new value as an alias to an existing member. Raises a :exc:" +"`ValueError` if the value is already linked with a different member." +msgstr "" + +#: ../../library/enum.rst:261 +#, fuzzy +msgid "" +"Before 3.11 ``EnumType`` was called ``EnumMeta``, which is still available " +"as an alias." +msgstr "" +"在 3.11 之前,``enum`` 使用 ``EnumMeta`` 類型,目前保留此類型當作別名。" + +#: ../../library/enum.rst:266 msgid "*Enum* is the base class for all *enum* enumerations." msgstr "*Enum* 是所有 *enum* 列舉的基礎類別。" -#: ../../library/enum.rst:260 +#: ../../library/enum.rst:270 msgid "The name used to define the ``Enum`` member::" msgstr "用來定義 ``Enum`` 成員的名稱: ::" -#: ../../library/enum.rst:262 +#: ../../library/enum.rst:272 msgid "" ">>> Color.BLUE.name\n" "'BLUE'" @@ -549,11 +565,11 @@ msgstr "" ">>> Color.BLUE.name\n" "'BLUE'" -#: ../../library/enum.rst:267 +#: ../../library/enum.rst:277 msgid "The value given to the ``Enum`` member::" msgstr "``Enum`` 成員給定的值: ::" -#: ../../library/enum.rst:269 +#: ../../library/enum.rst:279 msgid "" ">>> Color.RED.value\n" "1" @@ -561,15 +577,15 @@ msgstr "" ">>> Color.RED.value\n" "1" -#: ../../library/enum.rst:272 ../../library/enum.rst:292 +#: ../../library/enum.rst:282 ../../library/enum.rst:302 msgid "Value of the member, can be set in :meth:`~Enum.__new__`." msgstr "成員的值,可以在 :meth:`~Enum.__new__` 設定。" -#: ../../library/enum.rst:274 +#: ../../library/enum.rst:284 msgid "Enum member values" msgstr "列舉成員的值" -#: ../../library/enum.rst:276 +#: ../../library/enum.rst:286 msgid "" "Member values can be anything: :class:`int`, :class:`str`, etc. If the " "exact value is unimportant you may use :class:`auto` instances and an " @@ -579,7 +595,7 @@ msgstr "" "重要,你可以使用 :class:`auto` 實例,它會為你選擇合適的值。更多細節請參考 :" "class:`auto`。" -#: ../../library/enum.rst:281 +#: ../../library/enum.rst:291 msgid "" "While mutable/unhashable values, such as :class:`dict`, :class:`list` or a " "mutable :class:`~dataclasses.dataclass`, can be used, they will have a " @@ -587,23 +603,23 @@ msgid "" "mutable/unhashable values in the enum." msgstr "" -#: ../../library/enum.rst:288 +#: ../../library/enum.rst:298 msgid "Name of the member." msgstr "成員名稱。" -#: ../../library/enum.rst:296 +#: ../../library/enum.rst:306 msgid "" "No longer used, kept for backward compatibility. (class attribute, removed " "during class creation)." msgstr "已不再使用,只為了向後相容而保留(類別屬性,在類別建立時移除)" -#: ../../library/enum.rst:301 +#: ../../library/enum.rst:311 msgid "" "``_ignore_`` is only used during creation and is removed from the " "enumeration once creation is complete." msgstr "``_ignore_`` 只有在建立的時候用到,在列舉建立完成後會被移除。" -#: ../../library/enum.rst:304 +#: ../../library/enum.rst:314 msgid "" "``_ignore_`` is a list of names that will not become members, and whose " "names will also be removed from the completed enumeration. See :ref:" @@ -612,7 +628,7 @@ msgstr "" "``_ignore_`` 是一個不會變成成員的名稱串列,在列舉建立完成後其名稱會被移除。範" "例請參考 :ref:`TimePeriod `。" -#: ../../library/enum.rst:310 +#: ../../library/enum.rst:320 msgid "" "Returns ``['__class__', '__doc__', '__module__', 'name', 'value']`` and any " "public methods defined on *self.__class__*::" @@ -620,7 +636,7 @@ msgstr "" "回傳 ``['__class__', '__doc__', '__module__', 'name', 'value']`` 及任何 " "*self.__class__* 上定義的公開方法: ::" -#: ../../library/enum.rst:313 +#: ../../library/enum.rst:323 msgid "" ">>> from datetime import date\n" ">>> class Weekday(Enum):\n" @@ -660,11 +676,11 @@ msgstr "" msgid "name" msgstr "name" -#: ../../library/enum.rst:331 +#: ../../library/enum.rst:341 msgid "The name of the member being defined (e.g. 'RED')." msgstr "定義的成員名稱(例如 'RED')。" -#: ../../library/enum.rst:332 +#: ../../library/enum.rst:342 msgid "The start value for the Enum; the default is 1." msgstr "列舉的開始值,預設為 1。" @@ -672,7 +688,7 @@ msgstr "列舉的開始值,預設為 1。" msgid "count" msgstr "count" -#: ../../library/enum.rst:333 +#: ../../library/enum.rst:343 msgid "The number of members currently defined, not including this one." msgstr "已定義的成員數量,不包含目前這一個。" @@ -680,17 +696,17 @@ msgstr "已定義的成員數量,不包含目前這一個。" msgid "last_values" msgstr "last_values" -#: ../../library/enum.rst:334 +#: ../../library/enum.rst:344 msgid "A list of the previous values." msgstr "一個之前值的串列。" -#: ../../library/enum.rst:336 +#: ../../library/enum.rst:346 msgid "" "A *staticmethod* that is used to determine the next value returned by :class:" "`auto`::" msgstr "一個 *staticmethod*,用來決定 :class:`auto` 下一個要回傳的值的: ::" -#: ../../library/enum.rst:339 +#: ../../library/enum.rst:349 msgid "" ">>> from enum import auto\n" ">>> class PowersOfThree(Enum):\n" @@ -714,7 +730,7 @@ msgstr "" ">>> PowersOfThree.SECOND.value\n" "9" -#: ../../library/enum.rst:352 +#: ../../library/enum.rst:362 msgid "" "By default, does nothing. If multiple values are given in the member " "assignment, those values become separate arguments to ``__init__``; e.g." @@ -722,19 +738,19 @@ msgstr "" "預設情況下,不執行任何操作。如果在成員賦值中給出多個值,這些值將成為與 " "``__init__`` 分別的引數;例如" -#: ../../library/enum.rst:359 +#: ../../library/enum.rst:369 msgid "" "``Weekday.__init__()`` would be called as ``Weekday.__init__(self, 1, " "'Mon')``" msgstr "``Weekday.__init__()`` 將被稱為 ``Weekday.__init__(self, 1, 'Mon')``" -#: ../../library/enum.rst:363 +#: ../../library/enum.rst:373 msgid "" "A *classmethod* that is used to further configure subsequent subclasses. By " "default, does nothing." msgstr "一個 *classmethod*,用來進一步設定後續的子類別,預設不做任何事。" -#: ../../library/enum.rst:368 +#: ../../library/enum.rst:378 msgid "" "A *classmethod* for looking up values not found in *cls*. By default it " "does nothing, but can be overridden to implement custom search behavior::" @@ -742,7 +758,7 @@ msgstr "" "一個 *classmethod*,用來查詢在 *cls* 裡找不到的值。預設不做任何事,但可以被覆" "寫以實作客製化的搜尋行為: ::" -#: ../../library/enum.rst:371 +#: ../../library/enum.rst:381 msgid "" ">>> from enum import StrEnum\n" ">>> class Build(StrEnum):\n" @@ -778,7 +794,7 @@ msgstr "" ">>> Build('deBUG')\n" "" -#: ../../library/enum.rst:390 +#: ../../library/enum.rst:400 msgid "" "By default, doesn't exist. If specified, either in the enum class " "definition or in a mixin class (such as ``int``), all values given in the " @@ -787,12 +803,12 @@ msgstr "" "預設情況下不存在。如果有指定,無論是在列舉類別定義中還是在 mixin 類別中(例" "如 ``int``\\ ),都將傳遞成員賦值中給出的所有值;例如" -#: ../../library/enum.rst:398 +#: ../../library/enum.rst:408 msgid "" "results in the call ``int('1a', 16)`` and a value of ``26`` for the member." msgstr "" -#: ../../library/enum.rst:402 +#: ../../library/enum.rst:412 msgid "" "When writing a custom ``__new__``, do not use ``super().__new__`` -- call " "the appropriate ``__new__`` instead." @@ -800,7 +816,7 @@ msgstr "" "當寫自訂的 ``__new__`` 時,不要使用 ``super().__new__``,而是要呼叫適當的 " "``__new__``。" -#: ../../library/enum.rst:407 +#: ../../library/enum.rst:417 msgid "" "Returns the string used for *repr()* calls. By default, returns the *Enum* " "name, member name, and value, but can be overridden::" @@ -808,7 +824,7 @@ msgstr "" "回傳呼叫 *repr()* 時使用的字串。預設回傳 *Enum* 名稱、成員名稱及值,但可以被" "覆寫: ::" -#: ../../library/enum.rst:410 +#: ../../library/enum.rst:420 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -834,7 +850,7 @@ msgstr "" "ALTERNATE}\"\n" "(OtherStyle.ALTERNATE, 'OtherStyle.ALTERNATE', 'OtherStyle.ALTERNATE')" -#: ../../library/enum.rst:423 +#: ../../library/enum.rst:433 msgid "" "Returns the string used for *str()* calls. By default, returns the *Enum* " "name and member name, but can be overridden::" @@ -842,7 +858,7 @@ msgstr "" "回傳呼叫 *str()* 時使用的字串。預設回傳 *Enum* 名稱及成員名稱,但可以被覆" "寫: ::" -#: ../../library/enum.rst:426 +#: ../../library/enum.rst:436 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -866,7 +882,7 @@ msgstr "" "ALTERNATE}\"\n" "(, 'ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:438 +#: ../../library/enum.rst:448 msgid "" "Returns the string used for *format()* and *f-string* calls. By default, " "returns :meth:`__str__` return value, but can be overridden::" @@ -874,7 +890,7 @@ msgstr "" "回傳呼叫 *format()* 及 *f-string* 時使用的字串。預設回傳 :meth:`__str__` 的回" "傳值,但可以被覆寫: ::" -#: ../../library/enum.rst:441 +#: ../../library/enum.rst:451 msgid "" ">>> class OtherStyle(Enum):\n" "... ALTERNATE = auto()\n" @@ -898,33 +914,34 @@ msgstr "" "ALTERNATE}\"\n" "(, 'OtherStyle.ALTERNATE', 'ALTERNATE')" -#: ../../library/enum.rst:453 +#: ../../library/enum.rst:463 msgid "" "Using :class:`auto` with :class:`Enum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`Enum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:456 +#: ../../library/enum.rst:466 msgid "Added :ref:`enum-dataclass-support`" msgstr "新增 :ref:`enum-dataclass-support`" -#: ../../library/enum.rst:461 +#: ../../library/enum.rst:471 +#, fuzzy msgid "" -"*IntEnum* is the same as *Enum*, but its members are also integers and can " -"be used anywhere that an integer can be used. If any integer operation is " -"performed with an *IntEnum* member, the resulting value loses its " -"enumeration status." +"*IntEnum* is the same as :class:`Enum`, but its members are also integers " +"and can be used anywhere that an integer can be used. If any integer " +"operation is performed with an *IntEnum* member, the resulting value loses " +"its enumeration status." msgstr "" "*IntEnum* 和 *Enum* 一樣,但其成員同時也是整數而可以被用在任何使用整數的地" "方。如果 *IntEnum* 成員經過任何整數運算,其結果會失去列舉狀態。" -#: ../../library/enum.rst:482 +#: ../../library/enum.rst:492 msgid "" "Using :class:`auto` with :class:`IntEnum` results in integers of increasing " "value, starting with ``1``." msgstr ":class:`IntEnum` 使用 :class:`auto` 會產生從 ``1`` 開始遞增的整數。" -#: ../../library/enum.rst:485 +#: ../../library/enum.rst:495 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` was " @@ -934,17 +951,18 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:492 +#: ../../library/enum.rst:502 +#, fuzzy msgid "" -"*StrEnum* is the same as *Enum*, but its members are also strings and can be " -"used in most of the same places that a string can be used. The result of " -"any string operation performed on or with a *StrEnum* member is not part of " -"the enumeration." +"``StrEnum`` is the same as :class:`Enum`, but its members are also strings " +"and can be used in most of the same places that a string can be used. The " +"result of any string operation performed on or with a *StrEnum* member is " +"not part of the enumeration." msgstr "" "*StrEnum* 和 *Enum* 一樣,但其成員同時也是字串而可以被用在幾乎所有使用字串的" "地方。*StrEnum* 成員經過任何字串操作的結果會不再是列舉的一部份。" -#: ../../library/enum.rst:498 +#: ../../library/enum.rst:508 msgid "" "There are places in the stdlib that check for an exact :class:`str` instead " "of a :class:`str` subclass (i.e. ``type(unknown) == str`` instead of " @@ -955,13 +973,13 @@ msgstr "" "是 ``type(unknown) == str`` 而不是 ``isinstance(unknown, str)``),在這些地方" "你需要使用 ``str(StrEnum.member)``。" -#: ../../library/enum.rst:505 +#: ../../library/enum.rst:515 msgid "" "Using :class:`auto` with :class:`StrEnum` results in the lower-cased member " "name as the value." msgstr ":class:`StrEnum` 使用 :class:`auto` 會產生小寫的成員名稱當作值。" -#: ../../library/enum.rst:510 +#: ../../library/enum.rst:520 msgid "" ":meth:`~object.__str__` is :meth:`!str.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` is " @@ -971,7 +989,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!str.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 也會是 :meth:`!str.__format__`。" -#: ../../library/enum.rst:518 +#: ../../library/enum.rst:528 msgid "" "``Flag`` is the same as :class:`Enum`, but its members support the bitwise " "operators ``&`` (*AND*), ``|`` (*OR*), ``^`` (*XOR*), and ``~`` (*INVERT*); " @@ -981,11 +999,11 @@ msgstr "" "(*OR*)、``^`` (*XOR*) 和 ``~`` (*INVERT*);這些操作的結果是列舉的成員(的別" "名)。" -#: ../../library/enum.rst:524 +#: ../../library/enum.rst:534 msgid "Returns *True* if value is in self::" msgstr "如果 value 在 self 裡則回傳 *True*: ::" -#: ../../library/enum.rst:526 +#: ../../library/enum.rst:536 msgid "" ">>> from enum import Flag, auto\n" ">>> class Color(Flag):\n" @@ -1021,11 +1039,11 @@ msgstr "" ">>> white in purple\n" "False" -#: ../../library/enum.rst:545 +#: ../../library/enum.rst:555 msgid "Returns all contained non-alias members::" msgstr "回傳所有包含的非別名成員: ::" -#: ../../library/enum.rst:547 +#: ../../library/enum.rst:557 msgid "" ">>> list(Color.RED)\n" "[]\n" @@ -1037,11 +1055,11 @@ msgstr "" ">>> list(purple)\n" "[, ]" -#: ../../library/enum.rst:556 +#: ../../library/enum.rst:566 msgid "Returns number of members in flag::" msgstr "回傳旗標裡的成員數量: ::" -#: ../../library/enum.rst:558 +#: ../../library/enum.rst:568 msgid "" ">>> len(Color.GREEN)\n" "1\n" @@ -1053,11 +1071,11 @@ msgstr "" ">>> len(white)\n" "3" -#: ../../library/enum.rst:567 +#: ../../library/enum.rst:577 msgid "Returns *True* if any members in flag, *False* otherwise::" msgstr "如果成員在旗標裡則回傳 *True*,否則回傳 *False*: ::" -#: ../../library/enum.rst:569 +#: ../../library/enum.rst:579 msgid "" ">>> bool(Color.GREEN)\n" "True\n" @@ -1075,11 +1093,11 @@ msgstr "" ">>> bool(black)\n" "False" -#: ../../library/enum.rst:579 +#: ../../library/enum.rst:589 msgid "Returns current flag binary or'ed with other::" msgstr "回傳和 other 做 OR 過後的二進位旗標: ::" -#: ../../library/enum.rst:581 +#: ../../library/enum.rst:591 msgid "" ">>> Color.RED | Color.GREEN\n" "" @@ -1087,11 +1105,11 @@ msgstr "" ">>> Color.RED | Color.GREEN\n" "" -#: ../../library/enum.rst:586 +#: ../../library/enum.rst:596 msgid "Returns current flag binary and'ed with other::" msgstr "回傳和 other 做 AND 過後的二進位旗標: ::" -#: ../../library/enum.rst:588 +#: ../../library/enum.rst:598 msgid "" ">>> purple & white\n" "\n" @@ -1103,11 +1121,11 @@ msgstr "" ">>> purple & Color.GREEN\n" "" -#: ../../library/enum.rst:595 +#: ../../library/enum.rst:605 msgid "Returns current flag binary xor'ed with other::" msgstr "回傳和 other 做 XOR 過後的二進位旗標: ::" -#: ../../library/enum.rst:597 +#: ../../library/enum.rst:607 msgid "" ">>> purple ^ white\n" "\n" @@ -1119,11 +1137,12 @@ msgstr "" ">>> purple ^ Color.GREEN\n" "" -#: ../../library/enum.rst:604 -msgid "Returns all the flags in *type(self)* that are not in self::" +#: ../../library/enum.rst:614 +#, fuzzy +msgid "Returns all the flags in *type(self)* that are not in *self*::" msgstr "回傳所有在 *type(self)* 但不在 self 裡的旗標: ::" -#: ../../library/enum.rst:606 +#: ../../library/enum.rst:616 msgid "" ">>> ~white\n" "\n" @@ -1139,7 +1158,7 @@ msgstr "" ">>> ~Color.RED\n" "" -#: ../../library/enum.rst:615 +#: ../../library/enum.rst:625 msgid "" "Function used to format any remaining unnamed numeric values. Default is " "the value's repr; common choices are :func:`hex` and :func:`oct`." @@ -1147,31 +1166,32 @@ msgstr "" "用來格式化任何剩下未命名數值的函式。預設是值的 repr,常見選擇是 :func:`hex` " "和 :func:`oct`。" -#: ../../library/enum.rst:620 +#: ../../library/enum.rst:630 msgid "" "Using :class:`auto` with :class:`Flag` results in integers that are powers " "of two, starting with ``1``." msgstr ":class:`Flag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:623 +#: ../../library/enum.rst:633 msgid "The *repr()* of zero-valued flags has changed. It is now::" msgstr "值為 0 的旗標的 *repr()* 已改變。現在是: ::" -#: ../../library/enum.rst:631 +#: ../../library/enum.rst:641 +#, fuzzy msgid "" -"*IntFlag* is the same as *Flag*, but its members are also integers and can " -"be used anywhere that an integer can be used." +"``IntFlag`` is the same as :class:`Flag`, but its members are also integers " +"and can be used anywhere that an integer can be used." msgstr "" "*IntFlag* 和 *Flag* 一樣,但其成員同時也是整數而可以被用在任何使用整數的地" "方。" -#: ../../library/enum.rst:645 +#: ../../library/enum.rst:655 msgid "" "If any integer operation is performed with an *IntFlag* member, the result " "is not an *IntFlag*::" msgstr "如果 *IntFlag* 成員經過任何整數運算,其結果不是 *IntFlag*: ::" -#: ../../library/enum.rst:648 +#: ../../library/enum.rst:658 msgid "" ">>> Color.RED + 2\n" "3" @@ -1179,32 +1199,35 @@ msgstr "" ">>> Color.RED + 2\n" "3" -#: ../../library/enum.rst:651 -msgid "If a *Flag* operation is performed with an *IntFlag* member and:" +#: ../../library/enum.rst:661 +#, fuzzy +msgid "If a :class:`Flag` operation is performed with an *IntFlag* member and:" msgstr "如果 *IntFlag* 成員經過 *Flag* 操作且:" -#: ../../library/enum.rst:653 +#: ../../library/enum.rst:663 msgid "the result is a valid *IntFlag*: an *IntFlag* is returned" msgstr "結果是合法的 *IntFlag*:回傳 *IntFlag*" -#: ../../library/enum.rst:654 +#: ../../library/enum.rst:664 +#, fuzzy msgid "" -"the result is not a valid *IntFlag*: the result depends on the " -"*FlagBoundary* setting" +"the result is not a valid *IntFlag*: the result depends on the :class:" +"`FlagBoundary` setting" msgstr "結果不是合法的 *IntFlag*:結果會根據 *FlagBoundary* 的設定" -#: ../../library/enum.rst:656 -msgid "The *repr()* of unnamed zero-valued flags has changed. It is now:" +#: ../../library/enum.rst:666 +#, fuzzy +msgid "The :func:`repr` of unnamed zero-valued flags has changed. It is now:" msgstr "未命名且值為 0 的旗標的 *repr()* 已改變。現在是: ::" -#: ../../library/enum.rst:663 +#: ../../library/enum.rst:673 msgid "" "Using :class:`auto` with :class:`IntFlag` results in integers that are " "powers of two, starting with ``1``." msgstr "" ":class:`IntFlag` 使用 :class:`auto` 會產生從 ``1`` 開始 2 的次方的整數。" -#: ../../library/enum.rst:668 +#: ../../library/enum.rst:678 msgid "" ":meth:`~object.__str__` is now :meth:`!int.__str__` to better support the " "*replacement of existing constants* use-case. :meth:`~object.__format__` " @@ -1214,7 +1237,7 @@ msgstr "" "境,:meth:`~object.__str__` 現在會是 :meth:`!int.__str__`。為了同樣的理由,:" "meth:`~object.__format__` 已經是 :meth:`!int.__format__`。" -#: ../../library/enum.rst:672 +#: ../../library/enum.rst:682 msgid "" "Inversion of an :class:`!IntFlag` now returns a positive value that is the " "union of all flags not in the given flag, rather than a negative value. This " @@ -1223,7 +1246,7 @@ msgstr "" ":class:`!IntFlag` 的反轉 (inversion) 現在會回傳正值,該值是不在給定旗標的所有" "旗標聯集,而不是一個負值。這符合現有 :class:`Flag` 的行為。" -#: ../../library/enum.rst:678 +#: ../../library/enum.rst:688 msgid "" ":class:`!ReprEnum` uses the :meth:`repr() ` of :class:`Enum`, " "but the :class:`str() ` of the mixed-in data type:" @@ -1231,15 +1254,15 @@ msgstr "" ":class:`!ReprEnum` 使用 :class:`Enum` 的 :meth:`repr() `,但使" "用混合資料類型的 :class:`str() `:" -#: ../../library/enum.rst:681 +#: ../../library/enum.rst:691 msgid ":meth:`!int.__str__` for :class:`IntEnum` and :class:`IntFlag`" msgstr "對 :class:`IntEnum` 和 :class:`IntFlag` 是 :meth:`!int.__str__`" -#: ../../library/enum.rst:682 +#: ../../library/enum.rst:692 msgid ":meth:`!str.__str__` for :class:`StrEnum`" msgstr "對 :class:`StrEnum` 是 :meth:`!str.__str__`" -#: ../../library/enum.rst:684 +#: ../../library/enum.rst:694 msgid "" "Inherit from :class:`!ReprEnum` to keep the :class:`str() ` / :func:" "`format` of the mixed-in data type instead of using the :class:`Enum`-" @@ -1248,7 +1271,7 @@ msgstr "" "繼承 :class:`!ReprEnum` 來保留混合資料類型的 :class:`str() ` / :func:" "`format`,而不是使用 :class:`Enum` 預設的 :meth:`str() `。" -#: ../../library/enum.rst:693 +#: ../../library/enum.rst:703 msgid "" "*EnumCheck* contains the options used by the :func:`verify` decorator to " "ensure various constraints; failed constraints result in a :exc:`ValueError`." @@ -1256,11 +1279,11 @@ msgstr "" "*EnumCheck* 包含 :func:`verify` 裝飾器使用的選項,以確保多樣的限制,不符合限" "制會產生 :exc:`ValueError`。" -#: ../../library/enum.rst:698 +#: ../../library/enum.rst:708 msgid "Ensure that each value has only one name::" msgstr "確保每個值只有一個名稱: ::" -#: ../../library/enum.rst:700 +#: ../../library/enum.rst:710 msgid "" ">>> from enum import Enum, verify, UNIQUE\n" ">>> @verify(UNIQUE)\n" @@ -1284,13 +1307,13 @@ msgstr "" "...\n" "ValueError: aliases found in : CRIMSON -> RED" -#: ../../library/enum.rst:714 +#: ../../library/enum.rst:724 msgid "" "Ensure that there are no missing values between the lowest-valued member and " "the highest-valued member::" msgstr "確保在最小值成員跟最大值成員間沒有缺少值: ::" -#: ../../library/enum.rst:717 +#: ../../library/enum.rst:727 msgid "" ">>> from enum import Enum, verify, CONTINUOUS\n" ">>> @verify(CONTINUOUS)\n" @@ -1312,7 +1335,7 @@ msgstr "" "...\n" "ValueError: invalid enum 'Color': missing values 3, 4" -#: ../../library/enum.rst:729 +#: ../../library/enum.rst:739 msgid "" "Ensure that any flag groups/masks contain only named flags -- useful when " "values are specified instead of being generated by :func:`auto`::" @@ -1320,7 +1343,7 @@ msgstr "" "確保任何旗標群組 / 遮罩只包含命名旗標 -- 當值是用指定而不是透過 :func:`auto` " "產生時是很實用的: ::" -#: ../../library/enum.rst:732 +#: ../../library/enum.rst:742 msgid "" ">>> from enum import Flag, verify, NAMED_FLAGS\n" ">>> @verify(NAMED_FLAGS)\n" @@ -1348,24 +1371,25 @@ msgstr "" "ValueError: invalid Flag 'Color': aliases WHITE and NEON are missing " "combined values of 0x18 [use enum.show_flag_values(value) for details]" -#: ../../library/enum.rst:746 +#: ../../library/enum.rst:756 msgid "" "CONTINUOUS and NAMED_FLAGS are designed to work with integer-valued members." msgstr "CONTINUOUS 和 NAMED_FLAGS 是設計用來運作在整數值的成員上。" -#: ../../library/enum.rst:752 +#: ../../library/enum.rst:762 +#, fuzzy msgid "" -"*FlagBoundary* controls how out-of-range values are handled in *Flag* and " -"its subclasses." +"``FlagBoundary`` controls how out-of-range values are handled in :class:" +"`Flag` and its subclasses." msgstr "*FlagBoundary* 控制在 *Flag* 及其子類別中如何處理範圍外的值。" -#: ../../library/enum.rst:757 +#: ../../library/enum.rst:767 msgid "" "Out-of-range values cause a :exc:`ValueError` to be raised. This is the " "default for :class:`Flag`::" msgstr "範圍外的值會引發 :exc:`ValueError`。這是 :class:`Flag` 的預設行為: ::" -#: ../../library/enum.rst:760 +#: ../../library/enum.rst:770 msgid "" ">>> from enum import Flag, STRICT, auto\n" ">>> class StrictFlag(Flag, boundary=STRICT):\n" @@ -1393,13 +1417,14 @@ msgstr "" " given 0b0 10100\n" " allowed 0b0 00111" -#: ../../library/enum.rst:775 +#: ../../library/enum.rst:785 +#, fuzzy msgid "" -"Out-of-range values have invalid values removed, leaving a valid *Flag* " -"value::" +"Out-of-range values have invalid values removed, leaving a valid :class:" +"`Flag` value::" msgstr "範圍外的值會移除非法值,留下合法的 *Flag* 值: ::" -#: ../../library/enum.rst:778 +#: ../../library/enum.rst:788 msgid "" ">>> from enum import Flag, CONFORM, auto\n" ">>> class ConformFlag(Flag, boundary=CONFORM):\n" @@ -1419,20 +1444,23 @@ msgstr "" ">>> ConformFlag(2**2 + 2**4)\n" "" -#: ../../library/enum.rst:789 +#: ../../library/enum.rst:799 +#, fuzzy msgid "" -"Out-of-range values lose their *Flag* membership and revert to :class:`int`." +"Out-of-range values lose their :class:`Flag` membership and revert to :class:" +"`int`." msgstr "範圍外的值會失去它們的 *Flag* 成員資格且恢復成 :class:`int`。" -#: ../../library/enum.rst:802 +#: ../../library/enum.rst:812 +#, fuzzy msgid "" -"Out-of-range values are kept, and the *Flag* membership is kept. This is the " -"default for :class:`IntFlag`::" +"Out-of-range values are kept, and the :class:`Flag` membership is kept. This " +"is the default for :class:`IntFlag`::" msgstr "" "範圍外的值會被保留,*Flag* 成員資格也會被保留。這是 :class:`IntFlag` 的預設行" "為: ::" -#: ../../library/enum.rst:805 +#: ../../library/enum.rst:815 msgid "" ">>> from enum import Flag, KEEP, auto\n" ">>> class KeepFlag(Flag, boundary=KEEP):\n" @@ -1452,11 +1480,11 @@ msgstr "" ">>> KeepFlag(2**2 + 2**4)\n" "" -#: ../../library/enum.rst:819 +#: ../../library/enum.rst:829 msgid "Supported ``__dunder__`` names" msgstr "支援 ``__dunder__`` 名稱" -#: ../../library/enum.rst:821 +#: ../../library/enum.rst:831 msgid "" ":attr:`~EnumType.__members__` is a read-only ordered mapping of " "``member_name``:``member`` items. It is only available on the class." @@ -1464,36 +1492,49 @@ msgstr "" ":attr:`~EnumType.__members__` 是一個唯讀有序的\\ ``成員名稱``:``成員``\\ 項" "目的對映。只有在類別上可用。" -#: ../../library/enum.rst:824 +#: ../../library/enum.rst:834 +#, fuzzy msgid "" ":meth:`~Enum.__new__`, if specified, must create and return the enum " "members; it is also a very good idea to set the member's :attr:`!_value_` " -"appropriately. Once all the members are created it is no longer used." +"appropriately. Once all the members are created it is no longer used." msgstr "" "如果指定了 :meth:`~Enum.__new__`,它必須建立並回傳列舉成員;適當地設定成員" "的 :attr:`!_value_` 也是一個很好的主意。一旦所有成員都建立之後就不會再被用" "到。" -#: ../../library/enum.rst:830 +#: ../../library/enum.rst:840 msgid "Supported ``_sunder_`` names" msgstr "支援 ``_sunder_`` 名稱" -#: ../../library/enum.rst:832 +#: ../../library/enum.rst:842 +msgid "" +":meth:`~EnumType._add_alias_` -- adds a new name as an alias to an existing " +"member." +msgstr "" + +#: ../../library/enum.rst:844 +msgid "" +":meth:`~EnumType._add_value_alias_` -- adds a new value as an alias to an " +"existing member." +msgstr "" + +#: ../../library/enum.rst:846 msgid ":attr:`~Enum._name_` -- name of the member" msgstr ":attr:`~Enum._name_` -- 成員名稱" -#: ../../library/enum.rst:833 +#: ../../library/enum.rst:847 msgid ":attr:`~Enum._value_` -- value of the member; can be set in ``__new__``" msgstr ":attr:`~Enum._value_` -- 成員的值;可以在 ``__new__`` 設定" -#: ../../library/enum.rst:834 +#: ../../library/enum.rst:848 msgid "" ":meth:`~Enum._missing_` -- a lookup function used when a value is not found; " "may be overridden" msgstr "" ":meth:`~Enum._missing_` -- 當值沒有被找到時會使用的查詢函式;可以被覆寫" -#: ../../library/enum.rst:836 +#: ../../library/enum.rst:850 msgid "" ":attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a :" "class:`str`, that will not be transformed into members, and will be removed " @@ -1502,7 +1543,7 @@ msgstr "" ":attr:`~Enum._ignore_` -- 一個名稱的串列,可以是 :class:`list` 或 :class:" "`str`,它不會被轉換成成員,且在最後的類別上會被移除" -#: ../../library/enum.rst:839 +#: ../../library/enum.rst:853 msgid "" ":attr:`~Enum._order_` -- no longer used, kept for backward compatibility " "(class attribute, removed during class creation)" @@ -1510,49 +1551,67 @@ msgstr "" ":attr:`~Enum._order_` -- 不再被使用,僅為了向後相容而保留(類別屬性,在類別建" "立時移除)" -#: ../../library/enum.rst:841 +#: ../../library/enum.rst:855 msgid "" ":meth:`~Enum._generate_next_value_` -- used to get an appropriate value for " "an enum member; may be overridden" msgstr "" ":meth:`~Enum._generate_next_value_` -- 用來為列舉成員取得合適的值;可以被覆寫" -#: ../../library/enum.rst:846 +#: ../../library/enum.rst:860 +#, fuzzy msgid "" -"For standard :class:`Enum` classes the next value chosen is the last value " -"seen incremented by one." +"For standard :class:`Enum` classes the next value chosen is the highest " +"value seen incremented by one." msgstr "" "對標準的 :class:`Enum` 類別來說,下一個被選擇的值是最後一個看見的值加一。" -#: ../../library/enum.rst:849 +#: ../../library/enum.rst:863 +#, fuzzy msgid "" "For :class:`Flag` classes the next value chosen will be the next highest " -"power-of-two, regardless of the last value seen." +"power-of-two." msgstr "" "對 :class:`Flag` 類別來說,下一個被選擇的值是下一個最大的 2 的次方,不管最後" "一個看見的值是什麼。" -#: ../../library/enum.rst:852 +#: ../../library/enum.rst:866 +msgid "" +"While ``_sunder_`` names are generally reserved for the further development " +"of the :class:`Enum` class and can not be used, some are explicitly allowed:" +msgstr "" + +#: ../../library/enum.rst:869 +msgid "" +"``_repr_*`` (e.g. ``_repr_html_``), as used in `IPython's rich display`_" +msgstr "" + +#: ../../library/enum.rst:871 msgid "``_missing_``, ``_order_``, ``_generate_next_value_``" msgstr "``_missing_``、``_order_``、``_generate_next_value_``" -#: ../../library/enum.rst:853 +#: ../../library/enum.rst:872 msgid "``_ignore_``" msgstr "``_ignore_``" -#: ../../library/enum.rst:858 +#: ../../library/enum.rst:873 +msgid "``_add_alias_``, ``_add_value_alias_``, ``_repr_*``" +msgstr "" + +#: ../../library/enum.rst:879 msgid "Utilities and Decorators" msgstr "通用項目與裝飾器" -#: ../../library/enum.rst:862 +#: ../../library/enum.rst:883 +#, fuzzy msgid "" "*auto* can be used in place of a value. If used, the *Enum* machinery will " -"call an *Enum*'s :meth:`~Enum._generate_next_value_` to get an appropriate " -"value. For *Enum* and *IntEnum* that appropriate value will be the last " -"value plus one; for *Flag* and *IntFlag* it will be the first power-of-two " -"greater than the highest value; for *StrEnum* it will be the lower-cased " -"version of the member's name. Care must be taken if mixing *auto()* with " -"manually specified values." +"call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an " +"appropriate value. For :class:`Enum` and :class:`IntEnum` that appropriate " +"value will be the last value plus one; for :class:`Flag` and :class:" +"`IntFlag` it will be the first power-of-two greater than the highest value; " +"for :class:`StrEnum` it will be the lower-cased version of the member's " +"name. Care must be taken if mixing *auto()* with manually specified values." msgstr "" "*auto* 可以用來取代給值。如果使用的話,*Enum* 系統會呼叫 *Enum* 的 :meth:" "`~Enum._generate_next_value_` 來取得合適的值。對 *Enum* 和 *IntEnum* 來說,合" @@ -1560,16 +1619,16 @@ msgstr "" "2 的次方的數字;對 *StrEnum* 來說,是成員名稱的小寫版本。如果混用 *auto()* 和" "手動指定值的話要特別注意。" -#: ../../library/enum.rst:870 +#: ../../library/enum.rst:891 msgid "" "*auto* instances are only resolved when at the top level of an assignment:" msgstr "*auto* 實例只有在最上層的賦值時才會被解析:" -#: ../../library/enum.rst:872 +#: ../../library/enum.rst:893 msgid "``FIRST = auto()`` will work (auto() is replaced with ``1``);" msgstr "``FIRST = auto()`` 可以運作(auto() 會被取代成 ``1``)" -#: ../../library/enum.rst:873 +#: ../../library/enum.rst:894 msgid "" "``SECOND = auto(), -2`` will work (auto is replaced with ``2``, so ``2, -2`` " "is used to create the ``SECOND`` enum member;" @@ -1577,7 +1636,7 @@ msgstr "" "``SECOND = auto(), -2`` 可以運作(auto 會被取代成 ``2``, 因此 ``2, -2`` 會被" "用來建立列舉成員 ``SECOND``;" -#: ../../library/enum.rst:875 +#: ../../library/enum.rst:896 msgid "" "``THREE = [auto(), -3]`` will *not* work (``, -3`` is used to " "create the ``THREE`` enum member)" @@ -1585,19 +1644,19 @@ msgstr "" "``THREE = [auto(), -3]`` *無法*\\ 運作(\\ ``, -3`` 會被用來建立列" "舉成員 ``THREE``)" -#: ../../library/enum.rst:880 +#: ../../library/enum.rst:901 msgid "" "In prior versions, ``auto()`` had to be the only thing on the assignment " "line to work properly." msgstr "在之前的版本中,``auto()`` 必須是賦值行裡的唯一內容才能運作正確。" -#: ../../library/enum.rst:883 +#: ../../library/enum.rst:904 msgid "" "``_generate_next_value_`` can be overridden to customize the values used by " "*auto*." msgstr "可以覆寫 ``_generate_next_value_`` 來客製 *auto* 使用的值。" -#: ../../library/enum.rst:886 +#: ../../library/enum.rst:907 msgid "" "in 3.13 the default ``_generate_next_value_`` will always return the highest " "member value incremented by 1, and will fail if any member is an " @@ -1606,7 +1665,7 @@ msgstr "" "在 3.13 預設 ``_generate_next_value_`` 總是回傳最大的成員值加一,如果任何成員" "是不相容的類型就會失敗。" -#: ../../library/enum.rst:892 +#: ../../library/enum.rst:913 msgid "" "A decorator similar to the built-in *property*, but specifically for " "enumerations. It allows member attributes to have the same names as members " @@ -1615,7 +1674,7 @@ msgstr "" "和內建的 *property* 相似的裝飾器,但只專門針對列舉。它允許成員屬性和成員本身" "有相同名稱。" -#: ../../library/enum.rst:896 +#: ../../library/enum.rst:917 msgid "" "the *property* and the member must be defined in separate classes; for " "example, the *value* and *name* attributes are defined in the *Enum* class, " @@ -1625,7 +1684,7 @@ msgstr "" "*屬性*\\ 和成員必須定義在分開的類別裡;例如 *value* 和 *name* 屬性定義在 " "*Enum* 類別而 *Enum* 子類別可以定義成員名稱為 ``value`` 和 ``name``。" -#: ../../library/enum.rst:905 +#: ../../library/enum.rst:926 msgid "" "A :keyword:`class` decorator specifically for enumerations. It searches an " "enumeration's :attr:`~EnumType.__members__`, gathering any aliases it finds; " @@ -1635,7 +1694,7 @@ msgstr "" "__members__`,蒐集任何它找到的別名;如果有找到任何別名則引發 :exc:" "`ValueError` 並附上細節: ::" -#: ../../library/enum.rst:909 +#: ../../library/enum.rst:930 msgid "" ">>> from enum import Enum, unique\n" ">>> @unique\n" @@ -1661,7 +1720,7 @@ msgstr "" "...\n" "ValueError: duplicate values found in : FOUR -> THREE" -#: ../../library/enum.rst:923 +#: ../../library/enum.rst:944 msgid "" "A :keyword:`class` decorator specifically for enumerations. Members from :" "class:`EnumCheck` are used to specify which constraints should be checked on " @@ -1670,15 +1729,15 @@ msgstr "" "專門針對列舉的 :keyword:`class` 裝飾器。使用 :class:`EnumCheck` 裡的成員來指" "定在裝飾的列舉上應該檢查什麼限制。" -#: ../../library/enum.rst:931 +#: ../../library/enum.rst:952 msgid "A decorator for use in enums: its target will become a member." msgstr "列舉所使用的裝飾器:其目標會變成成員。" -#: ../../library/enum.rst:937 +#: ../../library/enum.rst:958 msgid "A decorator for use in enums: its target will not become a member." msgstr "列舉所使用的裝飾器:其目標不會變成成員。" -#: ../../library/enum.rst:943 +#: ../../library/enum.rst:964 msgid "" "A decorator to change the :class:`str() ` and :func:`repr` of an enum " "to show its members as belonging to the module instead of its class. Should " @@ -1689,19 +1748,19 @@ msgstr "" "組而不是其類別。應該只有當列舉成員被匯出到模組的全域命名空間才使用(範例請參" "考 :class:`re.RegexFlag`)。" -#: ../../library/enum.rst:953 +#: ../../library/enum.rst:974 msgid "Return a list of all power-of-two integers contained in a flag *value*." msgstr "回傳在旗標\\ *值*\\ 中包含的所有 2 的次方的整數串列。" -#: ../../library/enum.rst:960 +#: ../../library/enum.rst:981 msgid "Notes" msgstr "備註" -#: ../../library/enum.rst:962 +#: ../../library/enum.rst:983 msgid ":class:`IntEnum`, :class:`StrEnum`, and :class:`IntFlag`" msgstr ":class:`IntEnum`、:class:`StrEnum` 及 :class:`IntFlag`" -#: ../../library/enum.rst:964 +#: ../../library/enum.rst:985 msgid "" "These three enum types are designed to be drop-in replacements for existing " "integer- and string-based values; as such, they have extra limitations:" @@ -1709,17 +1768,17 @@ msgstr "" "這三種列舉類型是設計來直接取代現有以整數及字串為基底的值;因此它們有額外的限" "制:" -#: ../../library/enum.rst:967 +#: ../../library/enum.rst:988 msgid "``__str__`` uses the value and not the name of the enum member" msgstr "``__str__`` 使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:969 +#: ../../library/enum.rst:990 msgid "" "``__format__``, because it uses ``__str__``, will also use the value of the " "enum member instead of its name" msgstr "``__format__`` 因為使用 ``__str__``,也會使用值而不是列舉成員的名稱" -#: ../../library/enum.rst:972 +#: ../../library/enum.rst:993 msgid "" "If you do not need/want those limitations, you can either create your own " "base class by mixing in the ``int`` or ``str`` type yourself::" @@ -1727,7 +1786,7 @@ msgstr "" "如果你不需要或不想要這些限制,你可以透過混合 ``int`` 或 ``str`` 類型來建立自" "己的基礎類別: ::" -#: ../../library/enum.rst:975 +#: ../../library/enum.rst:996 msgid "" ">>> from enum import Enum\n" ">>> class MyIntEnum(int, Enum):\n" @@ -1737,11 +1796,11 @@ msgstr "" ">>> class MyIntEnum(int, Enum):\n" "... pass" -#: ../../library/enum.rst:979 +#: ../../library/enum.rst:1000 msgid "or you can reassign the appropriate :meth:`str`, etc., in your enum::" msgstr "或者你也可以在你的列舉重新給定合適的 :meth:`str`: ::" -#: ../../library/enum.rst:981 +#: ../../library/enum.rst:1002 msgid "" ">>> from enum import Enum, IntEnum\n" ">>> class MyIntEnum(IntEnum):\n" diff --git a/library/errno.po b/library/errno.po index 6316d82767..8a2c10f4e4 100644 --- a/library/errno.po +++ b/library/errno.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/exceptions.po b/library/exceptions.po index 9ef5f376f1..eb2e321fa6 100644 --- a/library/exceptions.po +++ b/library/exceptions.po @@ -6,9 +6,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-09-17 09:18+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -624,19 +624,47 @@ msgstr "" "化,大部分的浮點數運算都沒有被檢查。" #: ../../library/exceptions.rst:421 +#, fuzzy msgid "" -"This exception is derived from :exc:`RuntimeError`. It is raised when the " -"interpreter detects that the maximum recursion depth (see :func:`sys." -"getrecursionlimit`) is exceeded." +"This exception is derived from :exc:`RuntimeError`. It is raised when an " +"operation is blocked during interpreter shutdown also known as :term:`Python " +"finalization `." msgstr "" "此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參考 :" "func:`sys.getrecursionlimit`)時會引發此例外。" #: ../../library/exceptions.rst:425 +msgid "" +"Examples of operations which can be blocked with a :exc:" +"`PythonFinalizationError` during the Python finalization:" +msgstr "" + +#: ../../library/exceptions.rst:428 +msgid "Creating a new Python thread." +msgstr "" + +#: ../../library/exceptions.rst:429 +msgid ":func:`os.fork`." +msgstr ":func:`os.fork`。" + +#: ../../library/exceptions.rst:431 +msgid "See also the :func:`sys.is_finalizing` function." +msgstr "" + +#: ../../library/exceptions.rst:433 ../../library/exceptions.rst:443 msgid "Previously, a plain :exc:`RuntimeError` was raised." msgstr "在之前,會引發一般的 :exc:`RuntimeError`。" -#: ../../library/exceptions.rst:431 +#: ../../library/exceptions.rst:439 +msgid "" +"This exception is derived from :exc:`RuntimeError`. It is raised when the " +"interpreter detects that the maximum recursion depth (see :func:`sys." +"getrecursionlimit`) is exceeded." +msgstr "" +"此例外衍生自 :exc:`RuntimeError`。當直譯器偵測到超過最大的遞迴深度(參考 :" +"func:`sys.getrecursionlimit`)時會引發此例外。" + +#: ../../library/exceptions.rst:449 msgid "" "This exception is raised when a weak reference proxy, created by the :func:" "`weakref.proxy` function, is used to access an attribute of the referent " @@ -647,7 +675,7 @@ msgstr "" "用來存取已經被垃圾回收 (garbage collected) 的參照物屬性時會引發此例外。更多關" "於弱參照的資訊參考 :mod:`weakref` 模組。" -#: ../../library/exceptions.rst:439 +#: ../../library/exceptions.rst:457 msgid "" "Raised when an error is detected that doesn't fall in any of the other " "categories. The associated value is a string indicating what precisely went " @@ -656,7 +684,7 @@ msgstr "" "當偵測到一個不屬於任何其他種類的錯誤時會引發此例外。關聯值是一個表示確切什麼" "地方出錯的字串。" -#: ../../library/exceptions.rst:446 +#: ../../library/exceptions.rst:464 msgid "" "Raised by built-in function :func:`next` and an :term:`iterator`\\'s :meth:" "`~iterator.__next__` method to signal that there are no further items " @@ -665,7 +693,7 @@ msgstr "" "會被內建函式 :func:`next` 及 :term:`iterator` 的 :meth:`~iterator.__next__` " "方法引發,用來表示疊代器沒有更多項目可以產生。" -#: ../../library/exceptions.rst:452 +#: ../../library/exceptions.rst:470 msgid "" "The exception object has a single attribute :attr:`!value`, which is given " "as an argument when constructing the exception, and defaults to :const:" @@ -674,7 +702,7 @@ msgstr "" "此例外物件有單一屬性 :attr:`!value`,當建構此例外時會以引數給定,預設為 :" "const:`None`。" -#: ../../library/exceptions.rst:456 +#: ../../library/exceptions.rst:474 msgid "" "When a :term:`generator` or :term:`coroutine` function returns, a new :exc:" "`StopIteration` instance is raised, and the value returned by the function " @@ -684,7 +712,7 @@ msgstr "" "`StopIteration` 實例會被引發,而該函式的回傳值會被用來當作此例外建構函式的 :" "attr:`value` 參數。" -#: ../../library/exceptions.rst:461 +#: ../../library/exceptions.rst:479 msgid "" "If a generator code directly or indirectly raises :exc:`StopIteration`, it " "is converted into a :exc:`RuntimeError` (retaining the :exc:`StopIteration` " @@ -693,13 +721,13 @@ msgstr "" "如果產生器程式直接或間接引發 :exc:`StopIteration`,則其會被轉換成 :exc:" "`RuntimeError`\\ (保留 :exc:`StopIteration` 作為新例外的成因)。" -#: ../../library/exceptions.rst:465 +#: ../../library/exceptions.rst:483 msgid "" "Added ``value`` attribute and the ability for generator functions to use it " "to return a value." msgstr "新增 ``value`` 屬性且產生器函式可以用它來回傳值。" -#: ../../library/exceptions.rst:469 +#: ../../library/exceptions.rst:487 msgid "" "Introduced the RuntimeError transformation via ``from __future__ import " "generator_stop``, see :pep:`479`." @@ -707,7 +735,7 @@ msgstr "" "透過 ``from __future__ import generator_stop`` 引入 RuntimeError 的轉換,參" "考 :pep:`479`。" -#: ../../library/exceptions.rst:473 +#: ../../library/exceptions.rst:491 msgid "" "Enable :pep:`479` for all code by default: a :exc:`StopIteration` error " "raised in a generator is transformed into a :exc:`RuntimeError`." @@ -715,7 +743,7 @@ msgstr "" "預設對所有程式啟用 :pep:`479`:在產生器引發的 :exc:`StopIteration` 錯誤會轉換" "成 :exc:`RuntimeError`。" -#: ../../library/exceptions.rst:479 +#: ../../library/exceptions.rst:497 msgid "" "Must be raised by :meth:`~object.__anext__` method of an :term:`asynchronous " "iterator` object to stop the iteration." @@ -723,7 +751,7 @@ msgstr "" "此例外必須被 :term:`asynchronous iterator` 物件的 :meth:`~object.__anext__` " "方法引發來停止疊代。" -#: ../../library/exceptions.rst:486 +#: ../../library/exceptions.rst:504 msgid "" "Raised when the parser encounters a syntax error. This may occur in an :" "keyword:`import` statement, in a call to the built-in functions :func:" @@ -734,7 +762,7 @@ msgstr "" "呼叫內建函式 :func:`compile`、:func:`exec` 或 :func:`eval` 的時候,或者在讀取" "初始腳本或標準輸入(也包含互動式)的時候。" -#: ../../library/exceptions.rst:492 +#: ../../library/exceptions.rst:510 msgid "" "The :func:`str` of the exception instance returns only the error message. " "Details is a tuple whose members are also available as separate attributes." @@ -742,18 +770,18 @@ msgstr "" "例外實例的 :func:`str` 只回傳錯誤訊息。Details 是個元組,其成員也能夠以分開的" "屬性取得。" -#: ../../library/exceptions.rst:497 +#: ../../library/exceptions.rst:515 msgid "The name of the file the syntax error occurred in." msgstr "發生語法錯誤所在的檔案名稱。" -#: ../../library/exceptions.rst:501 +#: ../../library/exceptions.rst:519 msgid "" "Which line number in the file the error occurred in. This is 1-indexed: the " "first line in the file has a ``lineno`` of 1." msgstr "" "發生錯誤所在檔案的列號。這是以 1 開始的索引:檔案第一列的 ``lineno`` 是 1。" -#: ../../library/exceptions.rst:506 +#: ../../library/exceptions.rst:524 msgid "" "The column in the line where the error occurred. This is 1-indexed: the " "first character in the line has an ``offset`` of 1." @@ -761,11 +789,11 @@ msgstr "" "發生錯誤所在該列的欄號 (column)。這是以 1 開始的索引:該列第一個字元的 " "``offset`` 是 1。" -#: ../../library/exceptions.rst:511 +#: ../../library/exceptions.rst:529 msgid "The source code text involved in the error." msgstr "涉及該錯誤的原始程式碼文字。" -#: ../../library/exceptions.rst:515 +#: ../../library/exceptions.rst:533 msgid "" "Which line number in the file the error occurred ends in. This is 1-indexed: " "the first line in the file has a ``lineno`` of 1." @@ -773,7 +801,7 @@ msgstr "" "發生錯誤所在檔案的結束列號。這是以 1 開始的索引:檔案第一列的 ``lineno`` 是 " "1。" -#: ../../library/exceptions.rst:520 +#: ../../library/exceptions.rst:538 msgid "" "The column in the end line where the error occurred finishes. This is 1-" "indexed: the first character in the line has an ``offset`` of 1." @@ -781,7 +809,7 @@ msgstr "" "發生錯誤所在該結束列的欄號。這是以 1 開始的索引:該列第一個字元的 ``offset`` " "是 1。" -#: ../../library/exceptions.rst:523 +#: ../../library/exceptions.rst:541 msgid "" "For errors in f-string fields, the message is prefixed by \"f-string: \" and " "the offsets are offsets in a text constructed from the replacement " @@ -792,18 +820,18 @@ msgstr "" "(offset) 是從替代表達式建構的文字的偏移量。例如編譯 f'Bad {a b} field' 會得到" "這個 args 屬性:('f-string: ...', ('', 1, 2, '(a b)\\n', 1, 5))。" -#: ../../library/exceptions.rst:528 +#: ../../library/exceptions.rst:546 msgid "Added the :attr:`end_lineno` and :attr:`end_offset` attributes." msgstr "新增 :attr:`end_lineno` 與 :attr:`end_offset` 屬性。" -#: ../../library/exceptions.rst:533 +#: ../../library/exceptions.rst:551 msgid "" "Base class for syntax errors related to incorrect indentation. This is a " "subclass of :exc:`SyntaxError`." msgstr "" "與不正確的縮排有關的語法錯誤的基礎類別。這是 :exc:`SyntaxError` 的子類別。" -#: ../../library/exceptions.rst:539 +#: ../../library/exceptions.rst:557 msgid "" "Raised when indentation contains an inconsistent use of tabs and spaces. " "This is a subclass of :exc:`IndentationError`." @@ -811,7 +839,7 @@ msgstr "" "當縮排包含製表符號 (tab) 和空白的不一致用法時會引發此例外。這是 :exc:" "`IndentationError` 的子類別。" -#: ../../library/exceptions.rst:545 +#: ../../library/exceptions.rst:563 msgid "" "Raised when the interpreter finds an internal error, but the situation does " "not look so serious to cause it to abandon all hope. The associated value is " @@ -820,7 +848,7 @@ msgstr "" "當直譯器找到一個內部錯誤,但該情況看起來沒有嚴重到要讓它放棄所有的希望時會引" "發此例外。關聯值是一個表示什麼地方出錯的字串(以低階的方式表達)。" -#: ../../library/exceptions.rst:549 +#: ../../library/exceptions.rst:567 msgid "" "You should report this to the author or maintainer of your Python " "interpreter. Be sure to report the version of the Python interpreter (``sys." @@ -832,7 +860,7 @@ msgstr "" "的版本(``sys.version``;這也會在互動式 Python 會話的開頭被印出)、確切的錯誤" "訊息(該例外的關聯值)及如果可能的話,觸發此錯誤的程式來源。" -#: ../../library/exceptions.rst:558 +#: ../../library/exceptions.rst:576 msgid "" "This exception is raised by the :func:`sys.exit` function. It inherits " "from :exc:`BaseException` instead of :exc:`Exception` so that it is not " @@ -853,7 +881,7 @@ msgstr "" "``None``,結束狀態會是 0;如果它是其他類型(例如字串),則物件的值會被印出而" "結束狀態是 1。" -#: ../../library/exceptions.rst:569 +#: ../../library/exceptions.rst:587 msgid "" "A call to :func:`sys.exit` is translated into an exception so that clean-up " "handlers (:keyword:`finally` clauses of :keyword:`try` statements) can be " @@ -867,13 +895,13 @@ msgstr "" "風險下執行腳本。如果在絕對有必要立即結束的情況(例如在子行程呼叫完 :func:`os." "fork` 之後 )可以使用 :func:`os._exit` 函式。" -#: ../../library/exceptions.rst:578 +#: ../../library/exceptions.rst:596 msgid "" "The exit status or error message that is passed to the constructor. " "(Defaults to ``None``.)" msgstr "傳入建構函式的結束狀態或錯誤訊息。(預設是 ``None``。 )" -#: ../../library/exceptions.rst:584 +#: ../../library/exceptions.rst:602 msgid "" "Raised when an operation or function is applied to an object of " "inappropriate type. The associated value is a string giving details about " @@ -882,7 +910,7 @@ msgstr "" "當一個操作或函式被用在不適合的類型的物件時會引發此例外。關聯值是一個字串,提" "供關於不相符類型的細節。" -#: ../../library/exceptions.rst:587 +#: ../../library/exceptions.rst:605 msgid "" "This exception may be raised by user code to indicate that an attempted " "operation on an object is not supported, and is not meant to be. If an " @@ -893,7 +921,7 @@ msgstr "" "這樣做。如果一個物件有意要支援某個給定的操作但尚未提供實作,該引發的正確例外" "是 :exc:`NotImplementedError`。" -#: ../../library/exceptions.rst:592 +#: ../../library/exceptions.rst:610 msgid "" "Passing arguments of the wrong type (e.g. passing a :class:`list` when an :" "class:`int` is expected) should result in a :exc:`TypeError`, but passing " @@ -904,7 +932,7 @@ msgstr "" "導致 :exc:`TypeError`,但傳入帶有錯誤值的引數(例如超出預期範圍的數值)應該要" "導致 :exc:`ValueError`。" -#: ../../library/exceptions.rst:599 +#: ../../library/exceptions.rst:617 msgid "" "Raised when a reference is made to a local variable in a function or method, " "but no value has been bound to that variable. This is a subclass of :exc:" @@ -913,7 +941,7 @@ msgstr "" "當在函式或方法裡引用某個區域變數,但該變數尚未被繫結到任何值的時候會引發此例" "外。這是 :exc:`NameError` 的子類別。" -#: ../../library/exceptions.rst:606 +#: ../../library/exceptions.rst:624 msgid "" "Raised when a Unicode-related encoding or decoding error occurs. It is a " "subclass of :exc:`ValueError`." @@ -921,7 +949,7 @@ msgstr "" "當 Unicode 相關的編碼或解碼錯誤發生時會引發此例外。這是 :exc:`ValueError` 的" "子類別。" -#: ../../library/exceptions.rst:609 +#: ../../library/exceptions.rst:627 msgid "" ":exc:`UnicodeError` has attributes that describe the encoding or decoding " "error. For example, ``err.object[err.start:err.end]`` gives the particular " @@ -930,27 +958,27 @@ msgstr "" ":exc:`UnicodeError` 有屬性描述編碼或解碼錯誤。例如 ``err.object[err.start:" "err.end]`` 會提供讓編解碼器失敗的具體無效輸入。" -#: ../../library/exceptions.rst:615 +#: ../../library/exceptions.rst:633 msgid "The name of the encoding that raised the error." msgstr "引發錯誤的編碼名稱。" -#: ../../library/exceptions.rst:619 +#: ../../library/exceptions.rst:637 msgid "A string describing the specific codec error." msgstr "描述特定編解碼器錯誤的字串。" -#: ../../library/exceptions.rst:623 +#: ../../library/exceptions.rst:641 msgid "The object the codec was attempting to encode or decode." msgstr "編解碼器嘗試編碼或解碼的物件。" -#: ../../library/exceptions.rst:627 +#: ../../library/exceptions.rst:645 msgid "The first index of invalid data in :attr:`object`." msgstr "在 :attr:`object` 中無效資料的開始索引。" -#: ../../library/exceptions.rst:631 +#: ../../library/exceptions.rst:649 msgid "The index after the last invalid data in :attr:`object`." msgstr "在 :attr:`object` 中最後的無效資料後的索引。" -#: ../../library/exceptions.rst:636 +#: ../../library/exceptions.rst:654 msgid "" "Raised when a Unicode-related error occurs during encoding. It is a " "subclass of :exc:`UnicodeError`." @@ -958,7 +986,7 @@ msgstr "" "在編碼當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:642 +#: ../../library/exceptions.rst:660 msgid "" "Raised when a Unicode-related error occurs during decoding. It is a " "subclass of :exc:`UnicodeError`." @@ -966,7 +994,7 @@ msgstr "" "在解碼當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:648 +#: ../../library/exceptions.rst:666 msgid "" "Raised when a Unicode-related error occurs during translating. It is a " "subclass of :exc:`UnicodeError`." @@ -974,7 +1002,7 @@ msgstr "" "在轉譯當中發生 Unicode 相關錯誤時會引發此例外。這是 :exc:`UnicodeError` 的子" "類別。" -#: ../../library/exceptions.rst:654 +#: ../../library/exceptions.rst:672 msgid "" "Raised when an operation or function receives an argument that has the right " "type but an inappropriate value, and the situation is not described by a " @@ -983,7 +1011,7 @@ msgstr "" "當一個操作或函式收到引數是正確類型但是不適合的值,且該情況無法被更精確的例外" "例如 :exc:`IndexError` 所描述時會引發此例外。" -#: ../../library/exceptions.rst:661 +#: ../../library/exceptions.rst:679 msgid "" "Raised when the second argument of a division or modulo operation is zero. " "The associated value is a string indicating the type of the operands and the " @@ -992,7 +1020,7 @@ msgstr "" "當除法或模數運算 (modulo operation) 的第二個引數是 0 的時候會引發此例外。關聯" "值是一個字串,表示運算元及運算的類型。" -#: ../../library/exceptions.rst:666 +#: ../../library/exceptions.rst:684 msgid "" "The following exceptions are kept for compatibility with previous versions; " "starting from Python 3.3, they are aliases of :exc:`OSError`." @@ -1000,21 +1028,21 @@ msgstr "" "以下例外是為了相容於之前版本而保留;從 Python 3.3 開始,它們是 :exc:" "`OSError` 的別名。" -#: ../../library/exceptions.rst:675 +#: ../../library/exceptions.rst:693 msgid "Only available on Windows." msgstr "僅限於在 Windows 中使用。" -#: ../../library/exceptions.rst:679 +#: ../../library/exceptions.rst:697 msgid "OS exceptions" msgstr "作業系統例外" -#: ../../library/exceptions.rst:681 +#: ../../library/exceptions.rst:699 msgid "" "The following exceptions are subclasses of :exc:`OSError`, they get raised " "depending on the system error code." msgstr "以下的例外是 :exc:`OSError` 的子類別,它們根據系統錯誤代碼來引發。" -#: ../../library/exceptions.rst:686 +#: ../../library/exceptions.rst:704 msgid "" "Raised when an operation would block on an object (e.g. socket) set for non-" "blocking operation. Corresponds to :c:data:`errno` :py:const:`~errno." @@ -1025,14 +1053,14 @@ msgstr "" "到 :c:data:`errno` :py:const:`~errno.EAGAIN`、:py:const:`~errno.EALREADY`、:" "py:const:`~errno.EWOULDBLOCK` 及 :py:const:`~errno.EINPROGRESS`。" -#: ../../library/exceptions.rst:691 +#: ../../library/exceptions.rst:709 msgid "" "In addition to those of :exc:`OSError`, :exc:`BlockingIOError` can have one " "more attribute:" msgstr "" "除了 :exc:`OSError` 的那些屬性之外,:exc:`BlockingIOError` 有多一個屬性:" -#: ../../library/exceptions.rst:696 +#: ../../library/exceptions.rst:714 msgid "" "An integer containing the number of characters written to the stream before " "it blocked. This attribute is available when using the buffered I/O classes " @@ -1041,7 +1069,7 @@ msgstr "" "一個整數,內容為在其阻塞之前,已寫進串流的字元數。當使用 :mod:`io` 模組裡的緩" "衝 I/O 類別時這個屬性是可用的。" -#: ../../library/exceptions.rst:702 +#: ../../library/exceptions.rst:720 msgid "" "Raised when an operation on a child process failed. Corresponds to :c:data:" "`errno` :py:const:`~errno.ECHILD`." @@ -1049,11 +1077,11 @@ msgstr "" "當子行程上的操作失敗時會引發此例外。對應到 :c:data:`errno` :py:const:`~errno." "ECHILD`。" -#: ../../library/exceptions.rst:707 +#: ../../library/exceptions.rst:725 msgid "A base class for connection-related issues." msgstr "連線相關問題的基礎類別。" -#: ../../library/exceptions.rst:709 +#: ../../library/exceptions.rst:727 msgid "" "Subclasses are :exc:`BrokenPipeError`, :exc:`ConnectionAbortedError`, :exc:" "`ConnectionRefusedError` and :exc:`ConnectionResetError`." @@ -1061,7 +1089,7 @@ msgstr "" "子類別有 :exc:`BrokenPipeError`、:exc:`ConnectionAbortedError`、:exc:" "`ConnectionRefusedError` 及 :exc:`ConnectionResetError`。" -#: ../../library/exceptions.rst:714 +#: ../../library/exceptions.rst:732 msgid "" "A subclass of :exc:`ConnectionError`, raised when trying to write on a pipe " "while the other end has been closed, or trying to write on a socket which " @@ -1072,7 +1100,7 @@ msgstr "" "會引發此例外,或者當嘗試寫入已關閉寫入的 socket 時也會引發。對應到 :c:data:" "`errno` :py:const:`~errno.EPIPE` 及 :py:const:`~errno.ESHUTDOWN`。" -#: ../../library/exceptions.rst:721 +#: ../../library/exceptions.rst:739 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " "aborted by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." @@ -1081,7 +1109,7 @@ msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線的嘗試被對等端點 (peer) 中斷時會引" "發此例外。對應到 :c:data:`errno` :py:const:`~errno.ECONNABORTED`。" -#: ../../library/exceptions.rst:727 +#: ../../library/exceptions.rst:745 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection attempt is " "refused by the peer. Corresponds to :c:data:`errno` :py:const:`~errno." @@ -1090,7 +1118,7 @@ msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線的嘗試被對等端點拒絕時會引發此例" "外。對應到 :c:data:`errno` :py:const:`~errno.ECONNREFUSED`。" -#: ../../library/exceptions.rst:733 +#: ../../library/exceptions.rst:751 msgid "" "A subclass of :exc:`ConnectionError`, raised when a connection is reset by " "the peer. Corresponds to :c:data:`errno` :py:const:`~errno.ECONNRESET`." @@ -1098,7 +1126,7 @@ msgstr "" ":exc:`ConnectionError` 的子類別。當一個連線被對等端點重置時會引發此例外。對應" "到 :c:data:`errno` :py:const:`~errno.ECONNRESET`。" -#: ../../library/exceptions.rst:739 +#: ../../library/exceptions.rst:757 msgid "" "Raised when trying to create a file or directory which already exists. " "Corresponds to :c:data:`errno` :py:const:`~errno.EEXIST`." @@ -1106,7 +1134,7 @@ msgstr "" "當嘗試建立已存在的檔案或目錄時會引發此例外。對應到 :c:data:`errno` :py:const:" "`~errno.EEXIST`。" -#: ../../library/exceptions.rst:744 +#: ../../library/exceptions.rst:762 msgid "" "Raised when a file or directory is requested but doesn't exist. Corresponds " "to :c:data:`errno` :py:const:`~errno.ENOENT`." @@ -1114,7 +1142,7 @@ msgstr "" "當請求不存在的檔案或目錄時會引發此例外。對應到 :c:data:`errno` :py:const:" "`~errno.ENOENT`。" -#: ../../library/exceptions.rst:749 +#: ../../library/exceptions.rst:767 msgid "" "Raised when a system call is interrupted by an incoming signal. Corresponds " "to :c:data:`errno` :py:const:`~errno.EINTR`." @@ -1122,7 +1150,7 @@ msgstr "" "當系統呼叫被傳入的信號中斷時會引發此例外。對應到 :c:data:`errno` :py:const:" "`~errno.EINTR`。" -#: ../../library/exceptions.rst:752 +#: ../../library/exceptions.rst:770 msgid "" "Python now retries system calls when a syscall is interrupted by a signal, " "except if the signal handler raises an exception (see :pep:`475` for the " @@ -1131,7 +1159,7 @@ msgstr "" "現在當 syscall 被信號中斷時 Python 會重試系統呼叫而不會引發 :exc:" "`InterruptedError`,除非信號處理器引發例外(理由可參考 :pep:`475`)。" -#: ../../library/exceptions.rst:759 +#: ../../library/exceptions.rst:777 msgid "" "Raised when a file operation (such as :func:`os.remove`) is requested on a " "directory. Corresponds to :c:data:`errno` :py:const:`~errno.EISDIR`." @@ -1139,7 +1167,7 @@ msgstr "" "當在目錄上請求檔案操作(例如 :func:`os.remove`)時會引發此例外。對應到 :c:" "data:`errno` :py:const:`~errno.EISDIR`。" -#: ../../library/exceptions.rst:765 +#: ../../library/exceptions.rst:783 msgid "" "Raised when a directory operation (such as :func:`os.listdir`) is requested " "on something which is not a directory. On most POSIX platforms, it may also " @@ -1151,7 +1179,7 @@ msgstr "" "外。在大多數的 POSIX 平台上,如果嘗試操作開啟或遍歷一個當作目錄的非目錄檔案也" "會引發此例外。對應到 :c:data:`errno` :py:const:`~errno.ENOTDIR`。" -#: ../../library/exceptions.rst:773 +#: ../../library/exceptions.rst:791 msgid "" "Raised when trying to run an operation without the adequate access rights - " "for example filesystem permissions. Corresponds to :c:data:`errno` :py:const:" @@ -1162,14 +1190,14 @@ msgstr "" "到 :c:data:`errno` :py:const:`~errno.EACCES`、:py:const:`~errno.EPERM` 及 :" "py:const:`~errno.ENOTCAPABLE`。" -#: ../../library/exceptions.rst:778 +#: ../../library/exceptions.rst:796 msgid "" "WASI's :py:const:`~errno.ENOTCAPABLE` is now mapped to :exc:" "`PermissionError`." msgstr "" "WASI 的 :py:const:`~errno.ENOTCAPABLE` 現在對應到 :exc:`PermissionError`。" -#: ../../library/exceptions.rst:784 +#: ../../library/exceptions.rst:802 msgid "" "Raised when a given process doesn't exist. Corresponds to :c:data:`errno` :" "py:const:`~errno.ESRCH`." @@ -1177,7 +1205,7 @@ msgstr "" "當給定的行程不存在時會引發此例外。對應到 :c:data:`errno` :py:const:`~errno." "ESRCH`。" -#: ../../library/exceptions.rst:789 +#: ../../library/exceptions.rst:807 msgid "" "Raised when a system function timed out at the system level. Corresponds to :" "c:data:`errno` :py:const:`~errno.ETIMEDOUT`." @@ -1185,40 +1213,40 @@ msgstr "" "當系統函式在系統層級超時會引發此例外。對應到 :c:data:`errno` :py:const:" "`~errno.ETIMEDOUT`。" -#: ../../library/exceptions.rst:792 +#: ../../library/exceptions.rst:810 msgid "All the above :exc:`OSError` subclasses were added." msgstr "加入以上所有的 :exc:`OSError` 子類別。" -#: ../../library/exceptions.rst:798 +#: ../../library/exceptions.rst:816 msgid ":pep:`3151` - Reworking the OS and IO exception hierarchy" msgstr ":pep:`3151` — 改寫作業系統與 IO 例外階層" -#: ../../library/exceptions.rst:804 +#: ../../library/exceptions.rst:822 msgid "Warnings" msgstr "警告" -#: ../../library/exceptions.rst:806 +#: ../../library/exceptions.rst:824 msgid "" "The following exceptions are used as warning categories; see the :ref:" "`warning-categories` documentation for more details." msgstr "" "以下的例外是當作警告的種類使用;更多細節參考 :ref:`warning-categories` 文件。" -#: ../../library/exceptions.rst:811 +#: ../../library/exceptions.rst:829 msgid "Base class for warning categories." msgstr "警告種類的基礎類別。" -#: ../../library/exceptions.rst:816 +#: ../../library/exceptions.rst:834 msgid "Base class for warnings generated by user code." msgstr "使用者程式碼產生的警告的基礎類別。" -#: ../../library/exceptions.rst:821 +#: ../../library/exceptions.rst:839 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for other Python developers." msgstr "關於已棄用功能的警告的基礎類別,且當那些警告是針對其他 Python 開發者。" -#: ../../library/exceptions.rst:824 +#: ../../library/exceptions.rst:842 msgid "" "Ignored by the default warning filters, except in the ``__main__`` module (:" "pep:`565`). Enabling the :ref:`Python Development Mode ` shows this " @@ -1227,17 +1255,17 @@ msgstr "" "會被預設的警告過濾器忽略,在 ``__main__`` 模組裡除外 (:pep:`565`)。啟用 :ref:" "`Python 開發模式 `\\ 會顯示此警告。" -#: ../../library/exceptions.rst:828 ../../library/exceptions.rst:844 +#: ../../library/exceptions.rst:846 ../../library/exceptions.rst:862 msgid "The deprecation policy is described in :pep:`387`." msgstr "棄用原則描述在 :pep:`387` 裡。" -#: ../../library/exceptions.rst:833 +#: ../../library/exceptions.rst:851 msgid "" "Base class for warnings about features which are obsolete and expected to be " "deprecated in the future, but are not deprecated at the moment." msgstr "關於過時且預期未來要被棄用,但目前尚未被棄用的功能的警告的基礎類別。" -#: ../../library/exceptions.rst:837 +#: ../../library/exceptions.rst:855 msgid "" "This class is rarely used as emitting a warning about a possible upcoming " "deprecation is unusual, and :exc:`DeprecationWarning` is preferred for " @@ -1246,8 +1274,8 @@ msgstr "" "因為發出關於可能即將被棄用的警告是不尋常的,此類別很少被使用,而對已經被棄用" "的情況會優先使用 :exc:`DeprecationWarning`。" -#: ../../library/exceptions.rst:841 ../../library/exceptions.rst:867 -#: ../../library/exceptions.rst:894 +#: ../../library/exceptions.rst:859 ../../library/exceptions.rst:885 +#: ../../library/exceptions.rst:912 msgid "" "Ignored by the default warning filters. Enabling the :ref:`Python " "Development Mode ` shows this warning." @@ -1255,15 +1283,15 @@ msgstr "" "會被預設的警告過濾器忽略。啟用 :ref:`Python 開發模式 `\\ 會顯示此警" "告。" -#: ../../library/exceptions.rst:849 +#: ../../library/exceptions.rst:867 msgid "Base class for warnings about dubious syntax." msgstr "關於可疑語法的警告的基礎類別。" -#: ../../library/exceptions.rst:854 +#: ../../library/exceptions.rst:872 msgid "Base class for warnings about dubious runtime behavior." msgstr "關於可疑執行環境行為的警告的基礎類別。" -#: ../../library/exceptions.rst:859 +#: ../../library/exceptions.rst:877 msgid "" "Base class for warnings about deprecated features when those warnings are " "intended for end users of applications that are written in Python." @@ -1271,36 +1299,36 @@ msgstr "" "關於已棄用功能的警告的基礎類別,且當那些警告是針對以 Python 寫的應用程式的終" "端使用者。" -#: ../../library/exceptions.rst:865 +#: ../../library/exceptions.rst:883 msgid "Base class for warnings about probable mistakes in module imports." msgstr "關於在模組引入的可能錯誤的警告的基礎類別。" -#: ../../library/exceptions.rst:873 +#: ../../library/exceptions.rst:891 msgid "Base class for warnings related to Unicode." msgstr "Unicode 相關警告的基礎類別。" -#: ../../library/exceptions.rst:878 +#: ../../library/exceptions.rst:896 msgid "Base class for warnings related to encodings." msgstr "編碼相關警告的基礎類別。" -#: ../../library/exceptions.rst:880 +#: ../../library/exceptions.rst:898 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節參考\\ :ref:`io-encoding-warning`。" -#: ../../library/exceptions.rst:887 +#: ../../library/exceptions.rst:905 msgid "" "Base class for warnings related to :class:`bytes` and :class:`bytearray`." msgstr ":class:`bytes` 及 :class:`bytearray` 相關警告的基礎類別。" -#: ../../library/exceptions.rst:892 +#: ../../library/exceptions.rst:910 msgid "Base class for warnings related to resource usage." msgstr "資源用法相關警告的基礎類別。" -#: ../../library/exceptions.rst:903 +#: ../../library/exceptions.rst:921 msgid "Exception groups" msgstr "例外群組" -#: ../../library/exceptions.rst:905 +#: ../../library/exceptions.rst:923 msgid "" "The following are used when it is necessary to raise multiple unrelated " "exceptions. They are part of the exception hierarchy so they can be handled " @@ -1312,7 +1340,7 @@ msgstr "" "所有其他例外一樣使用 :keyword:`except` 來處理。此外,它們會以包含的例外類型為" "基礎來比對其子群組而被 :keyword:`except*` 辨認出來。" -#: ../../library/exceptions.rst:914 +#: ../../library/exceptions.rst:932 msgid "" "Both of these exception types wrap the exceptions in the sequence ``excs``. " "The ``msg`` parameter must be a string. The difference between the two " @@ -1328,7 +1356,7 @@ msgstr "" "`Exception` 的子類別。這個設計使得 ``except Exception`` 可以捕捉 :exc:" "`ExceptionGroup` 但不能捕捉 :exc:`BaseExceptionGroup`。" -#: ../../library/exceptions.rst:922 +#: ../../library/exceptions.rst:940 msgid "" "The :exc:`BaseExceptionGroup` constructor returns an :exc:`ExceptionGroup` " "rather than a :exc:`BaseExceptionGroup` if all contained exceptions are :exc:" @@ -1341,17 +1369,17 @@ msgstr "" "使用來讓這樣的選擇自動化。另一方面來說,如果任何包含的例外不是 :exc:" "`Exception` 的子類別,:exc:`ExceptionGroup` 建構函式會引發 :exc:`TypeError`。" -#: ../../library/exceptions.rst:931 +#: ../../library/exceptions.rst:949 msgid "The ``msg`` argument to the constructor. This is a read-only attribute." msgstr "建構函式的 ``msg`` 引數。這是一個唯讀的屬性。" -#: ../../library/exceptions.rst:935 +#: ../../library/exceptions.rst:953 msgid "" "A tuple of the exceptions in the ``excs`` sequence given to the constructor. " "This is a read-only attribute." msgstr "指定給建構函式 ``excs`` 序列中的例外組成的元組。這是一個唯讀的屬性。" -#: ../../library/exceptions.rst:940 +#: ../../library/exceptions.rst:958 msgid "" "Returns an exception group that contains only the exceptions from the " "current group that match *condition*, or ``None`` if the result is empty." @@ -1359,18 +1387,16 @@ msgstr "" "回傳只包含從現有群組比對到 *condition* 的例外的例外群組,或者當結果為空時回" "傳 ``None``。" -#: ../../library/exceptions.rst:943 +#: ../../library/exceptions.rst:961 msgid "" -"The condition can be either a function that accepts an exception and returns " -"true for those that should be in the subgroup, or it can be an exception " -"type or a tuple of exception types, which is used to check for a match using " -"the same check that is used in an ``except`` clause." +"The condition can be an exception type or tuple of exception types, in which " +"case each exception is checked for a match using the same check that is used " +"in an ``except`` clause. The condition can also be a callable (other than a " +"type object) that accepts an exception as its single argument and returns " +"true for the exceptions that should be in the subgroup." msgstr "" -"條件可以是一個函式,接受一個例外並對那些應該要在子群組裡的例外回傳 true,或者" -"可以是一個例外類型或例外類型的元組,並使用與 ``except`` 子句所使用的相同檢查" -"來檢查是否有比對到。" -#: ../../library/exceptions.rst:948 +#: ../../library/exceptions.rst:967 msgid "" "The nesting structure of the current exception is preserved in the result, " "as are the values of its :attr:`message`, :attr:`~BaseException." @@ -1383,7 +1409,7 @@ msgstr "" "__context__` 及 :attr:`~BaseException.__notes__` 欄位的值也一樣。空的巢狀群組" "會從結果裡排除。" -#: ../../library/exceptions.rst:955 +#: ../../library/exceptions.rst:974 msgid "" "The condition is checked for all exceptions in the nested exception group, " "including the top-level and any nested exception groups. If the condition is " @@ -1392,7 +1418,11 @@ msgstr "" "條件會對巢狀例外群組裡的所有例外做檢查,包括頂層及任何巢狀的例外群組。如果條" "件對這樣的例外群組為 true,它會被完整包含在結果裡。" -#: ../../library/exceptions.rst:961 +#: ../../library/exceptions.rst:978 +msgid "``condition`` can be any callable which is not a type object." +msgstr "" + +#: ../../library/exceptions.rst:983 msgid "" "Like :meth:`subgroup`, but returns the pair ``(match, rest)`` where " "``match`` is ``subgroup(condition)`` and ``rest`` is the remaining non-" @@ -1401,13 +1431,13 @@ msgstr "" "像 :meth:`subgroup` 一樣,但回傳一對 ``(match, rest)``,其中 ``match`` 是 " "``subgroup(condition)`` 而 ``rest`` 是剩下沒有比對到的部分。" -#: ../../library/exceptions.rst:967 +#: ../../library/exceptions.rst:989 msgid "" "Returns an exception group with the same :attr:`message`, but which wraps " "the exceptions in ``excs``." msgstr "回傳有相同 :attr:`message` 但將例外包裝在 ``excs`` 的例外群組。" -#: ../../library/exceptions.rst:970 +#: ../../library/exceptions.rst:992 msgid "" "This method is used by :meth:`subgroup` and :meth:`split`, which are used in " "various contexts to break up an exception group. A subclass needs to " @@ -1418,7 +1448,7 @@ msgstr "" "組。子類別需要覆寫它來讓 :meth:`subgroup` 及 :meth:`split` 回傳子類別而不是 :" "exc:`ExceptionGroup` 的實例。" -#: ../../library/exceptions.rst:976 +#: ../../library/exceptions.rst:998 msgid "" ":meth:`subgroup` and :meth:`split` copy the :attr:`~BaseException." "__traceback__`, :attr:`~BaseException.__cause__`, :attr:`~BaseException." @@ -1431,7 +1461,7 @@ msgstr "" "`~BaseException.__context__` 和 :attr:`~BaseException.__notes__` 欄位到 :" "meth:`derive` 所回傳的例外群組上,因此這些欄位不需要被 :meth:`derive` 更新。" -#: ../../library/exceptions.rst:983 +#: ../../library/exceptions.rst:1005 msgid "" ">>> class MyGroup(ExceptionGroup):\n" "... def derive(self, excs):\n" @@ -1485,7 +1515,7 @@ msgstr "" ">>> exc.__traceback__ is match.__traceback__ is rest.__traceback__\n" "True" -#: ../../library/exceptions.rst:1009 +#: ../../library/exceptions.rst:1031 msgid "" "Note that :exc:`BaseExceptionGroup` defines :meth:`~object.__new__`, so " "subclasses that need a different constructor signature need to override that " @@ -1497,7 +1527,7 @@ msgstr "" "建構函式簽名的子類別需要覆寫它而不是 :meth:`~object.__init__`。例如下面定義了" "一個例外群組子類別接受 exit_code 並從中建構群組的訊息。: ::" -#: ../../library/exceptions.rst:1015 +#: ../../library/exceptions.rst:1037 msgid "" "class Errors(ExceptionGroup):\n" " def __new__(cls, errors, exit_code):\n" @@ -1517,7 +1547,7 @@ msgstr "" " def derive(self, excs):\n" " return Errors(excs, self.exit_code)" -#: ../../library/exceptions.rst:1024 +#: ../../library/exceptions.rst:1046 msgid "" "Like :exc:`ExceptionGroup`, any subclass of :exc:`BaseExceptionGroup` which " "is also a subclass of :exc:`Exception` can only wrap instances of :exc:" @@ -1526,15 +1556,16 @@ msgstr "" "像 :exc:`ExceptionGroup` 一樣,任何 :exc:`BaseExceptionGroup` 的子類別且也" "是 :exc:`Exception` 的子類別只能包裝 :exc:`Exception` 的實例。" -#: ../../library/exceptions.rst:1032 +#: ../../library/exceptions.rst:1054 msgid "Exception hierarchy" msgstr "例外階層" -#: ../../library/exceptions.rst:1034 +#: ../../library/exceptions.rst:1056 msgid "The class hierarchy for built-in exceptions is:" msgstr "內建例外的類別階層如下:" -#: ../../library/exceptions.rst:1036 +#: ../../library/exceptions.rst:1058 +#, fuzzy msgid "" "BaseException\n" " ├── BaseExceptionGroup\n" @@ -1578,6 +1609,7 @@ msgid "" " ├── ReferenceError\n" " ├── RuntimeError\n" " │ ├── NotImplementedError\n" +" │ ├── PythonFinalizationError\n" " │ └── RecursionError\n" " ├── StopAsyncIteration\n" " ├── StopIteration\n" @@ -1720,3 +1752,13 @@ msgstr "module(模組)" #: ../../library/exceptions.rst:345 msgid "errno" msgstr "errno" + +#~ msgid "" +#~ "The condition can be either a function that accepts an exception and " +#~ "returns true for those that should be in the subgroup, or it can be an " +#~ "exception type or a tuple of exception types, which is used to check for " +#~ "a match using the same check that is used in an ``except`` clause." +#~ msgstr "" +#~ "條件可以是一個函式,接受一個例外並對那些應該要在子群組裡的例外回傳 true," +#~ "或者可以是一個例外類型或例外類型的元組,並使用與 ``except`` 子句所使用的相" +#~ "同檢查來檢查是否有比對到。" diff --git a/library/faulthandler.po b/library/faulthandler.po index 290364ae87..202d723b3c 100644 --- a/library/faulthandler.po +++ b/library/faulthandler.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/fcntl.po b/library/fcntl.po index 38455cb763..4a43c0463f 100644 --- a/library/fcntl.po +++ b/library/fcntl.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,7 +31,8 @@ msgid "" msgstr "" #: ../../library/fcntl.rst:21 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#, fuzzy +msgid ":ref:`Availability `: Unix, not WASI." msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" #: ../../library/fcntl.rst:23 @@ -51,29 +52,30 @@ msgstr "" #: ../../library/fcntl.rst:33 msgid "" -"The fcntl module now contains ``F_ADD_SEALS``, ``F_GET_SEALS``, and " +"The :mod:`!fcntl` module now contains ``F_ADD_SEALS``, ``F_GET_SEALS``, and " "``F_SEAL_*`` constants for sealing of :func:`os.memfd_create` file " "descriptors." msgstr "" #: ../../library/fcntl.rst:38 msgid "" -"On macOS, the fcntl module exposes the ``F_GETPATH`` constant, which obtains " -"the path of a file from a file descriptor. On Linux(>=3.15), the fcntl " -"module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK`` and ``F_OFD_SETLKW`` " -"constants, which are used when working with open file description locks." +"On macOS, the :mod:`!fcntl` module exposes the ``F_GETPATH`` constant, which " +"obtains the path of a file from a file descriptor. On Linux(>=3.15), the :" +"mod:`!fcntl` module exposes the ``F_OFD_GETLK``, ``F_OFD_SETLK`` and " +"``F_OFD_SETLKW`` constants, which are used when working with open file " +"description locks." msgstr "" #: ../../library/fcntl.rst:45 msgid "" -"On Linux >= 2.6.11, the fcntl module exposes the ``F_GETPIPE_SZ`` and " -"``F_SETPIPE_SZ`` constants, which allow to check and modify a pipe's size " -"respectively." +"On Linux >= 2.6.11, the :mod:`!fcntl` module exposes the ``F_GETPIPE_SZ`` " +"and ``F_SETPIPE_SZ`` constants, which allow to check and modify a pipe's " +"size respectively." msgstr "" #: ../../library/fcntl.rst:50 msgid "" -"On FreeBSD, the fcntl module exposes the ``F_DUP2FD`` and " +"On FreeBSD, the :mod:`!fcntl` module exposes the ``F_DUP2FD`` and " "``F_DUP2FD_CLOEXEC`` constants, which allow to duplicate a file descriptor, " "the latter setting ``FD_CLOEXEC`` flag in addition." msgstr "" @@ -87,10 +89,31 @@ msgid "" msgstr "" #: ../../library/fcntl.rst:61 +msgid "" +"On Linux >= 2.6.32, the :mod:`!fcntl` module exposes the ``F_GETOWN_EX``, " +"``F_SETOWN_EX``, ``F_OWNER_TID``, ``F_OWNER_PID``, ``F_OWNER_PGRP`` " +"constants, which allow to direct I/O availability signals to a specific " +"thread, process, or process group. On Linux >= 4.13, the :mod:`!fcntl` " +"module exposes the ``F_GET_RW_HINT``, ``F_SET_RW_HINT``, " +"``F_GET_FILE_RW_HINT``, ``F_SET_FILE_RW_HINT``, and ``RWH_WRITE_LIFE_*`` " +"constants, which allow to inform the kernel about the relative expected " +"lifetime of writes on a given inode or via a particular open file " +"description. On Linux >= 5.1 and NetBSD, the :mod:`!fcntl` module exposes " +"the ``F_SEAL_FUTURE_WRITE`` constant for use with ``F_ADD_SEALS`` and " +"``F_GET_SEALS`` operations. On FreeBSD, the :mod:`!fcntl` module exposes the " +"``F_READAHEAD``, ``F_ISUNIONSTACK``, and ``F_KINFO`` constants. On macOS and " +"FreeBSD, the :mod:`!fcntl` module exposes the ``F_RDAHEAD`` constant. On " +"NetBSD and AIX, the :mod:`!fcntl` module exposes the ``F_CLOSEM`` constant. " +"On NetBSD, the :mod:`!fcntl` module exposes the ``F_MAXFD`` constant. On " +"macOS and NetBSD, the :mod:`!fcntl` module exposes the ``F_GETNOSIGPIPE`` " +"and ``F_SETNOSIGPIPE`` constant." +msgstr "" + +#: ../../library/fcntl.rst:82 msgid "The module defines the following functions:" msgstr "" -#: ../../library/fcntl.rst:66 +#: ../../library/fcntl.rst:87 msgid "" "Perform the operation *cmd* on file descriptor *fd* (file objects providing " "a :meth:`~io.IOBase.fileno` method are accepted as well). The values used " @@ -109,11 +132,11 @@ msgid "" "result in a segmentation violation or a more subtle data corruption." msgstr "" -#: ../../library/fcntl.rst:83 +#: ../../library/fcntl.rst:104 msgid "If the :c:func:`fcntl` call fails, an :exc:`OSError` is raised." msgstr "" -#: ../../library/fcntl.rst:85 +#: ../../library/fcntl.rst:106 msgid "" "Raises an :ref:`auditing event ` ``fcntl.fcntl`` with arguments " "``fd``, ``cmd``, ``arg``." @@ -121,13 +144,13 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``arg`` 的\\ :ref:`稽核事件 ` " "``fcntl.fcntl``。" -#: ../../library/fcntl.rst:90 +#: ../../library/fcntl.rst:111 msgid "" "This function is identical to the :func:`~fcntl.fcntl` function, except that " "the argument handling is even more complicated." msgstr "" -#: ../../library/fcntl.rst:93 +#: ../../library/fcntl.rst:114 msgid "" "The *request* parameter is limited to values that can fit in 32-bits. " "Additional constants of interest for use as the *request* argument can be " @@ -135,26 +158,26 @@ msgid "" "relevant C header files." msgstr "" -#: ../../library/fcntl.rst:98 +#: ../../library/fcntl.rst:119 msgid "" "The parameter *arg* can be one of an integer, an object supporting the read-" "only buffer interface (like :class:`bytes`) or an object supporting the read-" "write buffer interface (like :class:`bytearray`)." msgstr "" -#: ../../library/fcntl.rst:102 +#: ../../library/fcntl.rst:123 msgid "" "In all but the last case, behaviour is as for the :func:`~fcntl.fcntl` " "function." msgstr "" -#: ../../library/fcntl.rst:105 +#: ../../library/fcntl.rst:126 msgid "" "If a mutable buffer is passed, then the behaviour is determined by the value " "of the *mutate_flag* parameter." msgstr "" -#: ../../library/fcntl.rst:108 +#: ../../library/fcntl.rst:129 msgid "" "If it is false, the buffer's mutability is ignored and behaviour is as for a " "read-only buffer, except that the 1024 byte limit mentioned above is avoided " @@ -162,7 +185,7 @@ msgid "" "system wants to put there, things should work." msgstr "" -#: ../../library/fcntl.rst:113 +#: ../../library/fcntl.rst:134 msgid "" "If *mutate_flag* is true (the default), then the buffer is (in effect) " "passed to the underlying :func:`ioctl` system call, the latter's return code " @@ -173,16 +196,16 @@ msgid "" "copied back into the supplied buffer." msgstr "" -#: ../../library/fcntl.rst:121 +#: ../../library/fcntl.rst:142 msgid "" "If the :c:func:`ioctl` call fails, an :exc:`OSError` exception is raised." msgstr "" -#: ../../library/fcntl.rst:123 +#: ../../library/fcntl.rst:144 msgid "An example::" msgstr "範例: ::" -#: ../../library/fcntl.rst:125 +#: ../../library/fcntl.rst:146 msgid "" ">>> import array, fcntl, struct, termios, os\n" ">>> os.getpgrp()\n" @@ -206,7 +229,7 @@ msgstr "" ">>> buf\n" "array('h', [13341])" -#: ../../library/fcntl.rst:136 +#: ../../library/fcntl.rst:157 msgid "" "Raises an :ref:`auditing event ` ``fcntl.ioctl`` with arguments " "``fd``, ``request``, ``arg``." @@ -214,7 +237,7 @@ msgstr "" "引發一個附帶引數 ``fd``、``request``、``arg`` 的\\ :ref:`稽核事件 " "` ``fcntl.ioctl``。" -#: ../../library/fcntl.rst:141 +#: ../../library/fcntl.rst:162 msgid "" "Perform the lock operation *operation* on file descriptor *fd* (file objects " "providing a :meth:`~io.IOBase.fileno` method are accepted as well). See the " @@ -222,12 +245,12 @@ msgid "" "function is emulated using :c:func:`fcntl`.)" msgstr "" -#: ../../library/fcntl.rst:146 +#: ../../library/fcntl.rst:167 msgid "" "If the :c:func:`flock` call fails, an :exc:`OSError` exception is raised." msgstr "" -#: ../../library/fcntl.rst:148 +#: ../../library/fcntl.rst:169 msgid "" "Raises an :ref:`auditing event ` ``fcntl.flock`` with arguments " "``fd``, ``operation``." @@ -235,7 +258,7 @@ msgstr "" "引發一個附帶引數 ``fd``、``operation`` 的\\ :ref:`稽核事件 ` " "``fcntl.flock``。" -#: ../../library/fcntl.rst:153 +#: ../../library/fcntl.rst:174 msgid "" "This is essentially a wrapper around the :func:`~fcntl.fcntl` locking calls. " "*fd* is the file descriptor (file objects providing a :meth:`~io.IOBase." @@ -243,25 +266,25 @@ msgid "" "*cmd* is one of the following values:" msgstr "" -#: ../../library/fcntl.rst:160 +#: ../../library/fcntl.rst:181 msgid "Release an existing lock." msgstr "" -#: ../../library/fcntl.rst:164 +#: ../../library/fcntl.rst:185 msgid "Acquire a shared lock." msgstr "" -#: ../../library/fcntl.rst:168 +#: ../../library/fcntl.rst:189 msgid "Acquire an exclusive lock." msgstr "" -#: ../../library/fcntl.rst:172 +#: ../../library/fcntl.rst:193 msgid "" "Bitwise OR with any of the other three ``LOCK_*`` constants to make the " "request non-blocking." msgstr "" -#: ../../library/fcntl.rst:175 +#: ../../library/fcntl.rst:196 msgid "" "If :const:`!LOCK_NB` is used and the lock cannot be acquired, an :exc:" "`OSError` will be raised and the exception will have an *errno* attribute " @@ -271,33 +294,33 @@ msgid "" "a file opened for writing." msgstr "" -#: ../../library/fcntl.rst:182 +#: ../../library/fcntl.rst:203 msgid "" "*len* is the number of bytes to lock, *start* is the byte offset at which " "the lock starts, relative to *whence*, and *whence* is as with :func:`io." "IOBase.seek`, specifically:" msgstr "" -#: ../../library/fcntl.rst:186 +#: ../../library/fcntl.rst:207 msgid "``0`` -- relative to the start of the file (:const:`os.SEEK_SET`)" msgstr "" -#: ../../library/fcntl.rst:187 +#: ../../library/fcntl.rst:208 msgid "``1`` -- relative to the current buffer position (:const:`os.SEEK_CUR`)" msgstr "" -#: ../../library/fcntl.rst:188 +#: ../../library/fcntl.rst:209 msgid "``2`` -- relative to the end of the file (:const:`os.SEEK_END`)" msgstr "" -#: ../../library/fcntl.rst:190 +#: ../../library/fcntl.rst:211 msgid "" "The default for *start* is 0, which means to start at the beginning of the " "file. The default for *len* is 0 which means to lock to the end of the " "file. The default for *whence* is also 0." msgstr "" -#: ../../library/fcntl.rst:194 +#: ../../library/fcntl.rst:215 msgid "" "Raises an :ref:`auditing event ` ``fcntl.lockf`` with arguments " "``fd``, ``cmd``, ``len``, ``start``, ``whence``." @@ -305,11 +328,11 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``len``、``start``、``whence`` 的\\ :ref:`" "稽核事件 ` ``fcntl.lockf``。" -#: ../../library/fcntl.rst:196 +#: ../../library/fcntl.rst:217 msgid "Examples (all on a SVR4 compliant system)::" msgstr "" -#: ../../library/fcntl.rst:198 +#: ../../library/fcntl.rst:219 msgid "" "import struct, fcntl, os\n" "\n" @@ -327,7 +350,7 @@ msgstr "" "lockdata = struct.pack('hhllhh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)\n" "rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata)" -#: ../../library/fcntl.rst:206 +#: ../../library/fcntl.rst:227 msgid "" "Note that in the first example the return value variable *rv* will hold an " "integer value; in the second example it will hold a :class:`bytes` object. " @@ -335,11 +358,11 @@ msgid "" "therefore using the :func:`flock` call may be better." msgstr "" -#: ../../library/fcntl.rst:214 +#: ../../library/fcntl.rst:235 msgid "Module :mod:`os`" msgstr ":mod:`os` 模組" -#: ../../library/fcntl.rst:215 +#: ../../library/fcntl.rst:236 msgid "" "If the locking flags :const:`~os.O_SHLOCK` and :const:`~os.O_EXLOCK` are " "present in the :mod:`os` module (on BSD only), the :func:`os.open` function " diff --git a/library/filecmp.po b/library/filecmp.po index 4d635d6e80..ca8839f45d 100644 --- a/library/filecmp.po +++ b/library/filecmp.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -120,124 +120,128 @@ msgstr "" #: ../../library/filecmp.rst:80 msgid "" "The :class:`dircmp` class compares files by doing *shallow* comparisons as " -"described for :func:`filecmp.cmp`." +"described for :func:`filecmp.cmp` by default using the *shallow* parameter." msgstr "" -#: ../../library/filecmp.rst:83 +#: ../../library/filecmp.rst:86 +msgid "Added the *shallow* parameter." +msgstr "" + +#: ../../library/filecmp.rst:88 msgid "The :class:`dircmp` class provides the following methods:" msgstr "" -#: ../../library/filecmp.rst:87 +#: ../../library/filecmp.rst:92 msgid "Print (to :data:`sys.stdout`) a comparison between *a* and *b*." msgstr "" -#: ../../library/filecmp.rst:91 +#: ../../library/filecmp.rst:96 msgid "" "Print a comparison between *a* and *b* and common immediate subdirectories." msgstr "" -#: ../../library/filecmp.rst:96 +#: ../../library/filecmp.rst:101 msgid "" "Print a comparison between *a* and *b* and common subdirectories " "(recursively)." msgstr "" -#: ../../library/filecmp.rst:99 +#: ../../library/filecmp.rst:104 msgid "" "The :class:`dircmp` class offers a number of interesting attributes that may " "be used to get various bits of information about the directory trees being " "compared." msgstr "" -#: ../../library/filecmp.rst:103 +#: ../../library/filecmp.rst:108 msgid "" "Note that via :meth:`~object.__getattr__` hooks, all attributes are computed " "lazily, so there is no speed penalty if only those attributes which are " "lightweight to compute are used." msgstr "" -#: ../../library/filecmp.rst:110 +#: ../../library/filecmp.rst:115 msgid "The directory *a*." msgstr "" -#: ../../library/filecmp.rst:115 +#: ../../library/filecmp.rst:120 msgid "The directory *b*." msgstr "" -#: ../../library/filecmp.rst:120 +#: ../../library/filecmp.rst:125 msgid "Files and subdirectories in *a*, filtered by *hide* and *ignore*." msgstr "" -#: ../../library/filecmp.rst:125 +#: ../../library/filecmp.rst:130 msgid "Files and subdirectories in *b*, filtered by *hide* and *ignore*." msgstr "" -#: ../../library/filecmp.rst:130 +#: ../../library/filecmp.rst:135 msgid "Files and subdirectories in both *a* and *b*." msgstr "" -#: ../../library/filecmp.rst:135 +#: ../../library/filecmp.rst:140 msgid "Files and subdirectories only in *a*." msgstr "" -#: ../../library/filecmp.rst:140 +#: ../../library/filecmp.rst:145 msgid "Files and subdirectories only in *b*." msgstr "" -#: ../../library/filecmp.rst:145 +#: ../../library/filecmp.rst:150 msgid "Subdirectories in both *a* and *b*." msgstr "" -#: ../../library/filecmp.rst:150 +#: ../../library/filecmp.rst:155 msgid "Files in both *a* and *b*." msgstr "" -#: ../../library/filecmp.rst:155 +#: ../../library/filecmp.rst:160 msgid "" "Names in both *a* and *b*, such that the type differs between the " "directories, or names for which :func:`os.stat` reports an error." msgstr "" -#: ../../library/filecmp.rst:161 +#: ../../library/filecmp.rst:166 msgid "" "Files which are identical in both *a* and *b*, using the class's file " "comparison operator." msgstr "" -#: ../../library/filecmp.rst:167 +#: ../../library/filecmp.rst:172 msgid "" "Files which are in both *a* and *b*, whose contents differ according to the " "class's file comparison operator." msgstr "" -#: ../../library/filecmp.rst:173 +#: ../../library/filecmp.rst:178 msgid "Files which are in both *a* and *b*, but could not be compared." msgstr "" -#: ../../library/filecmp.rst:178 +#: ../../library/filecmp.rst:183 msgid "" "A dictionary mapping names in :attr:`common_dirs` to :class:`dircmp` " "instances (or MyDirCmp instances if this instance is of type MyDirCmp, a " "subclass of :class:`dircmp`)." msgstr "" -#: ../../library/filecmp.rst:182 +#: ../../library/filecmp.rst:187 msgid "" "Previously entries were always :class:`dircmp` instances. Now entries are " "the same type as *self*, if *self* is a subclass of :class:`dircmp`." msgstr "" -#: ../../library/filecmp.rst:191 +#: ../../library/filecmp.rst:196 msgid "List of directories ignored by :class:`dircmp` by default." msgstr "" -#: ../../library/filecmp.rst:194 +#: ../../library/filecmp.rst:199 msgid "" "Here is a simplified example of using the ``subdirs`` attribute to search " "recursively through two directories to show common different files::" msgstr "" -#: ../../library/filecmp.rst:197 +#: ../../library/filecmp.rst:202 msgid "" ">>> from filecmp import dircmp\n" ">>> def print_diff_files(dcmp):\n" diff --git a/library/fileformats.po b/library/fileformats.po index 567de48562..3168a73efa 100644 --- a/library/fileformats.po +++ b/library/fileformats.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/library/fileinput.po b/library/fileinput.po index c54fab2cc5..92b59172fd 100644 --- a/library/fileinput.po +++ b/library/fileinput.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:01+0000\n" diff --git a/library/filesys.po b/library/filesys.po index e682fe6090..039d7bf996 100644 --- a/library/filesys.po +++ b/library/filesys.po @@ -7,7 +7,7 @@ # Allen Wu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-04-18 00:04+0000\n" "PO-Revision-Date: 2021-11-22 20:13+0800\n" diff --git a/library/fnmatch.po b/library/fnmatch.po index 3f51f72882..345fd99a0a 100644 --- a/library/fnmatch.po +++ b/library/fnmatch.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" diff --git a/library/fractions.po b/library/fractions.po index 82a4c8225e..0bed2f807a 100644 --- a/library/fractions.po +++ b/library/fractions.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2016-01-31 07:18+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -168,73 +168,79 @@ msgid "" "``\"G\"`` and ``\"%\"\"``." msgstr "" -#: ../../library/fractions.rst:111 -msgid "Numerator of the Fraction in lowest term." +#: ../../library/fractions.rst:109 +msgid "" +"Formatting of :class:`Fraction` instances without a presentation type now " +"supports fill, alignment, sign handling, minimum width and grouping." msgstr "" #: ../../library/fractions.rst:115 +msgid "Numerator of the Fraction in lowest term." +msgstr "" + +#: ../../library/fractions.rst:119 msgid "Denominator of the Fraction in lowest term." msgstr "" -#: ../../library/fractions.rst:120 +#: ../../library/fractions.rst:124 msgid "" "Return a tuple of two integers, whose ratio is equal to the original " "Fraction. The ratio is in lowest terms and has a positive denominator." msgstr "" -#: ../../library/fractions.rst:128 +#: ../../library/fractions.rst:132 msgid "Return ``True`` if the Fraction is an integer." msgstr "" -#: ../../library/fractions.rst:134 +#: ../../library/fractions.rst:138 msgid "" "Alternative constructor which only accepts instances of :class:`float` or :" "class:`numbers.Integral`. Beware that ``Fraction.from_float(0.3)`` is not " "the same value as ``Fraction(3, 10)``." msgstr "" -#: ../../library/fractions.rst:140 +#: ../../library/fractions.rst:144 msgid "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`float`." msgstr "" -#: ../../library/fractions.rst:146 +#: ../../library/fractions.rst:150 msgid "" "Alternative constructor which only accepts instances of :class:`decimal." "Decimal` or :class:`numbers.Integral`." msgstr "" -#: ../../library/fractions.rst:151 +#: ../../library/fractions.rst:155 msgid "" "From Python 3.2 onwards, you can also construct a :class:`Fraction` instance " "directly from a :class:`decimal.Decimal` instance." msgstr "" -#: ../../library/fractions.rst:158 +#: ../../library/fractions.rst:162 msgid "" "Finds and returns the closest :class:`Fraction` to ``self`` that has " "denominator at most max_denominator. This method is useful for finding " "rational approximations to a given floating-point number:" msgstr "" -#: ../../library/fractions.rst:166 +#: ../../library/fractions.rst:170 msgid "or for recovering a rational number that's represented as a float:" msgstr "" -#: ../../library/fractions.rst:179 +#: ../../library/fractions.rst:183 msgid "" "Returns the greatest :class:`int` ``<= self``. This method can also be " "accessed through the :func:`math.floor` function:" msgstr "" -#: ../../library/fractions.rst:189 +#: ../../library/fractions.rst:193 msgid "" "Returns the least :class:`int` ``>= self``. This method can also be " "accessed through the :func:`math.ceil` function." msgstr "" -#: ../../library/fractions.rst:196 +#: ../../library/fractions.rst:200 msgid "" "The first version returns the nearest :class:`int` to ``self``, rounding " "half to even. The second version rounds ``self`` to the nearest multiple of " @@ -243,24 +249,49 @@ msgid "" "func:`round` function." msgstr "" -#: ../../library/fractions.rst:204 +#: ../../library/fractions.rst:208 msgid "" -"Provides support for float-style formatting of :class:`Fraction` instances " -"via the :meth:`str.format` method, the :func:`format` built-in function, or :" -"ref:`Formatted string literals `. The presentation types " -"``\"e\"``, ``\"E\"``, ``\"f\"``, ``\"F\"``, ``\"g\"``, ``\"G\"`` and ``\"%" -"\"`` are supported. For these presentation types, formatting for a :class:" -"`Fraction` object ``x`` follows the rules outlined for the :class:`float` " -"type in the :ref:`formatspec` section." +"Provides support for formatting of :class:`Fraction` instances via the :meth:" +"`str.format` method, the :func:`format` built-in function, or :ref:" +"`Formatted string literals `." msgstr "" #: ../../library/fractions.rst:212 +msgid "" +"If the ``format_spec`` format specification string does not end with one of " +"the presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` " +"or ``'%'`` then formatting follows the general rules for fill, alignment, " +"sign handling, minimum width, and grouping as described in the :ref:`format " +"specification mini-language `. The \"alternate form\" flag " +"``'#'`` is supported: if present, it forces the output string to always " +"include an explicit denominator, even when the value being formatted is an " +"exact integer. The zero-fill flag ``'0'`` is not supported." +msgstr "" + +#: ../../library/fractions.rst:222 +msgid "" +"If the ``format_spec`` format specification string ends with one of the " +"presentation types ``'e'``, ``'E'``, ``'f'``, ``'F'``, ``'g'``, ``'G'`` or " +"``'%'`` then formatting follows the rules outlined for the :class:`float` " +"type in the :ref:`formatspec` section." +msgstr "" + +#: ../../library/fractions.rst:227 msgid "Here are some examples::" msgstr "" -#: ../../library/fractions.rst:214 +#: ../../library/fractions.rst:229 +#, fuzzy msgid "" ">>> from fractions import Fraction\n" +">>> format(Fraction(103993, 33102), '_')\n" +"'103_993/33_102'\n" +">>> format(Fraction(1, 7), '.^+10')\n" +"'...+1/7...'\n" +">>> format(Fraction(3, 1), '')\n" +"'3'\n" +">>> format(Fraction(3, 1), '#')\n" +"'3/1'\n" ">>> format(Fraction(1, 7), '.40g')\n" "'0.1428571428571428571428571428571428571429'\n" ">>> format(Fraction('1234567.855'), '_.2f')\n" @@ -282,10 +313,10 @@ msgstr "" ">>> \"{:.2%} price increase\".format(Fraction(new_price, old_price) - 1)\n" "'34.67% price increase'" -#: ../../library/fractions.rst:228 +#: ../../library/fractions.rst:251 msgid "Module :mod:`numbers`" msgstr ":mod:`numbers` 模組" -#: ../../library/fractions.rst:229 +#: ../../library/fractions.rst:252 msgid "The abstract base classes making up the numeric tower." msgstr "" diff --git a/library/frameworks.po b/library/frameworks.po index 7fd9ab13c2..5dce9895aa 100644 --- a/library/frameworks.po +++ b/library/frameworks.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/library/ftplib.po b/library/ftplib.po index 3042e7310a..5f1ac72eb1 100644 --- a/library/ftplib.po +++ b/library/ftplib.po @@ -5,9 +5,9 @@ # Matt Wang , 2023-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-04-26 19:44+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -46,17 +46,16 @@ msgid "The default encoding is UTF-8, following :rfc:`2640`." msgstr "預設編碼是 UTF-8,遵循 :rfc:`2640`。" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr ":ref:`Availability `:非 Emscripten、非 WASI。" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`Availability `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上不起作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/ftplib.rst:26 msgid "Here's a sample session using the :mod:`ftplib` module::" diff --git a/library/functional.po b/library/functional.po index 9c3ef0e55d..d8cea9f862 100644 --- a/library/functional.po +++ b/library/functional.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" diff --git a/library/functions.po b/library/functions.po index 94c87764ac..0703f10a5b 100644 --- a/library/functions.po +++ b/library/functions.po @@ -8,9 +8,9 @@ # Steven Hsu , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-05-06 17:06+0800\n" "Last-Translator: KNChiu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -514,13 +514,12 @@ msgid "" "ways." msgstr "如果不一定需要 \"0b\" 前綴,還可以使用如下的方法。" -#: ../../library/functions.rst:141 ../../library/functions.rst:909 -#: ../../library/functions.rst:1246 +#: ../../library/functions.rst:141 ../../library/functions.rst:931 +#: ../../library/functions.rst:1311 msgid "See also :func:`format` for more information." msgstr "可參考 :func:`format` 獲取更多資訊。" #: ../../library/functions.rst:146 -#, fuzzy msgid "" "Return a Boolean value, i.e. one of ``True`` or ``False``. The argument is " "converted using the standard :ref:`truth testing procedure `. If the " @@ -529,13 +528,13 @@ msgid "" "`typesnumeric`). It cannot be subclassed further. Its only instances are " "``False`` and ``True`` (see :ref:`typebool`)." msgstr "" -"回傳一個布林值,即 ``True`` 或者 ``False``。*x* 使用標準的\\ :ref:`真值測試程" -"序 `\\ 來轉換。如果 *x* 為假或者被省略,則回傳 ``False``;其他情況回" +"回傳一個布林值,即 ``True`` 或者 ``False``。引數會使用標準的\\ :ref:`真值測試" +"程序 `\\ 來轉換。如果引數為假或者被省略,則回傳 ``False``;其他情況回" "傳 ``True``。:class:`bool` class(類別)是 :class:`int` 的 subclass(子類別)" "(參見 :ref:`typesnumeric`),其他 class 不能繼承自它。它只有 ``False`` 和 " "``True`` 兩個實例(參見 :ref:`typebool`)。" -#: ../../library/functions.rst:156 ../../library/functions.rst:774 +#: ../../library/functions.rst:156 ../../library/functions.rst:796 msgid "The parameter is now positional-only." msgstr "現在為僅限位置參數。" @@ -764,15 +763,17 @@ msgstr "" #: ../../library/functions.rst:285 msgid "" -"Class methods now inherit the method attributes (``__module__``, " -"``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``) and " -"have a new ``__wrapped__`` attribute." +"Class methods now inherit the method attributes (:attr:`~function." +"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" +"attr:`~function.__doc__` and :attr:`~function.__annotations__`) and have a " +"new ``__wrapped__`` attribute." msgstr "" -"Class method 現在繼承了 method 屬性(``__module__``、``__name__``、" -"``__qualname__``、``__doc__`` 和 ``__annotations__``),並擁有一個新的 " +"Class method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" +"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." +"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " "``__wrapped__`` 屬性。" -#: ../../library/functions.rst:290 +#: ../../library/functions.rst:292 msgid "" "Class methods can no longer wrap other :term:`descriptors ` such " "as :func:`property`." @@ -780,7 +781,7 @@ msgstr "" "Class methods 不能再包裝其他的\\ :term:`描述器 `,例如 :func:" "`property`。" -#: ../../library/functions.rst:297 +#: ../../library/functions.rst:299 msgid "" "Compile the *source* into a code or AST object. Code objects can be " "executed by :func:`exec` or :func:`eval`. *source* can either be a normal " @@ -791,7 +792,7 @@ msgstr "" "`eval` 執行。*source* 可以是一般的字串、bytes 字串、或者 AST 物件。參見 :mod:" "`ast` module(模組)的說明文件瞭解如何使用 AST 物件。" -#: ../../library/functions.rst:302 +#: ../../library/functions.rst:304 msgid "" "The *filename* argument should give the file from which the code was read; " "pass some recognizable value if it wasn't read from a file (``''`` " @@ -800,7 +801,7 @@ msgstr "" "*filename* 引數必須是程式碼的檔名;如果程式碼不是從檔案中讀取,可以傳入一些可" "辨識的值(經常會使用 ``''`` 來替代)。" -#: ../../library/functions.rst:306 +#: ../../library/functions.rst:308 msgid "" "The *mode* argument specifies what kind of code must be compiled; it can be " "``'exec'`` if *source* consists of a sequence of statements, ``'eval'`` if " @@ -813,7 +814,7 @@ msgstr "" "式,可以是 ``'single'``\\ (在最後一種情況下,如果運算式執行結果不是 " "``None`` 則會被印出來)。" -#: ../../library/functions.rst:312 +#: ../../library/functions.rst:314 msgid "" "The optional arguments *flags* and *dont_inherit* control which :ref:" "`compiler options ` should be activated and which :ref:" @@ -833,7 +834,7 @@ msgstr "" "引數所指定的編譯器選項和未來陳述式。如果 *dont_inherit* 是一個非零整數,則使" "用 *flags* 引數 -- 周圍程式碼中的旗標(未來功能和編譯器選項)將被忽略。" -#: ../../library/functions.rst:323 +#: ../../library/functions.rst:325 msgid "" "Compiler options and future statements are specified by bits which can be " "bitwise ORed together to specify multiple options. The bitfield required to " @@ -848,7 +849,7 @@ msgstr "" "compiler_flag` 屬性來獲得。:ref:`編譯器旗標 `\\ 可以在 :" "mod:`ast` module 中搜尋有 ``PyCF_`` 前綴的名稱。" -#: ../../library/functions.rst:331 +#: ../../library/functions.rst:333 msgid "" "The argument *optimize* specifies the optimization level of the compiler; " "the default value of ``-1`` selects the optimization level of the " @@ -861,7 +862,7 @@ msgstr "" "``__debug__`` 為真值)、``1``\\ (assert 被刪除,``__debug__`` 為假值)或 " "``2``\\ (說明字串 (docstring) 也被刪除)。" -#: ../../library/functions.rst:337 +#: ../../library/functions.rst:339 msgid "" "This function raises :exc:`SyntaxError` if the compiled source is invalid, " "and :exc:`ValueError` if the source contains null bytes." @@ -869,13 +870,13 @@ msgstr "" "如果編譯的原始碼無效,此函式會引發 :exc:`SyntaxError`,如果原始碼包含 null " "bytes,則會引發 :exc:`ValueError`。" -#: ../../library/functions.rst:340 +#: ../../library/functions.rst:342 msgid "" "If you want to parse Python code into its AST representation, see :func:`ast." "parse`." msgstr "如果你想解析 Python 程式碼為 AST 運算式,請參閱 :func:`ast.parse`。" -#: ../../library/functions.rst:343 ../../library/functions.rst:345 +#: ../../library/functions.rst:345 ../../library/functions.rst:347 msgid "" "Raises an :ref:`auditing event ` ``compile`` with arguments " "``source`` and ``filename``. This event may also be raised by implicit " @@ -884,7 +885,7 @@ msgstr "" "引發一個附帶引數 ``source``、``filename`` 的\\ :ref:`稽核事件 ` " "``compile``。此事件也可能由隱式編譯 (implicit compilation) 所引發。" -#: ../../library/functions.rst:351 +#: ../../library/functions.rst:353 msgid "" "When compiling a string with multi-line code in ``'single'`` or ``'eval'`` " "mode, input must be terminated by at least one newline character. This is " @@ -894,7 +895,7 @@ msgstr "" "在 ``'single'`` 或 ``'eval'`` 模式編譯多行程式碼時,輸入必須以至少一個換行符" "結尾。這使 :mod:`code` module 更容易檢測陳述式的完整性。" -#: ../../library/functions.rst:358 +#: ../../library/functions.rst:360 msgid "" "It is possible to crash the Python interpreter with a sufficiently large/" "complex string when compiling to an AST object due to stack depth " @@ -903,7 +904,7 @@ msgstr "" "如果編譯足夠大或者足夠複雜的字串成 AST 物件時,Python 直譯器會因為 Python " "AST 編譯器的 stack 深度限制而崩潰。" -#: ../../library/functions.rst:362 +#: ../../library/functions.rst:364 msgid "" "Allowed use of Windows and Mac newlines. Also, input in ``'exec'`` mode " "does not have to end in a newline anymore. Added the *optimize* parameter." @@ -911,13 +912,13 @@ msgstr "" "允許使用 Windows 和 Mac 的換行符號。此外,在 ``'exec'`` 模式不需要以換行符號" "結尾。增加了 *optimize* 參數。" -#: ../../library/functions.rst:366 +#: ../../library/functions.rst:368 msgid "" "Previously, :exc:`TypeError` was raised when null bytes were encountered in " "*source*." msgstr "在之前的版本,*source* 中包含 null bytes 會引發 :exc:`TypeError`。" -#: ../../library/functions.rst:370 +#: ../../library/functions.rst:372 msgid "" "``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable " "support for top-level ``await``, ``async for``, and ``async with``." @@ -925,18 +926,18 @@ msgstr "" "``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` 現在可以傳遞旗標以啟用對頂層 ``await``、" "``async for`` 和 ``async with`` 的支援。" -#: ../../library/functions.rst:379 +#: ../../library/functions.rst:381 msgid "" "Convert a single string or number to a complex number, or create a complex " "number from real and imaginary parts." msgstr "" -#: ../../library/functions.rst:382 ../../library/functions.rst:719 -#: ../../library/functions.rst:965 +#: ../../library/functions.rst:384 ../../library/functions.rst:741 +#: ../../library/functions.rst:987 msgid "Examples:" msgstr "例如: ::" -#: ../../library/functions.rst:384 +#: ../../library/functions.rst:386 msgid "" ">>> complex('+1.23')\n" "(1.23+0j)\n" @@ -972,7 +973,7 @@ msgstr "" ">>> complex(-1.23, 4.5)\n" "(-1.23+4.5j)" -#: ../../library/functions.rst:403 +#: ../../library/functions.rst:405 msgid "" "If the argument is a string, it must contain either a real part (in the same " "format as for :func:`float`) or an imaginary part (in the same format but " @@ -987,8 +988,7 @@ msgid "" "parentheses and leading and trailing whitespace characters are removed:" msgstr "" -#: ../../library/functions.rst:422 -#, fuzzy +#: ../../library/functions.rst:424 msgid "" "If the argument is a number, the constructor serves as a numeric conversion " "like :class:`int` and :class:`float`. For a general Python object ``x``, " @@ -997,12 +997,13 @@ msgid "" "If :meth:`!__float__` is not defined then it falls back to :meth:`~object." "__index__`." msgstr "" -"對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 ``x." +"如果引數是一個數字,則建構函式會像 :class:`int` 和 :class:`float` 一樣進行數" +"值轉換。對於一個普通的 Python 物件 ``x``,``complex(x)`` 會委派給 ``x." "__complex__()``。如果 :meth:`~object.__complex__` 未定義,則會回退 (fall " "back) 到 :meth:`~object.__float__`。如果 :meth:`!__float__` 未定義,則會再回" "退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:431 +#: ../../library/functions.rst:433 msgid "" "If two arguments are provided or keyword arguments are used, each argument " "may be any numeric type (including complex). If both arguments are real " @@ -1013,20 +1014,20 @@ msgid "" "number, only its real component is used in the above expressions." msgstr "" -#: ../../library/functions.rst:441 +#: ../../library/functions.rst:443 msgid "If all arguments are omitted, returns ``0j``." msgstr "" -#: ../../library/functions.rst:443 +#: ../../library/functions.rst:445 msgid "The complex type is described in :ref:`typesnumeric`." msgstr "複數型別在 :ref:`typesnumeric` 中有相關描述。" -#: ../../library/functions.rst:445 ../../library/functions.rst:771 -#: ../../library/functions.rst:1014 +#: ../../library/functions.rst:447 ../../library/functions.rst:793 +#: ../../library/functions.rst:1036 msgid "Grouping digits with underscores as in code literals is allowed." msgstr "可以使用底線將程式碼文字中的數字進行分組。" -#: ../../library/functions.rst:448 +#: ../../library/functions.rst:450 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__complex__` and :" "meth:`~object.__float__` are not defined." @@ -1034,7 +1035,7 @@ msgstr "" "如果 :meth:`~object.__complex__` 和 :meth:`~object.__float__` 未定義,則會回" "退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:455 +#: ../../library/functions.rst:457 msgid "" "This is a relative of :func:`setattr`. The arguments are an object and a " "string. The string must be the name of one of the object's attributes. The " @@ -1047,7 +1048,7 @@ msgstr "" "'foobar')`` 等價於 ``del x.foobar``。*name* 不必是個 Python 識別符 " "(identifier)(請見 :func:`setattr`)。" -#: ../../library/functions.rst:468 +#: ../../library/functions.rst:470 msgid "" "Create a new dictionary. The :class:`dict` object is the dictionary class. " "See :class:`dict` and :ref:`typesmapping` for documentation about this class." @@ -1055,7 +1056,7 @@ msgstr "" "建立一個新的 dictionary(字典)。:class:`dict` 物件是一個 dictionary class。" "參見 :class:`dict` 和 :ref:`typesmapping` 來瞭解這個 class。" -#: ../../library/functions.rst:471 +#: ../../library/functions.rst:473 msgid "" "For other containers see the built-in :class:`list`, :class:`set`, and :" "class:`tuple` classes, as well as the :mod:`collections` module." @@ -1063,7 +1064,7 @@ msgstr "" "其他容器型別,請參見內建的 :class:`list`、:class:`set` 和 :class:`tuple` " "class,以及 :mod:`collections` module。" -#: ../../library/functions.rst:478 +#: ../../library/functions.rst:480 msgid "" "Without arguments, return the list of names in the current local scope. " "With an argument, attempt to return a list of valid attributes for that " @@ -1072,7 +1073,7 @@ msgstr "" "如果沒有引數,則回傳當前區域作用域 (local scope) 中的名稱列表。如果有引數,它" "會嘗試回傳該物件的有效屬性列表。" -#: ../../library/functions.rst:481 +#: ../../library/functions.rst:483 msgid "" "If the object has a method named :meth:`~object.__dir__`, this method will " "be called and must return the list of attributes. This allows objects that " @@ -1085,7 +1086,7 @@ msgstr "" "或 :func:`~object.__getattribute__` 函式的物件能夠自定義 :func:`dir` 來報告它" "們的屬性。" -#: ../../library/functions.rst:488 +#: ../../library/functions.rst:490 msgid "" "If the object does not provide :meth:`~object.__dir__`, the function tries " "its best to gather information from the object's :attr:`~object.__dict__` " @@ -1097,7 +1098,7 @@ msgstr "" "`~object.__dict__` 屬性和型別物件收集資訊。結果列表並不總是完整的,如果物件有" "自定義 :func:`~object.__getattr__`,那結果可能不準確。" -#: ../../library/functions.rst:494 +#: ../../library/functions.rst:496 msgid "" "The default :func:`dir` mechanism behaves differently with different types " "of objects, as it attempts to produce the most relevant, rather than " @@ -1106,13 +1107,13 @@ msgstr "" "預設的 :func:`dir` 機制對不同型別的物件有不同行為,它會試圖回傳最相關而非最完" "整的資訊:" -#: ../../library/functions.rst:498 +#: ../../library/functions.rst:500 msgid "" "If the object is a module object, the list contains the names of the " "module's attributes." msgstr "如果物件是 module 物件,則列表包含 module 的屬性名稱。" -#: ../../library/functions.rst:501 +#: ../../library/functions.rst:503 msgid "" "If the object is a type or class object, the list contains the names of its " "attributes, and recursively of the attributes of its bases." @@ -1120,7 +1121,7 @@ msgstr "" "如果物件是型別或 class 物件,則列表包含它們的屬性名稱,並且遞迴查詢其基礎的所" "有屬性。" -#: ../../library/functions.rst:504 +#: ../../library/functions.rst:506 msgid "" "Otherwise, the list contains the object's attributes' names, the names of " "its class's attributes, and recursively of the attributes of its class's " @@ -1129,11 +1130,11 @@ msgstr "" "否則,包含物件的屬性名稱列表、它的 class 屬性名稱,並且遞迴查詢它的 class 的" "所有基礎 class 的屬性。" -#: ../../library/functions.rst:508 +#: ../../library/functions.rst:510 msgid "The resulting list is sorted alphabetically. For example:" msgstr "回傳的列表按字母表排序,例如:" -#: ../../library/functions.rst:528 +#: ../../library/functions.rst:530 msgid "" "Because :func:`dir` is supplied primarily as a convenience for use at an " "interactive prompt, it tries to supply an interesting set of names more than " @@ -1146,7 +1147,7 @@ msgstr "" "版本之間改變。例如,當引數是一個 class 時,metaclass 的屬性不包含在結果列表" "中。" -#: ../../library/functions.rst:538 +#: ../../library/functions.rst:540 msgid "" "Take two (non-complex) numbers as arguments and return a pair of numbers " "consisting of their quotient and remainder when using integer division. " @@ -1164,7 +1165,7 @@ msgstr "" "等,如果 ``a % b`` 非零,則它的符號和 *b* 一樣,且 ``0 <= abs(a % b) < " "abs(b)``。" -#: ../../library/functions.rst:550 +#: ../../library/functions.rst:552 msgid "" "Return an enumerate object. *iterable* must be a sequence, an :term:" "`iterator`, or some other object which supports iteration. The :meth:" @@ -1177,11 +1178,11 @@ msgstr "" "__next__` method 回傳一個 tuple(元組),裡面包含一個計數值(從 *start* 開" "始,預設為 0)和透過疊代 *iterable* 獲得的值。" -#: ../../library/functions.rst:562 +#: ../../library/functions.rst:564 msgid "Equivalent to::" msgstr "等價於: ::" -#: ../../library/functions.rst:564 +#: ../../library/functions.rst:566 msgid "" "def enumerate(iterable, start=0):\n" " n = start\n" @@ -1199,15 +1200,15 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/functions.rst:574 +#: ../../library/functions.rst:576 msgid "A Python expression." msgstr "" -#: ../../library/functions.rst:578 +#: ../../library/functions.rst:580 msgid "The global namespace (default: ``None``)." msgstr "" -#: ../../library/functions.rst:582 +#: ../../library/functions.rst:584 msgid "The local namespace (default: ``None``)." msgstr "" @@ -1215,7 +1216,7 @@ msgstr "" msgid "Returns" msgstr "" -#: ../../library/functions.rst:586 +#: ../../library/functions.rst:588 msgid "The result of the evaluated expression." msgstr "" @@ -1223,41 +1224,45 @@ msgstr "" msgid "raises" msgstr "引發" -#: ../../library/functions.rst:587 +#: ../../library/functions.rst:589 msgid "Syntax errors are reported as exceptions." msgstr "" -#: ../../library/functions.rst:589 +#: ../../library/functions.rst:591 msgid "" "The *expression* argument is parsed and evaluated as a Python expression " "(technically speaking, a condition list) using the *globals* and *locals* " -"dictionaries as global and local namespace. If the *globals* dictionary is " +"mappings as global and local namespace. If the *globals* dictionary is " "present and does not contain a value for the key ``__builtins__``, a " "reference to the dictionary of the built-in module :mod:`builtins` is " "inserted under that key before *expression* is parsed. That way you can " "control what builtins are available to the executed code by inserting your " "own ``__builtins__`` dictionary into *globals* before passing it to :func:" -"`eval`. If the *locals* dictionary is omitted it defaults to the *globals* " -"dictionary. If both dictionaries are omitted, the expression is executed " -"with the *globals* and *locals* in the environment where :func:`eval` is " -"called. Note, *eval()* does not have access to the :term:`nested scopes " -"` (non-locals) in the enclosing environment." +"`eval`. If the *locals* mapping is omitted it defaults to the *globals* " +"dictionary. If both mappings are omitted, the expression is executed with " +"the *globals* and *locals* in the environment where :func:`eval` is called. " +"Note, *eval()* will only have access to the :term:`nested scopes ` (non-locals) in the enclosing environment if they are already " +"referenced in the scope that is calling :func:`eval` (e.g. via a :keyword:" +"`nonlocal` statement)." msgstr "" "*expression* 引數會被視為一條 Python 運算式(技術上而言,是條件列表)來剖析及" -"求值,而 *globals* 和 *locals* dictionaries 分別用作全域和區域命名空間。如果 " +"求值,而 *globals* 和 *locals* 對映分別用作全域和區域命名空間。如果 " "*globals* dictionary 存在但缺少 ``__builtins__`` 的鍵值,那 *expression* 被剖" "析之前,將為該鍵插入對內建 :mod:`builtins` module dictionary 的引用。這麼一" "來,在將 ``__builtins__`` dictionary 傳入 :func:`eval` 之前,你可以透過將它插" -"入 *globals* 來控制你需要哪些內建函式來執行程式碼。如果 *locals* 被省略,那它" -"的預設值是 *globals* dictionary。如果兩個 dictionary 引數都被省略,則在 :" -"func:`eval` 被呼叫的環境中執行運算式。請注意,*eval()* 在封閉 (enclosing) 環" -"境中無法存取\\ :term:`巢狀作用域 ` (non-locals)。" - -#: ../../library/functions.rst:604 +"入 *globals* 來控制你需要哪些內建函式來執行程式碼。如果 *locals* 對映被省略," +"那它的預設值是 *globals* dictionary。如果兩個對映都被省略,則以在 :func:" +"`eval` 被呼叫的環境中的 *globals* 和 *locals* 執行運算式。請注意,*eval()* 在" +"封閉 (enclosing) 環境中無法存取\\ :term:`巢狀作用域 ` (non-" +"locals),除非呼叫 :func:`eval` 的作用域已經有參照它們(例如透過 :keyword:" +"`nonlocal` 陳述式)。" + +#: ../../library/functions.rst:607 msgid "Example:" msgstr "範例:" -#: ../../library/functions.rst:610 +#: ../../library/functions.rst:613 msgid "" "This function can also be used to execute arbitrary code objects (such as " "those created by :func:`compile`). In this case, pass a code object instead " @@ -1268,7 +1273,7 @@ msgstr "" "情況下,傳入的引數是程式碼物件而不是字串。如果編譯該物件時的 *mode* 引數是 " "``'exec'``,那麼 :func:`eval` 回傳值為 ``None``。" -#: ../../library/functions.rst:615 +#: ../../library/functions.rst:618 msgid "" "Hints: dynamic execution of statements is supported by the :func:`exec` " "function. The :func:`globals` and :func:`locals` functions return the " @@ -1279,13 +1284,13 @@ msgstr "" "函式分別回傳當前的全域性和局部性 dictionary,它們對於將引數傳遞給 :func:" "`eval` 或 :func:`exec` 可能會方便許多。" -#: ../../library/functions.rst:620 +#: ../../library/functions.rst:623 msgid "" "If the given source is a string, then leading and trailing spaces and tabs " "are stripped." msgstr "如果給定來源是一個字串,那麼其前後的空格和定位字元會被移除。" -#: ../../library/functions.rst:623 +#: ../../library/functions.rst:626 msgid "" "See :func:`ast.literal_eval` for a function that can safely evaluate strings " "with expressions containing only literals." @@ -1293,8 +1298,8 @@ msgstr "" "另外可以參閱 :func:`ast.literal_eval`,該函式可以安全執行僅包含文字的運算式字" "串。" -#: ../../library/functions.rst:626 ../../library/functions.rst:628 -#: ../../library/functions.rst:671 ../../library/functions.rst:673 +#: ../../library/functions.rst:629 ../../library/functions.rst:631 +#: ../../library/functions.rst:685 ../../library/functions.rst:687 msgid "" "Raises an :ref:`auditing event ` ``exec`` with the code object as " "the argument. Code compilation events may also be raised." @@ -1302,9 +1307,19 @@ msgstr "" "引發一個附帶程式碼物件為引數的\\ :ref:`稽核事件 ` ``exec``。也可能" "會引發程式碼編譯事件。" -#: ../../library/functions.rst:635 +#: ../../library/functions.rst:636 ../../library/functions.rst:707 +msgid "The *globals* and *locals* arguments can now be passed as keywords." +msgstr "" + +#: ../../library/functions.rst:640 ../../library/functions.rst:711 +msgid "" +"The semantics of the default *locals* namespace have been adjusted as " +"described for the :func:`locals` builtin." +msgstr "" + +#: ../../library/functions.rst:647 msgid "" -"This function supports dynamic execution of Python code. *object* must be " +"This function supports dynamic execution of Python code. *source* must be " "either a string or a code object. If it is a string, the string is parsed " "as a suite of Python statements which is then executed (unless a syntax " "error occurs). [#]_ If it is a code object, it is simply executed. In all " @@ -1314,7 +1329,7 @@ msgid "" "not be used outside of function definitions even within the context of code " "passed to the :func:`exec` function. The return value is ``None``." msgstr "" -"這個函式支援動態執行 Python 程式碼。*object* 必須是字串或者程式碼物件。如果是" +"這個函式支援動態執行 Python 程式碼。*source* 必須是字串或者程式碼物件。如果是" "字串,那麼該字串將被剖析為一系列 Python 陳述式並執行(除非發生語法錯誤)。" "[#]_ 如果是程式碼物件,它將被直接執行。無論哪種情況,被執行的程式碼都需要和檔" "案輸入一樣是有效的(可參閱語言參考手冊中關於\\ :ref:`file-input`\\ 的章節)。" @@ -1322,8 +1337,7 @@ msgstr "" "`nonlocal`、:keyword:`yield` 和 :keyword:`return` 陳述式也不能在函式之外使" "用。該函式回傳值是 ``None``。" -#: ../../library/functions.rst:646 -#, fuzzy +#: ../../library/functions.rst:658 msgid "" "In all cases, if the optional parts are omitted, the code is executed in the " "current scope. If only *globals* is provided, it must be a dictionary (and " @@ -1333,22 +1347,22 @@ msgid "" "any mapping object. Remember that at the module level, globals and locals " "are the same dictionary." msgstr "" -"無論哪種情況,如果省略了選擇性引數,程式碼將在當前作用域內執行。如果只提供了 " -"*globals* 引數,就必須是 dictionary 型別,而且會被用作全域性和本地變數。如果" -"同時提供了 *globals* 和 *locals* 引數,它們分別被用作全域性和本地變數。如果提" -"供了 *locals* 引數,則它可以是任何映射物件。請記住在 module 層級中全域性和本" -"地變數是相同的 dictionary。" +"無論哪種情況,如果省略了選擇性的部分,程式碼將在當前作用域內執行。如果只提供" +"了 *globals* 引數,就必須是 dictionary 型別(且不能是 dictionary 的子類別)," +"而且會被用作全域和區域變數。如果同時提供了 *globals* 和 *locals*,它們分別被" +"用作全域和區域變數。如果提供了 *locals*,則它可以是任何對映物件。請記住在 " +"module 層級中全域和區域變數是相同的 dictionary。" -#: ../../library/functions.rst:656 +#: ../../library/functions.rst:668 msgid "" -"Most users should just pass a *globals* argument and never *locals*. If exec " -"gets two separate objects as *globals* and *locals*, the code will be " -"executed as if it were embedded in a class definition." +"When ``exec`` gets two separate objects as *globals* and *locals*, the code " +"will be executed as if it were embedded in a class definition. This means " +"functions and classes defined in the executed code will not be able to " +"access variables assigned at the top level (as the \"top level\" variables " +"are treated as class variables in a class definition)." msgstr "" -"大部分使用者只需要傳入 *globals* 引數,而不用傳遞 *locals*。如果 exec 有兩個" -"不同的 *globals* 和 *locals* 物件,程式碼就像嵌入在 class 定義中一樣執行。" -#: ../../library/functions.rst:660 +#: ../../library/functions.rst:674 msgid "" "If the *globals* dictionary does not contain a value for the key " "``__builtins__``, a reference to the dictionary of the built-in module :mod:" @@ -1361,7 +1375,7 @@ msgstr "" "dictionary 傳入 :func:`exec` 之前,你可以透過將它插入 *globals* 來控制你需要" "哪些內建函式來執行程式碼。" -#: ../../library/functions.rst:666 +#: ../../library/functions.rst:680 msgid "" "The *closure* argument specifies a closure--a tuple of cellvars. It's only " "valid when the *object* is a code object containing free variables. The " @@ -1372,31 +1386,30 @@ msgstr "" "只有在 *object* 是一個含有自由變數 (free variable) 的程式碼物件時,它才有效。" "Tuple 的長度必須與程式碼物件所引用的自由變數數量完全匹配。" -#: ../../library/functions.rst:678 +#: ../../library/functions.rst:692 msgid "" "The built-in functions :func:`globals` and :func:`locals` return the current " -"global and local dictionary, respectively, which may be useful to pass " -"around for use as the second and third argument to :func:`exec`." +"global and local namespace, respectively, which may be useful to pass around " +"for use as the second and third argument to :func:`exec`." msgstr "" -"內建 :func:`globals` 和 :func:`locals` 函式各自回傳當前的全域性和本地 " -"dictionary,因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數。" +"內建 :func:`globals` 和 :func:`locals` 函式各自回傳當前的全域和區域命名空間," +"因此可以將它們傳遞給 :func:`exec` 的第二個和第三個引數以供後續使用。" -#: ../../library/functions.rst:684 +#: ../../library/functions.rst:698 msgid "" -"The default *locals* act as described for function :func:`locals` below: " -"modifications to the default *locals* dictionary should not be attempted. " +"The default *locals* act as described for function :func:`locals` below. " "Pass an explicit *locals* dictionary if you need to see effects of the code " "on *locals* after function :func:`exec` returns." msgstr "" -"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣:不要試圖改變" -"預設的 *locals* dictionary。如果你想在 :func:`exec` 函式回傳時知道程式碼對 " -"*locals* 的變動,請明確地傳遞 *locals* dictionary 。" +"預設情況下,*locals* 的行為如下面 :func:`locals` 函式描述的一樣。如果你想在 :" +"func:`exec` 函式回傳時知道程式碼對 *locals* 的變動,請明確地傳遞 *locals* " +"dictionary 。" -#: ../../library/functions.rst:689 +#: ../../library/functions.rst:702 msgid "Added the *closure* parameter." msgstr "增加了 *closure* 參數。" -#: ../../library/functions.rst:695 +#: ../../library/functions.rst:717 msgid "" "Construct an iterator from those elements of *iterable* for which *function* " "is true. *iterable* may be either a sequence, a container which supports " @@ -1408,7 +1421,7 @@ msgstr "" "*function* 是 ``None``,則會假設它是一個識別性函式,即 *iterable* 中所有假值" "元素會被移除。" -#: ../../library/functions.rst:701 +#: ../../library/functions.rst:723 msgid "" "Note that ``filter(function, iterable)`` is equivalent to the generator " "expression ``(item for item in iterable if function(item))`` if function is " @@ -1419,7 +1432,7 @@ msgstr "" "是 ``None`` 的時候為 ``(item for item in iterable if function(item))``;" "function 是 ``None`` 的時候為 ``(item for item in iterable if item)``。" -#: ../../library/functions.rst:706 +#: ../../library/functions.rst:728 msgid "" "See :func:`itertools.filterfalse` for the complementary function that " "returns elements of *iterable* for which *function* is false." @@ -1427,11 +1440,11 @@ msgstr "" "請參閱 :func:`itertools.filterfalse`,只有 *function* 為 false 時才選取 " "*iterable* 中元素的互補函式。" -#: ../../library/functions.rst:717 +#: ../../library/functions.rst:739 msgid "Return a floating-point number constructed from a number or a string." msgstr "回傳從數字或字串生成的浮點數。" -#: ../../library/functions.rst:721 +#: ../../library/functions.rst:743 msgid "" ">>> float('+1.23')\n" "1.23\n" @@ -1455,7 +1468,7 @@ msgstr "" ">>> float('-Infinity')\n" "-inf" -#: ../../library/functions.rst:734 +#: ../../library/functions.rst:756 msgid "" "If the argument is a string, it should contain a decimal number, optionally " "preceded by a sign, and optionally embedded in whitespace. The optional " @@ -1470,7 +1483,7 @@ msgstr "" "數也可以是 NaN(非數字)或正負無窮大的字串。確切地說,除去首尾的空格後,輸入" "必須遵循以下語法中 :token:`~float:floatvalue` 的生成規則:" -#: ../../library/functions.rst:755 +#: ../../library/functions.rst:777 msgid "" "Case is not significant, so, for example, \"inf\", \"Inf\", \"INFINITY\", " "and \"iNfINity\" are all acceptable spellings for positive infinity." @@ -1478,7 +1491,7 @@ msgstr "" "字母大小寫不影響,例如,\"inf\"、\"Inf\"、\"INFINITY\"、\"iNfINity\" 都可以表" "示正無窮大。" -#: ../../library/functions.rst:758 +#: ../../library/functions.rst:780 msgid "" "Otherwise, if the argument is an integer or a floating-point number, a " "floating-point number with the same value (within Python's floating-point " @@ -1488,7 +1501,7 @@ msgstr "" "否則,如果引數是整數或浮點數,則回傳具有相同值(在 Python 浮點精度範圍內)的" "浮點數。如果引數在 Python 浮點精度範圍外,則會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:763 +#: ../../library/functions.rst:785 msgid "" "For a general Python object ``x``, ``float(x)`` delegates to ``x." "__float__()``. If :meth:`~object.__float__` is not defined then it falls " @@ -1497,22 +1510,22 @@ msgstr "" "對於一般的 Python 物件 ``x``,``float(x)`` 會委派給 ``x.__float__()``。如果未" "定義 :meth:`~object.__float__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:767 +#: ../../library/functions.rst:789 msgid "If no argument is given, ``0.0`` is returned." msgstr "如果沒有引數,則回傳 ``0.0``。" -#: ../../library/functions.rst:769 +#: ../../library/functions.rst:791 msgid "The float type is described in :ref:`typesnumeric`." msgstr ":ref:`typesnumeric` 描述了浮點數型別。" -#: ../../library/functions.rst:777 +#: ../../library/functions.rst:799 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__float__` is not " "defined." msgstr "" "如果 :meth:`~object.__float__` 未定義,則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:787 +#: ../../library/functions.rst:809 msgid "" "Convert a *value* to a \"formatted\" representation, as controlled by " "*format_spec*. The interpretation of *format_spec* will depend on the type " @@ -1523,7 +1536,7 @@ msgstr "" "取決於 *value* 引數的型別,但是大多數內建型別使用標準格式化語法::ref:" "`formatspec`。" -#: ../../library/functions.rst:792 +#: ../../library/functions.rst:814 msgid "" "The default *format_spec* is an empty string which usually gives the same " "effect as calling :func:`str(value) `." @@ -1531,7 +1544,7 @@ msgstr "" "預設的 *format_spec* 是一個空字串,它通常和呼叫 :func:`str(value) ` 的效" "果相同。" -#: ../../library/functions.rst:795 +#: ../../library/functions.rst:817 msgid "" "A call to ``format(value, format_spec)`` is translated to ``type(value)." "__format__(value, format_spec)`` which bypasses the instance dictionary when " @@ -1545,7 +1558,7 @@ msgstr "" "實例中的字典。如果搜尋到 :mod:`object` 這個 method 但 *format_spec* 不為空," "或是 *format_spec* 或回傳值不是字串,則會引發 :exc:`TypeError`。" -#: ../../library/functions.rst:802 +#: ../../library/functions.rst:824 msgid "" "``object().__format__(format_spec)`` raises :exc:`TypeError` if " "*format_spec* is not an empty string." @@ -1553,7 +1566,7 @@ msgstr "" "當 *format_spec* 不是空字串時,``object().__format__(format_spec)`` 會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:811 +#: ../../library/functions.rst:833 msgid "" "Return a new :class:`frozenset` object, optionally with elements taken from " "*iterable*. ``frozenset`` is a built-in class. See :class:`frozenset` and :" @@ -1563,7 +1576,7 @@ msgstr "" "``frozenset`` 是一個內建的 class。有關此 class 的文件,請參閱 :class:" "`frozenset` 和 :ref:`types-set`。" -#: ../../library/functions.rst:815 +#: ../../library/functions.rst:837 msgid "" "For other containers see the built-in :class:`set`, :class:`list`, :class:" "`tuple`, and :class:`dict` classes, as well as the :mod:`collections` module." @@ -1571,7 +1584,7 @@ msgstr "" "請參閱內建的 :class:`set`、:class:`list`、:class:`tuple` 和 :class:`dict` " "class,以及 :mod:`collections` module 來了解其它的容器。" -#: ../../library/functions.rst:823 +#: ../../library/functions.rst:845 msgid "" "Return the value of the named attribute of *object*. *name* must be a " "string. If the string is the name of one of the object's attributes, the " @@ -1586,7 +1599,7 @@ msgstr "" "`AttributeError`。*name* 不必是個 Python 識別符 (identifier)(請見 :func:" "`setattr`)。" -#: ../../library/functions.rst:832 +#: ../../library/functions.rst:854 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " @@ -1597,7 +1610,7 @@ msgstr "" "發生在編譯期,因此你必須手動改編私有屬性(有兩個前導底線的屬性)的名稱,才能" "使用 :func:`getattr` 來取得它。" -#: ../../library/functions.rst:840 +#: ../../library/functions.rst:862 msgid "" "Return the dictionary implementing the current module namespace. For code " "within functions, this is set when the function is defined and remains the " @@ -1606,7 +1619,7 @@ msgstr "" "回傳代表當前 module 命名空間的 dictionary。對於在函式中的程式碼來說,這在定義" "函式時設定且不論該函式是在何處呼叫都會保持相同。" -#: ../../library/functions.rst:847 +#: ../../library/functions.rst:869 msgid "" "The arguments are an object and a string. The result is ``True`` if the " "string is the name of one of the object's attributes, ``False`` if not. " @@ -1617,7 +1630,7 @@ msgstr "" "則回傳 ``False``。(此功能是透過呼叫 ``getattr(object, name)`` 並檢查是否引" "發 :exc:`AttributeError` 來實作的。)" -#: ../../library/functions.rst:855 +#: ../../library/functions.rst:877 msgid "" "Return the hash value of the object (if it has one). Hash values are " "integers. They are used to quickly compare dictionary keys during a " @@ -1628,7 +1641,7 @@ msgstr "" "時用來快速比較 dictionary 的鍵。相同大小的數字數值有相同的雜湊值(即使它們型" "別不同,如 1 和 1.0)。" -#: ../../library/functions.rst:862 +#: ../../library/functions.rst:884 msgid "" "For objects with custom :meth:`~object.__hash__` methods, note that :func:" "`hash` truncates the return value based on the bit width of the host machine." @@ -1636,7 +1649,7 @@ msgstr "" "請注意,如果物件帶有自訂的 :meth:`~object.__hash__` 方法,:func:`hash` 將根據" "運行機器的位元長度來截斷回傳值。" -#: ../../library/functions.rst:869 +#: ../../library/functions.rst:891 msgid "" "Invoke the built-in help system. (This function is intended for interactive " "use.) If no argument is given, the interactive help system starts on the " @@ -1650,7 +1663,7 @@ msgstr "" "關鍵字或說明文件主題中搜索該字串,並在控制台上列印幫助資訊。如果引數是其他任" "意物件,則會生成該物件的幫助頁。" -#: ../../library/functions.rst:876 +#: ../../library/functions.rst:898 msgid "" "Note that if a slash(/) appears in the parameter list of a function when " "invoking :func:`help`, it means that the parameters prior to the slash are " @@ -1661,12 +1674,12 @@ msgstr "" "前面的參數是僅限位置 (positional-only) 參數。有關更多資訊,請參閱\\ :ref:`常" "見問答集中的僅限位置參數條目 `。" -#: ../../library/functions.rst:881 +#: ../../library/functions.rst:903 msgid "" "This function is added to the built-in namespace by the :mod:`site` module." msgstr "此函式會被 :mod:`site` module 加入到內建命名空間。" -#: ../../library/functions.rst:883 +#: ../../library/functions.rst:905 msgid "" "Changes to :mod:`pydoc` and :mod:`inspect` mean that the reported signatures " "for callables are now more comprehensive and consistent." @@ -1674,7 +1687,7 @@ msgstr "" "對於 :mod:`pydoc` 和 :mod:`inspect` 的變更,使得可呼叫物件回報的的簽名 " "(signature) 更加全面和一致。" -#: ../../library/functions.rst:890 +#: ../../library/functions.rst:912 msgid "" "Convert an integer number to a lowercase hexadecimal string prefixed with " "\"0x\". If *x* is not a Python :class:`int` object, it has to define an :" @@ -1684,7 +1697,7 @@ msgstr "" "class:`int` 物件,則必須定義一個 :meth:`~object.__index__` method 並且回傳一" "個整數。舉例來說:" -#: ../../library/functions.rst:899 +#: ../../library/functions.rst:921 msgid "" "If you want to convert an integer number to an uppercase or lower " "hexadecimal string with prefix or not, you can use either of the following " @@ -1693,20 +1706,20 @@ msgstr "" "如果要將整數轉換為大寫或小寫的十六進位制字串,並可選擇有無 \"0x\" 前綴,則可" "以使用如下方法:" -#: ../../library/functions.rst:911 +#: ../../library/functions.rst:933 msgid "" "See also :func:`int` for converting a hexadecimal string to an integer using " "a base of 16." msgstr "另請參閱 :func:`int` 將十六進位制字串轉換為以 16 為基數的整數。" -#: ../../library/functions.rst:916 +#: ../../library/functions.rst:938 msgid "" "To obtain a hexadecimal string representation for a float, use the :meth:" "`float.hex` method." msgstr "" "如果要獲取浮點數的十六進位制字串形式,請使用 :meth:`float.hex` method。" -#: ../../library/functions.rst:922 +#: ../../library/functions.rst:944 msgid "" "Return the \"identity\" of an object. This is an integer which is " "guaranteed to be unique and constant for this object during its lifetime. " @@ -1716,18 +1729,18 @@ msgstr "" "回傳物件的 \"識別性\" 。該值是一個整數,在此物件的生命週期中保證是唯一且恆定" "的。兩個生命期不重疊的物件可能具有相同的 :func:`id` 值。" -#: ../../library/functions.rst:927 +#: ../../library/functions.rst:949 msgid "This is the address of the object in memory." msgstr "這是該物件在記憶體中的位址。" -#: ../../library/functions.rst:929 +#: ../../library/functions.rst:951 msgid "" "Raises an :ref:`auditing event ` ``builtins.id`` with argument " "``id``." msgstr "" "引發一個附帶引數 ``id`` 的\\ :ref:`稽核事件 ` ``builtins.id``。" -#: ../../library/functions.rst:935 +#: ../../library/functions.rst:957 msgid "" "If the *prompt* argument is present, it is written to standard output " "without a trailing newline. The function then reads a line from input, " @@ -1738,7 +1751,7 @@ msgstr "" "從輸入中讀取一行,將其轉換為字串(去除末尾的換行符)並回傳。當讀取到 EOF 時," "則引發 :exc:`EOFError`。例如: ::" -#: ../../library/functions.rst:940 +#: ../../library/functions.rst:962 msgid "" ">>> s = input('--> ') \n" "--> Monty Python's Flying Circus\n" @@ -1750,7 +1763,7 @@ msgstr "" ">>> s \n" "\"Monty Python's Flying Circus\"" -#: ../../library/functions.rst:945 +#: ../../library/functions.rst:967 msgid "" "If the :mod:`readline` module was loaded, then :func:`input` will use it to " "provide elaborate line editing and history features." @@ -1758,7 +1771,7 @@ msgstr "" "如果載入了 :mod:`readline` module,:func:`input` 將使用它來提供複雜的行編輯和" "歷史記錄功能。" -#: ../../library/functions.rst:948 ../../library/functions.rst:950 +#: ../../library/functions.rst:970 ../../library/functions.rst:972 msgid "" "Raises an :ref:`auditing event ` ``builtins.input`` with argument " "``prompt`` before reading input" @@ -1766,7 +1779,7 @@ msgstr "" "引發一個附帶讀取輸入前的引數 ``prompt`` 的\\ :ref:`稽核事件 ` " "``builtins.input``。" -#: ../../library/functions.rst:953 ../../library/functions.rst:955 +#: ../../library/functions.rst:975 ../../library/functions.rst:977 msgid "" "Raises an :ref:`auditing event ` ``builtins.input/result`` with " "the result after successfully reading input." @@ -1774,13 +1787,13 @@ msgstr "" "引發一個附帶成功讀取結果的\\ :ref:`稽核事件 ` ``builtins.input/" "result``。" -#: ../../library/functions.rst:962 +#: ../../library/functions.rst:984 msgid "" "Return an integer object constructed from a number or a string, or return " "``0`` if no arguments are given." msgstr "" -#: ../../library/functions.rst:967 +#: ../../library/functions.rst:989 msgid "" ">>> int(123.45)\n" "123\n" @@ -1808,7 +1821,7 @@ msgstr "" ">>> int('01110011', base=2)\n" "115" -#: ../../library/functions.rst:982 +#: ../../library/functions.rst:1004 msgid "" "If the argument defines :meth:`~object.__int__`, ``int(x)`` returns ``x." "__int__()``. If the argument defines :meth:`~object.__index__`, it returns " @@ -1821,7 +1834,7 @@ msgstr "" "義了 :meth:`~object.__trunc__` 則回傳 ``x.__trunc__()``。對於浮點數,則會向零" "的方向無條件捨去。" -#: ../../library/functions.rst:988 +#: ../../library/functions.rst:1010 msgid "" "If the argument is not a number or if *base* is given, then it must be a " "string, :class:`bytes`, or :class:`bytearray` instance representing an " @@ -1834,7 +1847,7 @@ msgstr "" "以有 ``+`` 或 ``-``\\ (中間沒有空格)、可有個前導的零、也可被空格包圍、或在" "數字間有單一底線。" -#: ../../library/functions.rst:994 +#: ../../library/functions.rst:1016 msgid "" "A base-n integer string contains digits, each representing a value from 0 to " "n-1. The values 0--9 can be represented by any Unicode decimal digit. The " @@ -1856,11 +1869,11 @@ msgstr "" "進制中的一個,所以 ``int('010', 0)`` 是非法的,但 ``int('010')`` 和 " "``int('010', 8)`` 是有效的。" -#: ../../library/functions.rst:1005 +#: ../../library/functions.rst:1027 msgid "The integer type is described in :ref:`typesnumeric`." msgstr "整數型別定義請參閱\\ :ref:`typesnumeric`。" -#: ../../library/functions.rst:1007 +#: ../../library/functions.rst:1029 msgid "" "If *base* is not an instance of :class:`int` and the *base* object has a :" "meth:`base.__index__ ` method, that method is called to " @@ -1872,22 +1885,22 @@ msgstr "" "的版本使用 :meth:`base.__int__ ` 而不是 :meth:`base." "__index__ `。" -#: ../../library/functions.rst:1017 +#: ../../library/functions.rst:1039 msgid "The first parameter is now positional-only." msgstr "第一個參數為僅限位置參數。" -#: ../../library/functions.rst:1020 +#: ../../library/functions.rst:1042 msgid "" "Falls back to :meth:`~object.__index__` if :meth:`~object.__int__` is not " "defined." msgstr "" "如果未定義 :meth:`~object.__int__` 則會回退到 :meth:`~object.__index__`。" -#: ../../library/functions.rst:1023 +#: ../../library/functions.rst:1045 msgid "The delegation to :meth:`~object.__trunc__` is deprecated." msgstr "對 :meth:`~object.__trunc__` 的委派已棄用。" -#: ../../library/functions.rst:1026 +#: ../../library/functions.rst:1048 msgid "" ":class:`int` string inputs and string representations can be limited to help " "avoid denial of service attacks. A :exc:`ValueError` is raised when the " @@ -1901,7 +1914,7 @@ msgstr "" "`int` 轉換為字串時將會超出限制時,會引發 :exc:`ValueError`。請參閱\\ :ref:`整" "數字串轉換的長度限制 `\\ 說明文件。" -#: ../../library/functions.rst:1036 +#: ../../library/functions.rst:1058 msgid "" "Return ``True`` if the *object* argument is an instance of the *classinfo* " "argument, or of a (direct, indirect, or :term:`virtual `) of *classinfo*. A class is considered a " @@ -1941,7 +1954,7 @@ msgstr "" "是 *classinfo* 中任一元素的 subclass 時則回傳 ``True``。其他情況,會引發 :" "exc:`TypeError`。" -#: ../../library/functions.rst:1068 +#: ../../library/functions.rst:1090 msgid "" "Return an :term:`iterator` object. The first argument is interpreted very " "differently depending on the presence of the second argument. Without a " @@ -1965,11 +1978,11 @@ msgstr "" "__next__` 時會不帶引數地呼叫 *object*;如果回傳的結果是 *sentinel* 則引發 :" "exc:`StopIteration`,否則回傳呼叫結果。" -#: ../../library/functions.rst:1082 +#: ../../library/functions.rst:1104 msgid "See also :ref:`typeiter`." msgstr "另請參閱 :ref:`typeiter`。" -#: ../../library/functions.rst:1084 +#: ../../library/functions.rst:1106 msgid "" "One useful application of the second form of :func:`iter` is to build a " "block-reader. For example, reading fixed-width blocks from a binary database " @@ -1978,7 +1991,7 @@ msgstr "" ":func:`iter` 的第二種形式有一個好用的應用,是能夠建立一個區塊閱讀器 (block-" "reader)。例如,從二進位資料庫檔案中讀取固定寬度的區塊,直到檔案的結尾: ::" -#: ../../library/functions.rst:1088 +#: ../../library/functions.rst:1110 msgid "" "from functools import partial\n" "with open('mydata.db', 'rb') as f:\n" @@ -1990,7 +2003,7 @@ msgstr "" " for block in iter(partial(f.read, 64), b''):\n" " process_block(block)" -#: ../../library/functions.rst:1096 +#: ../../library/functions.rst:1118 msgid "" "Return the length (the number of items) of an object. The argument may be a " "sequence (such as a string, bytes, tuple, list, or range) or a collection " @@ -1999,7 +2012,7 @@ msgstr "" "回傳物件的長度(元素個數)。引數可以是序列(如 string、bytes、tuple、list 或 " "range)或集合(如 dictionary、set 或 frozen set)。" -#: ../../library/functions.rst:1102 +#: ../../library/functions.rst:1124 msgid "" "``len`` raises :exc:`OverflowError` on lengths larger than :data:`sys." "maxsize`, such as :class:`range(2 ** 100) `." @@ -2007,7 +2020,7 @@ msgstr "" "如果物件長度大於 :data:`sys.maxsize`,像是 :class:`range(2 ** 100) `," "則 ``len`` 會引發 :exc:`OverflowError`。" -#: ../../library/functions.rst:1111 +#: ../../library/functions.rst:1133 msgid "" "Rather than being a function, :class:`list` is actually a mutable sequence " "type, as documented in :ref:`typesseq-list` and :ref:`typesseq`." @@ -2015,26 +2028,85 @@ msgstr "" "除了是函式,:class:`list` 也是可變序列型別,詳情請參閱 :ref:`typesseq-list` " "和 :ref:`typesseq`。" -#: ../../library/functions.rst:1117 +#: ../../library/functions.rst:1139 +msgid "" +"Return a mapping object representing the current local symbol table, with " +"variable names as the keys, and their currently bound references as the " +"values." +msgstr "" + +#: ../../library/functions.rst:1143 +msgid "" +"At module scope, as well as when using :func:`exec` or :func:`eval` with a " +"single namespace, this function returns the same namespace as :func:" +"`globals`." +msgstr "" + +#: ../../library/functions.rst:1147 +msgid "" +"At class scope, it returns the namespace that will be passed to the " +"metaclass constructor." +msgstr "" + +#: ../../library/functions.rst:1150 +msgid "" +"When using ``exec()`` or ``eval()`` with separate local and global " +"arguments, it returns the local namespace passed in to the function call." +msgstr "" + +#: ../../library/functions.rst:1153 +msgid "" +"In all of the above cases, each call to ``locals()`` in a given frame of " +"execution will return the *same* mapping object. Changes made through the " +"mapping object returned from ``locals()`` will be visible as assigned, " +"reassigned, or deleted local variables, and assigning, reassigning, or " +"deleting local variables will immediately affect the contents of the " +"returned mapping object." +msgstr "" + +#: ../../library/functions.rst:1160 +msgid "" +"In an :term:`optimized scope` (including functions, generators, and " +"coroutines), each call to ``locals()`` instead returns a fresh dictionary " +"containing the current bindings of the function's local variables and any " +"nonlocal cell references. In this case, name binding changes made via the " +"returned dict are *not* written back to the corresponding local variables or " +"nonlocal cell references, and assigning, reassigning, or deleting local " +"variables and nonlocal cell references does *not* affect the contents of " +"previously returned dictionaries." +msgstr "" + +#: ../../library/functions.rst:1169 +msgid "" +"Calling ``locals()`` as part of a comprehension in a function, generator, or " +"coroutine is equivalent to calling it in the containing scope, except that " +"the comprehension's initialised iteration variables will be included. In " +"other scopes, it behaves as if the comprehension were running as a nested " +"function." +msgstr "" + +#: ../../library/functions.rst:1175 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." +"Calling ``locals()`` as part of a generator expression is equivalent to " +"calling it in a nested generator function." msgstr "" -"更新並回傳表示當前本地符號表的 dictionary。在函式區塊而不是 class 區塊中呼" -"叫 :func:`locals` 時會回傳自由變數。請注意,在 module 階層中,:func:`locals` " -"和 :func:`globals` 是相同的 dictionary。" -#: ../../library/functions.rst:1123 +#: ../../library/functions.rst:1178 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." +"The behaviour of ``locals()`` in a comprehension has been updated as " +"described in :pep:`709`." msgstr "" -"此 dictionary 的內容不應該被更動;更改可能不會影響直譯器使用的本地變數或自由" -"變數的值。" -#: ../../library/functions.rst:1128 +#: ../../library/functions.rst:1182 +msgid "" +"As part of :pep:`667`, the semantics of mutating the mapping objects " +"returned from this function are now defined. The behavior in :term:" +"`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:1192 msgid "" "Return an iterator that applies *function* to every item of *iterable*, " "yielding the results. If additional *iterables* arguments are passed, " @@ -2049,13 +2121,13 @@ msgstr "" "iteratable 耗盡時 iterator 也會結束。如果函式的輸入已經被編排為引數的 tuple," "請參閱 :func:`itertools.starmap`。" -#: ../../library/functions.rst:1140 +#: ../../library/functions.rst:1204 msgid "" "Return the largest item in an iterable or the largest of two or more " "arguments." msgstr "回傳 iterable 中最大的元素,或者回傳兩個以上的引數中最大的。" -#: ../../library/functions.rst:1143 +#: ../../library/functions.rst:1207 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The largest item in the iterable is returned. If two or more positional " @@ -2064,7 +2136,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是個 :term:`iterable`,iterable 中最大的元素" "會被回傳。如果提供了兩個或以上的位置引數,則回傳最大的位置引數。" -#: ../../library/functions.rst:1148 ../../library/functions.rst:1186 +#: ../../library/functions.rst:1212 ../../library/functions.rst:1250 msgid "" "There are two optional keyword-only arguments. The *key* argument specifies " "a one-argument ordering function like that used for :meth:`list.sort`. The " @@ -2077,7 +2149,7 @@ msgstr "" "的物件。如果 iterable 為空,並且沒有提供 *default*,則會引發 :exc:" "`ValueError`。" -#: ../../library/functions.rst:1154 +#: ../../library/functions.rst:1218 msgid "" "If multiple items are maximal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2088,15 +2160,15 @@ msgstr "" "``sorted(iterable, key=keyfunc, reverse=True)[0]`` 和 ``heapq.nlargest(1, " "iterable, key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1159 ../../library/functions.rst:1197 +#: ../../library/functions.rst:1223 ../../library/functions.rst:1261 msgid "Added the *default* keyword-only parameter." msgstr "新增 *default* 僅限關鍵字參數。" -#: ../../library/functions.rst:1162 ../../library/functions.rst:1200 +#: ../../library/functions.rst:1226 ../../library/functions.rst:1264 msgid "The *key* can be ``None``." msgstr "*key* 可以為 ``None``。" -#: ../../library/functions.rst:1170 +#: ../../library/functions.rst:1234 msgid "" "Return a \"memory view\" object created from the given argument. See :ref:" "`typememoryview` for more information." @@ -2104,13 +2176,13 @@ msgstr "" "回傳由給定的引數所建立之「memory view(記憶體檢視)」物件。有關詳細資訊,請參" "閱\\ :ref:`typememoryview`。" -#: ../../library/functions.rst:1178 +#: ../../library/functions.rst:1242 msgid "" "Return the smallest item in an iterable or the smallest of two or more " "arguments." msgstr "回傳 iterable 中最小的元素,或者回傳兩個以上的引數中最小的。" -#: ../../library/functions.rst:1181 +#: ../../library/functions.rst:1245 msgid "" "If one positional argument is provided, it should be an :term:`iterable`. " "The smallest item in the iterable is returned. If two or more positional " @@ -2119,7 +2191,7 @@ msgstr "" "如果只提供了一個位置引數,它必須是 :term:`iterable`,iterable 中最小的元素會" "被回傳。如果提供了兩個以上的位置引數,則回傳最小的位置引數。" -#: ../../library/functions.rst:1192 +#: ../../library/functions.rst:1256 msgid "" "If multiple items are minimal, the function returns the first one " "encountered. This is consistent with other sort-stability preserving tools " @@ -2130,7 +2202,7 @@ msgstr "" "``sorted(iterable, key=keyfunc)[0]`` 和 ``heapq.nsmallest(1, iterable, " "key=keyfunc)`` 一致。" -#: ../../library/functions.rst:1207 +#: ../../library/functions.rst:1271 msgid "" "Retrieve the next item from the :term:`iterator` by calling its :meth:" "`~iterator.__next__` method. If *default* is given, it is returned if the " @@ -2140,7 +2212,7 @@ msgstr "" "素。如果 iterator 耗盡,則回傳給定的預設值 *default*,如果沒有預設值則引發 :" "exc:`StopIteration`。" -#: ../../library/functions.rst:1214 +#: ../../library/functions.rst:1278 msgid "" "Return a new featureless object. :class:`object` is a base for all classes. " "It has methods that are common to all instances of Python classes. This " @@ -2149,15 +2221,15 @@ msgstr "" "回傳一個沒有特徵的新物件。:class:`object` 是所有 class 的基礎,它具有所有 " "Python class 實例的通用 method。這個函式不接受任何引數。" -#: ../../library/functions.rst:1220 +#: ../../library/functions.rst:1284 msgid "" -":class:`object` does *not* have a :attr:`~object.__dict__`, so you can't " -"assign arbitrary attributes to an instance of the :class:`object` class." +":class:`object` instances do *not* have :attr:`~object.__dict__` attributes, " +"so you can't assign arbitrary attributes to an instance of :class:`object`." msgstr "" -"由於 :class:`object` *沒有* :attr:`~object.__dict__`,因此無法將任意屬性賦" -"給 :class:`object` class 的實例。" +"由於 :class:`object` 實例\\ *沒有* :attr:`~object.__dict__` 屬性,因此無法將" +"任意屬性賦給 :class:`object` 的實例。" -#: ../../library/functions.rst:1226 +#: ../../library/functions.rst:1291 msgid "" "Convert an integer number to an octal string prefixed with \"0o\". The " "result is a valid Python expression. If *x* is not a Python :class:`int` " @@ -2168,7 +2240,7 @@ msgstr "" "Python 運算式。如果 *x* 不是 Python 的 :class:`int` 物件,那它需要定義 :meth:" "`~object.__index__` method 回傳一個整數。舉例來說:" -#: ../../library/functions.rst:1236 +#: ../../library/functions.rst:1301 msgid "" "If you want to convert an integer number to an octal string either with the " "prefix \"0o\" or not, you can use either of the following ways." @@ -2176,7 +2248,7 @@ msgstr "" "如果要將整數轉換為八進位制字串,不論是否具備 \"0o\" 前綴,都可以使用下面的方" "法。" -#: ../../library/functions.rst:1253 +#: ../../library/functions.rst:1318 msgid "" "Open *file* and return a corresponding :term:`file object`. If the file " "cannot be opened, an :exc:`OSError` is raised. See :ref:`tut-files` for more " @@ -2186,7 +2258,7 @@ msgstr "" "啟,則引發 :exc:`OSError`。關於使用此函式的更多方法,請參閱\\ :ref:`tut-" "files`。" -#: ../../library/functions.rst:1257 +#: ../../library/functions.rst:1322 msgid "" "*file* is a :term:`path-like object` giving the pathname (absolute or " "relative to the current working directory) of the file to be opened or an " @@ -2199,7 +2271,7 @@ msgstr "" "器 (file descriptor)。(如果有給定檔案描述器,它會隨著回傳的 I/O 物件關閉而關" "閉,除非 *closefd* 被設為 ``False``。)" -#: ../../library/functions.rst:1263 +#: ../../library/functions.rst:1328 msgid "" "*mode* is an optional string that specifies the mode in which the file is " "opened. It defaults to ``'r'`` which means open for reading in text mode. " @@ -2220,71 +2292,71 @@ msgstr "" "getencoding` 來獲取當前的本地編碼。(要讀取和寫入原始 bytes,請使用二進位制模" "式且不要指定 *encoding*。)可用的模式有:" -#: ../../library/functions.rst:1280 +#: ../../library/functions.rst:1345 msgid "Character" msgstr "字元" -#: ../../library/functions.rst:1280 +#: ../../library/functions.rst:1345 msgid "Meaning" msgstr "意義" -#: ../../library/functions.rst:1282 +#: ../../library/functions.rst:1347 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/functions.rst:1282 +#: ../../library/functions.rst:1347 msgid "open for reading (default)" msgstr "讀取(預設)" -#: ../../library/functions.rst:1283 +#: ../../library/functions.rst:1348 msgid "``'w'``" msgstr "``'w'``" -#: ../../library/functions.rst:1283 +#: ../../library/functions.rst:1348 msgid "open for writing, truncating the file first" msgstr "寫入,會先清除檔案內容" -#: ../../library/functions.rst:1284 +#: ../../library/functions.rst:1349 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/functions.rst:1284 +#: ../../library/functions.rst:1349 msgid "open for exclusive creation, failing if the file already exists" msgstr "唯一性建立,如果文件已存在則會失敗" -#: ../../library/functions.rst:1285 +#: ../../library/functions.rst:1350 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/functions.rst:1285 +#: ../../library/functions.rst:1350 msgid "open for writing, appending to the end of file if it exists" msgstr "寫入,如果檔案存在則在其末端附加內容" -#: ../../library/functions.rst:1286 +#: ../../library/functions.rst:1351 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/functions.rst:1286 ../../library/functions.rst:1430 +#: ../../library/functions.rst:1351 ../../library/functions.rst:1495 msgid "binary mode" msgstr "二進制模式" -#: ../../library/functions.rst:1287 +#: ../../library/functions.rst:1352 msgid "``'t'``" msgstr "``'t'``" -#: ../../library/functions.rst:1287 +#: ../../library/functions.rst:1352 msgid "text mode (default)" msgstr "文字模式(預設)" -#: ../../library/functions.rst:1288 +#: ../../library/functions.rst:1353 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/functions.rst:1288 +#: ../../library/functions.rst:1353 msgid "open for updating (reading and writing)" msgstr "更新(讀取並寫入)" -#: ../../library/functions.rst:1291 +#: ../../library/functions.rst:1356 msgid "" "The default mode is ``'r'`` (open for reading text, a synonym of ``'rt'``). " "Modes ``'w+'`` and ``'w+b'`` open and truncate the file. Modes ``'r+'`` and " @@ -2294,7 +2366,7 @@ msgstr "" "``'w+b'`` 模式會開啟並清除檔案。``'r+'`` 和 ``'r+b'`` 模式會開啟且保留檔案內" "容。" -#: ../../library/functions.rst:1295 +#: ../../library/functions.rst:1360 msgid "" "As mentioned in the :ref:`io-overview`, Python distinguishes between binary " "and text I/O. Files opened in binary mode (including ``'b'`` in the *mode* " @@ -2310,7 +2382,7 @@ msgstr "" "``'t'``),檔案的內容會以 :class:`str` 回傳,其位元組已經先被解碼,使用的是取" "決於平台的編碼系統或是給定的 *encoding*。" -#: ../../library/functions.rst:1305 +#: ../../library/functions.rst:1370 msgid "" "Python doesn't depend on the underlying operating system's notion of text " "files; all the processing is done by Python itself, and is therefore " @@ -2319,7 +2391,7 @@ msgstr "" "Python 不會使用底層作業系統對於文字檔案的操作概念;所有的處理都是由 Python 獨" "自完成的,因此能獨立於不同平台。" -#: ../../library/functions.rst:1309 +#: ../../library/functions.rst:1374 msgid "" "*buffering* is an optional integer used to set the buffering policy. Pass 0 " "to switch buffering off (only allowed in binary mode), 1 to select line " @@ -2340,7 +2412,7 @@ msgstr "" "``write_through`` 旗標。若未給定 *buffering* 引數,則預設的緩衝策略會運作如" "下:" -#: ../../library/functions.rst:1319 +#: ../../library/functions.rst:1384 msgid "" "Binary files are buffered in fixed-size chunks; the size of the buffer is " "chosen using a heuristic trying to determine the underlying device's \"block " @@ -2352,7 +2424,7 @@ msgstr "" "DEFAULT_BUFFER_SIZE`。在許多系統上,緩衝區的長度通常為 4096 或 8192 個位元" "組。" -#: ../../library/functions.rst:1324 +#: ../../library/functions.rst:1389 msgid "" "\"Interactive\" text files (files for which :meth:`~io.IOBase.isatty` " "returns ``True``) use line buffering. Other text files use the policy " @@ -2361,7 +2433,7 @@ msgstr "" "「互動式」文字檔(:meth:`~io.IOBase.isatty` 回傳 ``True`` 的檔案)會使用列緩" "衝。其他文字檔則使用上述的二進制檔案緩衝策略。" -#: ../../library/functions.rst:1328 +#: ../../library/functions.rst:1393 msgid "" "*encoding* is the name of the encoding used to decode or encode the file. " "This should only be used in text mode. The default encoding is platform " @@ -2374,7 +2446,7 @@ msgstr "" "Python 支援的任何 :term:`text encoding`\\ (文字編碼)都是可以使用的。關於支" "援的編碼系統清單,請參閱 :mod:`codecs` module。" -#: ../../library/functions.rst:1334 +#: ../../library/functions.rst:1399 msgid "" "*errors* is an optional string that specifies how encoding and decoding " "errors are to be handled—this cannot be used in binary mode. A variety of " @@ -2387,7 +2459,7 @@ msgstr "" "handlers`\\ 有列出清單),不過任何已註冊到 :func:`codecs.register_error` 的錯" "誤處理程式名稱也都是有效的。標準的名稱包括:" -#: ../../library/functions.rst:1342 +#: ../../library/functions.rst:1407 msgid "" "``'strict'`` to raise a :exc:`ValueError` exception if there is an encoding " "error. The default value of ``None`` has the same effect." @@ -2395,20 +2467,20 @@ msgstr "" "``'strict'`` 如果發生編碼錯誤,則引發 :exc:`ValueError` 例外。預設值 " "``None`` 也有相同的效果。" -#: ../../library/functions.rst:1346 +#: ../../library/functions.rst:1411 msgid "" "``'ignore'`` ignores errors. Note that ignoring encoding errors can lead to " "data loss." msgstr "``'ignore'`` 忽略錯誤。請注意,忽略編碼錯誤可能導致資料遺失。" -#: ../../library/functions.rst:1349 +#: ../../library/functions.rst:1414 msgid "" "``'replace'`` causes a replacement marker (such as ``'?'``) to be inserted " "where there is malformed data." msgstr "" "``'replace'`` 會在格式不正確的資料位置插入一個替換標誌(像是 ``'?'``)。" -#: ../../library/functions.rst:1352 +#: ../../library/functions.rst:1417 msgid "" "``'surrogateescape'`` will represent any incorrect bytes as low surrogate " "code units ranging from U+DC80 to U+DCFF. These surrogate code units will " @@ -2421,7 +2493,7 @@ msgstr "" "被還原回 ``surrogateescape`` 錯誤處理程式當時所處理的那些相同位元組。這對於處" "理未知編碼方式的檔案會很好用。" -#: ../../library/functions.rst:1359 +#: ../../library/functions.rst:1424 msgid "" "``'xmlcharrefreplace'`` is only supported when writing to a file. Characters " "not supported by the encoding are replaced with the appropriate XML " @@ -2430,7 +2502,7 @@ msgstr "" "``'xmlcharrefreplace'`` 僅在寫入檔案時可支援。編碼系統不支援的字元會被替換為" "適當的 XML 字元參考 (character reference) ``&#nnn;``。" -#: ../../library/functions.rst:1363 +#: ../../library/functions.rst:1428 msgid "" "``'backslashreplace'`` replaces malformed data by Python's backslashed " "escape sequences." @@ -2438,7 +2510,7 @@ msgstr "" "``'backslashreplace'`` 會用 Python 的反斜線跳脫序列 (backslashed escape " "sequence) 替換格式不正確的資料。" -#: ../../library/functions.rst:1366 +#: ../../library/functions.rst:1431 msgid "" "``'namereplace'`` (also only supported when writing) replaces unsupported " "characters with ``\\N{...}`` escape sequences." @@ -2446,7 +2518,7 @@ msgstr "" "``'namereplace'``\\ (也僅在寫入時支援)會將不支援的字元替換為 ``\\N{...}`` " "跳脫序列。" -#: ../../library/functions.rst:1374 +#: ../../library/functions.rst:1439 msgid "" "*newline* determines how to parse newline characters from the stream. It can " "be ``None``, ``''``, ``'\\n'``, ``'\\r'``, and ``'\\r\\n'``. It works as " @@ -2455,7 +2527,7 @@ msgstr "" "*newline* 會決定如何剖析資料串流 (stream) 中的換行字元。它可以是 ``None``、" "``''``、``'\\n'``、``'\\r'`` 或 ``'\\r\\n'``。它的運作規則如下:" -#: ../../library/functions.rst:1378 +#: ../../library/functions.rst:1443 msgid "" "When reading input from the stream, if *newline* is ``None``, universal " "newlines mode is enabled. Lines in the input can end in ``'\\n'``, " @@ -2471,7 +2543,7 @@ msgstr "" "傳給呼叫方時,行尾符號不會被轉換。如果它是任何其他有效的值,則輸入資料的行只" "會由給定的字串做結尾,且在回傳給呼叫方時,行尾符號不會被轉換。" -#: ../../library/functions.rst:1386 +#: ../../library/functions.rst:1451 msgid "" "When writing output to the stream, if *newline* is ``None``, any ``'\\n'`` " "characters written are translated to the system default line separator, :" @@ -2484,7 +2556,7 @@ msgstr "" "``''`` 或 ``'\\n'``,則不做任何轉換。如果 *newline* 是任何其他有效的值,則寫" "入的任何 ``'\\n'`` 字元都將轉換為給定的字串。" -#: ../../library/functions.rst:1392 +#: ../../library/functions.rst:1457 msgid "" "If *closefd* is ``False`` and a file descriptor rather than a filename was " "given, the underlying file descriptor will be kept open when the file is " @@ -2495,7 +2567,7 @@ msgstr "" "則當檔案關閉時,底層的檔案描述器會保持開啟狀態。如果有給定一個檔名,則 " "*closefd* 必須是 ``True``\\ (預設值);否則將引發錯誤。" -#: ../../library/functions.rst:1397 +#: ../../library/functions.rst:1462 msgid "" "A custom opener can be used by passing a callable as *opener*. The " "underlying file descriptor for the file object is then obtained by calling " @@ -2508,11 +2580,11 @@ msgstr "" "必須回傳一個開啟的檔案描述器(將 :mod:`os.open` 作為 *opener* 傳入,在功能上" "的結果會相當於傳入 ``None``)。" -#: ../../library/functions.rst:1403 +#: ../../library/functions.rst:1468 msgid "The newly created file is :ref:`non-inheritable `." msgstr "新建立的檔案是\\ :ref:`不可繼承的 `。" -#: ../../library/functions.rst:1405 +#: ../../library/functions.rst:1470 msgid "" "The following example uses the :ref:`dir_fd ` parameter of the :func:" "`os.open` function to open a file relative to a given directory::" @@ -2520,7 +2592,7 @@ msgstr "" "下面的範例使用 :func:`os.open` 函式回傳值當作 :ref:`dir_fd ` 的參數," "從給定的目錄中用相對路徑開啟檔案: ::" -#: ../../library/functions.rst:1408 +#: ../../library/functions.rst:1473 msgid "" ">>> import os\n" ">>> dir_fd = os.open('somedir', os.O_RDONLY)\n" @@ -2533,7 +2605,7 @@ msgid "" ">>> os.close(dir_fd) # don't leak a file descriptor" msgstr "" -#: ../../library/functions.rst:1418 +#: ../../library/functions.rst:1483 msgid "" "The type of :term:`file object` returned by the :func:`open` function " "depends on the mode. When :func:`open` is used to open a file in a text " @@ -2557,7 +2629,7 @@ msgstr "" "BufferedRandom`。當緩衝被停用時,會回傳原始資料串流 :class:`io.FileIO`,它" "是 :class:`io.RawIOBase` 的一個 subclass。" -#: ../../library/functions.rst:1439 +#: ../../library/functions.rst:1504 msgid "" "See also the file handling modules, such as :mod:`fileinput`, :mod:`io` " "(where :func:`open` is declared), :mod:`os`, :mod:`os.path`, :mod:" @@ -2567,7 +2639,7 @@ msgstr "" "`open` 的 module )、:mod:`os`、:mod:`os.path`、:mod:`tempfile` 以及 :mod:" "`shutil`。" -#: ../../library/functions.rst:1443 +#: ../../library/functions.rst:1508 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -2575,25 +2647,25 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/functions.rst:1445 +#: ../../library/functions.rst:1510 msgid "" "The ``mode`` and ``flags`` arguments may have been modified or inferred from " "the original call." msgstr "``mode`` 和 ``flags`` 引數可能會被原始的呼叫所修改或推論 (infer)。" -#: ../../library/functions.rst:1450 +#: ../../library/functions.rst:1515 msgid "The *opener* parameter was added." msgstr "增加了 *opener* 參數。" -#: ../../library/functions.rst:1451 +#: ../../library/functions.rst:1516 msgid "The ``'x'`` mode was added." msgstr "增加了 ``'x'`` 模式。" -#: ../../library/functions.rst:1452 +#: ../../library/functions.rst:1517 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "過去引發的 :exc:`IOError`,現在是 :exc:`OSError` 的別名。" -#: ../../library/functions.rst:1453 +#: ../../library/functions.rst:1518 msgid "" ":exc:`FileExistsError` is now raised if the file opened in exclusive " "creation mode (``'x'``) already exists." @@ -2601,11 +2673,11 @@ msgstr "" "如果檔案已存在但使用了唯一性建立模式 (``'x'``),現在會引發 :exc:" "`FileExistsError`。" -#: ../../library/functions.rst:1458 +#: ../../library/functions.rst:1523 msgid "The file is now non-inheritable." msgstr "檔案在此版本開始是不可繼承的。" -#: ../../library/functions.rst:1462 +#: ../../library/functions.rst:1527 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the function now retries the system call instead of raising an :" @@ -2614,15 +2686,15 @@ msgstr "" "如果系統呼叫被中斷,但訊號處理程式沒有引發例外,此函式現在會重試系統呼叫,而" "不是引發 :exc:`InterruptedError` 例外(原因詳見 :pep:`475`)。" -#: ../../library/functions.rst:1465 +#: ../../library/functions.rst:1530 msgid "The ``'namereplace'`` error handler was added." msgstr "增加了 ``'namereplace'`` 錯誤處理程式。" -#: ../../library/functions.rst:1469 +#: ../../library/functions.rst:1534 msgid "Support added to accept objects implementing :class:`os.PathLike`." msgstr "增加對於實作 :class:`os.PathLike` 物件的支援。" -#: ../../library/functions.rst:1470 +#: ../../library/functions.rst:1535 msgid "" "On Windows, opening a console buffer may return a subclass of :class:`io." "RawIOBase` other than :class:`io.FileIO`." @@ -2630,11 +2702,11 @@ msgstr "" "在 Windows 上,開啟一個控制臺緩衝區可能會回傳 :class:`io.RawIOBase` 的 " "subclass,而不是 :class:`io.FileIO`。" -#: ../../library/functions.rst:1473 +#: ../../library/functions.rst:1538 msgid "The ``'U'`` mode has been removed." msgstr "``'U'`` 模式被移除。" -#: ../../library/functions.rst:1478 +#: ../../library/functions.rst:1543 msgid "" "Given a string representing one Unicode character, return an integer " "representing the Unicode code point of that character. For example, " @@ -2645,7 +2717,7 @@ msgstr "" "``ord('a')`` 回傳整數 ``97``、``ord('€')``\\ (歐元符號)回傳 ``8364``。這" "是 :func:`chr` 的逆函式。" -#: ../../library/functions.rst:1486 +#: ../../library/functions.rst:1551 msgid "" "Return *base* to the power *exp*; if *mod* is present, return *base* to the " "power *exp*, modulo *mod* (computed more efficiently than ``pow(base, exp) % " @@ -2656,8 +2728,7 @@ msgstr "" "*mod* 取餘數(比直接呼叫 ``pow(base, exp) % mod`` 計算更高效)。兩個引數形式" "的 ``pow(exp, exp)`` 等價於次方運算子:``base**exp``。" -#: ../../library/functions.rst:1491 -#, fuzzy +#: ../../library/functions.rst:1556 msgid "" "The arguments must have numeric types. With mixed operand types, the " "coercion rules for binary arithmetic operators apply. For :class:`int` " @@ -2671,15 +2742,17 @@ msgid "" "`float` with an integral exponent, a float result is delivered. For example, " "``pow(-9, 2.0)`` returns ``81.0``." msgstr "" -"引數必須是數值型別。對於不同型別的運算元,會套用二元算術運算子的強制轉型 " +"引數必須是數值型別。對於混合型別的運算元,會套用二元算術運算子的強制轉型 " "(coercion) 規則。對於 :class:`int` 運算元,運算結果會(在強制轉型後)與運算元" "的型別相同,除非第二個引數是負數;在這種情況下,所有的引數都會被轉換為浮點數" "並得到浮點數的結果。例如,``pow(10, 2)`` 會回傳 ``100``,但 ``pow(10, -2)`` " "會回傳 ``0.01``。如果底數 (base) 是型別為 :class:`int` 或 :class:`float` 的負" -"數,且指數 (exponent) 不是整數,則會得到一個複數的結果。例如,``pow(-9, " -"0.5)`` 會回傳一個接近 ``3j`` 的值。" +"數且指數 (exponent) 不是整數,則會得到一個複數的結果,例如 ``pow(-9, 0.5)`` " +"會回傳一個接近 ``3j`` 的值。如果底數 (base) 是型別為 :class:`int` 或 :class:" +"`float` 的負數且指數為整數,則會得到一個浮點數的結果,例如 ``pow(-9, 2.0)`` " +"會回傳 ``81.0``。" -#: ../../library/functions.rst:1503 +#: ../../library/functions.rst:1568 msgid "" "For :class:`int` operands *base* and *exp*, if *mod* is present, *mod* must " "also be of integer type and *mod* must be nonzero. If *mod* is present and " @@ -2692,11 +2765,11 @@ msgstr "" "與 *mod* 互質。在這種情況下,會回傳 ``pow(inv_base, -exp, mod)``,其中 " "*inv_base* 是 *base* 對 *mod* 的模倒數 (inverse modulo)。" -#: ../../library/functions.rst:1509 +#: ../../library/functions.rst:1574 msgid "Here's an example of computing an inverse for ``38`` modulo ``97``::" msgstr "以下是一個計算 ``38`` 對 ``97`` 取模倒數的範例: ::" -#: ../../library/functions.rst:1511 +#: ../../library/functions.rst:1576 msgid "" ">>> pow(38, -1, mod=97)\n" "23\n" @@ -2708,7 +2781,7 @@ msgstr "" ">>> 23 * 38 % 97 == 1\n" "True" -#: ../../library/functions.rst:1516 +#: ../../library/functions.rst:1581 msgid "" "For :class:`int` operands, the three-argument form of ``pow`` now allows the " "second argument to be negative, permitting computation of modular inverses." @@ -2716,12 +2789,12 @@ msgstr "" "對於 :class:`int` 運算元,現在 ``pow`` 的三引數形式允許第二個引數為負數,也容" "許模倒數的計算。" -#: ../../library/functions.rst:1521 +#: ../../library/functions.rst:1586 msgid "" "Allow keyword arguments. Formerly, only positional arguments were supported." msgstr "允許關鍵字引數。在此之前只支援位置引數。" -#: ../../library/functions.rst:1528 +#: ../../library/functions.rst:1593 msgid "" "Print *objects* to the text stream *file*, separated by *sep* and followed " "by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as " @@ -2730,7 +2803,7 @@ msgstr "" "將 *objects* 列印到文字資料串流 *file*,用 *sep* 分隔並以 *end* 結尾。如果有" "給定 *sep*、*end*、*file* 和 *flush*,那麼它們必須是關鍵字引數的形式。" -#: ../../library/functions.rst:1532 +#: ../../library/functions.rst:1597 msgid "" "All non-keyword arguments are converted to strings like :func:`str` does and " "written to the stream, separated by *sep* and followed by *end*. Both *sep* " @@ -2743,7 +2816,7 @@ msgstr "" "以是 ``None``,這表示使用預設值。如果沒有給定 *objects*,:func:`print` 就只會" "寫入 *end*。" -#: ../../library/functions.rst:1538 +#: ../../library/functions.rst:1603 msgid "" "The *file* argument must be an object with a ``write(string)`` method; if it " "is not present or ``None``, :data:`sys.stdout` will be used. Since printed " @@ -2755,7 +2828,7 @@ msgstr "" "串,所以 :func:`print` 不能用於二進位模式的檔案物件。對於此類物件,請改用 " "``file.write(...)``。" -#: ../../library/functions.rst:1543 +#: ../../library/functions.rst:1608 msgid "" "Output buffering is usually determined by *file*. However, if *flush* is " "true, the stream is forcibly flushed." @@ -2763,15 +2836,15 @@ msgstr "" "輸出緩衝通常會由 *file* 決定。但是如果 *flush* 為 true,則資料串流會被強制清" "除。" -#: ../../library/functions.rst:1547 +#: ../../library/functions.rst:1612 msgid "Added the *flush* keyword argument." msgstr "增加了 *flush* 關鍵字引數。" -#: ../../library/functions.rst:1553 +#: ../../library/functions.rst:1618 msgid "Return a property attribute." msgstr "回傳 property 屬性。" -#: ../../library/functions.rst:1555 +#: ../../library/functions.rst:1620 msgid "" "*fget* is a function for getting an attribute value. *fset* is a function " "for setting an attribute value. *fdel* is a function for deleting an " @@ -2780,11 +2853,11 @@ msgstr "" "*fget* 是一個用於取得屬性值的函式,*fset* 是一個用於設定屬性值的函式,*fdel* " "是一個用於刪除屬性值的函式,而 *doc* 會為該屬性建立一個說明字串。" -#: ../../library/functions.rst:1559 +#: ../../library/functions.rst:1624 msgid "A typical use is to define a managed attribute ``x``::" msgstr "一個典型的用途是定義一個受管理的屬性 ``x``: ::" -#: ../../library/functions.rst:1561 +#: ../../library/functions.rst:1626 msgid "" "class C:\n" " def __init__(self):\n" @@ -2816,7 +2889,7 @@ msgstr "" "\n" " x = property(getx, setx, delx, \"I'm the 'x' property.\")" -#: ../../library/functions.rst:1576 +#: ../../library/functions.rst:1641 msgid "" "If *c* is an instance of *C*, ``c.x`` will invoke the getter, ``c.x = " "value`` will invoke the setter, and ``del c.x`` the deleter." @@ -2824,7 +2897,7 @@ msgstr "" "如果 *c* 是 *C* 的一個實例,則 ``c.x`` 將會呼叫取得器 (getter),``c.x = " "value`` 會呼叫設定器 (setter),而 ``del c.x`` 會呼叫刪除器 (deleter)。" -#: ../../library/functions.rst:1579 +#: ../../library/functions.rst:1644 msgid "" "If given, *doc* will be the docstring of the property attribute. Otherwise, " "the property will copy *fget*'s docstring (if it exists). This makes it " @@ -2835,7 +2908,7 @@ msgstr "" "*fget* 的說明字串(如果它存在的話)。這樣一來,就能夠輕鬆地使用 :func:" "`property` 作為\\ :term:`裝飾器 `\\ 來建立唯讀屬性: ::" -#: ../../library/functions.rst:1583 +#: ../../library/functions.rst:1648 msgid "" "class Parrot:\n" " def __init__(self):\n" @@ -2847,14 +2920,14 @@ msgid "" " return self._voltage" msgstr "" -#: ../../library/functions.rst:1592 +#: ../../library/functions.rst:1657 msgid "" "The ``@property`` decorator turns the :meth:`!voltage` method into a " "\"getter\" for a read-only attribute with the same name, and it sets the " "docstring for *voltage* to \"Get the current voltage.\"" msgstr "" -#: ../../library/functions.rst:1600 +#: ../../library/functions.rst:1665 msgid "" "A property object has ``getter``, ``setter``, and ``deleter`` methods usable " "as decorators that create a copy of the property with the corresponding " @@ -2862,7 +2935,7 @@ msgid "" "with an example:" msgstr "" -#: ../../library/functions.rst:1605 +#: ../../library/functions.rst:1670 msgid "" "class C:\n" " def __init__(self):\n" @@ -2898,30 +2971,36 @@ msgstr "" " def x(self):\n" " del self._x" -#: ../../library/functions.rst:1624 +#: ../../library/functions.rst:1689 msgid "" "This code is exactly equivalent to the first example. Be sure to give the " "additional functions the same name as the original property (``x`` in this " "case.)" msgstr "" -#: ../../library/functions.rst:1628 +#: ../../library/functions.rst:1693 msgid "" "The returned property object also has the attributes ``fget``, ``fset``, and " "``fdel`` corresponding to the constructor arguments." msgstr "" -#: ../../library/functions.rst:1631 +#: ../../library/functions.rst:1696 msgid "The docstrings of property objects are now writeable." msgstr "" -#: ../../library/functions.rst:1640 +#: ../../library/functions.rst:1701 +msgid "" +"Attribute holding the name of the property. The name of the property can be " +"changed at runtime." +msgstr "" + +#: ../../library/functions.rst:1712 msgid "" "Rather than being a function, :class:`range` is actually an immutable " "sequence type, as documented in :ref:`typesseq-range` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1646 +#: ../../library/functions.rst:1718 msgid "" "Return a string containing a printable representation of an object. For " "many types, this function makes an attempt to return a string that would " @@ -2934,11 +3013,11 @@ msgid "" "raise :exc:`RuntimeError`." msgstr "" -#: ../../library/functions.rst:1657 +#: ../../library/functions.rst:1729 msgid "This class has a custom representation that can be evaluated::" msgstr "" -#: ../../library/functions.rst:1659 +#: ../../library/functions.rst:1731 msgid "" "class Person:\n" " def __init__(self, name, age):\n" @@ -2956,7 +3035,7 @@ msgstr "" " def __repr__(self):\n" " return f\"Person('{self.name}', {self.age})\"" -#: ../../library/functions.rst:1670 +#: ../../library/functions.rst:1742 msgid "" "Return a reverse :term:`iterator`. *seq* must be an object which has a :" "meth:`~object.__reversed__` method or supports the sequence protocol (the :" @@ -2964,14 +3043,14 @@ msgid "" "with integer arguments starting at ``0``)." msgstr "" -#: ../../library/functions.rst:1678 +#: ../../library/functions.rst:1750 msgid "" "Return *number* rounded to *ndigits* precision after the decimal point. If " "*ndigits* is omitted or is ``None``, it returns the nearest integer to its " "input." msgstr "" -#: ../../library/functions.rst:1682 +#: ../../library/functions.rst:1754 msgid "" "For the built-in types supporting :func:`round`, values are rounded to the " "closest multiple of 10 to the power minus *ndigits*; if two multiples are " @@ -2982,13 +3061,13 @@ msgid "" "``None``. Otherwise, the return value has the same type as *number*." msgstr "" -#: ../../library/functions.rst:1691 +#: ../../library/functions.rst:1763 msgid "" "For a general Python object ``number``, ``round`` delegates to ``number." "__round__``." msgstr "" -#: ../../library/functions.rst:1696 +#: ../../library/functions.rst:1768 msgid "" "The behavior of :func:`round` for floats can be surprising: for example, " "``round(2.675, 2)`` gives ``2.67`` instead of the expected ``2.68``. This is " @@ -2997,21 +3076,21 @@ msgid "" "information." msgstr "" -#: ../../library/functions.rst:1708 +#: ../../library/functions.rst:1780 msgid "" "Return a new :class:`set` object, optionally with elements taken from " "*iterable*. ``set`` is a built-in class. See :class:`set` and :ref:`types-" "set` for documentation about this class." msgstr "" -#: ../../library/functions.rst:1712 +#: ../../library/functions.rst:1784 msgid "" "For other containers see the built-in :class:`frozenset`, :class:`list`, :" "class:`tuple`, and :class:`dict` classes, as well as the :mod:`collections` " "module." msgstr "" -#: ../../library/functions.rst:1719 +#: ../../library/functions.rst:1791 msgid "" "This is the counterpart of :func:`getattr`. The arguments are an object, a " "string, and an arbitrary value. The string may name an existing attribute " @@ -3020,7 +3099,7 @@ msgid "" "is equivalent to ``x.foobar = 123``." msgstr "" -#: ../../library/functions.rst:1725 +#: ../../library/functions.rst:1797 msgid "" "*name* need not be a Python identifier as defined in :ref:`identifiers` " "unless the object chooses to enforce that, for example in a custom :meth:" @@ -3029,21 +3108,21 @@ msgid "" "notation, but is accessible through :func:`getattr` etc.." msgstr "" -#: ../../library/functions.rst:1733 +#: ../../library/functions.rst:1805 msgid "" "Since :ref:`private name mangling ` happens at " "compilation time, one must manually mangle a private attribute's (attributes " "with two leading underscores) name in order to set it with :func:`setattr`." msgstr "" -#: ../../library/functions.rst:1742 +#: ../../library/functions.rst:1814 msgid "" "Return a :term:`slice` object representing the set of indices specified by " "``range(start, stop, step)``. The *start* and *step* arguments default to " "``None``." msgstr "" -#: ../../library/functions.rst:1750 +#: ../../library/functions.rst:1822 msgid "" "Slice objects have read-only data attributes :attr:`!start`, :attr:`!stop`, " "and :attr:`!step` which merely return the argument values (or their " @@ -3051,48 +3130,48 @@ msgid "" "by NumPy and other third-party packages." msgstr "" -#: ../../library/functions.rst:1755 +#: ../../library/functions.rst:1827 msgid "" "Slice objects are also generated when extended indexing syntax is used. For " "example: ``a[start:stop:step]`` or ``a[start:stop, i]``. See :func:" "`itertools.islice` for an alternate version that returns an :term:`iterator`." msgstr "" -#: ../../library/functions.rst:1760 +#: ../../library/functions.rst:1832 msgid "" "Slice objects are now :term:`hashable` (provided :attr:`~slice.start`, :attr:" "`~slice.stop`, and :attr:`~slice.step` are hashable)." msgstr "" -#: ../../library/functions.rst:1766 +#: ../../library/functions.rst:1838 msgid "Return a new sorted list from the items in *iterable*." msgstr "" -#: ../../library/functions.rst:1768 +#: ../../library/functions.rst:1840 msgid "" "Has two optional arguments which must be specified as keyword arguments." msgstr "有兩個選擇性引數,只能使用關鍵字引數來指定。" -#: ../../library/functions.rst:1770 +#: ../../library/functions.rst:1842 msgid "" "*key* specifies a function of one argument that is used to extract a " "comparison key from each element in *iterable* (for example, ``key=str." "lower``). The default value is ``None`` (compare the elements directly)." msgstr "" -#: ../../library/functions.rst:1774 +#: ../../library/functions.rst:1846 msgid "" "*reverse* is a boolean value. If set to ``True``, then the list elements " "are sorted as if each comparison were reversed." msgstr "" -#: ../../library/functions.rst:1777 +#: ../../library/functions.rst:1849 msgid "" "Use :func:`functools.cmp_to_key` to convert an old-style *cmp* function to a " "*key* function." msgstr "" -#: ../../library/functions.rst:1780 +#: ../../library/functions.rst:1852 msgid "" "The built-in :func:`sorted` function is guaranteed to be stable. A sort is " "stable if it guarantees not to change the relative order of elements that " @@ -3100,7 +3179,7 @@ msgid "" "example, sort by department, then by salary grade)." msgstr "" -#: ../../library/functions.rst:1785 +#: ../../library/functions.rst:1857 msgid "" "The sort algorithm uses only ``<`` comparisons between items. While " "defining an :meth:`~object.__lt__` method will suffice for sorting, :PEP:`8` " @@ -3112,22 +3191,22 @@ msgid "" "method." msgstr "" -#: ../../library/functions.rst:1794 +#: ../../library/functions.rst:1866 msgid "" "For sorting examples and a brief sorting tutorial, see :ref:`sortinghowto`." msgstr "" -#: ../../library/functions.rst:1798 +#: ../../library/functions.rst:1870 msgid "Transform a method into a static method." msgstr "" -#: ../../library/functions.rst:1800 +#: ../../library/functions.rst:1872 msgid "" "A static method does not receive an implicit first argument. To declare a " "static method, use this idiom::" msgstr "" -#: ../../library/functions.rst:1803 +#: ../../library/functions.rst:1875 msgid "" "class C:\n" " @staticmethod\n" @@ -3137,7 +3216,7 @@ msgstr "" " @staticmethod\n" " def f(arg1, arg2, argN): ..." -#: ../../library/functions.rst:1807 +#: ../../library/functions.rst:1879 msgid "" "The ``@staticmethod`` form is a function :term:`decorator` -- see :ref:" "`function` for details." @@ -3145,7 +3224,7 @@ msgstr "" "``@staticmethod`` 語法是一個函式 :term:`decorator` - 參見 :ref:`function` 中" "的詳細介紹。" -#: ../../library/functions.rst:1810 +#: ../../library/functions.rst:1882 msgid "" "A static method can be called either on the class (such as ``C.f()``) or on " "an instance (such as ``C().f()``). Moreover, the static method :term:" @@ -3153,14 +3232,14 @@ msgid "" "(such as ``f()``)." msgstr "" -#: ../../library/functions.rst:1815 +#: ../../library/functions.rst:1887 msgid "" "Static methods in Python are similar to those found in Java or C++. Also, " "see :func:`classmethod` for a variant that is useful for creating alternate " "class constructors." msgstr "" -#: ../../library/functions.rst:1819 +#: ../../library/functions.rst:1891 msgid "" "Like all decorators, it is also possible to call ``staticmethod`` as a " "regular function and do something with its result. This is needed in some " @@ -3169,7 +3248,7 @@ msgid "" "cases, use this idiom::" msgstr "" -#: ../../library/functions.rst:1825 +#: ../../library/functions.rst:1897 msgid "" "def regular_function():\n" " ...\n" @@ -3183,36 +3262,41 @@ msgstr "" "class C:\n" " method = staticmethod(regular_function)" -#: ../../library/functions.rst:1831 +#: ../../library/functions.rst:1903 msgid "For more information on static methods, see :ref:`types`." msgstr "關於 static method 的更多資訊,請參考 :ref:`types`。" -#: ../../library/functions.rst:1833 +#: ../../library/functions.rst:1905 msgid "" -"Static methods now inherit the method attributes (``__module__``, " -"``__name__``, ``__qualname__``, ``__doc__`` and ``__annotations__``), have a " -"new ``__wrapped__`` attribute, and are now callable as regular functions." +"Static methods now inherit the method attributes (:attr:`~function." +"__module__`, :attr:`~function.__name__`, :attr:`~function.__qualname__`, :" +"attr:`~function.__doc__` and :attr:`~function.__annotations__`), have a new " +"``__wrapped__`` attribute, and are now callable as regular functions." msgstr "" +"Static method 現在繼承了 method 屬性(:attr:`~function.__module__`、:attr:" +"`~function.__name__`、:attr:`~function.__qualname__`、:attr:`~function." +"__doc__` 和 :attr:`~function.__annotations__`),並擁有一個新的 " +"``__wrapped__`` 屬性,且為如一般函式的可呼叫物件。" -#: ../../library/functions.rst:1848 +#: ../../library/functions.rst:1921 msgid "" "Return a :class:`str` version of *object*. See :func:`str` for details." msgstr "" -#: ../../library/functions.rst:1850 +#: ../../library/functions.rst:1923 msgid "" "``str`` is the built-in string :term:`class`. For general information about " "strings, see :ref:`textseq`." msgstr "" -#: ../../library/functions.rst:1856 +#: ../../library/functions.rst:1929 msgid "" "Sums *start* and the items of an *iterable* from left to right and returns " "the total. The *iterable*'s items are normally numbers, and the start value " "is not allowed to be a string." msgstr "" -#: ../../library/functions.rst:1860 +#: ../../library/functions.rst:1933 msgid "" "For some use cases, there are good alternatives to :func:`sum`. The " "preferred, fast way to concatenate a sequence of strings is by calling ``''." @@ -3221,45 +3305,45 @@ msgid "" "using :func:`itertools.chain`." msgstr "" -#: ../../library/functions.rst:1866 +#: ../../library/functions.rst:1939 msgid "The *start* parameter can be specified as a keyword argument." msgstr "*start* 參數可被指定為關鍵字引數。" -#: ../../library/functions.rst:1869 +#: ../../library/functions.rst:1942 msgid "" -"Summation of floats switched to an algorithm that gives higher accuracy on " -"most builds." +"Summation of floats switched to an algorithm that gives higher accuracy and " +"better commutativity on most builds." msgstr "" -#: ../../library/functions.rst:1876 +#: ../../library/functions.rst:1949 msgid "" "Return a proxy object that delegates method calls to a parent or sibling " "class of *type*. This is useful for accessing inherited methods that have " "been overridden in a class." msgstr "" -#: ../../library/functions.rst:1880 +#: ../../library/functions.rst:1953 msgid "" "The *object_or_type* determines the :term:`method resolution order` to be " "searched. The search starts from the class right after the *type*." msgstr "" -#: ../../library/functions.rst:1884 +#: ../../library/functions.rst:1957 msgid "" -"For example, if :attr:`~class.__mro__` of *object_or_type* is ``D -> B -> C -" +"For example, if :attr:`~type.__mro__` of *object_or_type* is ``D -> B -> C -" "> A -> object`` and the value of *type* is ``B``, then :func:`super` " "searches ``C -> A -> object``." msgstr "" -#: ../../library/functions.rst:1888 +#: ../../library/functions.rst:1961 msgid "" -"The :attr:`~class.__mro__` attribute of the class corresponding to " +"The :attr:`~type.__mro__` attribute of the class corresponding to " "*object_or_type* lists the method resolution search order used by both :func:" "`getattr` and :func:`super`. The attribute is dynamic and can change " "whenever the inheritance hierarchy is updated." msgstr "" -#: ../../library/functions.rst:1893 +#: ../../library/functions.rst:1966 msgid "" "If the second argument is omitted, the super object returned is unbound. If " "the second argument is an object, ``isinstance(obj, type)`` must be true. " @@ -3267,7 +3351,17 @@ msgid "" "(this is useful for classmethods)." msgstr "" -#: ../../library/functions.rst:1898 +#: ../../library/functions.rst:1971 +msgid "" +"When called directly within an ordinary method of a class, both arguments " +"may be omitted (\"zero-argument :func:`!super`\"). In this case, *type* will " +"be the enclosing class, and *obj* will be the first argument of the " +"immediately enclosing function (typically ``self``). (This means that zero-" +"argument :func:`!super` will not work as expected within nested functions, " +"including generator expressions, which implicitly create nested functions.)" +msgstr "" + +#: ../../library/functions.rst:1978 msgid "" "There are two typical use cases for *super*. In a class hierarchy with " "single inheritance, *super* can be used to refer to parent classes without " @@ -3275,7 +3369,7 @@ msgid "" "closely parallels the use of *super* in other programming languages." msgstr "" -#: ../../library/functions.rst:1903 +#: ../../library/functions.rst:1983 msgid "" "The second use case is to support cooperative multiple inheritance in a " "dynamic execution environment. This use case is unique to Python and is not " @@ -3288,11 +3382,11 @@ msgid "" "classes that are unknown prior to runtime)." msgstr "" -#: ../../library/functions.rst:1913 +#: ../../library/functions.rst:1993 msgid "For both use cases, a typical superclass call looks like this::" msgstr "" -#: ../../library/functions.rst:1915 +#: ../../library/functions.rst:1995 msgid "" "class C(B):\n" " def method(self, arg):\n" @@ -3300,14 +3394,14 @@ msgid "" " # super(C, self).method(arg)" msgstr "" -#: ../../library/functions.rst:1920 +#: ../../library/functions.rst:2000 msgid "" "In addition to method lookups, :func:`super` also works for attribute " "lookups. One possible use case for this is calling :term:`descriptors " "` in a parent or sibling class." msgstr "" -#: ../../library/functions.rst:1924 +#: ../../library/functions.rst:2004 msgid "" "Note that :func:`super` is implemented as part of the binding process for " "explicit dotted attribute lookups such as ``super().__getitem__(name)``. It " @@ -3317,7 +3411,7 @@ msgid "" "using statements or operators such as ``super()[name]``." msgstr "" -#: ../../library/functions.rst:1932 +#: ../../library/functions.rst:2012 msgid "" "Also note that, aside from the zero argument form, :func:`super` is not " "limited to use inside methods. The two argument form specifies the " @@ -3327,50 +3421,60 @@ msgid "" "accessing the current instance for ordinary methods." msgstr "" -#: ../../library/functions.rst:1939 +#: ../../library/functions.rst:2019 msgid "" "For practical suggestions on how to design cooperative classes using :func:" "`super`, see `guide to using super() `_." msgstr "" -#: ../../library/functions.rst:1949 +#: ../../library/functions.rst:2029 msgid "" "Rather than being a function, :class:`tuple` is actually an immutable " "sequence type, as documented in :ref:`typesseq-tuple` and :ref:`typesseq`." msgstr "" -#: ../../library/functions.rst:1958 +#: ../../library/functions.rst:2038 msgid "" "With one argument, return the type of an *object*. The return value is a " "type object and generally the same object as returned by :attr:`object." -"__class__ `." +"__class__`." msgstr "" -#: ../../library/functions.rst:1962 +#: ../../library/functions.rst:2042 msgid "" "The :func:`isinstance` built-in function is recommended for testing the type " "of an object, because it takes subclasses into account." msgstr "" -#: ../../library/functions.rst:1966 +#: ../../library/functions.rst:2045 msgid "" "With three arguments, return a new type object. This is essentially a " "dynamic form of the :keyword:`class` statement. The *name* string is the " -"class name and becomes the :attr:`~definition.__name__` attribute. The " -"*bases* tuple contains the base classes and becomes the :attr:`~class." -"__bases__` attribute; if empty, :class:`object`, the ultimate base of all " -"classes, is added. The *dict* dictionary contains attribute and method " -"definitions for the class body; it may be copied or wrapped before becoming " -"the :attr:`~object.__dict__` attribute. The following two statements create " -"identical :class:`type` objects:" +"class name and becomes the :attr:`~type.__name__` attribute. The *bases* " +"tuple contains the base classes and becomes the :attr:`~type.__bases__` " +"attribute; if empty, :class:`object`, the ultimate base of all classes, is " +"added. The *dict* dictionary contains attribute and method definitions for " +"the class body; it may be copied or wrapped before becoming the :attr:`~type." +"__dict__` attribute. The following two statements create identical :class:`!" +"type` objects:" +msgstr "" + +#: ../../library/functions.rst:2060 +msgid "See also:" msgstr "" -#: ../../library/functions.rst:1981 -msgid "See also :ref:`bltin-type-objects`." -msgstr "另請參閱 :ref:`bltin-type-objects`。" +#: ../../library/functions.rst:2062 +msgid "" +":ref:`Documentation on attributes and methods on classes `." +msgstr "" -#: ../../library/functions.rst:1983 +#: ../../library/functions.rst:2063 +msgid ":ref:`bltin-type-objects`" +msgstr ":ref:`bltin-type-objects`" + +#: ../../library/functions.rst:2065 msgid "" "Keyword arguments provided to the three argument form are passed to the " "appropriate metaclass machinery (usually :meth:`~object.__init_subclass__`) " @@ -3378,55 +3482,58 @@ msgid "" "would." msgstr "" -#: ../../library/functions.rst:1988 +#: ../../library/functions.rst:2070 msgid "See also :ref:`class-customization`." msgstr "另請參閱 :ref:`class-customization`。" -#: ../../library/functions.rst:1990 +#: ../../library/functions.rst:2072 msgid "" -"Subclasses of :class:`type` which don't override ``type.__new__`` may no " +"Subclasses of :class:`!type` which don't override ``type.__new__`` may no " "longer use the one-argument form to get the type of an object." msgstr "" -#: ../../library/functions.rst:1997 +#: ../../library/functions.rst:2079 msgid "" "Return the :attr:`~object.__dict__` attribute for a module, class, instance, " -"or any other object with a :attr:`~object.__dict__` attribute." +"or any other object with a :attr:`!__dict__` attribute." msgstr "" -#: ../../library/functions.rst:2000 +#: ../../library/functions.rst:2082 msgid "" "Objects such as modules and instances have an updateable :attr:`~object." "__dict__` attribute; however, other objects may have write restrictions on " -"their :attr:`~object.__dict__` attributes (for example, classes use a :class:" -"`types.MappingProxyType` to prevent direct dictionary updates)." +"their :attr:`!__dict__` attributes (for example, classes use a :class:`types." +"MappingProxyType` to prevent direct dictionary updates)." msgstr "" -#: ../../library/functions.rst:2005 -msgid "" -"Without an argument, :func:`vars` acts like :func:`locals`. Note, the " -"locals dictionary is only useful for reads since updates to the locals " -"dictionary are ignored." +#: ../../library/functions.rst:2087 +msgid "Without an argument, :func:`vars` acts like :func:`locals`." msgstr "" -#: ../../library/functions.rst:2009 +#: ../../library/functions.rst:2089 msgid "" "A :exc:`TypeError` exception is raised if an object is specified but it " "doesn't have a :attr:`~object.__dict__` attribute (for example, if its class " "defines the :attr:`~object.__slots__` attribute)." msgstr "" -#: ../../library/functions.rst:2015 +#: ../../library/functions.rst:2095 +msgid "" +"The result of calling this function without an argument has been updated as " +"described for the :func:`locals` builtin." +msgstr "" + +#: ../../library/functions.rst:2101 msgid "" "Iterate over several iterables in parallel, producing tuples with an item " "from each one." msgstr "" -#: ../../library/functions.rst:2018 +#: ../../library/functions.rst:2104 msgid "Example::" msgstr "例如: ::" -#: ../../library/functions.rst:2020 +#: ../../library/functions.rst:2106 msgid "" ">>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):\n" "... print(item)\n" @@ -3442,27 +3549,27 @@ msgstr "" "(2, 'spice')\n" "(3, 'everything nice')" -#: ../../library/functions.rst:2027 +#: ../../library/functions.rst:2113 msgid "" "More formally: :func:`zip` returns an iterator of tuples, where the *i*-th " "tuple contains the *i*-th element from each of the argument iterables." msgstr "" -#: ../../library/functions.rst:2030 +#: ../../library/functions.rst:2116 msgid "" "Another way to think of :func:`zip` is that it turns rows into columns, and " "columns into rows. This is similar to `transposing a matrix `_." msgstr "" -#: ../../library/functions.rst:2034 +#: ../../library/functions.rst:2120 msgid "" ":func:`zip` is lazy: The elements won't be processed until the iterable is " "iterated on, e.g. by a :keyword:`!for` loop or by wrapping in a :class:" "`list`." msgstr "" -#: ../../library/functions.rst:2038 +#: ../../library/functions.rst:2124 msgid "" "One thing to consider is that the iterables passed to :func:`zip` could have " "different lengths; sometimes by design, and sometimes because of a bug in " @@ -3470,14 +3577,14 @@ msgid "" "approaches to dealing with this issue:" msgstr "" -#: ../../library/functions.rst:2043 +#: ../../library/functions.rst:2129 msgid "" "By default, :func:`zip` stops when the shortest iterable is exhausted. It " "will ignore the remaining items in the longer iterables, cutting off the " "result to the length of the shortest iterable::" msgstr "" -#: ../../library/functions.rst:2047 +#: ../../library/functions.rst:2133 msgid "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" @@ -3485,14 +3592,14 @@ msgstr "" ">>> list(zip(range(3), ['fee', 'fi', 'fo', 'fum']))\n" "[(0, 'fee'), (1, 'fi'), (2, 'fo')]" -#: ../../library/functions.rst:2050 +#: ../../library/functions.rst:2136 msgid "" ":func:`zip` is often used in cases where the iterables are assumed to be of " "equal length. In such cases, it's recommended to use the ``strict=True`` " "option. Its output is the same as regular :func:`zip`::" msgstr "" -#: ../../library/functions.rst:2054 +#: ../../library/functions.rst:2140 msgid "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" @@ -3500,37 +3607,37 @@ msgstr "" ">>> list(zip(('a', 'b', 'c'), (1, 2, 3), strict=True))\n" "[('a', 1), ('b', 2), ('c', 3)]" -#: ../../library/functions.rst:2057 +#: ../../library/functions.rst:2143 msgid "" "Unlike the default behavior, it raises a :exc:`ValueError` if one iterable " "is exhausted before the others:" msgstr "" -#: ../../library/functions.rst:2075 +#: ../../library/functions.rst:2161 msgid "" "Without the ``strict=True`` argument, any bug that results in iterables of " "different lengths will be silenced, possibly manifesting as a hard-to-find " "bug in another part of the program." msgstr "" -#: ../../library/functions.rst:2079 +#: ../../library/functions.rst:2165 msgid "" "Shorter iterables can be padded with a constant value to make all the " "iterables have the same length. This is done by :func:`itertools." "zip_longest`." msgstr "" -#: ../../library/functions.rst:2083 +#: ../../library/functions.rst:2169 msgid "" "Edge cases: With a single iterable argument, :func:`zip` returns an iterator " "of 1-tuples. With no arguments, it returns an empty iterator." msgstr "" -#: ../../library/functions.rst:2086 +#: ../../library/functions.rst:2172 msgid "Tips and tricks:" msgstr "" -#: ../../library/functions.rst:2088 +#: ../../library/functions.rst:2174 msgid "" "The left-to-right evaluation order of the iterables is guaranteed. This " "makes possible an idiom for clustering a data series into n-length groups " @@ -3539,13 +3646,13 @@ msgid "" "iterator. This has the effect of dividing the input into n-length chunks." msgstr "" -#: ../../library/functions.rst:2094 +#: ../../library/functions.rst:2180 msgid "" ":func:`zip` in conjunction with the ``*`` operator can be used to unzip a " "list::" msgstr "" -#: ../../library/functions.rst:2097 +#: ../../library/functions.rst:2183 msgid "" ">>> x = [1, 2, 3]\n" ">>> y = [4, 5, 6]\n" @@ -3563,17 +3670,17 @@ msgstr "" ">>> x == list(x2) and y == list(y2)\n" "True" -#: ../../library/functions.rst:2105 +#: ../../library/functions.rst:2191 msgid "Added the ``strict`` argument." msgstr "增加了 ``strict`` 引數。" -#: ../../library/functions.rst:2117 +#: ../../library/functions.rst:2203 msgid "" "This is an advanced function that is not needed in everyday Python " "programming, unlike :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2120 +#: ../../library/functions.rst:2206 msgid "" "This function is invoked by the :keyword:`import` statement. It can be " "replaced (by importing the :mod:`builtins` module and assigning to " @@ -3585,7 +3692,7 @@ msgid "" "discouraged in favor of :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2129 +#: ../../library/functions.rst:2215 msgid "" "The function imports the module *name*, potentially using the given " "*globals* and *locals* to determine how to interpret the name in a package " @@ -3595,7 +3702,7 @@ msgid "" "determine the package context of the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2136 +#: ../../library/functions.rst:2222 msgid "" "*level* specifies whether to use absolute or relative imports. ``0`` (the " "default) means only perform absolute imports. Positive values for *level* " @@ -3604,7 +3711,7 @@ msgid "" "details)." msgstr "" -#: ../../library/functions.rst:2142 +#: ../../library/functions.rst:2228 msgid "" "When the *name* variable is of the form ``package.module``, normally, the " "top-level package (the name up till the first dot) is returned, *not* the " @@ -3612,37 +3719,37 @@ msgid "" "given, the module named by *name* is returned." msgstr "" -#: ../../library/functions.rst:2147 +#: ../../library/functions.rst:2233 msgid "" "For example, the statement ``import spam`` results in bytecode resembling " "the following code::" msgstr "" -#: ../../library/functions.rst:2150 +#: ../../library/functions.rst:2236 msgid "spam = __import__('spam', globals(), locals(), [], 0)" msgstr "spam = __import__('spam', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2152 +#: ../../library/functions.rst:2238 msgid "The statement ``import spam.ham`` results in this call::" msgstr "" -#: ../../library/functions.rst:2154 +#: ../../library/functions.rst:2240 msgid "spam = __import__('spam.ham', globals(), locals(), [], 0)" msgstr "spam = __import__('spam.ham', globals(), locals(), [], 0)" -#: ../../library/functions.rst:2156 +#: ../../library/functions.rst:2242 msgid "" "Note how :func:`__import__` returns the toplevel module here because this is " "the object that is bound to a name by the :keyword:`import` statement." msgstr "" -#: ../../library/functions.rst:2159 +#: ../../library/functions.rst:2245 msgid "" "On the other hand, the statement ``from spam.ham import eggs, sausage as " "saus`` results in ::" msgstr "" -#: ../../library/functions.rst:2162 +#: ../../library/functions.rst:2248 msgid "" "_temp = __import__('spam.ham', globals(), locals(), ['eggs', 'sausage'], 0)\n" "eggs = _temp.eggs\n" @@ -3652,36 +3759,36 @@ msgstr "" "eggs = _temp.eggs\n" "saus = _temp.sausage" -#: ../../library/functions.rst:2166 +#: ../../library/functions.rst:2252 msgid "" "Here, the ``spam.ham`` module is returned from :func:`__import__`. From " "this object, the names to import are retrieved and assigned to their " "respective names." msgstr "" -#: ../../library/functions.rst:2170 +#: ../../library/functions.rst:2256 msgid "" "If you simply want to import a module (potentially within a package) by " "name, use :func:`importlib.import_module`." msgstr "" -#: ../../library/functions.rst:2173 +#: ../../library/functions.rst:2259 msgid "" "Negative values for *level* are no longer supported (which also changes the " "default value to 0)." msgstr "" -#: ../../library/functions.rst:2177 +#: ../../library/functions.rst:2263 msgid "" "When the command line options :option:`-E` or :option:`-I` are being used, " "the environment variable :envvar:`PYTHONCASEOK` is now ignored." msgstr "" -#: ../../library/functions.rst:2182 +#: ../../library/functions.rst:2268 msgid "Footnotes" msgstr "註解" -#: ../../library/functions.rst:2183 +#: ../../library/functions.rst:2269 msgid "" "Note that the parser only accepts the Unix-style end of line convention. If " "you are reading the code from a file, make sure to use newline conversion " @@ -3694,106 +3801,132 @@ msgstr "" msgid "Boolean" msgstr "Boolean(布林值)" -#: ../../library/functions.rst:154 ../../library/functions.rst:1956 +#: ../../library/functions.rst:154 ../../library/functions.rst:2036 msgid "type" msgstr "type(型別)" -#: ../../library/functions.rst:631 +#: ../../library/functions.rst:643 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../library/functions.rst:631 +#: ../../library/functions.rst:643 msgid "exec" msgstr "exec" -#: ../../library/functions.rst:713 +#: ../../library/functions.rst:735 msgid "NaN" msgstr "NaN" -#: ../../library/functions.rst:713 +#: ../../library/functions.rst:735 msgid "Infinity" msgstr "Infinity(無窮)" -#: ../../library/functions.rst:781 +#: ../../library/functions.rst:803 msgid "__format__" msgstr "__format__" -#: ../../library/functions.rst:781 ../../library/functions.rst:1840 +#: ../../library/functions.rst:803 ../../library/functions.rst:1913 msgid "string" msgstr "string(字串)" -#: ../../library/functions.rst:781 +#: ../../library/functions.rst:803 msgid "format() (built-in function)" msgstr "format()(內建函式)" -#: ../../library/functions.rst:1248 +#: ../../library/functions.rst:1313 msgid "file object" msgstr "file object(檔案物件)" -#: ../../library/functions.rst:1248 ../../library/functions.rst:1369 +#: ../../library/functions.rst:1313 ../../library/functions.rst:1434 msgid "open() built-in function" msgstr "open() 內建函式" -#: ../../library/functions.rst:1276 +#: ../../library/functions.rst:1341 msgid "file" msgstr "file(檔案)" -#: ../../library/functions.rst:1276 +#: ../../library/functions.rst:1341 msgid "modes" msgstr "modes(模式)" -#: ../../library/functions.rst:1369 +#: ../../library/functions.rst:1434 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1495 msgid "line-buffered I/O" msgstr "line-buffered I/O(行緩衝 I/O)" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1495 msgid "unbuffered I/O" msgstr "unbuffered I/O(非緩衝 I/O)" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1495 msgid "buffer size, I/O" msgstr "buffer size, I/O(緩衝區大小、I/O)" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1495 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1495 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1495 msgid "text mode" msgstr "text mode(文字模式)" -#: ../../library/functions.rst:1430 ../../library/functions.rst:2111 +#: ../../library/functions.rst:1495 ../../library/functions.rst:2197 msgid "module" msgstr "module(模組)" -#: ../../library/functions.rst:1430 +#: ../../library/functions.rst:1495 msgid "sys" msgstr "sys" -#: ../../library/functions.rst:1840 +#: ../../library/functions.rst:1913 msgid "str() (built-in function)" msgstr "str() (內建函式)" -#: ../../library/functions.rst:1956 +#: ../../library/functions.rst:2036 msgid "object" msgstr "object(物件)" -#: ../../library/functions.rst:2111 +#: ../../library/functions.rst:2197 msgid "statement" msgstr "statement(陳述式)" -#: ../../library/functions.rst:2111 +#: ../../library/functions.rst:2197 msgid "import" msgstr "import(引入)" -#: ../../library/functions.rst:2111 +#: ../../library/functions.rst:2197 msgid "builtins" msgstr "builtins(內建)" + +#~ msgid "" +#~ "Most users should just pass a *globals* argument and never *locals*. If " +#~ "exec gets two separate objects as *globals* and *locals*, the code will " +#~ "be executed as if it were embedded in a class definition." +#~ msgstr "" +#~ "大部分使用者只需要傳入 *globals* 引數,而不用傳遞 *locals*。如果 exec 有" +#~ "兩個不同的 *globals* 和 *locals* 物件,程式碼就像嵌入在 class 定義中一樣執" +#~ "行。" + +#~ msgid "" +#~ "Update and return a dictionary representing the current local symbol " +#~ "table. Free variables are returned by :func:`locals` when it is called in " +#~ "function blocks, but not in class blocks. Note that at the module level, :" +#~ "func:`locals` and :func:`globals` are the same dictionary." +#~ msgstr "" +#~ "更新並回傳表示當前本地符號表的 dictionary。在函式區塊而不是 class 區塊中呼" +#~ "叫 :func:`locals` 時會回傳自由變數。請注意,在 module 階層中,:func:" +#~ "`locals` 和 :func:`globals` 是相同的 dictionary。" + +#~ msgid "" +#~ "The contents of this dictionary should not be modified; changes may not " +#~ "affect the values of local and free variables used by the interpreter." +#~ msgstr "" +#~ "此 dictionary 的內容不應該被更動;更改可能不會影響直譯器使用的本地變數或自" +#~ "由變數的值。" diff --git a/library/functools.po b/library/functools.po index 8fc6a31c22..af426e5f3d 100644 --- a/library/functools.po +++ b/library/functools.po @@ -5,9 +5,9 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2024-05-11 16:02+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -696,17 +696,17 @@ msgid "" "example, ``reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])`` calculates " "``((((1+2)+3)+4)+5)``. The left argument, *x*, is the accumulated value and " "the right argument, *y*, is the update value from the *iterable*. If the " -"optional *initializer* is present, it is placed before the items of the " -"iterable in the calculation, and serves as a default when the iterable is " -"empty. If *initializer* is not given and *iterable* contains only one item, " -"the first item is returned." +"optional *initial* is present, it is placed before the items of the iterable " +"in the calculation, and serves as a default when the iterable is empty. If " +"*initial* is not given and *iterable* contains only one item, the first item " +"is returned." msgstr "" "從左到右,將兩個引數的 *function* 累加運用到 *iterable* 的項目上,從而將可疊" "代物件減少為單一值。例如,``reduce(lambda x, y: x+y, [1, 2, 3, 4, 5])`` 會計" "算出 ``((((1+2)+3)+4)+5)``。左邊的引數 *x* 是累積值,右邊的引數 *y* 是來自 " -"*iterable* 的更新值。如果可選的 *initializer* 存在,則在計算中會將其放置在可" -"疊代物件的項目之前,並在可疊代物件為空時作為預設值。如果未給定 *initializer* " -"且 *iterable* 僅包含一個項目,則回傳第一個項目。" +"*iterable* 的更新值。如果可選的 *initial* 存在,則在計算中會將其放置在可疊代" +"物件的項目之前,並在可疊代物件為空時作為預設值。如果未給定 *initial* 且 " +"*iterable* 僅包含一個項目,則回傳第一個項目。" #: ../../library/functools.rst:417 msgid "Roughly equivalent to::" @@ -714,27 +714,31 @@ msgstr "大致相當於: ::" #: ../../library/functools.rst:419 msgid "" -"def reduce(function, iterable, initializer=None):\n" +"initial_missing = object()\n" +"\n" +"def reduce(function, iterable, initial=initial_missing, /):\n" " it = iter(iterable)\n" -" if initializer is None:\n" +" if initial is initial_missing:\n" " value = next(it)\n" " else:\n" -" value = initializer\n" +" value = initial\n" " for element in it:\n" " value = function(value, element)\n" " return value" msgstr "" -"def reduce(function, iterable, initializer=None):\n" +"initial_missing = object()\n" +"\n" +"def reduce(function, iterable, initial=initial_missing, /):\n" " it = iter(iterable)\n" -" if initializer is None:\n" +" if initial is initial_missing:\n" " value = next(it)\n" " else:\n" -" value = initializer\n" +" value = initial\n" " for element in it:\n" " value = function(value, element)\n" " return value" -#: ../../library/functools.rst:429 +#: ../../library/functools.rst:431 msgid "" "See :func:`itertools.accumulate` for an iterator that yields all " "intermediate values." @@ -742,7 +746,7 @@ msgstr "" "請參閱 :func:`itertools.accumulate` 以了解產生 (yield) 所有中間值 " "(intermediate value) 的疊代器。" -#: ../../library/functools.rst:434 +#: ../../library/functools.rst:436 msgid "" "Transform a function into a :term:`single-dispatch ` :term:" "`generic function`." @@ -750,7 +754,7 @@ msgstr "" "將函式轉換為\\ :term:`單一調度 `\\ :term:`泛型函式 `。" -#: ../../library/functools.rst:437 +#: ../../library/functools.rst:439 msgid "" "To define a generic function, decorate it with the ``@singledispatch`` " "decorator. When defining a function using ``@singledispatch``, note that the " @@ -760,7 +764,7 @@ msgstr "" "``@singledispatch`` 定義函式時,分派調度 (dispatch) 是發生在第一個引數的型別" "上: ::" -#: ../../library/functools.rst:441 +#: ../../library/functools.rst:443 msgid "" ">>> from functools import singledispatch\n" ">>> @singledispatch\n" @@ -776,7 +780,7 @@ msgstr "" "... print(\"Let me just say,\", end=\" \")\n" "... print(arg)" -#: ../../library/functools.rst:448 +#: ../../library/functools.rst:450 msgid "" "To add overloaded implementations to the function, use the :func:`register` " "attribute of the generic function, which can be used as a decorator. For " @@ -786,7 +790,7 @@ msgstr "" "若要為函式新增過載實作,請使用泛型函式的 :func:`register` 屬性,該屬性可用作" "裝飾器。對於以型別來註釋的函式,裝飾器將自動推斷第一個引數的型別: ::" -#: ../../library/functools.rst:453 +#: ../../library/functools.rst:455 msgid "" ">>> @fun.register\n" "... def _(arg: int, verbose=False):\n" @@ -814,11 +818,11 @@ msgstr "" "... for i, elem in enumerate(arg):\n" "... print(i, elem)" -#: ../../library/functools.rst:466 +#: ../../library/functools.rst:468 msgid ":data:`types.UnionType` and :data:`typing.Union` can also be used::" msgstr "也可以使用 :data:`types.UnionType` 和 :data:`typing.Union`: ::" -#: ../../library/functools.rst:468 +#: ../../library/functools.rst:470 msgid "" ">>> @fun.register\n" "... def _(arg: int | float, verbose=False):\n" @@ -850,14 +854,14 @@ msgstr "" "... print(i, elem)\n" "..." -#: ../../library/functools.rst:483 +#: ../../library/functools.rst:485 msgid "" "For code which doesn't use type annotations, the appropriate type argument " "can be passed explicitly to the decorator itself::" msgstr "" "對於不使用型別註釋的程式碼,可以將適當的型別引數明確傳遞給裝飾器本身: ::" -#: ../../library/functools.rst:486 +#: ../../library/functools.rst:488 msgid "" ">>> @fun.register(complex)\n" "... def _(arg, verbose=False):\n" @@ -873,7 +877,39 @@ msgstr "" "... print(arg.real, arg.imag)\n" "..." -#: ../../library/functools.rst:494 +#: ../../library/functools.rst:495 +msgid "" +"For code that dispatches on a collections type (e.g., ``list``), but wants " +"to typehint the items of the collection (e.g., ``list[int]``), the dispatch " +"type should be passed explicitly to the decorator itself with the typehint " +"going into the function definition::" +msgstr "" + +#: ../../library/functools.rst:500 +msgid "" +">>> @fun.register(list)\n" +"... def _(arg: list[int], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)" +msgstr "" +">>> @fun.register(list)\n" +"... def _(arg: list[int], verbose=False):\n" +"... if verbose:\n" +"... print(\"Enumerate this:\")\n" +"... for i, elem in enumerate(arg):\n" +"... print(i, elem)" + +#: ../../library/functools.rst:509 +msgid "" +"At runtime the function will dispatch on an instance of a list regardless of " +"the type contained within the list i.e. ``[1,2,3]`` will be dispatched the " +"same as ``[\"foo\", \"bar\", \"baz\"]``. The annotation provided in this " +"example is for static type checkers only and has no runtime impact." +msgstr "" + +#: ../../library/functools.rst:515 msgid "" "To enable registering :term:`lambdas` and pre-existing functions, " "the :func:`register` attribute can also be used in a functional form::" @@ -881,7 +917,7 @@ msgstr "" "若要啟用註冊 :term:`lambdas` 和預先存在的函式,:func:`register` 屬性" "也能以函式形式使用: ::" -#: ../../library/functools.rst:497 +#: ../../library/functools.rst:518 msgid "" ">>> def nothing(arg, verbose=False):\n" "... print(\"Nothing.\")\n" @@ -893,7 +929,7 @@ msgstr "" "...\n" ">>> fun.register(type(None), nothing)" -#: ../../library/functools.rst:502 +#: ../../library/functools.rst:523 msgid "" "The :func:`register` attribute returns the undecorated function. This " "enables decorator stacking, :mod:`pickling`, and the creation of " @@ -902,7 +938,7 @@ msgstr "" ":func:`register` 屬性回傳未加裝飾器的函式。這讓使得裝飾器堆疊 (decorator " "stacking)、:mod:`pickling` 以及為每個變體獨立建立單元測試成為可能:" -#: ../../library/functools.rst:506 +#: ../../library/functools.rst:527 msgid "" ">>> @fun.register(float)\n" "... @fun.register(Decimal)\n" @@ -924,13 +960,13 @@ msgstr "" ">>> fun_num is fun\n" "False" -#: ../../library/functools.rst:516 +#: ../../library/functools.rst:537 msgid "" "When called, the generic function dispatches on the type of the first " "argument::" msgstr "呼叫時,泛型函式會分派第一個引數的型別: ::" -#: ../../library/functools.rst:519 +#: ../../library/functools.rst:540 msgid "" ">>> fun(\"Hello, world.\")\n" "Hello, world.\n" @@ -966,7 +1002,7 @@ msgstr "" ">>> fun(1.23)\n" "0.615" -#: ../../library/functools.rst:536 +#: ../../library/functools.rst:557 msgid "" "Where there is no registered implementation for a specific type, its method " "resolution order is used to find a more generic implementation. The original " @@ -978,7 +1014,7 @@ msgstr "" "尋找更通用的實作。用 ``@singledispatch`` 裝飾的原始函式是為基底 :class:" "`object` 型別註冊的,這意味著如果沒有找到更好的實作就會使用它。" -#: ../../library/functools.rst:542 +#: ../../library/functools.rst:563 msgid "" "If an implementation is registered to an :term:`abstract base class`, " "virtual subclasses of the base class will be dispatched to that " @@ -987,7 +1023,7 @@ msgstr "" "如果一個實作有被註冊到一個\\ :term:`抽象基底類別 `,則基" "底類別的虛擬子類別將被分派到該實作: ::" -#: ../../library/functools.rst:546 +#: ../../library/functools.rst:567 msgid "" ">>> from collections.abc import Mapping\n" ">>> @fun.register\n" @@ -1011,14 +1047,14 @@ msgstr "" ">>> fun({\"a\": \"b\"})\n" "a => b" -#: ../../library/functools.rst:557 +#: ../../library/functools.rst:578 msgid "" "To check which implementation the generic function will choose for a given " "type, use the ``dispatch()`` attribute::" msgstr "" "若要檢查泛型函式將為給定型別選擇哪種實作,請使用 ``dispatch()`` 屬性: ::" -#: ../../library/functools.rst:560 +#: ../../library/functools.rst:581 msgid "" ">>> fun.dispatch(float)\n" "\n" @@ -1026,13 +1062,13 @@ msgid "" "" msgstr "" -#: ../../library/functools.rst:565 +#: ../../library/functools.rst:586 msgid "" "To access all registered implementations, use the read-only ``registry`` " "attribute::" msgstr "若要存取所有已註冊的實作,請使用唯讀 ``registry`` 屬性: ::" -#: ../../library/functools.rst:568 +#: ../../library/functools.rst:589 msgid "" ">>> fun.registry.keys()\n" "dict_keys([, , ,\n" @@ -1052,11 +1088,11 @@ msgstr "" ">>> fun.registry[object]\n" "" -#: ../../library/functools.rst:579 +#: ../../library/functools.rst:600 msgid "The :func:`register` attribute now supports using type annotations." msgstr ":func:`register` 屬性現在支援使用型別註釋。" -#: ../../library/functools.rst:582 +#: ../../library/functools.rst:603 msgid "" "The :func:`register` attribute now supports :data:`types.UnionType` and :" "data:`typing.Union` as type annotations." @@ -1064,7 +1100,7 @@ msgstr "" ":func:`register` 屬性現在支援以 :data:`types.UnionType` 和 :data:`typing." "Union` 作為型別註釋。" -#: ../../library/functools.rst:589 +#: ../../library/functools.rst:610 msgid "" "Transform a method into a :term:`single-dispatch ` :term:" "`generic function`." @@ -1072,7 +1108,7 @@ msgstr "" "將方法轉換為\\ :term:`單一調度 `\\ :term:`泛型函式 `。" -#: ../../library/functools.rst:592 +#: ../../library/functools.rst:613 msgid "" "To define a generic method, decorate it with the ``@singledispatchmethod`` " "decorator. When defining a function using ``@singledispatchmethod``, note " @@ -1083,7 +1119,7 @@ msgstr "" "用 ``@singledispatchmethod`` 定義函式時,分派調度是發生在第一個非 *self* 或" "非 *cls* 引數的型別上: ::" -#: ../../library/functools.rst:597 +#: ../../library/functools.rst:618 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -1111,7 +1147,7 @@ msgstr "" " def _(self, arg: bool):\n" " return not arg" -#: ../../library/functools.rst:610 +#: ../../library/functools.rst:631 msgid "" "``@singledispatchmethod`` supports nesting with other decorators such as :" "func:`@classmethod`. Note that to allow for ``dispatcher." @@ -1124,7 +1160,7 @@ msgstr "" "``singledispatchmethod`` 必須是\\ *最外面的*\\ 裝飾器。以下範例是 " "``Negator`` 類別,其 ``neg`` 方法繫結到該類別,而不是該類別的實例: ::" -#: ../../library/functools.rst:616 +#: ../../library/functools.rst:637 msgid "" "class Negator:\n" " @singledispatchmethod\n" @@ -1158,7 +1194,7 @@ msgstr "" " def _(cls, arg: bool):\n" " return not arg" -#: ../../library/functools.rst:632 +#: ../../library/functools.rst:653 msgid "" "The same pattern can be used for other similar decorators: :func:" "`@staticmethod`, :func:`@abstractmethod`, " @@ -1167,7 +1203,7 @@ msgstr "" "相同的模式可用於其他類似的裝飾器::func:`@staticmethod`、:func:" "`@abstractmethod` 等。" -#: ../../library/functools.rst:641 +#: ../../library/functools.rst:662 msgid "" "Update a *wrapper* function to look like the *wrapped* function. The " "optional arguments are tuples to specify which attributes of the original " @@ -1175,19 +1211,23 @@ msgid "" "function and which attributes of the wrapper function are updated with the " "corresponding attributes from the original function. The default values for " "these arguments are the module level constants ``WRAPPER_ASSIGNMENTS`` " -"(which assigns to the wrapper function's ``__module__``, ``__name__``, " -"``__qualname__``, ``__annotations__``, ``__type_params__``, and ``__doc__``, " -"the documentation string) and ``WRAPPER_UPDATES`` (which updates the wrapper " -"function's ``__dict__``, i.e. the instance dictionary)." +"(which assigns to the wrapper function's :attr:`~function.__module__`, :attr:" +"`~function.__name__`, :attr:`~function.__qualname__`, :attr:`~function." +"__annotations__`, :attr:`~function.__type_params__`, and :attr:`~function." +"__doc__`, the documentation string) and ``WRAPPER_UPDATES`` (which updates " +"the wrapper function's :attr:`~function.__dict__`, i.e. the instance " +"dictionary)." msgstr "" "更新 *wrapper* 函式,使其看起來像 *wrapped* 函式。可選引數是元組,用於指定原" "始函式的哪些屬性直接賦值給包裝函式上的匹配屬性,以及包裝函式的哪些屬性使用原" "始函式中的對應屬性進行更新。這些引數的預設值是模組層級的常數 " -"``WRAPPER_ASSIGNMENTS``\\ (它賦值給包裝函式的 ``__module__``、``__name__``、" -"``__qualname__``、``__annotations__`` 和 ``__doc__`` 文件字串 (docstring)和 " -"``WRAPPER_UPDATES``\\ (更新包裝器函式的 ``__dict__``,即實例字典)。" +"``WRAPPER_ASSIGNMENTS``\\ (它賦值給包裝函式的 :attr:`~function." +"__module__`、:attr:`~function.__name__`、:attr:`~function.__qualname__`、:" +"attr:`~function.__annotations__`、:attr:`~function.__type_params__` 和 :attr:" +"`~function.__doc__` 文件字串 (docstring))和 ``WRAPPER_UPDATES``\\ (更新包" +"裝器函式的 :attr:`~function.__dict__`,即實例字典)。" -#: ../../library/functools.rst:652 +#: ../../library/functools.rst:674 msgid "" "To allow access to the original function for introspection and other " "purposes (e.g. bypassing a caching decorator such as :func:`lru_cache`), " @@ -1198,7 +1238,7 @@ msgstr "" "飾器,如 :func:`lru_cache`),此函式會自動向包裝器新增 ``__wrapped__`` 屬性," "該包裝器參照被包裝的函式。" -#: ../../library/functools.rst:657 +#: ../../library/functools.rst:679 msgid "" "The main intended use for this function is in :term:`decorator` functions " "which wrap the decorated function and return the wrapper. If the wrapper " @@ -1210,7 +1250,7 @@ msgstr "" "裝器函式未更新,則回傳函式的元資料 (metadata) 將反映包裝器定義而非原始函式定" "義,這通常不太會有幫助。" -#: ../../library/functools.rst:663 +#: ../../library/functools.rst:685 msgid "" ":func:`update_wrapper` may be used with callables other than functions. Any " "attributes named in *assigned* or *updated* that are missing from the object " @@ -1223,16 +1263,16 @@ msgstr "" "器函式上設定它們)。如果包裝函式本身缺少 *updated* 中指定的任何屬性,仍然會引" "發 :exc:`AttributeError`。" -#: ../../library/functools.rst:669 +#: ../../library/functools.rst:691 msgid "" -"The ``__wrapped__`` attribute is now automatically added. The " -"``__annotations__`` attribute is now copied by default. Missing attributes " -"no longer trigger an :exc:`AttributeError`." +"The ``__wrapped__`` attribute is now automatically added. The :attr:" +"`~function.__annotations__` attribute is now copied by default. Missing " +"attributes no longer trigger an :exc:`AttributeError`." msgstr "" -"現在會自動新增 ``__wrapped__`` 屬性。現在預設會複製 ``__annotations__`` 屬" -"性。缺少的屬性不再觸發 :exc:`AttributeError`。" +"現在會自動新增 ``__wrapped__`` 屬性。現在預設會複製 :attr:`~function." +"__annotations__` 屬性。缺少的屬性不再觸發 :exc:`AttributeError`。" -#: ../../library/functools.rst:674 +#: ../../library/functools.rst:696 msgid "" "The ``__wrapped__`` attribute now always refers to the wrapped function, " "even if that function defined a ``__wrapped__`` attribute. (see :issue:" @@ -1241,11 +1281,12 @@ msgstr "" "``__wrapped__`` 屬性現在都會參照包裝函式,即便函式有定義 ``__wrapped__`` 屬" "性。(參見 :issue:`17482`)" -#: ../../library/functools.rst:679 -msgid "The ``__type_params__`` attribute is now copied by default." -msgstr "現在預設會複製 ``__type_params__`` 屬性。" +#: ../../library/functools.rst:701 +msgid "" +"The :attr:`~function.__type_params__` attribute is now copied by default." +msgstr "現在預設會複製 :attr:`~function.__type_params__` 屬性。" -#: ../../library/functools.rst:685 +#: ../../library/functools.rst:707 msgid "" "This is a convenience function for invoking :func:`update_wrapper` as a " "function decorator when defining a wrapper function. It is equivalent to " @@ -1256,7 +1297,7 @@ msgstr "" "式裝飾器。它相當於 ``partial(update_wrapper, wrapped=wrapped, " "assigned=assigned, updated=updated)``。例如: ::" -#: ../../library/functools.rst:690 +#: ../../library/functools.rst:712 msgid "" ">>> from functools import wraps\n" ">>> def my_decorator(f):\n" @@ -1280,7 +1321,7 @@ msgid "" "'Docstring'" msgstr "" -#: ../../library/functools.rst:711 +#: ../../library/functools.rst:733 msgid "" "Without the use of this decorator factory, the name of the example function " "would have been ``'wrapper'``, and the docstring of the original :func:" @@ -1289,11 +1330,11 @@ msgstr "" "如果不使用這個裝飾器工廠 (decorator factory),範例函式的名稱將會是 " "``'wrapper'``,並且原始 :func:`example` 的文件字串將會遺失。" -#: ../../library/functools.rst:719 +#: ../../library/functools.rst:741 msgid ":class:`partial` Objects" msgstr ":class:`partial` 物件" -#: ../../library/functools.rst:721 +#: ../../library/functools.rst:743 msgid "" ":class:`partial` objects are callable objects created by :func:`partial`. " "They have three read-only attributes:" @@ -1301,7 +1342,7 @@ msgstr "" ":class:`partial` 物件是由 :func:`partial` 所建立的可呼叫物件。它們有三個唯讀" "屬性:" -#: ../../library/functools.rst:727 +#: ../../library/functools.rst:749 msgid "" "A callable object or function. Calls to the :class:`partial` object will be " "forwarded to :attr:`func` with new arguments and keywords." @@ -1309,7 +1350,7 @@ msgstr "" "一個可呼叫的物件或函式。對 :class:`partial` 物件的呼叫將被轉送到帶有新引數和" "關鍵字的 :attr:`func`。" -#: ../../library/functools.rst:733 +#: ../../library/functools.rst:755 msgid "" "The leftmost positional arguments that will be prepended to the positional " "arguments provided to a :class:`partial` object call." @@ -1317,23 +1358,24 @@ msgstr "" "最左邊的位置引數將會被加入到提供給 :class:`partial` 物件呼叫的位置引數的前" "面。" -#: ../../library/functools.rst:739 +#: ../../library/functools.rst:761 msgid "" "The keyword arguments that will be supplied when the :class:`partial` object " "is called." msgstr "呼叫 :class:`partial` 物件時將提供的關鍵字引數。" -#: ../../library/functools.rst:742 -msgid "" -":class:`partial` objects are like :class:`function` objects in that they are " -"callable, weak referenceable, and can have attributes. There are some " -"important differences. For instance, the :attr:`~definition.__name__` and :" -"attr:`__doc__` attributes are not created automatically. Also, :class:" -"`partial` objects defined in classes behave like static methods and do not " -"transform into bound methods during instance attribute look-up." -msgstr "" -":class:`partial` 物件與 :class:`function` 物件類似,因為它們是可呼叫的、可弱" -"參照的 (weak referencable) 且可以具有屬性。有一些重要的區別,例如,:attr:" -"`~definition.__name__` 和 :attr:`__doc__` 屬性不會自動建立。此外,類別中定義" -"的 :class:`partial` 物件的行為類似於靜態方法,並且在實例屬性查找期間不會轉換" -"為繫結方法。" +#: ../../library/functools.rst:764 +msgid "" +":class:`partial` objects are like :ref:`function objects ` in that they are callable, weak referenceable, and can have " +"attributes. There are some important differences. For instance, the :attr:" +"`~function.__name__` and :attr:`function.__doc__` attributes are not created " +"automatically. Also, :class:`partial` objects defined in classes behave " +"like static methods and do not transform into bound methods during instance " +"attribute look-up." +msgstr "" +":class:`partial` 物件與\\ :ref:`函式物件 `\\ 類似,因為它" +"們是可呼叫的、可弱參照的 (weak referencable) 且可以具有屬性。有一些重要的區" +"別,例如,:attr:`~function.__name__` 和 :attr:`function.__doc__` 屬性不會自動" +"建立。此外,類別中定義的 :class:`partial` 物件的行為類似於靜態方法,並且在實" +"例屬性查找期間不會轉換為繫結方法。" diff --git a/library/gc.po b/library/gc.po index ac05411f77..dd5103866b 100644 --- a/library/gc.po +++ b/library/gc.po @@ -1,16 +1,15 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Liang-Bo Wang , 2015 -# Matt Wang , 2022 +# Matt Wang , 2022-2024 # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-10-01 00:15+0000\n" "PO-Revision-Date: 2023-04-24 21:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -67,8 +66,8 @@ msgstr "如果啟用了自動回收則回傳 ``True``。" msgid "" "With no arguments, run a full collection. The optional argument " "*generation* may be an integer specifying which generation to collect (from " -"0 to 2). A :exc:`ValueError` is raised if the generation number is " -"invalid. The number of unreachable objects found is returned." +"0 to 2). A :exc:`ValueError` is raised if the generation number is invalid. " +"The sum of collected objects and uncollectable objects is returned." msgstr "" "若被呼叫時沒有引數,則啟動完整垃圾回收。可選的引數 *generation* 可以是一個指" "明需要回收哪一代垃圾的整數(從 0 到 2)。當引數 *generation* 無效時,會引發 :" @@ -89,7 +88,7 @@ msgstr "" msgid "" "The effect of calling ``gc.collect()`` while the interpreter is already " "performing a collection is undefined." -msgstr "" +msgstr "當直譯器已經執行收集時呼叫 ``gc.collect()`` 的效果是未定義的。" #: ../../library/gc.rst:59 msgid "" @@ -105,14 +104,13 @@ msgid "Return the debugging flags currently set." msgstr "回傳當前設置的除錯旗標。" #: ../../library/gc.rst:71 -#, fuzzy msgid "" "Returns a list of all objects tracked by the collector, excluding the list " "returned. If *generation* is not ``None``, return only the objects tracked " "by the collector that are in that generation." msgstr "" "回傳一個包含回收器正在追蹤的所有物件的 list,除去所回傳的 list。如果 " -"*generation* 不為 None,只回傳回收器正在追蹤且屬於該代的物件。" +"*generation* 不為 ``None``,只回傳回收器正在追蹤且屬於該代的物件。" #: ../../library/gc.rst:75 msgid "New *generation* parameter." diff --git a/library/getopt.po b/library/getopt.po index 01b5b5326d..f4467adec5 100644 --- a/library/getopt.po +++ b/library/getopt.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2016-01-31 07:19+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,46 +26,52 @@ msgstr ":mod:`!getopt` --- 用於命令列選項的 C 風格剖析器" msgid "**Source code:** :source:`Lib/getopt.py`" msgstr "**原始碼:**\\ :source:`Lib/getopt.py`" -#: ../../library/getopt.rst:12 +#: ../../library/getopt.rst:10 +msgid "" +"The :mod:`getopt` module is :term:`soft deprecated` and will not be " +"developed further; development will continue with the :mod:`argparse` module." +msgstr "" + +#: ../../library/getopt.rst:17 msgid "" "The :mod:`getopt` module is a parser for command line options whose API is " -"designed to be familiar to users of the C :c:func:`getopt` function. Users " -"who are unfamiliar with the C :c:func:`getopt` function or who would like to " -"write less code and get better help and error messages should consider using " -"the :mod:`argparse` module instead." +"designed to be familiar to users of the C :c:func:`!getopt` function. Users " +"who are unfamiliar with the C :c:func:`!getopt` function or who would like " +"to write less code and get better help and error messages should consider " +"using the :mod:`argparse` module instead." msgstr "" -#: ../../library/getopt.rst:20 +#: ../../library/getopt.rst:25 msgid "" "This module helps scripts to parse the command line arguments in ``sys." -"argv``. It supports the same conventions as the Unix :c:func:`getopt` " +"argv``. It supports the same conventions as the Unix :c:func:`!getopt` " "function (including the special meanings of arguments of the form '``-``' " "and '``--``'). Long options similar to those supported by GNU software may " "be used as well via an optional third argument." msgstr "" -#: ../../library/getopt.rst:26 +#: ../../library/getopt.rst:31 msgid "This module provides two functions and an exception:" msgstr "" -#: ../../library/getopt.rst:32 +#: ../../library/getopt.rst:37 msgid "" "Parses command line options and parameter list. *args* is the argument list " "to be parsed, without the leading reference to the running program. " "Typically, this means ``sys.argv[1:]``. *shortopts* is the string of option " "letters that the script wants to recognize, with options that require an " "argument followed by a colon (``':'``; i.e., the same format that Unix :c:" -"func:`getopt` uses)." +"func:`!getopt` uses)." msgstr "" -#: ../../library/getopt.rst:40 +#: ../../library/getopt.rst:45 msgid "" -"Unlike GNU :c:func:`getopt`, after a non-option argument, all further " +"Unlike GNU :c:func:`!getopt`, after a non-option argument, all further " "arguments are considered also non-options. This is similar to the way non-" "GNU Unix systems work." msgstr "" -#: ../../library/getopt.rst:44 +#: ../../library/getopt.rst:49 msgid "" "*longopts*, if specified, must be a list of strings with the names of the " "long options which should be supported. The leading ``'--'`` characters " @@ -79,7 +85,7 @@ msgid "" "uniquely, so :exc:`GetoptError` will be raised." msgstr "" -#: ../../library/getopt.rst:55 +#: ../../library/getopt.rst:60 msgid "" "The return value consists of two elements: the first is a list of ``(option, " "value)`` pairs; the second is the list of program arguments left after the " @@ -92,7 +98,7 @@ msgid "" "occurrences. Long and short options may be mixed." msgstr "" -#: ../../library/getopt.rst:68 +#: ../../library/getopt.rst:73 msgid "" "This function works like :func:`getopt`, except that GNU style scanning mode " "is used by default. This means that option and non-option arguments may be " @@ -100,41 +106,41 @@ msgid "" "a non-option argument is encountered." msgstr "" -#: ../../library/getopt.rst:73 +#: ../../library/getopt.rst:78 msgid "" "If the first character of the option string is ``'+'``, or if the " -"environment variable :envvar:`POSIXLY_CORRECT` is set, then option " +"environment variable :envvar:`!POSIXLY_CORRECT` is set, then option " "processing stops as soon as a non-option argument is encountered." msgstr "" -#: ../../library/getopt.rst:80 +#: ../../library/getopt.rst:85 msgid "" "This is raised when an unrecognized option is found in the argument list or " "when an option requiring an argument is given none. The argument to the " "exception is a string indicating the cause of the error. For long options, " "an argument given to an option which does not require one will also cause " -"this exception to be raised. The attributes :attr:`msg` and :attr:`opt` " +"this exception to be raised. The attributes :attr:`!msg` and :attr:`!opt` " "give the error message and related option; if there is no specific option to " -"which the exception relates, :attr:`opt` is an empty string." +"which the exception relates, :attr:`!opt` is an empty string." msgstr "" -#: ../../library/getopt.rst:91 +#: ../../library/getopt.rst:96 msgid "Alias for :exc:`GetoptError`; for backward compatibility." msgstr "" -#: ../../library/getopt.rst:93 +#: ../../library/getopt.rst:98 msgid "An example using only Unix style options:" msgstr "" -#: ../../library/getopt.rst:105 +#: ../../library/getopt.rst:110 msgid "Using long option names is equally easy:" msgstr "" -#: ../../library/getopt.rst:118 +#: ../../library/getopt.rst:123 msgid "In a script, typical usage is something like this::" msgstr "" -#: ../../library/getopt.rst:120 +#: ../../library/getopt.rst:125 msgid "" "import getopt, sys\n" "\n" @@ -166,14 +172,14 @@ msgid "" " main()" msgstr "" -#: ../../library/getopt.rst:147 +#: ../../library/getopt.rst:152 msgid "" "Note that an equivalent command line interface could be produced with less " "code and more informative help and error messages by using the :mod:" "`argparse` module::" msgstr "" -#: ../../library/getopt.rst:150 +#: ../../library/getopt.rst:155 msgid "" "import argparse\n" "\n" @@ -186,10 +192,10 @@ msgid "" " # ... do something with args.verbose .." msgstr "" -#: ../../library/getopt.rst:162 +#: ../../library/getopt.rst:167 msgid "Module :mod:`argparse`" msgstr ":mod:`argparse` 模組" -#: ../../library/getopt.rst:163 +#: ../../library/getopt.rst:168 msgid "Alternative command line option and argument parsing library." msgstr "" diff --git a/library/getpass.po b/library/getpass.po index 16b7ea0454..c1301e9377 100644 --- a/library/getpass.po +++ b/library/getpass.po @@ -5,9 +5,9 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-30 18:24+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-02-11 12:04+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,17 +28,16 @@ msgid "**Source code:** :source:`Lib/getpass.py`" msgstr "**原始碼:**\\ :source:`Lib/getpass.py`" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`Availability `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/getpass.rst:17 msgid "The :mod:`getpass` module provides two functions:" @@ -85,12 +84,13 @@ msgid "Return the \"login name\" of the user." msgstr "回傳使用者的\"登入名稱\"。" #: ../../library/getpass.rst:45 +#, fuzzy msgid "" "This function checks the environment variables :envvar:`LOGNAME`, :envvar:" "`USER`, :envvar:`!LNAME` and :envvar:`USERNAME`, in order, and returns the " "value of the first one which is set to a non-empty string. If none are set, " "the login name from the password database is returned on systems which " -"support the :mod:`pwd` module, otherwise, an exception is raised." +"support the :mod:`pwd` module, otherwise, an :exc:`OSError` is raised." msgstr "" "此函式會按順序檢查環境變數 :envvar:`LOGNAME`、:envvar:`USER`、:envvar:`!" "LNAME` 和 :envvar:`USERNAME`,並回傳其中第一個被設定成非空字串的值。如果均未" @@ -100,3 +100,7 @@ msgstr "" #: ../../library/getpass.rst:52 msgid "In general, this function should be preferred over :func:`os.getlogin`." msgstr "大部分情況下,此函式應該要比 :func:`os.getlogin` 優先使用。" + +#: ../../library/getpass.rst:54 +msgid "Previously, various exceptions beyond just :exc:`OSError` were raised." +msgstr "" diff --git a/library/gettext.po b/library/gettext.po index 88431c49e5..c7634d5d75 100644 --- a/library/gettext.po +++ b/library/gettext.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" diff --git a/library/glob.po b/library/glob.po index 5b2a4cde1e..08c7f860d9 100644 --- a/library/glob.po +++ b/library/glob.po @@ -5,9 +5,9 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-01-24 01:21+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -60,11 +60,11 @@ msgstr "" "對於文本 (literal) 匹配,將元字元 (meta-character) 括在方括號中。例如," "``'[?]'`` 會匹配 ``'?'`` 字元。" -#: ../../library/glob.rst:39 -msgid "The :mod:`pathlib` module offers high-level path objects." -msgstr ":mod:`pathlib` 模組提供高階路徑物件。" +#: ../../library/glob.rst:37 +msgid "The :mod:`glob` module defines the following functions:" +msgstr "" -#: ../../library/glob.rst:45 +#: ../../library/glob.rst:43 msgid "" "Return a possibly empty list of path names that match *pathname*, which must " "be a string containing a path specification. *pathname* can be either " @@ -82,7 +82,7 @@ msgstr "" "取決於檔案系統 (file system)。如果在呼叫此函式期間刪除或新增滿足條件的檔案," "則結果不一定會包含該檔案的路徑名稱。" -#: ../../library/glob.rst:54 +#: ../../library/glob.rst:52 msgid "" "If *root_dir* is not ``None``, it should be a :term:`path-like object` " "specifying the root directory for searching. It has the same effect on :" @@ -93,14 +93,14 @@ msgstr "" "object`。它在呼叫它之前更改當前目錄的影響與 :func:`glob` 相同。如果 " "*pathname* 是相對的,結果將包含相對於 *root_dir* 的路徑。" -#: ../../library/glob.rst:60 +#: ../../library/glob.rst:58 msgid "" "This function can support :ref:`paths relative to directory descriptors " "` with the *dir_fd* parameter." msgstr "" "此函式可以支援以 *dir_fd* 參數使用\\ :ref:`相對目錄描述器的路徑 `。" -#: ../../library/glob.rst:66 +#: ../../library/glob.rst:64 msgid "" "If *recursive* is true, the pattern \"``**``\" will match any files and zero " "or more directories, subdirectories and symbolic links to directories. If " @@ -111,13 +111,13 @@ msgstr "" "和目錄的符號連結。如果模式後面有 :data:`os.sep` 或 :data:`os.altsep` 那麼檔案" "將不會被匹配。" -#: ../../library/glob.rst:71 +#: ../../library/glob.rst:69 msgid "" "If *include_hidden* is true, \"``**``\" pattern will match hidden " "directories." msgstr "如果 *include_hidden* 為真,\"``**``\" 模式將匹配被隱藏的目錄。" -#: ../../library/glob.rst:73 ../../library/glob.rst:100 +#: ../../library/glob.rst:71 ../../library/glob.rst:98 msgid "" "Raises an :ref:`auditing event ` ``glob.glob`` with arguments " "``pathname``, ``recursive``." @@ -125,7 +125,7 @@ msgstr "" "引發一個附帶引數 ``pathname``、``recursive`` 的\\ :ref:`稽核事件 ` " "``glob.glob``。" -#: ../../library/glob.rst:74 ../../library/glob.rst:101 +#: ../../library/glob.rst:72 ../../library/glob.rst:99 msgid "" "Raises an :ref:`auditing event ` ``glob.glob/2`` with arguments " "``pathname``, ``recursive``, ``root_dir``, ``dir_fd``." @@ -133,31 +133,31 @@ msgstr "" "引發一個附帶引數 ``pathname``、``recursive``、``root_dir``、``dir_fd`` 的\\ :" "ref:`稽核事件 ` ``glob.glob/2``。" -#: ../../library/glob.rst:77 +#: ../../library/glob.rst:75 msgid "" "Using the \"``**``\" pattern in large directory trees may consume an " "inordinate amount of time." msgstr "在大型目錄樹中使用 \"``**``\" 模式可能會消耗過多的時間。" -#: ../../library/glob.rst:81 ../../library/glob.rst:104 +#: ../../library/glob.rst:79 ../../library/glob.rst:102 msgid "" "This function may return duplicate path names if *pathname* contains " "multiple \"``**``\" patterns and *recursive* is true." msgstr "" -#: ../../library/glob.rst:84 ../../library/glob.rst:107 +#: ../../library/glob.rst:82 ../../library/glob.rst:105 msgid "Support for recursive globs using \"``**``\"." msgstr "支援以 \"``**``\" 使用遞迴 glob。" -#: ../../library/glob.rst:87 ../../library/glob.rst:110 +#: ../../library/glob.rst:85 ../../library/glob.rst:108 msgid "Added the *root_dir* and *dir_fd* parameters." msgstr "新增 *root_dir* 與 *dir_fd* 參數。" -#: ../../library/glob.rst:90 ../../library/glob.rst:113 +#: ../../library/glob.rst:88 ../../library/glob.rst:111 msgid "Added the *include_hidden* parameter." msgstr "新增 *include_hidden* 參數。" -#: ../../library/glob.rst:97 +#: ../../library/glob.rst:95 msgid "" "Return an :term:`iterator` which yields the same values as :func:`glob` " "without actually storing them all simultaneously." @@ -165,7 +165,7 @@ msgstr "" "回傳一個會產生與 :func:`glob` 相同的值的 :term:`iterator` ,而不是同時存儲全" "部的值。" -#: ../../library/glob.rst:119 +#: ../../library/glob.rst:117 msgid "" "Escape all special characters (``'?'``, ``'*'`` and ``'['``). This is useful " "if you want to match an arbitrary literal string that may have special " @@ -180,17 +180,62 @@ msgstr "" #: ../../library/glob.rst:128 msgid "" -"For example, consider a directory containing the following files: :file:`1." -"gif`, :file:`2.txt`, :file:`card.gif` and a subdirectory :file:`sub` which " -"contains only the file :file:`3.txt`. :func:`glob` will produce the " -"following results. Notice how any leading components of the path are " -"preserved. ::" +"Convert the given path specification to a regular expression for use with :" +"func:`re.match`. The path specification can contain shell-style wildcards." +msgstr "" + +#: ../../library/glob.rst:131 +msgid "For example:" +msgstr "" + +#: ../../library/glob.rst:142 +msgid "" +"Path separators and segments are meaningful to this function, unlike :func:" +"`fnmatch.translate`. By default wildcards do not match path separators, and " +"``*`` pattern segments match precisely one path segment." +msgstr "" + +#: ../../library/glob.rst:146 +msgid "" +"If *recursive* is true, the pattern segment \"``**``\" will match any number " +"of path segments." +msgstr "" + +#: ../../library/glob.rst:149 +msgid "" +"If *include_hidden* is true, wildcards can match path segments that start " +"with a dot (``.``)." +msgstr "" + +#: ../../library/glob.rst:152 +msgid "" +"A sequence of path separators may be supplied to the *seps* argument. If not " +"given, :data:`os.sep` and :data:`~os.altsep` (if available) are used." +msgstr "" + +#: ../../library/glob.rst:157 +msgid "" +":meth:`pathlib.PurePath.full_match` and :meth:`pathlib.Path.glob` methods, " +"which call this function to implement pattern matching and globbing." +msgstr "" + +#: ../../library/glob.rst:165 +msgid "Examples" +msgstr "" + +#: ../../library/glob.rst:167 +#, fuzzy +msgid "" +"Consider a directory containing the following files: :file:`1.gif`, :file:`2." +"txt`, :file:`card.gif` and a subdirectory :file:`sub` which contains only " +"the file :file:`3.txt`. :func:`glob` will produce the following results. " +"Notice how any leading components of the path are preserved. ::" msgstr "" "例如,在一個包含以下檔案的目錄::file:`1.gif`、:file:`2.txt`、:file:`card." "gif`,和一個僅包含 :file:`3.txt` 檔案的子目錄 :file:`sub`,:func:`glob` 將產" "生以下結果。請注意路徑的任何前導部分是如何保留的。 ::" -#: ../../library/glob.rst:134 +#: ../../library/glob.rst:173 msgid "" ">>> import glob\n" ">>> glob.glob('./[0-9].*')\n" @@ -216,7 +261,7 @@ msgstr "" ">>> glob.glob('./**/', recursive=True)\n" "['./', './sub/']" -#: ../../library/glob.rst:146 +#: ../../library/glob.rst:185 msgid "" "If the directory contains files starting with ``.`` they won't be matched by " "default. For example, consider a directory containing :file:`card.gif` and :" @@ -225,7 +270,7 @@ msgstr "" "如果目錄包含以 ``.`` 開頭的檔案,則預設情況下不會去匹配到它們。例如,一個包" "含 :file:`card.gif` 和 :file:`.card.gif` 的目錄: ::" -#: ../../library/glob.rst:150 +#: ../../library/glob.rst:189 msgid "" ">>> import glob\n" ">>> glob.glob('*.gif')\n" @@ -239,14 +284,16 @@ msgstr "" ">>> glob.glob('.c*')\n" "['.card.gif']" -#: ../../library/glob.rst:158 -msgid "Module :mod:`fnmatch`" -msgstr ":mod:`fnmatch` 模組" - -#: ../../library/glob.rst:159 -msgid "Shell-style filename (not path) expansion" +#: ../../library/glob.rst:196 +#, fuzzy +msgid "" +"The :mod:`fnmatch` module offers shell-style filename (not path) expansion." msgstr "Shell 風格檔案名(不是路徑)的擴展" +#: ../../library/glob.rst:199 +msgid "The :mod:`pathlib` module offers high-level path objects." +msgstr ":mod:`pathlib` 模組提供高階路徑物件。" + #: ../../library/glob.rst:9 msgid "filenames" msgstr "filenames(檔案名稱)" @@ -259,7 +306,7 @@ msgstr "pathname expansion(路徑名稱展開)" msgid "* (asterisk)" msgstr "* (星號)" -#: ../../library/glob.rst:13 ../../library/glob.rst:63 +#: ../../library/glob.rst:13 ../../library/glob.rst:61 msgid "in glob-style wildcards" msgstr "於 glob 風格的萬用字元中" @@ -283,6 +330,9 @@ msgstr "- (減號)" msgid ". (dot)" msgstr ". (點)" -#: ../../library/glob.rst:63 +#: ../../library/glob.rst:61 msgid "**" msgstr "**" + +#~ msgid "Module :mod:`fnmatch`" +#~ msgstr ":mod:`fnmatch` 模組" diff --git a/library/graphlib.po b/library/graphlib.po index 4ee16bd428..8e8f8e4479 100644 --- a/library/graphlib.po +++ b/library/graphlib.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-01-04 16:35+0800\n" diff --git a/library/grp.po b/library/grp.po index f035088276..15b9d95405 100644 --- a/library/grp.po +++ b/library/grp.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:02+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,8 +29,9 @@ msgid "" msgstr "" #: ../../library/grp.rst:13 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." -msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" +msgid "" +":ref:`Availability `: Unix, not WASI, not Android, not iOS." +msgstr ":ref:`適用 `:Unix、非 WASI、非 Android、非 iOS。" #: ../../library/grp.rst:15 msgid "" @@ -143,13 +144,8 @@ msgstr ":mod:`pwd` 模組" msgid "An interface to the user database, similar to this." msgstr "" -#: ../../library/grp.rst:67 -msgid "Module :mod:`spwd`" -msgstr ":mod:`spwd` 模組" - -#: ../../library/grp.rst:68 -msgid "An interface to the shadow password database, similar to this." -msgstr "" +#~ msgid "Module :mod:`spwd`" +#~ msgstr ":mod:`spwd` 模組" #~ msgid "" #~ "This module does not work or is not available on WebAssembly platforms " diff --git a/library/gzip.po b/library/gzip.po index 8e7285d25a..d2643f46da 100644 --- a/library/gzip.po +++ b/library/gzip.po @@ -5,9 +5,9 @@ # Adrian Liaw , 2018 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -105,7 +105,7 @@ msgstr "" msgid "Added support for the ``'x'``, ``'xb'`` and ``'xt'`` modes." msgstr "新增 ``'x'``、``'xb'`` 和 ``'xt'`` 模式的支援。" -#: ../../library/gzip.rst:59 ../../library/gzip.rst:171 +#: ../../library/gzip.rst:59 ../../library/gzip.rst:175 msgid "Accepts a :term:`path-like object`." msgstr "接受\\ :term:`類路徑物件 `。" @@ -168,14 +168,19 @@ msgstr "" #: ../../library/gzip.rst:103 msgid "" -"The *mtime* argument is an optional numeric timestamp to be written to the " -"last modification time field in the stream when compressing. It should only " -"be provided in compression mode. If omitted or ``None``, the current time " -"is used. See the :attr:`mtime` attribute for more details." +"The optional *mtime* argument is the timestamp requested by gzip. The time " +"is in Unix format, i.e., seconds since 00:00:00 UTC, January 1, 1970. If " +"*mtime* is omitted or ``None``, the current time is used. Use *mtime* = 0 to " +"generate a compressed stream that does not depend on creation time." msgstr "" #: ../../library/gzip.rst:108 msgid "" +"See below for the :attr:`mtime` attribute that is set when decompressing." +msgstr "" + +#: ../../library/gzip.rst:110 +msgid "" "Calling a :class:`GzipFile` object's :meth:`!close` method does not close " "*fileobj*, since you might wish to append more material after the compressed " "data. This also allows you to pass an :class:`io.BytesIO` object opened for " @@ -183,105 +188,103 @@ msgid "" "class:`io.BytesIO` object's :meth:`~io.BytesIO.getvalue` method." msgstr "" -#: ../../library/gzip.rst:114 +#: ../../library/gzip.rst:116 msgid "" ":class:`GzipFile` supports the :class:`io.BufferedIOBase` interface, " "including iteration and the :keyword:`with` statement. Only the :meth:`~io." "IOBase.truncate` method isn't implemented." msgstr "" -#: ../../library/gzip.rst:118 +#: ../../library/gzip.rst:120 msgid ":class:`GzipFile` also provides the following method and attribute:" msgstr ":class:`GzipFile` 也提供了以下的方法和屬性:" -#: ../../library/gzip.rst:122 +#: ../../library/gzip.rst:124 msgid "" "Read *n* uncompressed bytes without advancing the file position. At most one " "single read on the compressed stream is done to satisfy the call. The " "number of bytes returned may be more or less than requested." msgstr "" -#: ../../library/gzip.rst:127 +#: ../../library/gzip.rst:129 msgid "" "While calling :meth:`peek` does not change the file position of the :class:" "`GzipFile`, it may change the position of the underlying file object (e.g. " "if the :class:`GzipFile` was constructed with the *fileobj* parameter)." msgstr "" -#: ../../library/gzip.rst:136 -msgid "" -"When decompressing, the value of the last modification time field in the " -"most recently read header may be read from this attribute, as an integer. " -"The initial value before reading any headers is ``None``." +#: ../../library/gzip.rst:138 +msgid "``'rb'`` for reading and ``'wb'`` for writing." msgstr "" #: ../../library/gzip.rst:140 +msgid "In previous versions it was an integer ``1`` or ``2``." +msgstr "" + +#: ../../library/gzip.rst:145 msgid "" -"All :program:`gzip` compressed streams are required to contain this " -"timestamp field. Some programs, such as :program:`gunzip`\\ , make use of " -"the timestamp. The format is the same as the return value of :func:`time." -"time` and the :attr:`~os.stat_result.st_mtime` attribute of the object " -"returned by :func:`os.stat`." +"When decompressing, this attribute is set to the last timestamp in the most " +"recently read header. It is an integer, holding the number of seconds since " +"the Unix epoch (00:00:00 UTC, January 1, 1970). The initial value before " +"reading any headers is ``None``." msgstr "" -#: ../../library/gzip.rst:148 +#: ../../library/gzip.rst:152 msgid "" "The path to the gzip file on disk, as a :class:`str` or :class:`bytes`. " "Equivalent to the output of :func:`os.fspath` on the original input path, " "with no other normalization, resolution or expansion." msgstr "" -#: ../../library/gzip.rst:152 +#: ../../library/gzip.rst:156 msgid "" "Support for the :keyword:`with` statement was added, along with the *mtime* " "constructor argument and :attr:`mtime` attribute." msgstr "" -#: ../../library/gzip.rst:156 +#: ../../library/gzip.rst:160 msgid "Support for zero-padded and unseekable files was added." msgstr "" -#: ../../library/gzip.rst:159 +#: ../../library/gzip.rst:163 msgid "The :meth:`io.BufferedIOBase.read1` method is now implemented." msgstr ":meth:`io.BufferedIOBase.read1` 方法現在已有實作。" -#: ../../library/gzip.rst:162 +#: ../../library/gzip.rst:166 msgid "Added support for the ``'x'`` and ``'xb'`` modes." msgstr "新增 ``'x'`` 和 ``'xb'`` 模式的支援。" -#: ../../library/gzip.rst:165 +#: ../../library/gzip.rst:169 msgid "" "Added support for writing arbitrary :term:`bytes-like objects `. The :meth:`~io.BufferedIOBase.read` method now accepts an argument " "of ``None``." msgstr "" -#: ../../library/gzip.rst:174 -msgid "" -"Remove the ``filename`` attribute, use the :attr:`~GzipFile.name` attribute " -"instead." -msgstr "" - #: ../../library/gzip.rst:178 msgid "" "Opening :class:`GzipFile` for writing without specifying the *mode* argument " "is deprecated." msgstr "" -#: ../../library/gzip.rst:185 +#: ../../library/gzip.rst:182 +msgid "" +"Remove the ``filename`` attribute, use the :attr:`~GzipFile.name` attribute " +"instead." +msgstr "" + +#: ../../library/gzip.rst:189 msgid "" "Compress the *data*, returning a :class:`bytes` object containing the " "compressed data. *compresslevel* and *mtime* have the same meaning as in " -"the :class:`GzipFile` constructor above. When *mtime* is set to ``0``, this " -"function is equivalent to :func:`zlib.compress` with *wbits* set to ``31``. " -"The zlib function is faster." +"the :class:`GzipFile` constructor above." msgstr "" -#: ../../library/gzip.rst:192 +#: ../../library/gzip.rst:194 msgid "Added the *mtime* parameter for reproducible output." msgstr "" -#: ../../library/gzip.rst:194 +#: ../../library/gzip.rst:196 msgid "" "Speed is improved by compressing all data at once instead of in a streamed " "fashion. Calls with *mtime* set to ``0`` are delegated to :func:`zlib." @@ -292,6 +295,12 @@ msgstr "" #: ../../library/gzip.rst:203 msgid "" +"The gzip header OS byte is guaranteed to be set to 255 when this function is " +"used as was the case in 3.10 and earlier." +msgstr "" + +#: ../../library/gzip.rst:209 +msgid "" "Decompress the *data*, returning a :class:`bytes` object containing the " "uncompressed data. This function is capable of decompressing multi-member " "gzip data (multiple gzip blocks concatenated together). When the data is " @@ -299,21 +308,21 @@ msgid "" "*wbits* set to 31 is faster." msgstr "" -#: ../../library/gzip.rst:210 +#: ../../library/gzip.rst:216 msgid "" "Speed is improved by decompressing members at once in memory instead of in a " "streamed fashion." msgstr "" -#: ../../library/gzip.rst:217 +#: ../../library/gzip.rst:223 msgid "Examples of usage" msgstr "用法範例" -#: ../../library/gzip.rst:219 +#: ../../library/gzip.rst:225 msgid "Example of how to read a compressed file::" msgstr "如何讀取壓縮檔案的範例: ::" -#: ../../library/gzip.rst:221 +#: ../../library/gzip.rst:227 msgid "" "import gzip\n" "with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" @@ -323,11 +332,11 @@ msgstr "" "with gzip.open('/home/joe/file.txt.gz', 'rb') as f:\n" " file_content = f.read()" -#: ../../library/gzip.rst:225 +#: ../../library/gzip.rst:231 msgid "Example of how to create a compressed GZIP file::" msgstr "如何建立一個壓縮的 GZIP 檔案的範例: ::" -#: ../../library/gzip.rst:227 +#: ../../library/gzip.rst:233 msgid "" "import gzip\n" "content = b\"Lots of content here\"\n" @@ -339,11 +348,11 @@ msgstr "" "with gzip.open('/home/joe/file.txt.gz', 'wb') as f:\n" " f.write(content)" -#: ../../library/gzip.rst:232 +#: ../../library/gzip.rst:238 msgid "Example of how to GZIP compress an existing file::" msgstr "如何壓縮一個已存在的檔案的範例: ::" -#: ../../library/gzip.rst:234 +#: ../../library/gzip.rst:240 msgid "" "import gzip\n" "import shutil\n" @@ -357,11 +366,11 @@ msgstr "" " with gzip.open('/home/joe/file.txt.gz', 'wb') as f_out:\n" " shutil.copyfileobj(f_in, f_out)" -#: ../../library/gzip.rst:240 +#: ../../library/gzip.rst:246 msgid "Example of how to GZIP compress a binary string::" msgstr "如何壓縮一個二進位字串的範例: ::" -#: ../../library/gzip.rst:242 +#: ../../library/gzip.rst:248 msgid "" "import gzip\n" "s_in = b\"Lots of content here\"\n" @@ -371,56 +380,56 @@ msgstr "" "s_in = b\"Lots of content here\"\n" "s_out = gzip.compress(s_in)" -#: ../../library/gzip.rst:248 +#: ../../library/gzip.rst:254 msgid "Module :mod:`zlib`" msgstr ":mod:`zlib` 模組" -#: ../../library/gzip.rst:249 +#: ../../library/gzip.rst:255 msgid "" "The basic data compression module needed to support the :program:`gzip` file " "format." msgstr "" -#: ../../library/gzip.rst:258 +#: ../../library/gzip.rst:264 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/gzip.rst:260 +#: ../../library/gzip.rst:266 msgid "" "The :mod:`gzip` module provides a simple command line interface to compress " "or decompress files." msgstr "" -#: ../../library/gzip.rst:263 +#: ../../library/gzip.rst:269 msgid "Once executed the :mod:`gzip` module keeps the input file(s)." msgstr "" -#: ../../library/gzip.rst:267 +#: ../../library/gzip.rst:273 msgid "" "Add a new command line interface with a usage. By default, when you will " "execute the CLI, the default compression level is 6." msgstr "" -#: ../../library/gzip.rst:271 +#: ../../library/gzip.rst:277 msgid "Command line options" msgstr "命令列選項" -#: ../../library/gzip.rst:275 +#: ../../library/gzip.rst:281 msgid "If *file* is not specified, read from :data:`sys.stdin`." msgstr "如果未指定 *file*,則從 :data:`sys.stdin` 讀取。" -#: ../../library/gzip.rst:279 +#: ../../library/gzip.rst:285 msgid "Indicates the fastest compression method (less compression)." msgstr "" -#: ../../library/gzip.rst:283 +#: ../../library/gzip.rst:289 msgid "Indicates the slowest compression method (best compression)." msgstr "" -#: ../../library/gzip.rst:287 +#: ../../library/gzip.rst:293 msgid "Decompress the given file." msgstr "解壓縮指定的檔案。" -#: ../../library/gzip.rst:291 +#: ../../library/gzip.rst:297 msgid "Show the help message." msgstr "顯示幫助訊息。" diff --git a/library/hashlib.po b/library/hashlib.po index 9d2a0e698b..e7b2a5de94 100644 --- a/library/hashlib.po +++ b/library/hashlib.po @@ -5,9 +5,9 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2024-05-11 16:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -511,17 +511,17 @@ msgstr "" "*n* 是 CPU/記憶體開銷係數、*r* 是區塊大小、*p* 為平行化係數、*maxmem* 為記憶" "體限制(OpenSSL 1.1.0 預設為 32 MiB)。*dklen* 是生成密鑰的長度。" -#: ../../library/hashlib.rst:366 +#: ../../library/hashlib.rst:368 msgid "BLAKE2" msgstr "BLAKE2" -#: ../../library/hashlib.rst:373 +#: ../../library/hashlib.rst:375 msgid "" "BLAKE2_ is a cryptographic hash function defined in :rfc:`7693` that comes " "in two flavors:" msgstr "BLAKE2_ 是在 :rfc:`7693` 中定義的加密雜湊函式,有兩種類型:" -#: ../../library/hashlib.rst:376 +#: ../../library/hashlib.rst:378 msgid "" "**BLAKE2b**, optimized for 64-bit platforms and produces digests of any size " "between 1 and 64 bytes," @@ -529,7 +529,7 @@ msgstr "" "**BLAKE2b**,針對 64 位元平台進行了最佳化,可生成 1 到 64 位元組之間任意大小" "的摘要," -#: ../../library/hashlib.rst:379 +#: ../../library/hashlib.rst:381 msgid "" "**BLAKE2s**, optimized for 8- to 32-bit platforms and produces digests of " "any size between 1 and 32 bytes." @@ -537,7 +537,7 @@ msgstr "" "**BLAKE2s**,針對 8 至 32 位元平台進行了最佳化,可生成 1 至 32 位元組之間任意" "大小的摘要。" -#: ../../library/hashlib.rst:382 +#: ../../library/hashlib.rst:384 msgid "" "BLAKE2 supports **keyed mode** (a faster and simpler replacement for HMAC_), " "**salted hashing**, **personalization**, and **tree hashing**." @@ -545,21 +545,21 @@ msgstr "" "BLAKE2 支援\\ **密鑰模式 (keyed mode)** (更快、更簡單的 HMAC_ 替代品)、**加" "鹽雜湊 (salted hashing)**、**個人化**\\ 和\\ **樹狀雜湊**。" -#: ../../library/hashlib.rst:385 +#: ../../library/hashlib.rst:387 msgid "" "Hash objects from this module follow the API of standard library's :mod:" "`hashlib` objects." msgstr "該模組中的雜湊物件遵循標準函式庫的 :mod:`hashlib` 物件 API。" -#: ../../library/hashlib.rst:390 +#: ../../library/hashlib.rst:392 msgid "Creating hash objects" msgstr "建立雜湊物件" -#: ../../library/hashlib.rst:392 +#: ../../library/hashlib.rst:394 msgid "New hash objects are created by calling constructor functions:" msgstr "新的雜湊物件是透過呼叫建構函式建立的:" -#: ../../library/hashlib.rst:406 +#: ../../library/hashlib.rst:408 msgid "" "These functions return the corresponding hash objects for calculating " "BLAKE2b or BLAKE2s. They optionally take these general parameters:" @@ -567,7 +567,7 @@ msgstr "" "這些函式回傳相應的雜湊物件以計算 BLAKE2b 或 BLAKE2s。他們可以選擇採用這些通用" "參數:" -#: ../../library/hashlib.rst:409 +#: ../../library/hashlib.rst:411 msgid "" "*data*: initial chunk of data to hash, which must be :term:`bytes-like " "object`. It can be passed only as positional argument." @@ -575,18 +575,18 @@ msgstr "" "*data*:要雜湊的初始資料塊 (data chunk),它必須是\\ :term:`類位元組物件 " "`。它只能作為位置引數傳遞。" -#: ../../library/hashlib.rst:412 +#: ../../library/hashlib.rst:414 msgid "*digest_size*: size of output digest in bytes." msgstr "*digest_size*:輸出摘要的大小(以位元組為單位)。" -#: ../../library/hashlib.rst:414 +#: ../../library/hashlib.rst:416 msgid "" "*key*: key for keyed hashing (up to 64 bytes for BLAKE2b, up to 32 bytes for " "BLAKE2s)." msgstr "" "*key*:用於密鑰雜湊的密鑰(BLAKE2b 最多 64 位元組、BLAKE2s 最多 32 位元組)。" -#: ../../library/hashlib.rst:417 +#: ../../library/hashlib.rst:419 msgid "" "*salt*: salt for randomized hashing (up to 16 bytes for BLAKE2b, up to 8 " "bytes for BLAKE2s)." @@ -594,62 +594,62 @@ msgstr "" "*salt*:用於隨機雜湊的鹽(BLAKE2b 最多 16 個位元組、BLAKE2s 最多 8 個位元" "組)。" -#: ../../library/hashlib.rst:420 +#: ../../library/hashlib.rst:422 msgid "" "*person*: personalization string (up to 16 bytes for BLAKE2b, up to 8 bytes " "for BLAKE2s)." msgstr "" "*person*:個人化字串(BLAKE2b 最多 16 個位元組、BLAKE2s 最多 8 個位元組)。" -#: ../../library/hashlib.rst:423 +#: ../../library/hashlib.rst:425 msgid "The following table shows limits for general parameters (in bytes):" msgstr "下表顯示了一般參數的限制(以位元組為單位):" -#: ../../library/hashlib.rst:426 +#: ../../library/hashlib.rst:428 msgid "Hash" msgstr "雜湊" -#: ../../library/hashlib.rst:426 +#: ../../library/hashlib.rst:428 msgid "digest_size" msgstr "digest_size" -#: ../../library/hashlib.rst:426 +#: ../../library/hashlib.rst:428 msgid "len(key)" msgstr "len(key)" -#: ../../library/hashlib.rst:426 +#: ../../library/hashlib.rst:428 msgid "len(salt)" msgstr "len(salt)" -#: ../../library/hashlib.rst:426 +#: ../../library/hashlib.rst:428 msgid "len(person)" msgstr "len(person)" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:430 msgid "BLAKE2b" msgstr "BLAKE2b" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:430 msgid "64" msgstr "64" -#: ../../library/hashlib.rst:428 +#: ../../library/hashlib.rst:430 msgid "16" msgstr "16" -#: ../../library/hashlib.rst:429 +#: ../../library/hashlib.rst:431 msgid "BLAKE2s" msgstr "BLAKE2s" -#: ../../library/hashlib.rst:429 +#: ../../library/hashlib.rst:431 msgid "32" msgstr "32" -#: ../../library/hashlib.rst:429 +#: ../../library/hashlib.rst:431 msgid "8" msgstr "8" -#: ../../library/hashlib.rst:434 +#: ../../library/hashlib.rst:436 msgid "" "BLAKE2 specification defines constant lengths for salt and personalization " "parameters, however, for convenience, this implementation accepts byte " @@ -663,26 +663,26 @@ msgstr "" "以像是 ``b'salt`` 和 ``b'salt\\x00`` 是相同的值。(但 *key* 的情況並非如" "此。)" -#: ../../library/hashlib.rst:441 +#: ../../library/hashlib.rst:443 msgid "These sizes are available as module `constants`_ described below." msgstr "這些大小可作為模組\\ `常數 `_\\ 使用,如下所述。" -#: ../../library/hashlib.rst:443 +#: ../../library/hashlib.rst:445 msgid "" "Constructor functions also accept the following tree hashing parameters:" msgstr "建構函式還接受以下樹狀雜湊參數:" -#: ../../library/hashlib.rst:445 +#: ../../library/hashlib.rst:447 msgid "*fanout*: fanout (0 to 255, 0 if unlimited, 1 in sequential mode)." msgstr "*fanout*:扇出(0 到 255,如果無限制則為 0、順序模式為 1)。" -#: ../../library/hashlib.rst:447 +#: ../../library/hashlib.rst:449 msgid "" "*depth*: maximal depth of tree (1 to 255, 255 if unlimited, 1 in sequential " "mode)." msgstr "*depth*:樹的最大深度(1 到 255,如果無限制則為 255、順序模式為 1)。" -#: ../../library/hashlib.rst:450 +#: ../../library/hashlib.rst:452 msgid "" "*leaf_size*: maximal byte length of leaf (0 to ``2**32-1``, 0 if unlimited " "or in sequential mode)." @@ -690,7 +690,7 @@ msgstr "" "*leaf_size*:葉的最大位元組長度(0 到 ``2**32-1``,如果無限制或處於順序模式則" "為 0)。" -#: ../../library/hashlib.rst:453 +#: ../../library/hashlib.rst:455 msgid "" "*node_offset*: node offset (0 to ``2**64-1`` for BLAKE2b, 0 to ``2**48-1`` " "for BLAKE2s, 0 for the first, leftmost, leaf, or in sequential mode)." @@ -698,12 +698,12 @@ msgstr "" "*node_offset*:節點偏移量(BLAKE2b 為 0 到 ``2**64-1``,BLAKE2s 為 0 到 " "``2**48-1``,0 表示第一個、最左邊、葉子或在順序模式下)。" -#: ../../library/hashlib.rst:456 +#: ../../library/hashlib.rst:458 msgid "" "*node_depth*: node depth (0 to 255, 0 for leaves, or in sequential mode)." msgstr "*node_depth*:節點深度(0 到 255,葉為 0,或在順序模式下)。" -#: ../../library/hashlib.rst:458 +#: ../../library/hashlib.rst:460 msgid "" "*inner_size*: inner digest size (0 to 64 for BLAKE2b, 0 to 32 for BLAKE2s, 0 " "in sequential mode)." @@ -711,18 +711,18 @@ msgstr "" "*inner_size*:內部摘要大小(BLAKE2b 為 0 到 64,BLAKE2s 為 0 到 32,順序模式" "為 0)。" -#: ../../library/hashlib.rst:461 +#: ../../library/hashlib.rst:463 msgid "" "*last_node*: boolean indicating whether the processed node is the last one " "(``False`` for sequential mode)." msgstr "" "*last_node*:布林值,代表處理的節點是否為最後一個(``False`` 代表順序模式)。" -#: ../../library/hashlib.rst:464 +#: ../../library/hashlib.rst:466 msgid "Explanation of tree mode parameters." msgstr "樹狀模式參數說明。" -#: ../../library/hashlib.rst:468 +#: ../../library/hashlib.rst:470 msgid "" "See section 2.10 in `BLAKE2 specification `_ for comprehensive review of tree hashing." @@ -730,36 +730,36 @@ msgstr "" "關於樹狀雜湊的綜合回顧,請參閱 `BLAKE2 規範 `_\\ 中的第 2.10 節。" -#: ../../library/hashlib.rst:474 +#: ../../library/hashlib.rst:476 msgid "Constants" msgstr "常數" -#: ../../library/hashlib.rst:479 +#: ../../library/hashlib.rst:481 msgid "Salt length (maximum length accepted by constructors)." msgstr "鹽長度(建構函式接受的最大長度)。" -#: ../../library/hashlib.rst:485 +#: ../../library/hashlib.rst:487 msgid "" "Personalization string length (maximum length accepted by constructors)." msgstr "個人化字串長度(建構函式接受的最大長度)。" -#: ../../library/hashlib.rst:491 +#: ../../library/hashlib.rst:493 msgid "Maximum key size." msgstr "最大密鑰大小。" -#: ../../library/hashlib.rst:497 +#: ../../library/hashlib.rst:499 msgid "Maximum digest size that the hash function can output." msgstr "雜湊函式可以輸出的最大摘要大小。" -#: ../../library/hashlib.rst:501 +#: ../../library/hashlib.rst:503 msgid "Examples" msgstr "範例" -#: ../../library/hashlib.rst:504 +#: ../../library/hashlib.rst:506 msgid "Simple hashing" msgstr "簡單雜湊" -#: ../../library/hashlib.rst:506 +#: ../../library/hashlib.rst:508 msgid "" "To calculate hash of some data, you should first construct a hash object by " "calling the appropriate constructor function (:func:`blake2b` or :func:" @@ -772,7 +772,7 @@ msgstr "" "update` 來以資料對它更新,最後透過呼叫 :meth:`~hash.digest`\\ (或對於十六進" "位編碼字串則為 :meth:`~hash.hexdigest`)從物件中獲得摘要。" -#: ../../library/hashlib.rst:519 +#: ../../library/hashlib.rst:521 msgid "" "As a shortcut, you can pass the first chunk of data to update directly to " "the constructor as the positional argument:" @@ -780,17 +780,17 @@ msgstr "" "作為一個快捷方式,你可以將要更新的第一個資料塊作為位置引數直接傳遞給建構函" "式:" -#: ../../library/hashlib.rst:526 +#: ../../library/hashlib.rst:528 msgid "" "You can call :meth:`hash.update` as many times as you need to iteratively " "update the hash:" msgstr "你可以根據需求來多次呼叫 :meth:`hash.update` 以疊代更新雜湊:" -#: ../../library/hashlib.rst:540 +#: ../../library/hashlib.rst:542 msgid "Using different digest sizes" msgstr "使用不同的摘要大小" -#: ../../library/hashlib.rst:542 +#: ../../library/hashlib.rst:544 msgid "" "BLAKE2 has configurable size of digests up to 64 bytes for BLAKE2b and up to " "32 bytes for BLAKE2s. For example, to replace SHA-1 with BLAKE2b without " @@ -800,7 +800,7 @@ msgstr "" "組。例如,要在不改變輸出大小的情況下用 BLAKE2b 替換 SHA-1,我們可以指定 " "BLAKE2b 生成 20 位元組的摘要:" -#: ../../library/hashlib.rst:556 +#: ../../library/hashlib.rst:558 msgid "" "Hash objects with different digest sizes have completely different outputs " "(shorter hashes are *not* prefixes of longer hashes); BLAKE2b and BLAKE2s " @@ -809,11 +809,11 @@ msgstr "" "具有不同摘要大小的雜湊物件具有完全不同的輸出(較短的雜湊值\\ *不是*\\ 較長雜" "湊值的前綴);即使輸出長度相同,BLAKE2b 和 BLAKE2s 也會產生不同的輸出:" -#: ../../library/hashlib.rst:572 +#: ../../library/hashlib.rst:574 msgid "Keyed hashing" msgstr "密鑰雜湊 (Keyed hashing)" -#: ../../library/hashlib.rst:574 +#: ../../library/hashlib.rst:576 msgid "" "Keyed hashing can be used for authentication as a faster and simpler " "replacement for `Hash-based message authentication code >> from hashlib import blake2b\n" ">>> h = blake2b(key=b'pseudorandom key', digest_size=16)\n" @@ -847,7 +847,7 @@ msgstr "" ">>> h.hexdigest()\n" "'3d363ff7401e02026f4a4687d4863ced'" -#: ../../library/hashlib.rst:590 +#: ../../library/hashlib.rst:592 msgid "" "As a practical example, a web application can symmetrically sign cookies " "sent to users and later verify them to make sure they weren't tampered with::" @@ -855,7 +855,7 @@ msgstr "" "舉一個實際的例子,網頁應用程式可以對發送給使用者的 cookie 進行對稱簽名 " "(symmetrically sign),然後驗證它們以確保它們沒有被篡改: ::" -#: ../../library/hashlib.rst:593 +#: ../../library/hashlib.rst:595 msgid "" ">>> from hashlib import blake2b\n" ">>> from hmac import compare_digest\n" @@ -909,7 +909,7 @@ msgstr "" ">>> verify(cookie, b'0102030405060708090a0b0c0d0e0f00')\n" "False" -#: ../../library/hashlib.rst:619 +#: ../../library/hashlib.rst:621 msgid "" "Even though there's a native keyed hashing mode, BLAKE2 can, of course, be " "used in HMAC construction with :mod:`hmac` module::" @@ -917,7 +917,7 @@ msgstr "" "儘管有原生密鑰雜湊模式,BLAKE2 還是可以透過 :mod:`hmac` 模組用於建構 " "HMAC: ::" -#: ../../library/hashlib.rst:622 +#: ../../library/hashlib.rst:624 msgid "" ">>> import hmac, hashlib\n" ">>> m = hmac.new(b'secret key', digestmod=hashlib.blake2s)\n" @@ -931,11 +931,11 @@ msgstr "" ">>> m.hexdigest()\n" "'e3c8102868d28b5ff85fc35dda07329970d1a01e273c37481326fe0c861c8142'" -#: ../../library/hashlib.rst:630 +#: ../../library/hashlib.rst:632 msgid "Randomized hashing" msgstr "隨機雜湊 (Randomized hashing)" -#: ../../library/hashlib.rst:632 +#: ../../library/hashlib.rst:634 msgid "" "By setting *salt* parameter users can introduce randomization to the hash " "function. Randomized hashing is useful for protecting against collision " @@ -944,7 +944,7 @@ msgstr "" "透過設定 *salt* 參數,使用者可以向雜湊函式引入隨機化。隨機雜湊在防止針對數位" "簽章中雜湊函式的碰撞攻擊 (collision attacks) 非常有用。" -#: ../../library/hashlib.rst:636 +#: ../../library/hashlib.rst:638 msgid "" "Randomized hashing is designed for situations where one party, the message " "preparer, generates all or part of a message to be signed by a second party, " @@ -975,7 +975,7 @@ msgstr "" "的所有部分都是由簽名者所準備好的,使用隨機雜湊可能會降低數位簽章提供的安全" "性。" -#: ../../library/hashlib.rst:655 +#: ../../library/hashlib.rst:657 msgid "" "(`NIST SP-800-106 \"Randomized Hashing for Digital Signatures\" `_)" @@ -983,7 +983,7 @@ msgstr "" "(`NIST SP-800-106 「數位簽章的隨機雜湊 (Randomized Hashing for Digital " "Signatures)」 `_)" -#: ../../library/hashlib.rst:658 +#: ../../library/hashlib.rst:660 msgid "" "In BLAKE2 the salt is processed as a one-time input to the hash function " "during initialization, rather than as an input to each compression function." @@ -991,7 +991,7 @@ msgstr "" "在 BLAKE2 中,鹽在初始化期間作為雜湊函式的一次性輸入被處理,而不是作為每個壓" "縮函式的輸入。" -#: ../../library/hashlib.rst:663 +#: ../../library/hashlib.rst:665 msgid "" "*Salted hashing* (or just hashing) with BLAKE2 or any other general-purpose " "cryptographic hash function, such as SHA-256, is not suitable for hashing " @@ -1002,11 +1002,11 @@ msgstr "" "純雜湊)不適合對密碼進行雜湊處理。有關更多資訊,請參閱 `BLAKE2 FAQ `_ 。" -#: ../../library/hashlib.rst:686 +#: ../../library/hashlib.rst:688 msgid "Personalization" msgstr "個人化" -#: ../../library/hashlib.rst:688 +#: ../../library/hashlib.rst:690 msgid "" "Sometimes it is useful to force hash function to produce different digests " "for the same input for different purposes. Quoting the authors of the Skein " @@ -1015,7 +1015,7 @@ msgstr "" "有時候強制雜湊函式為不同目的的相同輸入生成不同的摘要是很有用的。引用 Skein 雜" "湊函式的作者的話:" -#: ../../library/hashlib.rst:692 +#: ../../library/hashlib.rst:694 msgid "" "We recommend that all application designers seriously consider doing this; " "we have seen many protocols where a hash that is computed in one part of the " @@ -1029,7 +1029,7 @@ msgstr "" "關的資料上完成的,並且攻擊者可以強制應用程式將雜湊輸入設為相同的。對協議中使" "用的每個雜湊函式進行個人化可以立即阻止此類攻擊。" -#: ../../library/hashlib.rst:699 +#: ../../library/hashlib.rst:701 msgid "" "(`The Skein Hash Function Family `_, p. 21)" @@ -1037,11 +1037,11 @@ msgstr "" "(`Skein 雜湊函式系列 `_,第 21 頁)" -#: ../../library/hashlib.rst:703 +#: ../../library/hashlib.rst:705 msgid "BLAKE2 can be personalized by passing bytes to the *person* argument::" msgstr "BLAKE2 可以透過將位元組傳遞給 *person* 引數來做個人化: ::" -#: ../../library/hashlib.rst:705 +#: ../../library/hashlib.rst:707 msgid "" ">>> from hashlib import blake2b\n" ">>> FILES_HASH_PERSON = b'MyApp Files Hash'\n" @@ -1067,21 +1067,21 @@ msgstr "" ">>> h.hexdigest()\n" "'cf68fb5761b9c44e7878bfb2c4c9aea52264a80b75005e65619778de59f383a3'" -#: ../../library/hashlib.rst:717 +#: ../../library/hashlib.rst:719 msgid "" "Personalization together with the keyed mode can also be used to derive " "different keys from a single one." msgstr "個人化與密鑰模式還可以一起用於從單個密鑰得出不同的密鑰。" -#: ../../library/hashlib.rst:731 +#: ../../library/hashlib.rst:733 msgid "Tree mode" msgstr "樹狀模式" -#: ../../library/hashlib.rst:733 +#: ../../library/hashlib.rst:735 msgid "Here's an example of hashing a minimal tree with two leaf nodes::" msgstr "下面是對具有兩個葉節點的最小樹進行雜湊處理的範例: ::" -#: ../../library/hashlib.rst:735 +#: ../../library/hashlib.rst:737 msgid "" " 10\n" " / \\\n" @@ -1091,13 +1091,13 @@ msgstr "" " / \\\n" "00 01" -#: ../../library/hashlib.rst:739 +#: ../../library/hashlib.rst:741 msgid "" "This example uses 64-byte internal digests, and returns the 32-byte final " "digest::" msgstr "此範例使用 64-byte 內部摘要,並回傳 32-byte 最終摘要: ::" -#: ../../library/hashlib.rst:742 +#: ../../library/hashlib.rst:744 msgid "" ">>> from hashlib import blake2b\n" ">>>\n" @@ -1151,11 +1151,11 @@ msgstr "" ">>> h10.hexdigest()\n" "'3ad2a9b37c6070e374c7a8c508fe20ca86b6ed54e286e93a0318e95e881db5aa'" -#: ../../library/hashlib.rst:769 +#: ../../library/hashlib.rst:771 msgid "Credits" msgstr "製作人員" -#: ../../library/hashlib.rst:771 +#: ../../library/hashlib.rst:773 msgid "" "BLAKE2_ was designed by *Jean-Philippe Aumasson*, *Samuel Neves*, *Zooko " "Wilcox-O'Hearn*, and *Christian Winnerlein* based on SHA-3_ finalist BLAKE_ " @@ -1167,13 +1167,13 @@ msgstr "" "Henzen*、*Willi Meier* 和 *Raphael C.-W. Phan* 所建立的 SHA-3_ 最終版本 " "BLAKE_。" -#: ../../library/hashlib.rst:776 +#: ../../library/hashlib.rst:778 msgid "" "It uses core algorithm from ChaCha_ cipher designed by *Daniel J. " "Bernstein*." msgstr "它使用 *Daniel J. Bernstein* 設計的 ChaCha_ 密碼的核心演算法。" -#: ../../library/hashlib.rst:778 +#: ../../library/hashlib.rst:780 msgid "" "The stdlib implementation is based on pyblake2_ module. It was written by " "*Dmitry Chestnykh* based on C implementation written by *Samuel Neves*. The " @@ -1183,17 +1183,17 @@ msgstr "" "Neves* 的 C 版本實作為基礎所編寫的。該文件是由 *Dmitry Chestnykh* 編寫並從 " "pyblake2_ 複製過來的。" -#: ../../library/hashlib.rst:782 +#: ../../library/hashlib.rst:784 msgid "The C code was partly rewritten for Python by *Christian Heimes*." msgstr "*Christian Heimes* 為 Python 重寫了部分 C 程式碼。" -#: ../../library/hashlib.rst:784 +#: ../../library/hashlib.rst:786 msgid "" "The following public domain dedication applies for both C hash function " "implementation, extension code, and this documentation:" msgstr "以下公開領域貢獻適用於 C 雜湊函式實作、擴充程式碼和此文件:" -#: ../../library/hashlib.rst:787 +#: ../../library/hashlib.rst:789 msgid "" "To the extent possible under law, the author(s) have dedicated all copyright " "and related and neighboring rights to this software to the public domain " @@ -1202,7 +1202,7 @@ msgstr "" "在法律允許的範圍內,作者已將該軟體的所有版權以及相關和鄰接權利奉獻給全球的公" "開領域。該軟體的發布沒有任何授權 (warranty)。" -#: ../../library/hashlib.rst:791 +#: ../../library/hashlib.rst:793 msgid "" "You should have received a copy of the CC0 Public Domain Dedication along " "with this software. If not, see https://creativecommons.org/publicdomain/" @@ -1212,7 +1212,7 @@ msgstr "" "Dedication) 的副本。如果沒有,請參閱 https://creativecommons.org/" "publicdomain/zero/1.0/ 。" -#: ../../library/hashlib.rst:795 +#: ../../library/hashlib.rst:797 msgid "" "The following people have helped with development or contributed their " "changes to the project and the public domain according to the Creative " @@ -1221,55 +1221,55 @@ msgstr "" "以下人員根據創用 CC 通用公眾領域貢獻宣告 1.0 (Creative Commons Public Domain " "Dedication 1.0 Universal) 於專案和公開領域做出了開發或貢獻:" -#: ../../library/hashlib.rst:799 +#: ../../library/hashlib.rst:801 msgid "*Alexandr Sokolovskiy*" msgstr "*Alexandr Sokolovskiy*" -#: ../../library/hashlib.rst:819 +#: ../../library/hashlib.rst:821 msgid "Module :mod:`hmac`" msgstr ":mod:`hmac` 模組" -#: ../../library/hashlib.rst:820 +#: ../../library/hashlib.rst:822 msgid "A module to generate message authentication codes using hashes." msgstr "使用雜湊生成訊息驗證程式碼的模組。" -#: ../../library/hashlib.rst:822 +#: ../../library/hashlib.rst:824 msgid "Module :mod:`base64`" msgstr ":mod:`base64` 模組" -#: ../../library/hashlib.rst:823 +#: ../../library/hashlib.rst:825 msgid "Another way to encode binary hashes for non-binary environments." msgstr "另一種在非二進位環境中編碼二進位雜湊的方法。" -#: ../../library/hashlib.rst:825 +#: ../../library/hashlib.rst:827 msgid "https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.180-4.pdf" msgstr "https://nvlpubs.nist.gov/nistpubs/fips/nist.fips.180-4.pdf" -#: ../../library/hashlib.rst:826 +#: ../../library/hashlib.rst:828 msgid "The FIPS 180-4 publication on Secure Hash Algorithms." msgstr "有關安全雜湊演算法的 FIPS 180-4 出版物。" -#: ../../library/hashlib.rst:828 +#: ../../library/hashlib.rst:830 msgid "https://csrc.nist.gov/pubs/fips/202/final" msgstr "https://csrc.nist.gov/pubs/fips/202/final" -#: ../../library/hashlib.rst:829 +#: ../../library/hashlib.rst:831 msgid "The FIPS 202 publication on the SHA-3 Standard." msgstr "有關 SHA-3 標準的 FIPS 202 出版物。" -#: ../../library/hashlib.rst:831 +#: ../../library/hashlib.rst:833 msgid "https://www.blake2.net/" msgstr "https://www.blake2.net/" -#: ../../library/hashlib.rst:832 +#: ../../library/hashlib.rst:834 msgid "Official BLAKE2 website." msgstr "BLAKE2 官方網站。" -#: ../../library/hashlib.rst:834 +#: ../../library/hashlib.rst:836 msgid "https://en.wikipedia.org/wiki/Cryptographic_hash_function" msgstr "https://en.wikipedia.org/wiki/Cryptographic_hash_function" -#: ../../library/hashlib.rst:835 +#: ../../library/hashlib.rst:837 msgid "" "Wikipedia article with information on which algorithms have known issues and " "what that means regarding their use." @@ -1277,21 +1277,21 @@ msgstr "" "包含有關哪些演算法存在已知問題以及這些問題對其使用意味著什麼資訊的維基百科文" "章。" -#: ../../library/hashlib.rst:838 +#: ../../library/hashlib.rst:840 msgid "https://www.ietf.org/rfc/rfc8018.txt" msgstr "https://www.ietf.org/rfc/rfc8018.txt" -#: ../../library/hashlib.rst:839 +#: ../../library/hashlib.rst:841 msgid "PKCS #5: Password-Based Cryptography Specification Version 2.1" msgstr "PKCS #5:基於密碼的加密規範版本 2.1" -#: ../../library/hashlib.rst:841 +#: ../../library/hashlib.rst:843 msgid "" "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf" msgstr "" "https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf" -#: ../../library/hashlib.rst:842 +#: ../../library/hashlib.rst:844 msgid "NIST Recommendation for Password-Based Key Derivation." msgstr "NIST(美國國家標準技術研究院)針對基於密碼的密鑰衍生的建議。" @@ -1315,6 +1315,6 @@ msgstr "OpenSSL" msgid "(use in module hashlib)" msgstr "(使用於 hashlib 模組中)" -#: ../../library/hashlib.rst:370 +#: ../../library/hashlib.rst:372 msgid "blake2b, blake2s" msgstr "blake2b, blake2s" diff --git a/library/heapq.po b/library/heapq.po index 41ee95e112..859f7606c5 100644 --- a/library/heapq.po +++ b/library/heapq.po @@ -6,7 +6,7 @@ # 周 忠毅 , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-07-01 18:20+0800\n" diff --git a/library/hmac.po b/library/hmac.po index 6dea034e07..96c143d75c 100644 --- a/library/hmac.po +++ b/library/hmac.po @@ -7,7 +7,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-03-30 00:16+0800\n" diff --git a/library/html.entities.po b/library/html.entities.po index 369e99c012..1131e507aa 100644 --- a/library/html.entities.po +++ b/library/html.entities.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-06-27 09:38+0800\n" diff --git a/library/html.parser.po b/library/html.parser.po index 69c985c715..f8c640799e 100644 --- a/library/html.parser.po +++ b/library/html.parser.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-05-04 22:54+0800\n" diff --git a/library/html.po b/library/html.po index 8fe70f0764..5da95baaf8 100644 --- a/library/html.po +++ b/library/html.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/http.client.po b/library/http.client.po index 04fdaaf61f..e9a367037e 100644 --- a/library/http.client.po +++ b/library/http.client.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -45,17 +45,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`Availability `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/http.client.rst:33 msgid "The module provides the following classes:" diff --git a/library/http.cookiejar.po b/library/http.cookiejar.po index f8330d7865..6184715dab 100644 --- a/library/http.cookiejar.po +++ b/library/http.cookiejar.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2016-11-19 00:31+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -223,7 +223,7 @@ msgstr "" #: ../../library/http.cookiejar.rst:153 msgid ":class:`CookieJar` has the following methods:" -msgstr "" +msgstr ":class:`CookieJar` 擁有以下方法:" #: ../../library/http.cookiejar.rst:158 msgid "Add correct :mailheader:`Cookie` header to *request*." diff --git a/library/http.cookies.po b/library/http.cookies.po index 543c129b71..4bd8b76059 100644 --- a/library/http.cookies.po +++ b/library/http.cookies.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-11-19 00:31+0000\n" diff --git a/library/http.po b/library/http.po index d1d4167712..96924cb5a1 100644 --- a/library/http.po +++ b/library/http.po @@ -5,9 +5,9 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -74,8 +74,8 @@ msgstr "" ":class:`enum.IntEnum` 的子類別,它定義了一組 HTTP 狀態碼、原理短語 (reason " "phrase) 以及英文長描述。" -#: ../../library/http.rst:34 ../../library/http.rst:157 -#: ../../library/http.rst:171 +#: ../../library/http.rst:34 ../../library/http.rst:161 +#: ../../library/http.rst:175 msgid "Usage::" msgstr "用法: ::" @@ -126,12 +126,12 @@ msgstr "" msgid "Code" msgstr "狀態碼" -#: ../../library/http.rst:60 ../../library/http.rst:204 +#: ../../library/http.rst:60 ../../library/http.rst:208 msgid "Enum Name" msgstr "列舉名稱" -#: ../../library/http.rst:60 ../../library/http.rst:148 -#: ../../library/http.rst:204 +#: ../../library/http.rst:60 ../../library/http.rst:152 +#: ../../library/http.rst:208 msgid "Details" msgstr "詳情" @@ -144,7 +144,8 @@ msgid "``CONTINUE``" msgstr "``CONTINUE``" #: ../../library/http.rst:62 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.2.1" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.2.1" msgstr "HTTP/1.1 :rfc:`7231`,6.2.1 節" #: ../../library/http.rst:63 @@ -156,7 +157,8 @@ msgid "``SWITCHING_PROTOCOLS``" msgstr "``SWITCHING_PROTOCOLS``" #: ../../library/http.rst:63 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.2.2" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.2.2" msgstr "HTTP/1.1 :rfc:`7231`,6.2.2 節" #: ../../library/http.rst:64 @@ -192,7 +194,8 @@ msgid "``OK``" msgstr "``OK``" #: ../../library/http.rst:66 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.3.1" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.3.1" msgstr "HTTP/1.1 :rfc:`7231`,6.3.1 節" #: ../../library/http.rst:67 @@ -204,7 +207,8 @@ msgid "``CREATED``" msgstr "``CREATED``" #: ../../library/http.rst:67 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.3.2" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.3.2" msgstr "HTTP/1.1 :rfc:`7231`,6.3.2 節" #: ../../library/http.rst:68 @@ -216,7 +220,8 @@ msgid "``ACCEPTED``" msgstr "``ACCEPTED``" #: ../../library/http.rst:68 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.3.3" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.3.3" msgstr "HTTP/1.1 :rfc:`7231`,6.3.3 節" #: ../../library/http.rst:69 @@ -228,7 +233,8 @@ msgid "``NON_AUTHORITATIVE_INFORMATION``" msgstr "``NON_AUTHORITATIVE_INFORMATION``" #: ../../library/http.rst:69 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.3.4" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.3.4" msgstr "HTTP/1.1 :rfc:`7231`,6.3.4 節" #: ../../library/http.rst:70 @@ -240,7 +246,8 @@ msgid "``NO_CONTENT``" msgstr "``NO_CONTENT``" #: ../../library/http.rst:70 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.3.5" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.3.5" msgstr "HTTP/1.1 :rfc:`7231`,6.3.5 節" #: ../../library/http.rst:71 @@ -252,7 +259,8 @@ msgid "``RESET_CONTENT``" msgstr "``RESET_CONTENT``" #: ../../library/http.rst:71 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.3.6" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.3.6" msgstr "HTTP/1.1 :rfc:`7231`,6.3.6 節" #: ../../library/http.rst:72 @@ -264,8 +272,9 @@ msgid "``PARTIAL_CONTENT``" msgstr "``PARTIAL_CONTENT``" #: ../../library/http.rst:72 -msgid "HTTP/1.1 :rfc:`7233`, Section 4.1" -msgstr "HTTP/1.1 :rfc:`7233`,4.1 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.3.7" +msgstr "HTTP/1.1 :rfc:`7231`,4.3.7 節" #: ../../library/http.rst:73 msgid "``207``" @@ -312,7 +321,8 @@ msgid "``MULTIPLE_CHOICES``" msgstr "``MULTIPLE_CHOICES``" #: ../../library/http.rst:76 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.1" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.1" msgstr "HTTP/1.1 :rfc:`7231`,6.4.1 節" #: ../../library/http.rst:77 @@ -324,7 +334,8 @@ msgid "``MOVED_PERMANENTLY``" msgstr "``MOVED_PERMANENTLY``" #: ../../library/http.rst:77 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.2" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.2" msgstr "HTTP/1.1 :rfc:`7231`,6.4.2 節" #: ../../library/http.rst:78 @@ -336,7 +347,8 @@ msgid "``FOUND``" msgstr "``FOUND``" #: ../../library/http.rst:78 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.3" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.3" msgstr "HTTP/1.1 :rfc:`7231`,6.4.3 節" #: ../../library/http.rst:79 @@ -348,7 +360,8 @@ msgid "``SEE_OTHER``" msgstr "``SEE_OTHER``" #: ../../library/http.rst:79 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.4" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.4" msgstr "HTTP/1.1 :rfc:`7231`,6.4.4 節" #: ../../library/http.rst:80 @@ -360,8 +373,9 @@ msgid "``NOT_MODIFIED``" msgstr "``NOT_MODIFIED``" #: ../../library/http.rst:80 -msgid "HTTP/1.1 :rfc:`7232`, Section 4.1" -msgstr "HTTP/1.1 :rfc:`7232`,4.1 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.5" +msgstr "HTTP/1.1 :rfc:`7231`,6.4.5 節" #: ../../library/http.rst:81 msgid "``305``" @@ -372,8 +386,9 @@ msgid "``USE_PROXY``" msgstr "``USE_PROXY``" #: ../../library/http.rst:81 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.5" -msgstr "HTTP/1.1 :rfc:`7231`,6.4.5 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.6" +msgstr "HTTP/1.1 :rfc:`7231`,6.3.6 節" #: ../../library/http.rst:82 msgid "``307``" @@ -384,8 +399,9 @@ msgid "``TEMPORARY_REDIRECT``" msgstr "``TEMPORARY_REDIRECT``" #: ../../library/http.rst:82 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.7" -msgstr "HTTP/1.1 :rfc:`7231`,6.4.7 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.8" +msgstr "HTTP/1.1 :rfc:`7231`,6.4.1 節" #: ../../library/http.rst:83 msgid "``308``" @@ -396,8 +412,9 @@ msgid "``PERMANENT_REDIRECT``" msgstr "``PERMANENT_REDIRECT``" #: ../../library/http.rst:83 -msgid "Permanent Redirect :rfc:`7238`, Section 3 (Experimental)" -msgstr "永久重定向 :rfc:`7238`,3 節(實驗性)" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.4.9" +msgstr "HTTP/1.1 :rfc:`7231`,6.4.1 節" #: ../../library/http.rst:84 msgid "``400``" @@ -408,7 +425,8 @@ msgid "``BAD_REQUEST``" msgstr "``BAD_REQUEST``" #: ../../library/http.rst:84 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.1" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.1" msgstr "HTTP/1.1 :rfc:`7231`,6.5.1 節" #: ../../library/http.rst:85 @@ -420,8 +438,9 @@ msgid "``UNAUTHORIZED``" msgstr "``UNAUTHORIZED``" #: ../../library/http.rst:85 -msgid "HTTP/1.1 Authentication :rfc:`7235`, Section 3.1" -msgstr "HTTP/1.1 身分驗證 (Authentication) :rfc:`7235`,3.1 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.2" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.2 節" #: ../../library/http.rst:86 msgid "``402``" @@ -432,8 +451,9 @@ msgid "``PAYMENT_REQUIRED``" msgstr "``PAYMENT_REQUIRED``" #: ../../library/http.rst:86 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.2" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.2 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.3" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.3 節" #: ../../library/http.rst:87 msgid "``403``" @@ -444,8 +464,9 @@ msgid "``FORBIDDEN``" msgstr "``FORBIDDEN``" #: ../../library/http.rst:87 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.3" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.3 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.4" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.4 節" #: ../../library/http.rst:88 msgid "``404``" @@ -456,8 +477,9 @@ msgid "``NOT_FOUND``" msgstr "``NOT_FOUND``" #: ../../library/http.rst:88 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.4" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.4 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.5" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.5 節" #: ../../library/http.rst:89 msgid "``405``" @@ -468,8 +490,9 @@ msgid "``METHOD_NOT_ALLOWED``" msgstr "``METHOD_NOT_ALLOWED``" #: ../../library/http.rst:89 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.5" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.5 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.6" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.6 節" #: ../../library/http.rst:90 msgid "``406``" @@ -480,8 +503,9 @@ msgid "``NOT_ACCEPTABLE``" msgstr "``NOT_ACCEPTABLE``" #: ../../library/http.rst:90 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.6" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.6 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.7" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.7 節" #: ../../library/http.rst:91 msgid "``407``" @@ -492,8 +516,9 @@ msgid "``PROXY_AUTHENTICATION_REQUIRED``" msgstr "``PROXY_AUTHENTICATION_REQUIRED``" #: ../../library/http.rst:91 -msgid "HTTP/1.1 Authentication :rfc:`7235`, Section 3.2" -msgstr "HTTP/1.1 身分驗證 :rfc:`7235`,3.2 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.8" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.8 節" #: ../../library/http.rst:92 msgid "``408``" @@ -504,8 +529,9 @@ msgid "``REQUEST_TIMEOUT``" msgstr "``REQUEST_TIMEOUT``" #: ../../library/http.rst:92 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.7" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.7 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.9" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.9 節" #: ../../library/http.rst:93 msgid "``409``" @@ -516,8 +542,9 @@ msgid "``CONFLICT``" msgstr "``CONFLICT``" #: ../../library/http.rst:93 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.8" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.8 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.10" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.10 節" #: ../../library/http.rst:94 msgid "``410``" @@ -528,8 +555,9 @@ msgid "``GONE``" msgstr "``GONE``" #: ../../library/http.rst:94 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.9" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.9 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.11" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.11 節" #: ../../library/http.rst:95 msgid "``411``" @@ -540,8 +568,9 @@ msgid "``LENGTH_REQUIRED``" msgstr "``LENGTH_REQUIRED``" #: ../../library/http.rst:95 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.10" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.10 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.12" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.12 節" #: ../../library/http.rst:96 msgid "``412``" @@ -552,32 +581,37 @@ msgid "``PRECONDITION_FAILED``" msgstr "``PRECONDITION_FAILED``" #: ../../library/http.rst:96 -msgid "HTTP/1.1 :rfc:`7232`, Section 4.2" -msgstr "HTTP/1.1 :rfc:`7232`,4.2 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.13" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.13 節" #: ../../library/http.rst:97 msgid "``413``" msgstr "``413``" #: ../../library/http.rst:97 -msgid "``REQUEST_ENTITY_TOO_LARGE``" +#, fuzzy +msgid "``CONTENT_TOO_LARGE``" msgstr "``REQUEST_ENTITY_TOO_LARGE``" #: ../../library/http.rst:97 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.11" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.11 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.14" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.14 節" #: ../../library/http.rst:98 msgid "``414``" msgstr "``414``" #: ../../library/http.rst:98 -msgid "``REQUEST_URI_TOO_LONG``" +#, fuzzy +msgid "``URI_TOO_LONG``" msgstr "``REQUEST_URI_TOO_LONG``" #: ../../library/http.rst:98 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.12" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.12 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.15" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.15 節" #: ../../library/http.rst:99 msgid "``415``" @@ -588,20 +622,23 @@ msgid "``UNSUPPORTED_MEDIA_TYPE``" msgstr "``UNSUPPORTED_MEDIA_TYPE``" #: ../../library/http.rst:99 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.13" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.13 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.16" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.1 節" #: ../../library/http.rst:100 msgid "``416``" msgstr "``416``" #: ../../library/http.rst:100 -msgid "``REQUESTED_RANGE_NOT_SATISFIABLE``" +#, fuzzy +msgid "``RANGE_NOT_SATISFIABLE``" msgstr "``REQUESTED_RANGE_NOT_SATISFIABLE``" #: ../../library/http.rst:100 -msgid "HTTP/1.1 Range Requests :rfc:`7233`, Section 4.4" -msgstr "HTTP/1.1 範圍請求 (Range Requests) :rfc:`7233`,4.4 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.17" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.1 節" #: ../../library/http.rst:101 msgid "``417``" @@ -612,8 +649,9 @@ msgid "``EXPECTATION_FAILED``" msgstr "``EXPECTATION_FAILED``" #: ../../library/http.rst:101 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.14" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.14 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.18" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.1 節" #: ../../library/http.rst:102 msgid "``418``" @@ -636,20 +674,23 @@ msgid "``MISDIRECTED_REQUEST``" msgstr "``MISDIRECTED_REQUEST``" #: ../../library/http.rst:103 -msgid "HTTP/2 :rfc:`7540`, Section 9.1.2" -msgstr "HTTP/2 :rfc:`7540`,9.1.2 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.20" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.2 節" #: ../../library/http.rst:104 msgid "``422``" msgstr "``422``" #: ../../library/http.rst:104 -msgid "``UNPROCESSABLE_ENTITY``" +#, fuzzy +msgid "``UNPROCESSABLE_CONTENT``" msgstr "``UNPROCESSABLE_ENTITY``" #: ../../library/http.rst:104 -msgid "WebDAV :rfc:`4918`, Section 11.2" -msgstr "WebDAV :rfc:`4918`,11.2 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.21" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.2 節" #: ../../library/http.rst:105 msgid "``423``" @@ -696,8 +737,9 @@ msgid "``UPGRADE_REQUIRED``" msgstr "``UPGRADE_REQUIRED``" #: ../../library/http.rst:108 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.5.15" -msgstr "HTTP/1.1 :rfc:`7231`,6.5.15 節" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.5.22" +msgstr "HTTP/1.1 :rfc:`7231`,6.5.2 節" #: ../../library/http.rst:109 msgid "``428``" @@ -749,7 +791,8 @@ msgid "``INTERNAL_SERVER_ERROR``" msgstr "``INTERNAL_SERVER_ERROR``" #: ../../library/http.rst:113 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.6.1" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.6.1" msgstr "HTTP/1.1 :rfc:`7231`,6.6.1 節" #: ../../library/http.rst:114 @@ -761,7 +804,8 @@ msgid "``NOT_IMPLEMENTED``" msgstr "``NOT_IMPLEMENTED``" #: ../../library/http.rst:114 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.6.2" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.6.2" msgstr "HTTP/1.1 :rfc:`7231`,6.6.2 節" #: ../../library/http.rst:115 @@ -773,7 +817,8 @@ msgid "``BAD_GATEWAY``" msgstr "``BAD_GATEWAY``" #: ../../library/http.rst:115 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.6.3" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.6.3" msgstr "HTTP/1.1 :rfc:`7231`,6.6.3 節" #: ../../library/http.rst:116 @@ -785,7 +830,8 @@ msgid "``SERVICE_UNAVAILABLE``" msgstr "``SERVICE_UNAVAILABLE``" #: ../../library/http.rst:116 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.6.4" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.6.4" msgstr "HTTP/1.1 :rfc:`7231`,6.6.4 節" #: ../../library/http.rst:117 @@ -797,7 +843,8 @@ msgid "``GATEWAY_TIMEOUT``" msgstr "``GATEWAY_TIMEOUT``" #: ../../library/http.rst:117 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.6.5" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.6.5" msgstr "HTTP/1.1 :rfc:`7231`,6.6.5 節" #: ../../library/http.rst:118 @@ -809,7 +856,8 @@ msgid "``HTTP_VERSION_NOT_SUPPORTED``" msgstr "``HTTP_VERSION_NOT_SUPPORTED``" #: ../../library/http.rst:118 -msgid "HTTP/1.1 :rfc:`7231`, Section 6.6.6" +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15.6.6" msgstr "HTTP/1.1 :rfc:`7231`,6.6.6 節" #: ../../library/http.rst:119 @@ -901,70 +949,77 @@ msgid "" msgstr "" "新增 ``103 EARLY_HINTS``、``418 IM_A_TEAPOT`` 與 ``425 TOO_EARLY`` 狀態碼。" -#: ../../library/http.rst:141 +#: ../../library/http.rst:140 +msgid "" +"Implemented RFC9110 naming for status constants. Old constant names are " +"preserved for backwards compatibility." +msgstr "" + +#: ../../library/http.rst:145 msgid "HTTP status category" msgstr "HTTP 狀態分類" -#: ../../library/http.rst:145 +#: ../../library/http.rst:149 msgid "" "The enum values have several properties to indicate the HTTP status category:" msgstr "" -#: ../../library/http.rst:148 +#: ../../library/http.rst:152 msgid "Property" msgstr "" -#: ../../library/http.rst:148 +#: ../../library/http.rst:152 msgid "Indicates that" msgstr "" -#: ../../library/http.rst:150 +#: ../../library/http.rst:154 msgid "``is_informational``" msgstr "``is_informational``" -#: ../../library/http.rst:150 +#: ../../library/http.rst:154 msgid "``100 <= status <= 199``" msgstr "``100 <= status <= 199``" -#: ../../library/http.rst:150 ../../library/http.rst:151 -#: ../../library/http.rst:152 ../../library/http.rst:153 -#: ../../library/http.rst:154 -msgid "HTTP/1.1 :rfc:`7231`, Section 6" -msgstr "HTTP/1.1 :rfc:`7231`,6 節" +#: ../../library/http.rst:154 ../../library/http.rst:155 +#: ../../library/http.rst:156 ../../library/http.rst:157 +#: ../../library/http.rst:158 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 15" +msgstr "HTTP/2 :rfc:`7540`,9.1.2 節" -#: ../../library/http.rst:151 +#: ../../library/http.rst:155 msgid "``is_success``" msgstr "``is_success``" -#: ../../library/http.rst:151 +#: ../../library/http.rst:155 msgid "``200 <= status <= 299``" msgstr "``200 <= status <= 299``" -#: ../../library/http.rst:152 +#: ../../library/http.rst:156 msgid "``is_redirection``" msgstr "``is_redirection``" -#: ../../library/http.rst:152 +#: ../../library/http.rst:156 msgid "``300 <= status <= 399``" msgstr "``300 <= status <= 399``" -#: ../../library/http.rst:153 +#: ../../library/http.rst:157 msgid "``is_client_error``" msgstr "``is_client_error``" -#: ../../library/http.rst:153 +#: ../../library/http.rst:157 msgid "``400 <= status <= 499``" msgstr "``400 <= status <= 499``" -#: ../../library/http.rst:154 +#: ../../library/http.rst:158 msgid "``is_server_error``" msgstr "``is_server_error``" -#: ../../library/http.rst:154 +#: ../../library/http.rst:158 msgid "``500 <= status <= 599``" msgstr "``500 <= status <= 599``" -#: ../../library/http.rst:159 +#: ../../library/http.rst:163 msgid "" ">>> from http import HTTPStatus\n" ">>> HTTPStatus.OK.is_success\n" @@ -978,13 +1033,13 @@ msgstr "" ">>> HTTPStatus.OK.is_client_error\n" "False" -#: ../../library/http.rst:169 +#: ../../library/http.rst:173 msgid "" "A subclass of :class:`enum.StrEnum` that defines a set of HTTP methods and " "descriptions written in English." msgstr ":class:`enum.StrEnum` 的子類別,它定義了一組 HTTP 方法以及英文描述。" -#: ../../library/http.rst:173 +#: ../../library/http.rst:177 msgid "" ">>> from http import HTTPMethod\n" ">>>\n" @@ -1028,11 +1083,11 @@ msgstr "" " ,\n" " ]" -#: ../../library/http.rst:197 +#: ../../library/http.rst:201 msgid "HTTP methods" msgstr "HTTP 方法" -#: ../../library/http.rst:199 +#: ../../library/http.rst:203 msgid "" "Supported, `IANA-registered methods `_ available in :class:`http.HTTPMethod` are:" @@ -1040,79 +1095,87 @@ msgstr "" ":class:`http.HTTPStatus` 當中,已支援並且有於 `IANA 註冊的狀態碼 `_\\ 有:" -#: ../../library/http.rst:204 +#: ../../library/http.rst:208 msgid "Method" msgstr "方法" -#: ../../library/http.rst:206 +#: ../../library/http.rst:210 msgid "``GET``" msgstr "``GET``" -#: ../../library/http.rst:206 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.1" -msgstr "HTTP/1.1 :rfc:`7231`,4.3.1 節" +#: ../../library/http.rst:210 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.1" +msgstr "HTTP/1.1 :rfc:`7231`,6.3.1 節" -#: ../../library/http.rst:207 +#: ../../library/http.rst:211 msgid "``HEAD``" msgstr "``HEAD``" -#: ../../library/http.rst:207 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.2" -msgstr "HTTP/1.1 :rfc:`7231`,4.3.2 節" +#: ../../library/http.rst:211 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.2" +msgstr "HTTP/2 :rfc:`7540`,9.1.2 節" -#: ../../library/http.rst:208 +#: ../../library/http.rst:212 msgid "``POST``" msgstr "``POST``" -#: ../../library/http.rst:208 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.3" -msgstr "HTTP/1.1 :rfc:`7231`,4.3.3 節" +#: ../../library/http.rst:212 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.3" +msgstr "HTTP/1.1 :rfc:`7231`,6.3.3 節" -#: ../../library/http.rst:209 +#: ../../library/http.rst:213 msgid "``PUT``" msgstr "``PUT``" -#: ../../library/http.rst:209 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.4" -msgstr "HTTP/1.1 :rfc:`7231`,4.3.4 節" +#: ../../library/http.rst:213 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.4" +msgstr "HTTP/1.1 :rfc:`7231`,6.3.4 節" -#: ../../library/http.rst:210 +#: ../../library/http.rst:214 msgid "``DELETE``" msgstr "``DELETE``" -#: ../../library/http.rst:210 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.5" +#: ../../library/http.rst:214 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.5" msgstr "HTTP/1.1 :rfc:`7231`,6.3.5 節" -#: ../../library/http.rst:211 +#: ../../library/http.rst:215 msgid "``CONNECT``" msgstr "``CONNECT``" -#: ../../library/http.rst:211 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.6" -msgstr "HTTP/1.1 :rfc:`7231`,4.3.6 節" +#: ../../library/http.rst:215 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.6" +msgstr "HTTP/1.1 :rfc:`7231`,6.3.6 節" -#: ../../library/http.rst:212 +#: ../../library/http.rst:216 msgid "``OPTIONS``" msgstr "``OPTIONS``" -#: ../../library/http.rst:212 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.7" +#: ../../library/http.rst:216 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.7" msgstr "HTTP/1.1 :rfc:`7231`,4.3.7 節" -#: ../../library/http.rst:213 +#: ../../library/http.rst:217 msgid "``TRACE``" msgstr "``TRACE``" -#: ../../library/http.rst:213 -msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.8" +#: ../../library/http.rst:217 +#, fuzzy +msgid "HTTP Semantics :rfc:`9110`, Section 9.3.8" msgstr "HTTP/1.1 :rfc:`7231`,4.3.8 節" -#: ../../library/http.rst:214 +#: ../../library/http.rst:218 msgid "``PATCH``" msgstr "``PATCH``" -#: ../../library/http.rst:214 +#: ../../library/http.rst:218 msgid "HTTP/1.1 :rfc:`5789`" msgstr "HTTP/1.1 :rfc:`5789`" @@ -1127,3 +1190,51 @@ msgstr "protocol(協定)" #: ../../library/http.rst:9 msgid "http (standard module)" msgstr "http(標準模組)" + +#~ msgid "HTTP/1.1 :rfc:`7233`, Section 4.1" +#~ msgstr "HTTP/1.1 :rfc:`7233`,4.1 節" + +#~ msgid "HTTP/1.1 :rfc:`7232`, Section 4.1" +#~ msgstr "HTTP/1.1 :rfc:`7232`,4.1 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 6.4.7" +#~ msgstr "HTTP/1.1 :rfc:`7231`,6.4.7 節" + +#~ msgid "Permanent Redirect :rfc:`7238`, Section 3 (Experimental)" +#~ msgstr "永久重定向 :rfc:`7238`,3 節(實驗性)" + +#~ msgid "HTTP/1.1 Authentication :rfc:`7235`, Section 3.1" +#~ msgstr "HTTP/1.1 身分驗證 (Authentication) :rfc:`7235`,3.1 節" + +#~ msgid "HTTP/1.1 Authentication :rfc:`7235`, Section 3.2" +#~ msgstr "HTTP/1.1 身分驗證 :rfc:`7235`,3.2 節" + +#~ msgid "HTTP/1.1 :rfc:`7232`, Section 4.2" +#~ msgstr "HTTP/1.1 :rfc:`7232`,4.2 節" + +#~ msgid "HTTP/1.1 Range Requests :rfc:`7233`, Section 4.4" +#~ msgstr "HTTP/1.1 範圍請求 (Range Requests) :rfc:`7233`,4.4 節" + +#~ msgid "WebDAV :rfc:`4918`, Section 11.2" +#~ msgstr "WebDAV :rfc:`4918`,11.2 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 6" +#~ msgstr "HTTP/1.1 :rfc:`7231`,6 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.1" +#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.1 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.2" +#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.2 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.3" +#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.3 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.4" +#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.4 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.5" +#~ msgstr "HTTP/1.1 :rfc:`7231`,6.3.5 節" + +#~ msgid "HTTP/1.1 :rfc:`7231`, Section 4.3.6" +#~ msgstr "HTTP/1.1 :rfc:`7231`,4.3.6 節" diff --git a/library/http.server.po b/library/http.server.po index 43a4f4373b..16bc06d5f9 100644 --- a/library/http.server.po +++ b/library/http.server.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,17 +36,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/http.server.rst:27 msgid "" @@ -669,35 +668,50 @@ msgid "" "reasons. Problems with the CGI script will be translated to error 403." msgstr "" -#: ../../library/http.server.rst:505 +#: ../../library/http.server.rst:507 +msgid "" +":class:`CGIHTTPRequestHandler` is being removed in 3.15. CGI has not been " +"considered a good way to do things for well over a decade. This code has " +"been unmaintained for a while now and sees very little practical use. " +"Retaining it could lead to further :ref:`security considerations `." +msgstr "" + +#: ../../library/http.server.rst:513 msgid "" ":class:`CGIHTTPRequestHandler` can be enabled in the command line by passing " "the ``--cgi`` option::" msgstr "" -#: ../../library/http.server.rst:508 +#: ../../library/http.server.rst:516 msgid "python -m http.server --cgi" msgstr "python -m http.server --cgi" -#: ../../library/http.server.rst:512 +#: ../../library/http.server.rst:520 +msgid "" +":mod:`http.server` command line ``--cgi`` support is being removed because :" +"class:`CGIHTTPRequestHandler` is being removed." +msgstr "" + +#: ../../library/http.server.rst:525 msgid "" ":class:`CGIHTTPRequestHandler` and the ``--cgi`` command line option are not " "intended for use by untrusted clients and may be vulnerable to exploitation. " "Always use within a secure environment." msgstr "" -#: ../../library/http.server.rst:519 +#: ../../library/http.server.rst:532 msgid "Security Considerations" msgstr "安全性注意事項" -#: ../../library/http.server.rst:523 +#: ../../library/http.server.rst:536 msgid "" ":class:`SimpleHTTPRequestHandler` will follow symbolic links when handling " "requests, this makes it possible for files outside of the specified " "directory to be served." msgstr "" -#: ../../library/http.server.rst:527 +#: ../../library/http.server.rst:540 msgid "" "Earlier versions of Python did not scrub control characters from the log " "messages emitted to stderr from ``python -m http.server`` or the default :" @@ -706,7 +720,7 @@ msgid "" "codes to your terminal." msgstr "" -#: ../../library/http.server.rst:533 +#: ../../library/http.server.rst:546 msgid "Control characters are scrubbed in stderr logs." msgstr "" @@ -734,10 +748,10 @@ msgstr "URL(統一資源定位器)" msgid "httpd" msgstr "httpd" -#: ../../library/http.server.rst:521 +#: ../../library/http.server.rst:534 msgid "http.server" msgstr "http.server" -#: ../../library/http.server.rst:521 +#: ../../library/http.server.rst:534 msgid "security" msgstr "security(安全)" diff --git a/library/i18n.po b/library/i18n.po index fbe9aeab54..e2fd6fc3c2 100644 --- a/library/i18n.po +++ b/library/i18n.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:26+0000\n" @@ -30,6 +30,8 @@ msgid "" "language to be used in program messages or by tailoring output to match " "local conventions." msgstr "" +"本章所描述的模組透過提供用於程式訊息中語言的選擇機制或是調整輸出以符合當地慣" +"例,來幫助你編寫不依賴語言和地區設定的軟體" #: ../../library/i18n.rst:12 msgid "The list of modules described in this chapter is:" diff --git a/library/idle.po b/library/idle.po index 4a2afd926f..66d6e0817f 100644 --- a/library/idle.po +++ b/library/idle.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:03+0000\n" diff --git a/library/imaplib.po b/library/imaplib.po index 4da8c1fd8e..e78b7739b0 100644 --- a/library/imaplib.po +++ b/library/imaplib.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,17 +35,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/imaplib.rst:31 msgid "" @@ -625,7 +624,7 @@ msgid "" "such tags, and popular IMAP servers, such as Gmail, accept and produce such " "flags. There are non-Python programs which also create such tags. Although " "it is an RFC violation and IMAP clients and servers are supposed to be " -"strict, imaplib nonetheless continues to allow such tags to be created for " +"strict, imaplib still continues to allow such tags to be created for " "backward compatibility reasons, and as of Python 3.6, handles them if they " "are sent from the server, since this improves real-world compatibility." msgstr "" diff --git a/library/imghdr.po b/library/imghdr.po deleted file mode 100644 index 49e98cc3d2..0000000000 --- a/library/imghdr.po +++ /dev/null @@ -1,209 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-05-22 02:06+0800\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/imghdr.rst:2 -msgid ":mod:`imghdr` --- Determine the type of an image" -msgstr ":mod:`imghdr` --- 推測圖片種類" - -#: ../../library/imghdr.rst:8 -msgid "**Source code:** :source:`Lib/imghdr.py`" -msgstr "**原始碼:**\\ :source:`Lib/imghdr.py`" - -#: ../../library/imghdr.rst:10 -msgid "" -"The :mod:`imghdr` module is deprecated (see :pep:`PEP 594 <594#imghdr>` for " -"details and alternatives)." -msgstr "" -":mod:`imghdr` 模組 (module) 即將被棄用(詳情與替代方案見 :pep:`PEP 594 " -"<594#imghdr>`\\ )。" - -#: ../../library/imghdr.rst:16 -msgid "" -"The :mod:`imghdr` module determines the type of image contained in a file or " -"byte stream." -msgstr "" - -#: ../../library/imghdr.rst:19 -msgid "The :mod:`imghdr` module defines the following function:" -msgstr "" - -#: ../../library/imghdr.rst:24 -msgid "" -"Test the image data contained in the file named *file* and return a string " -"describing the image type. If *h* is provided, the *file* argument is " -"ignored and *h* is assumed to contain the byte stream to test." -msgstr "" - -#: ../../library/imghdr.rst:28 -msgid "Accepts a :term:`path-like object`." -msgstr "" - -#: ../../library/imghdr.rst:31 -msgid "" -"The following image types are recognized, as listed below with the return " -"value from :func:`what`:" -msgstr "" - -#: ../../library/imghdr.rst:35 -msgid "Value" -msgstr "" - -#: ../../library/imghdr.rst:35 -msgid "Image format" -msgstr "" - -#: ../../library/imghdr.rst:37 -msgid "``'rgb'``" -msgstr "``'rgb'``" - -#: ../../library/imghdr.rst:37 -msgid "SGI ImgLib Files" -msgstr "" - -#: ../../library/imghdr.rst:39 -msgid "``'gif'``" -msgstr "``'gif'``" - -#: ../../library/imghdr.rst:39 -msgid "GIF 87a and 89a Files" -msgstr "" - -#: ../../library/imghdr.rst:41 -msgid "``'pbm'``" -msgstr "``'pbm'``" - -#: ../../library/imghdr.rst:41 -msgid "Portable Bitmap Files" -msgstr "" - -#: ../../library/imghdr.rst:43 -msgid "``'pgm'``" -msgstr "``'pgm'``" - -#: ../../library/imghdr.rst:43 -msgid "Portable Graymap Files" -msgstr "" - -#: ../../library/imghdr.rst:45 -msgid "``'ppm'``" -msgstr "``'ppm'``" - -#: ../../library/imghdr.rst:45 -msgid "Portable Pixmap Files" -msgstr "" - -#: ../../library/imghdr.rst:47 -msgid "``'tiff'``" -msgstr "``'tiff'``" - -#: ../../library/imghdr.rst:47 -msgid "TIFF Files" -msgstr "TIFF 檔案" - -#: ../../library/imghdr.rst:49 -msgid "``'rast'``" -msgstr "``'rast'``" - -#: ../../library/imghdr.rst:49 -msgid "Sun Raster Files" -msgstr "" - -#: ../../library/imghdr.rst:51 -msgid "``'xbm'``" -msgstr "``'xbm'``" - -#: ../../library/imghdr.rst:51 -msgid "X Bitmap Files" -msgstr "" - -#: ../../library/imghdr.rst:53 -msgid "``'jpeg'``" -msgstr "``'jpeg'``" - -#: ../../library/imghdr.rst:53 -msgid "JPEG data in JFIF or Exif formats" -msgstr "" - -#: ../../library/imghdr.rst:55 -msgid "``'bmp'``" -msgstr "``'bmp'``" - -#: ../../library/imghdr.rst:55 -msgid "BMP files" -msgstr "BMP 檔案" - -#: ../../library/imghdr.rst:57 -msgid "``'png'``" -msgstr "``'png'``" - -#: ../../library/imghdr.rst:57 -msgid "Portable Network Graphics" -msgstr "" - -#: ../../library/imghdr.rst:59 -msgid "``'webp'``" -msgstr "``'webp'``" - -#: ../../library/imghdr.rst:59 -msgid "WebP files" -msgstr "WebP 檔案" - -#: ../../library/imghdr.rst:61 -msgid "``'exr'``" -msgstr "``'exr'``" - -#: ../../library/imghdr.rst:61 -msgid "OpenEXR Files" -msgstr "OpenEXR 檔案" - -#: ../../library/imghdr.rst:64 -msgid "The *exr* and *webp* formats were added." -msgstr "新增 *exr* 與 *webp* 格式。" - -#: ../../library/imghdr.rst:68 -msgid "" -"You can extend the list of file types :mod:`imghdr` can recognize by " -"appending to this variable:" -msgstr "" - -#: ../../library/imghdr.rst:74 -msgid "" -"A list of functions performing the individual tests. Each function takes " -"two arguments: the byte-stream and an open file-like object. When :func:" -"`what` is called with a byte-stream, the file-like object will be ``None``." -msgstr "" - -#: ../../library/imghdr.rst:78 -msgid "" -"The test function should return a string describing the image type if the " -"test succeeded, or ``None`` if it failed." -msgstr "" - -#: ../../library/imghdr.rst:81 -msgid "Example::" -msgstr "範例: ::" - -#: ../../library/imghdr.rst:83 -msgid "" -">>> import imghdr\n" -">>> imghdr.what('bass.gif')\n" -"'gif'" -msgstr "" diff --git a/library/importlib.metadata.po b/library/importlib.metadata.po index 8e935b37f9..02d7d7e1c8 100644 --- a/library/importlib.metadata.po +++ b/library/importlib.metadata.po @@ -4,9 +4,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -59,7 +59,7 @@ msgid "" "*distribution package* can contain multiple *import packages* (and single " "modules), and one top-level *import package* may map to multiple " "*distribution packages* if it is a namespace package. You can use :ref:" -"`package_distributions() ` to get a mapping between " +"`packages_distributions() ` to get a mapping between " "them." msgstr "" @@ -294,10 +294,6 @@ msgid "" msgstr "" #: ../../library/importlib.metadata.rst:174 -msgid "*Compatibility Note*" -msgstr "" - -#: ../../library/importlib.metadata.rst:176 msgid "" "The \"selectable\" entry points were introduced in ``importlib_metadata`` " "3.6 and Python 3.10. Prior to those changes, ``entry_points`` accepted no " @@ -307,29 +303,35 @@ msgid "" "entry_points_selectable` for compatibility options." msgstr "" -#: ../../library/importlib.metadata.rst:188 -msgid "Distribution metadata" +#: ../../library/importlib.metadata.rst:183 +msgid "" +"``EntryPoint`` objects no longer present a tuple-like interface (:meth:" +"`~object.__getitem__`)." msgstr "" #: ../../library/importlib.metadata.rst:190 +msgid "Distribution metadata" +msgstr "" + +#: ../../library/importlib.metadata.rst:192 msgid "" "Every `Distribution Package `_ includes some metadata, which you can extract " "using the ``metadata()`` function::" msgstr "" -#: ../../library/importlib.metadata.rst:194 +#: ../../library/importlib.metadata.rst:196 msgid ">>> wheel_metadata = metadata('wheel') " msgstr ">>> wheel_metadata = metadata('wheel') " -#: ../../library/importlib.metadata.rst:196 +#: ../../library/importlib.metadata.rst:198 msgid "" "The keys of the returned data structure, a ``PackageMetadata``, name the " "metadata keywords, and the values are returned unparsed from the " "distribution metadata::" msgstr "" -#: ../../library/importlib.metadata.rst:200 +#: ../../library/importlib.metadata.rst:202 msgid "" ">>> wheel_metadata['Requires-Python'] \n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" @@ -337,13 +339,13 @@ msgstr "" ">>> wheel_metadata['Requires-Python'] \n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" -#: ../../library/importlib.metadata.rst:203 +#: ../../library/importlib.metadata.rst:205 msgid "" "``PackageMetadata`` also presents a ``json`` attribute that returns all the " "metadata in a JSON-compatible form per :PEP:`566`::" msgstr "" -#: ../../library/importlib.metadata.rst:206 +#: ../../library/importlib.metadata.rst:208 msgid "" ">>> wheel_metadata.json['requires_python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" @@ -351,7 +353,7 @@ msgstr "" ">>> wheel_metadata.json['requires_python']\n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'" -#: ../../library/importlib.metadata.rst:211 +#: ../../library/importlib.metadata.rst:213 msgid "" "The actual type of the object returned by ``metadata()`` is an " "implementation detail and should be accessed only through the interface " @@ -359,28 +361,28 @@ msgid "" "readthedocs.io/en/latest/api.html#importlib_metadata.PackageMetadata>`_." msgstr "" -#: ../../library/importlib.metadata.rst:216 +#: ../../library/importlib.metadata.rst:218 msgid "" "The ``Description`` is now included in the metadata when presented through " "the payload. Line continuation characters have been removed." msgstr "" -#: ../../library/importlib.metadata.rst:220 +#: ../../library/importlib.metadata.rst:222 msgid "The ``json`` attribute was added." msgstr "新增 ``json`` 屬性。" -#: ../../library/importlib.metadata.rst:226 +#: ../../library/importlib.metadata.rst:228 msgid "Distribution versions" msgstr "" -#: ../../library/importlib.metadata.rst:228 +#: ../../library/importlib.metadata.rst:230 msgid "" "The ``version()`` function is the quickest way to get a `Distribution " "Package `_'s version number, as a string::" msgstr "" -#: ../../library/importlib.metadata.rst:232 +#: ../../library/importlib.metadata.rst:234 msgid "" ">>> version('wheel') \n" "'0.32.3'" @@ -388,11 +390,11 @@ msgstr "" ">>> version('wheel') \n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:239 +#: ../../library/importlib.metadata.rst:241 msgid "Distribution files" msgstr "" -#: ../../library/importlib.metadata.rst:241 +#: ../../library/importlib.metadata.rst:243 msgid "" "You can also get the full set of files contained within a distribution. The " "``files()`` function takes a `Distribution Package >> util = [p for p in files('wheel') if 'util.py' in str(p)][0] \n" ">>> util \n" @@ -425,11 +427,11 @@ msgstr "" ">>> util.hash \n" "" -#: ../../library/importlib.metadata.rst:258 +#: ../../library/importlib.metadata.rst:260 msgid "Once you have the file, you can also read its contents::" msgstr "" -#: ../../library/importlib.metadata.rst:260 +#: ../../library/importlib.metadata.rst:262 msgid "" ">>> print(util.read_text()) \n" "import base64\n" @@ -449,13 +451,13 @@ msgstr "" " return s.encode('utf-8')\n" " return s" -#: ../../library/importlib.metadata.rst:269 +#: ../../library/importlib.metadata.rst:271 msgid "" "You can also use the ``locate`` method to get a the absolute path to the " "file::" msgstr "" -#: ../../library/importlib.metadata.rst:272 +#: ../../library/importlib.metadata.rst:274 msgid "" ">>> util.locate() \n" "PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')" @@ -463,7 +465,7 @@ msgstr "" ">>> util.locate() \n" "PosixPath('/home/gustav/example/lib/site-packages/wheel/util.py')" -#: ../../library/importlib.metadata.rst:275 +#: ../../library/importlib.metadata.rst:277 msgid "" "In the case where the metadata file listing files (RECORD or SOURCES.txt) is " "missing, ``files()`` will return ``None``. The caller may wish to wrap calls " @@ -473,18 +475,18 @@ msgid "" "present." msgstr "" -#: ../../library/importlib.metadata.rst:286 +#: ../../library/importlib.metadata.rst:288 msgid "Distribution requirements" msgstr "" -#: ../../library/importlib.metadata.rst:288 +#: ../../library/importlib.metadata.rst:290 msgid "" "To get the full set of requirements for a `Distribution Package `_, use " "the ``requires()`` function::" msgstr "" -#: ../../library/importlib.metadata.rst:292 +#: ../../library/importlib.metadata.rst:294 msgid "" ">>> requires('wheel') \n" "[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]" @@ -492,11 +494,11 @@ msgstr "" ">>> requires('wheel') \n" "[\"pytest (>=3.0.0) ; extra == 'test'\", \"pytest-cov ; extra == 'test'\"]" -#: ../../library/importlib.metadata.rst:300 +#: ../../library/importlib.metadata.rst:302 msgid "Mapping import to distribution packages" msgstr "" -#: ../../library/importlib.metadata.rst:302 +#: ../../library/importlib.metadata.rst:304 msgid "" "A convenience method to resolve the `Distribution Package `_ name (or names, " @@ -505,7 +507,7 @@ msgid "" "glossary/#term-Import-Package>`_::" msgstr "" -#: ../../library/importlib.metadata.rst:307 +#: ../../library/importlib.metadata.rst:309 msgid "" ">>> packages_distributions()\n" "{'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': " @@ -515,18 +517,18 @@ msgstr "" "{'importlib_metadata': ['importlib-metadata'], 'yaml': ['PyYAML'], 'jaraco': " "['jaraco.classes', 'jaraco.functools'], ...}" -#: ../../library/importlib.metadata.rst:310 +#: ../../library/importlib.metadata.rst:312 msgid "" "Some editable installs, `do not supply top-level names `_, and thus this function is not " "reliable with such installs." msgstr "" -#: ../../library/importlib.metadata.rst:319 +#: ../../library/importlib.metadata.rst:321 msgid "Distributions" msgstr "" -#: ../../library/importlib.metadata.rst:321 +#: ../../library/importlib.metadata.rst:323 msgid "" "While the above API is the most common and convenient usage, you can get all " "of that information from the ``Distribution`` class. A ``Distribution`` is " @@ -535,7 +537,7 @@ msgid "" "Package>`_. You can get the ``Distribution`` instance::" msgstr "" -#: ../../library/importlib.metadata.rst:327 +#: ../../library/importlib.metadata.rst:329 msgid "" ">>> from importlib.metadata import distribution \n" ">>> dist = distribution('wheel') " @@ -543,13 +545,13 @@ msgstr "" ">>> from importlib.metadata import distribution \n" ">>> dist = distribution('wheel') " -#: ../../library/importlib.metadata.rst:330 +#: ../../library/importlib.metadata.rst:332 msgid "" "Thus, an alternative way to get the version number is through the " "``Distribution`` instance::" msgstr "" -#: ../../library/importlib.metadata.rst:333 +#: ../../library/importlib.metadata.rst:335 msgid "" ">>> dist.version \n" "'0.32.3'" @@ -557,13 +559,13 @@ msgstr "" ">>> dist.version \n" "'0.32.3'" -#: ../../library/importlib.metadata.rst:336 +#: ../../library/importlib.metadata.rst:338 msgid "" "There are all kinds of additional metadata available on the ``Distribution`` " "instance::" msgstr "" -#: ../../library/importlib.metadata.rst:339 +#: ../../library/importlib.metadata.rst:341 msgid "" ">>> dist.metadata['Requires-Python'] \n" "'>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*'\n" @@ -575,18 +577,35 @@ msgstr "" ">>> dist.metadata['License'] \n" "'MIT'" -#: ../../library/importlib.metadata.rst:344 +#: ../../library/importlib.metadata.rst:346 +msgid "" +"For editable packages, an ``origin`` property may present :pep:`610` " +"metadata::" +msgstr "" + +#: ../../library/importlib.metadata.rst:349 +msgid "" +">>> dist.origin.url\n" +"'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl'" +msgstr "" + +#: ../../library/importlib.metadata.rst:352 msgid "" "The full set of available metadata is not described here. See the `Core " "metadata specifications `_ for additional details." msgstr "" -#: ../../library/importlib.metadata.rst:349 +#: ../../library/importlib.metadata.rst:355 +#, fuzzy +msgid "The ``.origin`` property was added." +msgstr "新增 ``json`` 屬性。" + +#: ../../library/importlib.metadata.rst:359 msgid "Distribution Discovery" msgstr "" -#: ../../library/importlib.metadata.rst:351 +#: ../../library/importlib.metadata.rst:361 msgid "" "By default, this package provides built-in support for discovery of metadata " "for file system and zip file `Distribution Package `_ metadata is not available through :" @@ -621,14 +640,14 @@ msgid "" "on :data:`sys.meta_path`." msgstr "" -#: ../../library/importlib.metadata.rst:370 +#: ../../library/importlib.metadata.rst:380 msgid "" "By default ``importlib.metadata`` installs a finder for distribution " "packages found on the file system. This finder doesn't actually find any " "*distributions*, but it can find their metadata." msgstr "" -#: ../../library/importlib.metadata.rst:375 +#: ../../library/importlib.metadata.rst:385 msgid "" "The abstract class :py:class:`importlib.abc.MetaPathFinder` defines the " "interface expected of finders by Python's import system. ``importlib." @@ -638,7 +657,7 @@ msgid "" "base class, which defines this abstract method::" msgstr "" -#: ../../library/importlib.metadata.rst:383 +#: ../../library/importlib.metadata.rst:393 msgid "" "@abc.abstractmethod\n" "def find_distributions(context=DistributionFinder.Context()):\n" @@ -647,14 +666,14 @@ msgid "" " \"\"\"" msgstr "" -#: ../../library/importlib.metadata.rst:389 +#: ../../library/importlib.metadata.rst:399 msgid "" "The ``DistributionFinder.Context`` object provides ``.path`` and ``.name`` " "properties indicating the path to search and name to match and may supply " "other relevant context." msgstr "" -#: ../../library/importlib.metadata.rst:393 +#: ../../library/importlib.metadata.rst:403 msgid "" "What this means in practice is that to support finding distribution package " "metadata in locations other than the file system, subclass ``Distribution`` " @@ -662,3 +681,109 @@ msgid "" "instances of this derived ``Distribution`` in the ``find_distributions()`` " "method." msgstr "" + +#: ../../library/importlib.metadata.rst:410 +msgid "Example" +msgstr "" + +#: ../../library/importlib.metadata.rst:412 +msgid "" +"Consider for example a custom finder that loads Python modules from a " +"database::" +msgstr "" + +#: ../../library/importlib.metadata.rst:415 +msgid "" +"class DatabaseImporter(importlib.abc.MetaPathFinder):\n" +" def __init__(self, db):\n" +" self.db = db\n" +"\n" +" def find_spec(self, fullname, target=None) -> ModuleSpec:\n" +" return self.db.spec_from_name(fullname)\n" +"\n" +"sys.meta_path.append(DatabaseImporter(connect_db(...)))" +msgstr "" + +#: ../../library/importlib.metadata.rst:424 +msgid "" +"That importer now presumably provides importable modules from a database, " +"but it provides no metadata or entry points. For this custom importer to " +"provide metadata, it would also need to implement ``DistributionFinder``::" +msgstr "" + +#: ../../library/importlib.metadata.rst:429 +msgid "" +"from importlib.metadata import DistributionFinder\n" +"\n" +"class DatabaseImporter(DistributionFinder):\n" +" ...\n" +"\n" +" def find_distributions(self, context=DistributionFinder.Context()):\n" +" query = dict(name=context.name) if context.name else {}\n" +" for dist_record in self.db.query_distributions(query):\n" +" yield DatabaseDistribution(dist_record)" +msgstr "" + +#: ../../library/importlib.metadata.rst:439 +msgid "" +"In this way, ``query_distributions`` would return records for each " +"distribution served by the database matching the query. For example, if " +"``requests-1.0`` is in the database, ``find_distributions`` would yield a " +"``DatabaseDistribution`` for ``Context(name='requests')`` or " +"``Context(name=None)``." +msgstr "" + +#: ../../library/importlib.metadata.rst:445 +msgid "" +"For the sake of simplicity, this example ignores ``context.path``\\. The " +"``path`` attribute defaults to ``sys.path`` and is the set of import paths " +"to be considered in the search. A ``DatabaseImporter`` could potentially " +"function without any concern for a search path. Assuming the importer does " +"no partitioning, the \"path\" would be irrelevant. In order to illustrate " +"the purpose of ``path``, the example would need to illustrate a more complex " +"``DatabaseImporter`` whose behavior varied depending on ``sys.path``/" +"``PYTHONPATH``. In that case, the ``find_distributions`` should honor the " +"``context.path`` and only yield ``Distribution``\\ s pertinent to that path." +msgstr "" + +#: ../../library/importlib.metadata.rst:456 +msgid "``DatabaseDistribution``, then, would look something like::" +msgstr "" + +#: ../../library/importlib.metadata.rst:458 +msgid "" +"class DatabaseDistribution(importlib.metadata.Distributon):\n" +" def __init__(self, record):\n" +" self.record = record\n" +"\n" +" def read_text(self, filename):\n" +" \"\"\"\n" +" Read a file like \"METADATA\" for the current distribution.\n" +" \"\"\"\n" +" if filename == \"METADATA\":\n" +" return f\"\"\"Name: {self.record.name}\n" +"Version: {self.record.version}\n" +"\"\"\"\n" +" if filename == \"entry_points.txt\":\n" +" return \"\\n\".join(\n" +" f\"\"\"[{ep.group}]\\n{ep.name}={ep.value}\"\"\"\n" +" for ep in self.record.entry_points)\n" +"\n" +" def locate_file(self, path):\n" +" raise RuntimeError(\"This distribution has no file system\")" +msgstr "" + +#: ../../library/importlib.metadata.rst:478 +msgid "" +"This basic implementation should provide metadata and entry points for " +"packages served by the ``DatabaseImporter``, assuming that the ``record`` " +"supplies suitable ``.name``, ``.version``, and ``.entry_points`` attributes." +msgstr "" + +#: ../../library/importlib.metadata.rst:483 +msgid "" +"The ``DatabaseDistribution`` may also provide other metadata files, like " +"``RECORD`` (required for ``Distribution.files``) or override the " +"implementation of ``Distribution.files``. See the source for more " +"inspiration." +msgstr "" diff --git a/library/importlib.po b/library/importlib.po index e6be299e9b..9946fd1bea 100644 --- a/library/importlib.po +++ b/library/importlib.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,7 +32,7 @@ msgstr "簡介" #: ../../library/importlib.rst:20 msgid "The purpose of the :mod:`importlib` package is three-fold." -msgstr "" +msgstr ":mod:`importlib` 的目的可分為三個部分。" #: ../../library/importlib.rst:22 msgid "" @@ -43,6 +43,9 @@ msgid "" "to comprehend than one implemented in a programming language other than " "Python." msgstr "" +"第一是提供 Python 原始碼中 :keyword:`import` 陳述式的實作(因此,也延伸到 :" +"func:`__import__` 函式)。這讓 :keyword:`!import` 實作可以移植到任何 Python " +"直譯器。同時,這也提供了一個比用其他程式語言實作更容易理解的版本。 " #: ../../library/importlib.rst:29 msgid "" @@ -1363,7 +1366,7 @@ msgstr "" msgid "Multi-phase init is now required for use in subinterpreters." msgstr "" -#: ../../library/importlib.rst:1109 +#: ../../library/importlib.rst:1109 ../../library/importlib.rst:1293 msgid "Name of the module the loader supports." msgstr "" @@ -1423,123 +1426,172 @@ msgstr "" #: ../../library/importlib.rst:1168 msgid "" "A specification for a module's import-system-related state. This is " -"typically exposed as the module's :attr:`__spec__` attribute. In the " -"descriptions below, the names in parentheses give the corresponding " -"attribute available directly on the module object, e.g. ``module.__spec__." -"origin == module.__file__``. Note, however, that while the *values* are " -"usually equivalent, they can differ since there is no synchronization " -"between the two objects. For example, it is possible to update the " -"module's :attr:`__file__` at runtime and this will not be automatically " -"reflected in the module's :attr:`__spec__.origin`, and vice versa." +"typically exposed as the module's :attr:`__spec__` attribute. Many of these " +"attributes are also available directly on a module: for example, ``module." +"__spec__.origin == module.__file__``. Note, however, that while the " +"*values* are usually equivalent, they can differ since there is no " +"synchronization between the two objects. For example, it is possible to " +"update the module's :attr:`__file__` at runtime and this will not be " +"automatically reflected in the module's :attr:`__spec__.origin`, and vice " +"versa." msgstr "" -#: ../../library/importlib.rst:1182 -msgid "(:attr:`__name__`)" -msgstr "(:attr:`__name__`)" - -#: ../../library/importlib.rst:1184 +#: ../../library/importlib.rst:1181 msgid "" -"The module's fully qualified name. The :term:`finder` should always set this " -"attribute to a non-empty string." +"The module's fully qualified name (see :attr:`__name__` attributes on " +"modules). The :term:`finder` should always set this attribute to a non-empty " +"string." msgstr "" -#: ../../library/importlib.rst:1189 -msgid "(:attr:`__loader__`)" -msgstr "(:attr:`__loader__`)" - -#: ../../library/importlib.rst:1191 +#: ../../library/importlib.rst:1187 msgid "" -"The :term:`loader` used to load the module. The :term:`finder` should always " -"set this attribute." +"The :term:`loader` used to load the module (see :attr:`__loader__` " +"attributes on modules). The :term:`finder` should always set this attribute." msgstr "" -#: ../../library/importlib.rst:1196 -msgid "(:attr:`__file__`)" -msgstr "(:attr:`__file__`)" - -#: ../../library/importlib.rst:1198 +#: ../../library/importlib.rst:1193 msgid "" -"The location the :term:`loader` should use to load the module. For example, " -"for modules loaded from a .py file this is the filename. The :term:`finder` " -"should always set this attribute to a meaningful value for the :term:" -"`loader` to use. In the uncommon case that there is not one (like for " -"namespace packages), it should be set to ``None``." +"The location the :term:`loader` should use to load the module (see :attr:" +"`__file__` attributes on modules). For example, for modules loaded from a ." +"py file this is the filename. The :term:`finder` should always set this " +"attribute to a meaningful value for the :term:`loader` to use. In the " +"uncommon case that there is not one (like for namespace packages), it should " +"be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1206 -msgid "(:attr:`__path__`)" -msgstr "(:attr:`__path__`)" - -#: ../../library/importlib.rst:1208 +#: ../../library/importlib.rst:1202 msgid "" -"The list of locations where the package's submodules will be found. Most of " -"the time this is a single directory. The :term:`finder` should set this " -"attribute to a list, even an empty one, to indicate to the import system " -"that the module is a package. It should be set to ``None`` for non-package " -"modules. It is set automatically later to a special object for namespace " -"packages." +"The list of locations where the package's submodules will be found (see :" +"attr:`__path__` attributes on modules). Most of the time this is a single " +"directory. The :term:`finder` should set this attribute to a list, even an " +"empty one, to indicate to the import system that the module is a package. " +"It should be set to ``None`` for non-package modules. It is set " +"automatically later to a special object for namespace packages." msgstr "" -#: ../../library/importlib.rst:1217 +#: ../../library/importlib.rst:1212 msgid "" "The :term:`finder` may set this attribute to an object containing " "additional, module-specific data to use when loading the module. Otherwise " "it should be set to ``None``." msgstr "" -#: ../../library/importlib.rst:1223 -msgid "(:attr:`__cached__`)" -msgstr "(:attr:`__cached__`)" +#: ../../library/importlib.rst:1218 +msgid "" +"The filename of a compiled version of the module's code (see :attr:" +"`__cached__` attributes on modules). The :term:`finder` should always set " +"this attribute but it may be ``None`` for modules that do not need compiled " +"code stored." +msgstr "" #: ../../library/importlib.rst:1225 msgid "" -"The filename of a compiled version of the module's code. The :term:`finder` " -"should always set this attribute but it may be ``None`` for modules that do " -"not need compiled code stored." +"(Read-only) The fully qualified name of the package the module is in (or the " +"empty string for a top-level module). See :attr:`__package__` attributes on " +"modules. If the module is a package then this is the same as :attr:`name`." msgstr "" -#: ../../library/importlib.rst:1231 -msgid "(:attr:`__package__`)" -msgstr "(:attr:`__package__`)" - -#: ../../library/importlib.rst:1233 +#: ../../library/importlib.rst:1232 msgid "" -"(Read-only) The fully qualified name of the package the module is in (or the " -"empty string for a top-level module). If the module is a package then this " -"is the same as :attr:`name`." +"``True`` if the spec's :attr:`origin` refers to a loadable location, " +"``False`` otherwise. This value impacts how :attr:`origin` is interpreted " +"and how the module's :attr:`__file__` is populated." msgstr "" #: ../../library/importlib.rst:1239 -msgid "``True`` if the spec's :attr:`origin` refers to a loadable location," +msgid "" +"A specialization of :class:`importlib.machinery.ExtensionFileLoader` that is " +"able to load extension modules in Framework format." msgstr "" -#: ../../library/importlib.rst:1240 +#: ../../library/importlib.rst:1242 msgid "" -"``False`` otherwise. This value impacts how :attr:`origin` is interpreted " -"and how the module's :attr:`__file__` is populated." +"For compatibility with the iOS App Store, *all* binary modules in an iOS app " +"must be dynamic libraries, contained in a framework with appropriate " +"metadata, stored in the ``Frameworks`` folder of the packaged app. There can " +"be only a single binary per framework, and there can be no executable binary " +"material outside the Frameworks folder." +msgstr "" + +#: ../../library/importlib.rst:1248 +msgid "" +"To accommodate this requirement, when running on iOS, extension module " +"binaries are *not* packaged as ``.so`` files on ``sys.path``, but as " +"individual standalone frameworks. To discover those frameworks, this loader " +"is be registered against the ``.fwork`` file extension, with a ``.fwork`` " +"file acting as a placeholder in the original location of the binary on ``sys." +"path``. The ``.fwork`` file contains the path of the actual binary in the " +"``Frameworks`` folder, relative to the app bundle. To allow for resolving a " +"framework-packaged binary back to the original location, the framework is " +"expected to contain a ``.origin`` file that contains the location of the ``." +"fwork`` file, relative to the app bundle." +msgstr "" + +#: ../../library/importlib.rst:1259 +msgid "" +"For example, consider the case of an import ``from foo.bar import _whiz``, " +"where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" +"_whiz.abi3.so``, with ``sources`` being the location registered on ``sys." +"path``, relative to the application bundle. This module *must* be " +"distributed as ``Frameworks/foo.bar._whiz.framework/foo.bar._whiz`` " +"(creating the framework name from the full import path of the module), with " +"an ``Info.plist`` file in the ``.framework`` directory identifying the " +"binary as a framework. The ``foo.bar._whiz`` module would be represented in " +"the original location with a ``sources/foo/bar/_whiz.abi3.fwork`` marker " +"file, containing the path ``Frameworks/foo.bar._whiz/foo.bar._whiz``. The " +"framework would also contain ``Frameworks/foo.bar._whiz.framework/foo.bar." +"_whiz.origin``, containing the path to the ``.fwork`` file." +msgstr "" + +#: ../../library/importlib.rst:1273 +msgid "" +"When a module is loaded with this loader, the ``__file__`` for the module " +"will report as the location of the ``.fwork`` file. This allows code to use " +"the ``__file__`` of a module as an anchor for file system traveral. " +"However, the spec origin will reference the location of the *actual* binary " +"in the ``.framework`` folder." +msgstr "" + +#: ../../library/importlib.rst:1279 +msgid "" +"The Xcode project building the app is responsible for converting any ``.so`` " +"files from wherever they exist in the ``PYTHONPATH`` into frameworks in the " +"``Frameworks`` folder (including stripping extensions from the module file, " +"the addition of framework metadata, and signing the resulting framework), " +"and creating the ``.fwork`` and ``.origin`` files. This will usually be done " +"with a build step in the Xcode project; see the iOS documentation for " +"details on how to construct this build step." msgstr "" -#: ../../library/importlib.rst:1245 +#: ../../library/importlib.rst:1289 +msgid ":ref:`Availability `: iOS." +msgstr "" + +#: ../../library/importlib.rst:1297 +msgid "Path to the ``.fwork`` file for the extension module." +msgstr "" + +#: ../../library/importlib.rst:1301 msgid ":mod:`importlib.util` -- Utility code for importers" msgstr "" -#: ../../library/importlib.rst:1251 +#: ../../library/importlib.rst:1307 msgid "**Source code:** :source:`Lib/importlib/util.py`" msgstr "**原始碼:**\\ :source:`Lib/importlib/util.py`" -#: ../../library/importlib.rst:1255 +#: ../../library/importlib.rst:1311 msgid "" "This module contains the various objects that help in the construction of " "an :term:`importer`." msgstr "" -#: ../../library/importlib.rst:1260 +#: ../../library/importlib.rst:1316 msgid "" "The bytes which represent the bytecode version number. If you need help with " "loading/writing bytecode then consider :class:`importlib.abc.SourceLoader`." msgstr "" -#: ../../library/importlib.rst:1267 +#: ../../library/importlib.rst:1323 msgid "" "Return the :pep:`3147`/:pep:`488` path to the byte-compiled file associated " "with the source *path*. For example, if *path* is ``/foo/bar/baz.py`` the " @@ -1549,7 +1601,7 @@ msgid "" "`NotImplementedError` will be raised)." msgstr "" -#: ../../library/importlib.rst:1274 +#: ../../library/importlib.rst:1330 msgid "" "The *optimization* parameter is used to specify the optimization level of " "the bytecode file. An empty string represents no optimization, so ``/foo/bar/" @@ -1562,7 +1614,7 @@ msgid "" "be alphanumeric, else :exc:`ValueError` is raised." msgstr "" -#: ../../library/importlib.rst:1284 +#: ../../library/importlib.rst:1340 msgid "" "The *debug_override* parameter is deprecated and can be used to override the " "system's value for ``__debug__``. A ``True`` value is the equivalent of " @@ -1571,18 +1623,18 @@ msgid "" "are not ``None`` then :exc:`TypeError` is raised." msgstr "" -#: ../../library/importlib.rst:1292 +#: ../../library/importlib.rst:1348 msgid "" "The *optimization* parameter was added and the *debug_override* parameter " "was deprecated." msgstr "" -#: ../../library/importlib.rst:1296 ../../library/importlib.rst:1312 -#: ../../library/importlib.rst:1401 +#: ../../library/importlib.rst:1352 ../../library/importlib.rst:1368 +#: ../../library/importlib.rst:1457 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/importlib.rst:1302 +#: ../../library/importlib.rst:1358 msgid "" "Given the *path* to a :pep:`3147` file name, return the associated source " "code file path. For example, if *path* is ``/foo/bar/__pycache__/baz." @@ -1592,25 +1644,25 @@ msgid "" "cache_tag` is not defined, :exc:`NotImplementedError` is raised." msgstr "" -#: ../../library/importlib.rst:1317 +#: ../../library/importlib.rst:1373 msgid "" "Decode the given bytes representing source code and return it as a string " "with universal newlines (as required by :meth:`importlib.abc.InspectLoader." "get_source`)." msgstr "" -#: ../../library/importlib.rst:1325 +#: ../../library/importlib.rst:1381 msgid "Resolve a relative module name to an absolute one." msgstr "" -#: ../../library/importlib.rst:1327 +#: ../../library/importlib.rst:1383 msgid "" "If **name** has no leading dots, then **name** is simply returned. This " "allows for usage such as ``importlib.util.resolve_name('sys', __spec__." "parent)`` without doing a check to see if the **package** argument is needed." msgstr "" -#: ../../library/importlib.rst:1332 +#: ../../library/importlib.rst:1388 msgid "" ":exc:`ImportError` is raised if **name** is a relative module name but " "**package** is a false value (e.g. ``None`` or the empty string). :exc:" @@ -1618,13 +1670,13 @@ msgid "" "package (e.g. requesting ``..bacon`` from within the ``spam`` package)." msgstr "" -#: ../../library/importlib.rst:1340 +#: ../../library/importlib.rst:1396 msgid "" "To improve consistency with import statements, raise :exc:`ImportError` " "instead of :exc:`ValueError` for invalid relative import attempts." msgstr "" -#: ../../library/importlib.rst:1347 +#: ../../library/importlib.rst:1403 msgid "" "Find the :term:`spec ` for a module, optionally relative to the " "specified **package** name. If the module is in :data:`sys.modules`, then " @@ -1634,30 +1686,30 @@ msgid "" "if no spec is found." msgstr "" -#: ../../library/importlib.rst:1354 +#: ../../library/importlib.rst:1410 msgid "" "If **name** is for a submodule (contains a dot), the parent module is " "automatically imported." msgstr "" -#: ../../library/importlib.rst:1357 +#: ../../library/importlib.rst:1413 msgid "**name** and **package** work the same as for :func:`import_module`." msgstr "" -#: ../../library/importlib.rst:1361 +#: ../../library/importlib.rst:1417 msgid "" "Raises :exc:`ModuleNotFoundError` instead of :exc:`AttributeError` if " "**package** is in fact not a package (i.e. lacks a :attr:`__path__` " "attribute)." msgstr "" -#: ../../library/importlib.rst:1368 +#: ../../library/importlib.rst:1424 msgid "" "Create a new module based on **spec** and :meth:`spec.loader.create_module " "`." msgstr "" -#: ../../library/importlib.rst:1371 +#: ../../library/importlib.rst:1427 msgid "" "If :meth:`spec.loader.create_module ` " "does not return ``None``, then any pre-existing attributes will not be " @@ -1665,14 +1717,14 @@ msgid "" "accessing **spec** or setting an attribute on the module." msgstr "" -#: ../../library/importlib.rst:1376 +#: ../../library/importlib.rst:1432 msgid "" "This function is preferred over using :class:`types.ModuleType` to create a " "new module as **spec** is used to set as many import-controlled attributes " "on the module as possible." msgstr "" -#: ../../library/importlib.rst:1384 +#: ../../library/importlib.rst:1440 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on a loader. The parameters have the same meaning as they do " @@ -1681,7 +1733,7 @@ msgid "" "spec." msgstr "" -#: ../../library/importlib.rst:1394 +#: ../../library/importlib.rst:1450 msgid "" "A factory function for creating a :class:`~importlib.machinery.ModuleSpec` " "instance based on the path to a file. Missing information will be filled in " @@ -1689,14 +1741,14 @@ msgid "" "module will be file-based." msgstr "" -#: ../../library/importlib.rst:1406 +#: ../../library/importlib.rst:1462 msgid "" "Return the hash of *source_bytes* as bytes. A hash-based ``.pyc`` file " "embeds the :func:`source_hash` of the corresponding source file's contents " "in its header." msgstr "" -#: ../../library/importlib.rst:1414 +#: ../../library/importlib.rst:1470 msgid "" "A context manager that can temporarily skip the compatibility check for " "extension modules. By default the check is enabled and will fail when a " @@ -1705,33 +1757,33 @@ msgid "" "interpreter GIL, when imported in an interpreter with its own GIL." msgstr "" -#: ../../library/importlib.rst:1421 +#: ../../library/importlib.rst:1477 msgid "" "Note that this function is meant to accommodate an unusual case; one which " "is likely to eventually go away. There's is a pretty good chance this is " "not what you were looking for." msgstr "" -#: ../../library/importlib.rst:1425 +#: ../../library/importlib.rst:1481 msgid "" "You can get the same effect as this function by implementing the basic " "interface of multi-phase init (:pep:`489`) and lying about support for " "multiple interpreters (or per-interpreter GIL)." msgstr "" -#: ../../library/importlib.rst:1430 +#: ../../library/importlib.rst:1486 msgid "" "Using this function to disable the check can lead to unexpected behavior and " "even crashes. It should only be used during extension module development." msgstr "" -#: ../../library/importlib.rst:1438 +#: ../../library/importlib.rst:1494 msgid "" "A class which postpones the execution of the loader of a module until the " "module has an attribute accessed." msgstr "" -#: ../../library/importlib.rst:1441 +#: ../../library/importlib.rst:1497 msgid "" "This class **only** works with loaders that define :meth:`~importlib.abc." "Loader.exec_module` as control over what module type is used for the module " @@ -1744,7 +1796,7 @@ msgid "" "raised if such a substitution is detected." msgstr "" -#: ../../library/importlib.rst:1452 +#: ../../library/importlib.rst:1508 msgid "" "For projects where startup time is critical, this class allows for " "potentially minimizing the cost of loading a module if it is never used. For " @@ -1753,21 +1805,21 @@ msgid "" "postponed and thus occurring out of context." msgstr "" -#: ../../library/importlib.rst:1460 +#: ../../library/importlib.rst:1516 msgid "" "Began calling :meth:`~importlib.abc.Loader.create_module`, removing the " "compatibility warning for :class:`importlib.machinery.BuiltinImporter` and :" "class:`importlib.machinery.ExtensionFileLoader`." msgstr "" -#: ../../library/importlib.rst:1467 +#: ../../library/importlib.rst:1523 msgid "" "A class method which returns a callable that creates a lazy loader. This is " "meant to be used in situations where the loader is passed by class instead " "of by instance. ::" msgstr "" -#: ../../library/importlib.rst:1472 +#: ../../library/importlib.rst:1528 msgid "" "suffixes = importlib.machinery.SOURCE_SUFFIXES\n" "loader = importlib.machinery.SourceFileLoader\n" @@ -1779,20 +1831,20 @@ msgstr "" "lazy_loader = importlib.util.LazyLoader.factory(loader)\n" "finder = importlib.machinery.FileFinder(path, (lazy_loader, suffixes))" -#: ../../library/importlib.rst:1480 +#: ../../library/importlib.rst:1536 msgid "Examples" msgstr "範例" -#: ../../library/importlib.rst:1483 +#: ../../library/importlib.rst:1539 msgid "Importing programmatically" msgstr "" -#: ../../library/importlib.rst:1485 +#: ../../library/importlib.rst:1541 msgid "" "To programmatically import a module, use :func:`importlib.import_module`. ::" msgstr "" -#: ../../library/importlib.rst:1488 +#: ../../library/importlib.rst:1544 msgid "" "import importlib\n" "\n" @@ -1802,23 +1854,23 @@ msgstr "" "\n" "itertools = importlib.import_module('itertools')" -#: ../../library/importlib.rst:1494 +#: ../../library/importlib.rst:1550 msgid "Checking if a module can be imported" msgstr "" -#: ../../library/importlib.rst:1496 +#: ../../library/importlib.rst:1552 msgid "" "If you need to find out if a module can be imported without actually doing " "the import, then you should use :func:`importlib.util.find_spec`." msgstr "" -#: ../../library/importlib.rst:1499 +#: ../../library/importlib.rst:1555 msgid "" "Note that if ``name`` is a submodule (contains a dot), :func:`importlib.util." "find_spec` will import the parent module. ::" msgstr "" -#: ../../library/importlib.rst:1503 +#: ../../library/importlib.rst:1559 msgid "" "import importlib.util\n" "import sys\n" @@ -1838,39 +1890,58 @@ msgid "" " print(f\"can't find the {name!r} module\")" msgstr "" -#: ../../library/importlib.rst:1522 +#: ../../library/importlib.rst:1578 msgid "Importing a source file directly" msgstr "" -#: ../../library/importlib.rst:1524 -msgid "To import a Python source file directly, use the following recipe::" +#: ../../library/importlib.rst:1580 +msgid "" +"This recipe should be used with caution: it is an approximation of an import " +"statement where the file path is specified directly, rather than :data:`sys." +"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:1587 +msgid "" +"To import a Python source file directly from a path, use the following " +"recipe::" msgstr "" -#: ../../library/importlib.rst:1526 +#: ../../library/importlib.rst:1589 msgid "" "import importlib.util\n" "import sys\n" "\n" -"# For illustrative purposes.\n" -"import tokenize\n" -"file_path = tokenize.__file__\n" -"module_name = tokenize.__name__\n" "\n" -"spec = importlib.util.spec_from_file_location(module_name, file_path)\n" -"module = importlib.util.module_from_spec(spec)\n" -"sys.modules[module_name] = module\n" -"spec.loader.exec_module(module)" +"def import_from_path(module_name, file_path):\n" +" spec = importlib.util.spec_from_file_location(module_name, file_path)\n" +" module = importlib.util.module_from_spec(spec)\n" +" sys.modules[module_name] = module\n" +" spec.loader.exec_module(module)\n" +" return module\n" +"\n" +"\n" +"# For illustrative purposes only (use of `json` is arbitrary).\n" +"import json\n" +"file_path = json.__file__\n" +"module_name = json.__name__\n" +"\n" +"# Similar outcome as `import json`.\n" +"json = import_from_path(module_name, file_path)" msgstr "" -#: ../../library/importlib.rst:1541 +#: ../../library/importlib.rst:1611 msgid "Implementing lazy imports" msgstr "" -#: ../../library/importlib.rst:1543 +#: ../../library/importlib.rst:1613 msgid "The example below shows how to implement lazy imports::" msgstr "" -#: ../../library/importlib.rst:1545 +#: ../../library/importlib.rst:1615 msgid "" ">>> import importlib.util\n" ">>> import sys\n" @@ -1890,11 +1961,11 @@ msgid "" "False" msgstr "" -#: ../../library/importlib.rst:1565 +#: ../../library/importlib.rst:1634 msgid "Setting up an importer" msgstr "" -#: ../../library/importlib.rst:1567 +#: ../../library/importlib.rst:1636 msgid "" "For deep customizations of import, you typically want to implement an :term:" "`importer`. This means managing both the :term:`finder` and :term:`loader` " @@ -1908,7 +1979,7 @@ msgid "" "for the appropriate classes defined within this package)::" msgstr "" -#: ../../library/importlib.rst:1578 +#: ../../library/importlib.rst:1647 msgid "" "import importlib.machinery\n" "import sys\n" @@ -1932,11 +2003,11 @@ msgid "" "sys.path_hooks.append(SpamPathEntryFinder.path_hook(loader_details))" msgstr "" -#: ../../library/importlib.rst:1599 +#: ../../library/importlib.rst:1668 msgid "Approximating :func:`importlib.import_module`" msgstr "" -#: ../../library/importlib.rst:1601 +#: ../../library/importlib.rst:1670 msgid "" "Import itself is implemented in Python code, making it possible to expose " "most of the import machinery through importlib. The following helps " @@ -1944,7 +2015,7 @@ msgid "" "approximate implementation of :func:`importlib.import_module`::" msgstr "" -#: ../../library/importlib.rst:1607 +#: ../../library/importlib.rst:1676 msgid "" "import importlib.util\n" "import sys\n" @@ -1984,3 +2055,21 @@ msgstr "universal newlines" #: ../../library/importlib.rst:443 msgid "importlib.abc.InspectLoader.get_source method" msgstr "importlib.abc.InspectLoader.get_source 方法" + +#~ msgid "(:attr:`__name__`)" +#~ msgstr "(:attr:`__name__`)" + +#~ msgid "(:attr:`__loader__`)" +#~ msgstr "(:attr:`__loader__`)" + +#~ msgid "(:attr:`__file__`)" +#~ msgstr "(:attr:`__file__`)" + +#~ msgid "(:attr:`__path__`)" +#~ msgstr "(:attr:`__path__`)" + +#~ msgid "(:attr:`__cached__`)" +#~ msgstr "(:attr:`__cached__`)" + +#~ msgid "(:attr:`__package__`)" +#~ msgstr "(:attr:`__package__`)" diff --git a/library/importlib.resources.abc.po b/library/importlib.resources.abc.po index 640cb5446c..5439f00156 100644 --- a/library/importlib.resources.abc.po +++ b/library/importlib.resources.abc.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/importlib.resources.po b/library/importlib.resources.po index 46564377c8..01d3b9aa4c 100644 --- a/library/importlib.resources.po +++ b/library/importlib.resources.po @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -137,187 +137,227 @@ msgstr "" msgid "Added support for *traversable* representing a directory." msgstr "" -#: ../../library/importlib.resources.rst:103 -msgid "Deprecated functions" -msgstr "已棄用函式" - #: ../../library/importlib.resources.rst:105 +msgid "Functional API" +msgstr "" + +#: ../../library/importlib.resources.rst:107 msgid "" -"An older, deprecated set of functions is still available, but is scheduled " -"for removal in a future version of Python. The main drawback of these " -"functions is that they do not support directories: they assume all resources " -"are located directly within a *package*." +"A set of simplified, backwards-compatible helpers is available. These allow " +"common operations in a single function call." +msgstr "" + +#: ../../library/importlib.resources.rst:110 +msgid "For all the following functions:" msgstr "" #: ../../library/importlib.resources.rst:112 msgid "" -"Whenever a function accepts a ``Package`` argument, you can pass in either " -"a :class:`module object ` or a module name as a string. " -"You can only pass module objects whose ``__spec__." -"submodule_search_locations`` is not ``None``." +"*anchor* is an :class:`~importlib.resources.Anchor`, as in :func:`~importlib." +"resources.files`. Unlike in ``files``, it may not be omitted." +msgstr "" + +#: ../../library/importlib.resources.rst:116 +msgid "" +"*path_names* are components of a resource's path name, relative to the " +"anchor. For example, to get the text of resource named ``info.txt``, use::" msgstr "" -#: ../../library/importlib.resources.rst:117 -msgid "The ``Package`` type is defined as ``Union[str, ModuleType]``." +#: ../../library/importlib.resources.rst:120 +msgid "importlib.resources.read_text(my_module, \"info.txt\")" msgstr "" -#: ../../library/importlib.resources.rst:124 +#: ../../library/importlib.resources.rst:122 msgid "" -"For *resource* arguments of the functions below, you can pass in the name of " -"a resource as a string or a :class:`path-like object `." +"Like :meth:`Traversable.joinpath `, The " +"individual components should use forward slashes (``/``) as path separators. " +"For example, the following are equivalent::" msgstr "" -#: ../../library/importlib.resources.rst:128 -msgid "The ``Resource`` type is defined as ``Union[str, os.PathLike]``." +#: ../../library/importlib.resources.rst:127 +msgid "" +"importlib.resources.read_binary(my_module, \"pics/painting.png\")\n" +"importlib.resources.read_binary(my_module, \"pics\", \"painting.png\")" msgstr "" -#: ../../library/importlib.resources.rst:133 -msgid "Open for binary reading the *resource* within *package*." +#: ../../library/importlib.resources.rst:130 +msgid "" +"For backward compatibility reasons, functions that read text require an " +"explicit *encoding* argument if multiple *path_names* are given. For " +"example, to get the text of ``info/chapter1.txt``, use::" msgstr "" -#: ../../library/importlib.resources.rst:135 +#: ../../library/importlib.resources.rst:134 msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory). This function returns a ``typing." -"BinaryIO`` instance, a binary I/O stream open for reading." +"importlib.resources.read_text(my_module, \"info\", \"chapter1.txt\",\n" +" encoding='utf-8')" msgstr "" -#: ../../library/importlib.resources.rst:143 -#: ../../library/importlib.resources.rst:164 -#: ../../library/importlib.resources.rst:182 -#: ../../library/importlib.resources.rst:201 -#: ../../library/importlib.resources.rst:237 -#: ../../library/importlib.resources.rst:253 -msgid "Calls to this function can be replaced by::" +#: ../../library/importlib.resources.rst:139 +msgid "Open the named resource for binary reading." msgstr "" -#: ../../library/importlib.resources.rst:145 -msgid "files(package).joinpath(resource).open('rb')" +#: ../../library/importlib.resources.rst:141 +#: ../../library/importlib.resources.rst:184 +#: ../../library/importlib.resources.rst:232 +#: ../../library/importlib.resources.rst:249 +#: ../../library/importlib.resources.rst:267 +msgid "" +"See :ref:`the introduction ` for details on " +"*anchor* and *path_names*." +msgstr "" + +#: ../../library/importlib.resources.rst:144 +msgid "" +"This function returns a :class:`~typing.BinaryIO` object, that is, a binary " +"stream open for reading." +msgstr "" + +#: ../../library/importlib.resources.rst:147 +#: ../../library/importlib.resources.rst:171 +#: ../../library/importlib.resources.rst:187 +#: ../../library/importlib.resources.rst:208 +#: ../../library/importlib.resources.rst:235 +#: ../../library/importlib.resources.rst:252 +#: ../../library/importlib.resources.rst:270 +msgid "This function is roughly equivalent to::" +msgstr "" + +#: ../../library/importlib.resources.rst:149 +#, fuzzy +msgid "files(anchor).joinpath(*path_names).open('rb')" msgstr "files(package).joinpath(resource).open('rb')" -#: ../../library/importlib.resources.rst:150 +#: ../../library/importlib.resources.rst:151 +#: ../../library/importlib.resources.rst:191 +#: ../../library/importlib.resources.rst:256 +msgid "Multiple *path_names* are accepted." +msgstr "" + +#: ../../library/importlib.resources.rst:157 msgid "" -"Open for text reading the *resource* within *package*. By default, the " -"resource is opened for reading as UTF-8." +"Open the named resource for text reading. By default, the contents are read " +"as strict UTF-8." msgstr "" -#: ../../library/importlib.resources.rst:153 +#: ../../library/importlib.resources.rst:160 +#: ../../library/importlib.resources.rst:200 +msgid "" +"See :ref:`the introduction ` for details on " +"*anchor* and *path_names*. *encoding* and *errors* have the same meaning as " +"in built-in :func:`open`." +msgstr "" + +#: ../../library/importlib.resources.rst:164 +#: ../../library/importlib.resources.rst:204 msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory). *encoding* and *errors* have the " -"same meaning as with built-in :func:`open`." +"For backward compatibility reasons, the *encoding* argument must be given " +"explicitly if there are multiple *path_names*. This limitation is scheduled " +"to be removed in Python 3.15." msgstr "" -#: ../../library/importlib.resources.rst:159 +#: ../../library/importlib.resources.rst:168 msgid "" -"This function returns a ``typing.TextIO`` instance, a text I/O stream open " -"for reading." +"This function returns a :class:`~typing.TextIO` object, that is, a text " +"stream open for reading." msgstr "" -#: ../../library/importlib.resources.rst:166 -msgid "files(package).joinpath(resource).open('r', encoding=encoding)" +#: ../../library/importlib.resources.rst:173 +#, fuzzy +msgid "files(anchor).joinpath(*path_names).open('r', encoding=encoding)" msgstr "files(package).joinpath(resource).open('r', encoding=encoding)" -#: ../../library/importlib.resources.rst:171 +#: ../../library/importlib.resources.rst:175 +#: ../../library/importlib.resources.rst:212 +#: ../../library/importlib.resources.rst:239 msgid "" -"Read and return the contents of the *resource* within *package* as ``bytes``." +"Multiple *path_names* are accepted. *encoding* and *errors* must be given as " +"keyword arguments." msgstr "" -#: ../../library/importlib.resources.rst:174 -msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory). This function returns the " -"contents of the resource as :class:`bytes`." +#: ../../library/importlib.resources.rst:182 +msgid "Read and return the contents of the named resource as :class:`bytes`." msgstr "" -#: ../../library/importlib.resources.rst:184 -msgid "files(package).joinpath(resource).read_bytes()" +#: ../../library/importlib.resources.rst:189 +#, fuzzy +msgid "files(anchor).joinpath(*path_names).read_bytes()" msgstr "files(package).joinpath(resource).read_bytes()" -#: ../../library/importlib.resources.rst:189 +#: ../../library/importlib.resources.rst:197 msgid "" -"Read and return the contents of *resource* within *package* as a ``str``. By " +"Read and return the contents of the named resource as :class:`str`. By " "default, the contents are read as strict UTF-8." msgstr "" -#: ../../library/importlib.resources.rst:192 -msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory). *encoding* and *errors* have the " -"same meaning as with built-in :func:`open`. This function returns the " -"contents of the resource as :class:`str`." -msgstr "" - -#: ../../library/importlib.resources.rst:203 -msgid "files(package).joinpath(resource).read_text(encoding=encoding)" +#: ../../library/importlib.resources.rst:210 +#, fuzzy +msgid "files(anchor).joinpath(*path_names).read_text(encoding=encoding)" msgstr "files(package).joinpath(resource).read_text(encoding=encoding)" -#: ../../library/importlib.resources.rst:208 +#: ../../library/importlib.resources.rst:219 msgid "" -"Return the path to the *resource* as an actual file system path. This " +"Provides the path to the *resource* as an actual file system path. This " "function returns a context manager for use in a :keyword:`with` statement. " "The context manager provides a :class:`pathlib.Path` object." msgstr "" -#: ../../library/importlib.resources.rst:212 +#: ../../library/importlib.resources.rst:223 msgid "" -"Exiting the context manager cleans up any temporary file created when the " -"resource needs to be extracted from e.g. a zip file." +"Exiting the context manager cleans up any temporary files created, e.g. when " +"the resource needs to be extracted from a zip file." msgstr "" -#: ../../library/importlib.resources.rst:215 +#: ../../library/importlib.resources.rst:226 msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements. *resource* is the name of the resource to open " -"within *package*; it may not contain path separators and it may not have sub-" -"resources (i.e. it cannot be a directory)." +"For example, the :meth:`~pathlib.Path.stat` method requires an actual file " +"system path; it can be used like this::" msgstr "" -#: ../../library/importlib.resources.rst:222 -msgid "Calls to this function can be replaced using :func:`as_file`::" +#: ../../library/importlib.resources.rst:229 +msgid "" +"with importlib.resources.path(anchor, \"resource.txt\") as fspath:\n" +" result = fspath.stat()" msgstr "" -#: ../../library/importlib.resources.rst:224 -msgid "as_file(files(package).joinpath(resource))" +#: ../../library/importlib.resources.rst:237 +#, fuzzy +msgid "as_file(files(anchor).joinpath(*path_names))" msgstr "as_file(files(package).joinpath(resource))" -#: ../../library/importlib.resources.rst:229 +#: ../../library/importlib.resources.rst:246 msgid "" -"Return ``True`` if there is a resource named *name* in the package, " -"otherwise ``False``. This function does not consider directories to be " -"resources. *package* is either a name or a module object which conforms to " -"the ``Package`` requirements." +"Return ``True`` if the named resource exists, otherwise ``False``. This " +"function does not consider directories to be resources." msgstr "" -#: ../../library/importlib.resources.rst:239 -msgid "files(package).joinpath(resource).is_file()" +#: ../../library/importlib.resources.rst:254 +#, fuzzy +msgid "files(anchor).joinpath(*path_names).is_file()" msgstr "files(package).joinpath(resource).is_file()" -#: ../../library/importlib.resources.rst:244 +#: ../../library/importlib.resources.rst:262 msgid "" -"Return an iterable over the named items within the package. The iterable " -"returns :class:`str` resources (e.g. files) and non-resources (e.g. " -"directories). The iterable does not recurse into subdirectories." +"Return an iterable over the named items within the package or path. The " +"iterable returns names of resources (e.g. files) and non-resources (e.g. " +"directories) as :class:`str`. The iterable does not recurse into " +"subdirectories." msgstr "" -#: ../../library/importlib.resources.rst:248 +#: ../../library/importlib.resources.rst:272 +#, fuzzy msgid "" -"*package* is either a name or a module object which conforms to the " -"``Package`` requirements." +"for resource in files(anchor).joinpath(*path_names).iterdir():\n" +" yield resource.name" msgstr "" - -#: ../../library/importlib.resources.rst:255 -msgid "" "(resource.name for resource in files(package).iterdir() if resource." "is_file())" + +#: ../../library/importlib.resources.rst:275 +msgid "" +"Prefer ``iterdir()`` as above, which offers more control over the results " +"and richer functionality." msgstr "" -"(resource.name for resource in files(package).iterdir() if resource." -"is_file())" + +#~ msgid "Deprecated functions" +#~ msgstr "已棄用函式" diff --git a/library/index.po b/library/index.po index 483e6ba1ad..35406943a5 100644 --- a/library/index.po +++ b/library/index.po @@ -9,7 +9,7 @@ # Steven Hsu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-11-10 00:19+0000\n" "PO-Revision-Date: 2021-07-04 22:55+0800\n" diff --git a/library/inspect.po b/library/inspect.po index c1c479ae2a..4b2f07941b 100644 --- a/library/inspect.po +++ b/library/inspect.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-13 00:04+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2022-10-16 06:59+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -666,11 +666,17 @@ msgid "" "wrapped function is a Python generator function." msgstr "" -#: ../../library/inspect.rst:369 +#: ../../library/inspect.rst:366 +msgid "" +"Functions wrapped in :func:`functools.partialmethod` now return ``True`` if " +"the wrapped function is a Python generator function." +msgstr "" + +#: ../../library/inspect.rst:372 msgid "Return ``True`` if the object is a generator." msgstr "如果物件是產生器,則回傳 ``True``。" -#: ../../library/inspect.rst:374 +#: ../../library/inspect.rst:377 msgid "" "Return ``True`` if the object is a :term:`coroutine function` (a function " "defined with an :keyword:`async def` syntax), a :func:`functools.partial` " @@ -678,54 +684,60 @@ msgid "" "`markcoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:381 +#: ../../library/inspect.rst:384 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is a :term:`coroutine function`." msgstr "" -#: ../../library/inspect.rst:385 +#: ../../library/inspect.rst:388 msgid "" "Sync functions marked with :func:`markcoroutinefunction` now return ``True``." msgstr "" -#: ../../library/inspect.rst:392 +#: ../../library/inspect.rst:392 ../../library/inspect.rst:462 +msgid "" +"Functions wrapped in :func:`functools.partialmethod` now return ``True`` if " +"the wrapped function is a :term:`coroutine function`." +msgstr "" + +#: ../../library/inspect.rst:399 msgid "" "Decorator to mark a callable as a :term:`coroutine function` if it would not " "otherwise be detected by :func:`iscoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:395 +#: ../../library/inspect.rst:402 msgid "" "This may be of use for sync functions that return a :term:`coroutine`, if " "the function is passed to an API that requires :func:`iscoroutinefunction`." msgstr "" -#: ../../library/inspect.rst:398 +#: ../../library/inspect.rst:405 msgid "" "When possible, using an :keyword:`async def` function is preferred. Also " "acceptable is calling the function and testing the return with :func:" "`iscoroutine`." msgstr "" -#: ../../library/inspect.rst:407 +#: ../../library/inspect.rst:414 msgid "" "Return ``True`` if the object is a :term:`coroutine` created by an :keyword:" "`async def` function." msgstr "" -#: ../../library/inspect.rst:415 +#: ../../library/inspect.rst:422 msgid "" "Return ``True`` if the object can be used in :keyword:`await` expression." msgstr "" -#: ../../library/inspect.rst:417 +#: ../../library/inspect.rst:424 msgid "" "Can also be used to distinguish generator-based coroutines from regular " "generators:" msgstr "" -#: ../../library/inspect.rst:420 +#: ../../library/inspect.rst:427 msgid "" "import types\n" "\n" @@ -749,13 +761,13 @@ msgstr "" "assert not isawaitable(gen())\n" "assert isawaitable(gen_coro())" -#: ../../library/inspect.rst:438 +#: ../../library/inspect.rst:445 msgid "" "Return ``True`` if the object is an :term:`asynchronous generator` function, " "for example:" msgstr "" -#: ../../library/inspect.rst:441 +#: ../../library/inspect.rst:448 msgid "" ">>> async def agen():\n" "... yield 1\n" @@ -764,73 +776,74 @@ msgid "" "True" msgstr "" -#: ../../library/inspect.rst:451 +#: ../../library/inspect.rst:458 msgid "" "Functions wrapped in :func:`functools.partial` now return ``True`` if the " "wrapped function is an :term:`asynchronous generator` function." msgstr "" -#: ../../library/inspect.rst:458 +#: ../../library/inspect.rst:468 msgid "" "Return ``True`` if the object is an :term:`asynchronous generator iterator` " "created by an :term:`asynchronous generator` function." msgstr "" -#: ../../library/inspect.rst:465 +#: ../../library/inspect.rst:475 msgid "Return ``True`` if the object is a traceback." msgstr "" -#: ../../library/inspect.rst:470 +#: ../../library/inspect.rst:480 msgid "Return ``True`` if the object is a frame." msgstr "" -#: ../../library/inspect.rst:475 +#: ../../library/inspect.rst:485 msgid "Return ``True`` if the object is a code." msgstr "如果物件是程式碼,則回傳 ``True``。" -#: ../../library/inspect.rst:480 +#: ../../library/inspect.rst:490 msgid "" "Return ``True`` if the object is a built-in function or a bound built-in " "method." msgstr "" -#: ../../library/inspect.rst:485 +#: ../../library/inspect.rst:495 msgid "" "Return ``True`` if the type of object is a :class:`~types.MethodWrapperType`." msgstr "" -#: ../../library/inspect.rst:487 +#: ../../library/inspect.rst:497 msgid "" "These are instances of :class:`~types.MethodWrapperType`, such as :meth:" "`~object.__str__`, :meth:`~object.__eq__` and :meth:`~object.__repr__`." msgstr "" -#: ../../library/inspect.rst:495 +#: ../../library/inspect.rst:505 msgid "" "Return ``True`` if the object is a user-defined or built-in function or " "method." msgstr "如果物件是使用者定義或內建的函式或方法,則回傳 ``True``。" -#: ../../library/inspect.rst:500 +#: ../../library/inspect.rst:510 msgid "Return ``True`` if the object is an abstract base class." msgstr "如果物件是抽象基底類別,則回傳 ``True``。" -#: ../../library/inspect.rst:505 +#: ../../library/inspect.rst:515 msgid "" "Return ``True`` if the object is a method descriptor, but not if :func:" "`ismethod`, :func:`isclass`, :func:`isfunction` or :func:`isbuiltin` are " "true." msgstr "" -#: ../../library/inspect.rst:509 +#: ../../library/inspect.rst:519 msgid "" "This, for example, is true of ``int.__add__``. An object passing this test " -"has a :meth:`~object.__get__` method but not a :meth:`~object.__set__` " -"method, but beyond that the set of attributes varies. A :attr:`~definition." -"__name__` attribute is usually sensible, and :attr:`!__doc__` often is." +"has a :meth:`~object.__get__` method, but not a :meth:`~object.__set__` " +"method or a :meth:`~object.__delete__` method. Beyond that, the set of " +"attributes varies. A :attr:`~definition.__name__` attribute is usually " +"sensible, and :attr:`~definition.__doc__` often is." msgstr "" -#: ../../library/inspect.rst:515 +#: ../../library/inspect.rst:525 msgid "" "Methods implemented via descriptors that also pass one of the other tests " "return ``False`` from the :func:`ismethoddescriptor` test, simply because " @@ -838,11 +851,19 @@ msgid "" "`~method.__func__` attribute (etc) when an object passes :func:`ismethod`." msgstr "" -#: ../../library/inspect.rst:524 +#: ../../library/inspect.rst:531 +msgid "" +"This function no longer incorrectly reports objects with :meth:`~object." +"__get__` and :meth:`~object.__delete__`, but not :meth:`~object.__set__`, as " +"being method descriptors (such objects are data descriptors, not method " +"descriptors)." +msgstr "" + +#: ../../library/inspect.rst:539 msgid "Return ``True`` if the object is a data descriptor." msgstr "如果物件是資料描述器,則回傳 ``True``。" -#: ../../library/inspect.rst:526 +#: ../../library/inspect.rst:541 msgid "" "Data descriptors have a :attr:`~object.__set__` or a :attr:`~object." "__delete__` method. Examples are properties (defined in Python), getsets, " @@ -853,33 +874,33 @@ msgid "" "and members have both of these attributes), but this is not guaranteed." msgstr "" -#: ../../library/inspect.rst:537 +#: ../../library/inspect.rst:552 msgid "Return ``True`` if the object is a getset descriptor." msgstr "" -#: ../../library/inspect.rst:541 +#: ../../library/inspect.rst:556 msgid "" "getsets are attributes defined in extension modules via :c:type:" "`PyGetSetDef` structures. For Python implementations without such types, " "this method will always return ``False``." msgstr "" -#: ../../library/inspect.rst:548 +#: ../../library/inspect.rst:563 msgid "Return ``True`` if the object is a member descriptor." msgstr "如果物件是成員描述器,則回傳 ``True``。" -#: ../../library/inspect.rst:552 +#: ../../library/inspect.rst:567 msgid "" "Member descriptors are attributes defined in extension modules via :c:type:" "`PyMemberDef` structures. For Python implementations without such types, " "this method will always return ``False``." msgstr "" -#: ../../library/inspect.rst:560 +#: ../../library/inspect.rst:575 msgid "Retrieving source code" msgstr "取得原始碼" -#: ../../library/inspect.rst:564 +#: ../../library/inspect.rst:579 msgid "" "Get the documentation string for an object, cleaned up with :func:" "`cleandoc`. If the documentation string for an object is not provided and " @@ -888,11 +909,11 @@ msgid "" "documentation string is invalid or missing." msgstr "" -#: ../../library/inspect.rst:570 +#: ../../library/inspect.rst:585 msgid "Documentation strings are now inherited if not overridden." msgstr "" -#: ../../library/inspect.rst:576 +#: ../../library/inspect.rst:591 msgid "" "Return in a single string any lines of comments immediately preceding the " "object's source code (for a class, function, or method), or at the top of " @@ -901,27 +922,27 @@ msgid "" "been defined in C or the interactive shell." msgstr "" -#: ../../library/inspect.rst:585 +#: ../../library/inspect.rst:600 msgid "" "Return the name of the (text or binary) file in which an object was defined. " "This will fail with a :exc:`TypeError` if the object is a built-in module, " "class, or function." msgstr "" -#: ../../library/inspect.rst:592 +#: ../../library/inspect.rst:607 msgid "" "Try to guess which module an object was defined in. Return ``None`` if the " "module cannot be determined." msgstr "" -#: ../../library/inspect.rst:598 +#: ../../library/inspect.rst:613 msgid "" "Return the name of the Python source file in which an object was defined or " "``None`` if no way can be identified to get the source. This will fail with " "a :exc:`TypeError` if the object is a built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:606 +#: ../../library/inspect.rst:621 msgid "" "Return a list of source lines and starting line number for an object. The " "argument may be a module, class, method, function, traceback, frame, or code " @@ -932,13 +953,13 @@ msgid "" "built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:615 ../../library/inspect.rst:629 +#: ../../library/inspect.rst:630 ../../library/inspect.rst:644 msgid "" ":exc:`OSError` is raised instead of :exc:`IOError`, now an alias of the " "former." msgstr "" -#: ../../library/inspect.rst:622 +#: ../../library/inspect.rst:637 msgid "" "Return the text of the source code for an object. The argument may be a " "module, class, method, function, traceback, frame, or code object. The " @@ -947,13 +968,13 @@ msgid "" "object is a built-in module, class, or function." msgstr "" -#: ../../library/inspect.rst:636 +#: ../../library/inspect.rst:651 msgid "" "Clean up indentation from docstrings that are indented to line up with " "blocks of code." msgstr "" -#: ../../library/inspect.rst:639 +#: ../../library/inspect.rst:654 msgid "" "All leading whitespace is removed from the first line. Any leading " "whitespace that can be uniformly removed from the second line onwards is " @@ -961,22 +982,22 @@ msgid "" "Also, all tabs are expanded to spaces." msgstr "" -#: ../../library/inspect.rst:648 +#: ../../library/inspect.rst:663 msgid "Introspecting callables with the Signature object" msgstr "" -#: ../../library/inspect.rst:652 +#: ../../library/inspect.rst:667 msgid "" "The :class:`Signature` object represents the call signature of a callable " "object and its return annotation. To retrieve a :class:`!Signature` object, " "use the :func:`!signature` function." msgstr "" -#: ../../library/inspect.rst:659 +#: ../../library/inspect.rst:674 msgid "Return a :class:`Signature` object for the given *callable*:" msgstr "" -#: ../../library/inspect.rst:661 +#: ../../library/inspect.rst:676 msgid "" ">>> from inspect import signature\n" ">>> def foo(a, *, b:int, **kwargs):\n" @@ -1008,13 +1029,13 @@ msgstr "" ">>> sig.parameters['b'].annotation\n" "" -#: ../../library/inspect.rst:678 +#: ../../library/inspect.rst:693 msgid "" "Accepts a wide range of Python callables, from plain functions and classes " "to :func:`functools.partial` objects." msgstr "" -#: ../../library/inspect.rst:681 +#: ../../library/inspect.rst:696 msgid "" "For objects defined in modules using stringized annotations (``from " "__future__ import annotations``), :func:`signature` will attempt to " @@ -1024,7 +1045,7 @@ msgid "" "func:`get_annotations` for instructions on how to use these parameters." msgstr "" -#: ../../library/inspect.rst:690 +#: ../../library/inspect.rst:705 msgid "" "Raises :exc:`ValueError` if no signature can be provided, and :exc:" "`TypeError` if that type of object is not supported. Also, if the " @@ -1033,32 +1054,32 @@ msgid "" "potentially raise any kind of exception." msgstr "" -#: ../../library/inspect.rst:696 +#: ../../library/inspect.rst:711 msgid "" "A slash(/) in the signature of a function denotes that the parameters prior " "to it are positional-only. For more info, see :ref:`the FAQ entry on " "positional-only parameters `." msgstr "" -#: ../../library/inspect.rst:700 +#: ../../library/inspect.rst:715 msgid "" "The *follow_wrapped* parameter was added. Pass ``False`` to get a signature " "of *callable* specifically (``callable.__wrapped__`` will not be used to " "unwrap decorated callables.)" msgstr "" -#: ../../library/inspect.rst:706 ../../library/inspect.rst:816 +#: ../../library/inspect.rst:721 ../../library/inspect.rst:845 msgid "The *globals*, *locals*, and *eval_str* parameters were added." msgstr "" -#: ../../library/inspect.rst:711 +#: ../../library/inspect.rst:726 msgid "" "Some callables may not be introspectable in certain implementations of " "Python. For example, in CPython, some built-in functions defined in C " "provide no metadata about their arguments." msgstr "" -#: ../../library/inspect.rst:717 +#: ../../library/inspect.rst:732 msgid "" "If the passed object has a :attr:`!__signature__` attribute, we may use it " "to create the signature. The exact semantics are an implementation detail " @@ -1066,14 +1087,14 @@ msgid "" "semantics." msgstr "" -#: ../../library/inspect.rst:725 +#: ../../library/inspect.rst:740 msgid "" "A :class:`!Signature` object represents the call signature of a function and " "its return annotation. For each parameter accepted by the function it " "stores a :class:`Parameter` object in its :attr:`parameters` collection." msgstr "" -#: ../../library/inspect.rst:730 +#: ../../library/inspect.rst:745 msgid "" "The optional *parameters* argument is a sequence of :class:`Parameter` " "objects, which is validated to check that there are no parameters with " @@ -1082,54 +1103,54 @@ msgid "" "defaults follow parameters without defaults." msgstr "" -#: ../../library/inspect.rst:736 +#: ../../library/inspect.rst:751 msgid "" "The optional *return_annotation* argument can be an arbitrary Python object. " "It represents the \"return\" annotation of the callable." msgstr "" -#: ../../library/inspect.rst:739 +#: ../../library/inspect.rst:754 msgid "" ":class:`!Signature` objects are *immutable*. Use :meth:`Signature.replace` " -"to make a modified copy." +"or :func:`copy.replace` to make a modified copy." msgstr "" -#: ../../library/inspect.rst:742 +#: ../../library/inspect.rst:757 msgid ":class:`!Signature` objects are now picklable and :term:`hashable`." msgstr "" -#: ../../library/inspect.rst:747 +#: ../../library/inspect.rst:762 msgid "A special class-level marker to specify absence of a return annotation." msgstr "" -#: ../../library/inspect.rst:751 +#: ../../library/inspect.rst:766 msgid "" "An ordered mapping of parameters' names to the corresponding :class:" "`Parameter` objects. Parameters appear in strict definition order, " "including keyword-only parameters." msgstr "" -#: ../../library/inspect.rst:755 ../../library/inspect.rst:1093 +#: ../../library/inspect.rst:770 ../../library/inspect.rst:1125 msgid "" "Python only explicitly guaranteed that it preserved the declaration order of " "keyword-only parameters as of version 3.7, although in practice this order " "had always been preserved in Python 3." msgstr "" -#: ../../library/inspect.rst:762 +#: ../../library/inspect.rst:777 msgid "" "The \"return\" annotation for the callable. If the callable has no " "\"return\" annotation, this attribute is set to :attr:`Signature.empty`." msgstr "" -#: ../../library/inspect.rst:767 +#: ../../library/inspect.rst:782 msgid "" "Create a mapping from positional and keyword arguments to parameters. " "Returns :class:`BoundArguments` if ``*args`` and ``**kwargs`` match the " "signature, or raises a :exc:`TypeError`." msgstr "" -#: ../../library/inspect.rst:773 +#: ../../library/inspect.rst:788 msgid "" "Works the same way as :meth:`Signature.bind`, but allows the omission of " "some required arguments (mimics :func:`functools.partial` behavior.) " @@ -1137,7 +1158,7 @@ msgid "" "arguments do not match the signature." msgstr "" -#: ../../library/inspect.rst:780 +#: ../../library/inspect.rst:795 msgid "" "Create a new :class:`Signature` instance based on the instance :meth:" "`replace` was invoked on. It is possible to pass different *parameters* and/" @@ -1146,7 +1167,7 @@ msgid "" "Signature`, pass in :attr:`Signature.empty`." msgstr "" -#: ../../library/inspect.rst:788 +#: ../../library/inspect.rst:803 msgid "" ">>> def test(a, b):\n" "... pass\n" @@ -1164,17 +1185,34 @@ msgstr "" ">>> str(new_sig)\n" "\"(a, b) -> 'new return anno'\"" -#: ../../library/inspect.rst:800 +#: ../../library/inspect.rst:813 +msgid "" +":class:`Signature` objects are also supported by the generic function :func:" +"`copy.replace`." +msgstr "" + +#: ../../library/inspect.rst:818 +msgid "Create a string representation of the :class:`Signature` object." +msgstr "" + +#: ../../library/inspect.rst:820 +msgid "" +"If *max_width* is passed, the method will attempt to fit the signature into " +"lines of at most *max_width* characters. If the signature is longer than " +"*max_width*, all parameters will be on separate lines." +msgstr "" + +#: ../../library/inspect.rst:829 msgid "" "Return a :class:`Signature` (or its subclass) object for a given callable " "*obj*." msgstr "" -#: ../../library/inspect.rst:803 +#: ../../library/inspect.rst:832 msgid "This method simplifies subclassing of :class:`Signature`:" msgstr "" -#: ../../library/inspect.rst:805 +#: ../../library/inspect.rst:834 msgid "" "class MySignature(Signature):\n" " pass\n" @@ -1186,129 +1224,129 @@ msgstr "" "sig = MySignature.from_callable(sum)\n" "assert isinstance(sig, MySignature)" -#: ../../library/inspect.rst:812 +#: ../../library/inspect.rst:841 msgid "Its behavior is otherwise identical to that of :func:`signature`." msgstr "" -#: ../../library/inspect.rst:822 +#: ../../library/inspect.rst:851 msgid "" ":class:`!Parameter` objects are *immutable*. Instead of modifying a :class:`!" -"Parameter` object, you can use :meth:`Parameter.replace` to create a " -"modified copy." +"Parameter` object, you can use :meth:`Parameter.replace` or :func:`copy." +"replace` to create a modified copy." msgstr "" -#: ../../library/inspect.rst:826 +#: ../../library/inspect.rst:855 msgid "Parameter objects are now picklable and :term:`hashable`." msgstr "" -#: ../../library/inspect.rst:831 +#: ../../library/inspect.rst:860 msgid "" "A special class-level marker to specify absence of default values and " "annotations." msgstr "" -#: ../../library/inspect.rst:836 +#: ../../library/inspect.rst:865 msgid "" "The name of the parameter as a string. The name must be a valid Python " "identifier." msgstr "" -#: ../../library/inspect.rst:841 +#: ../../library/inspect.rst:870 msgid "" "CPython generates implicit parameter names of the form ``.0`` on the code " "objects used to implement comprehensions and generator expressions." msgstr "" -#: ../../library/inspect.rst:845 +#: ../../library/inspect.rst:874 msgid "" "These parameter names are now exposed by this module as names like " "``implicit0``." msgstr "" -#: ../../library/inspect.rst:851 +#: ../../library/inspect.rst:880 msgid "" "The default value for the parameter. If the parameter has no default value, " "this attribute is set to :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:856 +#: ../../library/inspect.rst:885 msgid "" "The annotation for the parameter. If the parameter has no annotation, this " "attribute is set to :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:861 +#: ../../library/inspect.rst:890 msgid "" "Describes how argument values are bound to the parameter. The possible " "values are accessible via :class:`Parameter` (like ``Parameter." "KEYWORD_ONLY``), and support comparison and ordering, in the following order:" msgstr "" -#: ../../library/inspect.rst:868 +#: ../../library/inspect.rst:897 msgid "Name" msgstr "名稱" -#: ../../library/inspect.rst:868 +#: ../../library/inspect.rst:897 msgid "Meaning" msgstr "意義" -#: ../../library/inspect.rst:870 +#: ../../library/inspect.rst:899 msgid "*POSITIONAL_ONLY*" msgstr "*POSITIONAL_ONLY*" -#: ../../library/inspect.rst:870 +#: ../../library/inspect.rst:899 msgid "" "Value must be supplied as a positional argument. Positional only parameters " "are those which appear before a ``/`` entry (if present) in a Python " "function definition." msgstr "" -#: ../../library/inspect.rst:875 +#: ../../library/inspect.rst:904 msgid "*POSITIONAL_OR_KEYWORD*" msgstr "*POSITIONAL_OR_KEYWORD*" -#: ../../library/inspect.rst:875 +#: ../../library/inspect.rst:904 msgid "" "Value may be supplied as either a keyword or positional argument (this is " "the standard binding behaviour for functions implemented in Python.)" msgstr "" -#: ../../library/inspect.rst:880 +#: ../../library/inspect.rst:909 msgid "*VAR_POSITIONAL*" msgstr "*VAR_POSITIONAL*" -#: ../../library/inspect.rst:880 +#: ../../library/inspect.rst:909 msgid "" "A tuple of positional arguments that aren't bound to any other parameter. " "This corresponds to a ``*args`` parameter in a Python function definition." msgstr "" -#: ../../library/inspect.rst:885 +#: ../../library/inspect.rst:914 msgid "*KEYWORD_ONLY*" msgstr "*KEYWORD_ONLY*" -#: ../../library/inspect.rst:885 +#: ../../library/inspect.rst:914 msgid "" "Value must be supplied as a keyword argument. Keyword only parameters are " "those which appear after a ``*`` or ``*args`` entry in a Python function " "definition." msgstr "" -#: ../../library/inspect.rst:890 +#: ../../library/inspect.rst:919 msgid "*VAR_KEYWORD*" msgstr "*VAR_KEYWORD*" -#: ../../library/inspect.rst:890 +#: ../../library/inspect.rst:919 msgid "" "A dict of keyword arguments that aren't bound to any other parameter. This " "corresponds to a ``**kwargs`` parameter in a Python function definition." msgstr "" -#: ../../library/inspect.rst:896 +#: ../../library/inspect.rst:925 msgid "Example: print all keyword-only arguments without default values:" msgstr "" -#: ../../library/inspect.rst:898 +#: ../../library/inspect.rst:927 msgid "" ">>> def foo(a, b, *, c, d=10):\n" "... pass\n" @@ -1330,15 +1368,15 @@ msgstr "" "... print('Parameter:', param)\n" "Parameter: c" -#: ../../library/inspect.rst:912 +#: ../../library/inspect.rst:941 msgid "Describes an enum value of :attr:`Parameter.kind`." msgstr "" -#: ../../library/inspect.rst:916 +#: ../../library/inspect.rst:945 msgid "Example: print all descriptions of arguments:" msgstr "範例:列印所有引數的描述:" -#: ../../library/inspect.rst:918 +#: ../../library/inspect.rst:947 msgid "" ">>> def foo(a, b, *, c, d=10):\n" "... pass\n" @@ -1362,7 +1400,7 @@ msgstr "" "keyword-only\n" "keyword-only" -#: ../../library/inspect.rst:933 +#: ../../library/inspect.rst:962 msgid "" "Create a new :class:`Parameter` instance based on the instance replaced was " "invoked on. To override a :class:`!Parameter` attribute, pass the " @@ -1370,7 +1408,7 @@ msgid "" "a :class:`!Parameter`, pass :attr:`Parameter.empty`." msgstr "" -#: ../../library/inspect.rst:938 +#: ../../library/inspect.rst:967 msgid "" ">>> from inspect import Parameter\n" ">>> param = Parameter('foo', Parameter.KEYWORD_ONLY, default=42)\n" @@ -1394,77 +1432,83 @@ msgstr "" ">>> str(param.replace(default=Parameter.empty, annotation='spam'))\n" "\"foo: 'spam'\"" -#: ../../library/inspect.rst:951 +#: ../../library/inspect.rst:980 +msgid "" +":class:`Parameter` objects are also supported by the generic function :func:" +"`copy.replace`." +msgstr "" + +#: ../../library/inspect.rst:983 msgid "" "In Python 3.3 :class:`Parameter` objects were allowed to have ``name`` set " "to ``None`` if their ``kind`` was set to ``POSITIONAL_ONLY``. This is no " "longer permitted." msgstr "" -#: ../../library/inspect.rst:958 +#: ../../library/inspect.rst:990 msgid "" "Result of a :meth:`Signature.bind` or :meth:`Signature.bind_partial` call. " "Holds the mapping of arguments to the function's parameters." msgstr "" -#: ../../library/inspect.rst:963 +#: ../../library/inspect.rst:995 msgid "" "A mutable mapping of parameters' names to arguments' values. Contains only " "explicitly bound arguments. Changes in :attr:`arguments` will reflect in :" "attr:`args` and :attr:`kwargs`." msgstr "" -#: ../../library/inspect.rst:967 +#: ../../library/inspect.rst:999 msgid "" "Should be used in conjunction with :attr:`Signature.parameters` for any " "argument processing purposes." msgstr "" -#: ../../library/inspect.rst:972 +#: ../../library/inspect.rst:1004 msgid "" "Arguments for which :meth:`Signature.bind` or :meth:`Signature.bind_partial` " "relied on a default value are skipped. However, if needed, use :meth:" "`BoundArguments.apply_defaults` to add them." msgstr "" -#: ../../library/inspect.rst:977 +#: ../../library/inspect.rst:1009 msgid "" ":attr:`arguments` is now of type :class:`dict`. Formerly, it was of type :" "class:`collections.OrderedDict`." msgstr "" -#: ../../library/inspect.rst:983 +#: ../../library/inspect.rst:1015 msgid "" "A tuple of positional arguments values. Dynamically computed from the :attr:" "`arguments` attribute." msgstr "" -#: ../../library/inspect.rst:988 +#: ../../library/inspect.rst:1020 msgid "" "A dict of keyword arguments values. Dynamically computed from the :attr:" "`arguments` attribute. Arguments that can be passed positionally are " "included in :attr:`args` instead." msgstr "" -#: ../../library/inspect.rst:994 +#: ../../library/inspect.rst:1026 msgid "A reference to the parent :class:`Signature` object." msgstr "" -#: ../../library/inspect.rst:998 +#: ../../library/inspect.rst:1030 msgid "Set default values for missing arguments." msgstr "為遺漏的引數設定預設值。" -#: ../../library/inspect.rst:1000 +#: ../../library/inspect.rst:1032 msgid "" "For variable-positional arguments (``*args``) the default is an empty tuple." msgstr "" -#: ../../library/inspect.rst:1003 +#: ../../library/inspect.rst:1035 msgid "" "For variable-keyword arguments (``**kwargs``) the default is an empty dict." msgstr "" -#: ../../library/inspect.rst:1006 +#: ../../library/inspect.rst:1038 msgid "" ">>> def foo(a, b='ham', *args): pass\n" ">>> ba = inspect.signature(foo).bind('spam')\n" @@ -1478,13 +1522,13 @@ msgstr "" ">>> ba.arguments\n" "{'a': 'spam', 'b': 'ham', 'args': ()}" -#: ../../library/inspect.rst:1016 +#: ../../library/inspect.rst:1048 msgid "" "The :attr:`args` and :attr:`kwargs` properties can be used to invoke " "functions:" msgstr "" -#: ../../library/inspect.rst:1019 +#: ../../library/inspect.rst:1051 msgid "" "def test(a, *, b):\n" " ...\n" @@ -1500,19 +1544,19 @@ msgstr "" "ba = sig.bind(10, b=20)\n" "test(*ba.args, **ba.kwargs)" -#: ../../library/inspect.rst:1031 +#: ../../library/inspect.rst:1063 msgid ":pep:`362` - Function Signature Object." msgstr "" -#: ../../library/inspect.rst:1032 +#: ../../library/inspect.rst:1064 msgid "The detailed specification, implementation details and examples." msgstr "" -#: ../../library/inspect.rst:1038 +#: ../../library/inspect.rst:1070 msgid "Classes and functions" msgstr "類別與函式" -#: ../../library/inspect.rst:1042 +#: ../../library/inspect.rst:1074 msgid "" "Arrange the given list of classes into a hierarchy of nested lists. Where a " "nested list appears, it contains classes derived from the class whose entry " @@ -1523,19 +1567,19 @@ msgid "" "will appear multiple times." msgstr "" -#: ../../library/inspect.rst:1053 +#: ../../library/inspect.rst:1085 msgid "" "Get the names and default values of a Python function's parameters. A :term:" "`named tuple` is returned:" msgstr "" -#: ../../library/inspect.rst:1056 +#: ../../library/inspect.rst:1088 msgid "" "``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, " "annotations)``" msgstr "" -#: ../../library/inspect.rst:1059 +#: ../../library/inspect.rst:1091 msgid "" "*args* is a list of the positional parameter names. *varargs* is the name of " "the ``*`` parameter or ``None`` if arbitrary positional arguments are not " @@ -1550,7 +1594,7 @@ msgid "" "report the function return value annotation (if any)." msgstr "" -#: ../../library/inspect.rst:1074 +#: ../../library/inspect.rst:1106 msgid "" "Note that :func:`signature` and :ref:`Signature Object ` provide the recommended API for callable introspection, and support " @@ -1560,14 +1604,14 @@ msgid "" "``inspect`` module API." msgstr "" -#: ../../library/inspect.rst:1081 +#: ../../library/inspect.rst:1113 msgid "" "This function is now based on :func:`signature`, but still ignores " "``__wrapped__`` attributes and includes the already bound first parameter in " "the signature output for bound methods." msgstr "" -#: ../../library/inspect.rst:1086 +#: ../../library/inspect.rst:1118 msgid "" "This method was previously documented as deprecated in favour of :func:" "`signature` in Python 3.5, but that decision has been reversed in order to " @@ -1575,7 +1619,7 @@ msgid "" "code migrating away from the legacy :func:`getargspec` API." msgstr "" -#: ../../library/inspect.rst:1101 +#: ../../library/inspect.rst:1133 msgid "" "Get information about arguments passed into a particular frame. A :term:" "`named tuple` ``ArgInfo(args, varargs, keywords, locals)`` is returned. " @@ -1584,18 +1628,18 @@ msgid "" "dictionary of the given frame." msgstr "" -#: ../../library/inspect.rst:1108 ../../library/inspect.rst:1118 +#: ../../library/inspect.rst:1140 ../../library/inspect.rst:1150 msgid "This function was inadvertently marked as deprecated in Python 3.5." msgstr "" -#: ../../library/inspect.rst:1113 +#: ../../library/inspect.rst:1145 msgid "" "Format a pretty argument spec from the four values returned by :func:" "`getargvalues`. The format\\* arguments are the corresponding optional " "formatting functions that are called to turn names and values into strings." msgstr "" -#: ../../library/inspect.rst:1123 +#: ../../library/inspect.rst:1155 msgid "" "Return a tuple of class cls's base classes, including cls, in method " "resolution order. No class appears more than once in this tuple. Note that " @@ -1603,7 +1647,7 @@ msgid "" "user-defined metatype is in use, cls will be the first element of the tuple." msgstr "" -#: ../../library/inspect.rst:1131 +#: ../../library/inspect.rst:1163 msgid "" "Bind the *args* and *kwds* to the argument names of the Python function or " "method *func*, as if it was called with them. For bound methods, bind also " @@ -1616,7 +1660,7 @@ msgid "" "example:" msgstr "" -#: ../../library/inspect.rst:1140 +#: ../../library/inspect.rst:1172 msgid "" ">>> from inspect import getcallargs\n" ">>> def f(a, b=1, *pos, **named):\n" @@ -1646,11 +1690,11 @@ msgstr "" "...\n" "TypeError: f() missing 1 required positional argument: 'a'" -#: ../../library/inspect.rst:1157 +#: ../../library/inspect.rst:1189 msgid "Use :meth:`Signature.bind` and :meth:`Signature.bind_partial` instead." msgstr "請改用 :meth:`Signature.bind` 與 :meth:`Signature.bind_partial`。" -#: ../../library/inspect.rst:1163 +#: ../../library/inspect.rst:1195 msgid "" "Get the mapping of external name references in a Python function or method " "*func* to their current values. A :term:`named tuple` " @@ -1662,18 +1706,18 @@ msgid "" "builtins." msgstr "" -#: ../../library/inspect.rst:1172 +#: ../../library/inspect.rst:1204 msgid "" ":exc:`TypeError` is raised if *func* is not a Python function or method." msgstr "如果 *func* 不是 Python 函式或方法,則引發 :exc:`TypeError`。" -#: ../../library/inspect.rst:1179 +#: ../../library/inspect.rst:1211 msgid "" "Get the object wrapped by *func*. It follows the chain of :attr:" "`__wrapped__` attributes returning the last object in the chain." msgstr "" -#: ../../library/inspect.rst:1182 +#: ../../library/inspect.rst:1214 msgid "" "*stop* is an optional callback accepting an object in the wrapper chain as " "its sole argument that allows the unwrapping to be terminated early if the " @@ -1683,80 +1727,80 @@ msgid "" "``__signature__`` attribute defined." msgstr "" -#: ../../library/inspect.rst:1189 +#: ../../library/inspect.rst:1221 msgid ":exc:`ValueError` is raised if a cycle is encountered." msgstr "如果遇到循環,則引發 :exc:`ValueError`。" -#: ../../library/inspect.rst:1196 +#: ../../library/inspect.rst:1228 msgid "Compute the annotations dict for an object." msgstr "" -#: ../../library/inspect.rst:1198 +#: ../../library/inspect.rst:1230 msgid "" "``obj`` may be a callable, class, or module. Passing in an object of any " "other type raises :exc:`TypeError`." msgstr "" -#: ../../library/inspect.rst:1201 +#: ../../library/inspect.rst:1233 msgid "" "Returns a dict. ``get_annotations()`` returns a new dict every time it's " "called; calling it twice on the same object will return two different but " "equivalent dicts." msgstr "" -#: ../../library/inspect.rst:1205 +#: ../../library/inspect.rst:1237 msgid "This function handles several details for you:" msgstr "" -#: ../../library/inspect.rst:1207 +#: ../../library/inspect.rst:1239 msgid "" "If ``eval_str`` is true, values of type ``str`` will be un-stringized using :" "func:`eval`. This is intended for use with stringized annotations (``from " "__future__ import annotations``)." msgstr "" -#: ../../library/inspect.rst:1211 +#: ../../library/inspect.rst:1243 msgid "" "If ``obj`` doesn't have an annotations dict, returns an empty dict. " "(Functions and methods always have an annotations dict; classes, modules, " "and other types of callables may not.)" msgstr "" -#: ../../library/inspect.rst:1215 +#: ../../library/inspect.rst:1247 msgid "" "Ignores inherited annotations on classes. If a class doesn't have its own " "annotations dict, returns an empty dict." msgstr "" -#: ../../library/inspect.rst:1217 +#: ../../library/inspect.rst:1249 msgid "" "All accesses to object members and dict values are done using ``getattr()`` " "and ``dict.get()`` for safety." msgstr "" -#: ../../library/inspect.rst:1219 +#: ../../library/inspect.rst:1251 msgid "Always, always, always returns a freshly created dict." msgstr "" -#: ../../library/inspect.rst:1221 +#: ../../library/inspect.rst:1253 msgid "" "``eval_str`` controls whether or not values of type ``str`` are replaced " "with the result of calling :func:`eval` on those values:" msgstr "" -#: ../../library/inspect.rst:1224 +#: ../../library/inspect.rst:1256 msgid "" "If eval_str is true, :func:`eval` is called on values of type ``str``. (Note " "that ``get_annotations`` doesn't catch exceptions; if :func:`eval` raises an " "exception, it will unwind the stack past the ``get_annotations`` call.)" msgstr "" -#: ../../library/inspect.rst:1228 +#: ../../library/inspect.rst:1260 msgid "" "If eval_str is false (the default), values of type ``str`` are unchanged." msgstr "" -#: ../../library/inspect.rst:1230 +#: ../../library/inspect.rst:1262 msgid "" "``globals`` and ``locals`` are passed in to :func:`eval`; see the " "documentation for :func:`eval` for more information. If ``globals`` or " @@ -1764,35 +1808,35 @@ msgid "" "specific default, contingent on ``type(obj)``:" msgstr "" -#: ../../library/inspect.rst:1235 +#: ../../library/inspect.rst:1267 msgid "If ``obj`` is a module, ``globals`` defaults to ``obj.__dict__``." msgstr "" -#: ../../library/inspect.rst:1236 +#: ../../library/inspect.rst:1268 msgid "" "If ``obj`` is a class, ``globals`` defaults to ``sys.modules[obj.__module__]." "__dict__`` and ``locals`` defaults to the ``obj`` class namespace." msgstr "" -#: ../../library/inspect.rst:1239 +#: ../../library/inspect.rst:1271 msgid "" "If ``obj`` is a callable, ``globals`` defaults to :attr:`obj.__globals__ " "`, although if ``obj`` is a wrapped function (using :" "func:`functools.update_wrapper`) it is first unwrapped." msgstr "" -#: ../../library/inspect.rst:1244 +#: ../../library/inspect.rst:1276 msgid "" "Calling ``get_annotations`` is best practice for accessing the annotations " "dict of any object. See :ref:`annotations-howto` for more information on " "annotations best practices." msgstr "" -#: ../../library/inspect.rst:1254 +#: ../../library/inspect.rst:1286 msgid "The interpreter stack" msgstr "直譯器堆疊" -#: ../../library/inspect.rst:1256 +#: ../../library/inspect.rst:1288 msgid "" "Some of the following functions return :class:`FrameInfo` objects. For " "backwards compatibility these objects allow tuple-like operations on all " @@ -1800,95 +1844,95 @@ msgid "" "may be removed in the future." msgstr "" -#: ../../library/inspect.rst:1265 +#: ../../library/inspect.rst:1297 msgid "The :ref:`frame object ` that the record corresponds to." msgstr "" -#: ../../library/inspect.rst:1269 +#: ../../library/inspect.rst:1301 msgid "" "The file name associated with the code being executed by the frame this " "record corresponds to." msgstr "" -#: ../../library/inspect.rst:1274 +#: ../../library/inspect.rst:1306 msgid "" "The line number of the current line associated with the code being executed " "by the frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1279 +#: ../../library/inspect.rst:1311 msgid "" "The function name that is being executed by the frame this record " "corresponds to." msgstr "" -#: ../../library/inspect.rst:1283 +#: ../../library/inspect.rst:1315 msgid "" "A list of lines of context from the source code that's being executed by the " "frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1288 ../../library/inspect.rst:1327 +#: ../../library/inspect.rst:1320 ../../library/inspect.rst:1359 msgid "" "The index of the current line being executed in the :attr:`code_context` " "list." msgstr "" -#: ../../library/inspect.rst:1292 +#: ../../library/inspect.rst:1324 msgid "" "A :class:`dis.Positions` object containing the start line number, end line " "number, start column offset, and end column offset associated with the " "instruction being executed by the frame this record corresponds to." msgstr "" -#: ../../library/inspect.rst:1296 +#: ../../library/inspect.rst:1328 msgid "Return a :term:`named tuple` instead of a :class:`tuple`." msgstr "" -#: ../../library/inspect.rst:1299 +#: ../../library/inspect.rst:1331 msgid "" ":class:`!FrameInfo` is now a class instance (that is backwards compatible " "with the previous :term:`named tuple`)." msgstr "" -#: ../../library/inspect.rst:1308 +#: ../../library/inspect.rst:1340 msgid "" "The file name associated with the code being executed by the frame this " "traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1313 +#: ../../library/inspect.rst:1345 msgid "" "The line number of the current line associated with the code being executed " "by the frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1318 +#: ../../library/inspect.rst:1350 msgid "" "The function name that is being executed by the frame this traceback " "corresponds to." msgstr "" -#: ../../library/inspect.rst:1322 +#: ../../library/inspect.rst:1354 msgid "" "A list of lines of context from the source code that's being executed by the " "frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1331 +#: ../../library/inspect.rst:1363 msgid "" "A :class:`dis.Positions` object containing the start line number, end line " "number, start column offset, and end column offset associated with the " "instruction being executed by the frame this traceback corresponds to." msgstr "" -#: ../../library/inspect.rst:1336 +#: ../../library/inspect.rst:1368 msgid "" ":class:`!Traceback` is now a class instance (that is backwards compatible " "with the previous :term:`named tuple`)." msgstr "" -#: ../../library/inspect.rst:1343 +#: ../../library/inspect.rst:1375 msgid "" "Keeping references to frame objects, as found in the first element of the " "frame records these functions return, can cause your program to create " @@ -1900,7 +1944,7 @@ msgid "" "consumption which occurs." msgstr "" -#: ../../library/inspect.rst:1351 +#: ../../library/inspect.rst:1383 msgid "" "Though the cycle detector will catch these, destruction of the frames (and " "local variables) can be made deterministic by removing the cycle in a :" @@ -1908,7 +1952,7 @@ msgid "" "disabled when Python was compiled or using :func:`gc.disable`. For example::" msgstr "" -#: ../../library/inspect.rst:1356 +#: ../../library/inspect.rst:1388 msgid "" "def handle_stackframe_without_leak():\n" " frame = inspect.currentframe()\n" @@ -1918,31 +1962,31 @@ msgid "" " del frame" msgstr "" -#: ../../library/inspect.rst:1363 +#: ../../library/inspect.rst:1395 msgid "" "If you want to keep the frame around (for example to print a traceback " "later), you can also break reference cycles by using the :meth:`frame.clear` " "method." msgstr "" -#: ../../library/inspect.rst:1367 +#: ../../library/inspect.rst:1399 msgid "" "The optional *context* argument supported by most of these functions " "specifies the number of lines of context to return, which are centered " "around the current line." msgstr "" -#: ../../library/inspect.rst:1374 +#: ../../library/inspect.rst:1406 msgid "" "Get information about a frame or traceback object. A :class:`Traceback` " "object is returned." msgstr "" -#: ../../library/inspect.rst:1377 +#: ../../library/inspect.rst:1409 msgid "A :class:`Traceback` object is returned instead of a named tuple." msgstr "" -#: ../../library/inspect.rst:1382 +#: ../../library/inspect.rst:1414 msgid "" "Get a list of :class:`FrameInfo` objects for a frame and all outer frames. " "These frames represent the calls that lead to the creation of *frame*. The " @@ -1950,19 +1994,19 @@ msgid "" "represents the outermost call on *frame*'s stack." msgstr "" -#: ../../library/inspect.rst:1387 ../../library/inspect.rst:1402 -#: ../../library/inspect.rst:1428 ../../library/inspect.rst:1443 +#: ../../library/inspect.rst:1419 ../../library/inspect.rst:1434 +#: ../../library/inspect.rst:1460 ../../library/inspect.rst:1475 msgid "" "A list of :term:`named tuples ` ``FrameInfo(frame, filename, " "lineno, function, code_context, index)`` is returned." msgstr "" -#: ../../library/inspect.rst:1392 ../../library/inspect.rst:1407 -#: ../../library/inspect.rst:1433 ../../library/inspect.rst:1448 +#: ../../library/inspect.rst:1424 ../../library/inspect.rst:1439 +#: ../../library/inspect.rst:1465 ../../library/inspect.rst:1480 msgid "A list of :class:`FrameInfo` objects is returned." msgstr "回傳一個 :class:`FrameInfo` 物件串列。" -#: ../../library/inspect.rst:1397 +#: ../../library/inspect.rst:1429 msgid "" "Get a list of :class:`FrameInfo` objects for a traceback's frame and all " "inner frames. These frames represent calls made as a consequence of " @@ -1970,11 +2014,11 @@ msgid "" "represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1412 +#: ../../library/inspect.rst:1444 msgid "Return the frame object for the caller's stack frame." msgstr "" -#: ../../library/inspect.rst:1416 +#: ../../library/inspect.rst:1448 msgid "" "This function relies on Python stack frame support in the interpreter, which " "isn't guaranteed to exist in all implementations of Python. If running in " @@ -1982,14 +2026,14 @@ msgid "" "``None``." msgstr "" -#: ../../library/inspect.rst:1424 +#: ../../library/inspect.rst:1456 msgid "" "Return a list of :class:`FrameInfo` objects for the caller's stack. The " "first entry in the returned list represents the caller; the last entry " "represents the outermost call on the stack." msgstr "" -#: ../../library/inspect.rst:1438 +#: ../../library/inspect.rst:1470 msgid "" "Return a list of :class:`FrameInfo` objects for the stack between the " "current frame and the frame in which an exception currently being handled " @@ -1997,11 +2041,11 @@ msgid "" "entry represents where the exception was raised." msgstr "" -#: ../../library/inspect.rst:1452 +#: ../../library/inspect.rst:1484 msgid "Fetching attributes statically" msgstr "" -#: ../../library/inspect.rst:1454 +#: ../../library/inspect.rst:1486 msgid "" "Both :func:`getattr` and :func:`hasattr` can trigger code execution when " "fetching or checking for the existence of attributes. Descriptors, like " @@ -2009,20 +2053,20 @@ msgid "" "`~object.__getattribute__` may be called." msgstr "" -#: ../../library/inspect.rst:1460 +#: ../../library/inspect.rst:1492 msgid "" "For cases where you want passive introspection, like documentation tools, " "this can be inconvenient. :func:`getattr_static` has the same signature as :" "func:`getattr` but avoids executing code when it fetches attributes." msgstr "" -#: ../../library/inspect.rst:1466 +#: ../../library/inspect.rst:1498 msgid "" "Retrieve attributes without triggering dynamic lookup via the descriptor " "protocol, :meth:`~object.__getattr__` or :meth:`~object.__getattribute__`." msgstr "" -#: ../../library/inspect.rst:1470 +#: ../../library/inspect.rst:1502 msgid "" "Note: this function may not be able to retrieve all attributes that getattr " "can fetch (like dynamically created attributes) and may find attributes that " @@ -2030,27 +2074,27 @@ msgid "" "return descriptors objects instead of instance members." msgstr "" -#: ../../library/inspect.rst:1476 +#: ../../library/inspect.rst:1508 msgid "" "If the instance :attr:`~object.__dict__` is shadowed by another member (for " "example a property) then this function will be unable to find instance " "members." msgstr "" -#: ../../library/inspect.rst:1482 +#: ../../library/inspect.rst:1514 msgid "" ":func:`getattr_static` does not resolve descriptors, for example slot " "descriptors or getset descriptors on objects implemented in C. The " "descriptor object is returned instead of the underlying attribute." msgstr "" -#: ../../library/inspect.rst:1486 +#: ../../library/inspect.rst:1518 msgid "" "You can handle these with code like the following. Note that for arbitrary " "getset descriptors invoking these may trigger code execution::" msgstr "" -#: ../../library/inspect.rst:1490 +#: ../../library/inspect.rst:1522 msgid "" "# example code for resolving the builtin descriptor types\n" "class _foo:\n" @@ -2073,11 +2117,11 @@ msgid "" " pass" msgstr "" -#: ../../library/inspect.rst:1512 +#: ../../library/inspect.rst:1544 msgid "Current State of Generators, Coroutines, and Asynchronous Generators" msgstr "" -#: ../../library/inspect.rst:1514 +#: ../../library/inspect.rst:1546 msgid "" "When implementing coroutine schedulers and for other advanced uses of " "generators, it is useful to determine whether a generator is currently " @@ -2086,32 +2130,32 @@ msgid "" "generator to be determined easily." msgstr "" -#: ../../library/inspect.rst:1522 +#: ../../library/inspect.rst:1554 msgid "Get current state of a generator-iterator." msgstr "" -#: ../../library/inspect.rst:1524 ../../library/inspect.rst:1540 -#: ../../library/inspect.rst:1557 +#: ../../library/inspect.rst:1556 ../../library/inspect.rst:1572 +#: ../../library/inspect.rst:1589 msgid "Possible states are:" msgstr "" -#: ../../library/inspect.rst:1526 +#: ../../library/inspect.rst:1558 msgid "GEN_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1527 +#: ../../library/inspect.rst:1559 msgid "GEN_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1528 +#: ../../library/inspect.rst:1560 msgid "GEN_SUSPENDED: Currently suspended at a yield expression." msgstr "" -#: ../../library/inspect.rst:1529 +#: ../../library/inspect.rst:1561 msgid "GEN_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1535 +#: ../../library/inspect.rst:1567 msgid "" "Get current state of a coroutine object. The function is intended to be " "used with coroutine objects created by :keyword:`async def` functions, but " @@ -2119,23 +2163,23 @@ msgid "" "``cr_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1542 +#: ../../library/inspect.rst:1574 msgid "CORO_CREATED: Waiting to start execution." msgstr "" -#: ../../library/inspect.rst:1543 +#: ../../library/inspect.rst:1575 msgid "CORO_RUNNING: Currently being executed by the interpreter." msgstr "" -#: ../../library/inspect.rst:1544 +#: ../../library/inspect.rst:1576 msgid "CORO_SUSPENDED: Currently suspended at an await expression." msgstr "" -#: ../../library/inspect.rst:1545 +#: ../../library/inspect.rst:1577 msgid "CORO_CLOSED: Execution has completed." msgstr "" -#: ../../library/inspect.rst:1551 +#: ../../library/inspect.rst:1583 msgid "" "Get current state of an asynchronous generator object. The function is " "intended to be used with asynchronous iterator objects created by :keyword:" @@ -2144,30 +2188,30 @@ msgid "" "``ag_frame`` attributes." msgstr "" -#: ../../library/inspect.rst:1559 +#: ../../library/inspect.rst:1591 msgid "AGEN_CREATED: Waiting to start execution." msgstr "AGEN_CREATED: 等待開始執行。" -#: ../../library/inspect.rst:1560 +#: ../../library/inspect.rst:1592 msgid "AGEN_RUNNING: Currently being executed by the interpreter." msgstr "AGEN_RUNNING: 目前正在被直譯器執行。" -#: ../../library/inspect.rst:1561 +#: ../../library/inspect.rst:1593 msgid "AGEN_SUSPENDED: Currently suspended at a yield expression." msgstr "AGEN_SUSPENDED: 目前於 yield 運算式暫停。" -#: ../../library/inspect.rst:1562 +#: ../../library/inspect.rst:1594 msgid "AGEN_CLOSED: Execution has completed." msgstr "AGEN_CLOSED: 執行已完成。" -#: ../../library/inspect.rst:1566 +#: ../../library/inspect.rst:1598 msgid "" "The current internal state of the generator can also be queried. This is " "mostly useful for testing purposes, to ensure that internal state is being " "updated as expected:" msgstr "" -#: ../../library/inspect.rst:1572 +#: ../../library/inspect.rst:1604 msgid "" "Get the mapping of live local variables in *generator* to their current " "values. A dictionary is returned that maps from variable names to values. " @@ -2175,14 +2219,14 @@ msgid "" "generator, and all the same caveats apply." msgstr "" -#: ../../library/inspect.rst:1577 +#: ../../library/inspect.rst:1609 msgid "" "If *generator* is a :term:`generator` with no currently associated frame, " "then an empty dictionary is returned. :exc:`TypeError` is raised if " "*generator* is not a Python generator object." msgstr "" -#: ../../library/inspect.rst:1583 +#: ../../library/inspect.rst:1615 msgid "" "This function relies on the generator exposing a Python stack frame for " "introspection, which isn't guaranteed to be the case in all implementations " @@ -2190,79 +2234,79 @@ msgid "" "dictionary." msgstr "" -#: ../../library/inspect.rst:1592 +#: ../../library/inspect.rst:1624 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for coroutine objects created by :keyword:`async def` functions." msgstr "" -#: ../../library/inspect.rst:1599 +#: ../../library/inspect.rst:1631 msgid "" "This function is analogous to :func:`~inspect.getgeneratorlocals`, but works " "for asynchronous generator objects created by :keyword:`async def` functions " "which use the :keyword:`yield` statement." msgstr "" -#: ../../library/inspect.rst:1609 +#: ../../library/inspect.rst:1641 msgid "Code Objects Bit Flags" msgstr "" -#: ../../library/inspect.rst:1611 +#: ../../library/inspect.rst:1643 msgid "" "Python code objects have a :attr:`~codeobject.co_flags` attribute, which is " "a bitmap of the following flags:" msgstr "" -#: ../../library/inspect.rst:1616 +#: ../../library/inspect.rst:1648 msgid "The code object is optimized, using fast locals." msgstr "" -#: ../../library/inspect.rst:1620 +#: ../../library/inspect.rst:1652 msgid "" "If set, a new dict will be created for the frame's :attr:`~frame.f_locals` " "when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1625 +#: ../../library/inspect.rst:1657 msgid "The code object has a variable positional parameter (``*args``-like)." msgstr "" -#: ../../library/inspect.rst:1629 +#: ../../library/inspect.rst:1661 msgid "The code object has a variable keyword parameter (``**kwargs``-like)." msgstr "" -#: ../../library/inspect.rst:1633 +#: ../../library/inspect.rst:1665 msgid "The flag is set when the code object is a nested function." msgstr "" -#: ../../library/inspect.rst:1637 +#: ../../library/inspect.rst:1669 msgid "" "The flag is set when the code object is a generator function, i.e. a " "generator object is returned when the code object is executed." msgstr "" -#: ../../library/inspect.rst:1642 +#: ../../library/inspect.rst:1674 msgid "" "The flag is set when the code object is a coroutine function. When the code " "object is executed it returns a coroutine object. See :pep:`492` for more " "details." msgstr "" -#: ../../library/inspect.rst:1650 +#: ../../library/inspect.rst:1682 msgid "" "The flag is used to transform generators into generator-based coroutines. " "Generator objects with this flag can be used in ``await`` expression, and " "can ``yield from`` coroutine objects. See :pep:`492` for more details." msgstr "" -#: ../../library/inspect.rst:1659 +#: ../../library/inspect.rst:1691 msgid "" "The flag is set when the code object is an asynchronous generator function. " "When the code object is executed it returns an asynchronous generator " "object. See :pep:`525` for more details." msgstr "" -#: ../../library/inspect.rst:1666 +#: ../../library/inspect.rst:1698 msgid "" "The flags are specific to CPython, and may not be defined in other Python " "implementations. Furthermore, the flags are an implementation detail, and " @@ -2270,39 +2314,39 @@ msgid "" "use public APIs from the :mod:`inspect` module for any introspection needs." msgstr "" -#: ../../library/inspect.rst:1674 +#: ../../library/inspect.rst:1706 msgid "Buffer flags" msgstr "" -#: ../../library/inspect.rst:1678 +#: ../../library/inspect.rst:1710 msgid "" "This is an :class:`enum.IntFlag` that represents the flags that can be " "passed to the :meth:`~object.__buffer__` method of objects implementing the :" "ref:`buffer protocol `." msgstr "" -#: ../../library/inspect.rst:1682 +#: ../../library/inspect.rst:1714 msgid "The meaning of the flags is explained at :ref:`buffer-request-types`." msgstr "" -#: ../../library/inspect.rst:1709 +#: ../../library/inspect.rst:1741 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/inspect.rst:1711 +#: ../../library/inspect.rst:1743 msgid "" "The :mod:`inspect` module also provides a basic introspection capability " "from the command line." msgstr "" -#: ../../library/inspect.rst:1716 +#: ../../library/inspect.rst:1748 msgid "" "By default, accepts the name of a module and prints the source of that " "module. A class or function within the module can be printed instead by " "appended a colon and the qualified name of the target object." msgstr "" -#: ../../library/inspect.rst:1722 +#: ../../library/inspect.rst:1754 msgid "" "Print information about the specified object rather than the source code" msgstr "" diff --git a/library/internet.po b/library/internet.po index ff55f254eb..7df27a1a2a 100644 --- a/library/internet.po +++ b/library/internet.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" "PO-Revision-Date: 2023-08-15 22:14+0800\n" diff --git a/library/intro.po b/library/intro.po index 40887bae06..b620131be3 100644 --- a/library/intro.po +++ b/library/intro.po @@ -9,9 +9,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2021-10-26 17:01+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -117,7 +117,7 @@ msgstr "讓我們開始吧!" #: ../../library/intro.rst:54 msgid "Notes on availability" -msgstr "可用性之註釋" +msgstr "可用性之標註" #: ../../library/intro.rst:56 msgid "" @@ -125,16 +125,16 @@ msgid "" "Unix systems. It does not make any claims about its existence on a specific " "operating system." msgstr "" -"如果出現「適用:Unix」註釋,則代表該函式普遍存在於 Unix 系統中,但這並不保證" +"如果出現「適用:Unix」標註,則代表該函式普遍存在於 Unix 系統中,但這並不保證" "其存在於某特定作業系統。" #: ../../library/intro.rst:60 msgid "" "If not separately noted, all functions that claim \"Availability: Unix\" are " -"supported on macOS, which builds on a Unix core." +"supported on macOS, iOS and Android, all of which build on a Unix core." msgstr "" -"如果沒有分別註釋的話,有標明「適用:Unix」註釋的所有函式也都於 macOS 上支援," -"因其建於 Unix 核心之上。" +"如果沒有分別標註的話,有標明「適用:Unix」標註的所有函式也都於 macOS、iOS 和 " +"Android 上支援,因其建於 Unix 核心之上。" #: ../../library/intro.rst:63 msgid "" @@ -211,3 +211,87 @@ msgid "" "links are limited and don't support some operations. For example, WASI does " "not permit symlinks with absolute file names." msgstr "" + +#: ../../library/intro.rst:127 +msgid "Mobile platforms" +msgstr "行動平台" + +#: ../../library/intro.rst:129 +msgid "" +"Android and iOS are, in most respects, POSIX operating systems. File I/O, " +"socket handling, and threading all behave as they would on any POSIX " +"operating system. However, there are several major differences:" +msgstr "" + +#: ../../library/intro.rst:133 +msgid "" +"Mobile platforms can only use Python in \"embedded\" mode. There is no " +"Python REPL, and no ability to use separate executables such as :program:" +"`python` or :program:`pip`. To add Python code to your mobile app, you must " +"use the :ref:`Python embedding API `. For more details, see :ref:" +"`using-android` and :ref:`using-ios`." +msgstr "" + +#: ../../library/intro.rst:139 +msgid "Subprocesses:" +msgstr "" + +#: ../../library/intro.rst:141 +msgid "" +"On Android, creating subprocesses is possible but `officially unsupported " +"`__. In " +"particular, Android does not support any part of the System V IPC API, so :" +"mod:`multiprocessing` is not available." +msgstr "" + +#: ../../library/intro.rst:146 +msgid "" +"An iOS app cannot use any form of subprocessing, multiprocessing, or inter-" +"process communication. If an iOS app attempts to create a subprocess, the " +"process creating the subprocess will either lock up, or crash. An iOS app " +"has no visibility of other applications that are running, nor any ability to " +"communicate with other running applications, outside of the iOS-specific " +"APIs that exist for this purpose." +msgstr "" + +#: ../../library/intro.rst:153 +msgid "" +"Mobile apps have limited access to modify system resources (such as the " +"system clock). These resources will often be *readable*, but attempts to " +"modify those resources will usually fail." +msgstr "" + +#: ../../library/intro.rst:157 +msgid "Console input and output:" +msgstr "" + +#: ../../library/intro.rst:159 +msgid "" +"On Android, the native ``stdout`` and ``stderr`` are not connected to " +"anything, so Python installs its own streams which redirect messages to the " +"system log. These can be seen under the tags ``python.stdout`` and ``python." +"stderr`` respectively." +msgstr "" + +#: ../../library/intro.rst:164 +msgid "" +"iOS apps have a limited concept of console output. ``stdout`` and ``stderr`` " +"*exist*, and content written to ``stdout`` and ``stderr`` will be visible in " +"logs when running in Xcode, but this content *won't* be recorded in the " +"system log. If a user who has installed your app provides their app logs as " +"a diagnostic aid, they will not include any detail written to ``stdout`` or " +"``stderr``." +msgstr "" + +#: ../../library/intro.rst:171 +msgid "" +"Mobile apps have no usable ``stdin`` at all. While apps can display an on-" +"screen keyboard, this is a software feature, not something that is attached " +"to ``stdin``." +msgstr "" + +#: ../../library/intro.rst:175 +msgid "" +"As a result, Python modules that involve console manipulation (such as :mod:" +"`curses` and :mod:`readline`) are not available on mobile platforms." +msgstr "" diff --git a/library/io.po b/library/io.po index 391cdc6d14..feecd18d50 100644 --- a/library/io.po +++ b/library/io.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-12-08 00:08+0800\n" diff --git a/library/ipaddress.po b/library/ipaddress.po index eeea4cc3cb..a5c2cc8284 100644 --- a/library/ipaddress.po +++ b/library/ipaddress.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:04+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -318,7 +318,13 @@ msgid "" "``True`` if the address is reserved for link-local usage. See :RFC:`3927`." msgstr "" -#: ../../library/ipaddress.rst:252 +#: ../../library/ipaddress.rst:249 +msgid "" +":class:`IPv4Address` object representing the IPv4-mapped IPv6 address. See :" +"RFC:`4291`." +msgstr "" + +#: ../../library/ipaddress.rst:259 msgid "" "Returns a string representation of the IP address, controlled by an explicit " "format string. *fmt* can be one of the following: ``'s'``, the default " @@ -330,17 +336,17 @@ msgid "" "used by ``format``, ``str.format`` and f-strings." msgstr "" -#: ../../library/ipaddress.rst:279 +#: ../../library/ipaddress.rst:286 msgid "" "Construct an IPv6 address. An :exc:`AddressValueError` is raised if " "*address* is not a valid IPv6 address." msgstr "" -#: ../../library/ipaddress.rst:282 +#: ../../library/ipaddress.rst:289 msgid "The following constitutes a valid IPv6 address:" msgstr "" -#: ../../library/ipaddress.rst:284 +#: ../../library/ipaddress.rst:291 msgid "" "A string consisting of eight groups of four hexadecimal digits, each group " "representing 16 bits. The groups are separated by colons. This describes an " @@ -350,7 +356,7 @@ msgid "" "to ``\"::abc:7:def\"``." msgstr "" -#: ../../library/ipaddress.rst:292 +#: ../../library/ipaddress.rst:299 msgid "" "Optionally, the string may also have a scope zone ID, expressed with a " "suffix ``%scope_id``. If present, the scope ID must be non-empty, and may " @@ -359,39 +365,39 @@ msgid "" "the node." msgstr "" -#: ../../library/ipaddress.rst:297 +#: ../../library/ipaddress.rst:304 msgid "An integer that fits into 128 bits." msgstr "" -#: ../../library/ipaddress.rst:298 +#: ../../library/ipaddress.rst:305 msgid "" "An integer packed into a :class:`bytes` object of length 16, big-endian." msgstr "" -#: ../../library/ipaddress.rst:308 +#: ../../library/ipaddress.rst:315 msgid "" "The short form of the address representation, with leading zeroes in groups " "omitted and the longest sequence of groups consisting entirely of zeroes " "collapsed to a single empty group." msgstr "" -#: ../../library/ipaddress.rst:312 +#: ../../library/ipaddress.rst:319 msgid "This is also the value returned by ``str(addr)`` for IPv6 addresses." msgstr "" -#: ../../library/ipaddress.rst:316 +#: ../../library/ipaddress.rst:323 msgid "" "The long form of the address representation, with all leading zeroes and " "groups consisting entirely of zeroes included." msgstr "" -#: ../../library/ipaddress.rst:320 +#: ../../library/ipaddress.rst:327 msgid "" "For the following attributes and methods, see the corresponding " "documentation of the :class:`IPv4Address` class:" msgstr "" -#: ../../library/ipaddress.rst:340 +#: ../../library/ipaddress.rst:347 msgid "" "``True`` if the address is reserved for site-local usage. Note that the " "site-local address space has been deprecated by :RFC:`3879`. Use :attr:" @@ -399,21 +405,21 @@ msgid "" "local addresses as defined by :RFC:`4193`." msgstr "" -#: ../../library/ipaddress.rst:347 +#: ../../library/ipaddress.rst:354 msgid "" "For addresses that appear to be IPv4 mapped addresses (starting with ``::" "FFFF/96``), this property will report the embedded IPv4 address. For any " "other address, this property will be ``None``." msgstr "" -#: ../../library/ipaddress.rst:353 +#: ../../library/ipaddress.rst:360 msgid "" "For scoped addresses as defined by :RFC:`4007`, this property identifies the " "particular zone of the address's scope that the address belongs to, as a " "string. When no scope zone is specified, this property will be ``None``." msgstr "" -#: ../../library/ipaddress.rst:359 +#: ../../library/ipaddress.rst:366 msgid "" "For addresses that appear to be 6to4 addresses (starting with " "``2002::/16``) as defined by :RFC:`3056`, this property will report the " @@ -421,7 +427,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/ipaddress.rst:366 +#: ../../library/ipaddress.rst:373 msgid "" "For addresses that appear to be Teredo addresses (starting with " "``2001::/32``) as defined by :RFC:`4380`, this property will report the " @@ -429,23 +435,23 @@ msgid "" "property will be ``None``." msgstr "" -#: ../../library/ipaddress.rst:373 +#: ../../library/ipaddress.rst:380 msgid "" "Refer to the corresponding method documentation in :class:`IPv4Address`." msgstr "" -#: ../../library/ipaddress.rst:379 +#: ../../library/ipaddress.rst:386 msgid "Conversion to Strings and Integers" msgstr "" -#: ../../library/ipaddress.rst:381 +#: ../../library/ipaddress.rst:388 msgid "" "To interoperate with networking interfaces such as the socket module, " "addresses must be converted to strings or integers. This is handled using " "the :func:`str` and :func:`int` builtin functions::" msgstr "" -#: ../../library/ipaddress.rst:385 +#: ../../library/ipaddress.rst:392 msgid "" ">>> str(ipaddress.IPv4Address('192.168.0.1'))\n" "'192.168.0.1'\n" @@ -465,36 +471,36 @@ msgstr "" ">>> int(ipaddress.IPv6Address('::1'))\n" "1" -#: ../../library/ipaddress.rst:394 +#: ../../library/ipaddress.rst:401 msgid "" "Note that IPv6 scoped addresses are converted to integers without scope zone " "ID." msgstr "" -#: ../../library/ipaddress.rst:398 ../../library/ipaddress.rst:782 -#: ../../library/ipaddress.rst:918 +#: ../../library/ipaddress.rst:405 ../../library/ipaddress.rst:789 +#: ../../library/ipaddress.rst:925 msgid "Operators" msgstr "" -#: ../../library/ipaddress.rst:400 +#: ../../library/ipaddress.rst:407 msgid "" "Address objects support some operators. Unless stated otherwise, operators " "can only be applied between compatible objects (i.e. IPv4 with IPv4, IPv6 " "with IPv6)." msgstr "" -#: ../../library/ipaddress.rst:406 +#: ../../library/ipaddress.rst:413 msgid "Comparison operators" msgstr "" -#: ../../library/ipaddress.rst:408 +#: ../../library/ipaddress.rst:415 msgid "" "Address objects can be compared with the usual set of comparison operators. " "Same IPv6 addresses with different scope zone IDs are not equal. Some " "examples::" msgstr "" -#: ../../library/ipaddress.rst:412 +#: ../../library/ipaddress.rst:419 msgid "" ">>> IPv4Address('127.0.0.2') > IPv4Address('127.0.0.1')\n" "True\n" @@ -518,16 +524,16 @@ msgstr "" ">>> IPv6Address('fe80::1234%1') != IPv6Address('fe80::1234%2')\n" "True" -#: ../../library/ipaddress.rst:425 +#: ../../library/ipaddress.rst:432 msgid "Arithmetic operators" msgstr "" -#: ../../library/ipaddress.rst:427 +#: ../../library/ipaddress.rst:434 msgid "" "Integers can be added to or subtracted from address objects. Some examples::" msgstr "" -#: ../../library/ipaddress.rst:429 +#: ../../library/ipaddress.rst:436 msgid "" ">>> IPv4Address('127.0.0.2') + 3\n" "IPv4Address('127.0.0.5')\n" @@ -549,11 +555,11 @@ msgstr "" "ipaddress.AddressValueError: 4294967296 (>= 2**32) is not permitted as an " "IPv4 address" -#: ../../library/ipaddress.rst:440 +#: ../../library/ipaddress.rst:447 msgid "IP Network definitions" msgstr "" -#: ../../library/ipaddress.rst:442 +#: ../../library/ipaddress.rst:449 msgid "" "The :class:`IPv4Network` and :class:`IPv6Network` objects provide a " "mechanism for defining and inspecting IP network definitions. A network " @@ -564,11 +570,11 @@ msgid "" "addresses in the inclusive range ``192.168.1.0`` to ``192.168.1.255``." msgstr "" -#: ../../library/ipaddress.rst:452 +#: ../../library/ipaddress.rst:459 msgid "Prefix, net mask and host mask" msgstr "" -#: ../../library/ipaddress.rst:454 +#: ../../library/ipaddress.rst:461 msgid "" "There are several equivalent ways to specify IP network masks. A *prefix* " "``/`` is a notation that denotes how many high-order bits are set in " @@ -580,11 +586,11 @@ msgid "" "mask equivalent to ``/24`` in IPv4 is ``0.0.0.255``." msgstr "" -#: ../../library/ipaddress.rst:465 +#: ../../library/ipaddress.rst:472 msgid "Network objects" msgstr "" -#: ../../library/ipaddress.rst:467 +#: ../../library/ipaddress.rst:474 msgid "" "All attributes implemented by address objects are implemented by network " "objects as well. In addition, network objects implement additional " @@ -594,12 +600,12 @@ msgid "" "keys in dictionaries." msgstr "" -#: ../../library/ipaddress.rst:476 +#: ../../library/ipaddress.rst:483 msgid "" "Construct an IPv4 network definition. *address* can be one of the following:" msgstr "" -#: ../../library/ipaddress.rst:478 +#: ../../library/ipaddress.rst:485 msgid "" "A string consisting of an IP address and an optional mask, separated by a " "slash (``/``). The IP address is the network address, and the mask can be " @@ -611,26 +617,26 @@ msgid "" "it's considered to be ``/32``." msgstr "" -#: ../../library/ipaddress.rst:487 +#: ../../library/ipaddress.rst:494 msgid "" "For example, the following *address* specifications are equivalent: " "``192.168.1.0/24``, ``192.168.1.0/255.255.255.0`` and " "``192.168.1.0/0.0.0.255``." msgstr "" -#: ../../library/ipaddress.rst:491 +#: ../../library/ipaddress.rst:498 msgid "" "An integer that fits into 32 bits. This is equivalent to a single-address " "network, with the network address being *address* and the mask being ``/32``." msgstr "" -#: ../../library/ipaddress.rst:495 +#: ../../library/ipaddress.rst:502 msgid "" "An integer packed into a :class:`bytes` object of length 4, big-endian. The " "interpretation is similar to an integer *address*." msgstr "" -#: ../../library/ipaddress.rst:498 +#: ../../library/ipaddress.rst:505 msgid "" "A two-tuple of an address description and a netmask, where the address " "description is either a string, a 32-bits integer, a 4-bytes packed integer, " @@ -639,92 +645,92 @@ msgid "" "prefix mask (e.g. ``255.255.255.0``)." msgstr "" -#: ../../library/ipaddress.rst:504 +#: ../../library/ipaddress.rst:511 msgid "" "An :exc:`AddressValueError` is raised if *address* is not a valid IPv4 " "address. A :exc:`NetmaskValueError` is raised if the mask is not valid for " "an IPv4 address." msgstr "" -#: ../../library/ipaddress.rst:508 ../../library/ipaddress.rst:728 +#: ../../library/ipaddress.rst:515 ../../library/ipaddress.rst:735 msgid "" "If *strict* is ``True`` and host bits are set in the supplied address, then :" "exc:`ValueError` is raised. Otherwise, the host bits are masked out to " "determine the appropriate network address." msgstr "" -#: ../../library/ipaddress.rst:512 +#: ../../library/ipaddress.rst:519 msgid "" "Unless stated otherwise, all network methods accepting other network/address " "objects will raise :exc:`TypeError` if the argument's IP version is " "incompatible to ``self``." msgstr "" -#: ../../library/ipaddress.rst:518 ../../library/ipaddress.rst:734 +#: ../../library/ipaddress.rst:525 ../../library/ipaddress.rst:741 msgid "Added the two-tuple form for the *address* constructor parameter." msgstr "" -#: ../../library/ipaddress.rst:523 +#: ../../library/ipaddress.rst:530 msgid "" "Refer to the corresponding attribute documentation in :class:`IPv4Address`." msgstr "" -#: ../../library/ipaddress.rst:533 +#: ../../library/ipaddress.rst:540 msgid "" "These attributes are true for the network as a whole if they are true for " "both the network address and the broadcast address." msgstr "" -#: ../../library/ipaddress.rst:538 +#: ../../library/ipaddress.rst:545 msgid "" "The network address for the network. The network address and the prefix " "length together uniquely define a network." msgstr "" -#: ../../library/ipaddress.rst:543 +#: ../../library/ipaddress.rst:550 msgid "" "The broadcast address for the network. Packets sent to the broadcast address " "should be received by every host on the network." msgstr "" -#: ../../library/ipaddress.rst:548 +#: ../../library/ipaddress.rst:555 msgid "The host mask, as an :class:`IPv4Address` object." msgstr "" -#: ../../library/ipaddress.rst:552 +#: ../../library/ipaddress.rst:559 msgid "The net mask, as an :class:`IPv4Address` object." msgstr "" -#: ../../library/ipaddress.rst:558 +#: ../../library/ipaddress.rst:565 msgid "" "A string representation of the network, with the mask in prefix notation." msgstr "" -#: ../../library/ipaddress.rst:561 +#: ../../library/ipaddress.rst:568 msgid "" "``with_prefixlen`` and ``compressed`` are always the same as " "``str(network)``. ``exploded`` uses the exploded form the network address." msgstr "" -#: ../../library/ipaddress.rst:567 +#: ../../library/ipaddress.rst:574 msgid "" "A string representation of the network, with the mask in net mask notation." msgstr "" -#: ../../library/ipaddress.rst:572 +#: ../../library/ipaddress.rst:579 msgid "" "A string representation of the network, with the mask in host mask notation." msgstr "" -#: ../../library/ipaddress.rst:577 +#: ../../library/ipaddress.rst:584 msgid "The total number of addresses in the network." msgstr "" -#: ../../library/ipaddress.rst:581 +#: ../../library/ipaddress.rst:588 msgid "Length of the network prefix, in bits." msgstr "" -#: ../../library/ipaddress.rst:585 +#: ../../library/ipaddress.rst:592 msgid "" "Returns an iterator over the usable hosts in the network. The usable hosts " "are all the IP addresses that belong to the network, except the network " @@ -734,20 +740,20 @@ msgid "" "containing the single host address." msgstr "" -#: ../../library/ipaddress.rst:603 +#: ../../library/ipaddress.rst:610 msgid "" "``True`` if this network is partly or wholly contained in *other* or *other* " "is wholly contained in this network." msgstr "" -#: ../../library/ipaddress.rst:608 +#: ../../library/ipaddress.rst:615 msgid "" "Computes the network definitions resulting from removing the given *network* " "from this one. Returns an iterator of network objects. Raises :exc:" "`ValueError` if *network* is not completely contained in this network." msgstr "" -#: ../../library/ipaddress.rst:621 +#: ../../library/ipaddress.rst:628 msgid "" "The subnets that join to make the current network definition, depending on " "the argument values. *prefixlen_diff* is the amount our prefix length " @@ -757,7 +763,7 @@ msgid "" "network objects." msgstr "" -#: ../../library/ipaddress.rst:646 +#: ../../library/ipaddress.rst:653 msgid "" "The supernet containing this network definition, depending on the argument " "values. *prefixlen_diff* is the amount our prefix length should be " @@ -766,33 +772,33 @@ msgid "" "*new_prefix* must be set. Returns a single network object." msgstr "" -#: ../../library/ipaddress.rst:662 +#: ../../library/ipaddress.rst:669 msgid "Return ``True`` if this network is a subnet of *other*." msgstr "" -#: ../../library/ipaddress.rst:673 +#: ../../library/ipaddress.rst:680 msgid "Return ``True`` if this network is a supernet of *other*." msgstr "" -#: ../../library/ipaddress.rst:684 +#: ../../library/ipaddress.rst:691 msgid "" "Compare this network to *other*. In this comparison only the network " "addresses are considered; host bits aren't. Returns either ``-1``, ``0`` or " "``1``." msgstr "" -#: ../../library/ipaddress.rst:695 +#: ../../library/ipaddress.rst:702 msgid "" "It uses the same ordering and comparison algorithm as \"<\", \"==\", and " "\">\"" msgstr "" -#: ../../library/ipaddress.rst:701 +#: ../../library/ipaddress.rst:708 msgid "" "Construct an IPv6 network definition. *address* can be one of the following:" msgstr "" -#: ../../library/ipaddress.rst:703 +#: ../../library/ipaddress.rst:710 msgid "" "A string consisting of an IP address and an optional prefix length, " "separated by a slash (``/``). The IP address is the network address, and " @@ -800,26 +806,26 @@ msgid "" "length is provided, it's considered to be ``/128``." msgstr "" -#: ../../library/ipaddress.rst:708 +#: ../../library/ipaddress.rst:715 msgid "" "Note that currently expanded netmasks are not supported. That means ``2001:" "db00::0/24`` is a valid argument while ``2001:db00::0/ffff:ff00::`` is not." msgstr "" -#: ../../library/ipaddress.rst:712 +#: ../../library/ipaddress.rst:719 msgid "" "An integer that fits into 128 bits. This is equivalent to a single-address " "network, with the network address being *address* and the mask being " "``/128``." msgstr "" -#: ../../library/ipaddress.rst:716 +#: ../../library/ipaddress.rst:723 msgid "" "An integer packed into a :class:`bytes` object of length 16, big-endian. The " "interpretation is similar to an integer *address*." msgstr "" -#: ../../library/ipaddress.rst:719 +#: ../../library/ipaddress.rst:726 msgid "" "A two-tuple of an address description and a netmask, where the address " "description is either a string, a 128-bits integer, a 16-bytes packed " @@ -827,14 +833,14 @@ msgid "" "representing the prefix length." msgstr "" -#: ../../library/ipaddress.rst:724 +#: ../../library/ipaddress.rst:731 msgid "" "An :exc:`AddressValueError` is raised if *address* is not a valid IPv6 " "address. A :exc:`NetmaskValueError` is raised if the mask is not valid for " "an IPv6 address." msgstr "" -#: ../../library/ipaddress.rst:757 +#: ../../library/ipaddress.rst:764 msgid "" "Returns an iterator over the usable hosts in the network. The usable hosts " "are all the IP addresses that belong to the network, except the Subnet-" @@ -843,46 +849,46 @@ msgid "" "of 128 will return a list containing the single host address." msgstr "" -#: ../../library/ipaddress.rst:772 +#: ../../library/ipaddress.rst:779 msgid "" "Refer to the corresponding attribute documentation in :class:`IPv4Network`." msgstr "" -#: ../../library/ipaddress.rst:777 +#: ../../library/ipaddress.rst:784 msgid "" "These attribute is true for the network as a whole if it is true for both " "the network address and the broadcast address." msgstr "" -#: ../../library/ipaddress.rst:784 +#: ../../library/ipaddress.rst:791 msgid "" "Network objects support some operators. Unless stated otherwise, operators " "can only be applied between compatible objects (i.e. IPv4 with IPv4, IPv6 " "with IPv6)." msgstr "" -#: ../../library/ipaddress.rst:790 ../../library/ipaddress.rst:926 +#: ../../library/ipaddress.rst:797 ../../library/ipaddress.rst:933 msgid "Logical operators" msgstr "" -#: ../../library/ipaddress.rst:792 +#: ../../library/ipaddress.rst:799 msgid "" "Network objects can be compared with the usual set of logical operators. " "Network objects are ordered first by network address, then by net mask." msgstr "" -#: ../../library/ipaddress.rst:797 +#: ../../library/ipaddress.rst:804 msgid "Iteration" msgstr "" -#: ../../library/ipaddress.rst:799 +#: ../../library/ipaddress.rst:806 msgid "" "Network objects can be iterated to list all the addresses belonging to the " "network. For iteration, *all* hosts are returned, including unusable hosts " "(for usable hosts, use the :meth:`~IPv4Network.hosts` method). An example::" msgstr "" -#: ../../library/ipaddress.rst:804 +#: ../../library/ipaddress.rst:811 msgid "" ">>> for addr in IPv4Network('192.0.2.0/28'):\n" "... addr\n" @@ -924,15 +930,15 @@ msgstr "" "IPv4Address('192.0.2.14')\n" "IPv4Address('192.0.2.15')" -#: ../../library/ipaddress.rst:826 +#: ../../library/ipaddress.rst:833 msgid "Networks as containers of addresses" msgstr "" -#: ../../library/ipaddress.rst:828 +#: ../../library/ipaddress.rst:835 msgid "Network objects can act as containers of addresses. Some examples::" msgstr "" -#: ../../library/ipaddress.rst:830 +#: ../../library/ipaddress.rst:837 msgid "" ">>> IPv4Network('192.0.2.0/28')[0]\n" "IPv4Address('192.0.2.0')\n" @@ -952,92 +958,92 @@ msgstr "" ">>> IPv4Address('192.0.3.6') in IPv4Network('192.0.2.0/28')\n" "False" -#: ../../library/ipaddress.rst:841 +#: ../../library/ipaddress.rst:848 msgid "Interface objects" msgstr "" -#: ../../library/ipaddress.rst:843 +#: ../../library/ipaddress.rst:850 msgid "" "Interface objects are :term:`hashable`, so they can be used as keys in " "dictionaries." msgstr "" -#: ../../library/ipaddress.rst:848 +#: ../../library/ipaddress.rst:855 msgid "" "Construct an IPv4 interface. The meaning of *address* is as in the " "constructor of :class:`IPv4Network`, except that arbitrary host addresses " "are always accepted." msgstr "" -#: ../../library/ipaddress.rst:852 +#: ../../library/ipaddress.rst:859 msgid "" ":class:`IPv4Interface` is a subclass of :class:`IPv4Address`, so it inherits " "all the attributes from that class. In addition, the following attributes " "are available:" msgstr "" -#: ../../library/ipaddress.rst:858 +#: ../../library/ipaddress.rst:865 msgid "The address (:class:`IPv4Address`) without network information." msgstr "" -#: ../../library/ipaddress.rst:866 +#: ../../library/ipaddress.rst:873 msgid "The network (:class:`IPv4Network`) this interface belongs to." msgstr "" -#: ../../library/ipaddress.rst:874 +#: ../../library/ipaddress.rst:881 msgid "" "A string representation of the interface with the mask in prefix notation." msgstr "" -#: ../../library/ipaddress.rst:882 +#: ../../library/ipaddress.rst:889 msgid "" "A string representation of the interface with the network as a net mask." msgstr "" -#: ../../library/ipaddress.rst:890 +#: ../../library/ipaddress.rst:897 msgid "" "A string representation of the interface with the network as a host mask." msgstr "" -#: ../../library/ipaddress.rst:899 +#: ../../library/ipaddress.rst:906 msgid "" "Construct an IPv6 interface. The meaning of *address* is as in the " "constructor of :class:`IPv6Network`, except that arbitrary host addresses " "are always accepted." msgstr "" -#: ../../library/ipaddress.rst:903 +#: ../../library/ipaddress.rst:910 msgid "" ":class:`IPv6Interface` is a subclass of :class:`IPv6Address`, so it inherits " "all the attributes from that class. In addition, the following attributes " "are available:" msgstr "" -#: ../../library/ipaddress.rst:913 +#: ../../library/ipaddress.rst:920 msgid "" "Refer to the corresponding attribute documentation in :class:`IPv4Interface`." msgstr "" -#: ../../library/ipaddress.rst:920 +#: ../../library/ipaddress.rst:927 msgid "" "Interface objects support some operators. Unless stated otherwise, " "operators can only be applied between compatible objects (i.e. IPv4 with " "IPv4, IPv6 with IPv6)." msgstr "" -#: ../../library/ipaddress.rst:928 +#: ../../library/ipaddress.rst:935 msgid "" "Interface objects can be compared with the usual set of logical operators." msgstr "" -#: ../../library/ipaddress.rst:930 +#: ../../library/ipaddress.rst:937 msgid "" "For equality comparison (``==`` and ``!=``), both the IP address and network " "must be the same for the objects to be equal. An interface will not compare " "equal to any address or network object." msgstr "" -#: ../../library/ipaddress.rst:934 +#: ../../library/ipaddress.rst:941 msgid "" "For ordering (``<``, ``>``, etc) the rules are different. Interface and " "address objects with the same IP version can be compared, and the address " @@ -1046,15 +1052,15 @@ msgid "" "then by their IP addresses." msgstr "" -#: ../../library/ipaddress.rst:942 +#: ../../library/ipaddress.rst:949 msgid "Other Module Level Functions" msgstr "" -#: ../../library/ipaddress.rst:944 +#: ../../library/ipaddress.rst:951 msgid "The module also provides the following module level functions:" msgstr "" -#: ../../library/ipaddress.rst:948 +#: ../../library/ipaddress.rst:955 msgid "" "Represent an address as 4 packed bytes in network (big-endian) order. " "*address* is an integer representation of an IPv4 IP address. A :exc:" @@ -1062,7 +1068,7 @@ msgid "" "IP address." msgstr "" -#: ../../library/ipaddress.rst:961 +#: ../../library/ipaddress.rst:968 msgid "" "Represent an address as 16 packed bytes in network (big-endian) order. " "*address* is an integer representation of an IPv6 IP address. A :exc:" @@ -1070,7 +1076,7 @@ msgid "" "IP address." msgstr "" -#: ../../library/ipaddress.rst:969 +#: ../../library/ipaddress.rst:976 msgid "" "Return an iterator of the summarized network range given the first and last " "IP addresses. *first* is the first :class:`IPv4Address` or :class:" @@ -1081,7 +1087,7 @@ msgid "" "address version is not 4 or 6." msgstr "" -#: ../../library/ipaddress.rst:985 +#: ../../library/ipaddress.rst:992 msgid "" "Return an iterator of the collapsed :class:`IPv4Network` or :class:" "`IPv6Network` objects. *addresses* is an :term:`iterable` of :class:" @@ -1089,43 +1095,43 @@ msgid "" "if *addresses* contains mixed version objects." msgstr "" -#: ../../library/ipaddress.rst:998 +#: ../../library/ipaddress.rst:1005 msgid "" "Return a key suitable for sorting between networks and addresses. Address " "and Network objects are not sortable by default; they're fundamentally " "different, so the expression::" msgstr "" -#: ../../library/ipaddress.rst:1002 +#: ../../library/ipaddress.rst:1009 msgid "IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')" msgstr "IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')" -#: ../../library/ipaddress.rst:1004 +#: ../../library/ipaddress.rst:1011 msgid "" "doesn't make sense. There are some times however, where you may wish to " "have :mod:`ipaddress` sort these anyway. If you need to do this, you can " "use this function as the *key* argument to :func:`sorted`." msgstr "" -#: ../../library/ipaddress.rst:1008 +#: ../../library/ipaddress.rst:1015 msgid "*obj* is either a network or address object." msgstr "" -#: ../../library/ipaddress.rst:1012 +#: ../../library/ipaddress.rst:1019 msgid "Custom Exceptions" msgstr "" -#: ../../library/ipaddress.rst:1014 +#: ../../library/ipaddress.rst:1021 msgid "" "To support more specific error reporting from class constructors, the module " "defines the following exceptions:" msgstr "" -#: ../../library/ipaddress.rst:1019 +#: ../../library/ipaddress.rst:1026 msgid "Any value error related to the address." msgstr "" -#: ../../library/ipaddress.rst:1024 +#: ../../library/ipaddress.rst:1031 msgid "Any value error related to the net mask." msgstr "" diff --git a/library/ipc.po b/library/ipc.po index f024e94b8e..ed4490bb62 100644 --- a/library/ipc.po +++ b/library/ipc.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-09-20 15:25+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/itertools.po b/library/itertools.po index 5cc34e8bb9..cd3e78c8ca 100644 --- a/library/itertools.po +++ b/library/itertools.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-08-16 15:01+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -458,11 +458,11 @@ msgstr "" "如果提供了 *initial* 值,則累積將從該值開始,並且輸出的元素數將比輸入的可疊代" "物件多一個。" -#: ../../library/itertools.rst:113 ../../library/itertools.rst:182 -#: ../../library/itertools.rst:236 ../../library/itertools.rst:279 -#: ../../library/itertools.rst:476 ../../library/itertools.rst:507 -#: ../../library/itertools.rst:542 ../../library/itertools.rst:615 -#: ../../library/itertools.rst:676 ../../library/itertools.rst:718 +#: ../../library/itertools.rst:113 ../../library/itertools.rst:185 +#: ../../library/itertools.rst:244 ../../library/itertools.rst:287 +#: ../../library/itertools.rst:484 ../../library/itertools.rst:515 +#: ../../library/itertools.rst:550 ../../library/itertools.rst:623 +#: ../../library/itertools.rst:684 ../../library/itertools.rst:726 msgid "Roughly equivalent to::" msgstr "大致等價於: ::" @@ -539,6 +539,12 @@ msgstr "" #: ../../library/itertools.rst:170 msgid "" +"If *strict* is true, will raise a :exc:`ValueError` if the final batch is " +"shorter than *n*." +msgstr "" + +#: ../../library/itertools.rst:173 +msgid "" "Loops over the input iterable and accumulates data into tuples up to size " "*n*. The input is consumed lazily, just enough to fill a batch. The result " "is yielded as soon as the batch is full or when the input iterable is " @@ -548,7 +554,7 @@ msgstr "" "消耗 (consumed lazily) 的,會剛好足夠填充一批的資料。一旦批次填滿或輸入的可疊" "代物件耗盡,就會 yield 出結果:" -#: ../../library/itertools.rst:175 +#: ../../library/itertools.rst:178 msgid "" ">>> flattened_data = ['roses', 'red', 'violets', 'blue', 'sugar', 'sweet']\n" ">>> unflattened = list(batched(flattened_data, 2))\n" @@ -560,14 +566,17 @@ msgstr "" ">>> unflattened\n" "[('roses', 'red'), ('violets', 'blue'), ('sugar', 'sweet')]" -#: ../../library/itertools.rst:184 +#: ../../library/itertools.rst:187 +#, fuzzy msgid "" -"def batched(iterable, n):\n" +"def batched(iterable, n, *, strict=False):\n" " # batched('ABCDEFG', 3) → ABC DEF G\n" " if n < 1:\n" " raise ValueError('n must be at least one')\n" " iterator = iter(iterable)\n" " while batch := tuple(islice(iterator, n)):\n" +" if strict and len(batch) != n:\n" +" raise ValueError('batched(): incomplete batch')\n" " yield batch" msgstr "" "def batched(iterable, n):\n" @@ -578,7 +587,11 @@ msgstr "" " while batch := tuple(islice(iterator, n)):\n" " yield batch" -#: ../../library/itertools.rst:197 +#: ../../library/itertools.rst:199 +msgid "Added the *strict* option." +msgstr "" + +#: ../../library/itertools.rst:205 msgid "" "Make an iterator that returns elements from the first iterable until it is " "exhausted, then proceeds to the next iterable, until all of the iterables " @@ -589,7 +602,7 @@ msgstr "" "代物件,直到所有可疊代物件都耗盡。用於將連續的序列做為單一序列處理。大致等價" "於: ::" -#: ../../library/itertools.rst:202 +#: ../../library/itertools.rst:210 msgid "" "def chain(*iterables):\n" " # chain('ABC', 'DEF') → A B C D E F\n" @@ -597,7 +610,7 @@ msgid "" " yield from iterable" msgstr "" -#: ../../library/itertools.rst:210 +#: ../../library/itertools.rst:218 msgid "" "Alternate constructor for :func:`chain`. Gets chained inputs from a single " "iterable argument that is evaluated lazily. Roughly equivalent to::" @@ -605,7 +618,7 @@ msgstr "" ":func:`chain` 的另一個建構函式。從單個可疊代的引數中得到鏈接的輸入,該引數是" "惰性計算的。大致等價於:" -#: ../../library/itertools.rst:213 +#: ../../library/itertools.rst:221 msgid "" "def from_iterable(iterables):\n" " # chain.from_iterable(['ABC', 'DEF']) → A B C D E F\n" @@ -617,11 +630,11 @@ msgstr "" " for iterable in iterables:\n" " yield from iterable" -#: ../../library/itertools.rst:221 +#: ../../library/itertools.rst:229 msgid "Return *r* length subsequences of elements from the input *iterable*." msgstr "從輸入 *iterable* 中回傳長度為 *r* 的元素的子序列。" -#: ../../library/itertools.rst:223 +#: ../../library/itertools.rst:231 msgid "" "The output is a subsequence of :func:`product` keeping only entries that are " "subsequences of the *iterable*. The length of the output is given by :func:" @@ -632,7 +645,7 @@ msgstr "" "度由 :func:`math.comb` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / r! / (n - r)!" "``,當 ``r > n`` 時為零。" -#: ../../library/itertools.rst:228 +#: ../../library/itertools.rst:236 msgid "" "The combination tuples are emitted in lexicographic order according to the " "order of the input *iterable*. If the input *iterable* is sorted, the output " @@ -641,7 +654,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,組合的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已經排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:232 +#: ../../library/itertools.rst:240 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, there will be no repeated values within " @@ -650,7 +663,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,則每" "個組合內將不會有重複的值。" -#: ../../library/itertools.rst:238 +#: ../../library/itertools.rst:246 msgid "" "def combinations(iterable, r):\n" " # combinations('ABCD', 2) → AB AC AD BC BD CD\n" @@ -675,14 +688,14 @@ msgid "" " yield tuple(pool[i] for i in indices)" msgstr "" -#: ../../library/itertools.rst:263 +#: ../../library/itertools.rst:271 msgid "" "Return *r* length subsequences of elements from the input *iterable* " "allowing individual elements to be repeated more than once." msgstr "" "回傳來自輸入 *iterable* 的長度為 *r* 的子序列,且允許個別元素重複多次。" -#: ../../library/itertools.rst:266 +#: ../../library/itertools.rst:274 msgid "" "The output is a subsequence of :func:`product` that keeps only entries that " "are subsequences (with possible repeated elements) of the *iterable*. The " @@ -693,7 +706,7 @@ msgstr "" "複元素)的條目。當 ``n > 0`` 時,回傳的子序列數量為 ``(n + r - 1)! / r! / (n " "- 1)!``。" -#: ../../library/itertools.rst:271 +#: ../../library/itertools.rst:279 msgid "" "The combination tuples are emitted in lexicographic order according to the " "order of the input *iterable*. if the input *iterable* is sorted, the output " @@ -702,7 +715,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,組合的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已經排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:275 +#: ../../library/itertools.rst:283 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, the generated combinations will also be " @@ -711,7 +724,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,生成" "的組合也將是獨特的。" -#: ../../library/itertools.rst:281 +#: ../../library/itertools.rst:289 msgid "" "def combinations_with_replacement(iterable, r):\n" " # combinations_with_replacement('ABC', 2) → AA AB AC BB BC CC\n" @@ -733,7 +746,7 @@ msgid "" " yield tuple(pool[i] for i in indices)" msgstr "" -#: ../../library/itertools.rst:305 +#: ../../library/itertools.rst:313 msgid "" "Make an iterator that returns elements from *data* where the corresponding " "element in *selectors* is true. Stops when either the *data* or *selectors* " @@ -742,14 +755,14 @@ msgstr "" "建立一個疊代器,回傳 *data* 中對應 *selectors* 的元素為 true 的元素。當 " "*data* 或 *selectors* 可疊代物件耗盡時停止。大致等價於: ::" -#: ../../library/itertools.rst:310 +#: ../../library/itertools.rst:318 msgid "" "def compress(data, selectors):\n" " # compress('ABCDEF', [1,0,1,0,1,1]) → A C E F\n" " return (datum for datum, selector in zip(data, selectors) if selector)" msgstr "" -#: ../../library/itertools.rst:319 +#: ../../library/itertools.rst:327 msgid "" "Make an iterator that returns evenly spaced values beginning with *start*. " "Can be used with :func:`map` to generate consecutive data points or with :" @@ -758,7 +771,7 @@ msgstr "" "建立一個疊代器,回傳從 *start* 開始的等差的值。可以與 :func:`map` 一起使用來" "產生連續的資料點,或與 :func:`zip` 一起使用來增加序列號。大致等價於: ::" -#: ../../library/itertools.rst:324 +#: ../../library/itertools.rst:332 msgid "" "def count(start=0, step=1):\n" " # count(10) → 10 11 12 13 14 ...\n" @@ -776,7 +789,7 @@ msgstr "" " yield n\n" " n += step" -#: ../../library/itertools.rst:332 +#: ../../library/itertools.rst:340 msgid "" "When counting with floating-point numbers, better accuracy can sometimes be " "achieved by substituting multiplicative code such as: ``(start + step * i " @@ -785,11 +798,11 @@ msgstr "" "當用浮點數計數時,將上述程式碼替換為乘法有時可以獲得更好的精確度,例如:" "``(start + step * i for i in count())``。" -#: ../../library/itertools.rst:336 +#: ../../library/itertools.rst:344 msgid "Added *step* argument and allowed non-integer arguments." msgstr "新增 *step* 引數並允許非整數引數。" -#: ../../library/itertools.rst:342 +#: ../../library/itertools.rst:350 msgid "" "Make an iterator returning elements from the *iterable* and saving a copy of " "each. When the iterable is exhausted, return elements from the saved copy. " @@ -798,7 +811,7 @@ msgstr "" "建立一個疊代器,回傳 *iterable* 中的元素並保存每個元素的副本。當可疊代物件耗" "盡時,從保存的副本中回傳元素。會無限次的重複。大致等價於: ::" -#: ../../library/itertools.rst:346 +#: ../../library/itertools.rst:354 msgid "" "def cycle(iterable):\n" " # cycle('ABCD') → A B C D A B C D A B C D ...\n" @@ -820,13 +833,13 @@ msgstr "" " for element in saved:\n" " yield element" -#: ../../library/itertools.rst:356 +#: ../../library/itertools.rst:364 msgid "" "This itertool may require significant auxiliary storage (depending on the " "length of the iterable)." msgstr "此 itertool 可能需要大量的輔助儲存空間(取決於可疊代物件的長度)。" -#: ../../library/itertools.rst:362 +#: ../../library/itertools.rst:370 msgid "" "Make an iterator that drops elements from the *iterable* while the " "*predicate* is true and afterwards returns every element. Roughly " @@ -835,7 +848,7 @@ msgstr "" "建立一個疊代器,在 *predicate* 為 true 時丟棄 *iterable* 中的元素,之後回傳每" "個元素。大致等價於:" -#: ../../library/itertools.rst:366 +#: ../../library/itertools.rst:374 msgid "" "def dropwhile(predicate, iterable):\n" " # dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8\n" @@ -861,7 +874,7 @@ msgstr "" " for x in iterator:\n" " yield x" -#: ../../library/itertools.rst:378 +#: ../../library/itertools.rst:386 msgid "" "Note this does not produce *any* output until the predicate first becomes " "false, so this itertool may have a lengthy start-up time." @@ -869,7 +882,7 @@ msgstr "" "注意,在 predicate 首次變為 False 之前,這不會產生\\ *任何*\\ 輸出,所以此 " "itertool 可能會有較長的啟動時間。" -#: ../../library/itertools.rst:384 +#: ../../library/itertools.rst:392 msgid "" "Make an iterator that filters elements from the *iterable* returning only " "those for which the *predicate* returns a false value. If *predicate* is " @@ -878,7 +891,7 @@ msgstr "" "建立一個疊代器,過濾 *iterable* 中的元素,僅回傳 *predicate* 為 False 值的元" "素。如果 *predicate* 是 ``None``,則回傳為 False 的項目。大致等價於: ::" -#: ../../library/itertools.rst:389 +#: ../../library/itertools.rst:397 msgid "" "def filterfalse(predicate, iterable):\n" " # filterfalse(lambda x: x<5, [1,4,6,3,8]) → 6 8\n" @@ -896,7 +909,7 @@ msgstr "" " if not predicate(x):\n" " yield x" -#: ../../library/itertools.rst:400 +#: ../../library/itertools.rst:408 msgid "" "Make an iterator that returns consecutive keys and groups from the " "*iterable*. The *key* is a function computing a key value for each element. " @@ -909,7 +922,7 @@ msgstr "" "(identity function),並回傳未被更改的元素。一般來說,可疊代物件需要已經用相同" "的鍵函式進行排序。" -#: ../../library/itertools.rst:406 +#: ../../library/itertools.rst:414 msgid "" "The operation of :func:`groupby` is similar to the ``uniq`` filter in Unix. " "It generates a break or new group every time the value of the key function " @@ -922,7 +935,7 @@ msgstr "" "料進行排序)。這種行為不同於 SQL 的 GROUP BY,其無論輸入順序如何都會聚合相同" "的元素。" -#: ../../library/itertools.rst:412 +#: ../../library/itertools.rst:420 msgid "" "The returned group is itself an iterator that shares the underlying iterable " "with :func:`groupby`. Because the source is shared, when the :func:" @@ -933,7 +946,7 @@ msgstr "" "共享的,當 :func:`groupby` 物件前進時,前一個群組將不再可見。因此,如果之後需" "要該資料,應將其儲存為串列: ::" -#: ../../library/itertools.rst:417 +#: ../../library/itertools.rst:425 msgid "" "groups = []\n" "uniquekeys = []\n" @@ -943,11 +956,11 @@ msgid "" " uniquekeys.append(k)" msgstr "" -#: ../../library/itertools.rst:424 +#: ../../library/itertools.rst:432 msgid ":func:`groupby` is roughly equivalent to::" msgstr ":func:`groupby` 大致等價於: ::" -#: ../../library/itertools.rst:426 +#: ../../library/itertools.rst:434 msgid "" "def groupby(iterable, key=None):\n" " # [k for k, g in groupby('AAAABBBCCDAABBB')] → A B C D A B\n" @@ -1013,7 +1026,7 @@ msgstr "" " for _ in curr_group:\n" " pass" -#: ../../library/itertools.rst:462 +#: ../../library/itertools.rst:470 msgid "" "Make an iterator that returns selected elements from the iterable. Works " "like sequence slicing but does not support negative values for *start*, " @@ -1022,7 +1035,7 @@ msgstr "" "建立一個疊代器,回傳從 iterable 中選取的元素。其作用類似於序列切片 (sequence " "slicing),但不支援負數的 *start*、*stop* 或 *step* 的值。" -#: ../../library/itertools.rst:466 +#: ../../library/itertools.rst:474 msgid "" "If *start* is zero or ``None``, iteration starts at zero. Otherwise, " "elements from the iterable are skipped until *start* is reached." @@ -1030,7 +1043,7 @@ msgstr "" "如果 *start* 為零或 ``None``,則從零開始疊代。否則在達到 *start* 之前,會跳" "過 iterable 中的元素。" -#: ../../library/itertools.rst:469 +#: ../../library/itertools.rst:477 msgid "" "If *stop* is ``None``, iteration continues until the iterator is exhausted, " "if at all. Otherwise, it stops at the specified position." @@ -1038,7 +1051,7 @@ msgstr "" "如果 *stop* 為 ``None``,則疊代將繼續前進直到疊代器耗盡。如果指定了 *stop*," "則在達到指定位置時停止。" -#: ../../library/itertools.rst:472 +#: ../../library/itertools.rst:480 msgid "" "If *step* is ``None``, the step defaults to one. Elements are returned " "consecutively unless *step* is set higher than one which results in items " @@ -1047,7 +1060,7 @@ msgstr "" "如果 *step* 為 ``None``,則步長 (step) 預設為一。元素會連續回傳,除非將 " "*step* 設定為大於一,這會導致一些項目被跳過。" -#: ../../library/itertools.rst:478 +#: ../../library/itertools.rst:486 msgid "" "def islice(iterable, *args):\n" " # islice('ABCDEFG', 2) → A B\n" @@ -1089,11 +1102,11 @@ msgstr "" " yield element\n" " next_i += step" -#: ../../library/itertools.rst:501 +#: ../../library/itertools.rst:509 msgid "Return successive overlapping pairs taken from the input *iterable*." msgstr "回傳從輸入的 *iterable* 中提取的連續重疊對。" -#: ../../library/itertools.rst:503 +#: ../../library/itertools.rst:511 msgid "" "The number of 2-tuples in the output iterator will be one fewer than the " "number of inputs. It will be empty if the input iterable has fewer than two " @@ -1102,7 +1115,7 @@ msgstr "" "輸出疊代器中的 2 元組數量將比輸入少一個。如果輸入的可疊代物件中的值少於兩個," "則輸出將為空值。" -#: ../../library/itertools.rst:509 +#: ../../library/itertools.rst:517 msgid "" "def pairwise(iterable):\n" " # pairwise('ABCDEFG') → AB BC CD DE EF FG\n" @@ -1120,7 +1133,7 @@ msgstr "" " yield a, b\n" " a = b" -#: ../../library/itertools.rst:522 +#: ../../library/itertools.rst:530 msgid "" "Return successive *r* length `permutations of elements `_ from the *iterable*." @@ -1128,7 +1141,7 @@ msgstr "" "回傳 *iterable* 中連續且長度為 *r* 的\\ `元素排列 `_ 。" -#: ../../library/itertools.rst:525 +#: ../../library/itertools.rst:533 msgid "" "If *r* is not specified or is ``None``, then *r* defaults to the length of " "the *iterable* and all possible full-length permutations are generated." @@ -1136,7 +1149,7 @@ msgstr "" "如果未指定 *r* 或其值為 ``None``,則 *r* 預設為 *iterable* 的長度,並產生所有" "可能的完整長度的排列。" -#: ../../library/itertools.rst:529 +#: ../../library/itertools.rst:537 msgid "" "The output is a subsequence of :func:`product` where entries with repeated " "elements have been filtered out. The length of the output is given by :func:" @@ -1147,7 +1160,7 @@ msgstr "" "func:`math.perm` 給定,當 ``0 ≤ r ≤ n`` 時,長度為 ``n! / (n - r)!``,當 ``r " "> n`` 時為零。" -#: ../../library/itertools.rst:534 +#: ../../library/itertools.rst:542 msgid "" "The permutation tuples are emitted in lexicographic order according to the " "order of the input *iterable*. If the input *iterable* is sorted, the " @@ -1156,7 +1169,7 @@ msgstr "" "根據輸入值 *iterable* 的順序,排列的元組會按照字典順序輸出。如果輸入的 " "*iterable* 已排序,則輸出的元組也將按排序的順序產生。" -#: ../../library/itertools.rst:538 +#: ../../library/itertools.rst:546 msgid "" "Elements are treated as unique based on their position, not on their value. " "If the input elements are unique, there will be no repeated values within a " @@ -1165,7 +1178,7 @@ msgstr "" "元素是根據它們的位置(而非值)來決定其唯一性。如果輸入的元素都是獨特的,則排" "列中將不會有重複的值。" -#: ../../library/itertools.rst:544 +#: ../../library/itertools.rst:552 msgid "" "def permutations(iterable, r=None):\n" " # permutations('ABCD', 2) → AB AC AD BA BC BD CA CB CD DA DB DC\n" @@ -1223,11 +1236,11 @@ msgstr "" " else:\n" " return" -#: ../../library/itertools.rst:575 +#: ../../library/itertools.rst:583 msgid "Cartesian product of input iterables." msgstr "輸入的 iterables 的笛卡爾乘積。" -#: ../../library/itertools.rst:577 +#: ../../library/itertools.rst:585 msgid "" "Roughly equivalent to nested for-loops in a generator expression. For " "example, ``product(A, B)`` returns the same as ``((x,y) for x in A for y in " @@ -1236,7 +1249,7 @@ msgstr "" "大致等價於產生器運算式中的巢狀 for 迴圈。例如,``product(A, B)`` 的回傳結果" "與 ``((x,y) for x in A for y in B)`` 相同。" -#: ../../library/itertools.rst:580 +#: ../../library/itertools.rst:588 msgid "" "The nested loops cycle like an odometer with the rightmost element advancing " "on every iteration. This pattern creates a lexicographic ordering so that " @@ -1246,7 +1259,7 @@ msgstr "" "巢狀迴圈的循環類似於里程表,最右邊的元素在每次疊代時前進。這種模式會建立字典" "順序,因此如果輸入的 iterables 已排序,則輸出的乘積元組也將按排序的順序產生。" -#: ../../library/itertools.rst:585 +#: ../../library/itertools.rst:593 msgid "" "To compute the product of an iterable with itself, specify the number of " "repetitions with the optional *repeat* keyword argument. For example, " @@ -1255,7 +1268,7 @@ msgstr "" "要計算可疊代物件自身的乘積,可以使用可選的 *repeat* 關鍵字引數來指定重複次" "數。例如,``product(A, repeat=4)`` 與 ``product(A, A, A, A)`` 相同。" -#: ../../library/itertools.rst:589 +#: ../../library/itertools.rst:597 msgid "" "This function is roughly equivalent to the following code, except that the " "actual implementation does not build up intermediate results in memory::" @@ -1263,7 +1276,7 @@ msgstr "" "此函式大致等價於以下的程式碼,不同之處在於真正的實作不會在記憶體中建立中間結" "果: ::" -#: ../../library/itertools.rst:592 +#: ../../library/itertools.rst:600 msgid "" "def product(*iterables, repeat=1):\n" " # product('ABCD', 'xy') → Ax Ay Bx By Cx Cy Dx Dy\n" @@ -1291,7 +1304,7 @@ msgstr "" " for prod in result:\n" " yield tuple(prod)" -#: ../../library/itertools.rst:605 +#: ../../library/itertools.rst:613 msgid "" "Before :func:`product` runs, it completely consumes the input iterables, " "keeping pools of values in memory to generate the products. Accordingly, it " @@ -1300,7 +1313,7 @@ msgstr "" "在 :func:`product` 執行之前,它會完全消耗輸入的 iterables,並將值的池 (pools " "of values) 保存在記憶體中以產生乘積。因此,它僅對有限的輸入有用。" -#: ../../library/itertools.rst:612 +#: ../../library/itertools.rst:620 msgid "" "Make an iterator that returns *object* over and over again. Runs " "indefinitely unless the *times* argument is specified." @@ -1308,7 +1321,7 @@ msgstr "" "建立一個疊代器,反覆回傳 *object*。除非指定了 *times* 引數,否則會執行無限" "次。" -#: ../../library/itertools.rst:617 +#: ../../library/itertools.rst:625 msgid "" "def repeat(object, times=None):\n" " # repeat(10, 3) → 10 10 10\n" @@ -1328,13 +1341,13 @@ msgstr "" " for i in range(times):\n" " yield object" -#: ../../library/itertools.rst:626 +#: ../../library/itertools.rst:634 msgid "" "A common use for *repeat* is to supply a stream of constant values to *map* " "or *zip*:" msgstr "*repeat* 的常見用途是為 *map* 或 *zip* 提供定值的串流:" -#: ../../library/itertools.rst:629 +#: ../../library/itertools.rst:637 msgid "" ">>> list(map(pow, range(10), repeat(2)))\n" "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]" @@ -1342,7 +1355,7 @@ msgstr "" ">>> list(map(pow, range(10), repeat(2)))\n" "[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]" -#: ../../library/itertools.rst:637 +#: ../../library/itertools.rst:645 msgid "" "Make an iterator that computes the *function* using arguments obtained from " "the *iterable*. Used instead of :func:`map` when argument parameters have " @@ -1351,7 +1364,7 @@ msgstr "" "建立一個疊代器,使用從 *iterable* 獲取的引數計算 *function* 。當引數參數已經" "被「預先壓縮 (pre-zipped)」成元組時,使用此方法代替 :func:`map`。" -#: ../../library/itertools.rst:641 +#: ../../library/itertools.rst:649 msgid "" "The difference between :func:`map` and :func:`starmap` parallels the " "distinction between ``function(a,b)`` and ``function(*c)``. Roughly " @@ -1360,7 +1373,7 @@ msgstr "" ":func:`map` 和 :func:`starmap` 之間的區別類似於 ``function(a,b)`` 和 " "``function(*c)`` 之間的區別。大致等價於:" -#: ../../library/itertools.rst:645 +#: ../../library/itertools.rst:653 msgid "" "def starmap(function, iterable):\n" " # starmap(pow, [(2,5), (3,2), (10,3)]) → 32 9 1000\n" @@ -1372,7 +1385,7 @@ msgstr "" " for args in iterable:\n" " yield function(*args)" -#: ../../library/itertools.rst:653 +#: ../../library/itertools.rst:661 msgid "" "Make an iterator that returns elements from the *iterable* as long as the " "*predicate* is true. Roughly equivalent to::" @@ -1380,7 +1393,7 @@ msgstr "" "建立一個疊代器,只在 *predicate* 為 true 時回傳 *iterable* 中的元素。大致等價" "於:" -#: ../../library/itertools.rst:656 +#: ../../library/itertools.rst:664 msgid "" "def takewhile(predicate, iterable):\n" " # takewhile(lambda x: x<5, [1,4,6,3,8]) → 1 4\n" @@ -1396,7 +1409,7 @@ msgstr "" " break\n" " yield x" -#: ../../library/itertools.rst:663 +#: ../../library/itertools.rst:671 msgid "" "Note, the element that first fails the predicate condition is consumed from " "the input iterator and there is no way to access it. This could be an issue " @@ -1411,11 +1424,11 @@ msgstr "" "more-itertools.readthedocs.io/en/stable/api.html#more_itertools." "before_and_after>`_ 作為替代。" -#: ../../library/itertools.rst:674 +#: ../../library/itertools.rst:682 msgid "Return *n* independent iterators from a single iterable." msgstr "從一個 iterable 中回傳 *n* 個獨立的疊代器。" -#: ../../library/itertools.rst:678 +#: ../../library/itertools.rst:686 msgid "" "def tee(iterable, n=2):\n" " iterator = iter(iterable)\n" @@ -1449,7 +1462,7 @@ msgstr "" " except StopIteration:\n" " return" -#: ../../library/itertools.rst:694 +#: ../../library/itertools.rst:702 msgid "" "Once a :func:`tee` has been created, the original *iterable* should not be " "used anywhere else; otherwise, the *iterable* could get advanced without the " @@ -1458,7 +1471,7 @@ msgstr "" "一旦建立了 :func:`tee`,原始的 *iterable* 不應在其他地方使用;否則," "*iterable* 可能會在 tee 物件未被通知的情況下前進。" -#: ../../library/itertools.rst:698 +#: ../../library/itertools.rst:706 msgid "" "``tee`` iterators are not threadsafe. A :exc:`RuntimeError` may be raised " "when simultaneously using iterators returned by the same :func:`tee` call, " @@ -1468,7 +1481,7 @@ msgstr "" "呼叫所回傳的疊代器時,即使原始的 *iterable* 是執行緒安全的,也可能引發 :exc:" "`RuntimeError`。" -#: ../../library/itertools.rst:702 +#: ../../library/itertools.rst:710 msgid "" "This itertool may require significant auxiliary storage (depending on how " "much temporary data needs to be stored). In general, if one iterator uses " @@ -1479,11 +1492,11 @@ msgstr "" "果一個疊代器在另一個疊代器開始之前使用了大部分或全部的資料,使用 :func:" "`list` 會比 :func:`tee` 更快。" -#: ../../library/itertools.rst:710 +#: ../../library/itertools.rst:718 msgid "Make an iterator that aggregates elements from each of the *iterables*." msgstr "建立一個疊代器,聚合來自每個 *iterables* 中的元素。" -#: ../../library/itertools.rst:713 +#: ../../library/itertools.rst:721 msgid "" "If the iterables are of uneven length, missing values are filled-in with " "*fillvalue*. If not specified, *fillvalue* defaults to ``None``." @@ -1491,11 +1504,11 @@ msgstr "" "如果 iterables 的長度不一,則使用 *fillvalue* 填充缺少的值。如果未指定," "*fillvalue* 會預設為 ``None``。" -#: ../../library/itertools.rst:716 +#: ../../library/itertools.rst:724 msgid "Iteration continues until the longest iterable is exhausted." msgstr "疊代將持續直到最長的可疊代物件耗盡為止。" -#: ../../library/itertools.rst:720 +#: ../../library/itertools.rst:728 msgid "" "def zip_longest(*iterables, fillvalue=None):\n" " # zip_longest('ABCD', 'xy', fillvalue='-') → Ax By C- D-\n" @@ -1541,7 +1554,7 @@ msgstr "" " values.append(value)\n" " yield tuple(values)" -#: ../../library/itertools.rst:742 +#: ../../library/itertools.rst:750 msgid "" "If one of the iterables is potentially infinite, then the :func:" "`zip_longest` function should be wrapped with something that limits the " @@ -1550,18 +1563,18 @@ msgstr "" "如果其中一個 iterables 可能是無限的,那麼應該用別的可以限制呼叫次數的方法來包" "裝 :func:`zip_longest` 函式(例如 :func:`islice` 或 :func:`takewhile`)。" -#: ../../library/itertools.rst:750 +#: ../../library/itertools.rst:758 msgid "Itertools Recipes" msgstr "Itertools 應用技巧" -#: ../../library/itertools.rst:752 +#: ../../library/itertools.rst:760 msgid "" "This section shows recipes for creating an extended toolset using the " "existing itertools as building blocks." msgstr "" "此段落展示了使用現有的 itertools 作為構建塊來建立擴展工具集的應用技巧。" -#: ../../library/itertools.rst:755 +#: ../../library/itertools.rst:763 msgid "" "The primary purpose of the itertools recipes is educational. The recipes " "show various ways of thinking about individual tools — for example, that " @@ -1579,7 +1592,7 @@ msgstr "" "`collections` 模組一同使用以及與內建 itertools(如 ``map()``、``filter()``、" "``reversed()`` 和 ``enumerate()``)一同使用的模式。" -#: ../../library/itertools.rst:764 +#: ../../library/itertools.rst:772 msgid "" "A secondary purpose of the recipes is to serve as an incubator. The " "``accumulate()``, ``compress()``, and ``pairwise()`` itertools started out " @@ -1591,7 +1604,7 @@ msgstr "" "``sliding_window()``、``iter_index()`` 和 ``sieve()`` 的應用技巧正在被測試," "以確定它們是否有價值被收錄到內建的 itertools 中。" -#: ../../library/itertools.rst:769 +#: ../../library/itertools.rst:777 msgid "" "Substantially all of these recipes and many, many others can be installed " "from the :pypi:`more-itertools` project found on the Python Package Index::" @@ -1599,11 +1612,11 @@ msgstr "" "幾乎所有這些應用技巧以及許多其他應用技巧都可以從 Python Package Index 上的 :" "pypi:`more-itertools` 專案中安裝: ::" -#: ../../library/itertools.rst:773 +#: ../../library/itertools.rst:781 msgid "python -m pip install more-itertools" msgstr "python -m pip install more-itertools" -#: ../../library/itertools.rst:775 +#: ../../library/itertools.rst:783 msgid "" "Many of the recipes offer the same high performance as the underlying " "toolset. Superior memory performance is kept by processing elements one at a " @@ -1621,7 +1634,7 @@ msgstr "" "用「向量化 (vectorized)」的構建塊而不是使用會造成直譯器負擔的 for 迴圈和\\ :" "term:`產生器 `,則能保持高速度。" -#: ../../library/itertools.rst:783 +#: ../../library/itertools.rst:791 msgid "" "import collections\n" "import contextlib\n" @@ -1800,11 +1813,11 @@ msgid "" " yield func()" msgstr "" -#: ../../library/itertools.rst:956 +#: ../../library/itertools.rst:964 msgid "The following recipes have a more mathematical flavor:" msgstr "以下的應用技巧具有更多的數學風格:" -#: ../../library/itertools.rst:958 +#: ../../library/itertools.rst:966 msgid "" "def powerset(iterable):\n" " \"powerset([1,2,3]) → () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)\"\n" @@ -1819,7 +1832,7 @@ msgid "" "def reshape(matrix, cols):\n" " \"Reshape a 2-D matrix to have a given number of columns.\"\n" " # reshape([(0, 1), (2, 3), (4, 5)], 3) → (0, 1, 2), (3, 4, 5)\n" -" return batched(chain.from_iterable(matrix), cols)\n" +" return batched(chain.from_iterable(matrix), cols, strict=True)\n" "\n" "def transpose(matrix):\n" " \"Swap the rows and columns of a 2-D matrix.\"\n" diff --git a/library/json.po b/library/json.po index c8aba2819d..a910b316ff 100644 --- a/library/json.po +++ b/library/json.po @@ -6,9 +6,9 @@ # SkyLull , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-08-05 15:25+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -119,24 +119,41 @@ msgstr "美化輸出: ::" #: ../../library/json.rst:56 msgid "" ">>> import json\n" -">>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4))\n" +">>> print(json.dumps({'6': 7, '4': 5}, sort_keys=True, indent=4))\n" "{\n" " \"4\": 5,\n" " \"6\": 7\n" "}" msgstr "" ">>> import json\n" -">>> print(json.dumps({'4': 5, '6': 7}, sort_keys=True, indent=4))\n" +">>> print(json.dumps({'6': 7, '4': 5}, sort_keys=True, indent=4))\n" "{\n" " \"4\": 5,\n" " \"6\": 7\n" "}" #: ../../library/json.rst:63 +msgid "Specializing JSON object encoding::" +msgstr "特殊化 JSON 物件解碼方式: ::" + +#: ../../library/json.rst:65 +msgid "" +">>> import json\n" +">>> def custom_json(obj):\n" +"... if isinstance(obj, complex):\n" +"... return {'__complex__': True, 'real': obj.real, 'imag': obj." +"imag}\n" +"... raise TypeError(f'Cannot serialize object of {type(obj)}')\n" +"...\n" +">>> json.dumps(1 + 2j, default=custom_json)\n" +"'{\"__complex__\": true, \"real\": 1.0, \"imag\": 2.0}'" +msgstr "" + +#: ../../library/json.rst:74 msgid "Decoding JSON::" msgstr "JSON 解碼: ::" -#: ../../library/json.rst:65 +#: ../../library/json.rst:76 msgid "" ">>> import json\n" ">>> json.loads('[\"foo\", {\"bar\":[\"baz\", null, 1.0, 2]}]')\n" @@ -158,11 +175,11 @@ msgstr "" ">>> json.load(io)\n" "['streaming API']" -#: ../../library/json.rst:75 +#: ../../library/json.rst:86 msgid "Specializing JSON object decoding::" msgstr "自訂特殊的 JSON 解碼方式: ::" -#: ../../library/json.rst:77 +#: ../../library/json.rst:88 msgid "" ">>> import json\n" ">>> def as_complex(dct):\n" @@ -190,11 +207,11 @@ msgstr "" ">>> json.loads('1.1', parse_float=decimal.Decimal)\n" "Decimal('1.1')" -#: ../../library/json.rst:90 +#: ../../library/json.rst:101 msgid "Extending :class:`JSONEncoder`::" msgstr "繼承 :class:`JSONEncoder` 類別並自行擴充額外的編碼方法: ::" -#: ../../library/json.rst:92 +#: ../../library/json.rst:103 msgid "" ">>> import json\n" ">>> class ComplexEncoder(json.JSONEncoder):\n" @@ -212,11 +229,11 @@ msgid "" "['[2.0', ', 1.0', ']']" msgstr "" -#: ../../library/json.rst:108 +#: ../../library/json.rst:119 msgid "Using :mod:`json.tool` from the shell to validate and pretty-print:" msgstr "在命令列介面裡使用 :mod:`json.tool` 來驗證 JSON 語法和美化呈現方式:" -#: ../../library/json.rst:110 +#: ../../library/json.rst:121 msgid "" "$ echo '{\"json\":\"obj\"}' | python -m json.tool\n" "{\n" @@ -232,11 +249,11 @@ msgstr "" "$ echo '{1.2:3.4}' | python -m json.tool\n" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" -#: ../../library/json.rst:119 +#: ../../library/json.rst:130 msgid "See :ref:`json-commandline` for detailed documentation." msgstr "更詳盡的文件請見 :ref:`json-commandline`。" -#: ../../library/json.rst:123 +#: ../../library/json.rst:134 msgid "" "JSON is a subset of `YAML `_ 1.2. The JSON produced by " "this module's default settings (in particular, the default *separators* " @@ -248,7 +265,7 @@ msgstr "" "輸出也符合 YAML 1.0 和 1.1 的子集合規範。因此你也可以利用這個模組來當作 YAML " "的序列化工具(serializer)。" -#: ../../library/json.rst:130 +#: ../../library/json.rst:141 msgid "" "This module's encoders and decoders preserve input and output order by " "default. Order is only lost if the underlying containers are unordered." @@ -256,11 +273,11 @@ msgstr "" "這個模組的編、解碼器預設會保存輸入與輸出資料的順序關係,除非一開始的輸入本身" "就是無序的。" -#: ../../library/json.rst:135 +#: ../../library/json.rst:146 msgid "Basic Usage" msgstr "基本用法" -#: ../../library/json.rst:142 +#: ../../library/json.rst:153 msgid "" "Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-" "supporting :term:`file-like object`) using this :ref:`conversion table `." msgstr "" @@ -390,7 +407,7 @@ msgstr "" # SkyLull: 我想這裡的 "framed protocol" 指的是 # https://peps.python.org/pep-3154/#framing -#: ../../library/json.rst:203 +#: ../../library/json.rst:214 msgid "" "Unlike :mod:`pickle` and :mod:`marshal`, JSON is not a framed protocol, so " "trying to serialize multiple objects with repeated calls to :func:`dump` " @@ -400,7 +417,7 @@ msgstr "" "framed)的協定,因此嘗試重複呼叫 :func:`dump` 來序列化多個物件到同一個 *fp* " "裡將導致無效的 JSON 檔案。" -#: ../../library/json.rst:212 +#: ../../library/json.rst:223 msgid "" "Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion " "table `. The arguments have the same meaning as in :func:" @@ -409,7 +426,7 @@ msgstr "" "使用此\\ :ref:`轉換表 `\\ 來將 *obj* 序列化為 JSON 格式 :" "class:`str`。這個引數的作用與 :func:`dump` 中的同名引數意義相同。" -#: ../../library/json.rst:218 +#: ../../library/json.rst:229 msgid "" "Keys in key/value pairs of JSON are always of the type :class:`str`. When a " "dictionary is converted into JSON, all the keys of the dictionary are " @@ -422,7 +439,7 @@ msgstr "" "轉換回字典,則該字典可能不等於原始字典。也就是說,如果字典 x 含有非字串鍵值," "則 ``loads(dumps(x)) != x``。" -#: ../../library/json.rst:227 +#: ../../library/json.rst:238 msgid "" "Deserialize *fp* (a ``.read()``-supporting :term:`text file` or :term:" "`binary file` containing a JSON document) to a Python object using this :ref:" @@ -432,7 +449,7 @@ msgstr "" "read()``、包含 JSON 文件的\\ :term:`文字檔案 `\\ 或\\ :term:`二進" "位檔案 `\\ )去序列化為 Python 物件。" -#: ../../library/json.rst:231 +#: ../../library/json.rst:242 msgid "" "*object_hook* is an optional function that will be called with the result of " "any object literal decoded (a :class:`dict`). The return value of " @@ -445,7 +462,7 @@ msgstr "" "先的 :class:`dict` 輸出。此功能可用於實作自訂解碼器(例如 `JSON-RPC `_ 類別提示)。" -#: ../../library/json.rst:237 +#: ../../library/json.rst:248 msgid "" "*object_pairs_hook* is an optional function that will be called with the " "result of any object literal decoded with an ordered list of pairs. The " @@ -458,11 +475,11 @@ msgstr "" "*object_pairs_hook* 的回傳值來取代原先的 :class:`dict` 輸出。此功能可用於實作" "自訂解碼器。如果也同時給定了 *object_hook*,則 *object_pairs_hook* 優先。" -#: ../../library/json.rst:243 ../../library/json.rst:347 +#: ../../library/json.rst:254 ../../library/json.rst:358 msgid "Added support for *object_pairs_hook*." msgstr "新增對於 *object_pairs_hook* 的支援。" -#: ../../library/json.rst:246 ../../library/json.rst:350 +#: ../../library/json.rst:257 ../../library/json.rst:361 msgid "" "*parse_float* is an optional function that will be called with the string of " "every JSON float to be decoded. By default, this is equivalent to " @@ -473,7 +490,7 @@ msgstr "" "的函式來進行解碼。預設情況這等效於 ``float(num_str)``。這個參數可用於將 JSON " "中的浮點數解碼或剖析為另一種資料型別(例如 :class:`decimal.Decimal`\\ )。" -#: ../../library/json.rst:251 ../../library/json.rst:355 +#: ../../library/json.rst:262 ../../library/json.rst:366 msgid "" "*parse_int* is an optional function that will be called with the string of " "every JSON int to be decoded. By default, this is equivalent to " @@ -484,7 +501,7 @@ msgstr "" "``int(num_str)``。這個參數可用於將 JSON 中的整數解碼或剖析為另一種資料型別" "(例如 :class:`float`)。" -#: ../../library/json.rst:256 +#: ../../library/json.rst:267 msgid "" "The default *parse_int* of :func:`int` now limits the maximum length of the " "integer string via the interpreter's :ref:`integer string conversion length " @@ -494,7 +511,7 @@ msgstr "" "由直譯器的\\ :ref:`整數字串轉換長度限制 `\\ 機制來達成," "這能防止阻斷服務攻擊 (Denial of Service attacks)。" -#: ../../library/json.rst:262 ../../library/json.rst:360 +#: ../../library/json.rst:273 ../../library/json.rst:371 msgid "" "*parse_constant* is an optional function that will be called with one of the " "following strings: ``'-Infinity'``, ``'Infinity'``, ``'NaN'``. This can be " @@ -504,12 +521,12 @@ msgstr "" "``'Infinity'`` 或 ``'NaN'`` 其中之一則會改用這個參數給定的函式來進行解碼。這" "也可用於使解碼過程中遇到無效的 JSON 數字時引發一個例外。" -#: ../../library/json.rst:266 +#: ../../library/json.rst:277 msgid "*parse_constant* doesn't get called on 'null', 'true', 'false' anymore." msgstr "" "遭遇 'null'、'true' 或 'false' 時不再以 *parse_constant* 給定的函式來處理了。" -#: ../../library/json.rst:269 +#: ../../library/json.rst:280 msgid "" "To use a custom :class:`JSONDecoder` subclass, specify it with the ``cls`` " "kwarg; otherwise :class:`JSONDecoder` is used. Additional keyword arguments " @@ -519,8 +536,8 @@ msgstr "" "之,否則將使用預設的 :class:`JSONDecoder`。其他未使用到的關鍵字引數將繼續傳入" "給 JSONDecoder 的建構函式使用。" -#: ../../library/json.rst:273 ../../library/json.rst:291 -#: ../../library/json.rst:369 +#: ../../library/json.rst:284 ../../library/json.rst:302 +#: ../../library/json.rst:380 msgid "" "If the data being deserialized is not a valid JSON document, a :exc:" "`JSONDecodeError` will be raised." @@ -528,7 +545,7 @@ msgstr "" "如果被去序列化(deserialized)的資料不符合 JSON 格式,將會引發 :exc:" "`JSONDecodeError` 例外。" -#: ../../library/json.rst:279 +#: ../../library/json.rst:290 msgid "" "*fp* can now be a :term:`binary file`. The input encoding should be UTF-8, " "UTF-16 or UTF-32." @@ -536,7 +553,7 @@ msgstr "" "現在,*fp* 可以是一個\\ :term:`二進位檔案 `,前提是其編碼格式為 " "UTF-8、UTF-16 或 UTF-32。" -#: ../../library/json.rst:285 +#: ../../library/json.rst:296 msgid "" "Deserialize *s* (a :class:`str`, :class:`bytes` or :class:`bytearray` " "instance containing a JSON document) to a Python object using this :ref:" @@ -546,11 +563,11 @@ msgstr "" "class:`str`、:class:`bytes` 或 :class:`bytearray` 的實例(instance))去序列" "化(deserialize)為一個 Python 物件" -#: ../../library/json.rst:289 +#: ../../library/json.rst:300 msgid "The other arguments have the same meaning as in :func:`load`." msgstr "其餘引數的使用方式與意義和 :func:`load` 的相同。" -#: ../../library/json.rst:294 +#: ../../library/json.rst:305 msgid "" "*s* can now be of type :class:`bytes` or :class:`bytearray`. The input " "encoding should be UTF-8, UTF-16 or UTF-32." @@ -558,95 +575,95 @@ msgstr "" "現在,*s* 可以是一個二進位檔案如 :class:`bytes` 或 :class:`bytearray`,前提是" "其編碼格式為 UTF-8、UTF-16 或 UTF-32。" -#: ../../library/json.rst:298 +#: ../../library/json.rst:309 msgid "The keyword argument *encoding* has been removed." msgstr "刪除關鍵字引數 *encoding*。" -#: ../../library/json.rst:303 +#: ../../library/json.rst:314 msgid "Encoders and Decoders" msgstr "編碼器與解碼器" -#: ../../library/json.rst:307 +#: ../../library/json.rst:318 msgid "Simple JSON decoder." msgstr "簡易 JSON 解碼器" -#: ../../library/json.rst:309 +#: ../../library/json.rst:320 msgid "Performs the following translations in decoding by default:" msgstr "預設將執行下列資料型別轉換:" -#: ../../library/json.rst:314 ../../library/json.rst:402 +#: ../../library/json.rst:325 ../../library/json.rst:413 msgid "JSON" msgstr "JSON" -#: ../../library/json.rst:314 ../../library/json.rst:402 +#: ../../library/json.rst:325 ../../library/json.rst:413 msgid "Python" msgstr "Python" -#: ../../library/json.rst:316 ../../library/json.rst:404 +#: ../../library/json.rst:327 ../../library/json.rst:415 msgid "object" msgstr "object" -#: ../../library/json.rst:316 ../../library/json.rst:404 +#: ../../library/json.rst:327 ../../library/json.rst:415 msgid "dict" msgstr "dict" -#: ../../library/json.rst:318 ../../library/json.rst:406 +#: ../../library/json.rst:329 ../../library/json.rst:417 msgid "array" msgstr "array" -#: ../../library/json.rst:318 +#: ../../library/json.rst:329 msgid "list" msgstr "list" -#: ../../library/json.rst:320 ../../library/json.rst:408 +#: ../../library/json.rst:331 ../../library/json.rst:419 msgid "string" msgstr "string" -#: ../../library/json.rst:320 ../../library/json.rst:408 +#: ../../library/json.rst:331 ../../library/json.rst:419 msgid "str" msgstr "str" -#: ../../library/json.rst:322 +#: ../../library/json.rst:333 msgid "number (int)" msgstr "number (整數)" -#: ../../library/json.rst:322 +#: ../../library/json.rst:333 msgid "int" msgstr "int" -#: ../../library/json.rst:324 +#: ../../library/json.rst:335 msgid "number (real)" msgstr "number (實數)" -#: ../../library/json.rst:324 +#: ../../library/json.rst:335 msgid "float" msgstr "float" -#: ../../library/json.rst:326 ../../library/json.rst:412 +#: ../../library/json.rst:337 ../../library/json.rst:423 msgid "true" msgstr "true" -#: ../../library/json.rst:326 ../../library/json.rst:412 +#: ../../library/json.rst:337 ../../library/json.rst:423 msgid "True" msgstr "True" -#: ../../library/json.rst:328 ../../library/json.rst:414 +#: ../../library/json.rst:339 ../../library/json.rst:425 msgid "false" msgstr "false" -#: ../../library/json.rst:328 ../../library/json.rst:414 +#: ../../library/json.rst:339 ../../library/json.rst:425 msgid "False" msgstr "False" -#: ../../library/json.rst:330 ../../library/json.rst:416 +#: ../../library/json.rst:341 ../../library/json.rst:427 msgid "null" msgstr "null" -#: ../../library/json.rst:330 ../../library/json.rst:416 +#: ../../library/json.rst:341 ../../library/json.rst:427 msgid "None" msgstr "None" -#: ../../library/json.rst:333 +#: ../../library/json.rst:344 msgid "" "It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as their " "corresponding ``float`` values, which is outside the JSON spec." @@ -654,7 +671,7 @@ msgstr "" "雖然 ``NaN``、``Infinity`` 和 ``-Infinity`` 並不符合 JSON 規範,但解碼器依然" "能正確地將其轉換到相應的 Python ``float`` 值。" -#: ../../library/json.rst:336 +#: ../../library/json.rst:347 msgid "" "*object_hook* is an optional function that will be called with the result of " "every JSON object decoded and its return value will be used in place of the " @@ -665,7 +682,7 @@ msgstr "" "回傳值來取代原先的 :class:`dict`。這個功能可用於提供自訂的去序列化(例如支援 " "`JSON-RPC `_ 類別提示)。" -#: ../../library/json.rst:341 +#: ../../library/json.rst:352 msgid "" "*object_pairs_hook* is an optional function that will be called with the " "result of every JSON object decoded with an ordered list of pairs. The " @@ -674,7 +691,7 @@ msgid "" "*object_hook* is also defined, the *object_pairs_hook* takes priority." msgstr "" -#: ../../library/json.rst:364 +#: ../../library/json.rst:375 msgid "" "If *strict* is false (``True`` is the default), then control characters will " "be allowed inside strings. Control characters in this context are those " @@ -685,25 +702,25 @@ msgstr "" "語境中的控制字元指的是 ASCII 字元編碼在 0~31 範圍內的字元,包括 ``'\\t'``" "(tab)、``'\\n'``、``'\\r'`` 和 ``'\\0'``。" -#: ../../library/json.rst:372 ../../library/json.rst:473 +#: ../../library/json.rst:383 ../../library/json.rst:484 msgid "All parameters are now :ref:`keyword-only `." msgstr "" "所有參數現在都是\\ :ref:`僅限關鍵字參數 `\\ 了。" -#: ../../library/json.rst:377 +#: ../../library/json.rst:388 msgid "" "Return the Python representation of *s* (a :class:`str` instance containing " "a JSON document)." msgstr "" "回傳用 Python 型式表達的 *s* (一個含有 JSON 文件的 :class:`str` 實例)。" -#: ../../library/json.rst:380 +#: ../../library/json.rst:391 msgid "" ":exc:`JSONDecodeError` will be raised if the given JSON document is not " "valid." msgstr "若給定的輸入不符合 JSON 格式會引發 :exc:`JSONDecodeError` 例外。" -#: ../../library/json.rst:385 +#: ../../library/json.rst:396 msgid "" "Decode a JSON document from *s* (a :class:`str` beginning with a JSON " "document) and return a 2-tuple of the Python representation and the index in " @@ -712,40 +729,40 @@ msgstr "" "將 *s* (一個開頭部分含有合格 JSON 文件的 :class:`str`) 解碼,並將 JSON 文件" "結束點的索引值(index)和解碼結果合併為一個二元組(2-tuple)後回傳。" -#: ../../library/json.rst:389 +#: ../../library/json.rst:400 msgid "" "This can be used to decode a JSON document from a string that may have " "extraneous data at the end." msgstr "這個方法可以用來解碼尾段可能帶有 JSON 以外資料的文字。" -#: ../../library/json.rst:395 +#: ../../library/json.rst:406 msgid "Extensible JSON encoder for Python data structures." msgstr "可擴充的 Python 資料結構 JSON 編碼器。" -#: ../../library/json.rst:397 +#: ../../library/json.rst:408 msgid "Supports the following objects and types by default:" msgstr "預設可支援下列物件及型別:" -#: ../../library/json.rst:406 +#: ../../library/json.rst:417 msgid "list, tuple" msgstr "list, tuple" -#: ../../library/json.rst:410 +#: ../../library/json.rst:421 msgid "int, float, int- & float-derived Enums" msgstr "" "int、float 或可作為整數或浮點數運算的衍生列舉(int- or float-derived Enums)" -#: ../../library/json.rst:410 +#: ../../library/json.rst:421 msgid "number" msgstr "number" -#: ../../library/json.rst:419 +#: ../../library/json.rst:430 msgid "Added support for int- and float-derived Enum classes." msgstr "" "增加對整數(int)、浮點數(float)或可作為整數或浮點數運算的衍生列舉(int- " "or float-derived Enums)類別的支援性。" -#: ../../library/json.rst:422 +#: ../../library/json.rst:433 msgid "" "To extend this to recognize other objects, subclass and implement a :meth:" "`~JSONEncoder.default` method with another method that returns a " @@ -756,7 +773,7 @@ msgstr "" "方法。此方法應回傳一個可序列化的 ``o`` 物件,否則此方法應呼叫父類別的 " "JSONEncoder.default 方法(以引發 :exc:`TypeError` 例外)。" -#: ../../library/json.rst:427 +#: ../../library/json.rst:438 msgid "" "If *skipkeys* is false (the default), a :exc:`TypeError` will be raised when " "trying to encode keys that are not :class:`str`, :class:`int`, :class:" @@ -766,7 +783,7 @@ msgstr "" "`int`、:class:`float` 或 ``None`` 的鍵值時,將引發 :exc:`TypeError`。如果 " "*skipkeys* 為 true,這些項目將直接被跳過。" -#: ../../library/json.rst:435 +#: ../../library/json.rst:446 msgid "" "If *check_circular* is true (the default), then lists, dicts, and custom " "encoded objects will be checked for circular references during encoding to " @@ -777,7 +794,7 @@ msgstr "" "(dict)和自訂編碼物件的循環參照,以防止無限遞迴(一個會導致 :exc:" "`RecursionError` 例外的問題)。否則不會進行此類檢查。" -#: ../../library/json.rst:440 +#: ../../library/json.rst:451 msgid "" "If *allow_nan* is true (the default), then ``NaN``, ``Infinity``, and ``-" "Infinity`` will be encoded as such. This behavior is not JSON specification " @@ -789,7 +806,7 @@ msgstr "" "數基於 JavaScript 的編碼器和解碼器一致。否則若設為 false,嘗試對這些浮點數進" "行編碼將引發 :exc:`ValueError` 例外。" -#: ../../library/json.rst:446 +#: ../../library/json.rst:457 msgid "" "If *sort_keys* is true (default: ``False``), then the output of dictionaries " "will be sorted by key; this is useful for regression tests to ensure that " @@ -799,7 +816,7 @@ msgstr "" "按鍵值排序。這項功能可確保 JSON 序列化的結果能被互相比較,能讓日常的回歸測試" "檢查變得方便一些。" -#: ../../library/json.rst:479 +#: ../../library/json.rst:490 msgid "" "Implement this method in a subclass such that it returns a serializable " "object for *o*, or calls the base implementation (to raise a :exc:" @@ -808,7 +825,7 @@ msgstr "" "在任意一個子類別裡實作這個方法時須讓其回傳一個可序列化的物件 *o* ,或呼叫原始" "的實作以引發 :exc:`TypeError` 例外。" -#: ../../library/json.rst:483 +#: ../../library/json.rst:494 msgid "" "For example, to support arbitrary iterators, you could implement :meth:" "`~JSONEncoder.default` like this::" @@ -816,7 +833,7 @@ msgstr "" "舉例來說,想要讓編碼器支援任意疊代器(iterator),你可以實作這樣子的 :meth:" "`~JSONEncoder.default`: ::" -#: ../../library/json.rst:486 +#: ../../library/json.rst:497 msgid "" "def default(self, o):\n" " try:\n" @@ -829,13 +846,13 @@ msgid "" " return super().default(o)" msgstr "" -#: ../../library/json.rst:499 +#: ../../library/json.rst:510 msgid "" "Return a JSON string representation of a Python data structure, *o*. For " "example::" msgstr "回傳一個 Python 資料結構物件 *o* 的 JSON 的字串表示。例如: ::" -#: ../../library/json.rst:502 +#: ../../library/json.rst:513 msgid "" ">>> json.JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n" "'{\"foo\": [\"bar\", \"baz\"]}'" @@ -843,7 +860,7 @@ msgstr "" ">>> json.JSONEncoder().encode({\"foo\": [\"bar\", \"baz\"]})\n" "'{\"foo\": [\"bar\", \"baz\"]}'" -#: ../../library/json.rst:508 +#: ../../library/json.rst:519 msgid "" "Encode the given object, *o*, and yield each string representation as " "available. For example::" @@ -851,7 +868,7 @@ msgstr "" "將物件 *o* 編碼,並將結果統整為一個能依序產生(yield)各結果字串的物件。如下" "例: ::" -#: ../../library/json.rst:511 +#: ../../library/json.rst:522 msgid "" "for chunk in json.JSONEncoder().iterencode(bigobject):\n" " mysocket.write(chunk)" @@ -859,39 +876,39 @@ msgstr "" "for chunk in json.JSONEncoder().iterencode(bigobject):\n" " mysocket.write(chunk)" -#: ../../library/json.rst:516 +#: ../../library/json.rst:527 msgid "Exceptions" msgstr "例外" -#: ../../library/json.rst:520 +#: ../../library/json.rst:531 msgid "Subclass of :exc:`ValueError` with the following additional attributes:" msgstr ":exc:`ValueError` 的子類別具有下列額外屬性:" -#: ../../library/json.rst:524 +#: ../../library/json.rst:535 msgid "The unformatted error message." msgstr "未受格式化的錯誤訊息。" -#: ../../library/json.rst:528 +#: ../../library/json.rst:539 msgid "The JSON document being parsed." msgstr "正在被剖析的 JSON 文件。" -#: ../../library/json.rst:532 +#: ../../library/json.rst:543 msgid "The start index of *doc* where parsing failed." msgstr "*doc* 剖析失敗處的起始點的索引值。" -#: ../../library/json.rst:536 +#: ../../library/json.rst:547 msgid "The line corresponding to *pos*." msgstr "*pos* 所在的列(line)數。" -#: ../../library/json.rst:540 +#: ../../library/json.rst:551 msgid "The column corresponding to *pos*." msgstr "*pos* 所在的行(column)數。" -#: ../../library/json.rst:546 +#: ../../library/json.rst:557 msgid "Standard Compliance and Interoperability" msgstr "合規性與互通性(Interoperability)" -#: ../../library/json.rst:548 +#: ../../library/json.rst:559 msgid "" "The JSON format is specified by :rfc:`7159` and by `ECMA-404 `_. This " @@ -904,7 +921,7 @@ msgstr "" "組對 RFC 的遵循程度。簡單起見,:class:`JSONEncoder` 和 :class:`JSONDecoder` " "子類別以及未明確提及的參數將不予討論。" -#: ../../library/json.rst:554 +#: ../../library/json.rst:565 msgid "" "This module does not comply with the RFC in a strict fashion, implementing " "some extensions that are valid JavaScript but not valid JSON. In particular:" @@ -912,17 +929,17 @@ msgstr "" "這個模組的部份實作並未非常嚴格地遵循 RFC 規範。準確來說,下列實際實作符合 " "JavaScript 語法格式,但並不符合 JSON 格式:" -#: ../../library/json.rst:557 +#: ../../library/json.rst:568 msgid "Infinite and NaN number values are accepted and output;" msgstr "無限(Infinite)和非數字(NaN)值會被接受。" -#: ../../library/json.rst:558 +#: ../../library/json.rst:569 msgid "" "Repeated names within an object are accepted, and only the value of the last " "name-value pair is used." msgstr "同一個物件內可以有重複的名稱,但只有最後一個同名物件是有效的。" -#: ../../library/json.rst:561 +#: ../../library/json.rst:572 msgid "" "Since the RFC permits RFC-compliant parsers to accept input texts that are " "not RFC-compliant, this module's deserializer is technically RFC-compliant " @@ -931,11 +948,11 @@ msgstr "" "不過 RFC 准許遵循 RFC 的剖析器接受不合規的文字輸入,所以技術上來說若以預設設" "定運作,本模組的去序列化器(deserializer)是符合 RFC 規範的。" -#: ../../library/json.rst:566 +#: ../../library/json.rst:577 msgid "Character Encodings" msgstr "字元編碼格式" -#: ../../library/json.rst:568 +#: ../../library/json.rst:579 msgid "" "The RFC requires that JSON be represented using either UTF-8, UTF-16, or " "UTF-32, with UTF-8 being the recommended default for maximum " @@ -944,7 +961,7 @@ msgstr "" "RFC 要求 JSON 必須以 UTF-8、UTF-16 或 UTF-32 格式編碼。並推薦以 UTF-8 編碼以" "達成最佳的互通性。" -#: ../../library/json.rst:571 +#: ../../library/json.rst:582 msgid "" "As permitted, though not required, by the RFC, this module's serializer sets " "*ensure_ascii=True* by default, thus escaping the output so that the " @@ -953,7 +970,7 @@ msgstr "" "RFC 准許但並不強制編碼器的 *ensure_ascii=True* 行為是預設值,但本模組依然實作" "了此一選項作為預設,因此本模組預設會轉義所有非 ASCII 字元。" -#: ../../library/json.rst:575 +#: ../../library/json.rst:586 msgid "" "Other than the *ensure_ascii* parameter, this module is defined strictly in " "terms of conversion between Python objects and :class:`Unicode strings " @@ -963,7 +980,7 @@ msgstr "" "除了 *ensure_ascii* 選項參數之外,本模組嚴格遵循 Python 物件與 :class:" "`Unicode strings ` 之間的轉換規範,因此並不另外處理字元編碼的問題。" -#: ../../library/json.rst:580 +#: ../../library/json.rst:591 msgid "" "The RFC prohibits adding a byte order mark (BOM) to the start of a JSON " "text, and this module's serializer does not add a BOM to its output. The RFC " @@ -976,7 +993,7 @@ msgstr "" "(deserializer)忽略文件初始的端序記號,因此本模組的去序列化器將在遭遇位於文" "件開頭的端序記號時引發 :exc:`ValueError` 例外。" -#: ../../library/json.rst:586 +#: ../../library/json.rst:597 msgid "" "The RFC does not explicitly forbid JSON strings which contain byte sequences " "that don't correspond to valid Unicode characters (e.g. unpaired UTF-16 " @@ -989,11 +1006,11 @@ msgstr "" "預設情況下,當原始輸入的 :class:`str` 中存在此類序列時,該模組將接受並輸出這" "些序列的編碼位置(code points)。" -#: ../../library/json.rst:594 +#: ../../library/json.rst:605 msgid "Infinite and NaN Number Values" msgstr "正負無限與非數值" -#: ../../library/json.rst:596 +#: ../../library/json.rst:607 msgid "" "The RFC does not permit the representation of infinite or NaN number values. " "Despite that, by default, this module accepts and outputs ``Infinity``, ``-" @@ -1002,7 +1019,7 @@ msgstr "" "RFC 不允許表現無限大或非數值(NaN)。但預設情況下,這個模組仍接受並輸出 " "``Infinity``、``-Infinity`` 和 ``NaN``,如同它們是有效的 JSON 數值字面值: ::" -#: ../../library/json.rst:600 +#: ../../library/json.rst:611 msgid "" ">>> # Neither of these calls raises an exception, but the results are not " "valid JSON\n" @@ -1017,7 +1034,7 @@ msgid "" "nan" msgstr "" -#: ../../library/json.rst:611 +#: ../../library/json.rst:622 msgid "" "In the serializer, the *allow_nan* parameter can be used to alter this " "behavior. In the deserializer, the *parse_constant* parameter can be used " @@ -1026,11 +1043,11 @@ msgstr "" "在序列化器中,*allow_nan* 參數可以改變這個行為。在去序列化器中," "*parse_constant* 參數可以改變這個行為。" -#: ../../library/json.rst:617 +#: ../../library/json.rst:628 msgid "Repeated Names Within an Object" msgstr "物件內重複的名稱" -#: ../../library/json.rst:619 +#: ../../library/json.rst:630 msgid "" "The RFC specifies that the names within a JSON object should be unique, but " "does not mandate how repeated names in JSON objects should be handled. By " @@ -1041,22 +1058,22 @@ msgstr "" "字。預設情況下,本模組不會因此引發例外;相反的,它會忽略該名字的所有重複鍵值" "對,並只保留最後一個: ::" -#: ../../library/json.rst:624 +#: ../../library/json.rst:635 msgid "" ">>> weird_json = '{\"x\": 1, \"x\": 2, \"x\": 3}'\n" ">>> json.loads(weird_json)\n" "{'x': 3}" msgstr "" -#: ../../library/json.rst:628 +#: ../../library/json.rst:639 msgid "The *object_pairs_hook* parameter can be used to alter this behavior." msgstr "*object_parts_hook* 參數可以改變這個行為。" -#: ../../library/json.rst:632 +#: ../../library/json.rst:643 msgid "Top-level Non-Object, Non-Array Values" msgstr "位於頂層的非物件及非列表值" -#: ../../library/json.rst:634 +#: ../../library/json.rst:645 msgid "" "The old version of JSON specified by the obsolete :rfc:`4627` required that " "the top-level value of a JSON text must be either a JSON object or array " @@ -1070,37 +1087,37 @@ msgstr "" "boolean、數字或字串值。 :rfc:`7159` 移除了這個限制,而本模組的序列化器或去串" "列化器中未曾實施過該限制。" -#: ../../library/json.rst:641 +#: ../../library/json.rst:652 msgid "" "Regardless, for maximum interoperability, you may wish to voluntarily adhere " "to the restriction yourself." msgstr "如果想要最大限度地保留互通性,你可能還是會想要自行施加這個限制。" -#: ../../library/json.rst:646 +#: ../../library/json.rst:657 msgid "Implementation Limitations" msgstr "實作限制" -#: ../../library/json.rst:648 +#: ../../library/json.rst:659 msgid "Some JSON deserializer implementations may set limits on:" msgstr "某些 JSON 去序列化器的實作可能會造成下列限制:" -#: ../../library/json.rst:650 +#: ../../library/json.rst:661 msgid "the size of accepted JSON texts" msgstr "JSON 文件長度上限" -#: ../../library/json.rst:651 +#: ../../library/json.rst:662 msgid "the maximum level of nesting of JSON objects and arrays" msgstr "JSON 物件或陣列的最大巢狀層數(level of nesting)限制" -#: ../../library/json.rst:652 +#: ../../library/json.rst:663 msgid "the range and precision of JSON numbers" msgstr "數字的精準度或範圍" -#: ../../library/json.rst:653 +#: ../../library/json.rst:664 msgid "the content and maximum length of JSON strings" msgstr "JSON 字串長度上限" -#: ../../library/json.rst:655 +#: ../../library/json.rst:666 msgid "" "This module does not impose any such limits beyond those of the relevant " "Python datatypes themselves or the Python interpreter itself." @@ -1108,7 +1125,7 @@ msgstr "" "本模組除了 Python 資料型態本身或 Python 直譯器本身的限制以外,不會設定任何此" "類限制。" -#: ../../library/json.rst:658 +#: ../../library/json.rst:669 msgid "" "When serializing to JSON, beware any such limitations in applications that " "may consume your JSON. In particular, it is common for JSON numbers to be " @@ -1123,22 +1140,22 @@ msgstr "" "因而受到其表示範圍和精度限制的影響。這在序列化極大的 Python :class:`int` 數" "值、或是序列化特殊數字型別的實例時(例如 :class:`decimal.Decimal`)尤其重要。" -#: ../../library/json.rst:671 +#: ../../library/json.rst:682 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/json.rst:676 +#: ../../library/json.rst:687 msgid "**Source code:** :source:`Lib/json/tool.py`" msgstr "**原始碼:**\\ :source:`Lib/json/tool.py`" -#: ../../library/json.rst:680 +#: ../../library/json.rst:691 msgid "" "The :mod:`json.tool` module provides a simple command line interface to " "validate and pretty-print JSON objects." msgstr "" ":mod:`json.tool` 模組提供了一個簡易的命令列界面以供校驗與美化呈現 JSON 物件。" -#: ../../library/json.rst:683 +#: ../../library/json.rst:694 msgid "" "If the optional ``infile`` and ``outfile`` arguments are not specified, :" "data:`sys.stdin` and :data:`sys.stdout` will be used respectively:" @@ -1146,7 +1163,7 @@ msgstr "" "如果沒有指定可選引數 ``infile`` 和 ``outfile`` ,則 :data:`sys.stdin` 和 :" "data:`sys.stdout` 將各自做為輸入和輸出的預設值。" -#: ../../library/json.rst:686 +#: ../../library/json.rst:697 msgid "" "$ echo '{\"json\": \"obj\"}' | python -m json.tool\n" "{\n" @@ -1156,7 +1173,7 @@ msgid "" "Expecting property name enclosed in double quotes: line 1 column 2 (char 1)" msgstr "" -#: ../../library/json.rst:695 +#: ../../library/json.rst:706 msgid "" "The output is now in the same order as the input. Use the :option:`--sort-" "keys` option to sort the output of dictionaries alphabetically by key." @@ -1164,15 +1181,15 @@ msgstr "" "現在開始輸出和輸入的資料順序會是相同的。傳入 :option:`--sort-keys` 引數以按照" "鍵值的字母順序對輸出進行排序。" -#: ../../library/json.rst:702 +#: ../../library/json.rst:713 msgid "Command line options" msgstr "命令列選項" -#: ../../library/json.rst:706 +#: ../../library/json.rst:717 msgid "The JSON file to be validated or pretty-printed:" msgstr "將被用於校驗或美化呈現的 JSON 文件:" -#: ../../library/json.rst:708 +#: ../../library/json.rst:719 msgid "" "$ python -m json.tool mp_films.json\n" "[\n" @@ -1198,11 +1215,11 @@ msgstr "" " }\n" "]" -#: ../../library/json.rst:722 +#: ../../library/json.rst:733 msgid "If *infile* is not specified, read from :data:`sys.stdin`." msgstr "如果沒有指定 *infile* 則會從 :data:`sys.stdin` 讀取輸入。" -#: ../../library/json.rst:726 +#: ../../library/json.rst:737 msgid "" "Write the output of the *infile* to the given *outfile*. Otherwise, write it " "to :data:`sys.stdout`." @@ -1210,33 +1227,33 @@ msgstr "" "將 *infile* 的結果寫入到給定的 *outfile*。若未提供則寫入到 :data:`sys." "stdout`。" -#: ../../library/json.rst:731 +#: ../../library/json.rst:742 msgid "Sort the output of dictionaries alphabetically by key." msgstr "按照鍵值的字母順序對輸出字典進行排序。" -#: ../../library/json.rst:737 +#: ../../library/json.rst:748 msgid "" "Disable escaping of non-ascii characters, see :func:`json.dumps` for more " "information." msgstr "關閉非 ASCII 字元的自動轉義功能。詳情請參照 :func:`json.dumps`。" -#: ../../library/json.rst:743 +#: ../../library/json.rst:754 msgid "Parse every input line as separate JSON object." msgstr "將每一行輸入都單獨輸出為一個 JSON 物件。" -#: ../../library/json.rst:749 +#: ../../library/json.rst:760 msgid "Mutually exclusive options for whitespace control." msgstr "互斥的空白字元控制選項。" -#: ../../library/json.rst:755 +#: ../../library/json.rst:766 msgid "Show the help message." msgstr "顯示說明訊息。" -#: ../../library/json.rst:759 +#: ../../library/json.rst:770 msgid "Footnotes" msgstr "註解" -#: ../../library/json.rst:760 +#: ../../library/json.rst:771 msgid "" "As noted in `the errata for RFC 7159 `_, JSON permits literal U+2028 (LINE SEPARATOR) " diff --git a/library/keyword.po b/library/keyword.po index 4149814c03..975d58fd62 100644 --- a/library/keyword.po +++ b/library/keyword.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-01-18 14:55+0800\n" diff --git a/library/language.po b/library/language.po index 510a4a95c4..fd197d5ad7 100644 --- a/library/language.po +++ b/library/language.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/linecache.po b/library/linecache.po index 0c5de2752c..167947f253 100644 --- a/library/linecache.po +++ b/library/linecache.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" diff --git a/library/locale.po b/library/locale.po index f93026190b..2cb4e18ddf 100644 --- a/library/locale.po +++ b/library/locale.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -588,16 +588,6 @@ msgid "" msgstr "" #: ../../library/locale.rst:409 -msgid "Sets the locale for *category* to the default setting." -msgstr "" - -#: ../../library/locale.rst:411 -msgid "" -"The default setting is determined by calling :func:`getdefaultlocale`. " -"*category* defaults to :const:`LC_ALL`." -msgstr "" - -#: ../../library/locale.rst:419 msgid "" "Compares two strings according to the current :const:`LC_COLLATE` setting. " "As any other compare function, returns a negative, or a positive value, or " @@ -605,7 +595,7 @@ msgid "" "is equal to it." msgstr "" -#: ../../library/locale.rst:427 +#: ../../library/locale.rst:417 msgid "" "Transforms a string to one that can be used in locale-aware comparisons. " "For example, ``strxfrm(s1) < strxfrm(s2)`` is equivalent to ``strcoll(s1, " @@ -613,7 +603,7 @@ msgid "" "repeatedly, e.g. when collating a sequence of strings." msgstr "" -#: ../../library/locale.rst:436 +#: ../../library/locale.rst:426 msgid "" "Formats a number *val* according to the current :const:`LC_NUMERIC` setting. " "The format follows the conventions of the ``%`` operator. For floating-" @@ -621,29 +611,29 @@ msgid "" "is ``True``, also takes the grouping into account." msgstr "" -#: ../../library/locale.rst:441 +#: ../../library/locale.rst:431 msgid "" "If *monetary* is true, the conversion uses monetary thousands separator and " "grouping strings." msgstr "" -#: ../../library/locale.rst:444 +#: ../../library/locale.rst:434 msgid "" "Processes formatting specifiers as in ``format % val``, but takes the " "current locale settings into account." msgstr "" -#: ../../library/locale.rst:447 +#: ../../library/locale.rst:437 msgid "The *monetary* keyword parameter was added." msgstr "" -#: ../../library/locale.rst:453 +#: ../../library/locale.rst:443 msgid "" "Formats a number *val* according to the current :const:`LC_MONETARY` " "settings." msgstr "" -#: ../../library/locale.rst:455 +#: ../../library/locale.rst:445 msgid "" "The returned string includes the currency symbol if *symbol* is true, which " "is the default. If *grouping* is ``True`` (which is not the default), " @@ -651,43 +641,43 @@ msgid "" "not the default), the international currency symbol is used." msgstr "" -#: ../../library/locale.rst:462 +#: ../../library/locale.rst:452 msgid "" "This function will not work with the 'C' locale, so you have to set a locale " "via :func:`setlocale` first." msgstr "" -#: ../../library/locale.rst:468 +#: ../../library/locale.rst:458 msgid "" "Formats a floating-point number using the same format as the built-in " "function ``str(float)``, but takes the decimal point into account." msgstr "" -#: ../../library/locale.rst:474 +#: ../../library/locale.rst:464 msgid "" "Converts a string into a normalized number string, following the :const:" "`LC_NUMERIC` settings." msgstr "" -#: ../../library/locale.rst:482 +#: ../../library/locale.rst:472 msgid "" "Converts a normalized number string into a formatted string following the :" "const:`LC_NUMERIC` settings." msgstr "" -#: ../../library/locale.rst:490 +#: ../../library/locale.rst:480 msgid "" "Converts a string to a number, following the :const:`LC_NUMERIC` settings, " "by calling *func* on the result of calling :func:`delocalize` on *string*." msgstr "" -#: ../../library/locale.rst:496 +#: ../../library/locale.rst:486 msgid "" "Converts a string to an integer, following the :const:`LC_NUMERIC` " "conventions." msgstr "" -#: ../../library/locale.rst:501 +#: ../../library/locale.rst:491 msgid "" "Locale category for the character type functions. Most importantly, this " "category defines the text encoding, i.e. how bytes are interpreted as " @@ -697,32 +687,32 @@ msgid "" "SSH connections." msgstr "" -#: ../../library/locale.rst:508 +#: ../../library/locale.rst:498 msgid "" "Python doesn't internally use locale-dependent character transformation " "functions from ``ctype.h``. Instead, an internal ``pyctype.h`` provides " "locale-independent equivalents like :c:macro:`!Py_TOLOWER`." msgstr "" -#: ../../library/locale.rst:515 +#: ../../library/locale.rst:505 msgid "" "Locale category for sorting strings. The functions :func:`strcoll` and :" "func:`strxfrm` of the :mod:`locale` module are affected." msgstr "" -#: ../../library/locale.rst:521 +#: ../../library/locale.rst:511 msgid "" "Locale category for the formatting of time. The function :func:`time." "strftime` follows these conventions." msgstr "" -#: ../../library/locale.rst:527 +#: ../../library/locale.rst:517 msgid "" "Locale category for formatting of monetary values. The available options " "are available from the :func:`localeconv` function." msgstr "" -#: ../../library/locale.rst:533 +#: ../../library/locale.rst:523 msgid "" "Locale category for message display. Python currently does not support " "application specific locale-aware messages. Messages displayed by the " @@ -730,13 +720,13 @@ msgid "" "affected by this category." msgstr "" -#: ../../library/locale.rst:538 +#: ../../library/locale.rst:528 msgid "" "This value may not be available on operating systems not conforming to the " "POSIX standard, most notably Windows." msgstr "" -#: ../../library/locale.rst:544 +#: ../../library/locale.rst:534 msgid "" "Locale category for formatting numbers. The functions :func:" "`format_string`, :func:`atoi`, :func:`atof` and :func:`.str` of the :mod:" @@ -744,7 +734,7 @@ msgid "" "operations are not affected." msgstr "" -#: ../../library/locale.rst:552 +#: ../../library/locale.rst:542 msgid "" "Combination of all locale settings. If this flag is used when the locale is " "changed, setting the locale for all categories is attempted. If that fails " @@ -754,17 +744,17 @@ msgid "" "settings." msgstr "" -#: ../../library/locale.rst:561 +#: ../../library/locale.rst:551 msgid "" "This is a symbolic constant used for different values returned by :func:" "`localeconv`." msgstr "" -#: ../../library/locale.rst:565 +#: ../../library/locale.rst:555 msgid "Example::" msgstr "範例: ::" -#: ../../library/locale.rst:567 +#: ../../library/locale.rst:557 msgid "" ">>> import locale\n" ">>> loc = locale.getlocale() # get current locale\n" @@ -777,11 +767,11 @@ msgid "" ">>> locale.setlocale(locale.LC_ALL, loc) # restore saved locale" msgstr "" -#: ../../library/locale.rst:578 +#: ../../library/locale.rst:568 msgid "Background, details, hints, tips and caveats" msgstr "" -#: ../../library/locale.rst:580 +#: ../../library/locale.rst:570 msgid "" "The C standard defines the locale as a program-wide property that may be " "relatively expensive to change. On top of that, some implementations are " @@ -789,7 +779,7 @@ msgid "" "This makes the locale somewhat painful to use correctly." msgstr "" -#: ../../library/locale.rst:585 +#: ../../library/locale.rst:575 msgid "" "Initially, when a program is started, the locale is the ``C`` locale, no " "matter what the user's preferred locale is. There is one exception: the :" @@ -799,7 +789,7 @@ msgid "" "categories by calling ``setlocale(LC_ALL, '')``." msgstr "" -#: ../../library/locale.rst:592 +#: ../../library/locale.rst:582 msgid "" "It is generally a bad idea to call :func:`setlocale` in some library " "routine, since as a side effect it affects the entire program. Saving and " @@ -807,7 +797,7 @@ msgid "" "that happen to run before the settings have been restored." msgstr "" -#: ../../library/locale.rst:597 +#: ../../library/locale.rst:587 msgid "" "If, when coding a module for general use, you need a locale independent " "version of an operation that is affected by the locale (such as certain " @@ -818,14 +808,14 @@ msgid "" "settings." msgstr "" -#: ../../library/locale.rst:604 +#: ../../library/locale.rst:594 msgid "" "The only way to perform numeric operations according to the locale is to use " "the special functions defined by this module: :func:`atof`, :func:`atoi`, :" "func:`format_string`, :func:`.str`." msgstr "" -#: ../../library/locale.rst:608 +#: ../../library/locale.rst:598 msgid "" "There is no way to perform case conversions and character classifications " "according to the locale. For (Unicode) text strings these are done " @@ -836,11 +826,11 @@ msgid "" "whitespace." msgstr "" -#: ../../library/locale.rst:619 +#: ../../library/locale.rst:609 msgid "For extension writers and programs that embed Python" msgstr "" -#: ../../library/locale.rst:621 +#: ../../library/locale.rst:611 msgid "" "Extension modules should never call :func:`setlocale`, except to find out " "what the current locale is. But since the return value can only be used " @@ -848,7 +838,7 @@ msgid "" "whether or not the locale is ``C``)." msgstr "" -#: ../../library/locale.rst:626 +#: ../../library/locale.rst:616 msgid "" "When Python code uses the :mod:`locale` module to change the locale, this " "also affects the embedding application. If the embedding application " @@ -858,11 +848,11 @@ msgid "" "accessible as a shared library." msgstr "" -#: ../../library/locale.rst:637 +#: ../../library/locale.rst:627 msgid "Access to message catalogs" msgstr "" -#: ../../library/locale.rst:646 +#: ../../library/locale.rst:636 msgid "" "The locale module exposes the C library's gettext interface on systems that " "provide this interface. It consists of the functions :func:`gettext`, :func:" @@ -873,7 +863,7 @@ msgid "" "locating message catalogs." msgstr "" -#: ../../library/locale.rst:653 +#: ../../library/locale.rst:643 msgid "" "Python applications should normally find no need to invoke these functions, " "and should use :mod:`gettext` instead. A known exception to this rule are " diff --git a/library/logging.config.po b/library/logging.config.po index f4eb6e8a94..018f87b9aa 100644 --- a/library/logging.config.po +++ b/library/logging.config.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -984,12 +984,13 @@ msgid "" "``subject`` value could be accessed using either ``'cfg://handlers.email." "subject'`` or, equivalently, ``'cfg://handlers.email[subject]'``. The " "latter form only needs to be used if the key contains spaces or non-" -"alphanumeric characters. If an index value consists only of decimal digits, " +"alphanumeric characters. Please note that the characters ``[`` and ``]`` are " +"not allowed in the keys. If an index value consists only of decimal digits, " "access will be attempted using the corresponding integer value, falling back " "to the string value if needed." msgstr "" -#: ../../library/logging.config.rst:693 +#: ../../library/logging.config.rst:694 msgid "" "Given a string ``cfg://handlers.myhandler.mykey.123``, this will resolve to " "``config_dict['handlers']['myhandler']['mykey']['123']``. If the string is " @@ -999,11 +1000,11 @@ msgid "" "['mykey']['123']`` if that fails." msgstr "" -#: ../../library/logging.config.rst:705 +#: ../../library/logging.config.rst:706 msgid "Import resolution and custom importers" msgstr "" -#: ../../library/logging.config.rst:707 +#: ../../library/logging.config.rst:708 msgid "" "Import resolution, by default, uses the builtin :func:`__import__` function " "to do its importing. You may want to replace this with your own importing " @@ -1015,7 +1016,7 @@ msgid "" "instance level, you need to wrap it with :func:`staticmethod`. For example::" msgstr "" -#: ../../library/logging.config.rst:717 +#: ../../library/logging.config.rst:718 msgid "" "from importlib import import_module\n" "from logging.config import BaseConfigurator\n" @@ -1027,17 +1028,17 @@ msgstr "" "\n" "BaseConfigurator.importer = staticmethod(import_module)" -#: ../../library/logging.config.rst:722 +#: ../../library/logging.config.rst:723 msgid "" "You don't need to wrap with :func:`staticmethod` if you're setting the " "import callable on a configurator *instance*." msgstr "" -#: ../../library/logging.config.rst:728 +#: ../../library/logging.config.rst:729 msgid "Configuring QueueHandler and QueueListener" msgstr "" -#: ../../library/logging.config.rst:730 +#: ../../library/logging.config.rst:731 msgid "" "If you want to configure a :class:`~logging.handlers.QueueHandler`, noting " "that this is normally used in conjunction with a :class:`~logging.handlers." @@ -1050,7 +1051,7 @@ msgid "" "the example YAML snippet below." msgstr "" -#: ../../library/logging.config.rst:739 +#: ../../library/logging.config.rst:740 msgid "" "handlers:\n" " qhand:\n" @@ -1072,17 +1073,17 @@ msgstr "" " - hand_name_2\n" " ..." -#: ../../library/logging.config.rst:751 +#: ../../library/logging.config.rst:752 msgid "The ``queue`` and ``listener`` keys are optional." msgstr "" -#: ../../library/logging.config.rst:753 +#: ../../library/logging.config.rst:754 msgid "" "If the ``queue`` key is present, the corresponding value can be one of the " "following:" msgstr "" -#: ../../library/logging.config.rst:755 +#: ../../library/logging.config.rst:756 msgid "" "An object implementing the :class:`queue.Queue` public API. For instance, " "this may be an actual instance of :class:`queue.Queue` or a subclass " @@ -1090,13 +1091,13 @@ msgid "" "Queue`." msgstr "" -#: ../../library/logging.config.rst:759 +#: ../../library/logging.config.rst:760 msgid "" "This is of course only possible if you are constructing or modifying the " "configuration dictionary in code." msgstr "" -#: ../../library/logging.config.rst:762 +#: ../../library/logging.config.rst:763 msgid "" "A string that resolves to a callable which, when called with no arguments, " "returns the :class:`queue.Queue` instance to use. That callable could be a :" @@ -1104,39 +1105,39 @@ msgid "" "instance, such as ``my.module.queue_factory()``." msgstr "" -#: ../../library/logging.config.rst:767 +#: ../../library/logging.config.rst:768 msgid "" "A dict with a ``'()'`` key which is constructed in the usual way as " "discussed in :ref:`logging-config-dict-userdef`. The result of this " "construction should be a :class:`queue.Queue` instance." msgstr "" -#: ../../library/logging.config.rst:771 +#: ../../library/logging.config.rst:772 msgid "" "If the ``queue`` key is absent, a standard unbounded :class:`queue.Queue` " "instance is created and used." msgstr "" -#: ../../library/logging.config.rst:774 +#: ../../library/logging.config.rst:775 msgid "" "If the ``listener`` key is present, the corresponding value can be one of " "the following:" msgstr "" -#: ../../library/logging.config.rst:776 +#: ../../library/logging.config.rst:777 msgid "" "A subclass of :class:`logging.handlers.QueueListener`. This is of course " "only possible if you are constructing or modifying the configuration " "dictionary in code." msgstr "" -#: ../../library/logging.config.rst:780 +#: ../../library/logging.config.rst:781 msgid "" "A string which resolves to a class which is a subclass of ``QueueListener``, " "such as ``'my.package.CustomListener'``." msgstr "" -#: ../../library/logging.config.rst:783 +#: ../../library/logging.config.rst:784 msgid "" "A dict with a ``'()'`` key which is constructed in the usual way as " "discussed in :ref:`logging-config-dict-userdef`. The result of this " @@ -1144,31 +1145,31 @@ msgid "" "``QueueListener`` initializer." msgstr "" -#: ../../library/logging.config.rst:787 +#: ../../library/logging.config.rst:788 msgid "" "If the ``listener`` key is absent, :class:`logging.handlers.QueueListener` " "is used." msgstr "" -#: ../../library/logging.config.rst:789 +#: ../../library/logging.config.rst:790 msgid "" "The values under the ``handlers`` key are the names of other handlers in the " "configuration (not shown in the above snippet) which will be passed to the " "queue listener." msgstr "" -#: ../../library/logging.config.rst:793 +#: ../../library/logging.config.rst:794 msgid "" "Any custom queue handler and listener classes will need to be defined with " "the same initialization signatures as :class:`~logging.handlers." "QueueHandler` and :class:`~logging.handlers.QueueListener`." msgstr "" -#: ../../library/logging.config.rst:802 +#: ../../library/logging.config.rst:803 msgid "Configuration file format" msgstr "" -#: ../../library/logging.config.rst:804 +#: ../../library/logging.config.rst:805 msgid "" "The configuration file format understood by :func:`fileConfig` is based on :" "mod:`configparser` functionality. The file must contain sections called " @@ -1185,7 +1186,7 @@ msgid "" "specified in a section called ``[logger_root]``." msgstr "" -#: ../../library/logging.config.rst:819 +#: ../../library/logging.config.rst:820 msgid "" "The :func:`fileConfig` API is older than the :func:`dictConfig` API and does " "not provide functionality to cover certain aspects of logging. For example, " @@ -1198,11 +1199,11 @@ msgid "" "when it's convenient to do so." msgstr "" -#: ../../library/logging.config.rst:829 +#: ../../library/logging.config.rst:830 msgid "Examples of these sections in the file are given below." msgstr "" -#: ../../library/logging.config.rst:831 +#: ../../library/logging.config.rst:832 msgid "" "[loggers]\n" "keys=root,log02,log03,log04,log05,log06,log07\n" @@ -1222,13 +1223,13 @@ msgstr "" "[formatters]\n" "keys=form01,form02,form03,form04,form05,form06,form07,form08,form09" -#: ../../library/logging.config.rst:842 +#: ../../library/logging.config.rst:843 msgid "" "The root logger must specify a level and a list of handlers. An example of a " "root logger section is given below." msgstr "" -#: ../../library/logging.config.rst:845 +#: ../../library/logging.config.rst:846 msgid "" "[logger_root]\n" "level=NOTSET\n" @@ -1238,7 +1239,7 @@ msgstr "" "level=NOTSET\n" "handlers=hand01" -#: ../../library/logging.config.rst:851 +#: ../../library/logging.config.rst:852 msgid "" "The ``level`` entry can be one of ``DEBUG, INFO, WARNING, ERROR, CRITICAL`` " "or ``NOTSET``. For the root logger only, ``NOTSET`` means that all messages " @@ -1246,7 +1247,7 @@ msgid "" "of the ``logging`` package's namespace." msgstr "" -#: ../../library/logging.config.rst:856 +#: ../../library/logging.config.rst:857 msgid "" "The ``handlers`` entry is a comma-separated list of handler names, which " "must appear in the ``[handlers]`` section. These names must appear in the " @@ -1254,13 +1255,13 @@ msgid "" "file." msgstr "" -#: ../../library/logging.config.rst:861 +#: ../../library/logging.config.rst:862 msgid "" "For loggers other than the root logger, some additional information is " "required. This is illustrated by the following example." msgstr "" -#: ../../library/logging.config.rst:864 +#: ../../library/logging.config.rst:865 msgid "" "[logger_parser]\n" "level=DEBUG\n" @@ -1274,7 +1275,7 @@ msgstr "" "propagate=1\n" "qualname=compiler.parser" -#: ../../library/logging.config.rst:872 +#: ../../library/logging.config.rst:873 msgid "" "The ``level`` and ``handlers`` entries are interpreted as for the root " "logger, except that if a non-root logger's level is specified as ``NOTSET``, " @@ -1287,13 +1288,13 @@ msgid "" "application to get the logger." msgstr "" -#: ../../library/logging.config.rst:881 +#: ../../library/logging.config.rst:882 msgid "" "Sections which specify handler configuration are exemplified by the " "following." msgstr "" -#: ../../library/logging.config.rst:883 +#: ../../library/logging.config.rst:884 msgid "" "[handler_hand01]\n" "class=StreamHandler\n" @@ -1307,14 +1308,14 @@ msgstr "" "formatter=form01\n" "args=(sys.stdout,)" -#: ../../library/logging.config.rst:891 +#: ../../library/logging.config.rst:892 msgid "" "The ``class`` entry indicates the handler's class (as determined by :func:" "`eval` in the ``logging`` package's namespace). The ``level`` is interpreted " "as for loggers, and ``NOTSET`` is taken to mean 'log everything'." msgstr "" -#: ../../library/logging.config.rst:895 +#: ../../library/logging.config.rst:896 msgid "" "The ``formatter`` entry indicates the key name of the formatter for this " "handler. If blank, a default formatter (``logging._defaultFormatter``) is " @@ -1322,7 +1323,7 @@ msgid "" "and have a corresponding section in the configuration file." msgstr "" -#: ../../library/logging.config.rst:900 +#: ../../library/logging.config.rst:901 msgid "" "The ``args`` entry, when :ref:`evaluated ` in the context of the " "``logging`` package's namespace, is the list of arguments to the constructor " @@ -1331,7 +1332,7 @@ msgid "" "provided, it defaults to ``()``." msgstr "" -#: ../../library/logging.config.rst:906 +#: ../../library/logging.config.rst:907 msgid "" "The optional ``kwargs`` entry, when :ref:`evaluated ` in the " "context of the ``logging`` package's namespace, is the keyword argument dict " @@ -1339,7 +1340,7 @@ msgid "" "``{}``." msgstr "" -#: ../../library/logging.config.rst:910 +#: ../../library/logging.config.rst:911 msgid "" "[handler_hand02]\n" "class=FileHandler\n" @@ -1447,12 +1448,12 @@ msgstr "" "args=('localhost:9022', '/log', 'GET')\n" "kwargs={'secure': True}" -#: ../../library/logging.config.rst:963 +#: ../../library/logging.config.rst:964 msgid "" "Sections which specify formatter configuration are typified by the following." msgstr "" -#: ../../library/logging.config.rst:965 +#: ../../library/logging.config.rst:966 msgid "" "[formatter_form01]\n" "format=F1 %(asctime)s %(levelname)s %(message)s %(customfield)s\n" @@ -1470,21 +1471,21 @@ msgstr "" "defaults={'customfield': 'defaultvalue'}\n" "class=logging.Formatter" -#: ../../library/logging.config.rst:975 +#: ../../library/logging.config.rst:976 msgid "" "The arguments for the formatter configuration are the same as the keys in " "the dictionary schema :ref:`formatters section `." msgstr "" -#: ../../library/logging.config.rst:979 +#: ../../library/logging.config.rst:980 msgid "" "The ``defaults`` entry, when :ref:`evaluated ` in the context of " "the ``logging`` package's namespace, is a dictionary of default values for " "custom formatting fields. If not provided, it defaults to ``None``." msgstr "" -#: ../../library/logging.config.rst:986 +#: ../../library/logging.config.rst:987 msgid "" "Due to the use of :func:`eval` as described above, there are potential " "security risks which result from using the :func:`listen` to send and " @@ -1493,18 +1494,18 @@ msgid "" "`listen` documentation for more information." msgstr "" -#: ../../library/logging.config.rst:994 +#: ../../library/logging.config.rst:995 msgid "Module :mod:`logging`" msgstr ":mod:`logging` 模組" -#: ../../library/logging.config.rst:995 +#: ../../library/logging.config.rst:996 msgid "API reference for the logging module." msgstr "" -#: ../../library/logging.config.rst:997 +#: ../../library/logging.config.rst:998 msgid "Module :mod:`logging.handlers`" msgstr ":mod:`logging.handlers` 模組" -#: ../../library/logging.config.rst:998 +#: ../../library/logging.config.rst:999 msgid "Useful handlers included with the logging module." msgstr "" diff --git a/library/logging.handlers.po b/library/logging.handlers.po index 1294781f56..c735ab982e 100644 --- a/library/logging.handlers.po +++ b/library/logging.handlers.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" diff --git a/library/logging.po b/library/logging.po index 2f1dc52536..8bfdaea17d 100644 --- a/library/logging.po +++ b/library/logging.po @@ -5,9 +5,9 @@ # Andy Dai , 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-09 14:12+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-03-28 22:40+0800\n" "Last-Translator: RockLeon \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -346,7 +346,7 @@ msgid "" "level." msgstr "" -#: ../../library/logging.rst:211 ../../library/logging.rst:554 +#: ../../library/logging.rst:211 ../../library/logging.rst:555 msgid "See :ref:`levels` for a list of levels." msgstr "層級清單請見 :ref:`levels`。" @@ -464,13 +464,13 @@ msgstr "" #: ../../library/logging.rst:306 msgid "" "The fourth keyword argument is *extra* which can be used to pass a " -"dictionary which is used to populate the __dict__ of the :class:`LogRecord` " -"created for the logging event with user-defined attributes. These custom " -"attributes can then be used as you like. For example, they could be " -"incorporated into logged messages. For example::" +"dictionary which is used to populate the :attr:`~object.__dict__` of the :" +"class:`LogRecord` created for the logging event with user-defined " +"attributes. These custom attributes can then be used as you like. For " +"example, they could be incorporated into logged messages. For example::" msgstr "" -#: ../../library/logging.rst:312 +#: ../../library/logging.rst:313 msgid "" "FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'\n" "logging.basicConfig(format=FORMAT)\n" @@ -484,24 +484,24 @@ msgstr "" "logger = logging.getLogger('tcpserver')\n" "logger.warning('Protocol problem: %s', 'connection reset', extra=d)" -#: ../../library/logging.rst:318 +#: ../../library/logging.rst:319 msgid "would print something like" msgstr "" -#: ../../library/logging.rst:320 +#: ../../library/logging.rst:321 msgid "" "2006-02-08 22:20:02,165 192.168.0.1 fbloggs Protocol problem: connection " "reset" msgstr "" -#: ../../library/logging.rst:324 +#: ../../library/logging.rst:325 msgid "" "The keys in the dictionary passed in *extra* should not clash with the keys " "used by the logging system. (See the section on :ref:`logrecord-attributes` " "for more information on which keys are used by the logging system.)" msgstr "" -#: ../../library/logging.rst:328 +#: ../../library/logging.rst:329 msgid "" "If you choose to use these attributes in logged messages, you need to " "exercise some care. In the above example, for instance, the :class:" @@ -512,7 +512,7 @@ msgid "" "dictionary with these keys." msgstr "" -#: ../../library/logging.rst:335 +#: ../../library/logging.rst:336 msgid "" "While this might be annoying, this feature is intended for use in " "specialized circumstances, such as multi-threaded servers where the same " @@ -523,32 +523,32 @@ msgid "" "particular :class:`Handler`\\ s." msgstr "" -#: ../../library/logging.rst:342 +#: ../../library/logging.rst:343 msgid "" "If no handler is attached to this logger (or any of its ancestors, taking " "into account the relevant :attr:`Logger.propagate` attributes), the message " "will be sent to the handler set on :attr:`lastResort`." msgstr "" -#: ../../library/logging.rst:346 +#: ../../library/logging.rst:347 msgid "The *stack_info* parameter was added." msgstr "新增 *stack_info* 參數。" -#: ../../library/logging.rst:349 +#: ../../library/logging.rst:350 msgid "The *exc_info* parameter can now accept exception instances." msgstr "" -#: ../../library/logging.rst:352 +#: ../../library/logging.rst:353 msgid "The *stacklevel* parameter was added." msgstr "新增 *stacklevel* 參數。" -#: ../../library/logging.rst:358 +#: ../../library/logging.rst:359 msgid "" "Logs a message with level :const:`INFO` on this logger. The arguments are " "interpreted as for :meth:`debug`." msgstr "" -#: ../../library/logging.rst:364 +#: ../../library/logging.rst:365 msgid "" "Logs a message with level :const:`WARNING` on this logger. The arguments are " "interpreted as for :meth:`debug`." @@ -556,47 +556,47 @@ msgstr "" "在此記錄器上記錄一條層級為 :const:`WARNING` 的訊息。這些引數被直譯的方式與 :" "meth:`debug` 相同。" -#: ../../library/logging.rst:367 +#: ../../library/logging.rst:368 msgid "" "There is an obsolete method ``warn`` which is functionally identical to " "``warning``. As ``warn`` is deprecated, please do not use it - use " "``warning`` instead." msgstr "" -#: ../../library/logging.rst:373 +#: ../../library/logging.rst:374 msgid "" "Logs a message with level :const:`ERROR` on this logger. The arguments are " "interpreted as for :meth:`debug`." msgstr "" -#: ../../library/logging.rst:379 +#: ../../library/logging.rst:380 msgid "" "Logs a message with level :const:`CRITICAL` on this logger. The arguments " "are interpreted as for :meth:`debug`." msgstr "" -#: ../../library/logging.rst:385 +#: ../../library/logging.rst:386 msgid "" "Logs a message with integer level *level* on this logger. The other " "arguments are interpreted as for :meth:`debug`." msgstr "" -#: ../../library/logging.rst:391 +#: ../../library/logging.rst:392 msgid "" "Logs a message with level :const:`ERROR` on this logger. The arguments are " "interpreted as for :meth:`debug`. Exception info is added to the logging " "message. This method should only be called from an exception handler." msgstr "" -#: ../../library/logging.rst:398 +#: ../../library/logging.rst:399 msgid "Adds the specified filter *filter* to this logger." msgstr "在該 logger 內增加指定的 filter *filter*。" -#: ../../library/logging.rst:403 +#: ../../library/logging.rst:404 msgid "Removes the specified filter *filter* from this logger." msgstr "在該 logger 內移除指定的 filter *filter*。" -#: ../../library/logging.rst:408 +#: ../../library/logging.rst:409 msgid "" "Apply this logger's filters to the record and return ``True`` if the record " "is to be processed. The filters are consulted in turn, until one of them " @@ -605,22 +605,22 @@ msgid "" "processing of the record occurs." msgstr "" -#: ../../library/logging.rst:417 +#: ../../library/logging.rst:418 msgid "Adds the specified handler *hdlr* to this logger." msgstr "" -#: ../../library/logging.rst:422 +#: ../../library/logging.rst:423 msgid "Removes the specified handler *hdlr* from this logger." msgstr "" -#: ../../library/logging.rst:427 +#: ../../library/logging.rst:428 msgid "" "Finds the caller's source filename and line number. Returns the filename, " "line number, function name and stack information as a 4-element tuple. The " "stack information is returned as ``None`` unless *stack_info* is ``True``." msgstr "" -#: ../../library/logging.rst:431 +#: ../../library/logging.rst:432 msgid "" "The *stacklevel* parameter is passed from code calling the :meth:`debug` and " "other APIs. If greater than 1, the excess is used to skip stack frames " @@ -630,7 +630,7 @@ msgid "" "calls it." msgstr "" -#: ../../library/logging.rst:441 +#: ../../library/logging.rst:442 msgid "" "Handles a record by passing it to all handlers associated with this logger " "and its ancestors (until a false value of *propagate* is found). This method " @@ -639,13 +639,13 @@ msgid "" "filter`." msgstr "" -#: ../../library/logging.rst:449 +#: ../../library/logging.rst:450 msgid "" "This is a factory method which can be overridden in subclasses to create " "specialized :class:`LogRecord` instances." msgstr "" -#: ../../library/logging.rst:454 +#: ../../library/logging.rst:455 msgid "" "Checks to see if this logger has any handlers configured. This is done by " "looking for handlers in this logger and its parents in the logger hierarchy. " @@ -655,15 +655,15 @@ msgid "" "the existence of handlers." msgstr "" -#: ../../library/logging.rst:463 +#: ../../library/logging.rst:464 msgid "Loggers can now be pickled and unpickled." msgstr "" -#: ../../library/logging.rst:469 +#: ../../library/logging.rst:470 msgid "Logging Levels" msgstr "" -#: ../../library/logging.rst:471 +#: ../../library/logging.rst:472 msgid "" "The numeric values of logging levels are given in the following table. These " "are primarily of interest if you want to define your own levels, and need " @@ -672,83 +672,83 @@ msgid "" "value; the predefined name is lost." msgstr "" -#: ../../library/logging.rst:478 +#: ../../library/logging.rst:479 msgid "Level" msgstr "" -#: ../../library/logging.rst:478 +#: ../../library/logging.rst:479 msgid "Numeric value" msgstr "" -#: ../../library/logging.rst:478 +#: ../../library/logging.rst:479 msgid "What it means / When to use it" msgstr "" -#: ../../library/logging.rst:480 +#: ../../library/logging.rst:481 msgid "0" msgstr "0" -#: ../../library/logging.rst:480 +#: ../../library/logging.rst:481 msgid "" "When set on a logger, indicates that ancestor loggers are to be consulted to " "determine the effective level. If that still resolves to :const:`!NOTSET`, " "then all events are logged. When set on a handler, all events are handled." msgstr "" -#: ../../library/logging.rst:488 +#: ../../library/logging.rst:489 msgid "10" msgstr "10" -#: ../../library/logging.rst:488 +#: ../../library/logging.rst:489 msgid "" "Detailed information, typically only of interest to a developer trying to " "diagnose a problem." msgstr "" -#: ../../library/logging.rst:492 +#: ../../library/logging.rst:493 msgid "20" msgstr "20" -#: ../../library/logging.rst:492 +#: ../../library/logging.rst:493 msgid "Confirmation that things are working as expected." msgstr "" -#: ../../library/logging.rst:495 +#: ../../library/logging.rst:496 msgid "30" msgstr "30" -#: ../../library/logging.rst:495 +#: ../../library/logging.rst:496 msgid "" "An indication that something unexpected happened, or that a problem might " "occur in the near future (e.g. 'disk space low'). The software is still " "working as expected." msgstr "" -#: ../../library/logging.rst:502 +#: ../../library/logging.rst:503 msgid "40" msgstr "40" -#: ../../library/logging.rst:502 +#: ../../library/logging.rst:503 msgid "" "Due to a more serious problem, the software has not been able to perform " "some function." msgstr "" -#: ../../library/logging.rst:506 +#: ../../library/logging.rst:507 msgid "50" msgstr "50" -#: ../../library/logging.rst:506 +#: ../../library/logging.rst:507 msgid "" "A serious error, indicating that the program itself may be unable to " "continue running." msgstr "" -#: ../../library/logging.rst:515 +#: ../../library/logging.rst:516 msgid "Handler Objects" msgstr "" -#: ../../library/logging.rst:517 +#: ../../library/logging.rst:518 msgid "" "Handlers have the following attributes and methods. Note that :class:" "`Handler` is never instantiated directly; this class acts as a base for more " @@ -756,53 +756,53 @@ msgid "" "to call :meth:`Handler.__init__`." msgstr "" -#: ../../library/logging.rst:526 +#: ../../library/logging.rst:527 msgid "" "Initializes the :class:`Handler` instance by setting its level, setting the " "list of filters to the empty list and creating a lock (using :meth:" "`createLock`) for serializing access to an I/O mechanism." msgstr "" -#: ../../library/logging.rst:533 +#: ../../library/logging.rst:534 msgid "" "Initializes a thread lock which can be used to serialize access to " "underlying I/O functionality which may not be threadsafe." msgstr "" -#: ../../library/logging.rst:539 +#: ../../library/logging.rst:540 msgid "Acquires the thread lock created with :meth:`createLock`." msgstr "" -#: ../../library/logging.rst:544 +#: ../../library/logging.rst:545 msgid "Releases the thread lock acquired with :meth:`acquire`." msgstr "" -#: ../../library/logging.rst:549 +#: ../../library/logging.rst:550 msgid "" "Sets the threshold for this handler to *level*. Logging messages which are " "less severe than *level* will be ignored. When a handler is created, the " "level is set to :const:`NOTSET` (which causes all messages to be processed)." msgstr "" -#: ../../library/logging.rst:556 +#: ../../library/logging.rst:557 msgid "" "The *level* parameter now accepts a string representation of the level such " "as 'INFO' as an alternative to the integer constants such as :const:`INFO`." msgstr "" -#: ../../library/logging.rst:564 +#: ../../library/logging.rst:565 msgid "Sets the :class:`Formatter` for this handler to *fmt*." msgstr "" -#: ../../library/logging.rst:569 +#: ../../library/logging.rst:570 msgid "Adds the specified filter *filter* to this handler." msgstr "" -#: ../../library/logging.rst:574 +#: ../../library/logging.rst:575 msgid "Removes the specified filter *filter* from this handler." msgstr "" -#: ../../library/logging.rst:579 +#: ../../library/logging.rst:580 msgid "" "Apply this handler's filters to the record and return ``True`` if the record " "is to be processed. The filters are consulted in turn, until one of them " @@ -811,13 +811,13 @@ msgid "" "record." msgstr "" -#: ../../library/logging.rst:588 +#: ../../library/logging.rst:589 msgid "" "Ensure all logging output has been flushed. This version does nothing and is " "intended to be implemented by subclasses." msgstr "" -#: ../../library/logging.rst:594 +#: ../../library/logging.rst:595 msgid "" "Tidy up any resources used by the handler. This version does no output but " "removes the handler from an internal list of handlers which is closed when :" @@ -825,14 +825,14 @@ msgid "" "from overridden :meth:`close` methods." msgstr "" -#: ../../library/logging.rst:602 +#: ../../library/logging.rst:603 msgid "" "Conditionally emits the specified logging record, depending on filters which " "may have been added to the handler. Wraps the actual emission of the record " "with acquisition/release of the I/O thread lock." msgstr "" -#: ../../library/logging.rst:609 +#: ../../library/logging.rst:610 msgid "" "This method should be called from handlers when an exception is encountered " "during an :meth:`emit` call. If the module-level attribute :data:" @@ -845,20 +845,20 @@ msgid "" "is more useful during development)." msgstr "" -#: ../../library/logging.rst:622 +#: ../../library/logging.rst:623 msgid "" "Do formatting for a record - if a formatter is set, use it. Otherwise, use " "the default formatter for the module." msgstr "" -#: ../../library/logging.rst:628 +#: ../../library/logging.rst:629 msgid "" "Do whatever it takes to actually log the specified logging record. This " "version is intended to be implemented by subclasses and so raises a :exc:" "`NotImplementedError`." msgstr "" -#: ../../library/logging.rst:632 +#: ../../library/logging.rst:633 msgid "" "This method is called after a handler-level lock is acquired, which is " "released after this method returns. When you override this method, note that " @@ -867,13 +867,13 @@ msgid "" "Specifically:" msgstr "" -#: ../../library/logging.rst:638 +#: ../../library/logging.rst:639 msgid "" "Logging configuration APIs acquire the module-level lock, and then " "individual handler-level locks as those handlers are configured." msgstr "" -#: ../../library/logging.rst:641 +#: ../../library/logging.rst:642 msgid "" "Many logging APIs lock the module-level lock. If such an API is called from " "this method, it could cause a deadlock if a configuration call is made on " @@ -883,16 +883,16 @@ msgid "" "method, the handler-level lock has already been acquired)." msgstr "" -#: ../../library/logging.rst:648 +#: ../../library/logging.rst:649 msgid "" "For a list of handlers included as standard, see :mod:`logging.handlers`." msgstr "" -#: ../../library/logging.rst:653 +#: ../../library/logging.rst:654 msgid "Formatter Objects" msgstr "" -#: ../../library/logging.rst:659 +#: ../../library/logging.rst:660 msgid "" "Responsible for converting a :class:`LogRecord` to an output string to be " "interpreted by a human or external system." @@ -902,7 +902,7 @@ msgstr "" msgid "Parameters" msgstr "" -#: ../../library/logging.rst:662 +#: ../../library/logging.rst:663 msgid "" "A format string in the given *style* for the logged output as a whole. The " "possible mapping keys are drawn from the :class:`LogRecord` object's :ref:" @@ -910,14 +910,14 @@ msgid "" "is just the logged message." msgstr "" -#: ../../library/logging.rst:670 +#: ../../library/logging.rst:671 msgid "" "A format string in the given *style* for the date/time portion of the logged " "output. If not specified, the default described in :meth:`formatTime` is " "used." msgstr "" -#: ../../library/logging.rst:675 +#: ../../library/logging.rst:676 msgid "" "Can be one of ``'%'``, ``'{'`` or ``'$'`` and determines how the format " "string will be merged with its data: using one of :ref:`old-string-" @@ -928,32 +928,32 @@ msgid "" "use ``{``- and ``$``-formatting for log messages." msgstr "" -#: ../../library/logging.rst:685 +#: ../../library/logging.rst:686 msgid "" "If ``True`` (the default), incorrect or mismatched *fmt* and *style* will " "raise a :exc:`ValueError`; for example, ``logging.Formatter('%(asctime)s - " "%(message)s', style='{')``." msgstr "" -#: ../../library/logging.rst:690 +#: ../../library/logging.rst:691 msgid "" "A dictionary with default values to use in custom fields. For example, " "``logging.Formatter('%(ip)s %(message)s', defaults={\"ip\": None})``" msgstr "" -#: ../../library/logging.rst:695 +#: ../../library/logging.rst:696 msgid "Added the *style* parameter." msgstr "新增 *style* 參數。" -#: ../../library/logging.rst:698 +#: ../../library/logging.rst:699 msgid "Added the *validate* parameter." msgstr "新增 *validate* 參數。" -#: ../../library/logging.rst:701 +#: ../../library/logging.rst:702 msgid "Added the *defaults* parameter." msgstr "新增 *defaults* 參數。" -#: ../../library/logging.rst:707 +#: ../../library/logging.rst:708 msgid "" "The record's attribute dictionary is used as the operand to a string " "formatting operation. Returns the resulting string. Before formatting the " @@ -972,13 +972,13 @@ msgid "" "recalculates it afresh." msgstr "" -#: ../../library/logging.rst:723 +#: ../../library/logging.rst:724 msgid "" "If stack information is available, it's appended after the exception " "information, using :meth:`formatStack` to transform it if necessary." msgstr "" -#: ../../library/logging.rst:729 +#: ../../library/logging.rst:730 msgid "" "This method should be called from :meth:`format` by a formatter which wants " "to make use of a formatted time. This method can be overridden in formatters " @@ -991,7 +991,7 @@ msgid "" "resulting string is returned." msgstr "" -#: ../../library/logging.rst:739 +#: ../../library/logging.rst:740 msgid "" "This function uses a user-configurable function to convert the creation time " "to a tuple. By default, :func:`time.localtime` is used; to change this for a " @@ -1001,7 +1001,7 @@ msgid "" "be shown in GMT, set the ``converter`` attribute in the ``Formatter`` class." msgstr "" -#: ../../library/logging.rst:747 +#: ../../library/logging.rst:748 msgid "" "Previously, the default format was hard-coded as in this example: " "``2010-09-06 22:38:15,292`` where the part before the comma is handled by a " @@ -1016,11 +1016,11 @@ msgid "" "the millisecond value)." msgstr "" -#: ../../library/logging.rst:760 +#: ../../library/logging.rst:761 msgid "The ``default_msec_format`` can be ``None``." msgstr "" -#: ../../library/logging.rst:765 +#: ../../library/logging.rst:766 msgid "" "Formats the specified exception information (a standard exception tuple as " "returned by :func:`sys.exc_info`) as a string. This default implementation " @@ -1028,14 +1028,14 @@ msgid "" "returned." msgstr "" -#: ../../library/logging.rst:772 +#: ../../library/logging.rst:773 msgid "" "Formats the specified stack information (a string as returned by :func:" "`traceback.print_stack`, but with the last newline removed) as a string. " "This default implementation just returns the input value." msgstr "" -#: ../../library/logging.rst:778 +#: ../../library/logging.rst:779 msgid "" "A base formatter class suitable for subclassing when you want to format a " "number of records. You can pass a :class:`Formatter` instance which you want " @@ -1044,7 +1044,7 @@ msgid "" "used as the line formatter." msgstr "" -#: ../../library/logging.rst:786 +#: ../../library/logging.rst:787 msgid "" "Return a header for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " @@ -1052,14 +1052,14 @@ msgid "" "separator line." msgstr "" -#: ../../library/logging.rst:793 +#: ../../library/logging.rst:794 msgid "" "Return a footer for a list of *records*. The base implementation just " "returns the empty string. You will need to override this method if you want " "specific behaviour, e.g. to show the count of records or a separator line." msgstr "" -#: ../../library/logging.rst:800 +#: ../../library/logging.rst:801 msgid "" "Return formatted text for a list of *records*. The base implementation just " "returns the empty string if there are no records; otherwise, it returns the " @@ -1067,11 +1067,11 @@ msgid "" "and the footer." msgstr "" -#: ../../library/logging.rst:808 +#: ../../library/logging.rst:809 msgid "Filter Objects" msgstr "" -#: ../../library/logging.rst:810 +#: ../../library/logging.rst:811 msgid "" "``Filters`` can be used by ``Handlers`` and ``Loggers`` for more " "sophisticated filtering than is provided by levels. The base filter class " @@ -1081,7 +1081,7 @@ msgid "" "If initialized with the empty string, all events are passed." msgstr "" -#: ../../library/logging.rst:820 +#: ../../library/logging.rst:821 msgid "" "Returns an instance of the :class:`Filter` class. If *name* is specified, it " "names a logger which, together with its children, will have its events " @@ -1089,7 +1089,7 @@ msgid "" "event." msgstr "" -#: ../../library/logging.rst:827 +#: ../../library/logging.rst:828 msgid "" "Is the specified record to be logged? Returns false for no, true for yes. " "Filters can either modify log records in-place or return a completely " @@ -1097,7 +1097,7 @@ msgid "" "future processing of the event." msgstr "" -#: ../../library/logging.rst:832 +#: ../../library/logging.rst:833 msgid "" "Note that filters attached to handlers are consulted before an event is " "emitted by the handler, whereas filters attached to loggers are consulted " @@ -1107,13 +1107,13 @@ msgid "" "setting, unless the filter has also been applied to those descendant loggers." msgstr "" -#: ../../library/logging.rst:839 +#: ../../library/logging.rst:840 msgid "" "You don't actually need to subclass ``Filter``: you can pass any instance " "which has a ``filter`` method with the same semantics." msgstr "" -#: ../../library/logging.rst:842 +#: ../../library/logging.rst:843 msgid "" "You don't need to create specialized ``Filter`` classes, or use other " "classes with a ``filter`` method: you can use a function (or other callable) " @@ -1124,7 +1124,7 @@ msgid "" "value should conform to that returned by :meth:`~Filter.filter`." msgstr "" -#: ../../library/logging.rst:852 +#: ../../library/logging.rst:853 msgid "" "You can now return a :class:`LogRecord` instance from filters to replace the " "log record rather than modifying it in place. This allows filters attached " @@ -1132,7 +1132,7 @@ msgid "" "having side effects on other handlers." msgstr "" -#: ../../library/logging.rst:858 +#: ../../library/logging.rst:859 msgid "" "Although filters are used primarily to filter records based on more " "sophisticated criteria than levels, they get to see every record which is " @@ -1144,11 +1144,11 @@ msgid "" "contextual information into logs (see :ref:`filters-contextual`)." msgstr "" -#: ../../library/logging.rst:871 +#: ../../library/logging.rst:872 msgid "LogRecord Objects" msgstr "LogRecord 物件" -#: ../../library/logging.rst:873 +#: ../../library/logging.rst:874 msgid "" ":class:`LogRecord` instances are created automatically by the :class:" "`Logger` every time something is logged, and can be created manually via :" @@ -1156,17 +1156,17 @@ msgid "" "wire)." msgstr "" -#: ../../library/logging.rst:881 +#: ../../library/logging.rst:882 msgid "Contains all the information pertinent to the event being logged." msgstr "" -#: ../../library/logging.rst:883 +#: ../../library/logging.rst:884 msgid "" "The primary information is passed in *msg* and *args*, which are combined " "using ``msg % args`` to create the :attr:`!message` attribute of the record." msgstr "" -#: ../../library/logging.rst:887 +#: ../../library/logging.rst:888 msgid "" "The name of the logger used to log the event represented by this :class:`!" "LogRecord`. Note that the logger name in the :class:`!LogRecord` will always " @@ -1174,7 +1174,7 @@ msgid "" "different (ancestor) logger." msgstr "" -#: ../../library/logging.rst:895 +#: ../../library/logging.rst:896 msgid "" "The :ref:`numeric level ` of the logging event (such as ``10`` for " "``DEBUG``, ``20`` for ``INFO``, etc). Note that this is converted to *two* " @@ -1182,46 +1182,46 @@ msgid "" "attr:`!levelname` for the corresponding level name." msgstr "" -#: ../../library/logging.rst:902 +#: ../../library/logging.rst:903 msgid "" "The full string path of the source file where the logging call was made." msgstr "" -#: ../../library/logging.rst:906 +#: ../../library/logging.rst:907 msgid "The line number in the source file where the logging call was made." msgstr "" -#: ../../library/logging.rst:910 +#: ../../library/logging.rst:911 msgid "" "The event description message, which can be a %-format string with " "placeholders for variable data, or an arbitrary object (see :ref:`arbitrary-" "object-messages`)." msgstr "" -#: ../../library/logging.rst:915 +#: ../../library/logging.rst:916 msgid "" "Variable data to merge into the *msg* argument to obtain the event " "description." msgstr "" -#: ../../library/logging.rst:919 +#: ../../library/logging.rst:920 msgid "" "An exception tuple with the current exception information, as returned by :" "func:`sys.exc_info`, or ``None`` if no exception information is available." msgstr "" -#: ../../library/logging.rst:924 +#: ../../library/logging.rst:925 msgid "" "The name of the function or method from which the logging call was invoked." msgstr "" -#: ../../library/logging.rst:928 +#: ../../library/logging.rst:929 msgid "" "A text string representing stack information from the base of the stack in " "the current thread, up to the logging call." msgstr "" -#: ../../library/logging.rst:935 +#: ../../library/logging.rst:936 msgid "" "Returns the message for this :class:`LogRecord` instance after merging any " "user-supplied arguments with the message. If the user-supplied message " @@ -1230,7 +1230,7 @@ msgid "" "whose ``__str__`` method can return the actual format string to be used." msgstr "" -#: ../../library/logging.rst:942 +#: ../../library/logging.rst:943 msgid "" "The creation of a :class:`LogRecord` has been made more configurable by " "providing a factory which is used to create the record. The factory can be " @@ -1238,13 +1238,13 @@ msgid "" "this for the factory's signature)." msgstr "" -#: ../../library/logging.rst:948 +#: ../../library/logging.rst:949 msgid "" "This functionality can be used to inject your own values into a :class:" "`LogRecord` at creation time. You can use the following pattern::" msgstr "" -#: ../../library/logging.rst:951 +#: ../../library/logging.rst:952 msgid "" "old_factory = logging.getLogRecordFactory()\n" "\n" @@ -1264,18 +1264,18 @@ msgstr "" "\n" "logging.setLogRecordFactory(record_factory)" -#: ../../library/logging.rst:960 +#: ../../library/logging.rst:961 msgid "" "With this pattern, multiple factories could be chained, and as long as they " "don't overwrite each other's attributes or unintentionally overwrite the " "standard attributes listed above, there should be no surprises." msgstr "" -#: ../../library/logging.rst:969 +#: ../../library/logging.rst:970 msgid "LogRecord attributes" -msgstr "" +msgstr "LogRecord 屬性" -#: ../../library/logging.rst:971 +#: ../../library/logging.rst:972 msgid "" "The LogRecord has a number of attributes, most of which are derived from the " "parameters to the constructor. (Note that the names do not always correspond " @@ -1286,7 +1286,7 @@ msgid "" "style format string." msgstr "" -#: ../../library/logging.rst:979 +#: ../../library/logging.rst:980 msgid "" "If you are using {}-formatting (:func:`str.format`), you can use ``{attrname}" "`` as the placeholder in the format string. If you are using $-formatting (:" @@ -1294,7 +1294,7 @@ msgid "" "course, replace ``attrname`` with the actual attribute name you want to use." msgstr "" -#: ../../library/logging.rst:985 +#: ../../library/logging.rst:986 msgid "" "In the case of {}-formatting, you can specify formatting flags by placing " "them after the attribute name, separated from it with a colon. For example: " @@ -1303,324 +1303,328 @@ msgid "" "on the options available to you." msgstr "" -#: ../../library/logging.rst:992 +#: ../../library/logging.rst:993 msgid "Attribute name" -msgstr "" +msgstr "屬性名稱" -#: ../../library/logging.rst:992 ../../library/logging.rst:1354 +#: ../../library/logging.rst:993 ../../library/logging.rst:1363 msgid "Format" msgstr "格式" -#: ../../library/logging.rst:992 ../../library/logging.rst:1354 +#: ../../library/logging.rst:993 ../../library/logging.rst:1363 msgid "Description" msgstr "描述" -#: ../../library/logging.rst:0 ../../library/logging.rst:994 +#: ../../library/logging.rst:0 ../../library/logging.rst:995 msgid "args" -msgstr "" +msgstr "args" -#: ../../library/logging.rst:994 ../../library/logging.rst:1008 -#: ../../library/logging.rst:1036 ../../library/logging.rst:1054 +#: ../../library/logging.rst:995 ../../library/logging.rst:1009 +#: ../../library/logging.rst:1037 ../../library/logging.rst:1055 msgid "You shouldn't need to format this yourself." msgstr "你不應該需要自己格式化它。" -#: ../../library/logging.rst:994 +#: ../../library/logging.rst:995 msgid "" "The tuple of arguments merged into ``msg`` to produce ``message``, or a dict " "whose values are used for the merge (when there is only one argument, and it " "is a dictionary)." msgstr "" -#: ../../library/logging.rst:999 +#: ../../library/logging.rst:1000 msgid "asctime" -msgstr "" +msgstr "asctime" -#: ../../library/logging.rst:999 +#: ../../library/logging.rst:1000 msgid "``%(asctime)s``" msgstr "``%(asctime)s``" -#: ../../library/logging.rst:999 +#: ../../library/logging.rst:1000 msgid "" "Human-readable time when the :class:`LogRecord` was created. By default " "this is of the form '2003-07-08 16:49:45,896' (the numbers after the comma " "are millisecond portion of the time)." msgstr "" -#: ../../library/logging.rst:1005 +#: ../../library/logging.rst:1006 msgid "created" -msgstr "" +msgstr "created" -#: ../../library/logging.rst:1005 +#: ../../library/logging.rst:1006 msgid "``%(created)f``" msgstr "``%(created)f``" -#: ../../library/logging.rst:1005 +#: ../../library/logging.rst:1006 msgid "" "Time when the :class:`LogRecord` was created (as returned by :func:`time." -"time`)." +"time_ns` / 1e9)." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1008 +#: ../../library/logging.rst:0 ../../library/logging.rst:1009 msgid "exc_info" msgstr "exc_info" -#: ../../library/logging.rst:1008 +#: ../../library/logging.rst:1009 msgid "" "Exception tuple (à la ``sys.exc_info``) or, if no exception has occurred, " "``None``." msgstr "" -#: ../../library/logging.rst:1011 +#: ../../library/logging.rst:1012 msgid "filename" msgstr "filename" -#: ../../library/logging.rst:1011 +#: ../../library/logging.rst:1012 msgid "``%(filename)s``" msgstr "``%(filename)s``" -#: ../../library/logging.rst:1011 +#: ../../library/logging.rst:1012 msgid "Filename portion of ``pathname``." -msgstr "" +msgstr "``pathname`` 的檔案名稱部分。" -#: ../../library/logging.rst:1013 +#: ../../library/logging.rst:1014 msgid "funcName" -msgstr "" +msgstr "funcName" -#: ../../library/logging.rst:1013 +#: ../../library/logging.rst:1014 msgid "``%(funcName)s``" msgstr "``%(funcName)s``" -#: ../../library/logging.rst:1013 +#: ../../library/logging.rst:1014 msgid "Name of function containing the logging call." msgstr "" -#: ../../library/logging.rst:1015 +#: ../../library/logging.rst:1016 msgid "levelname" -msgstr "" +msgstr "levelname" -#: ../../library/logging.rst:1015 +#: ../../library/logging.rst:1016 msgid "``%(levelname)s``" msgstr "``%(levelname)s``" -#: ../../library/logging.rst:1015 +#: ../../library/logging.rst:1016 msgid "" "Text logging level for the message (``'DEBUG'``, ``'INFO'``, ``'WARNING'``, " "``'ERROR'``, ``'CRITICAL'``)." msgstr "" -#: ../../library/logging.rst:1019 +#: ../../library/logging.rst:1020 msgid "levelno" -msgstr "" +msgstr "levelno" -#: ../../library/logging.rst:1019 +#: ../../library/logging.rst:1020 msgid "``%(levelno)s``" msgstr "``%(levelno)s``" -#: ../../library/logging.rst:1019 +#: ../../library/logging.rst:1020 msgid "" "Numeric logging level for the message (:const:`DEBUG`, :const:`INFO`, :const:" "`WARNING`, :const:`ERROR`, :const:`CRITICAL`)." msgstr "" -#: ../../library/logging.rst:1024 +#: ../../library/logging.rst:1025 msgid "lineno" -msgstr "" +msgstr "lineno" -#: ../../library/logging.rst:1024 +#: ../../library/logging.rst:1025 msgid "``%(lineno)d``" msgstr "``%(lineno)d``" -#: ../../library/logging.rst:1024 +#: ../../library/logging.rst:1025 msgid "Source line number where the logging call was issued (if available)." msgstr "" -#: ../../library/logging.rst:1027 +#: ../../library/logging.rst:1028 msgid "message" -msgstr "" +msgstr "message" -#: ../../library/logging.rst:1027 +#: ../../library/logging.rst:1028 msgid "``%(message)s``" msgstr "``%(message)s``" -#: ../../library/logging.rst:1027 +#: ../../library/logging.rst:1028 msgid "" "The logged message, computed as ``msg % args``. This is set when :meth:" "`Formatter.format` is invoked." msgstr "" -#: ../../library/logging.rst:1031 +#: ../../library/logging.rst:1032 msgid "module" msgstr "模組" -#: ../../library/logging.rst:1031 +#: ../../library/logging.rst:1032 msgid "``%(module)s``" msgstr "``%(module)s``" -#: ../../library/logging.rst:1031 +#: ../../library/logging.rst:1032 msgid "Module (name portion of ``filename``)." -msgstr "" +msgstr "模組(``filename`` 的名稱部分)。" -#: ../../library/logging.rst:1033 +#: ../../library/logging.rst:1034 msgid "msecs" -msgstr "" +msgstr "msecs" -#: ../../library/logging.rst:1033 +#: ../../library/logging.rst:1034 msgid "``%(msecs)d``" msgstr "``%(msecs)d``" -#: ../../library/logging.rst:1033 +#: ../../library/logging.rst:1034 msgid "" "Millisecond portion of the time when the :class:`LogRecord` was created." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1036 +#: ../../library/logging.rst:0 ../../library/logging.rst:1037 msgid "msg" -msgstr "" +msgstr "msg" -#: ../../library/logging.rst:1036 +#: ../../library/logging.rst:1037 msgid "" "The format string passed in the original logging call. Merged with ``args`` " "to produce ``message``, or an arbitrary object (see :ref:`arbitrary-object-" "messages`)." msgstr "" -#: ../../library/logging.rst:0 ../../library/logging.rst:1041 +#: ../../library/logging.rst:0 ../../library/logging.rst:1042 msgid "name" msgstr "name" -#: ../../library/logging.rst:1041 +#: ../../library/logging.rst:1042 msgid "``%(name)s``" msgstr "``%(name)s``" -#: ../../library/logging.rst:1041 +#: ../../library/logging.rst:1042 msgid "Name of the logger used to log the call." msgstr "" -#: ../../library/logging.rst:1043 +#: ../../library/logging.rst:1044 msgid "pathname" -msgstr "" +msgstr "pathname" -#: ../../library/logging.rst:1043 +#: ../../library/logging.rst:1044 msgid "``%(pathname)s``" msgstr "``%(pathname)s``" -#: ../../library/logging.rst:1043 +#: ../../library/logging.rst:1044 msgid "" "Full pathname of the source file where the logging call was issued (if " "available)." msgstr "" -#: ../../library/logging.rst:1046 +#: ../../library/logging.rst:1047 msgid "process" -msgstr "" +msgstr "process" -#: ../../library/logging.rst:1046 +#: ../../library/logging.rst:1047 msgid "``%(process)d``" msgstr "``%(process)d``" -#: ../../library/logging.rst:1046 +#: ../../library/logging.rst:1047 msgid "Process ID (if available)." -msgstr "" +msgstr "行程 ID(如果可用)。" -#: ../../library/logging.rst:1048 +#: ../../library/logging.rst:1049 msgid "processName" -msgstr "" +msgstr "processName" -#: ../../library/logging.rst:1048 +#: ../../library/logging.rst:1049 msgid "``%(processName)s``" msgstr "``%(processName)s``" -#: ../../library/logging.rst:1048 +#: ../../library/logging.rst:1049 msgid "Process name (if available)." -msgstr "" +msgstr "行程名稱(如果可用)。" -#: ../../library/logging.rst:1050 +#: ../../library/logging.rst:1051 msgid "relativeCreated" -msgstr "" +msgstr "relativeCreated" -#: ../../library/logging.rst:1050 +#: ../../library/logging.rst:1051 msgid "``%(relativeCreated)d``" msgstr "``%(relativeCreated)d``" -#: ../../library/logging.rst:1050 +#: ../../library/logging.rst:1051 msgid "" "Time in milliseconds when the LogRecord was created, relative to the time " "the logging module was loaded." msgstr "" -#: ../../library/logging.rst:1054 +#: ../../library/logging.rst:1055 msgid "stack_info" msgstr "stack_info" -#: ../../library/logging.rst:1054 +#: ../../library/logging.rst:1055 msgid "" "Stack frame information (where available) from the bottom of the stack in " "the current thread, up to and including the stack frame of the logging call " "which resulted in the creation of this record." msgstr "" -#: ../../library/logging.rst:1060 +#: ../../library/logging.rst:1061 msgid "thread" -msgstr "" +msgstr "thread" -#: ../../library/logging.rst:1060 +#: ../../library/logging.rst:1061 msgid "``%(thread)d``" msgstr "``%(thread)d``" -#: ../../library/logging.rst:1060 +#: ../../library/logging.rst:1061 msgid "Thread ID (if available)." -msgstr "" +msgstr "執行緒 ID(如果可用)。" -#: ../../library/logging.rst:1062 +#: ../../library/logging.rst:1063 msgid "threadName" -msgstr "" +msgstr "threadName" -#: ../../library/logging.rst:1062 +#: ../../library/logging.rst:1063 msgid "``%(threadName)s``" msgstr "``%(threadName)s``" -#: ../../library/logging.rst:1062 +#: ../../library/logging.rst:1063 msgid "Thread name (if available)." msgstr "" -#: ../../library/logging.rst:1064 +#: ../../library/logging.rst:1065 msgid "taskName" msgstr "taskName" -#: ../../library/logging.rst:1064 +#: ../../library/logging.rst:1065 msgid "``%(taskName)s``" msgstr "``%(taskName)s``" -#: ../../library/logging.rst:1064 +#: ../../library/logging.rst:1065 msgid ":class:`asyncio.Task` name (if available)." msgstr "" -#: ../../library/logging.rst:1067 +#: ../../library/logging.rst:1068 msgid "*processName* was added." msgstr "新增 *processName*。" -#: ../../library/logging.rst:1070 +#: ../../library/logging.rst:1071 msgid "*taskName* was added." msgstr "新增 *taskName*。" -#: ../../library/logging.rst:1076 +#: ../../library/logging.rst:1077 msgid "LoggerAdapter Objects" msgstr "LoggerAdapter 物件" -#: ../../library/logging.rst:1078 +#: ../../library/logging.rst:1079 msgid "" ":class:`LoggerAdapter` instances are used to conveniently pass contextual " "information into logging calls. For a usage example, see the section on :ref:" "`adding contextual information to your logging output `." msgstr "" -#: ../../library/logging.rst:1084 +#: ../../library/logging.rst:1085 msgid "" "Returns an instance of :class:`LoggerAdapter` initialized with an " -"underlying :class:`Logger` instance and a dict-like object." +"underlying :class:`Logger` instance, a dict-like object (*extra*), and a " +"boolean (*merge_extra*) indicating whether or not the *extra* argument of " +"individual log calls should be merged with the :class:`LoggerAdapter` extra. " +"The default behavior is to ignore the *extra* argument of individual log " +"calls and only use the one of the :class:`LoggerAdapter` instance" msgstr "" -#: ../../library/logging.rst:1089 +#: ../../library/logging.rst:1094 msgid "" "Modifies the message and/or keyword arguments passed to a logging call in " "order to insert contextual information. This implementation takes the object " @@ -1629,15 +1633,15 @@ msgid "" "(possibly modified) versions of the arguments passed in." msgstr "" -#: ../../library/logging.rst:1097 +#: ../../library/logging.rst:1102 msgid "Delegates to the underlying :attr:`!manager` on *logger*." msgstr "" -#: ../../library/logging.rst:1101 +#: ../../library/logging.rst:1106 msgid "Delegates to the underlying :meth:`!_log` method on *logger*." msgstr "" -#: ../../library/logging.rst:1103 +#: ../../library/logging.rst:1108 msgid "" "In addition to the above, :class:`LoggerAdapter` supports the following " "methods of :class:`Logger`: :meth:`~Logger.debug`, :meth:`~Logger.info`, :" @@ -1649,24 +1653,28 @@ msgid "" "interchangeably." msgstr "" -#: ../../library/logging.rst:1114 +#: ../../library/logging.rst:1119 msgid "" "The :meth:`~Logger.isEnabledFor`, :meth:`~Logger.getEffectiveLevel`, :meth:" "`~Logger.setLevel` and :meth:`~Logger.hasHandlers` methods were added to :" "class:`LoggerAdapter`. These methods delegate to the underlying logger." msgstr "" -#: ../../library/logging.rst:1120 +#: ../../library/logging.rst:1125 msgid "" "Attribute :attr:`!manager` and method :meth:`!_log` were added, which " "delegate to the underlying logger and allow adapters to be nested." msgstr "" -#: ../../library/logging.rst:1125 +#: ../../library/logging.rst:1130 +msgid "The *merge_extra* argument was added." +msgstr "新增 *merge_extra* 引數。" + +#: ../../library/logging.rst:1134 msgid "Thread Safety" -msgstr "" +msgstr "執行緒安全" -#: ../../library/logging.rst:1127 +#: ../../library/logging.rst:1136 msgid "" "The logging module is intended to be thread-safe without any special work " "needing to be done by its clients. It achieves this though using threading " @@ -1675,7 +1683,7 @@ msgid "" "O." msgstr "" -#: ../../library/logging.rst:1132 +#: ../../library/logging.rst:1141 msgid "" "If you are implementing asynchronous signal handlers using the :mod:`signal` " "module, you may not be able to use logging from within such handlers. This " @@ -1683,17 +1691,17 @@ msgid "" "always re-entrant, and so cannot be invoked from such signal handlers." msgstr "" -#: ../../library/logging.rst:1139 +#: ../../library/logging.rst:1148 msgid "Module-Level Functions" -msgstr "" +msgstr "模組層級函式" -#: ../../library/logging.rst:1141 +#: ../../library/logging.rst:1150 msgid "" "In addition to the classes described above, there are a number of module-" "level functions." msgstr "" -#: ../../library/logging.rst:1147 +#: ../../library/logging.rst:1156 msgid "" "Return a logger with the specified name or, if name is ``None``, return the " "root logger of the hierarchy. If specified, the name is typically a dot-" @@ -1703,14 +1711,14 @@ msgid "" "for not doing that, as mentioned in :ref:`logger`." msgstr "" -#: ../../library/logging.rst:1154 +#: ../../library/logging.rst:1163 msgid "" "All calls to this function with a given name return the same logger " "instance. This means that logger instances never need to be passed between " "different parts of an application." msgstr "" -#: ../../library/logging.rst:1161 +#: ../../library/logging.rst:1170 msgid "" "Return either the standard :class:`Logger` class, or the last class passed " "to :func:`setLoggerClass`. This function may be called from within a new " @@ -1719,43 +1727,45 @@ msgid "" "example::" msgstr "" -#: ../../library/logging.rst:1166 +#: ../../library/logging.rst:1175 msgid "" "class MyLogger(logging.getLoggerClass()):\n" " # ... override behaviour here" msgstr "" +"class MyLogger(logging.getLoggerClass()):\n" +" # ... 在這裡覆蓋其行為" -#: ../../library/logging.rst:1172 +#: ../../library/logging.rst:1181 msgid "Return a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1174 +#: ../../library/logging.rst:1183 msgid "" "This function has been provided, along with :func:`setLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1179 +#: ../../library/logging.rst:1188 msgid "" "See :func:`setLogRecordFactory` for more information about the how the " "factory is called." msgstr "" -#: ../../library/logging.rst:1184 +#: ../../library/logging.rst:1193 msgid "" "This is a convenience function that calls :meth:`Logger.debug`, on the root " "logger. The handling of the arguments is in every way identical to what is " "described in that method." msgstr "" -#: ../../library/logging.rst:1188 +#: ../../library/logging.rst:1197 msgid "" "The only difference is that if the root logger has no handlers, then :func:" "`basicConfig` is called, prior to calling ``debug`` on the root logger." msgstr "" -#: ../../library/logging.rst:1191 +#: ../../library/logging.rst:1200 msgid "" "For very short scripts or quick demonstrations of ``logging`` facilities, " "``debug`` and the other module-level functions may be convenient. However, " @@ -1765,38 +1775,38 @@ msgid "" "described at the beginnning of this documentation." msgstr "" -#: ../../library/logging.rst:1201 +#: ../../library/logging.rst:1210 msgid "" "Logs a message with level :const:`INFO` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1207 +#: ../../library/logging.rst:1216 msgid "" "Logs a message with level :const:`WARNING` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1210 +#: ../../library/logging.rst:1219 msgid "" "There is an obsolete function ``warn`` which is functionally identical to " "``warning``. As ``warn`` is deprecated, please do not use it - use " "``warning`` instead." msgstr "" -#: ../../library/logging.rst:1217 +#: ../../library/logging.rst:1226 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1223 +#: ../../library/logging.rst:1232 msgid "" "Logs a message with level :const:`CRITICAL` on the root logger. The " "arguments and behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1229 +#: ../../library/logging.rst:1238 msgid "" "Logs a message with level :const:`ERROR` on the root logger. The arguments " "and behavior are otherwise the same as for :func:`debug`. Exception info is " @@ -1804,13 +1814,13 @@ msgid "" "exception handler." msgstr "" -#: ../../library/logging.rst:1235 +#: ../../library/logging.rst:1244 msgid "" "Logs a message with level *level* on the root logger. The arguments and " "behavior are otherwise the same as for :func:`debug`." msgstr "" -#: ../../library/logging.rst:1240 +#: ../../library/logging.rst:1249 msgid "" "Provides an overriding level *level* for all loggers which takes precedence " "over the logger's own level. When the need arises to temporarily throttle " @@ -1824,7 +1834,7 @@ msgid "" "individual loggers." msgstr "" -#: ../../library/logging.rst:1251 +#: ../../library/logging.rst:1260 msgid "" "Note that if you have defined any custom logging level higher than " "``CRITICAL`` (this is not recommended), you won't be able to rely on the " @@ -1832,13 +1842,13 @@ msgid "" "a suitable value." msgstr "" -#: ../../library/logging.rst:1256 +#: ../../library/logging.rst:1265 msgid "" "The *level* parameter was defaulted to level ``CRITICAL``. See :issue:" "`28524` for more information about this change." msgstr "" -#: ../../library/logging.rst:1262 +#: ../../library/logging.rst:1271 msgid "" "Associates level *level* with text *levelName* in an internal dictionary, " "which is used to map numeric levels to a textual representation, for example " @@ -1848,24 +1858,24 @@ msgid "" "and they should increase in increasing order of severity." msgstr "" -#: ../../library/logging.rst:1269 +#: ../../library/logging.rst:1278 msgid "" "If you are thinking of defining your own levels, please see the section on :" "ref:`custom-levels`." msgstr "" -#: ../../library/logging.rst:1274 +#: ../../library/logging.rst:1283 msgid "" "Returns a mapping from level names to their corresponding logging levels. " "For example, the string \"CRITICAL\" maps to :const:`CRITICAL`. The returned " "mapping is copied from an internal mapping on each call to this function." msgstr "" -#: ../../library/logging.rst:1282 +#: ../../library/logging.rst:1291 msgid "Returns the textual or numeric representation of logging level *level*." msgstr "" -#: ../../library/logging.rst:1284 +#: ../../library/logging.rst:1293 msgid "" "If *level* is one of the predefined levels :const:`CRITICAL`, :const:" "`ERROR`, :const:`WARNING`, :const:`INFO` or :const:`DEBUG` then you get the " @@ -1875,20 +1885,20 @@ msgid "" "the corresponding string representation is returned." msgstr "" -#: ../../library/logging.rst:1291 +#: ../../library/logging.rst:1300 msgid "" "The *level* parameter also accepts a string representation of the level such " "as 'INFO'. In such cases, this functions returns the corresponding numeric " "value of the level." msgstr "" -#: ../../library/logging.rst:1295 +#: ../../library/logging.rst:1304 msgid "" "If no matching numeric or string value is passed in, the string 'Level %s' % " "level is returned." msgstr "" -#: ../../library/logging.rst:1298 +#: ../../library/logging.rst:1307 msgid "" "Levels are internally integers (as they need to be compared in the logging " "logic). This function is used to convert between an integer level and the " @@ -1897,7 +1907,7 @@ msgid "" "vice versa." msgstr "" -#: ../../library/logging.rst:1304 +#: ../../library/logging.rst:1313 msgid "" "In Python versions earlier than 3.4, this function could also be passed a " "text level, and would return the corresponding numeric value of the level. " @@ -1905,17 +1915,17 @@ msgid "" "Python 3.4, but reinstated in 3.4.2 due to retain backward compatibility." msgstr "" -#: ../../library/logging.rst:1312 +#: ../../library/logging.rst:1321 msgid "" "Returns a handler with the specified *name*, or ``None`` if there is no " "handler with that name." msgstr "" -#: ../../library/logging.rst:1319 +#: ../../library/logging.rst:1328 msgid "Returns an immutable set of all known handler names." msgstr "" -#: ../../library/logging.rst:1325 +#: ../../library/logging.rst:1334 msgid "" "Creates and returns a new :class:`LogRecord` instance whose attributes are " "defined by *attrdict*. This function is useful for taking a pickled :class:" @@ -1923,7 +1933,7 @@ msgid "" "as a :class:`LogRecord` instance at the receiving end." msgstr "" -#: ../../library/logging.rst:1333 +#: ../../library/logging.rst:1342 msgid "" "Does basic configuration for the logging system by creating a :class:" "`StreamHandler` with a default :class:`Formatter` and adding it to the root " @@ -1932,13 +1942,13 @@ msgid "" "no handlers are defined for the root logger." msgstr "" -#: ../../library/logging.rst:1339 +#: ../../library/logging.rst:1348 msgid "" "This function does nothing if the root logger already has handlers " "configured, unless the keyword argument *force* is set to ``True``." msgstr "" -#: ../../library/logging.rst:1342 +#: ../../library/logging.rst:1351 msgid "" "This function should be called from the main thread before other threads are " "started. In versions of Python prior to 2.7.1 and 3.2, if this function is " @@ -1947,54 +1957,54 @@ msgid "" "unexpected results such as messages being duplicated in the log." msgstr "" -#: ../../library/logging.rst:1349 +#: ../../library/logging.rst:1358 msgid "The following keyword arguments are supported." -msgstr "" +msgstr "支援以下的關鍵字引數。" -#: ../../library/logging.rst:1356 +#: ../../library/logging.rst:1365 msgid "*filename*" msgstr "*filename*" -#: ../../library/logging.rst:1356 +#: ../../library/logging.rst:1365 msgid "" "Specifies that a :class:`FileHandler` be created, using the specified " "filename, rather than a :class:`StreamHandler`." msgstr "" -#: ../../library/logging.rst:1360 +#: ../../library/logging.rst:1369 msgid "*filemode*" msgstr "*filemode*" -#: ../../library/logging.rst:1360 +#: ../../library/logging.rst:1369 msgid "" "If *filename* is specified, open the file in this :ref:`mode `. " "Defaults to ``'a'``." msgstr "" -#: ../../library/logging.rst:1364 +#: ../../library/logging.rst:1373 msgid "*format*" msgstr "*format*" -#: ../../library/logging.rst:1364 +#: ../../library/logging.rst:1373 msgid "" "Use the specified format string for the handler. Defaults to attributes " "``levelname``, ``name`` and ``message`` separated by colons." msgstr "" -#: ../../library/logging.rst:1369 +#: ../../library/logging.rst:1378 msgid "*datefmt*" msgstr "*datefmt*" -#: ../../library/logging.rst:1369 +#: ../../library/logging.rst:1378 msgid "" "Use the specified date/time format, as accepted by :func:`time.strftime`." msgstr "" -#: ../../library/logging.rst:1372 +#: ../../library/logging.rst:1381 msgid "*style*" msgstr "*style*" -#: ../../library/logging.rst:1372 +#: ../../library/logging.rst:1381 msgid "" "If *format* is specified, use this style for the format string. One of " "``'%'``, ``'{'`` or ``'$'`` for :ref:`printf-style `." msgstr "" -#: ../../library/logging.rst:1383 +#: ../../library/logging.rst:1392 msgid "*stream*" msgstr "*stream*" -#: ../../library/logging.rst:1383 +#: ../../library/logging.rst:1392 msgid "" "Use the specified stream to initialize the :class:`StreamHandler`. Note that " "this argument is incompatible with *filename* - if both are present, a " "``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1389 +#: ../../library/logging.rst:1398 msgid "*handlers*" msgstr "*handlers*" -#: ../../library/logging.rst:1389 +#: ../../library/logging.rst:1398 msgid "" "If specified, this should be an iterable of already created handlers to add " "to the root logger. Any handlers which don't already have a formatter set " @@ -2034,33 +2044,33 @@ msgid "" "present, a ``ValueError`` is raised." msgstr "" -#: ../../library/logging.rst:1398 +#: ../../library/logging.rst:1407 msgid "*force*" msgstr "*force*" -#: ../../library/logging.rst:1398 +#: ../../library/logging.rst:1407 msgid "" "If this keyword argument is specified as true, any existing handlers " "attached to the root logger are removed and closed, before carrying out the " "configuration as specified by the other arguments." msgstr "" -#: ../../library/logging.rst:1404 +#: ../../library/logging.rst:1413 msgid "*encoding*" msgstr "*encoding*" -#: ../../library/logging.rst:1404 +#: ../../library/logging.rst:1413 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " "the output file." msgstr "" -#: ../../library/logging.rst:1409 +#: ../../library/logging.rst:1418 msgid "*errors*" msgstr "*errors*" -#: ../../library/logging.rst:1409 +#: ../../library/logging.rst:1418 msgid "" "If this keyword argument is specified along with *filename*, its value is " "used when the :class:`FileHandler` is created, and thus used when opening " @@ -2069,39 +2079,39 @@ msgid "" "`open`, which means that it will be treated the same as passing 'errors'." msgstr "" -#: ../../library/logging.rst:1420 +#: ../../library/logging.rst:1429 msgid "The *style* argument was added." msgstr "新增 *style* 引數。" -#: ../../library/logging.rst:1423 +#: ../../library/logging.rst:1432 msgid "" "The *handlers* argument was added. Additional checks were added to catch " "situations where incompatible arguments are specified (e.g. *handlers* " "together with *stream* or *filename*, or *stream* together with *filename*)." msgstr "" -#: ../../library/logging.rst:1429 +#: ../../library/logging.rst:1438 msgid "The *force* argument was added." msgstr "新增 *force* 引數。" -#: ../../library/logging.rst:1432 +#: ../../library/logging.rst:1441 msgid "The *encoding* and *errors* arguments were added." msgstr "新增 *encoding* 與 *errors* 引數。" -#: ../../library/logging.rst:1437 +#: ../../library/logging.rst:1446 msgid "" "Informs the logging system to perform an orderly shutdown by flushing and " "closing all handlers. This should be called at application exit and no " "further use of the logging system should be made after this call." msgstr "" -#: ../../library/logging.rst:1441 +#: ../../library/logging.rst:1450 msgid "" "When the logging module is imported, it registers this function as an exit " "handler (see :mod:`atexit`), so normally there's no need to do that manually." msgstr "" -#: ../../library/logging.rst:1448 +#: ../../library/logging.rst:1457 msgid "" "Tells the logging system to use the class *klass* when instantiating a " "logger. The class should define :meth:`!__init__` such that only a name " @@ -2113,32 +2123,32 @@ msgid "" "loggers." msgstr "" -#: ../../library/logging.rst:1459 +#: ../../library/logging.rst:1468 msgid "Set a callable which is used to create a :class:`LogRecord`." msgstr "" -#: ../../library/logging.rst:1461 +#: ../../library/logging.rst:1470 msgid "The factory callable to be used to instantiate a log record." msgstr "" -#: ../../library/logging.rst:1463 +#: ../../library/logging.rst:1472 msgid "" "This function has been provided, along with :func:`getLogRecordFactory`, to " "allow developers more control over how the :class:`LogRecord` representing a " "logging event is constructed." msgstr "" -#: ../../library/logging.rst:1468 +#: ../../library/logging.rst:1477 msgid "The factory has the following signature:" msgstr "" -#: ../../library/logging.rst:1470 +#: ../../library/logging.rst:1479 msgid "" "``factory(name, level, fn, lno, msg, args, exc_info, func=None, sinfo=None, " "**kwargs)``" msgstr "" -#: ../../library/logging.rst:1472 +#: ../../library/logging.rst:1481 msgid "The logger name." msgstr "" @@ -2146,7 +2156,7 @@ msgstr "" msgid "level" msgstr "" -#: ../../library/logging.rst:1473 +#: ../../library/logging.rst:1482 msgid "The logging level (numeric)." msgstr "" @@ -2154,7 +2164,7 @@ msgstr "" msgid "fn" msgstr "fn" -#: ../../library/logging.rst:1474 +#: ../../library/logging.rst:1483 msgid "The full pathname of the file where the logging call was made." msgstr "" @@ -2162,19 +2172,19 @@ msgstr "" msgid "lno" msgstr "lno" -#: ../../library/logging.rst:1475 +#: ../../library/logging.rst:1484 msgid "The line number in the file where the logging call was made." msgstr "" -#: ../../library/logging.rst:1476 +#: ../../library/logging.rst:1485 msgid "The logging message." msgstr "" -#: ../../library/logging.rst:1477 +#: ../../library/logging.rst:1486 msgid "The arguments for the logging message." msgstr "" -#: ../../library/logging.rst:1478 +#: ../../library/logging.rst:1487 msgid "An exception tuple, or ``None``." msgstr "" @@ -2182,7 +2192,7 @@ msgstr "" msgid "func" msgstr "func" -#: ../../library/logging.rst:1479 +#: ../../library/logging.rst:1488 msgid "The name of the function or method which invoked the logging call." msgstr "" @@ -2190,7 +2200,7 @@ msgstr "" msgid "sinfo" msgstr "sinfo" -#: ../../library/logging.rst:1481 +#: ../../library/logging.rst:1490 msgid "" "A stack traceback such as is provided by :func:`traceback.print_stack`, " "showing the call hierarchy." @@ -2200,15 +2210,15 @@ msgstr "" msgid "kwargs" msgstr "kwargs" -#: ../../library/logging.rst:1483 +#: ../../library/logging.rst:1492 msgid "Additional keyword arguments." msgstr "額外的關鍵字引數。" -#: ../../library/logging.rst:1487 +#: ../../library/logging.rst:1496 msgid "Module-Level Attributes" -msgstr "" +msgstr "模組層級屬性" -#: ../../library/logging.rst:1491 +#: ../../library/logging.rst:1500 msgid "" "A \"handler of last resort\" is available through this attribute. This is a :" "class:`StreamHandler` writing to ``sys.stderr`` with a level of ``WARNING``, " @@ -2219,15 +2229,15 @@ msgid "" "reason, ``lastResort`` can be set to ``None``." msgstr "" -#: ../../library/logging.rst:1503 +#: ../../library/logging.rst:1512 msgid "Used to see if exceptions during handling should be propagated." msgstr "" -#: ../../library/logging.rst:1505 +#: ../../library/logging.rst:1514 msgid "Default: ``True``." msgstr "" -#: ../../library/logging.rst:1507 +#: ../../library/logging.rst:1516 msgid "" "If :data:`raiseExceptions` is ``False``, exceptions get silently ignored. " "This is what is mostly wanted for a logging system - most users will not " @@ -2235,22 +2245,22 @@ msgid "" "application errors." msgstr "" -#: ../../library/logging.rst:1514 +#: ../../library/logging.rst:1523 msgid "Integration with the warnings module" msgstr "" -#: ../../library/logging.rst:1516 +#: ../../library/logging.rst:1525 msgid "" "The :func:`captureWarnings` function can be used to integrate :mod:`logging` " "with the :mod:`warnings` module." msgstr "" -#: ../../library/logging.rst:1521 +#: ../../library/logging.rst:1530 msgid "" "This function is used to turn the capture of warnings by logging on and off." msgstr "" -#: ../../library/logging.rst:1524 +#: ../../library/logging.rst:1533 msgid "" "If *capture* is ``True``, warnings issued by the :mod:`warnings` module will " "be redirected to the logging system. Specifically, a warning will be " @@ -2259,46 +2269,46 @@ msgid "" "`WARNING`." msgstr "" -#: ../../library/logging.rst:1529 +#: ../../library/logging.rst:1538 msgid "" "If *capture* is ``False``, the redirection of warnings to the logging system " "will stop, and warnings will be redirected to their original destinations (i." "e. those in effect before ``captureWarnings(True)`` was called)." msgstr "" -#: ../../library/logging.rst:1536 +#: ../../library/logging.rst:1545 msgid "Module :mod:`logging.config`" -msgstr "" +msgstr ":mod:`logging.config` 模組" -#: ../../library/logging.rst:1537 +#: ../../library/logging.rst:1546 msgid "Configuration API for the logging module." msgstr "" -#: ../../library/logging.rst:1539 +#: ../../library/logging.rst:1548 msgid "Module :mod:`logging.handlers`" -msgstr "" +msgstr ":mod:`logging.handlers` 模組" -#: ../../library/logging.rst:1540 +#: ../../library/logging.rst:1549 msgid "Useful handlers included with the logging module." msgstr "" -#: ../../library/logging.rst:1542 +#: ../../library/logging.rst:1551 msgid ":pep:`282` - A Logging System" msgstr "" -#: ../../library/logging.rst:1543 +#: ../../library/logging.rst:1552 msgid "" "The proposal which described this feature for inclusion in the Python " "standard library." msgstr "" -#: ../../library/logging.rst:1546 +#: ../../library/logging.rst:1555 msgid "" "`Original Python logging package `_" msgstr "" -#: ../../library/logging.rst:1547 +#: ../../library/logging.rst:1556 msgid "" "This is the original source for the :mod:`logging` package. The version of " "the package available from this site is suitable for use with Python 1.5.2, " @@ -2313,6 +2323,3 @@ msgstr "Errors(錯誤)" #: ../../library/logging.rst:12 msgid "logging" msgstr "logging(日誌)" - -#~ msgid "The simplest example:" -#~ msgstr "最簡單的示範:" diff --git a/library/lzma.po b/library/lzma.po index 627058b090..164401e87f 100644 --- a/library/lzma.po +++ b/library/lzma.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -104,7 +104,7 @@ msgstr "" msgid "Added support for the ``\"x\"``, ``\"xb\"`` and ``\"xt\"`` modes." msgstr "新增 ``\"x\"``、``\"xb\"`` 和 ``\"xt\"`` 模式的支援。" -#: ../../library/lzma.rst:68 ../../library/lzma.rst:127 +#: ../../library/lzma.rst:68 ../../library/lzma.rst:141 msgid "Accepts a :term:`path-like object`." msgstr "" @@ -151,7 +151,7 @@ msgid "" msgstr "" #: ../../library/lzma.rst:107 -msgid "The following method is also provided:" +msgid "The following method and attributes are also provided:" msgstr "" #: ../../library/lzma.rst:111 @@ -169,60 +169,70 @@ msgid "" "*filename*)." msgstr "" -#: ../../library/lzma.rst:120 +#: ../../library/lzma.rst:122 +msgid "``'rb'`` for reading and ``'wb'`` for writing." +msgstr "" + +#: ../../library/lzma.rst:128 +msgid "" +"The lzma file name. Equivalent to the :attr:`~io.FileIO.name` attribute of " +"the underlying :term:`file object`." +msgstr "" + +#: ../../library/lzma.rst:134 msgid "Added support for the ``\"x\"`` and ``\"xb\"`` modes." msgstr "新增 ``\"x\"`` 和 ``\"xb\"`` 模式的支援。" -#: ../../library/lzma.rst:123 +#: ../../library/lzma.rst:137 msgid "" "The :meth:`~io.BufferedIOBase.read` method now accepts an argument of " "``None``." msgstr "" -#: ../../library/lzma.rst:132 +#: ../../library/lzma.rst:146 msgid "Compressing and decompressing data in memory" msgstr "" -#: ../../library/lzma.rst:136 +#: ../../library/lzma.rst:150 msgid "" "Create a compressor object, which can be used to compress data incrementally." msgstr "" -#: ../../library/lzma.rst:138 +#: ../../library/lzma.rst:152 msgid "" "For a more convenient way of compressing a single chunk of data, see :func:" "`compress`." msgstr "" -#: ../../library/lzma.rst:141 +#: ../../library/lzma.rst:155 msgid "" "The *format* argument specifies what container format should be used. " "Possible values are:" msgstr "" -#: ../../library/lzma.rst:144 +#: ../../library/lzma.rst:158 msgid ":const:`FORMAT_XZ`: The ``.xz`` container format." msgstr "" -#: ../../library/lzma.rst:145 +#: ../../library/lzma.rst:159 msgid "This is the default format." msgstr "" -#: ../../library/lzma.rst:147 +#: ../../library/lzma.rst:161 msgid ":const:`FORMAT_ALONE`: The legacy ``.lzma`` container format." msgstr "" -#: ../../library/lzma.rst:148 +#: ../../library/lzma.rst:162 msgid "" "This format is more limited than ``.xz`` -- it does not support integrity " "checks or multiple filters." msgstr "" -#: ../../library/lzma.rst:151 +#: ../../library/lzma.rst:165 msgid ":const:`FORMAT_RAW`: A raw data stream, not using any container format." msgstr "" -#: ../../library/lzma.rst:152 +#: ../../library/lzma.rst:166 msgid "" "This format specifier does not support integrity checks, and requires that " "you always specify a custom filter chain (for both compression and " @@ -230,46 +240,46 @@ msgid "" "decompressed using :const:`FORMAT_AUTO` (see :class:`LZMADecompressor`)." msgstr "" -#: ../../library/lzma.rst:157 +#: ../../library/lzma.rst:171 msgid "" "The *check* argument specifies the type of integrity check to include in the " "compressed data. This check is used when decompressing, to ensure that the " "data has not been corrupted. Possible values are:" msgstr "" -#: ../../library/lzma.rst:161 +#: ../../library/lzma.rst:175 msgid "" ":const:`CHECK_NONE`: No integrity check. This is the default (and the only " "acceptable value) for :const:`FORMAT_ALONE` and :const:`FORMAT_RAW`." msgstr "" -#: ../../library/lzma.rst:165 +#: ../../library/lzma.rst:179 msgid ":const:`CHECK_CRC32`: 32-bit Cyclic Redundancy Check." msgstr "" -#: ../../library/lzma.rst:167 +#: ../../library/lzma.rst:181 msgid "" ":const:`CHECK_CRC64`: 64-bit Cyclic Redundancy Check. This is the default " "for :const:`FORMAT_XZ`." msgstr "" -#: ../../library/lzma.rst:170 +#: ../../library/lzma.rst:184 msgid ":const:`CHECK_SHA256`: 256-bit Secure Hash Algorithm." msgstr "" -#: ../../library/lzma.rst:172 +#: ../../library/lzma.rst:186 msgid "" "If the specified check is not supported, an :class:`LZMAError` is raised." msgstr "" -#: ../../library/lzma.rst:174 +#: ../../library/lzma.rst:188 msgid "" "The compression settings can be specified either as a preset compression " "level (with the *preset* argument), or in detail as a custom filter chain " "(with the *filters* argument)." msgstr "" -#: ../../library/lzma.rst:178 +#: ../../library/lzma.rst:192 msgid "" "The *preset* argument (if provided) should be an integer between ``0`` and " "``9`` (inclusive), optionally OR-ed with the constant :const:" @@ -278,7 +288,7 @@ msgid "" "presets produce smaller output, but make the compression process slower." msgstr "" -#: ../../library/lzma.rst:187 +#: ../../library/lzma.rst:201 msgid "" "In addition to being more CPU-intensive, compression with higher presets " "also requires much more memory (and produces output that needs more memory " @@ -287,13 +297,13 @@ msgid "" "generally best to stick with the default preset." msgstr "" -#: ../../library/lzma.rst:193 +#: ../../library/lzma.rst:207 msgid "" "The *filters* argument (if provided) should be a filter chain specifier. " "See :ref:`filter-chain-specs` for details." msgstr "" -#: ../../library/lzma.rst:198 +#: ../../library/lzma.rst:212 msgid "" "Compress *data* (a :class:`bytes` object), returning a :class:`bytes` object " "containing compressed data for at least part of the input. Some of *data* " @@ -302,29 +312,29 @@ msgid "" "any previous calls to :meth:`compress`." msgstr "" -#: ../../library/lzma.rst:206 +#: ../../library/lzma.rst:220 msgid "" "Finish the compression process, returning a :class:`bytes` object containing " "any data stored in the compressor's internal buffers." msgstr "" -#: ../../library/lzma.rst:209 +#: ../../library/lzma.rst:223 msgid "The compressor cannot be used after this method has been called." msgstr "" -#: ../../library/lzma.rst:214 +#: ../../library/lzma.rst:228 msgid "" "Create a decompressor object, which can be used to decompress data " "incrementally." msgstr "" -#: ../../library/lzma.rst:217 +#: ../../library/lzma.rst:231 msgid "" "For a more convenient way of decompressing an entire compressed stream at " "once, see :func:`decompress`." msgstr "" -#: ../../library/lzma.rst:220 +#: ../../library/lzma.rst:234 msgid "" "The *format* argument specifies the container format that should be used. " "The default is :const:`FORMAT_AUTO`, which can decompress both ``.xz`` and " @@ -332,7 +342,7 @@ msgid "" "`FORMAT_ALONE`, and :const:`FORMAT_RAW`." msgstr "" -#: ../../library/lzma.rst:225 +#: ../../library/lzma.rst:239 msgid "" "The *memlimit* argument specifies a limit (in bytes) on the amount of memory " "that the decompressor can use. When this argument is used, decompression " @@ -340,7 +350,7 @@ msgid "" "input within the given memory limit." msgstr "" -#: ../../library/lzma.rst:230 +#: ../../library/lzma.rst:244 msgid "" "The *filters* argument specifies the filter chain that was used to create " "the stream being decompressed. This argument is required if *format* is :" @@ -348,7 +358,7 @@ msgid "" "`filter-chain-specs` for more information about filter chains." msgstr "" -#: ../../library/lzma.rst:236 +#: ../../library/lzma.rst:250 msgid "" "This class does not transparently handle inputs containing multiple " "compressed streams, unlike :func:`decompress` and :class:`LZMAFile`. To " @@ -356,7 +366,7 @@ msgid "" "create a new decompressor for each stream." msgstr "" -#: ../../library/lzma.rst:243 +#: ../../library/lzma.rst:257 msgid "" "Decompress *data* (a :term:`bytes-like object`), returning uncompressed data " "as bytes. Some of *data* may be buffered internally, for use in later calls " @@ -364,7 +374,7 @@ msgid "" "output of any previous calls to :meth:`decompress`." msgstr "" -#: ../../library/lzma.rst:249 +#: ../../library/lzma.rst:263 msgid "" "If *max_length* is nonnegative, returns at most *max_length* bytes of " "decompressed data. If this limit is reached and further output can be " @@ -373,100 +383,100 @@ msgid "" "``b''`` to obtain more of the output." msgstr "" -#: ../../library/lzma.rst:256 +#: ../../library/lzma.rst:270 msgid "" "If all of the input data was decompressed and returned (either because this " "was less than *max_length* bytes, or because *max_length* was negative), " "the :attr:`~.needs_input` attribute will be set to ``True``." msgstr "" -#: ../../library/lzma.rst:261 +#: ../../library/lzma.rst:275 msgid "" "Attempting to decompress data after the end of stream is reached raises an :" "exc:`EOFError`. Any data found after the end of the stream is ignored and " "saved in the :attr:`~.unused_data` attribute." msgstr "" -#: ../../library/lzma.rst:265 +#: ../../library/lzma.rst:279 msgid "Added the *max_length* parameter." msgstr "新增 *max_length* 參數。" -#: ../../library/lzma.rst:270 +#: ../../library/lzma.rst:284 msgid "" "The ID of the integrity check used by the input stream. This may be :const:" "`CHECK_UNKNOWN` until enough of the input has been decoded to determine what " "integrity check it uses." msgstr "" -#: ../../library/lzma.rst:276 +#: ../../library/lzma.rst:290 msgid "``True`` if the end-of-stream marker has been reached." msgstr "" -#: ../../library/lzma.rst:280 +#: ../../library/lzma.rst:294 msgid "Data found after the end of the compressed stream." msgstr "" -#: ../../library/lzma.rst:282 +#: ../../library/lzma.rst:296 msgid "Before the end of the stream is reached, this will be ``b\"\"``." msgstr "" -#: ../../library/lzma.rst:286 +#: ../../library/lzma.rst:300 msgid "" "``False`` if the :meth:`.decompress` method can provide more decompressed " "data before requiring new uncompressed input." msgstr "" -#: ../../library/lzma.rst:293 +#: ../../library/lzma.rst:307 msgid "" "Compress *data* (a :class:`bytes` object), returning the compressed data as " "a :class:`bytes` object." msgstr "" -#: ../../library/lzma.rst:296 +#: ../../library/lzma.rst:310 msgid "" "See :class:`LZMACompressor` above for a description of the *format*, " "*check*, *preset* and *filters* arguments." msgstr "" -#: ../../library/lzma.rst:302 +#: ../../library/lzma.rst:316 msgid "" "Decompress *data* (a :class:`bytes` object), returning the uncompressed data " "as a :class:`bytes` object." msgstr "" -#: ../../library/lzma.rst:305 +#: ../../library/lzma.rst:319 msgid "" "If *data* is the concatenation of multiple distinct compressed streams, " "decompress all of these streams, and return the concatenation of the results." msgstr "" -#: ../../library/lzma.rst:308 +#: ../../library/lzma.rst:322 msgid "" "See :class:`LZMADecompressor` above for a description of the *format*, " "*memlimit* and *filters* arguments." msgstr "" -#: ../../library/lzma.rst:313 +#: ../../library/lzma.rst:327 msgid "Miscellaneous" msgstr "" -#: ../../library/lzma.rst:317 +#: ../../library/lzma.rst:331 msgid "" "Return ``True`` if the given integrity check is supported on this system." msgstr "" -#: ../../library/lzma.rst:319 +#: ../../library/lzma.rst:333 msgid "" ":const:`CHECK_NONE` and :const:`CHECK_CRC32` are always supported. :const:" "`CHECK_CRC64` and :const:`CHECK_SHA256` may be unavailable if you are using " "a version of :program:`liblzma` that was compiled with a limited feature set." msgstr "" -#: ../../library/lzma.rst:328 +#: ../../library/lzma.rst:342 msgid "Specifying custom filter chains" msgstr "" -#: ../../library/lzma.rst:330 +#: ../../library/lzma.rst:344 msgid "" "A filter chain specifier is a sequence of dictionaries, where each " "dictionary contains the ID and options for a single filter. Each dictionary " @@ -474,118 +484,118 @@ msgid "" "filter-dependent options. Valid filter IDs are as follows:" msgstr "" -#: ../../library/lzma.rst:335 +#: ../../library/lzma.rst:349 msgid "Compression filters:" msgstr "" -#: ../../library/lzma.rst:337 +#: ../../library/lzma.rst:351 msgid ":const:`FILTER_LZMA1` (for use with :const:`FORMAT_ALONE`)" msgstr "" -#: ../../library/lzma.rst:338 +#: ../../library/lzma.rst:352 msgid "" ":const:`FILTER_LZMA2` (for use with :const:`FORMAT_XZ` and :const:" "`FORMAT_RAW`)" msgstr "" -#: ../../library/lzma.rst:340 +#: ../../library/lzma.rst:354 msgid "Delta filter:" msgstr "" -#: ../../library/lzma.rst:342 +#: ../../library/lzma.rst:356 msgid ":const:`FILTER_DELTA`" msgstr ":const:`FILTER_DELTA`" -#: ../../library/lzma.rst:344 +#: ../../library/lzma.rst:358 msgid "Branch-Call-Jump (BCJ) filters:" msgstr "" -#: ../../library/lzma.rst:346 +#: ../../library/lzma.rst:360 msgid ":const:`FILTER_X86`" msgstr ":const:`FILTER_X86`" -#: ../../library/lzma.rst:347 +#: ../../library/lzma.rst:361 msgid ":const:`FILTER_IA64`" msgstr ":const:`FILTER_IA64`" -#: ../../library/lzma.rst:348 +#: ../../library/lzma.rst:362 msgid ":const:`FILTER_ARM`" msgstr ":const:`FILTER_ARM`" -#: ../../library/lzma.rst:349 +#: ../../library/lzma.rst:363 msgid ":const:`FILTER_ARMTHUMB`" msgstr ":const:`FILTER_ARMTHUMB`" -#: ../../library/lzma.rst:350 +#: ../../library/lzma.rst:364 msgid ":const:`FILTER_POWERPC`" msgstr ":const:`FILTER_POWERPC`" -#: ../../library/lzma.rst:351 +#: ../../library/lzma.rst:365 msgid ":const:`FILTER_SPARC`" msgstr ":const:`FILTER_SPARC`" -#: ../../library/lzma.rst:353 +#: ../../library/lzma.rst:367 msgid "" "A filter chain can consist of up to 4 filters, and cannot be empty. The last " "filter in the chain must be a compression filter, and any other filters must " "be delta or BCJ filters." msgstr "" -#: ../../library/lzma.rst:357 +#: ../../library/lzma.rst:371 msgid "" "Compression filters support the following options (specified as additional " "entries in the dictionary representing the filter):" msgstr "" -#: ../../library/lzma.rst:360 +#: ../../library/lzma.rst:374 msgid "" "``preset``: A compression preset to use as a source of default values for " "options that are not specified explicitly." msgstr "" -#: ../../library/lzma.rst:362 +#: ../../library/lzma.rst:376 msgid "" "``dict_size``: Dictionary size in bytes. This should be between 4 KiB and " "1.5 GiB (inclusive)." msgstr "" -#: ../../library/lzma.rst:364 +#: ../../library/lzma.rst:378 msgid "``lc``: Number of literal context bits." msgstr "" -#: ../../library/lzma.rst:365 +#: ../../library/lzma.rst:379 msgid "" "``lp``: Number of literal position bits. The sum ``lc + lp`` must be at most " "4." msgstr "" -#: ../../library/lzma.rst:367 +#: ../../library/lzma.rst:381 msgid "``pb``: Number of position bits; must be at most 4." msgstr "" -#: ../../library/lzma.rst:368 +#: ../../library/lzma.rst:382 msgid "``mode``: :const:`MODE_FAST` or :const:`MODE_NORMAL`." msgstr "" -#: ../../library/lzma.rst:369 +#: ../../library/lzma.rst:383 msgid "" "``nice_len``: What should be considered a \"nice length\" for a match. This " "should be 273 or less." msgstr "" -#: ../../library/lzma.rst:371 +#: ../../library/lzma.rst:385 msgid "" "``mf``: What match finder to use -- :const:`MF_HC3`, :const:`MF_HC4`, :const:" "`MF_BT2`, :const:`MF_BT3`, or :const:`MF_BT4`." msgstr "" -#: ../../library/lzma.rst:373 +#: ../../library/lzma.rst:387 msgid "" "``depth``: Maximum search depth used by match finder. 0 (default) means to " "select automatically based on other filter options." msgstr "" -#: ../../library/lzma.rst:376 +#: ../../library/lzma.rst:390 msgid "" "The delta filter stores the differences between bytes, producing more " "repetitive input for the compressor in certain circumstances. It supports " @@ -594,7 +604,7 @@ msgid "" "bytes." msgstr "" -#: ../../library/lzma.rst:381 +#: ../../library/lzma.rst:395 msgid "" "The BCJ filters are intended to be applied to machine code. They convert " "relative branches, calls and jumps in the code to use absolute addressing, " @@ -604,15 +614,15 @@ msgid "" "data. The default is 0." msgstr "" -#: ../../library/lzma.rst:389 +#: ../../library/lzma.rst:403 msgid "Examples" msgstr "範例" -#: ../../library/lzma.rst:391 +#: ../../library/lzma.rst:405 msgid "Reading in a compressed file::" msgstr "" -#: ../../library/lzma.rst:393 +#: ../../library/lzma.rst:407 msgid "" "import lzma\n" "with lzma.open(\"file.xz\") as f:\n" @@ -622,11 +632,11 @@ msgstr "" "with lzma.open(\"file.xz\") as f:\n" " file_content = f.read()" -#: ../../library/lzma.rst:397 +#: ../../library/lzma.rst:411 msgid "Creating a compressed file::" msgstr "" -#: ../../library/lzma.rst:399 +#: ../../library/lzma.rst:413 msgid "" "import lzma\n" "data = b\"Insert Data Here\"\n" @@ -634,11 +644,11 @@ msgid "" " f.write(data)" msgstr "" -#: ../../library/lzma.rst:404 +#: ../../library/lzma.rst:418 msgid "Compressing data in memory::" msgstr "" -#: ../../library/lzma.rst:406 +#: ../../library/lzma.rst:420 msgid "" "import lzma\n" "data_in = b\"Insert Data Here\"\n" @@ -648,11 +658,11 @@ msgstr "" "data_in = b\"Insert Data Here\"\n" "data_out = lzma.compress(data_in)" -#: ../../library/lzma.rst:410 +#: ../../library/lzma.rst:424 msgid "Incremental compression::" msgstr "" -#: ../../library/lzma.rst:412 +#: ../../library/lzma.rst:426 msgid "" "import lzma\n" "lzc = lzma.LZMACompressor()\n" @@ -664,11 +674,11 @@ msgid "" "result = b\"\".join([out1, out2, out3, out4])" msgstr "" -#: ../../library/lzma.rst:421 +#: ../../library/lzma.rst:435 msgid "Writing compressed data to an already-open file::" msgstr "" -#: ../../library/lzma.rst:423 +#: ../../library/lzma.rst:437 msgid "" "import lzma\n" "with open(\"file.xz\", \"wb\") as f:\n" @@ -684,11 +694,11 @@ msgstr "" " lzf.write(b\"This *will* be compressed\\n\")\n" " f.write(b\"Not compressed\\n\")" -#: ../../library/lzma.rst:430 +#: ../../library/lzma.rst:444 msgid "Creating a compressed file using a custom filter chain::" msgstr "" -#: ../../library/lzma.rst:432 +#: ../../library/lzma.rst:446 msgid "" "import lzma\n" "my_filters = [\n" diff --git a/library/mailbox.po b/library/mailbox.po index e547f70c08..5a8a09d14a 100644 --- a/library/mailbox.po +++ b/library/mailbox.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:05+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -417,49 +417,161 @@ msgid "The :attr:`!colon` attribute may also be set on a per-instance basis." msgstr "" #: ../../library/mailbox.rst:367 +msgid ":class:`Maildir` now ignores files with a leading dot." +msgstr "" + +#: ../../library/mailbox.rst:370 msgid "" ":class:`!Maildir` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:373 ../../library/mailbox.rst:545 +#: ../../library/mailbox.rst:376 ../../library/mailbox.rst:654 msgid "Return a list of the names of all folders." msgstr "" -#: ../../library/mailbox.rst:378 +#: ../../library/mailbox.rst:381 msgid "" "Return a :class:`!Maildir` instance representing the folder whose name is " "*folder*. A :exc:`NoSuchMailboxError` exception is raised if the folder does " "not exist." msgstr "" -#: ../../library/mailbox.rst:385 +#: ../../library/mailbox.rst:388 msgid "" "Create a folder whose name is *folder* and return a :class:`!Maildir` " "instance representing it." msgstr "" -#: ../../library/mailbox.rst:391 ../../library/mailbox.rst:563 +#: ../../library/mailbox.rst:394 ../../library/mailbox.rst:672 msgid "" "Delete the folder whose name is *folder*. If the folder contains any " "messages, a :exc:`NotEmptyError` exception will be raised and the folder " "will not be deleted." msgstr "" -#: ../../library/mailbox.rst:398 +#: ../../library/mailbox.rst:401 msgid "" "Delete temporary files from the mailbox that have not been accessed in the " "last 36 hours. The Maildir specification says that mail-reading programs " "should do this occasionally." msgstr "" -#: ../../library/mailbox.rst:402 +#: ../../library/mailbox.rst:408 +msgid "" +"Return as a string the flags that are set on the message corresponding to " +"*key*. This is the same as ``get_message(key).get_flags()`` but much faster, " +"because it does not open the message file. Use this method when iterating " +"over the keys to determine which messages are interesting to get." +msgstr "" + +#: ../../library/mailbox.rst:415 +msgid "" +"If you do have a :class:`MaildirMessage` object, use its :meth:" +"`~MaildirMessage.get_flags` method instead, because changes made by the " +"message's :meth:`~MaildirMessage.set_flags`, :meth:`~MaildirMessage." +"add_flag` and :meth:`~MaildirMessage.remove_flag` methods are not reflected " +"here until the mailbox's :meth:`__setitem__` method is called." +msgstr "" + +#: ../../library/mailbox.rst:427 +msgid "" +"On the message corresponding to *key*, set the flags specified by *flags* " +"and unset all others. Calling ``some_mailbox.set_flags(key, flags)`` is " +"similar to ::" +msgstr "" + +#: ../../library/mailbox.rst:431 +msgid "" +"one_message = some_mailbox.get_message(key)\n" +"one_message.set_flags(flags)\n" +"some_mailbox[key] = one_message" +msgstr "" + +#: ../../library/mailbox.rst:435 ../../library/mailbox.rst:498 +msgid "but faster, because it does not open the message file." +msgstr "" + +#: ../../library/mailbox.rst:437 +msgid "" +"If you do have a :class:`MaildirMessage` object, use its :meth:" +"`~MaildirMessage.set_flags` method instead, because changes made with this " +"mailbox method will not be visible to the message object's method, :meth:" +"`~MaildirMessage.get_flags`." +msgstr "" + +#: ../../library/mailbox.rst:447 +msgid "" +"On the message corresponding to *key*, set the flags specified by *flag* " +"without changing other flags. To add more than one flag at a time, *flag* " +"may be a string of more than one character." +msgstr "" + +#: ../../library/mailbox.rst:451 +msgid "" +"Considerations for using this method versus the message object's :meth:" +"`~MaildirMessage.add_flag` method are similar to those for :meth:" +"`set_flags`; see the discussion there." +msgstr "" + +#: ../../library/mailbox.rst:460 +msgid "" +"On the message corresponding to *key*, unset the flags specified by *flag* " +"without changing other flags. To remove more than one flag at a time, *flag* " +"may be a string of more than one character." +msgstr "" + +#: ../../library/mailbox.rst:464 +msgid "" +"Considerations for using this method versus the message object's :meth:" +"`~MaildirMessage.remove_flag` method are similar to those for :meth:" +"`set_flags`; see the discussion there." +msgstr "" + +#: ../../library/mailbox.rst:473 +msgid "" +"Return a string containing the info for the message corresponding to *key*. " +"This is the same as ``get_message(key).get_info()`` but much faster, because " +"it does not open the message file. Use this method when iterating over the " +"keys to determine which messages are interesting to get." +msgstr "" + +#: ../../library/mailbox.rst:480 +msgid "" +"If you do have a :class:`MaildirMessage` object, use its :meth:" +"`~MaildirMessage.get_info` method instead, because changes made by the " +"message's :meth:`~MaildirMessage.set_info` method are not reflected here " +"until the mailbox's :meth:`__setitem__` method is called." +msgstr "" + +#: ../../library/mailbox.rst:491 +msgid "" +"Set the info of the message corresponding to *key* to *info*. Calling " +"``some_mailbox.set_info(key, flags)`` is similar to ::" +msgstr "" + +#: ../../library/mailbox.rst:494 +msgid "" +"one_message = some_mailbox.get_message(key)\n" +"one_message.set_info(info)\n" +"some_mailbox[key] = one_message" +msgstr "" + +#: ../../library/mailbox.rst:500 +msgid "" +"If you do have a :class:`MaildirMessage` object, use its :meth:" +"`~MaildirMessage.set_info` method instead, because changes made with this " +"mailbox method will not be visible to the message object's method, :meth:" +"`~MaildirMessage.get_info`." +msgstr "" + +#: ../../library/mailbox.rst:507 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!Maildir` deserve " "special remarks:" msgstr "" -#: ../../library/mailbox.rst:412 +#: ../../library/mailbox.rst:517 msgid "" "These methods generate unique file names based upon the current process ID. " "When using multiple threads, undetected name clashes may occur and cause " @@ -467,56 +579,56 @@ msgid "" "these methods to manipulate the same mailbox simultaneously." msgstr "" -#: ../../library/mailbox.rst:420 +#: ../../library/mailbox.rst:525 msgid "" "All changes to Maildir mailboxes are immediately applied, so this method " "does nothing." msgstr "" -#: ../../library/mailbox.rst:427 +#: ../../library/mailbox.rst:532 msgid "" "Maildir mailboxes do not support (or require) locking, so these methods do " "nothing." msgstr "" -#: ../../library/mailbox.rst:433 +#: ../../library/mailbox.rst:538 msgid "" ":class:`!Maildir` instances do not keep any open files and the underlying " "mailboxes do not support locking, so this method does nothing." msgstr "" -#: ../../library/mailbox.rst:439 +#: ../../library/mailbox.rst:544 msgid "" "Depending upon the host platform, it may not be possible to modify or remove " "the underlying message while the returned file remains open." msgstr "" -#: ../../library/mailbox.rst:445 +#: ../../library/mailbox.rst:550 msgid "" "`maildir man page from Courier `_" msgstr "" -#: ../../library/mailbox.rst:446 +#: ../../library/mailbox.rst:551 msgid "" "A specification of the format. Describes a common extension for supporting " "folders." msgstr "" -#: ../../library/mailbox.rst:449 +#: ../../library/mailbox.rst:554 msgid "`Using maildir format `_" msgstr "" -#: ../../library/mailbox.rst:450 +#: ../../library/mailbox.rst:555 msgid "" "Notes on Maildir by its inventor. Includes an updated name-creation scheme " "and details on \"info\" semantics." msgstr "" -#: ../../library/mailbox.rst:457 +#: ../../library/mailbox.rst:562 msgid ":class:`!mbox` objects" msgstr ":class:`!mbox` 物件" -#: ../../library/mailbox.rst:462 +#: ../../library/mailbox.rst:567 msgid "" "A subclass of :class:`Mailbox` for mailboxes in mbox format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -526,7 +638,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:469 +#: ../../library/mailbox.rst:574 msgid "" "The mbox format is the classic format for storing mail on Unix systems. All " "messages in an mbox mailbox are stored in a single file with the beginning " @@ -534,7 +646,7 @@ msgid "" "\"." msgstr "" -#: ../../library/mailbox.rst:473 +#: ../../library/mailbox.rst:578 msgid "" "Several variations of the mbox format exist to address perceived " "shortcomings in the original. In the interest of compatibility, :class:`!" @@ -546,61 +658,61 @@ msgid "" "when reading the message." msgstr "" -#: ../../library/mailbox.rst:481 +#: ../../library/mailbox.rst:586 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!mbox` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:487 +#: ../../library/mailbox.rst:592 msgid "" "Using the file after calling :meth:`~Mailbox.flush` or :meth:`~Mailbox." "close` on the :class:`!mbox` instance may yield unpredictable results or " "raise an exception." msgstr "" -#: ../../library/mailbox.rst:495 ../../library/mailbox.rst:704 -#: ../../library/mailbox.rst:755 +#: ../../library/mailbox.rst:600 ../../library/mailbox.rst:813 +#: ../../library/mailbox.rst:864 msgid "" "Three locking mechanisms are used---dot locking and, if available, the :c:" "func:`!flock` and :c:func:`!lockf` system calls." msgstr "" -#: ../../library/mailbox.rst:501 +#: ../../library/mailbox.rst:606 msgid "" "`mbox man page from tin `_" msgstr "" -#: ../../library/mailbox.rst:502 +#: ../../library/mailbox.rst:607 msgid "A specification of the format, with details on locking." msgstr "" -#: ../../library/mailbox.rst:504 +#: ../../library/mailbox.rst:609 msgid "" "`Configuring Netscape Mail on Unix: Why The Content-Length Format is Bad " "`_" msgstr "" -#: ../../library/mailbox.rst:505 +#: ../../library/mailbox.rst:610 msgid "An argument for using the original mbox format rather than a variation." msgstr "" -#: ../../library/mailbox.rst:507 +#: ../../library/mailbox.rst:612 msgid "" "`\"mbox\" is a family of several mutually incompatible mailbox formats " "`_" msgstr "" -#: ../../library/mailbox.rst:508 +#: ../../library/mailbox.rst:613 msgid "A history of mbox variations." msgstr "" -#: ../../library/mailbox.rst:514 +#: ../../library/mailbox.rst:619 msgid ":class:`!MH` objects" msgstr ":class:`!MH` 物件" -#: ../../library/mailbox.rst:519 +#: ../../library/mailbox.rst:624 msgid "" "A subclass of :class:`Mailbox` for mailboxes in MH format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -610,7 +722,7 @@ msgid "" "is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:526 +#: ../../library/mailbox.rst:631 msgid "" "MH is a directory-based mailbox format invented for the MH Message Handling " "System, a mail user agent. Each message in an MH mailbox resides in its own " @@ -621,7 +733,7 @@ msgid "" "called :file:`.mh_sequences` in each folder." msgstr "" -#: ../../library/mailbox.rst:534 +#: ../../library/mailbox.rst:639 msgid "" "The :class:`!MH` class manipulates MH mailboxes, but it does not attempt to " "emulate all of :program:`mh`'s behaviors. In particular, it does not modify " @@ -629,63 +741,67 @@ msgid "" "are used by :program:`mh` to store its state and configuration." msgstr "" -#: ../../library/mailbox.rst:539 +#: ../../library/mailbox.rst:644 msgid "" ":class:`!MH` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:550 +#: ../../library/mailbox.rst:649 +msgid "Supported folders that don't contain a :file:`.mh_sequences` file." +msgstr "" + +#: ../../library/mailbox.rst:659 msgid "" "Return an :class:`!MH` instance representing the folder whose name is " "*folder*. A :exc:`NoSuchMailboxError` exception is raised if the folder does " "not exist." msgstr "" -#: ../../library/mailbox.rst:557 +#: ../../library/mailbox.rst:666 msgid "" "Create a folder whose name is *folder* and return an :class:`!MH` instance " "representing it." msgstr "" -#: ../../library/mailbox.rst:570 +#: ../../library/mailbox.rst:679 msgid "" "Return a dictionary of sequence names mapped to key lists. If there are no " "sequences, the empty dictionary is returned." msgstr "" -#: ../../library/mailbox.rst:576 +#: ../../library/mailbox.rst:685 msgid "" "Re-define the sequences that exist in the mailbox based upon *sequences*, a " "dictionary of names mapped to key lists, like returned by :meth:" "`get_sequences`." msgstr "" -#: ../../library/mailbox.rst:583 +#: ../../library/mailbox.rst:692 msgid "" "Rename messages in the mailbox as necessary to eliminate gaps in numbering. " "Entries in the sequences list are updated correspondingly." msgstr "" -#: ../../library/mailbox.rst:588 +#: ../../library/mailbox.rst:697 msgid "" "Already-issued keys are invalidated by this operation and should not be " "subsequently used." msgstr "" -#: ../../library/mailbox.rst:591 +#: ../../library/mailbox.rst:700 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!MH` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:599 +#: ../../library/mailbox.rst:708 msgid "" "These methods immediately delete the message. The MH convention of marking a " "message for deletion by prepending a comma to its name is not used." msgstr "" -#: ../../library/mailbox.rst:606 +#: ../../library/mailbox.rst:715 msgid "" "Three locking mechanisms are used---dot locking and, if available, the :c:" "func:`!flock` and :c:func:`!lockf` system calls. For MH mailboxes, locking " @@ -694,51 +810,51 @@ msgid "" "files." msgstr "" -#: ../../library/mailbox.rst:615 +#: ../../library/mailbox.rst:724 msgid "" "Depending upon the host platform, it may not be possible to remove the " "underlying message while the returned file remains open." msgstr "" -#: ../../library/mailbox.rst:621 +#: ../../library/mailbox.rst:730 msgid "" "All changes to MH mailboxes are immediately applied, so this method does " "nothing." msgstr "" -#: ../../library/mailbox.rst:627 +#: ../../library/mailbox.rst:736 msgid "" ":class:`!MH` instances do not keep any open files, so this method is " "equivalent to :meth:`unlock`." msgstr "" -#: ../../library/mailbox.rst:633 +#: ../../library/mailbox.rst:742 msgid "`nmh - Message Handling System `_" msgstr "" -#: ../../library/mailbox.rst:634 +#: ../../library/mailbox.rst:743 msgid "" "Home page of :program:`nmh`, an updated version of the original :program:" "`mh`." msgstr "" -#: ../../library/mailbox.rst:636 +#: ../../library/mailbox.rst:745 msgid "" "`MH & nmh: Email for Users & Programmers `_" msgstr "" -#: ../../library/mailbox.rst:637 +#: ../../library/mailbox.rst:746 msgid "" "A GPL-licensed book on :program:`mh` and :program:`nmh`, with some " "information on the mailbox format." msgstr "" -#: ../../library/mailbox.rst:644 +#: ../../library/mailbox.rst:753 msgid ":class:`!Babyl` objects" msgstr ":class:`!Babyl` 物件" -#: ../../library/mailbox.rst:649 +#: ../../library/mailbox.rst:758 msgid "" "A subclass of :class:`Mailbox` for mailboxes in Babyl format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -748,7 +864,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:656 +#: ../../library/mailbox.rst:765 msgid "" "Babyl is a single-file mailbox format used by the Rmail mail user agent " "included with Emacs. The beginning of a message is indicated by a line " @@ -758,7 +874,7 @@ msgid "" "Underscore (``'\\037'``) character." msgstr "" -#: ../../library/mailbox.rst:663 +#: ../../library/mailbox.rst:772 msgid "" "Messages in a Babyl mailbox have two sets of headers, original headers and " "so-called visible headers. Visible headers are typically a subset of the " @@ -769,31 +885,31 @@ msgid "" "in the Babyl options section." msgstr "" -#: ../../library/mailbox.rst:671 +#: ../../library/mailbox.rst:780 msgid "" ":class:`!Babyl` instances have all of the methods of :class:`Mailbox` in " "addition to the following:" msgstr "" -#: ../../library/mailbox.rst:677 +#: ../../library/mailbox.rst:786 msgid "" "Return a list of the names of all user-defined labels used in the mailbox." msgstr "" -#: ../../library/mailbox.rst:681 +#: ../../library/mailbox.rst:790 msgid "" "The actual messages are inspected to determine which labels exist in the " "mailbox rather than consulting the list of labels in the Babyl options " "section, but the Babyl section is updated whenever the mailbox is modified." msgstr "" -#: ../../library/mailbox.rst:686 +#: ../../library/mailbox.rst:795 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!Babyl` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:692 +#: ../../library/mailbox.rst:801 msgid "" "In Babyl mailboxes, the headers of a message are not stored contiguously " "with the body of the message. To generate a file-like representation, the " @@ -803,30 +919,30 @@ msgid "" "memory compared to a string representation." msgstr "" -#: ../../library/mailbox.rst:710 +#: ../../library/mailbox.rst:819 msgid "" "`Format of Version 5 Babyl Files `_" msgstr "" -#: ../../library/mailbox.rst:711 +#: ../../library/mailbox.rst:820 msgid "A specification of the Babyl format." msgstr "" -#: ../../library/mailbox.rst:713 +#: ../../library/mailbox.rst:822 msgid "" "`Reading Mail with Rmail `_" msgstr "" -#: ../../library/mailbox.rst:714 +#: ../../library/mailbox.rst:823 msgid "The Rmail manual, with some information on Babyl semantics." msgstr "" -#: ../../library/mailbox.rst:720 +#: ../../library/mailbox.rst:829 msgid ":class:`!MMDF` objects" msgstr ":class:`!MMDF` 物件" -#: ../../library/mailbox.rst:725 +#: ../../library/mailbox.rst:834 msgid "" "A subclass of :class:`Mailbox` for mailboxes in MMDF format. Parameter " "*factory* is a callable object that accepts a file-like message " @@ -836,7 +952,7 @@ msgid "" "mailbox is created if it does not exist." msgstr "" -#: ../../library/mailbox.rst:732 +#: ../../library/mailbox.rst:841 msgid "" "MMDF is a single-file mailbox format invented for the Multichannel " "Memorandum Distribution Facility, a mail transfer agent. Each message is in " @@ -849,52 +965,52 @@ msgid "" "subsequent messages." msgstr "" -#: ../../library/mailbox.rst:741 +#: ../../library/mailbox.rst:850 msgid "" "Some :class:`Mailbox` methods implemented by :class:`!MMDF` deserve special " "remarks:" msgstr "" -#: ../../library/mailbox.rst:747 +#: ../../library/mailbox.rst:856 msgid "" "Using the file after calling :meth:`~Mailbox.flush` or :meth:`~Mailbox." "close` on the :class:`!MMDF` instance may yield unpredictable results or " "raise an exception." msgstr "" -#: ../../library/mailbox.rst:761 +#: ../../library/mailbox.rst:870 msgid "" "`mmdf man page from tin `_" msgstr "" -#: ../../library/mailbox.rst:762 +#: ../../library/mailbox.rst:871 msgid "" "A specification of MMDF format from the documentation of tin, a newsreader." msgstr "" -#: ../../library/mailbox.rst:764 +#: ../../library/mailbox.rst:873 msgid "`MMDF `_" msgstr "`MMDF `_" -#: ../../library/mailbox.rst:765 +#: ../../library/mailbox.rst:874 msgid "" "A Wikipedia article describing the Multichannel Memorandum Distribution " "Facility." msgstr "" -#: ../../library/mailbox.rst:772 +#: ../../library/mailbox.rst:881 msgid ":class:`!Message` objects" msgstr ":class:`!Message` 物件" -#: ../../library/mailbox.rst:777 +#: ../../library/mailbox.rst:886 msgid "" "A subclass of the :mod:`email.message` module's :class:`~email.message." "Message`. Subclasses of :class:`!mailbox.Message` add mailbox-format-" "specific state and behavior." msgstr "" -#: ../../library/mailbox.rst:781 +#: ../../library/mailbox.rst:890 msgid "" "If *message* is omitted, the new instance is created in a default, empty " "state. If *message* is an :class:`email.message.Message` instance, its " @@ -906,7 +1022,7 @@ msgid "" "compatibility." msgstr "" -#: ../../library/mailbox.rst:790 +#: ../../library/mailbox.rst:899 msgid "" "The format-specific state and behaviors offered by subclasses vary, but in " "general it is only the properties that are not specific to a particular " @@ -918,7 +1034,7 @@ msgid "" "important is retained, because it applies to the message itself." msgstr "" -#: ../../library/mailbox.rst:799 +#: ../../library/mailbox.rst:908 msgid "" "There is no requirement that :class:`!Message` instances be used to " "represent messages retrieved using :class:`Mailbox` instances. In some " @@ -929,17 +1045,17 @@ msgid "" "initialized." msgstr "" -#: ../../library/mailbox.rst:810 +#: ../../library/mailbox.rst:919 msgid ":class:`!MaildirMessage` objects" msgstr ":class:`!MaildirMessage` 物件" -#: ../../library/mailbox.rst:815 +#: ../../library/mailbox.rst:924 msgid "" "A message with Maildir-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:818 +#: ../../library/mailbox.rst:927 msgid "" "Typically, a mail user agent application moves all of the messages in the :" "file:`new` subdirectory to the :file:`cur` subdirectory after the first time " @@ -953,128 +1069,128 @@ msgid "" "flags for Maildir messages are as follows:" msgstr "" -#: ../../library/mailbox.rst:830 ../../library/mailbox.rst:997 -#: ../../library/mailbox.rst:1368 +#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 +#: ../../library/mailbox.rst:1477 msgid "Flag" msgstr "" -#: ../../library/mailbox.rst:830 ../../library/mailbox.rst:997 -#: ../../library/mailbox.rst:1368 +#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 +#: ../../library/mailbox.rst:1477 msgid "Meaning" msgstr "含義" -#: ../../library/mailbox.rst:830 ../../library/mailbox.rst:997 -#: ../../library/mailbox.rst:1148 ../../library/mailbox.rst:1235 -#: ../../library/mailbox.rst:1368 +#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1106 +#: ../../library/mailbox.rst:1257 ../../library/mailbox.rst:1344 +#: ../../library/mailbox.rst:1477 msgid "Explanation" msgstr "" -#: ../../library/mailbox.rst:832 ../../library/mailbox.rst:1003 -#: ../../library/mailbox.rst:1374 +#: ../../library/mailbox.rst:941 ../../library/mailbox.rst:1112 +#: ../../library/mailbox.rst:1483 msgid "D" msgstr "D" -#: ../../library/mailbox.rst:832 +#: ../../library/mailbox.rst:941 msgid "Draft" msgstr "" -#: ../../library/mailbox.rst:832 +#: ../../library/mailbox.rst:941 msgid "Under composition" msgstr "" -#: ../../library/mailbox.rst:834 ../../library/mailbox.rst:1005 -#: ../../library/mailbox.rst:1376 +#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 +#: ../../library/mailbox.rst:1485 msgid "F" msgstr "F" -#: ../../library/mailbox.rst:834 ../../library/mailbox.rst:1005 -#: ../../library/mailbox.rst:1376 +#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 +#: ../../library/mailbox.rst:1485 msgid "Flagged" msgstr "" -#: ../../library/mailbox.rst:834 ../../library/mailbox.rst:1005 -#: ../../library/mailbox.rst:1154 ../../library/mailbox.rst:1376 +#: ../../library/mailbox.rst:943 ../../library/mailbox.rst:1114 +#: ../../library/mailbox.rst:1263 ../../library/mailbox.rst:1485 msgid "Marked as important" msgstr "" -#: ../../library/mailbox.rst:836 +#: ../../library/mailbox.rst:945 msgid "P" msgstr "P" -#: ../../library/mailbox.rst:836 +#: ../../library/mailbox.rst:945 msgid "Passed" msgstr "" -#: ../../library/mailbox.rst:836 +#: ../../library/mailbox.rst:945 msgid "Forwarded, resent, or bounced" msgstr "" -#: ../../library/mailbox.rst:838 ../../library/mailbox.rst:999 -#: ../../library/mailbox.rst:1370 +#: ../../library/mailbox.rst:947 ../../library/mailbox.rst:1108 +#: ../../library/mailbox.rst:1479 msgid "R" msgstr "R" -#: ../../library/mailbox.rst:838 +#: ../../library/mailbox.rst:947 msgid "Replied" msgstr "" -#: ../../library/mailbox.rst:838 ../../library/mailbox.rst:1007 -#: ../../library/mailbox.rst:1152 ../../library/mailbox.rst:1243 -#: ../../library/mailbox.rst:1378 +#: ../../library/mailbox.rst:947 ../../library/mailbox.rst:1116 +#: ../../library/mailbox.rst:1261 ../../library/mailbox.rst:1352 +#: ../../library/mailbox.rst:1487 msgid "Replied to" msgstr "" -#: ../../library/mailbox.rst:840 +#: ../../library/mailbox.rst:949 msgid "S" msgstr "S" -#: ../../library/mailbox.rst:840 +#: ../../library/mailbox.rst:949 msgid "Seen" msgstr "" -#: ../../library/mailbox.rst:840 ../../library/mailbox.rst:999 -#: ../../library/mailbox.rst:1370 +#: ../../library/mailbox.rst:949 ../../library/mailbox.rst:1108 +#: ../../library/mailbox.rst:1479 msgid "Read" msgstr "" -#: ../../library/mailbox.rst:842 +#: ../../library/mailbox.rst:951 msgid "T" msgstr "T" -#: ../../library/mailbox.rst:842 +#: ../../library/mailbox.rst:951 msgid "Trashed" msgstr "" -#: ../../library/mailbox.rst:842 ../../library/mailbox.rst:1003 -#: ../../library/mailbox.rst:1239 ../../library/mailbox.rst:1374 +#: ../../library/mailbox.rst:951 ../../library/mailbox.rst:1112 +#: ../../library/mailbox.rst:1348 ../../library/mailbox.rst:1483 msgid "Marked for subsequent deletion" msgstr "" -#: ../../library/mailbox.rst:845 +#: ../../library/mailbox.rst:954 msgid ":class:`!MaildirMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:850 +#: ../../library/mailbox.rst:959 msgid "" "Return either \"new\" (if the message should be stored in the :file:`new` " "subdirectory) or \"cur\" (if the message should be stored in the :file:`cur` " "subdirectory)." msgstr "" -#: ../../library/mailbox.rst:856 +#: ../../library/mailbox.rst:965 msgid "" "A message is typically moved from :file:`new` to :file:`cur` after its " -"mailbox has been accessed, whether or not the message is has been read. A " +"mailbox has been accessed, whether or not the message has been read. A " "message ``msg`` has been read if ``\"S\" in msg.get_flags()`` is ``True``." msgstr "" -#: ../../library/mailbox.rst:864 +#: ../../library/mailbox.rst:973 msgid "" "Set the subdirectory the message should be stored in. Parameter *subdir* " "must be either \"new\" or \"cur\"." msgstr "" -#: ../../library/mailbox.rst:870 +#: ../../library/mailbox.rst:979 msgid "" "Return a string specifying the flags that are currently set. If the message " "complies with the standard Maildir format, the result is the concatenation " @@ -1083,11 +1199,11 @@ msgid "" "flags are set or if \"info\" contains experimental semantics." msgstr "" -#: ../../library/mailbox.rst:880 +#: ../../library/mailbox.rst:989 msgid "Set the flags specified by *flags* and unset all others." msgstr "" -#: ../../library/mailbox.rst:885 +#: ../../library/mailbox.rst:994 msgid "" "Set the flag(s) specified by *flag* without changing other flags. To add " "more than one flag at a time, *flag* may be a string of more than one " @@ -1095,7 +1211,7 @@ msgid "" "experimental information rather than flags." msgstr "" -#: ../../library/mailbox.rst:893 +#: ../../library/mailbox.rst:1002 msgid "" "Unset the flag(s) specified by *flag* without changing other flags. To " "remove more than one flag at a time, *flag* maybe a string of more than one " @@ -1103,30 +1219,30 @@ msgid "" "the current \"info\" is not modified." msgstr "" -#: ../../library/mailbox.rst:901 +#: ../../library/mailbox.rst:1010 msgid "" "Return the delivery date of the message as a floating-point number " "representing seconds since the epoch." msgstr "" -#: ../../library/mailbox.rst:907 +#: ../../library/mailbox.rst:1016 msgid "" "Set the delivery date of the message to *date*, a floating-point number " "representing seconds since the epoch." msgstr "" -#: ../../library/mailbox.rst:913 +#: ../../library/mailbox.rst:1022 msgid "" "Return a string containing the \"info\" for a message. This is useful for " "accessing and modifying \"info\" that is experimental (i.e., not a list of " "flags)." msgstr "" -#: ../../library/mailbox.rst:920 +#: ../../library/mailbox.rst:1029 msgid "Set \"info\" to *info*, which should be a string." msgstr "" -#: ../../library/mailbox.rst:922 +#: ../../library/mailbox.rst:1031 msgid "" "When a :class:`!MaildirMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1134,176 +1250,176 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:928 ../../library/mailbox.rst:946 -#: ../../library/mailbox.rst:961 ../../library/mailbox.rst:1068 -#: ../../library/mailbox.rst:1085 ../../library/mailbox.rst:1100 -#: ../../library/mailbox.rst:1116 ../../library/mailbox.rst:1183 -#: ../../library/mailbox.rst:1198 ../../library/mailbox.rst:1212 -#: ../../library/mailbox.rst:1309 ../../library/mailbox.rst:1326 -#: ../../library/mailbox.rst:1340 ../../library/mailbox.rst:1440 -#: ../../library/mailbox.rst:1457 ../../library/mailbox.rst:1472 -#: ../../library/mailbox.rst:1488 +#: ../../library/mailbox.rst:1037 ../../library/mailbox.rst:1055 +#: ../../library/mailbox.rst:1070 ../../library/mailbox.rst:1177 +#: ../../library/mailbox.rst:1194 ../../library/mailbox.rst:1209 +#: ../../library/mailbox.rst:1225 ../../library/mailbox.rst:1292 +#: ../../library/mailbox.rst:1307 ../../library/mailbox.rst:1321 +#: ../../library/mailbox.rst:1418 ../../library/mailbox.rst:1435 +#: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1549 +#: ../../library/mailbox.rst:1566 ../../library/mailbox.rst:1581 +#: ../../library/mailbox.rst:1597 msgid "Resulting state" msgstr "" -#: ../../library/mailbox.rst:928 ../../library/mailbox.rst:1198 -#: ../../library/mailbox.rst:1326 +#: ../../library/mailbox.rst:1037 ../../library/mailbox.rst:1307 +#: ../../library/mailbox.rst:1435 msgid ":class:`mboxMessage` or :class:`MMDFMessage` state" msgstr "" -#: ../../library/mailbox.rst:931 ../../library/mailbox.rst:948 -#: ../../library/mailbox.rst:963 ../../library/mailbox.rst:1072 -#: ../../library/mailbox.rst:1444 +#: ../../library/mailbox.rst:1040 ../../library/mailbox.rst:1057 +#: ../../library/mailbox.rst:1072 ../../library/mailbox.rst:1181 +#: ../../library/mailbox.rst:1553 msgid "\"cur\" subdirectory" msgstr "" -#: ../../library/mailbox.rst:931 ../../library/mailbox.rst:1072 -#: ../../library/mailbox.rst:1089 ../../library/mailbox.rst:1104 -#: ../../library/mailbox.rst:1120 ../../library/mailbox.rst:1444 -#: ../../library/mailbox.rst:1461 ../../library/mailbox.rst:1476 -#: ../../library/mailbox.rst:1492 +#: ../../library/mailbox.rst:1040 ../../library/mailbox.rst:1181 +#: ../../library/mailbox.rst:1198 ../../library/mailbox.rst:1213 +#: ../../library/mailbox.rst:1229 ../../library/mailbox.rst:1553 +#: ../../library/mailbox.rst:1570 ../../library/mailbox.rst:1585 +#: ../../library/mailbox.rst:1601 msgid "O flag" msgstr "" -#: ../../library/mailbox.rst:933 ../../library/mailbox.rst:952 -#: ../../library/mailbox.rst:1076 ../../library/mailbox.rst:1091 -#: ../../library/mailbox.rst:1124 ../../library/mailbox.rst:1189 -#: ../../library/mailbox.rst:1205 ../../library/mailbox.rst:1448 -#: ../../library/mailbox.rst:1463 ../../library/mailbox.rst:1496 +#: ../../library/mailbox.rst:1042 ../../library/mailbox.rst:1061 +#: ../../library/mailbox.rst:1185 ../../library/mailbox.rst:1200 +#: ../../library/mailbox.rst:1233 ../../library/mailbox.rst:1298 +#: ../../library/mailbox.rst:1314 ../../library/mailbox.rst:1557 +#: ../../library/mailbox.rst:1572 ../../library/mailbox.rst:1605 msgid "F flag" msgstr "" -#: ../../library/mailbox.rst:935 ../../library/mailbox.rst:937 -#: ../../library/mailbox.rst:954 ../../library/mailbox.rst:969 -#: ../../library/mailbox.rst:1070 ../../library/mailbox.rst:1078 -#: ../../library/mailbox.rst:1118 ../../library/mailbox.rst:1187 -#: ../../library/mailbox.rst:1315 ../../library/mailbox.rst:1442 -#: ../../library/mailbox.rst:1450 ../../library/mailbox.rst:1490 +#: ../../library/mailbox.rst:1044 ../../library/mailbox.rst:1046 +#: ../../library/mailbox.rst:1063 ../../library/mailbox.rst:1078 +#: ../../library/mailbox.rst:1179 ../../library/mailbox.rst:1187 +#: ../../library/mailbox.rst:1227 ../../library/mailbox.rst:1296 +#: ../../library/mailbox.rst:1424 ../../library/mailbox.rst:1551 +#: ../../library/mailbox.rst:1559 ../../library/mailbox.rst:1599 msgid "R flag" msgstr "" -#: ../../library/mailbox.rst:935 ../../library/mailbox.rst:1078 -#: ../../library/mailbox.rst:1093 ../../library/mailbox.rst:1108 -#: ../../library/mailbox.rst:1126 ../../library/mailbox.rst:1203 -#: ../../library/mailbox.rst:1333 ../../library/mailbox.rst:1450 -#: ../../library/mailbox.rst:1465 ../../library/mailbox.rst:1480 -#: ../../library/mailbox.rst:1498 +#: ../../library/mailbox.rst:1044 ../../library/mailbox.rst:1187 +#: ../../library/mailbox.rst:1202 ../../library/mailbox.rst:1217 +#: ../../library/mailbox.rst:1235 ../../library/mailbox.rst:1312 +#: ../../library/mailbox.rst:1442 ../../library/mailbox.rst:1559 +#: ../../library/mailbox.rst:1574 ../../library/mailbox.rst:1589 +#: ../../library/mailbox.rst:1607 msgid "A flag" msgstr "" -#: ../../library/mailbox.rst:937 ../../library/mailbox.rst:1070 -#: ../../library/mailbox.rst:1442 +#: ../../library/mailbox.rst:1046 ../../library/mailbox.rst:1179 +#: ../../library/mailbox.rst:1551 msgid "S flag" msgstr "" -#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:971 -#: ../../library/mailbox.rst:1074 ../../library/mailbox.rst:1313 -#: ../../library/mailbox.rst:1446 +#: ../../library/mailbox.rst:1048 ../../library/mailbox.rst:1080 +#: ../../library/mailbox.rst:1183 ../../library/mailbox.rst:1422 +#: ../../library/mailbox.rst:1555 msgid "T flag" msgstr "" -#: ../../library/mailbox.rst:939 ../../library/mailbox.rst:1074 -#: ../../library/mailbox.rst:1106 ../../library/mailbox.rst:1122 -#: ../../library/mailbox.rst:1331 ../../library/mailbox.rst:1446 -#: ../../library/mailbox.rst:1478 ../../library/mailbox.rst:1494 +#: ../../library/mailbox.rst:1048 ../../library/mailbox.rst:1183 +#: ../../library/mailbox.rst:1215 ../../library/mailbox.rst:1231 +#: ../../library/mailbox.rst:1440 ../../library/mailbox.rst:1555 +#: ../../library/mailbox.rst:1587 ../../library/mailbox.rst:1603 msgid "D flag" msgstr "" -#: ../../library/mailbox.rst:942 +#: ../../library/mailbox.rst:1051 msgid "" "When a :class:`!MaildirMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:946 ../../library/mailbox.rst:1085 -#: ../../library/mailbox.rst:1340 ../../library/mailbox.rst:1457 +#: ../../library/mailbox.rst:1055 ../../library/mailbox.rst:1194 +#: ../../library/mailbox.rst:1449 ../../library/mailbox.rst:1566 msgid ":class:`MHMessage` state" msgstr "" -#: ../../library/mailbox.rst:948 ../../library/mailbox.rst:1089 -#: ../../library/mailbox.rst:1185 ../../library/mailbox.rst:1201 -#: ../../library/mailbox.rst:1214 ../../library/mailbox.rst:1342 -#: ../../library/mailbox.rst:1461 +#: ../../library/mailbox.rst:1057 ../../library/mailbox.rst:1198 +#: ../../library/mailbox.rst:1294 ../../library/mailbox.rst:1310 +#: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1451 +#: ../../library/mailbox.rst:1570 msgid "\"unseen\" sequence" msgstr "" -#: ../../library/mailbox.rst:950 ../../library/mailbox.rst:965 +#: ../../library/mailbox.rst:1059 ../../library/mailbox.rst:1074 msgid "\"cur\" subdirectory and S flag" msgstr "" -#: ../../library/mailbox.rst:950 ../../library/mailbox.rst:1087 -#: ../../library/mailbox.rst:1459 +#: ../../library/mailbox.rst:1059 ../../library/mailbox.rst:1196 +#: ../../library/mailbox.rst:1568 msgid "no \"unseen\" sequence" msgstr "" -#: ../../library/mailbox.rst:952 ../../library/mailbox.rst:1091 -#: ../../library/mailbox.rst:1189 ../../library/mailbox.rst:1205 -#: ../../library/mailbox.rst:1463 +#: ../../library/mailbox.rst:1061 ../../library/mailbox.rst:1200 +#: ../../library/mailbox.rst:1298 ../../library/mailbox.rst:1314 +#: ../../library/mailbox.rst:1572 msgid "\"flagged\" sequence" msgstr "" -#: ../../library/mailbox.rst:954 ../../library/mailbox.rst:1093 -#: ../../library/mailbox.rst:1187 ../../library/mailbox.rst:1203 -#: ../../library/mailbox.rst:1216 ../../library/mailbox.rst:1344 -#: ../../library/mailbox.rst:1465 +#: ../../library/mailbox.rst:1063 ../../library/mailbox.rst:1202 +#: ../../library/mailbox.rst:1296 ../../library/mailbox.rst:1312 +#: ../../library/mailbox.rst:1325 ../../library/mailbox.rst:1453 +#: ../../library/mailbox.rst:1574 msgid "\"replied\" sequence" msgstr "" -#: ../../library/mailbox.rst:957 +#: ../../library/mailbox.rst:1066 msgid "" "When a :class:`!MaildirMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:961 ../../library/mailbox.rst:1100 -#: ../../library/mailbox.rst:1212 ../../library/mailbox.rst:1472 +#: ../../library/mailbox.rst:1070 ../../library/mailbox.rst:1209 +#: ../../library/mailbox.rst:1321 ../../library/mailbox.rst:1581 msgid ":class:`BabylMessage` state" msgstr "" -#: ../../library/mailbox.rst:963 ../../library/mailbox.rst:1104 -#: ../../library/mailbox.rst:1214 ../../library/mailbox.rst:1311 -#: ../../library/mailbox.rst:1329 ../../library/mailbox.rst:1342 -#: ../../library/mailbox.rst:1476 +#: ../../library/mailbox.rst:1072 ../../library/mailbox.rst:1213 +#: ../../library/mailbox.rst:1323 ../../library/mailbox.rst:1420 +#: ../../library/mailbox.rst:1438 ../../library/mailbox.rst:1451 +#: ../../library/mailbox.rst:1585 msgid "\"unseen\" label" msgstr "" -#: ../../library/mailbox.rst:965 ../../library/mailbox.rst:1102 -#: ../../library/mailbox.rst:1474 +#: ../../library/mailbox.rst:1074 ../../library/mailbox.rst:1211 +#: ../../library/mailbox.rst:1583 msgid "no \"unseen\" label" msgstr "" -#: ../../library/mailbox.rst:967 ../../library/mailbox.rst:1317 +#: ../../library/mailbox.rst:1076 ../../library/mailbox.rst:1426 msgid "P flag" msgstr "" -#: ../../library/mailbox.rst:967 +#: ../../library/mailbox.rst:1076 msgid "\"forwarded\" or \"resent\" label" msgstr "" -#: ../../library/mailbox.rst:969 ../../library/mailbox.rst:1108 -#: ../../library/mailbox.rst:1216 ../../library/mailbox.rst:1315 -#: ../../library/mailbox.rst:1333 ../../library/mailbox.rst:1344 -#: ../../library/mailbox.rst:1480 +#: ../../library/mailbox.rst:1078 ../../library/mailbox.rst:1217 +#: ../../library/mailbox.rst:1325 ../../library/mailbox.rst:1424 +#: ../../library/mailbox.rst:1442 ../../library/mailbox.rst:1453 +#: ../../library/mailbox.rst:1589 msgid "\"answered\" label" msgstr "" -#: ../../library/mailbox.rst:971 ../../library/mailbox.rst:1106 -#: ../../library/mailbox.rst:1313 ../../library/mailbox.rst:1331 -#: ../../library/mailbox.rst:1478 +#: ../../library/mailbox.rst:1080 ../../library/mailbox.rst:1215 +#: ../../library/mailbox.rst:1422 ../../library/mailbox.rst:1440 +#: ../../library/mailbox.rst:1587 msgid "\"deleted\" label" msgstr "" -#: ../../library/mailbox.rst:978 +#: ../../library/mailbox.rst:1087 msgid ":class:`!mboxMessage` objects" msgstr ":class:`!mboxMessage` 物件" -#: ../../library/mailbox.rst:983 +#: ../../library/mailbox.rst:1092 msgid "" "A message with mbox-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:986 +#: ../../library/mailbox.rst:1095 msgid "" "Messages in an mbox mailbox are stored together in a single file. The " "sender's envelope address and the time of delivery are typically stored in a " @@ -1314,53 +1430,53 @@ msgid "" "typically stored in :mailheader:`Status` and :mailheader:`X-Status` headers." msgstr "" -#: ../../library/mailbox.rst:994 +#: ../../library/mailbox.rst:1103 msgid "Conventional flags for mbox messages are as follows:" msgstr "" -#: ../../library/mailbox.rst:1001 ../../library/mailbox.rst:1372 +#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 msgid "O" msgstr "O" -#: ../../library/mailbox.rst:1001 ../../library/mailbox.rst:1372 +#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 msgid "Old" msgstr "" -#: ../../library/mailbox.rst:1001 ../../library/mailbox.rst:1372 +#: ../../library/mailbox.rst:1110 ../../library/mailbox.rst:1481 msgid "Previously detected by MUA" msgstr "" -#: ../../library/mailbox.rst:1003 ../../library/mailbox.rst:1374 +#: ../../library/mailbox.rst:1112 ../../library/mailbox.rst:1483 msgid "Deleted" msgstr "" -#: ../../library/mailbox.rst:1007 ../../library/mailbox.rst:1378 +#: ../../library/mailbox.rst:1116 ../../library/mailbox.rst:1487 msgid "A" msgstr "A" -#: ../../library/mailbox.rst:1007 ../../library/mailbox.rst:1378 +#: ../../library/mailbox.rst:1116 ../../library/mailbox.rst:1487 msgid "Answered" msgstr "" -#: ../../library/mailbox.rst:1010 ../../library/mailbox.rst:1381 +#: ../../library/mailbox.rst:1119 ../../library/mailbox.rst:1490 msgid "" "The \"R\" and \"O\" flags are stored in the :mailheader:`Status` header, and " "the \"D\", \"F\", and \"A\" flags are stored in the :mailheader:`X-Status` " "header. The flags and headers typically appear in the order mentioned." msgstr "" -#: ../../library/mailbox.rst:1014 +#: ../../library/mailbox.rst:1123 msgid ":class:`!mboxMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1019 ../../library/mailbox.rst:1391 +#: ../../library/mailbox.rst:1128 ../../library/mailbox.rst:1500 msgid "" "Return a string representing the \"From \" line that marks the start of the " "message in an mbox mailbox. The leading \"From \" and the trailing newline " "are excluded." msgstr "" -#: ../../library/mailbox.rst:1026 ../../library/mailbox.rst:1398 +#: ../../library/mailbox.rst:1135 ../../library/mailbox.rst:1507 msgid "" "Set the \"From \" line to *from_*, which should be specified without a " "leading \"From \" or trailing newline. For convenience, *time_* may be " @@ -1370,7 +1486,7 @@ msgid "" "func:`time.gmtime`)." msgstr "" -#: ../../library/mailbox.rst:1036 ../../library/mailbox.rst:1408 +#: ../../library/mailbox.rst:1145 ../../library/mailbox.rst:1517 msgid "" "Return a string specifying the flags that are currently set. If the message " "complies with the conventional format, the result is the concatenation in " @@ -1378,28 +1494,28 @@ msgid "" "``'D'``, ``'F'``, and ``'A'``." msgstr "" -#: ../../library/mailbox.rst:1044 ../../library/mailbox.rst:1416 +#: ../../library/mailbox.rst:1153 ../../library/mailbox.rst:1525 msgid "" "Set the flags specified by *flags* and unset all others. Parameter *flags* " "should be the concatenation in any order of zero or more occurrences of each " "of ``'R'``, ``'O'``, ``'D'``, ``'F'``, and ``'A'``." msgstr "" -#: ../../library/mailbox.rst:1051 ../../library/mailbox.rst:1423 +#: ../../library/mailbox.rst:1160 ../../library/mailbox.rst:1532 msgid "" "Set the flag(s) specified by *flag* without changing other flags. To add " "more than one flag at a time, *flag* may be a string of more than one " "character." msgstr "" -#: ../../library/mailbox.rst:1058 ../../library/mailbox.rst:1430 +#: ../../library/mailbox.rst:1167 ../../library/mailbox.rst:1539 msgid "" "Unset the flag(s) specified by *flag* without changing other flags. To " "remove more than one flag at a time, *flag* maybe a string of more than one " "character." msgstr "" -#: ../../library/mailbox.rst:1062 +#: ../../library/mailbox.rst:1171 msgid "" "When an :class:`!mboxMessage` instance is created based upon a :class:" "`MaildirMessage` instance, a \"From \" line is generated based upon the :" @@ -1407,50 +1523,50 @@ msgid "" "conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1068 ../../library/mailbox.rst:1183 -#: ../../library/mailbox.rst:1309 ../../library/mailbox.rst:1440 +#: ../../library/mailbox.rst:1177 ../../library/mailbox.rst:1292 +#: ../../library/mailbox.rst:1418 ../../library/mailbox.rst:1549 msgid ":class:`MaildirMessage` state" msgstr "" -#: ../../library/mailbox.rst:1081 +#: ../../library/mailbox.rst:1190 msgid "" "When an :class:`!mboxMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1087 ../../library/mailbox.rst:1102 -#: ../../library/mailbox.rst:1459 ../../library/mailbox.rst:1474 +#: ../../library/mailbox.rst:1196 ../../library/mailbox.rst:1211 +#: ../../library/mailbox.rst:1568 ../../library/mailbox.rst:1583 msgid "R flag and O flag" msgstr "" -#: ../../library/mailbox.rst:1096 +#: ../../library/mailbox.rst:1205 msgid "" "When an :class:`!mboxMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1111 +#: ../../library/mailbox.rst:1220 msgid "" "When a :class:`!mboxMessage` instance is created based upon an :class:" "`MMDFMessage` instance, the \"From \" line is copied and all flags directly " "correspond:" msgstr "" -#: ../../library/mailbox.rst:1116 +#: ../../library/mailbox.rst:1225 msgid ":class:`MMDFMessage` state" msgstr "" -#: ../../library/mailbox.rst:1133 +#: ../../library/mailbox.rst:1242 msgid ":class:`!MHMessage` objects" msgstr ":class:`!MHMessage` 物件" -#: ../../library/mailbox.rst:1138 +#: ../../library/mailbox.rst:1247 msgid "" "A message with MH-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1141 +#: ../../library/mailbox.rst:1250 msgid "" "MH messages do not support marks or flags in the traditional sense, but they " "do support sequences, which are logical groupings of arbitrary messages. " @@ -1459,57 +1575,57 @@ msgid "" "formats, as follows:" msgstr "" -#: ../../library/mailbox.rst:1148 +#: ../../library/mailbox.rst:1257 msgid "Sequence" msgstr "" -#: ../../library/mailbox.rst:1150 ../../library/mailbox.rst:1237 +#: ../../library/mailbox.rst:1259 ../../library/mailbox.rst:1346 msgid "unseen" msgstr "" -#: ../../library/mailbox.rst:1150 ../../library/mailbox.rst:1237 +#: ../../library/mailbox.rst:1259 ../../library/mailbox.rst:1346 msgid "Not read, but previously detected by MUA" msgstr "" -#: ../../library/mailbox.rst:1152 +#: ../../library/mailbox.rst:1261 msgid "replied" msgstr "" -#: ../../library/mailbox.rst:1154 +#: ../../library/mailbox.rst:1263 msgid "flagged" msgstr "" -#: ../../library/mailbox.rst:1157 +#: ../../library/mailbox.rst:1266 msgid ":class:`!MHMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1162 +#: ../../library/mailbox.rst:1271 msgid "Return a list of the names of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1167 +#: ../../library/mailbox.rst:1276 msgid "Set the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1172 +#: ../../library/mailbox.rst:1281 msgid "Add *sequence* to the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1177 +#: ../../library/mailbox.rst:1286 msgid "Remove *sequence* from the list of sequences that include this message." msgstr "" -#: ../../library/mailbox.rst:1179 +#: ../../library/mailbox.rst:1288 msgid "" "When an :class:`!MHMessage` instance is created based upon a :class:" "`MaildirMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1185 ../../library/mailbox.rst:1311 +#: ../../library/mailbox.rst:1294 ../../library/mailbox.rst:1420 msgid "no S flag" msgstr "" -#: ../../library/mailbox.rst:1192 +#: ../../library/mailbox.rst:1301 msgid "" "When an :class:`!MHMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1517,110 +1633,110 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:1201 ../../library/mailbox.rst:1329 +#: ../../library/mailbox.rst:1310 ../../library/mailbox.rst:1438 msgid "no R flag" msgstr "" -#: ../../library/mailbox.rst:1208 +#: ../../library/mailbox.rst:1317 msgid "" "When an :class:`!MHMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1223 +#: ../../library/mailbox.rst:1332 msgid ":class:`!BabylMessage` objects" msgstr ":class:`!BabylMessage` 物件" -#: ../../library/mailbox.rst:1228 +#: ../../library/mailbox.rst:1337 msgid "" "A message with Babyl-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1231 +#: ../../library/mailbox.rst:1340 msgid "" "Certain message labels, called :dfn:`attributes`, are defined by convention " "to have special meanings. The attributes are as follows:" msgstr "" -#: ../../library/mailbox.rst:1235 +#: ../../library/mailbox.rst:1344 msgid "Label" msgstr "" -#: ../../library/mailbox.rst:1239 +#: ../../library/mailbox.rst:1348 msgid "deleted" msgstr "" -#: ../../library/mailbox.rst:1241 +#: ../../library/mailbox.rst:1350 msgid "filed" msgstr "" -#: ../../library/mailbox.rst:1241 +#: ../../library/mailbox.rst:1350 msgid "Copied to another file or mailbox" msgstr "" -#: ../../library/mailbox.rst:1243 +#: ../../library/mailbox.rst:1352 msgid "answered" msgstr "" -#: ../../library/mailbox.rst:1245 +#: ../../library/mailbox.rst:1354 msgid "forwarded" msgstr "" -#: ../../library/mailbox.rst:1245 +#: ../../library/mailbox.rst:1354 msgid "Forwarded" msgstr "" -#: ../../library/mailbox.rst:1247 +#: ../../library/mailbox.rst:1356 msgid "edited" msgstr "" -#: ../../library/mailbox.rst:1247 +#: ../../library/mailbox.rst:1356 msgid "Modified by the user" msgstr "" -#: ../../library/mailbox.rst:1249 +#: ../../library/mailbox.rst:1358 msgid "resent" msgstr "" -#: ../../library/mailbox.rst:1249 +#: ../../library/mailbox.rst:1358 msgid "Resent" msgstr "" -#: ../../library/mailbox.rst:1252 +#: ../../library/mailbox.rst:1361 msgid "" "By default, Rmail displays only visible headers. The :class:`!BabylMessage` " "class, though, uses the original headers because they are more complete. " "Visible headers may be accessed explicitly if desired." msgstr "" -#: ../../library/mailbox.rst:1256 +#: ../../library/mailbox.rst:1365 msgid ":class:`!BabylMessage` instances offer the following methods:" msgstr "" -#: ../../library/mailbox.rst:1261 +#: ../../library/mailbox.rst:1370 msgid "Return a list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1266 +#: ../../library/mailbox.rst:1375 msgid "Set the list of labels on the message to *labels*." msgstr "" -#: ../../library/mailbox.rst:1271 +#: ../../library/mailbox.rst:1380 msgid "Add *label* to the list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1276 +#: ../../library/mailbox.rst:1385 msgid "Remove *label* from the list of labels on the message." msgstr "" -#: ../../library/mailbox.rst:1281 +#: ../../library/mailbox.rst:1390 msgid "" "Return a :class:`Message` instance whose headers are the message's visible " "headers and whose body is empty." msgstr "" -#: ../../library/mailbox.rst:1287 +#: ../../library/mailbox.rst:1396 msgid "" "Set the message's visible headers to be the same as the headers in " "*message*. Parameter *visible* should be a :class:`Message` instance, an :" @@ -1628,7 +1744,7 @@ msgid "" "(which should be open in text mode)." msgstr "" -#: ../../library/mailbox.rst:1295 +#: ../../library/mailbox.rst:1404 msgid "" "When a :class:`!BabylMessage` instance's original headers are modified, the " "visible headers are not automatically modified to correspond. This method " @@ -1641,17 +1757,17 @@ msgid "" "visible headers." msgstr "" -#: ../../library/mailbox.rst:1305 +#: ../../library/mailbox.rst:1414 msgid "" "When a :class:`!BabylMessage` instance is created based upon a :class:" "`MaildirMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1317 +#: ../../library/mailbox.rst:1426 msgid "\"forwarded\" label" msgstr "" -#: ../../library/mailbox.rst:1320 +#: ../../library/mailbox.rst:1429 msgid "" "When a :class:`!BabylMessage` instance is created based upon an :class:" "`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status` " @@ -1659,23 +1775,23 @@ msgid "" "take place:" msgstr "" -#: ../../library/mailbox.rst:1336 +#: ../../library/mailbox.rst:1445 msgid "" "When a :class:`!BabylMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1351 +#: ../../library/mailbox.rst:1460 msgid ":class:`!MMDFMessage` objects" msgstr ":class:`!MMDFMessage` 物件" -#: ../../library/mailbox.rst:1356 +#: ../../library/mailbox.rst:1465 msgid "" "A message with MMDF-specific behaviors. Parameter *message* has the same " "meaning as with the :class:`Message` constructor." msgstr "" -#: ../../library/mailbox.rst:1359 +#: ../../library/mailbox.rst:1468 msgid "" "As with message in an mbox mailbox, MMDF messages are stored with the " "sender's address and the delivery date in an initial line beginning with " @@ -1683,19 +1799,19 @@ msgid "" "typically stored in :mailheader:`Status` and :mailheader:`X-Status` headers." msgstr "" -#: ../../library/mailbox.rst:1364 +#: ../../library/mailbox.rst:1473 msgid "" "Conventional flags for MMDF messages are identical to those of mbox message " "and are as follows:" msgstr "" -#: ../../library/mailbox.rst:1385 +#: ../../library/mailbox.rst:1494 msgid "" ":class:`!MMDFMessage` instances offer the following methods, which are " "identical to those offered by :class:`mboxMessage`:" msgstr "" -#: ../../library/mailbox.rst:1434 +#: ../../library/mailbox.rst:1543 msgid "" "When an :class:`!MMDFMessage` instance is created based upon a :class:" "`MaildirMessage` instance, a \"From \" line is generated based upon the :" @@ -1703,43 +1819,43 @@ msgid "" "conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1453 +#: ../../library/mailbox.rst:1562 msgid "" "When an :class:`!MMDFMessage` instance is created based upon an :class:" "`MHMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1468 +#: ../../library/mailbox.rst:1577 msgid "" "When an :class:`!MMDFMessage` instance is created based upon a :class:" "`BabylMessage` instance, the following conversions take place:" msgstr "" -#: ../../library/mailbox.rst:1483 +#: ../../library/mailbox.rst:1592 msgid "" "When an :class:`!MMDFMessage` instance is created based upon an :class:" "`mboxMessage` instance, the \"From \" line is copied and all flags directly " "correspond:" msgstr "" -#: ../../library/mailbox.rst:1488 +#: ../../library/mailbox.rst:1597 msgid ":class:`mboxMessage` state" msgstr "" -#: ../../library/mailbox.rst:1503 +#: ../../library/mailbox.rst:1612 msgid "Exceptions" msgstr "例外" -#: ../../library/mailbox.rst:1505 +#: ../../library/mailbox.rst:1614 msgid "" "The following exception classes are defined in the :mod:`!mailbox` module:" msgstr "" -#: ../../library/mailbox.rst:1510 +#: ../../library/mailbox.rst:1619 msgid "The based class for all other module-specific exceptions." msgstr "" -#: ../../library/mailbox.rst:1515 +#: ../../library/mailbox.rst:1624 msgid "" "Raised when a mailbox is expected but is not found, such as when " "instantiating a :class:`Mailbox` subclass with a path that does not exist " @@ -1747,13 +1863,13 @@ msgid "" "that does not exist." msgstr "" -#: ../../library/mailbox.rst:1522 +#: ../../library/mailbox.rst:1631 msgid "" "Raised when a mailbox is not empty but is expected to be, such as when " "deleting a folder that contains messages." msgstr "" -#: ../../library/mailbox.rst:1528 +#: ../../library/mailbox.rst:1637 msgid "" "Raised when some mailbox-related condition beyond the control of the program " "causes it to be unable to proceed, such as when failing to acquire a lock " @@ -1761,23 +1877,23 @@ msgid "" "name already exists." msgstr "" -#: ../../library/mailbox.rst:1536 +#: ../../library/mailbox.rst:1645 msgid "" "Raised when the data in a file cannot be parsed, such as when an :class:`MH` " "instance attempts to read a corrupted :file:`.mh_sequences` file." msgstr "" -#: ../../library/mailbox.rst:1543 +#: ../../library/mailbox.rst:1652 msgid "Examples" msgstr "範例" -#: ../../library/mailbox.rst:1545 +#: ../../library/mailbox.rst:1654 msgid "" "A simple example of printing the subjects of all messages in a mailbox that " "seem interesting::" msgstr "" -#: ../../library/mailbox.rst:1548 +#: ../../library/mailbox.rst:1657 msgid "" "import mailbox\n" "for message in mailbox.mbox('~/mbox'):\n" @@ -1791,13 +1907,13 @@ msgstr "" " if subject and 'python' in subject.lower():\n" " print(subject)" -#: ../../library/mailbox.rst:1554 +#: ../../library/mailbox.rst:1663 msgid "" "To copy all mail from a Babyl mailbox to an MH mailbox, converting all of " "the format-specific information that can be converted::" msgstr "" -#: ../../library/mailbox.rst:1557 +#: ../../library/mailbox.rst:1666 msgid "" "import mailbox\n" "destination = mailbox.MH('~/Mail')\n" @@ -1815,7 +1931,7 @@ msgstr "" "destination.flush()\n" "destination.unlock()" -#: ../../library/mailbox.rst:1565 +#: ../../library/mailbox.rst:1674 msgid "" "This example sorts mail from several mailing lists into different mailboxes, " "being careful to avoid mail corruption due to concurrent modification by " @@ -1823,7 +1939,7 @@ msgid "" "termination due to malformed messages in the mailbox::" msgstr "" -#: ../../library/mailbox.rst:1570 +#: ../../library/mailbox.rst:1679 msgid "" "import mailbox\n" "import email.errors\n" diff --git a/library/mailcap.po b/library/mailcap.po deleted file mode 100644 index f18c8968f3..0000000000 --- a/library/mailcap.po +++ /dev/null @@ -1,148 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2015-12-09 17:51+0000\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/mailcap.rst:2 -msgid ":mod:`mailcap` --- Mailcap file handling" -msgstr ":mod:`mailcap` --- Mailcap 檔案處理" - -#: ../../library/mailcap.rst:8 -msgid "**Source code:** :source:`Lib/mailcap.py`" -msgstr "**原始碼:**\\ :source:`Lib/mailcap.py`" - -#: ../../library/mailcap.rst:10 -msgid "" -"The :mod:`mailcap` module is deprecated (see :pep:`PEP 594 <594#mailcap>` " -"for details). The :mod:`mimetypes` module provides an alternative." -msgstr "" - -#: ../../library/mailcap.rst:17 -msgid "" -"Mailcap files are used to configure how MIME-aware applications such as mail " -"readers and web browsers react to files with different MIME types. (The name " -"\"mailcap\" is derived from the phrase \"mail capability\".) For example, a " -"mailcap file might contain a line like ``video/mpeg; xmpeg %s``. Then, if " -"the user encounters an email message or web document with the MIME type :" -"mimetype:`video/mpeg`, ``%s`` will be replaced by a filename (usually one " -"belonging to a temporary file) and the :program:`xmpeg` program can be " -"automatically started to view the file." -msgstr "" - -#: ../../library/mailcap.rst:26 -msgid "" -"The mailcap format is documented in :rfc:`1524`, \"A User Agent " -"Configuration Mechanism For Multimedia Mail Format Information\", but is not " -"an internet standard. However, mailcap files are supported on most Unix " -"systems." -msgstr "" - -#: ../../library/mailcap.rst:33 -msgid "" -"Return a 2-tuple; the first element is a string containing the command line " -"to be executed (which can be passed to :func:`os.system`), and the second " -"element is the mailcap entry for a given MIME type. If no matching MIME " -"type can be found, ``(None, None)`` is returned." -msgstr "" - -#: ../../library/mailcap.rst:38 -msgid "" -"*key* is the name of the field desired, which represents the type of " -"activity to be performed; the default value is 'view', since in the most " -"common case you simply want to view the body of the MIME-typed data. Other " -"possible values might be 'compose' and 'edit', if you wanted to create a new " -"body of the given MIME type or alter the existing body data. See :rfc:" -"`1524` for a complete list of these fields." -msgstr "" - -#: ../../library/mailcap.rst:45 -msgid "" -"*filename* is the filename to be substituted for ``%s`` in the command line; " -"the default value is ``'/dev/null'`` which is almost certainly not what you " -"want, so usually you'll override it by specifying a filename." -msgstr "" - -#: ../../library/mailcap.rst:49 -msgid "" -"*plist* can be a list containing named parameters; the default value is " -"simply an empty list. Each entry in the list must be a string containing " -"the parameter name, an equals sign (``'='``), and the parameter's value. " -"Mailcap entries can contain named parameters like ``%{foo}``, which will be " -"replaced by the value of the parameter named 'foo'. For example, if the " -"command line ``showpartial %{id} %{number} %{total}`` was in a mailcap file, " -"and *plist* was set to ``['id=1', 'number=2', 'total=3']``, the resulting " -"command line would be ``'showpartial 1 2 3'``." -msgstr "" - -#: ../../library/mailcap.rst:58 -msgid "" -"In a mailcap file, the \"test\" field can optionally be specified to test " -"some external condition (such as the machine architecture, or the window " -"system in use) to determine whether or not the mailcap line applies. :func:" -"`findmatch` will automatically check such conditions and skip the entry if " -"the check fails." -msgstr "" - -#: ../../library/mailcap.rst:65 -msgid "" -"To prevent security issues with shell metacharacters (symbols that have " -"special effects in a shell command line), ``findmatch`` will refuse to " -"inject ASCII characters other than alphanumerics and ``@+=:,./-_`` into the " -"returned command line." -msgstr "" - -#: ../../library/mailcap.rst:70 -msgid "" -"If a disallowed character appears in *filename*, ``findmatch`` will always " -"return ``(None, None)`` as if no entry was found. If such a character " -"appears elsewhere (a value in *plist* or in *MIMEtype*), ``findmatch`` will " -"ignore all mailcap entries which use that value. A :mod:`warning ` " -"will be raised in either case." -msgstr "" - -#: ../../library/mailcap.rst:78 -msgid "" -"Returns a dictionary mapping MIME types to a list of mailcap file entries. " -"This dictionary must be passed to the :func:`findmatch` function. An entry " -"is stored as a list of dictionaries, but it shouldn't be necessary to know " -"the details of this representation." -msgstr "" - -#: ../../library/mailcap.rst:83 -msgid "" -"The information is derived from all of the mailcap files found on the " -"system. Settings in the user's mailcap file :file:`$HOME/.mailcap` will " -"override settings in the system mailcap files :file:`/etc/mailcap`, :file:`/" -"usr/etc/mailcap`, and :file:`/usr/local/etc/mailcap`." -msgstr "" - -#: ../../library/mailcap.rst:88 -msgid "An example usage::" -msgstr "" - -#: ../../library/mailcap.rst:90 -msgid "" -">>> import mailcap\n" -">>> d = mailcap.getcaps()\n" -">>> mailcap.findmatch(d, 'video/mpeg', filename='tmp1223')\n" -"('xmpeg tmp1223', {'view': 'xmpeg %s'})" -msgstr "" -">>> import mailcap\n" -">>> d = mailcap.getcaps()\n" -">>> mailcap.findmatch(d, 'video/mpeg', filename='tmp1223')\n" -"('xmpeg tmp1223', {'view': 'xmpeg %s'})" diff --git a/library/markup.po b/library/markup.po index 63aaa070ba..6804f0d603 100644 --- a/library/markup.po +++ b/library/markup.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/marshal.po b/library/marshal.po index 6470b60402..472d892438 100644 --- a/library/marshal.po +++ b/library/marshal.po @@ -7,9 +7,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-04 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-04-24 21:28+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -40,17 +40,20 @@ msgstr "" "的;它可能在不同 Python 版本中被改變(雖然這種情況極少發生)。[#]_" #: ../../library/marshal.rst:21 +#, fuzzy msgid "" "This is not a general \"persistence\" module. For general persistence and " "transfer of Python objects through RPC calls, see the modules :mod:`pickle` " "and :mod:`shelve`. The :mod:`marshal` module exists mainly to support " "reading and writing the \"pseudo-compiled\" code for Python modules of :file:" "`.pyc` files. Therefore, the Python maintainers reserve the right to modify " -"the marshal format in backward incompatible ways should the need arise. If " -"you're serializing and de-serializing Python objects, use the :mod:`pickle` " -"module instead -- the performance is comparable, version independence is " -"guaranteed, and pickle supports a substantially wider range of objects than " -"marshal." +"the marshal format in backward incompatible ways should the need arise. The " +"format of code objects is not compatible between Python versions, even if " +"the version of the format is the same. De-serializing a code object in the " +"incorrect Python version has undefined behavior. If you're serializing and " +"de-serializing Python objects, use the :mod:`pickle` module instead -- the " +"performance is comparable, version independence is guaranteed, and pickle " +"supports a substantially wider range of objects than marshal." msgstr "" "這不是一個通用「持續性 (persistence)」module 。關於通用持續性以及透過 RPC 呼" "叫傳遞 Python 物件,請參閱 :mod:`pickle` 和 :mod:`shelve` 等 module 。:mod:" @@ -60,7 +63,7 @@ msgstr "" "`pickle` module -- 其執行效率相當、有保證版本獨立性,且實質上 pickle 還支援" "比 marshal 更多樣的物件。" -#: ../../library/marshal.rst:33 +#: ../../library/marshal.rst:37 msgid "" "The :mod:`marshal` module is not intended to be secure against erroneous or " "maliciously constructed data. Never unmarshal data received from an " @@ -69,19 +72,20 @@ msgstr "" ":mod:`marshal` module 對於錯誤或惡意構建的資料來說是不安全的。永遠不要 " "unmarshal 來自不受信任的或來源未經驗證的資料。" -#: ../../library/marshal.rst:39 +#: ../../library/marshal.rst:43 +#, fuzzy msgid "" "Not all Python object types are supported; in general, only objects whose " "value is independent from a particular invocation of Python can be written " "and read by this module. The following types are supported: booleans, " "integers, floating-point numbers, complex numbers, strings, bytes, " -"bytearrays, tuples, lists, sets, frozensets, dictionaries, and code objects, " -"where it should be understood that tuples, lists, sets, frozensets and " -"dictionaries are only supported as long as the values contained therein are " -"themselves supported. The singletons :const:`None`, :const:`Ellipsis` and :" -"exc:`StopIteration` can also be marshalled and unmarshalled. For format " -"*version* lower than 3, recursive lists, sets and dictionaries cannot be " -"written (see below)." +"bytearrays, tuples, lists, sets, frozensets, dictionaries, and code objects " +"(if *allow_code* is true), where it should be understood that tuples, lists, " +"sets, frozensets and dictionaries are only supported as long as the values " +"contained therein are themselves supported. The singletons :const:`None`, :" +"const:`Ellipsis` and :exc:`StopIteration` can also be marshalled and " +"unmarshalled. For format *version* lower than 3, recursive lists, sets and " +"dictionaries cannot be written (see below)." msgstr "" "不是所有 Python 物件型別都有支援;一般來說,此 module 只能寫入和讀取不依賴於" "特定 Python 調用 (invocation) 的物件。下列型別是有支援的:布林 (boolean)、整" @@ -93,18 +97,18 @@ msgstr "" "unmarshal。對於 *version* 低於 3 的格式,遞迴 list、集合和 dictionary 無法被" "寫入(見下文)。" -#: ../../library/marshal.rst:51 +#: ../../library/marshal.rst:56 msgid "" "There are functions that read/write files as well as functions operating on " "bytes-like objects." msgstr "" "有些函式可以讀/寫檔案,還有些函式可以操作類位元組串物件 (bytes-like object)。" -#: ../../library/marshal.rst:54 +#: ../../library/marshal.rst:59 msgid "The module defines these functions:" msgstr "這個 module 定義了以下函式:" -#: ../../library/marshal.rst:59 +#: ../../library/marshal.rst:64 msgid "" "Write the value on the open file. The value must be a supported type. The " "file must be a writeable :term:`binary file`." @@ -112,24 +116,26 @@ msgstr "" "將值寫入被開啟的檔案。值必須為受支援的型別,檔案必須為可寫入的 :term:`binary " "file`。" -#: ../../library/marshal.rst:62 +#: ../../library/marshal.rst:67 +#, fuzzy msgid "" "If the value has (or contains an object that has) an unsupported type, a :" "exc:`ValueError` exception is raised --- but garbage data will also be " "written to the file. The object will not be properly read back by :func:" -"`load`." +"`load`. :ref:`Code objects ` are only supported if " +"*allow_code* is true." msgstr "" "如果值具有(或其所包含的物件具有)不支援的型別,則會引發 :exc:`ValueError` 例" "外 --- 但是垃圾資料 (garbage data) 也將寫入檔案,物件也無法正確地透過 :func:" "`load` 重新讀取。" -#: ../../library/marshal.rst:66 +#: ../../library/marshal.rst:72 msgid "" "The *version* argument indicates the data format that ``dump`` should use " "(see below)." msgstr "*version* 引數指明 ``dump`` 應該使用的資料格式(見下文)。" -#: ../../library/marshal.rst:69 ../../library/marshal.rst:101 +#: ../../library/marshal.rst:75 ../../library/marshal.rst:115 msgid "" "Raises an :ref:`auditing event ` ``marshal.dumps`` with arguments " "``value``, ``version``." @@ -137,24 +143,31 @@ msgstr "" "引發一個附帶引數 ``value`` 與 ``version`` 的\\ :ref:`稽核事件 (auditing " "event) ` ``marshal.dumps``。" -#: ../../library/marshal.rst:74 +#: ../../library/marshal.rst:77 ../../library/marshal.rst:101 +#: ../../library/marshal.rst:117 ../../library/marshal.rst:135 +msgid "Added the *allow_code* parameter." +msgstr "" + +#: ../../library/marshal.rst:83 +#, fuzzy msgid "" "Read one value from the open file and return it. If no valid value is read " "(e.g. because the data has a different Python version's incompatible marshal " -"format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. The " -"file must be a readable :term:`binary file`." +"format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. :ref:" +"`Code objects ` are only supported if *allow_code* is true. " +"The file must be a readable :term:`binary file`." msgstr "" "從開啟的檔案讀取一個值並回傳。如果讀不到有效的值(例如,由於資料為不同 " "Python 版本的不相容 marshal 格式),則會引發 :exc:`EOFError`、:exc:" "`ValueError` 或 :exc:`TypeError`。檔案必須為可讀取的 :term:`binary file`。" -#: ../../library/marshal.rst:79 +#: ../../library/marshal.rst:89 msgid "" "Raises an :ref:`auditing event ` ``marshal.load`` with no " "arguments." msgstr "引發一個沒有附帶引數的\\ :ref:`稽核事件 ` ``marshal.load``。" -#: ../../library/marshal.rst:83 +#: ../../library/marshal.rst:93 msgid "" "If an object containing an unsupported type was marshalled with :func:" "`dump`, :func:`load` will substitute ``None`` for the unmarshallable type." @@ -162,7 +175,7 @@ msgstr "" "如果透過 :func:`dump` marshal 了一個包含不支援型別的物件,:func:`load` 會將不" "可 marshal 的型別替換為 ``None``。" -#: ../../library/marshal.rst:88 +#: ../../library/marshal.rst:98 msgid "" "This call used to raise a ``code.__new__`` audit event for each code object. " "Now it raises a single ``marshal.load`` event for the entire load operation." @@ -170,33 +183,38 @@ msgstr "" "使用此呼叫為每個程式碼物件引發一個 ``code.__new__`` 稽核事件。現在它會為整個" "載入操作引發單個 ``marshal.load`` 事件。" -#: ../../library/marshal.rst:94 +#: ../../library/marshal.rst:107 +#, fuzzy msgid "" "Return the bytes object that would be written to a file by ``dump(value, " "file)``. The value must be a supported type. Raise a :exc:`ValueError` " -"exception if value has (or contains an object that has) an unsupported type." +"exception if value has (or contains an object that has) an unsupported " +"type. :ref:`Code objects ` are only supported if *allow_code* " +"is true." msgstr "" "回傳將透過 ``dump(value, file)`` 來被寫入一個檔案的位元組串物件,其值必須是有" "支援的型別,如果值(或其包含的任一物件)為不支援的型別則會引發 :exc:" "`ValueError`。" -#: ../../library/marshal.rst:98 +#: ../../library/marshal.rst:112 msgid "" "The *version* argument indicates the data format that ``dumps`` should use " "(see below)." msgstr "*version* 引數指明 ``dumps`` 應當使用的資料型別(見下文)。" -#: ../../library/marshal.rst:106 +#: ../../library/marshal.rst:123 +#, fuzzy msgid "" "Convert the :term:`bytes-like object` to a value. If no valid value is " -"found, raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. Extra " -"bytes in the input are ignored." +"found, raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. :ref:" +"`Code objects ` are only supported if *allow_code* is true. " +"Extra bytes in the input are ignored." msgstr "" "將 :term:`bytes-like object` 轉換為一個值。如果找不到有效的值,則會引發 :exc:" "`EOFError`、:exc:`ValueError` 或 :exc:`TypeError`。輸入中額外的位元組串會被忽" "略。" -#: ../../library/marshal.rst:110 +#: ../../library/marshal.rst:128 msgid "" "Raises an :ref:`auditing event ` ``marshal.loads`` with argument " "``bytes``." @@ -204,7 +222,7 @@ msgstr "" "引發一個附帶引數 ``bytes`` 的\\ :ref:`稽核事件 ` ``marshal." "loads``。" -#: ../../library/marshal.rst:114 +#: ../../library/marshal.rst:132 msgid "" "This call used to raise a ``code.__new__`` audit event for each code object. " "Now it raises a single ``marshal.loads`` event for the entire load operation." @@ -212,11 +230,11 @@ msgstr "" "使用此呼叫為每個程式碼物件引發一個 ``code.__new__`` 稽核事件。現在它會為整個" "載入操作引發單個 ``marshal.loads`` 事件。" -#: ../../library/marshal.rst:118 +#: ../../library/marshal.rst:139 msgid "In addition, the following constants are defined:" msgstr "此外,還定義了以下常數:" -#: ../../library/marshal.rst:122 +#: ../../library/marshal.rst:143 msgid "" "Indicates the format that the module uses. Version 0 is the historical " "format, version 1 shares interned strings and version 2 uses a binary format " @@ -227,11 +245,11 @@ msgstr "" "string),第 2 版對浮點數使用二進位制格式。第 3 版添加了對於物件實例化和遞迴的" "支援。目前使用的是第 4 版。" -#: ../../library/marshal.rst:130 +#: ../../library/marshal.rst:151 msgid "Footnotes" msgstr "註解" -#: ../../library/marshal.rst:131 +#: ../../library/marshal.rst:152 msgid "" "The name of this module stems from a bit of terminology used by the " "designers of Modula-3 (amongst others), who use the term \"marshalling\" for " @@ -256,14 +274,14 @@ msgstr "pickle" msgid "shelve" msgstr "shelve" -#: ../../library/marshal.rst:37 +#: ../../library/marshal.rst:41 msgid "object" msgstr "object(物件)" -#: ../../library/marshal.rst:37 +#: ../../library/marshal.rst:41 msgid "code" msgstr "code(程式碼)" -#: ../../library/marshal.rst:37 +#: ../../library/marshal.rst:41 msgid "code object" msgstr "code object(程式碼物件)" diff --git a/library/math.po b/library/math.po index 2f104cc3be..b691fbe5dc 100644 --- a/library/math.po +++ b/library/math.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-04-26 15:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -85,7 +85,7 @@ msgstr "" "因為此值等同於 ``(1 + x)ⁿ`` 進行多項式展開後第 k 項的係數,所以又稱為二項式係" "數。" -#: ../../library/math.rst:51 ../../library/math.rst:258 +#: ../../library/math.rst:51 ../../library/math.rst:274 msgid "" "Raises :exc:`TypeError` if either of the arguments are not integers. Raises :" "exc:`ValueError` if either of the arguments are negative." @@ -114,7 +114,8 @@ msgstr "" "以整數回傳 *n* 的階乘。若 *n* 非整數型別或其值為負會引發 :exc:`ValueError`。" #: ../../library/math.rst:74 -msgid "Accepting floats with integral values (like ``5.0``) is deprecated." +#, fuzzy +msgid "Floats with integral values (like ``5.0``) are no longer accepted." msgstr "允許傳入其值為整數的浮點數(如:``5.0``)已被棄用。" #: ../../library/math.rst:80 @@ -129,6 +130,23 @@ msgstr "" #: ../../library/math.rst:87 msgid "" +"Fused multiply-add operation. Return ``(x * y) + z``, computed as though " +"with infinite precision and range followed by a single round to the " +"``float`` format. This operation often provides better accuracy than the " +"direct expression ``(x * y) + z``." +msgstr "" + +#: ../../library/math.rst:92 +msgid "" +"This function follows the specification of the fusedMultiplyAdd operation " +"described in the IEEE 754 standard. The standard leaves one case " +"implementation-defined, namely the result of ``fma(0, inf, nan)`` and " +"``fma(inf, 0, nan)``. In these cases, ``math.fma`` returns a NaN, and does " +"not raise any exception." +msgstr "" + +#: ../../library/math.rst:103 +msgid "" "Return ``fmod(x, y)``, as defined by the platform C library. Note that the " "Python expression ``x % y`` may not return the same result. The intent of " "the C standard is that ``fmod(x, y)`` be exactly (mathematically; to " @@ -151,7 +169,7 @@ msgstr "" "示成浮點數,並會四捨五入為出乎意料的 ``1e100``。因此,處理浮點數時通常會選擇" "函式 :func:`fmod`,而處理整數時會選擇 Python 運算式 ``x % y``。" -#: ../../library/math.rst:102 +#: ../../library/math.rst:118 msgid "" "Return the mantissa and exponent of *x* as the pair ``(m, e)``. *m* is a " "float and *e* is an integer such that ``x == m * 2**e`` exactly. If *x* is " @@ -162,7 +180,7 @@ msgstr "" "數,且兩者精確地使 ``x == m * 2**e``。若 *x* 為零,回傳 ``(0.0, 0)``,否則令 " "``0.5 <= abs(m) < 1``。此函式用於以可攜的方式「分割」浮點數內部表示法。" -#: ../../library/math.rst:110 +#: ../../library/math.rst:126 msgid "" "Return an accurate floating-point sum of values in the iterable. Avoids " "loss of precision by tracking multiple intermediate partial sums." @@ -170,7 +188,7 @@ msgstr "" "回傳可疊代物件(iterable)中所有值的精確浮點數和。透過追蹤過程中多個部分和" "(partial sum)以避免精確度損失。" -#: ../../library/math.rst:113 +#: ../../library/math.rst:129 msgid "" "The algorithm's accuracy depends on IEEE-754 arithmetic guarantees and the " "typical case where the rounding mode is half-even. On some non-Windows " @@ -182,7 +200,7 @@ msgstr "" "有些非 Windows 平台建置時,底層 C 函式庫使用延伸精度加法運算,而可能導致對過" "程中同一部分和重複捨入,並使其最低有效位不如預期。" -#: ../../library/math.rst:119 +#: ../../library/math.rst:135 msgid "" "For further discussion and two alternative approaches, see the `ASPN " "cookbook recipes for accurate floating-point summation `_。" -#: ../../library/math.rst:126 +#: ../../library/math.rst:142 msgid "" "Return the greatest common divisor of the specified integer arguments. If " "any of the arguments is nonzero, then the returned value is the largest " @@ -204,25 +222,25 @@ msgstr "" "最大的正整數。若所有引數皆為零,則回傳值為 ``0``。``gcd()`` 若未傳入任何引數" "也將回傳 ``0``。" -#: ../../library/math.rst:134 +#: ../../library/math.rst:150 msgid "" "Added support for an arbitrary number of arguments. Formerly, only two " "arguments were supported." msgstr "新增支援任意數量的引數。先前僅支援兩個引數。" -#: ../../library/math.rst:141 +#: ../../library/math.rst:157 msgid "" "Return ``True`` if the values *a* and *b* are close to each other and " "``False`` otherwise." msgstr "若 *a* 及 *b* 兩值足夠接近便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:144 +#: ../../library/math.rst:160 msgid "" "Whether or not two values are considered close is determined according to " "given absolute and relative tolerances." msgstr "兩數是否足夠接近取決於給定的絕對及相對容許偏差(tolerance)。" -#: ../../library/math.rst:147 +#: ../../library/math.rst:163 msgid "" "*rel_tol* is the relative tolerance -- it is the maximum allowed difference " "between *a* and *b*, relative to the larger absolute value of *a* or *b*. " @@ -235,7 +253,7 @@ msgstr "" "設值為 ``1e-09``,該值可確保兩數於大約 9 個十進數位內相同。*rel_tol* 須大於 " "``0``。" -#: ../../library/math.rst:153 +#: ../../library/math.rst:169 msgid "" "*abs_tol* is the minimum absolute tolerance -- useful for comparisons near " "zero. *abs_tol* must be at least zero." @@ -243,7 +261,7 @@ msgstr "" "*abs_tol* 為最小絕對容許偏差 ── 於接近零的比較時很有用。*abs_tol* 須大於等於 " "``0``。" -#: ../../library/math.rst:156 +#: ../../library/math.rst:172 msgid "" "If no errors occur, the result will be: ``abs(a-b) <= max(rel_tol * " "max(abs(a), abs(b)), abs_tol)``." @@ -251,7 +269,7 @@ msgstr "" "若未發生任何錯誤,函式結果為 ``abs(a-b) <= max(rel_tol * max(abs(a), " "abs(b)), abs_tol)``。" -#: ../../library/math.rst:159 +#: ../../library/math.rst:175 msgid "" "The IEEE 754 special values of ``NaN``, ``inf``, and ``-inf`` will be " "handled according to IEEE rules. Specifically, ``NaN`` is not considered " @@ -262,11 +280,11 @@ msgstr "" "處理。更明確地說,``NaN`` 不會與包含自身在內的任何數字足夠接近,而 ``inf`` " "及 ``-inf`` 皆只與自身接近。" -#: ../../library/math.rst:168 +#: ../../library/math.rst:184 msgid ":pep:`485` -- A function for testing approximate equality" msgstr ":pep:`485` ── 用於測試近似相等的函式" -#: ../../library/math.rst:173 +#: ../../library/math.rst:189 msgid "" "Return ``True`` if *x* is neither an infinity nor a NaN, and ``False`` " "otherwise. (Note that ``0.0`` *is* considered finite.)" @@ -274,20 +292,20 @@ msgstr "" "若 *x* 不是無限值或 ``NaN`` 便回傳 ``True``,否則回傳 ``False``。(注意 " "``0.0`` 被視為有限數。)" -#: ../../library/math.rst:181 +#: ../../library/math.rst:197 msgid "" "Return ``True`` if *x* is a positive or negative infinity, and ``False`` " "otherwise." msgstr "若 *x* 是正無限值或負無限值便回傳 ``True``,否則回傳 ``False``。" -#: ../../library/math.rst:187 +#: ../../library/math.rst:203 msgid "" "Return ``True`` if *x* is a NaN (not a number), and ``False`` otherwise." msgstr "" "若 *x* 是 ``NaN`` ── 即非數字(NaN, not a number)── 便回傳 ``True``,否則回" "傳 ``False``。" -#: ../../library/math.rst:192 +#: ../../library/math.rst:208 msgid "" "Return the integer square root of the nonnegative integer *n*. This is the " "floor of the exact square root of *n*, or equivalently the greatest integer " @@ -296,7 +314,7 @@ msgstr "" "回傳非負整數 *n* 的整數平方根。此值為 *n* 精確平方根經下取整的值,亦等同於滿" "足 *a*\\ ² |nbsp| ≤ |nbsp| *n* 的最大整數值 *a*。" -#: ../../library/math.rst:196 +#: ../../library/math.rst:212 msgid "" "For some applications, it may be more convenient to have the least integer " "*a* such that *n* |nbsp| ≤ |nbsp| *a*\\ ², or in other words the ceiling of " @@ -307,7 +325,7 @@ msgstr "" "者說 *n* 精確平方根經上取整的值 ── 會更加方便。對正數 *n*,此值可使用 ``a = " "1 + isqrt(n - 1)`` 計算。" -#: ../../library/math.rst:206 +#: ../../library/math.rst:222 msgid "" "Return the least common multiple of the specified integer arguments. If all " "arguments are nonzero, then the returned value is the smallest positive " @@ -319,86 +337,86 @@ msgstr "" "最小的正整數。若存在任一引數值為零,則回傳值為 ``0``。``lcm()`` 若未傳入任何" "引數將回傳 ``1``。" -#: ../../library/math.rst:217 +#: ../../library/math.rst:233 msgid "" "Return ``x * (2**i)``. This is essentially the inverse of function :func:" "`frexp`." msgstr "回傳 ``x * (2**i)``。此函式本質上為 :func:`frexp` 的反函式。" -#: ../../library/math.rst:223 +#: ../../library/math.rst:239 msgid "" "Return the fractional and integer parts of *x*. Both results carry the sign " "of *x* and are floats." msgstr "" -#: ../../library/math.rst:229 +#: ../../library/math.rst:245 msgid "Return the floating-point value *steps* steps after *x* towards *y*." msgstr "" -#: ../../library/math.rst:231 +#: ../../library/math.rst:247 msgid "If *x* is equal to *y*, return *y*, unless *steps* is zero." msgstr "" -#: ../../library/math.rst:233 +#: ../../library/math.rst:249 msgid "Examples:" msgstr "範例:" -#: ../../library/math.rst:235 +#: ../../library/math.rst:251 msgid "``math.nextafter(x, math.inf)`` goes up: towards positive infinity." msgstr "" -#: ../../library/math.rst:236 +#: ../../library/math.rst:252 msgid "``math.nextafter(x, -math.inf)`` goes down: towards minus infinity." msgstr "" -#: ../../library/math.rst:237 +#: ../../library/math.rst:253 msgid "``math.nextafter(x, 0.0)`` goes towards zero." msgstr "" -#: ../../library/math.rst:238 +#: ../../library/math.rst:254 msgid "``math.nextafter(x, math.copysign(math.inf, x))`` goes away from zero." msgstr "" -#: ../../library/math.rst:240 +#: ../../library/math.rst:256 msgid "See also :func:`math.ulp`." msgstr "另請參閱 :func:`math.ulp`。" -#: ../../library/math.rst:244 +#: ../../library/math.rst:260 msgid "Added the *steps* argument." msgstr "新增 *steps* 引數。" -#: ../../library/math.rst:249 +#: ../../library/math.rst:265 msgid "" "Return the number of ways to choose *k* items from *n* items without " "repetition and with order." msgstr "" -#: ../../library/math.rst:252 +#: ../../library/math.rst:268 msgid "" "Evaluates to ``n! / (n - k)!`` when ``k <= n`` and evaluates to zero when " "``k > n``." msgstr "" -#: ../../library/math.rst:255 +#: ../../library/math.rst:271 msgid "" "If *k* is not specified or is ``None``, then *k* defaults to *n* and the " "function returns ``n!``." msgstr "" -#: ../../library/math.rst:266 +#: ../../library/math.rst:282 msgid "" "Calculate the product of all the elements in the input *iterable*. The " "default *start* value for the product is ``1``." msgstr "" -#: ../../library/math.rst:269 +#: ../../library/math.rst:285 msgid "" "When the iterable is empty, return the start value. This function is " "intended specifically for use with numeric values and may reject non-numeric " "types." msgstr "" -#: ../../library/math.rst:278 +#: ../../library/math.rst:294 msgid "" "Return the IEEE 754-style remainder of *x* with respect to *y*. For finite " "*x* and finite nonzero *y*, this is the difference ``x - n*y``, where ``n`` " @@ -408,7 +426,7 @@ msgid "" "thus always satisfies ``abs(r) <= 0.5 * abs(y)``." msgstr "" -#: ../../library/math.rst:285 +#: ../../library/math.rst:301 msgid "" "Special cases follow IEEE 754: in particular, ``remainder(x, math.inf)`` is " "*x* for any finite *x*, and ``remainder(x, 0)`` and ``remainder(math.inf, " @@ -416,35 +434,35 @@ msgid "" "remainder operation is zero, that zero will have the same sign as *x*." msgstr "" -#: ../../library/math.rst:291 +#: ../../library/math.rst:307 msgid "" "On platforms using IEEE 754 binary floating point, the result of this " "operation is always exactly representable: no rounding error is introduced." msgstr "" -#: ../../library/math.rst:299 +#: ../../library/math.rst:315 msgid "Return the sum of products of values from two iterables *p* and *q*." msgstr "" -#: ../../library/math.rst:301 +#: ../../library/math.rst:317 msgid "Raises :exc:`ValueError` if the inputs do not have the same length." msgstr "" -#: ../../library/math.rst:303 ../../library/math.rst:498 +#: ../../library/math.rst:319 ../../library/math.rst:514 msgid "Roughly equivalent to::" msgstr "" -#: ../../library/math.rst:305 +#: ../../library/math.rst:321 msgid "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" msgstr "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))" -#: ../../library/math.rst:307 +#: ../../library/math.rst:323 msgid "" "For float and mixed int/float inputs, the intermediate products and sums are " "computed with extended precision." msgstr "" -#: ../../library/math.rst:315 +#: ../../library/math.rst:331 msgid "" "Return *x* with the fractional part removed, leaving the integer part. This " "rounds toward 0: ``trunc()`` is equivalent to :func:`floor` for positive " @@ -453,54 +471,54 @@ msgid "" "class:`~numbers.Integral` value." msgstr "" -#: ../../library/math.rst:323 +#: ../../library/math.rst:339 msgid "Return the value of the least significant bit of the float *x*:" msgstr "" -#: ../../library/math.rst:325 +#: ../../library/math.rst:341 msgid "If *x* is a NaN (not a number), return *x*." msgstr "" -#: ../../library/math.rst:326 +#: ../../library/math.rst:342 msgid "If *x* is negative, return ``ulp(-x)``." msgstr "" -#: ../../library/math.rst:327 +#: ../../library/math.rst:343 msgid "If *x* is a positive infinity, return *x*." msgstr "" -#: ../../library/math.rst:328 +#: ../../library/math.rst:344 msgid "" "If *x* is equal to zero, return the smallest positive *denormalized* " "representable float (smaller than the minimum positive *normalized* float, :" "data:`sys.float_info.min `)." msgstr "" -#: ../../library/math.rst:331 +#: ../../library/math.rst:347 msgid "" "If *x* is equal to the largest positive representable float, return the " "value of the least significant bit of *x*, such that the first float smaller " "than *x* is ``x - ulp(x)``." msgstr "" -#: ../../library/math.rst:334 +#: ../../library/math.rst:350 msgid "" "Otherwise (*x* is a positive finite number), return the value of the least " "significant bit of *x*, such that the first float bigger than *x* is ``x + " "ulp(x)``." msgstr "" -#: ../../library/math.rst:338 +#: ../../library/math.rst:354 msgid "ULP stands for \"Unit in the Last Place\"." msgstr "" -#: ../../library/math.rst:340 +#: ../../library/math.rst:356 msgid "" "See also :func:`math.nextafter` and :data:`sys.float_info.epsilon `." msgstr "" -#: ../../library/math.rst:346 +#: ../../library/math.rst:362 msgid "" "Note that :func:`frexp` and :func:`modf` have a different call/return " "pattern than their C equivalents: they take a single argument and return a " @@ -508,7 +526,7 @@ msgid "" "'output parameter' (there is no such thing in Python)." msgstr "" -#: ../../library/math.rst:351 +#: ../../library/math.rst:367 msgid "" "For the :func:`ceil`, :func:`floor`, and :func:`modf` functions, note that " "*all* floating-point numbers of sufficiently large magnitude are exact " @@ -517,26 +535,26 @@ msgid "" "``abs(x) >= 2**52`` necessarily has no fractional bits." msgstr "" -#: ../../library/math.rst:359 +#: ../../library/math.rst:375 msgid "Power and logarithmic functions" msgstr "" -#: ../../library/math.rst:363 +#: ../../library/math.rst:379 msgid "Return the cube root of *x*." msgstr "" -#: ../../library/math.rst:370 +#: ../../library/math.rst:386 msgid "" "Return *e* raised to the power *x*, where *e* = 2.718281... is the base of " "natural logarithms. This is usually more accurate than ``math.e ** x`` or " "``pow(math.e, x)``." msgstr "" -#: ../../library/math.rst:377 +#: ../../library/math.rst:393 msgid "Return *2* raised to the power *x*." msgstr "" -#: ../../library/math.rst:384 +#: ../../library/math.rst:400 msgid "" "Return *e* raised to the power *x*, minus 1. Here *e* is the base of " "natural logarithms. For small floats *x*, the subtraction in ``exp(x) - 1`` " @@ -545,41 +563,41 @@ msgid "" "compute this quantity to full precision:" msgstr "" -#: ../../library/math.rst:401 +#: ../../library/math.rst:417 msgid "With one argument, return the natural logarithm of *x* (to base *e*)." msgstr "" -#: ../../library/math.rst:403 +#: ../../library/math.rst:419 msgid "" "With two arguments, return the logarithm of *x* to the given *base*, " "calculated as ``log(x)/log(base)``." msgstr "" -#: ../../library/math.rst:409 +#: ../../library/math.rst:425 msgid "" "Return the natural logarithm of *1+x* (base *e*). The result is calculated " "in a way which is accurate for *x* near zero." msgstr "" -#: ../../library/math.rst:415 +#: ../../library/math.rst:431 msgid "" "Return the base-2 logarithm of *x*. This is usually more accurate than " "``log(x, 2)``." msgstr "" -#: ../../library/math.rst:422 +#: ../../library/math.rst:438 msgid "" ":meth:`int.bit_length` returns the number of bits necessary to represent an " "integer in binary, excluding the sign and leading zeros." msgstr "" -#: ../../library/math.rst:428 +#: ../../library/math.rst:444 msgid "" "Return the base-10 logarithm of *x*. This is usually more accurate than " "``log(x, 10)``." msgstr "" -#: ../../library/math.rst:434 +#: ../../library/math.rst:450 msgid "" "Return ``x`` raised to the power ``y``. Exceptional cases follow the IEEE " "754 standard as far as possible. In particular, ``pow(1.0, x)`` and " @@ -588,47 +606,47 @@ msgid "" "integer then ``pow(x, y)`` is undefined, and raises :exc:`ValueError`." msgstr "" -#: ../../library/math.rst:441 +#: ../../library/math.rst:457 msgid "" "Unlike the built-in ``**`` operator, :func:`math.pow` converts both its " "arguments to type :class:`float`. Use ``**`` or the built-in :func:`pow` " "function for computing exact integer powers." msgstr "" -#: ../../library/math.rst:445 +#: ../../library/math.rst:461 msgid "" "The special cases ``pow(0.0, -inf)`` and ``pow(-0.0, -inf)`` were changed to " "return ``inf`` instead of raising :exc:`ValueError`, for consistency with " "IEEE 754." msgstr "" -#: ../../library/math.rst:453 +#: ../../library/math.rst:469 msgid "Return the square root of *x*." msgstr "" -#: ../../library/math.rst:457 +#: ../../library/math.rst:473 msgid "Trigonometric functions" msgstr "" -#: ../../library/math.rst:461 +#: ../../library/math.rst:477 msgid "" "Return the arc cosine of *x*, in radians. The result is between ``0`` and " "``pi``." msgstr "" -#: ../../library/math.rst:467 +#: ../../library/math.rst:483 msgid "" "Return the arc sine of *x*, in radians. The result is between ``-pi/2`` and " "``pi/2``." msgstr "" -#: ../../library/math.rst:473 +#: ../../library/math.rst:489 msgid "" "Return the arc tangent of *x*, in radians. The result is between ``-pi/2`` " "and ``pi/2``." msgstr "" -#: ../../library/math.rst:479 +#: ../../library/math.rst:495 msgid "" "Return ``atan(y / x)``, in radians. The result is between ``-pi`` and " "``pi``. The vector in the plane from the origin to point ``(x, y)`` makes " @@ -638,128 +656,128 @@ msgid "" "``pi/4``, but ``atan2(-1, -1)`` is ``-3*pi/4``." msgstr "" -#: ../../library/math.rst:489 +#: ../../library/math.rst:505 msgid "Return the cosine of *x* radians." msgstr "" -#: ../../library/math.rst:494 +#: ../../library/math.rst:510 msgid "" "Return the Euclidean distance between two points *p* and *q*, each given as " "a sequence (or iterable) of coordinates. The two points must have the same " "dimension." msgstr "" -#: ../../library/math.rst:500 +#: ../../library/math.rst:516 msgid "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" msgstr "sqrt(sum((px - qx) ** 2.0 for px, qx in zip(p, q)))" -#: ../../library/math.rst:507 +#: ../../library/math.rst:523 msgid "" "Return the Euclidean norm, ``sqrt(sum(x**2 for x in coordinates))``. This is " "the length of the vector from the origin to the point given by the " "coordinates." msgstr "" -#: ../../library/math.rst:511 +#: ../../library/math.rst:527 msgid "" "For a two dimensional point ``(x, y)``, this is equivalent to computing the " "hypotenuse of a right triangle using the Pythagorean theorem, ``sqrt(x*x + " "y*y)``." msgstr "" -#: ../../library/math.rst:515 +#: ../../library/math.rst:531 msgid "" "Added support for n-dimensional points. Formerly, only the two dimensional " "case was supported." msgstr "" -#: ../../library/math.rst:519 +#: ../../library/math.rst:535 msgid "" "Improved the algorithm's accuracy so that the maximum error is under 1 ulp " "(unit in the last place). More typically, the result is almost always " "correctly rounded to within 1/2 ulp." msgstr "" -#: ../../library/math.rst:527 +#: ../../library/math.rst:543 msgid "Return the sine of *x* radians." msgstr "" -#: ../../library/math.rst:532 +#: ../../library/math.rst:548 msgid "Return the tangent of *x* radians." msgstr "" -#: ../../library/math.rst:536 +#: ../../library/math.rst:552 msgid "Angular conversion" msgstr "" -#: ../../library/math.rst:540 +#: ../../library/math.rst:556 msgid "Convert angle *x* from radians to degrees." msgstr "" -#: ../../library/math.rst:545 +#: ../../library/math.rst:561 msgid "Convert angle *x* from degrees to radians." msgstr "" -#: ../../library/math.rst:549 +#: ../../library/math.rst:565 msgid "Hyperbolic functions" msgstr "" -#: ../../library/math.rst:551 +#: ../../library/math.rst:567 msgid "" "`Hyperbolic functions `_ " "are analogs of trigonometric functions that are based on hyperbolas instead " "of circles." msgstr "" -#: ../../library/math.rst:557 +#: ../../library/math.rst:573 msgid "Return the inverse hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:562 +#: ../../library/math.rst:578 msgid "Return the inverse hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:567 +#: ../../library/math.rst:583 msgid "Return the inverse hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:572 +#: ../../library/math.rst:588 msgid "Return the hyperbolic cosine of *x*." msgstr "" -#: ../../library/math.rst:577 +#: ../../library/math.rst:593 msgid "Return the hyperbolic sine of *x*." msgstr "" -#: ../../library/math.rst:582 +#: ../../library/math.rst:598 msgid "Return the hyperbolic tangent of *x*." msgstr "" -#: ../../library/math.rst:586 +#: ../../library/math.rst:602 msgid "Special functions" msgstr "" -#: ../../library/math.rst:590 +#: ../../library/math.rst:606 msgid "" "Return the `error function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:593 +#: ../../library/math.rst:609 msgid "" "The :func:`erf` function can be used to compute traditional statistical " "functions such as the `cumulative standard normal distribution `_::" msgstr "" -#: ../../library/math.rst:597 +#: ../../library/math.rst:613 msgid "" "def phi(x):\n" " 'Cumulative distribution function for the standard normal distribution'\n" " return (1.0 + erf(x / sqrt(2.0))) / 2.0" msgstr "" -#: ../../library/math.rst:606 +#: ../../library/math.rst:622 msgid "" "Return the complementary error function at *x*. The `complementary error " "function `_ is defined as " @@ -768,31 +786,31 @@ msgid "" "Loss_of_significance>`_\\." msgstr "" -#: ../../library/math.rst:617 +#: ../../library/math.rst:633 msgid "" "Return the `Gamma function `_ " "at *x*." msgstr "" -#: ../../library/math.rst:625 +#: ../../library/math.rst:641 msgid "" "Return the natural logarithm of the absolute value of the Gamma function at " "*x*." msgstr "" -#: ../../library/math.rst:632 +#: ../../library/math.rst:648 msgid "Constants" msgstr "常數" -#: ../../library/math.rst:636 +#: ../../library/math.rst:652 msgid "The mathematical constant *π* = 3.141592..., to available precision." msgstr "" -#: ../../library/math.rst:641 +#: ../../library/math.rst:657 msgid "The mathematical constant *e* = 2.718281..., to available precision." msgstr "" -#: ../../library/math.rst:646 +#: ../../library/math.rst:662 msgid "" "The mathematical constant *τ* = 6.283185..., to available precision. Tau is " "a circle constant equal to 2\\ *π*, the ratio of a circle's circumference to " @@ -801,13 +819,13 @@ msgid "" "celebrating `Tau day `_ by eating twice as much pie!" msgstr "" -#: ../../library/math.rst:657 +#: ../../library/math.rst:673 msgid "" "A floating-point positive infinity. (For negative infinity, use ``-math." "inf``.) Equivalent to the output of ``float('inf')``." msgstr "" -#: ../../library/math.rst:665 +#: ../../library/math.rst:681 msgid "" "A floating-point \"not a number\" (NaN) value. Equivalent to the output of " "``float('nan')``. Due to the requirements of the `IEEE-754 standard \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -82,41 +82,54 @@ msgid "" msgstr "" #: ../../library/mimetypes.rst:54 -msgid "Added support for url being a :term:`path-like object`." +msgid "Added support for *url* being a :term:`path-like object`." msgstr "" -#: ../../library/mimetypes.rst:60 +#: ../../library/mimetypes.rst:57 +msgid "" +"Passing a file path instead of URL is :term:`soft deprecated`. Use :func:" +"`guess_file_type` for this." +msgstr "" + +#: ../../library/mimetypes.rst:66 +msgid "" +"Guess the type of a file based on its path, given by *path*. Similar to the :" +"func:`guess_type` function, but accepts a path instead of URL. Path can be a " +"string, a bytes object or a :term:`path-like object`." +msgstr "" + +#: ../../library/mimetypes.rst:75 msgid "" "Guess the extensions for a file based on its MIME type, given by *type*. The " "return value is a list of strings giving all possible filename extensions, " "including the leading dot (``'.'``). The extensions are not guaranteed to " "have been associated with any particular data stream, but would be mapped to " -"the MIME type *type* by :func:`guess_type`." +"the MIME type *type* by :func:`guess_type` and :func:`guess_file_type`." msgstr "" -#: ../../library/mimetypes.rst:66 ../../library/mimetypes.rst:78 +#: ../../library/mimetypes.rst:81 ../../library/mimetypes.rst:93 msgid "" "The optional *strict* argument has the same meaning as with the :func:" "`guess_type` function." msgstr "" -#: ../../library/mimetypes.rst:71 +#: ../../library/mimetypes.rst:86 msgid "" "Guess the extension for a file based on its MIME type, given by *type*. The " "return value is a string giving a filename extension, including the leading " "dot (``'.'``). The extension is not guaranteed to have been associated with " "any particular data stream, but would be mapped to the MIME type *type* by :" -"func:`guess_type`. If no extension can be guessed for *type*, ``None`` is " -"returned." +"func:`guess_type` and :func:`guess_file_type`. If no extension can be " +"guessed for *type*, ``None`` is returned." msgstr "" -#: ../../library/mimetypes.rst:80 +#: ../../library/mimetypes.rst:95 msgid "" "Some additional functions and data items are available for controlling the " "behavior of the module." msgstr "" -#: ../../library/mimetypes.rst:86 +#: ../../library/mimetypes.rst:101 msgid "" "Initialize the internal data structures. If given, *files* must be a " "sequence of file names which should be used to augment the default type " @@ -126,25 +139,25 @@ msgid "" "Calling :func:`init` repeatedly is allowed." msgstr "" -#: ../../library/mimetypes.rst:93 +#: ../../library/mimetypes.rst:108 msgid "" "Specifying an empty list for *files* will prevent the system defaults from " "being applied: only the well-known values will be present from a built-in " "list." msgstr "" -#: ../../library/mimetypes.rst:96 +#: ../../library/mimetypes.rst:111 msgid "" "If *files* is ``None`` the internal data structure is completely rebuilt to " "its initial default value. This is a stable operation and will produce the " "same results when called multiple times." msgstr "" -#: ../../library/mimetypes.rst:100 +#: ../../library/mimetypes.rst:115 msgid "Previously, Windows registry settings were ignored." msgstr "" -#: ../../library/mimetypes.rst:106 +#: ../../library/mimetypes.rst:121 msgid "" "Load the type map given in the file *filename*, if it exists. The type map " "is returned as a dictionary mapping filename extensions, including the " @@ -152,7 +165,7 @@ msgid "" "file *filename* does not exist or cannot be read, ``None`` is returned." msgstr "" -#: ../../library/mimetypes.rst:114 ../../library/mimetypes.rst:279 +#: ../../library/mimetypes.rst:129 ../../library/mimetypes.rst:302 msgid "" "Add a mapping from the MIME type *type* to the extension *ext*. When the " "extension is already known, the new type will replace the old one. When the " @@ -160,26 +173,26 @@ msgid "" "extensions." msgstr "" -#: ../../library/mimetypes.rst:118 ../../library/mimetypes.rst:283 +#: ../../library/mimetypes.rst:133 ../../library/mimetypes.rst:306 msgid "" "When *strict* is ``True`` (the default), the mapping will be added to the " "official MIME types, otherwise to the non-standard ones." msgstr "" -#: ../../library/mimetypes.rst:124 +#: ../../library/mimetypes.rst:139 msgid "" "Flag indicating whether or not the global data structures have been " "initialized. This is set to ``True`` by :func:`init`." msgstr "" -#: ../../library/mimetypes.rst:132 +#: ../../library/mimetypes.rst:147 msgid "" "List of type map file names commonly installed. These files are typically " "named :file:`mime.types` and are installed in different locations by " "different packages." msgstr "" -#: ../../library/mimetypes.rst:139 +#: ../../library/mimetypes.rst:154 msgid "" "Dictionary mapping suffixes to suffixes. This is used to allow recognition " "of encoded files for which the encoding and the type are indicated by the " @@ -187,25 +200,25 @@ msgid "" "`.tar.gz` to allow the encoding and type to be recognized separately." msgstr "" -#: ../../library/mimetypes.rst:147 +#: ../../library/mimetypes.rst:162 msgid "Dictionary mapping filename extensions to encoding types." msgstr "" -#: ../../library/mimetypes.rst:152 +#: ../../library/mimetypes.rst:167 msgid "Dictionary mapping filename extensions to MIME types." msgstr "" -#: ../../library/mimetypes.rst:157 +#: ../../library/mimetypes.rst:172 msgid "" "Dictionary mapping filename extensions to non-standard, but commonly found " "MIME types." msgstr "" -#: ../../library/mimetypes.rst:161 +#: ../../library/mimetypes.rst:176 msgid "An example usage of the module::" msgstr "模組的使用範例: ::" -#: ../../library/mimetypes.rst:163 +#: ../../library/mimetypes.rst:178 msgid "" ">>> import mimetypes\n" ">>> mimetypes.init()\n" @@ -229,18 +242,18 @@ msgstr "" ">>> mimetypes.types_map['.tgz']\n" "'application/x-tar-gz'" -#: ../../library/mimetypes.rst:178 +#: ../../library/mimetypes.rst:193 msgid "MimeTypes Objects" msgstr "MimeTypes 物件" -#: ../../library/mimetypes.rst:180 +#: ../../library/mimetypes.rst:195 msgid "" "The :class:`MimeTypes` class may be useful for applications which may want " "more than one MIME-type database; it provides an interface similar to the " "one of the :mod:`mimetypes` module." msgstr "" -#: ../../library/mimetypes.rst:187 +#: ../../library/mimetypes.rst:202 msgid "" "This class represents a MIME-types database. By default, it provides access " "to the same database as the rest of this module. The initial database is a " @@ -250,13 +263,13 @@ msgid "" "cleared before loading additional data if the default data is not desired." msgstr "" -#: ../../library/mimetypes.rst:194 +#: ../../library/mimetypes.rst:209 msgid "" "The optional *filenames* parameter can be used to cause additional files to " "be loaded \"on top\" of the default database." msgstr "" -#: ../../library/mimetypes.rst:200 +#: ../../library/mimetypes.rst:215 msgid "" "Dictionary mapping suffixes to suffixes. This is used to allow recognition " "of encoded files for which the encoding and the type are indicated by the " @@ -265,13 +278,13 @@ msgid "" "is initially a copy of the global :data:`suffix_map` defined in the module." msgstr "" -#: ../../library/mimetypes.rst:209 +#: ../../library/mimetypes.rst:224 msgid "" "Dictionary mapping filename extensions to encoding types. This is initially " "a copy of the global :data:`encodings_map` defined in the module." msgstr "" -#: ../../library/mimetypes.rst:215 +#: ../../library/mimetypes.rst:230 msgid "" "Tuple containing two dictionaries, mapping filename extensions to MIME " "types: the first dictionary is for the non-standards types and the second " @@ -279,7 +292,7 @@ msgid "" "and :data:`types_map`." msgstr "" -#: ../../library/mimetypes.rst:223 +#: ../../library/mimetypes.rst:238 msgid "" "Tuple containing two dictionaries, mapping MIME types to a list of filename " "extensions: the first dictionary is for the non-standards types and the " @@ -287,57 +300,64 @@ msgid "" "`common_types` and :data:`types_map`." msgstr "" -#: ../../library/mimetypes.rst:231 +#: ../../library/mimetypes.rst:246 msgid "" "Similar to the :func:`guess_extension` function, using the tables stored as " "part of the object." msgstr "" -#: ../../library/mimetypes.rst:237 +#: ../../library/mimetypes.rst:252 msgid "" "Similar to the :func:`guess_type` function, using the tables stored as part " "of the object." msgstr "" -#: ../../library/mimetypes.rst:243 +#: ../../library/mimetypes.rst:258 +msgid "" +"Similar to the :func:`guess_file_type` function, using the tables stored as " +"part of the object." +msgstr "" + +#: ../../library/mimetypes.rst:266 msgid "" "Similar to the :func:`guess_all_extensions` function, using the tables " "stored as part of the object." msgstr "" -#: ../../library/mimetypes.rst:249 +#: ../../library/mimetypes.rst:272 msgid "" "Load MIME information from a file named *filename*. This uses :meth:" "`readfp` to parse the file." msgstr "" -#: ../../library/mimetypes.rst:252 +#: ../../library/mimetypes.rst:275 msgid "" "If *strict* is ``True``, information will be added to list of standard " "types, else to the list of non-standard types." msgstr "" -#: ../../library/mimetypes.rst:258 +#: ../../library/mimetypes.rst:281 msgid "" "Load MIME type information from an open file *fp*. The file must have the " "format of the standard :file:`mime.types` files." msgstr "" -#: ../../library/mimetypes.rst:261 ../../library/mimetypes.rst:271 +#: ../../library/mimetypes.rst:284 ../../library/mimetypes.rst:294 msgid "" "If *strict* is ``True``, information will be added to the list of standard " "types, else to the list of non-standard types." msgstr "" -#: ../../library/mimetypes.rst:267 +#: ../../library/mimetypes.rst:290 msgid "Load MIME type information from the Windows registry." msgstr "" -#: ../../library/mimetypes.rst:269 +#: ../../library/mimetypes.rst:292 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" #: ../../library/mimetypes.rst:11 ../../library/mimetypes.rst:31 +#: ../../library/mimetypes.rst:64 msgid "MIME" msgstr "MIME" @@ -345,14 +365,14 @@ msgstr "MIME" msgid "content type" msgstr "content type(內容類型)" -#: ../../library/mimetypes.rst:31 +#: ../../library/mimetypes.rst:31 ../../library/mimetypes.rst:64 msgid "headers" msgstr "headers(標頭)" -#: ../../library/mimetypes.rst:130 +#: ../../library/mimetypes.rst:145 msgid "file" msgstr "file(檔案)" -#: ../../library/mimetypes.rst:130 +#: ../../library/mimetypes.rst:145 msgid "mime.types" msgstr "mime.types" diff --git a/library/mm.po b/library/mm.po index e3d6db2942..eefa2312a6 100644 --- a/library/mm.po +++ b/library/mm.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-01-18 14:54+0800\n" diff --git a/library/mmap.po b/library/mmap.po index 0a218bd00d..2d33ddb42b 100644 --- a/library/mmap.po +++ b/library/mmap.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -19,20 +19,19 @@ msgstr "" #: ../../library/mmap.rst:2 msgid ":mod:`!mmap` --- Memory-mapped file support" -msgstr ":mod:`!mmap` --- 記憶體映射檔案的支援" +msgstr ":mod:`!mmap` --- 記憶體對映檔案的支援" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/mmap.rst:11 msgid "" @@ -120,7 +119,7 @@ msgid "" "`ALLOCATIONGRANULARITY`." msgstr "" -#: ../../library/mmap.rst:72 ../../library/mmap.rst:163 +#: ../../library/mmap.rst:72 ../../library/mmap.rst:174 msgid "" "Raises an :ref:`auditing event ` ``mmap.__new__`` with arguments " "``fileno``, ``length``, ``access``, ``offset``." @@ -128,7 +127,7 @@ msgstr "" "引發一個附帶引數 ``fileno``、``length``、``access``、``offset`` 的\\ :ref:`稽" "核事件 ` ``mmap.__new__``。" -#: ../../library/mmap.rst:77 +#: ../../library/mmap.rst:78 msgid "" "**(Unix version)** Maps *length* bytes from the file specified by the file " "descriptor *fileno*, and returns a mmap object. If *length* is ``0``, the " @@ -136,7 +135,7 @@ msgid "" "`~mmap.mmap` is called." msgstr "" -#: ../../library/mmap.rst:82 +#: ../../library/mmap.rst:83 msgid "" "*flags* specifies the nature of the mapping. :const:`MAP_PRIVATE` creates a " "private copy-on-write mapping, so changes to the contents of the mmap object " @@ -147,7 +146,7 @@ msgid "" "constants>`." msgstr "" -#: ../../library/mmap.rst:90 +#: ../../library/mmap.rst:91 msgid "" "*prot*, if specified, gives the desired memory protection; the two most " "useful values are :const:`PROT_READ` and :const:`PROT_WRITE`, to specify " @@ -155,7 +154,7 @@ msgid "" "\\| PROT_WRITE`." msgstr "" -#: ../../library/mmap.rst:95 +#: ../../library/mmap.rst:96 msgid "" "*access* may be specified in lieu of *flags* and *prot* as an optional " "keyword parameter. It is an error to specify both *flags*, *prot* and " @@ -163,7 +162,7 @@ msgid "" "use this parameter." msgstr "" -#: ../../library/mmap.rst:100 +#: ../../library/mmap.rst:101 msgid "" "*offset* may be specified as a non-negative integer offset. mmap references " "will be relative to the offset from the beginning of the file. *offset* " @@ -171,18 +170,31 @@ msgid "" "which is equal to :const:`PAGESIZE` on Unix systems." msgstr "" -#: ../../library/mmap.rst:105 +#: ../../library/mmap.rst:106 +msgid "" +"If *trackfd* is ``False``, the file descriptor specified by *fileno* will " +"not be duplicated, and the resulting :class:`!mmap` object will not be " +"associated with the map's underlying file. This means that the :meth:`~mmap." +"mmap.size` and :meth:`~mmap.mmap.resize` methods will fail. This mode is " +"useful to limit the number of open file descriptors." +msgstr "" + +#: ../../library/mmap.rst:113 msgid "" "To ensure validity of the created memory mapping the file specified by the " "descriptor *fileno* is internally automatically synchronized with the " "physical backing store on macOS." msgstr "" -#: ../../library/mmap.rst:109 +#: ../../library/mmap.rst:117 +msgid "The *trackfd* parameter was added." +msgstr "" + +#: ../../library/mmap.rst:120 msgid "This example shows a simple way of using :class:`~mmap.mmap`::" msgstr "" -#: ../../library/mmap.rst:111 +#: ../../library/mmap.rst:122 msgid "" "import mmap\n" "\n" @@ -207,13 +219,13 @@ msgid "" " mm.close()" msgstr "" -#: ../../library/mmap.rst:134 +#: ../../library/mmap.rst:145 msgid "" ":class:`~mmap.mmap` can also be used as a context manager in a :keyword:" "`with` statement::" msgstr "" -#: ../../library/mmap.rst:137 +#: ../../library/mmap.rst:148 msgid "" "import mmap\n" "\n" @@ -225,17 +237,17 @@ msgstr "" "with mmap.mmap(-1, 13) as mm:\n" " mm.write(b\"Hello world!\")" -#: ../../library/mmap.rst:142 +#: ../../library/mmap.rst:153 msgid "Context manager support." msgstr "" -#: ../../library/mmap.rst:146 +#: ../../library/mmap.rst:157 msgid "" "The next example demonstrates how to create an anonymous map and exchange " "data between the parent and child processes::" msgstr "" -#: ../../library/mmap.rst:149 +#: ../../library/mmap.rst:160 msgid "" "import mmap\n" "import os\n" @@ -265,21 +277,21 @@ msgstr "" "\n" " mm.close()" -#: ../../library/mmap.rst:165 +#: ../../library/mmap.rst:176 msgid "Memory-mapped file objects support the following methods:" msgstr "" -#: ../../library/mmap.rst:169 +#: ../../library/mmap.rst:180 msgid "" "Closes the mmap. Subsequent calls to other methods of the object will result " "in a ValueError exception being raised. This will not close the open file." msgstr "" -#: ../../library/mmap.rst:176 +#: ../../library/mmap.rst:187 msgid "``True`` if the file is closed." msgstr "" -#: ../../library/mmap.rst:183 +#: ../../library/mmap.rst:194 msgid "" "Returns the lowest index in the object where the subsequence *sub* is found, " "such that *sub* is contained in the range [*start*, *end*]. Optional " @@ -287,12 +299,12 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/mmap.rst:188 ../../library/mmap.rst:277 -#: ../../library/mmap.rst:309 +#: ../../library/mmap.rst:199 ../../library/mmap.rst:291 +#: ../../library/mmap.rst:331 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" -#: ../../library/mmap.rst:194 +#: ../../library/mmap.rst:205 msgid "" "Flushes changes made to the in-memory copy of a file back to disk. Without " "use of this call there is no guarantee that changes are written back before " @@ -302,20 +314,20 @@ msgid "" "`PAGESIZE` or :const:`ALLOCATIONGRANULARITY`." msgstr "" -#: ../../library/mmap.rst:201 +#: ../../library/mmap.rst:212 msgid "" "``None`` is returned to indicate success. An exception is raised when the " "call failed." msgstr "" -#: ../../library/mmap.rst:204 +#: ../../library/mmap.rst:215 msgid "" "Previously, a nonzero value was returned on success; zero was returned on " "error under Windows. A zero value was returned on success; an exception was " "raised on error under Unix." msgstr "" -#: ../../library/mmap.rst:212 +#: ../../library/mmap.rst:223 msgid "" "Send advice *option* to the kernel about the memory region beginning at " "*start* and extending *length* bytes. *option* must be one of the :ref:" @@ -324,18 +336,18 @@ msgid "" "(including Linux), *start* must be a multiple of the :const:`PAGESIZE`." msgstr "" -#: ../../library/mmap.rst:219 +#: ../../library/mmap.rst:230 msgid "Availability: Systems with the ``madvise()`` system call." msgstr "" -#: ../../library/mmap.rst:226 +#: ../../library/mmap.rst:237 msgid "" "Copy the *count* bytes starting at offset *src* to the destination index " "*dest*. If the mmap was created with :const:`ACCESS_READ`, then calls to " "move will raise a :exc:`TypeError` exception." msgstr "" -#: ../../library/mmap.rst:233 +#: ../../library/mmap.rst:244 msgid "" "Return a :class:`bytes` containing up to *n* bytes starting from the current " "file position. If the argument is omitted, ``None`` or negative, return all " @@ -343,31 +355,36 @@ msgid "" "position is updated to point after the bytes that were returned." msgstr "" -#: ../../library/mmap.rst:239 +#: ../../library/mmap.rst:250 msgid "Argument can be omitted or ``None``." msgstr "" -#: ../../library/mmap.rst:244 +#: ../../library/mmap.rst:255 msgid "" "Returns a byte at the current file position as an integer, and advances the " "file position by 1." msgstr "" -#: ../../library/mmap.rst:250 +#: ../../library/mmap.rst:261 msgid "" "Returns a single line, starting at the current file position and up to the " "next newline. The file position is updated to point after the bytes that " "were returned." msgstr "" -#: ../../library/mmap.rst:257 +#: ../../library/mmap.rst:268 +msgid "Resizes the map and the underlying file, if any." +msgstr "" + +#: ../../library/mmap.rst:270 msgid "" -"Resizes the map and the underlying file, if any. If the mmap was created " -"with :const:`ACCESS_READ` or :const:`ACCESS_COPY`, resizing the map will " -"raise a :exc:`TypeError` exception." +"Resizing a map created with *access* of :const:`ACCESS_READ` or :const:" +"`ACCESS_COPY`, will raise a :exc:`TypeError` exception. Resizing a map " +"created with with *trackfd* set to ``False``, will raise a :exc:`ValueError` " +"exception." msgstr "" -#: ../../library/mmap.rst:261 +#: ../../library/mmap.rst:275 msgid "" "**On Windows**: Resizing the map will raise an :exc:`OSError` if there are " "other maps against the same named file. Resizing an anonymous map (ie " @@ -375,13 +392,13 @@ msgid "" "copied over up to the length of the new size." msgstr "" -#: ../../library/mmap.rst:266 +#: ../../library/mmap.rst:280 msgid "" "Correctly fails if attempting to resize when another map is held Allows " "resize against an anonymous map on Windows" msgstr "" -#: ../../library/mmap.rst:272 +#: ../../library/mmap.rst:286 msgid "" "Returns the highest index in the object where the subsequence *sub* is " "found, such that *sub* is contained in the range [*start*, *end*]. Optional " @@ -389,7 +406,7 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/mmap.rst:283 +#: ../../library/mmap.rst:297 msgid "" "Set the file's current position. *whence* argument is optional and defaults " "to ``os.SEEK_SET`` or ``0`` (absolute file positioning); other values are " @@ -397,17 +414,27 @@ msgid "" "SEEK_END`` or ``2`` (seek relative to the file's end)." msgstr "" -#: ../../library/mmap.rst:291 +#: ../../library/mmap.rst:302 +msgid "Return the new absolute position instead of ``None``." +msgstr "" + +#: ../../library/mmap.rst:307 +msgid "" +"Return whether the file supports seeking, and the return value is always " +"``True``." +msgstr "" + +#: ../../library/mmap.rst:313 msgid "" "Return the length of the file, which can be larger than the size of the " "memory-mapped area." msgstr "" -#: ../../library/mmap.rst:297 +#: ../../library/mmap.rst:319 msgid "Returns the current position of the file pointer." msgstr "" -#: ../../library/mmap.rst:302 +#: ../../library/mmap.rst:324 msgid "" "Write the bytes in *bytes* into memory at the current position of the file " "pointer and return the number of bytes written (never less than " @@ -417,11 +444,11 @@ msgid "" "it will raise a :exc:`TypeError` exception." msgstr "" -#: ../../library/mmap.rst:312 +#: ../../library/mmap.rst:334 msgid "The number of bytes written is now returned." msgstr "" -#: ../../library/mmap.rst:318 +#: ../../library/mmap.rst:340 msgid "" "Write the integer *byte* into memory at the current position of the file " "pointer; the file position is advanced by ``1``. If the mmap was created " @@ -429,25 +456,25 @@ msgid "" "exception." msgstr "" -#: ../../library/mmap.rst:326 +#: ../../library/mmap.rst:348 msgid "MADV_* Constants" msgstr "" -#: ../../library/mmap.rst:353 +#: ../../library/mmap.rst:375 msgid "" "These options can be passed to :meth:`mmap.madvise`. Not every option will " "be present on every system." msgstr "" -#: ../../library/mmap.rst:356 +#: ../../library/mmap.rst:378 msgid "Availability: Systems with the madvise() system call." msgstr "" -#: ../../library/mmap.rst:363 +#: ../../library/mmap.rst:385 msgid "MAP_* Constants" msgstr "MAP_* 常數" -#: ../../library/mmap.rst:376 +#: ../../library/mmap.rst:409 msgid "" "These are the various flags that can be passed to :meth:`mmap.mmap`. :data:" "`MAP_ALIGNED_SUPER` is only available at FreeBSD and :data:`MAP_CONCEAL` is " @@ -455,15 +482,23 @@ msgid "" "some systems." msgstr "" -#: ../../library/mmap.rst:380 +#: ../../library/mmap.rst:413 msgid "Added :data:`MAP_POPULATE` constant." msgstr "新增 :data:`MAP_POPULATE` 常數。" -#: ../../library/mmap.rst:383 +#: ../../library/mmap.rst:416 msgid "Added :data:`MAP_STACK` constant." msgstr "新增 :data:`MAP_STACK` 常數。" -#: ../../library/mmap.rst:386 -msgid "" -"Added :data:`MAP_ALIGNED_SUPER` constant. Added :data:`MAP_CONCEAL` constant." +#: ../../library/mmap.rst:419 +#, fuzzy +msgid "Added :data:`MAP_ALIGNED_SUPER` and :data:`MAP_CONCEAL` constants." msgstr "新增 :data:`MAP_ALIGNED_SUPER` 常數。新增 :data:`MAP_CONCEAL` 常數。" + +#: ../../library/mmap.rst:422 +msgid "" +"Added :data:`MAP_32BIT`, :data:`MAP_HASSEMAPHORE`, :data:`MAP_JIT`, :data:" +"`MAP_NOCACHE`, :data:`MAP_NOEXTEND`, :data:`MAP_NORESERVE`, :data:" +"`MAP_RESILIENT_CODESIGN`, :data:`MAP_RESILIENT_MEDIA`, :data:`MAP_TPRO`, :" +"data:`MAP_TRANSLATED_ALLOW_EXECUTE`, and :data:`MAP_UNIX03` constants." +msgstr "" diff --git a/library/modulefinder.po b/library/modulefinder.po index 70909e4390..e4f1f62d68 100644 --- a/library/modulefinder.po +++ b/library/modulefinder.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2024-05-11 14:42+0800\n" diff --git a/library/modules.po b/library/modules.po index f1928e20b0..147e11b561 100644 --- a/library/modules.po +++ b/library/modules.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" diff --git a/library/msilib.po b/library/msilib.po deleted file mode 100644 index 66e0e47ca3..0000000000 --- a/library/msilib.po +++ /dev/null @@ -1,623 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" -"PO-Revision-Date: 2018-05-23 16:06+0000\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/msilib.rst:2 -msgid ":mod:`msilib` --- Read and write Microsoft Installer files" -msgstr ":mod:`msilib` --- 讀寫 Microsoft Installer 檔案" - -#: ../../library/msilib.rst:12 -msgid "**Source code:** :source:`Lib/msilib/__init__.py`" -msgstr "**原始碼:**\\ :source:`Lib/msilib/__init__.py`" - -#: ../../library/msilib.rst:16 -msgid "" -"The :mod:`msilib` module is deprecated (see :pep:`PEP 594 <594#msilib>` for " -"details)." -msgstr "" -":mod:`msilib` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 " -"<594#msilib>`\\ )。" - -#: ../../library/msilib.rst:22 -msgid "" -"The :mod:`msilib` supports the creation of Microsoft Installer (``.msi``) " -"files. Because these files often contain an embedded \"cabinet\" file (``." -"cab``), it also exposes an API to create CAB files. Support for reading ``." -"cab`` files is currently not implemented; read support for the ``.msi`` " -"database is possible." -msgstr "" - -#: ../../library/msilib.rst:27 -msgid "" -"This package aims to provide complete access to all tables in an ``.msi`` " -"file, therefore, it is a fairly low-level API. One primary application of " -"this package is the creation of Python installer package itself (although " -"that currently uses a different version of ``msilib``)." -msgstr "" - -#: ../../library/msilib.rst:32 -msgid "" -"The package contents can be roughly split into four parts: low-level CAB " -"routines, low-level MSI routines, higher-level MSI routines, and standard " -"table structures." -msgstr "" - -#: ../../library/msilib.rst:39 -msgid "" -"Create a new CAB file named *cabname*. *files* must be a list of tuples, " -"each containing the name of the file on disk, and the name of the file " -"inside the CAB file." -msgstr "" - -#: ../../library/msilib.rst:43 -msgid "" -"The files are added to the CAB file in the order they appear in the list. " -"All files are added into a single CAB file, using the MSZIP compression " -"algorithm." -msgstr "" - -#: ../../library/msilib.rst:46 -msgid "" -"Callbacks to Python for the various steps of MSI creation are currently not " -"exposed." -msgstr "" - -#: ../../library/msilib.rst:52 -msgid "" -"Return the string representation of a new unique identifier. This wraps the " -"Windows API functions :c:func:`UuidCreate` and :c:func:`UuidToString`." -msgstr "" - -#: ../../library/msilib.rst:58 -msgid "" -"Return a new database object by calling MsiOpenDatabase. *path* is the " -"file name of the MSI file; *persist* can be one of the constants " -"``MSIDBOPEN_CREATEDIRECT``, ``MSIDBOPEN_CREATE``, ``MSIDBOPEN_DIRECT``, " -"``MSIDBOPEN_READONLY``, or ``MSIDBOPEN_TRANSACT``, and may include the flag " -"``MSIDBOPEN_PATCHFILE``. See the Microsoft documentation for the meaning of " -"these flags; depending on the flags, an existing database is opened, or a " -"new one created." -msgstr "" - -#: ../../library/msilib.rst:69 -msgid "" -"Return a new record object by calling :c:func:`MSICreateRecord`. *count* is " -"the number of fields of the record." -msgstr "" - -#: ../../library/msilib.rst:75 -msgid "" -"Create and return a new database *name*, initialize it with *schema*, and " -"set the properties *ProductName*, *ProductCode*, *ProductVersion*, and " -"*Manufacturer*." -msgstr "" - -#: ../../library/msilib.rst:79 -msgid "" -"*schema* must be a module object containing ``tables`` and " -"``_Validation_records`` attributes; typically, :mod:`msilib.schema` should " -"be used." -msgstr "" - -#: ../../library/msilib.rst:83 -msgid "" -"The database will contain just the schema and the validation records when " -"this function returns." -msgstr "" - -#: ../../library/msilib.rst:89 -msgid "Add all *records* to the table named *table* in *database*." -msgstr "" - -#: ../../library/msilib.rst:91 -msgid "" -"The *table* argument must be one of the predefined tables in the MSI schema, " -"e.g. ``'Feature'``, ``'File'``, ``'Component'``, ``'Dialog'``, " -"``'Control'``, etc." -msgstr "" - -#: ../../library/msilib.rst:95 -msgid "" -"*records* should be a list of tuples, each one containing all fields of a " -"record according to the schema of the table. For optional fields, ``None`` " -"can be passed." -msgstr "" - -#: ../../library/msilib.rst:99 -msgid "Field values can be ints, strings, or instances of the Binary class." -msgstr "" - -#: ../../library/msilib.rst:104 -msgid "" -"Represents entries in the Binary table; inserting such an object using :func:" -"`add_data` reads the file named *filename* into the table." -msgstr "" - -#: ../../library/msilib.rst:110 -msgid "" -"Add all table content from *module* to *database*. *module* must contain an " -"attribute *tables* listing all tables for which content should be added, and " -"one attribute per table that has the actual content." -msgstr "" - -#: ../../library/msilib.rst:114 -msgid "This is typically used to install the sequence tables." -msgstr "" - -#: ../../library/msilib.rst:119 -msgid "" -"Add the file *path* into the ``_Stream`` table of *database*, with the " -"stream name *name*." -msgstr "" - -#: ../../library/msilib.rst:125 -msgid "" -"Return a new UUID, in the format that MSI typically requires (i.e. in curly " -"braces, and with all hexdigits in uppercase)." -msgstr "" - -#: ../../library/msilib.rst:131 -msgid "" -"`FCICreate `_ " -"`UuidCreate `_ `UuidToString `_" -msgstr "" - -#: ../../library/msilib.rst:138 -msgid "Database Objects" -msgstr "" - -#: ../../library/msilib.rst:143 -msgid "" -"Return a view object, by calling :c:func:`MSIDatabaseOpenView`. *sql* is the " -"SQL statement to execute." -msgstr "" - -#: ../../library/msilib.rst:149 -msgid "" -"Commit the changes pending in the current transaction, by calling :c:func:" -"`MSIDatabaseCommit`." -msgstr "" - -#: ../../library/msilib.rst:155 -msgid "" -"Return a new summary information object, by calling :c:func:" -"`MsiGetSummaryInformation`. *count* is the maximum number of updated values." -msgstr "" - -#: ../../library/msilib.rst:161 -msgid "Close the database object, through :c:func:`MsiCloseHandle`." -msgstr "" - -#: ../../library/msilib.rst:167 -msgid "" -"`MSIDatabaseOpenView `_ `MSIDatabaseCommit `_ `MSIGetSummaryInformation " -"`_ " -"`MsiCloseHandle `_" -msgstr "" - -#: ../../library/msilib.rst:175 -msgid "View Objects" -msgstr "" - -#: ../../library/msilib.rst:180 -msgid "" -"Execute the SQL query of the view, through :c:func:`MSIViewExecute`. If " -"*params* is not ``None``, it is a record describing actual values of the " -"parameter tokens in the query." -msgstr "" - -#: ../../library/msilib.rst:187 -msgid "" -"Return a record describing the columns of the view, through calling :c:func:" -"`MsiViewGetColumnInfo`. *kind* can be either ``MSICOLINFO_NAMES`` or " -"``MSICOLINFO_TYPES``." -msgstr "" - -#: ../../library/msilib.rst:194 -msgid "" -"Return a result record of the query, through calling :c:func:`MsiViewFetch`." -msgstr "" - -#: ../../library/msilib.rst:199 -msgid "" -"Modify the view, by calling :c:func:`MsiViewModify`. *kind* can be one of " -"``MSIMODIFY_SEEK``, ``MSIMODIFY_REFRESH``, ``MSIMODIFY_INSERT``, " -"``MSIMODIFY_UPDATE``, ``MSIMODIFY_ASSIGN``, ``MSIMODIFY_REPLACE``, " -"``MSIMODIFY_MERGE``, ``MSIMODIFY_DELETE``, ``MSIMODIFY_INSERT_TEMPORARY``, " -"``MSIMODIFY_VALIDATE``, ``MSIMODIFY_VALIDATE_NEW``, " -"``MSIMODIFY_VALIDATE_FIELD``, or ``MSIMODIFY_VALIDATE_DELETE``." -msgstr "" - -#: ../../library/msilib.rst:206 -msgid "*data* must be a record describing the new data." -msgstr "" - -#: ../../library/msilib.rst:211 -msgid "Close the view, through :c:func:`MsiViewClose`." -msgstr "" - -#: ../../library/msilib.rst:216 -msgid "" -"`MsiViewExecute `_ `MSIViewGetColumnInfo `_ `MsiViewFetch `_ `MsiViewModify " -"`_ " -"`MsiViewClose `_" -msgstr "" - -#: ../../library/msilib.rst:225 -msgid "Summary Information Objects" -msgstr "" - -#: ../../library/msilib.rst:230 -msgid "" -"Return a property of the summary, through :c:func:" -"`MsiSummaryInfoGetProperty`. *field* is the name of the property, and can be " -"one of the constants ``PID_CODEPAGE``, ``PID_TITLE``, ``PID_SUBJECT``, " -"``PID_AUTHOR``, ``PID_KEYWORDS``, ``PID_COMMENTS``, ``PID_TEMPLATE``, " -"``PID_LASTAUTHOR``, ``PID_REVNUMBER``, ``PID_LASTPRINTED``, " -"``PID_CREATE_DTM``, ``PID_LASTSAVE_DTM``, ``PID_PAGECOUNT``, " -"``PID_WORDCOUNT``, ``PID_CHARCOUNT``, ``PID_APPNAME``, or ``PID_SECURITY``." -msgstr "" - -#: ../../library/msilib.rst:241 -msgid "" -"Return the number of summary properties, through :c:func:" -"`MsiSummaryInfoGetPropertyCount`." -msgstr "" - -#: ../../library/msilib.rst:247 -msgid "" -"Set a property through :c:func:`MsiSummaryInfoSetProperty`. *field* can have " -"the same values as in :meth:`GetProperty`, *value* is the new value of the " -"property. Possible value types are integer and string." -msgstr "" - -#: ../../library/msilib.rst:254 -msgid "" -"Write the modified properties to the summary information stream, using :c:" -"func:`MsiSummaryInfoPersist`." -msgstr "" - -#: ../../library/msilib.rst:260 -msgid "" -"`MsiSummaryInfoGetProperty `_ `MsiSummaryInfoGetPropertyCount `_ " -"`MsiSummaryInfoSetProperty `_ `MsiSummaryInfoPersist `_" -msgstr "" - -#: ../../library/msilib.rst:268 -msgid "Record Objects" -msgstr "" - -#: ../../library/msilib.rst:273 -msgid "" -"Return the number of fields of the record, through :c:func:" -"`MsiRecordGetFieldCount`." -msgstr "" - -#: ../../library/msilib.rst:279 -msgid "" -"Return the value of *field* as an integer where possible. *field* must be " -"an integer." -msgstr "" - -#: ../../library/msilib.rst:285 -msgid "" -"Return the value of *field* as a string where possible. *field* must be an " -"integer." -msgstr "" - -#: ../../library/msilib.rst:291 -msgid "" -"Set *field* to *value* through :c:func:`MsiRecordSetString`. *field* must be " -"an integer; *value* a string." -msgstr "" - -#: ../../library/msilib.rst:297 -msgid "" -"Set *field* to the contents of the file named *value*, through :c:func:" -"`MsiRecordSetStream`. *field* must be an integer; *value* a string." -msgstr "" - -#: ../../library/msilib.rst:303 -msgid "" -"Set *field* to *value* through :c:func:`MsiRecordSetInteger`. Both *field* " -"and *value* must be an integer." -msgstr "" - -#: ../../library/msilib.rst:309 -msgid "" -"Set all fields of the record to 0, through :c:func:`MsiRecordClearData`." -msgstr "" - -#: ../../library/msilib.rst:314 -msgid "" -"`MsiRecordGetFieldCount `_ `MsiRecordSetString `_ `MsiRecordSetStream `_ " -"`MsiRecordSetInteger `_ `MsiRecordClearData `_" -msgstr "" - -#: ../../library/msilib.rst:323 -msgid "Errors" -msgstr "" - -#: ../../library/msilib.rst:325 -msgid "" -"All wrappers around MSI functions raise :exc:`MSIError`; the string inside " -"the exception will contain more detail." -msgstr "" - -#: ../../library/msilib.rst:332 -msgid "CAB Objects" -msgstr "CAB 物件" - -#: ../../library/msilib.rst:337 -msgid "" -"The class :class:`CAB` represents a CAB file. During MSI construction, files " -"will be added simultaneously to the ``Files`` table, and to a CAB file. " -"Then, when all files have been added, the CAB file can be written, then " -"added to the MSI file." -msgstr "" - -#: ../../library/msilib.rst:342 -msgid "*name* is the name of the CAB file in the MSI file." -msgstr "" - -#: ../../library/msilib.rst:347 -msgid "" -"Add the file with the pathname *full* to the CAB file, under the name " -"*logical*. If there is already a file named *logical*, a new file name is " -"created." -msgstr "" - -#: ../../library/msilib.rst:351 -msgid "" -"Return the index of the file in the CAB file, and the new name of the file " -"inside the CAB file." -msgstr "" - -#: ../../library/msilib.rst:357 -msgid "" -"Generate a CAB file, add it as a stream to the MSI file, put it into the " -"``Media`` table, and remove the generated file from the disk." -msgstr "" - -#: ../../library/msilib.rst:364 -msgid "Directory Objects" -msgstr "" - -#: ../../library/msilib.rst:369 -msgid "" -"Create a new directory in the Directory table. There is a current component " -"at each point in time for the directory, which is either explicitly created " -"through :meth:`start_component`, or implicitly when files are added for the " -"first time. Files are added into the current component, and into the cab " -"file. To create a directory, a base directory object needs to be specified " -"(can be ``None``), the path to the physical directory, and a logical " -"directory name. *default* specifies the DefaultDir slot in the directory " -"table. *componentflags* specifies the default flags that new components get." -msgstr "" - -#: ../../library/msilib.rst:381 -msgid "" -"Add an entry to the Component table, and make this component the current " -"component for this directory. If no component name is given, the directory " -"name is used. If no *feature* is given, the current feature is used. If no " -"*flags* are given, the directory's default flags are used. If no *keyfile* " -"is given, the KeyPath is left null in the Component table." -msgstr "" - -#: ../../library/msilib.rst:390 -msgid "" -"Add a file to the current component of the directory, starting a new one if " -"there is no current component. By default, the file name in the source and " -"the file table will be identical. If the *src* file is specified, it is " -"interpreted relative to the current directory. Optionally, a *version* and a " -"*language* can be specified for the entry in the File table." -msgstr "" - -#: ../../library/msilib.rst:399 -msgid "" -"Add a list of files to the current component as specified in the glob " -"pattern. Individual files can be excluded in the *exclude* list." -msgstr "" - -#: ../../library/msilib.rst:405 -msgid "Remove ``.pyc`` files on uninstall." -msgstr "" - -#: ../../library/msilib.rst:410 -msgid "" -"`Directory Table `_ `File Table `_ `Component Table `_ `FeatureComponents Table " -"`_" -msgstr "" - -#: ../../library/msilib.rst:418 -msgid "Features" -msgstr "" - -#: ../../library/msilib.rst:423 -msgid "" -"Add a new record to the ``Feature`` table, using the values *id*, *parent." -"id*, *title*, *desc*, *display*, *level*, *directory*, and *attributes*. The " -"resulting feature object can be passed to the :meth:`start_component` method " -"of :class:`Directory`." -msgstr "" - -#: ../../library/msilib.rst:431 -msgid "" -"Make this feature the current feature of :mod:`msilib`. New components are " -"automatically added to the default feature, unless a feature is explicitly " -"specified." -msgstr "" - -#: ../../library/msilib.rst:438 -msgid "" -"`Feature Table `_" -msgstr "" - -#: ../../library/msilib.rst:443 -msgid "GUI classes" -msgstr "" - -#: ../../library/msilib.rst:445 -msgid "" -":mod:`msilib` provides several classes that wrap the GUI tables in an MSI " -"database. However, no standard user interface is provided." -msgstr "" - -#: ../../library/msilib.rst:451 -msgid "" -"Base class of the dialog controls. *dlg* is the dialog object the control " -"belongs to, and *name* is the control's name." -msgstr "" - -#: ../../library/msilib.rst:457 -msgid "Make an entry into the ``ControlEvent`` table for this control." -msgstr "" - -#: ../../library/msilib.rst:462 -msgid "Make an entry into the ``EventMapping`` table for this control." -msgstr "" - -#: ../../library/msilib.rst:467 -msgid "Make an entry into the ``ControlCondition`` table for this control." -msgstr "" - -#: ../../library/msilib.rst:472 -msgid "" -"Create a radio button control named *name*. *property* is the installer " -"property that gets set when a radio button is selected." -msgstr "" - -#: ../../library/msilib.rst:478 -msgid "" -"Add a radio button named *name* to the group, at the coordinates *x*, *y*, " -"*width*, *height*, and with the label *text*. If *value* is ``None``, it " -"defaults to *name*." -msgstr "" - -#: ../../library/msilib.rst:485 -msgid "" -"Return a new :class:`Dialog` object. An entry in the ``Dialog`` table is " -"made, with the specified coordinates, dialog attributes, title, name of the " -"first, default, and cancel controls." -msgstr "" - -#: ../../library/msilib.rst:492 -msgid "" -"Return a new :class:`Control` object. An entry in the ``Control`` table is " -"made with the specified parameters." -msgstr "" - -#: ../../library/msilib.rst:495 -msgid "" -"This is a generic method; for specific types, specialized methods are " -"provided." -msgstr "" - -#: ../../library/msilib.rst:501 -msgid "Add and return a ``Text`` control." -msgstr "" - -#: ../../library/msilib.rst:506 -msgid "Add and return a ``Bitmap`` control." -msgstr "" - -#: ../../library/msilib.rst:511 -msgid "Add and return a ``Line`` control." -msgstr "" - -#: ../../library/msilib.rst:516 -msgid "Add and return a ``PushButton`` control." -msgstr "" - -#: ../../library/msilib.rst:521 -msgid "Add and return a ``RadioButtonGroup`` control." -msgstr "" - -#: ../../library/msilib.rst:526 -msgid "Add and return a ``CheckBox`` control." -msgstr "" - -#: ../../library/msilib.rst:531 -msgid "" -"`Dialog Table `_ `Control Table `_ `Control Types `_ `ControlCondition Table " -"`_ " -"`ControlEvent Table `_ `EventMapping Table `_ `RadioButton Table `_" -msgstr "" - -#: ../../library/msilib.rst:542 -msgid "Precomputed tables" -msgstr "" - -#: ../../library/msilib.rst:544 -msgid "" -":mod:`msilib` provides a few subpackages that contain only schema and table " -"definitions. Currently, these definitions are based on MSI version 2.0." -msgstr "" - -#: ../../library/msilib.rst:550 -msgid "" -"This is the standard MSI schema for MSI 2.0, with the *tables* variable " -"providing a list of table definitions, and *_Validation_records* providing " -"the data for MSI validation." -msgstr "" - -#: ../../library/msilib.rst:557 -msgid "" -"This module contains table contents for the standard sequence tables: " -"*AdminExecuteSequence*, *AdminUISequence*, *AdvtExecuteSequence*, " -"*InstallExecuteSequence*, and *InstallUISequence*." -msgstr "" - -#: ../../library/msilib.rst:564 -msgid "" -"This module contains definitions for the UIText and ActionText tables, for " -"the standard installer actions." -msgstr "" - -#: ../../library/msilib.rst:14 -msgid "msi" -msgstr "msi" diff --git a/library/msvcrt.po b/library/msvcrt.po index 4edb26438d..a59619b149 100644 --- a/library/msvcrt.po +++ b/library/msvcrt.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-04 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,8 +25,8 @@ msgstr ":mod:`!msvcrt` --- MS VC++ runtime 提供的有用例程" #: ../../library/msvcrt.rst:12 msgid "" "These functions provide access to some useful capabilities on Windows " -"platforms. Some higher-level modules use these functions to build the " -"Windows implementations of their services. For example, the :mod:`getpass` " +"platforms. Some higher-level modules use these functions to build the " +"Windows implementations of their services. For example, the :mod:`getpass` " "module uses this in the implementation of the :func:`getpass` function." msgstr "" @@ -56,12 +56,12 @@ msgstr "" #: ../../library/msvcrt.rst:38 msgid "" -"Lock part of a file based on file descriptor *fd* from the C runtime. " -"Raises :exc:`OSError` on failure. The locked region of the file extends " -"from the current file position for *nbytes* bytes, and may continue beyond " -"the end of the file. *mode* must be one of the :const:`!LK_\\*` constants " -"listed below. Multiple regions in a file may be locked at the same time, but " -"may not overlap. Adjacent regions are not merged; they must be unlocked " +"Lock part of a file based on file descriptor *fd* from the C runtime. " +"Raises :exc:`OSError` on failure. The locked region of the file extends from " +"the current file position for *nbytes* bytes, and may continue beyond the " +"end of the file. *mode* must be one of the :const:`!LK_\\*` constants listed " +"below. Multiple regions in a file may be locked at the same time, but may " +"not overlap. Adjacent regions are not merged; they must be unlocked " "individually." msgstr "" @@ -76,7 +76,7 @@ msgstr "" #: ../../library/msvcrt.rst:51 msgid "" "Locks the specified bytes. If the bytes cannot be locked, the program " -"immediately tries again after 1 second. If, after 10 attempts, the bytes " +"immediately tries again after 1 second. If, after 10 attempts, the bytes " "cannot be locked, :exc:`OSError` is raised." msgstr "" @@ -99,13 +99,20 @@ msgstr "" #: ../../library/msvcrt.rst:77 msgid "" -"Create a C runtime file descriptor from the file handle *handle*. The " +"Create a C runtime file descriptor from the file handle *handle*. The " "*flags* parameter should be a bitwise OR of :const:`os.O_APPEND`, :const:`os." -"O_RDONLY`, and :const:`os.O_TEXT`. The returned file descriptor may be used " -"as a parameter to :func:`os.fdopen` to create a file object." +"O_RDONLY`, :const:`os.O_TEXT` and :const:`os.O_NOINHERIT`. The returned file " +"descriptor may be used as a parameter to :func:`os.fdopen` to create a file " +"object." msgstr "" -#: ../../library/msvcrt.rst:82 +#: ../../library/msvcrt.rst:83 +msgid "" +"The file descriptor is inheritable by default. Pass :const:`os.O_NOINHERIT` " +"flag to make it non inheritable." +msgstr "" + +#: ../../library/msvcrt.rst:86 msgid "" "Raises an :ref:`auditing event ` ``msvcrt.open_osfhandle`` with " "arguments ``handle``, ``flags``." @@ -113,13 +120,13 @@ msgstr "" "引發一個附帶引數 ``handle``、``flags`` 的\\ :ref:`稽核事件 ` " "``msvcrt.open_osfhandle``。" -#: ../../library/msvcrt.rst:87 +#: ../../library/msvcrt.rst:91 msgid "" -"Return the file handle for the file descriptor *fd*. Raises :exc:`OSError` " +"Return the file handle for the file descriptor *fd*. Raises :exc:`OSError` " "if *fd* is not recognized." msgstr "" -#: ../../library/msvcrt.rst:90 +#: ../../library/msvcrt.rst:94 msgid "" "Raises an :ref:`auditing event ` ``msvcrt.get_osfhandle`` with " "argument ``fd``." @@ -127,76 +134,164 @@ msgstr "" "引發一個附帶引數 ``fd`` 的\\ :ref:`稽核事件 ` ``msvcrt." "get_osfhandle``。" -#: ../../library/msvcrt.rst:96 +#: ../../library/msvcrt.rst:100 msgid "Console I/O" msgstr "" -#: ../../library/msvcrt.rst:101 -msgid "Return ``True`` if a keypress is waiting to be read." +#: ../../library/msvcrt.rst:105 +msgid "" +"Returns a nonzero value if a keypress is waiting to be read. Otherwise, " +"return 0." msgstr "" -#: ../../library/msvcrt.rst:106 +#: ../../library/msvcrt.rst:111 msgid "" "Read a keypress and return the resulting character as a byte string. Nothing " -"is echoed to the console. This call will block if a keypress is not already " +"is echoed to the console. This call will block if a keypress is not already " "available, but will not wait for :kbd:`Enter` to be pressed. If the pressed " "key was a special function key, this will return ``'\\000'`` or ``'\\xe0'``; " "the next call will return the keycode. The :kbd:`Control-C` keypress cannot " "be read with this function." msgstr "" -#: ../../library/msvcrt.rst:116 +#: ../../library/msvcrt.rst:121 msgid "Wide char variant of :func:`getch`, returning a Unicode value." msgstr "" -#: ../../library/msvcrt.rst:121 +#: ../../library/msvcrt.rst:126 msgid "" -"Similar to :func:`getch`, but the keypress will be echoed if it represents " -"a printable character." +"Similar to :func:`getch`, but the keypress will be echoed if it represents a " +"printable character." msgstr "" -#: ../../library/msvcrt.rst:127 +#: ../../library/msvcrt.rst:132 msgid "Wide char variant of :func:`getche`, returning a Unicode value." msgstr "" -#: ../../library/msvcrt.rst:132 +#: ../../library/msvcrt.rst:137 msgid "Print the byte string *char* to the console without buffering." msgstr "" -#: ../../library/msvcrt.rst:137 +#: ../../library/msvcrt.rst:142 msgid "Wide char variant of :func:`putch`, accepting a Unicode value." msgstr "" -#: ../../library/msvcrt.rst:142 +#: ../../library/msvcrt.rst:147 msgid "" "Cause the byte string *char* to be \"pushed back\" into the console buffer; " "it will be the next character read by :func:`getch` or :func:`getche`." msgstr "" -#: ../../library/msvcrt.rst:148 +#: ../../library/msvcrt.rst:153 msgid "Wide char variant of :func:`ungetch`, accepting a Unicode value." msgstr "" -#: ../../library/msvcrt.rst:154 +#: ../../library/msvcrt.rst:159 msgid "Other Functions" msgstr "" -#: ../../library/msvcrt.rst:159 +#: ../../library/msvcrt.rst:164 msgid "" "Force the :c:func:`malloc` heap to clean itself up and return unused blocks " "to the operating system. On failure, this raises :exc:`OSError`." msgstr "" -#: ../../library/msvcrt.rst:164 +#: ../../library/msvcrt.rst:170 +msgid "" +"Changes the location where the C runtime writes an error message for an " +"error that might end the program. *mode* must be one of the :const:`!" +"OUT_\\*` constants listed below or :const:`REPORT_ERRMODE`. Returns the old " +"setting or -1 if an error occurs. Only available in :ref:`debug build of " +"Python `." +msgstr "" + +#: ../../library/msvcrt.rst:179 +msgid "" +"Error sink is determined by the app's type. Only available in :ref:`debug " +"build of Python `." +msgstr "" + +#: ../../library/msvcrt.rst:185 +msgid "" +"Error sink is a standard error. Only available in :ref:`debug build of " +"Python `." +msgstr "" + +#: ../../library/msvcrt.rst:191 +msgid "" +"Error sink is a message box. Only available in :ref:`debug build of Python " +"`." +msgstr "" + +#: ../../library/msvcrt.rst:197 +msgid "" +"Report the current error mode value. Only available in :ref:`debug build of " +"Python `." +msgstr "" + +#: ../../library/msvcrt.rst:203 +msgid "" +"Specifies the destination or destinations for a specific report type " +"generated by :c:func:`!_CrtDbgReport` in the MS VC++ runtime. *type* must be " +"one of the :const:`!CRT_\\*` constants listed below. *mode* must be one of " +"the :const:`!CRTDBG_\\*` constants listed below. Only available in :ref:" +"`debug build of Python `." +msgstr "" + +#: ../../library/msvcrt.rst:212 +msgid "" +"After you use :func:`CrtSetReportMode` to specify :const:`CRTDBG_MODE_FILE`, " +"you can specify the file handle to receive the message text. *type* must be " +"one of the :const:`!CRT_\\*` constants listed below. *file* should be the " +"file handle your want specified. Only available in :ref:`debug build of " +"Python `." +msgstr "" + +#: ../../library/msvcrt.rst:221 +msgid "" +"Warnings, messages, and information that doesn't need immediate attention." +msgstr "" + +#: ../../library/msvcrt.rst:226 +msgid "" +"Errors, unrecoverable problems, and issues that require immediate attention." +msgstr "" + +#: ../../library/msvcrt.rst:231 +msgid "Assertion failures." +msgstr "" + +#: ../../library/msvcrt.rst:236 +msgid "Writes the message to the debugger's output window." +msgstr "" + +#: ../../library/msvcrt.rst:241 +msgid "" +"Writes the message to a user-supplied file handle. :func:`CrtSetReportFile` " +"should be called to define the specific file or stream to use as the " +"destination." +msgstr "" + +#: ../../library/msvcrt.rst:248 +msgid "" +"Creates a message box to display the message along with the ``Abort``, " +"``Retry``, and ``Ignore`` buttons." +msgstr "" + +#: ../../library/msvcrt.rst:254 +msgid "Returns current *mode* for the specified *type*." +msgstr "" + +#: ../../library/msvcrt.rst:259 msgid "The CRT Assembly version, from the :file:`crtassem.h` header file." msgstr "" -#: ../../library/msvcrt.rst:169 +#: ../../library/msvcrt.rst:264 msgid "" "The VC Assembly public key token, from the :file:`crtassem.h` header file." msgstr "" -#: ../../library/msvcrt.rst:174 +#: ../../library/msvcrt.rst:269 msgid "" "The Libraries Assembly name prefix, from the :file:`crtassem.h` header file." msgstr "" diff --git a/library/multiprocessing.po b/library/multiprocessing.po index c7910516ec..c428df62b4 100644 --- a/library/multiprocessing.po +++ b/library/multiprocessing.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,18 +25,17 @@ msgstr ":mod:`!multiprocessing` --- 以行程為基礎的平行性" msgid "**Source code:** :source:`Lib/multiprocessing/`" msgstr "**原始碼:**\\ :source:`Lib/multiprocessing/`" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +#: ../../includes/wasm-mobile-notavail.rst:3 +msgid ":ref:`Availability `: not Android, not iOS, not WASI." +msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" -#: ../../includes/wasm-notavail.rst:5 +#: ../../includes/wasm-mobile-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" +"台 `\\ 上不支援。" #: ../../library/multiprocessing.rst:14 msgid "Introduction" @@ -1566,8 +1565,8 @@ msgstr "" #: ../../library/multiprocessing.rst:1011 msgid "" "This number is not equivalent to the number of CPUs the current process can " -"use. The number of usable CPUs can be obtained with ``len(os." -"sched_getaffinity(0))``" +"use. The number of usable CPUs can be obtained with :func:`os." +"process_cpu_count` (or ``len(os.sched_getaffinity(0))``)." msgstr "" #: ../../library/multiprocessing.rst:1015 @@ -1577,39 +1576,46 @@ msgid "" msgstr "" #: ../../library/multiprocessing.rst:1019 -msgid ":func:`os.cpu_count`" -msgstr ":func:`os.cpu_count`" +msgid ":func:`os.cpu_count` :func:`os.process_cpu_count`" +msgstr "" + +#: ../../library/multiprocessing.rst:1024 +msgid "" +"The return value can also be overridden using the :option:`-X cpu_count <-" +"X>` flag or :envvar:`PYTHON_CPU_COUNT` as this is merely a wrapper around " +"the :mod:`os` cpu count APIs." +msgstr "" -#: ../../library/multiprocessing.rst:1023 +#: ../../library/multiprocessing.rst:1030 msgid "" "Return the :class:`Process` object corresponding to the current process." msgstr "" -#: ../../library/multiprocessing.rst:1025 +#: ../../library/multiprocessing.rst:1032 msgid "An analogue of :func:`threading.current_thread`." msgstr "" -#: ../../library/multiprocessing.rst:1029 +#: ../../library/multiprocessing.rst:1036 msgid "" "Return the :class:`Process` object corresponding to the parent process of " "the :func:`current_process`. For the main process, ``parent_process`` will " "be ``None``." msgstr "" -#: ../../library/multiprocessing.rst:1037 +#: ../../library/multiprocessing.rst:1044 msgid "" "Add support for when a program which uses :mod:`multiprocessing` has been " "frozen to produce a Windows executable. (Has been tested with **py2exe**, " "**PyInstaller** and **cx_Freeze**.)" msgstr "" -#: ../../library/multiprocessing.rst:1041 +#: ../../library/multiprocessing.rst:1048 msgid "" "One needs to call this function straight after the ``if __name__ == " "'__main__'`` line of the main module. For example::" msgstr "" -#: ../../library/multiprocessing.rst:1044 +#: ../../library/multiprocessing.rst:1051 msgid "" "from multiprocessing import Process, freeze_support\n" "\n" @@ -1629,13 +1635,13 @@ msgstr "" " freeze_support()\n" " Process(target=f).start()" -#: ../../library/multiprocessing.rst:1053 +#: ../../library/multiprocessing.rst:1060 msgid "" "If the ``freeze_support()`` line is omitted then trying to run the frozen " "executable will raise :exc:`RuntimeError`." msgstr "" -#: ../../library/multiprocessing.rst:1056 +#: ../../library/multiprocessing.rst:1063 msgid "" "Calling ``freeze_support()`` has no effect when invoked on any operating " "system other than Windows. In addition, if the module is being run normally " @@ -1643,7 +1649,7 @@ msgid "" "``freeze_support()`` has no effect." msgstr "" -#: ../../library/multiprocessing.rst:1063 +#: ../../library/multiprocessing.rst:1070 msgid "" "Returns a list of the supported start methods, the first of which is the " "default. The possible start methods are ``'fork'``, ``'spawn'`` and " @@ -1651,13 +1657,13 @@ msgid "" "`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1072 +#: ../../library/multiprocessing.rst:1079 msgid "" "Return a context object which has the same attributes as the :mod:" "`multiprocessing` module." msgstr "" -#: ../../library/multiprocessing.rst:1075 +#: ../../library/multiprocessing.rst:1082 msgid "" "If *method* is ``None`` then the default context is returned. Otherwise " "*method* should be ``'fork'``, ``'spawn'``, ``'forkserver'``. :exc:" @@ -1665,54 +1671,54 @@ msgid "" "ref:`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1084 +#: ../../library/multiprocessing.rst:1091 msgid "Return the name of start method used for starting processes." msgstr "" -#: ../../library/multiprocessing.rst:1086 +#: ../../library/multiprocessing.rst:1093 msgid "" "If the start method has not been fixed and *allow_none* is false, then the " "start method is fixed to the default and the name is returned. If the start " "method has not been fixed and *allow_none* is true then ``None`` is returned." msgstr "" -#: ../../library/multiprocessing.rst:1091 +#: ../../library/multiprocessing.rst:1098 msgid "" "The return value can be ``'fork'``, ``'spawn'``, ``'forkserver'`` or " "``None``. See :ref:`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1098 +#: ../../library/multiprocessing.rst:1105 msgid "" "On macOS, the *spawn* start method is now the default. The *fork* start " "method should be considered unsafe as it can lead to crashes of the " "subprocess. See :issue:`33725`." msgstr "" -#: ../../library/multiprocessing.rst:1104 +#: ../../library/multiprocessing.rst:1111 msgid "" "Set the path of the Python interpreter to use when starting a child process. " "(By default :data:`sys.executable` is used). Embedders will probably need " "to do some thing like ::" msgstr "" -#: ../../library/multiprocessing.rst:1108 +#: ../../library/multiprocessing.rst:1115 msgid "set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))" msgstr "set_executable(os.path.join(sys.exec_prefix, 'pythonw.exe'))" -#: ../../library/multiprocessing.rst:1110 +#: ../../library/multiprocessing.rst:1117 msgid "before they can create child processes." msgstr "" -#: ../../library/multiprocessing.rst:1112 +#: ../../library/multiprocessing.rst:1119 msgid "Now supported on POSIX when the ``'spawn'`` start method is used." msgstr "" -#: ../../library/multiprocessing.rst:1115 +#: ../../library/multiprocessing.rst:1122 msgid "Accepts a :term:`path-like object`." msgstr "接受一個\\ :term:`類路徑物件 `。" -#: ../../library/multiprocessing.rst:1120 +#: ../../library/multiprocessing.rst:1127 msgid "" "Set a list of module names for the forkserver main process to attempt to " "import so that their already imported state is inherited by forked " @@ -1721,19 +1727,19 @@ msgid "" "process." msgstr "" -#: ../../library/multiprocessing.rst:1126 +#: ../../library/multiprocessing.rst:1133 msgid "" "For this to work, it must be called before the forkserver process has been " "launched (before creating a :class:`Pool` or starting a :class:`Process`)." msgstr "" -#: ../../library/multiprocessing.rst:1129 +#: ../../library/multiprocessing.rst:1136 msgid "" "Only meaningful when using the ``'forkserver'`` start method. See :ref:" "`multiprocessing-start-methods`." msgstr "" -#: ../../library/multiprocessing.rst:1136 +#: ../../library/multiprocessing.rst:1143 msgid "" "Set the method which should be used to start child processes. The *method* " "argument can be ``'fork'``, ``'spawn'`` or ``'forkserver'``. Raises :exc:" @@ -1743,17 +1749,17 @@ msgid "" "then the context is set to the default context." msgstr "" -#: ../../library/multiprocessing.rst:1143 +#: ../../library/multiprocessing.rst:1150 msgid "" "Note that this should be called at most once, and it should be protected " "inside the ``if __name__ == '__main__'`` clause of the main module." msgstr "" -#: ../../library/multiprocessing.rst:1147 +#: ../../library/multiprocessing.rst:1154 msgid "See :ref:`multiprocessing-start-methods`." msgstr "參閱 :ref:`multiprocessing-start-methods`。" -#: ../../library/multiprocessing.rst:1153 +#: ../../library/multiprocessing.rst:1160 msgid "" ":mod:`multiprocessing` contains no analogues of :func:`threading." "active_count`, :func:`threading.enumerate`, :func:`threading.settrace`, :" @@ -1761,75 +1767,75 @@ msgid "" "local`." msgstr "" -#: ../../library/multiprocessing.rst:1160 +#: ../../library/multiprocessing.rst:1167 msgid "Connection Objects" msgstr "" -#: ../../library/multiprocessing.rst:1164 +#: ../../library/multiprocessing.rst:1171 msgid "" "Connection objects allow the sending and receiving of picklable objects or " "strings. They can be thought of as message oriented connected sockets." msgstr "" -#: ../../library/multiprocessing.rst:1167 +#: ../../library/multiprocessing.rst:1174 msgid "" "Connection objects are usually created using :func:`Pipe ` -- see also :ref:`multiprocessing-listeners-clients`." msgstr "" -#: ../../library/multiprocessing.rst:1175 +#: ../../library/multiprocessing.rst:1182 msgid "" "Send an object to the other end of the connection which should be read " "using :meth:`recv`." msgstr "" -#: ../../library/multiprocessing.rst:1178 +#: ../../library/multiprocessing.rst:1185 msgid "" "The object must be picklable. Very large pickles (approximately 32 MiB+, " "though it depends on the OS) may raise a :exc:`ValueError` exception." msgstr "" -#: ../../library/multiprocessing.rst:1183 +#: ../../library/multiprocessing.rst:1190 msgid "" "Return an object sent from the other end of the connection using :meth:" "`send`. Blocks until there is something to receive. Raises :exc:`EOFError` " "if there is nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1190 +#: ../../library/multiprocessing.rst:1197 msgid "Return the file descriptor or handle used by the connection." msgstr "" -#: ../../library/multiprocessing.rst:1194 +#: ../../library/multiprocessing.rst:1201 msgid "Close the connection." msgstr "" -#: ../../library/multiprocessing.rst:1196 +#: ../../library/multiprocessing.rst:1203 msgid "This is called automatically when the connection is garbage collected." msgstr "" -#: ../../library/multiprocessing.rst:1200 +#: ../../library/multiprocessing.rst:1207 msgid "Return whether there is any data available to be read." msgstr "" -#: ../../library/multiprocessing.rst:1202 +#: ../../library/multiprocessing.rst:1209 msgid "" "If *timeout* is not specified then it will return immediately. If *timeout* " "is a number then this specifies the maximum time in seconds to block. If " "*timeout* is ``None`` then an infinite timeout is used." msgstr "" -#: ../../library/multiprocessing.rst:1206 +#: ../../library/multiprocessing.rst:1213 msgid "" "Note that multiple connection objects may be polled at once by using :func:" "`multiprocessing.connection.wait`." msgstr "" -#: ../../library/multiprocessing.rst:1211 +#: ../../library/multiprocessing.rst:1218 msgid "Send byte data from a :term:`bytes-like object` as a complete message." msgstr "" -#: ../../library/multiprocessing.rst:1213 +#: ../../library/multiprocessing.rst:1220 msgid "" "If *offset* is given then data is read from that position in *buffer*. If " "*size* is given then that many bytes will be read from buffer. Very large " @@ -1837,7 +1843,7 @@ msgid "" "exc:`ValueError` exception" msgstr "" -#: ../../library/multiprocessing.rst:1220 +#: ../../library/multiprocessing.rst:1227 msgid "" "Return a complete message of byte data sent from the other end of the " "connection as a string. Blocks until there is something to receive. Raises :" @@ -1845,19 +1851,19 @@ msgid "" "closed." msgstr "" -#: ../../library/multiprocessing.rst:1225 +#: ../../library/multiprocessing.rst:1232 msgid "" "If *maxlength* is specified and the message is longer than *maxlength* then :" "exc:`OSError` is raised and the connection will no longer be readable." msgstr "" -#: ../../library/multiprocessing.rst:1229 +#: ../../library/multiprocessing.rst:1236 msgid "" "This function used to raise :exc:`IOError`, which is now an alias of :exc:" "`OSError`." msgstr "" -#: ../../library/multiprocessing.rst:1236 +#: ../../library/multiprocessing.rst:1243 msgid "" "Read into *buffer* a complete message of byte data sent from the other end " "of the connection and return the number of bytes in the message. Blocks " @@ -1865,38 +1871,38 @@ msgid "" "nothing left to receive and the other end was closed." msgstr "" -#: ../../library/multiprocessing.rst:1242 +#: ../../library/multiprocessing.rst:1249 msgid "" "*buffer* must be a writable :term:`bytes-like object`. If *offset* is given " "then the message will be written into the buffer from that position. Offset " "must be a non-negative integer less than the length of *buffer* (in bytes)." msgstr "" -#: ../../library/multiprocessing.rst:1247 +#: ../../library/multiprocessing.rst:1254 msgid "" "If the buffer is too short then a :exc:`BufferTooShort` exception is raised " "and the complete message is available as ``e.args[0]`` where ``e`` is the " "exception instance." msgstr "" -#: ../../library/multiprocessing.rst:1251 +#: ../../library/multiprocessing.rst:1258 msgid "" "Connection objects themselves can now be transferred between processes " "using :meth:`Connection.send` and :meth:`Connection.recv`." msgstr "" -#: ../../library/multiprocessing.rst:1255 +#: ../../library/multiprocessing.rst:1262 msgid "" "Connection objects also now support the context management protocol -- see :" "ref:`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "connection object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:1259 +#: ../../library/multiprocessing.rst:1266 msgid "For example:" msgstr "舉例來說:" -#: ../../library/multiprocessing.rst:1261 +#: ../../library/multiprocessing.rst:1268 msgid "" ">>> from multiprocessing import Pipe\n" ">>> a, b = Pipe()\n" @@ -1932,14 +1938,14 @@ msgstr "" ">>> arr2\n" "array('i', [0, 1, 2, 3, 4, 0, 0, 0, 0, 0])" -#: ../../library/multiprocessing.rst:1284 +#: ../../library/multiprocessing.rst:1291 msgid "" "The :meth:`Connection.recv` method automatically unpickles the data it " "receives, which can be a security risk unless you can trust the process " "which sent the message." msgstr "" -#: ../../library/multiprocessing.rst:1288 +#: ../../library/multiprocessing.rst:1295 msgid "" "Therefore, unless the connection object was produced using :func:`Pipe` you " "should only use the :meth:`~Connection.recv` and :meth:`~Connection.send` " @@ -1947,73 +1953,73 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:1295 +#: ../../library/multiprocessing.rst:1302 msgid "" "If a process is killed while it is trying to read or write to a pipe then " "the data in the pipe is likely to become corrupted, because it may become " "impossible to be sure where the message boundaries lie." msgstr "" -#: ../../library/multiprocessing.rst:1301 +#: ../../library/multiprocessing.rst:1308 msgid "Synchronization primitives" msgstr "" -#: ../../library/multiprocessing.rst:1305 +#: ../../library/multiprocessing.rst:1312 msgid "" "Generally synchronization primitives are not as necessary in a multiprocess " "program as they are in a multithreaded program. See the documentation for :" "mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:1309 +#: ../../library/multiprocessing.rst:1316 msgid "" "Note that one can also create synchronization primitives by using a manager " "object -- see :ref:`multiprocessing-managers`." msgstr "" -#: ../../library/multiprocessing.rst:1314 +#: ../../library/multiprocessing.rst:1321 msgid "A barrier object: a clone of :class:`threading.Barrier`." msgstr "" -#: ../../library/multiprocessing.rst:1320 +#: ../../library/multiprocessing.rst:1327 msgid "" "A bounded semaphore object: a close analog of :class:`threading." "BoundedSemaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1323 -#: ../../library/multiprocessing.rst:1461 +#: ../../library/multiprocessing.rst:1330 +#: ../../library/multiprocessing.rst:1468 msgid "" "A solitary difference from its close analog exists: its ``acquire`` method's " "first argument is named *block*, as is consistent with :meth:`Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1327 +#: ../../library/multiprocessing.rst:1334 msgid "" "On macOS, this is indistinguishable from :class:`Semaphore` because " "``sem_getvalue()`` is not implemented on that platform." msgstr "" -#: ../../library/multiprocessing.rst:1332 +#: ../../library/multiprocessing.rst:1339 msgid "A condition variable: an alias for :class:`threading.Condition`." msgstr "" -#: ../../library/multiprocessing.rst:1334 +#: ../../library/multiprocessing.rst:1341 msgid "" "If *lock* is specified then it should be a :class:`Lock` or :class:`RLock` " "object from :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:1337 -#: ../../library/multiprocessing.rst:1875 +#: ../../library/multiprocessing.rst:1344 +#: ../../library/multiprocessing.rst:1882 msgid "The :meth:`~threading.Condition.wait_for` method was added." msgstr "" -#: ../../library/multiprocessing.rst:1342 +#: ../../library/multiprocessing.rst:1349 msgid "A clone of :class:`threading.Event`." msgstr "" -#: ../../library/multiprocessing.rst:1347 +#: ../../library/multiprocessing.rst:1354 msgid "" "A non-recursive lock object: a close analog of :class:`threading.Lock`. Once " "a process or thread has acquired a lock, subsequent attempts to acquire it " @@ -2024,25 +2030,25 @@ msgid "" "as noted." msgstr "" -#: ../../library/multiprocessing.rst:1355 +#: ../../library/multiprocessing.rst:1362 msgid "" "Note that :class:`Lock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.Lock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1359 +#: ../../library/multiprocessing.rst:1366 msgid "" ":class:`Lock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1364 -#: ../../library/multiprocessing.rst:1415 +#: ../../library/multiprocessing.rst:1371 +#: ../../library/multiprocessing.rst:1422 msgid "Acquire a lock, blocking or non-blocking." msgstr "" -#: ../../library/multiprocessing.rst:1366 +#: ../../library/multiprocessing.rst:1373 msgid "" "With the *block* argument set to ``True`` (the default), the method call " "will block until the lock is in an unlocked state, then set it to locked and " @@ -2050,14 +2056,14 @@ msgid "" "that in :meth:`threading.Lock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1371 +#: ../../library/multiprocessing.rst:1378 msgid "" "With the *block* argument set to ``False``, the method call does not block. " "If the lock is currently in a locked state, return ``False``; otherwise set " "the lock to a locked state and return ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1375 +#: ../../library/multiprocessing.rst:1382 msgid "" "When invoked with a positive, floating-point value for *timeout*, block for " "at most the number of seconds specified by *timeout* as long as the lock can " @@ -2071,19 +2077,19 @@ msgid "" "acquired or ``False`` if the timeout period has elapsed." msgstr "" -#: ../../library/multiprocessing.rst:1390 +#: ../../library/multiprocessing.rst:1397 msgid "" "Release a lock. This can be called from any process or thread, not only the " "process or thread which originally acquired the lock." msgstr "" -#: ../../library/multiprocessing.rst:1393 +#: ../../library/multiprocessing.rst:1400 msgid "" "Behavior is the same as in :meth:`threading.Lock.release` except that when " "invoked on an unlocked lock, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:1399 +#: ../../library/multiprocessing.rst:1406 msgid "" "A recursive lock object: a close analog of :class:`threading.RLock`. A " "recursive lock must be released by the process or thread that acquired it. " @@ -2092,20 +2098,20 @@ msgid "" "release it once for each time it has been acquired." msgstr "" -#: ../../library/multiprocessing.rst:1405 +#: ../../library/multiprocessing.rst:1412 msgid "" "Note that :class:`RLock` is actually a factory function which returns an " "instance of ``multiprocessing.synchronize.RLock`` initialized with a default " "context." msgstr "" -#: ../../library/multiprocessing.rst:1409 +#: ../../library/multiprocessing.rst:1416 msgid "" ":class:`RLock` supports the :term:`context manager` protocol and thus may be " "used in :keyword:`with` statements." msgstr "" -#: ../../library/multiprocessing.rst:1417 +#: ../../library/multiprocessing.rst:1424 msgid "" "When invoked with the *block* argument set to ``True``, block until the lock " "is in an unlocked state (not owned by any process or thread) unless the lock " @@ -2118,7 +2124,7 @@ msgid "" "itself." msgstr "" -#: ../../library/multiprocessing.rst:1427 +#: ../../library/multiprocessing.rst:1434 msgid "" "When invoked with the *block* argument set to ``False``, do not block. If " "the lock has already been acquired (and thus is owned) by another process or " @@ -2129,14 +2135,14 @@ msgid "" "a return value of ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1435 +#: ../../library/multiprocessing.rst:1442 msgid "" "Use and behaviors of the *timeout* argument are the same as in :meth:`Lock." "acquire`. Note that some of these behaviors of *timeout* differ from the " "implemented behaviors in :meth:`threading.RLock.acquire`." msgstr "" -#: ../../library/multiprocessing.rst:1442 +#: ../../library/multiprocessing.rst:1449 msgid "" "Release a lock, decrementing the recursion level. If after the decrement " "the recursion level is zero, reset the lock to unlocked (not owned by any " @@ -2146,7 +2152,7 @@ msgid "" "locked and owned by the calling process or thread." msgstr "" -#: ../../library/multiprocessing.rst:1450 +#: ../../library/multiprocessing.rst:1457 msgid "" "Only call this method when the calling process or thread owns the lock. An :" "exc:`AssertionError` is raised if this method is called by a process or " @@ -2155,17 +2161,17 @@ msgid "" "from the implemented behavior in :meth:`threading.RLock.release`." msgstr "" -#: ../../library/multiprocessing.rst:1459 +#: ../../library/multiprocessing.rst:1466 msgid "A semaphore object: a close analog of :class:`threading.Semaphore`." msgstr "" -#: ../../library/multiprocessing.rst:1466 +#: ../../library/multiprocessing.rst:1473 msgid "" "On macOS, ``sem_timedwait`` is unsupported, so calling ``acquire()`` with a " "timeout will emulate that function's behavior using a sleeping loop." msgstr "" -#: ../../library/multiprocessing.rst:1471 +#: ../../library/multiprocessing.rst:1478 msgid "" "Some of this package's functionality requires a functioning shared semaphore " "implementation on the host operating system. Without one, the :mod:" @@ -2174,32 +2180,32 @@ msgid "" "additional information." msgstr "" -#: ../../library/multiprocessing.rst:1479 +#: ../../library/multiprocessing.rst:1486 msgid "Shared :mod:`ctypes` Objects" msgstr "共享的 :mod:`ctypes` 物件" -#: ../../library/multiprocessing.rst:1481 +#: ../../library/multiprocessing.rst:1488 msgid "" "It is possible to create shared objects using shared memory which can be " "inherited by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1486 +#: ../../library/multiprocessing.rst:1493 msgid "" "Return a :mod:`ctypes` object allocated from shared memory. By default the " "return value is actually a synchronized wrapper for the object. The object " "itself can be accessed via the *value* attribute of a :class:`Value`." msgstr "" -#: ../../library/multiprocessing.rst:1490 -#: ../../library/multiprocessing.rst:1577 +#: ../../library/multiprocessing.rst:1497 +#: ../../library/multiprocessing.rst:1584 msgid "" "*typecode_or_type* determines the type of the returned object: it is either " "a ctypes type or a one character typecode of the kind used by the :mod:" "`array` module. *\\*args* is passed on to the constructor for the type." msgstr "" -#: ../../library/multiprocessing.rst:1494 +#: ../../library/multiprocessing.rst:1501 msgid "" "If *lock* is ``True`` (the default) then a new recursive lock object is " "created to synchronize access to the value. If *lock* is a :class:`Lock` " @@ -2209,24 +2215,24 @@ msgid "" "\"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1501 +#: ../../library/multiprocessing.rst:1508 msgid "" "Operations like ``+=`` which involve a read and write are not atomic. So " "if, for instance, you want to atomically increment a shared value it is " "insufficient to just do ::" msgstr "" -#: ../../library/multiprocessing.rst:1505 +#: ../../library/multiprocessing.rst:1512 msgid "counter.value += 1" msgstr "counter.value += 1" -#: ../../library/multiprocessing.rst:1507 +#: ../../library/multiprocessing.rst:1514 msgid "" "Assuming the associated lock is recursive (which it is by default) you can " "instead do ::" msgstr "" -#: ../../library/multiprocessing.rst:1510 +#: ../../library/multiprocessing.rst:1517 msgid "" "with counter.get_lock():\n" " counter.value += 1" @@ -2234,19 +2240,19 @@ msgstr "" "with counter.get_lock():\n" " counter.value += 1" -#: ../../library/multiprocessing.rst:1513 -#: ../../library/multiprocessing.rst:1603 -#: ../../library/multiprocessing.rst:1618 +#: ../../library/multiprocessing.rst:1520 +#: ../../library/multiprocessing.rst:1610 +#: ../../library/multiprocessing.rst:1625 msgid "Note that *lock* is a keyword-only argument." msgstr "" -#: ../../library/multiprocessing.rst:1517 +#: ../../library/multiprocessing.rst:1524 msgid "" "Return a ctypes array allocated from shared memory. By default the return " "value is actually a synchronized wrapper for the array." msgstr "" -#: ../../library/multiprocessing.rst:1520 +#: ../../library/multiprocessing.rst:1527 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -2256,7 +2262,7 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1527 +#: ../../library/multiprocessing.rst:1534 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`Lock` or :class:" @@ -2266,28 +2272,28 @@ msgid "" "safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1534 +#: ../../library/multiprocessing.rst:1541 msgid "Note that *lock* is a keyword only argument." msgstr "" -#: ../../library/multiprocessing.rst:1536 +#: ../../library/multiprocessing.rst:1543 msgid "" "Note that an array of :data:`ctypes.c_char` has *value* and *raw* attributes " "which allow one to use it to store and retrieve strings." msgstr "" -#: ../../library/multiprocessing.rst:1541 +#: ../../library/multiprocessing.rst:1548 msgid "The :mod:`multiprocessing.sharedctypes` module" msgstr ":mod:`multiprocessing.sharedctypes` 模組" -#: ../../library/multiprocessing.rst:1546 +#: ../../library/multiprocessing.rst:1553 msgid "" "The :mod:`multiprocessing.sharedctypes` module provides functions for " "allocating :mod:`ctypes` objects from shared memory which can be inherited " "by child processes." msgstr "" -#: ../../library/multiprocessing.rst:1552 +#: ../../library/multiprocessing.rst:1559 msgid "" "Although it is possible to store a pointer in shared memory remember that " "this will refer to a location in the address space of a specific process. " @@ -2296,11 +2302,11 @@ msgid "" "may cause a crash." msgstr "" -#: ../../library/multiprocessing.rst:1560 +#: ../../library/multiprocessing.rst:1567 msgid "Return a ctypes array allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1562 +#: ../../library/multiprocessing.rst:1569 msgid "" "*typecode_or_type* determines the type of the elements of the returned " "array: it is either a ctypes type or a one character typecode of the kind " @@ -2310,40 +2316,40 @@ msgid "" "initialize the array and whose length determines the length of the array." msgstr "" -#: ../../library/multiprocessing.rst:1569 +#: ../../library/multiprocessing.rst:1576 msgid "" "Note that setting and getting an element is potentially non-atomic -- use :" "func:`Array` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1575 +#: ../../library/multiprocessing.rst:1582 msgid "Return a ctypes object allocated from shared memory." msgstr "" -#: ../../library/multiprocessing.rst:1581 +#: ../../library/multiprocessing.rst:1588 msgid "" "Note that setting and getting the value is potentially non-atomic -- use :" "func:`Value` instead to make sure that access is automatically synchronized " "using a lock." msgstr "" -#: ../../library/multiprocessing.rst:1585 +#: ../../library/multiprocessing.rst:1592 msgid "" "Note that an array of :data:`ctypes.c_char` has ``value`` and ``raw`` " "attributes which allow one to use it to store and retrieve strings -- see " "documentation for :mod:`ctypes`." msgstr "" -#: ../../library/multiprocessing.rst:1591 +#: ../../library/multiprocessing.rst:1598 msgid "" "The same as :func:`RawArray` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "array." msgstr "" -#: ../../library/multiprocessing.rst:1595 -#: ../../library/multiprocessing.rst:1611 +#: ../../library/multiprocessing.rst:1602 +#: ../../library/multiprocessing.rst:1618 msgid "" "If *lock* is ``True`` (the default) then a new lock object is created to " "synchronize access to the value. If *lock* is a :class:`~multiprocessing." @@ -2353,113 +2359,113 @@ msgid "" "not necessarily be \"process-safe\"." msgstr "" -#: ../../library/multiprocessing.rst:1607 +#: ../../library/multiprocessing.rst:1614 msgid "" "The same as :func:`RawValue` except that depending on the value of *lock* a " "process-safe synchronization wrapper may be returned instead of a raw ctypes " "object." msgstr "" -#: ../../library/multiprocessing.rst:1622 +#: ../../library/multiprocessing.rst:1629 msgid "" "Return a ctypes object allocated from shared memory which is a copy of the " "ctypes object *obj*." msgstr "" -#: ../../library/multiprocessing.rst:1627 +#: ../../library/multiprocessing.rst:1634 msgid "" "Return a process-safe wrapper object for a ctypes object which uses *lock* " "to synchronize access. If *lock* is ``None`` (the default) then a :class:" "`multiprocessing.RLock` object is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1631 +#: ../../library/multiprocessing.rst:1638 msgid "" "A synchronized wrapper will have two methods in addition to those of the " "object it wraps: :meth:`get_obj` returns the wrapped object and :meth:" "`get_lock` returns the lock object used for synchronization." msgstr "" -#: ../../library/multiprocessing.rst:1635 +#: ../../library/multiprocessing.rst:1642 msgid "" "Note that accessing the ctypes object through the wrapper can be a lot " "slower than accessing the raw ctypes object." msgstr "" -#: ../../library/multiprocessing.rst:1638 +#: ../../library/multiprocessing.rst:1645 msgid "Synchronized objects support the :term:`context manager` protocol." msgstr "" -#: ../../library/multiprocessing.rst:1642 +#: ../../library/multiprocessing.rst:1649 msgid "" "The table below compares the syntax for creating shared ctypes objects from " "shared memory with the normal ctypes syntax. (In the table ``MyStruct`` is " "some subclass of :class:`ctypes.Structure`.)" msgstr "" -#: ../../library/multiprocessing.rst:1647 +#: ../../library/multiprocessing.rst:1654 msgid "ctypes" msgstr "ctypes" -#: ../../library/multiprocessing.rst:1647 +#: ../../library/multiprocessing.rst:1654 msgid "sharedctypes using type" msgstr "" -#: ../../library/multiprocessing.rst:1647 +#: ../../library/multiprocessing.rst:1654 msgid "sharedctypes using typecode" msgstr "" -#: ../../library/multiprocessing.rst:1649 +#: ../../library/multiprocessing.rst:1656 msgid "c_double(2.4)" msgstr "c_double(2.4)" -#: ../../library/multiprocessing.rst:1649 +#: ../../library/multiprocessing.rst:1656 msgid "RawValue(c_double, 2.4)" msgstr "RawValue(c_double, 2.4)" -#: ../../library/multiprocessing.rst:1649 +#: ../../library/multiprocessing.rst:1656 msgid "RawValue('d', 2.4)" msgstr "RawValue('d', 2.4)" -#: ../../library/multiprocessing.rst:1650 +#: ../../library/multiprocessing.rst:1657 msgid "MyStruct(4, 6)" msgstr "MyStruct(4, 6)" -#: ../../library/multiprocessing.rst:1650 +#: ../../library/multiprocessing.rst:1657 msgid "RawValue(MyStruct, 4, 6)" msgstr "RawValue(MyStruct, 4, 6)" -#: ../../library/multiprocessing.rst:1651 +#: ../../library/multiprocessing.rst:1658 msgid "(c_short * 7)()" msgstr "(c_short * 7)()" -#: ../../library/multiprocessing.rst:1651 +#: ../../library/multiprocessing.rst:1658 msgid "RawArray(c_short, 7)" msgstr "RawArray(c_short, 7)" -#: ../../library/multiprocessing.rst:1651 +#: ../../library/multiprocessing.rst:1658 msgid "RawArray('h', 7)" msgstr "RawArray('h', 7)" -#: ../../library/multiprocessing.rst:1652 +#: ../../library/multiprocessing.rst:1659 msgid "(c_int * 3)(9, 2, 8)" msgstr "(c_int * 3)(9, 2, 8)" -#: ../../library/multiprocessing.rst:1652 +#: ../../library/multiprocessing.rst:1659 msgid "RawArray(c_int, (9, 2, 8))" msgstr "RawArray(c_int, (9, 2, 8))" -#: ../../library/multiprocessing.rst:1652 +#: ../../library/multiprocessing.rst:1659 msgid "RawArray('i', (9, 2, 8))" msgstr "RawArray('i', (9, 2, 8))" -#: ../../library/multiprocessing.rst:1656 +#: ../../library/multiprocessing.rst:1663 msgid "" "Below is an example where a number of ctypes objects are modified by a child " "process::" msgstr "" -#: ../../library/multiprocessing.rst:1659 +#: ../../library/multiprocessing.rst:1666 msgid "" "from multiprocessing import Process, Lock\n" "from multiprocessing.sharedctypes import Value, Array\n" @@ -2525,11 +2531,11 @@ msgstr "" " print(s.value)\n" " print([(a.x, a.y) for a in A])" -#: ../../library/multiprocessing.rst:1694 +#: ../../library/multiprocessing.rst:1701 msgid "The results printed are ::" msgstr "" -#: ../../library/multiprocessing.rst:1696 +#: ../../library/multiprocessing.rst:1703 msgid "" "49\n" "0.1111111111111111\n" @@ -2541,11 +2547,11 @@ msgstr "" "HELLO WORLD\n" "[(3.515625, 39.0625), (33.0625, 4.0), (5.640625, 90.25)]" -#: ../../library/multiprocessing.rst:1707 +#: ../../library/multiprocessing.rst:1714 msgid "Managers" msgstr "" -#: ../../library/multiprocessing.rst:1709 +#: ../../library/multiprocessing.rst:1716 msgid "" "Managers provide a way to create data which can be shared between different " "processes, including sharing over a network between processes running on " @@ -2554,7 +2560,7 @@ msgid "" "proxies." msgstr "" -#: ../../library/multiprocessing.rst:1718 +#: ../../library/multiprocessing.rst:1725 msgid "" "Returns a started :class:`~multiprocessing.managers.SyncManager` object " "which can be used for sharing objects between processes. The returned " @@ -2562,31 +2568,31 @@ msgid "" "will create shared objects and return corresponding proxies." msgstr "" -#: ../../library/multiprocessing.rst:1726 +#: ../../library/multiprocessing.rst:1733 msgid "" "Manager processes will be shutdown as soon as they are garbage collected or " "their parent process exits. The manager classes are defined in the :mod:" "`multiprocessing.managers` module:" msgstr "" -#: ../../library/multiprocessing.rst:1732 +#: ../../library/multiprocessing.rst:1739 msgid "Create a BaseManager object." msgstr "建立一個 BaseManager 物件。" -#: ../../library/multiprocessing.rst:1734 +#: ../../library/multiprocessing.rst:1741 msgid "" "Once created one should call :meth:`start` or ``get_server()." "serve_forever()`` to ensure that the manager object refers to a started " "manager process." msgstr "" -#: ../../library/multiprocessing.rst:1737 +#: ../../library/multiprocessing.rst:1744 msgid "" "*address* is the address on which the manager process listens for new " "connections. If *address* is ``None`` then an arbitrary one is chosen." msgstr "" -#: ../../library/multiprocessing.rst:1740 +#: ../../library/multiprocessing.rst:1747 msgid "" "*authkey* is the authentication key which will be used to check the validity " "of incoming connections to the server process. If *authkey* is ``None`` " @@ -2594,19 +2600,19 @@ msgid "" "it must be a byte string." msgstr "" -#: ../../library/multiprocessing.rst:1745 +#: ../../library/multiprocessing.rst:1752 msgid "" "*serializer* must be ``'pickle'`` (use :mod:`pickle` serialization) or " "``'xmlrpclib'`` (use :mod:`xmlrpc.client` serialization)." msgstr "" -#: ../../library/multiprocessing.rst:1748 +#: ../../library/multiprocessing.rst:1755 msgid "" "*ctx* is a context object, or ``None`` (use the current context). See the :" "func:`get_context` function." msgstr "" -#: ../../library/multiprocessing.rst:1751 +#: ../../library/multiprocessing.rst:1758 msgid "" "*shutdown_timeout* is a timeout in seconds used to wait until the process " "used by the manager completes in the :meth:`shutdown` method. If the " @@ -2614,24 +2620,24 @@ msgid "" "also times out, the process is killed." msgstr "" -#: ../../library/multiprocessing.rst:1756 +#: ../../library/multiprocessing.rst:1763 msgid "Added the *shutdown_timeout* parameter." msgstr "新增 *shutdown_timeout* 參數。" -#: ../../library/multiprocessing.rst:1761 +#: ../../library/multiprocessing.rst:1768 msgid "" "Start a subprocess to start the manager. If *initializer* is not ``None`` " "then the subprocess will call ``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:1766 +#: ../../library/multiprocessing.rst:1773 msgid "" "Returns a :class:`Server` object which represents the actual server under " "the control of the Manager. The :class:`Server` object supports the :meth:" "`serve_forever` method::" msgstr "" -#: ../../library/multiprocessing.rst:1770 +#: ../../library/multiprocessing.rst:1777 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> manager = BaseManager(address=('', 50000), authkey=b'abc')\n" @@ -2643,15 +2649,15 @@ msgstr "" ">>> server = manager.get_server()\n" ">>> server.serve_forever()" -#: ../../library/multiprocessing.rst:1775 +#: ../../library/multiprocessing.rst:1782 msgid ":class:`Server` additionally has an :attr:`address` attribute." msgstr "" -#: ../../library/multiprocessing.rst:1779 +#: ../../library/multiprocessing.rst:1786 msgid "Connect a local manager object to a remote manager process::" msgstr "" -#: ../../library/multiprocessing.rst:1781 +#: ../../library/multiprocessing.rst:1788 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')\n" @@ -2661,29 +2667,29 @@ msgstr "" ">>> m = BaseManager(address=('127.0.0.1', 50000), authkey=b'abc')\n" ">>> m.connect()" -#: ../../library/multiprocessing.rst:1787 +#: ../../library/multiprocessing.rst:1794 msgid "" "Stop the process used by the manager. This is only available if :meth:" "`start` has been used to start the server process." msgstr "" -#: ../../library/multiprocessing.rst:1790 +#: ../../library/multiprocessing.rst:1797 msgid "This can be called multiple times." msgstr "" -#: ../../library/multiprocessing.rst:1794 +#: ../../library/multiprocessing.rst:1801 msgid "" "A classmethod which can be used for registering a type or callable with the " "manager class." msgstr "" -#: ../../library/multiprocessing.rst:1797 +#: ../../library/multiprocessing.rst:1804 msgid "" "*typeid* is a \"type identifier\" which is used to identify a particular " "type of shared object. This must be a string." msgstr "" -#: ../../library/multiprocessing.rst:1800 +#: ../../library/multiprocessing.rst:1807 msgid "" "*callable* is a callable used for creating objects for this type " "identifier. If a manager instance will be connected to the server using " @@ -2691,14 +2697,14 @@ msgid "" "then this can be left as ``None``." msgstr "" -#: ../../library/multiprocessing.rst:1806 +#: ../../library/multiprocessing.rst:1813 msgid "" "*proxytype* is a subclass of :class:`BaseProxy` which is used to create " "proxies for shared objects with this *typeid*. If ``None`` then a proxy " "class is created automatically." msgstr "" -#: ../../library/multiprocessing.rst:1810 +#: ../../library/multiprocessing.rst:1817 msgid "" "*exposed* is used to specify a sequence of method names which proxies for " "this typeid should be allowed to access using :meth:`BaseProxy." @@ -2709,7 +2715,7 @@ msgid "" "method and whose name does not begin with ``'_'``.)" msgstr "" -#: ../../library/multiprocessing.rst:1819 +#: ../../library/multiprocessing.rst:1826 msgid "" "*method_to_typeid* is a mapping used to specify the return type of those " "exposed methods which should return a proxy. It maps method names to typeid " @@ -2719,22 +2725,22 @@ msgid "" "returned by the method will be copied by value." msgstr "" -#: ../../library/multiprocessing.rst:1826 +#: ../../library/multiprocessing.rst:1833 msgid "" "*create_method* determines whether a method should be created with name " "*typeid* which can be used to tell the server process to create a new shared " "object and return a proxy for it. By default it is ``True``." msgstr "" -#: ../../library/multiprocessing.rst:1830 +#: ../../library/multiprocessing.rst:1837 msgid ":class:`BaseManager` instances also have one read-only property:" msgstr "" -#: ../../library/multiprocessing.rst:1834 +#: ../../library/multiprocessing.rst:1841 msgid "The address used by the manager." msgstr "" -#: ../../library/multiprocessing.rst:1836 +#: ../../library/multiprocessing.rst:1843 msgid "" "Manager objects support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` starts the server " @@ -2742,121 +2748,121 @@ msgid "" "object. :meth:`~contextmanager.__exit__` calls :meth:`shutdown`." msgstr "" -#: ../../library/multiprocessing.rst:1842 +#: ../../library/multiprocessing.rst:1849 msgid "" "In previous versions :meth:`~contextmanager.__enter__` did not start the " "manager's server process if it was not already started." msgstr "" -#: ../../library/multiprocessing.rst:1847 +#: ../../library/multiprocessing.rst:1854 msgid "" "A subclass of :class:`BaseManager` which can be used for the synchronization " "of processes. Objects of this type are returned by :func:`multiprocessing." "Manager`." msgstr "" -#: ../../library/multiprocessing.rst:1851 +#: ../../library/multiprocessing.rst:1858 msgid "" "Its methods create and return :ref:`multiprocessing-proxy_objects` for a " "number of commonly used data types to be synchronized across processes. This " "notably includes shared lists and dictionaries." msgstr "" -#: ../../library/multiprocessing.rst:1857 +#: ../../library/multiprocessing.rst:1864 msgid "" "Create a shared :class:`threading.Barrier` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1864 +#: ../../library/multiprocessing.rst:1871 msgid "" "Create a shared :class:`threading.BoundedSemaphore` object and return a " "proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1869 +#: ../../library/multiprocessing.rst:1876 msgid "" "Create a shared :class:`threading.Condition` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1872 +#: ../../library/multiprocessing.rst:1879 msgid "" "If *lock* is supplied then it should be a proxy for a :class:`threading." "Lock` or :class:`threading.RLock` object." msgstr "" -#: ../../library/multiprocessing.rst:1880 +#: ../../library/multiprocessing.rst:1887 msgid "" "Create a shared :class:`threading.Event` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1884 +#: ../../library/multiprocessing.rst:1891 msgid "" "Create a shared :class:`threading.Lock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1888 +#: ../../library/multiprocessing.rst:1895 msgid "Create a shared :class:`Namespace` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1892 +#: ../../library/multiprocessing.rst:1899 msgid "Create a shared :class:`queue.Queue` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1896 +#: ../../library/multiprocessing.rst:1903 msgid "" "Create a shared :class:`threading.RLock` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1900 +#: ../../library/multiprocessing.rst:1907 msgid "" "Create a shared :class:`threading.Semaphore` object and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1905 +#: ../../library/multiprocessing.rst:1912 msgid "Create an array and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1909 +#: ../../library/multiprocessing.rst:1916 msgid "" "Create an object with a writable ``value`` attribute and return a proxy for " "it." msgstr "" -#: ../../library/multiprocessing.rst:1916 +#: ../../library/multiprocessing.rst:1923 msgid "Create a shared :class:`dict` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1921 +#: ../../library/multiprocessing.rst:1928 msgid "Create a shared :class:`list` object and return a proxy for it." msgstr "" -#: ../../library/multiprocessing.rst:1923 +#: ../../library/multiprocessing.rst:1930 msgid "" "Shared objects are capable of being nested. For example, a shared container " "object such as a shared list can contain other shared objects which will all " "be managed and synchronized by the :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1930 +#: ../../library/multiprocessing.rst:1937 msgid "A type that can register with :class:`SyncManager`." msgstr "" -#: ../../library/multiprocessing.rst:1932 +#: ../../library/multiprocessing.rst:1939 msgid "" "A namespace object has no public methods, but does have writable attributes. " "Its representation shows the values of its attributes." msgstr "" -#: ../../library/multiprocessing.rst:1935 +#: ../../library/multiprocessing.rst:1942 msgid "" "However, when using a proxy for a namespace object, an attribute beginning " "with ``'_'`` will be an attribute of the proxy and not an attribute of the " "referent:" msgstr "" -#: ../../library/multiprocessing.rst:1939 +#: ../../library/multiprocessing.rst:1946 msgid "" ">>> mp_context = multiprocessing.get_context('spawn')\n" ">>> manager = mp_context.Manager()\n" @@ -2868,18 +2874,18 @@ msgid "" "Namespace(x=10, y='hello')" msgstr "" -#: ../../library/multiprocessing.rst:1952 +#: ../../library/multiprocessing.rst:1959 msgid "Customized managers" msgstr "" -#: ../../library/multiprocessing.rst:1954 +#: ../../library/multiprocessing.rst:1961 msgid "" "To create one's own manager, one creates a subclass of :class:`BaseManager` " "and uses the :meth:`~BaseManager.register` classmethod to register new types " "or callables with the manager class. For example::" msgstr "" -#: ../../library/multiprocessing.rst:1958 +#: ../../library/multiprocessing.rst:1965 msgid "" "from multiprocessing.managers import BaseManager\n" "\n" @@ -2919,23 +2925,23 @@ msgstr "" " print(maths.add(4, 3)) # 印出 7\n" " print(maths.mul(7, 8)) # 印出 56" -#: ../../library/multiprocessing.rst:1979 +#: ../../library/multiprocessing.rst:1986 msgid "Using a remote manager" msgstr "" -#: ../../library/multiprocessing.rst:1981 +#: ../../library/multiprocessing.rst:1988 msgid "" "It is possible to run a manager server on one machine and have clients use " "it from other machines (assuming that the firewalls involved allow it)." msgstr "" -#: ../../library/multiprocessing.rst:1984 +#: ../../library/multiprocessing.rst:1991 msgid "" "Running the following commands creates a server for a single shared queue " "which remote clients can access::" msgstr "" -#: ../../library/multiprocessing.rst:1987 +#: ../../library/multiprocessing.rst:1994 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> from queue import Queue\n" @@ -2955,11 +2961,11 @@ msgstr "" ">>> s = m.get_server()\n" ">>> s.serve_forever()" -#: ../../library/multiprocessing.rst:1996 +#: ../../library/multiprocessing.rst:2003 msgid "One client can access the server as follows::" msgstr "" -#: ../../library/multiprocessing.rst:1998 +#: ../../library/multiprocessing.rst:2005 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> class QueueManager(BaseManager): pass\n" @@ -2979,11 +2985,11 @@ msgstr "" ">>> queue = m.get_queue()\n" ">>> queue.put('hello')" -#: ../../library/multiprocessing.rst:2006 +#: ../../library/multiprocessing.rst:2013 msgid "Another client can also use it::" msgstr "" -#: ../../library/multiprocessing.rst:2008 +#: ../../library/multiprocessing.rst:2015 msgid "" ">>> from multiprocessing.managers import BaseManager\n" ">>> class QueueManager(BaseManager): pass\n" @@ -3005,13 +3011,13 @@ msgstr "" ">>> queue.get()\n" "'hello'" -#: ../../library/multiprocessing.rst:2017 +#: ../../library/multiprocessing.rst:2024 msgid "" "Local processes can also access that queue, using the code from above on the " "client to access it remotely::" msgstr "" -#: ../../library/multiprocessing.rst:2020 +#: ../../library/multiprocessing.rst:2027 msgid "" ">>> from multiprocessing import Process, Queue\n" ">>> from multiprocessing.managers import BaseManager\n" @@ -3051,18 +3057,18 @@ msgstr "" ">>> s = m.get_server()\n" ">>> s.serve_forever()" -#: ../../library/multiprocessing.rst:2042 +#: ../../library/multiprocessing.rst:2049 msgid "Proxy Objects" msgstr "" -#: ../../library/multiprocessing.rst:2044 +#: ../../library/multiprocessing.rst:2051 msgid "" "A proxy is an object which *refers* to a shared object which lives " "(presumably) in a different process. The shared object is said to be the " "*referent* of the proxy. Multiple proxy objects may have the same referent." msgstr "" -#: ../../library/multiprocessing.rst:2048 +#: ../../library/multiprocessing.rst:2055 msgid "" "A proxy object has methods which invoke corresponding methods of its " "referent (although not every method of the referent will necessarily be " @@ -3070,7 +3076,7 @@ msgid "" "its referent can:" msgstr "" -#: ../../library/multiprocessing.rst:2052 +#: ../../library/multiprocessing.rst:2059 msgid "" ">>> mp_context = multiprocessing.get_context('spawn')\n" ">>> manager = mp_context.Manager()\n" @@ -3096,14 +3102,14 @@ msgstr "" ">>> l[2:5]\n" "[4, 9, 16]" -#: ../../library/multiprocessing.rst:2066 +#: ../../library/multiprocessing.rst:2073 msgid "" "Notice that applying :func:`str` to a proxy will return the representation " "of the referent, whereas applying :func:`repr` will return the " "representation of the proxy." msgstr "" -#: ../../library/multiprocessing.rst:2070 +#: ../../library/multiprocessing.rst:2077 msgid "" "An important feature of proxy objects is that they are picklable so they can " "be passed between processes. As such, a referent can contain :ref:" @@ -3111,7 +3117,7 @@ msgid "" "lists, dicts, and other :ref:`multiprocessing-proxy_objects`:" msgstr "" -#: ../../library/multiprocessing.rst:2075 +#: ../../library/multiprocessing.rst:2082 msgid "" ">>> a = manager.list()\n" ">>> b = manager.list()\n" @@ -3123,11 +3129,11 @@ msgid "" "['hello'] ['hello']" msgstr "" -#: ../../library/multiprocessing.rst:2086 +#: ../../library/multiprocessing.rst:2093 msgid "Similarly, dict and list proxies may be nested inside one another::" msgstr "" -#: ../../library/multiprocessing.rst:2088 +#: ../../library/multiprocessing.rst:2095 msgid "" ">>> l_outer = manager.list([ manager.dict() for i in range(2) ])\n" ">>> d_first_inner = l_outer[0]\n" @@ -3151,7 +3157,7 @@ msgstr "" ">>> print(l_outer[1])\n" "{'c': 3, 'z': 26}" -#: ../../library/multiprocessing.rst:2099 +#: ../../library/multiprocessing.rst:2106 msgid "" "If standard (non-proxy) :class:`list` or :class:`dict` objects are contained " "in a referent, modifications to those mutable values will not be propagated " @@ -3162,7 +3168,7 @@ msgid "" "assign the modified value to the container proxy::" msgstr "" -#: ../../library/multiprocessing.rst:2107 +#: ../../library/multiprocessing.rst:2114 msgid "" "# create a list proxy and append a mutable object (a dictionary)\n" "lproxy = manager.list()\n" @@ -3176,20 +3182,20 @@ msgid "" "lproxy[0] = d" msgstr "" -#: ../../library/multiprocessing.rst:2118 +#: ../../library/multiprocessing.rst:2125 msgid "" "This approach is perhaps less convenient than employing nested :ref:" "`multiprocessing-proxy_objects` for most use cases but also demonstrates a " "level of control over the synchronization." msgstr "" -#: ../../library/multiprocessing.rst:2124 +#: ../../library/multiprocessing.rst:2131 msgid "" "The proxy types in :mod:`multiprocessing` do nothing to support comparisons " "by value. So, for instance, we have:" msgstr "" -#: ../../library/multiprocessing.rst:2127 +#: ../../library/multiprocessing.rst:2134 msgid "" ">>> manager.list([1,2,3]) == [1,2,3]\n" "False" @@ -3197,48 +3203,48 @@ msgstr "" ">>> manager.list([1,2,3]) == [1,2,3]\n" "False" -#: ../../library/multiprocessing.rst:2132 +#: ../../library/multiprocessing.rst:2139 msgid "" "One should just use a copy of the referent instead when making comparisons." msgstr "" -#: ../../library/multiprocessing.rst:2136 +#: ../../library/multiprocessing.rst:2143 msgid "Proxy objects are instances of subclasses of :class:`BaseProxy`." msgstr "" -#: ../../library/multiprocessing.rst:2140 +#: ../../library/multiprocessing.rst:2147 msgid "Call and return the result of a method of the proxy's referent." msgstr "" -#: ../../library/multiprocessing.rst:2142 +#: ../../library/multiprocessing.rst:2149 msgid "" "If ``proxy`` is a proxy whose referent is ``obj`` then the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2144 +#: ../../library/multiprocessing.rst:2151 msgid "proxy._callmethod(methodname, args, kwds)" msgstr "proxy._callmethod(methodname, args, kwds)" -#: ../../library/multiprocessing.rst:2146 +#: ../../library/multiprocessing.rst:2153 msgid "will evaluate the expression ::" msgstr "" -#: ../../library/multiprocessing.rst:2148 +#: ../../library/multiprocessing.rst:2155 msgid "getattr(obj, methodname)(*args, **kwds)" msgstr "getattr(obj, methodname)(*args, **kwds)" -#: ../../library/multiprocessing.rst:2150 +#: ../../library/multiprocessing.rst:2157 msgid "in the manager's process." msgstr "" -#: ../../library/multiprocessing.rst:2152 +#: ../../library/multiprocessing.rst:2159 msgid "" "The returned value will be a copy of the result of the call or a proxy to a " "new shared object -- see documentation for the *method_to_typeid* argument " "of :meth:`BaseManager.register`." msgstr "" -#: ../../library/multiprocessing.rst:2156 +#: ../../library/multiprocessing.rst:2163 msgid "" "If an exception is raised by the call, then is re-raised by :meth:" "`_callmethod`. If some other exception is raised in the manager's process " @@ -3246,17 +3252,17 @@ msgid "" "meth:`_callmethod`." msgstr "" -#: ../../library/multiprocessing.rst:2161 +#: ../../library/multiprocessing.rst:2168 msgid "" "Note in particular that an exception will be raised if *methodname* has not " "been *exposed*." msgstr "" -#: ../../library/multiprocessing.rst:2164 +#: ../../library/multiprocessing.rst:2171 msgid "An example of the usage of :meth:`_callmethod`:" msgstr "" -#: ../../library/multiprocessing.rst:2166 +#: ../../library/multiprocessing.rst:2173 msgid "" ">>> l = manager.list(range(10))\n" ">>> l._callmethod('__len__')\n" @@ -3278,69 +3284,69 @@ msgstr "" "...\n" "IndexError: list index out of range" -#: ../../library/multiprocessing.rst:2180 +#: ../../library/multiprocessing.rst:2187 msgid "Return a copy of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2182 +#: ../../library/multiprocessing.rst:2189 msgid "If the referent is unpicklable then this will raise an exception." msgstr "" -#: ../../library/multiprocessing.rst:2186 +#: ../../library/multiprocessing.rst:2193 msgid "Return a representation of the proxy object." msgstr "" -#: ../../library/multiprocessing.rst:2190 +#: ../../library/multiprocessing.rst:2197 msgid "Return the representation of the referent." msgstr "" -#: ../../library/multiprocessing.rst:2194 +#: ../../library/multiprocessing.rst:2201 msgid "Cleanup" msgstr "" -#: ../../library/multiprocessing.rst:2196 +#: ../../library/multiprocessing.rst:2203 msgid "" "A proxy object uses a weakref callback so that when it gets garbage " "collected it deregisters itself from the manager which owns its referent." msgstr "" -#: ../../library/multiprocessing.rst:2199 +#: ../../library/multiprocessing.rst:2206 msgid "" "A shared object gets deleted from the manager process when there are no " "longer any proxies referring to it." msgstr "" -#: ../../library/multiprocessing.rst:2204 +#: ../../library/multiprocessing.rst:2211 msgid "Process Pools" msgstr "" -#: ../../library/multiprocessing.rst:2209 +#: ../../library/multiprocessing.rst:2216 msgid "" "One can create a pool of processes which will carry out tasks submitted to " "it with the :class:`Pool` class." msgstr "" -#: ../../library/multiprocessing.rst:2214 +#: ../../library/multiprocessing.rst:2221 msgid "" "A process pool object which controls a pool of worker processes to which " "jobs can be submitted. It supports asynchronous results with timeouts and " "callbacks and has a parallel map implementation." msgstr "" -#: ../../library/multiprocessing.rst:2218 +#: ../../library/multiprocessing.rst:2225 msgid "" "*processes* is the number of worker processes to use. If *processes* is " -"``None`` then the number returned by :func:`os.cpu_count` is used." +"``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2221 -#: ../../library/multiprocessing.rst:2782 +#: ../../library/multiprocessing.rst:2228 +#: ../../library/multiprocessing.rst:2792 msgid "" "If *initializer* is not ``None`` then each worker process will call " "``initializer(*initargs)`` when it starts." msgstr "" -#: ../../library/multiprocessing.rst:2224 +#: ../../library/multiprocessing.rst:2231 msgid "" "*maxtasksperchild* is the number of tasks a worker process can complete " "before it will exit and be replaced with a fresh worker process, to enable " @@ -3348,7 +3354,7 @@ msgid "" "which means worker processes will live as long as the pool." msgstr "" -#: ../../library/multiprocessing.rst:2229 +#: ../../library/multiprocessing.rst:2236 msgid "" "*context* can be used to specify the context used for starting the worker " "processes. Usually a pool is created using the function :func:" @@ -3356,13 +3362,13 @@ msgid "" "both cases *context* is set appropriately." msgstr "" -#: ../../library/multiprocessing.rst:2235 +#: ../../library/multiprocessing.rst:2242 msgid "" "Note that the methods of the pool object should only be called by the " "process which created the pool." msgstr "" -#: ../../library/multiprocessing.rst:2239 +#: ../../library/multiprocessing.rst:2246 msgid "" ":class:`multiprocessing.pool` objects have internal resources that need to " "be properly managed (like any other resource) by using the pool as a context " @@ -3370,22 +3376,28 @@ msgid "" "to do this can lead to the process hanging on finalization." msgstr "" -#: ../../library/multiprocessing.rst:2244 +#: ../../library/multiprocessing.rst:2251 msgid "" "Note that it is **not correct** to rely on the garbage collector to destroy " "the pool as CPython does not assure that the finalizer of the pool will be " "called (see :meth:`object.__del__` for more information)." msgstr "" -#: ../../library/multiprocessing.rst:2248 +#: ../../library/multiprocessing.rst:2255 msgid "Added the *maxtasksperchild* parameter." msgstr "新增 *maxtasksperchild* 參數。" -#: ../../library/multiprocessing.rst:2251 +#: ../../library/multiprocessing.rst:2258 msgid "Added the *context* parameter." msgstr "新增 *context* 參數。" -#: ../../library/multiprocessing.rst:2256 +#: ../../library/multiprocessing.rst:2261 +msgid "" +"*processes* uses :func:`os.process_cpu_count` by default, instead of :func:" +"`os.cpu_count`." +msgstr "" + +#: ../../library/multiprocessing.rst:2267 msgid "" "Worker processes within a :class:`Pool` typically live for the complete " "duration of the Pool's work queue. A frequent pattern found in other systems " @@ -3396,7 +3408,7 @@ msgid "" "ability to the end user." msgstr "" -#: ../../library/multiprocessing.rst:2266 +#: ../../library/multiprocessing.rst:2277 msgid "" "Call *func* with arguments *args* and keyword arguments *kwds*. It blocks " "until the result is ready. Given this blocks, :meth:`apply_async` is better " @@ -3404,14 +3416,14 @@ msgid "" "executed in one of the workers of the pool." msgstr "" -#: ../../library/multiprocessing.rst:2273 +#: ../../library/multiprocessing.rst:2284 msgid "" "A variant of the :meth:`apply` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2276 -#: ../../library/multiprocessing.rst:2307 +#: ../../library/multiprocessing.rst:2287 +#: ../../library/multiprocessing.rst:2318 msgid "" "If *callback* is specified then it should be a callable which accepts a " "single argument. When the result becomes ready *callback* is applied to it, " @@ -3419,60 +3431,60 @@ msgid "" "applied instead." msgstr "" -#: ../../library/multiprocessing.rst:2281 -#: ../../library/multiprocessing.rst:2312 +#: ../../library/multiprocessing.rst:2292 +#: ../../library/multiprocessing.rst:2323 msgid "" "If *error_callback* is specified then it should be a callable which accepts " "a single argument. If the target function fails, then the *error_callback* " "is called with the exception instance." msgstr "" -#: ../../library/multiprocessing.rst:2285 -#: ../../library/multiprocessing.rst:2316 +#: ../../library/multiprocessing.rst:2296 +#: ../../library/multiprocessing.rst:2327 msgid "" "Callbacks should complete immediately since otherwise the thread which " "handles the results will get blocked." msgstr "" -#: ../../library/multiprocessing.rst:2290 +#: ../../library/multiprocessing.rst:2301 msgid "" "A parallel equivalent of the :func:`map` built-in function (it supports only " "one *iterable* argument though, for multiple iterables see :meth:`starmap`). " "It blocks until the result is ready." msgstr "" -#: ../../library/multiprocessing.rst:2294 +#: ../../library/multiprocessing.rst:2305 msgid "" "This method chops the iterable into a number of chunks which it submits to " "the process pool as separate tasks. The (approximate) size of these chunks " "can be specified by setting *chunksize* to a positive integer." msgstr "" -#: ../../library/multiprocessing.rst:2298 +#: ../../library/multiprocessing.rst:2309 msgid "" "Note that it may cause high memory usage for very long iterables. Consider " "using :meth:`imap` or :meth:`imap_unordered` with explicit *chunksize* " "option for better efficiency." msgstr "" -#: ../../library/multiprocessing.rst:2304 +#: ../../library/multiprocessing.rst:2315 msgid "" "A variant of the :meth:`.map` method which returns a :class:" "`~multiprocessing.pool.AsyncResult` object." msgstr "" -#: ../../library/multiprocessing.rst:2321 +#: ../../library/multiprocessing.rst:2332 msgid "A lazier version of :meth:`.map`." msgstr "" -#: ../../library/multiprocessing.rst:2323 +#: ../../library/multiprocessing.rst:2334 msgid "" "The *chunksize* argument is the same as the one used by the :meth:`.map` " "method. For very long iterables using a large value for *chunksize* can " "make the job complete **much** faster than using the default value of ``1``." msgstr "" -#: ../../library/multiprocessing.rst:2328 +#: ../../library/multiprocessing.rst:2339 msgid "" "Also if *chunksize* is ``1`` then the :meth:`!next` method of the iterator " "returned by the :meth:`imap` method has an optional *timeout* parameter: " @@ -3480,65 +3492,65 @@ msgid "" "result cannot be returned within *timeout* seconds." msgstr "" -#: ../../library/multiprocessing.rst:2335 +#: ../../library/multiprocessing.rst:2346 msgid "" "The same as :meth:`imap` except that the ordering of the results from the " "returned iterator should be considered arbitrary. (Only when there is only " "one worker process is the order guaranteed to be \"correct\".)" msgstr "" -#: ../../library/multiprocessing.rst:2341 +#: ../../library/multiprocessing.rst:2352 msgid "" "Like :meth:`~multiprocessing.pool.Pool.map` except that the elements of the " "*iterable* are expected to be iterables that are unpacked as arguments." msgstr "" -#: ../../library/multiprocessing.rst:2345 +#: ../../library/multiprocessing.rst:2356 msgid "" "Hence an *iterable* of ``[(1,2), (3, 4)]`` results in ``[func(1,2), " "func(3,4)]``." msgstr "" -#: ../../library/multiprocessing.rst:2352 +#: ../../library/multiprocessing.rst:2363 msgid "" "A combination of :meth:`starmap` and :meth:`map_async` that iterates over " "*iterable* of iterables and calls *func* with the iterables unpacked. " "Returns a result object." msgstr "" -#: ../../library/multiprocessing.rst:2360 +#: ../../library/multiprocessing.rst:2371 msgid "" "Prevents any more tasks from being submitted to the pool. Once all the " "tasks have been completed the worker processes will exit." msgstr "" -#: ../../library/multiprocessing.rst:2365 +#: ../../library/multiprocessing.rst:2376 msgid "" "Stops the worker processes immediately without completing outstanding work. " "When the pool object is garbage collected :meth:`terminate` will be called " "immediately." msgstr "" -#: ../../library/multiprocessing.rst:2371 +#: ../../library/multiprocessing.rst:2382 msgid "" "Wait for the worker processes to exit. One must call :meth:`close` or :meth:" "`terminate` before using :meth:`join`." msgstr "" -#: ../../library/multiprocessing.rst:2374 +#: ../../library/multiprocessing.rst:2385 msgid "" "Pool objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the pool " "object, and :meth:`~contextmanager.__exit__` calls :meth:`terminate`." msgstr "" -#: ../../library/multiprocessing.rst:2382 +#: ../../library/multiprocessing.rst:2393 msgid "" "The class of the result returned by :meth:`Pool.apply_async` and :meth:`Pool." "map_async`." msgstr "" -#: ../../library/multiprocessing.rst:2387 +#: ../../library/multiprocessing.rst:2398 msgid "" "Return the result when it arrives. If *timeout* is not ``None`` and the " "result does not arrive within *timeout* seconds then :exc:`multiprocessing." @@ -3546,31 +3558,31 @@ msgid "" "exception will be reraised by :meth:`get`." msgstr "" -#: ../../library/multiprocessing.rst:2394 +#: ../../library/multiprocessing.rst:2405 msgid "Wait until the result is available or until *timeout* seconds pass." msgstr "" -#: ../../library/multiprocessing.rst:2398 +#: ../../library/multiprocessing.rst:2409 msgid "Return whether the call has completed." msgstr "" -#: ../../library/multiprocessing.rst:2402 +#: ../../library/multiprocessing.rst:2413 msgid "" "Return whether the call completed without raising an exception. Will raise :" "exc:`ValueError` if the result is not ready." msgstr "" -#: ../../library/multiprocessing.rst:2405 +#: ../../library/multiprocessing.rst:2416 msgid "" "If the result is not ready, :exc:`ValueError` is raised instead of :exc:" "`AssertionError`." msgstr "" -#: ../../library/multiprocessing.rst:2409 +#: ../../library/multiprocessing.rst:2420 msgid "The following example demonstrates the use of a pool::" msgstr "" -#: ../../library/multiprocessing.rst:2411 +#: ../../library/multiprocessing.rst:2422 msgid "" "from multiprocessing import Pool\n" "import time\n" @@ -3598,17 +3610,17 @@ msgid "" "TimeoutError" msgstr "" -#: ../../library/multiprocessing.rst:2436 +#: ../../library/multiprocessing.rst:2447 msgid "Listeners and Clients" msgstr "" -#: ../../library/multiprocessing.rst:2441 +#: ../../library/multiprocessing.rst:2452 msgid "" "Usually message passing between processes is done using queues or by using :" "class:`~Connection` objects returned by :func:`~multiprocessing.Pipe`." msgstr "" -#: ../../library/multiprocessing.rst:2445 +#: ../../library/multiprocessing.rst:2456 msgid "" "However, the :mod:`multiprocessing.connection` module allows some extra " "flexibility. It basically gives a high level message oriented API for " @@ -3617,46 +3629,46 @@ msgid "" "multiple connections at the same time." msgstr "" -#: ../../library/multiprocessing.rst:2454 +#: ../../library/multiprocessing.rst:2465 msgid "" "Send a randomly generated message to the other end of the connection and " "wait for a reply." msgstr "" -#: ../../library/multiprocessing.rst:2457 +#: ../../library/multiprocessing.rst:2468 msgid "" "If the reply matches the digest of the message using *authkey* as the key " "then a welcome message is sent to the other end of the connection. " "Otherwise :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2463 +#: ../../library/multiprocessing.rst:2474 msgid "" "Receive a message, calculate the digest of the message using *authkey* as " "the key, and then send the digest back." msgstr "" -#: ../../library/multiprocessing.rst:2466 +#: ../../library/multiprocessing.rst:2477 msgid "" "If a welcome message is not received, then :exc:`~multiprocessing." "AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2471 +#: ../../library/multiprocessing.rst:2482 msgid "" "Attempt to set up a connection to the listener which is using address " "*address*, returning a :class:`~Connection`." msgstr "" -#: ../../library/multiprocessing.rst:2474 +#: ../../library/multiprocessing.rst:2485 msgid "" "The type of the connection is determined by *family* argument, but this can " "generally be omitted since it can usually be inferred from the format of " "*address*. (See :ref:`multiprocessing-address-formats`)" msgstr "" -#: ../../library/multiprocessing.rst:2478 -#: ../../library/multiprocessing.rst:2513 +#: ../../library/multiprocessing.rst:2489 +#: ../../library/multiprocessing.rst:2524 msgid "" "If *authkey* is given and not ``None``, it should be a byte string and will " "be used as the secret key for an HMAC-based authentication challenge. No " @@ -3665,26 +3677,26 @@ msgid "" "`multiprocessing-auth-keys`." msgstr "" -#: ../../library/multiprocessing.rst:2486 +#: ../../library/multiprocessing.rst:2497 msgid "" "A wrapper for a bound socket or Windows named pipe which is 'listening' for " "connections." msgstr "" -#: ../../library/multiprocessing.rst:2489 +#: ../../library/multiprocessing.rst:2500 msgid "" "*address* is the address to be used by the bound socket or named pipe of the " "listener object." msgstr "" -#: ../../library/multiprocessing.rst:2494 +#: ../../library/multiprocessing.rst:2505 msgid "" "If an address of '0.0.0.0' is used, the address will not be a connectable " "end point on Windows. If you require a connectable end-point, you should use " "'127.0.0.1'." msgstr "" -#: ../../library/multiprocessing.rst:2498 +#: ../../library/multiprocessing.rst:2509 msgid "" "*family* is the type of socket (or named pipe) to use. This can be one of " "the strings ``'AF_INET'`` (for a TCP socket), ``'AF_UNIX'`` (for a Unix " @@ -3698,49 +3710,49 @@ msgid "" "using :func:`tempfile.mkstemp`." msgstr "" -#: ../../library/multiprocessing.rst:2509 +#: ../../library/multiprocessing.rst:2520 msgid "" "If the listener object uses a socket then *backlog* (1 by default) is passed " "to the :meth:`~socket.socket.listen` method of the socket once it has been " "bound." msgstr "" -#: ../../library/multiprocessing.rst:2521 +#: ../../library/multiprocessing.rst:2532 msgid "" "Accept a connection on the bound socket or named pipe of the listener object " "and return a :class:`~Connection` object. If authentication is attempted and " "fails, then :exc:`~multiprocessing.AuthenticationError` is raised." msgstr "" -#: ../../library/multiprocessing.rst:2528 +#: ../../library/multiprocessing.rst:2539 msgid "" "Close the bound socket or named pipe of the listener object. This is called " "automatically when the listener is garbage collected. However it is " "advisable to call it explicitly." msgstr "" -#: ../../library/multiprocessing.rst:2532 +#: ../../library/multiprocessing.rst:2543 msgid "Listener objects have the following read-only properties:" msgstr "" -#: ../../library/multiprocessing.rst:2536 +#: ../../library/multiprocessing.rst:2547 msgid "The address which is being used by the Listener object." msgstr "" -#: ../../library/multiprocessing.rst:2540 +#: ../../library/multiprocessing.rst:2551 msgid "" "The address from which the last accepted connection came. If this is " "unavailable then it is ``None``." msgstr "" -#: ../../library/multiprocessing.rst:2543 +#: ../../library/multiprocessing.rst:2554 msgid "" "Listener objects now support the context management protocol -- see :ref:" "`typecontextmanager`. :meth:`~contextmanager.__enter__` returns the " "listener object, and :meth:`~contextmanager.__exit__` calls :meth:`close`." msgstr "" -#: ../../library/multiprocessing.rst:2550 +#: ../../library/multiprocessing.rst:2561 msgid "" "Wait till an object in *object_list* is ready. Returns the list of those " "objects in *object_list* which are ready. If *timeout* is a float then the " @@ -3749,32 +3761,32 @@ msgid "" "zero timeout." msgstr "" -#: ../../library/multiprocessing.rst:2556 +#: ../../library/multiprocessing.rst:2567 msgid "" "For both POSIX and Windows, an object can appear in *object_list* if it is" msgstr "" -#: ../../library/multiprocessing.rst:2559 +#: ../../library/multiprocessing.rst:2570 msgid "a readable :class:`~multiprocessing.connection.Connection` object;" msgstr "" -#: ../../library/multiprocessing.rst:2560 +#: ../../library/multiprocessing.rst:2571 msgid "a connected and readable :class:`socket.socket` object; or" msgstr "" -#: ../../library/multiprocessing.rst:2561 +#: ../../library/multiprocessing.rst:2572 msgid "" "the :attr:`~multiprocessing.Process.sentinel` attribute of a :class:" "`~multiprocessing.Process` object." msgstr "" -#: ../../library/multiprocessing.rst:2564 +#: ../../library/multiprocessing.rst:2575 msgid "" "A connection or socket object is ready when there is data available to be " "read from it, or the other end has been closed." msgstr "" -#: ../../library/multiprocessing.rst:2567 +#: ../../library/multiprocessing.rst:2578 msgid "" "**POSIX**: ``wait(object_list, timeout)`` almost equivalent ``select." "select(object_list, [], [], timeout)``. The difference is that, if :func:" @@ -3782,7 +3794,7 @@ msgid "" "an error number of ``EINTR``, whereas :func:`wait` will not." msgstr "" -#: ../../library/multiprocessing.rst:2573 +#: ../../library/multiprocessing.rst:2584 msgid "" "**Windows**: An item in *object_list* must either be an integer handle which " "is waitable (according to the definition used by the documentation of the " @@ -3792,18 +3804,18 @@ msgid "" "handles.)" msgstr "" -#: ../../library/multiprocessing.rst:2583 +#: ../../library/multiprocessing.rst:2594 msgid "**Examples**" msgstr "" -#: ../../library/multiprocessing.rst:2585 +#: ../../library/multiprocessing.rst:2596 msgid "" "The following server code creates a listener which uses ``'secret " "password'`` as an authentication key. It then waits for a connection and " "sends some data to the client::" msgstr "" -#: ../../library/multiprocessing.rst:2589 +#: ../../library/multiprocessing.rst:2600 msgid "" "from multiprocessing.connection import Listener\n" "from array import array\n" @@ -3821,13 +3833,13 @@ msgid "" " conn.send_bytes(array('i', [42, 1729]))" msgstr "" -#: ../../library/multiprocessing.rst:2604 +#: ../../library/multiprocessing.rst:2615 msgid "" "The following code connects to the server and receives some data from the " "server::" msgstr "" -#: ../../library/multiprocessing.rst:2607 +#: ../../library/multiprocessing.rst:2618 msgid "" "from multiprocessing.connection import Client\n" "from array import array\n" @@ -3857,15 +3869,14 @@ msgstr "" " print(conn.recv_bytes_into(arr)) # => 8\n" " print(arr) # => array('i', [42, 1729, 0, 0, 0])" -#: ../../library/multiprocessing.rst:2621 +#: ../../library/multiprocessing.rst:2632 msgid "" "The following code uses :func:`~multiprocessing.connection.wait` to wait for " "messages from multiple processes at once::" msgstr "" -#: ../../library/multiprocessing.rst:2624 +#: ../../library/multiprocessing.rst:2635 msgid "" -"import time, random\n" "from multiprocessing import Process, Pipe, current_process\n" "from multiprocessing.connection import wait\n" "\n" @@ -3898,23 +3909,23 @@ msgid "" " print(msg)" msgstr "" -#: ../../library/multiprocessing.rst:2660 +#: ../../library/multiprocessing.rst:2670 msgid "Address Formats" msgstr "" -#: ../../library/multiprocessing.rst:2662 +#: ../../library/multiprocessing.rst:2672 msgid "" "An ``'AF_INET'`` address is a tuple of the form ``(hostname, port)`` where " "*hostname* is a string and *port* is an integer." msgstr "" -#: ../../library/multiprocessing.rst:2665 +#: ../../library/multiprocessing.rst:2675 msgid "" "An ``'AF_UNIX'`` address is a string representing a filename on the " "filesystem." msgstr "" -#: ../../library/multiprocessing.rst:2668 +#: ../../library/multiprocessing.rst:2678 msgid "" "An ``'AF_PIPE'`` address is a string of the form :samp:`r'\\\\\\\\\\\\.\\" "\\pipe\\\\\\\\{PipeName}'`. To use :func:`Client` to connect to a named " @@ -3923,17 +3934,17 @@ msgid "" "instead." msgstr "" -#: ../../library/multiprocessing.rst:2673 +#: ../../library/multiprocessing.rst:2683 msgid "" "Note that any string beginning with two backslashes is assumed by default to " "be an ``'AF_PIPE'`` address rather than an ``'AF_UNIX'`` address." msgstr "" -#: ../../library/multiprocessing.rst:2680 +#: ../../library/multiprocessing.rst:2690 msgid "Authentication keys" msgstr "" -#: ../../library/multiprocessing.rst:2682 +#: ../../library/multiprocessing.rst:2692 msgid "" "When one uses :meth:`Connection.recv `, the data received " "is automatically unpickled. Unfortunately unpickling data from an untrusted " @@ -3941,7 +3952,7 @@ msgid "" "use the :mod:`hmac` module to provide digest authentication." msgstr "" -#: ../../library/multiprocessing.rst:2688 +#: ../../library/multiprocessing.rst:2698 msgid "" "An authentication key is a byte string which can be thought of as a " "password: once a connection is established both ends will demand proof that " @@ -3949,7 +3960,7 @@ msgid "" "using the same key does **not** involve sending the key over the connection.)" msgstr "" -#: ../../library/multiprocessing.rst:2694 +#: ../../library/multiprocessing.rst:2704 msgid "" "If authentication is requested but no authentication key is specified then " "the return value of ``current_process().authkey`` is used (see :class:" @@ -3960,17 +3971,17 @@ msgid "" "setting up connections between themselves." msgstr "" -#: ../../library/multiprocessing.rst:2702 +#: ../../library/multiprocessing.rst:2712 msgid "" "Suitable authentication keys can also be generated by using :func:`os." "urandom`." msgstr "" -#: ../../library/multiprocessing.rst:2706 +#: ../../library/multiprocessing.rst:2716 msgid "Logging" msgstr "" -#: ../../library/multiprocessing.rst:2708 +#: ../../library/multiprocessing.rst:2718 msgid "" "Some support for logging is available. Note, however, that the :mod:" "`logging` package does not use process shared locks so it is possible " @@ -3978,27 +3989,27 @@ msgid "" "mixed up." msgstr "" -#: ../../library/multiprocessing.rst:2715 +#: ../../library/multiprocessing.rst:2725 msgid "" "Returns the logger used by :mod:`multiprocessing`. If necessary, a new one " "will be created." msgstr "" -#: ../../library/multiprocessing.rst:2718 +#: ../../library/multiprocessing.rst:2728 msgid "" "When first created the logger has level :const:`logging.NOTSET` and no " "default handler. Messages sent to this logger will not by default propagate " "to the root logger." msgstr "" -#: ../../library/multiprocessing.rst:2722 +#: ../../library/multiprocessing.rst:2732 msgid "" "Note that on Windows child processes will only inherit the level of the " "parent process's logger -- any other customization of the logger will not be " "inherited." msgstr "" -#: ../../library/multiprocessing.rst:2729 +#: ../../library/multiprocessing.rst:2739 msgid "" "This function performs a call to :func:`get_logger` but in addition to " "returning the logger created by get_logger, it adds a handler which sends " @@ -4007,11 +4018,11 @@ msgid "" "``level`` argument." msgstr "" -#: ../../library/multiprocessing.rst:2735 +#: ../../library/multiprocessing.rst:2745 msgid "Below is an example session with logging turned on::" msgstr "" -#: ../../library/multiprocessing.rst:2737 +#: ../../library/multiprocessing.rst:2747 msgid "" ">>> import multiprocessing, logging\n" ">>> logger = multiprocessing.log_to_stderr()\n" @@ -4039,21 +4050,21 @@ msgstr "" "[INFO/MainProcess] sending shutdown message to manager\n" "[INFO/SyncManager-...] manager exiting with exitcode 0" -#: ../../library/multiprocessing.rst:2750 +#: ../../library/multiprocessing.rst:2760 msgid "For a full table of logging levels, see the :mod:`logging` module." msgstr "" -#: ../../library/multiprocessing.rst:2754 +#: ../../library/multiprocessing.rst:2764 msgid "The :mod:`multiprocessing.dummy` module" msgstr ":mod:`multiprocessing.dummy` 模組" -#: ../../library/multiprocessing.rst:2759 +#: ../../library/multiprocessing.rst:2769 msgid "" ":mod:`multiprocessing.dummy` replicates the API of :mod:`multiprocessing` " "but is no more than a wrapper around the :mod:`threading` module." msgstr "" -#: ../../library/multiprocessing.rst:2764 +#: ../../library/multiprocessing.rst:2774 msgid "" "In particular, the ``Pool`` function provided by :mod:`multiprocessing." "dummy` returns an instance of :class:`ThreadPool`, which is a subclass of :" @@ -4061,7 +4072,7 @@ msgid "" "worker threads rather than worker processes." msgstr "" -#: ../../library/multiprocessing.rst:2772 +#: ../../library/multiprocessing.rst:2782 msgid "" "A thread pool object which controls a pool of worker threads to which jobs " "can be submitted. :class:`ThreadPool` instances are fully interface " @@ -4071,18 +4082,18 @@ msgid "" "pool.Pool.terminate` manually." msgstr "" -#: ../../library/multiprocessing.rst:2779 +#: ../../library/multiprocessing.rst:2789 msgid "" "*processes* is the number of worker threads to use. If *processes* is " -"``None`` then the number returned by :func:`os.cpu_count` is used." +"``None`` then the number returned by :func:`os.process_cpu_count` is used." msgstr "" -#: ../../library/multiprocessing.rst:2785 +#: ../../library/multiprocessing.rst:2795 msgid "" "Unlike :class:`Pool`, *maxtasksperchild* and *context* cannot be provided." msgstr "" -#: ../../library/multiprocessing.rst:2789 +#: ../../library/multiprocessing.rst:2799 msgid "" "A :class:`ThreadPool` shares the same interface as :class:`Pool`, which is " "designed around a pool of processes and predates the introduction of the :" @@ -4092,7 +4103,7 @@ msgid "" "is not understood by any other libraries." msgstr "" -#: ../../library/multiprocessing.rst:2796 +#: ../../library/multiprocessing.rst:2806 msgid "" "Users should generally prefer to use :class:`concurrent.futures." "ThreadPoolExecutor`, which has a simpler interface that was designed around " @@ -4101,69 +4112,69 @@ msgid "" "`asyncio`." msgstr "" -#: ../../library/multiprocessing.rst:2806 +#: ../../library/multiprocessing.rst:2816 msgid "Programming guidelines" msgstr "" -#: ../../library/multiprocessing.rst:2808 +#: ../../library/multiprocessing.rst:2818 msgid "" "There are certain guidelines and idioms which should be adhered to when " "using :mod:`multiprocessing`." msgstr "" -#: ../../library/multiprocessing.rst:2813 +#: ../../library/multiprocessing.rst:2823 msgid "All start methods" msgstr "" -#: ../../library/multiprocessing.rst:2815 +#: ../../library/multiprocessing.rst:2825 msgid "The following applies to all start methods." msgstr "" -#: ../../library/multiprocessing.rst:2817 +#: ../../library/multiprocessing.rst:2827 msgid "Avoid shared state" msgstr "" -#: ../../library/multiprocessing.rst:2819 +#: ../../library/multiprocessing.rst:2829 msgid "" "As far as possible one should try to avoid shifting large amounts of data " "between processes." msgstr "" -#: ../../library/multiprocessing.rst:2822 +#: ../../library/multiprocessing.rst:2832 msgid "" "It is probably best to stick to using queues or pipes for communication " "between processes rather than using the lower level synchronization " "primitives." msgstr "" -#: ../../library/multiprocessing.rst:2826 +#: ../../library/multiprocessing.rst:2836 msgid "Picklability" msgstr "" -#: ../../library/multiprocessing.rst:2828 +#: ../../library/multiprocessing.rst:2838 msgid "Ensure that the arguments to the methods of proxies are picklable." msgstr "" -#: ../../library/multiprocessing.rst:2830 +#: ../../library/multiprocessing.rst:2840 msgid "Thread safety of proxies" msgstr "" -#: ../../library/multiprocessing.rst:2832 +#: ../../library/multiprocessing.rst:2842 msgid "" "Do not use a proxy object from more than one thread unless you protect it " "with a lock." msgstr "" -#: ../../library/multiprocessing.rst:2835 +#: ../../library/multiprocessing.rst:2845 msgid "" "(There is never a problem with different processes using the *same* proxy.)" msgstr "" -#: ../../library/multiprocessing.rst:2837 +#: ../../library/multiprocessing.rst:2847 msgid "Joining zombie processes" msgstr "" -#: ../../library/multiprocessing.rst:2839 +#: ../../library/multiprocessing.rst:2849 msgid "" "On POSIX when a process finishes but has not been joined it becomes a " "zombie. There should never be very many because each time a new process " @@ -4174,11 +4185,11 @@ msgid "" "explicitly join all the processes that you start." msgstr "" -#: ../../library/multiprocessing.rst:2847 +#: ../../library/multiprocessing.rst:2857 msgid "Better to inherit than pickle/unpickle" msgstr "" -#: ../../library/multiprocessing.rst:2849 +#: ../../library/multiprocessing.rst:2859 msgid "" "When using the *spawn* or *forkserver* start methods many types from :mod:" "`multiprocessing` need to be picklable so that child processes can use " @@ -4188,11 +4199,11 @@ msgid "" "inherit it from an ancestor process." msgstr "" -#: ../../library/multiprocessing.rst:2857 +#: ../../library/multiprocessing.rst:2867 msgid "Avoid terminating processes" msgstr "" -#: ../../library/multiprocessing.rst:2859 +#: ../../library/multiprocessing.rst:2869 msgid "" "Using the :meth:`Process.terminate ` " "method to stop a process is liable to cause any shared resources (such as " @@ -4200,18 +4211,18 @@ msgid "" "become broken or unavailable to other processes." msgstr "" -#: ../../library/multiprocessing.rst:2865 +#: ../../library/multiprocessing.rst:2875 msgid "" "Therefore it is probably best to only consider using :meth:`Process." "terminate ` on processes which never use " "any shared resources." msgstr "" -#: ../../library/multiprocessing.rst:2869 +#: ../../library/multiprocessing.rst:2879 msgid "Joining processes that use queues" msgstr "" -#: ../../library/multiprocessing.rst:2871 +#: ../../library/multiprocessing.rst:2881 msgid "" "Bear in mind that a process that has put items in a queue will wait before " "terminating until all the buffered items are fed by the \"feeder\" thread to " @@ -4220,7 +4231,7 @@ msgid "" "queue to avoid this behaviour.)" msgstr "" -#: ../../library/multiprocessing.rst:2877 +#: ../../library/multiprocessing.rst:2887 msgid "" "This means that whenever you use a queue you need to make sure that all " "items which have been put on the queue will eventually be removed before the " @@ -4229,11 +4240,11 @@ msgid "" "processes will be joined automatically." msgstr "" -#: ../../library/multiprocessing.rst:2883 +#: ../../library/multiprocessing.rst:2893 msgid "An example which will deadlock is the following::" msgstr "" -#: ../../library/multiprocessing.rst:2885 +#: ../../library/multiprocessing.rst:2895 msgid "" "from multiprocessing import Process, Queue\n" "\n" @@ -4248,17 +4259,17 @@ msgid "" " obj = queue.get()" msgstr "" -#: ../../library/multiprocessing.rst:2897 +#: ../../library/multiprocessing.rst:2907 msgid "" "A fix here would be to swap the last two lines (or simply remove the ``p." "join()`` line)." msgstr "" -#: ../../library/multiprocessing.rst:2900 +#: ../../library/multiprocessing.rst:2910 msgid "Explicitly pass resources to child processes" msgstr "" -#: ../../library/multiprocessing.rst:2902 +#: ../../library/multiprocessing.rst:2912 msgid "" "On POSIX using the *fork* start method, a child process can make use of a " "shared resource created in a parent process using a global resource. " @@ -4266,7 +4277,7 @@ msgid "" "for the child process." msgstr "" -#: ../../library/multiprocessing.rst:2907 +#: ../../library/multiprocessing.rst:2917 msgid "" "Apart from making the code (potentially) compatible with Windows and the " "other start methods this also ensures that as long as the child process is " @@ -4275,11 +4286,11 @@ msgid "" "collected in the parent process." msgstr "" -#: ../../library/multiprocessing.rst:2914 +#: ../../library/multiprocessing.rst:2924 msgid "So for instance ::" msgstr "" -#: ../../library/multiprocessing.rst:2916 +#: ../../library/multiprocessing.rst:2926 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -4301,11 +4312,11 @@ msgstr "" " for i in range(10):\n" " Process(target=f).start()" -#: ../../library/multiprocessing.rst:2926 +#: ../../library/multiprocessing.rst:2936 msgid "should be rewritten as ::" msgstr "" -#: ../../library/multiprocessing.rst:2928 +#: ../../library/multiprocessing.rst:2938 msgid "" "from multiprocessing import Process, Lock\n" "\n" @@ -4327,25 +4338,25 @@ msgstr "" " for i in range(10):\n" " Process(target=f, args=(lock,)).start()" -#: ../../library/multiprocessing.rst:2938 +#: ../../library/multiprocessing.rst:2948 msgid "Beware of replacing :data:`sys.stdin` with a \"file like object\"" msgstr "" -#: ../../library/multiprocessing.rst:2940 +#: ../../library/multiprocessing.rst:2950 msgid ":mod:`multiprocessing` originally unconditionally called::" msgstr "" -#: ../../library/multiprocessing.rst:2942 +#: ../../library/multiprocessing.rst:2952 msgid "os.close(sys.stdin.fileno())" msgstr "os.close(sys.stdin.fileno())" -#: ../../library/multiprocessing.rst:2944 +#: ../../library/multiprocessing.rst:2954 msgid "" "in the :meth:`multiprocessing.Process._bootstrap` method --- this resulted " "in issues with processes-in-processes. This has been changed to::" msgstr "" -#: ../../library/multiprocessing.rst:2947 +#: ../../library/multiprocessing.rst:2957 msgid "" "sys.stdin.close()\n" "sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" @@ -4353,7 +4364,7 @@ msgstr "" "sys.stdin.close()\n" "sys.stdin = open(os.open(os.devnull, os.O_RDONLY), closefd=False)" -#: ../../library/multiprocessing.rst:2950 +#: ../../library/multiprocessing.rst:2960 msgid "" "Which solves the fundamental issue of processes colliding with each other " "resulting in a bad file descriptor error, but introduces a potential danger " @@ -4363,14 +4374,14 @@ msgid "" "data being flushed to the object multiple times, resulting in corruption." msgstr "" -#: ../../library/multiprocessing.rst:2957 +#: ../../library/multiprocessing.rst:2967 msgid "" "If you write a file-like object and implement your own caching, you can make " "it fork-safe by storing the pid whenever you append to the cache, and " "discarding the cache when the pid changes. For example::" msgstr "" -#: ../../library/multiprocessing.rst:2961 +#: ../../library/multiprocessing.rst:2971 msgid "" "@property\n" "def cache(self):\n" @@ -4388,26 +4399,26 @@ msgstr "" " self._cache = []\n" " return self._cache" -#: ../../library/multiprocessing.rst:2969 +#: ../../library/multiprocessing.rst:2979 msgid "" "For more information, see :issue:`5155`, :issue:`5313` and :issue:`5331`" msgstr "" -#: ../../library/multiprocessing.rst:2972 +#: ../../library/multiprocessing.rst:2982 msgid "The *spawn* and *forkserver* start methods" msgstr "" -#: ../../library/multiprocessing.rst:2974 +#: ../../library/multiprocessing.rst:2984 msgid "" "There are a few extra restrictions which don't apply to the *fork* start " "method." msgstr "" -#: ../../library/multiprocessing.rst:2977 +#: ../../library/multiprocessing.rst:2987 msgid "More picklability" msgstr "" -#: ../../library/multiprocessing.rst:2979 +#: ../../library/multiprocessing.rst:2989 msgid "" "Ensure that all arguments to :meth:`Process.__init__` are picklable. Also, " "if you subclass :class:`~multiprocessing.Process` then make sure that " @@ -4415,11 +4426,11 @@ msgid "" "Process.start>` method is called." msgstr "" -#: ../../library/multiprocessing.rst:2984 +#: ../../library/multiprocessing.rst:2994 msgid "Global variables" msgstr "" -#: ../../library/multiprocessing.rst:2986 +#: ../../library/multiprocessing.rst:2996 msgid "" "Bear in mind that if code run in a child process tries to access a global " "variable, then the value it sees (if any) may not be the same as the value " @@ -4427,30 +4438,30 @@ msgid "" "Process.start>` was called." msgstr "" -#: ../../library/multiprocessing.rst:2991 +#: ../../library/multiprocessing.rst:3001 msgid "" "However, global variables which are just module level constants cause no " "problems." msgstr "" -#: ../../library/multiprocessing.rst:2996 +#: ../../library/multiprocessing.rst:3006 msgid "Safe importing of main module" msgstr "" -#: ../../library/multiprocessing.rst:2998 +#: ../../library/multiprocessing.rst:3008 msgid "" "Make sure that the main module can be safely imported by a new Python " "interpreter without causing unintended side effects (such as starting a new " "process)." msgstr "" -#: ../../library/multiprocessing.rst:3002 +#: ../../library/multiprocessing.rst:3012 msgid "" "For example, using the *spawn* or *forkserver* start method running the " "following module would fail with a :exc:`RuntimeError`::" msgstr "" -#: ../../library/multiprocessing.rst:3006 +#: ../../library/multiprocessing.rst:3016 msgid "" "from multiprocessing import Process\n" "\n" @@ -4468,13 +4479,13 @@ msgstr "" "p = Process(target=foo)\n" "p.start()" -#: ../../library/multiprocessing.rst:3014 +#: ../../library/multiprocessing.rst:3024 msgid "" "Instead one should protect the \"entry point\" of the program by using ``if " "__name__ == '__main__':`` as follows::" msgstr "" -#: ../../library/multiprocessing.rst:3017 +#: ../../library/multiprocessing.rst:3027 msgid "" "from multiprocessing import Process, freeze_support, set_start_method\n" "\n" @@ -4498,33 +4509,33 @@ msgstr "" " p = Process(target=foo)\n" " p.start()" -#: ../../library/multiprocessing.rst:3028 +#: ../../library/multiprocessing.rst:3038 msgid "" "(The ``freeze_support()`` line can be omitted if the program will be run " "normally instead of frozen.)" msgstr "" -#: ../../library/multiprocessing.rst:3031 +#: ../../library/multiprocessing.rst:3041 msgid "" "This allows the newly spawned Python interpreter to safely import the module " "and then run the module's ``foo()`` function." msgstr "" -#: ../../library/multiprocessing.rst:3034 +#: ../../library/multiprocessing.rst:3044 msgid "" "Similar restrictions apply if a pool or manager is created in the main " "module." msgstr "" -#: ../../library/multiprocessing.rst:3041 +#: ../../library/multiprocessing.rst:3051 msgid "Examples" msgstr "範例" -#: ../../library/multiprocessing.rst:3043 +#: ../../library/multiprocessing.rst:3053 msgid "Demonstration of how to create and use customized managers and proxies:" msgstr "" -#: ../../library/multiprocessing.rst:3045 +#: ../../library/multiprocessing.rst:3055 msgid "" "from multiprocessing import freeze_support\n" "from multiprocessing.managers import BaseManager, BaseProxy\n" @@ -4618,11 +4629,11 @@ msgid "" " test()\n" msgstr "" -#: ../../library/multiprocessing.rst:3049 +#: ../../library/multiprocessing.rst:3059 msgid "Using :class:`~multiprocessing.pool.Pool`:" msgstr "使用 :class:`~multiprocessing.pool.Pool`:" -#: ../../library/multiprocessing.rst:3051 +#: ../../library/multiprocessing.rst:3061 msgid "" "import multiprocessing\n" "import time\n" @@ -4782,13 +4793,13 @@ msgid "" " test()\n" msgstr "" -#: ../../library/multiprocessing.rst:3055 +#: ../../library/multiprocessing.rst:3065 msgid "" "An example showing how to use queues to feed tasks to a collection of worker " "processes and collect the results:" msgstr "" -#: ../../library/multiprocessing.rst:3058 +#: ../../library/multiprocessing.rst:3068 msgid "" "import time\n" "import random\n" @@ -4868,3 +4879,16 @@ msgid "" " freeze_support()\n" " test()\n" msgstr "" + +#, fuzzy +#~ msgid "" +#~ "This module does not work or is not available on WebAssembly platforms, " +#~ "or on iOS. See :ref:`wasm-availability` for more information on WASM " +#~ "availability; see :ref:`iOS-availability` for more information on iOS " +#~ "availability." +#~ msgstr "" +#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" +#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" + +#~ msgid ":func:`os.cpu_count`" +#~ msgstr ":func:`os.cpu_count`" diff --git a/library/multiprocessing.shared_memory.po b/library/multiprocessing.shared_memory.po index 36e1c95d50..78ad49ee37 100644 --- a/library/multiprocessing.shared_memory.po +++ b/library/multiprocessing.shared_memory.po @@ -5,9 +5,9 @@ # Matt Wang , 2023-2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-12-11 00:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -127,54 +127,72 @@ msgstr "" "(memory page) 大小來選擇分配記憶體區塊,因此共享記憶體區塊的確切大小可能大於" "或等於請求的大小。當附加到現有共享記憶體區塊時,``size`` 參數將被忽略。" -#: ../../library/multiprocessing.shared_memory.rst:75 +#: ../../library/multiprocessing.shared_memory.rst:73 msgid "" -"Close access to the shared memory from this instance. In order to ensure " -"proper cleanup of resources, all instances should call :meth:`close` once " -"the instance is no longer needed. Note that calling :meth:`!close` does not " -"cause the shared memory block itself to be destroyed." +"When ``True``, register the shared memory block with a resource tracker " +"process on platforms where the OS does not do this automatically. The " +"resource tracker ensures proper cleanup of the shared memory even if all " +"other processes with access to the memory exit without doing so. Python " +"processes created from a common ancestor using :mod:`multiprocessing` " +"facilities share a single resource tracker process, and the lifetime of " +"shared memory segments is handled automatically among these processes. " +"Python processes created in any other way will receive their own resource " +"tracker when accessing shared memory with *track* enabled. This will cause " +"the shared memory to be deleted by the resource tracker of the first process " +"that terminates. To avoid this issue, users of :mod:`subprocess` or " +"standalone Python processes should set *track* to ``False`` when there is " +"already another process in place that does the bookkeeping. *track* is " +"ignored on Windows, which has its own tracking and automatically deletes " +"shared memory when all handles to it have been closed." msgstr "" -"關閉從此實例對共享記憶體的存取。為了確保正確清理資源,一旦實例不再被需要,所" -"有實例都應該呼叫 :meth:`close`。請注意,呼叫 :meth:`!close` 不會使得共享記憶" -"體區塊本身被銷毀。" -#: ../../library/multiprocessing.shared_memory.rst:83 -msgid "" -"Request that the underlying shared memory block be destroyed. In order to " -"ensure proper cleanup of resources, :meth:`unlink` should be called once " -"(and only once) across all processes which have need for the shared memory " -"block. After requesting its destruction, a shared memory block may or may " -"not be immediately destroyed and this behavior may differ across platforms. " -"Attempts to access data inside the shared memory block after :meth:`!unlink` " -"has been called may result in memory access errors. Note: the last process " -"relinquishing its hold on a shared memory block may call :meth:`!unlink` " -"and :meth:`close` in either order." +#: ../../library/multiprocessing.shared_memory.rst:91 +msgid "Added the *track* parameter." msgstr "" -"請求銷毀底層共享記憶體區塊。為了確保正確清理資源,應該在需要共享記憶體區塊的" -"所有行程中呼叫一次(且僅一次)\\ :meth:`unlink`。請求銷毀後,共享記憶體區塊可" -"能會也可能不會立即銷毀,此行為可能因平台而異。呼叫 :meth:`!unlink` 後嘗試存取" -"共享記憶體區塊內的資料可能會導致記憶體存取錯誤。注意:最後一個放棄持有某共享" -"記憶體區塊的行程可以按任意順序呼叫 :meth:`!unlink` 和 :meth:`close`。" #: ../../library/multiprocessing.shared_memory.rst:96 +msgid "" +"Close the file descriptor/handle to the shared memory from this instance. :" +"meth:`close` should be called once access to the shared memory block from " +"this instance is no longer needed. Depending on operating system, the " +"underlying memory may or may not be freed even if all handles to it have " +"been closed. To ensure proper cleanup, use the :meth:`unlink` method." +msgstr "" + +#: ../../library/multiprocessing.shared_memory.rst:105 +msgid "" +"Delete the underlying shared memory block. This should be called only once " +"per shared memory block regardless of the number of handles to it, even in " +"other processes. :meth:`unlink` and :meth:`close` can be called in any " +"order, but trying to access data inside a shared memory block after :meth:" +"`unlink` may result in memory access errors, depending on platform." +msgstr "" + +#: ../../library/multiprocessing.shared_memory.rst:112 +msgid "" +"This method has no effect on Windows, where the only way to delete a shared " +"memory block is to close all handles." +msgstr "" + +#: ../../library/multiprocessing.shared_memory.rst:117 msgid "A memoryview of contents of the shared memory block." msgstr "共享記憶體區塊內容的記憶體視圖 (memoryview)。" -#: ../../library/multiprocessing.shared_memory.rst:100 +#: ../../library/multiprocessing.shared_memory.rst:121 msgid "Read-only access to the unique name of the shared memory block." msgstr "對共享記憶體區塊之唯一名稱的唯讀存取。" -#: ../../library/multiprocessing.shared_memory.rst:104 +#: ../../library/multiprocessing.shared_memory.rst:125 msgid "Read-only access to size in bytes of the shared memory block." msgstr "對共享記憶體區塊大小(以位元組為單位)的唯讀存取。" -#: ../../library/multiprocessing.shared_memory.rst:107 +#: ../../library/multiprocessing.shared_memory.rst:128 msgid "" "The following example demonstrates low-level use of :class:`SharedMemory` " "instances::" msgstr "以下範例示範了 :class:`SharedMemory` 實例的低階使用方式: ::" -#: ../../library/multiprocessing.shared_memory.rst:110 +#: ../../library/multiprocessing.shared_memory.rst:131 msgid "" ">>> from multiprocessing import shared_memory\n" ">>> shm_a = shared_memory.SharedMemory(create=True, size=10)\n" @@ -199,7 +217,7 @@ msgid "" ">>> shm_a.unlink() # Call unlink only once to release the shared memory" msgstr "" -#: ../../library/multiprocessing.shared_memory.rst:133 +#: ../../library/multiprocessing.shared_memory.rst:154 msgid "" "The following example demonstrates a practical use of the :class:" "`SharedMemory` class with `NumPy arrays `_, accessing " @@ -209,7 +227,7 @@ msgstr "" ">`_\\ 的實際用法:從兩個不同的 Python shell 存取相同的 :class:`!numpy." "ndarray`:" -#: ../../library/multiprocessing.shared_memory.rst:137 +#: ../../library/multiprocessing.shared_memory.rst:158 msgid "" ">>> # In the first Python interactive shell\n" ">>> import numpy as np\n" @@ -255,7 +273,7 @@ msgid "" ">>> shm.unlink() # Free and release the shared memory block at the very end" msgstr "" -#: ../../library/multiprocessing.shared_memory.rst:187 +#: ../../library/multiprocessing.shared_memory.rst:208 msgid "" "A subclass of :class:`multiprocessing.managers.BaseManager` which can be " "used for the management of shared memory blocks across processes." @@ -263,7 +281,7 @@ msgstr "" ":class:`multiprocessing.managers.BaseManager` 的子類別,可用於跨行程管理共享" "記憶體區塊。" -#: ../../library/multiprocessing.shared_memory.rst:190 +#: ../../library/multiprocessing.shared_memory.rst:211 msgid "" "A call to :meth:`~multiprocessing.managers.BaseManager.start` on a :class:`!" "SharedMemoryManager` instance causes a new process to be started. This new " @@ -286,7 +304,7 @@ msgstr "" "SharedMemoryManager` 建立 :class:`!SharedMemory` 實例,我們無需手動追蹤和觸" "發共享記憶體資源的釋放。" -#: ../../library/multiprocessing.shared_memory.rst:202 +#: ../../library/multiprocessing.shared_memory.rst:223 msgid "" "This class provides methods for creating and returning :class:`SharedMemory` " "instances and for creating a list-like object (:class:`ShareableList`) " @@ -295,7 +313,7 @@ msgstr "" "此類別提供了用於建立和回傳 :class:`SharedMemory` 實例以及建立由共享記憶體支援" "的類串列物件 (:class:`ShareableList`) 的方法。" -#: ../../library/multiprocessing.shared_memory.rst:206 +#: ../../library/multiprocessing.shared_memory.rst:227 msgid "" "Refer to :class:`~multiprocessing.managers.BaseManager` for a description of " "the inherited *address* and *authkey* optional input arguments and how they " @@ -306,7 +324,7 @@ msgstr "" "和 *authkey* 可選輸入引數的描述以及如何使用它們從其他行程連接到現有的 :class:" "`!SharedMemoryManager` 服務。" -#: ../../library/multiprocessing.shared_memory.rst:213 +#: ../../library/multiprocessing.shared_memory.rst:234 msgid "" "Create and return a new :class:`SharedMemory` object with the specified " "*size* in bytes." @@ -314,7 +332,7 @@ msgstr "" "建立並回傳一個新的 :class:`SharedMemory` 物件,該物件具有指定的 *size*\\ (以" "位元組為單位)。" -#: ../../library/multiprocessing.shared_memory.rst:218 +#: ../../library/multiprocessing.shared_memory.rst:239 msgid "" "Create and return a new :class:`ShareableList` object, initialized by the " "values from the input *sequence*." @@ -322,7 +340,7 @@ msgstr "" "建立並回傳一個新的 :class:`ShareableList` 物件,該物件由輸入 *sequence* 中的" "值初始化。" -#: ../../library/multiprocessing.shared_memory.rst:222 +#: ../../library/multiprocessing.shared_memory.rst:243 msgid "" "The following example demonstrates the basic mechanisms of a :class:" "`~multiprocessing.managers.SharedMemoryManager`:" @@ -330,7 +348,7 @@ msgstr "" "以下範例示範了 :class:`~multiprocessing.managers.SharedMemoryManager` 的基本" "作用機制:" -#: ../../library/multiprocessing.shared_memory.rst:225 +#: ../../library/multiprocessing.shared_memory.rst:246 msgid "" ">>> from multiprocessing.managers import SharedMemoryManager\n" ">>> smm = SharedMemoryManager()\n" @@ -345,7 +363,7 @@ msgid "" ">>> smm.shutdown() # Calls unlink() on sl, raw_shm, and another_sl" msgstr "" -#: ../../library/multiprocessing.shared_memory.rst:240 +#: ../../library/multiprocessing.shared_memory.rst:261 msgid "" "The following example depicts a potentially more convenient pattern for " "using :class:`~multiprocessing.managers.SharedMemoryManager` objects via " @@ -356,7 +374,7 @@ msgstr "" "`~multiprocessing.managers.SharedMemoryManager` 物件,以確保所有共享記憶體區" "塊不再被需要後都被釋放:" -#: ../../library/multiprocessing.shared_memory.rst:245 +#: ../../library/multiprocessing.shared_memory.rst:266 msgid "" ">>> with SharedMemoryManager() as smm:\n" "... sl = smm.ShareableList(range(2000))\n" @@ -371,7 +389,7 @@ msgid "" "... total_result = sum(sl) # Consolidate the partial results now in sl" msgstr "" -#: ../../library/multiprocessing.shared_memory.rst:259 +#: ../../library/multiprocessing.shared_memory.rst:280 msgid "" "When using a :class:`~multiprocessing.managers.SharedMemoryManager` in a :" "keyword:`with` statement, the shared memory blocks created using that " @@ -382,7 +400,7 @@ msgstr "" "SharedMemoryManager` 時,當 :keyword:`!with` 陳述式的程式碼區塊執行完畢時,使" "用該管理器建立的共享記憶體區塊都會被釋放。" -#: ../../library/multiprocessing.shared_memory.rst:267 +#: ../../library/multiprocessing.shared_memory.rst:288 msgid "" "Provide a mutable list-like object where all values stored within are stored " "in a shared memory block. This constrains storable values to the following " @@ -391,31 +409,31 @@ msgstr "" "提供一個類似 list 的可變物件,其中儲存的所有值都儲存在共享記憶體區塊中。這將" "可儲存值限制為以下內建資料型別:" -#: ../../library/multiprocessing.shared_memory.rst:271 +#: ../../library/multiprocessing.shared_memory.rst:292 msgid ":class:`int` (signed 64-bit)" msgstr ":class:`int` (有符號 64 位元)" -#: ../../library/multiprocessing.shared_memory.rst:272 +#: ../../library/multiprocessing.shared_memory.rst:293 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/multiprocessing.shared_memory.rst:273 +#: ../../library/multiprocessing.shared_memory.rst:294 msgid ":class:`bool`" msgstr ":class:`bool`" -#: ../../library/multiprocessing.shared_memory.rst:274 +#: ../../library/multiprocessing.shared_memory.rst:295 msgid ":class:`str` (less than 10M bytes each when encoded as UTF-8)" msgstr ":class:`str` (編碼為 UTF-8 時每個小於 10M 位元組)" -#: ../../library/multiprocessing.shared_memory.rst:275 +#: ../../library/multiprocessing.shared_memory.rst:296 msgid ":class:`bytes` (less than 10M bytes each)" msgstr ":class:`bytes` (每個小於 10M 位元組)" -#: ../../library/multiprocessing.shared_memory.rst:276 +#: ../../library/multiprocessing.shared_memory.rst:297 msgid "``None``" msgstr "``None``" -#: ../../library/multiprocessing.shared_memory.rst:278 +#: ../../library/multiprocessing.shared_memory.rst:299 msgid "" "It also notably differs from the built-in :class:`list` type in that these " "lists can not change their overall length (i.e. no :meth:`!append`, :meth:`!" @@ -426,7 +444,7 @@ msgstr "" "有 :meth:`!append`、:meth:`!insert` 等)並且不支援通過切片動態建立新的 :" "class:`!ShareableList` 實例。" -#: ../../library/multiprocessing.shared_memory.rst:284 +#: ../../library/multiprocessing.shared_memory.rst:305 msgid "" "*sequence* is used in populating a new :class:`!ShareableList` full of " "values. Set to ``None`` to instead attach to an already existing :class:`!" @@ -436,7 +454,7 @@ msgstr "" "為 ``None`` 以透過其唯一的共享記憶體名稱來附加到已經存在的 :class:`!" "ShareableList`。" -#: ../../library/multiprocessing.shared_memory.rst:288 +#: ../../library/multiprocessing.shared_memory.rst:309 msgid "" "*name* is the unique name for the requested shared memory, as described in " "the definition for :class:`SharedMemory`. When attaching to an existing :" @@ -447,7 +465,7 @@ msgstr "" "稱。當附加到現有的 :class:`!ShareableList` 時,指定其共享記憶體區塊的唯一名" "稱,同時將 *sequence* 設定為 ``None``。" -#: ../../library/multiprocessing.shared_memory.rst:295 +#: ../../library/multiprocessing.shared_memory.rst:316 msgid "" "A known issue exists for :class:`bytes` and :class:`str` values. If they end " "with ``\\x00`` nul bytes or characters, those may be *silently stripped* " @@ -461,7 +479,7 @@ msgstr "" "rstrip(b'\\x00')`` 行為被認為是一個錯誤,將來可能會消失。請參閱 :gh:" "`106939`。" -#: ../../library/multiprocessing.shared_memory.rst:301 +#: ../../library/multiprocessing.shared_memory.rst:322 msgid "" "For applications where rstripping of trailing nulls is a problem, work " "around it by always unconditionally appending an extra non-0 byte to the end " @@ -471,7 +489,7 @@ msgstr "" "(workaround) 是始終無條件地在儲存時於此類值的末尾追加一個額外非 0 位元組,並" "在獲取時也無條件地刪除它:" -#: ../../library/multiprocessing.shared_memory.rst:306 +#: ../../library/multiprocessing.shared_memory.rst:327 msgid "" ">>> from multiprocessing import shared_memory\n" ">>> nul_bug_demo = shared_memory.ShareableList(['?\\x00', " @@ -505,11 +523,11 @@ msgstr "" "b'\\x03\\x02\\x01\\x00\\x00\\x00'\n" ">>> padded.shm.unlink()" -#: ../../library/multiprocessing.shared_memory.rst:324 +#: ../../library/multiprocessing.shared_memory.rst:345 msgid "Return the number of occurrences of *value*." msgstr "回傳 *value* 出現的次數。" -#: ../../library/multiprocessing.shared_memory.rst:328 +#: ../../library/multiprocessing.shared_memory.rst:349 msgid "" "Return first index position of *value*. Raise :exc:`ValueError` if *value* " "is not present." @@ -517,23 +535,23 @@ msgstr "" "回傳 *value* 的第一個索引位置。如果 *value* 不存在,則引發 :exc:" "`ValueError`。" -#: ../../library/multiprocessing.shared_memory.rst:333 +#: ../../library/multiprocessing.shared_memory.rst:354 msgid "" "Read-only attribute containing the :mod:`struct` packing format used by all " "currently stored values." msgstr "唯讀屬性,包含所有目前有儲存的值所使用的 :mod:`struct` 打包格式。" -#: ../../library/multiprocessing.shared_memory.rst:338 +#: ../../library/multiprocessing.shared_memory.rst:359 msgid "The :class:`SharedMemory` instance where the values are stored." msgstr "儲存值的 :class:`SharedMemory` 實例。" -#: ../../library/multiprocessing.shared_memory.rst:341 +#: ../../library/multiprocessing.shared_memory.rst:362 msgid "" "The following example demonstrates basic use of a :class:`ShareableList` " "instance:" msgstr "以下範例示範了 :class:`ShareableList` 實例的基本用法:" -#: ../../library/multiprocessing.shared_memory.rst:374 +#: ../../library/multiprocessing.shared_memory.rst:395 msgid "" "The following example depicts how one, two, or many processes may access the " "same :class:`ShareableList` by supplying the name of the shared memory block " @@ -542,7 +560,7 @@ msgstr "" "以下範例描述了一個、兩個或多個行程如何透過提供後面的共享記憶體區塊名稱來存取" "同一個 :class:`ShareableList`:" -#: ../../library/multiprocessing.shared_memory.rst:389 +#: ../../library/multiprocessing.shared_memory.rst:410 msgid "" "The following examples demonstrates that :class:`ShareableList` (and " "underlying :class:`SharedMemory`) objects can be pickled and unpickled if " @@ -567,3 +585,31 @@ msgstr "POSIX Shared Memory(POSIX 共享記憶體)" #: ../../library/multiprocessing.shared_memory.rst:11 msgid "Named Shared Memory" msgstr "Named Shared Memory(附名共享記憶體)" + +#~ msgid "" +#~ "Close access to the shared memory from this instance. In order to ensure " +#~ "proper cleanup of resources, all instances should call :meth:`close` once " +#~ "the instance is no longer needed. Note that calling :meth:`!close` does " +#~ "not cause the shared memory block itself to be destroyed." +#~ msgstr "" +#~ "關閉從此實例對共享記憶體的存取。為了確保正確清理資源,一旦實例不再被需要," +#~ "所有實例都應該呼叫 :meth:`close`。請注意,呼叫 :meth:`!close` 不會使得共享" +#~ "記憶體區塊本身被銷毀。" + +#~ msgid "" +#~ "Request that the underlying shared memory block be destroyed. In order " +#~ "to ensure proper cleanup of resources, :meth:`unlink` should be called " +#~ "once (and only once) across all processes which have need for the shared " +#~ "memory block. After requesting its destruction, a shared memory block " +#~ "may or may not be immediately destroyed and this behavior may differ " +#~ "across platforms. Attempts to access data inside the shared memory block " +#~ "after :meth:`!unlink` has been called may result in memory access " +#~ "errors. Note: the last process relinquishing its hold on a shared memory " +#~ "block may call :meth:`!unlink` and :meth:`close` in either order." +#~ msgstr "" +#~ "請求銷毀底層共享記憶體區塊。為了確保正確清理資源,應該在需要共享記憶體區塊" +#~ "的所有行程中呼叫一次(且僅一次)\\ :meth:`unlink`。請求銷毀後,共享記憶體" +#~ "區塊可能會也可能不會立即銷毀,此行為可能因平台而異。呼叫 :meth:`!unlink` " +#~ "後嘗試存取共享記憶體區塊內的資料可能會導致記憶體存取錯誤。注意:最後一個放" +#~ "棄持有某共享記憶體區塊的行程可以按任意順序呼叫 :meth:`!unlink` 和 :meth:" +#~ "`close`。" diff --git a/library/netdata.po b/library/netdata.po index 8f8a8899d5..079730d3d7 100644 --- a/library/netdata.po +++ b/library/netdata.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-10-26 16:47+0000\n" "PO-Revision-Date: 2023-01-23 23:33+0800\n" diff --git a/library/netrc.po b/library/netrc.po index 31020039ae..81fdb294b8 100644 --- a/library/netrc.po +++ b/library/netrc.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:06+0000\n" diff --git a/library/nis.po b/library/nis.po deleted file mode 100644 index 02a77493b4..0000000000 --- a/library/nis.po +++ /dev/null @@ -1,100 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" -"PO-Revision-Date: 2016-11-19 00:32+0000\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/nis.rst:3 -msgid ":mod:`nis` --- Interface to Sun's NIS (Yellow Pages)" -msgstr ":mod:`nis` --- Sun NIS (Yellow Pages) 介面" - -#: ../../library/nis.rst:13 -msgid "" -"The :mod:`nis` module is deprecated (see :pep:`PEP 594 <594#nis>` for " -"details)." -msgstr "" -":mod:`nis` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#nis>`\\ )。" - -#: ../../library/nis.rst:19 -msgid "" -"The :mod:`nis` module gives a thin wrapper around the NIS library, useful " -"for central administration of several hosts." -msgstr "" - -#: ../../library/nis.rst:22 -msgid "" -"Because NIS exists only on Unix systems, this module is only available for " -"Unix." -msgstr "" - -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: ../../includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" - -#: ../../library/nis.rst:26 -msgid "The :mod:`nis` module defines the following functions:" -msgstr "" - -#: ../../library/nis.rst:31 -msgid "" -"Return the match for *key* in map *mapname*, or raise an error (:exc:`nis." -"error`) if there is none. Both should be strings, *key* is 8-bit clean. " -"Return value is an arbitrary array of bytes (may contain ``NULL`` and other " -"joys)." -msgstr "" - -#: ../../library/nis.rst:36 ../../library/nis.rst:48 -msgid "Note that *mapname* is first checked if it is an alias to another name." -msgstr "" - -#: ../../library/nis.rst:38 ../../library/nis.rst:50 ../../library/nis.rst:58 -msgid "" -"The *domain* argument allows overriding the NIS domain used for the lookup. " -"If unspecified, lookup is in the default NIS domain." -msgstr "" - -#: ../../library/nis.rst:44 -msgid "" -"Return a dictionary mapping *key* to *value* such that ``match(key, " -"mapname)==value``. Note that both keys and values of the dictionary are " -"arbitrary arrays of bytes." -msgstr "" - -#: ../../library/nis.rst:56 -msgid "Return a list of all valid maps." -msgstr "" - -#: ../../library/nis.rst:64 -msgid "Return the system default NIS domain." -msgstr "" - -#: ../../library/nis.rst:67 -msgid "The :mod:`nis` module defines the following exception:" -msgstr "" - -#: ../../library/nis.rst:71 -msgid "An error raised when a NIS function returns an error code." -msgstr "" diff --git a/library/nntplib.po b/library/nntplib.po deleted file mode 100644 index f416460fef..0000000000 --- a/library/nntplib.po +++ /dev/null @@ -1,688 +0,0 @@ -# Copyright (C) 2001-2024, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2018-05-23 16:06+0000\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/nntplib.rst:2 -msgid ":mod:`nntplib` --- NNTP protocol client" -msgstr ":mod:`nntplib` --- NNTP 協定客戶端" - -#: ../../library/nntplib.rst:8 -msgid "**Source code:** :source:`Lib/nntplib.py`" -msgstr "**原始碼:**\\ :source:`Lib/nntplib.py`" - -#: ../../library/nntplib.rst:14 -msgid "The :mod:`nntplib` module is deprecated (see :pep:`594` for details)." -msgstr ":mod:`nntlib` 模組 (module) 即將被棄用(詳見 :pep:`594`\\ )。" - -#: ../../library/nntplib.rst:36 -msgid "" -"This module defines the class :class:`NNTP` which implements the client side " -"of the Network News Transfer Protocol. It can be used to implement a news " -"reader or poster, or automated news processors. It is compatible with :rfc:" -"`3977` as well as the older :rfc:`977` and :rfc:`2980`." -msgstr "" - -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: ../../includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" - -#: ../../library/nntplib.rst:43 -msgid "" -"Here are two small examples of how it can be used. To list some statistics " -"about a newsgroup and print the subjects of the last 10 articles::" -msgstr "" - -#: ../../library/nntplib.rst:46 -msgid "" -">>> s = nntplib.NNTP('news.gmane.io')\n" -">>> resp, count, first, last, name = s.group('gmane.comp.python." -"committers')\n" -">>> print('Group', name, 'has', count, 'articles, range', first, 'to', " -"last)\n" -"Group gmane.comp.python.committers has 1096 articles, range 1 to 1096\n" -">>> resp, overviews = s.over((last - 9, last))\n" -">>> for id, over in overviews:\n" -"... print(id, nntplib.decode_header(over['subject']))\n" -"...\n" -"1087 Re: Commit privileges for Łukasz Langa\n" -"1088 Re: 3.2 alpha 2 freeze\n" -"1089 Re: 3.2 alpha 2 freeze\n" -"1090 Re: Commit privileges for Łukasz Langa\n" -"1091 Re: Commit privileges for Łukasz Langa\n" -"1092 Updated ssh key\n" -"1093 Re: Updated ssh key\n" -"1094 Re: Updated ssh key\n" -"1095 Hello fellow committers!\n" -"1096 Re: Hello fellow committers!\n" -">>> s.quit()\n" -"'205 Bye!'" -msgstr "" -">>> s = nntplib.NNTP('news.gmane.io')\n" -">>> resp, count, first, last, name = s.group('gmane.comp.python." -"committers')\n" -">>> print('Group', name, 'has', count, 'articles, range', first, 'to', " -"last)\n" -"Group gmane.comp.python.committers has 1096 articles, range 1 to 1096\n" -">>> resp, overviews = s.over((last - 9, last))\n" -">>> for id, over in overviews:\n" -"... print(id, nntplib.decode_header(over['subject']))\n" -"...\n" -"1087 Re: Commit privileges for Łukasz Langa\n" -"1088 Re: 3.2 alpha 2 freeze\n" -"1089 Re: 3.2 alpha 2 freeze\n" -"1090 Re: Commit privileges for Łukasz Langa\n" -"1091 Re: Commit privileges for Łukasz Langa\n" -"1092 Updated ssh key\n" -"1093 Re: Updated ssh key\n" -"1094 Re: Updated ssh key\n" -"1095 Hello fellow committers!\n" -"1096 Re: Hello fellow committers!\n" -">>> s.quit()\n" -"'205 Bye!'" - -#: ../../library/nntplib.rst:67 -msgid "" -"To post an article from a binary file (this assumes that the article has " -"valid headers, and that you have right to post on the particular newsgroup)::" -msgstr "" - -#: ../../library/nntplib.rst:70 -msgid "" -">>> s = nntplib.NNTP('news.gmane.io')\n" -">>> f = open('article.txt', 'rb')\n" -">>> s.post(f)\n" -"'240 Article posted successfully.'\n" -">>> s.quit()\n" -"'205 Bye!'" -msgstr "" -">>> s = nntplib.NNTP('news.gmane.io')\n" -">>> f = open('article.txt', 'rb')\n" -">>> s.post(f)\n" -"'240 Article posted successfully.'\n" -">>> s.quit()\n" -"'205 Bye!'" - -#: ../../library/nntplib.rst:77 -msgid "The module itself defines the following classes:" -msgstr "" - -#: ../../library/nntplib.rst:82 -msgid "" -"Return a new :class:`NNTP` object, representing a connection to the NNTP " -"server running on host *host*, listening at port *port*. An optional " -"*timeout* can be specified for the socket connection. If the optional *user* " -"and *password* are provided, or if suitable credentials are present in :file:" -"`/.netrc` and the optional flag *usenetrc* is true, the ``AUTHINFO USER`` " -"and ``AUTHINFO PASS`` commands are used to identify and authenticate the " -"user to the server. If the optional flag *readermode* is true, then a " -"``mode reader`` command is sent before authentication is performed. Reader " -"mode is sometimes necessary if you are connecting to an NNTP server on the " -"local machine and intend to call reader-specific commands, such as " -"``group``. If you get unexpected :exc:`NNTPPermanentError`\\ s, you might " -"need to set *readermode*. The :class:`NNTP` class supports the :keyword:" -"`with` statement to unconditionally consume :exc:`OSError` exceptions and to " -"close the NNTP connection when done, e.g.:" -msgstr "" - -#: ../../library/nntplib.rst:105 ../../library/nntplib.rst:137 -msgid "" -"Raises an :ref:`auditing event ` ``nntplib.connect`` with " -"arguments ``self``, ``host``, ``port``." -msgstr "" -"引發一個附帶引數 ``self``、``host``、``port`` 的\\ :ref:`稽核事件 " -"` ``nntplib.connect``。" - -#: ../../library/nntplib.rst:107 ../../library/nntplib.rst:109 -#: ../../library/nntplib.rst:139 ../../library/nntplib.rst:141 -msgid "" -"All commands will raise an :ref:`auditing event ` ``nntplib." -"putline`` with arguments ``self`` and ``line``, where ``line`` is the bytes " -"about to be sent to the remote host." -msgstr "" - -#: ../../library/nntplib.rst:113 -msgid "*usenetrc* is now ``False`` by default." -msgstr "" - -#: ../../library/nntplib.rst:116 -msgid "Support for the :keyword:`with` statement was added." -msgstr "" - -#: ../../library/nntplib.rst:119 ../../library/nntplib.rst:152 -msgid "" -"If the *timeout* parameter is set to be zero, it will raise a :class:" -"`ValueError` to prevent the creation of a non-blocking socket." -msgstr "" - -#: ../../library/nntplib.rst:125 -msgid "" -"Return a new :class:`NNTP_SSL` object, representing an encrypted connection " -"to the NNTP server running on host *host*, listening at port *port*. :class:" -"`NNTP_SSL` objects have the same methods as :class:`NNTP` objects. If " -"*port* is omitted, port 563 (NNTPS) is used. *ssl_context* is also optional, " -"and is a :class:`~ssl.SSLContext` object. Please read :ref:`ssl-security` " -"for best practices. All other parameters behave the same as for :class:" -"`NNTP`." -msgstr "" - -#: ../../library/nntplib.rst:133 -msgid "" -"Note that SSL-on-563 is discouraged per :rfc:`4642`, in favor of STARTTLS as " -"described below. However, some servers only support the former." -msgstr "" - -#: ../../library/nntplib.rst:147 -msgid "" -"The class now supports hostname check with :attr:`ssl.SSLContext." -"check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." -msgstr "" - -#: ../../library/nntplib.rst:158 -msgid "" -"Derived from the standard exception :exc:`Exception`, this is the base class " -"for all exceptions raised by the :mod:`nntplib` module. Instances of this " -"class have the following attribute:" -msgstr "" - -#: ../../library/nntplib.rst:164 -msgid "The response of the server if available, as a :class:`str` object." -msgstr "" - -#: ../../library/nntplib.rst:169 -msgid "Exception raised when an unexpected reply is received from the server." -msgstr "" - -#: ../../library/nntplib.rst:174 -msgid "" -"Exception raised when a response code in the range 400--499 is received." -msgstr "" - -#: ../../library/nntplib.rst:179 -msgid "" -"Exception raised when a response code in the range 500--599 is received." -msgstr "" - -#: ../../library/nntplib.rst:184 -msgid "" -"Exception raised when a reply is received from the server that does not " -"begin with a digit in the range 1--5." -msgstr "" - -#: ../../library/nntplib.rst:190 -msgid "Exception raised when there is some error in the response data." -msgstr "" - -#: ../../library/nntplib.rst:196 -msgid "NNTP Objects" -msgstr "NNTP 物件" - -#: ../../library/nntplib.rst:198 -msgid "" -"When connected, :class:`NNTP` and :class:`NNTP_SSL` objects support the " -"following methods and attributes." -msgstr "" - -#: ../../library/nntplib.rst:202 -msgid "Attributes" -msgstr "屬性" - -#: ../../library/nntplib.rst:206 -msgid "" -"An integer representing the version of the NNTP protocol supported by the " -"server. In practice, this should be ``2`` for servers advertising :rfc:" -"`3977` compliance and ``1`` for others." -msgstr "" - -#: ../../library/nntplib.rst:214 -msgid "" -"A string describing the software name and version of the NNTP server, or :" -"const:`None` if not advertised by the server." -msgstr "" - -#: ../../library/nntplib.rst:220 -msgid "Methods" -msgstr "方法" - -#: ../../library/nntplib.rst:222 -msgid "" -"The *response* that is returned as the first item in the return tuple of " -"almost all methods is the server's response: a string beginning with a three-" -"digit code. If the server's response indicates an error, the method raises " -"one of the above exceptions." -msgstr "" - -#: ../../library/nntplib.rst:227 -msgid "" -"Many of the following methods take an optional keyword-only argument *file*. " -"When the *file* argument is supplied, it must be either a :term:`file " -"object` opened for binary writing, or the name of an on-disk file to be " -"written to. The method will then write any data returned by the server " -"(except for the response line and the terminating dot) to the file; any list " -"of lines, tuples or objects that the method normally returns will be empty." -msgstr "" - -#: ../../library/nntplib.rst:234 -msgid "" -"Many of the following methods have been reworked and fixed, which makes them " -"incompatible with their 3.1 counterparts." -msgstr "" - -#: ../../library/nntplib.rst:241 -msgid "" -"Send a ``QUIT`` command and close the connection. Once this method has been " -"called, no other methods of the NNTP object should be called." -msgstr "" - -#: ../../library/nntplib.rst:247 -msgid "" -"Return the welcome message sent by the server in reply to the initial " -"connection. (This message sometimes contains disclaimers or help " -"information that may be relevant to the user.)" -msgstr "" - -#: ../../library/nntplib.rst:254 -msgid "" -"Return the :rfc:`3977` capabilities advertised by the server, as a :class:" -"`dict` instance mapping capability names to (possibly empty) lists of " -"values. On legacy servers which don't understand the ``CAPABILITIES`` " -"command, an empty dictionary is returned instead." -msgstr "" - -#: ../../library/nntplib.rst:268 -msgid "" -"Send ``AUTHINFO`` commands with the user name and password. If *user* and " -"*password* are ``None`` and *usenetrc* is true, credentials from ``~/." -"netrc`` will be used if possible." -msgstr "" - -#: ../../library/nntplib.rst:272 -msgid "" -"Unless intentionally delayed, login is normally performed during the :class:" -"`NNTP` object initialization and separately calling this function is " -"unnecessary. To force authentication to be delayed, you must not set *user* " -"or *password* when creating the object, and must set *usenetrc* to False." -msgstr "" - -#: ../../library/nntplib.rst:283 -msgid "" -"Send a ``STARTTLS`` command. This will enable encryption on the NNTP " -"connection. The *context* argument is optional and should be a :class:`ssl." -"SSLContext` object. Please read :ref:`ssl-security` for best practices." -msgstr "" - -#: ../../library/nntplib.rst:288 -msgid "" -"Note that this may not be done after authentication information has been " -"transmitted, and authentication occurs by default if possible during a :" -"class:`NNTP` object initialization. See :meth:`NNTP.login` for information " -"on suppressing this behavior." -msgstr "" - -#: ../../library/nntplib.rst:295 -msgid "" -"The method now supports hostname check with :attr:`ssl.SSLContext." -"check_hostname` and *Server Name Indication* (see :data:`ssl.HAS_SNI`)." -msgstr "" - -#: ../../library/nntplib.rst:302 -msgid "" -"Send a ``NEWGROUPS`` command. The *date* argument should be a :class:" -"`datetime.date` or :class:`datetime.datetime` object. Return a pair " -"``(response, groups)`` where *groups* is a list representing the groups that " -"are new since the given *date*. If *file* is supplied, though, then *groups* " -"will be empty." -msgstr "" - -#: ../../library/nntplib.rst:318 -msgid "" -"Send a ``NEWNEWS`` command. Here, *group* is a group name or ``'*'``, and " -"*date* has the same meaning as for :meth:`newgroups`. Return a pair " -"``(response, articles)`` where *articles* is a list of message ids." -msgstr "" - -#: ../../library/nntplib.rst:322 -msgid "This command is frequently disabled by NNTP server administrators." -msgstr "" - -#: ../../library/nntplib.rst:327 -msgid "" -"Send a ``LIST`` or ``LIST ACTIVE`` command. Return a pair ``(response, " -"list)`` where *list* is a list of tuples representing all the groups " -"available from this NNTP server, optionally matching the pattern string " -"*group_pattern*. Each tuple has the form ``(group, last, first, flag)``, " -"where *group* is a group name, *last* and *first* are the last and first " -"article numbers, and *flag* usually takes one of these values:" -msgstr "" - -#: ../../library/nntplib.rst:335 -msgid "``y``: Local postings and articles from peers are allowed." -msgstr "" - -#: ../../library/nntplib.rst:336 -msgid "``m``: The group is moderated and all postings must be approved." -msgstr "" - -#: ../../library/nntplib.rst:337 -msgid "``n``: No local postings are allowed, only articles from peers." -msgstr "" - -#: ../../library/nntplib.rst:338 -msgid "``j``: Articles from peers are filed in the junk group instead." -msgstr "" - -#: ../../library/nntplib.rst:339 -msgid "``x``: No local postings, and articles from peers are ignored." -msgstr "" - -#: ../../library/nntplib.rst:340 -msgid "``=foo.bar``: Articles are filed in the ``foo.bar`` group instead." -msgstr "" - -#: ../../library/nntplib.rst:342 -msgid "" -"If *flag* has another value, then the status of the newsgroup should be " -"considered unknown." -msgstr "" - -#: ../../library/nntplib.rst:345 -msgid "" -"This command can return very large results, especially if *group_pattern* is " -"not specified. It is best to cache the results offline unless you really " -"need to refresh them." -msgstr "" - -#: ../../library/nntplib.rst:349 -msgid "*group_pattern* was added." -msgstr "新增 *group_pattern*。" - -#: ../../library/nntplib.rst:355 -msgid "" -"Send a ``LIST NEWSGROUPS`` command, where *grouppattern* is a wildmat string " -"as specified in :rfc:`3977` (it's essentially the same as DOS or UNIX shell " -"wildcard strings). Return a pair ``(response, descriptions)``, where " -"*descriptions* is a dictionary mapping group names to textual descriptions." -msgstr "" - -#: ../../library/nntplib.rst:369 -msgid "" -"Get a description for a single group *group*. If more than one group " -"matches (if 'group' is a real wildmat string), return the first match. If " -"no group matches, return an empty string." -msgstr "" - -#: ../../library/nntplib.rst:373 -msgid "" -"This elides the response code from the server. If the response code is " -"needed, use :meth:`descriptions`." -msgstr "" - -#: ../../library/nntplib.rst:379 -msgid "" -"Send a ``GROUP`` command, where *name* is the group name. The group is " -"selected as the current group, if it exists. Return a tuple ``(response, " -"count, first, last, name)`` where *count* is the (estimated) number of " -"articles in the group, *first* is the first article number in the group, " -"*last* is the last article number in the group, and *name* is the group name." -msgstr "" - -#: ../../library/nntplib.rst:389 -msgid "" -"Send an ``OVER`` command, or an ``XOVER`` command on legacy servers. " -"*message_spec* can be either a string representing a message id, or a " -"``(first, last)`` tuple of numbers indicating a range of articles in the " -"current group, or a ``(first, None)`` tuple indicating a range of articles " -"starting from *first* to the last article in the current group, or :const:" -"`None` to select the current article in the current group." -msgstr "" - -#: ../../library/nntplib.rst:396 -msgid "" -"Return a pair ``(response, overviews)``. *overviews* is a list of " -"``(article_number, overview)`` tuples, one for each article selected by " -"*message_spec*. Each *overview* is a dictionary with the same number of " -"items, but this number depends on the server. These items are either " -"message headers (the key is then the lower-cased header name) or metadata " -"items (the key is then the metadata name prepended with ``\":\"``). The " -"following items are guaranteed to be present by the NNTP specification:" -msgstr "" - -#: ../../library/nntplib.rst:404 -msgid "" -"the ``subject``, ``from``, ``date``, ``message-id`` and ``references`` " -"headers" -msgstr "" - -#: ../../library/nntplib.rst:406 -msgid "" -"the ``:bytes`` metadata: the number of bytes in the entire raw article " -"(including headers and body)" -msgstr "" - -#: ../../library/nntplib.rst:408 -msgid "the ``:lines`` metadata: the number of lines in the article body" -msgstr "" - -#: ../../library/nntplib.rst:410 -msgid "" -"The value of each item is either a string, or :const:`None` if not present." -msgstr "" - -#: ../../library/nntplib.rst:412 -msgid "" -"It is advisable to use the :func:`decode_header` function on header values " -"when they may contain non-ASCII characters::" -msgstr "" - -#: ../../library/nntplib.rst:415 -msgid "" -">>> _, _, first, last, _ = s.group('gmane.comp.python.devel')\n" -">>> resp, overviews = s.over((last, last))\n" -">>> art_num, over = overviews[0]\n" -">>> art_num\n" -"117216\n" -">>> list(over.keys())\n" -"['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', " -"'subject']\n" -">>> over['from']\n" -"'=?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= '\n" -">>> nntplib.decode_header(over['from'])\n" -"'\"Martin v. Löwis\" '" -msgstr "" -">>> _, _, first, last, _ = s.group('gmane.comp.python.devel')\n" -">>> resp, overviews = s.over((last, last))\n" -">>> art_num, over = overviews[0]\n" -">>> art_num\n" -"117216\n" -">>> list(over.keys())\n" -"['xref', 'from', ':lines', ':bytes', 'references', 'date', 'message-id', " -"'subject']\n" -">>> over['from']\n" -"'=?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= '\n" -">>> nntplib.decode_header(over['from'])\n" -"'\"Martin v. Löwis\" '" - -#: ../../library/nntplib.rst:432 -msgid "" -"Send a ``HELP`` command. Return a pair ``(response, list)`` where *list* is " -"a list of help strings." -msgstr "" - -#: ../../library/nntplib.rst:438 -msgid "" -"Send a ``STAT`` command, where *message_spec* is either a message id " -"(enclosed in ``'<'`` and ``'>'``) or an article number in the current group. " -"If *message_spec* is omitted or :const:`None`, the current article in the " -"current group is considered. Return a triple ``(response, number, id)`` " -"where *number* is the article number and *id* is the message id." -msgstr "" - -#: ../../library/nntplib.rst:452 -msgid "Send a ``NEXT`` command. Return as for :meth:`.stat`." -msgstr "" - -#: ../../library/nntplib.rst:457 -msgid "Send a ``LAST`` command. Return as for :meth:`.stat`." -msgstr "" - -#: ../../library/nntplib.rst:462 -msgid "" -"Send an ``ARTICLE`` command, where *message_spec* has the same meaning as " -"for :meth:`.stat`. Return a tuple ``(response, info)`` where *info* is a :" -"class:`~collections.namedtuple` with three attributes *number*, *message_id* " -"and *lines* (in that order). *number* is the article number in the group " -"(or 0 if the information is not available), *message_id* the message id as a " -"string, and *lines* a list of lines (without terminating newlines) " -"comprising the raw message including headers and body." -msgstr "" - -#: ../../library/nntplib.rst:487 -msgid "" -"Same as :meth:`article`, but sends a ``HEAD`` command. The *lines* returned " -"(or written to *file*) will only contain the message headers, not the body." -msgstr "" - -#: ../../library/nntplib.rst:494 -msgid "" -"Same as :meth:`article`, but sends a ``BODY`` command. The *lines* returned " -"(or written to *file*) will only contain the message body, not the headers." -msgstr "" - -#: ../../library/nntplib.rst:501 -msgid "" -"Post an article using the ``POST`` command. The *data* argument is either " -"a :term:`file object` opened for binary reading, or any iterable of bytes " -"objects (representing raw lines of the article to be posted). It should " -"represent a well-formed news article, including the required headers. The :" -"meth:`post` method automatically escapes lines beginning with ``.`` and " -"appends the termination line." -msgstr "" - -#: ../../library/nntplib.rst:508 -msgid "" -"If the method succeeds, the server's response is returned. If the server " -"refuses posting, a :class:`NNTPReplyError` is raised." -msgstr "" - -#: ../../library/nntplib.rst:514 -msgid "" -"Send an ``IHAVE`` command. *message_id* is the id of the message to send to " -"the server (enclosed in ``'<'`` and ``'>'``). The *data* parameter and the " -"return value are the same as for :meth:`post`." -msgstr "" - -#: ../../library/nntplib.rst:521 -msgid "" -"Return a pair ``(response, date)``. *date* is a :class:`~datetime.datetime` " -"object containing the current date and time of the server." -msgstr "" - -#: ../../library/nntplib.rst:527 -msgid "Send a ``SLAVE`` command. Return the server's *response*." -msgstr "" - -#: ../../library/nntplib.rst:532 -msgid "" -"Set the instance's debugging level. This controls the amount of debugging " -"output printed. The default, ``0``, produces no debugging output. A value " -"of ``1`` produces a moderate amount of debugging output, generally a single " -"line per request or response. A value of ``2`` or higher produces the " -"maximum amount of debugging output, logging each line sent and received on " -"the connection (including message text)." -msgstr "" - -#: ../../library/nntplib.rst:540 -msgid "" -"The following are optional NNTP extensions defined in :rfc:`2980`. Some of " -"them have been superseded by newer commands in :rfc:`3977`." -msgstr "" - -#: ../../library/nntplib.rst:546 -msgid "" -"Send an ``XHDR`` command. The *hdr* argument is a header keyword, e.g. " -"``'subject'``. The *str* argument should have the form ``'first-last'`` " -"where *first* and *last* are the first and last article numbers to search. " -"Return a pair ``(response, list)``, where *list* is a list of pairs ``(id, " -"text)``, where *id* is an article number (as a string) and *text* is the " -"text of the requested header for that article. If the *file* parameter is " -"supplied, then the output of the ``XHDR`` command is stored in a file. If " -"*file* is a string, then the method will open a file with that name, write " -"to it then close it. If *file* is a :term:`file object`, then it will start " -"calling :meth:`write` on it to store the lines of the command output. If " -"*file* is supplied, then the returned *list* is an empty list." -msgstr "" - -#: ../../library/nntplib.rst:561 -msgid "" -"Send an ``XOVER`` command. *start* and *end* are article numbers delimiting " -"the range of articles to select. The return value is the same of for :meth:" -"`over`. It is recommended to use :meth:`over` instead, since it will " -"automatically use the newer ``OVER`` command if available." -msgstr "" - -#: ../../library/nntplib.rst:569 -msgid "Utility functions" -msgstr "" - -#: ../../library/nntplib.rst:571 -msgid "The module also defines the following utility function:" -msgstr "" - -#: ../../library/nntplib.rst:576 -msgid "" -"Decode a header value, un-escaping any escaped non-ASCII characters. " -"*header_str* must be a :class:`str` object. The unescaped value is " -"returned. Using this function is recommended to display some headers in a " -"human readable form::" -msgstr "" - -#: ../../library/nntplib.rst:581 -msgid "" -">>> decode_header(\"Some subject\")\n" -"'Some subject'\n" -">>> decode_header(\"=?ISO-8859-15?Q?D=E9buter_en_Python?=\")\n" -"'Débuter en Python'\n" -">>> decode_header(\"Re: =?UTF-8?B?cHJvYmzDqG1lIGRlIG1hdHJpY2U=?=\")\n" -"'Re: problème de matrice'" -msgstr "" -">>> decode_header(\"Some subject\")\n" -"'Some subject'\n" -">>> decode_header(\"=?ISO-8859-15?Q?D=E9buter_en_Python?=\")\n" -"'Débuter en Python'\n" -">>> decode_header(\"Re: =?UTF-8?B?cHJvYmzDqG1lIGRlIG1hdHJpY2U=?=\")\n" -"'Re: problème de matrice'" - -#: ../../library/nntplib.rst:10 -msgid "NNTP" -msgstr "NNTP" - -#: ../../library/nntplib.rst:10 -msgid "protocol" -msgstr "protocol(協定)" - -#: ../../library/nntplib.rst:10 -msgid "Network News Transfer Protocol" -msgstr "Network News Transfer Protocol(網路新聞傳輸協定)" diff --git a/library/numbers.po b/library/numbers.po index a02472878e..221858c2e6 100644 --- a/library/numbers.po +++ b/library/numbers.po @@ -6,7 +6,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-11-16 04:57+0800\n" diff --git a/library/numeric.po b/library/numeric.po index 85a8f226d0..064f8e0530 100644 --- a/library/numeric.po +++ b/library/numeric.po @@ -6,7 +6,7 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" @@ -32,7 +32,11 @@ msgid "" "mod:`decimal` module supports exact representations of decimal numbers, " "using arbitrary precision arithmetic." msgstr "" +"本章所描述的模組提供了數值和與數學相關的函式和資料型別。:mod:`numbers` 模組定" +"義了數值型別的抽象階層結構。:mod:`math` 和 :mod:`cmath` 模組包含了用於浮點數" +"和複數的各種數學函式。:mod:`decimal` 模組支援對十進位數字的精確表示以及任意精" +"度的算術運算。" #: ../../library/numeric.rst:15 msgid "The following modules are documented in this chapter:" -msgstr "" +msgstr "本章節包含下列的模組:" diff --git a/library/operator.po b/library/operator.po index fd491feb8e..3df309831a 100644 --- a/library/operator.po +++ b/library/operator.po @@ -7,7 +7,7 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2023-02-18 14:49+0800\n" diff --git a/library/optparse.po b/library/optparse.po index f0154d0c34..7f39b49f93 100644 --- a/library/optparse.po +++ b/library/optparse.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,11 +28,11 @@ msgstr "**原始碼:**\\ :source:`Lib/optparse.py`" #: ../../library/optparse.rst:13 msgid "" -"The :mod:`optparse` module is deprecated and will not be developed further; " -"development will continue with the :mod:`argparse` module." +"The :mod:`optparse` module is :term:`soft deprecated` and will not be " +"developed further; development will continue with the :mod:`argparse` module." msgstr "" -#: ../../library/optparse.rst:19 +#: ../../library/optparse.rst:20 msgid "" ":mod:`optparse` is a more convenient, flexible, and powerful library for " "parsing command-line options than the old :mod:`getopt` module. :mod:" @@ -43,11 +43,11 @@ msgid "" "messages for you." msgstr "" -#: ../../library/optparse.rst:26 +#: ../../library/optparse.rst:27 msgid "Here's an example of using :mod:`optparse` in a simple script::" msgstr "" -#: ../../library/optparse.rst:28 +#: ../../library/optparse.rst:29 msgid "" "from optparse import OptionParser\n" "...\n" @@ -61,17 +61,17 @@ msgid "" "(options, args) = parser.parse_args()" msgstr "" -#: ../../library/optparse.rst:39 +#: ../../library/optparse.rst:40 msgid "" "With these few lines of code, users of your script can now do the \"usual " "thing\" on the command-line, for example::" msgstr "" -#: ../../library/optparse.rst:42 +#: ../../library/optparse.rst:43 msgid " --file=outfile -q" msgstr "" -#: ../../library/optparse.rst:44 +#: ../../library/optparse.rst:45 msgid "" "As it parses the command line, :mod:`optparse` sets attributes of the " "``options`` object returned by :meth:`~OptionParser.parse_args` based on " @@ -84,7 +84,7 @@ msgid "" "the above example::" msgstr "" -#: ../../library/optparse.rst:53 +#: ../../library/optparse.rst:54 msgid "" " -f outfile --quiet\n" " --quiet --file outfile\n" @@ -92,22 +92,22 @@ msgid "" " -qfoutfile" msgstr "" -#: ../../library/optparse.rst:58 +#: ../../library/optparse.rst:59 msgid "Additionally, users can run one of the following ::" msgstr "" -#: ../../library/optparse.rst:60 +#: ../../library/optparse.rst:61 msgid "" " -h\n" " --help" msgstr "" -#: ../../library/optparse.rst:63 +#: ../../library/optparse.rst:64 msgid "" "and :mod:`optparse` will print out a brief summary of your script's options:" msgstr "" -#: ../../library/optparse.rst:65 +#: ../../library/optparse.rst:66 msgid "" "Usage: [options]\n" "\n" @@ -117,17 +117,17 @@ msgid "" " -q, --quiet don't print status messages to stdout" msgstr "" -#: ../../library/optparse.rst:74 +#: ../../library/optparse.rst:75 msgid "" "where the value of *yourscript* is determined at runtime (normally from " "``sys.argv[0]``)." msgstr "" -#: ../../library/optparse.rst:81 +#: ../../library/optparse.rst:82 msgid "Background" msgstr "背景" -#: ../../library/optparse.rst:83 +#: ../../library/optparse.rst:84 msgid "" ":mod:`optparse` was explicitly designed to encourage the creation of " "programs with straightforward, conventional command-line interfaces. To " @@ -136,15 +136,15 @@ msgid "" "conventions, read this section to acquaint yourself with them." msgstr "" -#: ../../library/optparse.rst:93 +#: ../../library/optparse.rst:94 msgid "Terminology" msgstr "術語" -#: ../../library/optparse.rst:95 +#: ../../library/optparse.rst:96 msgid "argument" msgstr "" -#: ../../library/optparse.rst:96 +#: ../../library/optparse.rst:97 msgid "" "a string entered on the command-line, and passed by the shell to ``execl()`` " "or ``execv()``. In Python, arguments are elements of ``sys.argv[1:]`` " @@ -152,7 +152,7 @@ msgid "" "also use the term \"word\"." msgstr "" -#: ../../library/optparse.rst:101 +#: ../../library/optparse.rst:102 msgid "" "It is occasionally desirable to substitute an argument list other than ``sys." "argv[1:]``, so you should read \"argument\" as \"an element of ``sys." @@ -160,11 +160,11 @@ msgid "" "argv[1:]``\"." msgstr "" -#: ../../library/optparse.rst:106 +#: ../../library/optparse.rst:107 msgid "option" msgstr "" -#: ../../library/optparse.rst:107 +#: ../../library/optparse.rst:108 msgid "" "an argument used to supply extra information to guide or customize the " "execution of a program. There are many different syntaxes for options; the " @@ -176,36 +176,36 @@ msgid "" "option syntaxes provided by :mod:`optparse`." msgstr "" -#: ../../library/optparse.rst:116 +#: ../../library/optparse.rst:117 msgid "Some other option syntaxes that the world has seen include:" msgstr "" -#: ../../library/optparse.rst:118 +#: ../../library/optparse.rst:119 msgid "" "a hyphen followed by a few letters, e.g. ``-pf`` (this is *not* the same as " "multiple options merged into a single argument)" msgstr "" -#: ../../library/optparse.rst:121 +#: ../../library/optparse.rst:122 msgid "" "a hyphen followed by a whole word, e.g. ``-file`` (this is technically " "equivalent to the previous syntax, but they aren't usually seen in the same " "program)" msgstr "" -#: ../../library/optparse.rst:125 +#: ../../library/optparse.rst:126 msgid "" "a plus sign followed by a single letter, or a few letters, or a word, e.g. " "``+f``, ``+rgb``" msgstr "" -#: ../../library/optparse.rst:128 +#: ../../library/optparse.rst:129 msgid "" "a slash followed by a letter, or a few letters, or a word, e.g. ``/f``, ``/" "file``" msgstr "" -#: ../../library/optparse.rst:131 +#: ../../library/optparse.rst:132 msgid "" "These option syntaxes are not supported by :mod:`optparse`, and they never " "will be. This is deliberate: the first three are non-standard on any " @@ -213,11 +213,11 @@ msgid "" "Windows or certain legacy platforms (e.g. VMS, MS-DOS)." msgstr "" -#: ../../library/optparse.rst:136 +#: ../../library/optparse.rst:137 msgid "option argument" msgstr "" -#: ../../library/optparse.rst:137 +#: ../../library/optparse.rst:138 msgid "" "an argument that follows an option, is closely associated with that option, " "and is consumed from the argument list when that option is. With :mod:" @@ -225,23 +225,23 @@ msgid "" "option:" msgstr "" -#: ../../library/optparse.rst:142 +#: ../../library/optparse.rst:143 msgid "" "-f foo\n" "--file foo" msgstr "" -#: ../../library/optparse.rst:147 +#: ../../library/optparse.rst:148 msgid "or included in the same argument:" msgstr "" -#: ../../library/optparse.rst:149 +#: ../../library/optparse.rst:150 msgid "" "-ffoo\n" "--file=foo" msgstr "" -#: ../../library/optparse.rst:154 +#: ../../library/optparse.rst:155 msgid "" "Typically, a given option either takes an argument or it doesn't. Lots of " "people want an \"optional option arguments\" feature, meaning that some " @@ -252,22 +252,22 @@ msgid "" "support this feature." msgstr "" -#: ../../library/optparse.rst:162 +#: ../../library/optparse.rst:163 msgid "positional argument" msgstr "" -#: ../../library/optparse.rst:163 +#: ../../library/optparse.rst:164 msgid "" "something leftover in the argument list after options have been parsed, i.e. " "after options and their arguments have been parsed and removed from the " "argument list." msgstr "" -#: ../../library/optparse.rst:167 +#: ../../library/optparse.rst:168 msgid "required option" msgstr "" -#: ../../library/optparse.rst:168 +#: ../../library/optparse.rst:169 msgid "" "an option that must be supplied on the command-line; note that the phrase " "\"required option\" is self-contradictory in English. :mod:`optparse` " @@ -275,26 +275,26 @@ msgid "" "much help at it either." msgstr "" -#: ../../library/optparse.rst:173 +#: ../../library/optparse.rst:174 msgid "For example, consider this hypothetical command-line::" msgstr "" -#: ../../library/optparse.rst:175 +#: ../../library/optparse.rst:176 msgid "prog -v --report report.txt foo bar" msgstr "" -#: ../../library/optparse.rst:177 +#: ../../library/optparse.rst:178 msgid "" "``-v`` and ``--report`` are both options. Assuming that ``--report`` takes " "one argument, ``report.txt`` is an option argument. ``foo`` and ``bar`` are " "positional arguments." msgstr "" -#: ../../library/optparse.rst:185 +#: ../../library/optparse.rst:186 msgid "What are options for?" msgstr "" -#: ../../library/optparse.rst:187 +#: ../../library/optparse.rst:188 msgid "" "Options are used to provide extra information to tune or customize the " "execution of a program. In case it wasn't clear, options are usually " @@ -306,7 +306,7 @@ msgid "" "interfaces.)" msgstr "" -#: ../../library/optparse.rst:195 +#: ../../library/optparse.rst:196 msgid "" "Lots of people want their programs to have \"required options\". Think " "about it. If it's required, then it's *not optional*! If there is a piece " @@ -314,7 +314,7 @@ msgid "" "successfully, that's what positional arguments are for." msgstr "" -#: ../../library/optparse.rst:200 +#: ../../library/optparse.rst:201 msgid "" "As an example of good command-line interface design, consider the humble " "``cp`` utility, for copying files. It doesn't make much sense to try to " @@ -323,13 +323,13 @@ msgid "" "useful syntax that does not require any options at all::" msgstr "" -#: ../../library/optparse.rst:206 +#: ../../library/optparse.rst:207 msgid "" "cp SOURCE DEST\n" "cp SOURCE ... DEST-DIR" msgstr "" -#: ../../library/optparse.rst:209 +#: ../../library/optparse.rst:210 msgid "" "You can get pretty far with just that. Most ``cp`` implementations provide " "a bunch of options to tweak exactly how the files are copied: you can " @@ -339,17 +339,17 @@ msgid "" "files to another directory." msgstr "" -#: ../../library/optparse.rst:220 +#: ../../library/optparse.rst:221 msgid "What are positional arguments for?" msgstr "" -#: ../../library/optparse.rst:222 +#: ../../library/optparse.rst:223 msgid "" "Positional arguments are for those pieces of information that your program " "absolutely, positively requires to run." msgstr "" -#: ../../library/optparse.rst:225 +#: ../../library/optparse.rst:226 msgid "" "A good user interface should have as few absolute requirements as possible. " "If your program requires 17 distinct pieces of information in order to run " @@ -360,7 +360,7 @@ msgid "" "most of them will simply give up." msgstr "" -#: ../../library/optparse.rst:233 +#: ../../library/optparse.rst:234 msgid "" "In short, try to minimize the amount of information that users are " "absolutely required to supply---use sensible defaults whenever possible. Of " @@ -373,65 +373,65 @@ msgid "" "make your code much harder to maintain." msgstr "" -#: ../../library/optparse.rst:246 +#: ../../library/optparse.rst:247 msgid "Tutorial" msgstr "教學" -#: ../../library/optparse.rst:248 +#: ../../library/optparse.rst:249 msgid "" "While :mod:`optparse` is quite flexible and powerful, it's also " "straightforward to use in most cases. This section covers the code patterns " "that are common to any :mod:`optparse`\\ -based program." msgstr "" -#: ../../library/optparse.rst:252 +#: ../../library/optparse.rst:253 msgid "" "First, you need to import the OptionParser class; then, early in the main " "program, create an OptionParser instance::" msgstr "" -#: ../../library/optparse.rst:255 +#: ../../library/optparse.rst:256 msgid "" "from optparse import OptionParser\n" "...\n" "parser = OptionParser()" msgstr "" -#: ../../library/optparse.rst:259 +#: ../../library/optparse.rst:260 msgid "Then you can start defining options. The basic syntax is::" msgstr "" -#: ../../library/optparse.rst:261 +#: ../../library/optparse.rst:262 msgid "" "parser.add_option(opt_str, ...,\n" " attr=value, ...)" msgstr "" -#: ../../library/optparse.rst:264 +#: ../../library/optparse.rst:265 msgid "" "Each option has one or more option strings, such as ``-f`` or ``--file``, " "and several option attributes that tell :mod:`optparse` what to expect and " "what to do when it encounters that option on the command line." msgstr "" -#: ../../library/optparse.rst:268 +#: ../../library/optparse.rst:269 msgid "" "Typically, each option will have one short option string and one long option " "string, e.g.::" msgstr "" -#: ../../library/optparse.rst:271 +#: ../../library/optparse.rst:272 msgid "parser.add_option(\"-f\", \"--file\", ...)" msgstr "" -#: ../../library/optparse.rst:273 +#: ../../library/optparse.rst:274 msgid "" "You're free to define as many short option strings and as many long option " "strings as you like (including zero), as long as there is at least one " "option string overall." msgstr "" -#: ../../library/optparse.rst:277 +#: ../../library/optparse.rst:278 msgid "" "The option strings passed to :meth:`OptionParser.add_option` are effectively " "labels for the option defined by that call. For brevity, we will frequently " @@ -439,28 +439,28 @@ msgid "" "`optparse` encounters *option strings* and looks up options from them." msgstr "" -#: ../../library/optparse.rst:283 +#: ../../library/optparse.rst:284 msgid "" "Once all of your options are defined, instruct :mod:`optparse` to parse your " "program's command line::" msgstr "" -#: ../../library/optparse.rst:286 +#: ../../library/optparse.rst:287 msgid "(options, args) = parser.parse_args()" msgstr "" -#: ../../library/optparse.rst:288 +#: ../../library/optparse.rst:289 msgid "" "(If you like, you can pass a custom argument list to :meth:`~OptionParser." "parse_args`, but that's rarely necessary: by default it uses ``sys." "argv[1:]``.)" msgstr "" -#: ../../library/optparse.rst:291 +#: ../../library/optparse.rst:292 msgid ":meth:`~OptionParser.parse_args` returns two values:" msgstr ":meth:`~OptionParser.parse_args` 回傳兩個值:" -#: ../../library/optparse.rst:293 +#: ../../library/optparse.rst:294 msgid "" "``options``, an object containing values for all of your options---e.g. if " "``--file`` takes a single string argument, then ``options.file`` will be the " @@ -468,12 +468,12 @@ msgid "" "option" msgstr "" -#: ../../library/optparse.rst:298 +#: ../../library/optparse.rst:299 msgid "" "``args``, the list of positional arguments leftover after parsing options" msgstr "" -#: ../../library/optparse.rst:300 +#: ../../library/optparse.rst:301 msgid "" "This tutorial section only covers the four most important option " "attributes: :attr:`~Option.action`, :attr:`~Option.type`, :attr:`~Option." @@ -481,11 +481,11 @@ msgid "" "action` is the most fundamental." msgstr "" -#: ../../library/optparse.rst:309 +#: ../../library/optparse.rst:310 msgid "Understanding option actions" msgstr "" -#: ../../library/optparse.rst:311 +#: ../../library/optparse.rst:312 msgid "" "Actions tell :mod:`optparse` what to do when it encounters an option on the " "command line. There is a fixed set of actions hard-coded into :mod:" @@ -495,44 +495,44 @@ msgid "" "and store it in an attribute of ``options``." msgstr "" -#: ../../library/optparse.rst:318 +#: ../../library/optparse.rst:319 msgid "" "If you don't specify an option action, :mod:`optparse` defaults to ``store``." msgstr "" -#: ../../library/optparse.rst:324 +#: ../../library/optparse.rst:325 msgid "The store action" msgstr "" -#: ../../library/optparse.rst:326 +#: ../../library/optparse.rst:327 msgid "" "The most common option action is ``store``, which tells :mod:`optparse` to " "take the next argument (or the remainder of the current argument), ensure " "that it is of the correct type, and store it to your chosen destination." msgstr "" -#: ../../library/optparse.rst:330 +#: ../../library/optparse.rst:331 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/optparse.rst:332 +#: ../../library/optparse.rst:333 msgid "" "parser.add_option(\"-f\", \"--file\",\n" " action=\"store\", type=\"string\", dest=\"filename\")" msgstr "" -#: ../../library/optparse.rst:335 +#: ../../library/optparse.rst:336 msgid "" "Now let's make up a fake command line and ask :mod:`optparse` to parse it::" msgstr "" -#: ../../library/optparse.rst:337 +#: ../../library/optparse.rst:338 msgid "" "args = [\"-f\", \"foo.txt\"]\n" "(options, args) = parser.parse_args(args)" msgstr "" -#: ../../library/optparse.rst:340 +#: ../../library/optparse.rst:341 msgid "" "When :mod:`optparse` sees the option string ``-f``, it consumes the next " "argument, ``foo.txt``, and stores it in ``options.filename``. So, after " @@ -540,51 +540,51 @@ msgid "" "``\"foo.txt\"``." msgstr "" -#: ../../library/optparse.rst:344 +#: ../../library/optparse.rst:345 msgid "" "Some other option types supported by :mod:`optparse` are ``int`` and " "``float``. Here's an option that expects an integer argument::" msgstr "" -#: ../../library/optparse.rst:347 +#: ../../library/optparse.rst:348 msgid "parser.add_option(\"-n\", type=\"int\", dest=\"num\")" msgstr "" -#: ../../library/optparse.rst:349 +#: ../../library/optparse.rst:350 msgid "" "Note that this option has no long option string, which is perfectly " "acceptable. Also, there's no explicit action, since the default is ``store``." msgstr "" -#: ../../library/optparse.rst:352 +#: ../../library/optparse.rst:353 msgid "" "Let's parse another fake command-line. This time, we'll jam the option " "argument right up against the option: since ``-n42`` (one argument) is " "equivalent to ``-n 42`` (two arguments), the code ::" msgstr "" -#: ../../library/optparse.rst:356 +#: ../../library/optparse.rst:357 msgid "" "(options, args) = parser.parse_args([\"-n42\"])\n" "print(options.num)" msgstr "" -#: ../../library/optparse.rst:359 +#: ../../library/optparse.rst:360 msgid "will print ``42``." msgstr "" -#: ../../library/optparse.rst:361 +#: ../../library/optparse.rst:362 msgid "" "If you don't specify a type, :mod:`optparse` assumes ``string``. Combined " "with the fact that the default action is ``store``, that means our first " "example can be a lot shorter::" msgstr "" -#: ../../library/optparse.rst:365 +#: ../../library/optparse.rst:366 msgid "parser.add_option(\"-f\", \"--file\", dest=\"filename\")" msgstr "" -#: ../../library/optparse.rst:367 +#: ../../library/optparse.rst:368 msgid "" "If you don't supply a destination, :mod:`optparse` figures out a sensible " "default from the option strings: if the first long option string is ``--foo-" @@ -593,17 +593,17 @@ msgid "" "default destination for ``-f`` is ``f``." msgstr "" -#: ../../library/optparse.rst:373 +#: ../../library/optparse.rst:374 msgid "" ":mod:`optparse` also includes the built-in ``complex`` type. Adding types " "is covered in section :ref:`optparse-extending-optparse`." msgstr "" -#: ../../library/optparse.rst:380 +#: ../../library/optparse.rst:381 msgid "Handling boolean (flag) options" msgstr "" -#: ../../library/optparse.rst:382 +#: ../../library/optparse.rst:383 msgid "" "Flag options---set a variable to true or false when a particular option is " "seen---are quite common. :mod:`optparse` supports them with two separate " @@ -611,77 +611,77 @@ msgid "" "``verbose`` flag that is turned on with ``-v`` and off with ``-q``::" msgstr "" -#: ../../library/optparse.rst:387 +#: ../../library/optparse.rst:388 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\")\n" "parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\")" msgstr "" -#: ../../library/optparse.rst:390 +#: ../../library/optparse.rst:391 msgid "" "Here we have two different options with the same destination, which is " "perfectly OK. (It just means you have to be a bit careful when setting " "default values---see below.)" msgstr "" -#: ../../library/optparse.rst:394 +#: ../../library/optparse.rst:395 msgid "" "When :mod:`optparse` encounters ``-v`` on the command line, it sets " "``options.verbose`` to ``True``; when it encounters ``-q``, ``options." "verbose`` is set to ``False``." msgstr "" -#: ../../library/optparse.rst:402 +#: ../../library/optparse.rst:403 msgid "Other actions" msgstr "" -#: ../../library/optparse.rst:404 +#: ../../library/optparse.rst:405 msgid "Some other actions supported by :mod:`optparse` are:" msgstr "" -#: ../../library/optparse.rst:406 ../../library/optparse.rst:928 +#: ../../library/optparse.rst:407 ../../library/optparse.rst:929 msgid "``\"store_const\"``" msgstr "``\"store_const\"``" -#: ../../library/optparse.rst:407 ../../library/optparse.rst:929 +#: ../../library/optparse.rst:408 ../../library/optparse.rst:930 msgid "store a constant value, pre-set via :attr:`Option.const`" msgstr "" -#: ../../library/optparse.rst:409 ../../library/optparse.rst:937 +#: ../../library/optparse.rst:410 ../../library/optparse.rst:938 msgid "``\"append\"``" msgstr "``\"append\"``" -#: ../../library/optparse.rst:410 ../../library/optparse.rst:938 +#: ../../library/optparse.rst:411 ../../library/optparse.rst:939 msgid "append this option's argument to a list" msgstr "" -#: ../../library/optparse.rst:412 ../../library/optparse.rst:943 +#: ../../library/optparse.rst:413 ../../library/optparse.rst:944 msgid "``\"count\"``" msgstr "``\"count\"``" -#: ../../library/optparse.rst:413 ../../library/optparse.rst:944 +#: ../../library/optparse.rst:414 ../../library/optparse.rst:945 msgid "increment a counter by one" msgstr "" -#: ../../library/optparse.rst:415 ../../library/optparse.rst:946 +#: ../../library/optparse.rst:416 ../../library/optparse.rst:947 msgid "``\"callback\"``" msgstr "``\"callback\"``" -#: ../../library/optparse.rst:416 ../../library/optparse.rst:947 +#: ../../library/optparse.rst:417 ../../library/optparse.rst:948 msgid "call a specified function" msgstr "" -#: ../../library/optparse.rst:418 +#: ../../library/optparse.rst:419 msgid "" "These are covered in section :ref:`optparse-reference-guide`, and section :" "ref:`optparse-option-callbacks`." msgstr "" -#: ../../library/optparse.rst:425 +#: ../../library/optparse.rst:426 msgid "Default values" msgstr "" -#: ../../library/optparse.rst:427 +#: ../../library/optparse.rst:428 msgid "" "All of the above examples involve setting some variable (the " "\"destination\") when certain command-line options are seen. What happens " @@ -691,38 +691,38 @@ msgid "" "destination, which is assigned before the command line is parsed." msgstr "" -#: ../../library/optparse.rst:434 +#: ../../library/optparse.rst:435 msgid "" "First, consider the verbose/quiet example. If we want :mod:`optparse` to " "set ``verbose`` to ``True`` unless ``-q`` is seen, then we can do this::" msgstr "" -#: ../../library/optparse.rst:437 +#: ../../library/optparse.rst:438 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\", " "default=True)\n" "parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\")" msgstr "" -#: ../../library/optparse.rst:440 +#: ../../library/optparse.rst:441 msgid "" "Since default values apply to the *destination* rather than to any " "particular option, and these two options happen to have the same " "destination, this is exactly equivalent::" msgstr "" -#: ../../library/optparse.rst:444 +#: ../../library/optparse.rst:445 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\")\n" "parser.add_option(\"-q\", action=\"store_false\", dest=\"verbose\", " "default=True)" msgstr "" -#: ../../library/optparse.rst:447 +#: ../../library/optparse.rst:448 msgid "Consider this::" msgstr "" -#: ../../library/optparse.rst:449 +#: ../../library/optparse.rst:450 msgid "" "parser.add_option(\"-v\", action=\"store_true\", dest=\"verbose\", " "default=False)\n" @@ -730,38 +730,38 @@ msgid "" "default=True)" msgstr "" -#: ../../library/optparse.rst:452 +#: ../../library/optparse.rst:453 msgid "" "Again, the default value for ``verbose`` will be ``True``: the last default " "value supplied for any particular destination is the one that counts." msgstr "" -#: ../../library/optparse.rst:455 +#: ../../library/optparse.rst:456 msgid "" "A clearer way to specify default values is the :meth:`set_defaults` method " "of OptionParser, which you can call at any time before calling :meth:" "`~OptionParser.parse_args`::" msgstr "" -#: ../../library/optparse.rst:459 +#: ../../library/optparse.rst:460 msgid "" "parser.set_defaults(verbose=True)\n" "parser.add_option(...)\n" "(options, args) = parser.parse_args()" msgstr "" -#: ../../library/optparse.rst:463 +#: ../../library/optparse.rst:464 msgid "" "As before, the last value specified for a given option destination is the " "one that counts. For clarity, try to use one method or the other of setting " "default values, not both." msgstr "" -#: ../../library/optparse.rst:471 +#: ../../library/optparse.rst:472 msgid "Generating help" msgstr "" -#: ../../library/optparse.rst:473 +#: ../../library/optparse.rst:474 msgid "" ":mod:`optparse`'s ability to generate help and usage text automatically is " "useful for creating user-friendly command-line interfaces. All you have to " @@ -770,7 +770,7 @@ msgid "" "populated with user-friendly (documented) options::" msgstr "" -#: ../../library/optparse.rst:479 +#: ../../library/optparse.rst:480 msgid "" "usage = \"usage: %prog [options] arg1 arg2\"\n" "parser = OptionParser(usage=usage)\n" @@ -788,14 +788,14 @@ msgid "" " \"or expert [default: %default]\")" msgstr "" -#: ../../library/optparse.rst:494 +#: ../../library/optparse.rst:495 msgid "" "If :mod:`optparse` encounters either ``-h`` or ``--help`` on the command-" "line, or if you just call :meth:`parser.print_help`, it prints the following " "to standard output:" msgstr "" -#: ../../library/optparse.rst:498 +#: ../../library/optparse.rst:499 msgid "" "Usage: [options] arg1 arg2\n" "\n" @@ -809,58 +809,58 @@ msgid "" " expert [default: intermediate]" msgstr "" -#: ../../library/optparse.rst:511 +#: ../../library/optparse.rst:512 msgid "" "(If the help output is triggered by a help option, :mod:`optparse` exits " "after printing the help text.)" msgstr "" -#: ../../library/optparse.rst:514 +#: ../../library/optparse.rst:515 msgid "" "There's a lot going on here to help :mod:`optparse` generate the best " "possible help message:" msgstr "" -#: ../../library/optparse.rst:517 +#: ../../library/optparse.rst:518 msgid "the script defines its own usage message::" msgstr "" -#: ../../library/optparse.rst:519 +#: ../../library/optparse.rst:520 msgid "usage = \"usage: %prog [options] arg1 arg2\"" msgstr "" -#: ../../library/optparse.rst:521 +#: ../../library/optparse.rst:522 msgid "" ":mod:`optparse` expands ``%prog`` in the usage string to the name of the " "current program, i.e. ``os.path.basename(sys.argv[0])``. The expanded " "string is then printed before the detailed option help." msgstr "" -#: ../../library/optparse.rst:525 +#: ../../library/optparse.rst:526 msgid "" "If you don't supply a usage string, :mod:`optparse` uses a bland but " "sensible default: ``\"Usage: %prog [options]\"``, which is fine if your " "script doesn't take any positional arguments." msgstr "" -#: ../../library/optparse.rst:529 +#: ../../library/optparse.rst:530 msgid "" "every option defines a help string, and doesn't worry about line-wrapping---" "\\ :mod:`optparse` takes care of wrapping lines and making the help output " "look good." msgstr "" -#: ../../library/optparse.rst:533 +#: ../../library/optparse.rst:534 msgid "" "options that take a value indicate this fact in their automatically " "generated help message, e.g. for the \"mode\" option::" msgstr "" -#: ../../library/optparse.rst:536 +#: ../../library/optparse.rst:537 msgid "-m MODE, --mode=MODE" msgstr "" -#: ../../library/optparse.rst:538 +#: ../../library/optparse.rst:539 msgid "" "Here, \"MODE\" is called the meta-variable: it stands for the argument that " "the user is expected to supply to ``-m``/``--mode``. By default, :mod:" @@ -870,11 +870,11 @@ msgid "" "this automatically generated option description::" msgstr "" -#: ../../library/optparse.rst:545 +#: ../../library/optparse.rst:546 msgid "-f FILE, --filename=FILE" msgstr "" -#: ../../library/optparse.rst:547 +#: ../../library/optparse.rst:548 msgid "" "This is important for more than just saving space, though: the manually " "written help text uses the meta-variable ``FILE`` to clue the user in that " @@ -884,7 +884,7 @@ msgid "" "users." msgstr "" -#: ../../library/optparse.rst:553 +#: ../../library/optparse.rst:554 msgid "" "options that have a default value can include ``%default`` in the help " "string---\\ :mod:`optparse` will replace it with :func:`str` of the option's " @@ -892,58 +892,58 @@ msgid "" "``None``), ``%default`` expands to ``none``." msgstr "" -#: ../../library/optparse.rst:559 +#: ../../library/optparse.rst:560 msgid "Grouping Options" msgstr "" -#: ../../library/optparse.rst:561 +#: ../../library/optparse.rst:562 msgid "" "When dealing with many options, it is convenient to group these options for " "better help output. An :class:`OptionParser` can contain several option " "groups, each of which can contain several options." msgstr "" -#: ../../library/optparse.rst:565 +#: ../../library/optparse.rst:566 msgid "An option group is obtained using the class :class:`OptionGroup`:" msgstr "" -#: ../../library/optparse.rst:569 ../../library/optparse.rst:1640 +#: ../../library/optparse.rst:570 ../../library/optparse.rst:1641 msgid "where" msgstr "" -#: ../../library/optparse.rst:571 +#: ../../library/optparse.rst:572 msgid "" "parser is the :class:`OptionParser` instance the group will be inserted in to" msgstr "" -#: ../../library/optparse.rst:573 +#: ../../library/optparse.rst:574 msgid "title is the group title" msgstr "" -#: ../../library/optparse.rst:574 +#: ../../library/optparse.rst:575 msgid "description, optional, is a long description of the group" msgstr "" -#: ../../library/optparse.rst:576 +#: ../../library/optparse.rst:577 msgid "" ":class:`OptionGroup` inherits from :class:`OptionContainer` (like :class:" "`OptionParser`) and so the :meth:`add_option` method can be used to add an " "option to the group." msgstr "" -#: ../../library/optparse.rst:580 +#: ../../library/optparse.rst:581 msgid "" "Once all the options are declared, using the :class:`OptionParser` method :" "meth:`add_option_group` the group is added to the previously defined parser." msgstr "" -#: ../../library/optparse.rst:583 +#: ../../library/optparse.rst:584 msgid "" "Continuing with the parser defined in the previous section, adding an :class:" "`OptionGroup` to a parser is easy::" msgstr "" -#: ../../library/optparse.rst:586 +#: ../../library/optparse.rst:587 msgid "" "group = OptionGroup(parser, \"Dangerous Options\",\n" " \"Caution: use these options at your own risk. \"\n" @@ -952,11 +952,11 @@ msgid "" "parser.add_option_group(group)" msgstr "" -#: ../../library/optparse.rst:592 +#: ../../library/optparse.rst:593 msgid "This would result in the following help output:" msgstr "" -#: ../../library/optparse.rst:594 +#: ../../library/optparse.rst:595 msgid "" "Usage: [options] arg1 arg2\n" "\n" @@ -976,13 +976,13 @@ msgid "" " -g Group option." msgstr "" -#: ../../library/optparse.rst:613 +#: ../../library/optparse.rst:614 msgid "" "A bit more complete example might involve using more than one group: still " "extending the previous example::" msgstr "" -#: ../../library/optparse.rst:616 +#: ../../library/optparse.rst:617 msgid "" "group = OptionGroup(parser, \"Dangerous Options\",\n" " \"Caution: use these options at your own risk. \"\n" @@ -1000,11 +1000,11 @@ msgid "" "parser.add_option_group(group)" msgstr "" -#: ../../library/optparse.rst:630 +#: ../../library/optparse.rst:631 msgid "that results in the following output:" msgstr "" -#: ../../library/optparse.rst:632 +#: ../../library/optparse.rst:633 msgid "" "Usage: [options] arg1 arg2\n" "\n" @@ -1029,35 +1029,35 @@ msgid "" " -e Print every action done" msgstr "" -#: ../../library/optparse.rst:656 +#: ../../library/optparse.rst:657 msgid "" "Another interesting method, in particular when working programmatically with " "option groups is:" msgstr "" -#: ../../library/optparse.rst:661 +#: ../../library/optparse.rst:662 msgid "" "Return the :class:`OptionGroup` to which the short or long option string " "*opt_str* (e.g. ``'-o'`` or ``'--option'``) belongs. If there's no such :" "class:`OptionGroup`, return ``None``." msgstr "" -#: ../../library/optparse.rst:668 +#: ../../library/optparse.rst:669 msgid "Printing a version string" msgstr "" -#: ../../library/optparse.rst:670 +#: ../../library/optparse.rst:671 msgid "" "Similar to the brief usage string, :mod:`optparse` can also print a version " "string for your program. You have to supply the string as the ``version`` " "argument to OptionParser::" msgstr "" -#: ../../library/optparse.rst:674 +#: ../../library/optparse.rst:675 msgid "parser = OptionParser(usage=\"%prog [-f] [-q]\", version=\"%prog 1.0\")" msgstr "" -#: ../../library/optparse.rst:676 +#: ../../library/optparse.rst:677 msgid "" "``%prog`` is expanded just like it is in ``usage``. Apart from that, " "``version`` can contain anything you like. When you supply it, :mod:" @@ -1066,23 +1066,23 @@ msgid "" "string (by replacing ``%prog``), prints it to stdout, and exits." msgstr "" -#: ../../library/optparse.rst:682 +#: ../../library/optparse.rst:683 msgid "For example, if your script is called ``/usr/bin/foo``:" msgstr "" -#: ../../library/optparse.rst:684 +#: ../../library/optparse.rst:685 msgid "" "$ /usr/bin/foo --version\n" "foo 1.0" msgstr "" -#: ../../library/optparse.rst:689 +#: ../../library/optparse.rst:690 msgid "" "The following two methods can be used to print and get the ``version`` " "string:" msgstr "" -#: ../../library/optparse.rst:693 +#: ../../library/optparse.rst:694 msgid "" "Print the version message for the current program (``self.version``) to " "*file* (default stdout). As with :meth:`print_usage`, any occurrence of " @@ -1090,17 +1090,17 @@ msgid "" "program. Does nothing if ``self.version`` is empty or undefined." msgstr "" -#: ../../library/optparse.rst:700 +#: ../../library/optparse.rst:701 msgid "" "Same as :meth:`print_version` but returns the version string instead of " "printing it." msgstr "" -#: ../../library/optparse.rst:707 +#: ../../library/optparse.rst:708 msgid "How :mod:`optparse` handles errors" msgstr "" -#: ../../library/optparse.rst:709 +#: ../../library/optparse.rst:710 msgid "" "There are two broad classes of errors that :mod:`optparse` has to worry " "about: programmer errors and user errors. Programmer errors are usually " @@ -1110,7 +1110,7 @@ msgid "" "OptionError` or :exc:`TypeError`) and let the program crash." msgstr "" -#: ../../library/optparse.rst:716 +#: ../../library/optparse.rst:717 msgid "" "Handling user errors is much more important, since they are guaranteed to " "happen no matter how stable your code is. :mod:`optparse` can automatically " @@ -1121,7 +1121,7 @@ msgid "" "error condition::" msgstr "" -#: ../../library/optparse.rst:724 +#: ../../library/optparse.rst:725 msgid "" "(options, args) = parser.parse_args()\n" "...\n" @@ -1129,20 +1129,20 @@ msgid "" " parser.error(\"options -a and -b are mutually exclusive\")" msgstr "" -#: ../../library/optparse.rst:729 +#: ../../library/optparse.rst:730 msgid "" "In either case, :mod:`optparse` handles the error the same way: it prints " "the program's usage message and an error message to standard error and exits " "with error status 2." msgstr "" -#: ../../library/optparse.rst:733 +#: ../../library/optparse.rst:734 msgid "" "Consider the first example above, where the user passes ``4x`` to an option " "that takes an integer:" msgstr "" -#: ../../library/optparse.rst:736 +#: ../../library/optparse.rst:737 msgid "" "$ /usr/bin/foo -n 4x\n" "Usage: foo [options]\n" @@ -1150,11 +1150,11 @@ msgid "" "foo: error: option -n: invalid integer value: '4x'" msgstr "" -#: ../../library/optparse.rst:743 +#: ../../library/optparse.rst:744 msgid "Or, where the user fails to pass a value at all:" msgstr "" -#: ../../library/optparse.rst:745 +#: ../../library/optparse.rst:746 msgid "" "$ /usr/bin/foo -n\n" "Usage: foo [options]\n" @@ -1162,29 +1162,29 @@ msgid "" "foo: error: -n option requires an argument" msgstr "" -#: ../../library/optparse.rst:752 +#: ../../library/optparse.rst:753 msgid "" ":mod:`optparse`\\ -generated error messages take care always to mention the " "option involved in the error; be sure to do the same when calling :func:" "`OptionParser.error` from your application code." msgstr "" -#: ../../library/optparse.rst:756 +#: ../../library/optparse.rst:757 msgid "" "If :mod:`optparse`'s default error-handling behaviour does not suit your " "needs, you'll need to subclass OptionParser and override its :meth:" "`~OptionParser.exit` and/or :meth:`~OptionParser.error` methods." msgstr "" -#: ../../library/optparse.rst:764 +#: ../../library/optparse.rst:765 msgid "Putting it all together" msgstr "" -#: ../../library/optparse.rst:766 +#: ../../library/optparse.rst:767 msgid "Here's what :mod:`optparse`\\ -based scripts usually look like::" msgstr "" -#: ../../library/optparse.rst:768 +#: ../../library/optparse.rst:769 msgid "" "from optparse import OptionParser\n" "...\n" @@ -1209,32 +1209,32 @@ msgid "" " main()" msgstr "" -#: ../../library/optparse.rst:794 +#: ../../library/optparse.rst:795 msgid "Reference Guide" msgstr "" -#: ../../library/optparse.rst:800 +#: ../../library/optparse.rst:801 msgid "Creating the parser" msgstr "" -#: ../../library/optparse.rst:802 +#: ../../library/optparse.rst:803 msgid "" "The first step in using :mod:`optparse` is to create an OptionParser " "instance." msgstr "" -#: ../../library/optparse.rst:806 +#: ../../library/optparse.rst:807 msgid "" "The OptionParser constructor has no required arguments, but a number of " "optional keyword arguments. You should always pass them as keyword " "arguments, i.e. do not rely on the order in which the arguments are declared." msgstr "" -#: ../../library/optparse.rst:810 +#: ../../library/optparse.rst:811 msgid "``usage`` (default: ``\"%prog [options]\"``)" msgstr "" -#: ../../library/optparse.rst:811 +#: ../../library/optparse.rst:812 msgid "" "The usage summary to print when your program is run incorrectly or with a " "help option. When :mod:`optparse` prints the usage string, it expands " @@ -1243,11 +1243,11 @@ msgid "" "value :const:`optparse.SUPPRESS_USAGE`." msgstr "" -#: ../../library/optparse.rst:817 +#: ../../library/optparse.rst:818 msgid "``option_list`` (default: ``[]``)" msgstr "" -#: ../../library/optparse.rst:818 +#: ../../library/optparse.rst:819 msgid "" "A list of Option objects to populate the parser with. The options in " "``option_list`` are added after any options in ``standard_option_list`` (a " @@ -1256,19 +1256,19 @@ msgid "" "the parser instead." msgstr "" -#: ../../library/optparse.rst:824 +#: ../../library/optparse.rst:825 msgid "``option_class`` (default: optparse.Option)" msgstr "" -#: ../../library/optparse.rst:825 +#: ../../library/optparse.rst:826 msgid "Class to use when adding options to the parser in :meth:`add_option`." msgstr "" -#: ../../library/optparse.rst:827 +#: ../../library/optparse.rst:828 msgid "``version`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:828 +#: ../../library/optparse.rst:829 msgid "" "A version string to print when the user supplies a version option. If you " "supply a true value for ``version``, :mod:`optparse` automatically adds a " @@ -1276,21 +1276,21 @@ msgid "" "``%prog`` is expanded the same as for ``usage``." msgstr "" -#: ../../library/optparse.rst:833 +#: ../../library/optparse.rst:834 msgid "``conflict_handler`` (default: ``\"error\"``)" msgstr "" -#: ../../library/optparse.rst:834 +#: ../../library/optparse.rst:835 msgid "" "Specifies what to do when options with conflicting option strings are added " "to the parser; see section :ref:`optparse-conflicts-between-options`." msgstr "" -#: ../../library/optparse.rst:838 +#: ../../library/optparse.rst:839 msgid "``description`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:839 +#: ../../library/optparse.rst:840 msgid "" "A paragraph of text giving a brief overview of your program. :mod:`optparse` " "reformats this paragraph to fit the current terminal width and prints it " @@ -1298,74 +1298,74 @@ msgid "" "options)." msgstr "" -#: ../../library/optparse.rst:844 +#: ../../library/optparse.rst:845 msgid "``formatter`` (default: a new :class:`IndentedHelpFormatter`)" msgstr "" -#: ../../library/optparse.rst:845 +#: ../../library/optparse.rst:846 msgid "" "An instance of optparse.HelpFormatter that will be used for printing help " "text. :mod:`optparse` provides two concrete classes for this purpose: " "IndentedHelpFormatter and TitledHelpFormatter." msgstr "" -#: ../../library/optparse.rst:849 +#: ../../library/optparse.rst:850 msgid "``add_help_option`` (default: ``True``)" msgstr "" -#: ../../library/optparse.rst:850 +#: ../../library/optparse.rst:851 msgid "" "If true, :mod:`optparse` will add a help option (with option strings ``-h`` " "and ``--help``) to the parser." msgstr "" -#: ../../library/optparse.rst:853 +#: ../../library/optparse.rst:854 msgid "``prog``" msgstr "``prog``" -#: ../../library/optparse.rst:854 +#: ../../library/optparse.rst:855 msgid "" "The string to use when expanding ``%prog`` in ``usage`` and ``version`` " "instead of ``os.path.basename(sys.argv[0])``." msgstr "" -#: ../../library/optparse.rst:857 +#: ../../library/optparse.rst:858 msgid "``epilog`` (default: ``None``)" msgstr "" -#: ../../library/optparse.rst:858 +#: ../../library/optparse.rst:859 msgid "A paragraph of help text to print after the option help." msgstr "" -#: ../../library/optparse.rst:863 +#: ../../library/optparse.rst:864 msgid "Populating the parser" msgstr "" -#: ../../library/optparse.rst:865 +#: ../../library/optparse.rst:866 msgid "" "There are several ways to populate the parser with options. The preferred " "way is by using :meth:`OptionParser.add_option`, as shown in section :ref:" "`optparse-tutorial`. :meth:`add_option` can be called in one of two ways:" msgstr "" -#: ../../library/optparse.rst:869 +#: ../../library/optparse.rst:870 msgid "pass it an Option instance (as returned by :func:`make_option`)" msgstr "" -#: ../../library/optparse.rst:871 +#: ../../library/optparse.rst:872 msgid "" "pass it any combination of positional and keyword arguments that are " "acceptable to :func:`make_option` (i.e., to the Option constructor), and it " "will create the Option instance for you" msgstr "" -#: ../../library/optparse.rst:875 +#: ../../library/optparse.rst:876 msgid "" "The other alternative is to pass a list of pre-constructed Option instances " "to the OptionParser constructor, as in::" msgstr "" -#: ../../library/optparse.rst:878 +#: ../../library/optparse.rst:879 msgid "" "option_list = [\n" " make_option(\"-f\", \"--filename\",\n" @@ -1376,7 +1376,7 @@ msgid "" "parser = OptionParser(option_list=option_list)" msgstr "" -#: ../../library/optparse.rst:886 +#: ../../library/optparse.rst:887 msgid "" "(:func:`make_option` is a factory function for creating Option instances; " "currently it is an alias for the Option constructor. A future version of :" @@ -1385,40 +1385,40 @@ msgid "" "Option directly.)" msgstr "" -#: ../../library/optparse.rst:895 +#: ../../library/optparse.rst:896 msgid "Defining options" msgstr "" -#: ../../library/optparse.rst:897 +#: ../../library/optparse.rst:898 msgid "" "Each Option instance represents a set of synonymous command-line option " "strings, e.g. ``-f`` and ``--file``. You can specify any number of short or " "long option strings, but you must specify at least one overall option string." msgstr "" -#: ../../library/optparse.rst:901 +#: ../../library/optparse.rst:902 msgid "" "The canonical way to create an :class:`Option` instance is with the :meth:" "`add_option` method of :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:907 +#: ../../library/optparse.rst:908 msgid "To define an option with only a short option string::" msgstr "" -#: ../../library/optparse.rst:909 +#: ../../library/optparse.rst:910 msgid "parser.add_option(\"-f\", attr=value, ...)" msgstr "" -#: ../../library/optparse.rst:911 +#: ../../library/optparse.rst:912 msgid "And to define an option with only a long option string::" msgstr "" -#: ../../library/optparse.rst:913 +#: ../../library/optparse.rst:914 msgid "parser.add_option(\"--foo\", attr=value, ...)" msgstr "" -#: ../../library/optparse.rst:915 +#: ../../library/optparse.rst:916 msgid "" "The keyword arguments define attributes of the new Option object. The most " "important option attribute is :attr:`~Option.action`, and it largely " @@ -1427,69 +1427,69 @@ msgid "" "raises an :exc:`OptionError` exception explaining your mistake." msgstr "" -#: ../../library/optparse.rst:921 +#: ../../library/optparse.rst:922 msgid "" "An option's *action* determines what :mod:`optparse` does when it encounters " "this option on the command-line. The standard option actions hard-coded " "into :mod:`optparse` are:" msgstr "" -#: ../../library/optparse.rst:925 +#: ../../library/optparse.rst:926 msgid "``\"store\"``" msgstr "``\"store\"``" -#: ../../library/optparse.rst:926 +#: ../../library/optparse.rst:927 msgid "store this option's argument (default)" msgstr "" -#: ../../library/optparse.rst:931 +#: ../../library/optparse.rst:932 msgid "``\"store_true\"``" msgstr "``\"store_true\"``" -#: ../../library/optparse.rst:932 +#: ../../library/optparse.rst:933 msgid "store ``True``" msgstr "" -#: ../../library/optparse.rst:934 +#: ../../library/optparse.rst:935 msgid "``\"store_false\"``" msgstr "``\"store_false\"``" -#: ../../library/optparse.rst:935 +#: ../../library/optparse.rst:936 msgid "store ``False``" msgstr "" -#: ../../library/optparse.rst:940 +#: ../../library/optparse.rst:941 msgid "``\"append_const\"``" msgstr "``\"append_const\"``" -#: ../../library/optparse.rst:941 +#: ../../library/optparse.rst:942 msgid "append a constant value to a list, pre-set via :attr:`Option.const`" msgstr "" -#: ../../library/optparse.rst:949 ../../library/optparse.rst:1244 +#: ../../library/optparse.rst:950 ../../library/optparse.rst:1245 msgid "``\"help\"``" msgstr "``\"help\"``" -#: ../../library/optparse.rst:950 +#: ../../library/optparse.rst:951 msgid "" "print a usage message including all options and the documentation for them" msgstr "" -#: ../../library/optparse.rst:952 +#: ../../library/optparse.rst:953 msgid "" "(If you don't supply an action, the default is ``\"store\"``. For this " "action, you may also supply :attr:`~Option.type` and :attr:`~Option.dest` " "option attributes; see :ref:`optparse-standard-option-actions`.)" msgstr "" -#: ../../library/optparse.rst:956 +#: ../../library/optparse.rst:957 msgid "" "As you can see, most actions involve storing or updating a value somewhere. :" "mod:`optparse` always creates a special object for this, conventionally " "called ``options``, which is an instance of :class:`optparse.Values`." msgstr "" -#: ../../library/optparse.rst:962 +#: ../../library/optparse.rst:963 msgid "" "An object holding parsed argument names and values as attributes. Normally " "created by calling when calling :meth:`OptionParser.parse_args`, and can be " @@ -1498,35 +1498,35 @@ msgid "" "arguments`)." msgstr "" -#: ../../library/optparse.rst:967 +#: ../../library/optparse.rst:968 msgid "" "Option arguments (and various other values) are stored as attributes of this " "object, according to the :attr:`~Option.dest` (destination) option attribute." msgstr "" -#: ../../library/optparse.rst:971 +#: ../../library/optparse.rst:972 msgid "For example, when you call ::" msgstr "例如說,當你呼叫: ::" -#: ../../library/optparse.rst:973 +#: ../../library/optparse.rst:974 msgid "parser.parse_args()" msgstr "parser.parse_args()" -#: ../../library/optparse.rst:975 +#: ../../library/optparse.rst:976 msgid "" "one of the first things :mod:`optparse` does is create the ``options`` " "object::" msgstr "" -#: ../../library/optparse.rst:977 +#: ../../library/optparse.rst:978 msgid "options = Values()" msgstr "options = Values()" -#: ../../library/optparse.rst:979 +#: ../../library/optparse.rst:980 msgid "If one of the options in this parser is defined with ::" msgstr "" -#: ../../library/optparse.rst:981 +#: ../../library/optparse.rst:982 msgid "" "parser.add_option(\"-f\", \"--file\", action=\"store\", type=\"string\", " "dest=\"filename\")" @@ -1534,11 +1534,11 @@ msgstr "" "parser.add_option(\"-f\", \"--file\", action=\"store\", type=\"string\", " "dest=\"filename\")" -#: ../../library/optparse.rst:983 +#: ../../library/optparse.rst:984 msgid "and the command-line being parsed includes any of the following::" msgstr "" -#: ../../library/optparse.rst:985 +#: ../../library/optparse.rst:986 msgid "" "-ffoo\n" "-f foo\n" @@ -1550,27 +1550,27 @@ msgstr "" "--file=foo\n" "--file foo" -#: ../../library/optparse.rst:990 +#: ../../library/optparse.rst:991 msgid "" "then :mod:`optparse`, on seeing this option, will do the equivalent of ::" msgstr "" -#: ../../library/optparse.rst:992 +#: ../../library/optparse.rst:993 msgid "options.filename = \"foo\"" msgstr "options.filename = \"foo\"" -#: ../../library/optparse.rst:994 +#: ../../library/optparse.rst:995 msgid "" "The :attr:`~Option.type` and :attr:`~Option.dest` option attributes are " "almost as important as :attr:`~Option.action`, but :attr:`~Option.action` is " "the only one that makes sense for *all* options." msgstr "" -#: ../../library/optparse.rst:1002 +#: ../../library/optparse.rst:1003 msgid "Option attributes" msgstr "" -#: ../../library/optparse.rst:1006 +#: ../../library/optparse.rst:1007 msgid "" "A single command line argument, with various attributes passed by keyword to " "the constructor. Normally created with :meth:`OptionParser.add_option` " @@ -1578,7 +1578,7 @@ msgid "" "*option_class* argument to :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:1012 +#: ../../library/optparse.rst:1013 msgid "" "The following option attributes may be passed as keyword arguments to :meth:" "`OptionParser.add_option`. If you pass an option attribute that is not " @@ -1586,33 +1586,33 @@ msgid "" "attribute, :mod:`optparse` raises :exc:`OptionError`." msgstr "" -#: ../../library/optparse.rst:1019 +#: ../../library/optparse.rst:1020 msgid "(default: ``\"store\"``)" msgstr "(預設值: ``\"store\"`` )" -#: ../../library/optparse.rst:1021 +#: ../../library/optparse.rst:1022 msgid "" "Determines :mod:`optparse`'s behaviour when this option is seen on the " "command line; the available options are documented :ref:`here `." msgstr "" -#: ../../library/optparse.rst:1027 +#: ../../library/optparse.rst:1028 msgid "(default: ``\"string\"``)" msgstr "(預設值: ``\"string\"`` )" -#: ../../library/optparse.rst:1029 +#: ../../library/optparse.rst:1030 msgid "" "The argument type expected by this option (e.g., ``\"string\"`` or " "``\"int\"``); the available option types are documented :ref:`here `." msgstr "" -#: ../../library/optparse.rst:1035 ../../library/optparse.rst:1085 +#: ../../library/optparse.rst:1036 ../../library/optparse.rst:1086 msgid "(default: derived from option strings)" msgstr "" -#: ../../library/optparse.rst:1037 +#: ../../library/optparse.rst:1038 msgid "" "If the option's action implies writing or modifying a value somewhere, this " "tells :mod:`optparse` where to write it: :attr:`~Option.dest` names an " @@ -1620,47 +1620,47 @@ msgid "" "the command line." msgstr "" -#: ../../library/optparse.rst:1044 +#: ../../library/optparse.rst:1045 msgid "" "The value to use for this option's destination if the option is not seen on " "the command line. See also :meth:`OptionParser.set_defaults`." msgstr "" -#: ../../library/optparse.rst:1049 +#: ../../library/optparse.rst:1050 msgid "(default: 1)" msgstr "(預設值:1)" -#: ../../library/optparse.rst:1051 +#: ../../library/optparse.rst:1052 msgid "" "How many arguments of type :attr:`~Option.type` should be consumed when this " "option is seen. If > 1, :mod:`optparse` will store a tuple of values to :" "attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1057 +#: ../../library/optparse.rst:1058 msgid "For actions that store a constant value, the constant value to store." msgstr "" -#: ../../library/optparse.rst:1061 +#: ../../library/optparse.rst:1062 msgid "" "For options of type ``\"choice\"``, the list of strings the user may choose " "from." msgstr "" -#: ../../library/optparse.rst:1066 +#: ../../library/optparse.rst:1067 msgid "" "For options with action ``\"callback\"``, the callable to call when this " "option is seen. See section :ref:`optparse-option-callbacks` for detail on " "the arguments passed to the callable." msgstr "" -#: ../../library/optparse.rst:1073 +#: ../../library/optparse.rst:1074 msgid "" "Additional positional and keyword arguments to pass to ``callback`` after " "the four standard callback arguments." msgstr "" -#: ../../library/optparse.rst:1078 +#: ../../library/optparse.rst:1079 msgid "" "Help text to print for this option when listing all available options after " "the user supplies a :attr:`~Option.help` option (such as ``--help``). If no " @@ -1668,17 +1668,17 @@ msgid "" "this option, use the special value :const:`optparse.SUPPRESS_HELP`." msgstr "" -#: ../../library/optparse.rst:1087 +#: ../../library/optparse.rst:1088 msgid "" "Stand-in for the option argument(s) to use when printing help text. See " "section :ref:`optparse-tutorial` for an example." msgstr "" -#: ../../library/optparse.rst:1094 +#: ../../library/optparse.rst:1095 msgid "Standard option actions" msgstr "" -#: ../../library/optparse.rst:1096 +#: ../../library/optparse.rst:1097 msgid "" "The various option actions all have slightly different requirements and " "effects. Most actions have several relevant option attributes which you may " @@ -1686,13 +1686,13 @@ msgid "" "attributes, which you must specify for any option using that action." msgstr "" -#: ../../library/optparse.rst:1101 +#: ../../library/optparse.rst:1102 msgid "" "``\"store\"`` [relevant: :attr:`~Option.type`, :attr:`~Option.dest`, :attr:" "`~Option.nargs`, :attr:`~Option.choices`]" msgstr "" -#: ../../library/optparse.rst:1104 +#: ../../library/optparse.rst:1105 msgid "" "The option must be followed by an argument, which is converted to a value " "according to :attr:`~Option.type` and stored in :attr:`~Option.dest`. If :" @@ -1702,17 +1702,17 @@ msgid "" "option-types` section." msgstr "" -#: ../../library/optparse.rst:1111 +#: ../../library/optparse.rst:1112 msgid "" "If :attr:`~Option.choices` is supplied (a list or tuple of strings), the " "type defaults to ``\"choice\"``." msgstr "" -#: ../../library/optparse.rst:1114 +#: ../../library/optparse.rst:1115 msgid "If :attr:`~Option.type` is not supplied, it defaults to ``\"string\"``." msgstr "" -#: ../../library/optparse.rst:1116 +#: ../../library/optparse.rst:1117 msgid "" "If :attr:`~Option.dest` is not supplied, :mod:`optparse` derives a " "destination from the first long option string (e.g., ``--foo-bar`` implies " @@ -1720,13 +1720,13 @@ msgid "" "destination from the first short option string (e.g., ``-f`` implies ``f``)." msgstr "" -#: ../../library/optparse.rst:1121 ../../library/optparse.rst:1141 -#: ../../library/optparse.rst:1163 ../../library/optparse.rst:1181 -#: ../../library/optparse.rst:1220 ../../library/optparse.rst:1258 +#: ../../library/optparse.rst:1122 ../../library/optparse.rst:1142 +#: ../../library/optparse.rst:1164 ../../library/optparse.rst:1182 +#: ../../library/optparse.rst:1221 ../../library/optparse.rst:1259 msgid "Example::" msgstr "範例: ::" -#: ../../library/optparse.rst:1123 +#: ../../library/optparse.rst:1124 msgid "" "parser.add_option(\"-f\")\n" "parser.add_option(\"-p\", type=\"float\", nargs=3, dest=\"point\")" @@ -1734,19 +1734,19 @@ msgstr "" "parser.add_option(\"-f\")\n" "parser.add_option(\"-p\", type=\"float\", nargs=3, dest=\"point\")" -#: ../../library/optparse.rst:1126 +#: ../../library/optparse.rst:1127 msgid "As it parses the command line ::" msgstr "" -#: ../../library/optparse.rst:1128 +#: ../../library/optparse.rst:1129 msgid "-f foo.txt -p 1 -3.5 4 -fbar.txt" msgstr "-f foo.txt -p 1 -3.5 4 -fbar.txt" -#: ../../library/optparse.rst:1130 +#: ../../library/optparse.rst:1131 msgid ":mod:`optparse` will set ::" msgstr "" -#: ../../library/optparse.rst:1132 +#: ../../library/optparse.rst:1133 msgid "" "options.f = \"foo.txt\"\n" "options.point = (1.0, -3.5, 4.0)\n" @@ -1756,17 +1756,17 @@ msgstr "" "options.point = (1.0, -3.5, 4.0)\n" "options.f = \"bar.txt\"" -#: ../../library/optparse.rst:1136 +#: ../../library/optparse.rst:1137 msgid "" "``\"store_const\"`` [required: :attr:`~Option.const`; relevant: :attr:" "`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1139 +#: ../../library/optparse.rst:1140 msgid "The value :attr:`~Option.const` is stored in :attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1143 +#: ../../library/optparse.rst:1144 msgid "" "parser.add_option(\"-q\", \"--quiet\",\n" " action=\"store_const\", const=0, dest=\"verbose\")\n" @@ -1782,33 +1782,33 @@ msgstr "" "parser.add_option(\"--noisy\",\n" " action=\"store_const\", const=2, dest=\"verbose\")" -#: ../../library/optparse.rst:1150 +#: ../../library/optparse.rst:1151 msgid "If ``--noisy`` is seen, :mod:`optparse` will set ::" msgstr "" -#: ../../library/optparse.rst:1152 +#: ../../library/optparse.rst:1153 msgid "options.verbose = 2" msgstr "options.verbose = 2" -#: ../../library/optparse.rst:1154 +#: ../../library/optparse.rst:1155 msgid "``\"store_true\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1156 +#: ../../library/optparse.rst:1157 msgid "" "A special case of ``\"store_const\"`` that stores ``True`` to :attr:`~Option." "dest`." msgstr "" -#: ../../library/optparse.rst:1159 +#: ../../library/optparse.rst:1160 msgid "``\"store_false\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1161 +#: ../../library/optparse.rst:1162 msgid "Like ``\"store_true\"``, but stores ``False``." msgstr "" -#: ../../library/optparse.rst:1165 +#: ../../library/optparse.rst:1166 msgid "" "parser.add_option(\"--clobber\", action=\"store_true\", dest=\"clobber\")\n" "parser.add_option(\"--no-clobber\", action=\"store_false\", dest=\"clobber\")" @@ -1816,13 +1816,13 @@ msgstr "" "parser.add_option(\"--clobber\", action=\"store_true\", dest=\"clobber\")\n" "parser.add_option(\"--no-clobber\", action=\"store_false\", dest=\"clobber\")" -#: ../../library/optparse.rst:1168 +#: ../../library/optparse.rst:1169 msgid "" "``\"append\"`` [relevant: :attr:`~Option.type`, :attr:`~Option.dest`, :attr:" "`~Option.nargs`, :attr:`~Option.choices`]" msgstr "" -#: ../../library/optparse.rst:1171 +#: ../../library/optparse.rst:1172 msgid "" "The option must be followed by an argument, which is appended to the list " "in :attr:`~Option.dest`. If no default value for :attr:`~Option.dest` is " @@ -1832,25 +1832,25 @@ msgid "" "is appended to :attr:`~Option.dest`." msgstr "" -#: ../../library/optparse.rst:1178 +#: ../../library/optparse.rst:1179 msgid "" "The defaults for :attr:`~Option.type` and :attr:`~Option.dest` are the same " "as for the ``\"store\"`` action." msgstr "" -#: ../../library/optparse.rst:1183 +#: ../../library/optparse.rst:1184 msgid "" "parser.add_option(\"-t\", \"--tracks\", action=\"append\", type=\"int\")" msgstr "" "parser.add_option(\"-t\", \"--tracks\", action=\"append\", type=\"int\")" -#: ../../library/optparse.rst:1185 +#: ../../library/optparse.rst:1186 msgid "" "If ``-t3`` is seen on the command-line, :mod:`optparse` does the equivalent " "of::" msgstr "" -#: ../../library/optparse.rst:1188 +#: ../../library/optparse.rst:1189 msgid "" "options.tracks = []\n" "options.tracks.append(int(\"3\"))" @@ -1858,15 +1858,15 @@ msgstr "" "options.tracks = []\n" "options.tracks.append(int(\"3\"))" -#: ../../library/optparse.rst:1191 +#: ../../library/optparse.rst:1192 msgid "If, a little later on, ``--tracks=4`` is seen, it does::" msgstr "" -#: ../../library/optparse.rst:1193 +#: ../../library/optparse.rst:1194 msgid "options.tracks.append(int(\"4\"))" msgstr "options.tracks.append(int(\"4\"))" -#: ../../library/optparse.rst:1195 +#: ../../library/optparse.rst:1196 msgid "" "The ``append`` action calls the ``append`` method on the current value of " "the option. This means that any default value specified must have an " @@ -1875,7 +1875,7 @@ msgid "" "with any values from the command line appended after those default values::" msgstr "" -#: ../../library/optparse.rst:1201 +#: ../../library/optparse.rst:1202 msgid "" ">>> parser.add_option(\"--files\", action=\"append\", default=['~/.mypkg/" "defaults'])\n" @@ -1889,13 +1889,13 @@ msgstr "" ">>> opts.files\n" "['~/.mypkg/defaults', 'overrides.mypkg']" -#: ../../library/optparse.rst:1206 +#: ../../library/optparse.rst:1207 msgid "" "``\"append_const\"`` [required: :attr:`~Option.const`; relevant: :attr:" "`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1209 +#: ../../library/optparse.rst:1210 msgid "" "Like ``\"store_const\"``, but the value :attr:`~Option.const` is appended " "to :attr:`~Option.dest`; as with ``\"append\"``, :attr:`~Option.dest` " @@ -1903,28 +1903,28 @@ msgid "" "time the option is encountered." msgstr "" -#: ../../library/optparse.rst:1214 +#: ../../library/optparse.rst:1215 msgid "``\"count\"`` [relevant: :attr:`~Option.dest`]" msgstr "" -#: ../../library/optparse.rst:1216 +#: ../../library/optparse.rst:1217 msgid "" "Increment the integer stored at :attr:`~Option.dest`. If no default value " "is supplied, :attr:`~Option.dest` is set to zero before being incremented " "the first time." msgstr "" -#: ../../library/optparse.rst:1222 +#: ../../library/optparse.rst:1223 msgid "parser.add_option(\"-v\", action=\"count\", dest=\"verbosity\")" msgstr "parser.add_option(\"-v\", action=\"count\", dest=\"verbosity\")" -#: ../../library/optparse.rst:1224 +#: ../../library/optparse.rst:1225 msgid "" "The first time ``-v`` is seen on the command line, :mod:`optparse` does the " "equivalent of::" msgstr "" -#: ../../library/optparse.rst:1227 +#: ../../library/optparse.rst:1228 msgid "" "options.verbosity = 0\n" "options.verbosity += 1" @@ -1932,36 +1932,36 @@ msgstr "" "options.verbosity = 0\n" "options.verbosity += 1" -#: ../../library/optparse.rst:1230 +#: ../../library/optparse.rst:1231 msgid "Every subsequent occurrence of ``-v`` results in ::" msgstr "" -#: ../../library/optparse.rst:1232 +#: ../../library/optparse.rst:1233 msgid "options.verbosity += 1" msgstr "options.verbosity += 1" -#: ../../library/optparse.rst:1234 +#: ../../library/optparse.rst:1235 msgid "" "``\"callback\"`` [required: :attr:`~Option.callback`; relevant: :attr:" "`~Option.type`, :attr:`~Option.nargs`, :attr:`~Option.callback_args`, :attr:" "`~Option.callback_kwargs`]" msgstr "" -#: ../../library/optparse.rst:1238 +#: ../../library/optparse.rst:1239 msgid "" "Call the function specified by :attr:`~Option.callback`, which is called " "as ::" msgstr "" -#: ../../library/optparse.rst:1240 ../../library/optparse.rst:1638 +#: ../../library/optparse.rst:1241 ../../library/optparse.rst:1639 msgid "func(option, opt_str, value, parser, *args, **kwargs)" msgstr "func(option, opt_str, value, parser, *args, **kwargs)" -#: ../../library/optparse.rst:1242 +#: ../../library/optparse.rst:1243 msgid "See section :ref:`optparse-option-callbacks` for more detail." msgstr "更多細節請見 :ref:`optparse-option-callbacks`。" -#: ../../library/optparse.rst:1246 +#: ../../library/optparse.rst:1247 msgid "" "Prints a complete help message for all the options in the current option " "parser. The help message is constructed from the ``usage`` string passed to " @@ -1969,20 +1969,20 @@ msgid "" "every option." msgstr "" -#: ../../library/optparse.rst:1251 +#: ../../library/optparse.rst:1252 msgid "" "If no :attr:`~Option.help` string is supplied for an option, it will still " "be listed in the help message. To omit an option entirely, use the special " "value :const:`optparse.SUPPRESS_HELP`." msgstr "" -#: ../../library/optparse.rst:1255 +#: ../../library/optparse.rst:1256 msgid "" ":mod:`optparse` automatically adds a :attr:`~Option.help` option to all " "OptionParsers, so you do not normally need to create one." msgstr "" -#: ../../library/optparse.rst:1260 +#: ../../library/optparse.rst:1261 msgid "" "from optparse import OptionParser, SUPPRESS_HELP\n" "\n" @@ -1998,14 +1998,14 @@ msgid "" "parser.add_option(\"--secret\", help=SUPPRESS_HELP)" msgstr "" -#: ../../library/optparse.rst:1273 +#: ../../library/optparse.rst:1274 msgid "" "If :mod:`optparse` sees either ``-h`` or ``--help`` on the command line, it " "will print something like the following help message to stdout (assuming " "``sys.argv[0]`` is ``\"foo.py\"``):" msgstr "" -#: ../../library/optparse.rst:1277 +#: ../../library/optparse.rst:1278 msgid "" "Usage: foo.py [options]\n" "\n" @@ -2021,17 +2021,17 @@ msgstr "" " -v Be moderately verbose\n" " --file=FILENAME Input file to read data from" -#: ../../library/optparse.rst:1286 +#: ../../library/optparse.rst:1287 msgid "" "After printing the help message, :mod:`optparse` terminates your process " "with ``sys.exit(0)``." msgstr "" -#: ../../library/optparse.rst:1289 +#: ../../library/optparse.rst:1290 msgid "``\"version\"``" msgstr "``\"version\"``" -#: ../../library/optparse.rst:1291 +#: ../../library/optparse.rst:1292 msgid "" "Prints the version number supplied to the OptionParser to stdout and exits. " "The version number is actually formatted and printed by the " @@ -2041,58 +2041,58 @@ msgid "" "since :mod:`optparse` automatically adds them when needed." msgstr "" -#: ../../library/optparse.rst:1302 +#: ../../library/optparse.rst:1303 msgid "Standard option types" msgstr "" -#: ../../library/optparse.rst:1304 +#: ../../library/optparse.rst:1305 msgid "" ":mod:`optparse` has five built-in option types: ``\"string\"``, ``\"int\"``, " "``\"choice\"``, ``\"float\"`` and ``\"complex\"``. If you need to add new " "option types, see section :ref:`optparse-extending-optparse`." msgstr "" -#: ../../library/optparse.rst:1308 +#: ../../library/optparse.rst:1309 msgid "" "Arguments to string options are not checked or converted in any way: the " "text on the command line is stored in the destination (or passed to the " "callback) as-is." msgstr "" -#: ../../library/optparse.rst:1311 +#: ../../library/optparse.rst:1312 msgid "Integer arguments (type ``\"int\"``) are parsed as follows:" msgstr "" -#: ../../library/optparse.rst:1313 +#: ../../library/optparse.rst:1314 msgid "if the number starts with ``0x``, it is parsed as a hexadecimal number" msgstr "" -#: ../../library/optparse.rst:1315 +#: ../../library/optparse.rst:1316 msgid "if the number starts with ``0``, it is parsed as an octal number" msgstr "" -#: ../../library/optparse.rst:1317 +#: ../../library/optparse.rst:1318 msgid "if the number starts with ``0b``, it is parsed as a binary number" msgstr "" -#: ../../library/optparse.rst:1319 +#: ../../library/optparse.rst:1320 msgid "otherwise, the number is parsed as a decimal number" msgstr "" -#: ../../library/optparse.rst:1322 +#: ../../library/optparse.rst:1323 msgid "" "The conversion is done by calling :func:`int` with the appropriate base (2, " "8, 10, or 16). If this fails, so will :mod:`optparse`, although with a more " "useful error message." msgstr "" -#: ../../library/optparse.rst:1326 +#: ../../library/optparse.rst:1327 msgid "" "``\"float\"`` and ``\"complex\"`` option arguments are converted directly " "with :func:`float` and :func:`complex`, with similar error-handling." msgstr "" -#: ../../library/optparse.rst:1329 +#: ../../library/optparse.rst:1330 msgid "" "``\"choice\"`` options are a subtype of ``\"string\"`` options. The :attr:" "`~Option.choices` option attribute (a sequence of strings) defines the set " @@ -2101,63 +2101,63 @@ msgid "" "`OptionValueError` if an invalid string is given." msgstr "" -#: ../../library/optparse.rst:1339 +#: ../../library/optparse.rst:1340 msgid "Parsing arguments" msgstr "剖析引數" -#: ../../library/optparse.rst:1341 +#: ../../library/optparse.rst:1342 msgid "" "The whole point of creating and populating an OptionParser is to call its :" "meth:`~OptionParser.parse_args` method." msgstr "" -#: ../../library/optparse.rst:1346 +#: ../../library/optparse.rst:1347 msgid "Parse the command-line options found in *args*." msgstr "" -#: ../../library/optparse.rst:1348 +#: ../../library/optparse.rst:1349 msgid "The input parameters are" msgstr "" -#: ../../library/optparse.rst:1350 ../../library/optparse.rst:1364 -#: ../../library/optparse.rst:1682 +#: ../../library/optparse.rst:1351 ../../library/optparse.rst:1365 +#: ../../library/optparse.rst:1683 msgid "``args``" msgstr "``args``" -#: ../../library/optparse.rst:1351 +#: ../../library/optparse.rst:1352 msgid "the list of arguments to process (default: ``sys.argv[1:]``)" msgstr "" -#: ../../library/optparse.rst:1353 +#: ../../library/optparse.rst:1354 msgid "``values``" msgstr "``values``" -#: ../../library/optparse.rst:1354 +#: ../../library/optparse.rst:1355 msgid "" "a :class:`Values` object to store option arguments in (default: a new " "instance of :class:`Values`) -- if you give an existing object, the option " "defaults will not be initialized on it" msgstr "" -#: ../../library/optparse.rst:1358 +#: ../../library/optparse.rst:1359 msgid "and the return value is a pair ``(options, args)`` where" msgstr "" -#: ../../library/optparse.rst:1360 +#: ../../library/optparse.rst:1361 msgid "``options``" msgstr "``options``" -#: ../../library/optparse.rst:1361 +#: ../../library/optparse.rst:1362 msgid "" "the same object that was passed in as *values*, or the ``optparse.Values`` " "instance created by :mod:`optparse`" msgstr "" -#: ../../library/optparse.rst:1365 +#: ../../library/optparse.rst:1366 msgid "the leftover positional arguments after all options have been processed" msgstr "" -#: ../../library/optparse.rst:1367 +#: ../../library/optparse.rst:1368 msgid "" "The most common usage is to supply neither keyword argument. If you supply " "``values``, it will be modified with repeated :func:`setattr` calls (roughly " @@ -2165,7 +2165,7 @@ msgid "" "by :meth:`~OptionParser.parse_args`." msgstr "" -#: ../../library/optparse.rst:1372 +#: ../../library/optparse.rst:1373 msgid "" "If :meth:`~OptionParser.parse_args` encounters any errors in the argument " "list, it calls the OptionParser's :meth:`error` method with an appropriate " @@ -2173,69 +2173,69 @@ msgid "" "status of 2 (the traditional Unix exit status for command-line errors)." msgstr "" -#: ../../library/optparse.rst:1381 +#: ../../library/optparse.rst:1382 msgid "Querying and manipulating your option parser" msgstr "" -#: ../../library/optparse.rst:1383 +#: ../../library/optparse.rst:1384 msgid "" "The default behavior of the option parser can be customized slightly, and " "you can also poke around your option parser and see what's there. " "OptionParser provides several methods to help you out:" msgstr "" -#: ../../library/optparse.rst:1389 +#: ../../library/optparse.rst:1390 msgid "" "Set parsing to stop on the first non-option. For example, if ``-a`` and ``-" "b`` are both simple options that take no arguments, :mod:`optparse` normally " "accepts this syntax::" msgstr "" -#: ../../library/optparse.rst:1393 +#: ../../library/optparse.rst:1394 msgid "prog -a arg1 -b arg2" msgstr "prog -a arg1 -b arg2" -#: ../../library/optparse.rst:1395 +#: ../../library/optparse.rst:1396 msgid "and treats it as equivalent to ::" msgstr "" -#: ../../library/optparse.rst:1397 +#: ../../library/optparse.rst:1398 msgid "prog -a -b arg1 arg2" msgstr "prog -a -b arg1 arg2" -#: ../../library/optparse.rst:1399 +#: ../../library/optparse.rst:1400 msgid "" "To disable this feature, call :meth:`disable_interspersed_args`. This " "restores traditional Unix syntax, where option parsing stops with the first " "non-option argument." msgstr "" -#: ../../library/optparse.rst:1403 +#: ../../library/optparse.rst:1404 msgid "" "Use this if you have a command processor which runs another command which " "has options of its own and you want to make sure these options don't get " "confused. For example, each command might have a different set of options." msgstr "" -#: ../../library/optparse.rst:1409 +#: ../../library/optparse.rst:1410 msgid "" "Set parsing to not stop on the first non-option, allowing interspersing " "switches with command arguments. This is the default behavior." msgstr "" -#: ../../library/optparse.rst:1414 +#: ../../library/optparse.rst:1415 msgid "" "Returns the Option instance with the option string *opt_str*, or ``None`` if " "no options have that option string." msgstr "" -#: ../../library/optparse.rst:1419 +#: ../../library/optparse.rst:1420 msgid "" "Return ``True`` if the OptionParser has an option with option string " "*opt_str* (e.g., ``-q`` or ``--verbose``)." msgstr "" -#: ../../library/optparse.rst:1424 +#: ../../library/optparse.rst:1425 msgid "" "If the :class:`OptionParser` has an option corresponding to *opt_str*, that " "option is removed. If that option provided any other option strings, all of " @@ -2243,17 +2243,17 @@ msgid "" "option belonging to this :class:`OptionParser`, raises :exc:`ValueError`." msgstr "" -#: ../../library/optparse.rst:1433 +#: ../../library/optparse.rst:1434 msgid "Conflicts between options" msgstr "" -#: ../../library/optparse.rst:1435 +#: ../../library/optparse.rst:1436 msgid "" "If you're not careful, it's easy to define options with conflicting option " "strings::" msgstr "" -#: ../../library/optparse.rst:1438 +#: ../../library/optparse.rst:1439 msgid "" "parser.add_option(\"-n\", \"--dry-run\", ...)\n" "...\n" @@ -2263,13 +2263,13 @@ msgstr "" "...\n" "parser.add_option(\"-n\", \"--noisy\", ...)" -#: ../../library/optparse.rst:1442 +#: ../../library/optparse.rst:1443 msgid "" "(This is particularly true if you've defined your own OptionParser subclass " "with some standard options.)" msgstr "" -#: ../../library/optparse.rst:1445 +#: ../../library/optparse.rst:1446 msgid "" "Every time you add an option, :mod:`optparse` checks for conflicts with " "existing options. If it finds any, it invokes the current conflict-handling " @@ -2277,47 +2277,47 @@ msgid "" "constructor::" msgstr "" -#: ../../library/optparse.rst:1449 +#: ../../library/optparse.rst:1450 msgid "parser = OptionParser(..., conflict_handler=handler)" msgstr "parser = OptionParser(..., conflict_handler=handler)" -#: ../../library/optparse.rst:1451 +#: ../../library/optparse.rst:1452 msgid "or with a separate call::" msgstr "" -#: ../../library/optparse.rst:1453 +#: ../../library/optparse.rst:1454 msgid "parser.set_conflict_handler(handler)" msgstr "parser.set_conflict_handler(handler)" -#: ../../library/optparse.rst:1455 +#: ../../library/optparse.rst:1456 msgid "The available conflict handlers are:" msgstr "" -#: ../../library/optparse.rst:1457 +#: ../../library/optparse.rst:1458 msgid "``\"error\"`` (default)" msgstr "" -#: ../../library/optparse.rst:1458 +#: ../../library/optparse.rst:1459 msgid "" "assume option conflicts are a programming error and raise :exc:" "`OptionConflictError`" msgstr "" -#: ../../library/optparse.rst:1461 +#: ../../library/optparse.rst:1462 msgid "``\"resolve\"``" msgstr "``\"resolve\"``" -#: ../../library/optparse.rst:1462 +#: ../../library/optparse.rst:1463 msgid "resolve option conflicts intelligently (see below)" msgstr "" -#: ../../library/optparse.rst:1465 +#: ../../library/optparse.rst:1466 msgid "" "As an example, let's define an :class:`OptionParser` that resolves conflicts " "intelligently and add conflicting options to it::" msgstr "" -#: ../../library/optparse.rst:1468 +#: ../../library/optparse.rst:1469 msgid "" "parser = OptionParser(conflict_handler=\"resolve\")\n" "parser.add_option(\"-n\", \"--dry-run\", ..., help=\"do no harm\")\n" @@ -2327,7 +2327,7 @@ msgstr "" "parser.add_option(\"-n\", \"--dry-run\", ..., help=\"do no harm\")\n" "parser.add_option(\"-n\", \"--noisy\", ..., help=\"be noisy\")" -#: ../../library/optparse.rst:1472 +#: ../../library/optparse.rst:1473 msgid "" "At this point, :mod:`optparse` detects that a previously added option is " "already using the ``-n`` option string. Since ``conflict_handler`` is " @@ -2337,7 +2337,7 @@ msgid "" "message will reflect that::" msgstr "" -#: ../../library/optparse.rst:1478 +#: ../../library/optparse.rst:1479 msgid "" "Options:\n" " --dry-run do no harm\n" @@ -2345,7 +2345,7 @@ msgid "" " -n, --noisy be noisy" msgstr "" -#: ../../library/optparse.rst:1483 +#: ../../library/optparse.rst:1484 msgid "" "It's possible to whittle away the option strings for a previously added " "option until there are none left, and the user has no way of invoking that " @@ -2354,17 +2354,17 @@ msgid "" "Carrying on with our existing OptionParser::" msgstr "" -#: ../../library/optparse.rst:1489 +#: ../../library/optparse.rst:1490 msgid "parser.add_option(\"--dry-run\", ..., help=\"new dry-run option\")" msgstr "parser.add_option(\"--dry-run\", ..., help=\"new dry-run option\")" -#: ../../library/optparse.rst:1491 +#: ../../library/optparse.rst:1492 msgid "" "At this point, the original ``-n``/``--dry-run`` option is no longer " "accessible, so :mod:`optparse` removes it, leaving this help text::" msgstr "" -#: ../../library/optparse.rst:1494 +#: ../../library/optparse.rst:1495 msgid "" "Options:\n" " ...\n" @@ -2376,11 +2376,11 @@ msgstr "" " -n, --noisy be noisy\n" " --dry-run new dry-run option" -#: ../../library/optparse.rst:1503 +#: ../../library/optparse.rst:1504 msgid "Cleanup" msgstr "" -#: ../../library/optparse.rst:1505 +#: ../../library/optparse.rst:1506 msgid "" "OptionParser instances have several cyclic references. This should not be a " "problem for Python's garbage collector, but you may wish to break the cyclic " @@ -2390,15 +2390,15 @@ msgid "" "OptionParser." msgstr "" -#: ../../library/optparse.rst:1516 +#: ../../library/optparse.rst:1517 msgid "Other methods" msgstr "其他方法" -#: ../../library/optparse.rst:1518 +#: ../../library/optparse.rst:1519 msgid "OptionParser supports several other public methods:" msgstr "" -#: ../../library/optparse.rst:1522 +#: ../../library/optparse.rst:1523 msgid "" "Set the usage string according to the rules described above for the " "``usage`` constructor keyword argument. Passing ``None`` sets the default " @@ -2406,7 +2406,7 @@ msgid "" "message." msgstr "" -#: ../../library/optparse.rst:1528 +#: ../../library/optparse.rst:1529 msgid "" "Print the usage message for the current program (``self.usage``) to *file* " "(default stdout). Any occurrence of the string ``%prog`` in ``self.usage`` " @@ -2414,13 +2414,13 @@ msgid "" "usage`` is empty or not defined." msgstr "" -#: ../../library/optparse.rst:1535 +#: ../../library/optparse.rst:1536 msgid "" "Same as :meth:`print_usage` but returns the usage string instead of printing " "it." msgstr "" -#: ../../library/optparse.rst:1540 +#: ../../library/optparse.rst:1541 msgid "" "Set default values for several option destinations at once. Using :meth:" "`set_defaults` is the preferred way to set default values for options, since " @@ -2429,7 +2429,7 @@ msgid "" "default, and the last one wins::" msgstr "" -#: ../../library/optparse.rst:1546 +#: ../../library/optparse.rst:1547 msgid "" "parser.add_option(\"--advanced\", action=\"store_const\",\n" " dest=\"mode\", const=\"advanced\",\n" @@ -2439,11 +2439,11 @@ msgid "" " default=\"advanced\") # overrides above setting" msgstr "" -#: ../../library/optparse.rst:1553 +#: ../../library/optparse.rst:1554 msgid "To avoid this confusion, use :meth:`set_defaults`::" msgstr "" -#: ../../library/optparse.rst:1555 +#: ../../library/optparse.rst:1556 msgid "" "parser.set_defaults(mode=\"advanced\")\n" "parser.add_option(\"--advanced\", action=\"store_const\",\n" @@ -2457,11 +2457,11 @@ msgstr "" "parser.add_option(\"--novice\", action=\"store_const\",\n" " dest=\"mode\", const=\"novice\")" -#: ../../library/optparse.rst:1565 +#: ../../library/optparse.rst:1566 msgid "Option Callbacks" msgstr "" -#: ../../library/optparse.rst:1567 +#: ../../library/optparse.rst:1568 msgid "" "When :mod:`optparse`'s built-in actions and types aren't quite enough for " "your needs, you have two choices: extend :mod:`optparse` or define a " @@ -2469,25 +2469,25 @@ msgid "" "a lot of simple cases. Quite often a simple callback is all you need." msgstr "" -#: ../../library/optparse.rst:1572 +#: ../../library/optparse.rst:1573 msgid "There are two steps to defining a callback option:" msgstr "" -#: ../../library/optparse.rst:1574 +#: ../../library/optparse.rst:1575 msgid "define the option itself using the ``\"callback\"`` action" msgstr "" -#: ../../library/optparse.rst:1576 +#: ../../library/optparse.rst:1577 msgid "" "write the callback; this is a function (or method) that takes at least four " "arguments, as described below" msgstr "" -#: ../../library/optparse.rst:1583 +#: ../../library/optparse.rst:1584 msgid "Defining a callback option" msgstr "" -#: ../../library/optparse.rst:1585 +#: ../../library/optparse.rst:1586 msgid "" "As always, the easiest way to define a callback option is by using the :meth:" "`OptionParser.add_option` method. Apart from :attr:`~Option.action`, the " @@ -2495,11 +2495,11 @@ msgid "" "call::" msgstr "" -#: ../../library/optparse.rst:1589 +#: ../../library/optparse.rst:1590 msgid "parser.add_option(\"-c\", action=\"callback\", callback=my_callback)" msgstr "parser.add_option(\"-c\", action=\"callback\", callback=my_callback)" -#: ../../library/optparse.rst:1591 +#: ../../library/optparse.rst:1592 msgid "" "``callback`` is a function (or other callable object), so you must have " "already defined ``my_callback()`` when you create this callback option. In " @@ -2511,7 +2511,7 @@ msgid "" "tricky; it's covered later in this section." msgstr "" -#: ../../library/optparse.rst:1600 +#: ../../library/optparse.rst:1601 msgid "" ":mod:`optparse` always passes four particular arguments to your callback, " "and it will only pass additional arguments if you specify them via :attr:" @@ -2519,25 +2519,25 @@ msgid "" "minimal callback function signature is::" msgstr "" -#: ../../library/optparse.rst:1605 +#: ../../library/optparse.rst:1606 msgid "def my_callback(option, opt, value, parser):" msgstr "def my_callback(option, opt, value, parser):" -#: ../../library/optparse.rst:1607 +#: ../../library/optparse.rst:1608 msgid "The four arguments to a callback are described below." msgstr "" -#: ../../library/optparse.rst:1609 +#: ../../library/optparse.rst:1610 msgid "" "There are several other option attributes that you can supply when you " "define a callback option:" msgstr "" -#: ../../library/optparse.rst:1612 +#: ../../library/optparse.rst:1613 msgid ":attr:`~Option.type`" msgstr ":attr:`~Option.type`" -#: ../../library/optparse.rst:1613 +#: ../../library/optparse.rst:1614 msgid "" "has its usual meaning: as with the ``\"store\"`` or ``\"append\"`` actions, " "it instructs :mod:`optparse` to consume one argument and convert it to :attr:" @@ -2545,11 +2545,11 @@ msgid "" "though, :mod:`optparse` passes it to your callback function." msgstr "" -#: ../../library/optparse.rst:1618 +#: ../../library/optparse.rst:1619 msgid ":attr:`~Option.nargs`" msgstr ":attr:`~Option.nargs`" -#: ../../library/optparse.rst:1619 +#: ../../library/optparse.rst:1620 msgid "" "also has its usual meaning: if it is supplied and > 1, :mod:`optparse` will " "consume :attr:`~Option.nargs` arguments, each of which must be convertible " @@ -2557,43 +2557,43 @@ msgid "" "callback." msgstr "" -#: ../../library/optparse.rst:1624 +#: ../../library/optparse.rst:1625 msgid ":attr:`~Option.callback_args`" msgstr ":attr:`~Option.callback_args`" -#: ../../library/optparse.rst:1625 +#: ../../library/optparse.rst:1626 msgid "a tuple of extra positional arguments to pass to the callback" msgstr "" -#: ../../library/optparse.rst:1627 +#: ../../library/optparse.rst:1628 msgid ":attr:`~Option.callback_kwargs`" msgstr ":attr:`~Option.callback_kwargs`" -#: ../../library/optparse.rst:1628 +#: ../../library/optparse.rst:1629 msgid "a dictionary of extra keyword arguments to pass to the callback" msgstr "" -#: ../../library/optparse.rst:1634 +#: ../../library/optparse.rst:1635 msgid "How callbacks are called" msgstr "" -#: ../../library/optparse.rst:1636 +#: ../../library/optparse.rst:1637 msgid "All callbacks are called as follows::" msgstr "" -#: ../../library/optparse.rst:1642 +#: ../../library/optparse.rst:1643 msgid "``option``" msgstr "``option``" -#: ../../library/optparse.rst:1643 +#: ../../library/optparse.rst:1644 msgid "is the Option instance that's calling the callback" msgstr "" -#: ../../library/optparse.rst:1645 +#: ../../library/optparse.rst:1646 msgid "``opt_str``" msgstr "``opt_str``" -#: ../../library/optparse.rst:1646 +#: ../../library/optparse.rst:1647 msgid "" "is the option string seen on the command-line that's triggering the " "callback. (If an abbreviated long option was used, ``opt_str`` will be the " @@ -2602,11 +2602,11 @@ msgid "" "``\"--foobar\"``.)" msgstr "" -#: ../../library/optparse.rst:1652 +#: ../../library/optparse.rst:1653 msgid "``value``" msgstr "``value``" -#: ../../library/optparse.rst:1653 +#: ../../library/optparse.rst:1654 msgid "" "is the argument to this option seen on the command-line. :mod:`optparse` " "will only expect an argument if :attr:`~Option.type` is set; the type of " @@ -2616,21 +2616,21 @@ msgid "" "of values of the appropriate type." msgstr "" -#: ../../library/optparse.rst:1659 +#: ../../library/optparse.rst:1660 msgid "``parser``" msgstr "``parser``" -#: ../../library/optparse.rst:1660 +#: ../../library/optparse.rst:1661 msgid "" "is the OptionParser instance driving the whole thing, mainly useful because " "you can access some other interesting data through its instance attributes:" msgstr "" -#: ../../library/optparse.rst:1663 +#: ../../library/optparse.rst:1664 msgid "``parser.largs``" msgstr "``parser.largs``" -#: ../../library/optparse.rst:1664 +#: ../../library/optparse.rst:1665 msgid "" "the current list of leftover arguments, ie. arguments that have been " "consumed but are neither options nor option arguments. Feel free to modify " @@ -2639,22 +2639,22 @@ msgid "" "parse_args`.)" msgstr "" -#: ../../library/optparse.rst:1669 +#: ../../library/optparse.rst:1670 msgid "``parser.rargs``" msgstr "``parser.rargs``" -#: ../../library/optparse.rst:1670 +#: ../../library/optparse.rst:1671 msgid "" "the current list of remaining arguments, ie. with ``opt_str`` and ``value`` " "(if applicable) removed, and only the arguments following them still there. " "Feel free to modify ``parser.rargs``, e.g. by consuming more arguments." msgstr "" -#: ../../library/optparse.rst:1675 +#: ../../library/optparse.rst:1676 msgid "``parser.values``" msgstr "``parser.values``" -#: ../../library/optparse.rst:1676 +#: ../../library/optparse.rst:1677 msgid "" "the object where option values are by default stored (an instance of " "optparse.OptionValues). This lets callbacks use the same mechanism as the " @@ -2663,27 +2663,27 @@ msgid "" "of any options already encountered on the command-line." msgstr "" -#: ../../library/optparse.rst:1683 +#: ../../library/optparse.rst:1684 msgid "" "is a tuple of arbitrary positional arguments supplied via the :attr:`~Option." "callback_args` option attribute." msgstr "" -#: ../../library/optparse.rst:1686 +#: ../../library/optparse.rst:1687 msgid "``kwargs``" msgstr "``kwargs``" -#: ../../library/optparse.rst:1687 +#: ../../library/optparse.rst:1688 msgid "" "is a dictionary of arbitrary keyword arguments supplied via :attr:`~Option." "callback_kwargs`." msgstr "" -#: ../../library/optparse.rst:1694 +#: ../../library/optparse.rst:1695 msgid "Raising errors in a callback" msgstr "" -#: ../../library/optparse.rst:1696 +#: ../../library/optparse.rst:1697 msgid "" "The callback function should raise :exc:`OptionValueError` if there are any " "problems with the option or its argument(s). :mod:`optparse` catches this " @@ -2693,17 +2693,17 @@ msgid "" "they did wrong." msgstr "" -#: ../../library/optparse.rst:1706 +#: ../../library/optparse.rst:1707 msgid "Callback example 1: trivial callback" msgstr "" -#: ../../library/optparse.rst:1708 +#: ../../library/optparse.rst:1709 msgid "" "Here's an example of a callback option that takes no arguments, and simply " "records that the option was seen::" msgstr "" -#: ../../library/optparse.rst:1711 +#: ../../library/optparse.rst:1712 msgid "" "def record_foo_seen(option, opt_str, value, parser):\n" " parser.values.saw_foo = True\n" @@ -2715,21 +2715,21 @@ msgstr "" "\n" "parser.add_option(\"--foo\", action=\"callback\", callback=record_foo_seen)" -#: ../../library/optparse.rst:1716 +#: ../../library/optparse.rst:1717 msgid "Of course, you could do that with the ``\"store_true\"`` action." msgstr "" -#: ../../library/optparse.rst:1722 +#: ../../library/optparse.rst:1723 msgid "Callback example 2: check option order" msgstr "" -#: ../../library/optparse.rst:1724 +#: ../../library/optparse.rst:1725 msgid "" "Here's a slightly more interesting example: record the fact that ``-a`` is " "seen, but blow up if it comes after ``-b`` in the command-line. ::" msgstr "" -#: ../../library/optparse.rst:1727 +#: ../../library/optparse.rst:1728 msgid "" "def check_order(option, opt_str, value, parser):\n" " if parser.values.b:\n" @@ -2747,18 +2747,18 @@ msgstr "" "parser.add_option(\"-a\", action=\"callback\", callback=check_order)\n" "parser.add_option(\"-b\", action=\"store_true\", dest=\"b\")" -#: ../../library/optparse.rst:1739 +#: ../../library/optparse.rst:1740 msgid "Callback example 3: check option order (generalized)" msgstr "" -#: ../../library/optparse.rst:1741 +#: ../../library/optparse.rst:1742 msgid "" "If you want to reuse this callback for several similar options (set a flag, " "but blow up if ``-b`` has already been seen), it needs a bit of work: the " "error message and the flag that it sets must be generalized. ::" msgstr "" -#: ../../library/optparse.rst:1745 +#: ../../library/optparse.rst:1746 msgid "" "def check_order(option, opt_str, value, parser):\n" " if parser.values.b:\n" @@ -2782,11 +2782,11 @@ msgstr "" "parser.add_option(\"-c\", action=\"callback\", callback=check_order, " "dest='c')" -#: ../../library/optparse.rst:1758 +#: ../../library/optparse.rst:1759 msgid "Callback example 4: check arbitrary condition" msgstr "" -#: ../../library/optparse.rst:1760 +#: ../../library/optparse.rst:1761 msgid "" "Of course, you could put any condition in there---you're not limited to " "checking the values of already-defined options. For example, if you have " @@ -2794,7 +2794,7 @@ msgid "" "is this::" msgstr "" -#: ../../library/optparse.rst:1764 +#: ../../library/optparse.rst:1765 msgid "" "def check_moon(option, opt_str, value, parser):\n" " if is_moon_full():\n" @@ -2814,16 +2814,16 @@ msgstr "" "parser.add_option(\"--foo\",\n" " action=\"callback\", callback=check_moon, dest=\"foo\")" -#: ../../library/optparse.rst:1773 +#: ../../library/optparse.rst:1774 msgid "" "(The definition of ``is_moon_full()`` is left as an exercise for the reader.)" msgstr "" -#: ../../library/optparse.rst:1779 +#: ../../library/optparse.rst:1780 msgid "Callback example 5: fixed arguments" msgstr "" -#: ../../library/optparse.rst:1781 +#: ../../library/optparse.rst:1782 msgid "" "Things get slightly more interesting when you define callback options that " "take a fixed number of arguments. Specifying that a callback option takes " @@ -2833,12 +2833,12 @@ msgid "" "nargs`, then the option takes :attr:`~Option.nargs` arguments." msgstr "" -#: ../../library/optparse.rst:1788 +#: ../../library/optparse.rst:1789 msgid "" "Here's an example that just emulates the standard ``\"store\"`` action::" msgstr "" -#: ../../library/optparse.rst:1790 +#: ../../library/optparse.rst:1791 msgid "" "def store_value(option, opt_str, value, parser):\n" " setattr(parser.values, option.dest, value)\n" @@ -2854,18 +2854,18 @@ msgstr "" " action=\"callback\", callback=store_value,\n" " type=\"int\", nargs=3, dest=\"foo\")" -#: ../../library/optparse.rst:1797 +#: ../../library/optparse.rst:1798 msgid "" "Note that :mod:`optparse` takes care of consuming 3 arguments and converting " "them to integers for you; all you have to do is store them. (Or whatever; " "obviously you don't need a callback for this example.)" msgstr "" -#: ../../library/optparse.rst:1805 +#: ../../library/optparse.rst:1806 msgid "Callback example 6: variable arguments" msgstr "" -#: ../../library/optparse.rst:1807 +#: ../../library/optparse.rst:1808 msgid "" "Things get hairy when you want an option to take a variable number of " "arguments. For this case, you must write a callback, as :mod:`optparse` " @@ -2875,23 +2875,23 @@ msgid "" "implement the conventional rules for bare ``--`` and ``-`` arguments:" msgstr "" -#: ../../library/optparse.rst:1814 +#: ../../library/optparse.rst:1815 msgid "either ``--`` or ``-`` can be option arguments" msgstr "" -#: ../../library/optparse.rst:1816 +#: ../../library/optparse.rst:1817 msgid "" "bare ``--`` (if not the argument to some option): halt command-line " "processing and discard the ``--``" msgstr "" -#: ../../library/optparse.rst:1819 +#: ../../library/optparse.rst:1820 msgid "" "bare ``-`` (if not the argument to some option): halt command-line " "processing but keep the ``-`` (append it to ``parser.largs``)" msgstr "" -#: ../../library/optparse.rst:1822 +#: ../../library/optparse.rst:1823 msgid "" "If you want an option that takes a variable number of arguments, there are " "several subtle, tricky issues to worry about. The exact implementation you " @@ -2900,13 +2900,13 @@ msgid "" "directly)." msgstr "" -#: ../../library/optparse.rst:1828 +#: ../../library/optparse.rst:1829 msgid "" "Nevertheless, here's a stab at a callback for an option with variable " "arguments::" msgstr "" -#: ../../library/optparse.rst:1831 +#: ../../library/optparse.rst:1832 msgid "" "def vararg_callback(option, opt_str, value, parser):\n" " assert value is None\n" @@ -2936,22 +2936,22 @@ msgid "" " action=\"callback\", callback=vararg_callback)" msgstr "" -#: ../../library/optparse.rst:1862 +#: ../../library/optparse.rst:1863 msgid "Extending :mod:`optparse`" msgstr "" -#: ../../library/optparse.rst:1864 +#: ../../library/optparse.rst:1865 msgid "" "Since the two major controlling factors in how :mod:`optparse` interprets " "command-line options are the action and type of each option, the most likely " "direction of extension is to add new actions and new types." msgstr "" -#: ../../library/optparse.rst:1872 +#: ../../library/optparse.rst:1873 msgid "Adding new types" msgstr "" -#: ../../library/optparse.rst:1874 +#: ../../library/optparse.rst:1875 msgid "" "To add new types, you need to define your own subclass of :mod:`optparse`'s :" "class:`Option` class. This class has a couple of attributes that define :" @@ -2959,23 +2959,23 @@ msgid "" "TYPE_CHECKER`." msgstr "" -#: ../../library/optparse.rst:1880 +#: ../../library/optparse.rst:1881 msgid "" "A tuple of type names; in your subclass, simply define a new tuple :attr:" "`TYPES` that builds on the standard one." msgstr "" -#: ../../library/optparse.rst:1885 +#: ../../library/optparse.rst:1886 msgid "" "A dictionary mapping type names to type-checking functions. A type-checking " "function has the following signature::" msgstr "" -#: ../../library/optparse.rst:1888 +#: ../../library/optparse.rst:1889 msgid "def check_mytype(option, opt, value)" msgstr "def check_mytype(option, opt, value)" -#: ../../library/optparse.rst:1890 +#: ../../library/optparse.rst:1891 msgid "" "where ``option`` is an :class:`Option` instance, ``opt`` is an option string " "(e.g., ``-f``), and ``value`` is the string from the command line that must " @@ -2986,7 +2986,7 @@ msgid "" "``value`` parameter." msgstr "" -#: ../../library/optparse.rst:1898 +#: ../../library/optparse.rst:1899 msgid "" "Your type-checking function should raise :exc:`OptionValueError` if it " "encounters any problems. :exc:`OptionValueError` takes a single string " @@ -2995,7 +2995,7 @@ msgid "" "\"`` and prints everything to stderr before terminating the process." msgstr "" -#: ../../library/optparse.rst:1904 +#: ../../library/optparse.rst:1905 msgid "" "Here's a silly example that demonstrates adding a ``\"complex\"`` option " "type to parse Python-style complex numbers on the command line. (This is " @@ -3003,11 +3003,11 @@ msgid "" "support for complex numbers, but never mind.)" msgstr "" -#: ../../library/optparse.rst:1909 +#: ../../library/optparse.rst:1910 msgid "First, the necessary imports::" msgstr "" -#: ../../library/optparse.rst:1911 +#: ../../library/optparse.rst:1912 msgid "" "from copy import copy\n" "from optparse import Option, OptionValueError" @@ -3015,13 +3015,13 @@ msgstr "" "from copy import copy\n" "from optparse import Option, OptionValueError" -#: ../../library/optparse.rst:1914 +#: ../../library/optparse.rst:1915 msgid "" "You need to define your type-checker first, since it's referred to later (in " "the :attr:`~Option.TYPE_CHECKER` class attribute of your Option subclass)::" msgstr "" -#: ../../library/optparse.rst:1917 +#: ../../library/optparse.rst:1918 msgid "" "def check_complex(option, opt, value):\n" " try:\n" @@ -3037,11 +3037,11 @@ msgstr "" " raise OptionValueError(\n" " \"option %s: invalid complex value: %r\" % (opt, value))" -#: ../../library/optparse.rst:1924 +#: ../../library/optparse.rst:1925 msgid "Finally, the Option subclass::" msgstr "" -#: ../../library/optparse.rst:1926 +#: ../../library/optparse.rst:1927 msgid "" "class MyOption (Option):\n" " TYPES = Option.TYPES + (\"complex\",)\n" @@ -3053,7 +3053,7 @@ msgstr "" " TYPE_CHECKER = copy(Option.TYPE_CHECKER)\n" " TYPE_CHECKER[\"complex\"] = check_complex" -#: ../../library/optparse.rst:1931 +#: ../../library/optparse.rst:1932 msgid "" "(If we didn't make a :func:`copy` of :attr:`Option.TYPE_CHECKER`, we would " "end up modifying the :attr:`~Option.TYPE_CHECKER` attribute of :mod:" @@ -3061,14 +3061,14 @@ msgid "" "that except good manners and common sense.)" msgstr "" -#: ../../library/optparse.rst:1936 +#: ../../library/optparse.rst:1937 msgid "" "That's it! Now you can write a script that uses the new option type just " "like any other :mod:`optparse`\\ -based script, except you have to instruct " "your OptionParser to use MyOption instead of Option::" msgstr "" -#: ../../library/optparse.rst:1940 +#: ../../library/optparse.rst:1941 msgid "" "parser = OptionParser(option_class=MyOption)\n" "parser.add_option(\"-c\", type=\"complex\")" @@ -3076,14 +3076,14 @@ msgstr "" "parser = OptionParser(option_class=MyOption)\n" "parser.add_option(\"-c\", type=\"complex\")" -#: ../../library/optparse.rst:1943 +#: ../../library/optparse.rst:1944 msgid "" "Alternately, you can build your own option list and pass it to OptionParser; " "if you don't use :meth:`add_option` in the above way, you don't need to tell " "OptionParser which option class to use::" msgstr "" -#: ../../library/optparse.rst:1947 +#: ../../library/optparse.rst:1948 msgid "" "option_list = [MyOption(\"-c\", action=\"store\", type=\"complex\", " "dest=\"c\")]\n" @@ -3093,32 +3093,32 @@ msgstr "" "dest=\"c\")]\n" "parser = OptionParser(option_list=option_list)" -#: ../../library/optparse.rst:1954 +#: ../../library/optparse.rst:1955 msgid "Adding new actions" msgstr "" -#: ../../library/optparse.rst:1956 +#: ../../library/optparse.rst:1957 msgid "" "Adding new actions is a bit trickier, because you have to understand that :" "mod:`optparse` has a couple of classifications for actions:" msgstr "" -#: ../../library/optparse.rst:1959 +#: ../../library/optparse.rst:1960 msgid "\"store\" actions" msgstr "" -#: ../../library/optparse.rst:1960 +#: ../../library/optparse.rst:1961 msgid "" "actions that result in :mod:`optparse` storing a value to an attribute of " "the current OptionValues instance; these options require a :attr:`~Option." "dest` attribute to be supplied to the Option constructor." msgstr "" -#: ../../library/optparse.rst:1964 +#: ../../library/optparse.rst:1965 msgid "\"typed\" actions" msgstr "" -#: ../../library/optparse.rst:1965 +#: ../../library/optparse.rst:1966 msgid "" "actions that take a value from the command line and expect it to be of a " "certain type; or rather, a string that can be converted to a certain type. " @@ -3126,7 +3126,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/optparse.rst:1970 +#: ../../library/optparse.rst:1971 msgid "" "These are overlapping sets: some default \"store\" actions are " "``\"store\"``, ``\"store_const\"``, ``\"append\"``, and ``\"count\"``, while " @@ -3134,25 +3134,25 @@ msgid "" "``\"callback\"``." msgstr "" -#: ../../library/optparse.rst:1974 +#: ../../library/optparse.rst:1975 msgid "" "When you add an action, you need to categorize it by listing it in at least " "one of the following class attributes of Option (all are lists of strings):" msgstr "" -#: ../../library/optparse.rst:1979 +#: ../../library/optparse.rst:1980 msgid "All actions must be listed in ACTIONS." msgstr "" -#: ../../library/optparse.rst:1983 +#: ../../library/optparse.rst:1984 msgid "\"store\" actions are additionally listed here." msgstr "" -#: ../../library/optparse.rst:1987 +#: ../../library/optparse.rst:1988 msgid "\"typed\" actions are additionally listed here." msgstr "" -#: ../../library/optparse.rst:1991 +#: ../../library/optparse.rst:1992 msgid "" "Actions that always take a type (i.e. whose options always take a value) are " "additionally listed here. The only effect of this is that :mod:`optparse` " @@ -3160,13 +3160,13 @@ msgid "" "whose action is listed in :attr:`ALWAYS_TYPED_ACTIONS`." msgstr "" -#: ../../library/optparse.rst:1996 +#: ../../library/optparse.rst:1997 msgid "" "In order to actually implement your new action, you must override Option's :" "meth:`take_action` method and add a case that recognizes your action." msgstr "" -#: ../../library/optparse.rst:1999 +#: ../../library/optparse.rst:2000 msgid "" "For example, let's add an ``\"extend\"`` action. This is similar to the " "standard ``\"append\"`` action, but instead of taking a single value from " @@ -3176,23 +3176,23 @@ msgid "" "option of type ``\"string\"``, the command line ::" msgstr "" -#: ../../library/optparse.rst:2006 +#: ../../library/optparse.rst:2007 msgid "--names=foo,bar --names blah --names ding,dong" msgstr "--names=foo,bar --names blah --names ding,dong" -#: ../../library/optparse.rst:2008 +#: ../../library/optparse.rst:2009 msgid "would result in a list ::" msgstr "" -#: ../../library/optparse.rst:2010 +#: ../../library/optparse.rst:2011 msgid "[\"foo\", \"bar\", \"blah\", \"ding\", \"dong\"]" msgstr "[\"foo\", \"bar\", \"blah\", \"ding\", \"dong\"]" -#: ../../library/optparse.rst:2012 +#: ../../library/optparse.rst:2013 msgid "Again we define a subclass of Option::" msgstr "" -#: ../../library/optparse.rst:2014 +#: ../../library/optparse.rst:2015 msgid "" "class MyOption(Option):\n" "\n" @@ -3224,43 +3224,43 @@ msgstr "" " Option.take_action(\n" " self, action, dest, opt, value, values, parser)" -#: ../../library/optparse.rst:2029 +#: ../../library/optparse.rst:2030 msgid "Features of note:" msgstr "" -#: ../../library/optparse.rst:2031 +#: ../../library/optparse.rst:2032 msgid "" "``\"extend\"`` both expects a value on the command-line and stores that " "value somewhere, so it goes in both :attr:`~Option.STORE_ACTIONS` and :attr:" "`~Option.TYPED_ACTIONS`." msgstr "" -#: ../../library/optparse.rst:2035 +#: ../../library/optparse.rst:2036 msgid "" "to ensure that :mod:`optparse` assigns the default type of ``\"string\"`` to " "``\"extend\"`` actions, we put the ``\"extend\"`` action in :attr:`~Option." "ALWAYS_TYPED_ACTIONS` as well." msgstr "" -#: ../../library/optparse.rst:2039 +#: ../../library/optparse.rst:2040 msgid "" ":meth:`MyOption.take_action` implements just this one new action, and passes " "control back to :meth:`Option.take_action` for the standard :mod:`optparse` " "actions." msgstr "" -#: ../../library/optparse.rst:2043 +#: ../../library/optparse.rst:2044 msgid "" "``values`` is an instance of the optparse_parser.Values class, which " "provides the very useful :meth:`ensure_value` method. :meth:`ensure_value` " "is essentially :func:`getattr` with a safety valve; it is called as ::" msgstr "" -#: ../../library/optparse.rst:2047 +#: ../../library/optparse.rst:2048 msgid "values.ensure_value(attr, value)" msgstr "values.ensure_value(attr, value)" -#: ../../library/optparse.rst:2049 +#: ../../library/optparse.rst:2050 msgid "" "If the ``attr`` attribute of ``values`` doesn't exist or is ``None``, then " "ensure_value() first sets it to ``value``, and then returns ``value``. This " @@ -3273,28 +3273,28 @@ msgid "" "meth:`ensure_value` will take care of getting it right when it's needed." msgstr "" -#: ../../library/optparse.rst:2060 +#: ../../library/optparse.rst:2061 msgid "Exceptions" msgstr "例外" -#: ../../library/optparse.rst:2064 +#: ../../library/optparse.rst:2065 msgid "" "Raised if an :class:`Option` instance is created with invalid or " "inconsistent arguments." msgstr "" -#: ../../library/optparse.rst:2069 +#: ../../library/optparse.rst:2070 msgid "Raised if conflicting options are added to an :class:`OptionParser`." msgstr "" -#: ../../library/optparse.rst:2073 +#: ../../library/optparse.rst:2074 msgid "Raised if an invalid option value is encountered on the command line." msgstr "" -#: ../../library/optparse.rst:2077 +#: ../../library/optparse.rst:2078 msgid "Raised if an invalid option is passed on the command line." msgstr "" -#: ../../library/optparse.rst:2081 +#: ../../library/optparse.rst:2082 msgid "Raised if an ambiguous option is passed on the command line." msgstr "" diff --git a/library/os.path.po b/library/os.path.po index 50436d3391..7480d8c542 100644 --- a/library/os.path.po +++ b/library/os.path.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-07-13 14:06+0800\n" "Last-Translator: Po-Chuan Chen \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -109,18 +109,18 @@ msgstr "" "func:`normpath` 函式:``normpath(join(os.getcwd(), path))``。" #: ../../library/os.path.rst:63 ../../library/os.path.rst:76 -#: ../../library/os.path.rst:114 ../../library/os.path.rst:123 -#: ../../library/os.path.rst:139 ../../library/os.path.rst:149 -#: ../../library/os.path.rst:175 ../../library/os.path.rst:195 -#: ../../library/os.path.rst:212 ../../library/os.path.rst:224 -#: ../../library/os.path.rst:233 ../../library/os.path.rst:243 -#: ../../library/os.path.rst:253 ../../library/os.path.rst:263 -#: ../../library/os.path.rst:282 ../../library/os.path.rst:301 -#: ../../library/os.path.rst:350 ../../library/os.path.rst:370 -#: ../../library/os.path.rst:393 ../../library/os.path.rst:413 -#: ../../library/os.path.rst:429 ../../library/os.path.rst:440 -#: ../../library/os.path.rst:454 ../../library/os.path.rst:470 -#: ../../library/os.path.rst:495 ../../library/os.path.rst:559 +#: ../../library/os.path.rst:117 ../../library/os.path.rst:126 +#: ../../library/os.path.rst:142 ../../library/os.path.rst:152 +#: ../../library/os.path.rst:178 ../../library/os.path.rst:198 +#: ../../library/os.path.rst:215 ../../library/os.path.rst:227 +#: ../../library/os.path.rst:236 ../../library/os.path.rst:246 +#: ../../library/os.path.rst:260 ../../library/os.path.rst:270 +#: ../../library/os.path.rst:289 ../../library/os.path.rst:308 +#: ../../library/os.path.rst:380 ../../library/os.path.rst:400 +#: ../../library/os.path.rst:423 ../../library/os.path.rst:443 +#: ../../library/os.path.rst:459 ../../library/os.path.rst:470 +#: ../../library/os.path.rst:484 ../../library/os.path.rst:500 +#: ../../library/os.path.rst:525 ../../library/os.path.rst:589 msgid "Accepts a :term:`path-like object`." msgstr "接受一個 :term:`path-like object`。" @@ -138,8 +138,9 @@ msgstr "" "`basename` 函式回傳空字串(``''``)。" #: ../../library/os.path.rst:82 +#, fuzzy msgid "" -"Return the longest common sub-path of each pathname in the sequence " +"Return the longest common sub-path of each pathname in the iterable " "*paths*. Raise :exc:`ValueError` if *paths* contain both absolute and " "relative pathnames, if *paths* are on different drives, or if *paths* is " "empty. Unlike :func:`commonprefix`, this returns a valid path." @@ -152,7 +153,11 @@ msgstr "" msgid "Accepts a sequence of :term:`path-like objects `." msgstr "接受一個\\ :term:`類路徑物件 `\\ 的序列。" -#: ../../library/os.path.rst:96 +#: ../../library/os.path.rst:93 +msgid "Any iterable can now be passed, rather than just sequences." +msgstr "" + +#: ../../library/os.path.rst:99 msgid "" "Return the longest path prefix (taken character-by-character) that is a " "prefix of all paths in *list*. If *list* is empty, return the empty string " @@ -161,7 +166,7 @@ msgstr "" "回傳 *list* 中所有路徑的最長路徑前綴(逐字元比較)。如果 *list* 為空,則回傳" "空字串(``''``)。" -#: ../../library/os.path.rst:102 +#: ../../library/os.path.rst:105 msgid "" "This function may return invalid paths because it works a character at a " "time. To obtain a valid path, see :func:`commonpath`." @@ -169,7 +174,7 @@ msgstr "" "由於此函式是逐字元比較,因此可能會回傳無效的路徑。若要獲得有效的路徑,請參" "考 :func:`commonpath` 函式。" -#: ../../library/os.path.rst:108 +#: ../../library/os.path.rst:111 msgid "" ">>> os.path.commonprefix(['/usr/lib', '/usr/local/lib'])\n" "'/usr/l'\n" @@ -183,7 +188,7 @@ msgstr "" ">>> os.path.commonpath(['/usr/lib', '/usr/local/lib'])\n" "'/usr'" -#: ../../library/os.path.rst:120 +#: ../../library/os.path.rst:123 msgid "" "Return the directory name of pathname *path*. This is the first element of " "the pair returned by passing *path* to the function :func:`split`." @@ -191,7 +196,7 @@ msgstr "" "回傳路徑名 *path* 的目錄名稱。這是將 *path* 傳遞給函式 :func:`split` 後回傳之" "成對結果中的第一個元素。" -#: ../../library/os.path.rst:129 +#: ../../library/os.path.rst:132 msgid "" "Return ``True`` if *path* refers to an existing path or an open file " "descriptor. Returns ``False`` for broken symbolic links. On some " @@ -203,7 +208,7 @@ msgstr "" "的符號連結則回傳 ``False``。在某些平台上,即使 *path* 實際存在,如果未被授予" "執行 :func:`os.stat` 的權限,此函式仍可能回傳 ``False``。" -#: ../../library/os.path.rst:135 +#: ../../library/os.path.rst:138 msgid "" "*path* can now be an integer: ``True`` is returned if it is an open file " "descriptor, ``False`` otherwise." @@ -211,7 +216,7 @@ msgstr "" "現在 *path* 可以是一個整數:如果它是一個開啟的檔案描述器,則回傳 ``True``;否" "則回傳 ``False``。" -#: ../../library/os.path.rst:145 +#: ../../library/os.path.rst:148 msgid "" "Return ``True`` if *path* refers to an existing path, including broken " "symbolic links. Equivalent to :func:`exists` on platforms lacking :func:" @@ -220,7 +225,7 @@ msgstr "" "如果 *path* 是一個存在的路徑則回傳 ``True``,對已損壞的符號連結也是。在缺乏 :" "func:`os.lstat` 的平台上,與 :func:`exists` 函式等效。" -#: ../../library/os.path.rst:157 +#: ../../library/os.path.rst:160 msgid "" "On Unix and Windows, return the argument with an initial component of ``~`` " "or ``~user`` replaced by that *user*'s home directory." @@ -228,7 +233,7 @@ msgstr "" "在 Unix 和 Windows 上,將引數中以 ``~`` 或 ``~user`` 開頭的部分替換為該 " "*user* 的家目錄。" -#: ../../library/os.path.rst:162 +#: ../../library/os.path.rst:165 msgid "" "On Unix, an initial ``~`` is replaced by the environment variable :envvar:" "`HOME` if it is set; otherwise the current user's home directory is looked " @@ -239,7 +244,7 @@ msgstr "" "數的值;否則將使用內建模組 :mod:`pwd` 在密碼目錄中查找當前使用者的家目錄。對" "於初始的 ``~user``,直接在密碼目錄中查找該使用者的家目錄。" -#: ../../library/os.path.rst:167 +#: ../../library/os.path.rst:170 msgid "" "On Windows, :envvar:`USERPROFILE` will be used if set, otherwise a " "combination of :envvar:`HOMEPATH` and :envvar:`HOMEDRIVE` will be used. An " @@ -252,18 +257,18 @@ msgstr "" "當前使用者的家目錄的最後一個目錄元件是否與 :envvar:`USERNAME` 相符,如果相符" "則替換它。" -#: ../../library/os.path.rst:172 +#: ../../library/os.path.rst:175 msgid "" "If the expansion fails or if the path does not begin with a tilde, the path " "is returned unchanged." msgstr "" "如果展開失敗或路徑不以波浪符號 (tilde) 開頭,則回傳原始路徑,不做任何變更。" -#: ../../library/os.path.rst:178 +#: ../../library/os.path.rst:181 msgid "No longer uses :envvar:`HOME` on Windows." msgstr "在 Windows 上不再使用 :envvar:`HOME` 變數。" -#: ../../library/os.path.rst:187 +#: ../../library/os.path.rst:190 msgid "" "Return the argument with environment variables expanded. Substrings of the " "form ``$name`` or ``${name}`` are replaced by the value of environment " @@ -273,7 +278,7 @@ msgstr "" "回傳已展開環境變數的引數。形如 ``$name`` 或 ``${name}`` 的子字串會被替換為環" "境變數 *name* 的值。無效的變數名稱和對不存在變數的引用保持不變。" -#: ../../library/os.path.rst:192 +#: ../../library/os.path.rst:195 msgid "" "On Windows, ``%name%`` expansions are supported in addition to ``$name`` and " "``${name}``." @@ -281,7 +286,7 @@ msgstr "" "在 Windows 上,除了支援 ``$name`` 和 ``${name}`` 形式的展開外,還支援 " "``%name%`` 形式的展開。" -#: ../../library/os.path.rst:201 +#: ../../library/os.path.rst:204 msgid "" "Return the time of last access of *path*. The return value is a floating-" "point number giving the number of seconds since the epoch (see the :mod:" @@ -291,7 +296,7 @@ msgstr "" "回傳 *path* 的最後存取時間。回傳值是一個浮點數,表示自紀元(參見 :mod:`time` " "模組)以來的秒數。如果檔案不存在或無法存取,則引發 :exc:`OSError`。" -#: ../../library/os.path.rst:208 +#: ../../library/os.path.rst:211 msgid "" "Return the time of last modification of *path*. The return value is a " "floating-point number giving the number of seconds since the epoch (see " @@ -301,7 +306,7 @@ msgstr "" "回傳 *path* 的最後修改時間。回傳值是一個浮點數,表示自紀元(參見 :mod:`time` " "模組)以來的秒數。如果檔案不存在或無法存取,則引發 :exc:`OSError`。" -#: ../../library/os.path.rst:218 +#: ../../library/os.path.rst:221 msgid "" "Return the system's ctime which, on some systems (like Unix) is the time of " "the last metadata change, and, on others (like Windows), is the creation " @@ -314,7 +319,7 @@ msgstr "" "數,表示自紀元(參見 :mod:`time` 模組)以來的秒數。如果檔案不存在或無法存" "取),則引發 :exc:`OSError`。" -#: ../../library/os.path.rst:230 +#: ../../library/os.path.rst:233 msgid "" "Return the size, in bytes, of *path*. Raise :exc:`OSError` if the file does " "not exist or is inaccessible." @@ -322,17 +327,24 @@ msgstr "" "回傳 *path* 的大小(以位元組為單位)。如果檔案不存在或無法存取,則引發 :exc:" "`OSError`。" -#: ../../library/os.path.rst:239 +#: ../../library/os.path.rst:242 +#, fuzzy msgid "" "Return ``True`` if *path* is an absolute pathname. On Unix, that means it " -"begins with a slash, on Windows that it begins with a (back)slash after " -"chopping off a potential drive letter." +"begins with a slash, on Windows that it begins with two (back)slashes, or a " +"drive letter, colon, and (back)slash together." msgstr "" "如果 *path* 是絕對路徑名,則回傳 ``True``。在 Unix 上,這表示它以斜線開頭;" "在 Windows 上,表示在去除可能的驅動機字母後,以(反)斜線開頭。" #: ../../library/os.path.rst:249 msgid "" +"On Windows, returns ``False`` if the given path starts with exactly one " +"(back)slash." +msgstr "" + +#: ../../library/os.path.rst:256 +msgid "" "Return ``True`` if *path* is an :func:`existing ` regular file. This " "follows symbolic links, so both :func:`islink` and :func:`isfile` can be " "true for the same path." @@ -341,7 +353,7 @@ msgstr "" "這將跟隨符號連結,因此同一個路徑可以同時回傳 :func:`islink` 和 :func:" "`isfile` 的結果為真。" -#: ../../library/os.path.rst:259 +#: ../../library/os.path.rst:266 msgid "" "Return ``True`` if *path* is an :func:`existing ` directory. This " "follows symbolic links, so both :func:`islink` and :func:`isdir` can be true " @@ -351,7 +363,7 @@ msgstr "" "跟隨符號連結,因此同一個路徑可以同時回傳 :func:`islink` 和 :func:`isfile` 的" "結果為真。" -#: ../../library/os.path.rst:269 +#: ../../library/os.path.rst:276 msgid "" "Return ``True`` if *path* refers to an :func:`existing ` directory " "entry that is a junction. Always return ``False`` if junctions are not " @@ -360,7 +372,7 @@ msgstr "" "如果 *path* 是指向\\ :func:`已存在的 `\\ 目錄條目且為聯接點 " "(junction),則回傳 ``True``。如果目前平台不支援聯接點,則始終返回 ``False``。" -#: ../../library/os.path.rst:278 +#: ../../library/os.path.rst:285 msgid "" "Return ``True`` if *path* refers to an :func:`existing ` directory " "entry that is a symbolic link. Always ``False`` if symbolic links are not " @@ -369,7 +381,7 @@ msgstr "" "如果 *path* 是指向\\ :func:`已存在的 `\\ 目錄項目且為符號連結,則回" "傳 ``True``。如果 Python 執行時不支援符號連結,則始終回傳 ``False``。" -#: ../../library/os.path.rst:288 +#: ../../library/os.path.rst:295 msgid "" "Return ``True`` if pathname *path* is a :dfn:`mount point`: a point in a " "file system where a different file system has been mounted. On POSIX, the " @@ -389,11 +401,11 @@ msgstr "" "上,以驅動機字母開頭的根目錄和 UNC 共享路徑始終是掛載點,對於任何其他路徑,會" "呼叫 ``GetVolumePathName`` 函式來檢查它是否與輸入路徑不同。" -#: ../../library/os.path.rst:298 +#: ../../library/os.path.rst:305 msgid "Added support for detecting non-root mount points on Windows." msgstr "新增在 Windows 上檢測非根目錄掛載點的支援。" -#: ../../library/os.path.rst:307 +#: ../../library/os.path.rst:314 msgid "" "Return ``True`` if pathname *path* is located on a Windows Dev Drive. A Dev " "Drive is optimized for developer scenarios, and offers faster performance " @@ -405,7 +417,7 @@ msgstr "" "開發人員場景進行了優化,提供更快的讀寫檔案性能。建議將其用於原始程式碼、臨時" "建置目錄、封包快取和其他 I/O 密集型操作。" -#: ../../library/os.path.rst:313 +#: ../../library/os.path.rst:320 msgid "" "May raise an error for an invalid path, for example, one without a " "recognizable drive, but returns ``False`` on platforms that do not support " @@ -416,11 +428,38 @@ msgstr "" "碟機的平台上返回 ``False``。請參閱 `Windows 文件 `_\\ 以了解有關啟用和建立 Dev 驅動機的資訊。" -#: ../../library/os.path.rst:318 +#: ../../library/os.path.rst:327 +msgid "" +"The function is now available on all platforms, and will always return " +"``False`` on those that have no support for Dev Drives" +msgstr "" + +#: ../../library/os.path.rst:333 +msgid "Return ``True`` if *path* is a reserved pathname on the current system." +msgstr "" + +#: ../../library/os.path.rst:335 +msgid "" +"On Windows, reserved filenames include those that end with a space or dot; " +"those that contain colons (i.e. file streams such as \"name:stream\"), " +"wildcard characters (i.e. ``'*?\"<>'``), pipe, or ASCII control characters; " +"as well as DOS device names such as \"NUL\", \"CON\", \"CONIN$\", \"CONOUT$" +"\", \"AUX\", \"PRN\", \"COM1\", and \"LPT1\"." +msgstr "" + +#: ../../library/os.path.rst:343 +msgid "" +"This function approximates rules for reserved paths on most Windows systems. " +"These rules change over time in various Windows releases. This function may " +"be updated in future Python releases as changes to the rules become broadly " +"available." +msgstr "" + +#: ../../library/os.path.rst:348 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/os.path.rst:325 +#: ../../library/os.path.rst:355 msgid "" "Join one or more path segments intelligently. The return value is the " "concatenation of *path* and all members of *\\*paths*, with exactly one " @@ -435,7 +474,7 @@ msgstr "" "個部分為空或以分隔符號結尾,結果只會以分隔符號結尾。如果一個段是絕對路徑(在 " "Windows 上需要驅動機和根),則忽略所有之前的段,並從絕對路徑段繼續連接。" -#: ../../library/os.path.rst:333 +#: ../../library/os.path.rst:363 msgid "" "On Windows, the drive is not reset when a rooted path segment (e.g., " "``r'\\foo'``) is encountered. If a segment is on a different drive or is an " @@ -450,11 +489,11 @@ msgstr "" "對於驅動機 :file:`C:` 的當前目錄的路徑(即 :file:`c:foo`),而不是 :file:`c:" "\\\\foo`。" -#: ../../library/os.path.rst:340 +#: ../../library/os.path.rst:370 msgid "Accepts a :term:`path-like object` for *path* and *paths*." msgstr "*path* 和 *paths* 接受 :term:`path-like object` 作為參數。" -#: ../../library/os.path.rst:346 +#: ../../library/os.path.rst:376 msgid "" "Normalize the case of a pathname. On Windows, convert all characters in the " "pathname to lowercase, and also convert forward slashes to backward slashes. " @@ -463,7 +502,7 @@ msgstr "" "將路徑名的大小寫規範化。在 Windows 上,將路徑名中的所有字元轉換為小寫,並將正" "斜線轉換為反斜線。在其他作業系統上,回傳原始路徑。" -#: ../../library/os.path.rst:356 +#: ../../library/os.path.rst:386 msgid "" "Normalize a pathname by collapsing redundant separators and up-level " "references so that ``A//B``, ``A/B/``, ``A/./B`` and ``A/foo/../B`` all " @@ -476,7 +515,7 @@ msgstr "" "結的路徑的含義。在 Windows 上,它將正斜線轉換為反斜線。要標準化大小寫,請使" "用 :func:`normcase`。" -#: ../../library/os.path.rst:363 +#: ../../library/os.path.rst:393 msgid "" "On POSIX systems, in accordance with `IEEE Std 1003.1 2013 Edition; 4.13 " "Pathname Resolution >> splitdrive(\"c:/dir\")\n" "(\"c:\", \"/dir\")" @@ -638,12 +680,12 @@ msgstr "" ">>> splitdrive(\"c:/dir\")\n" "(\"c:\", \"/dir\")" -#: ../../library/os.path.rst:489 +#: ../../library/os.path.rst:519 msgid "" "If the path contains a UNC path, drive will contain the host name and share::" msgstr "如果路徑包含 UNC 路徑,則驅動機將包含主機名和共享名: ::" -#: ../../library/os.path.rst:492 +#: ../../library/os.path.rst:522 msgid "" ">>> splitdrive(\"//host/computer/dir\")\n" "(\"//host/computer\", \"/dir\")" @@ -651,7 +693,7 @@ msgstr "" ">>> splitdrive(\"//host/computer/dir\")\n" "(\"//host/computer\", \"/dir\")" -#: ../../library/os.path.rst:501 +#: ../../library/os.path.rst:531 msgid "" "Split the pathname *path* into a 3-item tuple ``(drive, root, tail)`` where " "*drive* is a device name or mount point, *root* is a string of separators " @@ -664,7 +706,7 @@ msgstr "" "這些項目中的任何一個都可能是空字串。在所有情況下,``drive + root + tail`` 將" "與 *path* 相同。" -#: ../../library/os.path.rst:507 +#: ../../library/os.path.rst:537 msgid "" "On POSIX systems, *drive* is always empty. The *root* may be empty (if " "*path* is relative), a single forward slash (if *path* is absolute), or two " @@ -678,7 +720,7 @@ msgstr "" "onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>`_ 的實作定義)。例" "如: ::" -#: ../../library/os.path.rst:513 +#: ../../library/os.path.rst:543 msgid "" ">>> splitroot('/home/sam')\n" "('', '/', 'home/sam')\n" @@ -694,7 +736,7 @@ msgstr "" ">>> splitroot('///home/sam')\n" "('', '/', '//home/sam')" -#: ../../library/os.path.rst:520 +#: ../../library/os.path.rst:550 msgid "" "On Windows, *drive* may be empty, a drive-letter name, a UNC share, or a " "device name. The *root* may be empty, a forward slash, or a backward slash. " @@ -703,7 +745,7 @@ msgstr "" "在 Windows 上,*drive* 可能為空、驅動機名稱、UNC 共享或設備名稱。*root* 可能" "為空,斜線或反斜線。例如: ::" -#: ../../library/os.path.rst:524 +#: ../../library/os.path.rst:554 msgid "" ">>> splitroot('C:/Users/Sam')\n" "('C:', '/', 'Users/Sam')\n" @@ -715,7 +757,7 @@ msgstr "" ">>> splitroot('//Server/Share/Users/Sam')\n" "('//Server/Share', '/', 'Users/Sam')" -#: ../../library/os.path.rst:534 +#: ../../library/os.path.rst:564 msgid "" "Split the pathname *path* into a pair ``(root, ext)`` such that ``root + " "ext == path``, and the extension, *ext*, is empty or begins with a period " @@ -724,11 +766,11 @@ msgstr "" "將路徑名 *path* 拆分為一對 ``(root, ext)``,使得 ``root + ext == path``,且副" "檔名 *ext* 為空或以點開頭且最多包含一個點 (period)。" -#: ../../library/os.path.rst:538 +#: ../../library/os.path.rst:568 msgid "If the path contains no extension, *ext* will be ``''``::" msgstr "如果路徑不包含副檔名,則 *ext* 將為 ``''``: ::" -#: ../../library/os.path.rst:540 +#: ../../library/os.path.rst:570 msgid "" ">>> splitext('bar')\n" "('bar', '')" @@ -736,7 +778,7 @@ msgstr "" ">>> splitext('bar')\n" "('bar', '')" -#: ../../library/os.path.rst:543 +#: ../../library/os.path.rst:573 msgid "" "If the path contains an extension, then *ext* will be set to this extension, " "including the leading period. Note that previous periods will be ignored::" @@ -744,7 +786,7 @@ msgstr "" "如果路徑包含副檔名,則 *ext* 將設置為該副檔名,包括前導的點。請注意,前面的點" "將被忽略: ::" -#: ../../library/os.path.rst:546 +#: ../../library/os.path.rst:576 msgid "" ">>> splitext('foo.bar.exe')\n" "('foo.bar', '.exe')\n" @@ -756,13 +798,13 @@ msgstr "" ">>> splitext('/foo/bar.exe')\n" "('/foo/bar', '.exe')" -#: ../../library/os.path.rst:551 +#: ../../library/os.path.rst:581 msgid "" "Leading periods of the last component of the path are considered to be part " "of the root::" msgstr "路徑的最後一個部份的前導點被認為是根的一部分: ::" -#: ../../library/os.path.rst:554 +#: ../../library/os.path.rst:584 msgid "" ">>> splitext('.cshrc')\n" "('.cshrc', '')\n" @@ -774,7 +816,7 @@ msgstr "" ">>> splitext('/foo/....jpg')\n" "('/foo/....jpg', '')" -#: ../../library/os.path.rst:565 +#: ../../library/os.path.rst:595 msgid "" "``True`` if arbitrary Unicode strings can be used as file names (within " "limitations imposed by the file system)." @@ -790,34 +832,34 @@ msgstr "path(路徑)" msgid "operations" msgstr "operations(操作)" -#: ../../library/os.path.rst:153 +#: ../../library/os.path.rst:156 msgid "~ (tilde)" msgstr "~ (波浪號)" -#: ../../library/os.path.rst:153 +#: ../../library/os.path.rst:156 msgid "home directory expansion" msgstr "home directory expansion(家目錄展開)" -#: ../../library/os.path.rst:160 +#: ../../library/os.path.rst:163 msgid "module" msgstr "module(模組)" -#: ../../library/os.path.rst:160 +#: ../../library/os.path.rst:163 msgid "pwd" msgstr "pwd" -#: ../../library/os.path.rst:181 +#: ../../library/os.path.rst:184 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/os.path.rst:181 +#: ../../library/os.path.rst:184 msgid "environment variables expansion" msgstr "environment variables expansion(環境變數展開)" -#: ../../library/os.path.rst:181 +#: ../../library/os.path.rst:184 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/os.path.rst:181 +#: ../../library/os.path.rst:184 msgid "environment variables expansion (Windows)" msgstr "environment variables expansion (Windows)(環境變數展開 (Windows))" diff --git a/library/os.po b/library/os.po index 3b3f140719..e840cd0740 100644 --- a/library/os.po +++ b/library/os.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-04-29 15:24+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -83,18 +83,18 @@ msgstr "在 VxWorks, 不支援 os.popen、os.fork、os.execv 和 os.spawn*p*。" #: ../../library/os.rst:37 msgid "" -"On WebAssembly platforms ``wasm32-emscripten`` and ``wasm32-wasi``, large " -"parts of the :mod:`os` module are not available or behave differently. API " -"related to processes (e.g. :func:`~os.fork`, :func:`~os.execve`), signals (e." -"g. :func:`~os.kill`, :func:`~os.wait`), and resources (e.g. :func:`~os." +"On WebAssembly platforms, Android and iOS, large parts of the :mod:`os` " +"module are not available or behave differently. APIs related to processes (e." +"g. :func:`~os.fork`, :func:`~os.execve`) and resources (e.g. :func:`~os." "nice`) are not available. Others like :func:`~os.getuid` and :func:`~os." -"getpid` are emulated or stubs." +"getpid` are emulated or stubs. WebAssembly platforms also lack support for " +"signals (e.g. :func:`~os.kill`, :func:`~os.wait`)." msgstr "" -"在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上,大部分 :mod:" -"`os` 模組無法使用或行為不同。與行程(Process)(例如 :func:`~os.fork`、:func:" -"`~os.execve`\\ )、訊號(例如 :func:`~os.kill`、:func:`~os.wait`\\ ),與資源" +"在 WebAssembly 平台和 Android 與 iOS 上,大部分 :mod:`os` 模組無法使用或行為" +"不同。與行程 (process)(例如 :func:`~os.fork`、:func:`~os.execve`\\ )與資源" "(例如 :func:`~os.nice`\\ )相關的 API 不可使用。其他諸如 :func:`~os.getuid` " -"和 :func:`~os.getpid` 的相關 API 是 emulated 或 stubs。" +"和 :func:`~os.getpid` 的相關 API 是 emulated 或 stubs。WebAssembly 平台也缺少" +"訊號相關支援(例如 :func:`~os.kill`、:func:`~os.wait`\\ )。" #: ../../library/os.rst:47 msgid "" @@ -308,40 +308,27 @@ msgstr "" #: ../../library/os.rst:181 ../../library/os.rst:358 ../../library/os.rst:367 #: ../../library/os.rst:389 ../../library/os.rst:398 ../../library/os.rst:434 #: ../../library/os.rst:442 ../../library/os.rst:480 ../../library/os.rst:491 -#: ../../library/os.rst:512 ../../library/os.rst:522 ../../library/os.rst:545 -#: ../../library/os.rst:579 ../../library/os.rst:586 ../../library/os.rst:593 -#: ../../library/os.rst:602 ../../library/os.rst:652 ../../library/os.rst:661 -#: ../../library/os.rst:678 ../../library/os.rst:687 ../../library/os.rst:694 -#: ../../library/os.rst:703 ../../library/os.rst:712 ../../library/os.rst:719 -#: ../../library/os.rst:726 ../../library/os.rst:735 ../../library/os.rst:1161 -#: ../../library/os.rst:1345 ../../library/os.rst:1371 -#: ../../library/os.rst:1608 ../../library/os.rst:1628 -#: ../../library/os.rst:1637 ../../library/os.rst:2021 -#: ../../library/os.rst:2110 ../../library/os.rst:2150 -#: ../../library/os.rst:2440 ../../library/os.rst:2462 -#: ../../library/os.rst:4043 ../../library/os.rst:4050 -#: ../../library/os.rst:4057 ../../library/os.rst:4064 -#: ../../library/os.rst:4071 ../../library/os.rst:4078 -#: ../../library/os.rst:4085 ../../library/os.rst:4093 -#: ../../library/os.rst:4101 ../../library/os.rst:4108 -#: ../../library/os.rst:4115 ../../library/os.rst:4124 -#: ../../library/os.rst:4132 ../../library/os.rst:4140 -#: ../../library/os.rst:4147 ../../library/os.rst:4154 -#: ../../library/os.rst:4230 ../../library/os.rst:4270 -#: ../../library/os.rst:4277 ../../library/os.rst:4307 -#: ../../library/os.rst:4434 ../../library/os.rst:4483 -#: ../../library/os.rst:4720 ../../library/os.rst:4754 -#: ../../library/os.rst:4815 ../../library/os.rst:4829 -#: ../../library/os.rst:4846 ../../library/os.rst:4861 -#: ../../library/os.rst:4872 ../../library/os.rst:4884 -#: ../../library/os.rst:4897 ../../library/os.rst:4906 -#: ../../library/os.rst:4916 ../../library/os.rst:4929 -#: ../../library/os.rst:4980 ../../library/os.rst:4991 -#: ../../library/os.rst:5003 ../../library/os.rst:5010 -#: ../../library/os.rst:5019 ../../library/os.rst:5028 -#: ../../library/os.rst:5037 ../../library/os.rst:5046 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." -msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" +#: ../../library/os.rst:512 ../../library/os.rst:522 ../../library/os.rst:602 +#: ../../library/os.rst:652 ../../library/os.rst:661 ../../library/os.rst:678 +#: ../../library/os.rst:719 ../../library/os.rst:726 ../../library/os.rst:1139 +#: ../../library/os.rst:1183 ../../library/os.rst:1367 +#: ../../library/os.rst:1393 ../../library/os.rst:1463 +#: ../../library/os.rst:1535 ../../library/os.rst:1662 +#: ../../library/os.rst:1682 ../../library/os.rst:1691 +#: ../../library/os.rst:1772 ../../library/os.rst:1780 +#: ../../library/os.rst:1800 ../../library/os.rst:2087 +#: ../../library/os.rst:2221 ../../library/os.rst:2514 +#: ../../library/os.rst:2536 ../../library/os.rst:4330 +#: ../../library/os.rst:4337 ../../library/os.rst:4344 +#: ../../library/os.rst:4351 ../../library/os.rst:4358 +#: ../../library/os.rst:4365 ../../library/os.rst:4372 +#: ../../library/os.rst:4380 ../../library/os.rst:4388 +#: ../../library/os.rst:4395 ../../library/os.rst:4402 +#: ../../library/os.rst:4411 ../../library/os.rst:4419 +#: ../../library/os.rst:4427 ../../library/os.rst:4434 +#: ../../library/os.rst:4441 ../../library/os.rst:4564 +msgid ":ref:`Availability `: Unix, not WASI." +msgstr ":ref:`適用 `:Unix、非 WASI。" #: ../../library/os.rst:186 msgid "" @@ -494,13 +481,14 @@ msgid "" "like to use a different encoding." msgstr "" -#: ../../library/os.rst:322 ../../library/os.rst:1086 ../../library/os.rst:1097 -#: ../../library/os.rst:1110 ../../library/os.rst:1357 -#: ../../library/os.rst:1649 ../../library/os.rst:1797 -#: ../../library/os.rst:2540 ../../library/os.rst:3382 -#: ../../library/os.rst:3419 ../../library/os.rst:4035 -#: ../../library/os.rst:4571 ../../library/os.rst:4582 -#: ../../library/os.rst:4699 +#: ../../library/os.rst:322 ../../library/os.rst:1009 ../../library/os.rst:1094 +#: ../../library/os.rst:1105 ../../library/os.rst:1118 +#: ../../library/os.rst:1379 ../../library/os.rst:1703 +#: ../../library/os.rst:1864 ../../library/os.rst:2271 +#: ../../library/os.rst:2614 ../../library/os.rst:3456 +#: ../../library/os.rst:3493 ../../library/os.rst:4322 +#: ../../library/os.rst:4871 ../../library/os.rst:4882 +#: ../../library/os.rst:4999 msgid ":ref:`Availability `: Unix, Windows." msgstr ":ref:`適用 `:Unix、Windows。" @@ -520,20 +508,20 @@ msgid "" msgstr "" #: ../../library/os.rst:337 ../../library/os.rst:376 ../../library/os.rst:533 -#: ../../library/os.rst:787 ../../library/os.rst:1004 ../../library/os.rst:1019 -#: ../../library/os.rst:1030 ../../library/os.rst:1053 -#: ../../library/os.rst:1074 ../../library/os.rst:1138 -#: ../../library/os.rst:1150 ../../library/os.rst:1396 -#: ../../library/os.rst:1411 ../../library/os.rst:1424 -#: ../../library/os.rst:1493 ../../library/os.rst:1708 -#: ../../library/os.rst:1735 ../../library/os.rst:1770 -#: ../../library/os.rst:2093 ../../library/os.rst:2124 -#: ../../library/os.rst:2181 ../../library/os.rst:2506 -#: ../../library/os.rst:2518 ../../library/os.rst:3248 -#: ../../library/os.rst:3405 ../../library/os.rst:3638 -#: ../../library/os.rst:5194 ../../library/os.rst:5203 -#: ../../library/os.rst:5224 ../../library/os.rst:5234 -#: ../../library/os.rst:5243 +#: ../../library/os.rst:792 ../../library/os.rst:1027 ../../library/os.rst:1038 +#: ../../library/os.rst:1061 ../../library/os.rst:1082 +#: ../../library/os.rst:1160 ../../library/os.rst:1172 +#: ../../library/os.rst:1403 ../../library/os.rst:1418 +#: ../../library/os.rst:1433 ../../library/os.rst:1446 +#: ../../library/os.rst:1547 ../../library/os.rst:1762 +#: ../../library/os.rst:1789 ../../library/os.rst:1837 +#: ../../library/os.rst:2164 ../../library/os.rst:2195 +#: ../../library/os.rst:2255 ../../library/os.rst:2580 +#: ../../library/os.rst:2592 ../../library/os.rst:3322 +#: ../../library/os.rst:3479 ../../library/os.rst:3712 +#: ../../library/os.rst:5496 ../../library/os.rst:5505 +#: ../../library/os.rst:5529 ../../library/os.rst:5556 +#: ../../library/os.rst:5565 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" @@ -562,8 +550,8 @@ msgstr "" #: ../../library/os.rst:378 ../../library/os.rst:451 ../../library/os.rst:535 #: ../../library/os.rst:758 msgid "" -"The function is a stub on Emscripten and WASI, see :ref:`wasm-availability` " -"for more information." +"The function is a stub on WASI, see :ref:`wasm-availability` for more " +"information." msgstr "" #: ../../library/os.rst:384 @@ -605,13 +593,9 @@ msgid "" "getpwuid(os.getuid())[0]`` to get the login name of the current real user id." msgstr "" -#: ../../library/os.rst:426 ../../library/os.rst:462 ../../library/os.rst:4000 -#: ../../library/os.rst:4254 ../../library/os.rst:4552 -#: ../../library/os.rst:4676 ../../library/os.rst:4795 -#: ../../library/os.rst:4964 -msgid "" -":ref:`Availability `: Unix, Windows, not Emscripten, not WASI." -msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten、非 WASI。" +#: ../../library/os.rst:426 ../../library/os.rst:462 +msgid ":ref:`Availability `: Unix, Windows, not WASI." +msgstr ":ref:`適用 `:Unix、Windows、非 WASI。" #: ../../library/os.rst:431 msgid "" @@ -681,6 +665,13 @@ msgid "" "group id." msgstr "" +#: ../../library/os.rst:545 ../../library/os.rst:579 ../../library/os.rst:586 +#: ../../library/os.rst:593 ../../library/os.rst:687 ../../library/os.rst:694 +#: ../../library/os.rst:703 ../../library/os.rst:712 ../../library/os.rst:735 +#: ../../library/os.rst:2181 +msgid ":ref:`Availability `: Unix, not WASI, not Android." +msgstr ":ref:`適用 `:Unix、非 WASI、非 Android。" + #: ../../library/os.rst:554 msgid "" "Set the environment variable named *key* to the string *value*. Such " @@ -916,20 +907,28 @@ msgid "" "or even ``socket.gethostbyaddr(socket.gethostname())``." msgstr "" -#: ../../library/os.rst:789 ../../library/os.rst:4701 +#: ../../library/os.rst:787 +msgid "" +"On macOS, iOS and Android, this returns the *kernel* name and version (i.e., " +"``'Darwin'`` on macOS and iOS; ``'Linux'`` on Android). :func:`platform." +"uname` can be used to get the user-facing operating system name and version " +"on iOS and Android." +msgstr "" + +#: ../../library/os.rst:794 ../../library/os.rst:5001 msgid "" "Return type changed from a tuple to a tuple-like object with named " "attributes." msgstr "" -#: ../../library/os.rst:798 +#: ../../library/os.rst:803 msgid "" "Unset (delete) the environment variable named *key*. Such changes to the " "environment affect subprocesses started with :func:`os.system`, :func:" "`popen` or :func:`fork` and :func:`execv`." msgstr "" -#: ../../library/os.rst:802 +#: ../../library/os.rst:807 msgid "" "Deletion of items in :data:`os.environ` is automatically translated into a " "corresponding call to :func:`unsetenv`; however, calls to :func:`unsetenv` " @@ -937,18 +936,18 @@ msgid "" "items of :data:`os.environ`." msgstr "" -#: ../../library/os.rst:807 +#: ../../library/os.rst:812 msgid "" "Raises an :ref:`auditing event ` ``os.unsetenv`` with argument " "``key``." msgstr "" "引發一個附帶引數 ``key`` 的\\ :ref:`稽核事件 ` ``os.unsetenv``。" -#: ../../library/os.rst:809 +#: ../../library/os.rst:814 msgid "The function is now always available and is also available on Windows." msgstr "" -#: ../../library/os.rst:815 +#: ../../library/os.rst:820 msgid "" "Disassociate parts of the process execution context, and move them into a " "newly created namespace. See the :manpage:`unshare(2)` man page for more " @@ -959,32 +958,32 @@ msgid "" "are made to the calling process's execution context." msgstr "" -#: ../../library/os.rst:826 +#: ../../library/os.rst:831 msgid ":ref:`Availability `: Linux >= 2.6.16." msgstr ":ref:`適用 `:Linux 2.6.16 以上。" -#: ../../library/os.rst:832 +#: ../../library/os.rst:837 msgid "The :func:`~os.setns` function." msgstr ":func:`~os.setns` 函式。" -#: ../../library/os.rst:836 +#: ../../library/os.rst:841 msgid "" "Flags to the :func:`unshare` function, if the implementation supports them. " "See :manpage:`unshare(2)` in the Linux manual for their exact effect and " "availability." msgstr "" -#: ../../library/os.rst:859 +#: ../../library/os.rst:864 msgid "File Object Creation" msgstr "" -#: ../../library/os.rst:861 +#: ../../library/os.rst:866 msgid "" "These functions create new :term:`file objects `. (See also :" "func:`~os.open` for opening file descriptors.)" msgstr "" -#: ../../library/os.rst:867 +#: ../../library/os.rst:872 msgid "" "Return an open file object connected to the file descriptor *fd*. This is " "an alias of the :func:`open` built-in function and accepts the same " @@ -992,16 +991,16 @@ msgid "" "must always be an integer." msgstr "" -#: ../../library/os.rst:876 +#: ../../library/os.rst:881 msgid "File Descriptor Operations" msgstr "" -#: ../../library/os.rst:878 +#: ../../library/os.rst:883 msgid "" "These functions operate on I/O streams referenced using file descriptors." msgstr "" -#: ../../library/os.rst:880 +#: ../../library/os.rst:885 msgid "" "File descriptors are small integers corresponding to a file that has been " "opened by the current process. For example, standard input is usually file " @@ -1011,7 +1010,7 @@ msgid "" "pipes are also referenced by file descriptors." msgstr "" -#: ../../library/os.rst:887 +#: ../../library/os.rst:892 msgid "" "The :meth:`~io.IOBase.fileno` method can be used to obtain the file " "descriptor associated with a :term:`file object` when required. Note that " @@ -1019,11 +1018,11 @@ msgid "" "ignoring aspects such as internal buffering of data." msgstr "" -#: ../../library/os.rst:895 +#: ../../library/os.rst:900 msgid "Close file descriptor *fd*." msgstr "" -#: ../../library/os.rst:899 +#: ../../library/os.rst:904 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To close a " @@ -1031,13 +1030,13 @@ msgid "" "`popen` or :func:`fdopen`, use its :meth:`~io.IOBase.close` method." msgstr "" -#: ../../library/os.rst:907 +#: ../../library/os.rst:912 msgid "" "Close all file descriptors from *fd_low* (inclusive) to *fd_high* " "(exclusive), ignoring errors. Equivalent to (but much faster than)::" msgstr "" -#: ../../library/os.rst:910 +#: ../../library/os.rst:915 msgid "" "for fd in range(fd_low, fd_high):\n" " try:\n" @@ -1051,7 +1050,7 @@ msgstr "" " except OSError:\n" " pass" -#: ../../library/os.rst:919 +#: ../../library/os.rst:924 msgid "" "Copy *count* bytes from file descriptor *src*, starting from offset " "*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " @@ -1059,14 +1058,14 @@ msgid "" "respectively for *offset_dst*." msgstr "" -#: ../../library/os.rst:924 +#: ../../library/os.rst:929 msgid "" "In Linux kernel older than 5.3, the files pointed to by *src* and *dst* must " "reside in the same filesystem, otherwise an :exc:`OSError` is raised with :" "attr:`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" -#: ../../library/os.rst:928 +#: ../../library/os.rst:933 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -1076,19 +1075,19 @@ msgid "" "(in the case of NFS)." msgstr "" -#: ../../library/os.rst:935 +#: ../../library/os.rst:940 msgid "" "The function copies bytes between two file descriptors. Text options, like " "the encoding and the line ending, are ignored." msgstr "" -#: ../../library/os.rst:938 +#: ../../library/os.rst:943 msgid "" "The return value is the amount of bytes copied. This could be less than the " "amount requested." msgstr "" -#: ../../library/os.rst:943 +#: ../../library/os.rst:948 msgid "" "On Linux, :func:`os.copy_file_range` should not be used for copying a range " "of a pseudo file from a special filesystem like procfs and sysfs. It will " @@ -1096,47 +1095,47 @@ msgid "" "known Linux kernel issue." msgstr "" -#: ../../library/os.rst:948 +#: ../../library/os.rst:953 msgid ":ref:`Availability `: Linux >= 4.5 with glibc >= 2.27." msgstr ":ref:`適用 `:Linux 4.5 以上且具有 glibc 2.27 以上。" -#: ../../library/os.rst:955 +#: ../../library/os.rst:960 msgid "" "Return a string describing the encoding of the device associated with *fd* " "if it is connected to a terminal; else return :const:`None`." msgstr "" -#: ../../library/os.rst:958 +#: ../../library/os.rst:963 msgid "" "On Unix, if the :ref:`Python UTF-8 Mode ` is enabled, return " "``'UTF-8'`` rather than the device encoding." msgstr "" -#: ../../library/os.rst:961 +#: ../../library/os.rst:966 msgid "On Unix, the function now implements the Python UTF-8 Mode." msgstr "" -#: ../../library/os.rst:967 +#: ../../library/os.rst:972 msgid "" "Return a duplicate of file descriptor *fd*. The new file descriptor is :ref:" "`non-inheritable `." msgstr "" -#: ../../library/os.rst:970 +#: ../../library/os.rst:975 msgid "" "On Windows, when duplicating a standard stream (0: stdin, 1: stdout, 2: " "stderr), the new file descriptor is :ref:`inheritable `." msgstr "" -#: ../../library/os.rst:974 ../../library/os.rst:987 +#: ../../library/os.rst:979 ../../library/os.rst:992 msgid ":ref:`Availability `: not WASI." msgstr ":ref:`適用 `:非 WASI。" -#: ../../library/os.rst:976 ../../library/os.rst:1244 +#: ../../library/os.rst:981 ../../library/os.rst:1266 msgid "The new file descriptor is now non-inheritable." msgstr "" -#: ../../library/os.rst:982 +#: ../../library/os.rst:987 msgid "" "Duplicate file descriptor *fd* to *fd2*, closing the latter first if " "necessary. Return *fd2*. The new file descriptor is :ref:`inheritable " @@ -1144,23 +1143,23 @@ msgid "" "``False``." msgstr "" -#: ../../library/os.rst:989 +#: ../../library/os.rst:994 msgid "Add the optional *inheritable* parameter." msgstr "" -#: ../../library/os.rst:992 +#: ../../library/os.rst:997 msgid "Return *fd2* on success. Previously, ``None`` was always returned." msgstr "" -#: ../../library/os.rst:998 +#: ../../library/os.rst:1003 msgid "" "Change the mode of the file given by *fd* to the numeric *mode*. See the " "docs for :func:`chmod` for possible values of *mode*. As of Python 3.3, " "this is equivalent to ``os.chmod(fd, mode)``." msgstr "" -#: ../../library/os.rst:1002 ../../library/os.rst:2069 -#: ../../library/os.rst:2166 +#: ../../library/os.rst:1007 ../../library/os.rst:2136 +#: ../../library/os.rst:2237 msgid "" "Raises an :ref:`auditing event ` ``os.chmod`` with arguments " "``path``, ``mode``, ``dir_fd``." @@ -1168,24 +1167,28 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.chmod``。" -#: ../../library/os.rst:1006 ../../library/os.rst:1021 -#: ../../library/os.rst:1112 ../../library/os.rst:1651 -#: ../../library/os.rst:2066 ../../library/os.rst:2095 -#: ../../library/os.rst:3384 +#: ../../library/os.rst:1011 ../../library/os.rst:1029 +#: ../../library/os.rst:1120 ../../library/os.rst:1705 +#: ../../library/os.rst:2133 ../../library/os.rst:2166 +#: ../../library/os.rst:3458 msgid "" -"The function is limited on Emscripten and WASI, see :ref:`wasm-availability` " -"for more information." +"The function is limited on WASI, see :ref:`wasm-availability` for more " +"information." msgstr "" -#: ../../library/os.rst:1012 +#: ../../library/os.rst:1014 ../../library/os.rst:2244 +msgid "Added support on Windows." +msgstr "新增對 Windows 的支援。" + +#: ../../library/os.rst:1020 msgid "" "Change the owner and group id of the file given by *fd* to the numeric *uid* " "and *gid*. To leave one of the ids unchanged, set it to -1. See :func:" "`chown`. As of Python 3.3, this is equivalent to ``os.chown(fd, uid, gid)``." msgstr "" -#: ../../library/os.rst:1017 ../../library/os.rst:2091 -#: ../../library/os.rst:2179 +#: ../../library/os.rst:1025 ../../library/os.rst:2162 +#: ../../library/os.rst:2253 msgid "" "Raises an :ref:`auditing event ` ``os.chown`` with arguments " "``path``, ``uid``, ``gid``, ``dir_fd``." @@ -1193,17 +1196,17 @@ msgstr "" "引發一個附帶引數 ``path``、``uid``、``gid``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.chown``。" -#: ../../library/os.rst:1027 +#: ../../library/os.rst:1035 msgid "" "Force write of file with filedescriptor *fd* to disk. Does not force update " "of metadata." msgstr "" -#: ../../library/os.rst:1033 +#: ../../library/os.rst:1041 msgid "This function is not available on MacOS." msgstr "" -#: ../../library/os.rst:1038 +#: ../../library/os.rst:1046 msgid "" "Return system configuration information relevant to an open file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -1214,7 +1217,7 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:1046 ../../library/os.rst:2498 +#: ../../library/os.rst:1054 ../../library/os.rst:2572 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " @@ -1222,53 +1225,53 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:1051 +#: ../../library/os.rst:1059 msgid "As of Python 3.3, this is equivalent to ``os.pathconf(fd, name)``." msgstr "" -#: ../../library/os.rst:1058 +#: ../../library/os.rst:1066 msgid "" "Get the status of the file descriptor *fd*. Return a :class:`stat_result` " "object." msgstr "" -#: ../../library/os.rst:1061 +#: ../../library/os.rst:1069 msgid "As of Python 3.3, this is equivalent to ``os.stat(fd)``." msgstr "" -#: ../../library/os.rst:1065 ../../library/os.rst:2326 +#: ../../library/os.rst:1073 ../../library/os.rst:2400 msgid "The :func:`.stat` function." msgstr "" -#: ../../library/os.rst:1070 +#: ../../library/os.rst:1078 msgid "" "Return information about the filesystem containing the file associated with " "file descriptor *fd*, like :func:`statvfs`. As of Python 3.3, this is " "equivalent to ``os.statvfs(fd)``." msgstr "" -#: ../../library/os.rst:1079 +#: ../../library/os.rst:1087 msgid "" "Force write of file with filedescriptor *fd* to disk. On Unix, this calls " "the native :c:func:`!fsync` function; on Windows, the MS :c:func:`!_commit` " "function." msgstr "" -#: ../../library/os.rst:1082 +#: ../../library/os.rst:1090 msgid "" "If you're starting with a buffered Python :term:`file object` *f*, first do " "``f.flush()``, and then do ``os.fsync(f.fileno())``, to ensure that all " "internal buffers associated with *f* are written to disk." msgstr "" -#: ../../library/os.rst:1091 +#: ../../library/os.rst:1099 msgid "" "Truncate the file corresponding to file descriptor *fd*, so that it is at " "most *length* bytes in size. As of Python 3.3, this is equivalent to ``os." "truncate(fd, length)``." msgstr "" -#: ../../library/os.rst:1095 +#: ../../library/os.rst:1103 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``fd``, ``length``." @@ -1276,35 +1279,46 @@ msgstr "" "引發一個附帶引數 ``fd``、``length`` 的\\ :ref:`稽核事件 ` ``os." "truncate``。" -#: ../../library/os.rst:1099 ../../library/os.rst:3423 +#: ../../library/os.rst:1107 ../../library/os.rst:3497 msgid "Added support for Windows" msgstr "新增對 Windows 的支援" -#: ../../library/os.rst:1105 +#: ../../library/os.rst:1113 msgid "" "Get the blocking mode of the file descriptor: ``False`` if the :data:" "`O_NONBLOCK` flag is set, ``True`` if the flag is cleared." msgstr "" -#: ../../library/os.rst:1108 +#: ../../library/os.rst:1116 msgid "See also :func:`set_blocking` and :meth:`socket.socket.setblocking`." msgstr "另請參閱 :func:`set_blocking` 與 :meth:`socket.socket.setblocking`。" -#: ../../library/os.rst:1115 ../../library/os.rst:1654 +#: ../../library/os.rst:1123 ../../library/os.rst:1708 msgid "On Windows, this function is limited to pipes." msgstr "" -#: ../../library/os.rst:1119 ../../library/os.rst:1658 +#: ../../library/os.rst:1127 ../../library/os.rst:1712 msgid "Added support for pipes on Windows." msgstr "新增對 Windows 上的 pipe 支援。" -#: ../../library/os.rst:1124 +#: ../../library/os.rst:1133 +msgid "" +"Grant access to the slave pseudo-terminal device associated with the master " +"pseudo-terminal device to which the file descriptor *fd* refers. The file " +"descriptor *fd* is not closed upon failure." +msgstr "" + +#: ../../library/os.rst:1137 +msgid "Calls the C standard library function :c:func:`grantpt`." +msgstr "" + +#: ../../library/os.rst:1146 msgid "" "Return ``True`` if the file descriptor *fd* is open and connected to a tty(-" "like) device, else ``False``." msgstr "" -#: ../../library/os.rst:1130 +#: ../../library/os.rst:1152 msgid "" "Apply, test or remove a POSIX lock on an open file descriptor. *fd* is an " "open file descriptor. *cmd* specifies the command to use - one of :data:" @@ -1312,7 +1326,7 @@ msgid "" "specifies the section of the file to lock." msgstr "" -#: ../../library/os.rst:1136 +#: ../../library/os.rst:1158 msgid "" "Raises an :ref:`auditing event ` ``os.lockf`` with arguments " "``fd``, ``cmd``, ``len``." @@ -1320,123 +1334,123 @@ msgstr "" "引發一個附帶引數 ``fd``、``cmd``、``len`` 的\\ :ref:`稽核事件 ` " "``os.lockf``。" -#: ../../library/os.rst:1148 +#: ../../library/os.rst:1170 msgid "Flags that specify what action :func:`lockf` will take." msgstr "" -#: ../../library/os.rst:1157 +#: ../../library/os.rst:1179 msgid "" "Prepare the tty of which fd is a file descriptor for a new login session. " "Make the calling process a session leader; make the tty the controlling tty, " "the stdin, the stdout, and the stderr of the calling process; close fd." msgstr "" -#: ../../library/os.rst:1168 +#: ../../library/os.rst:1190 msgid "" "Set the current position of file descriptor *fd* to position *pos*, modified " "by *whence*, and return the new position in bytes relative to the start of " "the file. Valid values for *whence* are:" msgstr "" -#: ../../library/os.rst:1173 +#: ../../library/os.rst:1195 msgid "" ":const:`SEEK_SET` or ``0`` -- set *pos* relative to the beginning of the file" msgstr "" -#: ../../library/os.rst:1174 +#: ../../library/os.rst:1196 msgid "" ":const:`SEEK_CUR` or ``1`` -- set *pos* relative to the current file position" msgstr "" -#: ../../library/os.rst:1175 +#: ../../library/os.rst:1197 msgid ":const:`SEEK_END` or ``2`` -- set *pos* relative to the end of the file" msgstr "" -#: ../../library/os.rst:1176 +#: ../../library/os.rst:1198 msgid "" ":const:`SEEK_HOLE` -- set *pos* to the next data location, relative to *pos*" msgstr "" -#: ../../library/os.rst:1177 +#: ../../library/os.rst:1199 msgid "" ":const:`SEEK_DATA` -- set *pos* to the next data hole, relative to *pos*" msgstr "" -#: ../../library/os.rst:1181 +#: ../../library/os.rst:1203 msgid "Add support for :const:`!SEEK_HOLE` and :const:`!SEEK_DATA`." msgstr "" -#: ../../library/os.rst:1188 +#: ../../library/os.rst:1210 msgid "" "Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` " "method on :term:`file-like objects `, for whence to adjust the " "file position indicator." msgstr "" -#: ../../library/os.rst:1192 +#: ../../library/os.rst:1214 msgid ":const:`SEEK_SET`" msgstr ":const:`SEEK_SET`" -#: ../../library/os.rst:1193 +#: ../../library/os.rst:1215 msgid "Adjust the file position relative to the beginning of the file." msgstr "" -#: ../../library/os.rst:1194 +#: ../../library/os.rst:1216 msgid ":const:`SEEK_CUR`" msgstr ":const:`SEEK_CUR`" -#: ../../library/os.rst:1195 +#: ../../library/os.rst:1217 msgid "Adjust the file position relative to the current file position." msgstr "" -#: ../../library/os.rst:1196 +#: ../../library/os.rst:1218 msgid ":const:`SEEK_END`" msgstr ":const:`SEEK_END`" -#: ../../library/os.rst:1197 +#: ../../library/os.rst:1219 msgid "Adjust the file position relative to the end of the file." msgstr "" -#: ../../library/os.rst:1199 +#: ../../library/os.rst:1221 msgid "Their values are 0, 1, and 2, respectively." msgstr "" -#: ../../library/os.rst:1205 +#: ../../library/os.rst:1227 msgid "" "Parameters to the :func:`lseek` function and the :meth:`~io.IOBase.seek` " "method on :term:`file-like objects `, for seeking file data and " "holes on sparsely allocated files." msgstr "" -#: ../../library/os.rst:1209 +#: ../../library/os.rst:1231 msgid ":data:`!SEEK_DATA`" msgstr ":data:`!SEEK_DATA`" -#: ../../library/os.rst:1210 +#: ../../library/os.rst:1232 msgid "" "Adjust the file offset to the next location containing data, relative to the " "seek position." msgstr "" -#: ../../library/os.rst:1213 +#: ../../library/os.rst:1235 msgid ":data:`!SEEK_HOLE`" msgstr ":data:`!SEEK_HOLE`" -#: ../../library/os.rst:1214 +#: ../../library/os.rst:1236 msgid "" "Adjust the file offset to the next location containing a hole, relative to " "the seek position. A hole is defined as a sequence of zeros." msgstr "" -#: ../../library/os.rst:1220 +#: ../../library/os.rst:1242 msgid "These operations only make sense for filesystems that support them." msgstr "" -#: ../../library/os.rst:1222 +#: ../../library/os.rst:1244 msgid ":ref:`Availability `: Linux >= 3.1, macOS, Unix" msgstr ":ref:`適用 `:Linux 3.1 以上、macOS、Unix。" -#: ../../library/os.rst:1229 +#: ../../library/os.rst:1251 msgid "" "Open the file *path* and set various flags according to *flags* and possibly " "its mode according to *mode*. When computing *mode*, the current umask " @@ -1444,7 +1458,7 @@ msgid "" "file. The new file descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:1234 +#: ../../library/os.rst:1256 msgid "" "For a description of the flag and mode values, see the C run-time " "documentation; flag constants (like :const:`O_RDONLY` and :const:`O_WRONLY`) " @@ -1452,13 +1466,13 @@ msgid "" "const:`O_BINARY` is needed to open files in binary mode." msgstr "" -#: ../../library/os.rst:1239 +#: ../../library/os.rst:1261 msgid "" "This function can support :ref:`paths relative to directory descriptors " "` with the *dir_fd* parameter." msgstr "" -#: ../../library/os.rst:1242 +#: ../../library/os.rst:1264 msgid "" "Raises an :ref:`auditing event ` ``open`` with arguments ``path``, " "``mode``, ``flags``." @@ -1466,7 +1480,7 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``flags`` 的\\ :ref:`稽核事件 " "` ``open``。" -#: ../../library/os.rst:1249 +#: ../../library/os.rst:1271 msgid "" "This function is intended for low-level I/O. For normal usage, use the " "built-in function :func:`open`, which returns a :term:`file object` with :" @@ -1474,41 +1488,41 @@ msgid "" "a file descriptor in a file object, use :func:`fdopen`." msgstr "" -#: ../../library/os.rst:1254 ../../library/os.rst:2331 -#: ../../library/os.rst:2371 ../../library/os.rst:2442 -#: ../../library/os.rst:2464 ../../library/os.rst:2545 -#: ../../library/os.rst:2575 ../../library/os.rst:2682 -#: ../../library/os.rst:3439 +#: ../../library/os.rst:1276 ../../library/os.rst:2405 +#: ../../library/os.rst:2445 ../../library/os.rst:2516 +#: ../../library/os.rst:2538 ../../library/os.rst:2619 +#: ../../library/os.rst:2649 ../../library/os.rst:2756 +#: ../../library/os.rst:3513 msgid "Added the *dir_fd* parameter." msgstr "新增 *dir_fd* 參數。" -#: ../../library/os.rst:1257 ../../library/os.rst:1576 -#: ../../library/os.rst:1752 ../../library/os.rst:4797 +#: ../../library/os.rst:1279 ../../library/os.rst:1630 +#: ../../library/os.rst:1819 ../../library/os.rst:5097 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the function now retries the system call instead of raising an :" "exc:`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: ../../library/os.rst:1262 ../../library/os.rst:1963 -#: ../../library/os.rst:1995 ../../library/os.rst:2026 -#: ../../library/os.rst:2075 ../../library/os.rst:2112 -#: ../../library/os.rst:2152 ../../library/os.rst:2170 -#: ../../library/os.rst:2183 ../../library/os.rst:2242 -#: ../../library/os.rst:2334 ../../library/os.rst:2374 -#: ../../library/os.rst:2418 ../../library/os.rst:2445 -#: ../../library/os.rst:2467 ../../library/os.rst:2508 -#: ../../library/os.rst:2578 ../../library/os.rst:2597 -#: ../../library/os.rst:2685 ../../library/os.rst:2975 -#: ../../library/os.rst:3262 ../../library/os.rst:3426 -#: ../../library/os.rst:3442 ../../library/os.rst:3482 -#: ../../library/os.rst:3581 ../../library/os.rst:3642 -#: ../../library/os.rst:3826 ../../library/os.rst:4006 -#: ../../library/os.rst:4559 +#: ../../library/os.rst:1284 ../../library/os.rst:2029 +#: ../../library/os.rst:2061 ../../library/os.rst:2092 +#: ../../library/os.rst:2142 ../../library/os.rst:2183 +#: ../../library/os.rst:2223 ../../library/os.rst:2241 +#: ../../library/os.rst:2257 ../../library/os.rst:2316 +#: ../../library/os.rst:2408 ../../library/os.rst:2448 +#: ../../library/os.rst:2492 ../../library/os.rst:2519 +#: ../../library/os.rst:2541 ../../library/os.rst:2582 +#: ../../library/os.rst:2652 ../../library/os.rst:2671 +#: ../../library/os.rst:2759 ../../library/os.rst:3049 +#: ../../library/os.rst:3336 ../../library/os.rst:3500 +#: ../../library/os.rst:3516 ../../library/os.rst:3556 +#: ../../library/os.rst:3655 ../../library/os.rst:3716 +#: ../../library/os.rst:4113 ../../library/os.rst:4293 +#: ../../library/os.rst:4859 msgid "Accepts a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:1265 +#: ../../library/os.rst:1287 msgid "" "The following constants are options for the *flags* parameter to the :func:" "`~os.open` function. They can be combined using the bitwise OR operator ``|" @@ -1518,45 +1532,45 @@ msgid "" "on Windows." msgstr "" -#: ../../library/os.rst:1280 +#: ../../library/os.rst:1302 msgid "The above constants are available on Unix and Windows." msgstr "" -#: ../../library/os.rst:1291 +#: ../../library/os.rst:1313 msgid "The above constants are only available on Unix." msgstr "" -#: ../../library/os.rst:1293 +#: ../../library/os.rst:1315 msgid "Add :data:`O_CLOEXEC` constant." msgstr "" -#: ../../library/os.rst:1304 +#: ../../library/os.rst:1326 msgid "The above constants are only available on Windows." msgstr "" -#: ../../library/os.rst:1311 +#: ../../library/os.rst:1333 msgid "The above constants are only available on macOS." msgstr "" -#: ../../library/os.rst:1313 +#: ../../library/os.rst:1335 msgid "" "Add :data:`O_EVTONLY`, :data:`O_FSYNC`, :data:`O_SYMLINK` and :data:" "`O_NOFOLLOW_ANY` constants." msgstr "" -#: ../../library/os.rst:1327 +#: ../../library/os.rst:1349 msgid "" "The above constants are extensions and not present if they are not defined " "by the C library." msgstr "" -#: ../../library/os.rst:1330 +#: ../../library/os.rst:1352 msgid "" "Add :data:`O_PATH` on systems that support it. Add :data:`O_TMPFILE`, only " "available on Linux Kernel 3.11 or newer." msgstr "" -#: ../../library/os.rst:1340 +#: ../../library/os.rst:1362 msgid "" "Open a new pseudo-terminal pair. Return a pair of file descriptors " "``(master, slave)`` for the pty and the tty, respectively. The new file " @@ -1564,18 +1578,18 @@ msgid "" "more portable approach, use the :mod:`pty` module." msgstr "" -#: ../../library/os.rst:1347 ../../library/os.rst:1359 +#: ../../library/os.rst:1369 ../../library/os.rst:1381 msgid "The new file descriptors are now non-inheritable." msgstr "" -#: ../../library/os.rst:1353 +#: ../../library/os.rst:1375 msgid "" "Create a pipe. Return a pair of file descriptors ``(r, w)`` usable for " "reading and writing, respectively. The new file descriptor is :ref:`non-" "inheritable `." msgstr "" -#: ../../library/os.rst:1365 +#: ../../library/os.rst:1387 msgid "" "Create a pipe with *flags* set atomically. *flags* can be constructed by " "ORing together one or more of these values: :data:`O_NONBLOCK`, :data:" @@ -1583,17 +1597,13 @@ msgid "" "and writing, respectively." msgstr "" -#: ../../library/os.rst:1378 +#: ../../library/os.rst:1400 msgid "" "Ensures that enough disk space is allocated for the file specified by *fd* " "starting from *offset* and continuing for *len* bytes." msgstr "" -#: ../../library/os.rst:1381 -msgid ":ref:`Availability `: Unix, not Emscripten." -msgstr ":ref:`適用 `:Unix、非 Emscripten。" - -#: ../../library/os.rst:1388 +#: ../../library/os.rst:1410 msgid "" "Announces an intention to access data in a specific pattern thus allowing " "the kernel to make optimizations. The advice applies to the region of the " @@ -1604,25 +1614,43 @@ msgid "" "`POSIX_FADV_DONTNEED`." msgstr "" -#: ../../library/os.rst:1408 +#: ../../library/os.rst:1430 msgid "" "Flags that can be used in *advice* in :func:`posix_fadvise` that specify the " "access pattern that is likely to be used." msgstr "" -#: ../../library/os.rst:1418 +#: ../../library/os.rst:1440 msgid "" "Read at most *n* bytes from file descriptor *fd* at a position of *offset*, " "leaving the file offset unchanged." msgstr "" -#: ../../library/os.rst:1421 ../../library/os.rst:1565 +#: ../../library/os.rst:1443 ../../library/os.rst:1619 msgid "" "Return a bytestring containing the bytes read. If the end of the file " "referred to by *fd* has been reached, an empty bytes object is returned." msgstr "" -#: ../../library/os.rst:1431 +#: ../../library/os.rst:1453 +msgid "Open and return a file descriptor for a master pseudo-terminal device." +msgstr "" + +#: ../../library/os.rst:1455 +msgid "" +"Calls the C standard library function :c:func:`posix_openpt`. The *oflag* " +"argument is used to set file status flags and file access modes as specified " +"in the manual page of :c:func:`posix_openpt` of your system." +msgstr "" + +#: ../../library/os.rst:1459 +msgid "" +"The returned file descriptor is :ref:`non-inheritable `. If " +"the value :data:`O_CLOEXEC` is available on the system, it is added to " +"*oflag*." +msgstr "" + +#: ../../library/os.rst:1470 msgid "" "Read from a file descriptor *fd* at a position of *offset* into mutable :" "term:`bytes-like objects ` *buffers*, leaving the file " @@ -1630,38 +1658,38 @@ msgid "" "move on to the next buffer in the sequence to hold the rest of the data." msgstr "" -#: ../../library/os.rst:1436 ../../library/os.rst:1506 +#: ../../library/os.rst:1475 ../../library/os.rst:1560 msgid "" "The flags argument contains a bitwise OR of zero or more of the following " "flags:" msgstr "" -#: ../../library/os.rst:1439 +#: ../../library/os.rst:1478 msgid ":data:`RWF_HIPRI`" msgstr ":data:`RWF_HIPRI`" -#: ../../library/os.rst:1440 +#: ../../library/os.rst:1479 msgid ":data:`RWF_NOWAIT`" msgstr ":data:`RWF_NOWAIT`" -#: ../../library/os.rst:1442 ../../library/os.rst:1702 +#: ../../library/os.rst:1481 ../../library/os.rst:1756 msgid "" "Return the total number of bytes actually read which can be less than the " "total capacity of all the objects." msgstr "" -#: ../../library/os.rst:1445 ../../library/os.rst:1515 -#: ../../library/os.rst:1705 ../../library/os.rst:1767 +#: ../../library/os.rst:1484 ../../library/os.rst:1569 +#: ../../library/os.rst:1759 ../../library/os.rst:1834 msgid "" "The operating system may set a limit (:func:`sysconf` value " "``'SC_IOV_MAX'``) on the number of buffers that can be used." msgstr "" -#: ../../library/os.rst:1448 +#: ../../library/os.rst:1487 msgid "Combine the functionality of :func:`os.readv` and :func:`os.pread`." msgstr "" -#: ../../library/os.rst:1450 ../../library/os.rst:1520 +#: ../../library/os.rst:1489 ../../library/os.rst:1574 msgid "" ":ref:`Availability `: Linux >= 2.6.30, FreeBSD >= 6.0, OpenBSD " ">= 2.7, AIX >= 7.1." @@ -1669,55 +1697,69 @@ msgstr "" ":ref:`適用 `:Linux 2.6.30 以上、FreeBSD 6.0 以上、OpenBSD 2.7 " "以上、AIX 7.1 以上。" -#: ../../library/os.rst:1452 ../../library/os.rst:1522 +#: ../../library/os.rst:1491 ../../library/os.rst:1576 msgid "Using flags requires Linux >= 4.6." msgstr "" -#: ../../library/os.rst:1459 +#: ../../library/os.rst:1498 msgid "" "Do not wait for data which is not immediately available. If this flag is " "specified, the system call will return instantly if it would have to read " "data from the backing storage or wait for a lock." msgstr "" -#: ../../library/os.rst:1463 +#: ../../library/os.rst:1502 msgid "" "If some data was successfully read, it will return the number of bytes read. " "If no bytes were read, it will return ``-1`` and set errno to :const:`errno." "EAGAIN`." msgstr "" -#: ../../library/os.rst:1467 +#: ../../library/os.rst:1506 msgid ":ref:`Availability `: Linux >= 4.14." msgstr ":ref:`適用 `:Linux 4.14 以上。" -#: ../../library/os.rst:1474 +#: ../../library/os.rst:1513 msgid "" "High priority read/write. Allows block-based filesystems to use polling of " "the device, which provides lower latency, but may use additional resources." msgstr "" -#: ../../library/os.rst:1478 +#: ../../library/os.rst:1517 msgid "" "Currently, on Linux, this feature is usable only on a file descriptor opened " "using the :data:`O_DIRECT` flag." msgstr "" -#: ../../library/os.rst:1481 +#: ../../library/os.rst:1520 msgid ":ref:`Availability `: Linux >= 4.6." msgstr ":ref:`適用 `:Linux 4.6 以上。" -#: ../../library/os.rst:1488 +#: ../../library/os.rst:1527 +msgid "" +"Return the name of the slave pseudo-terminal device associated with the " +"master pseudo-terminal device to which the file descriptor *fd* refers. The " +"file descriptor *fd* is not closed upon failure." +msgstr "" + +#: ../../library/os.rst:1531 +msgid "" +"Calls the reentrant C standard library function :c:func:`ptsname_r` if it is " +"available; otherwise, the C standard library function :c:func:`ptsname`, " +"which is not guaranteed to be thread-safe, is called." +msgstr "" + +#: ../../library/os.rst:1542 msgid "" "Write the bytestring in *str* to file descriptor *fd* at position of " "*offset*, leaving the file offset unchanged." msgstr "" -#: ../../library/os.rst:1491 ../../library/os.rst:1742 +#: ../../library/os.rst:1545 ../../library/os.rst:1809 msgid "Return the number of bytes actually written." msgstr "" -#: ../../library/os.rst:1500 +#: ../../library/os.rst:1554 msgid "" "Write the *buffers* contents to file descriptor *fd* at an offset *offset*, " "leaving the file offset unchanged. *buffers* must be a sequence of :term:" @@ -1726,43 +1768,43 @@ msgid "" "the second, and so on." msgstr "" -#: ../../library/os.rst:1509 +#: ../../library/os.rst:1563 msgid ":data:`RWF_DSYNC`" msgstr ":data:`RWF_DSYNC`" -#: ../../library/os.rst:1510 +#: ../../library/os.rst:1564 msgid ":data:`RWF_SYNC`" msgstr ":data:`RWF_SYNC`" -#: ../../library/os.rst:1511 +#: ../../library/os.rst:1565 msgid ":data:`RWF_APPEND`" msgstr ":data:`RWF_APPEND`" -#: ../../library/os.rst:1513 +#: ../../library/os.rst:1567 msgid "Return the total number of bytes actually written." msgstr "" -#: ../../library/os.rst:1518 +#: ../../library/os.rst:1572 msgid "Combine the functionality of :func:`os.writev` and :func:`os.pwrite`." msgstr "" -#: ../../library/os.rst:1529 +#: ../../library/os.rst:1583 msgid "" "Provide a per-write equivalent of the :data:`O_DSYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1532 ../../library/os.rst:1542 +#: ../../library/os.rst:1586 ../../library/os.rst:1596 msgid ":ref:`Availability `: Linux >= 4.7." msgstr ":ref:`適用 `:Linux 4.7 以上。" -#: ../../library/os.rst:1539 +#: ../../library/os.rst:1593 msgid "" "Provide a per-write equivalent of the :data:`O_SYNC` :func:`os.open` flag. " "This flag effect applies only to the data range written by the system call." msgstr "" -#: ../../library/os.rst:1549 +#: ../../library/os.rst:1603 msgid "" "Provide a per-write equivalent of the :data:`O_APPEND` :func:`os.open` flag. " "This flag is meaningful only for :func:`os.pwritev`, and its effect applies " @@ -1772,15 +1814,15 @@ msgid "" "*offset* is updated." msgstr "" -#: ../../library/os.rst:1556 +#: ../../library/os.rst:1610 msgid ":ref:`Availability `: Linux >= 4.16." msgstr ":ref:`適用 `:Linux 4.16 以上。" -#: ../../library/os.rst:1563 +#: ../../library/os.rst:1617 msgid "Read at most *n* bytes from file descriptor *fd*." msgstr "" -#: ../../library/os.rst:1570 +#: ../../library/os.rst:1624 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To read a \"file " @@ -1789,26 +1831,26 @@ msgid "" "`~file.readline` methods." msgstr "" -#: ../../library/os.rst:1585 +#: ../../library/os.rst:1639 msgid "" "Copy *count* bytes from file descriptor *in_fd* to file descriptor *out_fd* " "starting at *offset*. Return the number of bytes sent. When EOF is reached " "return ``0``." msgstr "" -#: ../../library/os.rst:1589 +#: ../../library/os.rst:1643 msgid "" "The first function notation is supported by all platforms that define :func:" "`sendfile`." msgstr "" -#: ../../library/os.rst:1592 +#: ../../library/os.rst:1646 msgid "" "On Linux, if *offset* is given as ``None``, the bytes are read from the " "current position of *in_fd* and the position of *in_fd* is updated." msgstr "" -#: ../../library/os.rst:1595 +#: ../../library/os.rst:1649 msgid "" "The second case may be used on macOS and FreeBSD where *headers* and " "*trailers* are arbitrary sequences of buffers that are written before and " @@ -1816,58 +1858,58 @@ msgid "" "case." msgstr "" -#: ../../library/os.rst:1599 +#: ../../library/os.rst:1653 msgid "" "On macOS and FreeBSD, a value of ``0`` for *count* specifies to send until " "the end of *in_fd* is reached." msgstr "" -#: ../../library/os.rst:1602 +#: ../../library/os.rst:1656 msgid "" "All platforms support sockets as *out_fd* file descriptor, and some " "platforms allow other types (e.g. regular file, pipe) as well." msgstr "" -#: ../../library/os.rst:1605 +#: ../../library/os.rst:1659 msgid "" "Cross-platform applications should not use *headers*, *trailers* and *flags* " "arguments." msgstr "" -#: ../../library/os.rst:1612 +#: ../../library/os.rst:1666 msgid "" "For a higher-level wrapper of :func:`sendfile`, see :meth:`socket.socket." "sendfile`." msgstr "" -#: ../../library/os.rst:1617 +#: ../../library/os.rst:1671 msgid "Parameters *out* and *in* was renamed to *out_fd* and *in_fd*." msgstr "" -#: ../../library/os.rst:1625 +#: ../../library/os.rst:1679 msgid "" "Parameters to the :func:`sendfile` function, if the implementation supports " "them." msgstr "" -#: ../../library/os.rst:1634 +#: ../../library/os.rst:1688 msgid "" "Parameter to the :func:`sendfile` function, if the implementation supports " "it. The data won't be cached in the virtual memory and will be freed " "afterwards." msgstr "" -#: ../../library/os.rst:1644 +#: ../../library/os.rst:1698 msgid "" "Set the blocking mode of the specified file descriptor. Set the :data:" "`O_NONBLOCK` flag if blocking is ``False``, clear the flag otherwise." msgstr "" -#: ../../library/os.rst:1647 +#: ../../library/os.rst:1701 msgid "See also :func:`get_blocking` and :meth:`socket.socket.setblocking`." msgstr "另請參閱 :func:`get_blocking` 與 :meth:`socket.socket.setblocking`。" -#: ../../library/os.rst:1664 +#: ../../library/os.rst:1718 msgid "" "Transfer *count* bytes from file descriptor *src*, starting from offset " "*offset_src*, to file descriptor *dst*, starting from offset *offset_dst*. " @@ -1879,7 +1921,7 @@ msgid "" "`~OSError.errno` set to :const:`errno.EXDEV`." msgstr "" -#: ../../library/os.rst:1673 +#: ../../library/os.rst:1727 msgid "" "This copy is done without the additional cost of transferring data from the " "kernel to user space and then back into the kernel. Additionally, some " @@ -1887,7 +1929,7 @@ msgid "" "files are opened as binary." msgstr "" -#: ../../library/os.rst:1678 +#: ../../library/os.rst:1732 msgid "" "Upon successful completion, returns the number of bytes spliced to or from " "the pipe. A return value of 0 means end of input. If *src* refers to a pipe, " @@ -1896,11 +1938,11 @@ msgid "" "the pipe." msgstr "" -#: ../../library/os.rst:1684 +#: ../../library/os.rst:1738 msgid ":ref:`Availability `: Linux >= 2.6.17 with glibc >= 2.5" msgstr ":ref:`適用 `:Linux 2.6.17 以上且具有 glibc 2.5 以上" -#: ../../library/os.rst:1697 +#: ../../library/os.rst:1751 msgid "" "Read from a file descriptor *fd* into a number of mutable :term:`bytes-like " "objects ` *buffers*. Transfer data into each buffer until " @@ -1908,34 +1950,41 @@ msgid "" "rest of the data." msgstr "" -#: ../../library/os.rst:1715 +#: ../../library/os.rst:1769 msgid "" "Return the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`)." msgstr "" -#: ../../library/os.rst:1718 ../../library/os.rst:1726 -msgid ":ref:`Availability `: Unix, not WASI." -msgstr ":ref:`適用 `:Unix、非 WASI。" - -#: ../../library/os.rst:1723 +#: ../../library/os.rst:1777 msgid "" "Set the process group associated with the terminal given by *fd* (an open " "file descriptor as returned by :func:`os.open`) to *pg*." msgstr "" -#: ../../library/os.rst:1731 +#: ../../library/os.rst:1785 msgid "" "Return a string which specifies the terminal device associated with file " "descriptor *fd*. If *fd* is not associated with a terminal device, an " "exception is raised." msgstr "" -#: ../../library/os.rst:1740 +#: ../../library/os.rst:1794 +msgid "" +"Unlock the slave pseudo-terminal device associated with the master pseudo-" +"terminal device to which the file descriptor *fd* refers. The file " +"descriptor *fd* is not closed upon failure." +msgstr "" + +#: ../../library/os.rst:1798 +msgid "Calls the C standard library function :c:func:`unlockpt`." +msgstr "" + +#: ../../library/os.rst:1807 msgid "Write the bytestring in *str* to file descriptor *fd*." msgstr "" -#: ../../library/os.rst:1746 +#: ../../library/os.rst:1813 msgid "" "This function is intended for low-level I/O and must be applied to a file " "descriptor as returned by :func:`os.open` or :func:`pipe`. To write a " @@ -1944,7 +1993,7 @@ msgid "" "its :meth:`~file.write` method." msgstr "" -#: ../../library/os.rst:1760 +#: ../../library/os.rst:1827 msgid "" "Write the contents of *buffers* to file descriptor *fd*. *buffers* must be a " "sequence of :term:`bytes-like objects `. Buffers are " @@ -1952,70 +2001,70 @@ msgid "" "before proceeding to the second, and so on." msgstr "" -#: ../../library/os.rst:1765 +#: ../../library/os.rst:1832 msgid "Returns the total number of bytes actually written." msgstr "" -#: ../../library/os.rst:1778 +#: ../../library/os.rst:1845 msgid "Querying the size of a terminal" msgstr "" -#: ../../library/os.rst:1784 +#: ../../library/os.rst:1851 msgid "" "Return the size of the terminal window as ``(columns, lines)``, tuple of " "type :class:`terminal_size`." msgstr "" -#: ../../library/os.rst:1787 +#: ../../library/os.rst:1854 msgid "" "The optional argument ``fd`` (default ``STDOUT_FILENO``, or standard output) " "specifies which file descriptor should be queried." msgstr "" -#: ../../library/os.rst:1790 +#: ../../library/os.rst:1857 msgid "" "If the file descriptor is not connected to a terminal, an :exc:`OSError` is " "raised." msgstr "" -#: ../../library/os.rst:1793 +#: ../../library/os.rst:1860 msgid "" ":func:`shutil.get_terminal_size` is the high-level function which should " "normally be used, ``os.get_terminal_size`` is the low-level implementation." msgstr "" -#: ../../library/os.rst:1801 +#: ../../library/os.rst:1868 msgid "" "A subclass of tuple, holding ``(columns, lines)`` of the terminal window " "size." msgstr "" -#: ../../library/os.rst:1805 +#: ../../library/os.rst:1872 msgid "Width of the terminal window in characters." msgstr "" -#: ../../library/os.rst:1809 +#: ../../library/os.rst:1876 msgid "Height of the terminal window in characters." msgstr "" -#: ../../library/os.rst:1815 +#: ../../library/os.rst:1882 msgid "Inheritance of File Descriptors" msgstr "" -#: ../../library/os.rst:1819 +#: ../../library/os.rst:1886 msgid "" "A file descriptor has an \"inheritable\" flag which indicates if the file " "descriptor can be inherited by child processes. Since Python 3.4, file " "descriptors created by Python are non-inheritable by default." msgstr "" -#: ../../library/os.rst:1823 +#: ../../library/os.rst:1890 msgid "" "On UNIX, non-inheritable file descriptors are closed in child processes at " "the execution of a new program, other file descriptors are inherited." msgstr "" -#: ../../library/os.rst:1826 +#: ../../library/os.rst:1893 msgid "" "On Windows, non-inheritable handles and file descriptors are closed in child " "processes, except for standard streams (file descriptors 0, 1 and 2: stdin, " @@ -2026,46 +2075,44 @@ msgid "" "only inherited if the *close_fds* parameter is ``False``." msgstr "" -#: ../../library/os.rst:1834 -msgid "" -"On WebAssembly platforms ``wasm32-emscripten`` and ``wasm32-wasi``, the file " -"descriptor cannot be modified." +#: ../../library/os.rst:1901 +msgid "On WebAssembly platforms, the file descriptor cannot be modified." msgstr "" -#: ../../library/os.rst:1839 +#: ../../library/os.rst:1905 msgid "" "Get the \"inheritable\" flag of the specified file descriptor (a boolean)." msgstr "" -#: ../../library/os.rst:1843 +#: ../../library/os.rst:1909 msgid "Set the \"inheritable\" flag of the specified file descriptor." msgstr "" -#: ../../library/os.rst:1847 +#: ../../library/os.rst:1913 msgid "Get the \"inheritable\" flag of the specified handle (a boolean)." msgstr "" -#: ../../library/os.rst:1849 ../../library/os.rst:1855 -#: ../../library/os.rst:3931 ../../library/os.rst:4594 -#: ../../library/os.rst:4639 +#: ../../library/os.rst:1915 ../../library/os.rst:1921 +#: ../../library/os.rst:4218 ../../library/os.rst:4894 +#: ../../library/os.rst:4939 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/os.rst:1853 +#: ../../library/os.rst:1919 msgid "Set the \"inheritable\" flag of the specified handle." msgstr "" -#: ../../library/os.rst:1861 +#: ../../library/os.rst:1927 msgid "Files and Directories" msgstr "" -#: ../../library/os.rst:1863 +#: ../../library/os.rst:1929 msgid "" "On some Unix platforms, many of these functions support one or more of these " "features:" msgstr "" -#: ../../library/os.rst:1868 +#: ../../library/os.rst:1934 msgid "" "**specifying a file descriptor:** Normally the *path* argument provided to " "functions in the :mod:`os` module must be a string specifying a file path. " @@ -2076,7 +2123,7 @@ msgid "" "``chdir``).)" msgstr "" -#: ../../library/os.rst:1876 +#: ../../library/os.rst:1942 msgid "" "You can check whether or not *path* can be specified as a file descriptor " "for a particular function on your platform using :data:`os.supports_fd`. If " @@ -2084,13 +2131,13 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1881 +#: ../../library/os.rst:1947 msgid "" "If the function also supports *dir_fd* or *follow_symlinks* arguments, it's " "an error to specify one of those when supplying *path* as a file descriptor." msgstr "" -#: ../../library/os.rst:1886 +#: ../../library/os.rst:1952 msgid "" "**paths relative to directory descriptors:** If *dir_fd* is not ``None``, it " "should be a file descriptor referring to a directory, and the path to " @@ -2101,14 +2148,14 @@ msgid "" "``access``)." msgstr "" -#: ../../library/os.rst:1893 +#: ../../library/os.rst:1959 msgid "" "You can check whether or not *dir_fd* is supported for a particular function " "on your platform using :data:`os.supports_dir_fd`. If it's unavailable, " "using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1899 +#: ../../library/os.rst:1965 msgid "" "**not following symlinks:** If *follow_symlinks* is ``False``, and the last " "element of the path to operate on is a symbolic link, the function will " @@ -2117,14 +2164,14 @@ msgid "" "function.)" msgstr "" -#: ../../library/os.rst:1905 +#: ../../library/os.rst:1971 msgid "" "You can check whether or not *follow_symlinks* is supported for a particular " "function on your platform using :data:`os.supports_follow_symlinks`. If it's " "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1913 +#: ../../library/os.rst:1979 msgid "" "Use the real uid/gid to test for access to *path*. Note that most " "operations will use the effective uid/gid, therefore this routine can be " @@ -2136,13 +2183,13 @@ msgid "" "manpage:`access(2)` for more information." msgstr "" -#: ../../library/os.rst:1922 +#: ../../library/os.rst:1988 msgid "" "This function can support specifying :ref:`paths relative to directory " "descriptors ` and :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:1925 +#: ../../library/os.rst:1991 msgid "" "If *effective_ids* is ``True``, :func:`access` will perform its access " "checks using the effective uid/gid instead of the real uid/gid. " @@ -2151,7 +2198,7 @@ msgid "" "unavailable, using it will raise a :exc:`NotImplementedError`." msgstr "" -#: ../../library/os.rst:1933 +#: ../../library/os.rst:1999 msgid "" "Using :func:`access` to check if a user is authorized to e.g. open a file " "before actually doing so using :func:`open` creates a security hole, because " @@ -2160,7 +2207,7 @@ msgid "" "For example::" msgstr "" -#: ../../library/os.rst:1939 +#: ../../library/os.rst:2005 msgid "" "if os.access(\"myfile\", os.R_OK):\n" " with open(\"myfile\") as fp:\n" @@ -2172,11 +2219,11 @@ msgstr "" " return fp.read()\n" "return \"some default data\"" -#: ../../library/os.rst:1944 +#: ../../library/os.rst:2010 msgid "is better written as::" msgstr "" -#: ../../library/os.rst:1946 +#: ../../library/os.rst:2012 msgid "" "try:\n" " fp = open(\"myfile\")\n" @@ -2194,113 +2241,113 @@ msgstr "" " with fp:\n" " return fp.read()" -#: ../../library/os.rst:1956 +#: ../../library/os.rst:2022 msgid "" "I/O operations may fail even when :func:`access` indicates that they would " "succeed, particularly for operations on network filesystems which may have " "permissions semantics beyond the usual POSIX permission-bit model." msgstr "" -#: ../../library/os.rst:1960 +#: ../../library/os.rst:2026 msgid "Added the *dir_fd*, *effective_ids*, and *follow_symlinks* parameters." msgstr "新增 *dir_fd*、*effective_ids* 與 *follow_symlinks* 參數。" -#: ../../library/os.rst:1972 +#: ../../library/os.rst:2038 msgid "" "Values to pass as the *mode* parameter of :func:`access` to test the " "existence, readability, writability and executability of *path*, " "respectively." msgstr "" -#: ../../library/os.rst:1981 +#: ../../library/os.rst:2047 msgid "Change the current working directory to *path*." msgstr "" -#: ../../library/os.rst:1983 +#: ../../library/os.rst:2049 msgid "" "This function can support :ref:`specifying a file descriptor `. " "The descriptor must refer to an opened directory, not an open file." msgstr "" -#: ../../library/os.rst:1986 +#: ../../library/os.rst:2052 msgid "" "This function can raise :exc:`OSError` and subclasses such as :exc:" "`FileNotFoundError`, :exc:`PermissionError`, and :exc:`NotADirectoryError`." msgstr "" -#: ../../library/os.rst:1989 ../../library/os.rst:2122 +#: ../../library/os.rst:2055 ../../library/os.rst:2193 msgid "" "Raises an :ref:`auditing event ` ``os.chdir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.chdir``。" -#: ../../library/os.rst:1991 +#: ../../library/os.rst:2057 msgid "" "Added support for specifying *path* as a file descriptor on some platforms." msgstr "" -#: ../../library/os.rst:2001 +#: ../../library/os.rst:2067 msgid "" "Set the flags of *path* to the numeric *flags*. *flags* may take a " "combination (bitwise OR) of the following values (as defined in the :mod:" "`stat` module):" msgstr "" -#: ../../library/os.rst:2004 +#: ../../library/os.rst:2070 msgid ":const:`stat.UF_NODUMP`" msgstr ":const:`stat.UF_NODUMP`" -#: ../../library/os.rst:2005 +#: ../../library/os.rst:2071 msgid ":const:`stat.UF_IMMUTABLE`" msgstr ":const:`stat.UF_IMMUTABLE`" -#: ../../library/os.rst:2006 +#: ../../library/os.rst:2072 msgid ":const:`stat.UF_APPEND`" msgstr ":const:`stat.UF_APPEND`" -#: ../../library/os.rst:2007 +#: ../../library/os.rst:2073 msgid ":const:`stat.UF_OPAQUE`" msgstr ":const:`stat.UF_OPAQUE`" -#: ../../library/os.rst:2008 +#: ../../library/os.rst:2074 msgid ":const:`stat.UF_NOUNLINK`" msgstr ":const:`stat.UF_NOUNLINK`" -#: ../../library/os.rst:2009 +#: ../../library/os.rst:2075 msgid ":const:`stat.UF_COMPRESSED`" msgstr ":const:`stat.UF_COMPRESSED`" -#: ../../library/os.rst:2010 +#: ../../library/os.rst:2076 msgid ":const:`stat.UF_HIDDEN`" msgstr ":const:`stat.UF_HIDDEN`" -#: ../../library/os.rst:2011 +#: ../../library/os.rst:2077 msgid ":const:`stat.SF_ARCHIVED`" msgstr ":const:`stat.SF_ARCHIVED`" -#: ../../library/os.rst:2012 +#: ../../library/os.rst:2078 msgid ":const:`stat.SF_IMMUTABLE`" msgstr ":const:`stat.SF_IMMUTABLE`" -#: ../../library/os.rst:2013 +#: ../../library/os.rst:2079 msgid ":const:`stat.SF_APPEND`" msgstr ":const:`stat.SF_APPEND`" -#: ../../library/os.rst:2014 +#: ../../library/os.rst:2080 msgid ":const:`stat.SF_NOUNLINK`" msgstr ":const:`stat.SF_NOUNLINK`" -#: ../../library/os.rst:2015 +#: ../../library/os.rst:2081 msgid ":const:`stat.SF_SNAPSHOT`" msgstr ":const:`stat.SF_SNAPSHOT`" -#: ../../library/os.rst:2017 +#: ../../library/os.rst:2083 msgid "" "This function can support :ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:2019 ../../library/os.rst:2148 +#: ../../library/os.rst:2085 ../../library/os.rst:2219 msgid "" "Raises an :ref:`auditing event ` ``os.chflags`` with arguments " "``path``, ``flags``." @@ -2308,164 +2355,171 @@ msgstr "" "引發一個附帶引數 ``path``、``flags`` 的\\ :ref:`稽核事件 ` ``os." "chflags``。" -#: ../../library/os.rst:2023 +#: ../../library/os.rst:2089 msgid "Added the *follow_symlinks* parameter." msgstr "新增 *follow_symlinks* 參數。" -#: ../../library/os.rst:2032 +#: ../../library/os.rst:2098 msgid "" "Change the mode of *path* to the numeric *mode*. *mode* may take one of the " "following values (as defined in the :mod:`stat` module) or bitwise ORed " "combinations of them:" msgstr "" -#: ../../library/os.rst:2036 +#: ../../library/os.rst:2102 msgid ":const:`stat.S_ISUID`" msgstr ":const:`stat.S_ISUID`" -#: ../../library/os.rst:2037 +#: ../../library/os.rst:2103 msgid ":const:`stat.S_ISGID`" msgstr ":const:`stat.S_ISGID`" -#: ../../library/os.rst:2038 +#: ../../library/os.rst:2104 msgid ":const:`stat.S_ENFMT`" msgstr ":const:`stat.S_ENFMT`" -#: ../../library/os.rst:2039 +#: ../../library/os.rst:2105 msgid ":const:`stat.S_ISVTX`" msgstr ":const:`stat.S_ISVTX`" -#: ../../library/os.rst:2040 +#: ../../library/os.rst:2106 msgid ":const:`stat.S_IREAD`" msgstr ":const:`stat.S_IREAD`" -#: ../../library/os.rst:2041 +#: ../../library/os.rst:2107 msgid ":const:`stat.S_IWRITE`" msgstr ":const:`stat.S_IWRITE`" -#: ../../library/os.rst:2042 +#: ../../library/os.rst:2108 msgid ":const:`stat.S_IEXEC`" msgstr ":const:`stat.S_IEXEC`" -#: ../../library/os.rst:2043 +#: ../../library/os.rst:2109 msgid ":const:`stat.S_IRWXU`" msgstr ":const:`stat.S_IRWXU`" -#: ../../library/os.rst:2044 +#: ../../library/os.rst:2110 msgid ":const:`stat.S_IRUSR`" msgstr ":const:`stat.S_IRUSR`" -#: ../../library/os.rst:2045 +#: ../../library/os.rst:2111 msgid ":const:`stat.S_IWUSR`" msgstr ":const:`stat.S_IWUSR`" -#: ../../library/os.rst:2046 +#: ../../library/os.rst:2112 msgid ":const:`stat.S_IXUSR`" msgstr ":const:`stat.S_IXUSR`" -#: ../../library/os.rst:2047 +#: ../../library/os.rst:2113 msgid ":const:`stat.S_IRWXG`" msgstr ":const:`stat.S_IRWXG`" -#: ../../library/os.rst:2048 +#: ../../library/os.rst:2114 msgid ":const:`stat.S_IRGRP`" msgstr ":const:`stat.S_IRGRP`" -#: ../../library/os.rst:2049 +#: ../../library/os.rst:2115 msgid ":const:`stat.S_IWGRP`" msgstr ":const:`stat.S_IWGRP`" -#: ../../library/os.rst:2050 +#: ../../library/os.rst:2116 msgid ":const:`stat.S_IXGRP`" msgstr ":const:`stat.S_IXGRP`" -#: ../../library/os.rst:2051 +#: ../../library/os.rst:2117 msgid ":const:`stat.S_IRWXO`" msgstr ":const:`stat.S_IRWXO`" -#: ../../library/os.rst:2052 +#: ../../library/os.rst:2118 msgid ":const:`stat.S_IROTH`" msgstr ":const:`stat.S_IROTH`" -#: ../../library/os.rst:2053 +#: ../../library/os.rst:2119 msgid ":const:`stat.S_IWOTH`" msgstr ":const:`stat.S_IWOTH`" -#: ../../library/os.rst:2054 +#: ../../library/os.rst:2120 msgid ":const:`stat.S_IXOTH`" msgstr ":const:`stat.S_IXOTH`" -#: ../../library/os.rst:2056 ../../library/os.rst:2084 -#: ../../library/os.rst:3472 +#: ../../library/os.rst:2122 ../../library/os.rst:2155 +#: ../../library/os.rst:3546 msgid "" "This function can support :ref:`specifying a file descriptor `, :" "ref:`paths relative to directory descriptors ` and :ref:`not " "following symlinks `." msgstr "" -#: ../../library/os.rst:2062 +#: ../../library/os.rst:2128 msgid "" "Although Windows supports :func:`chmod`, you can only set the file's read-" "only flag with it (via the ``stat.S_IWRITE`` and ``stat.S_IREAD`` constants " -"or a corresponding integer value). All other bits are ignored." +"or a corresponding integer value). All other bits are ignored. The default " +"value of *follow_symlinks* is ``False`` on Windows." msgstr "" -#: ../../library/os.rst:2071 ../../library/os.rst:2098 +#: ../../library/os.rst:2138 ../../library/os.rst:2169 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd* and *follow_symlinks* arguments." msgstr "" -#: ../../library/os.rst:2081 +#: ../../library/os.rst:2145 +msgid "" +"Added support for a file descriptor and the *follow_symlinks* argument on " +"Windows." +msgstr "" + +#: ../../library/os.rst:2152 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. To " "leave one of the ids unchanged, set it to -1." msgstr "" -#: ../../library/os.rst:2088 +#: ../../library/os.rst:2159 msgid "" "See :func:`shutil.chown` for a higher-level function that accepts names in " "addition to numeric ids." msgstr "" -#: ../../library/os.rst:2102 +#: ../../library/os.rst:2173 msgid "Supports a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:2108 +#: ../../library/os.rst:2179 msgid "Change the root directory of the current process to *path*." msgstr "" -#: ../../library/os.rst:2118 +#: ../../library/os.rst:2189 msgid "" "Change the current working directory to the directory represented by the " "file descriptor *fd*. The descriptor must refer to an opened directory, not " "an open file. As of Python 3.3, this is equivalent to ``os.chdir(fd)``." msgstr "" -#: ../../library/os.rst:2129 +#: ../../library/os.rst:2200 msgid "Return a string representing the current working directory." msgstr "" -#: ../../library/os.rst:2134 +#: ../../library/os.rst:2205 msgid "Return a bytestring representing the current working directory." msgstr "" -#: ../../library/os.rst:2136 +#: ../../library/os.rst:2207 msgid "" "The function now uses the UTF-8 encoding on Windows, rather than the ANSI " "code page: see :pep:`529` for the rationale. The function is no longer " "deprecated on Windows." msgstr "" -#: ../../library/os.rst:2144 +#: ../../library/os.rst:2215 msgid "" "Set the flags of *path* to the numeric *flags*, like :func:`chflags`, but do " "not follow symbolic links. As of Python 3.3, this is equivalent to ``os." "chflags(path, flags, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2158 +#: ../../library/os.rst:2229 msgid "" "Change the mode of *path* to the numeric *mode*. If path is a symlink, this " "affects the symlink rather than the target. See the docs for :func:`chmod` " @@ -2473,39 +2527,39 @@ msgid "" "chmod(path, mode, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2163 +#: ../../library/os.rst:2234 msgid "" "``lchmod()`` is not part of POSIX, but Unix implementations may have it if " "changing the mode of symbolic links is supported." msgstr "" -#: ../../library/os.rst:2168 +#: ../../library/os.rst:2239 msgid "" -":ref:`Availability `: Unix, not Linux, FreeBSD >= 1.3, NetBSD " -">= 1.3, not OpenBSD" +":ref:`Availability `: Unix, Windows, not Linux, FreeBSD >= " +"1.3, NetBSD >= 1.3, not OpenBSD" msgstr "" -":ref:`適用 `:Unix、非 Linux、FreeBSD 1.3 以上、NetBSD 1.3 以" -"上、非 OpenBSD。" +":ref:`適用 `:Unix、Windows、非 Linux、FreeBSD 1.3 以上、" +"NetBSD 1.3 以上、非 OpenBSD。" -#: ../../library/os.rst:2175 +#: ../../library/os.rst:2249 msgid "" "Change the owner and group id of *path* to the numeric *uid* and *gid*. " "This function will not follow symbolic links. As of Python 3.3, this is " "equivalent to ``os.chown(path, uid, gid, follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2189 +#: ../../library/os.rst:2263 msgid "Create a hard link pointing to *src* named *dst*." msgstr "" -#: ../../library/os.rst:2191 +#: ../../library/os.rst:2265 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `, and :ref:" "`not following symlinks `." msgstr "" -#: ../../library/os.rst:2195 +#: ../../library/os.rst:2269 msgid "" "Raises an :ref:`auditing event ` ``os.link`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." @@ -2513,24 +2567,20 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``src_dir_fd``、``dst_dir_fd`` 的\\ :ref:`" "稽核事件 ` ``os.link``。" -#: ../../library/os.rst:2197 -msgid ":ref:`Availability `: Unix, Windows, not Emscripten." -msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten。" - -#: ../../library/os.rst:2199 ../../library/os.rst:4256 +#: ../../library/os.rst:2273 ../../library/os.rst:4543 msgid "Added Windows support." msgstr "新支援 Windows。" -#: ../../library/os.rst:2202 +#: ../../library/os.rst:2276 msgid "Added the *src_dir_fd*, *dst_dir_fd*, and *follow_symlinks* parameters." msgstr "新增 *src_dir_fd*、*dst_dir_fd* 與 *follow_symlinks* 參數。" -#: ../../library/os.rst:2205 ../../library/os.rst:2629 -#: ../../library/os.rst:2666 ../../library/os.rst:3394 +#: ../../library/os.rst:2279 ../../library/os.rst:2703 +#: ../../library/os.rst:2740 ../../library/os.rst:3468 msgid "Accepts a :term:`path-like object` for *src* and *dst*." msgstr "" -#: ../../library/os.rst:2211 +#: ../../library/os.rst:2285 msgid "" "Return a list containing the names of the entries in the directory given by " "*path*. The list is in arbitrary order, and does not include the special " @@ -2539,7 +2589,7 @@ msgid "" "function, whether a name for that file be included is unspecified." msgstr "" -#: ../../library/os.rst:2217 +#: ../../library/os.rst:2291 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the " @@ -2547,42 +2597,42 @@ msgid "" "circumstances, they will be of type ``str``." msgstr "" -#: ../../library/os.rst:2222 ../../library/os.rst:2714 +#: ../../library/os.rst:2296 ../../library/os.rst:2788 msgid "" "This function can also support :ref:`specifying a file descriptor " "`; the file descriptor must refer to a directory." msgstr "" -#: ../../library/os.rst:2225 +#: ../../library/os.rst:2299 msgid "" "Raises an :ref:`auditing event ` ``os.listdir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.listdir``。" -#: ../../library/os.rst:2228 +#: ../../library/os.rst:2302 msgid "To encode ``str`` filenames to ``bytes``, use :func:`~os.fsencode`." msgstr "" -#: ../../library/os.rst:2232 +#: ../../library/os.rst:2306 msgid "" "The :func:`scandir` function returns directory entries along with file " "attribute information, giving better performance for many common use cases." msgstr "" -#: ../../library/os.rst:2236 +#: ../../library/os.rst:2310 msgid "The *path* parameter became optional." msgstr "" -#: ../../library/os.rst:2239 ../../library/os.rst:3253 +#: ../../library/os.rst:2313 ../../library/os.rst:3327 msgid "Added support for specifying *path* as an open file descriptor." msgstr "" -#: ../../library/os.rst:2248 +#: ../../library/os.rst:2322 msgid "Return a list containing the names of drives on a Windows system." msgstr "" -#: ../../library/os.rst:2250 +#: ../../library/os.rst:2324 msgid "" "A drive name typically looks like ``'C:\\\\'``. Not every drive name will be " "associated with a volume, and some may be inaccessible for a variety of " @@ -2590,27 +2640,27 @@ msgid "" "function does not test for access." msgstr "" -#: ../../library/os.rst:2255 +#: ../../library/os.rst:2329 msgid "May raise :exc:`OSError` if an error occurs collecting the drive names." msgstr "" -#: ../../library/os.rst:2258 +#: ../../library/os.rst:2332 msgid "" "Raises an :ref:`auditing event ` ``os.listdrives`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.listdrives``。" -#: ../../library/os.rst:2260 ../../library/os.rst:2284 -#: ../../library/os.rst:2304 +#: ../../library/os.rst:2334 ../../library/os.rst:2358 +#: ../../library/os.rst:2378 msgid ":ref:`Availability `: Windows" msgstr ":ref:`適用 `:Windows。" -#: ../../library/os.rst:2267 +#: ../../library/os.rst:2341 msgid "" "Return a list containing the mount points for a volume on a Windows system." msgstr "" -#: ../../library/os.rst:2270 +#: ../../library/os.rst:2344 msgid "" "*volume* must be represented as a GUID path, like those returned by :func:" "`os.listvolumes`. Volumes may be mounted in multiple locations or not at " @@ -2618,19 +2668,19 @@ msgid "" "associated with a volume will not be returned by this function." msgstr "" -#: ../../library/os.rst:2276 +#: ../../library/os.rst:2350 msgid "" "The mount points return by this function will be absolute paths, and may be " "longer than the drive name." msgstr "" -#: ../../library/os.rst:2279 +#: ../../library/os.rst:2353 msgid "" "Raises :exc:`OSError` if the volume is not recognized or if an error occurs " "collecting the paths." msgstr "" -#: ../../library/os.rst:2282 +#: ../../library/os.rst:2356 msgid "" "Raises an :ref:`auditing event ` ``os.listmounts`` with argument " "``volume``." @@ -2638,11 +2688,11 @@ msgstr "" "引發一個附帶引數 ``volume`` 的\\ :ref:`稽核事件 ` ``os." "listmounts``。" -#: ../../library/os.rst:2291 +#: ../../library/os.rst:2365 msgid "Return a list containing the volumes in the system." msgstr "" -#: ../../library/os.rst:2293 +#: ../../library/os.rst:2367 msgid "" "Volumes are typically represented as a GUID path that looks like ``\\\\?" "\\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\\``. Files can usually be " @@ -2651,49 +2701,49 @@ msgid "" "function is to retrieve mount points using :func:`os.listmounts`." msgstr "" -#: ../../library/os.rst:2300 +#: ../../library/os.rst:2374 msgid "May raise :exc:`OSError` if an error occurs collecting the volumes." msgstr "" -#: ../../library/os.rst:2302 +#: ../../library/os.rst:2376 msgid "" "Raises an :ref:`auditing event ` ``os.listvolumes`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.listvolumes``。" -#: ../../library/os.rst:2311 +#: ../../library/os.rst:2385 msgid "" "Perform the equivalent of an :c:func:`!lstat` system call on the given path. " "Similar to :func:`~os.stat`, but does not follow symbolic links. Return a :" "class:`stat_result` object." msgstr "" -#: ../../library/os.rst:2315 +#: ../../library/os.rst:2389 msgid "" "On platforms that do not support symbolic links, this is an alias for :func:" "`~os.stat`." msgstr "" -#: ../../library/os.rst:2318 +#: ../../library/os.rst:2392 msgid "" "As of Python 3.3, this is equivalent to ``os.stat(path, dir_fd=dir_fd, " "follow_symlinks=False)``." msgstr "" -#: ../../library/os.rst:2321 ../../library/os.rst:2363 -#: ../../library/os.rst:2431 ../../library/os.rst:2459 -#: ../../library/os.rst:2533 +#: ../../library/os.rst:2395 ../../library/os.rst:2437 +#: ../../library/os.rst:2505 ../../library/os.rst:2533 +#: ../../library/os.rst:2607 msgid "" "This function can also support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/os.rst:2328 ../../library/os.rst:2542 -#: ../../library/os.rst:3387 +#: ../../library/os.rst:2402 ../../library/os.rst:2616 +#: ../../library/os.rst:3461 msgid "Added support for Windows 6.0 (Vista) symbolic links." msgstr "" -#: ../../library/os.rst:2337 +#: ../../library/os.rst:2411 msgid "" "On Windows, now opens reparse points that represent another path (name " "surrogates), including symbolic links and directory junctions. Other kinds " @@ -2701,18 +2751,18 @@ msgid "" "stat`." msgstr "" -#: ../../library/os.rst:2346 +#: ../../library/os.rst:2420 msgid "Create a directory named *path* with numeric mode *mode*." msgstr "" -#: ../../library/os.rst:2348 +#: ../../library/os.rst:2422 msgid "" "If the directory already exists, :exc:`FileExistsError` is raised. If a " "parent directory in the path does not exist, :exc:`FileNotFoundError` is " "raised." msgstr "" -#: ../../library/os.rst:2353 +#: ../../library/os.rst:2427 msgid "" "On some systems, *mode* is ignored. Where it is used, the current umask " "value is first masked out. If bits other than the last 9 (i.e. the last 3 " @@ -2721,20 +2771,20 @@ msgid "" "call :func:`chmod` explicitly to set them." msgstr "" -#: ../../library/os.rst:2359 +#: ../../library/os.rst:2433 msgid "" "On Windows, a *mode* of ``0o700`` is specifically handled to apply access " "control to the new directory such that only the current user and " "administrators have access. Other values of *mode* are ignored." msgstr "" -#: ../../library/os.rst:2366 +#: ../../library/os.rst:2440 msgid "" "It is also possible to create temporary directories; see the :mod:`tempfile` " "module's :func:`tempfile.mkdtemp` function." msgstr "" -#: ../../library/os.rst:2369 ../../library/os.rst:2406 +#: ../../library/os.rst:2443 ../../library/os.rst:2480 msgid "" "Raises an :ref:`auditing event ` ``os.mkdir`` with arguments " "``path``, ``mode``, ``dir_fd``." @@ -2742,17 +2792,17 @@ msgstr "" "引發一個附帶引數 ``path``、``mode``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.mkdir``。" -#: ../../library/os.rst:2377 +#: ../../library/os.rst:2451 msgid "Windows now handles a *mode* of ``0o700``." msgstr "" -#: ../../library/os.rst:2387 +#: ../../library/os.rst:2461 msgid "" "Recursive directory creation function. Like :func:`mkdir`, but makes all " "intermediate-level directories needed to contain the leaf directory." msgstr "" -#: ../../library/os.rst:2390 +#: ../../library/os.rst:2464 msgid "" "The *mode* parameter is passed to :func:`mkdir` for creating the leaf " "directory; see :ref:`the mkdir() description ` for how it is " @@ -2761,27 +2811,27 @@ msgid "" "file permission bits of existing parent directories are not changed." msgstr "" -#: ../../library/os.rst:2396 +#: ../../library/os.rst:2470 msgid "" "If *exist_ok* is ``False`` (the default), a :exc:`FileExistsError` is raised " "if the target directory already exists." msgstr "" -#: ../../library/os.rst:2401 +#: ../../library/os.rst:2475 msgid "" ":func:`makedirs` will become confused if the path elements to create " "include :data:`pardir` (eg. \"..\" on UNIX systems)." msgstr "" -#: ../../library/os.rst:2404 +#: ../../library/os.rst:2478 msgid "This function handles UNC paths correctly." msgstr "" -#: ../../library/os.rst:2408 +#: ../../library/os.rst:2482 msgid "Added the *exist_ok* parameter." msgstr "新增 *exist_ok* 參數。" -#: ../../library/os.rst:2413 +#: ../../library/os.rst:2487 msgid "" "Before Python 3.4.1, if *exist_ok* was ``True`` and the directory existed, :" "func:`makedirs` would still raise an error if *mode* did not match the mode " @@ -2789,19 +2839,19 @@ msgid "" "safely, it was removed in Python 3.4.1. See :issue:`21082`." msgstr "" -#: ../../library/os.rst:2421 +#: ../../library/os.rst:2495 msgid "" "The *mode* argument no longer affects the file permission bits of newly " "created intermediate-level directories." msgstr "" -#: ../../library/os.rst:2428 +#: ../../library/os.rst:2502 msgid "" "Create a FIFO (a named pipe) named *path* with numeric mode *mode*. The " "current umask value is first masked out from the mode." msgstr "" -#: ../../library/os.rst:2434 +#: ../../library/os.rst:2508 msgid "" "FIFOs are pipes that can be accessed like regular files. FIFOs exist until " "they are deleted (for example with :func:`os.unlink`). Generally, FIFOs are " @@ -2811,7 +2861,7 @@ msgid "" "rendezvous point." msgstr "" -#: ../../library/os.rst:2451 +#: ../../library/os.rst:2525 msgid "" "Create a filesystem node (file, device special file or named pipe) named " "*path*. *mode* specifies both the permissions to use and the type of node to " @@ -2822,23 +2872,23 @@ msgid "" "`os.makedev`), otherwise it is ignored." msgstr "" -#: ../../library/os.rst:2473 +#: ../../library/os.rst:2547 msgid "" "Extract the device major number from a raw device number (usually the :attr:" "`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" -#: ../../library/os.rst:2479 +#: ../../library/os.rst:2553 msgid "" "Extract the device minor number from a raw device number (usually the :attr:" "`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`)." msgstr "" -#: ../../library/os.rst:2485 +#: ../../library/os.rst:2559 msgid "Compose a raw device number from the major and minor device numbers." msgstr "" -#: ../../library/os.rst:2490 +#: ../../library/os.rst:2564 msgid "" "Return system configuration information relevant to a named file. *name* " "specifies the configuration value to retrieve; it may be a string which is " @@ -2849,20 +2899,20 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:2503 ../../library/os.rst:3246 -#: ../../library/os.rst:3415 +#: ../../library/os.rst:2577 ../../library/os.rst:3320 +#: ../../library/os.rst:3489 msgid "" "This function can support :ref:`specifying a file descriptor `." msgstr "" -#: ../../library/os.rst:2514 +#: ../../library/os.rst:2588 msgid "" "Dictionary mapping names accepted by :func:`pathconf` and :func:`fpathconf` " "to the integer values defined for those names by the host operating system. " "This can be used to determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:2523 +#: ../../library/os.rst:2597 msgid "" "Return a string representing the path to which the symbolic link points. " "The result may be either an absolute or relative pathname; if it is " @@ -2870,7 +2920,7 @@ msgid "" "join(os.path.dirname(path), result)``." msgstr "" -#: ../../library/os.rst:2528 +#: ../../library/os.rst:2602 msgid "" "If the *path* is a string object (directly or indirectly through a :class:" "`PathLike` interface), the result will also be a string object, and the call " @@ -2878,42 +2928,42 @@ msgid "" "indirectly), the result will be a bytes object." msgstr "" -#: ../../library/os.rst:2536 +#: ../../library/os.rst:2610 msgid "" "When trying to resolve a path that may contain links, use :func:`~os.path." "realpath` to properly handle recursion and platform differences." msgstr "" -#: ../../library/os.rst:2548 +#: ../../library/os.rst:2622 msgid "Accepts a :term:`path-like object` on Unix." msgstr "" -#: ../../library/os.rst:2551 +#: ../../library/os.rst:2625 msgid "Accepts a :term:`path-like object` and a bytes object on Windows." msgstr "" -#: ../../library/os.rst:2554 +#: ../../library/os.rst:2628 msgid "" "Added support for directory junctions, and changed to return the " "substitution path (which typically includes ``\\\\?\\`` prefix) rather than " "the optional \"print name\" field that was previously returned." msgstr "" -#: ../../library/os.rst:2560 +#: ../../library/os.rst:2634 msgid "" "Remove (delete) the file *path*. If *path* is a directory, an :exc:" "`OSError` is raised. Use :func:`rmdir` to remove directories. If the file " "does not exist, a :exc:`FileNotFoundError` is raised." msgstr "" -#: ../../library/os.rst:2564 ../../library/os.rst:2677 -#: ../../library/os.rst:3366 +#: ../../library/os.rst:2638 ../../library/os.rst:2751 +#: ../../library/os.rst:3440 msgid "" "This function can support :ref:`paths relative to directory descriptors " "`." msgstr "" -#: ../../library/os.rst:2567 +#: ../../library/os.rst:2641 msgid "" "On Windows, attempting to remove a file that is in use causes an exception " "to be raised; on Unix, the directory entry is removed but the storage " @@ -2921,12 +2971,12 @@ msgid "" "longer in use." msgstr "" -#: ../../library/os.rst:2571 +#: ../../library/os.rst:2645 msgid "This function is semantically identical to :func:`unlink`." msgstr "" -#: ../../library/os.rst:2573 ../../library/os.rst:2595 -#: ../../library/os.rst:3437 +#: ../../library/os.rst:2647 ../../library/os.rst:2669 +#: ../../library/os.rst:3511 msgid "" "Raises an :ref:`auditing event ` ``os.remove`` with arguments " "``path``, ``dir_fd``." @@ -2934,7 +2984,7 @@ msgstr "" "引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` ``os." "remove``。" -#: ../../library/os.rst:2586 +#: ../../library/os.rst:2660 msgid "" "Remove directories recursively. Works like :func:`rmdir` except that, if " "the leaf directory is successfully removed, :func:`removedirs` tries to " @@ -2946,20 +2996,20 @@ msgid "" "could not be successfully removed." msgstr "" -#: ../../library/os.rst:2603 +#: ../../library/os.rst:2677 msgid "" "Rename the file or directory *src* to *dst*. If *dst* exists, the operation " "will fail with an :exc:`OSError` subclass in a number of cases:" msgstr "" -#: ../../library/os.rst:2606 +#: ../../library/os.rst:2680 msgid "" "On Windows, if *dst* exists a :exc:`FileExistsError` is always raised. The " "operation may fail if *src* and *dst* are on different filesystems. Use :" "func:`shutil.move` to support moves to a different filesystem." msgstr "" -#: ../../library/os.rst:2610 +#: ../../library/os.rst:2684 msgid "" "On Unix, if *src* is a file and *dst* is a directory or vice-versa, an :exc:" "`IsADirectoryError` or a :exc:`NotADirectoryError` will be raised " @@ -2971,20 +3021,20 @@ msgid "" "operation (this is a POSIX requirement)." msgstr "" -#: ../../library/os.rst:2619 ../../library/os.rst:2659 +#: ../../library/os.rst:2693 ../../library/os.rst:2733 msgid "" "This function can support specifying *src_dir_fd* and/or *dst_dir_fd* to " "supply :ref:`paths relative to directory descriptors `." msgstr "" -#: ../../library/os.rst:2622 +#: ../../library/os.rst:2696 msgid "" "If you want cross-platform overwriting of the destination, use :func:" "`replace`." msgstr "" -#: ../../library/os.rst:2624 ../../library/os.rst:2645 -#: ../../library/os.rst:2662 +#: ../../library/os.rst:2698 ../../library/os.rst:2719 +#: ../../library/os.rst:2736 msgid "" "Raises an :ref:`auditing event ` ``os.rename`` with arguments " "``src``, ``dst``, ``src_dir_fd``, ``dst_dir_fd``." @@ -2992,11 +3042,11 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``src_dir_fd``、``dst_dir_fd`` 的\\ :ref:`" "稽核事件 ` ``os.rename``。" -#: ../../library/os.rst:2626 +#: ../../library/os.rst:2700 msgid "Added the *src_dir_fd* and *dst_dir_fd* parameters." msgstr "新增 *src_dir_fd* 與 *dst_dir_fd* 參數。" -#: ../../library/os.rst:2635 +#: ../../library/os.rst:2709 msgid "" "Recursive directory or file renaming function. Works like :func:`rename`, " "except creation of any intermediate directories needed to make the new " @@ -3005,17 +3055,17 @@ msgid "" "using :func:`removedirs`." msgstr "" -#: ../../library/os.rst:2642 +#: ../../library/os.rst:2716 msgid "" "This function can fail with the new directory structure made if you lack " "permissions needed to remove the leaf directory or file." msgstr "" -#: ../../library/os.rst:2647 +#: ../../library/os.rst:2721 msgid "Accepts a :term:`path-like object` for *old* and *new*." msgstr "" -#: ../../library/os.rst:2653 +#: ../../library/os.rst:2727 msgid "" "Rename the file or directory *src* to *dst*. If *dst* is a non-empty " "directory, :exc:`OSError` will be raised. If *dst* exists and is a file, it " @@ -3024,7 +3074,7 @@ msgid "" "renaming will be an atomic operation (this is a POSIX requirement)." msgstr "" -#: ../../library/os.rst:2672 +#: ../../library/os.rst:2746 msgid "" "Remove (delete) the directory *path*. If the directory does not exist or is " "not empty, a :exc:`FileNotFoundError` or an :exc:`OSError` is raised " @@ -3032,7 +3082,7 @@ msgid "" "rmtree` can be used." msgstr "" -#: ../../library/os.rst:2680 +#: ../../library/os.rst:2754 msgid "" "Raises an :ref:`auditing event ` ``os.rmdir`` with arguments " "``path``, ``dir_fd``." @@ -3040,7 +3090,7 @@ msgstr "" "引發一個附帶引數 ``path``、``dir_fd`` 的\\ :ref:`稽核事件 ` ``os." "rmdir``。" -#: ../../library/os.rst:2691 +#: ../../library/os.rst:2765 msgid "" "Return an iterator of :class:`os.DirEntry` objects corresponding to the " "entries in the directory given by *path*. The entries are yielded in " @@ -3050,7 +3100,7 @@ msgid "" "unspecified." msgstr "" -#: ../../library/os.rst:2698 +#: ../../library/os.rst:2772 msgid "" "Using :func:`scandir` instead of :func:`listdir` can significantly increase " "the performance of code that also needs file type or file attribute " @@ -3062,7 +3112,7 @@ msgid "" "Unix but only requires one for symbolic links on Windows." msgstr "" -#: ../../library/os.rst:2708 +#: ../../library/os.rst:2782 msgid "" "*path* may be a :term:`path-like object`. If *path* is of type ``bytes`` " "(directly or indirectly through the :class:`PathLike` interface), the type " @@ -3071,31 +3121,31 @@ msgid "" "they will be of type ``str``." msgstr "" -#: ../../library/os.rst:2717 +#: ../../library/os.rst:2791 msgid "" "Raises an :ref:`auditing event ` ``os.scandir`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.scandir``。" -#: ../../library/os.rst:2719 +#: ../../library/os.rst:2793 msgid "" "The :func:`scandir` iterator supports the :term:`context manager` protocol " "and has the following method:" msgstr "" -#: ../../library/os.rst:2724 +#: ../../library/os.rst:2798 msgid "Close the iterator and free acquired resources." msgstr "" -#: ../../library/os.rst:2726 +#: ../../library/os.rst:2800 msgid "" "This is called automatically when the iterator is exhausted or garbage " "collected, or when an error happens during iterating. However it is " "advisable to call it explicitly or use the :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:2733 +#: ../../library/os.rst:2807 msgid "" "The following example shows a simple use of :func:`scandir` to display all " "the files (excluding directories) in the given *path* that don't start with " @@ -3103,7 +3153,7 @@ msgid "" "system call::" msgstr "" -#: ../../library/os.rst:2738 +#: ../../library/os.rst:2812 msgid "" "with os.scandir(path) as it:\n" " for entry in it:\n" @@ -3115,7 +3165,7 @@ msgstr "" " if not entry.name.startswith('.') and entry.is_file():\n" " print(entry.name)" -#: ../../library/os.rst:2745 +#: ../../library/os.rst:2819 msgid "" "On Unix-based systems, :func:`scandir` uses the system's `opendir() `_ and " @@ -3126,7 +3176,7 @@ msgid "" "desktop/aa364428(v=vs.85).aspx>`_ functions." msgstr "" -#: ../../library/os.rst:2757 +#: ../../library/os.rst:2831 msgid "" "Added support for the :term:`context manager` protocol and the :func:" "`~scandir.close` method. If a :func:`scandir` iterator is neither exhausted " @@ -3134,28 +3184,28 @@ msgid "" "destructor." msgstr "" -#: ../../library/os.rst:2763 +#: ../../library/os.rst:2837 msgid "The function accepts a :term:`path-like object`." msgstr "" -#: ../../library/os.rst:2765 +#: ../../library/os.rst:2839 msgid "Added support for :ref:`file descriptors ` on Unix." msgstr "" -#: ../../library/os.rst:2771 +#: ../../library/os.rst:2845 msgid "" "Object yielded by :func:`scandir` to expose the file path and other file " "attributes of a directory entry." msgstr "" -#: ../../library/os.rst:2774 +#: ../../library/os.rst:2848 msgid "" ":func:`scandir` will provide as much of this information as possible without " "making additional system calls. When a ``stat()`` or ``lstat()`` system call " "is made, the ``os.DirEntry`` object will cache the result." msgstr "" -#: ../../library/os.rst:2778 +#: ../../library/os.rst:2852 msgid "" "``os.DirEntry`` instances are not intended to be stored in long-lived data " "structures; if you know the file metadata has changed or if a long time has " @@ -3163,7 +3213,7 @@ msgid "" "up-to-date information." msgstr "" -#: ../../library/os.rst:2783 +#: ../../library/os.rst:2857 msgid "" "Because the ``os.DirEntry`` methods can make operating system calls, they " "may also raise :exc:`OSError`. If you need very fine-grained control over " @@ -3171,29 +3221,29 @@ msgid "" "methods and handle as appropriate." msgstr "" -#: ../../library/os.rst:2788 +#: ../../library/os.rst:2862 msgid "" "To be directly usable as a :term:`path-like object`, ``os.DirEntry`` " "implements the :class:`PathLike` interface." msgstr "" -#: ../../library/os.rst:2791 +#: ../../library/os.rst:2865 msgid "Attributes and methods on a ``os.DirEntry`` instance are as follows:" msgstr "" -#: ../../library/os.rst:2795 +#: ../../library/os.rst:2869 msgid "" "The entry's base filename, relative to the :func:`scandir` *path* argument." msgstr "" -#: ../../library/os.rst:2798 +#: ../../library/os.rst:2872 msgid "" "The :attr:`name` attribute will be ``bytes`` if the :func:`scandir` *path* " "argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." "fsdecode` to decode byte filenames." msgstr "" -#: ../../library/os.rst:2804 +#: ../../library/os.rst:2878 msgid "" "The entry's full path name: equivalent to ``os.path.join(scandir_path, entry." "name)`` where *scandir_path* is the :func:`scandir` *path* argument. The " @@ -3203,51 +3253,51 @@ msgid "" "attribute." msgstr "" -#: ../../library/os.rst:2811 +#: ../../library/os.rst:2885 msgid "" "The :attr:`path` attribute will be ``bytes`` if the :func:`scandir` *path* " "argument is of type ``bytes`` and ``str`` otherwise. Use :func:`~os." "fsdecode` to decode byte filenames." msgstr "" -#: ../../library/os.rst:2817 +#: ../../library/os.rst:2891 msgid "Return the inode number of the entry." msgstr "" -#: ../../library/os.rst:2819 +#: ../../library/os.rst:2893 msgid "" "The result is cached on the ``os.DirEntry`` object. Use ``os.stat(entry." "path, follow_symlinks=False).st_ino`` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2823 +#: ../../library/os.rst:2897 msgid "" "On the first, uncached call, a system call is required on Windows but not on " "Unix." msgstr "" -#: ../../library/os.rst:2828 +#: ../../library/os.rst:2902 msgid "" "Return ``True`` if this entry is a directory or a symbolic link pointing to " "a directory; return ``False`` if the entry is or points to any other kind of " "file, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2832 +#: ../../library/os.rst:2906 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "directory (without following symlinks); return ``False`` if the entry is any " "other kind of file or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2836 +#: ../../library/os.rst:2910 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` along " "with :func:`stat.S_ISDIR` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2840 +#: ../../library/os.rst:2914 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, for non-symlinks, neither Windows or Unix require a system " @@ -3257,46 +3307,46 @@ msgid "" "is ``False``." msgstr "" -#: ../../library/os.rst:2847 ../../library/os.rst:2877 +#: ../../library/os.rst:2921 ../../library/os.rst:2951 msgid "" "This method can raise :exc:`OSError`, such as :exc:`PermissionError`, but :" "exc:`FileNotFoundError` is caught and not raised." msgstr "" -#: ../../library/os.rst:2852 +#: ../../library/os.rst:2926 msgid "" "Return ``True`` if this entry is a file or a symbolic link pointing to a " "file; return ``False`` if the entry is or points to a directory or other non-" "file entry, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2856 +#: ../../library/os.rst:2930 msgid "" "If *follow_symlinks* is ``False``, return ``True`` only if this entry is a " "file (without following symlinks); return ``False`` if the entry is a " "directory or other non-file entry, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2860 +#: ../../library/os.rst:2934 msgid "" "The result is cached on the ``os.DirEntry`` object. Caching, system calls " "made, and exceptions raised are as per :func:`~os.DirEntry.is_dir`." msgstr "" -#: ../../library/os.rst:2865 +#: ../../library/os.rst:2939 msgid "" "Return ``True`` if this entry is a symbolic link (even if broken); return " "``False`` if the entry points to a directory or any kind of file, or if it " "doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2869 +#: ../../library/os.rst:2943 msgid "" "The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." "islink` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2872 +#: ../../library/os.rst:2946 msgid "" "On the first, uncached call, no system call is required in most cases. " "Specifically, neither Windows or Unix require a system call, except on " @@ -3304,48 +3354,48 @@ msgid "" "``dirent.d_type == DT_UNKNOWN``." msgstr "" -#: ../../library/os.rst:2882 +#: ../../library/os.rst:2956 msgid "" "Return ``True`` if this entry is a junction (even if broken); return " "``False`` if the entry points to a regular directory, any kind of file, a " "symlink, or if it doesn't exist anymore." msgstr "" -#: ../../library/os.rst:2886 +#: ../../library/os.rst:2960 msgid "" "The result is cached on the ``os.DirEntry`` object. Call :func:`os.path." "isjunction` to fetch up-to-date information." msgstr "" -#: ../../library/os.rst:2893 +#: ../../library/os.rst:2967 msgid "" "Return a :class:`stat_result` object for this entry. This method follows " "symbolic links by default; to stat a symbolic link add the " "``follow_symlinks=False`` argument." msgstr "" -#: ../../library/os.rst:2897 +#: ../../library/os.rst:2971 msgid "" "On Unix, this method always requires a system call. On Windows, it only " "requires a system call if *follow_symlinks* is ``True`` and the entry is a " "reparse point (for example, a symbolic link or directory junction)." msgstr "" -#: ../../library/os.rst:2902 +#: ../../library/os.rst:2976 msgid "" "On Windows, the ``st_ino``, ``st_dev`` and ``st_nlink`` attributes of the :" "class:`stat_result` are always set to zero. Call :func:`os.stat` to get " "these attributes." msgstr "" -#: ../../library/os.rst:2906 +#: ../../library/os.rst:2980 msgid "" "The result is cached on the ``os.DirEntry`` object, with a separate cache " "for *follow_symlinks* ``True`` and ``False``. Call :func:`os.stat` to fetch " "up-to-date information." msgstr "" -#: ../../library/os.rst:2910 +#: ../../library/os.rst:2984 msgid "" "Note that there is a nice correspondence between several attributes and " "methods of ``os.DirEntry`` and of :class:`pathlib.Path`. In particular, the " @@ -3353,13 +3403,13 @@ msgid "" "``is_file()``, ``is_symlink()``, ``is_junction()``, and ``stat()`` methods." msgstr "" -#: ../../library/os.rst:2918 +#: ../../library/os.rst:2992 msgid "" "Added support for the :class:`~os.PathLike` interface. Added support for :" "class:`bytes` paths on Windows." msgstr "" -#: ../../library/os.rst:2922 +#: ../../library/os.rst:2996 msgid "" "The ``st_ctime`` attribute of a stat result is deprecated on Windows. The " "file creation time is properly available as ``st_birthtime``, and in the " @@ -3367,7 +3417,7 @@ msgid "" "time, if available." msgstr "" -#: ../../library/os.rst:2931 +#: ../../library/os.rst:3005 msgid "" "Get the status of a file or a file descriptor. Perform the equivalent of a :" "c:func:`stat` system call on the given path. *path* may be specified as " @@ -3376,21 +3426,21 @@ msgid "" "`stat_result` object." msgstr "" -#: ../../library/os.rst:2937 +#: ../../library/os.rst:3011 msgid "" "This function normally follows symlinks; to stat a symlink add the argument " "``follow_symlinks=False``, or use :func:`lstat`." msgstr "" -#: ../../library/os.rst:2940 ../../library/os.rst:3805 -#: ../../library/os.rst:3821 ../../library/os.rst:3837 -#: ../../library/os.rst:3857 +#: ../../library/os.rst:3014 ../../library/os.rst:4092 +#: ../../library/os.rst:4108 ../../library/os.rst:4124 +#: ../../library/os.rst:4144 msgid "" "This function can support :ref:`specifying a file descriptor ` and :" "ref:`not following symlinks `." msgstr "" -#: ../../library/os.rst:2943 +#: ../../library/os.rst:3017 msgid "" "On Windows, passing ``follow_symlinks=False`` will disable following all " "name-surrogate reparse points, which includes symlinks and directory " @@ -3404,11 +3454,11 @@ msgid "" "junction points, which will raise the usual exceptions." msgstr "" -#: ../../library/os.rst:2956 ../../library/os.rst:3725 +#: ../../library/os.rst:3030 ../../library/os.rst:3799 msgid "Example::" msgstr "範例: ::" -#: ../../library/os.rst:2958 +#: ../../library/os.rst:3032 msgid "" ">>> import os\n" ">>> statinfo = os.stat('somefile.txt')\n" @@ -3428,17 +3478,17 @@ msgstr "" ">>> statinfo.st_size\n" "264" -#: ../../library/os.rst:2969 +#: ../../library/os.rst:3043 msgid ":func:`fstat` and :func:`lstat` functions." msgstr ":func:`fstat` 和 :func:`lstat` 函式。" -#: ../../library/os.rst:2971 +#: ../../library/os.rst:3045 msgid "" "Added the *dir_fd* and *follow_symlinks* parameters, specifying a file " "descriptor instead of a path." msgstr "新增 *dir_fd* 與 *follow_symlinks* 參數,指定一個檔案描述器而非路徑。" -#: ../../library/os.rst:2978 +#: ../../library/os.rst:3052 msgid "" "On Windows, all reparse points that can be resolved by the operating system " "are now followed, and passing ``follow_symlinks=False`` disables following " @@ -3448,122 +3498,122 @@ msgid "" "of raising an error." msgstr "" -#: ../../library/os.rst:2989 +#: ../../library/os.rst:3063 msgid "" "Object whose attributes correspond roughly to the members of the :c:struct:" "`stat` structure. It is used for the result of :func:`os.stat`, :func:`os." "fstat` and :func:`os.lstat`." msgstr "" -#: ../../library/os.rst:2993 +#: ../../library/os.rst:3067 msgid "Attributes:" msgstr "屬性:" -#: ../../library/os.rst:2997 +#: ../../library/os.rst:3071 msgid "File mode: file type and file mode bits (permissions)." msgstr "" -#: ../../library/os.rst:3001 +#: ../../library/os.rst:3075 msgid "" "Platform dependent, but if non-zero, uniquely identifies the file for a " "given value of ``st_dev``. Typically:" msgstr "" -#: ../../library/os.rst:3004 +#: ../../library/os.rst:3078 msgid "the inode number on Unix," msgstr "" -#: ../../library/os.rst:3005 +#: ../../library/os.rst:3079 msgid "" "the `file index `_ on " "Windows" msgstr "" -#: ../../library/os.rst:3011 +#: ../../library/os.rst:3085 msgid "Identifier of the device on which this file resides." msgstr "" -#: ../../library/os.rst:3015 +#: ../../library/os.rst:3089 msgid "Number of hard links." msgstr "" -#: ../../library/os.rst:3019 +#: ../../library/os.rst:3093 msgid "User identifier of the file owner." msgstr "" -#: ../../library/os.rst:3023 +#: ../../library/os.rst:3097 msgid "Group identifier of the file owner." msgstr "" -#: ../../library/os.rst:3027 +#: ../../library/os.rst:3101 msgid "" "Size of the file in bytes, if it is a regular file or a symbolic link. The " "size of a symbolic link is the length of the pathname it contains, without a " "terminating null byte." msgstr "" -#: ../../library/os.rst:3031 +#: ../../library/os.rst:3105 msgid "Timestamps:" msgstr "" -#: ../../library/os.rst:3035 +#: ../../library/os.rst:3109 msgid "Time of most recent access expressed in seconds." msgstr "" -#: ../../library/os.rst:3039 +#: ../../library/os.rst:3113 msgid "Time of most recent content modification expressed in seconds." msgstr "" -#: ../../library/os.rst:3043 +#: ../../library/os.rst:3117 msgid "Time of most recent metadata change expressed in seconds." msgstr "" -#: ../../library/os.rst:3045 +#: ../../library/os.rst:3119 msgid "" "``st_ctime`` is deprecated on Windows. Use ``st_birthtime`` for the file " "creation time. In the future, ``st_ctime`` will contain the time of the most " "recent metadata change, as for other platforms." msgstr "" -#: ../../library/os.rst:3052 +#: ../../library/os.rst:3126 msgid "Time of most recent access expressed in nanoseconds as an integer." msgstr "" -#: ../../library/os.rst:3058 +#: ../../library/os.rst:3132 msgid "" "Time of most recent content modification expressed in nanoseconds as an " "integer." msgstr "" -#: ../../library/os.rst:3065 +#: ../../library/os.rst:3139 msgid "" "Time of most recent metadata change expressed in nanoseconds as an integer." msgstr "" -#: ../../library/os.rst:3070 +#: ../../library/os.rst:3144 msgid "" "``st_ctime_ns`` is deprecated on Windows. Use ``st_birthtime_ns`` for the " "file creation time. In the future, ``st_ctime`` will contain the time of the " "most recent metadata change, as for other platforms." msgstr "" -#: ../../library/os.rst:3077 +#: ../../library/os.rst:3151 msgid "" "Time of file creation expressed in seconds. This attribute is not always " "available, and may raise :exc:`AttributeError`." msgstr "" -#: ../../library/os.rst:3080 +#: ../../library/os.rst:3154 msgid "``st_birthtime`` is now available on Windows." msgstr "" -#: ../../library/os.rst:3085 +#: ../../library/os.rst:3159 msgid "" "Time of file creation expressed in nanoseconds as an integer. This attribute " "is not always available, and may raise :exc:`AttributeError`." msgstr "" -#: ../../library/os.rst:3093 +#: ../../library/os.rst:3167 msgid "" "The exact meaning and resolution of the :attr:`st_atime`, :attr:`st_mtime`, :" "attr:`st_ctime` and :attr:`st_birthtime` attributes depend on the operating " @@ -3573,7 +3623,7 @@ msgid "" "details." msgstr "" -#: ../../library/os.rst:3100 +#: ../../library/os.rst:3174 msgid "" "Similarly, although :attr:`st_atime_ns`, :attr:`st_mtime_ns`, :attr:" "`st_ctime_ns` and :attr:`st_birthtime_ns` are always expressed in " @@ -3586,74 +3636,74 @@ msgid "" "`st_birthtime_ns`." msgstr "" -#: ../../library/os.rst:3110 +#: ../../library/os.rst:3184 msgid "" "On some Unix systems (such as Linux), the following attributes may also be " "available:" msgstr "" -#: ../../library/os.rst:3115 +#: ../../library/os.rst:3189 msgid "" "Number of 512-byte blocks allocated for file. This may be smaller than :attr:" "`st_size`/512 when the file has holes." msgstr "" -#: ../../library/os.rst:3120 +#: ../../library/os.rst:3194 msgid "" "\"Preferred\" blocksize for efficient file system I/O. Writing to a file in " "smaller chunks may cause an inefficient read-modify-rewrite." msgstr "" -#: ../../library/os.rst:3125 +#: ../../library/os.rst:3199 msgid "Type of device if an inode device." msgstr "" -#: ../../library/os.rst:3129 +#: ../../library/os.rst:3203 msgid "User defined flags for file." msgstr "" -#: ../../library/os.rst:3131 +#: ../../library/os.rst:3205 msgid "" "On other Unix systems (such as FreeBSD), the following attributes may be " "available (but may be only filled out if root tries to use them):" msgstr "" -#: ../../library/os.rst:3136 +#: ../../library/os.rst:3210 msgid "File generation number." msgstr "" -#: ../../library/os.rst:3138 +#: ../../library/os.rst:3212 msgid "" "On Solaris and derivatives, the following attributes may also be available:" msgstr "" -#: ../../library/os.rst:3143 +#: ../../library/os.rst:3217 msgid "" "String that uniquely identifies the type of the filesystem that contains the " "file." msgstr "" -#: ../../library/os.rst:3146 +#: ../../library/os.rst:3220 msgid "On macOS systems, the following attributes may also be available:" msgstr "" -#: ../../library/os.rst:3150 +#: ../../library/os.rst:3224 msgid "Real size of the file." msgstr "" -#: ../../library/os.rst:3154 +#: ../../library/os.rst:3228 msgid "Creator of the file." msgstr "" -#: ../../library/os.rst:3158 +#: ../../library/os.rst:3232 msgid "File type." msgstr "" -#: ../../library/os.rst:3160 +#: ../../library/os.rst:3234 msgid "On Windows systems, the following attributes are also available:" msgstr "" -#: ../../library/os.rst:3164 +#: ../../library/os.rst:3238 msgid "" "Windows file attributes: ``dwFileAttributes`` member of the " "``BY_HANDLE_FILE_INFORMATION`` structure returned by :c:func:`!" @@ -3661,7 +3711,7 @@ msgid "" "FILE_ATTRIBUTE_ARCHIVE>` constants in the :mod:`stat` module." msgstr "" -#: ../../library/os.rst:3174 +#: ../../library/os.rst:3248 msgid "" "When :attr:`st_file_attributes` has the :const:`~stat." "FILE_ATTRIBUTE_REPARSE_POINT` set, this field contains the tag identifying " @@ -3669,14 +3719,14 @@ msgid "" "IO_REPARSE_TAG_SYMLINK>` constants in the :mod:`stat` module." msgstr "" -#: ../../library/os.rst:3179 +#: ../../library/os.rst:3253 msgid "" "The standard module :mod:`stat` defines functions and constants that are " "useful for extracting information from a :c:struct:`stat` structure. (On " "Windows, some items are filled with dummy values.)" msgstr "" -#: ../../library/os.rst:3183 +#: ../../library/os.rst:3257 msgid "" "For backward compatibility, a :class:`stat_result` instance is also " "accessible as a tuple of at least 10 integers giving the most important (and " @@ -3688,49 +3738,49 @@ msgid "" "class:`stat_result` as a tuple always returns integers." msgstr "" -#: ../../library/os.rst:3192 +#: ../../library/os.rst:3266 msgid "Windows now returns the file index as :attr:`st_ino` when available." msgstr "" -#: ../../library/os.rst:3196 +#: ../../library/os.rst:3270 msgid "Added the :attr:`st_fstype` member to Solaris/derivatives." msgstr "" -#: ../../library/os.rst:3199 +#: ../../library/os.rst:3273 msgid "Added the :attr:`st_reparse_tag` member on Windows." msgstr "在 Windows 上新增 :attr:`st_reparse_tag` 成員。" -#: ../../library/os.rst:3202 +#: ../../library/os.rst:3276 msgid "" "On Windows, the :attr:`st_mode` member now identifies special files as :" "const:`S_IFCHR`, :const:`S_IFIFO` or :const:`S_IFBLK` as appropriate." msgstr "" -#: ../../library/os.rst:3207 +#: ../../library/os.rst:3281 msgid "" "On Windows, :attr:`st_ctime` is deprecated. Eventually, it will contain the " "last metadata change time, for consistency with other platforms, but for now " "still contains creation time. Use :attr:`st_birthtime` for the creation time." msgstr "" -#: ../../library/os.rst:3213 +#: ../../library/os.rst:3287 msgid "" "On Windows, :attr:`st_ino` may now be up to 128 bits, depending on the file " "system. Previously it would not be above 64 bits, and larger file " "identifiers would be arbitrarily packed." msgstr "" -#: ../../library/os.rst:3217 +#: ../../library/os.rst:3291 msgid "" "On Windows, :attr:`st_rdev` no longer returns a value. Previously it would " "contain the same as :attr:`st_dev`, which was incorrect." msgstr "" -#: ../../library/os.rst:3220 +#: ../../library/os.rst:3294 msgid "Added the :attr:`st_birthtime` member on Windows." msgstr "在 Windows 上新增 :attr:`st_birthtime` 成員。" -#: ../../library/os.rst:3225 +#: ../../library/os.rst:3299 msgid "" "Perform a :c:func:`!statvfs` system call on the given path. The return " "value is an object whose attributes describe the filesystem on the given " @@ -3740,7 +3790,7 @@ msgid "" "`f_favail`, :attr:`f_flag`, :attr:`f_namemax`, :attr:`f_fsid`." msgstr "" -#: ../../library/os.rst:3232 +#: ../../library/os.rst:3306 msgid "" "Two module-level constants are defined for the :attr:`f_flag` attribute's " "bit-flags: if :const:`ST_RDONLY` is set, the filesystem is mounted read-" @@ -3748,7 +3798,7 @@ msgid "" "are disabled or not supported." msgstr "" -#: ../../library/os.rst:3237 +#: ../../library/os.rst:3311 msgid "" "Additional module-level constants are defined for GNU/glibc based systems. " "These are :const:`ST_NODEV` (disallow access to device special files), :" @@ -3761,11 +3811,11 @@ msgid "" "relative to mtime/ctime)." msgstr "" -#: ../../library/os.rst:3250 +#: ../../library/os.rst:3324 msgid "The :const:`ST_RDONLY` and :const:`ST_NOSUID` constants were added." msgstr "新增 :const:`ST_RDONLY` 與 :const:`ST_NOSUID` 常數。" -#: ../../library/os.rst:3256 +#: ../../library/os.rst:3330 msgid "" "The :const:`ST_NODEV`, :const:`ST_NOEXEC`, :const:`ST_SYNCHRONOUS`, :const:" "`ST_MANDLOCK`, :const:`ST_WRITE`, :const:`ST_APPEND`, :const:" @@ -3773,11 +3823,11 @@ msgid "" "`ST_RELATIME` constants were added." msgstr "" -#: ../../library/os.rst:3265 +#: ../../library/os.rst:3339 msgid "Added the :attr:`f_fsid` attribute." msgstr "新增 :attr:`f_fsid` 屬性。" -#: ../../library/os.rst:3271 +#: ../../library/os.rst:3345 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept an open file descriptor for their *dir_fd* parameter. Different " @@ -3789,7 +3839,7 @@ msgid "" "(Specifying ``None`` for *dir_fd* is always supported on all platforms.)" msgstr "" -#: ../../library/os.rst:3281 +#: ../../library/os.rst:3355 msgid "" "To check whether a particular function accepts an open file descriptor for " "its *dir_fd* parameter, use the ``in`` operator on ``supports_dir_fd``. As " @@ -3797,17 +3847,17 @@ msgid "" "open file descriptors for *dir_fd* on the local platform::" msgstr "" -#: ../../library/os.rst:3286 +#: ../../library/os.rst:3360 msgid "os.stat in os.supports_dir_fd" msgstr "os.stat in os.supports_dir_fd" -#: ../../library/os.rst:3288 +#: ../../library/os.rst:3362 msgid "" "Currently *dir_fd* parameters only work on Unix platforms; none of them work " "on Windows." msgstr "" -#: ../../library/os.rst:3296 +#: ../../library/os.rst:3370 msgid "" "A :class:`set` object indicating whether :func:`os.access` permits " "specifying ``True`` for its *effective_ids* parameter on the local platform. " @@ -3816,23 +3866,23 @@ msgid "" "func:`os.access`; otherwise it will be empty." msgstr "" -#: ../../library/os.rst:3302 +#: ../../library/os.rst:3376 msgid "" "This expression evaluates to ``True`` if :func:`os.access` supports " "``effective_ids=True`` on the local platform::" msgstr "" -#: ../../library/os.rst:3305 +#: ../../library/os.rst:3379 msgid "os.access in os.supports_effective_ids" msgstr "os.access in os.supports_effective_ids" -#: ../../library/os.rst:3307 +#: ../../library/os.rst:3381 msgid "" "Currently *effective_ids* is only supported on Unix platforms; it does not " "work on Windows." msgstr "" -#: ../../library/os.rst:3315 +#: ../../library/os.rst:3389 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "permit specifying their *path* parameter as an open file descriptor on the " @@ -3841,7 +3891,7 @@ msgid "" "*path* arguments is not available on all platforms Python supports." msgstr "" -#: ../../library/os.rst:3322 +#: ../../library/os.rst:3396 msgid "" "To determine whether a particular function permits specifying an open file " "descriptor for its *path* parameter, use the ``in`` operator on " @@ -3850,11 +3900,11 @@ msgid "" "platform::" msgstr "" -#: ../../library/os.rst:3328 +#: ../../library/os.rst:3402 msgid "os.chdir in os.supports_fd" msgstr "os.chdir in os.supports_fd" -#: ../../library/os.rst:3335 +#: ../../library/os.rst:3409 msgid "" "A :class:`set` object indicating which functions in the :mod:`os` module " "accept ``False`` for their *follow_symlinks* parameter on the local " @@ -3867,7 +3917,7 @@ msgid "" "on all platforms.)" msgstr "" -#: ../../library/os.rst:3345 +#: ../../library/os.rst:3419 msgid "" "To check whether a particular function accepts ``False`` for its " "*follow_symlinks* parameter, use the ``in`` operator on " @@ -3876,15 +3926,15 @@ msgid "" "stat` on the local platform::" msgstr "" -#: ../../library/os.rst:3351 +#: ../../library/os.rst:3425 msgid "os.stat in os.supports_follow_symlinks" msgstr "os.stat in os.supports_follow_symlinks" -#: ../../library/os.rst:3358 +#: ../../library/os.rst:3432 msgid "Create a symbolic link pointing to *src* named *dst*." msgstr "" -#: ../../library/os.rst:3360 +#: ../../library/os.rst:3434 msgid "" "On Windows, a symlink represents either a file or a directory, and does not " "morph to the target dynamically. If the target is present, the type of the " @@ -3894,7 +3944,7 @@ msgid "" "ignored." msgstr "" -#: ../../library/os.rst:3371 +#: ../../library/os.rst:3445 msgid "" "On newer versions of Windows 10, unprivileged accounts can create symlinks " "if Developer Mode is enabled. When Developer Mode is not available/enabled, " @@ -3902,12 +3952,12 @@ msgid "" "must be run as an administrator." msgstr "" -#: ../../library/os.rst:3377 +#: ../../library/os.rst:3451 msgid "" ":exc:`OSError` is raised when the function is called by an unprivileged user." msgstr "" -#: ../../library/os.rst:3380 +#: ../../library/os.rst:3454 msgid "" "Raises an :ref:`auditing event ` ``os.symlink`` with arguments " "``src``, ``dst``, ``dir_fd``." @@ -3915,27 +3965,27 @@ msgstr "" "引發一個附帶引數 ``src``、``dst``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.symlink``。" -#: ../../library/os.rst:3390 +#: ../../library/os.rst:3464 msgid "" "Added the *dir_fd* parameter, and now allow *target_is_directory* on non-" "Windows platforms." msgstr "" -#: ../../library/os.rst:3397 +#: ../../library/os.rst:3471 msgid "Added support for unelevated symlinks on Windows with Developer Mode." msgstr "" -#: ../../library/os.rst:3403 +#: ../../library/os.rst:3477 msgid "Force write of everything to disk." msgstr "" -#: ../../library/os.rst:3412 +#: ../../library/os.rst:3486 msgid "" "Truncate the file corresponding to *path*, so that it is at most *length* " "bytes in size." msgstr "" -#: ../../library/os.rst:3417 +#: ../../library/os.rst:3491 msgid "" "Raises an :ref:`auditing event ` ``os.truncate`` with arguments " "``path``, ``length``." @@ -3943,46 +3993,46 @@ msgstr "" "引發一個附帶引數 ``path``、``length`` 的\\ :ref:`稽核事件 ` ``os." "truncate``。" -#: ../../library/os.rst:3432 +#: ../../library/os.rst:3506 msgid "" "Remove (delete) the file *path*. This function is semantically identical " "to :func:`remove`; the ``unlink`` name is its traditional Unix name. Please " "see the documentation for :func:`remove` for further information." msgstr "" -#: ../../library/os.rst:3448 +#: ../../library/os.rst:3522 msgid "Set the access and modified times of the file specified by *path*." msgstr "" -#: ../../library/os.rst:3450 +#: ../../library/os.rst:3524 msgid "" ":func:`utime` takes two optional parameters, *times* and *ns*. These specify " "the times set on *path* and are used as follows:" msgstr "" -#: ../../library/os.rst:3453 +#: ../../library/os.rst:3527 msgid "" "If *ns* is specified, it must be a 2-tuple of the form ``(atime_ns, " "mtime_ns)`` where each member is an int expressing nanoseconds." msgstr "" -#: ../../library/os.rst:3456 +#: ../../library/os.rst:3530 msgid "" "If *times* is not ``None``, it must be a 2-tuple of the form ``(atime, " "mtime)`` where each member is an int or float expressing seconds." msgstr "" -#: ../../library/os.rst:3459 +#: ../../library/os.rst:3533 msgid "" "If *times* is ``None`` and *ns* is unspecified, this is equivalent to " "specifying ``ns=(atime_ns, mtime_ns)`` where both times are the current time." msgstr "" -#: ../../library/os.rst:3463 +#: ../../library/os.rst:3537 msgid "It is an error to specify tuples for both *times* and *ns*." msgstr "" -#: ../../library/os.rst:3465 +#: ../../library/os.rst:3539 msgid "" "Note that the exact times you set here may not be returned by a subsequent :" "func:`~os.stat` call, depending on the resolution with which your operating " @@ -3992,7 +4042,7 @@ msgid "" "func:`utime`." msgstr "" -#: ../../library/os.rst:3476 +#: ../../library/os.rst:3550 msgid "" "Raises an :ref:`auditing event ` ``os.utime`` with arguments " "``path``, ``times``, ``ns``, ``dir_fd``." @@ -4000,13 +4050,13 @@ msgstr "" "引發一個附帶引數 ``path``、``times``、``ns``、``dir_fd`` 的\\ :ref:`稽核事件 " "` ``os.utime``。" -#: ../../library/os.rst:3478 +#: ../../library/os.rst:3552 msgid "" "Added support for specifying *path* as an open file descriptor, and the " "*dir_fd*, *follow_symlinks*, and *ns* parameters." msgstr "" -#: ../../library/os.rst:3492 +#: ../../library/os.rst:3566 msgid "" "Generate the file names in a directory tree by walking the tree either top-" "down or bottom-up. For each directory in the tree rooted at directory *top* " @@ -4014,7 +4064,7 @@ msgid "" "filenames)``." msgstr "" -#: ../../library/os.rst:3497 +#: ../../library/os.rst:3571 msgid "" "*dirpath* is a string, the path to the directory. *dirnames* is a list of " "the names of the subdirectories in *dirpath* (including symlinks to " @@ -4028,7 +4078,7 @@ msgid "" "unspecified." msgstr "" -#: ../../library/os.rst:3508 +#: ../../library/os.rst:3582 msgid "" "If optional argument *topdown* is ``True`` or not specified, the triple for " "a directory is generated before the triples for any of its subdirectories " @@ -4039,7 +4089,7 @@ msgid "" "its subdirectories are generated." msgstr "" -#: ../../library/os.rst:3516 +#: ../../library/os.rst:3590 msgid "" "When *topdown* is ``True``, the caller can modify the *dirnames* list in-" "place (perhaps using :keyword:`del` or slice assignment), and :func:`walk` " @@ -4052,7 +4102,7 @@ msgid "" "itself is generated." msgstr "" -#: ../../library/os.rst:3525 +#: ../../library/os.rst:3599 msgid "" "By default, errors from the :func:`scandir` call are ignored. If optional " "argument *onerror* is specified, it should be a function; it will be called " @@ -4062,35 +4112,35 @@ msgid "" "object." msgstr "" -#: ../../library/os.rst:3531 +#: ../../library/os.rst:3605 msgid "" "By default, :func:`walk` will not walk down into symbolic links that resolve " "to directories. Set *followlinks* to ``True`` to visit directories pointed " "to by symlinks, on systems that support them." msgstr "" -#: ../../library/os.rst:3537 +#: ../../library/os.rst:3611 msgid "" "Be aware that setting *followlinks* to ``True`` can lead to infinite " "recursion if a link points to a parent directory of itself. :func:`walk` " "does not keep track of the directories it visited already." msgstr "" -#: ../../library/os.rst:3543 +#: ../../library/os.rst:3617 msgid "" "If you pass a relative pathname, don't change the current working directory " "between resumptions of :func:`walk`. :func:`walk` never changes the current " "directory, and assumes that its caller doesn't either." msgstr "" -#: ../../library/os.rst:3547 ../../library/os.rst:3608 +#: ../../library/os.rst:3621 ../../library/os.rst:3682 msgid "" "This example displays the number of bytes taken by non-directory files in " "each directory under the starting directory, except that it doesn't look " "under any CVS subdirectory::" msgstr "" -#: ../../library/os.rst:3551 +#: ../../library/os.rst:3625 msgid "" "import os\n" "from os.path import join, getsize\n" @@ -4102,14 +4152,14 @@ msgid "" " dirs.remove('CVS') # don't visit CVS directories" msgstr "" -#: ../../library/os.rst:3560 +#: ../../library/os.rst:3634 msgid "" "In the next example (simple implementation of :func:`shutil.rmtree`), " "walking the tree bottom-up is essential, :func:`rmdir` doesn't allow " "deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3564 +#: ../../library/os.rst:3638 msgid "" "# Delete everything reachable from the directory named in \"top\",\n" "# assuming there are no symbolic links.\n" @@ -4123,7 +4173,7 @@ msgid "" " os.rmdir(os.path.join(root, name))" msgstr "" -#: ../../library/os.rst:3575 +#: ../../library/os.rst:3649 msgid "" "Raises an :ref:`auditing event ` ``os.walk`` with arguments " "``top``, ``topdown``, ``onerror``, ``followlinks``." @@ -4131,25 +4181,25 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``followlinks`` 的\\ :" "ref:`稽核事件 ` ``os.walk``。" -#: ../../library/os.rst:3577 +#: ../../library/os.rst:3651 msgid "" "This function now calls :func:`os.scandir` instead of :func:`os.listdir`, " "making it faster by reducing the number of calls to :func:`os.stat`." msgstr "" -#: ../../library/os.rst:3591 +#: ../../library/os.rst:3665 msgid "" "This behaves exactly like :func:`walk`, except that it yields a 4-tuple " "``(dirpath, dirnames, filenames, dirfd)``, and it supports ``dir_fd``." msgstr "" -#: ../../library/os.rst:3594 +#: ../../library/os.rst:3668 msgid "" "*dirpath*, *dirnames* and *filenames* are identical to :func:`walk` output, " "and *dirfd* is a file descriptor referring to the directory *dirpath*." msgstr "" -#: ../../library/os.rst:3597 +#: ../../library/os.rst:3671 msgid "" "This function always supports :ref:`paths relative to directory descriptors " "` and :ref:`not following symlinks `. Note however " @@ -4157,14 +4207,14 @@ msgid "" "*follow_symlinks* is ``False``." msgstr "" -#: ../../library/os.rst:3604 +#: ../../library/os.rst:3678 msgid "" "Since :func:`fwalk` yields file descriptors, those are only valid until the " "next iteration step, so you should duplicate them (e.g. with :func:`dup`) if " "you want to keep them longer." msgstr "" -#: ../../library/os.rst:3612 +#: ../../library/os.rst:3686 msgid "" "import os\n" "for root, dirs, files, rootfd in os.fwalk('python/Lib/email'):\n" @@ -4176,13 +4226,13 @@ msgid "" " dirs.remove('CVS') # don't visit CVS directories" msgstr "" -#: ../../library/os.rst:3621 +#: ../../library/os.rst:3695 msgid "" "In the next example, walking the tree bottom-up is essential: :func:`rmdir` " "doesn't allow deleting a directory before the directory is empty::" msgstr "" -#: ../../library/os.rst:3625 +#: ../../library/os.rst:3699 msgid "" "# Delete everything reachable from the directory named in \"top\",\n" "# assuming there are no symbolic links.\n" @@ -4196,7 +4246,7 @@ msgid "" " os.rmdir(name, dir_fd=rootfd)" msgstr "" -#: ../../library/os.rst:3636 +#: ../../library/os.rst:3710 msgid "" "Raises an :ref:`auditing event ` ``os.fwalk`` with arguments " "``top``, ``topdown``, ``onerror``, ``follow_symlinks``, ``dir_fd``." @@ -4204,11 +4254,11 @@ msgstr "" "引發一個附帶引數 ``top``、``topdown``、``onerror``、``follow_symlinks``、" "``dir_fd`` 的\\ :ref:`稽核事件 ` ``os.fwalk``。" -#: ../../library/os.rst:3645 +#: ../../library/os.rst:3719 msgid "Added support for :class:`bytes` paths." msgstr "新增對 :class:`bytes` 路徑的支援。" -#: ../../library/os.rst:3651 +#: ../../library/os.rst:3725 msgid "" "Create an anonymous file and return a file descriptor that refers to it. " "*flags* must be one of the ``os.MFD_*`` constants available on the system " @@ -4216,7 +4266,7 @@ msgid "" "descriptor is :ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3656 +#: ../../library/os.rst:3730 msgid "" "The name supplied in *name* is used as a filename and will be displayed as " "the target of the corresponding symbolic link in the directory ``/proc/self/" @@ -4226,23 +4276,23 @@ msgid "" "side effects." msgstr "" -#: ../../library/os.rst:3663 +#: ../../library/os.rst:3737 msgid ":ref:`Availability `: Linux >= 3.17 with glibc >= 2.27." msgstr ":ref:`適用 `:Linux 3.17 以上且具有 glibc 2.27 以上。" -#: ../../library/os.rst:3686 +#: ../../library/os.rst:3760 msgid "These flags can be passed to :func:`memfd_create`." msgstr "這些旗標可以傳給 :func:`memfd_create`。" -#: ../../library/os.rst:3688 +#: ../../library/os.rst:3762 msgid ":ref:`Availability `: Linux >= 3.17 with glibc >= 2.27" msgstr ":ref:`適用 `:Linux 3.17 以上且具有 glibc 2.27 以上" -#: ../../library/os.rst:3690 +#: ../../library/os.rst:3764 msgid "The ``MFD_HUGE*`` flags are only available since Linux 4.14." msgstr "``MFD_HUGE*`` 旗標僅在 Linux 4.14 以上可用。" -#: ../../library/os.rst:3697 +#: ../../library/os.rst:3771 msgid "" "Create and return an event file descriptor. The file descriptors supports " "raw :func:`read` and :func:`write` with a buffer size of 8, :func:`~select." @@ -4251,7 +4301,7 @@ msgid "" "ref:`non-inheritable `." msgstr "" -#: ../../library/os.rst:3703 +#: ../../library/os.rst:3777 msgid "" "*initval* is the initial value of the event counter. The initial value must " "be a 32 bit unsigned integer. Please note that the initial value is limited " @@ -4259,39 +4309,39 @@ msgid "" "integer with a maximum value of 2\\ :sup:`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3708 +#: ../../library/os.rst:3782 msgid "" "*flags* can be constructed from :const:`EFD_CLOEXEC`, :const:`EFD_NONBLOCK`, " "and :const:`EFD_SEMAPHORE`." msgstr "" -#: ../../library/os.rst:3711 +#: ../../library/os.rst:3785 msgid "" "If :const:`EFD_SEMAPHORE` is specified and the event counter is non-zero, :" "func:`eventfd_read` returns 1 and decrements the counter by one." msgstr "" -#: ../../library/os.rst:3714 +#: ../../library/os.rst:3788 msgid "" "If :const:`EFD_SEMAPHORE` is not specified and the event counter is non-" "zero, :func:`eventfd_read` returns the current event counter value and " "resets the counter to zero." msgstr "" -#: ../../library/os.rst:3718 +#: ../../library/os.rst:3792 msgid "" "If the event counter is zero and :const:`EFD_NONBLOCK` is not specified, :" "func:`eventfd_read` blocks." msgstr "" -#: ../../library/os.rst:3721 +#: ../../library/os.rst:3795 msgid "" ":func:`eventfd_write` increments the event counter. Write blocks if the " "write operation would increment the counter to a value larger than 2\\ :sup:" "`64`\\ -\\ 2." msgstr "" -#: ../../library/os.rst:3727 +#: ../../library/os.rst:3801 msgid "" "import os\n" "\n" @@ -4309,55 +4359,339 @@ msgid "" " os.close(fd)" msgstr "" -#: ../../library/os.rst:3742 +#: ../../library/os.rst:3816 ../../library/os.rst:3932 +#: ../../library/os.rst:3995 ../../library/os.rst:4005 +#: ../../library/os.rst:4023 ../../library/os.rst:4032 +#: ../../library/os.rst:4042 ../../library/os.rst:4052 +#: ../../library/os.rst:4062 ../../library/os.rst:4073 msgid ":ref:`Availability `: Linux >= 2.6.27 with glibc >= 2.8" msgstr ":ref:`適用 `:Linux 2.6.27 以上且具有 glibc 2.8 以上" -#: ../../library/os.rst:3748 +#: ../../library/os.rst:3822 msgid "" "Read value from an :func:`eventfd` file descriptor and return a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3751 ../../library/os.rst:3760 -#: ../../library/os.rst:3768 ../../library/os.rst:3777 +#: ../../library/os.rst:3825 ../../library/os.rst:3834 +#: ../../library/os.rst:3842 ../../library/os.rst:3851 msgid ":ref:`Availability `: Linux >= 2.6.27" msgstr ":ref:`適用 `:Linux 2.6.27 以上" -#: ../../library/os.rst:3757 +#: ../../library/os.rst:3831 msgid "" "Add value to an :func:`eventfd` file descriptor. *value* must be a 64 bit " "unsigned int. The function does not verify that *fd* is an :func:`eventfd`." msgstr "" -#: ../../library/os.rst:3766 +#: ../../library/os.rst:3840 msgid "Set close-on-exec flag for new :func:`eventfd` file descriptor." msgstr "" -#: ../../library/os.rst:3774 +#: ../../library/os.rst:3848 msgid "" "Set :const:`O_NONBLOCK` status flag for new :func:`eventfd` file descriptor." msgstr "設定新的 :func:`eventfd` 檔案描述器的 :const:`O_NONBLOCK` 狀態旗標。" -#: ../../library/os.rst:3783 +#: ../../library/os.rst:3857 msgid "" "Provide semaphore-like semantics for reads from an :func:`eventfd` file " "descriptor. On read the internal counter is decremented by one." msgstr "" -#: ../../library/os.rst:3786 +#: ../../library/os.rst:3860 msgid ":ref:`Availability `: Linux >= 2.6.30" msgstr ":ref:`適用 `:Linux 2.6.30 以上" -#: ../../library/os.rst:3792 +#: ../../library/os.rst:3868 +msgid "Timer File Descriptors" +msgstr "" + +#: ../../library/os.rst:3872 +msgid "" +"These functions provide support for Linux's *timer file descriptor* API. " +"Naturally, they are all only available on Linux." +msgstr "" + +#: ../../library/os.rst:3877 +msgid "Create and return a timer file descriptor (*timerfd*)." +msgstr "" + +#: ../../library/os.rst:3879 +msgid "The file descriptor returned by :func:`timerfd_create` supports:" +msgstr "" + +#: ../../library/os.rst:3881 +msgid ":func:`read`" +msgstr ":func:`read`" + +#: ../../library/os.rst:3882 +msgid ":func:`~select.select`" +msgstr ":func:`~select.select`" + +#: ../../library/os.rst:3883 +msgid ":func:`~select.poll`" +msgstr ":func:`~select.poll`" + +#: ../../library/os.rst:3885 +msgid "" +"The file descriptor's :func:`read` method can be called with a buffer size " +"of 8. If the timer has already expired one or more times, :func:`read` " +"returns the number of expirations with the host's endianness, which may be " +"converted to an :class:`int` by ``int.from_bytes(x, byteorder=sys." +"byteorder)``." +msgstr "" + +#: ../../library/os.rst:3890 +msgid "" +":func:`~select.select` and :func:`~select.poll` can be used to wait until " +"timer expires and the file descriptor is readable." +msgstr "" + +#: ../../library/os.rst:3893 +msgid "" +"*clockid* must be a valid :ref:`clock ID `, as " +"defined in the :py:mod:`time` module:" +msgstr "" + +#: ../../library/os.rst:3896 +msgid ":const:`time.CLOCK_REALTIME`" +msgstr ":const:`time.CLOCK_REALTIME`" + +#: ../../library/os.rst:3897 +msgid ":const:`time.CLOCK_MONOTONIC`" +msgstr ":const:`time.CLOCK_MONOTONIC`" + +#: ../../library/os.rst:3898 +msgid ":const:`time.CLOCK_BOOTTIME` (Since Linux 3.15 for timerfd_create)" +msgstr "" + +#: ../../library/os.rst:3900 +msgid "" +"If *clockid* is :const:`time.CLOCK_REALTIME`, a settable system-wide real-" +"time clock is used. If system clock is changed, timer setting need to be " +"updated. To cancel timer when system clock is changed, see :const:" +"`TFD_TIMER_CANCEL_ON_SET`." +msgstr "" + +#: ../../library/os.rst:3905 +msgid "" +"If *clockid* is :const:`time.CLOCK_MONOTONIC`, a non-settable monotonically " +"increasing clock is used. Even if the system clock is changed, the timer " +"setting will not be affected." +msgstr "" + +#: ../../library/os.rst:3909 +msgid "" +"If *clockid* is :const:`time.CLOCK_BOOTTIME`, same as :const:`time." +"CLOCK_MONOTONIC` except it includes any time that the system is suspended." +msgstr "" + +#: ../../library/os.rst:3912 +msgid "" +"The file descriptor's behaviour can be modified by specifying a *flags* " +"value. Any of the following variables may used, combined using bitwise OR " +"(the ``|`` operator):" +msgstr "" + +#: ../../library/os.rst:3916 +msgid ":const:`TFD_NONBLOCK`" +msgstr ":const:`TFD_NONBLOCK`" + +#: ../../library/os.rst:3917 +msgid ":const:`TFD_CLOEXEC`" +msgstr ":const:`TFD_CLOEXEC`" + +#: ../../library/os.rst:3919 +msgid "" +"If :const:`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks until the " +"timer expires. If it is set as a flag, :func:`read` doesn't block, but If " +"there hasn't been an expiration since the last call to read, :func:`read` " +"raises :class:`OSError` with ``errno`` is set to :const:`errno.EAGAIN`." +msgstr "" + +#: ../../library/os.rst:3925 +msgid ":const:`TFD_CLOEXEC` is always set by Python automatically." +msgstr "" + +#: ../../library/os.rst:3927 +msgid "" +"The file descriptor must be closed with :func:`os.close` when it is no " +"longer needed, or else the file descriptor will be leaked." +msgstr "" + +#: ../../library/os.rst:3930 +msgid "The :manpage:`timerfd_create(2)` man page." +msgstr ":manpage:`timerfd_create(2)` 手冊頁。" + +#: ../../library/os.rst:3939 +msgid "" +"Alter a timer file descriptor's internal timer. This function operates the " +"same interval timer as :func:`timerfd_settime_ns`." +msgstr "" + +#: ../../library/os.rst:3942 +msgid "*fd* must be a valid timer file descriptor." +msgstr "" + +#: ../../library/os.rst:3944 +msgid "" +"The timer's behaviour can be modified by specifying a *flags* value. Any of " +"the following variables may used, combined using bitwise OR (the ``|`` " +"operator):" +msgstr "" + +#: ../../library/os.rst:3948 +msgid ":const:`TFD_TIMER_ABSTIME`" +msgstr ":const:`TFD_TIMER_ABSTIME`" + +#: ../../library/os.rst:3949 +msgid ":const:`TFD_TIMER_CANCEL_ON_SET`" +msgstr ":const:`TFD_TIMER_CANCEL_ON_SET`" + +#: ../../library/os.rst:3951 +msgid "" +"The timer is disabled by setting *initial* to zero (``0``). If *initial* is " +"equal to or greater than zero, the timer is enabled. If *initial* is less " +"than zero, it raises an :class:`OSError` exception with ``errno`` set to :" +"const:`errno.EINVAL`" +msgstr "" + +#: ../../library/os.rst:3956 +msgid "" +"By default the timer will fire when *initial* seconds have elapsed. (If " +"*initial* is zero, timer will fire immediately.)" +msgstr "" + +#: ../../library/os.rst:3959 +msgid "" +"However, if the :const:`TFD_TIMER_ABSTIME` flag is set, the timer will fire " +"when the timer's clock (set by *clockid* in :func:`timerfd_create`) reaches " +"*initial* seconds." +msgstr "" + +#: ../../library/os.rst:3963 +msgid "" +"The timer's interval is set by the *interval* :py:class:`float`. If " +"*interval* is zero, the timer only fires once, on the initial expiration. If " +"*interval* is greater than zero, the timer fires every time *interval* " +"seconds have elapsed since the previous expiration. If *interval* is less " +"than zero, it raises :class:`OSError` with ``errno`` set to :const:`errno." +"EINVAL`" +msgstr "" + +#: ../../library/os.rst:3970 +msgid "" +"If the :const:`TFD_TIMER_CANCEL_ON_SET` flag is set along with :const:" +"`TFD_TIMER_ABSTIME` and the clock for this timer is :const:`time." +"CLOCK_REALTIME`, the timer is marked as cancelable if the real-time clock is " +"changed discontinuously. Reading the descriptor is aborted with the error " +"ECANCELED." +msgstr "" + +#: ../../library/os.rst:3976 +msgid "" +"Linux manages system clock as UTC. A daylight-savings time transition is " +"done by changing time offset only and doesn't cause discontinuous system " +"clock change." +msgstr "" + +#: ../../library/os.rst:3980 +msgid "" +"Discontinuous system clock change will be caused by the following events:" +msgstr "" + +#: ../../library/os.rst:3982 +msgid "``settimeofday``" +msgstr "``settimeofday``" + +#: ../../library/os.rst:3983 +msgid "``clock_settime``" +msgstr "``clock_settime``" + +#: ../../library/os.rst:3984 +msgid "set the system date and time by ``date`` command" +msgstr "" + +#: ../../library/os.rst:3986 +msgid "" +"Return a two-item tuple of (``next_expiration``, ``interval``) from the " +"previous timer state, before this function executed." +msgstr "" + +#: ../../library/os.rst:3991 +msgid "" +":manpage:`timerfd_create(2)`, :manpage:`timerfd_settime(2)`, :manpage:" +"`settimeofday(2)`, :manpage:`clock_settime(2)`, and :manpage:`date(1)`." +msgstr "" + +#: ../../library/os.rst:4002 +msgid "" +"Similar to :func:`timerfd_settime`, but use time as nanoseconds. This " +"function operates the same interval timer as :func:`timerfd_settime`." +msgstr "" + +#: ../../library/os.rst:4012 +msgid "Return a two-item tuple of floats (``next_expiration``, ``interval``)." +msgstr "" + +#: ../../library/os.rst:4014 +msgid "" +"``next_expiration`` denotes the relative time until next the timer next " +"fires, regardless of if the :const:`TFD_TIMER_ABSTIME` flag is set." +msgstr "" + +#: ../../library/os.rst:4017 +msgid "" +"``interval`` denotes the timer's interval. If zero, the timer will only fire " +"once, after ``next_expiration`` seconds have elapsed." +msgstr "" + +#: ../../library/os.rst:4021 +msgid ":manpage:`timerfd_gettime(2)`" +msgstr "" + +#: ../../library/os.rst:4030 +msgid "Similar to :func:`timerfd_gettime`, but return time as nanoseconds." +msgstr "" + +#: ../../library/os.rst:4038 +msgid "" +"A flag for the :func:`timerfd_create` function, which sets the :const:" +"`O_NONBLOCK` status flag for the new timer file descriptor. If :const:" +"`TFD_NONBLOCK` is not set as a flag, :func:`read` blocks." +msgstr "" + +#: ../../library/os.rst:4048 +msgid "" +"A flag for the :func:`timerfd_create` function, If :const:`TFD_CLOEXEC` is " +"set as a flag, set close-on-exec flag for new file descriptor." +msgstr "" + +#: ../../library/os.rst:4058 +msgid "" +"A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " +"functions. If this flag is set, *initial* is interpreted as an absolute " +"value on the timer's clock (in UTC seconds or nanoseconds since the Unix " +"Epoch)." +msgstr "" + +#: ../../library/os.rst:4068 +msgid "" +"A flag for the :func:`timerfd_settime` and :func:`timerfd_settime_ns` " +"functions along with :const:`TFD_TIMER_ABSTIME`. The timer is cancelled when " +"the time of the underlying clock changes discontinuously." +msgstr "" + +#: ../../library/os.rst:4079 msgid "Linux extended attributes" msgstr "" -#: ../../library/os.rst:3796 +#: ../../library/os.rst:4083 msgid "These functions are all available on Linux only." msgstr "" -#: ../../library/os.rst:3800 +#: ../../library/os.rst:4087 msgid "" "Return the value of the extended filesystem attribute *attribute* for " "*path*. *attribute* can be bytes or str (directly or indirectly through the :" @@ -4365,7 +4699,7 @@ msgid "" "encoding." msgstr "" -#: ../../library/os.rst:3808 +#: ../../library/os.rst:4095 msgid "" "Raises an :ref:`auditing event ` ``os.getxattr`` with arguments " "``path``, ``attribute``." @@ -4373,12 +4707,12 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.getxattr``。" -#: ../../library/os.rst:3810 ../../library/os.rst:3842 -#: ../../library/os.rst:3867 +#: ../../library/os.rst:4097 ../../library/os.rst:4129 +#: ../../library/os.rst:4154 msgid "Accepts a :term:`path-like object` for *path* and *attribute*." msgstr "" -#: ../../library/os.rst:3816 +#: ../../library/os.rst:4103 msgid "" "Return a list of the extended filesystem attributes on *path*. The " "attributes in the list are represented as strings decoded with the " @@ -4386,14 +4720,14 @@ msgid "" "the current directory." msgstr "" -#: ../../library/os.rst:3824 +#: ../../library/os.rst:4111 msgid "" "Raises an :ref:`auditing event ` ``os.listxattr`` with argument " "``path``." msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os.listxattr``。" -#: ../../library/os.rst:3832 +#: ../../library/os.rst:4119 msgid "" "Removes the extended filesystem attribute *attribute* from *path*. " "*attribute* should be bytes or str (directly or indirectly through the :" @@ -4401,7 +4735,7 @@ msgid "" "`filesystem encoding and error handler`." msgstr "" -#: ../../library/os.rst:3840 +#: ../../library/os.rst:4127 msgid "" "Raises an :ref:`auditing event ` ``os.removexattr`` with arguments " "``path``, ``attribute``." @@ -4409,7 +4743,7 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute`` 的\\ :ref:`稽核事件 ` " "``os.removexattr``。" -#: ../../library/os.rst:3848 +#: ../../library/os.rst:4135 msgid "" "Set the extended filesystem attribute *attribute* on *path* to *value*. " "*attribute* must be a bytes or str with no embedded NULs (directly or " @@ -4421,13 +4755,13 @@ msgid "" "will not be created and ``EEXISTS`` will be raised." msgstr "" -#: ../../library/os.rst:3862 +#: ../../library/os.rst:4149 msgid "" "A bug in Linux kernel versions less than 2.6.39 caused the flags argument to " "be ignored on some filesystems." msgstr "" -#: ../../library/os.rst:3865 +#: ../../library/os.rst:4152 msgid "" "Raises an :ref:`auditing event ` ``os.setxattr`` with arguments " "``path``, ``attribute``, ``value``, ``flags``." @@ -4435,33 +4769,33 @@ msgstr "" "引發一個附帶引數 ``path``、``attribute``、``value``、``flags`` 的\\ :ref:`稽" "核事件 ` ``os.setxattr``。" -#: ../../library/os.rst:3873 +#: ../../library/os.rst:4160 msgid "" "The maximum size the value of an extended attribute can be. Currently, this " "is 64 KiB on Linux." msgstr "" -#: ../../library/os.rst:3879 +#: ../../library/os.rst:4166 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must create an attribute." msgstr "" -#: ../../library/os.rst:3885 +#: ../../library/os.rst:4172 msgid "" "This is a possible value for the flags argument in :func:`setxattr`. It " "indicates the operation must replace an existing attribute." msgstr "" -#: ../../library/os.rst:3892 +#: ../../library/os.rst:4179 msgid "Process Management" msgstr "行程管理" -#: ../../library/os.rst:3894 +#: ../../library/os.rst:4181 msgid "These functions may be used to create and manage processes." msgstr "" -#: ../../library/os.rst:3896 +#: ../../library/os.rst:4183 msgid "" "The various :func:`exec\\* ` functions take a list of arguments for " "the new program loaded into the process. In each case, the first of these " @@ -4472,7 +4806,7 @@ msgid "" "standard output; ``foo`` will seem to be ignored." msgstr "" -#: ../../library/os.rst:3907 +#: ../../library/os.rst:4194 msgid "" "Generate a :const:`SIGABRT` signal to the current process. On Unix, the " "default behavior is to produce a core dump; on Windows, the process " @@ -4481,31 +4815,31 @@ msgid "" "`SIGABRT` with :func:`signal.signal`." msgstr "" -#: ../../library/os.rst:3916 +#: ../../library/os.rst:4203 msgid "Add a path to the DLL search path." msgstr "" -#: ../../library/os.rst:3918 +#: ../../library/os.rst:4205 msgid "" "This search path is used when resolving dependencies for imported extension " "modules (the module itself is resolved through :data:`sys.path`), and also " "by :mod:`ctypes`." msgstr "" -#: ../../library/os.rst:3922 +#: ../../library/os.rst:4209 msgid "" "Remove the directory by calling **close()** on the returned object or using " "it in a :keyword:`with` statement." msgstr "" -#: ../../library/os.rst:3925 +#: ../../library/os.rst:4212 msgid "" "See the `Microsoft documentation `_ for more information about how " "DLLs are loaded." msgstr "" -#: ../../library/os.rst:3929 +#: ../../library/os.rst:4216 msgid "" "Raises an :ref:`auditing event ` ``os.add_dll_directory`` with " "argument ``path``." @@ -4513,7 +4847,7 @@ msgstr "" "引發一個附帶引數 ``path`` 的\\ :ref:`稽核事件 ` ``os." "add_dll_directory``。" -#: ../../library/os.rst:3933 +#: ../../library/os.rst:4220 msgid "" "Previous versions of CPython would resolve DLLs using the default behavior " "for the current process. This led to inconsistencies, such as only sometimes " @@ -4521,14 +4855,14 @@ msgid "" "such as ``AddDllDirectory`` having no effect." msgstr "" -#: ../../library/os.rst:3940 +#: ../../library/os.rst:4227 msgid "" "In 3.8, the two primary ways DLLs are loaded now explicitly override the " "process-wide behavior to ensure consistency. See the :ref:`porting notes " "` for information on updating libraries." msgstr "" -#: ../../library/os.rst:3955 +#: ../../library/os.rst:4242 msgid "" "These functions all execute a new program, replacing the current process; " "they do not return. On Unix, the new executable is loaded into the current " @@ -4536,7 +4870,7 @@ msgid "" "reported as :exc:`OSError` exceptions." msgstr "" -#: ../../library/os.rst:3960 +#: ../../library/os.rst:4247 msgid "" "The current process is replaced immediately. Open file objects and " "descriptors are not flushed, so if there may be data buffered on these open " @@ -4544,7 +4878,7 @@ msgid "" "fsync` before calling an :func:`exec\\* ` function." msgstr "" -#: ../../library/os.rst:3966 +#: ../../library/os.rst:4253 msgid "" "The \"l\" and \"v\" variants of the :func:`exec\\* ` functions differ " "in how command-line arguments are passed. The \"l\" variants are perhaps " @@ -4557,7 +4891,7 @@ msgid "" "is not enforced." msgstr "" -#: ../../library/os.rst:3975 +#: ../../library/os.rst:4262 msgid "" "The variants which include a \"p\" near the end (:func:`execlp`, :func:" "`execlpe`, :func:`execvp`, and :func:`execvpe`) will use the :envvar:`PATH` " @@ -4571,7 +4905,7 @@ msgid "" "even on Windows, as plain names will not be resolved." msgstr "" -#: ../../library/os.rst:3986 +#: ../../library/os.rst:4273 msgid "" "For :func:`execle`, :func:`execlpe`, :func:`execve`, and :func:`execvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -4581,7 +4915,7 @@ msgid "" "process to inherit the environment of the current process." msgstr "" -#: ../../library/os.rst:3993 +#: ../../library/os.rst:4280 msgid "" "For :func:`execve` on some platforms, *path* may also be specified as an " "open file descriptor. This functionality may not be supported on your " @@ -4590,7 +4924,7 @@ msgid "" "`NotImplementedError`." msgstr "" -#: ../../library/os.rst:3998 +#: ../../library/os.rst:4285 msgid "" "Raises an :ref:`auditing event ` ``os.exec`` with arguments " "``path``, ``args``, ``env``." @@ -4598,25 +4932,34 @@ msgstr "" "引發一個附帶引數 ``path``、``args``、``env`` 的\\ :ref:`稽核事件 ` " "``os.exec``。" -#: ../../library/os.rst:4002 +#: ../../library/os.rst:4287 ../../library/os.rst:4852 +#: ../../library/os.rst:4976 ../../library/os.rst:5095 +#: ../../library/os.rst:5264 +msgid "" +":ref:`Availability `: Unix, Windows, not WASI, not Android, " +"not iOS." +msgstr "" +":ref:`適用 `:Unix、Windows、非 WASI、非 Android、非 iOS。" + +#: ../../library/os.rst:4289 msgid "" "Added support for specifying *path* as an open file descriptor for :func:" "`execve`." msgstr "" -#: ../../library/os.rst:4011 +#: ../../library/os.rst:4298 msgid "" "Exit the process with status *n*, without calling cleanup handlers, flushing " "stdio buffers, etc." msgstr "" -#: ../../library/os.rst:4016 +#: ../../library/os.rst:4303 msgid "" "The standard way to exit is :func:`sys.exit(n) `. :func:`!_exit` " "should normally only be used in the child process after a :func:`fork`." msgstr "" -#: ../../library/os.rst:4019 +#: ../../library/os.rst:4306 msgid "" "The following exit codes are defined and can be used with :func:`_exit`, " "although they are not required. These are typically used for system " @@ -4624,139 +4967,139 @@ msgid "" "delivery program." msgstr "" -#: ../../library/os.rst:4025 +#: ../../library/os.rst:4312 msgid "" "Some of these may not be available on all Unix platforms, since there is " "some variation. These constants are defined where they are defined by the " "underlying platform." msgstr "" -#: ../../library/os.rst:4032 +#: ../../library/os.rst:4319 msgid "" "Exit code that means no error occurred. May be taken from the defined value " "of ``EXIT_SUCCESS`` on some platforms. Generally has a value of zero." msgstr "" -#: ../../library/os.rst:4040 +#: ../../library/os.rst:4327 msgid "" "Exit code that means the command was used incorrectly, such as when the " "wrong number of arguments are given." msgstr "" -#: ../../library/os.rst:4048 +#: ../../library/os.rst:4335 msgid "Exit code that means the input data was incorrect." msgstr "" -#: ../../library/os.rst:4055 +#: ../../library/os.rst:4342 msgid "Exit code that means an input file did not exist or was not readable." msgstr "" -#: ../../library/os.rst:4062 +#: ../../library/os.rst:4349 msgid "Exit code that means a specified user did not exist." msgstr "" -#: ../../library/os.rst:4069 +#: ../../library/os.rst:4356 msgid "Exit code that means a specified host did not exist." msgstr "" -#: ../../library/os.rst:4076 +#: ../../library/os.rst:4363 msgid "Exit code that means that a required service is unavailable." msgstr "" -#: ../../library/os.rst:4083 +#: ../../library/os.rst:4370 msgid "Exit code that means an internal software error was detected." msgstr "" -#: ../../library/os.rst:4090 +#: ../../library/os.rst:4377 msgid "" "Exit code that means an operating system error was detected, such as the " "inability to fork or create a pipe." msgstr "" -#: ../../library/os.rst:4098 +#: ../../library/os.rst:4385 msgid "" "Exit code that means some system file did not exist, could not be opened, or " "had some other kind of error." msgstr "" -#: ../../library/os.rst:4106 +#: ../../library/os.rst:4393 msgid "Exit code that means a user specified output file could not be created." msgstr "" -#: ../../library/os.rst:4113 +#: ../../library/os.rst:4400 msgid "" "Exit code that means that an error occurred while doing I/O on some file." msgstr "" -#: ../../library/os.rst:4120 +#: ../../library/os.rst:4407 msgid "" "Exit code that means a temporary failure occurred. This indicates something " "that may not really be an error, such as a network connection that couldn't " "be made during a retryable operation." msgstr "" -#: ../../library/os.rst:4129 +#: ../../library/os.rst:4416 msgid "" "Exit code that means that a protocol exchange was illegal, invalid, or not " "understood." msgstr "" -#: ../../library/os.rst:4137 +#: ../../library/os.rst:4424 msgid "" "Exit code that means that there were insufficient permissions to perform the " "operation (but not intended for file system problems)." msgstr "" -#: ../../library/os.rst:4145 +#: ../../library/os.rst:4432 msgid "Exit code that means that some kind of configuration error occurred." msgstr "" -#: ../../library/os.rst:4152 +#: ../../library/os.rst:4439 msgid "Exit code that means something like \"an entry was not found\"." msgstr "" -#: ../../library/os.rst:4159 +#: ../../library/os.rst:4446 msgid "" "Fork a child process. Return ``0`` in the child and the child's process id " "in the parent. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4162 +#: ../../library/os.rst:4449 msgid "" "Note that some platforms including FreeBSD <= 6.3 and Cygwin have known " "issues when using ``fork()`` from a thread." msgstr "" -#: ../../library/os.rst:4165 +#: ../../library/os.rst:4452 msgid "" "Raises an :ref:`auditing event ` ``os.fork`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.fork``。" -#: ../../library/os.rst:4169 +#: ../../library/os.rst:4456 msgid "" "If you use TLS sockets in an application calling ``fork()``, see the warning " "in the :mod:`ssl` documentation." msgstr "" -#: ../../library/os.rst:4174 ../../library/os.rst:4218 +#: ../../library/os.rst:4461 ../../library/os.rst:4505 msgid "" "On macOS the use of this function is unsafe when mixed with using higher-" "level system APIs, and that includes using :mod:`urllib.request`." msgstr "" -#: ../../library/os.rst:4177 +#: ../../library/os.rst:4464 msgid "" "Calling ``fork()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4181 +#: ../../library/os.rst:4468 msgid "" "If Python is able to detect that your process has multiple threads, :func:" "`os.fork` now raises a :exc:`DeprecationWarning`." msgstr "" -#: ../../library/os.rst:4185 +#: ../../library/os.rst:4472 msgid "" "We chose to surface this as a warning, when detectable, to better inform " "developers of a design problem that the POSIX platform specifically notes as " @@ -4767,25 +5110,26 @@ msgid "" "``free``)." msgstr "" -#: ../../library/os.rst:4194 +#: ../../library/os.rst:4481 msgid "" "Users of macOS or users of libc or malloc implementations other than those " "typically found in glibc to date are among those already more likely to " "experience deadlocks running such code." msgstr "" -#: ../../library/os.rst:4198 +#: ../../library/os.rst:4485 msgid "" "See `this discussion on fork being incompatible with threads `_ for technical details of why we're surfacing " "this longstanding platform compatibility problem to developers." msgstr "" -#: ../../library/os.rst:4203 ../../library/os.rst:4450 -msgid ":ref:`Availability `: POSIX, not Emscripten, not WASI." -msgstr ":ref:`適用 `:POSIX、非 Emscripten、非 WASI。" +#: ../../library/os.rst:4490 ../../library/os.rst:4750 +msgid "" +":ref:`Availability `: POSIX, not WASI, not Android, not iOS." +msgstr ":ref:`適用 `:POSIX、非 WASI、非 Android、非 iOS。" -#: ../../library/os.rst:4208 +#: ../../library/os.rst:4495 msgid "" "Fork a child process, using a new pseudo-terminal as the child's controlling " "terminal. Return a pair of ``(pid, fd)``, where *pid* is ``0`` in the child, " @@ -4794,31 +5138,47 @@ msgid "" "the :mod:`pty` module. If an error occurs :exc:`OSError` is raised." msgstr "" -#: ../../library/os.rst:4214 +#: ../../library/os.rst:4501 msgid "" "Raises an :ref:`auditing event ` ``os.forkpty`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``os.forkpty``。" -#: ../../library/os.rst:4221 +#: ../../library/os.rst:4508 msgid "" "Calling ``forkpty()`` in a subinterpreter is no longer supported (:exc:" "`RuntimeError` is raised)." msgstr "" -#: ../../library/os.rst:4225 +#: ../../library/os.rst:4512 msgid "" "If Python is able to detect that your process has multiple threads, this now " "raises a :exc:`DeprecationWarning`. See the longer explanation on :func:`os." "fork`." msgstr "" -#: ../../library/os.rst:4239 +#: ../../library/os.rst:4517 ../../library/os.rst:4734 +#: ../../library/os.rst:4783 ../../library/os.rst:5020 +#: ../../library/os.rst:5054 ../../library/os.rst:5115 +#: ../../library/os.rst:5129 ../../library/os.rst:5146 +#: ../../library/os.rst:5161 ../../library/os.rst:5172 +#: ../../library/os.rst:5184 ../../library/os.rst:5197 +#: ../../library/os.rst:5206 ../../library/os.rst:5216 +#: ../../library/os.rst:5229 ../../library/os.rst:5280 +#: ../../library/os.rst:5291 ../../library/os.rst:5303 +#: ../../library/os.rst:5310 ../../library/os.rst:5319 +#: ../../library/os.rst:5328 ../../library/os.rst:5337 +#: ../../library/os.rst:5346 +msgid "" +":ref:`Availability `: Unix, not WASI, not Android, not iOS." +msgstr ":ref:`適用 `:Unix、非 WASI、非 Android、非 iOS。" + +#: ../../library/os.rst:4526 msgid "" "Send signal *sig* to the process *pid*. Constants for the specific signals " "available on the host platform are defined in the :mod:`signal` module." msgstr "" -#: ../../library/os.rst:4242 +#: ../../library/os.rst:4529 msgid "" "Windows: The :const:`signal.CTRL_C_EVENT` and :const:`signal." "CTRL_BREAK_EVENT` signals are special signals which can only be sent to " @@ -4829,11 +5189,11 @@ msgid "" "process handles to be killed." msgstr "" -#: ../../library/os.rst:4250 +#: ../../library/os.rst:4537 msgid "See also :func:`signal.pthread_kill`." msgstr "另請參閱 :func:`signal.pthread_kill`。" -#: ../../library/os.rst:4252 +#: ../../library/os.rst:4539 msgid "" "Raises an :ref:`auditing event ` ``os.kill`` with arguments " "``pid``, ``sig``." @@ -4841,11 +5201,15 @@ msgstr "" "引發一個附帶引數 ``pid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." "kill``。" -#: ../../library/os.rst:4266 +#: ../../library/os.rst:4541 +msgid ":ref:`Availability `: Unix, Windows, not WASI, not iOS." +msgstr ":ref:`適用 `:Unix、Windows、非 WASI、非 iOS" + +#: ../../library/os.rst:4553 msgid "Send the signal *sig* to the process group *pgid*." msgstr "" -#: ../../library/os.rst:4268 +#: ../../library/os.rst:4555 msgid "" "Raises an :ref:`auditing event ` ``os.killpg`` with arguments " "``pgid``, ``sig``." @@ -4853,27 +5217,35 @@ msgstr "" "引發一個附帶引數 ``pgid``、``sig`` 的\\ :ref:`稽核事件 ` ``os." "killpg``。" -#: ../../library/os.rst:4275 +#: ../../library/os.rst:4557 ../../library/os.rst:4594 +msgid ":ref:`Availability `: Unix, not WASI, not iOS." +msgstr ":ref:`適用 `:Unix、非 WASI、非 iOS。" + +#: ../../library/os.rst:4562 msgid "" "Add *increment* to the process's \"niceness\". Return the new niceness." msgstr "" -#: ../../library/os.rst:4282 +#: ../../library/os.rst:4569 msgid "" "Return a file descriptor referring to the process *pid* with *flags* set. " "This descriptor can be used to perform process management without races and " "signals." msgstr "" -#: ../../library/os.rst:4286 +#: ../../library/os.rst:4573 msgid "See the :manpage:`pidfd_open(2)` man page for more details." msgstr "更多細節請見 :manpage:`pidfd_open(2)` 手冊頁。" -#: ../../library/os.rst:4288 -msgid ":ref:`Availability `: Linux >= 5.3" -msgstr ":ref:`適用 `:Linux 5.3 以上" +#: ../../library/os.rst:4575 +msgid "" +":ref:`Availability `: Linux >= 5.3, Android >= :func:`build-" +"time ` API level 31" +msgstr "" +":ref:`適用 `:Linux 5.3 Android 6.0 以上、Android :func:`build-" +"time ` API level 31 以上" -#: ../../library/os.rst:4293 +#: ../../library/os.rst:4580 msgid "" "This flag indicates that the file descriptor will be non-blocking. If the " "process referred to by the file descriptor has not yet terminated, then an " @@ -4881,17 +5253,17 @@ msgid "" "immediately return the error :const:`~errno.EAGAIN` rather than blocking." msgstr "" -#: ../../library/os.rst:4298 +#: ../../library/os.rst:4585 msgid ":ref:`Availability `: Linux >= 5.10" msgstr ":ref:`適用 `:Linux 5.10 以上" -#: ../../library/os.rst:4304 +#: ../../library/os.rst:4591 msgid "" "Lock program segments into memory. The value of *op* (defined in ````) determines which segments are locked." msgstr "" -#: ../../library/os.rst:4312 +#: ../../library/os.rst:4599 msgid "" "Open a pipe to or from command *cmd*. The return value is an open file " "object connected to the pipe, which can be read or written depending on " @@ -4901,7 +5273,7 @@ msgid "" "rather than bytes." msgstr "" -#: ../../library/os.rst:4320 +#: ../../library/os.rst:4607 msgid "" "The ``close`` method returns :const:`None` if the subprocess exited " "successfully, or the subprocess's return code if there was an error. On " @@ -4913,60 +5285,61 @@ msgid "" "contains the signed integer return code from the child process." msgstr "" -#: ../../library/os.rst:4330 +#: ../../library/os.rst:4617 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the ``close`` " "method result (exit status) into an exit code if it is not ``None``. On " "Windows, the ``close`` method result is directly the exit code (or ``None``)." msgstr "" -#: ../../library/os.rst:4335 +#: ../../library/os.rst:4622 msgid "" "This is implemented using :class:`subprocess.Popen`; see that class's " "documentation for more powerful ways to manage and communicate with " "subprocesses." msgstr "" -#: ../../library/os.rst:4339 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" +#: ../../library/os.rst:4626 +msgid ":ref:`Availability `: not WASI, not Android, not iOS." +msgstr ":ref:`適用 `:非 WASI、非 Android、非 iOS。" -#: ../../library/os.rst:4342 +#: ../../library/os.rst:4629 msgid "" "The :ref:`Python UTF-8 Mode ` affects encodings used for *cmd* " "and pipe contents." msgstr "" -#: ../../library/os.rst:4345 +#: ../../library/os.rst:4632 msgid "" ":func:`popen` is a simple wrapper around :class:`subprocess.Popen`. Use :" "class:`subprocess.Popen` or :func:`subprocess.run` to control options like " "encodings." msgstr "" -#: ../../library/os.rst:4354 +#: ../../library/os.rst:4641 msgid "Wraps the :c:func:`!posix_spawn` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4356 +#: ../../library/os.rst:4643 msgid "" "Most users should use :func:`subprocess.run` instead of :func:`posix_spawn`." msgstr "" -#: ../../library/os.rst:4358 +#: ../../library/os.rst:4645 msgid "" "The positional-only arguments *path*, *args*, and *env* are similar to :func:" -"`execve`." +"`execve`. *env* is allowed to be ``None``, in which case current process' " +"environment is used." msgstr "" -#: ../../library/os.rst:4361 +#: ../../library/os.rst:4649 msgid "" "The *path* parameter is the path to the executable file. The *path* should " "contain a directory. Use :func:`posix_spawnp` to pass an executable file " "without directory." msgstr "" -#: ../../library/os.rst:4365 +#: ../../library/os.rst:4653 msgid "" "The *file_actions* argument may be a sequence of tuples describing actions " "to take on specific file descriptors in the child process between the C " @@ -4975,40 +5348,49 @@ msgid "" "describing the remaining tuple elements:" msgstr "" -#: ../../library/os.rst:4373 +#: ../../library/os.rst:4661 msgid "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" msgstr "(``os.POSIX_SPAWN_OPEN``, *fd*, *path*, *flags*, *mode*)" -#: ../../library/os.rst:4375 +#: ../../library/os.rst:4663 msgid "Performs ``os.dup2(os.open(path, flags, mode), fd)``." msgstr "" -#: ../../library/os.rst:4379 +#: ../../library/os.rst:4667 msgid "(``os.POSIX_SPAWN_CLOSE``, *fd*)" msgstr "(``os.POSIX_SPAWN_CLOSE``, *fd*)" -#: ../../library/os.rst:4381 +#: ../../library/os.rst:4669 msgid "Performs ``os.close(fd)``." msgstr "" -#: ../../library/os.rst:4385 +#: ../../library/os.rst:4673 msgid "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" msgstr "(``os.POSIX_SPAWN_DUP2``, *fd*, *new_fd*)" -#: ../../library/os.rst:4387 +#: ../../library/os.rst:4675 msgid "Performs ``os.dup2(fd, new_fd)``." msgstr "" -#: ../../library/os.rst:4389 +#: ../../library/os.rst:4679 +msgid "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" +msgstr "(``os.POSIX_SPAWN_CLOSEFROM``, *fd*)" + +#: ../../library/os.rst:4681 +msgid "Performs ``os.closerange(fd, INF)``." +msgstr "" + +#: ../../library/os.rst:4683 msgid "" "These tuples correspond to the C library :c:func:`!" "posix_spawn_file_actions_addopen`, :c:func:`!" -"posix_spawn_file_actions_addclose`, and :c:func:`!" -"posix_spawn_file_actions_adddup2` API calls used to prepare for the :c:func:" -"`!posix_spawn` call itself." +"posix_spawn_file_actions_addclose`, :c:func:`!" +"posix_spawn_file_actions_adddup2`, and :c:func:`!" +"posix_spawn_file_actions_addclosefrom_np` API calls used to prepare for the :" +"c:func:`!posix_spawn` call itself." msgstr "" -#: ../../library/os.rst:4395 +#: ../../library/os.rst:4690 msgid "" "The *setpgroup* argument will set the process group of the child to the " "value specified. If the value specified is 0, the child's process group ID " @@ -5017,7 +5399,7 @@ msgid "" "corresponds to the C library :c:macro:`!POSIX_SPAWN_SETPGROUP` flag." msgstr "" -#: ../../library/os.rst:4401 +#: ../../library/os.rst:4696 msgid "" "If the *resetids* argument is ``True`` it will reset the effective UID and " "GID of the child to the real UID and GID of the parent process. If the " @@ -5028,7 +5410,7 @@ msgid "" "library :c:macro:`!POSIX_SPAWN_RESETIDS` flag." msgstr "" -#: ../../library/os.rst:4409 +#: ../../library/os.rst:4704 msgid "" "If the *setsid* argument is ``True``, it will create a new session ID for " "``posix_spawn``. *setsid* requires :c:macro:`!POSIX_SPAWN_SETSID` or :c:" @@ -5036,7 +5418,7 @@ msgid "" "is raised." msgstr "" -#: ../../library/os.rst:4414 +#: ../../library/os.rst:4709 msgid "" "The *setsigmask* argument will set the signal mask to the signal set " "specified. If the parameter is not used, then the child inherits the " @@ -5044,14 +5426,14 @@ msgid "" "POSIX_SPAWN_SETSIGMASK` flag." msgstr "" -#: ../../library/os.rst:4419 +#: ../../library/os.rst:4714 msgid "" "The *sigdef* argument will reset the disposition of all signals in the set " "specified. This argument corresponds to the C library :c:macro:`!" "POSIX_SPAWN_SETSIGDEF` flag." msgstr "" -#: ../../library/os.rst:4423 +#: ../../library/os.rst:4718 msgid "" "The *scheduler* argument must be a tuple containing the (optional) scheduler " "policy and an instance of :class:`sched_param` with the scheduler " @@ -5061,7 +5443,7 @@ msgid "" "POSIX_SPAWN_SETSCHEDULER` flags." msgstr "" -#: ../../library/os.rst:4430 ../../library/os.rst:4446 +#: ../../library/os.rst:4725 ../../library/os.rst:4746 msgid "" "Raises an :ref:`auditing event ` ``os.posix_spawn`` with arguments " "``path``, ``argv``, ``env``." @@ -5069,72 +5451,79 @@ msgstr "" "引發一個附帶引數 ``path``、``argv``、``env`` 的\\ :ref:`稽核事件 ` " "``os.posix_spawn``。" -#: ../../library/os.rst:4440 +#: ../../library/os.rst:4729 +msgid "" +"*env* parameter accepts ``None``. ``os.POSIX_SPAWN_CLOSEFROM`` is available " +"on platforms where :c:func:`!posix_spawn_file_actions_addclosefrom_np` " +"exists." +msgstr "" + +#: ../../library/os.rst:4740 msgid "Wraps the :c:func:`!posix_spawnp` C library API for use from Python." msgstr "" -#: ../../library/os.rst:4442 +#: ../../library/os.rst:4742 msgid "" "Similar to :func:`posix_spawn` except that the system searches for the " "*executable* file in the list of directories specified by the :envvar:`PATH` " "environment variable (in the same way as for ``execvp(3)``)." msgstr "" -#: ../../library/os.rst:4452 +#: ../../library/os.rst:4752 msgid "See :func:`posix_spawn` documentation." msgstr "見 :func:`posix_spawn` 文件。" -#: ../../library/os.rst:4458 +#: ../../library/os.rst:4758 msgid "" "Register callables to be executed when a new child process is forked using :" "func:`os.fork` or similar process cloning APIs. The parameters are optional " "and keyword-only. Each specifies a different call point." msgstr "" -#: ../../library/os.rst:4463 +#: ../../library/os.rst:4763 msgid "*before* is a function called before forking a child process." msgstr "" -#: ../../library/os.rst:4464 +#: ../../library/os.rst:4764 msgid "" "*after_in_parent* is a function called from the parent process after forking " "a child process." msgstr "" -#: ../../library/os.rst:4466 +#: ../../library/os.rst:4766 msgid "*after_in_child* is a function called from the child process." msgstr "" -#: ../../library/os.rst:4468 +#: ../../library/os.rst:4768 msgid "" "These calls are only made if control is expected to return to the Python " "interpreter. A typical :mod:`subprocess` launch will not trigger them as " "the child is not going to re-enter the interpreter." msgstr "" -#: ../../library/os.rst:4472 +#: ../../library/os.rst:4772 msgid "" "Functions registered for execution before forking are called in reverse " "registration order. Functions registered for execution after forking " "(either in the parent or in the child) are called in registration order." msgstr "" -#: ../../library/os.rst:4477 +#: ../../library/os.rst:4777 msgid "" "Note that :c:func:`fork` calls made by third-party C code may not call those " "functions, unless it explicitly calls :c:func:`PyOS_BeforeFork`, :c:func:" "`PyOS_AfterFork_Parent` and :c:func:`PyOS_AfterFork_Child`." msgstr "" -#: ../../library/os.rst:4481 +#: ../../library/os.rst:4781 msgid "There is no way to unregister a function." msgstr "" -#: ../../library/os.rst:4497 +#: ../../library/os.rst:4797 msgid "Execute the program *path* in a new process." msgstr "" -#: ../../library/os.rst:4499 +#: ../../library/os.rst:4799 msgid "" "(Note that the :mod:`subprocess` module provides more powerful facilities " "for spawning new processes and retrieving their results; using that module " @@ -5142,7 +5531,7 @@ msgid "" "`subprocess-replacements` section.)" msgstr "" -#: ../../library/os.rst:4504 +#: ../../library/os.rst:4804 msgid "" "If *mode* is :const:`P_NOWAIT`, this function returns the process id of the " "new process; if *mode* is :const:`P_WAIT`, returns the process's exit code " @@ -5151,13 +5540,13 @@ msgid "" "handle, so can be used with the :func:`waitpid` function." msgstr "" -#: ../../library/os.rst:4510 +#: ../../library/os.rst:4810 msgid "" "Note on VxWorks, this function doesn't return ``-signal`` when the new " "process is killed. Instead it raises OSError exception." msgstr "" -#: ../../library/os.rst:4513 +#: ../../library/os.rst:4813 msgid "" "The \"l\" and \"v\" variants of the :func:`spawn\\* ` functions " "differ in how command-line arguments are passed. The \"l\" variants are " @@ -5169,7 +5558,7 @@ msgid "" "to the child process must start with the name of the command being run." msgstr "" -#: ../../library/os.rst:4522 +#: ../../library/os.rst:4822 msgid "" "The variants which include a second \"p\" near the end (:func:`spawnlp`, :" "func:`spawnlpe`, :func:`spawnvp`, and :func:`spawnvpe`) will use the :envvar:" @@ -5182,7 +5571,7 @@ msgid "" "appropriate absolute or relative path." msgstr "" -#: ../../library/os.rst:4532 +#: ../../library/os.rst:4832 msgid "" "For :func:`spawnle`, :func:`spawnlpe`, :func:`spawnve`, and :func:`spawnvpe` " "(note that these all end in \"e\"), the *env* parameter must be a mapping " @@ -5194,13 +5583,13 @@ msgid "" "values will cause the function to fail, with a return value of ``127``." msgstr "" -#: ../../library/os.rst:4541 +#: ../../library/os.rst:4841 msgid "" "As an example, the following calls to :func:`spawnlp` and :func:`spawnvpe` " "are equivalent::" msgstr "" -#: ../../library/os.rst:4544 +#: ../../library/os.rst:4844 msgid "" "import os\n" "os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')\n" @@ -5214,7 +5603,7 @@ msgstr "" "L = ['cp', 'index.html', '/dev/null']\n" "os.spawnvpe(os.P_WAIT, 'cp', L, os.environ)" -#: ../../library/os.rst:4550 +#: ../../library/os.rst:4850 msgid "" "Raises an :ref:`auditing event ` ``os.spawn`` with arguments " "``mode``, ``path``, ``args``, ``env``." @@ -5222,7 +5611,7 @@ msgstr "" "引發一個附帶引數 ``mode``、``path``、``args``、``env`` 的\\ :ref:`稽核事件 " "` ``os.spawn``。" -#: ../../library/os.rst:4554 +#: ../../library/os.rst:4854 msgid "" ":func:`spawnlp`, :func:`spawnlpe`, :func:`spawnvp` and :func:`spawnvpe` are " "not available on Windows. :func:`spawnle` and :func:`spawnve` are not " @@ -5230,7 +5619,7 @@ msgid "" "instead." msgstr "" -#: ../../library/os.rst:4566 +#: ../../library/os.rst:4866 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If either of these values is given, the :func:" @@ -5238,7 +5627,7 @@ msgid "" "been created, with the process id as the return value." msgstr "" -#: ../../library/os.rst:4576 +#: ../../library/os.rst:4876 msgid "" "Possible value for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. If this is given as *mode*, the :func:`spawn\\* " @@ -5247,7 +5636,7 @@ msgid "" "successful, or ``-signal`` if a signal kills the process." msgstr "" -#: ../../library/os.rst:4588 +#: ../../library/os.rst:4888 msgid "" "Possible values for the *mode* parameter to the :func:`spawn\\* ` " "family of functions. These are less portable than those listed above. :" @@ -5257,11 +5646,11 @@ msgid "" "function will not return." msgstr "" -#: ../../library/os.rst:4599 +#: ../../library/os.rst:4899 msgid "Start a file with its associated application." msgstr "" -#: ../../library/os.rst:4601 +#: ../../library/os.rst:4901 msgid "" "When *operation* is not specified, this acts like double-clicking the file " "in Windows Explorer, or giving the file name as an argument to the :program:" @@ -5269,7 +5658,7 @@ msgid "" "whatever application (if any) its extension is associated." msgstr "" -#: ../../library/os.rst:4606 +#: ../../library/os.rst:4906 msgid "" "When another *operation* is given, it must be a \"command verb\" that " "specifies what should be done with the file. Common verbs documented by " @@ -5277,28 +5666,28 @@ msgid "" "as well as ``'explore'`` and ``'find'`` (to be used on directories)." msgstr "" -#: ../../library/os.rst:4611 +#: ../../library/os.rst:4911 msgid "" "When launching an application, specify *arguments* to be passed as a single " "string. This argument may have no effect when using this function to launch " "a document." msgstr "" -#: ../../library/os.rst:4615 +#: ../../library/os.rst:4915 msgid "" "The default working directory is inherited, but may be overridden by the " "*cwd* argument. This should be an absolute path. A relative *path* will be " "resolved against this argument." msgstr "" -#: ../../library/os.rst:4619 +#: ../../library/os.rst:4919 msgid "" "Use *show_cmd* to override the default window style. Whether this has any " "effect will depend on the application being launched. Values are integers as " "supported by the Win32 :c:func:`!ShellExecute` function." msgstr "" -#: ../../library/os.rst:4623 +#: ../../library/os.rst:4923 msgid "" ":func:`startfile` returns as soon as the associated application is launched. " "There is no option to wait for the application to close, and no way to " @@ -5309,14 +5698,14 @@ msgid "" "encoded for Win32." msgstr "" -#: ../../library/os.rst:4631 +#: ../../library/os.rst:4931 msgid "" "To reduce interpreter startup overhead, the Win32 :c:func:`!ShellExecute` " "function is not resolved until this function is first called. If the " "function cannot be resolved, :exc:`NotImplementedError` will be raised." msgstr "" -#: ../../library/os.rst:4635 +#: ../../library/os.rst:4935 msgid "" "Raises an :ref:`auditing event ` ``os.startfile`` with arguments " "``path``, ``operation``." @@ -5324,7 +5713,7 @@ msgstr "" "引發一個附帶引數 ``path``、``operation`` 的\\ :ref:`稽核事件 ` " "``os.startfile``。" -#: ../../library/os.rst:4637 +#: ../../library/os.rst:4937 msgid "" "Raises an :ref:`auditing event ` ``os.startfile/2`` with arguments " "``path``, ``operation``, ``arguments``, ``cwd``, ``show_cmd``." @@ -5332,13 +5721,13 @@ msgstr "" "引發一個附帶引數 ``path``、``operation``、``arguments``、``cwd``、" "``show_cmd`` 的\\ :ref:`稽核事件 ` ``os.startfile/2``。" -#: ../../library/os.rst:4641 +#: ../../library/os.rst:4941 msgid "" "Added the *arguments*, *cwd* and *show_cmd* arguments, and the ``os." "startfile/2`` audit event." msgstr "" -#: ../../library/os.rst:4648 +#: ../../library/os.rst:4948 msgid "" "Execute the command (a string) in a subshell. This is implemented by " "calling the Standard C function :c:func:`system`, and has the same " @@ -5349,13 +5738,13 @@ msgid "" "value of the Python function is system-dependent." msgstr "" -#: ../../library/os.rst:4656 +#: ../../library/os.rst:4956 msgid "" "On Unix, the return value is the exit status of the process encoded in the " "format specified for :func:`wait`." msgstr "" -#: ../../library/os.rst:4659 +#: ../../library/os.rst:4959 msgid "" "On Windows, the return value is that returned by the system shell after " "running *command*. The shell is given by the Windows environment variable :" @@ -5364,7 +5753,7 @@ msgid "" "shell documentation." msgstr "" -#: ../../library/os.rst:4665 +#: ../../library/os.rst:4965 msgid "" "The :mod:`subprocess` module provides more powerful facilities for spawning " "new processes and retrieving their results; using that module is preferable " @@ -5372,54 +5761,54 @@ msgid "" "the :mod:`subprocess` documentation for some helpful recipes." msgstr "" -#: ../../library/os.rst:4670 +#: ../../library/os.rst:4970 msgid "" "On Unix, :func:`waitstatus_to_exitcode` can be used to convert the result " "(exit status) into an exit code. On Windows, the result is directly the exit " "code." msgstr "" -#: ../../library/os.rst:4674 +#: ../../library/os.rst:4974 msgid "" "Raises an :ref:`auditing event ` ``os.system`` with argument " "``command``." msgstr "" "引發一個附帶引數 ``command`` 的\\ :ref:`稽核事件 ` ``os.system``。" -#: ../../library/os.rst:4681 +#: ../../library/os.rst:4981 msgid "" "Returns the current global process times. The return value is an object with " "five attributes:" msgstr "" -#: ../../library/os.rst:4684 +#: ../../library/os.rst:4984 msgid ":attr:`!user` - user time" msgstr ":attr:`!user` - 使用者時間" -#: ../../library/os.rst:4685 +#: ../../library/os.rst:4985 msgid ":attr:`!system` - system time" msgstr ":attr:`!system` - 系統時間" -#: ../../library/os.rst:4686 +#: ../../library/os.rst:4986 msgid ":attr:`!children_user` - user time of all child processes" msgstr ":attr:`!children_user` - 所有子行程的使用者時間" -#: ../../library/os.rst:4687 +#: ../../library/os.rst:4987 msgid ":attr:`!children_system` - system time of all child processes" msgstr ":attr:`!children_system` - 所有子行程的系統時間" -#: ../../library/os.rst:4688 +#: ../../library/os.rst:4988 msgid ":attr:`!elapsed` - elapsed real time since a fixed point in the past" msgstr "" -#: ../../library/os.rst:4690 +#: ../../library/os.rst:4990 msgid "" "For backwards compatibility, this object also behaves like a five-tuple " "containing :attr:`!user`, :attr:`!system`, :attr:`!children_user`, :attr:`!" "children_system`, and :attr:`!elapsed` in that order." msgstr "" -#: ../../library/os.rst:4694 +#: ../../library/os.rst:4994 msgid "" "See the Unix manual page :manpage:`times(2)` and `times(3) `_ manual page on Unix or `the " @@ -5429,7 +5818,7 @@ msgid "" "attributes are zero." msgstr "" -#: ../../library/os.rst:4708 +#: ../../library/os.rst:5008 msgid "" "Wait for completion of a child process, and return a tuple containing its " "pid and exit status indication: a 16-bit number, whose low byte is the " @@ -5438,87 +5827,87 @@ msgid "" "if a core file was produced." msgstr "" -#: ../../library/os.rst:4714 +#: ../../library/os.rst:5014 msgid "" "If there are no children that could be waited for, :exc:`ChildProcessError` " "is raised." msgstr "" -#: ../../library/os.rst:4717 ../../library/os.rst:4792 +#: ../../library/os.rst:5017 ../../library/os.rst:5092 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exit code." msgstr "" -#: ../../library/os.rst:4724 +#: ../../library/os.rst:5024 msgid "" "The other :func:`!wait*` functions documented below can be used to wait for " "the completion of a specific child process and have more options. :func:" "`waitpid` is the only one also available on Windows." msgstr "" -#: ../../library/os.rst:4731 +#: ../../library/os.rst:5031 msgid "Wait for the completion of a child process." msgstr "" -#: ../../library/os.rst:4733 +#: ../../library/os.rst:5033 msgid "" "*idtype* can be :data:`P_PID`, :data:`P_PGID`, :data:`P_ALL`, or (on Linux) :" "data:`P_PIDFD`. The interpretation of *id* depends on it; see their " "individual descriptions." msgstr "" -#: ../../library/os.rst:4736 +#: ../../library/os.rst:5036 msgid "" "*options* is an OR combination of flags. At least one of :data:`WEXITED`, :" "data:`WSTOPPED` or :data:`WCONTINUED` is required; :data:`WNOHANG` and :data:" "`WNOWAIT` are additional optional flags." msgstr "" -#: ../../library/os.rst:4740 +#: ../../library/os.rst:5040 msgid "" "The return value is an object representing the data contained in the :c:type:" "`siginfo_t` structure with the following attributes:" msgstr "" -#: ../../library/os.rst:4743 +#: ../../library/os.rst:5043 msgid ":attr:`!si_pid` (process ID)" msgstr "" -#: ../../library/os.rst:4744 +#: ../../library/os.rst:5044 msgid ":attr:`!si_uid` (real user ID of the child)" msgstr "" -#: ../../library/os.rst:4745 +#: ../../library/os.rst:5045 msgid ":attr:`!si_signo` (always :const:`~signal.SIGCHLD`)" msgstr "" -#: ../../library/os.rst:4746 +#: ../../library/os.rst:5046 msgid "" ":attr:`!si_status` (the exit status or signal number, depending on :attr:`!" "si_code`)" msgstr "" -#: ../../library/os.rst:4747 +#: ../../library/os.rst:5047 msgid ":attr:`!si_code` (see :data:`CLD_EXITED` for possible values)" msgstr "" -#: ../../library/os.rst:4749 +#: ../../library/os.rst:5049 msgid "" "If :data:`WNOHANG` is specified and there are no matching children in the " "requested state, ``None`` is returned. Otherwise, if there are no matching " "children that could be waited for, :exc:`ChildProcessError` is raised." msgstr "" -#: ../../library/os.rst:4757 -msgid "This function is not available on macOS." +#: ../../library/os.rst:5058 +msgid "This function is now available on macOS as well." msgstr "" -#: ../../library/os.rst:4764 +#: ../../library/os.rst:5064 msgid "The details of this function differ on Unix and Windows." msgstr "" -#: ../../library/os.rst:4766 +#: ../../library/os.rst:5066 msgid "" "On Unix: Wait for completion of a child process given by process id *pid*, " "and return a tuple containing its process id and exit status indication " @@ -5527,7 +5916,7 @@ msgid "" "operation." msgstr "" -#: ../../library/os.rst:4771 +#: ../../library/os.rst:5071 msgid "" "If *pid* is greater than ``0``, :func:`waitpid` requests status information " "for that specific process. If *pid* is ``0``, the request is for the status " @@ -5537,7 +5926,7 @@ msgid "" "group ``-pid`` (the absolute value of *pid*)." msgstr "" -#: ../../library/os.rst:4778 +#: ../../library/os.rst:5078 msgid "" "*options* is an OR combination of flags. If it contains :data:`WNOHANG` and " "there are no matching children in the requested state, ``(0, 0)`` is " @@ -5546,7 +5935,7 @@ msgid "" "are :data:`WUNTRACED` and :data:`WCONTINUED`." msgstr "" -#: ../../library/os.rst:4784 +#: ../../library/os.rst:5084 msgid "" "On Windows: Wait for completion of a process given by process handle *pid*, " "and return a tuple containing *pid*, and its exit status shifted left by 8 " @@ -5558,7 +5947,7 @@ msgid "" "process handles." msgstr "" -#: ../../library/os.rst:4805 +#: ../../library/os.rst:5105 msgid "" "Similar to :func:`waitpid`, except no process id argument is given and a 3-" "element tuple containing the child's process id, exit status indication, and " @@ -5567,13 +5956,13 @@ msgid "" "same as that provided to :func:`waitpid` and :func:`wait4`." msgstr "" -#: ../../library/os.rst:4812 ../../library/os.rst:4826 +#: ../../library/os.rst:5112 ../../library/os.rst:5126 msgid "" ":func:`waitstatus_to_exitcode` can be used to convert the exit status into " "an exitcode." msgstr "" -#: ../../library/os.rst:4820 +#: ../../library/os.rst:5120 msgid "" "Similar to :func:`waitpid`, except a 3-element tuple, containing the child's " "process id, exit status indication, and resource usage information is " @@ -5582,118 +5971,118 @@ msgid "" "to :func:`waitpid`." msgstr "" -#: ../../library/os.rst:4837 +#: ../../library/os.rst:5137 msgid "" "These are the possible values for *idtype* in :func:`waitid`. They affect " "how *id* is interpreted:" msgstr "" -#: ../../library/os.rst:4840 +#: ../../library/os.rst:5140 msgid ":data:`!P_PID` - wait for the child whose PID is *id*." msgstr "" -#: ../../library/os.rst:4841 +#: ../../library/os.rst:5141 msgid ":data:`!P_PGID` - wait for any child whose progress group ID is *id*." msgstr "" -#: ../../library/os.rst:4842 +#: ../../library/os.rst:5142 msgid ":data:`!P_ALL` - wait for any child; *id* is ignored." msgstr "" -#: ../../library/os.rst:4843 +#: ../../library/os.rst:5143 msgid "" ":data:`!P_PIDFD` - wait for the child identified by the file descriptor *id* " "(a process file descriptor created with :func:`pidfd_open`)." msgstr "" -#: ../../library/os.rst:4848 +#: ../../library/os.rst:5148 msgid ":data:`!P_PIDFD` is only available on Linux >= 5.4." msgstr "" -#: ../../library/os.rst:4851 +#: ../../library/os.rst:5151 msgid "The :data:`!P_PIDFD` constant." msgstr "" -#: ../../library/os.rst:4857 +#: ../../library/os.rst:5157 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, :func:`wait4`, and :" "func:`waitid` causes child processes to be reported if they have been " "continued from a job control stop since they were last reported." msgstr "" -#: ../../library/os.rst:4866 +#: ../../library/os.rst:5166 msgid "" "This *options* flag for :func:`waitid` causes child processes that have " "terminated to be reported." msgstr "" -#: ../../library/os.rst:4869 +#: ../../library/os.rst:5169 msgid "" "The other ``wait*`` functions always report children that have terminated, " "so this option is not available for them." msgstr "" -#: ../../library/os.rst:4879 +#: ../../library/os.rst:5179 msgid "" "This *options* flag for :func:`waitid` causes child processes that have been " "stopped by the delivery of a signal to be reported." msgstr "" -#: ../../library/os.rst:4882 ../../library/os.rst:4914 +#: ../../library/os.rst:5182 ../../library/os.rst:5214 msgid "This option is not available for the other ``wait*`` functions." msgstr "" -#: ../../library/os.rst:4891 +#: ../../library/os.rst:5191 msgid "" "This *options* flag for :func:`waitpid`, :func:`wait3`, and :func:`wait4` " "causes child processes to also be reported if they have been stopped but " "their current state has not been reported since they were stopped." msgstr "" -#: ../../library/os.rst:4895 +#: ../../library/os.rst:5195 msgid "This option is not available for :func:`waitid`." msgstr "" -#: ../../library/os.rst:4902 +#: ../../library/os.rst:5202 msgid "" "This *options* flag causes :func:`waitpid`, :func:`wait3`, :func:`wait4`, " "and :func:`waitid` to return right away if no child process status is " "available immediately." msgstr "" -#: ../../library/os.rst:4911 +#: ../../library/os.rst:5211 msgid "" "This *options* flag causes :func:`waitid` to leave the child in a waitable " "state, so that a later :func:`!wait*` call can be used to retrieve the child " "status information again." msgstr "" -#: ../../library/os.rst:4926 +#: ../../library/os.rst:5226 msgid "" "These are the possible values for :attr:`!si_code` in the result returned " "by :func:`waitid`." msgstr "" -#: ../../library/os.rst:4933 +#: ../../library/os.rst:5233 msgid "Added :data:`CLD_KILLED` and :data:`CLD_STOPPED` values." msgstr "" -#: ../../library/os.rst:4939 +#: ../../library/os.rst:5239 msgid "Convert a wait status to an exit code." msgstr "" -#: ../../library/os.rst:4941 +#: ../../library/os.rst:5241 msgid "On Unix:" msgstr "" -#: ../../library/os.rst:4943 +#: ../../library/os.rst:5243 msgid "" "If the process exited normally (if ``WIFEXITED(status)`` is true), return " "the process exit status (return ``WEXITSTATUS(status)``): result greater " "than or equal to 0." msgstr "" -#: ../../library/os.rst:4946 +#: ../../library/os.rst:5246 msgid "" "If the process was terminated by a signal (if ``WIFSIGNALED(status)`` is " "true), return ``-signum`` where *signum* is the number of the signal that " @@ -5701,15 +6090,15 @@ msgid "" "than 0." msgstr "" -#: ../../library/os.rst:4950 +#: ../../library/os.rst:5250 msgid "Otherwise, raise a :exc:`ValueError`." msgstr "" -#: ../../library/os.rst:4952 +#: ../../library/os.rst:5252 msgid "On Windows, return *status* shifted right by 8 bits." msgstr "" -#: ../../library/os.rst:4954 +#: ../../library/os.rst:5254 msgid "" "On Unix, if the process is being traced or if :func:`waitpid` was called " "with :data:`WUNTRACED` option, the caller must first check if " @@ -5717,221 +6106,225 @@ msgid "" "``WIFSTOPPED(status)`` is true." msgstr "" -#: ../../library/os.rst:4961 +#: ../../library/os.rst:5261 msgid "" ":func:`WIFEXITED`, :func:`WEXITSTATUS`, :func:`WIFSIGNALED`, :func:" "`WTERMSIG`, :func:`WIFSTOPPED`, :func:`WSTOPSIG` functions." msgstr "" -#: ../../library/os.rst:4969 +#: ../../library/os.rst:5269 msgid "" "The following functions take a process status code as returned by :func:" "`system`, :func:`wait`, or :func:`waitpid` as a parameter. They may be used " "to determine the disposition of a process." msgstr "" -#: ../../library/os.rst:4975 +#: ../../library/os.rst:5275 msgid "" "Return ``True`` if a core dump was generated for the process, otherwise " "return ``False``." msgstr "" -#: ../../library/os.rst:4978 ../../library/os.rst:5044 +#: ../../library/os.rst:5278 ../../library/os.rst:5344 msgid "This function should be employed only if :func:`WIFSIGNALED` is true." msgstr "" -#: ../../library/os.rst:4985 +#: ../../library/os.rst:5285 msgid "" "Return ``True`` if a stopped child has been resumed by delivery of :const:" "`~signal.SIGCONT` (if the process has been continued from a job control " "stop), otherwise return ``False``." msgstr "" -#: ../../library/os.rst:4989 +#: ../../library/os.rst:5289 msgid "See :data:`WCONTINUED` option." msgstr "參閱 :data:`WCONTINUED` 選項。" -#: ../../library/os.rst:4996 +#: ../../library/os.rst:5296 msgid "" "Return ``True`` if the process was stopped by delivery of a signal, " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:4999 +#: ../../library/os.rst:5299 msgid "" ":func:`WIFSTOPPED` only returns ``True`` if the :func:`waitpid` call was " "done using :data:`WUNTRACED` option or when the process is being traced " "(see :manpage:`ptrace(2)`)." msgstr "" -#: ../../library/os.rst:5007 +#: ../../library/os.rst:5307 msgid "" "Return ``True`` if the process was terminated by a signal, otherwise return " "``False``." msgstr "" -#: ../../library/os.rst:5015 +#: ../../library/os.rst:5315 msgid "" "Return ``True`` if the process exited terminated normally, that is, by " "calling ``exit()`` or ``_exit()``, or by returning from ``main()``; " "otherwise return ``False``." msgstr "" -#: ../../library/os.rst:5024 +#: ../../library/os.rst:5324 msgid "Return the process exit status." msgstr "" -#: ../../library/os.rst:5026 +#: ../../library/os.rst:5326 msgid "This function should be employed only if :func:`WIFEXITED` is true." msgstr "" -#: ../../library/os.rst:5033 +#: ../../library/os.rst:5333 msgid "Return the signal which caused the process to stop." msgstr "" -#: ../../library/os.rst:5035 +#: ../../library/os.rst:5335 msgid "This function should be employed only if :func:`WIFSTOPPED` is true." msgstr "" -#: ../../library/os.rst:5042 +#: ../../library/os.rst:5342 msgid "Return the number of the signal that caused the process to terminate." msgstr "" -#: ../../library/os.rst:5050 +#: ../../library/os.rst:5350 msgid "Interface to the scheduler" msgstr "" -#: ../../library/os.rst:5052 +#: ../../library/os.rst:5352 msgid "" "These functions control how a process is allocated CPU time by the operating " "system. They are only available on some Unix platforms. For more detailed " "information, consult your Unix manpages." msgstr "" -#: ../../library/os.rst:5058 +#: ../../library/os.rst:5358 msgid "" "The following scheduling policies are exposed if they are supported by the " "operating system." msgstr "" -#: ../../library/os.rst:5063 +#: ../../library/os.rst:5363 msgid "The default scheduling policy." msgstr "" -#: ../../library/os.rst:5067 +#: ../../library/os.rst:5367 msgid "" "Scheduling policy for CPU-intensive processes that tries to preserve " "interactivity on the rest of the computer." msgstr "" -#: ../../library/os.rst:5072 +#: ../../library/os.rst:5372 msgid "Scheduling policy for extremely low priority background tasks." msgstr "" -#: ../../library/os.rst:5076 +#: ../../library/os.rst:5376 msgid "Scheduling policy for sporadic server programs." msgstr "" -#: ../../library/os.rst:5080 +#: ../../library/os.rst:5380 msgid "A First In First Out scheduling policy." msgstr "" -#: ../../library/os.rst:5084 +#: ../../library/os.rst:5384 msgid "A round-robin scheduling policy." msgstr "" -#: ../../library/os.rst:5088 +#: ../../library/os.rst:5388 msgid "" "This flag can be OR'ed with any other scheduling policy. When a process with " "this flag set forks, its child's scheduling policy and priority are reset to " "the default." msgstr "" -#: ../../library/os.rst:5095 +#: ../../library/os.rst:5395 msgid "" "This class represents tunable scheduling parameters used in :func:" "`sched_setparam`, :func:`sched_setscheduler`, and :func:`sched_getparam`. It " "is immutable." msgstr "" -#: ../../library/os.rst:5099 +#: ../../library/os.rst:5399 msgid "At the moment, there is only one possible parameter:" msgstr "" -#: ../../library/os.rst:5103 +#: ../../library/os.rst:5403 msgid "The scheduling priority for a scheduling policy." msgstr "" -#: ../../library/os.rst:5108 +#: ../../library/os.rst:5408 msgid "" "Get the minimum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5114 +#: ../../library/os.rst:5414 msgid "" "Get the maximum priority value for *policy*. *policy* is one of the " "scheduling policy constants above." msgstr "" -#: ../../library/os.rst:5120 +#: ../../library/os.rst:5420 msgid "" "Set the scheduling policy for the process with PID *pid*. A *pid* of 0 means " "the calling process. *policy* is one of the scheduling policy constants " "above. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:5127 +#: ../../library/os.rst:5427 msgid "" "Return the scheduling policy for the process with PID *pid*. A *pid* of 0 " "means the calling process. The result is one of the scheduling policy " "constants above." msgstr "" -#: ../../library/os.rst:5134 +#: ../../library/os.rst:5434 msgid "" "Set the scheduling parameters for the process with PID *pid*. A *pid* of 0 " "means the calling process. *param* is a :class:`sched_param` instance." msgstr "" -#: ../../library/os.rst:5140 +#: ../../library/os.rst:5440 msgid "" "Return the scheduling parameters as a :class:`sched_param` instance for the " "process with PID *pid*. A *pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:5146 +#: ../../library/os.rst:5446 msgid "" "Return the round-robin quantum in seconds for the process with PID *pid*. A " "*pid* of 0 means the calling process." msgstr "" -#: ../../library/os.rst:5152 +#: ../../library/os.rst:5452 msgid "Voluntarily relinquish the CPU." msgstr "" -#: ../../library/os.rst:5157 +#: ../../library/os.rst:5457 msgid "" "Restrict the process with PID *pid* (or the current process if zero) to a " "set of CPUs. *mask* is an iterable of integers representing the set of CPUs " "to which the process should be restricted." msgstr "" -#: ../../library/os.rst:5164 +#: ../../library/os.rst:5464 msgid "Return the set of CPUs the process with PID *pid* is restricted to." msgstr "" -#: ../../library/os.rst:5166 +#: ../../library/os.rst:5466 msgid "" "If *pid* is zero, return the set of CPUs the calling thread of the current " "process is restricted to." msgstr "" -#: ../../library/os.rst:5173 +#: ../../library/os.rst:5469 +msgid "See also the :func:`process_cpu_count` function." +msgstr "也請見 :func:`process_cpu_count` 函式。" + +#: ../../library/os.rst:5475 msgid "Miscellaneous System Information" msgstr "" -#: ../../library/os.rst:5178 +#: ../../library/os.rst:5480 msgid "" "Return string-valued system configuration values. *name* specifies the " "configuration value to retrieve; it may be a string which is the name of a " @@ -5942,13 +6335,13 @@ msgid "" "included in that mapping, passing an integer for *name* is also accepted." msgstr "" -#: ../../library/os.rst:5186 +#: ../../library/os.rst:5488 msgid "" "If the configuration value specified by *name* isn't defined, ``None`` is " "returned." msgstr "" -#: ../../library/os.rst:5189 +#: ../../library/os.rst:5491 msgid "" "If *name* is a string and is not known, :exc:`ValueError` is raised. If a " "specific value for *name* is not supported by the host system, even if it is " @@ -5956,34 +6349,62 @@ msgid "" "`errno.EINVAL` for the error number." msgstr "" -#: ../../library/os.rst:5199 +#: ../../library/os.rst:5501 msgid "" "Dictionary mapping names accepted by :func:`confstr` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:5208 +#: ../../library/os.rst:5510 msgid "" -"Return the number of logical CPUs in the system. Returns ``None`` if " +"Return the number of logical CPUs in the **system**. Returns ``None`` if " "undetermined." msgstr "" -#: ../../library/os.rst:5211 +#: ../../library/os.rst:5513 +msgid "" +"The :func:`process_cpu_count` function can be used to get the number of " +"logical CPUs usable by the calling thread of the **current process**." +msgstr "" + +#: ../../library/os.rst:5518 msgid "" -"This number is not equivalent to the number of logical CPUs the current " -"process can use. ``len(os.sched_getaffinity(0))`` gets the number of logical " -"CPUs the calling thread of the current process is restricted to" +"If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " +"set, :func:`cpu_count` returns the overridden value *n*." msgstr "" -#: ../../library/os.rst:5220 +#: ../../library/os.rst:5525 msgid "" "Return the number of processes in the system run queue averaged over the " "last 1, 5, and 15 minutes or raises :exc:`OSError` if the load average was " "unobtainable." msgstr "" -#: ../../library/os.rst:5229 +#: ../../library/os.rst:5534 +msgid "" +"Get the number of logical CPUs usable by the calling thread of the **current " +"process**. Returns ``None`` if undetermined. It can be less than :func:" +"`cpu_count` depending on the CPU affinity." +msgstr "" + +#: ../../library/os.rst:5538 +msgid "" +"The :func:`cpu_count` function can be used to get the number of logical CPUs " +"in the **system**." +msgstr "" + +#: ../../library/os.rst:5541 +msgid "" +"If :option:`-X cpu_count <-X>` is given or :envvar:`PYTHON_CPU_COUNT` is " +"set, :func:`process_cpu_count` returns the overridden value *n*." +msgstr "" + +#: ../../library/os.rst:5544 +msgid "See also the :func:`sched_getaffinity` functions." +msgstr "也請見 :func:`sched_getaffinity` 函式。" + +#: ../../library/os.rst:5551 msgid "" "Return integer-valued system configuration values. If the configuration " "value specified by *name* isn't defined, ``-1`` is returned. The comments " @@ -5992,44 +6413,44 @@ msgid "" "``sysconf_names``." msgstr "" -#: ../../library/os.rst:5239 +#: ../../library/os.rst:5561 msgid "" "Dictionary mapping names accepted by :func:`sysconf` to the integer values " "defined for those names by the host operating system. This can be used to " "determine the set of names known to the system." msgstr "" -#: ../../library/os.rst:5245 +#: ../../library/os.rst:5567 msgid "Add ``'SC_MINSIGSTKSZ'`` name." msgstr "" -#: ../../library/os.rst:5248 +#: ../../library/os.rst:5570 msgid "" "The following data values are used to support path manipulation operations. " "These are defined for all platforms." msgstr "" -#: ../../library/os.rst:5251 +#: ../../library/os.rst:5573 msgid "" "Higher-level operations on pathnames are defined in the :mod:`os.path` " "module." msgstr "" -#: ../../library/os.rst:5257 +#: ../../library/os.rst:5579 msgid "" "The constant string used by the operating system to refer to the current " "directory. This is ``'.'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: ../../library/os.rst:5265 +#: ../../library/os.rst:5587 msgid "" "The constant string used by the operating system to refer to the parent " "directory. This is ``'..'`` for Windows and POSIX. Also available via :mod:" "`os.path`." msgstr "" -#: ../../library/os.rst:5274 +#: ../../library/os.rst:5596 msgid "" "The character used by the operating system to separate pathname components. " "This is ``'/'`` for POSIX and ``'\\\\'`` for Windows. Note that knowing " @@ -6038,7 +6459,7 @@ msgid "" "useful. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5284 +#: ../../library/os.rst:5606 msgid "" "An alternative character used by the operating system to separate pathname " "components, or ``None`` if only one separator character exists. This is set " @@ -6046,27 +6467,27 @@ msgid "" "via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5293 +#: ../../library/os.rst:5615 msgid "" "The character which separates the base filename from the extension; for " "example, the ``'.'`` in :file:`os.py`. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5301 +#: ../../library/os.rst:5623 msgid "" "The character conventionally used by the operating system to separate search " "path components (as in :envvar:`PATH`), such as ``':'`` for POSIX or ``';'`` " "for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5308 +#: ../../library/os.rst:5630 msgid "" "The default search path used by :func:`exec\\*p\\* ` and :func:" "`spawn\\*p\\* ` if the environment doesn't have a ``'PATH'`` key. " "Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5315 +#: ../../library/os.rst:5637 msgid "" "The string used to separate (or, rather, terminate) lines on the current " "platform. This may be a single character, such as ``'\\n'`` for POSIX, or " @@ -6075,36 +6496,36 @@ msgid "" "default); use a single ``'\\n'`` instead, on all platforms." msgstr "" -#: ../../library/os.rst:5324 +#: ../../library/os.rst:5646 msgid "" "The file path of the null device. For example: ``'/dev/null'`` for POSIX, " "``'nul'`` for Windows. Also available via :mod:`os.path`." msgstr "" -#: ../../library/os.rst:5335 +#: ../../library/os.rst:5657 msgid "" "Flags for use with the :func:`~sys.setdlopenflags` and :func:`~sys." "getdlopenflags` functions. See the Unix manual page :manpage:`dlopen(3)` " "for what the different flags mean." msgstr "" -#: ../../library/os.rst:5343 +#: ../../library/os.rst:5665 msgid "Random numbers" msgstr "" -#: ../../library/os.rst:5348 +#: ../../library/os.rst:5670 msgid "" "Get up to *size* random bytes. The function can return less bytes than " "requested." msgstr "" -#: ../../library/os.rst:5351 +#: ../../library/os.rst:5673 msgid "" "These bytes can be used to seed user-space random number generators or for " "cryptographic purposes." msgstr "" -#: ../../library/os.rst:5354 +#: ../../library/os.rst:5676 msgid "" "``getrandom()`` relies on entropy gathered from device drivers and other " "sources of environmental noise. Unnecessarily reading large quantities of " @@ -6112,36 +6533,36 @@ msgid "" "``/dev/urandom`` devices." msgstr "" -#: ../../library/os.rst:5359 +#: ../../library/os.rst:5681 msgid "" "The flags argument is a bit mask that can contain zero or more of the " "following values ORed together: :py:const:`os.GRND_RANDOM` and :py:data:" "`GRND_NONBLOCK`." msgstr "" -#: ../../library/os.rst:5363 +#: ../../library/os.rst:5685 msgid "" "See also the `Linux getrandom() manual page `_." msgstr "" -#: ../../library/os.rst:5366 +#: ../../library/os.rst:5688 msgid ":ref:`Availability `: Linux >= 3.17." msgstr ":ref:`適用 `:Linux 3.17 以上。" -#: ../../library/os.rst:5372 +#: ../../library/os.rst:5694 msgid "" "Return a bytestring of *size* random bytes suitable for cryptographic use." msgstr "" -#: ../../library/os.rst:5374 +#: ../../library/os.rst:5696 msgid "" "This function returns random bytes from an OS-specific randomness source. " "The returned data should be unpredictable enough for cryptographic " "applications, though its exact quality depends on the OS implementation." msgstr "" -#: ../../library/os.rst:5378 +#: ../../library/os.rst:5700 msgid "" "On Linux, if the ``getrandom()`` syscall is available, it is used in " "blocking mode: block until the system urandom entropy pool is initialized " @@ -6151,63 +6572,63 @@ msgid "" "to poll until the system urandom entropy pool is initialized." msgstr "" -#: ../../library/os.rst:5385 +#: ../../library/os.rst:5707 msgid "" "On a Unix-like system, random bytes are read from the ``/dev/urandom`` " "device. If the ``/dev/urandom`` device is not available or not readable, " "the :exc:`NotImplementedError` exception is raised." msgstr "" -#: ../../library/os.rst:5389 +#: ../../library/os.rst:5711 msgid "On Windows, it will use ``BCryptGenRandom()``." msgstr "" -#: ../../library/os.rst:5392 +#: ../../library/os.rst:5714 msgid "" "The :mod:`secrets` module provides higher level functions. For an easy-to-" "use interface to the random number generator provided by your platform, " "please see :class:`random.SystemRandom`." msgstr "" -#: ../../library/os.rst:5396 +#: ../../library/os.rst:5718 msgid "" "On Linux 3.17 and newer, the ``getrandom()`` syscall is now used when " "available. On OpenBSD 5.6 and newer, the C ``getentropy()`` function is now " "used. These functions avoid the usage of an internal file descriptor." msgstr "" -#: ../../library/os.rst:5402 +#: ../../library/os.rst:5724 msgid "" "On Linux, if the ``getrandom()`` syscall blocks (the urandom entropy pool is " "not initialized yet), fall back on reading ``/dev/urandom``." msgstr "" -#: ../../library/os.rst:5406 +#: ../../library/os.rst:5728 msgid "" "On Linux, ``getrandom()`` is now used in blocking mode to increase the " "security." msgstr "" -#: ../../library/os.rst:5410 +#: ../../library/os.rst:5732 msgid "" "On Windows, ``BCryptGenRandom()`` is used instead of ``CryptGenRandom()`` " "which is deprecated." msgstr "" -#: ../../library/os.rst:5416 +#: ../../library/os.rst:5738 msgid "" "By default, when reading from ``/dev/random``, :func:`getrandom` blocks if " "no random bytes are available, and when reading from ``/dev/urandom``, it " "blocks if the entropy pool has not yet been initialized." msgstr "" -#: ../../library/os.rst:5420 +#: ../../library/os.rst:5742 msgid "" "If the :py:data:`GRND_NONBLOCK` flag is set, then :func:`getrandom` does not " "block in these cases, but instead immediately raises :exc:`BlockingIOError`." msgstr "" -#: ../../library/os.rst:5427 +#: ../../library/os.rst:5749 msgid "" "If this bit is set, then random bytes are drawn from the ``/dev/" "random`` pool instead of the ``/dev/urandom`` pool." @@ -6223,7 +6644,7 @@ msgstr "" #: ../../library/os.rst:372 ../../library/os.rst:438 ../../library/os.rst:447 #: ../../library/os.rst:456 ../../library/os.rst:470 ../../library/os.rst:666 -#: ../../library/os.rst:4235 ../../library/os.rst:4262 +#: ../../library/os.rst:4522 ../../library/os.rst:4549 msgid "process" msgstr "process" @@ -6243,7 +6664,7 @@ msgstr "" msgid "scheduling priority" msgstr "scheduling priority(排程優先權)" -#: ../../library/os.rst:552 ../../library/os.rst:796 +#: ../../library/os.rst:552 ../../library/os.rst:801 msgid "environment variables" msgstr "environment variables(環境變數)" @@ -6263,94 +6684,109 @@ msgstr "gethostname()(於 socket 模組)" msgid "gethostbyaddr() (in module socket)" msgstr "gethostbyaddr()(於 socket 模組)" -#: ../../library/os.rst:796 ../../library/os.rst:2584 +#: ../../library/os.rst:801 ../../library/os.rst:2658 msgid "deleting" msgstr "deleting(刪除)" -#: ../../library/os.rst:1338 ../../library/os.rst:2954 +#: ../../library/os.rst:1360 ../../library/os.rst:3028 msgid "module" msgstr "module(模組)" -#: ../../library/os.rst:1338 +#: ../../library/os.rst:1360 msgid "pty" msgstr "pty" -#: ../../library/os.rst:1979 ../../library/os.rst:2383 -#: ../../library/os.rst:2584 ../../library/os.rst:3488 -#: ../../library/os.rst:3587 +#: ../../library/os.rst:2045 ../../library/os.rst:2457 +#: ../../library/os.rst:2658 ../../library/os.rst:3562 +#: ../../library/os.rst:3661 msgid "directory" msgstr "directory(目錄)" -#: ../../library/os.rst:1979 +#: ../../library/os.rst:2045 msgid "changing" msgstr "changing(改變)" -#: ../../library/os.rst:2383 +#: ../../library/os.rst:2457 msgid "creating" msgstr "creating(建立)" -#: ../../library/os.rst:2383 +#: ../../library/os.rst:2457 msgid "UNC paths" msgstr "UNC paths(UNC 路徑)" -#: ../../library/os.rst:2383 +#: ../../library/os.rst:2457 msgid "and os.makedirs()" msgstr "以及 os.makedirs()" -#: ../../library/os.rst:2954 +#: ../../library/os.rst:3028 msgid "stat" msgstr "stat" -#: ../../library/os.rst:3488 ../../library/os.rst:3587 +#: ../../library/os.rst:3562 ../../library/os.rst:3661 msgid "walking" msgstr "" -#: ../../library/os.rst:3488 ../../library/os.rst:3587 +#: ../../library/os.rst:3562 ../../library/os.rst:3661 msgid "traversal" msgstr "traversal(遍歷)" -#: ../../library/os.rst:4235 ../../library/os.rst:4262 +#: ../../library/os.rst:4522 ../../library/os.rst:4549 msgid "killing" msgstr "" -#: ../../library/os.rst:4235 ../../library/os.rst:4262 +#: ../../library/os.rst:4522 ../../library/os.rst:4549 msgid "signalling" msgstr "signalling(信號)" -#: ../../library/os.rst:5254 ../../library/os.rst:5290 +#: ../../library/os.rst:5576 ../../library/os.rst:5612 msgid ". (dot)" msgstr ". (點)" -#: ../../library/os.rst:5254 ../../library/os.rst:5262 -#: ../../library/os.rst:5270 ../../library/os.rst:5281 -#: ../../library/os.rst:5290 +#: ../../library/os.rst:5576 ../../library/os.rst:5584 +#: ../../library/os.rst:5592 ../../library/os.rst:5603 +#: ../../library/os.rst:5612 msgid "in pathnames" msgstr "於 pathnames(路徑名稱)中" -#: ../../library/os.rst:5262 +#: ../../library/os.rst:5584 msgid ".." msgstr ".." -#: ../../library/os.rst:5270 ../../library/os.rst:5281 +#: ../../library/os.rst:5592 ../../library/os.rst:5603 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../library/os.rst:5271 +#: ../../library/os.rst:5593 msgid "\\ (backslash)" msgstr "\\ (反斜線)" -#: ../../library/os.rst:5271 +#: ../../library/os.rst:5593 msgid "in pathnames (Windows)" msgstr "in pathnames (Windows)(在路徑名稱中 (Windows))" -#: ../../library/os.rst:5297 +#: ../../library/os.rst:5619 msgid ": (colon)" msgstr ": (冒號)" -#: ../../library/os.rst:5297 +#: ../../library/os.rst:5619 msgid "path separator (POSIX)" msgstr "path separator (POSIX)(路徑分隔器 (POSIX))" -#: ../../library/os.rst:5297 +#: ../../library/os.rst:5619 msgid "; (semicolon)" msgstr "; (分號)" + +#~ msgid ":ref:`Availability `: Linux >= 5.3" +#~ msgstr ":ref:`適用 `:Linux 5.3 以上" + +#~ msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#~ msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" + +#~ msgid ":ref:`Availability `: Unix, not Emscripten." +#~ msgstr ":ref:`適用 `:Unix、非 Emscripten。" + +#~ msgid ":ref:`Availability `: Unix, Windows, not Emscripten." +#~ msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten。" + +#~ msgid ":ref:`Availability `: not Emscripten, not WASI." +#~ msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" diff --git a/library/ossaudiodev.po b/library/ossaudiodev.po deleted file mode 100644 index 7caa453007..0000000000 --- a/library/ossaudiodev.po +++ /dev/null @@ -1,603 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-05-22 02:10+0800\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/ossaudiodev.rst:2 -msgid ":mod:`ossaudiodev` --- Access to OSS-compatible audio devices" -msgstr ":mod:`ossaudiodev` --- 對 OSS 相容聲音裝置的存取" - -#: ../../library/ossaudiodev.rst:9 -msgid "" -"The :mod:`ossaudiodev` module is deprecated (see :pep:`PEP 594 " -"<594#ossaudiodev>` for details)." -msgstr "" -":mod:`ossaudiodev` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 " -"<594#ossaudiodev>`\\ )。" - -#: ../../library/ossaudiodev.rst:15 -msgid "" -"This module allows you to access the OSS (Open Sound System) audio " -"interface. OSS is available for a wide range of open-source and commercial " -"Unices, and is the standard audio interface for Linux and recent versions of " -"FreeBSD." -msgstr "" - -#: ../../library/ossaudiodev.rst:47 -msgid "" -"Operations in this module now raise :exc:`OSError` where :exc:`IOError` was " -"raised." -msgstr "" - -#: ../../library/ossaudiodev.rst:54 -msgid "" -"`Open Sound System Programmer's Guide `_" -msgstr "" - -#: ../../library/ossaudiodev.rst:55 -msgid "the official documentation for the OSS C API" -msgstr "" - -#: ../../library/ossaudiodev.rst:57 -msgid "" -"The module defines a large number of constants supplied by the OSS device " -"driver; see ```` on either Linux or FreeBSD for a listing." -msgstr "" - -#: ../../library/ossaudiodev.rst:60 -msgid ":mod:`ossaudiodev` defines the following variables and functions:" -msgstr "" - -#: ../../library/ossaudiodev.rst:65 -msgid "" -"This exception is raised on certain errors. The argument is a string " -"describing what went wrong." -msgstr "" - -#: ../../library/ossaudiodev.rst:68 -msgid "" -"(If :mod:`ossaudiodev` receives an error from a system call such as :c:func:" -"`open`, :c:func:`write`, or :c:func:`ioctl`, it raises :exc:`OSError`. " -"Errors detected directly by :mod:`ossaudiodev` result in :exc:" -"`OSSAudioError`.)" -msgstr "" - -#: ../../library/ossaudiodev.rst:72 -msgid "" -"(For backwards compatibility, the exception class is also available as " -"``ossaudiodev.error``.)" -msgstr "" - -#: ../../library/ossaudiodev.rst:79 -msgid "" -"Open an audio device and return an OSS audio device object. This object " -"supports many file-like methods, such as :meth:`read`, :meth:`write`, and :" -"meth:`fileno` (although there are subtle differences between conventional " -"Unix read/write semantics and those of OSS audio devices). It also supports " -"a number of audio-specific methods; see below for the complete list of " -"methods." -msgstr "" - -#: ../../library/ossaudiodev.rst:85 -msgid "" -"*device* is the audio device filename to use. If it is not specified, this " -"module first looks in the environment variable :envvar:`AUDIODEV` for a " -"device to use. If not found, it falls back to :file:`/dev/dsp`." -msgstr "" - -#: ../../library/ossaudiodev.rst:89 -msgid "" -"*mode* is one of ``'r'`` for read-only (record) access, ``'w'`` for write-" -"only (playback) access and ``'rw'`` for both. Since many sound cards only " -"allow one process to have the recorder or player open at a time, it is a " -"good idea to open the device only for the activity needed. Further, some " -"sound cards are half-duplex: they can be opened for reading or writing, but " -"not both at once." -msgstr "" - -#: ../../library/ossaudiodev.rst:96 -msgid "" -"Note the unusual calling syntax: the *first* argument is optional, and the " -"second is required. This is a historical artifact for compatibility with " -"the older :mod:`linuxaudiodev` module which :mod:`ossaudiodev` supersedes." -msgstr "" - -#: ../../library/ossaudiodev.rst:107 -msgid "" -"Open a mixer device and return an OSS mixer device object. *device* is the " -"mixer device filename to use. If it is not specified, this module first " -"looks in the environment variable :envvar:`MIXERDEV` for a device to use. " -"If not found, it falls back to :file:`/dev/mixer`." -msgstr "" - -#: ../../library/ossaudiodev.rst:116 -msgid "Audio Device Objects" -msgstr "" - -#: ../../library/ossaudiodev.rst:118 -msgid "" -"Before you can write to or read from an audio device, you must call three " -"methods in the correct order:" -msgstr "" - -#: ../../library/ossaudiodev.rst:121 -msgid ":meth:`setfmt` to set the output format" -msgstr "" - -#: ../../library/ossaudiodev.rst:123 -msgid ":meth:`channels` to set the number of channels" -msgstr "" - -#: ../../library/ossaudiodev.rst:125 -msgid ":meth:`speed` to set the sample rate" -msgstr "" - -#: ../../library/ossaudiodev.rst:127 -msgid "" -"Alternately, you can use the :meth:`setparameters` method to set all three " -"audio parameters at once. This is more convenient, but may not be as " -"flexible in all cases." -msgstr "" - -#: ../../library/ossaudiodev.rst:131 -msgid "" -"The audio device objects returned by :func:`.open` define the following " -"methods and (read-only) attributes:" -msgstr "" - -#: ../../library/ossaudiodev.rst:137 -msgid "" -"Explicitly close the audio device. When you are done writing to or reading " -"from an audio device, you should explicitly close it. A closed device " -"cannot be used again." -msgstr "" - -#: ../../library/ossaudiodev.rst:144 -msgid "Return the file descriptor associated with the device." -msgstr "" - -#: ../../library/ossaudiodev.rst:149 -msgid "" -"Read *size* bytes from the audio input and return them as a Python string. " -"Unlike most Unix device drivers, OSS audio devices in blocking mode (the " -"default) will block :func:`read` until the entire requested amount of data " -"is available." -msgstr "" - -#: ../../library/ossaudiodev.rst:157 -msgid "" -"Write a :term:`bytes-like object` *data* to the audio device and return the " -"number of bytes written. If the audio device is in blocking mode (the " -"default), the entire data is always written (again, this is different from " -"usual Unix device semantics). If the device is in non-blocking mode, some " -"data may not be written---see :meth:`writeall`." -msgstr "" - -#: ../../library/ossaudiodev.rst:163 ../../library/ossaudiodev.rst:177 -msgid "Writable :term:`bytes-like object` is now accepted." -msgstr "" - -#: ../../library/ossaudiodev.rst:169 -msgid "" -"Write a :term:`bytes-like object` *data* to the audio device: waits until " -"the audio device is able to accept data, writes as much data as it will " -"accept, and repeats until *data* has been completely written. If the device " -"is in blocking mode (the default), this has the same effect as :meth:" -"`write`; :meth:`writeall` is only useful in non-blocking mode. Has no " -"return value, since the amount of data written is always equal to the amount " -"of data supplied." -msgstr "" - -#: ../../library/ossaudiodev.rst:181 -msgid "" -"Audio device objects also support the context management protocol, i.e. they " -"can be used in a :keyword:`with` statement." -msgstr "" - -#: ../../library/ossaudiodev.rst:186 -msgid "" -"The following methods each map to exactly one :c:func:`ioctl` system call. " -"The correspondence is obvious: for example, :meth:`setfmt` corresponds to " -"the ``SNDCTL_DSP_SETFMT`` ioctl, and :meth:`sync` to ``SNDCTL_DSP_SYNC`` " -"(this can be useful when consulting the OSS documentation). If the " -"underlying :c:func:`ioctl` fails, they all raise :exc:`OSError`." -msgstr "" - -#: ../../library/ossaudiodev.rst:195 -msgid "" -"Put the device into non-blocking mode. Once in non-blocking mode, there is " -"no way to return it to blocking mode." -msgstr "" - -#: ../../library/ossaudiodev.rst:201 -msgid "" -"Return a bitmask of the audio output formats supported by the soundcard. " -"Some of the formats supported by OSS are:" -msgstr "" - -#: ../../library/ossaudiodev.rst:205 -msgid "Format" -msgstr "格式" - -#: ../../library/ossaudiodev.rst:205 ../../library/ossaudiodev.rst:259 -msgid "Description" -msgstr "描述" - -#: ../../library/ossaudiodev.rst:207 -msgid ":const:`AFMT_MU_LAW`" -msgstr ":const:`AFMT_MU_LAW`" - -#: ../../library/ossaudiodev.rst:207 -msgid "" -"a logarithmic encoding (used by Sun ``.au`` files and :file:`/dev/audio`)" -msgstr "" - -#: ../../library/ossaudiodev.rst:210 -msgid ":const:`AFMT_A_LAW`" -msgstr ":const:`AFMT_A_LAW`" - -#: ../../library/ossaudiodev.rst:210 -msgid "a logarithmic encoding" -msgstr "" - -#: ../../library/ossaudiodev.rst:212 -msgid ":const:`AFMT_IMA_ADPCM`" -msgstr ":const:`AFMT_IMA_ADPCM`" - -#: ../../library/ossaudiodev.rst:212 -msgid "" -"a 4:1 compressed format defined by the Interactive Multimedia Association" -msgstr "" - -#: ../../library/ossaudiodev.rst:215 -msgid ":const:`AFMT_U8`" -msgstr ":const:`AFMT_U8`" - -#: ../../library/ossaudiodev.rst:215 -msgid "Unsigned, 8-bit audio" -msgstr "" - -#: ../../library/ossaudiodev.rst:217 -msgid ":const:`AFMT_S16_LE`" -msgstr ":const:`AFMT_S16_LE`" - -#: ../../library/ossaudiodev.rst:217 -msgid "" -"Signed, 16-bit audio, little-endian byte order (as used by Intel processors)" -msgstr "" - -#: ../../library/ossaudiodev.rst:220 -msgid ":const:`AFMT_S16_BE`" -msgstr ":const:`AFMT_S16_BE`" - -#: ../../library/ossaudiodev.rst:220 -msgid "" -"Signed, 16-bit audio, big-endian byte order (as used by 68k, PowerPC, Sparc)" -msgstr "" - -#: ../../library/ossaudiodev.rst:223 -msgid ":const:`AFMT_S8`" -msgstr ":const:`AFMT_S8`" - -#: ../../library/ossaudiodev.rst:223 -msgid "Signed, 8 bit audio" -msgstr "" - -#: ../../library/ossaudiodev.rst:225 -msgid ":const:`AFMT_U16_LE`" -msgstr ":const:`AFMT_U16_LE`" - -#: ../../library/ossaudiodev.rst:225 -msgid "Unsigned, 16-bit little-endian audio" -msgstr "" - -#: ../../library/ossaudiodev.rst:227 -msgid ":const:`AFMT_U16_BE`" -msgstr ":const:`AFMT_U16_BE`" - -#: ../../library/ossaudiodev.rst:227 -msgid "Unsigned, 16-bit big-endian audio" -msgstr "" - -#: ../../library/ossaudiodev.rst:230 -msgid "" -"Consult the OSS documentation for a full list of audio formats, and note " -"that most devices support only a subset of these formats. Some older " -"devices only support :const:`AFMT_U8`; the most common format used today is :" -"const:`AFMT_S16_LE`." -msgstr "" - -#: ../../library/ossaudiodev.rst:238 -msgid "" -"Try to set the current audio format to *format*---see :meth:`getfmts` for a " -"list. Returns the audio format that the device was set to, which may not be " -"the requested format. May also be used to return the current audio format---" -"do this by passing an \"audio format\" of :const:`AFMT_QUERY`." -msgstr "" - -#: ../../library/ossaudiodev.rst:246 -msgid "" -"Set the number of output channels to *nchannels*. A value of 1 indicates " -"monophonic sound, 2 stereophonic. Some devices may have more than 2 " -"channels, and some high-end devices may not support mono. Returns the number " -"of channels the device was set to." -msgstr "" - -#: ../../library/ossaudiodev.rst:254 -msgid "" -"Try to set the audio sampling rate to *samplerate* samples per second. " -"Returns the rate actually set. Most sound devices don't support arbitrary " -"sampling rates. Common rates are:" -msgstr "" - -#: ../../library/ossaudiodev.rst:259 -msgid "Rate" -msgstr "" - -#: ../../library/ossaudiodev.rst:261 -msgid "8000" -msgstr "8000" - -#: ../../library/ossaudiodev.rst:261 -msgid "default rate for :file:`/dev/audio`" -msgstr "" - -#: ../../library/ossaudiodev.rst:263 -msgid "11025" -msgstr "11025" - -#: ../../library/ossaudiodev.rst:263 -msgid "speech recording" -msgstr "" - -#: ../../library/ossaudiodev.rst:265 -msgid "22050" -msgstr "22050" - -#: ../../library/ossaudiodev.rst:267 -msgid "44100" -msgstr "44100" - -#: ../../library/ossaudiodev.rst:267 -msgid "CD quality audio (at 16 bits/sample and 2 channels)" -msgstr "" - -#: ../../library/ossaudiodev.rst:270 -msgid "96000" -msgstr "96000" - -#: ../../library/ossaudiodev.rst:270 -msgid "DVD quality audio (at 24 bits/sample)" -msgstr "" - -#: ../../library/ossaudiodev.rst:276 -msgid "" -"Wait until the sound device has played every byte in its buffer. (This " -"happens implicitly when the device is closed.) The OSS documentation " -"recommends closing and re-opening the device rather than using :meth:`sync`." -msgstr "" - -#: ../../library/ossaudiodev.rst:283 -msgid "" -"Immediately stop playing or recording and return the device to a state where " -"it can accept commands. The OSS documentation recommends closing and re-" -"opening the device after calling :meth:`reset`." -msgstr "" - -#: ../../library/ossaudiodev.rst:290 -msgid "" -"Tell the driver that there is likely to be a pause in the output, making it " -"possible for the device to handle the pause more intelligently. You might " -"use this after playing a spot sound effect, before waiting for user input, " -"or before doing disk I/O." -msgstr "" - -#: ../../library/ossaudiodev.rst:295 -msgid "" -"The following convenience methods combine several ioctls, or one ioctl and " -"some simple calculations." -msgstr "" - -#: ../../library/ossaudiodev.rst:301 -msgid "" -"Set the key audio sampling parameters---sample format, number of channels, " -"and sampling rate---in one method call. *format*, *nchannels*, and " -"*samplerate* should be as specified in the :meth:`setfmt`, :meth:`channels`, " -"and :meth:`speed` methods. If *strict* is true, :meth:`setparameters` " -"checks to see if each parameter was actually set to the requested value, and " -"raises :exc:`OSSAudioError` if not. Returns a tuple (*format*, *nchannels*, " -"*samplerate*) indicating the parameter values that were actually set by the " -"device driver (i.e., the same as the return values of :meth:`setfmt`, :meth:" -"`channels`, and :meth:`speed`)." -msgstr "" - -#: ../../library/ossaudiodev.rst:311 -msgid "For example, ::" -msgstr "舉例來說: ::" - -#: ../../library/ossaudiodev.rst:313 -msgid "(fmt, channels, rate) = dsp.setparameters(fmt, channels, rate)" -msgstr "(fmt, channels, rate) = dsp.setparameters(fmt, channels, rate)" - -#: ../../library/ossaudiodev.rst:315 -msgid "is equivalent to ::" -msgstr "等價於: ::" - -#: ../../library/ossaudiodev.rst:317 -msgid "" -"fmt = dsp.setfmt(fmt)\n" -"channels = dsp.channels(channels)\n" -"rate = dsp.rate(rate)" -msgstr "" -"fmt = dsp.setfmt(fmt)\n" -"channels = dsp.channels(channels)\n" -"rate = dsp.rate(rate)" - -#: ../../library/ossaudiodev.rst:324 -msgid "Returns the size of the hardware buffer, in samples." -msgstr "" - -#: ../../library/ossaudiodev.rst:329 -msgid "" -"Returns the number of samples that are in the hardware buffer yet to be " -"played." -msgstr "" - -#: ../../library/ossaudiodev.rst:334 -msgid "" -"Returns the number of samples that could be queued into the hardware buffer " -"to be played without blocking." -msgstr "" - -#: ../../library/ossaudiodev.rst:337 -msgid "Audio device objects also support several read-only attributes:" -msgstr "" - -#: ../../library/ossaudiodev.rst:342 -msgid "Boolean indicating whether the device has been closed." -msgstr "" - -#: ../../library/ossaudiodev.rst:347 -msgid "String containing the name of the device file." -msgstr "" - -#: ../../library/ossaudiodev.rst:352 -msgid "The I/O mode for the file, either ``\"r\"``, ``\"rw\"``, or ``\"w\"``." -msgstr "" - -#: ../../library/ossaudiodev.rst:358 -msgid "Mixer Device Objects" -msgstr "" - -#: ../../library/ossaudiodev.rst:360 -msgid "The mixer object provides two file-like methods:" -msgstr "" - -#: ../../library/ossaudiodev.rst:365 -msgid "" -"This method closes the open mixer device file. Any further attempts to use " -"the mixer after this file is closed will raise an :exc:`OSError`." -msgstr "" - -#: ../../library/ossaudiodev.rst:371 -msgid "Returns the file handle number of the open mixer device file." -msgstr "" - -#: ../../library/ossaudiodev.rst:373 -msgid "Mixer objects also support the context management protocol." -msgstr "" - -#: ../../library/ossaudiodev.rst:377 -msgid "The remaining methods are specific to audio mixing:" -msgstr "" - -#: ../../library/ossaudiodev.rst:382 -msgid "" -"This method returns a bitmask specifying the available mixer controls " -"(\"Control\" being a specific mixable \"channel\", such as :const:" -"`SOUND_MIXER_PCM` or :const:`SOUND_MIXER_SYNTH`). This bitmask indicates a " -"subset of all available mixer controls---the :const:`SOUND_MIXER_\\*` " -"constants defined at module level. To determine if, for example, the current " -"mixer object supports a PCM mixer, use the following Python code::" -msgstr "" - -#: ../../library/ossaudiodev.rst:389 -msgid "" -"mixer=ossaudiodev.openmixer()\n" -"if mixer.controls() & (1 << ossaudiodev.SOUND_MIXER_PCM):\n" -" # PCM is supported\n" -" ... code ..." -msgstr "" - -#: ../../library/ossaudiodev.rst:394 -msgid "" -"For most purposes, the :const:`SOUND_MIXER_VOLUME` (master volume) and :" -"const:`SOUND_MIXER_PCM` controls should suffice---but code that uses the " -"mixer should be flexible when it comes to choosing mixer controls. On the " -"Gravis Ultrasound, for example, :const:`SOUND_MIXER_VOLUME` does not exist." -msgstr "" - -#: ../../library/ossaudiodev.rst:402 -msgid "" -"Returns a bitmask indicating stereo mixer controls. If a bit is set, the " -"corresponding control is stereo; if it is unset, the control is either " -"monophonic or not supported by the mixer (use in combination with :meth:" -"`controls` to determine which)." -msgstr "" - -#: ../../library/ossaudiodev.rst:407 -msgid "" -"See the code example for the :meth:`controls` function for an example of " -"getting data from a bitmask." -msgstr "" - -#: ../../library/ossaudiodev.rst:413 -msgid "" -"Returns a bitmask specifying the mixer controls that may be used to record. " -"See the code example for :meth:`controls` for an example of reading from a " -"bitmask." -msgstr "" - -#: ../../library/ossaudiodev.rst:419 -msgid "" -"Returns the volume of a given mixer control. The returned volume is a 2-" -"tuple ``(left_volume,right_volume)``. Volumes are specified as numbers from " -"0 (silent) to 100 (full volume). If the control is monophonic, a 2-tuple is " -"still returned, but both volumes are the same." -msgstr "" - -#: ../../library/ossaudiodev.rst:424 -msgid "" -"Raises :exc:`OSSAudioError` if an invalid control is specified, or :exc:" -"`OSError` if an unsupported control is specified." -msgstr "" - -#: ../../library/ossaudiodev.rst:430 -msgid "" -"Sets the volume for a given mixer control to ``(left,right)``. ``left`` and " -"``right`` must be ints and between 0 (silent) and 100 (full volume). On " -"success, the new volume is returned as a 2-tuple. Note that this may not be " -"exactly the same as the volume specified, because of the limited resolution " -"of some soundcard's mixers." -msgstr "" - -#: ../../library/ossaudiodev.rst:436 -msgid "" -"Raises :exc:`OSSAudioError` if an invalid mixer control was specified, or if " -"the specified volumes were out-of-range." -msgstr "" - -#: ../../library/ossaudiodev.rst:442 -msgid "" -"This method returns a bitmask indicating which control(s) are currently " -"being used as a recording source." -msgstr "" - -#: ../../library/ossaudiodev.rst:448 -msgid "" -"Call this function to specify a recording source. Returns a bitmask " -"indicating the new recording source (or sources) if successful; raises :exc:" -"`OSError` if an invalid source was specified. To set the current recording " -"source to the microphone input::" -msgstr "" - -#: ../../library/ossaudiodev.rst:453 -msgid "mixer.setrecsrc (1 << ossaudiodev.SOUND_MIXER_MIC)" -msgstr "mixer.setrecsrc (1 << ossaudiodev.SOUND_MIXER_MIC)" diff --git a/library/pathlib.po b/library/pathlib.po index 88307bb77b..ffd0c4ac4f 100644 --- a/library/pathlib.po +++ b/library/pathlib.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-02-29 20:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,7 +23,8 @@ msgid ":mod:`!pathlib` --- Object-oriented filesystem paths" msgstr ":mod:`!pathlib` --- 物件導向檔案系統路徑" #: ../../library/pathlib.rst:9 -msgid "**Source code:** :source:`Lib/pathlib.py`" +#, fuzzy +msgid "**Source code:** :source:`Lib/pathlib/`" msgstr "**原始碼:**\\ :source:`Lib/pathlib.py`" #: ../../library/pathlib.rst:15 @@ -186,11 +187,22 @@ msgstr "" "...\n" "'#!/bin/bash\\n'" -#: ../../library/pathlib.rst:99 +#: ../../library/pathlib.rst:97 +#, fuzzy +msgid "Exceptions" +msgstr "operations(操作)" + +#: ../../library/pathlib.rst:101 +msgid "" +"An exception inheriting :exc:`NotImplementedError` that is raised when an " +"unsupported operation is called on a path object." +msgstr "" + +#: ../../library/pathlib.rst:110 msgid "Pure paths" msgstr "純路徑" -#: ../../library/pathlib.rst:101 +#: ../../library/pathlib.rst:112 msgid "" "Pure path objects provide path-handling operations which don't actually " "access a filesystem. There are three ways to access these classes, which we " @@ -199,7 +211,7 @@ msgstr "" "純路徑物件提供處理路徑的操作,實際上不會存取檔案系統。有三種方式可以存取這些" "類別,我們也稱之為\\ *類型 (flavours)*:" -#: ../../library/pathlib.rst:107 +#: ../../library/pathlib.rst:118 msgid "" "A generic class that represents the system's path flavour (instantiating it " "creates either a :class:`PurePosixPath` or a :class:`PureWindowsPath`)::" @@ -207,13 +219,13 @@ msgstr "" "一個通用的類別,表示系統的路徑類型(實例化時會建立一個 :class:" "`PurePosixPath` 或 :class:`PureWindowsPath`): ::" -#: ../../library/pathlib.rst:110 +#: ../../library/pathlib.rst:121 msgid "" ">>> PurePath('setup.py') # Running on a Unix machine\n" "PurePosixPath('setup.py')" msgstr "" -#: ../../library/pathlib.rst:113 +#: ../../library/pathlib.rst:124 msgid "" "Each element of *pathsegments* can be either a string representing a path " "segment, or an object implementing the :class:`os.PathLike` interface where " @@ -224,7 +236,7 @@ msgstr "" "個物件,它實作了 :class:`os.PathLike` 介面且其中的 :meth:`~os.PathLike." "__fspath__` 方法會回傳字串,就像是另一個路徑物件: ::" -#: ../../library/pathlib.rst:118 +#: ../../library/pathlib.rst:129 msgid "" ">>> PurePath('foo', 'some/path', 'bar')\n" "PurePosixPath('foo/some/path/bar')\n" @@ -236,11 +248,11 @@ msgstr "" ">>> PurePath(Path('foo'), Path('bar'))\n" "PurePosixPath('foo/bar')" -#: ../../library/pathlib.rst:123 +#: ../../library/pathlib.rst:134 msgid "When *pathsegments* is empty, the current directory is assumed::" msgstr "當沒有給 *pathsegments* 的時候,會假設是目前的目錄: ::" -#: ../../library/pathlib.rst:125 +#: ../../library/pathlib.rst:136 msgid "" ">>> PurePath()\n" "PurePosixPath('.')" @@ -248,7 +260,7 @@ msgstr "" ">>> PurePath()\n" "PurePosixPath('.')" -#: ../../library/pathlib.rst:128 +#: ../../library/pathlib.rst:139 msgid "" "If a segment is an absolute path, all previous segments are ignored (like :" "func:`os.path.join`)::" @@ -256,7 +268,7 @@ msgstr "" "如果一個片段是絕對路徑,則所有之前的片段會被忽略(類似 :func:`os.path." "join`): ::" -#: ../../library/pathlib.rst:131 +#: ../../library/pathlib.rst:142 msgid "" ">>> PurePath('/etc', '/usr', 'lib64')\n" "PurePosixPath('/usr/lib64')\n" @@ -268,7 +280,7 @@ msgstr "" ">>> PureWindowsPath('c:/Windows', 'd:bar')\n" "PureWindowsPath('d:bar')" -#: ../../library/pathlib.rst:136 +#: ../../library/pathlib.rst:147 msgid "" "On Windows, the drive is not reset when a rooted relative path segment (e." "g., ``r'\\foo'``) is encountered::" @@ -276,7 +288,7 @@ msgstr "" "在 Windows 系統上,當遇到具有根目錄的相對路徑片段(例如 ``r'\\foo'``)時,磁" "碟機 (drive) 部分不會被重置: ::" -#: ../../library/pathlib.rst:139 +#: ../../library/pathlib.rst:150 msgid "" ">>> PureWindowsPath('c:/Windows', '/Program Files')\n" "PureWindowsPath('c:/Program Files')" @@ -284,7 +296,7 @@ msgstr "" ">>> PureWindowsPath('c:/Windows', '/Program Files')\n" "PureWindowsPath('c:/Program Files')" -#: ../../library/pathlib.rst:142 +#: ../../library/pathlib.rst:153 msgid "" "Spurious slashes and single dots are collapsed, but double dots (``'..'``) " "and leading double slashes (``'//'``) are not, since this would change the " @@ -294,7 +306,7 @@ msgstr "" "被合併,因為這樣會因為各種原因改變路徑的意義(例如符號連結 (symbolic links)、" "UNC 路徑): ::" -#: ../../library/pathlib.rst:146 +#: ../../library/pathlib.rst:157 msgid "" ">>> PurePath('foo//bar')\n" "PurePosixPath('foo/bar')\n" @@ -314,7 +326,7 @@ msgstr "" ">>> PurePath('foo/../bar')\n" "PurePosixPath('foo/../bar')" -#: ../../library/pathlib.rst:155 +#: ../../library/pathlib.rst:166 msgid "" "(a naïve approach would make ``PurePosixPath('foo/../bar')`` equivalent to " "``PurePosixPath('bar')``, which is wrong if ``foo`` is a symbolic link to " @@ -323,7 +335,7 @@ msgstr "" "(一個使得 ``PurePosixPath('foo/../bar')`` 等同於 ``PurePosixPath('bar')`` 的" "單純方法,但如果 ``foo`` 是指到另一個目錄的符號連結,就會是錯誤的。)" -#: ../../library/pathlib.rst:159 +#: ../../library/pathlib.rst:170 msgid "" "Pure path objects implement the :class:`os.PathLike` interface, allowing " "them to be used anywhere the interface is accepted." @@ -331,18 +343,18 @@ msgstr "" "純路徑物件實作了 :class:`os.PathLike` 介面,使得它們可以在任何接受該介面的地" "方使用。" -#: ../../library/pathlib.rst:162 +#: ../../library/pathlib.rst:173 msgid "Added support for the :class:`os.PathLike` interface." msgstr "新增了對於 :class:`os.PathLike` 介面的支援。" -#: ../../library/pathlib.rst:167 +#: ../../library/pathlib.rst:178 msgid "" "A subclass of :class:`PurePath`, this path flavour represents non-Windows " "filesystem paths::" msgstr "" ":class:`PurePath` 的一個子類別,該路徑類型表示非 Windows 檔案系統的路徑: ::" -#: ../../library/pathlib.rst:170 +#: ../../library/pathlib.rst:181 msgid "" ">>> PurePosixPath('/etc/hosts')\n" "PurePosixPath('/etc/hosts')" @@ -350,13 +362,13 @@ msgstr "" ">>> PurePosixPath('/etc/hosts')\n" "PurePosixPath('/etc/hosts')" -#: ../../library/pathlib.rst:173 ../../library/pathlib.rst:185 -#: ../../library/pathlib.rst:758 ../../library/pathlib.rst:768 -#: ../../library/pathlib.rst:778 +#: ../../library/pathlib.rst:184 ../../library/pathlib.rst:196 +#: ../../library/pathlib.rst:766 ../../library/pathlib.rst:776 +#: ../../library/pathlib.rst:791 msgid "*pathsegments* is specified similarly to :class:`PurePath`." msgstr "*pathsegments* 的指定方式與 :class:`PurePath` 類似。" -#: ../../library/pathlib.rst:177 +#: ../../library/pathlib.rst:188 msgid "" "A subclass of :class:`PurePath`, this path flavour represents Windows " "filesystem paths, including `UNC paths`_::" @@ -364,7 +376,7 @@ msgstr "" ":class:`PurePath` 的一個子類別,該路徑類型表示 Windows 檔案系統的路徑,包括 " "`UNC paths`_: ::" -#: ../../library/pathlib.rst:180 +#: ../../library/pathlib.rst:191 msgid "" ">>> PureWindowsPath('c:/', 'Users', 'Ximénez')\n" "PureWindowsPath('c:/Users/Ximénez')\n" @@ -376,7 +388,7 @@ msgstr "" ">>> PureWindowsPath('//server/share/file')\n" "PureWindowsPath('//server/share/file')" -#: ../../library/pathlib.rst:189 +#: ../../library/pathlib.rst:200 msgid "" "Regardless of the system you're running on, you can instantiate all of these " "classes, since they don't provide any operation that does system calls." @@ -384,11 +396,11 @@ msgstr "" "不論你使用的是什麼系統,你都可以實例化這些類別,因為它們不提供任何涉及系統呼" "叫的操作。" -#: ../../library/pathlib.rst:194 +#: ../../library/pathlib.rst:205 msgid "General properties" msgstr "通用屬性" -#: ../../library/pathlib.rst:196 +#: ../../library/pathlib.rst:207 msgid "" "Paths are immutable and :term:`hashable`. Paths of a same flavour are " "comparable and orderable. These properties respect the flavour's case-" @@ -397,7 +409,7 @@ msgstr "" "路徑物件是不可變 (immutable) 且可雜湊 (:term:`hashable`) 的。相同類型的路徑物" "件可以被比較和排序。這些屬性遵守該類型的大小寫語意規則: ::" -#: ../../library/pathlib.rst:200 +#: ../../library/pathlib.rst:211 msgid "" ">>> PurePosixPath('foo') == PurePosixPath('FOO')\n" "False\n" @@ -417,11 +429,11 @@ msgstr "" ">>> PureWindowsPath('C:') < PureWindowsPath('d:')\n" "True" -#: ../../library/pathlib.rst:209 +#: ../../library/pathlib.rst:220 msgid "Paths of a different flavour compare unequal and cannot be ordered::" msgstr "不同類型的路徑物件在比較時視為不相等且無法被排序: ::" -#: ../../library/pathlib.rst:211 +#: ../../library/pathlib.rst:222 msgid "" ">>> PureWindowsPath('foo') == PurePosixPath('foo')\n" "False\n" @@ -439,11 +451,11 @@ msgstr "" "TypeError: '<' not supported between instances of 'PureWindowsPath' and " "'PurePosixPath'" -#: ../../library/pathlib.rst:220 +#: ../../library/pathlib.rst:231 msgid "Operators" msgstr "運算子" -#: ../../library/pathlib.rst:222 +#: ../../library/pathlib.rst:233 msgid "" "The slash operator helps create child paths, like :func:`os.path.join`. If " "the argument is an absolute path, the previous path is ignored. On Windows, " @@ -454,7 +466,7 @@ msgstr "" "一樣。如果引數是絕對路徑,則忽略前一個路徑。在 Windows 系統上,當引數是具有根" "目錄的相對路徑(例如,``r'\\foo'``),磁碟機部分不會被重置: ::" -#: ../../library/pathlib.rst:227 +#: ../../library/pathlib.rst:238 msgid "" ">>> p = PurePath('/etc')\n" ">>> p\n" @@ -482,14 +494,14 @@ msgstr "" ">>> PureWindowsPath('c:/Windows', '/Program Files')\n" "PureWindowsPath('c:/Program Files')" -#: ../../library/pathlib.rst:240 +#: ../../library/pathlib.rst:251 msgid "" "A path object can be used anywhere an object implementing :class:`os." "PathLike` is accepted::" msgstr "" "路徑物件可以被用在任何可以接受實作 :class:`os.PathLike` 的物件的地方: ::" -#: ../../library/pathlib.rst:243 +#: ../../library/pathlib.rst:254 msgid "" ">>> import os\n" ">>> p = PurePath('/etc')\n" @@ -501,7 +513,7 @@ msgstr "" ">>> os.fspath(p)\n" "'/etc'" -#: ../../library/pathlib.rst:248 +#: ../../library/pathlib.rst:259 msgid "" "The string representation of a path is the raw filesystem path itself (in " "native form, e.g. with backslashes under Windows), which you can pass to any " @@ -510,7 +522,7 @@ msgstr "" "路徑的字串表示是原始的檔案系統路徑本身(以原生的形式,例如在 Windows 下是反斜" "線),你可以將其傳入任何將檔案路徑當作字串傳入的函式: ::" -#: ../../library/pathlib.rst:252 +#: ../../library/pathlib.rst:263 msgid "" ">>> p = PurePath('/etc')\n" ">>> str(p)\n" @@ -526,7 +538,7 @@ msgstr "" ">>> str(p)\n" "'c:\\\\Program Files'" -#: ../../library/pathlib.rst:259 +#: ../../library/pathlib.rst:270 msgid "" "Similarly, calling :class:`bytes` on a path gives the raw filesystem path as " "a bytes object, as encoded by :func:`os.fsencode`::" @@ -534,7 +546,7 @@ msgstr "" "類似地,對路徑呼叫 :class:`bytes` 會得到原始檔案系統路徑的 bytes 物件,就像使" "用 :func:`os.fsencode` 編碼過的一樣: ::" -#: ../../library/pathlib.rst:262 +#: ../../library/pathlib.rst:273 msgid "" ">>> bytes(p)\n" "b'/etc'" @@ -542,7 +554,7 @@ msgstr "" ">>> bytes(p)\n" "b'/etc'" -#: ../../library/pathlib.rst:266 +#: ../../library/pathlib.rst:277 msgid "" "Calling :class:`bytes` is only recommended under Unix. Under Windows, the " "unicode form is the canonical representation of filesystem paths." @@ -550,21 +562,21 @@ msgstr "" "只建議在 Unix 下呼叫 :class:`bytes`。在 Windows 裡,unicode 形式是檔案系統路" "徑的權威表示方式。" -#: ../../library/pathlib.rst:271 +#: ../../library/pathlib.rst:282 msgid "Accessing individual parts" msgstr "對個別組成的存取" -#: ../../library/pathlib.rst:273 +#: ../../library/pathlib.rst:284 msgid "" "To access the individual \"parts\" (components) of a path, use the following " "property:" msgstr "可以使用下列屬性來存取路徑的個別「組成」(parts, components):" -#: ../../library/pathlib.rst:278 +#: ../../library/pathlib.rst:289 msgid "A tuple giving access to the path's various components::" msgstr "一個可存取路徑的各組成的元組: ::" -#: ../../library/pathlib.rst:280 +#: ../../library/pathlib.rst:291 msgid "" ">>> p = PurePath('/usr/bin/python3')\n" ">>> p.parts\n" @@ -582,25 +594,31 @@ msgstr "" ">>> p.parts\n" "('c:\\\\', 'Program Files', 'PSF')" -#: ../../library/pathlib.rst:288 +#: ../../library/pathlib.rst:299 msgid "(note how the drive and local root are regrouped in a single part)" msgstr "(特別注意磁碟機跟本地根目錄是如何被重新組合成一個單一組成)" -#: ../../library/pathlib.rst:292 +#: ../../library/pathlib.rst:303 msgid "Methods and properties" msgstr "方法與屬性" -#: ../../library/pathlib.rst:298 +#: ../../library/pathlib.rst:309 msgid "Pure paths provide the following methods and properties:" msgstr "純路徑提供以下方法與屬性:" -#: ../../library/pathlib.rst:302 +#: ../../library/pathlib.rst:313 +msgid "" +"The implementation of the :mod:`os.path` module used for low-level path " +"parsing and joining: either :mod:`posixpath` or :mod:`ntpath`." +msgstr "" + +#: ../../library/pathlib.rst:320 msgid "A string representing the drive letter or name, if any::" msgstr "" "若存在則為一個表示磁碟機字母 (drive letter) 或磁碟機名稱 (drive name) 的字" "串: ::" -#: ../../library/pathlib.rst:304 +#: ../../library/pathlib.rst:322 msgid "" ">>> PureWindowsPath('c:/Program Files/').drive\n" "'c:'\n" @@ -616,11 +634,11 @@ msgstr "" ">>> PurePosixPath('/etc').drive\n" "''" -#: ../../library/pathlib.rst:311 +#: ../../library/pathlib.rst:329 msgid "UNC shares are also considered drives::" msgstr "UNC shares 也被視為磁碟機: ::" -#: ../../library/pathlib.rst:313 +#: ../../library/pathlib.rst:331 msgid "" ">>> PureWindowsPath('//host/share/foo.txt').drive\n" "'\\\\\\\\host\\\\share'" @@ -628,11 +646,11 @@ msgstr "" ">>> PureWindowsPath('//host/share/foo.txt').drive\n" "'\\\\\\\\host\\\\share'" -#: ../../library/pathlib.rst:318 +#: ../../library/pathlib.rst:336 msgid "A string representing the (local or global) root, if any::" msgstr "若存在則為一個表示(本地或全域)根目錄的字串: ::" -#: ../../library/pathlib.rst:320 +#: ../../library/pathlib.rst:338 msgid "" ">>> PureWindowsPath('c:/Program Files/').root\n" "'\\\\'\n" @@ -648,11 +666,11 @@ msgstr "" ">>> PurePosixPath('/etc').root\n" "'/'" -#: ../../library/pathlib.rst:327 +#: ../../library/pathlib.rst:345 msgid "UNC shares always have a root::" msgstr "UNC shares 都會有一個根目錄: ::" -#: ../../library/pathlib.rst:329 +#: ../../library/pathlib.rst:347 msgid "" ">>> PureWindowsPath('//host/share').root\n" "'\\\\'" @@ -660,7 +678,7 @@ msgstr "" ">>> PureWindowsPath('//host/share').root\n" "'\\\\'" -#: ../../library/pathlib.rst:332 +#: ../../library/pathlib.rst:350 msgid "" "If the path starts with more than two successive slashes, :class:`~pathlib." "PurePosixPath` collapses them::" @@ -668,7 +686,7 @@ msgstr "" "如果路徑以超過兩個連續的斜線開頭,:class:`~pathlib.PurePosixPath` 會合併它" "們: ::" -#: ../../library/pathlib.rst:335 +#: ../../library/pathlib.rst:353 msgid "" ">>> PurePosixPath('//etc').root\n" "'//'\n" @@ -684,7 +702,7 @@ msgstr "" ">>> PurePosixPath('////etc').root\n" "'/'" -#: ../../library/pathlib.rst:344 +#: ../../library/pathlib.rst:362 msgid "" "This behavior conforms to *The Open Group Base Specifications Issue 6*, " "paragraph `4.11 Pathname Resolution `_:" -#: ../../library/pathlib.rst:348 +#: ../../library/pathlib.rst:366 msgid "" "*\"A pathname that begins with two successive slashes may be interpreted in " "an implementation-defined manner, although more than two leading slashes " @@ -703,11 +721,11 @@ msgstr "" "*「以兩個連續斜線開頭的路徑名稱可以根據實作定義的方式來解讀,儘管如此,開頭超" "過兩個斜線應該視為單一斜線。」*" -#: ../../library/pathlib.rst:354 +#: ../../library/pathlib.rst:372 msgid "The concatenation of the drive and root::" msgstr "磁碟機與根目錄的結合: ::" -#: ../../library/pathlib.rst:356 +#: ../../library/pathlib.rst:374 msgid "" ">>> PureWindowsPath('c:/Program Files/').anchor\n" "'c:\\\\'\n" @@ -727,12 +745,12 @@ msgstr "" ">>> PureWindowsPath('//host/share').anchor\n" "'\\\\\\\\host\\\\share\\\\'" -#: ../../library/pathlib.rst:368 +#: ../../library/pathlib.rst:386 msgid "" "An immutable sequence providing access to the logical ancestors of the path::" msgstr "一個不可變的序列,為路徑邏輯上的祖先 (logical ancestors) 提供存取: ::" -#: ../../library/pathlib.rst:371 +#: ../../library/pathlib.rst:389 msgid "" ">>> p = PureWindowsPath('c:/foo/bar/setup.py')\n" ">>> p.parents[0]\n" @@ -750,17 +768,17 @@ msgstr "" ">>> p.parents[2]\n" "PureWindowsPath('c:/')" -#: ../../library/pathlib.rst:379 +#: ../../library/pathlib.rst:397 msgid "" "The parents sequence now supports :term:`slices ` and negative index " "values." msgstr "父序列現在支援 :term:`slices ` 及負的索引值。" -#: ../../library/pathlib.rst:384 +#: ../../library/pathlib.rst:402 msgid "The logical parent of the path::" msgstr "邏輯上的父路徑: ::" -#: ../../library/pathlib.rst:386 +#: ../../library/pathlib.rst:404 msgid "" ">>> p = PurePosixPath('/a/b/c/d')\n" ">>> p.parent\n" @@ -770,11 +788,11 @@ msgstr "" ">>> p.parent\n" "PurePosixPath('/a/b/c')" -#: ../../library/pathlib.rst:390 +#: ../../library/pathlib.rst:408 msgid "You cannot go past an anchor, or empty path::" msgstr "你不能越過一個 anchor 或空路徑: ::" -#: ../../library/pathlib.rst:392 +#: ../../library/pathlib.rst:410 msgid "" ">>> p = PurePosixPath('/')\n" ">>> p.parent\n" @@ -790,11 +808,11 @@ msgstr "" ">>> p.parent\n" "PurePosixPath('.')" -#: ../../library/pathlib.rst:400 +#: ../../library/pathlib.rst:418 msgid "This is a purely lexical operation, hence the following behaviour::" msgstr "這是一個純粹字句上的 (lexical) 運算,因此會有以下行為: ::" -#: ../../library/pathlib.rst:402 +#: ../../library/pathlib.rst:420 msgid "" ">>> p = PurePosixPath('foo/..')\n" ">>> p.parent\n" @@ -804,7 +822,7 @@ msgstr "" ">>> p.parent\n" "PurePosixPath('foo')" -#: ../../library/pathlib.rst:406 +#: ../../library/pathlib.rst:424 msgid "" "If you want to walk an arbitrary filesystem path upwards, it is recommended " "to first call :meth:`Path.resolve` so as to resolve symlinks and eliminate " @@ -813,7 +831,7 @@ msgstr "" "如果你想要沿任意的檔案系統路徑往上走,建議要先呼叫 :meth:`Path.resolve` 來解" "析符號連結 (symlink) 及去除其中的 ``”..”``。" -#: ../../library/pathlib.rst:413 +#: ../../library/pathlib.rst:431 msgid "" "A string representing the final path component, excluding the drive and " "root, if any::" @@ -821,7 +839,7 @@ msgstr "" "最後的路徑組成 (final path component) 的字串表示,不包含任何磁碟機或根目" "錄: ::" -#: ../../library/pathlib.rst:416 +#: ../../library/pathlib.rst:434 msgid "" ">>> PurePosixPath('my/library/setup.py').name\n" "'setup.py'" @@ -829,11 +847,11 @@ msgstr "" ">>> PurePosixPath('my/library/setup.py').name\n" "'setup.py'" -#: ../../library/pathlib.rst:419 +#: ../../library/pathlib.rst:437 msgid "UNC drive names are not considered::" msgstr "UNC 磁碟機名稱並沒有算在內: ::" -#: ../../library/pathlib.rst:421 +#: ../../library/pathlib.rst:439 msgid "" ">>> PureWindowsPath('//some/share/setup.py').name\n" "'setup.py'\n" @@ -845,11 +863,12 @@ msgstr "" ">>> PureWindowsPath('//some/share').name\n" "''" -#: ../../library/pathlib.rst:429 -msgid "The file extension of the final component, if any::" +#: ../../library/pathlib.rst:447 +#, fuzzy +msgid "The last dot-separated portion of the final component, if any::" msgstr "若存在則為最後的路徑組成的檔案副檔名: ::" -#: ../../library/pathlib.rst:431 +#: ../../library/pathlib.rst:449 msgid "" ">>> PurePosixPath('my/library/setup.py').suffix\n" "'.py'\n" @@ -865,11 +884,17 @@ msgstr "" ">>> PurePosixPath('my/library').suffix\n" "''" -#: ../../library/pathlib.rst:441 -msgid "A list of the path's file extensions::" +#: ../../library/pathlib.rst:456 +#, fuzzy +msgid "This is commonly called the file extension." +msgstr "路徑檔案副檔名的串列: ::" + +#: ../../library/pathlib.rst:460 +#, fuzzy +msgid "A list of the path's suffixes, often called file extensions::" msgstr "路徑檔案副檔名的串列: ::" -#: ../../library/pathlib.rst:443 +#: ../../library/pathlib.rst:462 msgid "" ">>> PurePosixPath('my/library.tar.gar').suffixes\n" "['.tar', '.gar']\n" @@ -885,11 +910,11 @@ msgstr "" ">>> PurePosixPath('my/library').suffixes\n" "[]" -#: ../../library/pathlib.rst:453 +#: ../../library/pathlib.rst:472 msgid "The final path component, without its suffix::" msgstr "最後的路徑組成,不包括後綴 (suffix): ::" -#: ../../library/pathlib.rst:455 +#: ../../library/pathlib.rst:474 msgid "" ">>> PurePosixPath('my/library.tar.gz').stem\n" "'library.tar'\n" @@ -905,12 +930,12 @@ msgstr "" ">>> PurePosixPath('my/library').stem\n" "'library'" -#: ../../library/pathlib.rst:465 +#: ../../library/pathlib.rst:484 msgid "" "Return a string representation of the path with forward slashes (``/``)::" msgstr "回傳一個使用正斜線 (``/``) 的路徑的字串表示: ::" -#: ../../library/pathlib.rst:467 +#: ../../library/pathlib.rst:486 msgid "" ">>> p = PureWindowsPath('c:\\\\windows')\n" ">>> str(p)\n" @@ -924,14 +949,7 @@ msgstr "" ">>> p.as_posix()\n" "'c:/windows'" -#: ../../library/pathlib.rst:476 -msgid "" -"Represent the path as a ``file`` URI. :exc:`ValueError` is raised if the " -"path isn't absolute." -msgstr "" -"以 ``file`` URI 來表示一個路徑。如果不是絕對路徑會引發 :exc:`ValueError`。" - -#: ../../library/pathlib.rst:489 +#: ../../library/pathlib.rst:495 msgid "" "Return whether the path is absolute or not. A path is considered absolute " "if it has both a root and (if the flavour allows) a drive::" @@ -939,7 +957,7 @@ msgstr "" "回傳一個路徑是否是絕對路徑。一個路徑被視為絕對路徑的條件是它同時有根目錄及" "(如果該系統類型允許的話)磁碟機: ::" -#: ../../library/pathlib.rst:492 +#: ../../library/pathlib.rst:498 msgid "" ">>> PurePosixPath('/a/b').is_absolute()\n" "True\n" @@ -969,11 +987,11 @@ msgstr "" ">>> PureWindowsPath('//some/share').is_absolute()\n" "True" -#: ../../library/pathlib.rst:509 +#: ../../library/pathlib.rst:515 msgid "Return whether or not this path is relative to the *other* path." msgstr "回傳此路徑是否為 *other* 路徑的相對路徑。" -#: ../../library/pathlib.rst:517 +#: ../../library/pathlib.rst:523 msgid "" "This method is string-based; it neither accesses the filesystem nor treats " "\"``..``\" segments specially. The following code is equivalent:" @@ -981,13 +999,13 @@ msgstr "" "該方法是基於字串的;它既不存取檔案系統,也不特別處理 \"``..``\" 片段。以下程" "式碼是等效的:" -#: ../../library/pathlib.rst:528 +#: ../../library/pathlib.rst:534 msgid "" "Passing additional arguments is deprecated; if supplied, they are joined " "with *other*." msgstr "額外引數的傳入已棄用;如果有的話,它們會與 *other* 連接在一起。" -#: ../../library/pathlib.rst:533 +#: ../../library/pathlib.rst:539 msgid "" "With :class:`PureWindowsPath`, return ``True`` if the path is considered " "reserved under Windows, ``False`` otherwise. With :class:`PurePosixPath`, " @@ -997,19 +1015,25 @@ msgstr "" "``True``,否則回傳 ``False``。對 :class:`PurePosixPath` 來說,總是回傳 " "``False``。" -#: ../../library/pathlib.rst:542 +#: ../../library/pathlib.rst:543 msgid "" -"File system calls on reserved paths can fail mysteriously or have unintended " -"effects." -msgstr "在保留路徑上的檔案系統呼叫會神秘地失敗或有意外的效果。" +"Windows path names that contain a colon, or end with a dot or a space, are " +"considered reserved. UNC paths may be reserved." +msgstr "" -#: ../../library/pathlib.rst:548 +#: ../../library/pathlib.rst:547 +msgid "" +"This method is deprecated; use :func:`os.path.isreserved` to detect reserved " +"paths on Windows." +msgstr "" + +#: ../../library/pathlib.rst:553 msgid "" "Calling this method is equivalent to combining the path with each of the " "given *pathsegments* in turn::" msgstr "呼叫此方法會依序結合每個所給定的 *pathsegments* 到路徑上: ::" -#: ../../library/pathlib.rst:551 +#: ../../library/pathlib.rst:556 msgid "" ">>> PurePosixPath('/etc').joinpath('passwd')\n" "PurePosixPath('/etc/passwd')\n" @@ -1029,30 +1053,26 @@ msgstr "" ">>> PureWindowsPath('c:').joinpath('/Program Files')\n" "PureWindowsPath('c:/Program Files')" -#: ../../library/pathlib.rst:563 +#: ../../library/pathlib.rst:568 +#, fuzzy msgid "" "Match this path against the provided glob-style pattern. Return ``True`` if " -"matching is successful, ``False`` otherwise." +"matching is successful, ``False`` otherwise. For example::" msgstr "" "將路徑與 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回傳 " "``True``,否則回傳 ``False``。" -#: ../../library/pathlib.rst:566 +#: ../../library/pathlib.rst:571 +#, fuzzy msgid "" -"If *pattern* is relative, the path can be either relative or absolute, and " -"matching is done from the right::" -msgstr "" -"如果 *pattern* 是相對的,則路徑可以是相對或絕對的,而且會從右邊來完成比" -"對: ::" - -#: ../../library/pathlib.rst:569 -msgid "" -">>> PurePath('a/b.py').match('*.py')\n" +">>> PurePath('a/b.py').full_match('a/*.py')\n" "True\n" -">>> PurePath('/a/b/c.py').match('b/*.py')\n" +">>> PurePath('a/b.py').full_match('*.py')\n" +"False\n" +">>> PurePath('/a/b/c.py').full_match('/a/**')\n" "True\n" -">>> PurePath('/a/b/c.py').match('a/*.py')\n" -"False" +">>> PurePath('/a/b/c.py').full_match('**/*.py')\n" +"True" msgstr "" ">>> PurePath('a/b.py').match('*.py')\n" "True\n" @@ -1061,59 +1081,20 @@ msgstr "" ">>> PurePath('/a/b/c.py').match('a/*.py')\n" "False" -#: ../../library/pathlib.rst:576 -msgid "" -"If *pattern* is absolute, the path must be absolute, and the whole path must " -"match::" -msgstr "如果 *pattern* 是絕對的,則路徑必須是絕對的,且整個路徑都要比對到: ::" - -#: ../../library/pathlib.rst:579 -msgid "" -">>> PurePath('/a.py').match('/*.py')\n" -"True\n" -">>> PurePath('a/b.py').match('/*.py')\n" -"False" +#: ../../library/pathlib.rst:581 ../../library/pathlib.rst:1291 +msgid ":ref:`pathlib-pattern-language` documentation." msgstr "" -">>> PurePath('/a.py').match('/*.py')\n" -"True\n" -">>> PurePath('a/b.py').match('/*.py')\n" -"False" - -#: ../../library/pathlib.rst:584 -msgid "" -"The *pattern* may be another path object; this speeds up matching the same " -"pattern against multiple files::" -msgstr "*pattern* 可以是另一個路徑物件;這會加速對多個檔案比對相同的樣式: ::" -#: ../../library/pathlib.rst:587 -msgid "" -">>> pattern = PurePath('*.py')\n" -">>> PurePath('a/b.py').match(pattern)\n" -"True" -msgstr "" -">>> pattern = PurePath('*.py')\n" -">>> PurePath('a/b.py').match(pattern)\n" -"True" - -#: ../../library/pathlib.rst:592 -msgid "" -"The recursive wildcard \"``**``\" isn't supported by this method (it acts " -"like non-recursive \"``*``\".)" -msgstr "" - -#: ../../library/pathlib.rst:595 -msgid "Accepts an object implementing the :class:`os.PathLike` interface." -msgstr "接受一個有實作 :class:`os.PathLike` 介面的物件。" - -#: ../../library/pathlib.rst:598 +#: ../../library/pathlib.rst:583 msgid "As with other methods, case-sensitivity follows platform defaults::" msgstr "像其它方法一樣,是否區分大小寫會遵循平台的預設行為: ::" -#: ../../library/pathlib.rst:600 +#: ../../library/pathlib.rst:585 +#, fuzzy msgid "" -">>> PurePosixPath('b.py').match('*.PY')\n" +">>> PurePosixPath('b.py').full_match('*.PY')\n" "False\n" -">>> PureWindowsPath('b.py').match('*.PY')\n" +">>> PureWindowsPath('b.py').full_match('*.PY')\n" "True" msgstr "" ">>> PurePosixPath('b.py').match('*.PY')\n" @@ -1121,17 +1102,55 @@ msgstr "" ">>> PureWindowsPath('b.py').match('*.PY')\n" "True" -#: ../../library/pathlib.rst:605 +#: ../../library/pathlib.rst:590 msgid "" "Set *case_sensitive* to ``True`` or ``False`` to override this behaviour." msgstr "將 *case_sensitive* 設定成 ``True`` 或 ``False`` 會覆蓋這個行為。" -#: ../../library/pathlib.rst:607 ../../library/pathlib.rst:1212 -#: ../../library/pathlib.rst:1240 +#: ../../library/pathlib.rst:597 +#, fuzzy +msgid "" +"Match this path against the provided non-recursive glob-style pattern. " +"Return ``True`` if matching is successful, ``False`` otherwise." +msgstr "" +"將路徑與 glob 形式的樣式 (glob-style pattern) 做比對。如果比對成功則回傳 " +"``True``,否則回傳 ``False``。" + +#: ../../library/pathlib.rst:600 +msgid "" +"This method is similar to :meth:`~PurePath.full_match`, but empty patterns " +"aren't allowed (:exc:`ValueError` is raised), the recursive wildcard " +"\"``**``\" isn't supported (it acts like non-recursive \"``*``\"), and if a " +"relative pattern is provided, then matching is done from the right::" +msgstr "" + +#: ../../library/pathlib.rst:605 +msgid "" +">>> PurePath('a/b.py').match('*.py')\n" +"True\n" +">>> PurePath('/a/b/c.py').match('b/*.py')\n" +"True\n" +">>> PurePath('/a/b/c.py').match('a/*.py')\n" +"False" +msgstr "" +">>> PurePath('a/b.py').match('*.py')\n" +"True\n" +">>> PurePath('/a/b/c.py').match('b/*.py')\n" +"True\n" +">>> PurePath('/a/b/c.py').match('a/*.py')\n" +"False" + +#: ../../library/pathlib.rst:612 ../../library/pathlib.rst:1310 +#: ../../library/pathlib.rst:1335 +msgid "The *pattern* parameter accepts a :term:`path-like object`." +msgstr "" + +#: ../../library/pathlib.rst:615 ../../library/pathlib.rst:1304 +#: ../../library/pathlib.rst:1329 msgid "The *case_sensitive* parameter was added." msgstr "新增 *case_sensitive* 參數。" -#: ../../library/pathlib.rst:613 +#: ../../library/pathlib.rst:621 msgid "" "Compute a version of this path relative to the path represented by *other*. " "If it's impossible, :exc:`ValueError` is raised::" @@ -1139,7 +1158,7 @@ msgstr "" "計算這個路徑相對於 *other* 所表示路徑的版本。如果做不到會引發 :exc:" "`ValueError`: ::" -#: ../../library/pathlib.rst:616 +#: ../../library/pathlib.rst:624 msgid "" ">>> p = PurePosixPath('/etc/passwd')\n" ">>> p.relative_to('/')\n" @@ -1167,7 +1186,7 @@ msgstr "" "ValueError: '/etc/passwd' is not in the subpath of '/usr' OR one path is " "relative and the other is absolute." -#: ../../library/pathlib.rst:628 +#: ../../library/pathlib.rst:636 msgid "" "When *walk_up* is false (the default), the path must start with *other*. " "When the argument is true, ``..`` entries may be added to form the relative " @@ -1178,7 +1197,7 @@ msgstr "" "可能會加入 ``..`` 以組成相對路徑。在其他情況下,例如路徑參考到不同的磁碟機," "則會引發 :exc:`ValueError`: ::" -#: ../../library/pathlib.rst:633 +#: ../../library/pathlib.rst:641 msgid "" ">>> p.relative_to('/usr', walk_up=True)\n" "PurePosixPath('../etc/passwd')\n" @@ -1200,7 +1219,7 @@ msgstr "" "ValueError: '/etc/passwd' is not on the same drive as 'foo' OR one path is " "relative and the other is absolute." -#: ../../library/pathlib.rst:643 +#: ../../library/pathlib.rst:651 msgid "" "This function is part of :class:`PurePath` and works with strings. It does " "not check or access the underlying file structure. This can impact the " @@ -1211,19 +1230,19 @@ msgstr "" "的檔案架構。這會影響到 *walk_up* 選項,因為它假設路徑中沒有符號連結;如果需要" "解析符號連結的話可以先呼叫 :meth:`~Path.resolve`。" -#: ../../library/pathlib.rst:649 +#: ../../library/pathlib.rst:657 msgid "" "The *walk_up* parameter was added (old behavior is the same as " "``walk_up=False``)." msgstr "加入 *walk_up* 參數(舊的行為和 ``walk_up=False`` 相同)。" -#: ../../library/pathlib.rst:654 +#: ../../library/pathlib.rst:662 msgid "" "Passing additional positional arguments is deprecated; if supplied, they are " "joined with *other*." msgstr "額外位置引數的傳入已棄用;如果有的話,它們會與 *other* 連接在一起。" -#: ../../library/pathlib.rst:659 +#: ../../library/pathlib.rst:667 msgid "" "Return a new path with the :attr:`name` changed. If the original path " "doesn't have a name, ValueError is raised::" @@ -1231,7 +1250,7 @@ msgstr "" "回傳一個修改 :attr:`name` 後的新路徑。如果原始路徑沒有名稱則引發 " "ValueError: ::" -#: ../../library/pathlib.rst:662 +#: ../../library/pathlib.rst:670 msgid "" ">>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')\n" ">>> p.with_name('setup.py')\n" @@ -1257,7 +1276,7 @@ msgstr "" " raise ValueError(\"%r has an empty name\" % (self,))\n" "ValueError: PureWindowsPath('c:/') has an empty name" -#: ../../library/pathlib.rst:676 +#: ../../library/pathlib.rst:684 msgid "" "Return a new path with the :attr:`stem` changed. If the original path " "doesn't have a name, ValueError is raised::" @@ -1265,7 +1284,7 @@ msgstr "" "回傳一個修改 :attr:`stem` 後的新路徑。如果原始路徑沒有名稱則引發 " "ValueError: ::" -#: ../../library/pathlib.rst:679 +#: ../../library/pathlib.rst:687 msgid "" ">>> p = PureWindowsPath('c:/Downloads/draft.txt')\n" ">>> p.with_stem('final')\n" @@ -1303,7 +1322,7 @@ msgstr "" " raise ValueError(\"%r has an empty name\" % (self,))\n" "ValueError: PureWindowsPath('c:/') has an empty name" -#: ../../library/pathlib.rst:700 +#: ../../library/pathlib.rst:708 msgid "" "Return a new path with the :attr:`suffix` changed. If the original path " "doesn't have a suffix, the new *suffix* is appended instead. If the " @@ -1312,7 +1331,7 @@ msgstr "" "回傳一個修改 :attr:`suffix` 後的新路徑。如果原始路徑沒有後綴,新的 *suffix* " "會附加在後面。如果 *suffix* 是一個空字串,原來的後綴會被移除: ::" -#: ../../library/pathlib.rst:704 +#: ../../library/pathlib.rst:712 msgid "" ">>> p = PureWindowsPath('c:/Downloads/pathlib.tar.gz')\n" ">>> p.with_suffix('.bz2')\n" @@ -1334,7 +1353,7 @@ msgstr "" ">>> p.with_suffix('')\n" "PureWindowsPath('README')" -#: ../../library/pathlib.rst:717 +#: ../../library/pathlib.rst:725 msgid "" "Create a new path object of the same type by combining the given " "*pathsegments*. This method is called whenever a derivative path is created, " @@ -1345,7 +1364,7 @@ msgstr "" "建立的時候會呼叫這個方法,例如從 :attr:`parent` 和 :meth:`relative_to` 建立衍" "生路徑。子類別可以覆寫此方法來傳遞資訊給衍生路徑,例如: ::" -#: ../../library/pathlib.rst:722 +#: ../../library/pathlib.rst:730 msgid "" "from pathlib import PurePosixPath\n" "\n" @@ -1375,11 +1394,11 @@ msgstr "" "hosts = etc / 'hosts'\n" "print(hosts.session_id) # 42" -#: ../../library/pathlib.rst:743 +#: ../../library/pathlib.rst:751 msgid "Concrete paths" msgstr "實體路徑" -#: ../../library/pathlib.rst:745 +#: ../../library/pathlib.rst:753 msgid "" "Concrete paths are subclasses of the pure path classes. In addition to " "operations provided by the latter, they also provide methods to do system " @@ -1388,7 +1407,7 @@ msgstr "" "實體路徑是純路徑類別的子類別。除了後者本來就有提供的操作,它們也提供方法可以" "對路徑物件做系統呼叫。有三種方式可以實例化實體路徑:" -#: ../../library/pathlib.rst:751 +#: ../../library/pathlib.rst:759 msgid "" "A subclass of :class:`PurePath`, this class represents concrete paths of the " "system's path flavour (instantiating it creates either a :class:`PosixPath` " @@ -1397,7 +1416,7 @@ msgstr "" ":class:`PurePath` 的子類別,此類別表示系統的路徑類型的實體路徑(實例化時會建" "立一個 :class:`PosixPath` 或 :class:`WindowsPath`): ::" -#: ../../library/pathlib.rst:755 +#: ../../library/pathlib.rst:763 msgid "" ">>> Path('setup.py')\n" "PosixPath('setup.py')" @@ -1405,7 +1424,7 @@ msgstr "" ">>> Path('setup.py')\n" "PosixPath('setup.py')" -#: ../../library/pathlib.rst:762 +#: ../../library/pathlib.rst:770 msgid "" "A subclass of :class:`Path` and :class:`PurePosixPath`, this class " "represents concrete non-Windows filesystem paths::" @@ -1413,7 +1432,7 @@ msgstr "" ":class:`Path` 和 :class:`PurePosixPath` 的子類別,此類別表示實體非 Windows 檔" "案系統路徑: ::" -#: ../../library/pathlib.rst:765 +#: ../../library/pathlib.rst:773 msgid "" ">>> PosixPath('/etc/hosts')\n" "PosixPath('/etc/hosts')" @@ -1421,7 +1440,13 @@ msgstr "" ">>> PosixPath('/etc/hosts')\n" "PosixPath('/etc/hosts')" -#: ../../library/pathlib.rst:772 +#: ../../library/pathlib.rst:778 +msgid "" +"Raises :exc:`UnsupportedOperation` on Windows. In previous versions, :exc:" +"`NotImplementedError` was raised instead." +msgstr "" + +#: ../../library/pathlib.rst:785 msgid "" "A subclass of :class:`Path` and :class:`PureWindowsPath`, this class " "represents concrete Windows filesystem paths::" @@ -1429,7 +1454,7 @@ msgstr "" ":class:`Path` 和 :class:`PureWindowsPath` 的子類別,此類別表示實體 Windows 檔" "案系統路徑: ::" -#: ../../library/pathlib.rst:775 +#: ../../library/pathlib.rst:788 msgid "" ">>> WindowsPath('c:/', 'Users', 'Ximénez')\n" "WindowsPath('c:/Users/Ximénez')" @@ -1437,7 +1462,13 @@ msgstr "" ">>> WindowsPath('c:/', 'Users', 'Ximénez')\n" "WindowsPath('c:/Users/Ximénez')" -#: ../../library/pathlib.rst:780 +#: ../../library/pathlib.rst:793 +msgid "" +"Raises :exc:`UnsupportedOperation` on non-Windows platforms. In previous " +"versions, :exc:`NotImplementedError` was raised instead." +msgstr "" + +#: ../../library/pathlib.rst:798 msgid "" "You can only instantiate the class flavour that corresponds to your system " "(allowing system calls on non-compatible path flavours could lead to bugs or " @@ -1446,7 +1477,8 @@ msgstr "" "你只能實例化對應你的系統的類別類型(允許在不相容的路徑類型上做系統呼叫可能在" "你的應用程式導致漏洞或故障): ::" -#: ../../library/pathlib.rst:784 +#: ../../library/pathlib.rst:802 +#, fuzzy msgid "" ">>> import os\n" ">>> os.name\n" @@ -1460,7 +1492,7 @@ msgid "" " File \"\", line 1, in \n" " File \"pathlib.py\", line 798, in __new__\n" " % (cls.__name__,))\n" -"NotImplementedError: cannot instantiate 'WindowsPath' on your system" +"UnsupportedOperation: cannot instantiate 'WindowsPath' on your system" msgstr "" ">>> import os\n" ">>> os.name\n" @@ -1476,18 +1508,117 @@ msgstr "" " % (cls.__name__,))\n" "NotImplementedError: cannot instantiate 'WindowsPath' on your system" -#: ../../library/pathlib.rst:798 +#: ../../library/pathlib.rst:816 msgid "" "Some concrete path methods can raise an :exc:`OSError` if a system call " "fails (for example because the path doesn't exist)." msgstr "" "有些實體路徑方法會在系統呼叫失敗(例如因為路徑不存在)時引發 :exc:`OSError`" -#: ../../library/pathlib.rst:803 +#: ../../library/pathlib.rst:821 +msgid "Parsing and generating URIs" +msgstr "" + +#: ../../library/pathlib.rst:823 +msgid "" +"Concrete path objects can be created from, and represented as, 'file' URIs " +"conforming to :rfc:`8089`." +msgstr "" + +#: ../../library/pathlib.rst:828 +msgid "" +"File URIs are not portable across machines with different :ref:`filesystem " +"encodings `." +msgstr "" + +#: ../../library/pathlib.rst:833 +msgid "Return a new path object from parsing a 'file' URI. For example::" +msgstr "" + +#: ../../library/pathlib.rst:835 +#, fuzzy +msgid "" +">>> p = Path.from_uri('file:///etc/hosts')\n" +"PosixPath('/etc/hosts')" +msgstr "" +">>> PosixPath('/etc/hosts')\n" +"PosixPath('/etc/hosts')" + +#: ../../library/pathlib.rst:838 +msgid "On Windows, DOS device and UNC paths may be parsed from URIs::" +msgstr "" + +#: ../../library/pathlib.rst:840 +#, fuzzy +msgid "" +">>> p = Path.from_uri('file:///c:/windows')\n" +"WindowsPath('c:/windows')\n" +">>> p = Path.from_uri('file://server/share')\n" +"WindowsPath('//server/share')" +msgstr "" +">>> PureWindowsPath('c:/', 'Users', 'Ximénez')\n" +"PureWindowsPath('c:/Users/Ximénez')\n" +">>> PureWindowsPath('//server/share/file')\n" +"PureWindowsPath('//server/share/file')" + +#: ../../library/pathlib.rst:845 +msgid "Several variant forms are supported::" +msgstr "" + +#: ../../library/pathlib.rst:847 +msgid "" +">>> p = Path.from_uri('file:////server/share')\n" +"WindowsPath('//server/share')\n" +">>> p = Path.from_uri('file://///server/share')\n" +"WindowsPath('//server/share')\n" +">>> p = Path.from_uri('file:c:/windows')\n" +"WindowsPath('c:/windows')\n" +">>> p = Path.from_uri('file:/c|/windows')\n" +"WindowsPath('c:/windows')" +msgstr "" + +#: ../../library/pathlib.rst:856 +msgid "" +":exc:`ValueError` is raised if the URI does not start with ``file:``, or the " +"parsed path isn't absolute." +msgstr "" + +#: ../../library/pathlib.rst:864 +#, fuzzy +msgid "" +"Represent the path as a 'file' URI. :exc:`ValueError` is raised if the path " +"isn't absolute." +msgstr "" +"以 ``file`` URI 來表示一個路徑。如果不是絕對路徑會引發 :exc:`ValueError`。" + +#: ../../library/pathlib.rst:867 +#, fuzzy +msgid "" +">>> p = PosixPath('/etc/passwd')\n" +">>> p.as_uri()\n" +"'file:///etc/passwd'\n" +">>> p = WindowsPath('c:/Windows')\n" +">>> p.as_uri()\n" +"'file:///c:/Windows'" +msgstr "" +">>> p = PurePath('/etc')\n" +">>> str(p)\n" +"'/etc'\n" +">>> p = PureWindowsPath('c:/Program Files')\n" +">>> str(p)\n" +"'c:\\\\Program Files'" + +#: ../../library/pathlib.rst:876 +msgid "" +"For historical reasons, this method is also available from :class:`PurePath` " +"objects. However, its use of :func:`os.fsencode` makes it strictly impure." +msgstr "" + +#: ../../library/pathlib.rst:882 msgid "Expanding and resolving paths" msgstr "" -#: ../../library/pathlib.rst:807 +#: ../../library/pathlib.rst:886 msgid "" "Return a new path object representing the user's home directory (as returned " "by :func:`os.path.expanduser` with ``~`` construct). If the home directory " @@ -1496,7 +1627,7 @@ msgstr "" "回傳一個代表使用者家目錄的新的路徑物件(像以 ``~`` 構成的 :func:`os.path." "expanduser` 的回傳一樣)。如果無法解析家目錄,會引發 :exc:`RuntimeError`。" -#: ../../library/pathlib.rst:813 +#: ../../library/pathlib.rst:892 msgid "" ">>> Path.home()\n" "PosixPath('/home/antoine')" @@ -1504,7 +1635,7 @@ msgstr "" ">>> Path.home()\n" "PosixPath('/home/antoine')" -#: ../../library/pathlib.rst:821 +#: ../../library/pathlib.rst:900 msgid "" "Return a new path with expanded ``~`` and ``~user`` constructs, as returned " "by :meth:`os.path.expanduser`. If a home directory can't be resolved, :exc:" @@ -1513,7 +1644,7 @@ msgstr "" "回傳一個展開 ``~`` 和 ``~user`` 構成的新路徑,像 :meth:`os.path.expanduser` " "回傳的一樣。如果無法解析家目錄,會引發 :exc:`RuntimeError`。" -#: ../../library/pathlib.rst:827 +#: ../../library/pathlib.rst:906 msgid "" ">>> p = PosixPath('~/films/Monty Python')\n" ">>> p.expanduser()\n" @@ -1523,14 +1654,14 @@ msgstr "" ">>> p.expanduser()\n" "PosixPath('/home/eric/films/Monty Python')" -#: ../../library/pathlib.rst:836 +#: ../../library/pathlib.rst:915 msgid "" "Return a new path object representing the current directory (as returned by :" "func:`os.getcwd`)::" msgstr "" "回傳一個代表目前目錄的新的路徑物件(像 :func:`os.getcwd` 回傳的一樣): ::" -#: ../../library/pathlib.rst:839 +#: ../../library/pathlib.rst:918 msgid "" ">>> Path.cwd()\n" "PosixPath('/home/antoine/pathlib')" @@ -1538,14 +1669,14 @@ msgstr "" ">>> Path.cwd()\n" "PosixPath('/home/antoine/pathlib')" -#: ../../library/pathlib.rst:845 +#: ../../library/pathlib.rst:924 msgid "" "Make the path absolute, without normalization or resolving symlinks. Returns " "a new path object::" msgstr "" "將路徑轉換為絕對路徑,不進行標準化或解析符號連結。回傳一個新的路徑物件: ::" -#: ../../library/pathlib.rst:848 +#: ../../library/pathlib.rst:927 msgid "" ">>> p = Path('tests')\n" ">>> p\n" @@ -1559,13 +1690,13 @@ msgstr "" ">>> p.absolute()\n" "PosixPath('/home/antoine/pathlib/tests')" -#: ../../library/pathlib.rst:857 +#: ../../library/pathlib.rst:936 msgid "" "Make the path absolute, resolving any symlinks. A new path object is " "returned::" msgstr "將路徑轉換為絕對路徑,解析所有符號連結。回傳一個新的路徑物件: ::" -#: ../../library/pathlib.rst:860 +#: ../../library/pathlib.rst:939 msgid "" ">>> p = Path()\n" ">>> p\n" @@ -1579,13 +1710,13 @@ msgstr "" ">>> p.resolve()\n" "PosixPath('/home/antoine/pathlib')" -#: ../../library/pathlib.rst:866 +#: ../../library/pathlib.rst:945 msgid "" "\"``..``\" components are also eliminated (this is the only method to do " "so)::" msgstr "同時也會消除 \"``..``\" 的路徑組成(只有此方法這樣做): ::" -#: ../../library/pathlib.rst:868 +#: ../../library/pathlib.rst:947 msgid "" ">>> p = Path('docs/../setup.py')\n" ">>> p.resolve()\n" @@ -1595,29 +1726,36 @@ msgstr "" ">>> p.resolve()\n" "PosixPath('/home/antoine/pathlib/setup.py')" -#: ../../library/pathlib.rst:872 +#: ../../library/pathlib.rst:951 +#, fuzzy msgid "" -"If the path doesn't exist and *strict* is ``True``, :exc:`FileNotFoundError` " -"is raised. If *strict* is ``False``, the path is resolved as far as " -"possible and any remainder is appended without checking whether it exists. " -"If an infinite loop is encountered along the resolution path, :exc:" -"`RuntimeError` is raised." +"If a path doesn't exist or a symlink loop is encountered, and *strict* is " +"``True``, :exc:`OSError` is raised. If *strict* is ``False``, the path is " +"resolved as far as possible and any remainder is appended without checking " +"whether it exists." msgstr "" "如果路徑不存在且 *strict* 為 ``True``,則引發 :exc:`FileNotFoundError`。如果 " "*strict* 為 ``False``,則將盡可能解析該路徑,並將任何剩餘部分追加到路徑中,而" "不檢查其是否存在。如果在解析過程中遇到無窮迴圈,則引發 :exc:`RuntimeError`。" -#: ../../library/pathlib.rst:878 +#: ../../library/pathlib.rst:956 msgid "The *strict* parameter was added (pre-3.6 behavior is strict)." msgstr "新增 *strict* 參數(在 3.6 版本之前的行為是嚴格的)。" -#: ../../library/pathlib.rst:884 +#: ../../library/pathlib.rst:959 +msgid "" +"Symlink loops are treated like other errors: :exc:`OSError` is raised in " +"strict mode, and no exception is raised in non-strict mode. In previous " +"versions, :exc:`RuntimeError` is raised no matter the value of *strict*." +msgstr "" + +#: ../../library/pathlib.rst:967 msgid "" "Return the path to which the symbolic link points (as returned by :func:`os." "readlink`)::" msgstr "回傳符號連結指向的路徑(如 :func:`os.readlink` 的回傳值): ::" -#: ../../library/pathlib.rst:887 +#: ../../library/pathlib.rst:970 msgid "" ">>> p = Path('mylink')\n" ">>> p.symlink_to('setup.py')\n" @@ -1629,11 +1767,17 @@ msgstr "" ">>> p.readlink()\n" "PosixPath('setup.py')" -#: ../../library/pathlib.rst:896 +#: ../../library/pathlib.rst:977 +msgid "" +"Raises :exc:`UnsupportedOperation` if :func:`os.readlink` is not available. " +"In previous versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: ../../library/pathlib.rst:983 msgid "Querying file type and status" msgstr "" -#: ../../library/pathlib.rst:900 +#: ../../library/pathlib.rst:987 msgid "" ":meth:`~Path.exists`, :meth:`~Path.is_dir`, :meth:`~Path.is_file`, :meth:" "`~Path.is_mount`, :meth:`~Path.is_symlink`, :meth:`~Path.is_block_device`, :" @@ -1646,7 +1790,7 @@ msgstr "" "meth:`~Path.is_char_device`、:meth:`~Path.is_fifo`、:meth:`~Path.is_socket` " "遇到路徑包含 OS 層無法表示的字元時現在會回傳 ``False`` 而不是引發例外。" -#: ../../library/pathlib.rst:910 +#: ../../library/pathlib.rst:997 msgid "" "Return an :class:`os.stat_result` object containing information about this " "path, like :func:`os.stat`. The result is looked up at each call to this " @@ -1655,7 +1799,7 @@ msgstr "" "回傳一個包含該路徑資訊的 :class:`os.stat_result` 物件,像 :func:`os.stat` 一" "樣。每次呼叫此方法都會重新查詢結果。" -#: ../../library/pathlib.rst:913 +#: ../../library/pathlib.rst:1000 msgid "" "This method normally follows symlinks; to stat a symlink add the argument " "``follow_symlinks=False``, or use :meth:`~Path.lstat`." @@ -1663,7 +1807,7 @@ msgstr "" "此方法通常會跟隨 (follow) 符號連結;想要取得符號連結的資訊,可以加上引數 " "``follow_symlinks=False`` 或使用 :meth:`~Path.lstat`。" -#: ../../library/pathlib.rst:918 +#: ../../library/pathlib.rst:1005 msgid "" ">>> p = Path('setup.py')\n" ">>> p.stat().st_size\n" @@ -1677,12 +1821,14 @@ msgstr "" ">>> p.stat().st_mtime\n" "1327883547.852554" -#: ../../library/pathlib.rst:924 ../../library/pathlib.rst:952 -#: ../../library/pathlib.rst:1514 +#: ../../library/pathlib.rst:1011 ../../library/pathlib.rst:1039 +#: ../../library/pathlib.rst:1054 ../../library/pathlib.rst:1069 +#: ../../library/pathlib.rst:1600 ../../library/pathlib.rst:1616 +#: ../../library/pathlib.rst:1637 msgid "The *follow_symlinks* parameter was added." msgstr "新增 *follow_symlinks* 參數。" -#: ../../library/pathlib.rst:930 +#: ../../library/pathlib.rst:1017 msgid "" "Like :meth:`Path.stat` but, if the path points to a symbolic link, return " "the symbolic link's information rather than its target's." @@ -1690,11 +1836,11 @@ msgstr "" "類似 :meth:`Path.stat`,但如果該路徑指向一個符號連結,則回傳符號連結的資訊而" "不是其指向的目標。" -#: ../../library/pathlib.rst:936 +#: ../../library/pathlib.rst:1023 msgid "Return ``True`` if the path points to an existing file or directory." msgstr "如果路徑指向存在的檔案或目錄則回傳 ``True``。" -#: ../../library/pathlib.rst:938 +#: ../../library/pathlib.rst:1025 msgid "" "This method normally follows symlinks; to check if a symlink exists, add the " "argument ``follow_symlinks=False``." @@ -1702,7 +1848,7 @@ msgstr "" "此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " "``follow_symlinks=False``。" -#: ../../library/pathlib.rst:943 +#: ../../library/pathlib.rst:1030 msgid "" ">>> Path('.').exists()\n" "True\n" @@ -1722,17 +1868,18 @@ msgstr "" ">>> Path('nonexistentfile').exists()\n" "False" -#: ../../library/pathlib.rst:958 +#: ../../library/pathlib.rst:1045 +#, fuzzy msgid "" -"Return ``True`` if the path points to a regular file (or a symbolic link " -"pointing to a regular file), ``False`` if it points to another kind of file." +"Return ``True`` if the path points to a regular file, ``False`` if it points " +"to another kind of file." msgstr "" "如果該路徑指向一個普通檔案(或者是一個指向普通檔案的符號連結)則回傳 " "``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:961 ../../library/pathlib.rst:970 -#: ../../library/pathlib.rst:1012 ../../library/pathlib.rst:1021 -#: ../../library/pathlib.rst:1030 ../../library/pathlib.rst:1039 +#: ../../library/pathlib.rst:1048 ../../library/pathlib.rst:1063 +#: ../../library/pathlib.rst:1111 ../../library/pathlib.rst:1120 +#: ../../library/pathlib.rst:1129 ../../library/pathlib.rst:1138 msgid "" "``False`` is also returned if the path doesn't exist or is a broken symlink; " "other errors (such as permission errors) are propagated." @@ -1740,27 +1887,46 @@ msgstr "" "如果路徑不存在或者是一個斷掉的符號連結則也會回傳 ``False``;其他錯誤(例如權" "限錯誤)則會傳遞出來。" -#: ../../library/pathlib.rst:967 +#: ../../library/pathlib.rst:1051 +#, fuzzy +msgid "" +"This method normally follows symlinks; to exclude symlinks, add the argument " +"``follow_symlinks=False``." +msgstr "" +"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"``follow_symlinks=False``。" + +#: ../../library/pathlib.rst:1060 +#, fuzzy msgid "" -"Return ``True`` if the path points to a directory (or a symbolic link " -"pointing to a directory), ``False`` if it points to another kind of file." +"Return ``True`` if the path points to a directory, ``False`` if it points to " +"another kind of file." msgstr "" "如果該路徑指向一個目錄(或者是一個指向目錄的符號連結)則回傳 ``True``,如果指" "向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:976 +#: ../../library/pathlib.rst:1066 +#, fuzzy +msgid "" +"This method normally follows symlinks; to exclude symlinks to directories, " +"add the argument ``follow_symlinks=False``." +msgstr "" +"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"``follow_symlinks=False``。" + +#: ../../library/pathlib.rst:1075 msgid "" "Return ``True`` if the path points to a symbolic link, ``False`` otherwise." msgstr "如果該路徑指向一個符號連結則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/pathlib.rst:978 +#: ../../library/pathlib.rst:1077 msgid "" "``False`` is also returned if the path doesn't exist; other errors (such as " "permission errors) are propagated." msgstr "" "如果該路徑不存在也會回傳 ``False``;其他錯誤(例如權限錯誤)則會傳遞出來。" -#: ../../library/pathlib.rst:984 +#: ../../library/pathlib.rst:1083 msgid "" "Return ``True`` if the path points to a junction, and ``False`` for any " "other type of file. Currently only Windows supports junctions." @@ -1768,7 +1934,7 @@ msgstr "" "如果該路徑指向一個連接點 (junction) 則回傳 ``True``,對其他類型的檔案則回傳 " "``False``。目前只有 Windows 支援連接點。" -#: ../../library/pathlib.rst:992 +#: ../../library/pathlib.rst:1091 msgid "" "Return ``True`` if the path is a :dfn:`mount point`: a point in a file " "system where a different file system has been mounted. On POSIX, the " @@ -1786,11 +1952,11 @@ msgstr "" "Windows 上,一個掛載點被視為一個根磁碟機字母(例如 ``c:\\``)、一個 UNC share" "(例如 ``\\\\server\\share``)或是掛載的檔案系統目錄。" -#: ../../library/pathlib.rst:1003 +#: ../../library/pathlib.rst:1102 msgid "Windows support was added." msgstr "加入對 Windows 的支援。" -#: ../../library/pathlib.rst:1009 +#: ../../library/pathlib.rst:1108 msgid "" "Return ``True`` if the path points to a Unix socket (or a symbolic link " "pointing to a Unix socket), ``False`` if it points to another kind of file." @@ -1798,7 +1964,7 @@ msgstr "" "如果該路徑指向一個 Unix socket(或者是一個指向 Unix socket 的符號連結)則會回" "傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:1018 +#: ../../library/pathlib.rst:1117 msgid "" "Return ``True`` if the path points to a FIFO (or a symbolic link pointing to " "a FIFO), ``False`` if it points to another kind of file." @@ -1806,7 +1972,7 @@ msgstr "" "如果該路徑指向一個 FIFO(或者是一個指向 FIFO 的符號連結)則會回傳 ``True``," "如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:1027 +#: ../../library/pathlib.rst:1126 msgid "" "Return ``True`` if the path points to a block device (or a symbolic link " "pointing to a block device), ``False`` if it points to another kind of file." @@ -1814,7 +1980,7 @@ msgstr "" "如果該路徑指向一個區塊裝置 (block device)(或者是一個指向區塊裝置的符號連結)" "則會回傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:1036 +#: ../../library/pathlib.rst:1135 msgid "" "Return ``True`` if the path points to a character device (or a symbolic link " "pointing to a character device), ``False`` if it points to another kind of " @@ -1823,7 +1989,7 @@ msgstr "" "如果該路徑指向一個字元裝置 (character device)(或者是一個指向字元裝置的符號連" "結)則會回傳 ``True``,如果指向其他類型的檔案則回傳 ``False``。" -#: ../../library/pathlib.rst:1045 +#: ../../library/pathlib.rst:1144 msgid "" "Return whether this path points to the same file as *other_path*, which can " "be either a Path object, or a string. The semantics are similar to :func:" @@ -1833,13 +1999,13 @@ msgstr "" "物件或字串。其語義類似於 :func:`os.path.samefile` 和 :func:`os.path." "samestat`。" -#: ../../library/pathlib.rst:1049 +#: ../../library/pathlib.rst:1148 msgid "" "An :exc:`OSError` can be raised if either file cannot be accessed for some " "reason." msgstr "若任何一個檔案因為某些原因無法存取,則引發 :exc:`OSError`。" -#: ../../library/pathlib.rst:1054 +#: ../../library/pathlib.rst:1153 msgid "" ">>> p = Path('spam')\n" ">>> q = Path('eggs')\n" @@ -1855,17 +2021,17 @@ msgstr "" ">>> p.samefile('spam')\n" "True" -#: ../../library/pathlib.rst:1065 +#: ../../library/pathlib.rst:1164 msgid "Reading and writing files" msgstr "" -#: ../../library/pathlib.rst:1070 +#: ../../library/pathlib.rst:1169 msgid "" "Open the file pointed to by the path, like the built-in :func:`open` " "function does::" msgstr "開啟該路徑指向的檔案,像內建的 :func:`open` 函式做的一樣: ::" -#: ../../library/pathlib.rst:1073 +#: ../../library/pathlib.rst:1172 msgid "" ">>> p = Path('setup.py')\n" ">>> with p.open() as f:\n" @@ -1879,11 +2045,11 @@ msgstr "" "...\n" "'#!/usr/bin/env python3\\n'" -#: ../../library/pathlib.rst:1082 +#: ../../library/pathlib.rst:1181 msgid "Return the decoded contents of the pointed-to file as a string::" msgstr "將路徑指向的檔案的解碼內容以字串形式回傳: ::" -#: ../../library/pathlib.rst:1084 ../../library/pathlib.rst:1114 +#: ../../library/pathlib.rst:1183 ../../library/pathlib.rst:1216 msgid "" ">>> p = Path('my_text_file')\n" ">>> p.write_text('Text file contents')\n" @@ -1897,17 +2063,21 @@ msgstr "" ">>> p.read_text()\n" "'Text file contents'" -#: ../../library/pathlib.rst:1090 +#: ../../library/pathlib.rst:1189 msgid "" "The file is opened and then closed. The optional parameters have the same " "meaning as in :func:`open`." msgstr "該檔案被打開並且隨後關閉。可選參數的含義與 :func:`open` 中的相同。" -#: ../../library/pathlib.rst:1098 +#: ../../library/pathlib.rst:1194 ../../library/pathlib.rst:1227 +msgid "The *newline* parameter was added." +msgstr "新增 *newline* 參數。" + +#: ../../library/pathlib.rst:1200 msgid "Return the binary contents of the pointed-to file as a bytes object::" msgstr "將路徑指向的檔案的二進位內容以一個位元組物件回傳: ::" -#: ../../library/pathlib.rst:1100 ../../library/pathlib.rst:1134 +#: ../../library/pathlib.rst:1202 ../../library/pathlib.rst:1236 msgid "" ">>> p = Path('my_binary_file')\n" ">>> p.write_bytes(b'Binary file contents')\n" @@ -1921,44 +2091,40 @@ msgstr "" ">>> p.read_bytes()\n" "b'Binary file contents'" -#: ../../library/pathlib.rst:1111 +#: ../../library/pathlib.rst:1213 msgid "" "Open the file pointed to in text mode, write *data* to it, and close the " "file::" msgstr "以文字模式開啟指向的檔案,將 *data* 寫到檔案,並關閉檔案:: :" -#: ../../library/pathlib.rst:1120 +#: ../../library/pathlib.rst:1222 msgid "" "An existing file of the same name is overwritten. The optional parameters " "have the same meaning as in :func:`open`." msgstr "" "一個名稱相同的已存在檔案會被覆寫。可選參數和 :func:`open` 的參數有相同意義。" -#: ../../library/pathlib.rst:1125 -msgid "The *newline* parameter was added." -msgstr "新增 *newline* 參數。" - -#: ../../library/pathlib.rst:1131 +#: ../../library/pathlib.rst:1233 msgid "" "Open the file pointed to in bytes mode, write *data* to it, and close the " "file::" msgstr "以位元組模式開啟指向的檔案,將 *data* 寫到檔案,並關閉檔案:: :" -#: ../../library/pathlib.rst:1140 +#: ../../library/pathlib.rst:1242 msgid "An existing file of the same name is overwritten." msgstr "一個名稱相同的已存在檔案會被覆寫。" -#: ../../library/pathlib.rst:1146 +#: ../../library/pathlib.rst:1248 msgid "Reading directories" msgstr "讀取目錄" -#: ../../library/pathlib.rst:1150 +#: ../../library/pathlib.rst:1252 msgid "" "When the path points to a directory, yield path objects of the directory " "contents::" msgstr "當該路徑指向一個目錄,會 yield 目錄裡面的路徑物件: ::" -#: ../../library/pathlib.rst:1153 +#: ../../library/pathlib.rst:1255 msgid "" ">>> p = Path('docs')\n" ">>> for child in p.iterdir(): child\n" @@ -1982,7 +2148,7 @@ msgstr "" "PosixPath('docs/_static')\n" "PosixPath('docs/Makefile')" -#: ../../library/pathlib.rst:1164 +#: ../../library/pathlib.rst:1266 msgid "" "The children are yielded in arbitrary order, and the special entries ``'.'`` " "and ``'..'`` are not included. If a file is removed from or added to the " @@ -1993,13 +2159,13 @@ msgstr "" "檔案在建立這個疊代器之後加到該目錄或從目錄刪除,這個檔案的路徑物件是否會被包" "含是沒有明定的。" -#: ../../library/pathlib.rst:1169 +#: ../../library/pathlib.rst:1271 msgid "" "If the path is not a directory or otherwise inaccessible, :exc:`OSError` is " "raised." msgstr "" -#: ../../library/pathlib.rst:1174 +#: ../../library/pathlib.rst:1276 msgid "" "Glob the given relative *pattern* in the directory represented by this path, " "yielding all matching files (of any kind)::" @@ -2007,31 +2173,14 @@ msgstr "" "在該路徑表示的目錄裡,以 glob 方式比對所給定的相對 *pattern*,並 yield 所有比" "對到的檔案(任意類型): ::" -#: ../../library/pathlib.rst:1177 +#: ../../library/pathlib.rst:1279 +#, fuzzy msgid "" ">>> sorted(Path('.').glob('*.py'))\n" "[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." "py')]\n" ">>> sorted(Path('.').glob('*/*.py'))\n" -"[PosixPath('docs/conf.py')]" -msgstr "" -">>> sorted(Path('.').glob('*.py'))\n" -"[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." -"py')]\n" -">>> sorted(Path('.').glob('*/*.py'))\n" -"[PosixPath('docs/conf.py')]" - -#: ../../library/pathlib.rst:1182 -msgid "" -"Patterns are the same as for :mod:`fnmatch`, with the addition of \"``**``\" " -"which means \"this directory and all subdirectories, recursively\". In " -"other words, it enables recursive globbing::" -msgstr "" -"模式 (pattern) 和給 :mod:`fnmatch` 的一樣,加上 \"``**``\" 代表「目前目錄及所" -"有遞迴的子目錄」。也就是說它能夠做遞迴的 glob 比對: ::" - -#: ../../library/pathlib.rst:1186 -msgid "" +"[PosixPath('docs/conf.py')]\n" ">>> sorted(Path('.').glob('**/*.py'))\n" "[PosixPath('build/lib/pathlib.py'),\n" " PosixPath('docs/conf.py'),\n" @@ -2046,16 +2195,7 @@ msgstr "" " PosixPath('setup.py'),\n" " PosixPath('test_pathlib.py')]" -#: ../../library/pathlib.rst:1193 -msgid "" -"This method calls :meth:`Path.is_dir` on the top-level directory and " -"propagates any :exc:`OSError` exception that is raised. Subsequent :exc:" -"`OSError` exceptions from scanning directories are suppressed." -msgstr "" -"此方法在頂層目錄上呼叫 :meth:`Path.is_dir` 並傳遞引發的任何 :exc:`OSError` 例" -"外。將會抑制在目錄對於 :exc:`OSError` 例外的後續掃描。" - -#: ../../library/pathlib.rst:1197 ../../library/pathlib.rst:1229 +#: ../../library/pathlib.rst:1293 msgid "" "By default, or when the *case_sensitive* keyword-only argument is set to " "``None``, this method matches paths using platform-specific casing rules: " @@ -2067,13 +2207,14 @@ msgstr "" "在 Windows 上不區分大小寫。將 *case_sensitive* 設成 ``True`` 或 ``False`` 會" "覆寫這個行為。" -#: ../../library/pathlib.rst:1203 +#: ../../library/pathlib.rst:1298 msgid "" -"Using the \"``**``\" pattern in large directory trees may consume an " -"inordinate amount of time." -msgstr "在很大的目錄樹裡使用 \"``**``\" 可能會耗費過多的時間。" +"By default, or when the *recurse_symlinks* keyword-only argument is set to " +"``False``, this method follows symlinks except when expanding \"``**``\" " +"wildcards. Set *recurse_symlinks* to ``True`` to always follow symlinks." +msgstr "" -#: ../../library/pathlib.rst:1206 +#: ../../library/pathlib.rst:1302 msgid "" "Raises an :ref:`auditing event ` ``pathlib.Path.glob`` with " "arguments ``self``, ``pattern``." @@ -2081,41 +2222,33 @@ msgstr "" "引發一個附帶引數 ``self``、``pattern`` 的\\ :ref:`稽核事件 ` " "``pathlib.Path.glob``。" -#: ../../library/pathlib.rst:1208 ../../library/pathlib.rst:1236 +#: ../../library/pathlib.rst:1307 ../../library/pathlib.rst:1332 +#, fuzzy +msgid "The *recurse_symlinks* parameter was added." +msgstr "新增 *follow_symlinks* 參數。" + +#: ../../library/pathlib.rst:1313 msgid "" -"Return only directories if *pattern* ends with a pathname components " -"separator (:data:`~os.sep` or :data:`~os.altsep`)." +"Any :exc:`OSError` exceptions raised from scanning the filesystem are " +"suppressed. In previous versions, such exceptions are suppressed in many " +"cases, but not all." msgstr "" -"如果 *pattern* 以路徑名稱組成的分隔符號(:data:`~os.sep` 或 :data:`~os." -"altsep`)作結尾則只會回傳目錄。" -#: ../../library/pathlib.rst:1218 +#: ../../library/pathlib.rst:1321 +#, fuzzy msgid "" "Glob the given relative *pattern* recursively. This is like calling :func:" -"`Path.glob` with \"``**/``\" added in front of the *pattern*, where " -"*patterns* are the same as for :mod:`fnmatch`::" +"`Path.glob` with \"``**/``\" added in front of the *pattern*." msgstr "" "遞迴地 glob 給定的相對 *pattern*。這相當於在給定的相對 *pattern* 前面加上 " "\"``**/``\" 並呼叫 :func:`Path.glob`,其中 *patterns* 和給 :mod:`fnmatch` 的" "相同: ::" -#: ../../library/pathlib.rst:1222 -msgid "" -">>> sorted(Path().rglob(\"*.py\"))\n" -"[PosixPath('build/lib/pathlib.py'),\n" -" PosixPath('docs/conf.py'),\n" -" PosixPath('pathlib.py'),\n" -" PosixPath('setup.py'),\n" -" PosixPath('test_pathlib.py')]" +#: ../../library/pathlib.rst:1325 +msgid ":ref:`pathlib-pattern-language` and :meth:`Path.glob` documentation." msgstr "" -">>> sorted(Path().rglob(\"*.py\"))\n" -"[PosixPath('build/lib/pathlib.py'),\n" -" PosixPath('docs/conf.py'),\n" -" PosixPath('pathlib.py'),\n" -" PosixPath('setup.py'),\n" -" PosixPath('test_pathlib.py')]" -#: ../../library/pathlib.rst:1234 +#: ../../library/pathlib.rst:1327 msgid "" "Raises an :ref:`auditing event ` ``pathlib.Path.rglob`` with " "arguments ``self``, ``pattern``." @@ -2123,13 +2256,13 @@ msgstr "" "引發一個附帶引數 ``self``、``pattern`` 的\\ :ref:`稽核事件 ` " "``pathlib.Path.rglob``。" -#: ../../library/pathlib.rst:1246 +#: ../../library/pathlib.rst:1341 msgid "" "Generate the file names in a directory tree by walking the tree either top-" "down or bottom-up." msgstr "透過由上而下或由下而上地走訪目錄樹產生目錄樹裡的檔案名稱。" -#: ../../library/pathlib.rst:1249 +#: ../../library/pathlib.rst:1344 msgid "" "For each directory in the directory tree rooted at *self* (including *self* " "but excluding '.' and '..'), the method yields a 3-tuple of ``(dirpath, " @@ -2138,7 +2271,7 @@ msgstr "" "對每個以 *self* 為根且在目錄樹裡的目錄(包含 *self* 但不包含 '.' 和 '..' )," "此方法會 yield 一個 ``(dirpath, dirnames, filenames)`` 的三元素元組。" -#: ../../library/pathlib.rst:1253 +#: ../../library/pathlib.rst:1348 msgid "" "*dirpath* is a :class:`Path` to the directory currently being walked, " "*dirnames* is a list of strings for the names of subdirectories in *dirpath* " @@ -2153,7 +2286,7 @@ msgstr "" "裡檔案或目錄的完整路徑(以 *self* 開頭),可以使用 ``dirpath / name``。會根據" "檔案系統來決定串列是否有排序。" -#: ../../library/pathlib.rst:1261 +#: ../../library/pathlib.rst:1356 msgid "" "If the optional argument *top_down* is true (which is the default), the " "triple for a directory is generated before the triples for any of its " @@ -2169,7 +2302,7 @@ msgstr "" "不論 *top_down* 的值是什麼,子目錄的串列會在走訪該目錄及其子目錄的三元素元組" "之前取得。" -#: ../../library/pathlib.rst:1269 +#: ../../library/pathlib.rst:1364 msgid "" "When *top_down* is true, the caller can modify the *dirnames* list in-place " "(for example, using :keyword:`del` or slice assignment), and :meth:`Path." @@ -2189,7 +2322,7 @@ msgstr "" "*dirnames* 對 :meth:`Path.walk` 的行為沒有影響,因為 *dirnames* 裡的目錄已經" "在 *dirnames* yield 給呼叫者之前被產生。" -#: ../../library/pathlib.rst:1279 +#: ../../library/pathlib.rst:1374 msgid "" "By default, errors from :func:`os.scandir` are ignored. If the optional " "argument *on_error* is specified, it should be a callable; it will be called " @@ -2202,7 +2335,7 @@ msgstr "" "這個可呼叫物件可以處理錯誤以繼續走訪,或者再次引發錯誤來停止走訪。注意,檔案" "名稱可以從例外物件的 ``filename`` 屬性來取得。" -#: ../../library/pathlib.rst:1285 +#: ../../library/pathlib.rst:1380 msgid "" "By default, :meth:`Path.walk` does not follow symbolic links, and instead " "adds them to the *filenames* list. Set *follow_symlinks* to true to resolve " @@ -2215,7 +2348,7 @@ msgstr "" "適當的 *dirnames* 和 *filenames*,而因此訪問到符號連結指向的目錄(在有支援符" "號連結的地方)。" -#: ../../library/pathlib.rst:1292 +#: ../../library/pathlib.rst:1387 msgid "" "Be aware that setting *follow_symlinks* to true can lead to infinite " "recursion if a link points to a parent directory of itself. :meth:`Path." @@ -2224,7 +2357,7 @@ msgstr "" "需要注意的是如果符號連結指向一個其本身的父目錄,則將 *follow_symlinks* 設定" "為 true 會導致無窮的遞迴。:meth:`Path.walk` 不會紀錄其已經訪問過的目錄。" -#: ../../library/pathlib.rst:1297 +#: ../../library/pathlib.rst:1392 msgid "" ":meth:`Path.walk` assumes the directories it walks are not modified during " "execution. For example, if a directory from *dirnames* has been replaced " @@ -2237,7 +2370,7 @@ msgstr "" "meth:`Path.walk` 依然會試著往下進入它。為了防止這樣的行為,可以從 *dirnames* " "適當地移除目錄。" -#: ../../library/pathlib.rst:1305 +#: ../../library/pathlib.rst:1400 msgid "" "Unlike :func:`os.walk`, :meth:`Path.walk` lists symlinks to directories in " "*filenames* if *follow_symlinks* is false." @@ -2245,7 +2378,7 @@ msgstr "" "如果 *follow_symlinks* 是 false,和 :func:`os.walk` 行為不同的是 :meth:`Path." "walk` 會將指向目錄的符號連結放在 *filenames* 串列。" -#: ../../library/pathlib.rst:1308 +#: ../../library/pathlib.rst:1403 msgid "" "This example displays the number of bytes used by all files in each " "directory, while ignoring ``__pycache__`` directories::" @@ -2253,7 +2386,7 @@ msgstr "" "這個範例會顯示在每個目錄裡所有檔案使用的位元組數量,同時間忽略 " "``__pycache__`` 目錄: ::" -#: ../../library/pathlib.rst:1311 +#: ../../library/pathlib.rst:1406 msgid "" "from pathlib import Path\n" "for root, dirs, files in Path(\"cpython/Lib/concurrent\")." @@ -2283,7 +2416,7 @@ msgstr "" " if '__pycache__' in dirs:\n" " dirs.remove('__pycache__')" -#: ../../library/pathlib.rst:1324 +#: ../../library/pathlib.rst:1419 msgid "" "This next example is a simple implementation of :func:`shutil.rmtree`. " "Walking the tree bottom-up is essential as :func:`rmdir` doesn't allow " @@ -2292,7 +2425,7 @@ msgstr "" "下一個範例是 :func:`shutil.rmtree` 的一個簡單的實作方式。由下而上走訪目錄樹是" "必要的,因為 :func:`rmdir` 不允許在目錄為空之前刪除它: ::" -#: ../../library/pathlib.rst:1328 +#: ../../library/pathlib.rst:1423 msgid "" "# Delete everything reachable from the directory \"top\".\n" "# CAUTION: This is dangerous! For example, if top == Path('/'),\n" @@ -2304,11 +2437,11 @@ msgid "" " (root / name).rmdir()" msgstr "" -#: ../../library/pathlib.rst:1341 +#: ../../library/pathlib.rst:1436 msgid "Creating files and directories" msgstr "建立檔案與目錄" -#: ../../library/pathlib.rst:1345 +#: ../../library/pathlib.rst:1440 msgid "" "Create a file at this given path. If *mode* is given, it is combined with " "the process's ``umask`` value to determine the file mode and access flags. " @@ -2320,13 +2453,13 @@ msgstr "" "合,以確定檔案模式和存取旗標。當檔案已經存在時,若 *exist_ok* 為 true 則函式" "不會失敗(其變更時間會被更新為當下時間),否則會引發 :exc:`FileExistsError`。" -#: ../../library/pathlib.rst:1352 +#: ../../library/pathlib.rst:1447 msgid "" "The :meth:`~Path.open`, :meth:`~Path.write_text` and :meth:`~Path." "write_bytes` methods are often used to create files." msgstr "" -#: ../../library/pathlib.rst:1358 +#: ../../library/pathlib.rst:1453 msgid "" "Create a new directory at this given path. If *mode* is given, it is " "combined with the process's ``umask`` value to determine the file mode and " @@ -2336,7 +2469,7 @@ msgstr "" "``umask`` 值來決定檔案模式與存取旗標 (access flag)。如果路徑已經存在,會引" "發 :exc:`FileExistsError`。" -#: ../../library/pathlib.rst:1363 +#: ../../library/pathlib.rst:1458 msgid "" "If *parents* is true, any missing parents of this path are created as " "needed; they are created with the default permissions without taking *mode* " @@ -2345,7 +2478,7 @@ msgstr "" "如果 *parents* 是 true,則任何缺少的父路徑都會依需要被建立;它們不考慮 " "*mode* 而會以預設的權限來建立(模仿 POSIX 的 ``mkdir -p`` 指令)。" -#: ../../library/pathlib.rst:1367 +#: ../../library/pathlib.rst:1462 msgid "" "If *parents* is false (the default), a missing parent raises :exc:" "`FileNotFoundError`." @@ -2353,7 +2486,7 @@ msgstr "" "如果 *parents* 是 false(預設值),缺少的父路徑會引發 :exc:" "`FileNotFoundError`。" -#: ../../library/pathlib.rst:1370 +#: ../../library/pathlib.rst:1465 msgid "" "If *exist_ok* is false (the default), :exc:`FileExistsError` is raised if " "the target directory already exists." @@ -2361,7 +2494,7 @@ msgstr "" "如果 *exist_ok* 是 false(預設值),則當目標目錄已經存在的話會引發 :exc:" "`FileExistsError`。" -#: ../../library/pathlib.rst:1373 +#: ../../library/pathlib.rst:1468 msgid "" "If *exist_ok* is true, :exc:`FileExistsError` will not be raised unless the " "given path already exists in the file system and is not a directory (same " @@ -2370,15 +2503,15 @@ msgstr "" "如果 *exist_ok* 是 true,只有當最後的路徑組成不是一個已存在的非目錄檔案,:" "exc:`FileExistsError` 例外會被忽略(與 POSIX 的 ``mkdir -p`` 指令行為相同)。" -#: ../../library/pathlib.rst:1377 +#: ../../library/pathlib.rst:1472 msgid "The *exist_ok* parameter was added." msgstr "新增 *exist_ok* 參數。" -#: ../../library/pathlib.rst:1383 +#: ../../library/pathlib.rst:1478 msgid "Make this path a symbolic link pointing to *target*." msgstr "使這個路徑成為一個指向 *target* 的符號連結。" -#: ../../library/pathlib.rst:1385 +#: ../../library/pathlib.rst:1480 msgid "" "On Windows, a symlink represents either a file or a directory, and does not " "morph to the target dynamically. If the target is present, the type of the " @@ -2391,7 +2524,7 @@ msgstr "" "*target_is_directory* 是 true,該符號連結會被建立成目錄,如果不是則建立成檔案" "(預設值)。在非 Windows 平台上,*target_is_directory* 會被忽略。" -#: ../../library/pathlib.rst:1393 +#: ../../library/pathlib.rst:1488 msgid "" ">>> p = Path('mylink')\n" ">>> p.symlink_to('setup.py')\n" @@ -2411,25 +2544,37 @@ msgstr "" ">>> p.lstat().st_size\n" "8" -#: ../../library/pathlib.rst:1403 +#: ../../library/pathlib.rst:1498 msgid "" "The order of arguments (link, target) is the reverse of :func:`os.symlink`'s." msgstr "引數的順序 (link, target) 和 :func:`os.symlink` 相反。" -#: ../../library/pathlib.rst:1409 +#: ../../library/pathlib.rst:1501 +msgid "" +"Raises :exc:`UnsupportedOperation` if :func:`os.symlink` is not available. " +"In previous versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: ../../library/pathlib.rst:1508 msgid "Make this path a hard link to the same file as *target*." msgstr "使這個路徑成為與 *target* 相同檔案的一個硬連結 (hard link)。" -#: ../../library/pathlib.rst:1412 +#: ../../library/pathlib.rst:1511 msgid "" "The order of arguments (link, target) is the reverse of :func:`os.link`'s." msgstr "引數的順序 (link, target) 和 :func:`os.link` 相反。" -#: ../../library/pathlib.rst:1419 +#: ../../library/pathlib.rst:1516 +msgid "" +"Raises :exc:`UnsupportedOperation` if :func:`os.link` is not available. In " +"previous versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: ../../library/pathlib.rst:1522 msgid "Renaming and deleting" msgstr "" -#: ../../library/pathlib.rst:1423 +#: ../../library/pathlib.rst:1526 msgid "" "Rename this file or directory to the given *target*, and return a new :class:" "`!Path` instance pointing to *target*. On Unix, if *target* exists and is a " @@ -2442,7 +2587,7 @@ msgstr "" "限,則會在不顯示訊息的情況下進行取代。在 Windows 系統上,若 *target* 存在,則" "會引發 :exc:`FileExistsError` 錯誤。*target* 可以是字串或另一個路徑物件: ::" -#: ../../library/pathlib.rst:1429 +#: ../../library/pathlib.rst:1532 msgid "" ">>> p = Path('foo')\n" ">>> p.open('w').write('some text')\n" @@ -2462,7 +2607,7 @@ msgstr "" ">>> target.open().read()\n" "'some text'" -#: ../../library/pathlib.rst:1438 ../../library/pathlib.rst:1454 +#: ../../library/pathlib.rst:1541 ../../library/pathlib.rst:1557 msgid "" "The target path may be absolute or relative. Relative paths are interpreted " "relative to the current working directory, *not* the directory of the :class:" @@ -2471,17 +2616,17 @@ msgstr "" "目標路徑可以是絕對路徑或相對路徑。相對路徑會相對於當前的工作目錄進行解釋,*而" "不是*\\ 相對於 :class:`!Path` 物件所在的目錄。" -#: ../../library/pathlib.rst:1442 +#: ../../library/pathlib.rst:1545 msgid "" "It is implemented in terms of :func:`os.rename` and gives the same " "guarantees." msgstr "此功能是使用 :func:`os.rename` 實現的,並提供相同的保證。" -#: ../../library/pathlib.rst:1444 ../../library/pathlib.rst:1458 +#: ../../library/pathlib.rst:1547 ../../library/pathlib.rst:1561 msgid "Added return value, return the new :class:`!Path` instance." msgstr "新增了回傳值,回傳新的 :class:`!Path` 實例。" -#: ../../library/pathlib.rst:1450 +#: ../../library/pathlib.rst:1553 msgid "" "Rename this file or directory to the given *target*, and return a new :class:" "`!Path` instance pointing to *target*. If *target* points to an existing " @@ -2490,13 +2635,13 @@ msgstr "" "將此檔案或目錄重新命名為給定的 *target*,並回傳一個指向 *target* 的新 :class:" "`!Path` 實例。如果 *target* 指向一個現有的檔案或空目錄,它將被無條件地取代。" -#: ../../library/pathlib.rst:1464 +#: ../../library/pathlib.rst:1567 msgid "" "Remove this file or symbolic link. If the path points to a directory, use :" "func:`Path.rmdir` instead." msgstr "移除這個檔案或符號連結。如果路徑指向目錄,請改用 :func:`Path.rmdir`。" -#: ../../library/pathlib.rst:1467 +#: ../../library/pathlib.rst:1570 msgid "" "If *missing_ok* is false (the default), :exc:`FileNotFoundError` is raised " "if the path does not exist." @@ -2504,7 +2649,7 @@ msgstr "" "如果 *missing_ok* 是 false(預設值),:exc:`FileNotFoundError` 會在路徑不存在" "時被引發。" -#: ../../library/pathlib.rst:1470 +#: ../../library/pathlib.rst:1573 msgid "" "If *missing_ok* is true, :exc:`FileNotFoundError` exceptions will be ignored " "(same behavior as the POSIX ``rm -f`` command)." @@ -2512,39 +2657,71 @@ msgstr "" "如果 *missing_ok* 是 true,:exc:`FileNotFoundError` 例外會被忽略(行為與 " "POSIX ``rm -f`` 指令相同)。" -#: ../../library/pathlib.rst:1473 +#: ../../library/pathlib.rst:1576 msgid "The *missing_ok* parameter was added." msgstr "新增 *missing_ok* 參數。" -#: ../../library/pathlib.rst:1479 +#: ../../library/pathlib.rst:1582 msgid "Remove this directory. The directory must be empty." msgstr "移除此目錄。該目錄必須為空。" -#: ../../library/pathlib.rst:1483 +#: ../../library/pathlib.rst:1586 msgid "Permissions and ownership" msgstr "" -#: ../../library/pathlib.rst:1487 +#: ../../library/pathlib.rst:1590 +#, fuzzy msgid "" -"Return the name of the user owning the file. :exc:`KeyError` is raised if " +"Return the name of the user owning the file. :exc:`KeyError` is raised if " "the file's user identifier (UID) isn't found in the system database." msgstr "" "回傳擁有該檔案的用戶名稱。如果在系統資料庫中找不到該檔案的使用者識別字 " "(UID),則會引發 :exc:`KeyError`。" -#: ../../library/pathlib.rst:1493 +#: ../../library/pathlib.rst:1593 +#, fuzzy +msgid "" +"This method normally follows symlinks; to get the owner of the symlink, add " +"the argument ``follow_symlinks=False``." +msgstr "" +"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"``follow_symlinks=False``。" + +#: ../../library/pathlib.rst:1596 msgid "" -"Return the name of the group owning the file. :exc:`KeyError` is raised if " +"Raises :exc:`UnsupportedOperation` if the :mod:`pwd` module is not " +"available. In earlier versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: ../../library/pathlib.rst:1606 +#, fuzzy +msgid "" +"Return the name of the group owning the file. :exc:`KeyError` is raised if " "the file's group identifier (GID) isn't found in the system database." msgstr "" "回傳擁有該檔案的群組名稱。如果在系統資料庫裡找不到檔案的群組識別字 (GID) 會引" "發 :exc:`KeyError`。" -#: ../../library/pathlib.rst:1499 +#: ../../library/pathlib.rst:1609 +#, fuzzy +msgid "" +"This method normally follows symlinks; to get the group of the symlink, add " +"the argument ``follow_symlinks=False``." +msgstr "" +"此方法通常會跟隨符號連結;如果想檢查符號連結是否存在,可以加上引數 " +"``follow_symlinks=False``。" + +#: ../../library/pathlib.rst:1612 +msgid "" +"Raises :exc:`UnsupportedOperation` if the :mod:`grp` module is not " +"available. In earlier versions, :exc:`NotImplementedError` was raised." +msgstr "" + +#: ../../library/pathlib.rst:1622 msgid "Change the file mode and permissions, like :func:`os.chmod`." msgstr "修改檔案模式 (file mode) 與權限,像 :func:`os.chmod` 一樣。" -#: ../../library/pathlib.rst:1501 +#: ../../library/pathlib.rst:1624 msgid "" "This method normally follows symlinks. Some Unix flavours support changing " "permissions on the symlink itself; on these platforms you may add the " @@ -2553,7 +2730,7 @@ msgstr "" "此方法通常會跟隨符號連結。一些 Unix 類型支援修改符號連結本身的權限;在這些平" "台上你可以加上引數 ``follow_symlinks=False`` 或使用 :meth:`~Path.lchmod`。" -#: ../../library/pathlib.rst:1507 +#: ../../library/pathlib.rst:1630 msgid "" ">>> p = Path('setup.py')\n" ">>> p.stat().st_mode\n" @@ -2569,7 +2746,7 @@ msgstr "" ">>> p.stat().st_mode\n" "33060" -#: ../../library/pathlib.rst:1520 +#: ../../library/pathlib.rst:1643 msgid "" "Like :meth:`Path.chmod` but, if the path points to a symbolic link, the " "symbolic link's mode is changed rather than its target's." @@ -2577,11 +2754,264 @@ msgstr "" "類似 :meth:`Path.chmod`,但如果該路徑指向一個符號連結,則符號連結的模式 " "(mode) 會被改變而不是其指向的目標。" -#: ../../library/pathlib.rst:1525 -msgid "Correspondence to tools in the :mod:`os` module" +#: ../../library/pathlib.rst:1650 +msgid "Pattern language" +msgstr "" + +#: ../../library/pathlib.rst:1652 +msgid "" +"The following wildcards are supported in patterns for :meth:`~PurePath." +"full_match`, :meth:`~Path.glob` and :meth:`~Path.rglob`:" +msgstr "" + +#: ../../library/pathlib.rst:1655 +msgid "``**`` (entire segment)" +msgstr "" + +#: ../../library/pathlib.rst:1656 +msgid "Matches any number of file or directory segments, including zero." +msgstr "" + +#: ../../library/pathlib.rst:1657 +msgid "``*`` (entire segment)" +msgstr "" + +#: ../../library/pathlib.rst:1658 +msgid "Matches one file or directory segment." +msgstr "" + +#: ../../library/pathlib.rst:1659 +msgid "``*`` (part of a segment)" +msgstr "" + +#: ../../library/pathlib.rst:1660 +msgid "Matches any number of non-separator characters, including zero." +msgstr "" + +#: ../../library/pathlib.rst:1661 +msgid "``?``" +msgstr "``?``" + +#: ../../library/pathlib.rst:1662 +msgid "Matches one non-separator character." +msgstr "" + +#: ../../library/pathlib.rst:1663 +msgid "``[seq]``" +msgstr "``[seq]``" + +#: ../../library/pathlib.rst:1664 +msgid "Matches one character in *seq*." +msgstr "" + +#: ../../library/pathlib.rst:1665 +msgid "``[!seq]``" +msgstr "``[!seq]``" + +#: ../../library/pathlib.rst:1666 +msgid "Matches one character not in *seq*." +msgstr "" + +#: ../../library/pathlib.rst:1668 +msgid "" +"For a literal match, wrap the meta-characters in brackets. For example, " +"``\"[?]\"`` matches the character ``\"?\"``." +msgstr "" + +#: ../../library/pathlib.rst:1671 +msgid "The \"``**``\" wildcard enables recursive globbing. A few examples:" +msgstr "" + +#: ../../library/pathlib.rst:1674 +msgid "Pattern" +msgstr "" + +#: ../../library/pathlib.rst:1674 +msgid "Meaning" +msgstr "" + +#: ../../library/pathlib.rst:1676 +msgid "\"``**/*``\"" +msgstr "" + +#: ../../library/pathlib.rst:1676 +msgid "Any path with at least one segment." +msgstr "" + +#: ../../library/pathlib.rst:1677 +msgid "\"``**/*.py``\"" +msgstr "" + +#: ../../library/pathlib.rst:1677 +msgid "Any path with a final segment ending \"``.py``\"." +msgstr "" + +#: ../../library/pathlib.rst:1678 +msgid "\"``assets/**``\"" +msgstr "" + +#: ../../library/pathlib.rst:1678 +msgid "Any path starting with \"``assets/``\"." +msgstr "" + +#: ../../library/pathlib.rst:1679 +msgid "\"``assets/**/*``\"" +msgstr "" + +#: ../../library/pathlib.rst:1679 +msgid "" +"Any path starting with \"``assets/``\", excluding \"``assets/``\" itself." +msgstr "" + +#: ../../library/pathlib.rst:1683 +msgid "" +"Globbing with the \"``**``\" wildcard visits every directory in the tree. " +"Large directory trees may take a long time to search." +msgstr "" + +#: ../../library/pathlib.rst:1686 +msgid "" +"Globbing with a pattern that ends with \"``**``\" returns both files and " +"directories. In previous versions, only directories were returned." +msgstr "" + +#: ../../library/pathlib.rst:1690 +msgid "" +"In :meth:`Path.glob` and :meth:`~Path.rglob`, a trailing slash may be added " +"to the pattern to match only directories." +msgstr "" + +#: ../../library/pathlib.rst:1693 +#, fuzzy +msgid "" +"Globbing with a pattern that ends with a pathname components separator (:" +"data:`~os.sep` or :data:`~os.altsep`) returns only directories." +msgstr "" +"如果 *pattern* 以路徑名稱組成的分隔符號(:data:`~os.sep` 或 :data:`~os." +"altsep`)作結尾則只會回傳目錄。" + +#: ../../library/pathlib.rst:1699 +#, fuzzy +msgid "Comparison to the :mod:`glob` module" msgstr "與 :mod:`os` 模組裡的工具的對應關係" -#: ../../library/pathlib.rst:1527 +#: ../../library/pathlib.rst:1701 +msgid "" +"The patterns accepted and results generated by :meth:`Path.glob` and :meth:" +"`Path.rglob` differ slightly from those by the :mod:`glob` module:" +msgstr "" + +#: ../../library/pathlib.rst:1704 +msgid "" +"Files beginning with a dot are not special in pathlib. This is like passing " +"``include_hidden=True`` to :func:`glob.glob`." +msgstr "" + +#: ../../library/pathlib.rst:1706 +msgid "" +"\"``**``\" pattern components are always recursive in pathlib. This is like " +"passing ``recursive=True`` to :func:`glob.glob`." +msgstr "" + +#: ../../library/pathlib.rst:1708 +msgid "" +"\"``**``\" pattern components do not follow symlinks by default in pathlib. " +"This behaviour has no equivalent in :func:`glob.glob`, but you can pass " +"``recurse_symlinks=True`` to :meth:`Path.glob` for compatible behaviour." +msgstr "" + +#: ../../library/pathlib.rst:1711 +msgid "" +"Like all :class:`PurePath` and :class:`Path` objects, the values returned " +"from :meth:`Path.glob` and :meth:`Path.rglob` don't include trailing slashes." +msgstr "" + +#: ../../library/pathlib.rst:1714 +msgid "" +"The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` " +"include the *path* as a prefix, unlike the results of ``glob." +"glob(root_dir=path)``." +msgstr "" + +#: ../../library/pathlib.rst:1717 +msgid "" +"The values returned from pathlib's ``path.glob()`` and ``path.rglob()`` may " +"include *path* itself, for example when globbing \"``**``\", whereas the " +"results of ``glob.glob(root_dir=path)`` never include an empty string that " +"would correspond to *path*." +msgstr "" + +#: ../../library/pathlib.rst:1724 +#, fuzzy +msgid "Comparison to the :mod:`os` and :mod:`os.path` modules" +msgstr ":mod:`os` 和 :mod:`os.path`" + +#: ../../library/pathlib.rst:1726 +msgid "" +"pathlib implements path operations using :class:`PurePath` and :class:`Path` " +"objects, and so it's said to be *object-oriented*. On the other hand, the :" +"mod:`os` and :mod:`os.path` modules supply functions that work with low-" +"level ``str`` and ``bytes`` objects, which is a more *procedural* approach. " +"Some users consider the object-oriented style to be more readable." +msgstr "" + +#: ../../library/pathlib.rst:1732 +msgid "" +"Many functions in :mod:`os` and :mod:`os.path` support ``bytes`` paths and :" +"ref:`paths relative to directory descriptors `. These features " +"aren't available in pathlib." +msgstr "" + +#: ../../library/pathlib.rst:1736 +msgid "" +"Python's ``str`` and ``bytes`` types, and portions of the :mod:`os` and :mod:" +"`os.path` modules, are written in C and are very speedy. pathlib is written " +"in pure Python and is often slower, but rarely slow enough to matter." +msgstr "" + +#: ../../library/pathlib.rst:1740 +msgid "" +"pathlib's path normalization is slightly more opinionated and consistent " +"than :mod:`os.path`. For example, whereas :func:`os.path.abspath` eliminates " +"\"``..``\" segments from a path, which may change its meaning if symlinks " +"are involved, :meth:`Path.absolute` preserves these segments for greater " +"safety." +msgstr "" + +#: ../../library/pathlib.rst:1745 +msgid "" +"pathlib's path normalization may render it unsuitable for some applications:" +msgstr "" + +#: ../../library/pathlib.rst:1747 +msgid "" +"pathlib normalizes ``Path(\"my_folder/\")`` to ``Path(\"my_folder\")``, " +"which changes a path's meaning when supplied to various operating system " +"APIs and command-line utilities. Specifically, the absence of a trailing " +"separator may allow the path to be resolved as either a file or directory, " +"rather than a directory only." +msgstr "" + +#: ../../library/pathlib.rst:1752 +msgid "" +"pathlib normalizes ``Path(\"./my_program\")`` to ``Path(\"my_program\")``, " +"which changes a path's meaning when used as an executable search path, such " +"as in a shell or when spawning a child process. Specifically, the absence of " +"a separator in the path may force it to be looked up in :envvar:`PATH` " +"rather than the current directory." +msgstr "" + +#: ../../library/pathlib.rst:1758 +msgid "" +"As a consequence of these differences, pathlib is not a drop-in replacement " +"for :mod:`os.path`." +msgstr "" + +#: ../../library/pathlib.rst:1763 +msgid "Corresponding tools" +msgstr "" + +#: ../../library/pathlib.rst:1765 msgid "" "Below is a table mapping various :mod:`os` functions to their corresponding :" "class:`PurePath`/:class:`Path` equivalent." @@ -2589,267 +3019,267 @@ msgstr "" "以下是一張表格,對應許多 :mod:`os` 函式及其相符於 :class:`PurePath`/:class:" "`Path` 的項目。" -#: ../../library/pathlib.rst:1531 +#: ../../library/pathlib.rst:1769 msgid ":mod:`os` and :mod:`os.path`" msgstr ":mod:`os` 和 :mod:`os.path`" -#: ../../library/pathlib.rst:1531 +#: ../../library/pathlib.rst:1769 msgid ":mod:`pathlib`" msgstr ":mod:`pathlib`" -#: ../../library/pathlib.rst:1533 +#: ../../library/pathlib.rst:1771 msgid ":func:`os.path.dirname`" msgstr ":func:`os.path.dirname`" -#: ../../library/pathlib.rst:1533 +#: ../../library/pathlib.rst:1771 msgid ":attr:`PurePath.parent`" msgstr ":attr:`PurePath.parent`" -#: ../../library/pathlib.rst:1534 +#: ../../library/pathlib.rst:1772 msgid ":func:`os.path.basename`" msgstr ":func:`os.path.basename`" -#: ../../library/pathlib.rst:1534 +#: ../../library/pathlib.rst:1772 msgid ":attr:`PurePath.name`" msgstr ":attr:`PurePath.name`" -#: ../../library/pathlib.rst:1535 +#: ../../library/pathlib.rst:1773 msgid ":func:`os.path.splitext`" msgstr ":func:`os.path.splitext`" -#: ../../library/pathlib.rst:1535 +#: ../../library/pathlib.rst:1773 msgid ":attr:`PurePath.stem`, :attr:`PurePath.suffix`" msgstr ":attr:`PurePath.stem` 和 :attr:`PurePath.suffix`" -#: ../../library/pathlib.rst:1536 +#: ../../library/pathlib.rst:1774 msgid ":func:`os.path.join`" msgstr ":func:`os.path.join`" -#: ../../library/pathlib.rst:1536 +#: ../../library/pathlib.rst:1774 msgid ":meth:`PurePath.joinpath`" msgstr ":meth:`PurePath.joinpath`" -#: ../../library/pathlib.rst:1537 +#: ../../library/pathlib.rst:1775 msgid ":func:`os.path.isabs`" msgstr ":func:`os.path.isabs`" -#: ../../library/pathlib.rst:1537 +#: ../../library/pathlib.rst:1775 msgid ":meth:`PurePath.is_absolute`" msgstr ":meth:`PurePath.is_absolute`" -#: ../../library/pathlib.rst:1538 +#: ../../library/pathlib.rst:1776 msgid ":func:`os.path.relpath`" msgstr ":func:`os.path.relpath`" -#: ../../library/pathlib.rst:1538 +#: ../../library/pathlib.rst:1776 msgid ":meth:`PurePath.relative_to` [1]_" msgstr ":meth:`PurePath.relative_to` [1]_" -#: ../../library/pathlib.rst:1539 +#: ../../library/pathlib.rst:1777 msgid ":func:`os.path.expanduser`" msgstr ":func:`os.path.expanduser`" -#: ../../library/pathlib.rst:1539 +#: ../../library/pathlib.rst:1777 msgid ":meth:`Path.expanduser` [2]_" msgstr ":meth:`Path.expanduser` [2]_" -#: ../../library/pathlib.rst:1540 +#: ../../library/pathlib.rst:1778 msgid ":func:`os.path.realpath`" msgstr ":func:`os.path.realpath`" -#: ../../library/pathlib.rst:1540 +#: ../../library/pathlib.rst:1778 msgid ":meth:`Path.resolve`" msgstr ":meth:`Path.resolve`" -#: ../../library/pathlib.rst:1541 +#: ../../library/pathlib.rst:1779 msgid ":func:`os.path.abspath`" msgstr ":func:`os.path.abspath`" -#: ../../library/pathlib.rst:1541 +#: ../../library/pathlib.rst:1779 msgid ":meth:`Path.absolute` [3]_" msgstr ":meth:`Path.absolute` [3]_" -#: ../../library/pathlib.rst:1542 +#: ../../library/pathlib.rst:1780 msgid ":func:`os.path.exists`" msgstr ":func:`os.path.exists`" -#: ../../library/pathlib.rst:1542 +#: ../../library/pathlib.rst:1780 msgid ":meth:`Path.exists`" msgstr ":meth:`Path.exists`" -#: ../../library/pathlib.rst:1543 +#: ../../library/pathlib.rst:1781 msgid ":func:`os.path.isfile`" msgstr ":func:`os.path.isfile`" -#: ../../library/pathlib.rst:1543 +#: ../../library/pathlib.rst:1781 msgid ":meth:`Path.is_file`" msgstr ":meth:`Path.is_file`" -#: ../../library/pathlib.rst:1544 +#: ../../library/pathlib.rst:1782 msgid ":func:`os.path.isdir`" msgstr ":func:`os.path.isdir`" -#: ../../library/pathlib.rst:1544 +#: ../../library/pathlib.rst:1782 msgid ":meth:`Path.is_dir`" msgstr ":meth:`Path.is_dir`" -#: ../../library/pathlib.rst:1545 +#: ../../library/pathlib.rst:1783 msgid ":func:`os.path.islink`" msgstr ":func:`os.path.islink`" -#: ../../library/pathlib.rst:1545 +#: ../../library/pathlib.rst:1783 msgid ":meth:`Path.is_symlink`" msgstr ":meth:`Path.is_symlink`" -#: ../../library/pathlib.rst:1546 +#: ../../library/pathlib.rst:1784 msgid ":func:`os.path.isjunction`" msgstr ":func:`os.path.isjunction`" -#: ../../library/pathlib.rst:1546 +#: ../../library/pathlib.rst:1784 msgid ":meth:`Path.is_junction`" msgstr ":meth:`Path.is_junction`" -#: ../../library/pathlib.rst:1547 +#: ../../library/pathlib.rst:1785 msgid ":func:`os.path.ismount`" msgstr ":func:`os.path.ismount`" -#: ../../library/pathlib.rst:1547 +#: ../../library/pathlib.rst:1785 msgid ":meth:`Path.is_mount`" msgstr ":meth:`Path.is_mount`" -#: ../../library/pathlib.rst:1548 +#: ../../library/pathlib.rst:1786 msgid ":func:`os.path.samefile`" msgstr ":func:`os.path.samefile`" -#: ../../library/pathlib.rst:1548 +#: ../../library/pathlib.rst:1786 msgid ":meth:`Path.samefile`" msgstr ":meth:`Path.samefile`" -#: ../../library/pathlib.rst:1549 +#: ../../library/pathlib.rst:1787 msgid ":func:`os.getcwd`" msgstr ":func:`os.getcwd`" -#: ../../library/pathlib.rst:1549 +#: ../../library/pathlib.rst:1787 msgid ":meth:`Path.cwd`" msgstr ":meth:`Path.cwd`" -#: ../../library/pathlib.rst:1550 +#: ../../library/pathlib.rst:1788 msgid ":func:`os.stat`" msgstr ":func:`os.stat`" -#: ../../library/pathlib.rst:1550 +#: ../../library/pathlib.rst:1788 msgid ":meth:`Path.stat`" msgstr ":meth:`Path.stat`" -#: ../../library/pathlib.rst:1551 +#: ../../library/pathlib.rst:1789 msgid ":func:`os.lstat`" msgstr ":func:`os.lstat`" -#: ../../library/pathlib.rst:1551 +#: ../../library/pathlib.rst:1789 msgid ":meth:`Path.lstat`" msgstr ":meth:`Path.lstat`" -#: ../../library/pathlib.rst:1552 +#: ../../library/pathlib.rst:1790 msgid ":func:`os.listdir`" msgstr ":func:`os.listdir`" -#: ../../library/pathlib.rst:1552 +#: ../../library/pathlib.rst:1790 msgid ":meth:`Path.iterdir`" msgstr ":meth:`Path.iterdir`" -#: ../../library/pathlib.rst:1553 +#: ../../library/pathlib.rst:1791 msgid ":func:`os.walk`" msgstr ":func:`os.walk`" -#: ../../library/pathlib.rst:1553 +#: ../../library/pathlib.rst:1791 msgid ":meth:`Path.walk` [4]_" msgstr ":meth:`Path.walk` [4]_" -#: ../../library/pathlib.rst:1554 +#: ../../library/pathlib.rst:1792 msgid ":func:`os.mkdir`, :func:`os.makedirs`" msgstr ":func:`os.mkdir`、:func:`os.makedirs`" -#: ../../library/pathlib.rst:1554 +#: ../../library/pathlib.rst:1792 msgid ":meth:`Path.mkdir`" msgstr ":meth:`Path.mkdir`" -#: ../../library/pathlib.rst:1555 +#: ../../library/pathlib.rst:1793 msgid ":func:`os.link`" msgstr ":func:`os.link`" -#: ../../library/pathlib.rst:1555 +#: ../../library/pathlib.rst:1793 msgid ":meth:`Path.hardlink_to`" msgstr ":meth:`Path.hardlink_to`" -#: ../../library/pathlib.rst:1556 +#: ../../library/pathlib.rst:1794 msgid ":func:`os.symlink`" msgstr ":func:`os.symlink`" -#: ../../library/pathlib.rst:1556 +#: ../../library/pathlib.rst:1794 msgid ":meth:`Path.symlink_to`" msgstr ":meth:`Path.symlink_to`" -#: ../../library/pathlib.rst:1557 +#: ../../library/pathlib.rst:1795 msgid ":func:`os.readlink`" msgstr ":func:`os.readlink`" -#: ../../library/pathlib.rst:1557 +#: ../../library/pathlib.rst:1795 msgid ":meth:`Path.readlink`" msgstr ":meth:`Path.readlink`" -#: ../../library/pathlib.rst:1558 +#: ../../library/pathlib.rst:1796 msgid ":func:`os.rename`" msgstr ":func:`os.rename`" -#: ../../library/pathlib.rst:1558 +#: ../../library/pathlib.rst:1796 msgid ":meth:`Path.rename`" msgstr ":meth:`Path.rename`" -#: ../../library/pathlib.rst:1559 +#: ../../library/pathlib.rst:1797 msgid ":func:`os.replace`" msgstr ":func:`os.replace`" -#: ../../library/pathlib.rst:1559 +#: ../../library/pathlib.rst:1797 msgid ":meth:`Path.replace`" msgstr ":meth:`Path.replace`" -#: ../../library/pathlib.rst:1560 +#: ../../library/pathlib.rst:1798 msgid ":func:`os.remove`, :func:`os.unlink`" msgstr ":func:`os.remove`、:func:`os.unlink`" -#: ../../library/pathlib.rst:1560 +#: ../../library/pathlib.rst:1798 msgid ":meth:`Path.unlink`" msgstr ":meth:`Path.unlink`" -#: ../../library/pathlib.rst:1561 +#: ../../library/pathlib.rst:1799 msgid ":func:`os.rmdir`" msgstr ":func:`os.rmdir`" -#: ../../library/pathlib.rst:1561 +#: ../../library/pathlib.rst:1799 msgid ":meth:`Path.rmdir`" msgstr ":meth:`Path.rmdir`" -#: ../../library/pathlib.rst:1562 +#: ../../library/pathlib.rst:1800 msgid ":func:`os.chmod`" msgstr ":func:`os.chmod`" -#: ../../library/pathlib.rst:1562 +#: ../../library/pathlib.rst:1800 msgid ":meth:`Path.chmod`" msgstr ":meth:`Path.chmod`" -#: ../../library/pathlib.rst:1563 +#: ../../library/pathlib.rst:1801 msgid ":func:`os.lchmod`" msgstr ":func:`os.lchmod`" -#: ../../library/pathlib.rst:1563 +#: ../../library/pathlib.rst:1801 msgid ":meth:`Path.lchmod`" msgstr ":meth:`Path.lchmod`" -#: ../../library/pathlib.rst:1567 +#: ../../library/pathlib.rst:1805 msgid "Footnotes" msgstr "註解" -#: ../../library/pathlib.rst:1568 +#: ../../library/pathlib.rst:1806 msgid "" ":func:`os.path.relpath` calls :func:`~os.path.abspath` to make paths " "absolute and remove \"``..``\" parts, whereas :meth:`PurePath.relative_to` " @@ -2857,21 +3287,21 @@ msgid "" "anchors differ (e.g. if one path is absolute and the other relative.)" msgstr "" -#: ../../library/pathlib.rst:1572 +#: ../../library/pathlib.rst:1810 msgid "" ":func:`os.path.expanduser` returns the path unchanged if the home directory " "can't be resolved, whereas :meth:`Path.expanduser` raises :exc:" "`RuntimeError`." msgstr "" -#: ../../library/pathlib.rst:1575 +#: ../../library/pathlib.rst:1813 msgid "" ":func:`os.path.abspath` removes \"``..``\" components without resolving " "symlinks, which may change the meaning of the path, whereas :meth:`Path." "absolute` leaves any \"``..``\" components in the path." msgstr "" -#: ../../library/pathlib.rst:1578 +#: ../../library/pathlib.rst:1816 msgid "" ":func:`os.walk` always follows symlinks when categorizing paths into " "*dirnames* and *filenames*, whereas :meth:`Path.walk` categorizes all " @@ -2885,3 +3315,99 @@ msgstr "path(路徑)" #: ../../library/pathlib.rst:11 msgid "operations" msgstr "operations(操作)" + +#~ msgid "" +#~ "File system calls on reserved paths can fail mysteriously or have " +#~ "unintended effects." +#~ msgstr "在保留路徑上的檔案系統呼叫會神秘地失敗或有意外的效果。" + +#~ msgid "" +#~ "If *pattern* is relative, the path can be either relative or absolute, " +#~ "and matching is done from the right::" +#~ msgstr "" +#~ "如果 *pattern* 是相對的,則路徑可以是相對或絕對的,而且會從右邊來完成比" +#~ "對: ::" + +#~ msgid "" +#~ "If *pattern* is absolute, the path must be absolute, and the whole path " +#~ "must match::" +#~ msgstr "" +#~ "如果 *pattern* 是絕對的,則路徑必須是絕對的,且整個路徑都要比對到: ::" + +#~ msgid "" +#~ ">>> PurePath('/a.py').match('/*.py')\n" +#~ "True\n" +#~ ">>> PurePath('a/b.py').match('/*.py')\n" +#~ "False" +#~ msgstr "" +#~ ">>> PurePath('/a.py').match('/*.py')\n" +#~ "True\n" +#~ ">>> PurePath('a/b.py').match('/*.py')\n" +#~ "False" + +#~ msgid "" +#~ "The *pattern* may be another path object; this speeds up matching the " +#~ "same pattern against multiple files::" +#~ msgstr "" +#~ "*pattern* 可以是另一個路徑物件;這會加速對多個檔案比對相同的樣式: ::" + +#~ msgid "" +#~ ">>> pattern = PurePath('*.py')\n" +#~ ">>> PurePath('a/b.py').match(pattern)\n" +#~ "True" +#~ msgstr "" +#~ ">>> pattern = PurePath('*.py')\n" +#~ ">>> PurePath('a/b.py').match(pattern)\n" +#~ "True" + +#~ msgid "Accepts an object implementing the :class:`os.PathLike` interface." +#~ msgstr "接受一個有實作 :class:`os.PathLike` 介面的物件。" + +#~ msgid "" +#~ ">>> sorted(Path('.').glob('*.py'))\n" +#~ "[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." +#~ "py')]\n" +#~ ">>> sorted(Path('.').glob('*/*.py'))\n" +#~ "[PosixPath('docs/conf.py')]" +#~ msgstr "" +#~ ">>> sorted(Path('.').glob('*.py'))\n" +#~ "[PosixPath('pathlib.py'), PosixPath('setup.py'), PosixPath('test_pathlib." +#~ "py')]\n" +#~ ">>> sorted(Path('.').glob('*/*.py'))\n" +#~ "[PosixPath('docs/conf.py')]" + +#~ msgid "" +#~ "Patterns are the same as for :mod:`fnmatch`, with the addition of " +#~ "\"``**``\" which means \"this directory and all subdirectories, " +#~ "recursively\". In other words, it enables recursive globbing::" +#~ msgstr "" +#~ "模式 (pattern) 和給 :mod:`fnmatch` 的一樣,加上 \"``**``\" 代表「目前目錄" +#~ "及所有遞迴的子目錄」。也就是說它能夠做遞迴的 glob 比對: ::" + +#~ msgid "" +#~ "This method calls :meth:`Path.is_dir` on the top-level directory and " +#~ "propagates any :exc:`OSError` exception that is raised. Subsequent :exc:" +#~ "`OSError` exceptions from scanning directories are suppressed." +#~ msgstr "" +#~ "此方法在頂層目錄上呼叫 :meth:`Path.is_dir` 並傳遞引發的任何 :exc:" +#~ "`OSError` 例外。將會抑制在目錄對於 :exc:`OSError` 例外的後續掃描。" + +#~ msgid "" +#~ "Using the \"``**``\" pattern in large directory trees may consume an " +#~ "inordinate amount of time." +#~ msgstr "在很大的目錄樹裡使用 \"``**``\" 可能會耗費過多的時間。" + +#~ msgid "" +#~ ">>> sorted(Path().rglob(\"*.py\"))\n" +#~ "[PosixPath('build/lib/pathlib.py'),\n" +#~ " PosixPath('docs/conf.py'),\n" +#~ " PosixPath('pathlib.py'),\n" +#~ " PosixPath('setup.py'),\n" +#~ " PosixPath('test_pathlib.py')]" +#~ msgstr "" +#~ ">>> sorted(Path().rglob(\"*.py\"))\n" +#~ "[PosixPath('build/lib/pathlib.py'),\n" +#~ " PosixPath('docs/conf.py'),\n" +#~ " PosixPath('pathlib.py'),\n" +#~ " PosixPath('setup.py'),\n" +#~ " PosixPath('test_pathlib.py')]" diff --git a/library/pdb.po b/library/pdb.po index fc65e4555f..bd47a844d5 100644 --- a/library/pdb.po +++ b/library/pdb.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -108,8 +108,8 @@ msgstr "" #: ../../library/pdb.rst:65 msgid "" -"> ...(3)double()\n" -"-> return x * 2\n" +"> ...(2)double()\n" +"-> breakpoint()\n" "(Pdb) p x\n" "3\n" "(Pdb) continue\n" @@ -193,13 +193,20 @@ msgid "" "(Pdb)" msgstr "" -#: ../../library/pdb.rst:127 +#: ../../library/pdb.rst:126 +msgid "" +"The implementation of :pep:`667` means that name assignments made via " +"``pdb`` will immediately affect the active scope, even when running inside " +"an :term:`optimized scope`." +msgstr "" + +#: ../../library/pdb.rst:132 msgid "" "The module defines the following functions; each enters the debugger in a " "slightly different way:" msgstr "" -#: ../../library/pdb.rst:132 +#: ../../library/pdb.rst:137 msgid "" "Execute the *statement* (given as a string or a code object) under debugger " "control. The debugger prompt appears before any code is executed; you can " @@ -211,14 +218,14 @@ msgid "" "`exec` or :func:`eval` functions.)" msgstr "" -#: ../../library/pdb.rst:144 +#: ../../library/pdb.rst:149 msgid "" "Evaluate the *expression* (given as a string or a code object) under " "debugger control. When :func:`runeval` returns, it returns the value of the " "*expression*. Otherwise this function is similar to :func:`run`." msgstr "" -#: ../../library/pdb.rst:151 +#: ../../library/pdb.rst:156 msgid "" "Call the *function* (a function or method object, not a string) with the " "given arguments. When :func:`runcall` returns, it returns whatever the " @@ -226,7 +233,7 @@ msgid "" "is entered." msgstr "" -#: ../../library/pdb.rst:159 +#: ../../library/pdb.rst:164 msgid "" "Enter the debugger at the calling stack frame. This is useful to hard-code " "a breakpoint at a given point in a program, even if the code is not " @@ -234,11 +241,17 @@ msgid "" "is printed to the console just before debugging begins." msgstr "" -#: ../../library/pdb.rst:164 +#: ../../library/pdb.rst:169 msgid "The keyword-only argument *header*." msgstr "" -#: ../../library/pdb.rst:170 +#: ../../library/pdb.rst:172 +msgid "" +":func:`set_trace` will enter the debugger immediately, rather than on the " +"next line of code to be executed." +msgstr "" + +#: ../../library/pdb.rst:178 msgid "" "Enter post-mortem debugging of the given *traceback* object. If no " "*traceback* is given, it uses the one of the exception that is currently " @@ -246,37 +259,36 @@ msgid "" "used)." msgstr "" -#: ../../library/pdb.rst:178 +#: ../../library/pdb.rst:186 msgid "" -"Enter post-mortem debugging of the traceback found in :data:`sys." -"last_traceback`." +"Enter post-mortem debugging of the exception found in :data:`sys.last_exc`." msgstr "" -#: ../../library/pdb.rst:182 +#: ../../library/pdb.rst:190 msgid "" "The ``run*`` functions and :func:`set_trace` are aliases for instantiating " "the :class:`Pdb` class and calling the method of the same name. If you want " "to access further features, you have to do this yourself:" msgstr "" -#: ../../library/pdb.rst:189 +#: ../../library/pdb.rst:197 msgid ":class:`Pdb` is the debugger class." msgstr "" -#: ../../library/pdb.rst:191 +#: ../../library/pdb.rst:199 msgid "" "The *completekey*, *stdin* and *stdout* arguments are passed to the " "underlying :class:`cmd.Cmd` class; see the description there." msgstr "" -#: ../../library/pdb.rst:194 +#: ../../library/pdb.rst:202 msgid "" "The *skip* argument, if given, must be an iterable of glob-style module name " "patterns. The debugger will not step into frames that originate in a module " "that matches one of these patterns. [1]_" msgstr "" -#: ../../library/pdb.rst:198 +#: ../../library/pdb.rst:206 msgid "" "By default, Pdb sets a handler for the SIGINT signal (which is sent when the " "user presses :kbd:`Ctrl-C` on the console) when you give a :pdbcmd:" @@ -285,48 +297,48 @@ msgid "" "set *nosigint* to true." msgstr "" -#: ../../library/pdb.rst:203 +#: ../../library/pdb.rst:211 msgid "" "The *readrc* argument defaults to true and controls whether Pdb will load ." "pdbrc files from the filesystem." msgstr "" -#: ../../library/pdb.rst:206 +#: ../../library/pdb.rst:214 msgid "Example call to enable tracing with *skip*::" msgstr "" -#: ../../library/pdb.rst:208 +#: ../../library/pdb.rst:216 msgid "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" msgstr "import pdb; pdb.Pdb(skip=['django.*']).set_trace()" -#: ../../library/pdb.rst:210 +#: ../../library/pdb.rst:218 msgid "" "Raises an :ref:`auditing event ` ``pdb.Pdb`` with no arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``pdb.Pdb``。" -#: ../../library/pdb.rst:212 +#: ../../library/pdb.rst:220 msgid "Added the *skip* parameter." msgstr "" -#: ../../library/pdb.rst:215 +#: ../../library/pdb.rst:223 msgid "" "Added the *nosigint* parameter. Previously, a SIGINT handler was never set " "by Pdb." msgstr "" -#: ../../library/pdb.rst:219 +#: ../../library/pdb.rst:227 msgid "The *readrc* argument." msgstr "*readrc* 引數。" -#: ../../library/pdb.rst:227 +#: ../../library/pdb.rst:235 msgid "See the documentation for the functions explained above." msgstr "" -#: ../../library/pdb.rst:233 +#: ../../library/pdb.rst:241 msgid "Debugger Commands" msgstr "" -#: ../../library/pdb.rst:235 +#: ../../library/pdb.rst:243 msgid "" "The commands recognized by the debugger are listed below. Most commands can " "be abbreviated to one or two letters as indicated; e.g. ``h(elp)`` means " @@ -338,13 +350,13 @@ msgid "" "are separated by a vertical bar (``|``)." msgstr "" -#: ../../library/pdb.rst:244 +#: ../../library/pdb.rst:252 msgid "" "Entering a blank line repeats the last command entered. Exception: if the " "last command was a :pdbcmd:`list` command, the next 11 lines are listed." msgstr "" -#: ../../library/pdb.rst:247 +#: ../../library/pdb.rst:255 msgid "" "Commands that the debugger doesn't recognize are assumed to be Python " "statements and are executed in the context of the program being debugged. " @@ -355,14 +367,20 @@ msgid "" "is not changed." msgstr "" -#: ../../library/pdb.rst:255 +#: ../../library/pdb.rst:263 +msgid "" +"Expressions/Statements whose prefix is a pdb command are now correctly " +"identified and executed." +msgstr "" + +#: ../../library/pdb.rst:267 msgid "" "The debugger supports :ref:`aliases `. Aliases can have " "parameters which allows one a certain level of adaptability to the context " "under examination." msgstr "" -#: ../../library/pdb.rst:259 +#: ../../library/pdb.rst:271 msgid "" "Multiple commands may be entered on a single line, separated by ``;;``. (A " "single ``;`` is not used as it is the separator for multiple commands in a " @@ -373,7 +391,7 @@ msgid "" "\"\";\"``." msgstr "" -#: ../../library/pdb.rst:266 +#: ../../library/pdb.rst:278 msgid "" "To set a temporary global variable, use a *convenience variable*. A " "*convenience variable* is a variable whose name starts with ``$``. For " @@ -383,27 +401,27 @@ msgid "" "compared to using normal variables like ``foo = 1``." msgstr "" -#: ../../library/pdb.rst:273 +#: ../../library/pdb.rst:285 msgid "There are three preset *convenience variables*:" msgstr "" -#: ../../library/pdb.rst:275 +#: ../../library/pdb.rst:287 msgid "``$_frame``: the current frame you are debugging" msgstr "" -#: ../../library/pdb.rst:276 +#: ../../library/pdb.rst:288 msgid "``$_retval``: the return value if the frame is returning" msgstr "" -#: ../../library/pdb.rst:277 +#: ../../library/pdb.rst:289 msgid "``$_exception``: the exception if the frame is raising an exception" msgstr "" -#: ../../library/pdb.rst:281 +#: ../../library/pdb.rst:293 msgid "Added the *convenience variable* feature." msgstr "" -#: ../../library/pdb.rst:287 +#: ../../library/pdb.rst:299 msgid "" "If a file :file:`.pdbrc` exists in the user's home directory or in the " "current directory, it is read with ``'utf-8'`` encoding and executed as if " @@ -413,20 +431,20 @@ msgid "" "read first and aliases defined there can be overridden by the local file." msgstr "" -#: ../../library/pdb.rst:294 +#: ../../library/pdb.rst:306 msgid "" ":file:`.pdbrc` can now contain commands that continue debugging, such as :" "pdbcmd:`continue` or :pdbcmd:`next`. Previously, these commands had no " "effect." msgstr "" -#: ../../library/pdb.rst:299 +#: ../../library/pdb.rst:311 msgid "" ":file:`.pdbrc` is now read with ``'utf-8'`` encoding. Previously, it was " "read with the system locale encoding." msgstr "" -#: ../../library/pdb.rst:306 +#: ../../library/pdb.rst:318 msgid "" "Without argument, print the list of available commands. With a *command* as " "argument, print help about that command. ``help pdb`` displays the full " @@ -435,63 +453,75 @@ msgid "" "the ``!`` command." msgstr "" -#: ../../library/pdb.rst:314 +#: ../../library/pdb.rst:326 msgid "" "Print a stack trace, with the most recent frame at the bottom. An arrow " "(``>``) indicates the current frame, which determines the context of most " "commands." msgstr "" -#: ../../library/pdb.rst:319 +#: ../../library/pdb.rst:331 msgid "" "Move the current frame *count* (default one) levels down in the stack trace " "(to a newer frame)." msgstr "" -#: ../../library/pdb.rst:324 +#: ../../library/pdb.rst:336 msgid "" "Move the current frame *count* (default one) levels up in the stack trace " "(to an older frame)." msgstr "" -#: ../../library/pdb.rst:329 +#: ../../library/pdb.rst:341 msgid "" -"With a *lineno* argument, set a break there in the current file. With a " -"*function* argument, set a break at the first executable statement within " -"that function. The line number may be prefixed with a filename and a colon, " -"to specify a breakpoint in another file (probably one that hasn't been " -"loaded yet). The file is searched on :data:`sys.path`. Note that each " -"breakpoint is assigned a number to which all the other breakpoint commands " -"refer." +"With a *lineno* argument, set a break at line *lineno* in the current file. " +"The line number may be prefixed with a *filename* and a colon, to specify a " +"breakpoint in another file (possibly one that hasn't been loaded yet). The " +"file is searched on :data:`sys.path`. Accepatable forms of *filename* are " +"``/abspath/to/file.py``, ``relpath/file.py``, ``module`` and ``package." +"module``." msgstr "" -#: ../../library/pdb.rst:336 +#: ../../library/pdb.rst:348 +msgid "" +"With a *function* argument, set a break at the first executable statement " +"within that function. *function* can be any expression that evaluates to a " +"function in the current namespace." +msgstr "" + +#: ../../library/pdb.rst:352 msgid "" "If a second argument is present, it is an expression which must evaluate to " "true before the breakpoint is honored." msgstr "" -#: ../../library/pdb.rst:339 +#: ../../library/pdb.rst:355 msgid "" "Without argument, list all breaks, including for each breakpoint, the number " "of times that breakpoint has been hit, the current ignore count, and the " "associated condition if any." msgstr "" -#: ../../library/pdb.rst:345 +#: ../../library/pdb.rst:359 +msgid "" +"Each breakpoint is assigned a number to which all the other breakpoint " +"commands refer." +msgstr "" + +#: ../../library/pdb.rst:364 msgid "" "Temporary breakpoint, which is removed automatically when it is first hit. " "The arguments are the same as for :pdbcmd:`break`." msgstr "" -#: ../../library/pdb.rst:350 +#: ../../library/pdb.rst:369 msgid "" "With a *filename:lineno* argument, clear all the breakpoints at this line. " "With a space separated list of breakpoint numbers, clear those breakpoints. " "Without argument, clear all breaks (but first ask confirmation)." msgstr "" -#: ../../library/pdb.rst:356 +#: ../../library/pdb.rst:375 msgid "" "Disable the breakpoints given as a space separated list of breakpoint " "numbers. Disabling a breakpoint means it cannot cause the program to stop " @@ -499,11 +529,11 @@ msgid "" "breakpoints and can be (re-)enabled." msgstr "" -#: ../../library/pdb.rst:363 +#: ../../library/pdb.rst:382 msgid "Enable the breakpoints specified." msgstr "" -#: ../../library/pdb.rst:367 +#: ../../library/pdb.rst:386 msgid "" "Set the ignore count for the given breakpoint number. If *count* is " "omitted, the ignore count is set to 0. A breakpoint becomes active when the " @@ -512,21 +542,21 @@ msgid "" "associated condition evaluates to true." msgstr "" -#: ../../library/pdb.rst:375 +#: ../../library/pdb.rst:394 msgid "" "Set a new *condition* for the breakpoint, an expression which must evaluate " "to true before the breakpoint is honored. If *condition* is absent, any " "existing condition is removed; i.e., the breakpoint is made unconditional." msgstr "" -#: ../../library/pdb.rst:381 +#: ../../library/pdb.rst:400 msgid "" "Specify a list of commands for breakpoint number *bpnumber*. The commands " "themselves appear on the following lines. Type a line containing just " "``end`` to terminate the commands. An example::" msgstr "" -#: ../../library/pdb.rst:385 +#: ../../library/pdb.rst:404 msgid "" "(Pdb) commands 1\n" "(com) p some_variable\n" @@ -534,25 +564,25 @@ msgid "" "(Pdb)" msgstr "" -#: ../../library/pdb.rst:390 +#: ../../library/pdb.rst:409 msgid "" "To remove all commands from a breakpoint, type ``commands`` and follow it " "immediately with ``end``; that is, give no commands." msgstr "" -#: ../../library/pdb.rst:393 +#: ../../library/pdb.rst:412 msgid "" "With no *bpnumber* argument, ``commands`` refers to the last breakpoint set." msgstr "" -#: ../../library/pdb.rst:395 +#: ../../library/pdb.rst:414 msgid "" "You can use breakpoint commands to start your program up again. Simply use " "the :pdbcmd:`continue` command, or :pdbcmd:`step`, or any other command that " "resumes execution." msgstr "" -#: ../../library/pdb.rst:399 +#: ../../library/pdb.rst:418 msgid "" "Specifying any command resuming execution (currently :pdbcmd:`continue`, :" "pdbcmd:`step`, :pdbcmd:`next`, :pdbcmd:`return`, :pdbcmd:`jump`, :pdbcmd:" @@ -563,7 +593,7 @@ msgid "" "ambiguities about which list to execute." msgstr "" -#: ../../library/pdb.rst:408 +#: ../../library/pdb.rst:427 msgid "" "If you use the ``silent`` command in the command list, the usual message " "about stopping at a breakpoint is not printed. This may be desirable for " @@ -572,13 +602,13 @@ msgid "" "was reached." msgstr "" -#: ../../library/pdb.rst:415 +#: ../../library/pdb.rst:434 msgid "" "Execute the current line, stop at the first possible occasion (either in a " "function that is called or on the next line in the current function)." msgstr "" -#: ../../library/pdb.rst:420 +#: ../../library/pdb.rst:439 msgid "" "Continue execution until the next line in the current function is reached or " "it returns. (The difference between :pdbcmd:`next` and :pdbcmd:`step` is " @@ -587,46 +617,46 @@ msgid "" "line in the current function.)" msgstr "" -#: ../../library/pdb.rst:428 +#: ../../library/pdb.rst:447 msgid "" "Without argument, continue execution until the line with a number greater " "than the current one is reached." msgstr "" -#: ../../library/pdb.rst:431 +#: ../../library/pdb.rst:450 msgid "" "With *lineno*, continue execution until a line with a number greater or " "equal to *lineno* is reached. In both cases, also stop when the current " "frame returns." msgstr "" -#: ../../library/pdb.rst:435 +#: ../../library/pdb.rst:454 msgid "Allow giving an explicit line number." msgstr "" -#: ../../library/pdb.rst:440 +#: ../../library/pdb.rst:459 msgid "Continue execution until the current function returns." msgstr "" -#: ../../library/pdb.rst:444 +#: ../../library/pdb.rst:463 msgid "Continue execution, only stop when a breakpoint is encountered." msgstr "" -#: ../../library/pdb.rst:448 +#: ../../library/pdb.rst:467 msgid "" "Set the next line that will be executed. Only available in the bottom-most " "frame. This lets you jump back and execute code again, or jump forward to " "skip code that you don't want to run." msgstr "" -#: ../../library/pdb.rst:452 +#: ../../library/pdb.rst:471 msgid "" "It should be noted that not all jumps are allowed -- for instance it is not " "possible to jump into the middle of a :keyword:`for` loop or out of a :" "keyword:`finally` clause." msgstr "" -#: ../../library/pdb.rst:458 +#: ../../library/pdb.rst:477 msgid "" "List source code for the current file. Without arguments, list 11 lines " "around the current line or continue the previous listing. With ``.`` as " @@ -635,7 +665,7 @@ msgid "" "second argument is less than the first, it is interpreted as a count." msgstr "" -#: ../../library/pdb.rst:464 +#: ../../library/pdb.rst:483 msgid "" "The current line in the current frame is indicated by ``->``. If an " "exception is being debugged, the line where the exception was originally " @@ -643,67 +673,67 @@ msgid "" "line." msgstr "" -#: ../../library/pdb.rst:469 +#: ../../library/pdb.rst:488 msgid "Added the ``>>`` marker." msgstr "" -#: ../../library/pdb.rst:474 +#: ../../library/pdb.rst:493 msgid "" "List all source code for the current function or frame. Interesting lines " "are marked as for :pdbcmd:`list`." msgstr "" -#: ../../library/pdb.rst:481 +#: ../../library/pdb.rst:500 msgid "Print the arguments of the current function and their current values." msgstr "" -#: ../../library/pdb.rst:485 +#: ../../library/pdb.rst:504 msgid "Evaluate *expression* in the current context and print its value." msgstr "" -#: ../../library/pdb.rst:489 +#: ../../library/pdb.rst:508 msgid "" "``print()`` can also be used, but is not a debugger command --- this " "executes the Python :func:`print` function." msgstr "" -#: ../../library/pdb.rst:495 +#: ../../library/pdb.rst:514 msgid "" "Like the :pdbcmd:`p` command, except the value of *expression* is pretty-" "printed using the :mod:`pprint` module." msgstr "" -#: ../../library/pdb.rst:500 +#: ../../library/pdb.rst:519 msgid "Print the type of *expression*." msgstr "" -#: ../../library/pdb.rst:504 +#: ../../library/pdb.rst:523 msgid "Try to get source code of *expression* and display it." msgstr "" -#: ../../library/pdb.rst:510 +#: ../../library/pdb.rst:529 msgid "" "Display the value of *expression* if it changed, each time execution stops " "in the current frame." msgstr "" -#: ../../library/pdb.rst:513 +#: ../../library/pdb.rst:532 msgid "" "Without *expression*, list all display expressions for the current frame." msgstr "" -#: ../../library/pdb.rst:517 +#: ../../library/pdb.rst:536 msgid "" "Display evaluates *expression* and compares to the result of the previous " "evaluation of *expression*, so when the result is mutable, display may not " "be able to pick up the changes." msgstr "" -#: ../../library/pdb.rst:521 +#: ../../library/pdb.rst:540 ../../library/pdb.rst:690 msgid "Example::" msgstr "範例: ::" -#: ../../library/pdb.rst:523 +#: ../../library/pdb.rst:542 msgid "" "lst = []\n" "breakpoint()\n" @@ -712,13 +742,13 @@ msgid "" "print(lst)" msgstr "" -#: ../../library/pdb.rst:529 +#: ../../library/pdb.rst:548 msgid "" "Display won't realize ``lst`` has been changed because the result of " "evaluation is modified in place by ``lst.append(1)`` before being compared::" msgstr "" -#: ../../library/pdb.rst:532 +#: ../../library/pdb.rst:551 msgid "" "> example.py(3)()\n" "-> pass\n" @@ -733,11 +763,11 @@ msgid "" "(Pdb)" msgstr "" -#: ../../library/pdb.rst:544 +#: ../../library/pdb.rst:563 msgid "You can do some tricks with copy mechanism to make it work::" msgstr "" -#: ../../library/pdb.rst:546 +#: ../../library/pdb.rst:565 msgid "" "> example.py(3)()\n" "-> pass\n" @@ -753,29 +783,49 @@ msgid "" "(Pdb)" msgstr "" -#: ../../library/pdb.rst:563 +#: ../../library/pdb.rst:582 msgid "" "Do not display *expression* anymore in the current frame. Without " "*expression*, clear all display expressions for the current frame." msgstr "" -#: ../../library/pdb.rst:570 +#: ../../library/pdb.rst:589 +msgid "" +"Start an interactive interpreter (using the :mod:`code` module) in a new " +"global namespace initialised from the local and global namespaces for the " +"current scope. Use ``exit()`` or ``quit()`` to exit the interpreter and " +"return to the debugger." +msgstr "" + +#: ../../library/pdb.rst:596 +msgid "" +"As ``interact`` creates a new dedicated namespace for code execution, " +"assignments to variables will not affect the original namespaces. However, " +"modifications to any referenced mutable objects will be reflected in the " +"original namespaces as usual." +msgstr "" + +#: ../../library/pdb.rst:603 +msgid "" +"``exit()`` and ``quit()`` can be used to exit the :pdbcmd:`interact` command." +msgstr "" + +#: ../../library/pdb.rst:607 msgid "" -"Start an interactive interpreter (using the :mod:`code` module) whose global " -"namespace contains all the (global and local) names found in the current " -"scope." +":pdbcmd:`interact` directs its output to the debugger's output channel " +"rather than :data:`sys.stderr`." msgstr "" -#: ../../library/pdb.rst:580 +#: ../../library/pdb.rst:615 msgid "" "Create an alias called *name* that executes *command*. The *command* must " "*not* be enclosed in quotes. Replaceable parameters can be indicated by " -"``%1``, ``%2``, and so on, while ``%*`` is replaced by all the parameters. " -"If *command* is omitted, the current alias for *name* is shown. If no " -"arguments are given, all aliases are listed." +"``%1``, ``%2``, ... and ``%9``, while ``%*`` is replaced by all the " +"parameters. If *command* is omitted, the current alias for *name* is shown. " +"If no arguments are given, all aliases are listed." msgstr "" -#: ../../library/pdb.rst:586 +#: ../../library/pdb.rst:621 msgid "" "Aliases may be nested and can contain anything that can be legally typed at " "the pdb prompt. Note that internal pdb commands *can* be overridden by " @@ -784,13 +834,13 @@ msgid "" "other words in the line are left alone." msgstr "" -#: ../../library/pdb.rst:592 +#: ../../library/pdb.rst:627 msgid "" "As an example, here are two useful aliases (especially when placed in the :" "file:`.pdbrc` file)::" msgstr "" -#: ../../library/pdb.rst:595 +#: ../../library/pdb.rst:630 msgid "" "# Print instance variables (usage \"pi classInst\")\n" "alias pi for k in %1.__dict__.keys(): print(f\"%1.{k} = {%1.__dict__[k]}\")\n" @@ -798,36 +848,36 @@ msgid "" "alias ps pi self" msgstr "" -#: ../../library/pdb.rst:602 +#: ../../library/pdb.rst:637 msgid "Delete the specified alias *name*." msgstr "" -#: ../../library/pdb.rst:606 +#: ../../library/pdb.rst:641 msgid "" "Execute the (one-line) *statement* in the context of the current stack " "frame. The exclamation point can be omitted unless the first word of the " "statement resembles a debugger command, e.g.:" msgstr "" -#: ../../library/pdb.rst:610 +#: ../../library/pdb.rst:645 msgid "" "(Pdb) ! n=42\n" "(Pdb)" msgstr "" -#: ../../library/pdb.rst:615 +#: ../../library/pdb.rst:650 msgid "" "To set a global variable, you can prefix the assignment command with a :" "keyword:`global` statement on the same line, e.g.:" msgstr "" -#: ../../library/pdb.rst:618 +#: ../../library/pdb.rst:653 msgid "" "(Pdb) global list_options; list_options = ['-l']\n" "(Pdb)" msgstr "" -#: ../../library/pdb.rst:626 +#: ../../library/pdb.rst:661 msgid "" "Restart the debugged Python program. If *args* is supplied, it is split " "with :mod:`shlex` and the result is used as the new :data:`sys.argv`. " @@ -835,25 +885,80 @@ msgid "" "`restart` is an alias for :pdbcmd:`run`." msgstr "" -#: ../../library/pdb.rst:633 +#: ../../library/pdb.rst:668 msgid "Quit from the debugger. The program being executed is aborted." msgstr "" -#: ../../library/pdb.rst:637 +#: ../../library/pdb.rst:672 msgid "" "Enter a recursive debugger that steps through *code* (which is an arbitrary " "expression or statement to be executed in the current environment)." msgstr "" -#: ../../library/pdb.rst:643 +#: ../../library/pdb.rst:678 msgid "Print the return value for the last return of the current function." msgstr "" -#: ../../library/pdb.rst:646 +#: ../../library/pdb.rst:682 +msgid "List or jump between chained exceptions." +msgstr "" + +#: ../../library/pdb.rst:684 +msgid "" +"When using ``pdb.pm()`` or ``Pdb.post_mortem(...)`` with a chained " +"exception instead of a traceback, it allows the user to move between the " +"chained exceptions using ``exceptions`` command to list exceptions, and " +"``exception `` to switch to that exception." +msgstr "" + +#: ../../library/pdb.rst:692 +msgid "" +"def out():\n" +" try:\n" +" middle()\n" +" except Exception as e:\n" +" raise ValueError(\"reraise middle() error\") from e\n" +"\n" +"def middle():\n" +" try:\n" +" return inner(0)\n" +" except Exception as e:\n" +" raise ValueError(\"Middle fail\")\n" +"\n" +"def inner(x):\n" +" 1 / x\n" +"\n" +" out()" +msgstr "" + +#: ../../library/pdb.rst:709 +msgid "calling ``pdb.pm()`` will allow to move between exceptions::" +msgstr "" + +#: ../../library/pdb.rst:711 +msgid "" +"> example.py(5)out()\n" +"-> raise ValueError(\"reraise middle() error\") from e\n" +"\n" +"(Pdb) exceptions\n" +" 0 ZeroDivisionError('division by zero')\n" +" 1 ValueError('Middle fail')\n" +"> 2 ValueError('reraise middle() error')\n" +"\n" +"(Pdb) exceptions 0\n" +"> example.py(16)inner()\n" +"-> 1 / x\n" +"\n" +"(Pdb) up\n" +"> example.py(10)middle()\n" +"-> return inner(0)" +msgstr "" + +#: ../../library/pdb.rst:730 msgid "Footnotes" msgstr "註解" -#: ../../library/pdb.rst:647 +#: ../../library/pdb.rst:731 msgid "" "Whether a frame is considered to originate in a certain module is determined " "by the ``__name__`` in the frame globals." @@ -879,18 +984,18 @@ msgstr "bdb" msgid "cmd" msgstr "cmd" -#: ../../library/pdb.rst:283 +#: ../../library/pdb.rst:295 msgid ".pdbrc" msgstr ".pdbrc" -#: ../../library/pdb.rst:283 +#: ../../library/pdb.rst:295 msgid "file" msgstr "file(檔案)" -#: ../../library/pdb.rst:283 +#: ../../library/pdb.rst:295 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/pdb.rst:283 +#: ../../library/pdb.rst:295 msgid "configuration" msgstr "configuration(設定)" diff --git a/library/persistence.po b/library/persistence.po index 9e69ecf5d2..b655269a25 100644 --- a/library/persistence.po +++ b/library/persistence.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/pickle.po b/library/pickle.po index ba40da6e5c..c512db8eb2 100644 --- a/library/pickle.po +++ b/library/pickle.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -179,9 +179,8 @@ msgstr "" msgid "" "The data format used by :mod:`pickle` is Python-specific. This has the " "advantage that there are no restrictions imposed by external standards such " -"as JSON or XDR (which can't represent pointer sharing); however it means " -"that non-Python programs may not be able to reconstruct pickled Python " -"objects." +"as JSON (which can't represent pointer sharing); however it means that non-" +"Python programs may not be able to reconstruct pickled Python objects." msgstr "" #: ../../library/pickle.rst:131 @@ -356,7 +355,7 @@ msgid "" msgstr "" #: ../../library/pickle.rst:252 ../../library/pickle.rst:267 -#: ../../library/pickle.rst:429 +#: ../../library/pickle.rst:433 msgid "The *buffers* argument was added." msgstr "新增 *buffer* 引數。" @@ -479,11 +478,17 @@ msgid "" "by :meth:`persistent_id` cannot itself have a persistent ID." msgstr "" -#: ../../library/pickle.rst:346 ../../library/pickle.rst:447 +#: ../../library/pickle.rst:346 ../../library/pickle.rst:451 msgid "See :ref:`pickle-persistent` for details and examples of uses." msgstr "關於細節與用法範例請見 :ref:`pickle-persistent`。" -#: ../../library/pickle.rst:350 +#: ../../library/pickle.rst:348 +msgid "" +"Add the default implementation of this method in the C implementation of :" +"class:`!Pickler`." +msgstr "" + +#: ../../library/pickle.rst:354 msgid "" "A pickler object's dispatch table is a registry of *reduction functions* of " "the kind which can be declared using :func:`copyreg.pickle`. It is a " @@ -492,7 +497,7 @@ msgid "" "should conform to the same interface as a :meth:`~object.__reduce__` method." msgstr "" -#: ../../library/pickle.rst:358 +#: ../../library/pickle.rst:362 msgid "" "By default, a pickler object will not have a :attr:`dispatch_table` " "attribute, and it will instead use the global dispatch table managed by the :" @@ -503,11 +508,11 @@ msgid "" "table for instances of that class." msgstr "" -#: ../../library/pickle.rst:367 +#: ../../library/pickle.rst:371 msgid "See :ref:`pickle-dispatch` for usage examples." msgstr "關於用法範例請見 :ref:`pickle-dispatch`。" -#: ../../library/pickle.rst:373 +#: ../../library/pickle.rst:377 msgid "" "Special reducer that can be defined in :class:`Pickler` subclasses. This " "method has priority over any reducer in the :attr:`dispatch_table`. It " @@ -516,11 +521,11 @@ msgid "" "`dispatch_table`-registered reducers to pickle ``obj``." msgstr "" -#: ../../library/pickle.rst:379 +#: ../../library/pickle.rst:383 msgid "For a detailed example, see :ref:`reducer_override`." msgstr "" -#: ../../library/pickle.rst:385 +#: ../../library/pickle.rst:389 msgid "" "Deprecated. Enable fast mode if set to a true value. The fast mode disables " "the usage of memo, therefore speeding the pickling process by not generating " @@ -528,21 +533,21 @@ msgid "" "objects, doing otherwise will cause :class:`Pickler` to recurse infinitely." msgstr "" -#: ../../library/pickle.rst:391 +#: ../../library/pickle.rst:395 msgid "Use :func:`pickletools.optimize` if you need more compact pickles." msgstr "" -#: ../../library/pickle.rst:396 +#: ../../library/pickle.rst:400 msgid "This takes a binary file for reading a pickle data stream." msgstr "" -#: ../../library/pickle.rst:398 +#: ../../library/pickle.rst:402 msgid "" "The protocol version of the pickle is detected automatically, so no protocol " "argument is needed." msgstr "" -#: ../../library/pickle.rst:401 +#: ../../library/pickle.rst:405 msgid "" "The argument *file* must have three methods, a read() method that takes an " "integer argument, a readinto() method that takes a buffer argument and a " @@ -552,7 +557,7 @@ msgid "" "that meets this interface." msgstr "" -#: ../../library/pickle.rst:408 +#: ../../library/pickle.rst:412 msgid "" "The optional arguments *fix_imports*, *encoding* and *errors* are used to " "control compatibility support for pickle stream generated by Python 2. If " @@ -566,7 +571,7 @@ msgid "" "Python 2." msgstr "" -#: ../../library/pickle.rst:419 +#: ../../library/pickle.rst:423 msgid "" "If *buffers* is ``None`` (the default), then all data necessary for " "deserialization must be contained in the pickle stream. This means that the " @@ -574,7 +579,7 @@ msgid "" "instantiated (or when :func:`dump` or :func:`dumps` was called)." msgstr "" -#: ../../library/pickle.rst:424 +#: ../../library/pickle.rst:428 msgid "" "If *buffers* is not ``None``, it should be an iterable of buffer-enabled " "objects that is consumed each time the pickle stream references an :ref:`out-" @@ -582,25 +587,31 @@ msgid "" "the *buffer_callback* of a Pickler object." msgstr "" -#: ../../library/pickle.rst:434 +#: ../../library/pickle.rst:438 msgid "" "Read the pickled representation of an object from the open file object given " "in the constructor, and return the reconstituted object hierarchy specified " "therein. Bytes past the pickled representation of the object are ignored." msgstr "" -#: ../../library/pickle.rst:441 +#: ../../library/pickle.rst:445 msgid "Raise an :exc:`UnpicklingError` by default." msgstr "" -#: ../../library/pickle.rst:443 +#: ../../library/pickle.rst:447 msgid "" "If defined, :meth:`persistent_load` should return the object specified by " "the persistent ID *pid*. If an invalid persistent ID is encountered, an :" "exc:`UnpicklingError` should be raised." msgstr "" -#: ../../library/pickle.rst:451 +#: ../../library/pickle.rst:453 +msgid "" +"Add the default implementation of this method in the C implementation of :" +"class:`!Unpickler`." +msgstr "" + +#: ../../library/pickle.rst:459 msgid "" "Import *module* if necessary and return the object called *name* from it, " "where the *module* and *name* arguments are :class:`str` objects. Note, " @@ -608,14 +619,14 @@ msgid "" "functions." msgstr "" -#: ../../library/pickle.rst:456 +#: ../../library/pickle.rst:464 msgid "" "Subclasses may override this to gain control over what type of objects and " "how they can be loaded, potentially reducing security risks. Refer to :ref:" "`pickle-restrict` for details." msgstr "" -#: ../../library/pickle.rst:460 +#: ../../library/pickle.rst:468 msgid "" "Raises an :ref:`auditing event ` ``pickle.find_class`` with " "arguments ``module``, ``name``." @@ -623,28 +634,28 @@ msgstr "" "引發一個附帶引數 ``module``、``name`` 的\\ :ref:`稽核事件 ` " "``pickle.find_class``。" -#: ../../library/pickle.rst:464 +#: ../../library/pickle.rst:472 msgid "" "A wrapper for a buffer representing picklable data. *buffer* must be a :ref:" "`buffer-providing ` object, such as a :term:`bytes-like " "object` or a N-dimensional array." msgstr "" -#: ../../library/pickle.rst:468 +#: ../../library/pickle.rst:476 msgid "" ":class:`PickleBuffer` is itself a buffer provider, therefore it is possible " "to pass it to other APIs expecting a buffer-providing object, such as :class:" "`memoryview`." msgstr "" -#: ../../library/pickle.rst:472 +#: ../../library/pickle.rst:480 msgid "" ":class:`PickleBuffer` objects can only be serialized using pickle protocol 5 " "or higher. They are eligible for :ref:`out-of-band serialization `." msgstr "" -#: ../../library/pickle.rst:480 +#: ../../library/pickle.rst:488 msgid "" "Return a :class:`memoryview` of the memory area underlying this buffer. The " "returned object is a one-dimensional, C-contiguous memoryview with format " @@ -652,54 +663,54 @@ msgid "" "neither C- nor Fortran-contiguous." msgstr "" -#: ../../library/pickle.rst:487 +#: ../../library/pickle.rst:495 msgid "Release the underlying buffer exposed by the PickleBuffer object." msgstr "" -#: ../../library/pickle.rst:493 +#: ../../library/pickle.rst:501 msgid "What can be pickled and unpickled?" msgstr "" -#: ../../library/pickle.rst:495 +#: ../../library/pickle.rst:503 msgid "The following types can be pickled:" msgstr "" -#: ../../library/pickle.rst:497 +#: ../../library/pickle.rst:505 msgid "" "built-in constants (``None``, ``True``, ``False``, ``Ellipsis``, and :data:" "`NotImplemented`);" msgstr "" -#: ../../library/pickle.rst:500 +#: ../../library/pickle.rst:508 msgid "integers, floating-point numbers, complex numbers;" msgstr "" -#: ../../library/pickle.rst:502 +#: ../../library/pickle.rst:510 msgid "strings, bytes, bytearrays;" msgstr "" -#: ../../library/pickle.rst:504 +#: ../../library/pickle.rst:512 msgid "" "tuples, lists, sets, and dictionaries containing only picklable objects;" msgstr "" -#: ../../library/pickle.rst:506 +#: ../../library/pickle.rst:514 msgid "" "functions (built-in and user-defined) accessible from the top level of a " "module (using :keyword:`def`, not :keyword:`lambda`);" msgstr "" -#: ../../library/pickle.rst:509 +#: ../../library/pickle.rst:517 msgid "classes accessible from the top level of a module;" msgstr "" -#: ../../library/pickle.rst:511 +#: ../../library/pickle.rst:519 msgid "" "instances of such classes whose the result of calling :meth:`~object." "__getstate__` is picklable (see section :ref:`pickle-inst` for details)." msgstr "" -#: ../../library/pickle.rst:514 +#: ../../library/pickle.rst:522 msgid "" "Attempts to pickle unpicklable objects will raise the :exc:`PicklingError` " "exception; when this happens, an unspecified number of bytes may have " @@ -709,7 +720,7 @@ msgid "" "limit with :func:`sys.setrecursionlimit`." msgstr "" -#: ../../library/pickle.rst:521 +#: ../../library/pickle.rst:529 msgid "" "Note that functions (built-in and user-defined) are pickled by fully :term:" "`qualified name`, not by value. [#]_ This means that only the function name " @@ -720,7 +731,7 @@ msgid "" "exception will be raised. [#]_" msgstr "" -#: ../../library/pickle.rst:528 +#: ../../library/pickle.rst:536 msgid "" "Similarly, classes are pickled by fully qualified name, so the same " "restrictions in the unpickling environment apply. Note that none of the " @@ -728,7 +739,7 @@ msgid "" "attribute ``attr`` is not restored in the unpickling environment::" msgstr "" -#: ../../library/pickle.rst:533 +#: ../../library/pickle.rst:541 msgid "" "class Foo:\n" " attr = 'A class attribute'\n" @@ -740,13 +751,13 @@ msgstr "" "\n" "picklestring = pickle.dumps(Foo)" -#: ../../library/pickle.rst:538 +#: ../../library/pickle.rst:546 msgid "" "These restrictions are why picklable functions and classes must be defined " "at the top level of a module." msgstr "" -#: ../../library/pickle.rst:541 +#: ../../library/pickle.rst:549 msgid "" "Similarly, when class instances are pickled, their class's code and data are " "not pickled along with them. Only the instance data are pickled. This is " @@ -758,17 +769,17 @@ msgid "" "__setstate__` method." msgstr "" -#: ../../library/pickle.rst:553 +#: ../../library/pickle.rst:561 msgid "Pickling Class Instances" msgstr "" -#: ../../library/pickle.rst:557 +#: ../../library/pickle.rst:565 msgid "" "In this section, we describe the general mechanisms available to you to " "define, customize, and control how class instances are pickled and unpickled." msgstr "" -#: ../../library/pickle.rst:560 +#: ../../library/pickle.rst:568 msgid "" "In most cases, no additional code is needed to make instances picklable. By " "default, pickle will retrieve the class and the attributes of an instance " @@ -778,7 +789,7 @@ msgid "" "The following code shows an implementation of this behaviour::" msgstr "" -#: ../../library/pickle.rst:567 +#: ../../library/pickle.rst:575 msgid "" "def save(obj):\n" " return (obj.__class__, obj.__dict__)\n" @@ -796,13 +807,13 @@ msgstr "" " obj.__dict__.update(attributes)\n" " return obj" -#: ../../library/pickle.rst:575 +#: ../../library/pickle.rst:583 msgid "" "Classes can alter the default behaviour by providing one or several special " "methods:" msgstr "" -#: ../../library/pickle.rst:580 +#: ../../library/pickle.rst:588 msgid "" "In protocols 2 and newer, classes that implements the :meth:" "`__getnewargs_ex__` method can dictate the values passed to the :meth:" @@ -812,37 +823,37 @@ msgid "" "passed to the :meth:`__new__` method upon unpickling." msgstr "" -#: ../../library/pickle.rst:588 +#: ../../library/pickle.rst:596 msgid "" "You should implement this method if the :meth:`__new__` method of your class " "requires keyword-only arguments. Otherwise, it is recommended for " "compatibility to implement :meth:`__getnewargs__`." msgstr "" -#: ../../library/pickle.rst:592 +#: ../../library/pickle.rst:600 msgid ":meth:`__getnewargs_ex__` is now used in protocols 2 and 3." msgstr "" -#: ../../library/pickle.rst:598 +#: ../../library/pickle.rst:606 msgid "" "This method serves a similar purpose as :meth:`__getnewargs_ex__`, but " "supports only positional arguments. It must return a tuple of arguments " "``args`` which will be passed to the :meth:`__new__` method upon unpickling." msgstr "" -#: ../../library/pickle.rst:602 +#: ../../library/pickle.rst:610 msgid "" ":meth:`__getnewargs__` will not be called if :meth:`__getnewargs_ex__` is " "defined." msgstr "" -#: ../../library/pickle.rst:605 +#: ../../library/pickle.rst:613 msgid "" "Before Python 3.6, :meth:`__getnewargs__` was called instead of :meth:" "`__getnewargs_ex__` in protocols 2 and 3." msgstr "" -#: ../../library/pickle.rst:612 +#: ../../library/pickle.rst:620 msgid "" "Classes can further influence how their instances are pickled by overriding " "the method :meth:`__getstate__`. It is called and the returned object is " @@ -850,19 +861,19 @@ msgid "" "are several cases:" msgstr "" -#: ../../library/pickle.rst:617 +#: ../../library/pickle.rst:625 msgid "" "For a class that has no instance :attr:`~object.__dict__` and no :attr:" "`~object.__slots__`, the default state is ``None``." msgstr "" -#: ../../library/pickle.rst:620 +#: ../../library/pickle.rst:628 msgid "" "For a class that has an instance :attr:`~object.__dict__` and no :attr:" "`~object.__slots__`, the default state is ``self.__dict__``." msgstr "" -#: ../../library/pickle.rst:623 +#: ../../library/pickle.rst:631 msgid "" "For a class that has an instance :attr:`~object.__dict__` and :attr:`~object." "__slots__`, the default state is a tuple consisting of two dictionaries: " @@ -870,7 +881,7 @@ msgid "" "slots that have a value are included in the latter." msgstr "" -#: ../../library/pickle.rst:629 +#: ../../library/pickle.rst:637 msgid "" "For a class that has :attr:`~object.__slots__` and no instance :attr:" "`~object.__dict__`, the default state is a tuple whose first item is " @@ -878,13 +889,13 @@ msgid "" "values described in the previous bullet." msgstr "" -#: ../../library/pickle.rst:634 +#: ../../library/pickle.rst:642 msgid "" "Added the default implementation of the ``__getstate__()`` method in the :" "class:`object` class." msgstr "" -#: ../../library/pickle.rst:641 +#: ../../library/pickle.rst:649 msgid "" "Upon unpickling, if the class defines :meth:`__setstate__`, it is called " "with the unpickled state. In that case, there is no requirement for the " @@ -892,20 +903,20 @@ msgid "" "dictionary and its items are assigned to the new instance's dictionary." msgstr "" -#: ../../library/pickle.rst:648 +#: ../../library/pickle.rst:656 msgid "" "If :meth:`__reduce__` returns a state with value ``None`` at pickling, the :" "meth:`__setstate__` method will not be called upon unpickling." msgstr "" -#: ../../library/pickle.rst:652 +#: ../../library/pickle.rst:660 msgid "" "Refer to the section :ref:`pickle-state` for more information about how to " "use the methods :meth:`~object.__getstate__` and :meth:`~object." "__setstate__`." msgstr "" -#: ../../library/pickle.rst:657 +#: ../../library/pickle.rst:665 msgid "" "At unpickling time, some methods like :meth:`~object.__getattr__`, :meth:" "`~object.__getattribute__`, or :meth:`~object.__setattr__` may be called " @@ -915,7 +926,7 @@ msgid "" "an instance." msgstr "" -#: ../../library/pickle.rst:666 +#: ../../library/pickle.rst:674 msgid "" "As we shall see, pickle does not use directly the methods described above. " "In fact, these methods are part of the copy protocol which implements the :" @@ -924,7 +935,7 @@ msgid "" "objects. [#]_" msgstr "" -#: ../../library/pickle.rst:672 +#: ../../library/pickle.rst:680 msgid "" "Although powerful, implementing :meth:`~object.__reduce__` directly in your " "classes is error prone. For this reason, class designers should use the " @@ -934,14 +945,14 @@ msgid "" "option or leads to more efficient pickling or both." msgstr "" -#: ../../library/pickle.rst:681 +#: ../../library/pickle.rst:689 msgid "" "The interface is currently defined as follows. The :meth:`__reduce__` " "method takes no argument and shall return either a string or preferably a " "tuple (the returned object is often referred to as the \"reduce value\")." msgstr "" -#: ../../library/pickle.rst:685 +#: ../../library/pickle.rst:693 msgid "" "If a string is returned, the string should be interpreted as the name of a " "global variable. It should be the object's local name relative to its " @@ -949,26 +960,26 @@ msgid "" "object's module. This behaviour is typically useful for singletons." msgstr "" -#: ../../library/pickle.rst:690 +#: ../../library/pickle.rst:698 msgid "" "When a tuple is returned, it must be between two and six items long. " "Optional items can either be omitted, or ``None`` can be provided as their " "value. The semantics of each item are in order:" msgstr "" -#: ../../library/pickle.rst:696 +#: ../../library/pickle.rst:704 msgid "" "A callable object that will be called to create the initial version of the " "object." msgstr "" -#: ../../library/pickle.rst:699 +#: ../../library/pickle.rst:707 msgid "" "A tuple of arguments for the callable object. An empty tuple must be given " "if the callable does not accept any argument." msgstr "" -#: ../../library/pickle.rst:702 +#: ../../library/pickle.rst:710 msgid "" "Optionally, the object's state, which will be passed to the object's :meth:" "`__setstate__` method as previously described. If the object has no such " @@ -976,7 +987,7 @@ msgid "" "object's :attr:`~object.__dict__` attribute." msgstr "" -#: ../../library/pickle.rst:707 +#: ../../library/pickle.rst:715 msgid "" "Optionally, an iterator (and not a sequence) yielding successive items. " "These items will be appended to the object either using ``obj.append(item)`` " @@ -988,7 +999,7 @@ msgid "" "append, so both must be supported.)" msgstr "" -#: ../../library/pickle.rst:717 +#: ../../library/pickle.rst:725 msgid "" "Optionally, an iterator (not a sequence) yielding successive key-value " "pairs. These items will be stored to the object using ``obj[key] = " @@ -996,7 +1007,7 @@ msgid "" "by other classes as long as they implement :meth:`__setitem__`." msgstr "" -#: ../../library/pickle.rst:722 +#: ../../library/pickle.rst:730 msgid "" "Optionally, a callable with a ``(obj, state)`` signature. This callable " "allows the user to programmatically control the state-updating behavior of a " @@ -1005,11 +1016,11 @@ msgid "" "meth:`__setstate__`." msgstr "" -#: ../../library/pickle.rst:728 +#: ../../library/pickle.rst:736 msgid "The optional sixth tuple item, ``(obj, state)``, was added." msgstr "" -#: ../../library/pickle.rst:734 +#: ../../library/pickle.rst:742 msgid "" "Alternatively, a :meth:`__reduce_ex__` method may be defined. The only " "difference is this method should take a single integer argument, the " @@ -1019,11 +1030,11 @@ msgid "" "provide backwards-compatible reduce values for older Python releases." msgstr "" -#: ../../library/pickle.rst:746 +#: ../../library/pickle.rst:754 msgid "Persistence of External Objects" msgstr "" -#: ../../library/pickle.rst:752 +#: ../../library/pickle.rst:760 msgid "" "For the benefit of object persistence, the :mod:`pickle` module supports the " "notion of a reference to an object outside the pickled data stream. Such " @@ -1032,7 +1043,7 @@ msgid "" "(for any newer protocol)." msgstr "" -#: ../../library/pickle.rst:758 +#: ../../library/pickle.rst:766 msgid "" "The resolution of such persistent IDs is not defined by the :mod:`pickle` " "module; it will delegate this resolution to the user-defined methods on the " @@ -1040,7 +1051,7 @@ msgid "" "persistent_load` respectively." msgstr "" -#: ../../library/pickle.rst:763 +#: ../../library/pickle.rst:771 msgid "" "To pickle objects that have an external persistent ID, the pickler must have " "a custom :meth:`~Pickler.persistent_id` method that takes an object as an " @@ -1051,20 +1062,20 @@ msgid "" "persistent ID." msgstr "" -#: ../../library/pickle.rst:770 +#: ../../library/pickle.rst:778 msgid "" "To unpickle external objects, the unpickler must have a custom :meth:" "`~Unpickler.persistent_load` method that takes a persistent ID object and " "returns the referenced object." msgstr "" -#: ../../library/pickle.rst:774 +#: ../../library/pickle.rst:782 msgid "" "Here is a comprehensive example presenting how persistent ID can be used to " "pickle external objects by reference." msgstr "" -#: ../../library/pickle.rst:777 +#: ../../library/pickle.rst:785 msgid "" "# Simple example presenting how persistent ID can be used to pickle\n" "# external objects by reference.\n" @@ -1162,29 +1173,29 @@ msgid "" " main()\n" msgstr "" -#: ../../library/pickle.rst:782 +#: ../../library/pickle.rst:790 msgid "Dispatch Tables" msgstr "" -#: ../../library/pickle.rst:784 +#: ../../library/pickle.rst:792 msgid "" "If one wants to customize pickling of some classes without disturbing any " "other code which depends on pickling, then one can create a pickler with a " "private dispatch table." msgstr "" -#: ../../library/pickle.rst:788 +#: ../../library/pickle.rst:796 msgid "" "The global dispatch table managed by the :mod:`copyreg` module is available " "as :data:`!copyreg.dispatch_table`. Therefore, one may choose to use a " "modified copy of :data:`!copyreg.dispatch_table` as a private dispatch table." msgstr "" -#: ../../library/pickle.rst:793 +#: ../../library/pickle.rst:801 msgid "For example ::" msgstr "舉例來說: ::" -#: ../../library/pickle.rst:795 +#: ../../library/pickle.rst:803 msgid "" "f = io.BytesIO()\n" "p = pickle.Pickler(f)\n" @@ -1196,13 +1207,13 @@ msgstr "" "p.dispatch_table = copyreg.dispatch_table.copy()\n" "p.dispatch_table[SomeClass] = reduce_SomeClass" -#: ../../library/pickle.rst:800 +#: ../../library/pickle.rst:808 msgid "" "creates an instance of :class:`pickle.Pickler` with a private dispatch table " "which handles the ``SomeClass`` class specially. Alternatively, the code ::" msgstr "" -#: ../../library/pickle.rst:804 +#: ../../library/pickle.rst:812 msgid "" "class MyPickler(pickle.Pickler):\n" " dispatch_table = copyreg.dispatch_table.copy()\n" @@ -1216,13 +1227,13 @@ msgstr "" "f = io.BytesIO()\n" "p = MyPickler(f)" -#: ../../library/pickle.rst:810 +#: ../../library/pickle.rst:818 msgid "" "does the same but all instances of ``MyPickler`` will by default share the " "private dispatch table. On the other hand, the code ::" msgstr "" -#: ../../library/pickle.rst:813 +#: ../../library/pickle.rst:821 msgid "" "copyreg.pickle(SomeClass, reduce_SomeClass)\n" "f = io.BytesIO()\n" @@ -1232,17 +1243,17 @@ msgstr "" "f = io.BytesIO()\n" "p = pickle.Pickler(f)" -#: ../../library/pickle.rst:817 +#: ../../library/pickle.rst:825 msgid "" "modifies the global dispatch table shared by all users of the :mod:`copyreg` " "module." msgstr "" -#: ../../library/pickle.rst:822 +#: ../../library/pickle.rst:830 msgid "Handling Stateful Objects" msgstr "" -#: ../../library/pickle.rst:828 +#: ../../library/pickle.rst:836 msgid "" "Here's an example that shows how to modify pickling behavior for a class. " "The :class:`!TextReader` class below opens a text file, and returns the line " @@ -1254,7 +1265,7 @@ msgid "" "behavior. ::" msgstr "" -#: ../../library/pickle.rst:836 +#: ../../library/pickle.rst:844 msgid "" "class TextReader:\n" " \"\"\"Print and number lines in a text file.\"\"\"\n" @@ -1294,11 +1305,11 @@ msgid "" " self.file = file" msgstr "" -#: ../../library/pickle.rst:874 +#: ../../library/pickle.rst:882 msgid "A sample usage might be something like this::" msgstr "" -#: ../../library/pickle.rst:876 +#: ../../library/pickle.rst:884 msgid "" ">>> reader = TextReader(\"hello.txt\")\n" ">>> reader.readline()\n" @@ -1318,11 +1329,11 @@ msgstr "" ">>> new_reader.readline()\n" "'3: Goodbye!'" -#: ../../library/pickle.rst:888 +#: ../../library/pickle.rst:896 msgid "Custom Reduction for Types, Functions, and Other Objects" msgstr "" -#: ../../library/pickle.rst:892 +#: ../../library/pickle.rst:900 msgid "" "Sometimes, :attr:`~Pickler.dispatch_table` may not be flexible enough. In " "particular we may want to customize pickling based on another criterion than " @@ -1330,7 +1341,7 @@ msgid "" "classes." msgstr "" -#: ../../library/pickle.rst:897 +#: ../../library/pickle.rst:905 msgid "" "For those cases, it is possible to subclass from the :class:`Pickler` class " "and implement a :meth:`~Pickler.reducer_override` method. This method can " @@ -1339,14 +1350,14 @@ msgid "" "behavior." msgstr "" -#: ../../library/pickle.rst:902 +#: ../../library/pickle.rst:910 msgid "" "If both the :attr:`~Pickler.dispatch_table` and :meth:`~Pickler." "reducer_override` are defined, then :meth:`~Pickler.reducer_override` method " "takes priority." msgstr "" -#: ../../library/pickle.rst:907 +#: ../../library/pickle.rst:915 msgid "" "For performance reasons, :meth:`~Pickler.reducer_override` may not be called " "for the following objects: ``None``, ``True``, ``False``, and exact " @@ -1355,13 +1366,13 @@ msgid "" "`tuple`." msgstr "" -#: ../../library/pickle.rst:913 +#: ../../library/pickle.rst:921 msgid "" "Here is a simple example where we allow pickling and reconstructing a given " "class::" msgstr "" -#: ../../library/pickle.rst:916 +#: ../../library/pickle.rst:924 msgid "" "import io\n" "import pickle\n" @@ -1392,11 +1403,11 @@ msgid "" "assert unpickled_class.my_attribute == 1" msgstr "" -#: ../../library/pickle.rst:948 +#: ../../library/pickle.rst:956 msgid "Out-of-band Buffers" msgstr "" -#: ../../library/pickle.rst:952 +#: ../../library/pickle.rst:960 msgid "" "In some contexts, the :mod:`pickle` module is used to transfer massive " "amounts of data. Therefore, it can be important to minimize the number of " @@ -1406,7 +1417,7 @@ msgid "" "involves copying data to and from the pickle stream." msgstr "" -#: ../../library/pickle.rst:959 +#: ../../library/pickle.rst:967 msgid "" "This constraint can be eschewed if both the *provider* (the implementation " "of the object types to be transferred) and the *consumer* (the " @@ -1414,11 +1425,11 @@ msgid "" "transfer facilities provided by pickle protocol 5 and higher." msgstr "" -#: ../../library/pickle.rst:965 +#: ../../library/pickle.rst:973 msgid "Provider API" msgstr "" -#: ../../library/pickle.rst:967 +#: ../../library/pickle.rst:975 msgid "" "The large data objects to be pickled must implement a :meth:`~object." "__reduce_ex__` method specialized for protocol 5 and higher, which returns " @@ -1426,7 +1437,7 @@ msgid "" "for any large data." msgstr "" -#: ../../library/pickle.rst:972 +#: ../../library/pickle.rst:980 msgid "" "A :class:`PickleBuffer` object *signals* that the underlying buffer is " "eligible for out-of-band data transfer. Those objects remain compatible " @@ -1435,17 +1446,17 @@ msgid "" "themselves." msgstr "" -#: ../../library/pickle.rst:979 +#: ../../library/pickle.rst:987 msgid "Consumer API" msgstr "" -#: ../../library/pickle.rst:981 +#: ../../library/pickle.rst:989 msgid "" "A communications system can enable custom handling of the :class:" "`PickleBuffer` objects generated when serializing an object graph." msgstr "" -#: ../../library/pickle.rst:984 +#: ../../library/pickle.rst:992 msgid "" "On the sending side, it needs to pass a *buffer_callback* argument to :class:" "`Pickler` (or to the :func:`dump` or :func:`dumps` function), which will be " @@ -1454,7 +1465,7 @@ msgid "" "copied into the pickle stream, only a cheap marker will be inserted." msgstr "" -#: ../../library/pickle.rst:991 +#: ../../library/pickle.rst:999 msgid "" "On the receiving side, it needs to pass a *buffers* argument to :class:" "`Unpickler` (or to the :func:`load` or :func:`loads` function), which is an " @@ -1465,7 +1476,7 @@ msgid "" "`PickleBuffer` objects." msgstr "" -#: ../../library/pickle.rst:999 +#: ../../library/pickle.rst:1007 msgid "" "Between the sending side and the receiving side, the communications system " "is free to implement its own transfer mechanism for out-of-band buffers. " @@ -1473,17 +1484,17 @@ msgid "" "dependent compression." msgstr "" -#: ../../library/pickle.rst:1005 +#: ../../library/pickle.rst:1013 msgid "Example" msgstr "範例" -#: ../../library/pickle.rst:1007 +#: ../../library/pickle.rst:1015 msgid "" "Here is a trivial example where we implement a :class:`bytearray` subclass " "able to participate in out-of-band buffer pickling::" msgstr "" -#: ../../library/pickle.rst:1010 +#: ../../library/pickle.rst:1018 msgid "" "class ZeroCopyByteArray(bytearray):\n" "\n" @@ -1507,20 +1518,20 @@ msgid "" " return cls(obj)" msgstr "" -#: ../../library/pickle.rst:1031 +#: ../../library/pickle.rst:1039 msgid "" "The reconstructor (the ``_reconstruct`` class method) returns the buffer's " "providing object if it has the right type. This is an easy way to simulate " "zero-copy behaviour on this toy example." msgstr "" -#: ../../library/pickle.rst:1035 +#: ../../library/pickle.rst:1043 msgid "" "On the consumer side, we can pickle those objects the usual way, which when " "unserialized will give us a copy of the original object::" msgstr "" -#: ../../library/pickle.rst:1038 +#: ../../library/pickle.rst:1046 msgid "" "b = ZeroCopyByteArray(b\"abc\")\n" "data = pickle.dumps(b, protocol=5)\n" @@ -1529,13 +1540,13 @@ msgid "" "print(b is new_b) # False: a copy was made" msgstr "" -#: ../../library/pickle.rst:1044 +#: ../../library/pickle.rst:1052 msgid "" "But if we pass a *buffer_callback* and then give back the accumulated " "buffers when unserializing, we are able to get back the original object::" msgstr "" -#: ../../library/pickle.rst:1047 +#: ../../library/pickle.rst:1055 msgid "" "b = ZeroCopyByteArray(b\"abc\")\n" "buffers = []\n" @@ -1545,7 +1556,7 @@ msgid "" "print(b is new_b) # True: no copy was made" msgstr "" -#: ../../library/pickle.rst:1054 +#: ../../library/pickle.rst:1062 msgid "" "This example is limited by the fact that :class:`bytearray` allocates its " "own memory: you cannot create a :class:`bytearray` instance that is backed " @@ -1555,15 +1566,15 @@ msgid "" "processes or systems." msgstr "" -#: ../../library/pickle.rst:1061 +#: ../../library/pickle.rst:1069 msgid ":pep:`574` -- Pickle protocol 5 with out-of-band data" msgstr "" -#: ../../library/pickle.rst:1067 +#: ../../library/pickle.rst:1075 msgid "Restricting Globals" msgstr "" -#: ../../library/pickle.rst:1072 +#: ../../library/pickle.rst:1080 msgid "" "By default, unpickling will import any class or function that it finds in " "the pickle data. For many applications, this behaviour is unacceptable as " @@ -1571,7 +1582,7 @@ msgid "" "what this hand-crafted pickle data stream does when loaded::" msgstr "" -#: ../../library/pickle.rst:1077 +#: ../../library/pickle.rst:1085 msgid "" ">>> import pickle\n" ">>> pickle.loads(b\"cos\\nsystem\\n(S'echo hello world'\\ntR.\")\n" @@ -1583,7 +1594,7 @@ msgstr "" "hello world\n" "0" -#: ../../library/pickle.rst:1082 +#: ../../library/pickle.rst:1090 msgid "" "In this example, the unpickler imports the :func:`os.system` function and " "then apply the string argument \"echo hello world\". Although this example " @@ -1591,7 +1602,7 @@ msgid "" "system." msgstr "" -#: ../../library/pickle.rst:1086 +#: ../../library/pickle.rst:1094 msgid "" "For this reason, you may want to control what gets unpickled by customizing :" "meth:`Unpickler.find_class`. Unlike its name suggests, :meth:`Unpickler." @@ -1600,13 +1611,13 @@ msgid "" "restrict them to a safe subset." msgstr "" -#: ../../library/pickle.rst:1092 +#: ../../library/pickle.rst:1100 msgid "" "Here is an example of an unpickler allowing only few safe classes from the :" "mod:`builtins` module to be loaded::" msgstr "" -#: ../../library/pickle.rst:1095 +#: ../../library/pickle.rst:1103 msgid "" "import builtins\n" "import io\n" @@ -1635,11 +1646,11 @@ msgid "" " return RestrictedUnpickler(io.BytesIO(s)).load()" msgstr "" -#: ../../library/pickle.rst:1121 +#: ../../library/pickle.rst:1129 msgid "A sample usage of our unpickler working as intended::" msgstr "" -#: ../../library/pickle.rst:1123 +#: ../../library/pickle.rst:1131 msgid "" ">>> restricted_loads(pickle.dumps([1, 2, range(15)]))\n" "[1, 2, range(0, 15)]\n" @@ -1667,7 +1678,7 @@ msgstr "" " ...\n" "pickle.UnpicklingError: global 'builtins.eval' is forbidden" -#: ../../library/pickle.rst:1140 +#: ../../library/pickle.rst:1148 msgid "" "As our examples shows, you have to be careful with what you allow to be " "unpickled. Therefore if security is a concern, you may want to consider " @@ -1675,27 +1686,27 @@ msgid "" "party solutions." msgstr "" -#: ../../library/pickle.rst:1147 +#: ../../library/pickle.rst:1155 msgid "Performance" msgstr "" -#: ../../library/pickle.rst:1149 +#: ../../library/pickle.rst:1157 msgid "" "Recent versions of the pickle protocol (from protocol 2 and upwards) feature " "efficient binary encodings for several common features and built-in types. " "Also, the :mod:`pickle` module has a transparent optimizer written in C." msgstr "" -#: ../../library/pickle.rst:1157 +#: ../../library/pickle.rst:1165 msgid "Examples" msgstr "範例" -#: ../../library/pickle.rst:1159 +#: ../../library/pickle.rst:1167 msgid "" "For the simplest code, use the :func:`dump` and :func:`load` functions. ::" msgstr "" -#: ../../library/pickle.rst:1161 +#: ../../library/pickle.rst:1169 msgid "" "import pickle\n" "\n" @@ -1711,11 +1722,11 @@ msgid "" " pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)" msgstr "" -#: ../../library/pickle.rst:1175 +#: ../../library/pickle.rst:1183 msgid "The following example reads the resulting pickled data. ::" msgstr "" -#: ../../library/pickle.rst:1177 +#: ../../library/pickle.rst:1185 msgid "" "import pickle\n" "\n" @@ -1725,73 +1736,73 @@ msgid "" " data = pickle.load(f)" msgstr "" -#: ../../library/pickle.rst:1191 +#: ../../library/pickle.rst:1199 msgid "Module :mod:`copyreg`" msgstr ":mod:`copyreg` 模組" -#: ../../library/pickle.rst:1192 +#: ../../library/pickle.rst:1200 msgid "Pickle interface constructor registration for extension types." msgstr "" -#: ../../library/pickle.rst:1194 +#: ../../library/pickle.rst:1202 msgid "Module :mod:`pickletools`" msgstr ":mod:`pickletools` 模組" -#: ../../library/pickle.rst:1195 +#: ../../library/pickle.rst:1203 msgid "Tools for working with and analyzing pickled data." msgstr "" -#: ../../library/pickle.rst:1197 +#: ../../library/pickle.rst:1205 msgid "Module :mod:`shelve`" msgstr ":mod:`shelve` 模組" -#: ../../library/pickle.rst:1198 +#: ../../library/pickle.rst:1206 msgid "Indexed databases of objects; uses :mod:`pickle`." msgstr "" -#: ../../library/pickle.rst:1200 +#: ../../library/pickle.rst:1208 msgid "Module :mod:`copy`" msgstr ":mod:`copy` 模組" -#: ../../library/pickle.rst:1201 +#: ../../library/pickle.rst:1209 msgid "Shallow and deep object copying." msgstr "" -#: ../../library/pickle.rst:1203 +#: ../../library/pickle.rst:1211 msgid "Module :mod:`marshal`" msgstr ":mod:`marshal` 模組" -#: ../../library/pickle.rst:1204 +#: ../../library/pickle.rst:1212 msgid "High-performance serialization of built-in types." msgstr "" -#: ../../library/pickle.rst:1208 +#: ../../library/pickle.rst:1216 msgid "Footnotes" msgstr "註解" -#: ../../library/pickle.rst:1209 +#: ../../library/pickle.rst:1217 msgid "Don't confuse this with the :mod:`marshal` module" msgstr "" -#: ../../library/pickle.rst:1211 +#: ../../library/pickle.rst:1219 msgid "" "This is why :keyword:`lambda` functions cannot be pickled: all :keyword:`!" "lambda` functions share the same name: ````." msgstr "" -#: ../../library/pickle.rst:1214 +#: ../../library/pickle.rst:1222 msgid "" "The exception raised will likely be an :exc:`ImportError` or an :exc:" "`AttributeError` but it could be something else." msgstr "" -#: ../../library/pickle.rst:1217 +#: ../../library/pickle.rst:1225 msgid "" "The :mod:`copy` module uses this protocol for shallow and deep copying " "operations." msgstr "" -#: ../../library/pickle.rst:1220 +#: ../../library/pickle.rst:1228 msgid "" "The limitation on alphanumeric characters is due to the fact that persistent " "IDs in protocol 0 are delimited by the newline character. Therefore if any " @@ -1831,30 +1842,30 @@ msgstr "pickling" msgid "External Data Representation" msgstr "External Data Representation(外部資料表示法)" -#: ../../library/pickle.rst:664 +#: ../../library/pickle.rst:672 msgid "copy" msgstr "copy(複製)" -#: ../../library/pickle.rst:664 +#: ../../library/pickle.rst:672 msgid "protocol" msgstr "protocol(協定)" -#: ../../library/pickle.rst:748 +#: ../../library/pickle.rst:756 msgid "persistent_id (pickle protocol)" msgstr "persistent_id(pickle 協定)" -#: ../../library/pickle.rst:748 +#: ../../library/pickle.rst:756 msgid "persistent_load (pickle protocol)" msgstr "persistent_load(pickle 協定)" -#: ../../library/pickle.rst:824 +#: ../../library/pickle.rst:832 msgid "__getstate__() (copy protocol)" msgstr "__getstate__()(copy 協定)" -#: ../../library/pickle.rst:824 +#: ../../library/pickle.rst:832 msgid "__setstate__() (copy protocol)" msgstr "__setstate__()(copy 協定)" -#: ../../library/pickle.rst:1069 +#: ../../library/pickle.rst:1077 msgid "find_class() (pickle protocol)" msgstr "find_class()(pickle 協定)" diff --git a/library/pickletools.po b/library/pickletools.po index 15a4442979..d3bd0aee93 100644 --- a/library/pickletools.po +++ b/library/pickletools.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:07+0000\n" diff --git a/library/pipes.po b/library/pipes.po deleted file mode 100644 index 0f7dfc2aad..0000000000 --- a/library/pipes.po +++ /dev/null @@ -1,144 +0,0 @@ -# Copyright (C) 2001-2024, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-05-22 02:11+0800\n" -"Last-Translator: Liang-Bo Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/pipes.rst:2 -msgid ":mod:`pipes` --- Interface to shell pipelines" -msgstr ":mod:`pipes` --- shell pipelines 介面" - -#: ../../library/pipes.rst:11 -msgid "**Source code:** :source:`Lib/pipes.py`" -msgstr "**原始碼:**\\ :source:`Lib/pipes.py`" - -#: ../../library/pipes.rst:13 -msgid "" -"The :mod:`pipes` module is deprecated (see :pep:`PEP 594 <594#pipes>` for " -"details). Please use the :mod:`subprocess` module instead." -msgstr "" -":mod:`pipes` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#pipes>`\\ )。" -"請改用 :mod:`subprocess`。" - -#: ../../library/pipes.rst:20 -msgid "" -"The :mod:`pipes` module defines a class to abstract the concept of a " -"*pipeline* --- a sequence of converters from one file to another." -msgstr "" - -#: ../../library/pipes.rst:23 -msgid "" -"Because the module uses :program:`/bin/sh` command lines, a POSIX or " -"compatible shell for :func:`os.system` and :func:`os.popen` is required." -msgstr "" - -#: ../../library/pipes.rst:26 -msgid ":ref:`Availability `: Unix, not VxWorks." -msgstr ":ref:`適用 `:Unix,非 VxWorks。" - -#: ../../library/pipes.rst:28 -msgid "The :mod:`pipes` module defines the following class:" -msgstr "" - -#: ../../library/pipes.rst:33 -msgid "An abstraction of a pipeline." -msgstr "" - -#: ../../library/pipes.rst:35 -msgid "Example::" -msgstr "範例: ::" - -#: ../../library/pipes.rst:37 -msgid "" -">>> import pipes\n" -">>> t = pipes.Template()\n" -">>> t.append('tr a-z A-Z', '--')\n" -">>> f = t.open('pipefile', 'w')\n" -">>> f.write('hello world')\n" -">>> f.close()\n" -">>> open('pipefile').read()\n" -"'HELLO WORLD'" -msgstr "" -">>> import pipes\n" -">>> t = pipes.Template()\n" -">>> t.append('tr a-z A-Z', '--')\n" -">>> f = t.open('pipefile', 'w')\n" -">>> f.write('hello world')\n" -">>> f.close()\n" -">>> open('pipefile').read()\n" -"'HELLO WORLD'" - -#: ../../library/pipes.rst:50 -msgid "Template Objects" -msgstr "" - -#: ../../library/pipes.rst:52 -msgid "Template objects following methods:" -msgstr "" - -#: ../../library/pipes.rst:57 -msgid "Restore a pipeline template to its initial state." -msgstr "" - -#: ../../library/pipes.rst:62 -msgid "Return a new, equivalent, pipeline template." -msgstr "" - -#: ../../library/pipes.rst:67 -msgid "" -"If *flag* is true, turn debugging on. Otherwise, turn debugging off. When " -"debugging is on, commands to be executed are printed, and the shell is given " -"``set -x`` command to be more verbose." -msgstr "" - -#: ../../library/pipes.rst:74 -msgid "" -"Append a new action at the end. The *cmd* variable must be a valid bourne " -"shell command. The *kind* variable consists of two letters." -msgstr "" - -#: ../../library/pipes.rst:77 -msgid "" -"The first letter can be either of ``'-'`` (which means the command reads its " -"standard input), ``'f'`` (which means the commands reads a given file on the " -"command line) or ``'.'`` (which means the commands reads no input, and hence " -"must be first.)" -msgstr "" - -#: ../../library/pipes.rst:82 -msgid "" -"Similarly, the second letter can be either of ``'-'`` (which means the " -"command writes to standard output), ``'f'`` (which means the command writes " -"a file on the command line) or ``'.'`` (which means the command does not " -"write anything, and hence must be last.)" -msgstr "" - -#: ../../library/pipes.rst:90 -msgid "" -"Add a new action at the beginning. See :meth:`append` for explanations of " -"the arguments." -msgstr "" - -#: ../../library/pipes.rst:96 -msgid "" -"Return a file-like object, open to *file*, but read from or written to by " -"the pipeline. Note that only one of ``'r'``, ``'w'`` may be given." -msgstr "" - -#: ../../library/pipes.rst:102 -msgid "Copy *infile* to *outfile* through the pipe." -msgstr "" diff --git a/library/pkgutil.po b/library/pkgutil.po index 8c6aba317d..c8a23bee35 100644 --- a/library/pkgutil.po +++ b/library/pkgutil.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2024-03-08 16:07+0000\n" diff --git a/library/platform.po b/library/platform.po index 2e904a0cc5..de5e532153 100644 --- a/library/platform.po +++ b/library/platform.po @@ -6,9 +6,9 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-06-11 14:03+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -231,7 +231,14 @@ msgstr "" "回傳系統/OS 的名稱,例如 ``'Linux'``、``'Darwin'``、``'Java'``、" "``'Windows'``。如果該值無法確定則回傳一個空字串。" -#: ../../library/platform.rst:154 +#: ../../library/platform.rst:151 +msgid "" +"On iOS and Android, this returns the user-facing OS name (i.e, ``'iOS``, " +"``'iPadOS'`` or ``'Android'``). To obtain the kernel name (``'Darwin'`` or " +"``'Linux'``), use :func:`os.uname`." +msgstr "" + +#: ../../library/platform.rst:157 msgid "" "Returns ``(system, release, version)`` aliased to common marketing names " "used for some systems. It also does some reordering of the information in " @@ -240,7 +247,7 @@ msgstr "" "回傳做為某些系統所使用的常見行銷名稱之別名的 ``(system, release, version)``。" "它還會在可能導致混淆的情況下對資訊進行一些重新排序。" -#: ../../library/platform.rst:161 +#: ../../library/platform.rst:164 msgid "" "Returns the system's release version, e.g. ``'#3 on degas'``. An empty " "string is returned if the value cannot be determined." @@ -250,6 +257,12 @@ msgstr "" #: ../../library/platform.rst:167 msgid "" +"On iOS and Android, this is the user-facing OS version. To obtain the Darwin " +"or Linux kernel version, use :func:`os.uname`." +msgstr "" + +#: ../../library/platform.rst:172 +msgid "" "Fairly portable uname interface. Returns a :func:`~collections.namedtuple` " "containing six attributes: :attr:`system`, :attr:`node`, :attr:`release`, :" "attr:`version`, :attr:`machine`, and :attr:`processor`." @@ -258,11 +271,11 @@ msgstr "" "`~collections.namedtuple`::attr:`system`、:attr:`node`、:attr:`release`、:" "attr:`version`、:attr:`machine` 和 :attr:`processor`。" -#: ../../library/platform.rst:171 +#: ../../library/platform.rst:176 msgid ":attr:`processor` is resolved late, on demand." msgstr ":attr:`processor` 會延遲解析,有需求時才會解析" -#: ../../library/platform.rst:173 +#: ../../library/platform.rst:178 msgid "" "Note: the first two attribute names differ from the names presented by :func:" "`os.uname`, where they are named :attr:`sysname` and :attr:`nodename`." @@ -270,27 +283,27 @@ msgstr "" "注意:前兩個屬性名稱與 :func:`os.uname` 提供的名稱不同,它們分別命名為 :attr:" "`sysname` 和 :attr:`nodename`。" -#: ../../library/platform.rst:177 +#: ../../library/platform.rst:182 msgid "Entries which cannot be determined are set to ``''``." msgstr "無法確定的條目會被設為 ``''``。" -#: ../../library/platform.rst:179 +#: ../../library/platform.rst:184 msgid "Result changed from a tuple to a :func:`~collections.namedtuple`." msgstr "將結果從 tuple 改為 :func:`~collections.namedtuple`。" -#: ../../library/platform.rst:182 +#: ../../library/platform.rst:187 msgid ":attr:`processor` is resolved late instead of immediately." msgstr ":attr:`processor` 會延遲解析,並非立即解析。" -#: ../../library/platform.rst:187 +#: ../../library/platform.rst:192 msgid "Java Platform" msgstr "Java 平台" -#: ../../library/platform.rst:192 +#: ../../library/platform.rst:197 msgid "Version interface for Jython." msgstr "Jython 的版本介面。" -#: ../../library/platform.rst:194 +#: ../../library/platform.rst:199 msgid "" "Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a " "tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple " @@ -302,11 +315,17 @@ msgstr "" "os_version, os_arch)``。無法確定的值將被設為由參數所給定的預設值(預設均為 " "``''``\\ )。" -#: ../../library/platform.rst:201 +#: ../../library/platform.rst:204 +msgid "" +"It was largely untested, had a confusing API, and was only useful for Jython " +"support." +msgstr "" + +#: ../../library/platform.rst:210 msgid "Windows Platform" msgstr "Windows 平台" -#: ../../library/platform.rst:206 +#: ../../library/platform.rst:215 msgid "" "Get additional version information from the Windows Registry and return a " "tuple ``(release, version, csd, ptype)`` referring to OS release, version " @@ -318,7 +337,7 @@ msgstr "" "``(release, version, csd, ptype)``,它代表 OS 發行版、版本號、CSD 級別 " "(service pack) 和 OS 類型(多個/單個處理器)。" -#: ../../library/platform.rst:212 +#: ../../library/platform.rst:221 msgid "" "As a hint: *ptype* is ``'Uniprocessor Free'`` on single processor NT " "machines and ``'Multiprocessor Free'`` on multi processor machines. The " @@ -331,7 +350,7 @@ msgstr "" "錯程式。它也可能以 ``'Checked'`` 表示,代表該 OS 版本使用了除錯程式,即檢查引" "數、範圍等的程式。" -#: ../../library/platform.rst:220 +#: ../../library/platform.rst:229 msgid "" "Returns a string representing the current Windows edition, or ``None`` if " "the value cannot be determined. Possible values include but are not limited " @@ -341,7 +360,7 @@ msgstr "" "回傳一個代表當前 Windows 版本的字串。可能的值包括但不限於 ``'Enterprise'``、" "``'IoTUAP'``、``'ServerStandard'`` 和 ``'nanoserver'``。" -#: ../../library/platform.rst:228 +#: ../../library/platform.rst:237 msgid "" "Return ``True`` if the Windows edition returned by :func:`win32_edition` is " "recognized as an IoT edition." @@ -349,11 +368,11 @@ msgstr "" "如果 :func:`win32_edition` 回傳的 Windows 版本被識別為 IoT 版則回傳 " "``True``。" -#: ../../library/platform.rst:235 +#: ../../library/platform.rst:244 msgid "macOS Platform" msgstr "macOS 平台" -#: ../../library/platform.rst:240 +#: ../../library/platform.rst:248 msgid "" "Get macOS version information and return it as tuple ``(release, " "versioninfo, machine)`` with *versioninfo* being a tuple ``(version, " @@ -363,17 +382,54 @@ msgstr "" "其中 *versioninfo* 是一個 tuple ``(version, dev_stage, " "non_release_version)``。" -#: ../../library/platform.rst:244 +#: ../../library/platform.rst:252 msgid "" "Entries which cannot be determined are set to ``''``. All tuple entries are " "strings." msgstr "無法確定的條目會被設為 ``''``。所有 tuple 條目均為字串。" -#: ../../library/platform.rst:249 +#: ../../library/platform.rst:256 +msgid "iOS Platform" +msgstr "iOS 平台" + +#: ../../library/platform.rst:260 +msgid "" +"Get iOS version information and return it as a :func:`~collections." +"namedtuple` with the following attributes:" +msgstr "" + +#: ../../library/platform.rst:263 +msgid "``system`` is the OS name; either ``'iOS'`` or ``'iPadOS'``." +msgstr "" + +#: ../../library/platform.rst:264 +msgid "``release`` is the iOS version number as a string (e.g., ``'17.2'``)." +msgstr "" + +#: ../../library/platform.rst:265 +msgid "" +"``model`` is the device model identifier; this will be a string like " +"``'iPhone13,2'`` for a physical device, or ``'iPhone'`` on a simulator." +msgstr "" + +#: ../../library/platform.rst:267 +msgid "" +"``is_simulator`` is a boolean describing if the app is running on a " +"simulator or a physical device." +msgstr "" + +#: ../../library/platform.rst:270 +#, fuzzy +msgid "" +"Entries which cannot be determined are set to the defaults given as " +"parameters." +msgstr "無法確定的條目會被設為 ``''``。所有 tuple 條目均為字串。" + +#: ../../library/platform.rst:275 msgid "Unix Platforms" msgstr "Unix 平台" -#: ../../library/platform.rst:253 +#: ../../library/platform.rst:279 msgid "" "Tries to determine the libc version against which the file executable " "(defaults to the Python interpreter) is linked. Returns a tuple of strings " @@ -383,7 +439,7 @@ msgstr "" "嘗試確認可執行檔案(預設為 Python 直譯器)所連結到的 libc 版本。回傳一個字串 " "tuple ``(lib, version)``,當查詢失敗時其預設值將被設為給定的參數值。" -#: ../../library/platform.rst:257 +#: ../../library/platform.rst:283 msgid "" "Note that this function has intimate knowledge of how different libc " "versions add symbols to the executable is probably only usable for " @@ -392,15 +448,15 @@ msgstr "" "請注意,此函式對於不同 libc 版本如何為可執行檔案新增符號的方式有深層的關聯," "可能僅適用於以 :program:`gcc` 編譯出來的可執行檔案。" -#: ../../library/platform.rst:261 +#: ../../library/platform.rst:287 msgid "The file is read and scanned in chunks of *chunksize* bytes." msgstr "檔案會以 *chunksize* 位元組大小的分塊 (chunk) 來讀取和掃描。" -#: ../../library/platform.rst:265 +#: ../../library/platform.rst:291 msgid "Linux Platforms" msgstr "Linux 平台" -#: ../../library/platform.rst:269 +#: ../../library/platform.rst:295 msgid "" "Get operating system identification from ``os-release`` file and return it " "as a dict. The ``os-release`` file is a `freedesktop.org standard `_、並在大多數 Linux 發行版上可用。一個重要的例外" "是 Android 和基於 Android 的發行版。" -#: ../../library/platform.rst:275 +#: ../../library/platform.rst:301 msgid "" "Raises :exc:`OSError` or subclass when neither ``/etc/os-release`` nor ``/" "usr/lib/os-release`` can be read." @@ -421,7 +477,7 @@ msgstr "" "當 ``/etc/os-release`` 與 ``/usr/lib/os-release`` 均無法被讀取時將引發 :exc:" "`OSError` 或其子類別。" -#: ../../library/platform.rst:278 +#: ../../library/platform.rst:304 msgid "" "On success, the function returns a dictionary where keys and values are " "strings. Values have their special characters like ``\"`` and ``$`` " @@ -434,7 +490,7 @@ msgstr "" "``PRETTY_NAME`` 總會按照標準來定義。所有其他欄位都是可選的。根據不同廠商可能" "會包括額外的欄位。" -#: ../../library/platform.rst:284 +#: ../../library/platform.rst:310 msgid "" "Note that fields like ``NAME``, ``VERSION``, and ``VARIANT`` are strings " "suitable for presentation to users. Programs should use fields like ``ID``, " @@ -445,11 +501,11 @@ msgstr "" "串。程式應當使用 ``ID``、``ID_LIKE``、``VERSION_ID`` 或 ``VARIANT_ID`` 等欄位" "來標識 Linux 發行版。" -#: ../../library/platform.rst:289 +#: ../../library/platform.rst:315 msgid "Example::" msgstr "範例: ::" -#: ../../library/platform.rst:291 +#: ../../library/platform.rst:317 msgid "" "def get_like_distro():\n" " info = platform.freedesktop_os_release()\n" @@ -459,3 +515,55 @@ msgid "" " ids.extend(info[\"ID_LIKE\"].split())\n" " return ids" msgstr "" + +#: ../../library/platform.rst:329 +msgid "Android Platform" +msgstr "Android 平台" + +#: ../../library/platform.rst:334 +msgid "" +"Get Android device information. Returns a :func:`~collections.namedtuple` " +"with the following attributes. Values which cannot be determined are set to " +"the defaults given as parameters." +msgstr "" + +#: ../../library/platform.rst:338 +msgid "``release`` - Android version, as a string (e.g. ``\"14\"``)." +msgstr "" + +#: ../../library/platform.rst:340 +msgid "" +"``api_level`` - API level of the running device, as an integer (e.g. ``34`` " +"for Android 14). To get the API level which Python was built against, see :" +"func:`sys.getandroidapilevel`." +msgstr "" + +#: ../../library/platform.rst:344 +msgid "" +"``manufacturer`` - `Manufacturer name `__." +msgstr "" + +#: ../../library/platform.rst:347 +msgid "" +"``model`` - `Model name `__ – typically the marketing name or model number." +msgstr "" + +#: ../../library/platform.rst:351 +msgid "" +"``device`` - `Device name `__ – typically the model number or a codename." +msgstr "" + +#: ../../library/platform.rst:355 +msgid "" +"``is_emulator`` - ``True`` if the device is an emulator; ``False`` if it's a " +"physical device." +msgstr "" + +#: ../../library/platform.rst:358 +msgid "" +"Google maintains a `list of known model and device names `__." +msgstr "" diff --git a/library/plistlib.po b/library/plistlib.po index 82762c0f61..282baf27aa 100644 --- a/library/plistlib.po +++ b/library/plistlib.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2016-01-31 07:27+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -48,8 +48,8 @@ msgstr "" #: ../../library/plistlib.rst:30 msgid "" -"To work with plist data in bytes objects, use :func:`dumps` and :func:" -"`loads`." +"To work with plist data in bytes or string objects, use :func:`dumps` and :" +"func:`loads`." msgstr "" #: ../../library/plistlib.rst:33 @@ -117,111 +117,133 @@ msgstr "" #: ../../library/plistlib.rst:72 msgid "" +"When *aware_datetime* is true, fields with type ``datetime.datetime`` will " +"be created as :ref:`aware object `, with :attr:`!" +"tzinfo` as :attr:`datetime.UTC`." +msgstr "" + +#: ../../library/plistlib.rst:76 +msgid "" "XML data for the :data:`FMT_XML` format is parsed using the Expat parser " "from :mod:`xml.parsers.expat` -- see its documentation for possible " "exceptions on ill-formed XML. Unknown elements will simply be ignored by " "the plist parser." msgstr "" -#: ../../library/plistlib.rst:77 +#: ../../library/plistlib.rst:81 msgid "" "The parser for the binary format raises :exc:`InvalidFileException` when the " "file cannot be parsed." msgstr "" -#: ../../library/plistlib.rst:85 +#: ../../library/plistlib.rst:86 ../../library/plistlib.rst:131 +msgid "The keyword-only parameter *aware_datetime* has been added." +msgstr "" + +#: ../../library/plistlib.rst:92 msgid "" -"Load a plist from a bytes object. See :func:`load` for an explanation of the " -"keyword arguments." +"Load a plist from a bytes or string object. See :func:`load` for an " +"explanation of the keyword arguments." +msgstr "" + +#: ../../library/plistlib.rst:97 +msgid "*data* can be a string when *fmt* equals :data:`FMT_XML`." msgstr "" -#: ../../library/plistlib.rst:93 +#: ../../library/plistlib.rst:102 msgid "" "Write *value* to a plist file. *Fp* should be a writable, binary file object." msgstr "" -#: ../../library/plistlib.rst:96 +#: ../../library/plistlib.rst:105 msgid "" "The *fmt* argument specifies the format of the plist file and can be one of " "the following values:" msgstr "" -#: ../../library/plistlib.rst:99 +#: ../../library/plistlib.rst:108 msgid ":data:`FMT_XML`: XML formatted plist file" msgstr "" -#: ../../library/plistlib.rst:101 +#: ../../library/plistlib.rst:110 msgid ":data:`FMT_BINARY`: Binary formatted plist file" msgstr "" -#: ../../library/plistlib.rst:103 +#: ../../library/plistlib.rst:112 msgid "" "When *sort_keys* is true (the default) the keys for dictionaries will be " "written to the plist in sorted order, otherwise they will be written in the " "iteration order of the dictionary." msgstr "" -#: ../../library/plistlib.rst:107 +#: ../../library/plistlib.rst:116 msgid "" "When *skipkeys* is false (the default) the function raises :exc:`TypeError` " "when a key of a dictionary is not a string, otherwise such keys are skipped." msgstr "" -#: ../../library/plistlib.rst:110 +#: ../../library/plistlib.rst:119 +msgid "" +"When *aware_datetime* is true and any field with type ``datetime.datetime`` " +"is set as an :ref:`aware object `, it will convert to " +"UTC timezone before writing it." +msgstr "" + +#: ../../library/plistlib.rst:123 msgid "" "A :exc:`TypeError` will be raised if the object is of an unsupported type or " "a container that contains objects of unsupported types." msgstr "" -#: ../../library/plistlib.rst:113 +#: ../../library/plistlib.rst:126 msgid "" "An :exc:`OverflowError` will be raised for integer values that cannot be " "represented in (binary) plist files." msgstr "" -#: ../../library/plistlib.rst:121 +#: ../../library/plistlib.rst:137 msgid "" "Return *value* as a plist-formatted bytes object. See the documentation for :" "func:`dump` for an explanation of the keyword arguments of this function." msgstr "" -#: ../../library/plistlib.rst:128 +#: ../../library/plistlib.rst:144 msgid "The following classes are available:" msgstr "" -#: ../../library/plistlib.rst:132 +#: ../../library/plistlib.rst:148 msgid "" "Wraps an :class:`int`. This is used when reading or writing NSKeyedArchiver " "encoded data, which contains UID (see PList manual)." msgstr "" -#: ../../library/plistlib.rst:135 +#: ../../library/plistlib.rst:151 msgid "" "It has one attribute, :attr:`data`, which can be used to retrieve the int " "value of the UID. :attr:`data` must be in the range ``0 <= data < 2**64``." msgstr "" -#: ../../library/plistlib.rst:141 +#: ../../library/plistlib.rst:157 msgid "The following constants are available:" msgstr "" -#: ../../library/plistlib.rst:145 +#: ../../library/plistlib.rst:161 msgid "The XML format for plist files." msgstr "" -#: ../../library/plistlib.rst:152 +#: ../../library/plistlib.rst:168 msgid "The binary format for plist files" msgstr "" -#: ../../library/plistlib.rst:158 +#: ../../library/plistlib.rst:174 msgid "Examples" msgstr "範例" -#: ../../library/plistlib.rst:160 +#: ../../library/plistlib.rst:176 msgid "Generating a plist::" msgstr "" -#: ../../library/plistlib.rst:162 +#: ../../library/plistlib.rst:178 msgid "" "import datetime\n" "import plistlib\n" @@ -263,11 +285,11 @@ msgstr "" ")\n" "print(plistlib.dumps(pl).decode())" -#: ../../library/plistlib.rst:182 +#: ../../library/plistlib.rst:198 msgid "Parsing a plist::" msgstr "" -#: ../../library/plistlib.rst:184 +#: ../../library/plistlib.rst:200 msgid "" "import plistlib\n" "\n" diff --git a/library/poplib.po b/library/poplib.po index 3f678ffc37..05056d6a9f 100644 --- a/library/poplib.po +++ b/library/poplib.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -52,17 +52,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/poplib.rst:33 msgid "The :mod:`poplib` module provides two classes:" diff --git a/library/posix.po b/library/posix.po index 8b09e8308c..394ad55dc8 100644 --- a/library/posix.po +++ b/library/posix.po @@ -5,7 +5,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-01-24 00:05+0800\n" diff --git a/library/pprint.po b/library/pprint.po index 35796365bc..ce89afcb1b 100644 --- a/library/pprint.po +++ b/library/pprint.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" diff --git a/library/profile.po b/library/profile.po index 6a90bdd428..aa480c4282 100644 --- a/library/profile.po +++ b/library/profile.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -422,8 +422,7 @@ msgstr "" #: ../../library/profile.rst:236 msgid "" "This function is similar to :func:`run`, with added arguments to supply the " -"globals and locals dictionaries for the *command* string. This routine " -"executes::" +"globals and locals mappings for the *command* string. This routine executes::" msgstr "" #: ../../library/profile.rst:240 @@ -522,25 +521,36 @@ msgid "" "print the results to stdout." msgstr "" -#: ../../library/profile.rst:304 +#: ../../library/profile.rst:302 +msgid "" +"The *sort* parameter specifies the sorting order of the displayed " +"statistics. It accepts a single key or a tuple of keys to enable multi-level " +"sorting, as in :func:`Stats.sort_stats `." +msgstr "" + +#: ../../library/profile.rst:306 +msgid ":meth:`~Profile.print_stats` now accepts a tuple of keys." +msgstr "" + +#: ../../library/profile.rst:311 msgid "Write the results of the current profile to *filename*." msgstr "" -#: ../../library/profile.rst:308 +#: ../../library/profile.rst:315 msgid "Profile the cmd via :func:`exec`." msgstr "" -#: ../../library/profile.rst:312 +#: ../../library/profile.rst:319 msgid "" "Profile the cmd via :func:`exec` with the specified global and local " "environment." msgstr "" -#: ../../library/profile.rst:317 +#: ../../library/profile.rst:324 msgid "Profile ``func(*args, **kwargs)``" msgstr "" -#: ../../library/profile.rst:319 +#: ../../library/profile.rst:326 msgid "" "Note that profiling will only work if the called command/function actually " "returns. If the interpreter is terminated (e.g. via a :func:`sys.exit` call " @@ -548,23 +558,23 @@ msgid "" "printed." msgstr "" -#: ../../library/profile.rst:327 +#: ../../library/profile.rst:334 msgid "The :class:`Stats` Class" msgstr "" -#: ../../library/profile.rst:329 +#: ../../library/profile.rst:336 msgid "" "Analysis of the profiler data is done using the :class:`~pstats.Stats` class." msgstr "" -#: ../../library/profile.rst:336 +#: ../../library/profile.rst:343 msgid "" "This class constructor creates an instance of a \"statistics object\" from a " "*filename* (or list of filenames) or from a :class:`Profile` instance. " "Output will be printed to the stream specified by *stream*." msgstr "" -#: ../../library/profile.rst:340 +#: ../../library/profile.rst:347 msgid "" "The file selected by the above constructor must have been created by the " "corresponding version of :mod:`profile` or :mod:`cProfile`. To be specific, " @@ -578,17 +588,17 @@ msgid "" "can be used." msgstr "" -#: ../../library/profile.rst:351 +#: ../../library/profile.rst:358 msgid "" "Instead of reading the profile data from a file, a :class:`cProfile.Profile` " "or :class:`profile.Profile` object can be used as the profile data source." msgstr "" -#: ../../library/profile.rst:354 +#: ../../library/profile.rst:361 msgid ":class:`Stats` objects have the following methods:" msgstr "" -#: ../../library/profile.rst:358 +#: ../../library/profile.rst:365 msgid "" "This method for the :class:`Stats` class removes all leading path " "information from file names. It is very useful in reducing the size of the " @@ -602,7 +612,7 @@ msgid "" "single entry." msgstr "" -#: ../../library/profile.rst:372 +#: ../../library/profile.rst:379 msgid "" "This method of the :class:`Stats` class accumulates additional profiling " "information into the current profiling object. Its arguments should refer " @@ -611,7 +621,7 @@ msgid "" "functions are automatically accumulated into single function statistics." msgstr "" -#: ../../library/profile.rst:382 +#: ../../library/profile.rst:389 msgid "" "Save the data loaded into the :class:`Stats` object to a file named " "*filename*. The file is created if it does not exist, and is overwritten if " @@ -619,7 +629,7 @@ msgid "" "the :class:`profile.Profile` and :class:`cProfile.Profile` classes." msgstr "" -#: ../../library/profile.rst:390 +#: ../../library/profile.rst:397 msgid "" "This method modifies the :class:`Stats` object by sorting it according to " "the supplied criteria. The argument can be either a string or a SortKey " @@ -629,7 +639,7 @@ msgid "" "prone." msgstr "" -#: ../../library/profile.rst:397 +#: ../../library/profile.rst:404 msgid "" "When more than one key is provided, then additional keys are used as " "secondary criteria when there is equality in all keys selected before them. " @@ -638,164 +648,164 @@ msgid "" "function names) by sorting by file name." msgstr "" -#: ../../library/profile.rst:403 +#: ../../library/profile.rst:410 msgid "" "For the string argument, abbreviations can be used for any key names, as " "long as the abbreviation is unambiguous." msgstr "" -#: ../../library/profile.rst:406 +#: ../../library/profile.rst:413 msgid "The following are the valid string and SortKey:" msgstr "" -#: ../../library/profile.rst:409 +#: ../../library/profile.rst:416 msgid "Valid String Arg" msgstr "" -#: ../../library/profile.rst:409 +#: ../../library/profile.rst:416 msgid "Valid enum Arg" msgstr "" -#: ../../library/profile.rst:409 +#: ../../library/profile.rst:416 msgid "Meaning" msgstr "含義" -#: ../../library/profile.rst:411 +#: ../../library/profile.rst:418 msgid "``'calls'``" msgstr "``'calls'``" -#: ../../library/profile.rst:411 +#: ../../library/profile.rst:418 msgid "SortKey.CALLS" msgstr "SortKey.CALLS" -#: ../../library/profile.rst:411 ../../library/profile.rst:423 +#: ../../library/profile.rst:418 ../../library/profile.rst:430 msgid "call count" msgstr "" -#: ../../library/profile.rst:413 +#: ../../library/profile.rst:420 msgid "``'cumulative'``" msgstr "``'cumulative'``" -#: ../../library/profile.rst:413 +#: ../../library/profile.rst:420 msgid "SortKey.CUMULATIVE" msgstr "SortKey.CUMULATIVE" -#: ../../library/profile.rst:413 ../../library/profile.rst:415 +#: ../../library/profile.rst:420 ../../library/profile.rst:422 msgid "cumulative time" msgstr "" -#: ../../library/profile.rst:415 +#: ../../library/profile.rst:422 msgid "``'cumtime'``" msgstr "``'cumtime'``" -#: ../../library/profile.rst:415 ../../library/profile.rst:417 -#: ../../library/profile.rst:421 ../../library/profile.rst:423 -#: ../../library/profile.rst:437 +#: ../../library/profile.rst:422 ../../library/profile.rst:424 +#: ../../library/profile.rst:428 ../../library/profile.rst:430 +#: ../../library/profile.rst:444 msgid "N/A" msgstr "N/A" -#: ../../library/profile.rst:417 +#: ../../library/profile.rst:424 msgid "``'file'``" msgstr "``'file'``" -#: ../../library/profile.rst:417 ../../library/profile.rst:419 -#: ../../library/profile.rst:421 +#: ../../library/profile.rst:424 ../../library/profile.rst:426 +#: ../../library/profile.rst:428 msgid "file name" msgstr "file name(檔案名稱)" -#: ../../library/profile.rst:419 +#: ../../library/profile.rst:426 msgid "``'filename'``" msgstr "``'filename'``" -#: ../../library/profile.rst:419 +#: ../../library/profile.rst:426 msgid "SortKey.FILENAME" msgstr "SortKey.FILENAME" -#: ../../library/profile.rst:421 +#: ../../library/profile.rst:428 msgid "``'module'``" msgstr "``'module'``" -#: ../../library/profile.rst:423 +#: ../../library/profile.rst:430 msgid "``'ncalls'``" msgstr "``'ncalls'``" -#: ../../library/profile.rst:425 +#: ../../library/profile.rst:432 msgid "``'pcalls'``" msgstr "``'pcalls'``" -#: ../../library/profile.rst:425 +#: ../../library/profile.rst:432 msgid "SortKey.PCALLS" msgstr "SortKey.PCALLS" -#: ../../library/profile.rst:425 +#: ../../library/profile.rst:432 msgid "primitive call count" msgstr "" -#: ../../library/profile.rst:427 +#: ../../library/profile.rst:434 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/profile.rst:427 +#: ../../library/profile.rst:434 msgid "SortKey.LINE" msgstr "SortKey.LINE" -#: ../../library/profile.rst:427 +#: ../../library/profile.rst:434 msgid "line number" msgstr "列號" -#: ../../library/profile.rst:429 +#: ../../library/profile.rst:436 msgid "``'name'``" msgstr "``'name'``" -#: ../../library/profile.rst:429 +#: ../../library/profile.rst:436 msgid "SortKey.NAME" msgstr "SortKey.NAME" -#: ../../library/profile.rst:429 +#: ../../library/profile.rst:436 msgid "function name" msgstr "" -#: ../../library/profile.rst:431 +#: ../../library/profile.rst:438 msgid "``'nfl'``" msgstr "``'nfl'``" -#: ../../library/profile.rst:431 +#: ../../library/profile.rst:438 msgid "SortKey.NFL" msgstr "SortKey.NFL" -#: ../../library/profile.rst:431 +#: ../../library/profile.rst:438 msgid "name/file/line" msgstr "" -#: ../../library/profile.rst:433 +#: ../../library/profile.rst:440 msgid "``'stdname'``" msgstr "``'stdname'``" -#: ../../library/profile.rst:433 +#: ../../library/profile.rst:440 msgid "SortKey.STDNAME" msgstr "SortKey.STDNAME" -#: ../../library/profile.rst:433 +#: ../../library/profile.rst:440 msgid "standard name" msgstr "" -#: ../../library/profile.rst:435 +#: ../../library/profile.rst:442 msgid "``'time'``" msgstr "``'time'``" -#: ../../library/profile.rst:435 +#: ../../library/profile.rst:442 msgid "SortKey.TIME" msgstr "SortKey.TIME" -#: ../../library/profile.rst:435 ../../library/profile.rst:437 +#: ../../library/profile.rst:442 ../../library/profile.rst:444 msgid "internal time" msgstr "" -#: ../../library/profile.rst:437 +#: ../../library/profile.rst:444 msgid "``'tottime'``" msgstr "``'tottime'``" -#: ../../library/profile.rst:440 +#: ../../library/profile.rst:447 msgid "" "Note that all sorts on statistics are in descending order (placing most time " "consuming items first), where as name, file, and line number searches are in " @@ -809,7 +819,7 @@ msgid "" "SortKey.FILENAME, SortKey.LINE)``." msgstr "" -#: ../../library/profile.rst:451 +#: ../../library/profile.rst:458 msgid "" "For backward-compatibility reasons, the numeric arguments ``-1``, ``0``, " "``1``, and ``2`` are permitted. They are interpreted as ``'stdname'``, " @@ -818,31 +828,31 @@ msgid "" "used, and additional arguments will be silently ignored." msgstr "" -#: ../../library/profile.rst:459 +#: ../../library/profile.rst:466 msgid "Added the SortKey enum." msgstr "" -#: ../../library/profile.rst:464 +#: ../../library/profile.rst:471 msgid "" "This method for the :class:`Stats` class reverses the ordering of the basic " "list within the object. Note that by default ascending vs descending order " "is properly selected based on the sort key of choice." msgstr "" -#: ../../library/profile.rst:474 +#: ../../library/profile.rst:481 msgid "" "This method for the :class:`Stats` class prints out a report as described in " "the :func:`profile.run` definition." msgstr "" -#: ../../library/profile.rst:477 +#: ../../library/profile.rst:484 msgid "" "The order of the printing is based on the last :meth:`~pstats.Stats." "sort_stats` operation done on the object (subject to caveats in :meth:" "`~pstats.Stats.add` and :meth:`~pstats.Stats.strip_dirs`)." msgstr "" -#: ../../library/profile.rst:482 +#: ../../library/profile.rst:489 msgid "" "The arguments provided (if any) can be used to limit the list down to the " "significant entries. Initially, the list is taken to be the complete set of " @@ -854,28 +864,28 @@ msgid "" "example::" msgstr "" -#: ../../library/profile.rst:491 +#: ../../library/profile.rst:498 msgid "print_stats(.1, 'foo:')" msgstr "print_stats(.1, 'foo:')" -#: ../../library/profile.rst:493 +#: ../../library/profile.rst:500 msgid "" "would first limit the printing to first 10% of list, and then only print " "functions that were part of filename :file:`.\\*foo:`. In contrast, the " "command::" msgstr "" -#: ../../library/profile.rst:497 +#: ../../library/profile.rst:504 msgid "print_stats('foo:', .1)" msgstr "print_stats('foo:', .1)" -#: ../../library/profile.rst:499 +#: ../../library/profile.rst:506 msgid "" "would limit the list to all functions having file names :file:`.\\*foo:`, " "and then proceed to only print the first 10% of them." msgstr "" -#: ../../library/profile.rst:505 +#: ../../library/profile.rst:512 msgid "" "This method for the :class:`Stats` class prints a list of all functions that " "called each function in the profiled database. The ordering is identical to " @@ -885,7 +895,7 @@ msgid "" "produced the stats:" msgstr "" -#: ../../library/profile.rst:512 +#: ../../library/profile.rst:519 msgid "" "With :mod:`profile`, a number is shown in parentheses after each caller to " "show how many times this specific call was made. For convenience, a second " @@ -893,14 +903,14 @@ msgid "" "at the right." msgstr "" -#: ../../library/profile.rst:517 +#: ../../library/profile.rst:524 msgid "" "With :mod:`cProfile`, each caller is preceded by three numbers: the number " "of times this specific call was made, and the total and cumulative times " "spent in the current function while it was invoked by this specific caller." msgstr "" -#: ../../library/profile.rst:525 +#: ../../library/profile.rst:532 msgid "" "This method for the :class:`Stats` class prints a list of all function that " "were called by the indicated function. Aside from this reversal of " @@ -908,7 +918,7 @@ msgid "" "are identical to the :meth:`~pstats.Stats.print_callers` method." msgstr "" -#: ../../library/profile.rst:533 +#: ../../library/profile.rst:540 msgid "" "This method returns an instance of StatsProfile, which contains a mapping of " "function names to instances of FunctionProfile. Each FunctionProfile " @@ -916,17 +926,17 @@ msgid "" "long the function took to run, how many times it was called, etc..." msgstr "" -#: ../../library/profile.rst:538 +#: ../../library/profile.rst:545 msgid "" "Added the following dataclasses: StatsProfile, FunctionProfile. Added the " "following function: get_stats_profile." msgstr "" -#: ../../library/profile.rst:545 +#: ../../library/profile.rst:552 msgid "What Is Deterministic Profiling?" msgstr "" -#: ../../library/profile.rst:547 +#: ../../library/profile.rst:554 msgid "" ":dfn:`Deterministic profiling` is meant to reflect the fact that all " "*function call*, *function return*, and *exception* events are monitored, " @@ -939,7 +949,7 @@ msgid "" "being spent." msgstr "" -#: ../../library/profile.rst:556 +#: ../../library/profile.rst:563 msgid "" "In Python, since there is an interpreter active during execution, the " "presence of instrumented code is not required in order to do deterministic " @@ -951,7 +961,7 @@ msgid "" "time statistics about the execution of a Python program." msgstr "" -#: ../../library/profile.rst:565 +#: ../../library/profile.rst:572 msgid "" "Call count statistics can be used to identify bugs in code (surprising " "counts), and to identify possible inline-expansion points (high call " @@ -963,11 +973,11 @@ msgid "" "compared to iterative implementations." msgstr "" -#: ../../library/profile.rst:578 +#: ../../library/profile.rst:585 msgid "Limitations" msgstr "限制" -#: ../../library/profile.rst:580 +#: ../../library/profile.rst:587 msgid "" "One limitation has to do with accuracy of timing information. There is a " "fundamental problem with deterministic profilers involving accuracy. The " @@ -978,7 +988,7 @@ msgid "" "first error induces a second source of error." msgstr "" -#: ../../library/profile.rst:588 +#: ../../library/profile.rst:595 msgid "" "The second problem is that it \"takes a while\" from when an event is " "dispatched until the profiler's call to get the time actually *gets* the " @@ -991,7 +1001,7 @@ msgid "" "clock tick), but it *can* accumulate and become very significant." msgstr "" -#: ../../library/profile.rst:598 +#: ../../library/profile.rst:605 msgid "" "The problem is more important with :mod:`profile` than with the lower-" "overhead :mod:`cProfile`. For this reason, :mod:`profile` provides a means " @@ -1005,11 +1015,11 @@ msgid "" "calibration." msgstr "" -#: ../../library/profile.rst:612 +#: ../../library/profile.rst:619 msgid "Calibration" msgstr "校正" -#: ../../library/profile.rst:614 +#: ../../library/profile.rst:621 msgid "" "The profiler of the :mod:`profile` module subtracts a constant from each " "event handling time to compensate for the overhead of calling the time " @@ -1018,7 +1028,7 @@ msgid "" "platform (see :ref:`profile-limitations`). ::" msgstr "" -#: ../../library/profile.rst:620 +#: ../../library/profile.rst:627 msgid "" "import profile\n" "pr = profile.Profile()\n" @@ -1030,7 +1040,7 @@ msgstr "" "for i in range(5):\n" " print(pr.calibrate(10000))" -#: ../../library/profile.rst:625 +#: ../../library/profile.rst:632 msgid "" "The method executes the number of Python calls given by the argument, " "directly and again under the profiler, measuring the time for both. It then " @@ -1040,19 +1050,19 @@ msgid "" "4.04e-6." msgstr "" -#: ../../library/profile.rst:631 +#: ../../library/profile.rst:638 msgid "" "The object of this exercise is to get a fairly consistent result. If your " "computer is *very* fast, or your timer function has poor resolution, you " "might have to pass 100000, or even 1000000, to get consistent results." msgstr "" -#: ../../library/profile.rst:635 +#: ../../library/profile.rst:642 msgid "" "When you have a consistent answer, there are three ways you can use it::" msgstr "" -#: ../../library/profile.rst:637 +#: ../../library/profile.rst:644 msgid "" "import profile\n" "\n" @@ -1067,40 +1077,40 @@ msgid "" "pr = profile.Profile(bias=your_computed_bias)" msgstr "" -#: ../../library/profile.rst:649 +#: ../../library/profile.rst:656 msgid "" "If you have a choice, you are better off choosing a smaller constant, and " "then your results will \"less often\" show up as negative in profile " "statistics." msgstr "" -#: ../../library/profile.rst:655 +#: ../../library/profile.rst:662 msgid "Using a custom timer" msgstr "" -#: ../../library/profile.rst:657 +#: ../../library/profile.rst:664 msgid "" "If you want to change how current time is determined (for example, to force " "use of wall-clock time or elapsed process time), pass the timing function " "you want to the :class:`Profile` class constructor::" msgstr "" -#: ../../library/profile.rst:661 +#: ../../library/profile.rst:668 msgid "pr = profile.Profile(your_time_func)" msgstr "pr = profile.Profile(your_time_func)" -#: ../../library/profile.rst:663 +#: ../../library/profile.rst:670 msgid "" "The resulting profiler will then call ``your_time_func``. Depending on " "whether you are using :class:`profile.Profile` or :class:`cProfile.Profile`, " "``your_time_func``'s return value will be interpreted differently:" msgstr "" -#: ../../library/profile.rst:667 +#: ../../library/profile.rst:674 msgid ":class:`profile.Profile`" msgstr ":class:`profile.Profile`" -#: ../../library/profile.rst:668 +#: ../../library/profile.rst:675 msgid "" "``your_time_func`` should return a single number, or a list of numbers whose " "sum is the current time (like what :func:`os.times` returns). If the " @@ -1109,7 +1119,7 @@ msgid "" "routine." msgstr "" -#: ../../library/profile.rst:674 +#: ../../library/profile.rst:681 msgid "" "Be warned that you should calibrate the profiler class for the timer " "function that you choose (see :ref:`profile-calibration`). For most " @@ -1121,11 +1131,11 @@ msgid "" "along with the appropriate calibration constant." msgstr "" -#: ../../library/profile.rst:683 +#: ../../library/profile.rst:690 msgid ":class:`cProfile.Profile`" msgstr ":class:`cProfile.Profile`" -#: ../../library/profile.rst:684 +#: ../../library/profile.rst:691 msgid "" "``your_time_func`` should return a single number. If it returns integers, " "you can also invoke the class constructor with a second argument specifying " @@ -1134,11 +1144,11 @@ msgid "" "you would construct the :class:`Profile` instance as follows::" msgstr "" -#: ../../library/profile.rst:690 +#: ../../library/profile.rst:697 msgid "pr = cProfile.Profile(your_integer_time_func, 0.001)" msgstr "pr = cProfile.Profile(your_integer_time_func, 0.001)" -#: ../../library/profile.rst:692 +#: ../../library/profile.rst:699 msgid "" "As the :class:`cProfile.Profile` class cannot be calibrated, custom timer " "functions should be used with care and should be as fast as possible. For " @@ -1146,7 +1156,7 @@ msgid "" "in the C source of the internal :mod:`!_lsprof` module." msgstr "" -#: ../../library/profile.rst:697 +#: ../../library/profile.rst:704 msgid "" "Python 3.3 adds several new functions in :mod:`time` that can be used to " "make precise measurements of process or wall-clock time. For example, see :" diff --git a/library/pty.po b/library/pty.po index 508bddc8ea..f609bfc794 100644 --- a/library/pty.po +++ b/library/pty.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2016-11-19 00:33+0000\n" diff --git a/library/pwd.po b/library/pwd.po index b9ddcdd639..29507dc008 100644 --- a/library/pwd.po +++ b/library/pwd.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-05-20 16:08+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -31,7 +31,8 @@ msgstr "" "此模組提供對 Unix 使用者帳戶和密碼資料庫的存取介面。它適用於所有 Unix 版本。" #: ../../library/pwd.rst:13 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#, fuzzy +msgid ":ref:`Availability `: Unix, not WASI, not iOS." msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" #: ../../library/pwd.rst:15 @@ -147,16 +148,16 @@ msgstr "" "uid 和 gid 項目為整數,其他項目都是字串。如果找不到請求的條目,則會引發 :exc:" "`KeyError`。" -#: ../../library/pwd.rst:44 +#: ../../library/pwd.rst:42 +#, fuzzy msgid "" "In traditional Unix the field ``pw_passwd`` usually contains a password " -"encrypted with a DES derived algorithm (see module :mod:`crypt`). However " -"most modern unices use a so-called *shadow password* system. On those " -"unices the *pw_passwd* field only contains an asterisk (``'*'``) or the " -"letter ``'x'`` where the encrypted password is stored in a file :file:`/etc/" -"shadow` which is not world readable. Whether the *pw_passwd* field contains " -"anything useful is system-dependent. If available, the :mod:`spwd` module " -"should be used where access to the encrypted password is required." +"encrypted with a DES derived algorithm. However most modern unices use a " +"so-called *shadow password* system. On those unices the *pw_passwd* field " +"only contains an asterisk (``'*'``) or the letter ``'x'`` where the " +"encrypted password is stored in a file :file:`/etc/shadow` which is not " +"world readable. Whether the *pw_passwd* field contains anything useful is " +"system-dependent." msgstr "" "在傳統的 Unix 中,``pw_passwd`` 欄位通常包含一個使用 DES 衍生演算法加密的密碼" "(參見模組 :mod:`crypt`)。然而,大多數現代 Unix 是使用所謂的 *shadow " @@ -165,46 +166,42 @@ msgstr "" "shadow` 文件中。 *pw_passwd* 欄位是否包含任何有用的內容取決於系統。如果可用," "應該要在需要存取加密密碼的地方使用 :mod:`spwd` 模組。" -#: ../../library/pwd.rst:53 +#: ../../library/pwd.rst:50 msgid "It defines the following items:" msgstr "它定義了以下項目:" -#: ../../library/pwd.rst:58 +#: ../../library/pwd.rst:55 msgid "Return the password database entry for the given numeric user ID." msgstr "回傳給定數值使用者 ID 的密碼資料庫條目。" -#: ../../library/pwd.rst:63 +#: ../../library/pwd.rst:60 msgid "Return the password database entry for the given user name." msgstr "回傳給定使用者名稱的密碼資料庫條目。" -#: ../../library/pwd.rst:68 +#: ../../library/pwd.rst:65 msgid "" "Return a list of all available password database entries, in arbitrary order." msgstr "以任意順序回傳所有可用密碼資料庫條目的 list。" -#: ../../library/pwd.rst:73 +#: ../../library/pwd.rst:70 msgid "Module :mod:`grp`" msgstr ":mod:`grp` 模組" -#: ../../library/pwd.rst:74 +#: ../../library/pwd.rst:71 msgid "An interface to the group database, similar to this." msgstr "群組資料庫的介面,與此模組類似。" -#: ../../library/pwd.rst:76 -msgid "Module :mod:`spwd`" -msgstr ":mod:`spwd` 模組" +#~ msgid "Module :mod:`spwd`" +#~ msgstr ":mod:`spwd` 模組" -#: ../../library/pwd.rst:77 -msgid "An interface to the shadow password database, similar to this." -msgstr "Shadow 密碼資料庫的介面,與此模組類似。" +#~ msgid "An interface to the shadow password database, similar to this." +#~ msgstr "Shadow 密碼資料庫的介面,與此模組類似。" -#: ../../library/pwd.rst:42 -msgid "module" -msgstr "module(模組)" +#~ msgid "module" +#~ msgstr "module(模組)" -#: ../../library/pwd.rst:42 -msgid "crypt" -msgstr "crypt" +#~ msgid "crypt" +#~ msgstr "crypt" #~ msgid "" #~ "This module does not work or is not available on WebAssembly platforms " diff --git a/library/py_compile.po b/library/py_compile.po index 285dff5332..19828595ae 100644 --- a/library/py_compile.po +++ b/library/py_compile.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" diff --git a/library/pyclbr.po b/library/pyclbr.po index 9a31c04cd0..c55eccfc78 100644 --- a/library/pyclbr.po +++ b/library/pyclbr.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" diff --git a/library/pydoc.po b/library/pydoc.po index 1b3de1fd42..d301141ac0 100644 --- a/library/pydoc.po +++ b/library/pydoc.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,8 +36,8 @@ msgstr "" #: ../../library/pydoc.rst:23 msgid "" "For modules, classes, functions and methods, the displayed documentation is " -"derived from the docstring (i.e. the :attr:`!__doc__` attribute) of the " -"object, and recursively of its documentable members. If there is no " +"derived from the docstring (i.e. the :attr:`~definition.__doc__` attribute) " +"of the object, and recursively of its documentable members. If there is no " "docstring, :mod:`!pydoc` tries to obtain a description from the block of " "comment lines just above the definition of the class, function or method in " "the source file, or at the top of the module (see :func:`inspect." diff --git a/library/pyexpat.po b/library/pyexpat.po index c589eba9f1..b5d6eca3f3 100644 --- a/library/pyexpat.po +++ b/library/pyexpat.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:08+0000\n" diff --git a/library/python.po b/library/python.po index 0380edcd9b..804cb269c0 100644 --- a/library/python.po +++ b/library/python.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/queue.po b/library/queue.po index 914fef0b6c..489a62d536 100644 --- a/library/queue.po +++ b/library/queue.po @@ -8,9 +8,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-09-27 00:12+0800\n" "Last-Translator: Allen Wu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -174,11 +174,20 @@ msgstr "" "當對一個已滿的 :class:`Queue` 物件呼叫非阻塞的 :meth:`~Queue.put`\\ (或 :" "meth:`~Queue.put_nowait`\\ )將引發此例外。" -#: ../../library/queue.rst:99 +#: ../../library/queue.rst:98 +#, fuzzy +msgid "" +"Exception raised when :meth:`~Queue.put` or :meth:`~Queue.get` is called on " +"a :class:`Queue` object which has been shut down." +msgstr "" +"當對一個空的 :class:`Queue` 物件呼叫非阻塞的 (non-blocking) :meth:`~Queue." +"get`\\ (或 :meth:`~Queue.get_nowait`\\ )將引發此例外。" + +#: ../../library/queue.rst:107 msgid "Queue Objects" msgstr "佇列物件" -#: ../../library/queue.rst:101 +#: ../../library/queue.rst:109 msgid "" "Queue objects (:class:`Queue`, :class:`LifoQueue`, or :class:" "`PriorityQueue`) provide the public methods described below." @@ -186,7 +195,7 @@ msgstr "" "佇列物件(:class:`Queue`、:class:`LifoQueue`、:class:`PriorityQueue`)提供下" "面描述的公用 method。" -#: ../../library/queue.rst:107 +#: ../../library/queue.rst:115 msgid "" "Return the approximate size of the queue. Note, qsize() > 0 doesn't " "guarantee that a subsequent get() will not block, nor will qsize() < maxsize " @@ -195,7 +204,7 @@ msgstr "" "回傳佇列的近似大小。注意,qsize() > 0 並不能保證後續的 get() 不會阻塞," "qsize() < maxsize 也不會保證 put() 不會阻塞。" -#: ../../library/queue.rst:114 +#: ../../library/queue.rst:122 msgid "" "Return ``True`` if the queue is empty, ``False`` otherwise. If empty() " "returns ``True`` it doesn't guarantee that a subsequent call to put() will " @@ -206,7 +215,7 @@ msgstr "" "``True``,則不保證後續呼叫 put() 不會阻塞。同樣,如果 empty() 回傳 " "``False``,則不保證後續呼叫 get() 不會阻塞。" -#: ../../library/queue.rst:122 +#: ../../library/queue.rst:130 msgid "" "Return ``True`` if the queue is full, ``False`` otherwise. If full() " "returns ``True`` it doesn't guarantee that a subsequent call to get() will " @@ -217,7 +226,7 @@ msgstr "" "``True``,則不保證後續呼叫 get() 不會阻塞。同樣,如果 full() 回傳 ``False``," "則不保證後續呼叫 put() 不會阻塞。" -#: ../../library/queue.rst:130 +#: ../../library/queue.rst:138 msgid "" "Put *item* into the queue. If optional args *block* is true and *timeout* " "is ``None`` (the default), block if necessary until a free slot is " @@ -233,11 +242,15 @@ msgstr "" "引發 :exc:`Full` 例外。否則(*block* 為 false),如果自由槽立即可用,則將項目" "放在佇列中,否則引發 :exc:`Full` 例外(在這種情況下,*timeout* 將被忽略)。" -#: ../../library/queue.rst:141 +#: ../../library/queue.rst:146 +msgid "Raises :exc:`ShutDown` if the queue has been shut down." +msgstr "" + +#: ../../library/queue.rst:151 msgid "Equivalent to ``put(item, block=False)``." msgstr "等效於 ``put(item, block=False)``。" -#: ../../library/queue.rst:146 ../../library/queue.rst:258 +#: ../../library/queue.rst:156 ../../library/queue.rst:297 msgid "" "Remove and return an item from the queue. If optional args *block* is true " "and *timeout* is ``None`` (the default), block if necessary until an item is " @@ -253,7 +266,7 @@ msgstr "" "`Empty` 例外。否則(*block* 為 false),如果立即可用,則回傳一個項目,否則引" "發 :exc:`Empty` 例外(在這種情況下,*timeout* 將被忽略)。" -#: ../../library/queue.rst:153 +#: ../../library/queue.rst:163 msgid "" "Prior to 3.0 on POSIX systems, and for all versions on Windows, if *block* " "is true and *timeout* is ``None``, this operation goes into an " @@ -265,11 +278,17 @@ msgstr "" "*timeout* 為 ``None``,則此操作將在底層鎖上進入不間斷等待。這意味著不會發生例" "外,特別是 SIGINT(中斷訊號)不會觸發 :exc:`KeyboardInterrupt`。" -#: ../../library/queue.rst:161 ../../library/queue.rst:268 +#: ../../library/queue.rst:168 +msgid "" +"Raises :exc:`ShutDown` if the queue has been shut down and is empty, or if " +"the queue has been shut down immediately." +msgstr "" + +#: ../../library/queue.rst:174 ../../library/queue.rst:307 msgid "Equivalent to ``get(False)``." msgstr "等效於 ``get(False)``。" -#: ../../library/queue.rst:163 +#: ../../library/queue.rst:176 msgid "" "Two methods are offered to support tracking whether enqueued tasks have been " "fully processed by daemon consumer threads." @@ -277,7 +296,7 @@ msgstr "" "有兩個 method 可以支援追蹤放入佇列的任務是否已由常駐消費者執行緒 (daemon " "consumer threads) 完全處理。" -#: ../../library/queue.rst:169 +#: ../../library/queue.rst:182 msgid "" "Indicate that a formerly enqueued task is complete. Used by queue consumer " "threads. For each :meth:`get` used to fetch a task, a subsequent call to :" @@ -286,7 +305,7 @@ msgstr "" "表示先前放入佇列的任務已完成。由佇列消費者執行緒使用。對於用來提取任務的每" "個 :meth:`get`,隨後呼叫 :meth:`task_done` 告訴佇列任務的處理已完成。" -#: ../../library/queue.rst:173 +#: ../../library/queue.rst:186 msgid "" "If a :meth:`join` is currently blocking, it will resume when all items have " "been processed (meaning that a :meth:`task_done` call was received for every " @@ -295,17 +314,23 @@ msgstr "" "如果目前 :meth:`join` 阻塞,它將會在所有項目都已處理完畢後恢復(代表對於以 :" "meth:`put` 放進佇列的每個項目,都要收到 :meth:`task_done` 的呼叫)。" -#: ../../library/queue.rst:177 +#: ../../library/queue.rst:190 +msgid "" +"``shutdown(immediate=True)`` calls :meth:`task_done` for each remaining item " +"in the queue." +msgstr "" + +#: ../../library/queue.rst:193 msgid "" "Raises a :exc:`ValueError` if called more times than there were items placed " "in the queue." msgstr "如果呼叫次數超過佇列中放置的項目數量,則引發 :exc:`ValueError`。" -#: ../../library/queue.rst:183 +#: ../../library/queue.rst:199 msgid "Blocks until all items in the queue have been gotten and processed." msgstr "持續阻塞直到佇列中的所有項目都已被獲取並處理完畢。" -#: ../../library/queue.rst:185 +#: ../../library/queue.rst:201 msgid "" "The count of unfinished tasks goes up whenever an item is added to the " "queue. The count goes down whenever a consumer thread calls :meth:" @@ -317,11 +342,11 @@ msgstr "" "`task_done` 以指示該項目已被取出並且對其的所有工作都已完成時,計數就會下降。" "當未完成任務的計數降至零時,:meth:`join` 將停止阻塞。" -#: ../../library/queue.rst:191 +#: ../../library/queue.rst:207 msgid "Example of how to wait for enqueued tasks to be completed::" msgstr "如何等待放入佇列的任務完成的範例: ::" -#: ../../library/queue.rst:193 +#: ../../library/queue.rst:209 msgid "" "import threading\n" "import queue\n" @@ -347,23 +372,54 @@ msgid "" "print('All work completed')" msgstr "" -#: ../../library/queue.rst:218 +#: ../../library/queue.rst:234 +msgid "Terminating queues" +msgstr "" + +#: ../../library/queue.rst:236 +msgid "" +":class:`Queue` objects can be made to prevent further interaction by " +"shutting them down." +msgstr "" + +#: ../../library/queue.rst:241 +msgid "" +"Shut down the queue, making :meth:`~Queue.get` and :meth:`~Queue.put` raise :" +"exc:`ShutDown`." +msgstr "" + +#: ../../library/queue.rst:244 +msgid "" +"By default, :meth:`~Queue.get` on a shut down queue will only raise once the " +"queue is empty. Set *immediate* to true to make :meth:`~Queue.get` raise " +"immediately instead." +msgstr "" + +#: ../../library/queue.rst:248 +msgid "" +"All blocked callers of :meth:`~Queue.put` and :meth:`~Queue.get` will be " +"unblocked. If *immediate* is true, a task will be marked as done for each " +"remaining item in the queue, which may unblock callers of :meth:`~Queue." +"join`." +msgstr "" + +#: ../../library/queue.rst:257 msgid "SimpleQueue Objects" msgstr "SimpleQueue 物件" -#: ../../library/queue.rst:220 +#: ../../library/queue.rst:259 msgid "" ":class:`SimpleQueue` objects provide the public methods described below." msgstr ":class:`SimpleQueue` 物件提供下面描述的公用 method。" -#: ../../library/queue.rst:224 +#: ../../library/queue.rst:263 msgid "" "Return the approximate size of the queue. Note, qsize() > 0 doesn't " "guarantee that a subsequent get() will not block." msgstr "" "傳回佇列的近似大小。注意,qsize() > 0 並不能保證後續的 get() 不會阻塞。" -#: ../../library/queue.rst:230 +#: ../../library/queue.rst:269 msgid "" "Return ``True`` if the queue is empty, ``False`` otherwise. If empty() " "returns ``False`` it doesn't guarantee that a subsequent call to get() will " @@ -372,7 +428,7 @@ msgstr "" "如果佇列為空,則回傳 ``True``,否則回傳 ``False``。如果 empty() 回傳 " "``False``,則不保證後續呼叫 get() 不會阻塞。" -#: ../../library/queue.rst:237 +#: ../../library/queue.rst:276 msgid "" "Put *item* into the queue. The method never blocks and always succeeds " "(except for potential low-level errors such as failure to allocate memory). " @@ -383,7 +439,7 @@ msgstr "" "像是分配記憶體失敗)。可選的 args *block* 和 *timeout* 會被忽略,它們僅是為了" "與 :meth:`Queue.put` 相容才存在。" -#: ../../library/queue.rst:243 +#: ../../library/queue.rst:282 msgid "" "This method has a C implementation which is reentrant. That is, a ``put()`` " "or ``get()`` call can be interrupted by another ``put()`` call in the same " @@ -396,18 +452,18 @@ msgstr "" "鎖 (deadlock) 或損壞佇列中的內部狀態。這使得它適合在解構子 (destructor) 中使" "用,像是 ``__del__`` method 或 :mod:`weakref` 回呼函式 (callback)。" -#: ../../library/queue.rst:252 +#: ../../library/queue.rst:291 msgid "" "Equivalent to ``put(item, block=False)``, provided for compatibility with :" "meth:`Queue.put_nowait`." msgstr "" "等效於 ``put(item, block=False)``,用於與 :meth:`Queue.put_nowait` 相容。" -#: ../../library/queue.rst:273 +#: ../../library/queue.rst:312 msgid "Class :class:`multiprocessing.Queue`" msgstr "Class :class:`multiprocessing.Queue`" -#: ../../library/queue.rst:274 +#: ../../library/queue.rst:313 msgid "" "A queue class for use in a multi-processing (rather than multi-threading) " "context." @@ -415,7 +471,7 @@ msgstr "" "用於多行程處理 (multi-processing)(而非多執行緒)情境 (context) 的佇列 " "class。" -#: ../../library/queue.rst:277 +#: ../../library/queue.rst:316 msgid "" ":class:`collections.deque` is an alternative implementation of unbounded " "queues with fast atomic :meth:`~collections.deque.append` and :meth:" diff --git a/library/quopri.po b/library/quopri.po index 5799070e46..f4dccd0e0d 100644 --- a/library/quopri.po +++ b/library/quopri.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2023-07-01 14:59+0800\n" diff --git a/library/random.po b/library/random.po index dccebf8953..08679f4e90 100644 --- a/library/random.po +++ b/library/random.po @@ -5,9 +5,9 @@ # Allen Wu , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2023-01-23 22:47+0800\n" "Last-Translator: Allen Wu \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -129,15 +129,24 @@ msgstr "" "activestate.com/recipes/576707-long-period-random-number-generator/>`_,可作" "為隨機數產生器的一個可相容替代方案,具有較長的週期和相對簡單的更新操作。" -#: ../../library/random.rst:64 +#: ../../library/random.rst:63 +msgid "" +"The global random number generator and instances of :class:`Random` are " +"thread-safe. However, in the free-threaded build, concurrent calls to the " +"global generator or to the same instance of :class:`Random` may encounter " +"contention and poor performance. Consider using separate instances of :class:" +"`Random` per thread instead." +msgstr "" + +#: ../../library/random.rst:70 msgid "Bookkeeping functions" msgstr "簿記函式 (bookkeeping functions)" -#: ../../library/random.rst:68 +#: ../../library/random.rst:74 msgid "Initialize the random number generator." msgstr "初始化隨機數產生器。" -#: ../../library/random.rst:70 +#: ../../library/random.rst:76 msgid "" "If *a* is omitted or ``None``, the current system time is used. If " "randomness sources are provided by the operating system, they are used " @@ -148,11 +157,11 @@ msgstr "" "供,則使用它們而不是系統時間(有關可用性的詳細資訊,請參考 :func:`os." "urandom` 函式)。" -#: ../../library/random.rst:75 +#: ../../library/random.rst:81 msgid "If *a* is an int, it is used directly." msgstr "如果 *a* 為 int(整數),則直接使用它。" -#: ../../library/random.rst:77 +#: ../../library/random.rst:83 msgid "" "With version 2 (the default), a :class:`str`, :class:`bytes`, or :class:" "`bytearray` object gets converted to an :class:`int` and all of its bits are " @@ -161,7 +170,7 @@ msgstr "" "如使用版本 2(預設值),:class:`str`、:class:`bytes` 或 :class:`bytearray` 物" "件將轉換為 :class:`int`,並使用其所有位元。" -#: ../../library/random.rst:80 +#: ../../library/random.rst:86 msgid "" "With version 1 (provided for reproducing random sequences from older " "versions of Python), the algorithm for :class:`str` and :class:`bytes` " @@ -170,12 +179,12 @@ msgstr "" "若使用版本 1(為復現於舊版本 Python 中產生隨機序列而提供),:class:`str` 和 :" "class:`bytes` 的演算法會生成範圍更窄的種子 (seed)。" -#: ../../library/random.rst:84 +#: ../../library/random.rst:90 msgid "" "Moved to the version 2 scheme which uses all of the bits in a string seed." msgstr "移至版本 2 方案,該方案使用字串種子中的所有位元。" -#: ../../library/random.rst:87 +#: ../../library/random.rst:93 msgid "" "The *seed* must be one of the following types: ``None``, :class:`int`, :" "class:`float`, :class:`str`, :class:`bytes`, or :class:`bytearray`." @@ -183,7 +192,7 @@ msgstr "" "*seed* 必須是以下型別之一:``None``、:class:`int`、:class:`float`、:class:" "`str`、:class:`bytes`、:class:`bytearray`。" -#: ../../library/random.rst:94 +#: ../../library/random.rst:100 msgid "" "Return an object capturing the current internal state of the generator. " "This object can be passed to :func:`setstate` to restore the state." @@ -191,7 +200,7 @@ msgstr "" "回傳一個物件,捕獲產生器的當前內部狀態。此物件可以傳遞給 :func:`setstate` 以" "恢復狀態。" -#: ../../library/random.rst:100 +#: ../../library/random.rst:106 msgid "" "*state* should have been obtained from a previous call to :func:`getstate`, " "and :func:`setstate` restores the internal state of the generator to what it " @@ -200,30 +209,30 @@ msgstr "" "*state* 應該要從之前對 :func:`getstate` 的呼叫中獲得,並且以 :func:" "`setstate` 將產生器的內部狀態恢復到呼叫 :func:`getstate` 時的狀態。" -#: ../../library/random.rst:106 +#: ../../library/random.rst:112 msgid "Functions for bytes" msgstr "回傳位元組的函式" -#: ../../library/random.rst:110 +#: ../../library/random.rst:116 msgid "Generate *n* random bytes." msgstr "產生 *n* 個隨機位元組。" -#: ../../library/random.rst:112 +#: ../../library/random.rst:118 msgid "" "This method should not be used for generating security tokens. Use :func:" "`secrets.token_bytes` instead." msgstr "" "此方法不應使用於產生安全性權杖 (Token)。請改用 :func:`secrets.token_bytes`。" -#: ../../library/random.rst:119 +#: ../../library/random.rst:125 msgid "Functions for integers" msgstr "回傳整數的函式" -#: ../../library/random.rst:124 +#: ../../library/random.rst:130 msgid "Return a randomly selected element from ``range(start, stop, step)``." msgstr "傳回從 ``range(start, stop, step)`` 中隨機選擇的元素。" -#: ../../library/random.rst:126 +#: ../../library/random.rst:132 msgid "" "This is roughly equivalent to ``choice(range(start, stop, step))`` but " "supports arbitrarily large ranges and is optimized for common cases." @@ -231,11 +240,11 @@ msgstr "" "這大致相當於 ``choice(range(start, stop, step))``,但支援任意大的範圍,並針對" "常見情況進行了最佳化。" -#: ../../library/random.rst:129 +#: ../../library/random.rst:135 msgid "The positional argument pattern matches the :func:`range` function." msgstr "位置引數模式與 :func:`range` 函式相符。" -#: ../../library/random.rst:131 +#: ../../library/random.rst:137 msgid "" "Keyword arguments should not be used because they can be interpreted in " "unexpected ways. For example ``randrange(start=100)`` is interpreted as " @@ -244,7 +253,7 @@ msgstr "" "不應使用關鍵字引數,因為它們可能會以意想不到的方式被直譯。例如 " "``randrange(start=100)`` 會被直譯為 ``randrange(0, 100, 1)``。" -#: ../../library/random.rst:135 +#: ../../library/random.rst:141 msgid "" ":meth:`randrange` is more sophisticated about producing equally distributed " "values. Formerly it used a style like ``int(random()*n)`` which could " @@ -253,7 +262,7 @@ msgstr "" ":meth:`randrange` 在產生均勻分佈的值方面更為複雜。以前,它使用像 " "``int(random()*n)`` 這樣的樣式,這可能會產生稍微不均勻的分佈。" -#: ../../library/random.rst:140 +#: ../../library/random.rst:146 msgid "" "Automatic conversion of non-integer types is no longer supported. Calls such " "as ``randrange(10.0)`` and ``randrange(Fraction(10, 1))`` now raise a :exc:" @@ -262,14 +271,14 @@ msgstr "" "已經不再支援非整數類型到等效整數的自動轉換。像是 ``randrange(10.0)`` 和 " "``randrange(Fraction(10, 1))`` 的呼叫將會引發 :exc:`TypeError`。" -#: ../../library/random.rst:147 +#: ../../library/random.rst:153 msgid "" "Return a random integer *N* such that ``a <= N <= b``. Alias for " "``randrange(a, b+1)``." msgstr "" "回傳一個隨機整數 *N*,使得 ``a <= N <= b``。為 ``randrange(a, b+1)`` 的別名。" -#: ../../library/random.rst:152 +#: ../../library/random.rst:158 msgid "" "Returns a non-negative Python integer with *k* random bits. This method is " "supplied with the Mersenne Twister generator and some other generators may " @@ -280,15 +289,15 @@ msgstr "" "生器一起提供,一些其他的產生器也可能將其作為 API 的可選部分。如果可用,:meth:" "`getrandbits` 使 :meth:`randrange` 能夠處理任意大的範圍。" -#: ../../library/random.rst:158 +#: ../../library/random.rst:164 msgid "This method now accepts zero for *k*." msgstr "此方法現在接受 *k* 為零。" -#: ../../library/random.rst:163 +#: ../../library/random.rst:169 msgid "Functions for sequences" msgstr "回傳序列的函式" -#: ../../library/random.rst:167 +#: ../../library/random.rst:173 msgid "" "Return a random element from the non-empty sequence *seq*. If *seq* is " "empty, raises :exc:`IndexError`." @@ -296,7 +305,7 @@ msgstr "" "從非空序列 *seq* 回傳一個隨機元素。如果 *seq* 為空,則引發 :exc:" "`IndexError`。" -#: ../../library/random.rst:172 +#: ../../library/random.rst:178 msgid "" "Return a *k* sized list of elements chosen from the *population* with " "replacement. If the *population* is empty, raises :exc:`IndexError`." @@ -304,7 +313,7 @@ msgstr "" "回傳從 *population* 中重置取樣出的一個大小為 *k* 的元素 list。如果 " "*population* 為空,則引發 :exc:`IndexError`。" -#: ../../library/random.rst:175 +#: ../../library/random.rst:181 msgid "" "If a *weights* sequence is specified, selections are made according to the " "relative weights. Alternatively, if a *cum_weights* sequence is given, the " @@ -320,7 +329,7 @@ msgstr "" "15, 45, 50]``。在內部,相對權重在進行選擇之前會轉換為累積權重,因此提供累積權" "重可以節省工作。" -#: ../../library/random.rst:184 +#: ../../library/random.rst:190 msgid "" "If neither *weights* nor *cum_weights* are specified, selections are made " "with equal probability. If a weights sequence is supplied, it must be the " @@ -331,7 +340,7 @@ msgstr "" "供了加權序列,則該序列的長度必須與 *population* 序列的長度相同。它是一個 :" "exc:`TypeError` 來指定 *weights* 和 *cum_weights*。" -#: ../../library/random.rst:189 +#: ../../library/random.rst:195 msgid "" "The *weights* or *cum_weights* can use any numeric type that interoperates " "with the :class:`float` values returned by :func:`random` (that includes " @@ -344,7 +353,7 @@ msgstr "" "數值類型。權重假定為非負數和有限的。如果所有權重均為零,則引發 :exc:" "`ValueError`。" -#: ../../library/random.rst:195 +#: ../../library/random.rst:201 msgid "" "For a given seed, the :func:`choices` function with equal weighting " "typically produces a different sequence than repeated calls to :func:" @@ -358,15 +367,15 @@ msgstr "" "和速度。:func:`choice` 使用的演算法預設為整數運算和重複選擇,以避免捨入誤差產" "生的小偏差。" -#: ../../library/random.rst:204 +#: ../../library/random.rst:210 msgid "Raises a :exc:`ValueError` if all weights are zero." msgstr "如果所有權重均為零,則引發 :exc:`ValueError`。" -#: ../../library/random.rst:210 +#: ../../library/random.rst:216 msgid "Shuffle the sequence *x* in place." msgstr "將序列 *x* 原地 (in place) 隨機打亂位置。" -#: ../../library/random.rst:212 +#: ../../library/random.rst:218 msgid "" "To shuffle an immutable sequence and return a new shuffled list, use " "``sample(x, k=len(x))`` instead." @@ -374,7 +383,7 @@ msgstr "" "要打亂一個不可變的序列並回傳一個新的被打亂的 list(串列),請使用 " "``sample(x, k=len(x))``。" -#: ../../library/random.rst:215 +#: ../../library/random.rst:221 msgid "" "Note that even for small ``len(x)``, the total number of permutations of *x* " "can quickly grow larger than the period of most random number generators. " @@ -386,11 +395,11 @@ msgstr "" "數產生器的週期。這意味著長序列的大多數置換永遠無法產生。例如,長度為 2080 的" "序列是 Mersenne Twister 隨機數產生器週期內可以容納的最大序列。" -#: ../../library/random.rst:221 +#: ../../library/random.rst:227 msgid "Removed the optional parameter *random*." msgstr "移除可選參數 *random*。" -#: ../../library/random.rst:227 +#: ../../library/random.rst:233 msgid "" "Return a *k* length list of unique elements chosen from the population " "sequence. Used for random sampling without replacement." @@ -398,7 +407,7 @@ msgstr "" "回傳從母體序列中選擇出的一個包含獨特元素、長度為 *k* 的 list。用於不重置的隨" "機取樣。" -#: ../../library/random.rst:230 +#: ../../library/random.rst:236 msgid "" "Returns a new list containing elements from the population while leaving the " "original population unchanged. The resulting list is in selection order so " @@ -410,7 +419,7 @@ msgstr "" "此所有子切片也會是有效的隨機樣本。這允許抽獎獲獎者(樣本)分為大獎和第二名獲" "獎者(子切片)。" -#: ../../library/random.rst:236 +#: ../../library/random.rst:242 msgid "" "Members of the population need not be :term:`hashable` or unique. If the " "population contains repeats, then each occurrence is a possible selection in " @@ -419,7 +428,7 @@ msgstr "" "母體成員不必是 :term:`hashable` 或唯一的。如果母體包含重複項,則每次出現都是" "樣本中可能出現的一個選擇。" -#: ../../library/random.rst:239 +#: ../../library/random.rst:245 msgid "" "Repeated elements can be specified one at a time or with the optional " "keyword-only *counts* parameter. For example, ``sample(['red', 'blue'], " @@ -430,7 +439,7 @@ msgstr "" "素。例如 ``sample(['red', 'blue'], counts=[4, 2], k=5)`` 等同於 " "``sample(['red', 'red', 'red', 'red', 'blue', 'blue'], k=5)``。" -#: ../../library/random.rst:244 +#: ../../library/random.rst:250 msgid "" "To choose a sample from a range of integers, use a :func:`range` object as " "an argument. This is especially fast and space efficient for sampling from " @@ -439,31 +448,31 @@ msgstr "" "若要從整數範圍中選擇範例,請使用 :func:`range` 物件作為引數。這對於從大型母體" "中取樣特別快速且節省空間:``sample(range(10000000), k=60)``。" -#: ../../library/random.rst:248 +#: ../../library/random.rst:254 msgid "" "If the sample size is larger than the population size, a :exc:`ValueError` " "is raised." msgstr "如果樣本大小大於母體大小,:exc:`ValueError` 會被引發。" -#: ../../library/random.rst:251 +#: ../../library/random.rst:257 msgid "Added the *counts* parameter." msgstr "新增 *counts* 參數。" -#: ../../library/random.rst:256 +#: ../../library/random.rst:262 msgid "" "The *population* must be a sequence. Automatic conversion of sets to lists " "is no longer supported." msgstr "*population* 必須是一個序列。不再支援將 set 自動轉換為 list。" -#: ../../library/random.rst:260 +#: ../../library/random.rst:266 msgid "Discrete distributions" msgstr "離散分布" -#: ../../library/random.rst:262 +#: ../../library/random.rst:268 msgid "The following function generates a discrete distribution." msgstr "以下函式產生離散分佈。" -#: ../../library/random.rst:266 +#: ../../library/random.rst:272 msgid "" "`Binomial distribution `_. Return the number of successes for *n* independent trials with the " @@ -473,15 +482,15 @@ msgstr "" "BinomialDistribution.html>`_。回傳 *n* 個獨立試驗的成功次數,每個試驗的成功機" "率為 *p*:" -#: ../../library/random.rst:271 +#: ../../library/random.rst:277 msgid "Mathematically equivalent to::" msgstr "數學上等價於: ::" -#: ../../library/random.rst:273 +#: ../../library/random.rst:279 msgid "sum(random() < p for i in range(n))" msgstr "sum(random() < p for i in range(n))" -#: ../../library/random.rst:275 +#: ../../library/random.rst:281 msgid "" "The number of trials *n* should be a non-negative integer. The probability " "of success *p* should be between ``0.0 <= p <= 1.0``. The result is an " @@ -490,11 +499,11 @@ msgstr "" "試驗次數 *n* 應為非負整數。成功的機率 *p* 應在 ``0.0 <= p <= 1.0`` 之間。結果" "是 ``0 <= X <= n`` 範圍內的整數。" -#: ../../library/random.rst:285 +#: ../../library/random.rst:291 msgid "Real-valued distributions" msgstr "實數分布" -#: ../../library/random.rst:287 +#: ../../library/random.rst:293 msgid "" "The following functions generate specific real-valued distributions. " "Function parameters are named after the corresponding variables in the " @@ -504,12 +513,12 @@ msgstr "" "以下函式產生特定的實數分佈。函式參數以分佈方程中的對應變數命名,如常見的數學" "實踐所示;這些方程式中的大多數都可以在任意統計文本中找到。" -#: ../../library/random.rst:295 +#: ../../library/random.rst:301 msgid "" "Return the next random floating-point number in the range ``0.0 <= X < 1.0``" msgstr "回傳範圍 ``0.0 <= X < 1.0`` 中的下一個隨機浮點數" -#: ../../library/random.rst:300 +#: ../../library/random.rst:306 msgid "" "Return a random floating-point number *N* such that ``a <= N <= b`` for ``a " "<= b`` and ``b <= N <= a`` for ``b < a``." @@ -517,7 +526,7 @@ msgstr "" "回傳一個隨機浮點數 *N*,當 ``a <= b`` 時確保 N 為 ``a <= N <= b`` 、``b < " "a`` 時確保 N 為 ``b <= N <= a``。" -#: ../../library/random.rst:303 +#: ../../library/random.rst:309 msgid "" "The end-point value ``b`` may or may not be included in the range depending " "on floating-point rounding in the expression ``a + (b-a) * random()``." @@ -525,7 +534,7 @@ msgstr "" "終點值 ``b`` 可能包含在範圍內,也可能不包含在範圍內,取決於運算式 ``a + (b-" "a) * random()`` 中的浮點捨入。" -#: ../../library/random.rst:310 +#: ../../library/random.rst:316 msgid "" "Return a random floating-point number *N* such that ``low <= N <= high`` and " "with the specified *mode* between those bounds. The *low* and *high* bounds " @@ -536,7 +545,7 @@ msgstr "" "的 *mode*。*low* 和 *high* 邊界預設為零和一。*mode* 引數預設為邊界之間的中" "點,從而給出對稱分佈。" -#: ../../library/random.rst:318 +#: ../../library/random.rst:324 msgid "" "Beta distribution. Conditions on the parameters are ``alpha > 0`` and " "``beta > 0``. Returned values range between 0 and 1." @@ -544,7 +553,7 @@ msgstr "" "Beta(貝它)分布。參數的條件為 ``alpha > 0`` 和 ``beta > 0``。回傳值的範圍介" "於 0 和 1 之間。" -#: ../../library/random.rst:324 +#: ../../library/random.rst:330 msgid "" "Exponential distribution. *lambd* is 1.0 divided by the desired mean. It " "should be nonzero. (The parameter would be called \"lambda\", but that is a " @@ -556,11 +565,11 @@ msgstr "" "\"lambda\",但這是 Python 中的保留字)如果 *lambd* 為正,則回傳值的範圍從 0 " "到正無窮大;如果 *lambd* 為負,則回傳值的範圍從負無窮大到 0。" -#: ../../library/random.rst:330 +#: ../../library/random.rst:336 msgid "Added the default value for ``lambd``." msgstr "新增 ``lambd`` 的預設值。" -#: ../../library/random.rst:336 +#: ../../library/random.rst:342 msgid "" "Gamma distribution. (*Not* the gamma function!) The shape and scale " "parameters, *alpha* and *beta*, must have positive values. (Calling " @@ -570,11 +579,11 @@ msgstr "" "*alpha* 和 *beta* 必須具有正值。(根據呼叫習慣不同,部分來源會將 'beta' 定義" "為比例的倒數)。" -#: ../../library/random.rst:341 +#: ../../library/random.rst:347 msgid "The probability distribution function is::" msgstr "Probability distribution function(機率密度函式)是: ::" -#: ../../library/random.rst:343 +#: ../../library/random.rst:349 msgid "" " x ** (alpha - 1) * math.exp(-x / beta)\n" "pdf(x) = --------------------------------------\n" @@ -584,7 +593,7 @@ msgstr "" "pdf(x) = --------------------------------------\n" " math.gamma(alpha) * beta ** alpha" -#: ../../library/random.rst:350 +#: ../../library/random.rst:356 msgid "" "Normal distribution, also called the Gaussian distribution. *mu* is the " "mean, and *sigma* is the standard deviation. This is slightly faster than " @@ -593,7 +602,7 @@ msgstr "" "常態分佈,也稱為高斯分佈。*mu* 是平均數,*sigma* 是標準差。這比下面定義的 :" "func:`normalvariate` 函式快一點。" -#: ../../library/random.rst:355 +#: ../../library/random.rst:361 msgid "" "Multithreading note: When two threads call this function simultaneously, it " "is possible that they will receive the same return value. This can be " @@ -605,11 +614,11 @@ msgstr "" "可以透過三種方式避免。1)讓每個執行緒使用隨機數產生器的不同實例。2)在所有呼" "叫周圍加鎖。3)使用較慢但執行緒安全的 :func:`normalvariate` 函式代替。" -#: ../../library/random.rst:362 ../../library/random.rst:378 +#: ../../library/random.rst:368 ../../library/random.rst:384 msgid "*mu* and *sigma* now have default arguments." msgstr "*mu* 和 *sigma* 現在有預設引數。" -#: ../../library/random.rst:368 +#: ../../library/random.rst:374 msgid "" "Log normal distribution. If you take the natural logarithm of this " "distribution, you'll get a normal distribution with mean *mu* and standard " @@ -619,13 +628,13 @@ msgstr "" "對數常態分佈。如果你取此分佈的自然對數,你將獲得一個具有平均數 *mu* 和標準差 " "*sigma* 的常態分佈。*mu* 可以為任何值,並且 *sigma* 必須大於零。" -#: ../../library/random.rst:376 +#: ../../library/random.rst:382 msgid "" "Normal distribution. *mu* is the mean, and *sigma* is the standard " "deviation." msgstr "常態分佈。*mu* 是平均數,*sigma* 是標準差。" -#: ../../library/random.rst:384 +#: ../../library/random.rst:390 msgid "" "*mu* is the mean angle, expressed in radians between 0 and 2\\*\\ *pi*, and " "*kappa* is the concentration parameter, which must be greater than or equal " @@ -636,28 +645,28 @@ msgstr "" "大於或等於零。如果 *kappa* 等於零,則此分佈在 0 到 2\\*\\ *pi* 的範圍內將減小" "為均勻的隨機角度。" -#: ../../library/random.rst:392 +#: ../../library/random.rst:398 msgid "Pareto distribution. *alpha* is the shape parameter." msgstr "Pareto distribution(柏拉圖分佈)。*alpha* 是形狀參數。" -#: ../../library/random.rst:397 +#: ../../library/random.rst:403 msgid "" "Weibull distribution. *alpha* is the scale parameter and *beta* is the " "shape parameter." msgstr "" "Weibull distribution(韋伯分佈)。*alpha* 是比例參數,*beta* 是形狀參數。" -#: ../../library/random.rst:402 +#: ../../library/random.rst:408 msgid "Alternative Generator" msgstr "替代產生器" -#: ../../library/random.rst:406 +#: ../../library/random.rst:412 msgid "" "Class that implements the default pseudo-random number generator used by " "the :mod:`random` module." msgstr "實現 :mod:`random` 模組使用的預設偽隨機數產生器的 class。" -#: ../../library/random.rst:409 +#: ../../library/random.rst:415 msgid "" "Formerly the *seed* could be any hashable object. Now it is limited to: " "``None``, :class:`int`, :class:`float`, :class:`str`, :class:`bytes`, or :" @@ -666,14 +675,14 @@ msgstr "" "過去 *seed* 可以是任何可雜湊物件,但現在必須是以下類型之一:``None``、:class:" "`int`、:class:`float`、:class:`str`、:class:`bytes`、:class:`bytearray`。" -#: ../../library/random.rst:414 +#: ../../library/random.rst:420 msgid "" "Subclasses of :class:`!Random` should override the following methods if they " "wish to make use of a different basic generator:" msgstr "" "如果 :class:`!Random` 的子類別希望使用不同的基礎產生器,則應該覆寫以下方法:" -#: ../../library/random.rst:419 +#: ../../library/random.rst:425 msgid "" "Override this method in subclasses to customise the :meth:`~random.seed` " "behaviour of :class:`!Random` instances." @@ -681,7 +690,7 @@ msgstr "" "在子類別中覆寫此方法以自訂 :class:`!Random` 實例的 :meth:`~random.seed` 行" "為。" -#: ../../library/random.rst:424 +#: ../../library/random.rst:430 msgid "" "Override this method in subclasses to customise the :meth:`~random.getstate` " "behaviour of :class:`!Random` instances." @@ -689,7 +698,7 @@ msgstr "" "在子類別中覆寫此方法以自訂 :class:`!Random` 實例的 :meth:`~random.getstate` " "行為。" -#: ../../library/random.rst:429 +#: ../../library/random.rst:435 msgid "" "Override this method in subclasses to customise the :meth:`~random.setstate` " "behaviour of :class:`!Random` instances." @@ -697,7 +706,7 @@ msgstr "" "在子類別中覆寫此方法以自訂 :class:`!Random` 實例的 :meth:`~random.setstate` " "行為。" -#: ../../library/random.rst:434 +#: ../../library/random.rst:440 msgid "" "Override this method in subclasses to customise the :meth:`~random.random` " "behaviour of :class:`!Random` instances." @@ -705,12 +714,12 @@ msgstr "" "在子類別中覆寫此方法以自訂 :class:`!Random` 實例的 :meth:`~random.random` 行" "為。" -#: ../../library/random.rst:437 +#: ../../library/random.rst:443 msgid "" "Optionally, a custom generator subclass can also supply the following method:" msgstr "或者,自訂產生器子類別還可以提供以下方法:" -#: ../../library/random.rst:441 +#: ../../library/random.rst:447 msgid "" "Override this method in subclasses to customise the :meth:`~random." "getrandbits` behaviour of :class:`!Random` instances." @@ -718,7 +727,7 @@ msgstr "" "在子類別中覆寫此方法以自訂 :class:`!Random` 實例的 :meth:`~random." "getrandbits` 行為。" -#: ../../library/random.rst:447 +#: ../../library/random.rst:453 msgid "" "Class that uses the :func:`os.urandom` function for generating random " "numbers from sources provided by the operating system. Not available on all " @@ -732,11 +741,11 @@ msgstr "" "有效果且被忽略。如果呼叫 :meth:`getstate` 和 :meth:`setstate` 方法會引發 :" "exc:`NotImplementedError`。" -#: ../../library/random.rst:456 +#: ../../library/random.rst:462 msgid "Notes on Reproducibility" msgstr "關於 Reproducibility(復現性)的注意事項" -#: ../../library/random.rst:458 +#: ../../library/random.rst:464 msgid "" "Sometimes it is useful to be able to reproduce the sequences given by a " "pseudo-random number generator. By reusing a seed value, the same sequence " @@ -746,7 +755,7 @@ msgstr "" "有時,能夠重現偽隨機數產生器給出的序列很有用。只要多執行緒未運行,透過重複使" "用種子值,同一序列就應該可以被復現。" -#: ../../library/random.rst:462 +#: ../../library/random.rst:468 msgid "" "Most of the random module's algorithms and seeding functions are subject to " "change across Python versions, but two aspects are guaranteed not to change:" @@ -754,13 +763,13 @@ msgstr "" "大多數隨機 module 的演算法和 seed 設定函式在 Python 版本中可能會發生變化,但" "可以保證兩個方面不會改變:" -#: ../../library/random.rst:465 +#: ../../library/random.rst:471 msgid "" "If a new seeding method is added, then a backward compatible seeder will be " "offered." msgstr "如果增加了新的 seed 設定函式,則將提供向後相容的播種器 (seeder)。" -#: ../../library/random.rst:468 +#: ../../library/random.rst:474 msgid "" "The generator's :meth:`~Random.random` method will continue to produce the " "same sequence when the compatible seeder is given the same seed." @@ -768,15 +777,15 @@ msgstr "" "當相容的播種器被賦予相同的種子時,產生器的 :meth:`~Random.random` 方法將持續" "產生相同的序列。" -#: ../../library/random.rst:474 +#: ../../library/random.rst:480 msgid "Examples" msgstr "範例" -#: ../../library/random.rst:476 +#: ../../library/random.rst:482 msgid "Basic examples::" msgstr "基礎範例: ::" -#: ../../library/random.rst:478 +#: ../../library/random.rst:484 msgid "" ">>> random() # Random float: 0.0 <= x < 1.0\n" "0.37444887175646646\n" @@ -808,11 +817,11 @@ msgid "" "[40, 10, 50, 30]" msgstr "" -#: ../../library/random.rst:504 +#: ../../library/random.rst:510 msgid "Simulations::" msgstr "模擬: ::" -#: ../../library/random.rst:506 +#: ../../library/random.rst:512 msgid "" ">>> # Six roulette wheel spins (weighted sampling with replacement)\n" ">>> choices(['red', 'black', 'green'], [18, 18, 2], k=6)\n" @@ -838,7 +847,7 @@ msgid "" "0.7958" msgstr "" -#: ../../library/random.rst:529 +#: ../../library/random.rst:535 msgid "" "Example of `statistical bootstrapping `_ using resampling with replacement to estimate " @@ -848,7 +857,7 @@ msgstr "" "Bootstrapping_(statistics)>`_\\ 的範例,使用有重置的重新取樣來估計樣本平均數" "的信賴區間: ::" -#: ../../library/random.rst:533 +#: ../../library/random.rst:539 msgid "" "# https://www.thoughtco.com/example-of-bootstrapping-3126155\n" "from statistics import fmean as mean\n" @@ -868,7 +877,7 @@ msgstr "" "print(f'The sample mean of {mean(data):.1f} has a 90% confidence '\n" " f'interval from {means[5]:.1f} to {means[94]:.1f}')" -#: ../../library/random.rst:542 +#: ../../library/random.rst:548 msgid "" "Example of a `resampling permutation test `_ to determine the statistical " @@ -880,7 +889,7 @@ msgstr "" "慰劑之間差異的統計學意義或 `p 值 `_\\ " ": ::" -#: ../../library/random.rst:548 +#: ../../library/random.rst:554 msgid "" "# Example from \"Statistics is Easy\" by Dennis Shasha and Manda Wilson\n" "from statistics import fmean as mean\n" @@ -908,12 +917,12 @@ msgid "" "placebo.')" msgstr "" -#: ../../library/random.rst:569 +#: ../../library/random.rst:575 msgid "" "Simulation of arrival times and service deliveries for a multiserver queue::" msgstr "模擬多伺服器佇列 (queue) 的到達時間與服務交付: ::" -#: ../../library/random.rst:571 +#: ../../library/random.rst:577 msgid "" "from heapq import heapify, heapreplace\n" "from random import expovariate, gauss\n" @@ -942,7 +951,7 @@ msgid "" "print('Quartiles:', [round(q, 1) for q in quantiles(waits)])" msgstr "" -#: ../../library/random.rst:598 +#: ../../library/random.rst:604 msgid "" "`Statistics for Hackers `_ a " "video tutorial by `Jake Vanderplas `_ 製作的教" "學影片,僅使用幾個基本概念(包括模擬、取樣、洗牌、交叉驗證)進行統計分析。" -#: ../../library/random.rst:604 +#: ../../library/random.rst:610 msgid "" "`Economics Simulation `_ a simulation of a marketplace by `Peter Norvig `_ a tutorial by `Peter Norvig " @@ -977,11 +986,11 @@ msgstr "" "Probability.ipynb>`_\\ 為 `Peter Norvig `_ 的教" "學課程,涵蓋了機率理論的基礎知識與如何模擬以及使用 Python 執行數據分析。" -#: ../../library/random.rst:619 +#: ../../library/random.rst:625 msgid "Recipes" msgstr "使用方案" -#: ../../library/random.rst:621 +#: ../../library/random.rst:627 msgid "" "These recipes show how to efficiently make random selections from the " "combinatoric iterators in the :mod:`itertools` module:" @@ -989,7 +998,7 @@ msgstr "" "這些使用方案展示了如何有效地從 :mod:`itertools` 模組的組合疊代器 " "(combinatoric iterators) 中進行隨機選擇:" -#: ../../library/random.rst:624 +#: ../../library/random.rst:630 msgid "" "def random_product(*args, repeat=1):\n" " \"Random selection from itertools.product(*args, **kwds)\"\n" @@ -1020,7 +1029,7 @@ msgid "" " return tuple(pool[i] for i in indices)" msgstr "" -#: ../../library/random.rst:653 +#: ../../library/random.rst:659 msgid "" "The default :func:`.random` returns multiples of 2⁻⁵³ in the range *0.0 ≤ x " "< 1.0*. All such numbers are evenly spaced and are exactly representable as " @@ -1032,7 +1041,7 @@ msgstr "" "均勻分佈的,並且可以完全表示為 Python float。但是,該間隔中的許多其他可表示" "的 float 不是可能的選擇。 例如 ``0.05954861408025609`` 不是 2⁻⁵³ 的整數倍。" -#: ../../library/random.rst:659 +#: ../../library/random.rst:665 msgid "" "The following recipe takes a different approach. All floats in the interval " "are possible selections. The mantissa comes from a uniform distribution of " @@ -1044,7 +1053,7 @@ msgstr "" "數 < 2⁵³* 範圍內的整數均勻分佈。指數來自幾何分佈,其中小於 *-53* 的指數的出現" "頻率是下一個較大指數的一半。" -#: ../../library/random.rst:667 +#: ../../library/random.rst:673 msgid "" "from random import Random\n" "from math import ldexp\n" @@ -1074,7 +1083,7 @@ msgstr "" " exponent += x.bit_length() - 32\n" " return ldexp(mantissa, exponent)" -#: ../../library/random.rst:681 +#: ../../library/random.rst:687 msgid "" "All :ref:`real valued distributions ` in the " "class will use the new method::" @@ -1082,7 +1091,7 @@ msgstr "" "Class 中的所有\\ :ref:`實數分佈 `\\ 都將使用新方" "法: ::" -#: ../../library/random.rst:684 +#: ../../library/random.rst:690 msgid "" ">>> fr = FullRandom()\n" ">>> fr.random()\n" @@ -1096,7 +1105,7 @@ msgstr "" ">>> fr.expovariate(0.25)\n" "8.87925541791544" -#: ../../library/random.rst:690 +#: ../../library/random.rst:696 msgid "" "The recipe is conceptually equivalent to an algorithm that chooses from all " "the multiples of 2⁻¹⁰⁷⁴ in the range *0.0 ≤ x < 1.0*. All such numbers are " @@ -1109,7 +1118,7 @@ msgstr "" "示的 Python float。(2⁻¹⁰⁷⁴ 是最小為正的非正規化 float,等於 ``math." "ulp(0.0)``)" -#: ../../library/random.rst:699 +#: ../../library/random.rst:705 msgid "" "`Generating Pseudo-random Floating-Point Values `_ a paper by Allen B. Downey describing " @@ -1119,3 +1128,97 @@ msgstr "" "`產生偽隨機浮點值 `_ Allen B. Downey 的一篇論文描述了產生比通常由 :func:`.random` 產生的 " "float 更 fine-grained(細粒的)的方法。" + +#: ../../library/random.rst:713 +msgid "Command-line usage" +msgstr "" + +#: ../../library/random.rst:717 +msgid "The :mod:`!random` module can be executed from the command line." +msgstr "" + +#: ../../library/random.rst:719 +msgid "" +"python -m random [-h] [-c CHOICE [CHOICE ...] | -i N | -f N] [input ...]" +msgstr "" + +#: ../../library/random.rst:723 +#, fuzzy +msgid "The following options are accepted:" +msgstr "以下函式產生離散分佈。" + +#: ../../library/random.rst:729 +msgid "Show the help message and exit." +msgstr "" + +#: ../../library/random.rst:734 +msgid "Print a random choice, using :meth:`choice`." +msgstr "" + +#: ../../library/random.rst:739 +msgid "" +"Print a random integer between 1 and N inclusive, using :meth:`randint`." +msgstr "" + +#: ../../library/random.rst:744 +msgid "" +"Print a random floating-point number between 0 and N inclusive, using :meth:" +"`uniform`." +msgstr "" + +#: ../../library/random.rst:747 +msgid "If no options are given, the output depends on the input:" +msgstr "" + +#: ../../library/random.rst:749 +msgid "String or multiple: same as :option:`--choice`." +msgstr "" + +#: ../../library/random.rst:750 +msgid "Integer: same as :option:`--integer`." +msgstr "" + +#: ../../library/random.rst:751 +msgid "Float: same as :option:`--float`." +msgstr "" + +#: ../../library/random.rst:756 +msgid "Command-line example" +msgstr "" + +#: ../../library/random.rst:758 +msgid "Here are some examples of the :mod:`!random` command-line interface:" +msgstr "" + +#: ../../library/random.rst:760 +msgid "" +"$ # Choose one at random\n" +"$ python -m random egg bacon sausage spam \"Lobster Thermidor aux crevettes " +"with a Mornay sauce\"\n" +"Lobster Thermidor aux crevettes with a Mornay sauce\n" +"\n" +"$ # Random integer\n" +"$ python -m random 6\n" +"6\n" +"\n" +"$ # Random floating-point number\n" +"$ python -m random 1.8\n" +"1.7080016272295635\n" +"\n" +"$ # With explicit arguments\n" +"$ python -m random --choice egg bacon sausage spam \"Lobster Thermidor aux " +"crevettes with a Mornay sauce\"\n" +"egg\n" +"\n" +"$ python -m random --integer 6\n" +"3\n" +"\n" +"$ python -m random --float 1.8\n" +"1.5666339105010318\n" +"\n" +"$ python -m random --integer 6\n" +"5\n" +"\n" +"$ python -m random --float 6\n" +"3.1942323316565915" +msgstr "" diff --git a/library/re.po b/library/re.po index 6e8abfb216..ade794f4a6 100644 --- a/library/re.po +++ b/library/re.po @@ -6,9 +6,9 @@ # Leo Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-09-16 14:49+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -169,7 +169,7 @@ msgstr "" msgid "The special characters are:" msgstr "" -#: ../../library/re.rst:101 ../../library/re.rst:1637 +#: ../../library/re.rst:101 ../../library/re.rst:1649 msgid "``.``" msgstr "``.``" @@ -829,53 +829,60 @@ msgid "" msgstr "" #: ../../library/re.rst:577 +msgid "" +"Note that ``\\B`` does not match an empty string, which differs from RE " +"implementations in other programming languages such as Perl. This behavior " +"is kept for compatibility reasons." +msgstr "" + +#: ../../library/re.rst:583 msgid "``\\d``" msgstr "``\\d``" -#: ../../library/re.rst:578 ../../library/re.rst:602 ../../library/re.rst:624 +#: ../../library/re.rst:584 ../../library/re.rst:608 ../../library/re.rst:630 msgid "For Unicode (str) patterns:" msgstr "" -#: ../../library/re.rst:579 +#: ../../library/re.rst:585 msgid "" "Matches any Unicode decimal digit (that is, any character in Unicode " "character category `[Nd]`__). This includes ``[0-9]``, and also many other " "digit characters." msgstr "" -#: ../../library/re.rst:583 +#: ../../library/re.rst:589 msgid "Matches ``[0-9]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:587 ../../library/re.rst:609 ../../library/re.rst:632 +#: ../../library/re.rst:593 ../../library/re.rst:615 ../../library/re.rst:638 msgid "For 8-bit (bytes) patterns:" msgstr "" -#: ../../library/re.rst:588 +#: ../../library/re.rst:594 msgid "" "Matches any decimal digit in the ASCII character set; this is equivalent to " "``[0-9]``." msgstr "" -#: ../../library/re.rst:593 +#: ../../library/re.rst:599 msgid "``\\D``" msgstr "``\\D``" -#: ../../library/re.rst:594 +#: ../../library/re.rst:600 msgid "" "Matches any character which is not a decimal digit. This is the opposite of " "``\\d``." msgstr "" -#: ../../library/re.rst:597 +#: ../../library/re.rst:603 msgid "Matches ``[^0-9]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:601 +#: ../../library/re.rst:607 msgid "``\\s``" msgstr "``\\s``" -#: ../../library/re.rst:603 +#: ../../library/re.rst:609 msgid "" "Matches Unicode whitespace characters (as defined by :py:meth:`str." "isspace`). This includes ``[ \\t\\n\\r\\f\\v]``, and also many other " @@ -883,48 +890,48 @@ msgid "" "in many languages." msgstr "" -#: ../../library/re.rst:607 +#: ../../library/re.rst:613 msgid "" "Matches ``[ \\t\\n\\r\\f\\v]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:610 +#: ../../library/re.rst:616 msgid "" "Matches characters considered whitespace in the ASCII character set; this is " "equivalent to ``[ \\t\\n\\r\\f\\v]``." msgstr "" -#: ../../library/re.rst:615 +#: ../../library/re.rst:621 msgid "``\\S``" msgstr "``\\S``" -#: ../../library/re.rst:616 +#: ../../library/re.rst:622 msgid "" "Matches any character which is not a whitespace character. This is the " "opposite of ``\\s``." msgstr "" -#: ../../library/re.rst:619 +#: ../../library/re.rst:625 msgid "" "Matches ``[^ \\t\\n\\r\\f\\v]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:623 +#: ../../library/re.rst:629 msgid "``\\w``" msgstr "``\\w``" -#: ../../library/re.rst:625 +#: ../../library/re.rst:631 msgid "" "Matches Unicode word characters; this includes all Unicode alphanumeric " "characters (as defined by :py:meth:`str.isalnum`), as well as the underscore " "(``_``)." msgstr "" -#: ../../library/re.rst:630 +#: ../../library/re.rst:636 msgid "Matches ``[a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:633 +#: ../../library/re.rst:639 msgid "" "Matches characters considered alphanumeric in the ASCII character set; this " "is equivalent to ``[a-zA-Z0-9_]``. If the :py:const:`~re.LOCALE` flag is " @@ -932,42 +939,42 @@ msgid "" "the underscore." msgstr "" -#: ../../library/re.rst:640 +#: ../../library/re.rst:646 msgid "``\\W``" msgstr "``\\W``" -#: ../../library/re.rst:641 +#: ../../library/re.rst:647 msgid "" "Matches any character which is not a word character. This is the opposite of " "``\\w``. By default, matches non-underscore (``_``) characters for which :py:" "meth:`str.isalnum` returns ``False``." msgstr "" -#: ../../library/re.rst:646 +#: ../../library/re.rst:652 msgid "Matches ``[^a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used." msgstr "" -#: ../../library/re.rst:648 +#: ../../library/re.rst:654 msgid "" "If the :py:const:`~re.LOCALE` flag is used, matches characters which are " "neither alphanumeric in the current locale nor the underscore." msgstr "" -#: ../../library/re.rst:654 +#: ../../library/re.rst:660 msgid "``\\Z``" msgstr "``\\Z``" -#: ../../library/re.rst:655 +#: ../../library/re.rst:661 msgid "Matches only at the end of the string." msgstr "" -#: ../../library/re.rst:671 +#: ../../library/re.rst:677 msgid "" "Most of the :ref:`escape sequences ` supported by Python " "string literals are also accepted by the regular expression parser::" msgstr "" -#: ../../library/re.rst:674 +#: ../../library/re.rst:680 msgid "" "\\a \\b \\f \\n\n" "\\N \\r \\t \\u\n" @@ -977,20 +984,20 @@ msgstr "" "\\N \\r \\t \\u\n" "\\U \\v \\x \\\\" -#: ../../library/re.rst:678 +#: ../../library/re.rst:684 msgid "" "(Note that ``\\b`` is used to represent word boundaries, and means " "\"backspace\" only inside character classes.)" msgstr "" -#: ../../library/re.rst:681 +#: ../../library/re.rst:687 msgid "" "``'\\u'``, ``'\\U'``, and ``'\\N'`` escape sequences are only recognized in " "Unicode (str) patterns. In bytes patterns they are errors. Unknown escapes " "of ASCII letters are reserved for future use and treated as errors." msgstr "" -#: ../../library/re.rst:687 +#: ../../library/re.rst:693 msgid "" "Octal escapes are included in a limited form. If the first digit is a 0, or " "if there are three octal digits, it is considered an octal escape. " @@ -998,27 +1005,27 @@ msgid "" "are always at most three digits in length." msgstr "" -#: ../../library/re.rst:692 +#: ../../library/re.rst:698 msgid "The ``'\\u'`` and ``'\\U'`` escape sequences have been added." msgstr "" -#: ../../library/re.rst:695 +#: ../../library/re.rst:701 msgid "" "Unknown escapes consisting of ``'\\'`` and an ASCII letter now are errors." msgstr "" -#: ../../library/re.rst:698 +#: ../../library/re.rst:704 msgid "" "The :samp:`'\\\\N\\\\{{name}\\\\}'` escape sequence has been added. As in " "string literals, it expands to the named Unicode character (e.g. ``'\\N{EM " "DASH}'``)." msgstr "" -#: ../../library/re.rst:706 +#: ../../library/re.rst:712 msgid "Module Contents" msgstr "模組內容" -#: ../../library/re.rst:708 +#: ../../library/re.rst:714 msgid "" "The module defines several functions, constants, and an exception. Some of " "the functions are simplified versions of the full featured methods for " @@ -1026,26 +1033,26 @@ msgid "" "compiled form." msgstr "" -#: ../../library/re.rst:715 +#: ../../library/re.rst:721 msgid "Flags" msgstr "旗標" -#: ../../library/re.rst:717 +#: ../../library/re.rst:723 msgid "" "Flag constants are now instances of :class:`RegexFlag`, which is a subclass " "of :class:`enum.IntFlag`." msgstr "" -#: ../../library/re.rst:724 +#: ../../library/re.rst:730 msgid "" "An :class:`enum.IntFlag` class containing the regex options listed below." msgstr "" -#: ../../library/re.rst:726 +#: ../../library/re.rst:732 msgid "- added to ``__all__``" msgstr "" -#: ../../library/re.rst:731 +#: ../../library/re.rst:737 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B``, ``\\d``, ``\\D``, ``\\s`` and " "``\\S`` perform ASCII-only matching instead of full Unicode matching. This " @@ -1053,11 +1060,11 @@ msgid "" "patterns." msgstr "" -#: ../../library/re.rst:735 +#: ../../library/re.rst:741 msgid "Corresponds to the inline flag ``(?a)``." msgstr "" -#: ../../library/re.rst:739 +#: ../../library/re.rst:745 msgid "" "The :py:const:`~re.U` flag still exists for backward compatibility, but is " "redundant in Python 3 since matches are Unicode by default for ``str`` " @@ -1065,15 +1072,15 @@ msgid "" "`~re.UNICODE` and the inline flag ``(?u)`` are similarly redundant." msgstr "" -#: ../../library/re.rst:748 +#: ../../library/re.rst:754 msgid "Display debug information about compiled expression." msgstr "" -#: ../../library/re.rst:750 +#: ../../library/re.rst:756 msgid "No corresponding inline flag." msgstr "" -#: ../../library/re.rst:756 +#: ../../library/re.rst:762 msgid "" "Perform case-insensitive matching; expressions like ``[A-Z]`` will also " "match lowercase letters. Full Unicode matching (such as ``Ü`` matching " @@ -1082,11 +1089,11 @@ msgid "" "flag unless the :py:const:`~re.LOCALE` flag is also used." msgstr "" -#: ../../library/re.rst:764 +#: ../../library/re.rst:770 msgid "Corresponds to the inline flag ``(?i)``." msgstr "" -#: ../../library/re.rst:766 +#: ../../library/re.rst:772 msgid "" "Note that when the Unicode patterns ``[a-z]`` or ``[A-Z]`` are used in " "combination with the :const:`IGNORECASE` flag, they will match the 52 ASCII " @@ -1097,18 +1104,18 @@ msgid "" "are matched." msgstr "" -#: ../../library/re.rst:777 +#: ../../library/re.rst:783 msgid "" "Make ``\\w``, ``\\W``, ``\\b``, ``\\B`` and case-insensitive matching " "dependent on the current locale. This flag can be used only with bytes " "patterns." msgstr "" -#: ../../library/re.rst:781 +#: ../../library/re.rst:787 msgid "Corresponds to the inline flag ``(?L)``." msgstr "" -#: ../../library/re.rst:785 +#: ../../library/re.rst:791 msgid "" "This flag is discouraged; consider Unicode matching instead. The locale " "mechanism is very unreliable as it only handles one \"culture\" at a time " @@ -1117,20 +1124,20 @@ msgid "" "languages." msgstr "" -#: ../../library/re.rst:792 +#: ../../library/re.rst:798 msgid "" ":py:const:`~re.LOCALE` can be used only with bytes patterns and is not " "compatible with :py:const:`~re.ASCII`." msgstr "" -#: ../../library/re.rst:796 +#: ../../library/re.rst:802 msgid "" "Compiled regular expression objects with the :py:const:`~re.LOCALE` flag no " "longer depend on the locale at compile time. Only the locale at matching " "time affects the result of matching." msgstr "" -#: ../../library/re.rst:805 +#: ../../library/re.rst:811 msgid "" "When specified, the pattern character ``'^'`` matches at the beginning of " "the string and at the beginning of each line (immediately following each " @@ -1141,11 +1148,11 @@ msgid "" "the end of the string." msgstr "" -#: ../../library/re.rst:812 +#: ../../library/re.rst:818 msgid "Corresponds to the inline flag ``(?m)``." msgstr "" -#: ../../library/re.rst:816 +#: ../../library/re.rst:822 msgid "" "Indicates no flag being applied, the value is ``0``. This flag may be used " "as a default value for a function keyword argument or as a base value that " @@ -1153,35 +1160,35 @@ msgid "" "value::" msgstr "" -#: ../../library/re.rst:821 +#: ../../library/re.rst:827 msgid "" "def myfunc(text, flag=re.NOFLAG):\n" " return re.match(text, flag)" msgstr "" -#: ../../library/re.rst:829 +#: ../../library/re.rst:835 msgid "" "Make the ``'.'`` special character match any character at all, including a " "newline; without this flag, ``'.'`` will match anything *except* a newline." msgstr "" -#: ../../library/re.rst:832 +#: ../../library/re.rst:838 msgid "Corresponds to the inline flag ``(?s)``." msgstr "" -#: ../../library/re.rst:838 +#: ../../library/re.rst:844 msgid "" "In Python 3, Unicode characters are matched by default for ``str`` patterns. " "This flag is therefore redundant with **no effect** and is only kept for " "backward compatibility." msgstr "" -#: ../../library/re.rst:843 +#: ../../library/re.rst:849 msgid "" "See :py:const:`~re.ASCII` to restrict matching to ASCII characters instead." msgstr "" -#: ../../library/re.rst:850 +#: ../../library/re.rst:856 msgid "" "This flag allows you to write regular expressions that look nicer and are " "more readable by allowing you to visually separate logical sections of the " @@ -1194,13 +1201,13 @@ msgid "" "ignored." msgstr "" -#: ../../library/re.rst:860 +#: ../../library/re.rst:866 msgid "" "This means that the two following regular expression objects that match a " "decimal number are functionally equal::" msgstr "" -#: ../../library/re.rst:863 +#: ../../library/re.rst:869 msgid "" "a = re.compile(r\"\"\"\\d + # the integral part\n" " \\. # the decimal point\n" @@ -1208,57 +1215,57 @@ msgid "" "b = re.compile(r\"\\d+\\.\\d*\")" msgstr "" -#: ../../library/re.rst:868 +#: ../../library/re.rst:874 msgid "Corresponds to the inline flag ``(?x)``." msgstr "" -#: ../../library/re.rst:872 +#: ../../library/re.rst:878 msgid "Functions" msgstr "" -#: ../../library/re.rst:876 +#: ../../library/re.rst:882 msgid "" "Compile a regular expression pattern into a :ref:`regular expression object " "`, which can be used for matching using its :func:`~Pattern." "match`, :func:`~Pattern.search` and other methods, described below." msgstr "" -#: ../../library/re.rst:881 ../../library/re.rst:913 ../../library/re.rst:931 -#: ../../library/re.rst:942 ../../library/re.rst:988 ../../library/re.rst:1017 -#: ../../library/re.rst:1032 ../../library/re.rst:1091 -#: ../../library/re.rst:1130 +#: ../../library/re.rst:887 ../../library/re.rst:919 ../../library/re.rst:937 +#: ../../library/re.rst:948 ../../library/re.rst:994 ../../library/re.rst:1028 +#: ../../library/re.rst:1043 ../../library/re.rst:1102 +#: ../../library/re.rst:1138 msgid "" "The expression's behaviour can be modified by specifying a *flags* value. " "Values can be any of the `flags`_ variables, combined using bitwise OR (the " "``|`` operator)." msgstr "" -#: ../../library/re.rst:885 +#: ../../library/re.rst:891 msgid "The sequence ::" msgstr "" -#: ../../library/re.rst:887 +#: ../../library/re.rst:893 msgid "" "prog = re.compile(pattern)\n" "result = prog.match(string)" msgstr "" -#: ../../library/re.rst:890 +#: ../../library/re.rst:896 msgid "is equivalent to ::" msgstr "等價於: ::" -#: ../../library/re.rst:892 +#: ../../library/re.rst:898 msgid "result = re.match(pattern, string)" msgstr "" -#: ../../library/re.rst:894 +#: ../../library/re.rst:900 msgid "" "but using :func:`re.compile` and saving the resulting regular expression " "object for reuse is more efficient when the expression will be used several " "times in a single program." msgstr "" -#: ../../library/re.rst:900 +#: ../../library/re.rst:906 msgid "" "The compiled versions of the most recent patterns passed to :func:`re." "compile` and the module-level matching functions are cached, so programs " @@ -1266,7 +1273,7 @@ msgid "" "compiling regular expressions." msgstr "" -#: ../../library/re.rst:908 +#: ../../library/re.rst:914 msgid "" "Scan through *string* looking for the first location where the regular " "expression *pattern* produces a match, and return a corresponding :class:" @@ -1275,7 +1282,7 @@ msgid "" "some point in the string." msgstr "" -#: ../../library/re.rst:920 +#: ../../library/re.rst:926 msgid "" "If zero or more characters at the beginning of *string* match the regular " "expression *pattern*, return a corresponding :class:`~re.Match`. Return " @@ -1283,26 +1290,26 @@ msgid "" "different from a zero-length match." msgstr "" -#: ../../library/re.rst:925 +#: ../../library/re.rst:931 msgid "" "Note that even in :const:`MULTILINE` mode, :func:`re.match` will only match " "at the beginning of the string and not at the beginning of each line." msgstr "" -#: ../../library/re.rst:928 +#: ../../library/re.rst:934 msgid "" "If you want to locate a match anywhere in *string*, use :func:`search` " "instead (see also :ref:`search-vs-match`)." msgstr "" -#: ../../library/re.rst:938 +#: ../../library/re.rst:944 msgid "" "If the whole *string* matches the regular expression *pattern*, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" -#: ../../library/re.rst:951 +#: ../../library/re.rst:957 msgid "" "Split *string* by the occurrences of *pattern*. If capturing parentheses " "are used in *pattern*, then the text of all groups in the pattern are also " @@ -1311,13 +1318,13 @@ msgid "" "final element of the list. ::" msgstr "" -#: ../../library/re.rst:957 +#: ../../library/re.rst:963 msgid "" ">>> re.split(r'\\W+', 'Words, words, words.')\n" "['Words', 'words', 'words', '']\n" ">>> re.split(r'(\\W+)', 'Words, words, words.')\n" "['Words', ', ', 'words', ', ', 'words', '.', '']\n" -">>> re.split(r'\\W+', 'Words, words, words.', 1)\n" +">>> re.split(r'\\W+', 'Words, words, words.', maxsplit=1)\n" "['Words', 'words, words.']\n" ">>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE)\n" "['0', '3', '9']" @@ -1326,19 +1333,19 @@ msgstr "" "['Words', 'words', 'words', '']\n" ">>> re.split(r'(\\W+)', 'Words, words, words.')\n" "['Words', ', ', 'words', ', ', 'words', '.', '']\n" -">>> re.split(r'\\W+', 'Words, words, words.', 1)\n" +">>> re.split(r'\\W+', 'Words, words, words.', maxsplit=1)\n" "['Words', 'words, words.']\n" ">>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE)\n" "['0', '3', '9']" -#: ../../library/re.rst:966 +#: ../../library/re.rst:972 msgid "" "If there are capturing groups in the separator and it matches at the start " "of the string, the result will start with an empty string. The same holds " "for the end of the string::" msgstr "" -#: ../../library/re.rst:970 +#: ../../library/re.rst:976 msgid "" ">>> re.split(r'(\\W+)', '...words, words...')\n" "['', '...', 'words', ', ', 'words', '...', '']" @@ -1346,19 +1353,19 @@ msgstr "" ">>> re.split(r'(\\W+)', '...words, words...')\n" "['', '...', 'words', ', ', 'words', '...', '']" -#: ../../library/re.rst:973 +#: ../../library/re.rst:979 msgid "" "That way, separator components are always found at the same relative indices " "within the result list." msgstr "" -#: ../../library/re.rst:976 +#: ../../library/re.rst:982 msgid "" "Empty matches for the pattern split the string only when not adjacent to a " "previous empty match." msgstr "" -#: ../../library/re.rst:979 +#: ../../library/re.rst:985 msgid "" ">>> re.split(r'\\b', 'Words, words, words.')\n" "['', 'Words', ', ', 'words', ', ', 'words', '.']\n" @@ -1376,23 +1383,30 @@ msgstr "" "['', '...', '', '', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '', '', " "'']" -#: ../../library/re.rst:992 ../../library/re.rst:1095 ../../library/re.rst:1124 +#: ../../library/re.rst:998 ../../library/re.rst:1106 msgid "Added the optional flags argument." msgstr "新增可選的旗標引數。" -#: ../../library/re.rst:995 +#: ../../library/re.rst:1001 msgid "" "Added support of splitting on a pattern that could match an empty string." msgstr "" -#: ../../library/re.rst:1001 +#: ../../library/re.rst:1004 +msgid "" +"Passing *maxsplit* and *flags* as positional arguments is deprecated. In " +"future Python versions they will be :ref:`keyword-only parameters `." +msgstr "" + +#: ../../library/re.rst:1012 msgid "" "Return all non-overlapping matches of *pattern* in *string*, as a list of " "strings or tuples. The *string* is scanned left-to-right, and matches are " "returned in the order found. Empty matches are included in the result." msgstr "" -#: ../../library/re.rst:1005 +#: ../../library/re.rst:1016 msgid "" "The result depends on the number of capturing groups in the pattern. If " "there are no groups, return a list of strings matching the whole pattern. " @@ -1402,11 +1416,11 @@ msgid "" "result." msgstr "" -#: ../../library/re.rst:1021 ../../library/re.rst:1036 +#: ../../library/re.rst:1032 ../../library/re.rst:1047 msgid "Non-empty matches can now start just after a previous empty match." msgstr "" -#: ../../library/re.rst:1027 +#: ../../library/re.rst:1038 msgid "" "Return an :term:`iterator` yielding :class:`~re.Match` objects over all non-" "overlapping matches for the RE *pattern* in *string*. The *string* is " @@ -1414,7 +1428,7 @@ msgid "" "matches are included in the result." msgstr "" -#: ../../library/re.rst:1042 +#: ../../library/re.rst:1053 msgid "" "Return the string obtained by replacing the leftmost non-overlapping " "occurrences of *pattern* in *string* by the replacement *repl*. If the " @@ -1428,7 +1442,7 @@ msgid "" "For example::" msgstr "" -#: ../../library/re.rst:1053 +#: ../../library/re.rst:1064 msgid "" ">>> re.sub(r'def\\s+([a-zA-Z_][a-zA-Z_0-9]*)\\s*\\(\\s*\\):',\n" "... r'static PyObject*\\npy_\\1(void)\\n{',\n" @@ -1440,14 +1454,14 @@ msgstr "" "... 'def myfunc():')\n" "'static PyObject*\\npy_myfunc(void)\\n{'" -#: ../../library/re.rst:1058 +#: ../../library/re.rst:1069 msgid "" "If *repl* is a function, it is called for every non-overlapping occurrence " "of *pattern*. The function takes a single :class:`~re.Match` argument, and " "returns the replacement string. For example::" msgstr "" -#: ../../library/re.rst:1062 +#: ../../library/re.rst:1073 msgid "" ">>> def dashrepl(matchobj):\n" "... if matchobj.group(0) == '-': return ' '\n" @@ -1469,11 +1483,11 @@ msgstr "" "IGNORECASE)\n" "'Baked Beans & Spam'" -#: ../../library/re.rst:1071 +#: ../../library/re.rst:1082 msgid "The pattern may be a string or a :class:`~re.Pattern`." msgstr "" -#: ../../library/re.rst:1073 +#: ../../library/re.rst:1084 msgid "" "The optional argument *count* is the maximum number of pattern occurrences " "to be replaced; *count* must be a non-negative integer. If omitted or zero, " @@ -1482,7 +1496,7 @@ msgid "" "'abxd')`` returns ``'-a-b--d-'``." msgstr "" -#: ../../library/re.rst:1081 +#: ../../library/re.rst:1092 msgid "" "In string-type *repl* arguments, in addition to the character escapes and " "backreferences described above, ``\\g`` will use the substring matched " @@ -1495,50 +1509,51 @@ msgid "" "RE." msgstr "" -#: ../../library/re.rst:1098 ../../library/re.rst:1127 -#: ../../library/re.rst:1375 +#: ../../library/re.rst:1109 ../../library/re.rst:1387 msgid "Unmatched groups are replaced with an empty string." msgstr "" -#: ../../library/re.rst:1101 +#: ../../library/re.rst:1112 msgid "" "Unknown escapes in *pattern* consisting of ``'\\'`` and an ASCII letter now " "are errors." msgstr "" -#: ../../library/re.rst:1105 +#: ../../library/re.rst:1116 msgid "" "Unknown escapes in *repl* consisting of ``'\\'`` and an ASCII letter now are " -"errors." -msgstr "" - -#: ../../library/re.rst:1109 -msgid "" -"Empty matches for the pattern are replaced when adjacent to a previous non-" -"empty match." +"errors. Empty matches for the pattern are replaced when adjacent to a " +"previous non-empty match." msgstr "" -#: ../../library/re.rst:1113 +#: ../../library/re.rst:1122 msgid "" "Group *id* can only contain ASCII digits. In :class:`bytes` replacement " "strings, group *name* can only contain bytes in the ASCII range " "(``b'\\x00'``-``b'\\x7f'``)." msgstr "" -#: ../../library/re.rst:1121 +#: ../../library/re.rst:1127 +msgid "" +"Passing *count* and *flags* as positional arguments is deprecated. In future " +"Python versions they will be :ref:`keyword-only parameters `." +msgstr "" + +#: ../../library/re.rst:1135 msgid "" "Perform the same operation as :func:`sub`, but return a tuple ``(new_string, " "number_of_subs_made)``." msgstr "" -#: ../../library/re.rst:1137 +#: ../../library/re.rst:1145 msgid "" "Escape special characters in *pattern*. This is useful if you want to match " "an arbitrary literal string that may have regular expression metacharacters " "in it. For example::" msgstr "" -#: ../../library/re.rst:1141 +#: ../../library/re.rst:1149 msgid "" ">>> print(re.escape('https://www.python.org'))\n" "https://www\\.python\\.org\n" @@ -1564,13 +1579,13 @@ msgstr "" ">>> print('|'.join(map(re.escape, sorted(operators, reverse=True))))\n" "/|\\-|\\+|\\*\\*|\\*" -#: ../../library/re.rst:1152 +#: ../../library/re.rst:1160 msgid "" "This function must not be used for the replacement string in :func:`sub` " "and :func:`subn`, only backslashes should be escaped. For example::" msgstr "" -#: ../../library/re.rst:1155 +#: ../../library/re.rst:1163 msgid "" ">>> digits_re = r'\\d+'\n" ">>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'\n" @@ -1582,11 +1597,11 @@ msgstr "" ">>> print(re.sub(digits_re, digits_re.replace('\\\\', r'\\\\'), sample))\n" "/usr/sbin/sendmail - \\d+ errors, \\d+ warnings" -#: ../../library/re.rst:1160 +#: ../../library/re.rst:1168 msgid "The ``'_'`` character is no longer escaped." msgstr "" -#: ../../library/re.rst:1163 +#: ../../library/re.rst:1171 msgid "" "Only characters that can have special meaning in a regular expression are " "escaped. As a result, ``'!'``, ``'\"'``, ``'%'``, ``\"'\"``, ``','``, " @@ -1594,62 +1609,69 @@ msgid "" "are no longer escaped." msgstr "" -#: ../../library/re.rst:1172 +#: ../../library/re.rst:1180 msgid "Clear the regular expression cache." msgstr "" -#: ../../library/re.rst:1176 +#: ../../library/re.rst:1184 msgid "Exceptions" msgstr "" -#: ../../library/re.rst:1180 +#: ../../library/re.rst:1188 msgid "" "Exception raised when a string passed to one of the functions here is not a " "valid regular expression (for example, it might contain unmatched " "parentheses) or when some other error occurs during compilation or " "matching. It is never an error if a string contains no match for a " -"pattern. The error instance has the following additional attributes:" +"pattern. The ``PatternError`` instance has the following additional " +"attributes:" msgstr "" -#: ../../library/re.rst:1188 +#: ../../library/re.rst:1196 msgid "The unformatted error message." msgstr "" -#: ../../library/re.rst:1192 +#: ../../library/re.rst:1200 msgid "The regular expression pattern." msgstr "" -#: ../../library/re.rst:1196 +#: ../../library/re.rst:1204 msgid "The index in *pattern* where compilation failed (may be ``None``)." msgstr "" -#: ../../library/re.rst:1200 +#: ../../library/re.rst:1208 msgid "The line corresponding to *pos* (may be ``None``)." msgstr "" -#: ../../library/re.rst:1204 +#: ../../library/re.rst:1212 msgid "The column corresponding to *pos* (may be ``None``)." msgstr "" -#: ../../library/re.rst:1206 +#: ../../library/re.rst:1214 msgid "Added additional attributes." msgstr "新增額外屬性。" -#: ../../library/re.rst:1212 +#: ../../library/re.rst:1217 +msgid "" +"``PatternError`` was originally named ``error``; the latter is kept as an " +"alias for backward compatibility." +msgstr "" + +#: ../../library/re.rst:1224 msgid "Regular Expression Objects" msgstr "" -#: ../../library/re.rst:1216 +#: ../../library/re.rst:1228 msgid "Compiled regular expression object returned by :func:`re.compile`." msgstr "" -#: ../../library/re.rst:1218 +#: ../../library/re.rst:1230 msgid "" ":py:class:`re.Pattern` supports ``[]`` to indicate a Unicode (str) or bytes " "pattern. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1224 +#: ../../library/re.rst:1236 msgid "" "Scan through *string* looking for the first location where this regular " "expression produces a match, and return a corresponding :class:`~re.Match`. " @@ -1658,7 +1680,7 @@ msgid "" "string." msgstr "" -#: ../../library/re.rst:1229 +#: ../../library/re.rst:1241 msgid "" "The optional second parameter *pos* gives an index in the string where the " "search is to start; it defaults to ``0``. This is not completely equivalent " @@ -1667,7 +1689,7 @@ msgid "" "necessarily at the index where the search is to start." msgstr "" -#: ../../library/re.rst:1235 +#: ../../library/re.rst:1247 msgid "" "The optional parameter *endpos* limits how far the string will be searched; " "it will be as if the string is *endpos* characters long, so only the " @@ -1677,7 +1699,7 @@ msgid "" "equivalent to ``rx.search(string[:50], 0)``. ::" msgstr "" -#: ../../library/re.rst:1242 +#: ../../library/re.rst:1254 msgid "" ">>> pattern = re.compile(\"d\")\n" ">>> pattern.search(\"dog\") # Match at index 0\n" @@ -1685,7 +1707,7 @@ msgid "" ">>> pattern.search(\"dog\", 1) # No match; search doesn't include the \"d\"" msgstr "" -#: ../../library/re.rst:1250 +#: ../../library/re.rst:1262 msgid "" "If zero or more characters at the *beginning* of *string* match this regular " "expression, return a corresponding :class:`~re.Match`. Return ``None`` if " @@ -1693,13 +1715,13 @@ msgid "" "zero-length match." msgstr "" -#: ../../library/re.rst:1255 ../../library/re.rst:1273 +#: ../../library/re.rst:1267 ../../library/re.rst:1285 msgid "" "The optional *pos* and *endpos* parameters have the same meaning as for the :" "meth:`~Pattern.search` method. ::" msgstr "" -#: ../../library/re.rst:1258 +#: ../../library/re.rst:1270 msgid "" ">>> pattern = re.compile(\"o\")\n" ">>> pattern.match(\"dog\") # No match as \"o\" is not at the start of " @@ -1709,20 +1731,20 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1263 +#: ../../library/re.rst:1275 msgid "" "If you want to locate a match anywhere in *string*, use :meth:`~Pattern." "search` instead (see also :ref:`search-vs-match`)." msgstr "" -#: ../../library/re.rst:1269 +#: ../../library/re.rst:1281 msgid "" "If the whole *string* matches this regular expression, return a " "corresponding :class:`~re.Match`. Return ``None`` if the string does not " "match the pattern; note that this is different from a zero-length match." msgstr "" -#: ../../library/re.rst:1276 +#: ../../library/re.rst:1288 msgid "" ">>> pattern = re.compile(\"o[gh]\")\n" ">>> pattern.fullmatch(\"dog\") # No match as \"o\" is not at the start " @@ -1733,72 +1755,72 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1287 +#: ../../library/re.rst:1299 msgid "Identical to the :func:`split` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1292 +#: ../../library/re.rst:1304 msgid "" "Similar to the :func:`findall` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1299 +#: ../../library/re.rst:1311 msgid "" "Similar to the :func:`finditer` function, using the compiled pattern, but " "also accepts optional *pos* and *endpos* parameters that limit the search " "region like for :meth:`search`." msgstr "" -#: ../../library/re.rst:1306 +#: ../../library/re.rst:1318 msgid "Identical to the :func:`sub` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1311 +#: ../../library/re.rst:1323 msgid "Identical to the :func:`subn` function, using the compiled pattern." msgstr "" -#: ../../library/re.rst:1316 +#: ../../library/re.rst:1328 msgid "" "The regex matching flags. This is a combination of the flags given to :func:" "`.compile`, any ``(?...)`` inline flags in the pattern, and implicit flags " "such as :py:const:`~re.UNICODE` if the pattern is a Unicode string." msgstr "" -#: ../../library/re.rst:1323 +#: ../../library/re.rst:1335 msgid "The number of capturing groups in the pattern." msgstr "" -#: ../../library/re.rst:1328 +#: ../../library/re.rst:1340 msgid "" "A dictionary mapping any symbolic group names defined by ``(?P)`` to " "group numbers. The dictionary is empty if no symbolic groups were used in " "the pattern." msgstr "" -#: ../../library/re.rst:1335 +#: ../../library/re.rst:1347 msgid "The pattern string from which the pattern object was compiled." msgstr "" -#: ../../library/re.rst:1338 +#: ../../library/re.rst:1350 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Compiled " "regular expression objects are considered atomic." msgstr "" -#: ../../library/re.rst:1346 +#: ../../library/re.rst:1358 msgid "Match Objects" msgstr "" -#: ../../library/re.rst:1348 +#: ../../library/re.rst:1360 msgid "" "Match objects always have a boolean value of ``True``. Since :meth:`~Pattern." "match` and :meth:`~Pattern.search` return ``None`` when there is no match, " "you can test whether there was a match with a simple ``if`` statement::" msgstr "" -#: ../../library/re.rst:1353 +#: ../../library/re.rst:1365 msgid "" "match = re.search(pattern, string)\n" "if match:\n" @@ -1808,17 +1830,17 @@ msgstr "" "if match:\n" " process(match)" -#: ../../library/re.rst:1359 +#: ../../library/re.rst:1371 msgid "Match object returned by successful ``match``\\ es and ``search``\\ es." msgstr "" -#: ../../library/re.rst:1361 +#: ../../library/re.rst:1373 msgid "" ":py:class:`re.Match` supports ``[]`` to indicate a Unicode (str) or bytes " "match. See :ref:`types-genericalias`." msgstr "" -#: ../../library/re.rst:1367 +#: ../../library/re.rst:1379 msgid "" "Return the string obtained by doing backslash substitution on the template " "string *template*, as done by the :meth:`~Pattern.sub` method. Escapes such " @@ -1828,7 +1850,7 @@ msgid "" "backreference ``\\g<0>`` will be replaced by the entire match." msgstr "" -#: ../../library/re.rst:1380 +#: ../../library/re.rst:1392 msgid "" "Returns one or more subgroups of the match. If there is a single argument, " "the result is a single string; if there are multiple arguments, the result " @@ -1843,7 +1865,7 @@ msgid "" "the pattern that matched multiple times, the last match is returned. ::" msgstr "" -#: ../../library/re.rst:1392 +#: ../../library/re.rst:1404 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m.group(0) # The entire match\n" @@ -1856,7 +1878,7 @@ msgid "" "('Isaac', 'Newton')" msgstr "" -#: ../../library/re.rst:1402 +#: ../../library/re.rst:1414 msgid "" "If the regular expression uses the ``(?P...)`` syntax, the *groupN* " "arguments may also be strings identifying groups by their group name. If a " @@ -1864,11 +1886,11 @@ msgid "" "`IndexError` exception is raised." msgstr "" -#: ../../library/re.rst:1407 +#: ../../library/re.rst:1419 msgid "A moderately complicated example::" msgstr "" -#: ../../library/re.rst:1409 +#: ../../library/re.rst:1421 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -1884,11 +1906,11 @@ msgstr "" ">>> m.group('last_name')\n" "'Reynolds'" -#: ../../library/re.rst:1415 +#: ../../library/re.rst:1427 msgid "Named groups can also be referred to by their index::" msgstr "" -#: ../../library/re.rst:1417 +#: ../../library/re.rst:1429 msgid "" ">>> m.group(1)\n" "'Malcolm'\n" @@ -1900,24 +1922,24 @@ msgstr "" ">>> m.group(2)\n" "'Reynolds'" -#: ../../library/re.rst:1422 +#: ../../library/re.rst:1434 msgid "If a group matches multiple times, only the last match is accessible::" msgstr "" -#: ../../library/re.rst:1424 +#: ../../library/re.rst:1436 msgid "" ">>> m = re.match(r\"(..)+\", \"a1b2c3\") # Matches 3 times.\n" ">>> m.group(1) # Returns only the last match.\n" "'c3'" msgstr "" -#: ../../library/re.rst:1431 +#: ../../library/re.rst:1443 msgid "" "This is identical to ``m.group(g)``. This allows easier access to an " "individual group from a match::" msgstr "" -#: ../../library/re.rst:1434 +#: ../../library/re.rst:1446 msgid "" ">>> m = re.match(r\"(\\w+) (\\w+)\", \"Isaac Newton, physicist\")\n" ">>> m[0] # The entire match\n" @@ -1928,11 +1950,11 @@ msgid "" "'Newton'" msgstr "" -#: ../../library/re.rst:1442 +#: ../../library/re.rst:1454 msgid "Named groups are supported as well::" msgstr "" -#: ../../library/re.rst:1444 +#: ../../library/re.rst:1456 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Isaac " "Newton\")\n" @@ -1948,18 +1970,18 @@ msgstr "" ">>> m['last_name']\n" "'Newton'" -#: ../../library/re.rst:1455 +#: ../../library/re.rst:1467 msgid "" "Return a tuple containing all the subgroups of the match, from 1 up to " "however many groups are in the pattern. The *default* argument is used for " "groups that did not participate in the match; it defaults to ``None``." msgstr "" -#: ../../library/re.rst:1459 ../../library/re.rst:1684 +#: ../../library/re.rst:1471 ../../library/re.rst:1696 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/re.rst:1461 +#: ../../library/re.rst:1473 msgid "" ">>> m = re.match(r\"(\\d+)\\.(\\d+)\", \"24.1632\")\n" ">>> m.groups()\n" @@ -1969,14 +1991,14 @@ msgstr "" ">>> m.groups()\n" "('24', '1632')" -#: ../../library/re.rst:1465 +#: ../../library/re.rst:1477 msgid "" "If we make the decimal place and everything after it optional, not all " "groups might participate in the match. These groups will default to " "``None`` unless the *default* argument is given::" msgstr "" -#: ../../library/re.rst:1469 +#: ../../library/re.rst:1481 msgid "" ">>> m = re.match(r\"(\\d+)\\.?(\\d+)?\", \"24\")\n" ">>> m.groups() # Second group defaults to None.\n" @@ -1985,14 +2007,14 @@ msgid "" "('24', '0')" msgstr "" -#: ../../library/re.rst:1478 +#: ../../library/re.rst:1490 msgid "" "Return a dictionary containing all the *named* subgroups of the match, keyed " "by the subgroup name. The *default* argument is used for groups that did " "not participate in the match; it defaults to ``None``. For example::" msgstr "" -#: ../../library/re.rst:1482 +#: ../../library/re.rst:1494 msgid "" ">>> m = re.match(r\"(?P\\w+) (?P\\w+)\", \"Malcolm " "Reynolds\")\n" @@ -2004,7 +2026,7 @@ msgstr "" ">>> m.groupdict()\n" "{'first_name': 'Malcolm', 'last_name': 'Reynolds'}" -#: ../../library/re.rst:1490 +#: ../../library/re.rst:1502 msgid "" "Return the indices of the start and end of the substring matched by *group*; " "*group* defaults to zero (meaning the whole matched substring). Return " @@ -2013,11 +2035,11 @@ msgid "" "matched by group *g* (equivalent to ``m.group(g)``) is ::" msgstr "" -#: ../../library/re.rst:1496 +#: ../../library/re.rst:1508 msgid "m.string[m.start(g):m.end(g)]" msgstr "m.string[m.start(g):m.end(g)]" -#: ../../library/re.rst:1498 +#: ../../library/re.rst:1510 msgid "" "Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched " "a null string. For example, after ``m = re.search('b(c?)', 'cba')``, ``m." @@ -2025,11 +2047,11 @@ msgid "" "2, and ``m.start(2)`` raises an :exc:`IndexError` exception." msgstr "" -#: ../../library/re.rst:1503 +#: ../../library/re.rst:1515 msgid "An example that will remove *remove_this* from email addresses::" msgstr "" -#: ../../library/re.rst:1505 +#: ../../library/re.rst:1517 msgid "" ">>> email = \"tony@tiremove_thisger.net\"\n" ">>> m = re.search(\"remove_this\", email)\n" @@ -2041,28 +2063,28 @@ msgstr "" ">>> email[:m.start()] + email[m.end():]\n" "'tony@tiger.net'" -#: ../../library/re.rst:1513 +#: ../../library/re.rst:1525 msgid "" "For a match *m*, return the 2-tuple ``(m.start(group), m.end(group))``. Note " "that if *group* did not contribute to the match, this is ``(-1, -1)``. " "*group* defaults to zero, the entire match." msgstr "" -#: ../../library/re.rst:1520 +#: ../../library/re.rst:1532 msgid "" "The value of *pos* which was passed to the :meth:`~Pattern.search` or :meth:" "`~Pattern.match` method of a :ref:`regex object `. This is the " "index into the string at which the RE engine started looking for a match." msgstr "" -#: ../../library/re.rst:1527 +#: ../../library/re.rst:1539 msgid "" "The value of *endpos* which was passed to the :meth:`~Pattern.search` or :" "meth:`~Pattern.match` method of a :ref:`regex object `. This is " "the index into the string beyond which the RE engine will not go." msgstr "" -#: ../../library/re.rst:1534 +#: ../../library/re.rst:1546 msgid "" "The integer index of the last matched capturing group, or ``None`` if no " "group was matched at all. For example, the expressions ``(a)b``, ``((a)" @@ -2071,43 +2093,43 @@ msgid "" "applied to the same string." msgstr "" -#: ../../library/re.rst:1543 +#: ../../library/re.rst:1555 msgid "" "The name of the last matched capturing group, or ``None`` if the group " "didn't have a name, or if no group was matched at all." msgstr "" -#: ../../library/re.rst:1549 +#: ../../library/re.rst:1561 msgid "" "The :ref:`regular expression object ` whose :meth:`~Pattern." "match` or :meth:`~Pattern.search` method produced this match instance." msgstr "" -#: ../../library/re.rst:1555 +#: ../../library/re.rst:1567 msgid "The string passed to :meth:`~Pattern.match` or :meth:`~Pattern.search`." msgstr "" -#: ../../library/re.rst:1558 +#: ../../library/re.rst:1570 msgid "" "Added support of :func:`copy.copy` and :func:`copy.deepcopy`. Match objects " "are considered atomic." msgstr "" -#: ../../library/re.rst:1566 +#: ../../library/re.rst:1578 msgid "Regular Expression Examples" msgstr "" -#: ../../library/re.rst:1570 +#: ../../library/re.rst:1582 msgid "Checking for a Pair" msgstr "" -#: ../../library/re.rst:1572 +#: ../../library/re.rst:1584 msgid "" "In this example, we'll use the following helper function to display match " "objects a little more gracefully::" msgstr "" -#: ../../library/re.rst:1575 +#: ../../library/re.rst:1587 msgid "" "def displaymatch(match):\n" " if match is None:\n" @@ -2119,7 +2141,7 @@ msgstr "" " return None\n" " return '' % (match.group(), match.groups())" -#: ../../library/re.rst:1580 +#: ../../library/re.rst:1592 msgid "" "Suppose you are writing a poker program where a player's hand is represented " "as a 5-character string with each character representing a card, \"a\" for " @@ -2127,11 +2149,11 @@ msgid "" "\"2\" through \"9\" representing the card with that value." msgstr "" -#: ../../library/re.rst:1585 +#: ../../library/re.rst:1597 msgid "To see if a given string is a valid hand, one could do the following::" msgstr "" -#: ../../library/re.rst:1587 +#: ../../library/re.rst:1599 msgid "" ">>> valid = re.compile(r\"^[a2-9tjqk]{5}$\")\n" ">>> displaymatch(valid.match(\"akt5q\")) # Valid.\n" @@ -2142,14 +2164,14 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1595 +#: ../../library/re.rst:1607 msgid "" "That last hand, ``\"727ak\"``, contained a pair, or two of the same valued " "cards. To match this with a regular expression, one could use backreferences " "as such::" msgstr "" -#: ../../library/re.rst:1598 +#: ../../library/re.rst:1610 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> displaymatch(pair.match(\"717ak\")) # Pair of 7s.\n" @@ -2159,13 +2181,13 @@ msgid "" "\"\"" msgstr "" -#: ../../library/re.rst:1605 +#: ../../library/re.rst:1617 msgid "" "To find out what card the pair consists of, one could use the :meth:`~Match." "group` method of the match object in the following manner::" msgstr "" -#: ../../library/re.rst:1608 +#: ../../library/re.rst:1620 msgid "" ">>> pair = re.compile(r\".*(.).*\\1\")\n" ">>> pair.match(\"717ak\").group(1)\n" @@ -2183,11 +2205,11 @@ msgid "" "'a'" msgstr "" -#: ../../library/re.rst:1624 +#: ../../library/re.rst:1636 msgid "Simulating scanf()" msgstr "模擬 scanf()" -#: ../../library/re.rst:1628 +#: ../../library/re.rst:1640 msgid "" "Python does not currently have an equivalent to :c:func:`!scanf`. Regular " "expressions are generally more powerful, though also more verbose, than :c:" @@ -2196,130 +2218,130 @@ msgid "" "expressions." msgstr "" -#: ../../library/re.rst:1635 +#: ../../library/re.rst:1647 msgid ":c:func:`!scanf` Token" msgstr "" -#: ../../library/re.rst:1635 +#: ../../library/re.rst:1647 msgid "Regular Expression" msgstr "" -#: ../../library/re.rst:1637 +#: ../../library/re.rst:1649 msgid "``%c``" msgstr "``%c``" -#: ../../library/re.rst:1639 +#: ../../library/re.rst:1651 msgid "``%5c``" msgstr "``%5c``" -#: ../../library/re.rst:1639 +#: ../../library/re.rst:1651 msgid "``.{5}``" msgstr "``.{5}``" -#: ../../library/re.rst:1641 +#: ../../library/re.rst:1653 msgid "``%d``" msgstr "``%d``" -#: ../../library/re.rst:1641 +#: ../../library/re.rst:1653 msgid "``[-+]?\\d+``" msgstr "``[-+]?\\d+``" -#: ../../library/re.rst:1643 +#: ../../library/re.rst:1655 msgid "``%e``, ``%E``, ``%f``, ``%g``" msgstr "``%e``, ``%E``, ``%f``, ``%g``" -#: ../../library/re.rst:1643 +#: ../../library/re.rst:1655 msgid "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" msgstr "``[-+]?(\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?``" -#: ../../library/re.rst:1645 +#: ../../library/re.rst:1657 msgid "``%i``" msgstr "``%i``" -#: ../../library/re.rst:1645 +#: ../../library/re.rst:1657 msgid "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" msgstr "``[-+]?(0[xX][\\dA-Fa-f]+|0[0-7]*|\\d+)``" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1659 msgid "``%o``" msgstr "``%o``" -#: ../../library/re.rst:1647 +#: ../../library/re.rst:1659 msgid "``[-+]?[0-7]+``" msgstr "``[-+]?[0-7]+``" -#: ../../library/re.rst:1649 +#: ../../library/re.rst:1661 msgid "``%s``" msgstr "``%s``" -#: ../../library/re.rst:1649 +#: ../../library/re.rst:1661 msgid "``\\S+``" msgstr "``\\S+``" -#: ../../library/re.rst:1651 +#: ../../library/re.rst:1663 msgid "``%u``" msgstr "``%u``" -#: ../../library/re.rst:1651 +#: ../../library/re.rst:1663 msgid "``\\d+``" msgstr "``\\d+``" -#: ../../library/re.rst:1653 +#: ../../library/re.rst:1665 msgid "``%x``, ``%X``" msgstr "``%x``、``%X``" -#: ../../library/re.rst:1653 +#: ../../library/re.rst:1665 msgid "``[-+]?(0[xX])?[\\dA-Fa-f]+``" msgstr "``[-+]?(0[xX])?[\\dA-Fa-f]+``" -#: ../../library/re.rst:1656 +#: ../../library/re.rst:1668 msgid "To extract the filename and numbers from a string like ::" msgstr "" -#: ../../library/re.rst:1658 +#: ../../library/re.rst:1670 msgid "/usr/sbin/sendmail - 0 errors, 4 warnings" msgstr "/usr/sbin/sendmail - 0 errors, 4 warnings" -#: ../../library/re.rst:1660 +#: ../../library/re.rst:1672 msgid "you would use a :c:func:`!scanf` format like ::" msgstr "" -#: ../../library/re.rst:1662 +#: ../../library/re.rst:1674 msgid "%s - %d errors, %d warnings" msgstr "" -#: ../../library/re.rst:1664 +#: ../../library/re.rst:1676 msgid "The equivalent regular expression would be ::" msgstr "" -#: ../../library/re.rst:1666 +#: ../../library/re.rst:1678 msgid "(\\S+) - (\\d+) errors, (\\d+) warnings" msgstr "" -#: ../../library/re.rst:1672 +#: ../../library/re.rst:1684 msgid "search() vs. match()" msgstr "search() vs. match()" -#: ../../library/re.rst:1676 +#: ../../library/re.rst:1688 msgid "" "Python offers different primitive operations based on regular expressions:" msgstr "" -#: ../../library/re.rst:1678 +#: ../../library/re.rst:1690 msgid ":func:`re.match` checks for a match only at the beginning of the string" msgstr "" -#: ../../library/re.rst:1679 +#: ../../library/re.rst:1691 msgid "" ":func:`re.search` checks for a match anywhere in the string (this is what " "Perl does by default)" msgstr "" -#: ../../library/re.rst:1681 +#: ../../library/re.rst:1693 msgid ":func:`re.fullmatch` checks for entire string to be a match" msgstr "" -#: ../../library/re.rst:1686 +#: ../../library/re.rst:1698 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"c\", \"abcdef\") # Match\n" @@ -2329,13 +2351,13 @@ msgid "" ">>> re.fullmatch(\"r.*n\", \"python\") # No match" msgstr "" -#: ../../library/re.rst:1693 +#: ../../library/re.rst:1705 msgid "" "Regular expressions beginning with ``'^'`` can be used with :func:`search` " "to restrict the match at the beginning of the string::" msgstr "" -#: ../../library/re.rst:1696 +#: ../../library/re.rst:1708 msgid "" ">>> re.match(\"c\", \"abcdef\") # No match\n" ">>> re.search(\"^c\", \"abcdef\") # No match\n" @@ -2343,7 +2365,7 @@ msgid "" "" msgstr "" -#: ../../library/re.rst:1701 +#: ../../library/re.rst:1713 msgid "" "Note however that in :const:`MULTILINE` mode :func:`match` only matches at " "the beginning of the string, whereas using :func:`search` with a regular " @@ -2351,18 +2373,18 @@ msgid "" "line. ::" msgstr "" -#: ../../library/re.rst:1705 +#: ../../library/re.rst:1717 msgid "" ">>> re.match(\"X\", \"A\\nB\\nX\", re.MULTILINE) # No match\n" ">>> re.search(\"^X\", \"A\\nB\\nX\", re.MULTILINE) # Match\n" "" msgstr "" -#: ../../library/re.rst:1711 +#: ../../library/re.rst:1723 msgid "Making a Phonebook" msgstr "" -#: ../../library/re.rst:1713 +#: ../../library/re.rst:1725 msgid "" ":func:`split` splits a string into a list delimited by the passed pattern. " "The method is invaluable for converting textual data into data structures " @@ -2370,13 +2392,13 @@ msgid "" "following example that creates a phonebook." msgstr "" -#: ../../library/re.rst:1718 +#: ../../library/re.rst:1730 msgid "" "First, here is the input. Normally it may come from a file, here we are " "using triple-quoted string syntax" msgstr "" -#: ../../library/re.rst:1721 +#: ../../library/re.rst:1733 msgid "" ">>> text = \"\"\"Ross McFluff: 834.345.1254 155 Elm Street\n" "...\n" @@ -2394,13 +2416,13 @@ msgstr "" "...\n" "... Heather Albrecht: 548.326.4584 919 Park Place\"\"\"" -#: ../../library/re.rst:1731 +#: ../../library/re.rst:1743 msgid "" "The entries are separated by one or more newlines. Now we convert the string " "into a list with each nonempty line having its own entry:" msgstr "" -#: ../../library/re.rst:1734 +#: ../../library/re.rst:1746 msgid "" ">>> entries = re.split(\"\\n+\", text)\n" ">>> entries\n" @@ -2416,53 +2438,53 @@ msgstr "" "'Frank Burger: 925.541.7625 662 South Dogwood Way',\n" "'Heather Albrecht: 548.326.4584 919 Park Place']" -#: ../../library/re.rst:1744 +#: ../../library/re.rst:1756 msgid "" "Finally, split each entry into a list with first name, last name, telephone " "number, and address. We use the ``maxsplit`` parameter of :func:`split` " "because the address has spaces, our splitting pattern, in it:" msgstr "" -#: ../../library/re.rst:1748 +#: ../../library/re.rst:1760 msgid "" -">>> [re.split(\":? \", entry, 3) for entry in entries]\n" +">>> [re.split(\":? \", entry, maxsplit=3) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],\n" "['Ronald', 'Heathmore', '892.345.3428', '436 Finley Avenue'],\n" "['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919 Park Place']]" msgstr "" -">>> [re.split(\":? \", entry, 3) for entry in entries]\n" +">>> [re.split(\":? \", entry, maxsplit=3) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],\n" "['Ronald', 'Heathmore', '892.345.3428', '436 Finley Avenue'],\n" "['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919 Park Place']]" -#: ../../library/re.rst:1757 +#: ../../library/re.rst:1769 msgid "" "The ``:?`` pattern matches the colon after the last name, so that it does " "not occur in the result list. With a ``maxsplit`` of ``4``, we could " "separate the house number from the street name:" msgstr "" -#: ../../library/re.rst:1761 +#: ../../library/re.rst:1773 msgid "" -">>> [re.split(\":? \", entry, 4) for entry in entries]\n" +">>> [re.split(\":? \", entry, maxsplit=4) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155', 'Elm Street'],\n" "['Ronald', 'Heathmore', '892.345.3428', '436', 'Finley Avenue'],\n" "['Frank', 'Burger', '925.541.7625', '662', 'South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919', 'Park Place']]" msgstr "" -">>> [re.split(\":? \", entry, 4) for entry in entries]\n" +">>> [re.split(\":? \", entry, maxsplit=4) for entry in entries]\n" "[['Ross', 'McFluff', '834.345.1254', '155', 'Elm Street'],\n" "['Ronald', 'Heathmore', '892.345.3428', '436', 'Finley Avenue'],\n" "['Frank', 'Burger', '925.541.7625', '662', 'South Dogwood Way'],\n" "['Heather', 'Albrecht', '548.326.4584', '919', 'Park Place']]" -#: ../../library/re.rst:1772 +#: ../../library/re.rst:1784 msgid "Text Munging" msgstr "" -#: ../../library/re.rst:1774 +#: ../../library/re.rst:1786 msgid "" ":func:`sub` replaces every occurrence of a pattern with a string or the " "result of a function. This example demonstrates using :func:`sub` with a " @@ -2470,7 +2492,7 @@ msgid "" "each word of a sentence except for the first and last characters::" msgstr "" -#: ../../library/re.rst:1779 +#: ../../library/re.rst:1791 msgid "" ">>> def repl(m):\n" "... inner_word = list(m.group(2))\n" @@ -2494,11 +2516,11 @@ msgstr "" ">>> re.sub(r\"(\\w)(\\w+)(\\w)\", repl, text)\n" "'Pofsroser Aodlambelk, plasee reoprt yuor asnebces potlmrpy.'" -#: ../../library/re.rst:1792 +#: ../../library/re.rst:1804 msgid "Finding all Adverbs" msgstr "" -#: ../../library/re.rst:1794 +#: ../../library/re.rst:1806 msgid "" ":func:`findall` matches *all* occurrences of a pattern, not just the first " "one as :func:`search` does. For example, if a writer wanted to find all of " @@ -2506,7 +2528,7 @@ msgid "" "manner::" msgstr "" -#: ../../library/re.rst:1799 +#: ../../library/re.rst:1811 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> re.findall(r\"\\w+ly\\b\", text)\n" @@ -2516,11 +2538,11 @@ msgstr "" ">>> re.findall(r\"\\w+ly\\b\", text)\n" "['carefully', 'quickly']" -#: ../../library/re.rst:1805 +#: ../../library/re.rst:1817 msgid "Finding all Adverbs and their Positions" msgstr "" -#: ../../library/re.rst:1807 +#: ../../library/re.rst:1819 msgid "" "If one wants more information about all matches of a pattern than the " "matched text, :func:`finditer` is useful as it provides :class:`~re.Match` " @@ -2529,7 +2551,7 @@ msgid "" "they would use :func:`finditer` in the following manner::" msgstr "" -#: ../../library/re.rst:1813 +#: ../../library/re.rst:1825 msgid "" ">>> text = \"He was carefully disguised but captured quickly by police.\"\n" ">>> for m in re.finditer(r\"\\w+ly\\b\", text):\n" @@ -2543,11 +2565,11 @@ msgstr "" "07-16: carefully\n" "40-47: quickly" -#: ../../library/re.rst:1821 +#: ../../library/re.rst:1833 msgid "Raw String Notation" msgstr "" -#: ../../library/re.rst:1823 +#: ../../library/re.rst:1835 msgid "" "Raw string notation (``r\"text\"``) keeps regular expressions sane. Without " "it, every backslash (``'\\'``) in a regular expression would have to be " @@ -2555,7 +2577,7 @@ msgid "" "lines of code are functionally identical::" msgstr "" -#: ../../library/re.rst:1828 +#: ../../library/re.rst:1840 msgid "" ">>> re.match(r\"\\W(.)\\1\\W\", \" ff \")\n" "\n" @@ -2567,7 +2589,7 @@ msgstr "" ">>> re.match(\"\\\\W(.)\\\\1\\\\W\", \" ff \")\n" "" -#: ../../library/re.rst:1833 +#: ../../library/re.rst:1845 msgid "" "When one wants to match a literal backslash, it must be escaped in the " "regular expression. With raw string notation, this means ``r\"\\\\\"``. " @@ -2575,7 +2597,7 @@ msgid "" "following lines of code functionally identical::" msgstr "" -#: ../../library/re.rst:1838 +#: ../../library/re.rst:1850 msgid "" ">>> re.match(r\"\\\\\", r\"\\\\\")\n" "\n" @@ -2587,25 +2609,25 @@ msgstr "" ">>> re.match(\"\\\\\\\\\", r\"\\\\\")\n" "" -#: ../../library/re.rst:1845 +#: ../../library/re.rst:1857 msgid "Writing a Tokenizer" msgstr "" -#: ../../library/re.rst:1847 +#: ../../library/re.rst:1859 msgid "" "A `tokenizer or scanner `_ " "analyzes a string to categorize groups of characters. This is a useful " "first step in writing a compiler or interpreter." msgstr "" -#: ../../library/re.rst:1851 +#: ../../library/re.rst:1863 msgid "" "The text categories are specified with regular expressions. The technique " "is to combine those into a single master regular expression and to loop over " "successive matches::" msgstr "" -#: ../../library/re.rst:1855 +#: ../../library/re.rst:1867 msgid "" "from typing import NamedTuple\n" "import re\n" @@ -2661,11 +2683,11 @@ msgid "" " print(token)" msgstr "" -#: ../../library/re.rst:1907 +#: ../../library/re.rst:1919 msgid "The tokenizer produces the following output::" msgstr "" -#: ../../library/re.rst:1909 +#: ../../library/re.rst:1921 msgid "" "Token(type='IF', value='IF', line=2, column=4)\n" "Token(type='ID', value='quantity', line=2, column=7)\n" @@ -2707,7 +2729,7 @@ msgstr "" "Token(type='ENDIF', value='ENDIF', line=5, column=4)\n" "Token(type='END', value=';', line=5, column=9)" -#: ../../library/re.rst:1930 +#: ../../library/re.rst:1942 msgid "" "Friedl, Jeffrey. Mastering Regular Expressions. 3rd ed., O'Reilly Media, " "2009. The third edition of the book no longer covers Python at all, but the " @@ -2729,10 +2751,10 @@ msgstr ". (點)" #: ../../library/re.rst:448 ../../library/re.rst:455 ../../library/re.rst:462 #: ../../library/re.rst:489 ../../library/re.rst:499 ../../library/re.rst:522 #: ../../library/re.rst:534 ../../library/re.rst:539 ../../library/re.rst:561 -#: ../../library/re.rst:575 ../../library/re.rst:591 ../../library/re.rst:599 -#: ../../library/re.rst:613 ../../library/re.rst:621 ../../library/re.rst:638 -#: ../../library/re.rst:652 ../../library/re.rst:657 ../../library/re.rst:848 -#: ../../library/re.rst:1079 +#: ../../library/re.rst:581 ../../library/re.rst:597 ../../library/re.rst:605 +#: ../../library/re.rst:619 ../../library/re.rst:627 ../../library/re.rst:644 +#: ../../library/re.rst:658 ../../library/re.rst:663 ../../library/re.rst:854 +#: ../../library/re.rst:1090 msgid "in regular expressions" msgstr "於正規表示式中" @@ -2848,7 +2870,7 @@ msgstr "(?(" msgid "\\A" msgstr "\\A" -#: ../../library/re.rst:539 ../../library/re.rst:657 +#: ../../library/re.rst:539 ../../library/re.rst:663 msgid "\\b" msgstr "\\b" @@ -2856,87 +2878,87 @@ msgstr "\\b" msgid "\\B" msgstr "\\B" -#: ../../library/re.rst:575 +#: ../../library/re.rst:581 msgid "\\d" msgstr "\\d" -#: ../../library/re.rst:591 +#: ../../library/re.rst:597 msgid "\\D" msgstr "\\D" -#: ../../library/re.rst:599 +#: ../../library/re.rst:605 msgid "\\s" msgstr "\\s" -#: ../../library/re.rst:613 +#: ../../library/re.rst:619 msgid "\\S" msgstr "\\S" -#: ../../library/re.rst:621 +#: ../../library/re.rst:627 msgid "\\w" msgstr "\\w" -#: ../../library/re.rst:638 +#: ../../library/re.rst:644 msgid "\\W" msgstr "\\W" -#: ../../library/re.rst:652 +#: ../../library/re.rst:658 msgid "\\Z" msgstr "\\Z" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\a" msgstr "\\a" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\f" msgstr "\\f" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\n" msgstr "\\n" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\N" msgstr "\\N" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\r" msgstr "\\r" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\t" msgstr "\\t" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\u" msgstr "\\u" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\U" msgstr "\\U" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\v" msgstr "\\v" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\x" msgstr "\\x" -#: ../../library/re.rst:657 +#: ../../library/re.rst:663 msgid "\\\\" msgstr "\\\\" -#: ../../library/re.rst:848 +#: ../../library/re.rst:854 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/re.rst:1079 +#: ../../library/re.rst:1090 msgid "\\g" msgstr "\\g" -#: ../../library/re.rst:1626 +#: ../../library/re.rst:1638 msgid "scanf (C function)" msgstr "scanf(C 函式)" diff --git a/library/readline.po b/library/readline.po index a23e1af6e2..40b729b026 100644 --- a/library/readline.po +++ b/library/readline.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -43,30 +43,41 @@ msgid "" "general." msgstr "" -#: ../../library/readline.rst:29 +#: ../../includes/wasm-mobile-notavail.rst:3 +msgid ":ref:`Availability `: not Android, not iOS, not WASI." +msgstr ":ref:`適用 `:非 Android、非 iOS、非 WASI。" + +#: ../../includes/wasm-mobile-notavail.rst:5 msgid "" -"The underlying Readline library API may be implemented by the ``libedit`` " -"library instead of GNU readline. On macOS the :mod:`readline` module detects " -"which library is being used at run time." +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" +"此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" +"台 `\\ 上不支援。" -#: ../../library/readline.rst:34 +#: ../../library/readline.rst:31 msgid "" -"The configuration file for ``libedit`` is different from that of GNU " -"readline. If you programmatically load configuration strings you can check " -"for the text \"libedit\" in :const:`readline.__doc__` to differentiate " -"between GNU readline and libedit." +"The underlying Readline library API may be implemented by the ``editline`` " +"(``libedit``) library instead of GNU readline. On macOS the :mod:`readline` " +"module detects which library is being used at run time." msgstr "" -#: ../../library/readline.rst:39 +#: ../../library/readline.rst:36 msgid "" -"If you use *editline*/``libedit`` readline emulation on macOS, the " +"The configuration file for ``editline`` is different from that of GNU " +"readline. If you programmatically load configuration strings you can use :" +"data:`backend` to determine which library is being used." +msgstr "" + +#: ../../library/readline.rst:40 +msgid "" +"If you use ``editline``/``libedit`` readline emulation on macOS, the " "initialization file located in your home directory is named ``.editrc``. For " "example, the following content in ``~/.editrc`` will turn ON *vi* " "keybindings and TAB completion::" msgstr "" -#: ../../library/readline.rst:44 +#: ../../library/readline.rst:45 msgid "" "python:bind -v\n" "python:bind ^I rl_complete" @@ -74,83 +85,89 @@ msgstr "" "python:bind -v\n" "python:bind ^I rl_complete" -#: ../../library/readline.rst:47 +#: ../../library/readline.rst:48 msgid "" "Also note that different libraries may use different history file formats. " "When switching the underlying library, existing history files may become " "unusable." msgstr "" -#: ../../library/readline.rst:53 +#: ../../library/readline.rst:54 +msgid "" +"The name of the underlying Readline library being used, either " +"``\"readline\"`` or ``\"editline\"``." +msgstr "" + +#: ../../library/readline.rst:60 msgid "Init file" msgstr "" -#: ../../library/readline.rst:55 +#: ../../library/readline.rst:62 msgid "The following functions relate to the init file and user configuration:" msgstr "" -#: ../../library/readline.rst:60 +#: ../../library/readline.rst:67 msgid "" "Execute the init line provided in the *string* argument. This calls :c:func:" "`rl_parse_and_bind` in the underlying library." msgstr "" -#: ../../library/readline.rst:66 +#: ../../library/readline.rst:73 msgid "" "Execute a readline initialization file. The default filename is the last " "filename used. This calls :c:func:`rl_read_init_file` in the underlying " "library." msgstr "" -#: ../../library/readline.rst:71 +#: ../../library/readline.rst:78 msgid "Line buffer" msgstr "" -#: ../../library/readline.rst:73 +#: ../../library/readline.rst:80 msgid "The following functions operate on the line buffer:" msgstr "" -#: ../../library/readline.rst:78 +#: ../../library/readline.rst:85 msgid "" "Return the current contents of the line buffer (:c:data:`rl_line_buffer` in " "the underlying library)." msgstr "" -#: ../../library/readline.rst:84 +#: ../../library/readline.rst:91 msgid "" "Insert text into the line buffer at the cursor position. This calls :c:func:" "`rl_insert_text` in the underlying library, but ignores the return value." msgstr "" -#: ../../library/readline.rst:91 +#: ../../library/readline.rst:98 msgid "" "Change what's displayed on the screen to reflect the current contents of the " "line buffer. This calls :c:func:`rl_redisplay` in the underlying library." msgstr "" -#: ../../library/readline.rst:96 +#: ../../library/readline.rst:103 msgid "History file" msgstr "" -#: ../../library/readline.rst:98 +#: ../../library/readline.rst:105 msgid "The following functions operate on a history file:" msgstr "" -#: ../../library/readline.rst:103 +#: ../../library/readline.rst:110 msgid "" "Load a readline history file, and append it to the history list. The default " "filename is :file:`~/.history`. This calls :c:func:`read_history` in the " "underlying library." msgstr "" -#: ../../library/readline.rst:110 +#: ../../library/readline.rst:117 msgid "" "Save the history list to a readline history file, overwriting any existing " "file. The default filename is :file:`~/.history`. This calls :c:func:" "`write_history` in the underlying library." msgstr "" -#: ../../library/readline.rst:117 +#: ../../library/readline.rst:124 msgid "" "Append the last *nelements* items of history to a file. The default " "filename is :file:`~/.history`. The file must already exist. This calls :c:" @@ -158,7 +175,7 @@ msgid "" "if Python was compiled for a version of the library that supports it." msgstr "" -#: ../../library/readline.rst:129 +#: ../../library/readline.rst:136 msgid "" "Set or return the desired number of lines to save in the history file. The :" "func:`write_history_file` function uses this value to truncate the history " @@ -166,72 +183,72 @@ msgid "" "Negative values imply unlimited history file size." msgstr "" -#: ../../library/readline.rst:137 +#: ../../library/readline.rst:144 msgid "History list" msgstr "" -#: ../../library/readline.rst:139 +#: ../../library/readline.rst:146 msgid "The following functions operate on a global history list:" msgstr "" -#: ../../library/readline.rst:144 +#: ../../library/readline.rst:151 msgid "" "Clear the current history. This calls :c:func:`clear_history` in the " "underlying library. The Python function only exists if Python was compiled " "for a version of the library that supports it." msgstr "" -#: ../../library/readline.rst:151 +#: ../../library/readline.rst:158 msgid "" "Return the number of items currently in the history. (This is different " "from :func:`get_history_length`, which returns the maximum number of lines " "that will be written to a history file.)" msgstr "" -#: ../../library/readline.rst:158 +#: ../../library/readline.rst:165 msgid "" "Return the current contents of history item at *index*. The item index is " "one-based. This calls :c:func:`history_get` in the underlying library." msgstr "" -#: ../../library/readline.rst:164 +#: ../../library/readline.rst:171 msgid "" "Remove history item specified by its position from the history. The position " "is zero-based. This calls :c:func:`remove_history` in the underlying " "library." msgstr "" -#: ../../library/readline.rst:171 +#: ../../library/readline.rst:178 msgid "" "Replace history item specified by its position with *line*. The position is " "zero-based. This calls :c:func:`replace_history_entry` in the underlying " "library." msgstr "" -#: ../../library/readline.rst:178 +#: ../../library/readline.rst:185 msgid "" "Append *line* to the history buffer, as if it was the last line typed. This " "calls :c:func:`add_history` in the underlying library." msgstr "" -#: ../../library/readline.rst:184 +#: ../../library/readline.rst:191 msgid "" "Enable or disable automatic calls to :c:func:`add_history` when reading " "input via readline. The *enabled* argument should be a Boolean value that " "when true, enables auto history, and that when false, disables auto history." msgstr "" -#: ../../library/readline.rst:192 +#: ../../library/readline.rst:199 msgid "" "Auto history is enabled by default, and changes to this do not persist " "across multiple sessions." msgstr "" -#: ../../library/readline.rst:197 +#: ../../library/readline.rst:204 msgid "Startup hooks" msgstr "" -#: ../../library/readline.rst:202 +#: ../../library/readline.rst:209 msgid "" "Set or remove the function invoked by the :c:data:`rl_startup_hook` callback " "of the underlying library. If *function* is specified, it will be used as " @@ -240,7 +257,7 @@ msgid "" "readline prints the first prompt." msgstr "" -#: ../../library/readline.rst:211 +#: ../../library/readline.rst:218 msgid "" "Set or remove the function invoked by the :c:data:`rl_pre_input_hook` " "callback of the underlying library. If *function* is specified, it will be " @@ -251,11 +268,11 @@ msgid "" "of the library that supports it." msgstr "" -#: ../../library/readline.rst:223 +#: ../../library/readline.rst:230 msgid "Completion" msgstr "" -#: ../../library/readline.rst:225 +#: ../../library/readline.rst:232 msgid "" "The following functions relate to implementing a custom word completion " "function. This is typically operated by the Tab key, and can suggest and " @@ -265,7 +282,7 @@ msgid "" "custom completer, a different set of word delimiters should be set." msgstr "" -#: ../../library/readline.rst:235 +#: ../../library/readline.rst:242 msgid "" "Set or remove the completer function. If *function* is specified, it will " "be used as the new completer function; if omitted or ``None``, any completer " @@ -275,7 +292,7 @@ msgid "" "starting with *text*." msgstr "" -#: ../../library/readline.rst:242 +#: ../../library/readline.rst:249 msgid "" "The installed completer function is invoked by the *entry_func* callback " "passed to :c:func:`rl_completion_matches` in the underlying library. The " @@ -283,19 +300,19 @@ msgid "" "`rl_attempted_completion_function` callback of the underlying library." msgstr "" -#: ../../library/readline.rst:251 +#: ../../library/readline.rst:258 msgid "" "Get the completer function, or ``None`` if no completer function has been " "set." msgstr "" -#: ../../library/readline.rst:256 +#: ../../library/readline.rst:263 msgid "" "Get the type of completion being attempted. This returns the :c:data:" "`rl_completion_type` variable in the underlying library as an integer." msgstr "" -#: ../../library/readline.rst:264 +#: ../../library/readline.rst:271 msgid "" "Get the beginning or ending index of the completion scope. These indexes are " "the *start* and *end* arguments passed to the :c:data:" @@ -305,7 +322,7 @@ msgid "" "differently than libreadline." msgstr "" -#: ../../library/readline.rst:275 +#: ../../library/readline.rst:282 msgid "" "Set or get the word delimiters for completion. These determine the start of " "the word to be considered for completion (the completion scope). These " @@ -313,7 +330,7 @@ msgid "" "in the underlying library." msgstr "" -#: ../../library/readline.rst:283 +#: ../../library/readline.rst:290 msgid "" "Set or remove the completion display function. If *function* is specified, " "it will be used as the new completion display function; if omitted or " @@ -324,11 +341,11 @@ msgid "" "each time matches need to be displayed." msgstr "" -#: ../../library/readline.rst:296 +#: ../../library/readline.rst:303 msgid "Example" msgstr "範例" -#: ../../library/readline.rst:298 +#: ../../library/readline.rst:305 msgid "" "The following example demonstrates how to use the :mod:`readline` module's " "history reading and writing functions to automatically load and save a " @@ -337,7 +354,7 @@ msgid "" "sessions from the user's :envvar:`PYTHONSTARTUP` file. ::" msgstr "" -#: ../../library/readline.rst:304 +#: ../../library/readline.rst:311 msgid "" "import atexit\n" "import os\n" @@ -354,19 +371,19 @@ msgid "" "atexit.register(readline.write_history_file, histfile)" msgstr "" -#: ../../library/readline.rst:318 +#: ../../library/readline.rst:325 msgid "" "This code is actually automatically run when Python is run in :ref:" "`interactive mode ` (see :ref:`rlcompleter-config`)." msgstr "" -#: ../../library/readline.rst:321 +#: ../../library/readline.rst:328 msgid "" "The following example achieves the same goal but supports concurrent " "interactive sessions, by only appending the new history. ::" msgstr "" -#: ../../library/readline.rst:324 +#: ../../library/readline.rst:331 msgid "" "import atexit\n" "import os\n" @@ -404,13 +421,13 @@ msgstr "" " readline.append_history_file(new_h_len - prev_h_len, histfile)\n" "atexit.register(save, h_len, histfile)" -#: ../../library/readline.rst:342 +#: ../../library/readline.rst:349 msgid "" "The following example extends the :class:`code.InteractiveConsole` class to " "support history save/restore. ::" msgstr "" -#: ../../library/readline.rst:345 +#: ../../library/readline.rst:352 msgid "" "import atexit\n" "import code\n" diff --git a/library/reprlib.po b/library/reprlib.po index c68a714b13..ee82176131 100644 --- a/library/reprlib.po +++ b/library/reprlib.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/resource.po b/library/resource.po index 633d41c179..f1f4e4a90c 100644 --- a/library/resource.po +++ b/library/resource.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,7 +28,8 @@ msgid "" msgstr "" #: ../../library/resource.rst:16 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#, fuzzy +msgid ":ref:`Availability `: Unix, not WASI." msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" #: ../../library/resource.rst:18 diff --git a/library/rlcompleter.po b/library/rlcompleter.po index f6ae409d9b..c40e220e6e 100644 --- a/library/rlcompleter.po +++ b/library/rlcompleter.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/runpy.po b/library/runpy.po index b59ef48a03..3b338bcfc3 100644 --- a/library/runpy.po +++ b/library/runpy.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2016-11-19 00:33+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,7 +55,7 @@ msgstr "" #: ../../library/runpy.rst:35 msgid "" -"Execute the code of the specified module and return the resulting module " +"Execute the code of the specified module and return the resulting module's " "globals dictionary. The module's code is first located using the standard " "import mechanism (refer to :pep:`302` for details) and then executed in a " "fresh module namespace." @@ -72,19 +72,19 @@ msgstr "" #: ../../library/runpy.rst:46 msgid "" "The optional dictionary argument *init_globals* may be used to pre-populate " -"the module's globals dictionary before the code is executed. The supplied " -"dictionary will not be modified. If any of the special global variables " -"below are defined in the supplied dictionary, those definitions are " -"overridden by :func:`run_module`." +"the module's globals dictionary before the code is executed. *init_globals* " +"will not be modified. If any of the special global variables below are " +"defined in *init_globals*, those definitions are overridden by :func:" +"`run_module`." msgstr "" #: ../../library/runpy.rst:52 ../../library/runpy.rst:127 msgid "" "The special global variables ``__name__``, ``__spec__``, ``__file__``, " "``__cached__``, ``__loader__`` and ``__package__`` are set in the globals " -"dictionary before the module code is executed (Note that this is a minimal " +"dictionary before the module code is executed. (Note that this is a minimal " "set of variables - other variables may be set implicitly as an interpreter " -"implementation detail)." +"implementation detail.)" msgstr "" #: ../../library/runpy.rst:58 @@ -98,7 +98,7 @@ msgstr "" msgid "" "``__spec__`` will be set appropriately for the *actually* imported module " "(that is, ``__spec__.name`` will always be *mod_name* or ``mod_name + '." -"__main__``, never *run_name*)." +"__main__'``, never *run_name*)." msgstr "" #: ../../library/runpy.rst:66 @@ -156,11 +156,10 @@ msgstr "" #: ../../library/runpy.rst:106 msgid "" "Execute the code at the named filesystem location and return the resulting " -"module globals dictionary. As with a script name supplied to the CPython " -"command line, the supplied path may refer to a Python source file, a " -"compiled bytecode file or a valid :data:`sys.path` entry containing a :mod:" -"`__main__` module (e.g. a zipfile containing a top-level ``__main__.py`` " -"file)." +"module's globals dictionary. As with a script name supplied to the CPython " +"command line, *file_path* may refer to a Python source file, a compiled " +"bytecode file or a valid :data:`sys.path` entry containing a :mod:`__main__` " +"module (e.g. a zipfile containing a top-level :file:`__main__.py` file)." msgstr "" #: ../../library/runpy.rst:113 @@ -177,10 +176,10 @@ msgstr "" #: ../../library/runpy.rst:121 msgid "" "The optional dictionary argument *init_globals* may be used to pre-populate " -"the module's globals dictionary before the code is executed. The supplied " -"dictionary will not be modified. If any of the special global variables " -"below are defined in the supplied dictionary, those definitions are " -"overridden by :func:`run_path`." +"the module's globals dictionary before the code is executed. *init_globals* " +"will not be modified. If any of the special global variables below are " +"defined in *init_globals*, those definitions are overridden by :func:" +"`run_path`." msgstr "" #: ../../library/runpy.rst:133 @@ -191,15 +190,15 @@ msgstr "" #: ../../library/runpy.rst:136 msgid "" -"If the supplied path directly references a script file (whether as source or " -"as precompiled byte code), then ``__file__`` will be set to the supplied " -"path, and ``__spec__``, ``__cached__``, ``__loader__`` and ``__package__`` " -"will all be set to :const:`None`." +"If *file_path* directly references a script file (whether as source or as " +"precompiled byte code), then ``__file__`` will be set to *file_path*, and " +"``__spec__``, ``__cached__``, ``__loader__`` and ``__package__`` will all be " +"set to :const:`None`." msgstr "" #: ../../library/runpy.rst:141 msgid "" -"If the supplied path is a reference to a valid :data:`sys.path` entry, then " +"If *file_path* is a reference to a valid :data:`sys.path` entry, then " "``__spec__`` will be set appropriately for the imported :mod:`__main__` " "module (that is, ``__spec__.name`` will always be ``__main__``). " "``__file__``, ``__cached__``, ``__loader__`` and ``__package__`` will be :" @@ -210,7 +209,7 @@ msgstr "" msgid "" "A number of alterations are also made to the :mod:`sys` module. Firstly, :" "data:`sys.path` may be altered as described above. ``sys.argv[0]`` is " -"updated with the value of ``path_name`` and ``sys.modules[__name__]`` is " +"updated with the value of *file_path* and ``sys.modules[__name__]`` is " "updated with a temporary module object for the module being executed. All " "modifications to items in :mod:`sys` are reverted before the function " "returns." diff --git a/library/sched.po b/library/sched.po index 1349a730a5..3e6f6d458d 100644 --- a/library/sched.po +++ b/library/sched.po @@ -5,7 +5,7 @@ # Matt Wang , 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-05-09 16:09+0000\n" diff --git a/library/secrets.po b/library/secrets.po index 703330aac0..d2bfde8612 100644 --- a/library/secrets.po +++ b/library/secrets.po @@ -5,9 +5,9 @@ # bonzo , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-09 14:12+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2022-11-30 13:42+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" diff --git a/library/security_warnings.po b/library/security_warnings.po index 8a2bfa8fe4..711aca08ae 100644 --- a/library/security_warnings.po +++ b/library/security_warnings.po @@ -5,9 +5,9 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-08-21 02:41+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,10 +34,6 @@ msgstr "" "`4648`" #: ../../library/security_warnings.rst:12 -msgid ":mod:`cgi`: :ref:`CGI security considerations `" -msgstr ":mod:`cgi`::ref:`CGI 安全性注意事項 `" - -#: ../../library/security_warnings.rst:13 msgid "" ":mod:`hashlib`: :ref:`all constructors take a \"usedforsecurity\" keyword-" "only argument disabling known insecure and blocked algorithms `" -#: ../../library/security_warnings.rst:16 +#: ../../library/security_warnings.rst:15 msgid "" ":mod:`http.server` is not suitable for production use, only implementing " "basic security checks. See the :ref:`security considerations `。" -#: ../../library/security_warnings.rst:18 +#: ../../library/security_warnings.rst:17 msgid "" ":mod:`logging`: :ref:`Logging configuration uses eval() `" msgstr ":mod:`logging`::ref:`日誌配置使用 eval() `" -#: ../../library/security_warnings.rst:20 +#: ../../library/security_warnings.rst:19 msgid "" ":mod:`multiprocessing`: :ref:`Connection.recv() uses pickle `" @@ -69,17 +65,17 @@ msgstr "" ":mod:`multiprocessing`::ref:`Connection.recv() 使用 pickle `" -#: ../../library/security_warnings.rst:22 +#: ../../library/security_warnings.rst:21 msgid ":mod:`pickle`: :ref:`Restricting globals in pickle `" msgstr ":mod:`pickle`::ref:`限制 pickle 中的全域變數 `" -#: ../../library/security_warnings.rst:23 +#: ../../library/security_warnings.rst:22 msgid "" ":mod:`random` shouldn't be used for security purposes, use :mod:`secrets` " "instead" msgstr ":mod:`random` 不該用於安全性相關用途,請改用 :mod:`secrets`" -#: ../../library/security_warnings.rst:25 +#: ../../library/security_warnings.rst:24 msgid "" ":mod:`shelve`: :ref:`shelve is based on pickle and thus unsuitable for " "dealing with untrusted sources `" @@ -87,17 +83,17 @@ msgstr "" ":mod:`shelve`::ref:`shelve 為基於 pickle,因此不適合用來處理不受信任的來源 " "`" -#: ../../library/security_warnings.rst:27 +#: ../../library/security_warnings.rst:26 msgid ":mod:`ssl`: :ref:`SSL/TLS security considerations `" msgstr ":mod:`ssl`::ref:`SSL/TLS 安全性注意事項 `" -#: ../../library/security_warnings.rst:28 +#: ../../library/security_warnings.rst:27 msgid "" ":mod:`subprocess`: :ref:`Subprocess security considerations `" msgstr ":mod:`subprocess`::ref:`子行程安全性注意事項 `" -#: ../../library/security_warnings.rst:30 +#: ../../library/security_warnings.rst:29 msgid "" ":mod:`tempfile`: :ref:`mktemp is deprecated due to vulnerability to race " "conditions `" @@ -105,11 +101,11 @@ msgstr "" ":mod:`tempfile`::ref:`mktemp 由於存在競爭條件 (race condition) 漏洞而被棄用 " "`" -#: ../../library/security_warnings.rst:32 +#: ../../library/security_warnings.rst:31 msgid ":mod:`xml`: :ref:`XML vulnerabilities `" msgstr ":mod:`xml`::ref:`XML 漏洞 `" -#: ../../library/security_warnings.rst:33 +#: ../../library/security_warnings.rst:32 msgid "" ":mod:`zipfile`: :ref:`maliciously prepared .zip files can cause disk volume " "exhaustion `" @@ -117,7 +113,7 @@ msgstr "" ":mod:`zipfile`::ref:`惡意準備的 .zip 檔案可能會導致硬碟空間耗盡 `" -#: ../../library/security_warnings.rst:36 +#: ../../library/security_warnings.rst:35 msgid "" "The :option:`-I` command line option can be used to run Python in isolated " "mode. When it cannot be used, the :option:`-P` option or the :envvar:" @@ -132,3 +128,6 @@ msgstr "" #: ../../library/security_warnings.rst:3 msgid "security considerations" msgstr "security considerations(安全性注意事項)" + +#~ msgid ":mod:`cgi`: :ref:`CGI security considerations `" +#~ msgstr ":mod:`cgi`::ref:`CGI 安全性注意事項 `" diff --git a/library/select.po b/library/select.po index 3d28e0dd46..17c60cfe83 100644 --- a/library/select.po +++ b/library/select.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,17 +42,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/select.rst:27 msgid "The module defines the following:" diff --git a/library/selectors.po b/library/selectors.po index add677babc..bf3bb5b888 100644 --- a/library/selectors.po +++ b/library/selectors.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -70,17 +70,16 @@ msgid "Low-level I/O multiplexing module." msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/selectors.rst:44 msgid "Classes" diff --git a/library/shelve.po b/library/shelve.po index bef4196535..868c1e555e 100644 --- a/library/shelve.po +++ b/library/shelve.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" diff --git a/library/shlex.po b/library/shlex.po index 1994b4f5db..d1c7a7333d 100644 --- a/library/shlex.po +++ b/library/shlex.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:09+0000\n" diff --git a/library/shutil.po b/library/shutil.po index 0868a4ac29..6eab863585 100644 --- a/library/shutil.po +++ b/library/shutil.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-26 00:13+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -115,7 +115,7 @@ msgstr "" #: ../../library/shutil.rst:81 ../../library/shutil.rst:185 #: ../../library/shutil.rst:217 ../../library/shutil.rst:287 -#: ../../library/shutil.rst:390 +#: ../../library/shutil.rst:396 msgid "" "Platform-specific fast-copy syscalls may be used internally in order to copy " "the file more efficiently. See :ref:`shutil-platform-dependent-efficient-" @@ -449,33 +449,40 @@ msgstr "新增 *dir_fd* 參數。" msgid "Added the *onexc* parameter, deprecated *onerror*." msgstr "新增 *onexc* 參數並棄用 *onerror*。" -#: ../../library/shutil.rst:348 +#: ../../library/shutil.rst:346 +msgid "" +":func:`!rmtree` now ignores :exc:`FileNotFoundError` exceptions for all but " +"the top-level path. Exceptions other than :exc:`OSError` and subclasses of :" +"exc:`!OSError` are now always propagated to the caller." +msgstr "" + +#: ../../library/shutil.rst:354 msgid "" "Indicates whether the current platform and implementation provides a symlink " "attack resistant version of :func:`rmtree`. Currently this is only true for " "platforms supporting fd-based directory access functions." msgstr "" -#: ../../library/shutil.rst:357 +#: ../../library/shutil.rst:363 msgid "" "Recursively move a file or directory (*src*) to another location and return " "the destination." msgstr "" -#: ../../library/shutil.rst:360 +#: ../../library/shutil.rst:366 msgid "" "If *dst* is an existing directory or a symlink to a directory, then *src* is " "moved inside that directory. The destination path in that directory must not " "already exist." msgstr "" -#: ../../library/shutil.rst:364 +#: ../../library/shutil.rst:370 msgid "" "If *dst* already exists but is not a directory, it may be overwritten " "depending on :func:`os.rename` semantics." msgstr "" -#: ../../library/shutil.rst:367 +#: ../../library/shutil.rst:373 msgid "" "If the destination is on the current filesystem, then :func:`os.rename` is " "used. Otherwise, *src* is copied to the destination using *copy_function* " @@ -483,7 +490,7 @@ msgid "" "of *src* will be created as the destination and *src* will be removed." msgstr "" -#: ../../library/shutil.rst:372 +#: ../../library/shutil.rst:378 msgid "" "If *copy_function* is given, it must be a callable that takes two arguments, " "*src* and the destination, and will be used to copy *src* to the destination " @@ -494,7 +501,7 @@ msgid "" "copy the metadata, at the expense of not copying any of the metadata." msgstr "" -#: ../../library/shutil.rst:380 +#: ../../library/shutil.rst:386 msgid "" "Raises an :ref:`auditing event ` ``shutil.move`` with arguments " "``src``, ``dst``." @@ -502,57 +509,57 @@ msgstr "" "引發一個附帶引數 ``src``、``dst`` 的\\ :ref:`稽核事件 ` ``shutil." "move``。" -#: ../../library/shutil.rst:382 +#: ../../library/shutil.rst:388 msgid "" "Added explicit symlink handling for foreign filesystems, thus adapting it to " "the behavior of GNU's :program:`mv`. Now returns *dst*." msgstr "" -#: ../../library/shutil.rst:387 +#: ../../library/shutil.rst:393 msgid "Added the *copy_function* keyword argument." msgstr "新增 *copy_function* 關鍵字引數。" -#: ../../library/shutil.rst:395 +#: ../../library/shutil.rst:401 msgid "Accepts a :term:`path-like object` for both *src* and *dst*." msgstr "" -#: ../../library/shutil.rst:400 +#: ../../library/shutil.rst:406 msgid "" "Return disk usage statistics about the given path as a :term:`named tuple` " "with the attributes *total*, *used* and *free*, which are the amount of " "total, used and free space, in bytes. *path* may be a file or a directory." msgstr "" -#: ../../library/shutil.rst:407 +#: ../../library/shutil.rst:413 msgid "" "On Unix filesystems, *path* must point to a path within a **mounted** " "filesystem partition. On those platforms, CPython doesn't attempt to " "retrieve disk usage information from non-mounted filesystems." msgstr "" -#: ../../library/shutil.rst:413 +#: ../../library/shutil.rst:419 msgid "On Windows, *path* can now be a file or directory." msgstr "" -#: ../../library/shutil.rst:416 +#: ../../library/shutil.rst:422 msgid ":ref:`Availability `: Unix, Windows." msgstr ":ref:`適用 `:Unix、Windows。" -#: ../../library/shutil.rst:420 +#: ../../library/shutil.rst:427 msgid "Change owner *user* and/or *group* of the given *path*." msgstr "" -#: ../../library/shutil.rst:422 +#: ../../library/shutil.rst:429 msgid "" "*user* can be a system user name or a uid; the same applies to *group*. At " "least one argument is required." msgstr "" -#: ../../library/shutil.rst:425 +#: ../../library/shutil.rst:432 msgid "See also :func:`os.chown`, the underlying function." msgstr "" -#: ../../library/shutil.rst:427 +#: ../../library/shutil.rst:434 msgid "" "Raises an :ref:`auditing event ` ``shutil.chown`` with arguments " "``path``, ``user``, ``group``." @@ -560,29 +567,36 @@ msgstr "" "引發一個附帶引數 ``path``、``user``、``group`` 的\\ :ref:`稽核事件 " "` ``shutil.chown``。" -#: ../../library/shutil.rst:429 +#: ../../library/shutil.rst:436 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" -#: ../../library/shutil.rst:436 +#: ../../library/shutil.rst:440 +#, fuzzy +msgid "Added *dir_fd* and *follow_symlinks* parameters." +msgstr "新增 *follow_symlinks* 引數。" + +#: ../../library/shutil.rst:446 msgid "" "Return the path to an executable which would be run if the given *cmd* was " "called. If no *cmd* would be called, return ``None``." msgstr "" -#: ../../library/shutil.rst:439 +#: ../../library/shutil.rst:449 msgid "" "*mode* is a permission mask passed to :func:`os.access`, by default " "determining if the file exists and is executable." msgstr "" -#: ../../library/shutil.rst:442 +#: ../../library/shutil.rst:452 msgid "" -"When no *path* is specified, the results of :func:`os.environ` are used, " -"returning either the \"PATH\" value or a fallback of :data:`os.defpath`." +"*path* is a \"``PATH`` string\" specifying the directories to look in, " +"delimited by :data:`os.pathsep`. When no *path* is specified, the :envvar:" +"`PATH` environment variable is read from :data:`os.environ`, falling back " +"to :data:`os.defpath` if it is not set." msgstr "" -#: ../../library/shutil.rst:445 +#: ../../library/shutil.rst:457 msgid "" "On Windows, the current directory is prepended to the *path* if *mode* does " "not include ``os.X_OK``. When the *mode* does include ``os.X_OK``, the " @@ -592,16 +606,16 @@ msgid "" "environment variable ``NoDefaultCurrentDirectoryInExePath``." msgstr "" -#: ../../library/shutil.rst:452 +#: ../../library/shutil.rst:464 msgid "" -"Also on Windows, the ``PATHEXT`` variable is used to resolve commands that " -"may not already include an extension. For example, if you call ``shutil." -"which(\"python\")``, :func:`which` will search ``PATHEXT`` to know that it " -"should look for ``python.exe`` within the *path* directories. For example, " -"on Windows::" +"Also on Windows, the :envvar:`PATHEXT` environment variable is used to " +"resolve commands that may not already include an extension. For example, if " +"you call ``shutil.which(\"python\")``, :func:`which` will search ``PATHEXT`` " +"to know that it should look for ``python.exe`` within the *path* " +"directories. For example, on Windows::" msgstr "" -#: ../../library/shutil.rst:458 +#: ../../library/shutil.rst:470 msgid "" ">>> shutil.which(\"python\")\n" "'C:\\\\Python33\\\\python.EXE'" @@ -609,25 +623,25 @@ msgstr "" ">>> shutil.which(\"python\")\n" "'C:\\\\Python33\\\\python.EXE'" -#: ../../library/shutil.rst:461 +#: ../../library/shutil.rst:473 msgid "" "This is also applied when *cmd* is a path that contains a directory " "component::" msgstr "" -#: ../../library/shutil.rst:464 +#: ../../library/shutil.rst:476 msgid "" ">> shutil.which(\"C:\\\\Python33\\\\python\")\n" "'C:\\\\Python33\\\\python.EXE'" msgstr "" -#: ../../library/shutil.rst:469 +#: ../../library/shutil.rst:481 msgid "" "The :class:`bytes` type is now accepted. If *cmd* type is :class:`bytes`, " "the result type is also :class:`bytes`." msgstr "" -#: ../../library/shutil.rst:473 +#: ../../library/shutil.rst:485 msgid "" "On Windows, the current directory is no longer prepended to the search path " "if *mode* includes ``os.X_OK`` and WinAPI " @@ -638,25 +652,25 @@ msgid "" "now be found." msgstr "" -#: ../../library/shutil.rst:482 +#: ../../library/shutil.rst:494 msgid "" "On Windows, if *mode* includes ``os.X_OK``, executables with an extension in " "``PATHEXT`` will be preferred over executables without a matching extension. " "This brings behavior closer to that of Python 3.11." msgstr "" -#: ../../library/shutil.rst:490 +#: ../../library/shutil.rst:502 msgid "" "This exception collects exceptions that are raised during a multi-file " "operation. For :func:`copytree`, the exception argument is a list of 3-" "tuples (*srcname*, *dstname*, *exception*)." msgstr "" -#: ../../library/shutil.rst:497 +#: ../../library/shutil.rst:509 msgid "Platform-dependent efficient copy operations" msgstr "" -#: ../../library/shutil.rst:499 +#: ../../library/shutil.rst:511 msgid "" "Starting from Python 3.8, all functions involving a file copy (:func:" "`copyfile`, :func:`~shutil.copy`, :func:`copy2`, :func:`copytree`, and :func:" @@ -666,37 +680,37 @@ msgid "" "buffers in Python as in \"``outfd.write(infd.read())``\"." msgstr "" -#: ../../library/shutil.rst:507 +#: ../../library/shutil.rst:519 msgid "On macOS `fcopyfile`_ is used to copy the file content (not metadata)." msgstr "" -#: ../../library/shutil.rst:509 +#: ../../library/shutil.rst:521 msgid "On Linux :func:`os.sendfile` is used." msgstr "" -#: ../../library/shutil.rst:511 +#: ../../library/shutil.rst:523 msgid "" "On Windows :func:`shutil.copyfile` uses a bigger default buffer size (1 MiB " "instead of 64 KiB) and a :func:`memoryview`-based variant of :func:`shutil." "copyfileobj` is used." msgstr "" -#: ../../library/shutil.rst:515 +#: ../../library/shutil.rst:527 msgid "" "If the fast-copy operation fails and no data was written in the destination " "file then shutil will silently fallback on using less efficient :func:" "`copyfileobj` function internally." msgstr "" -#: ../../library/shutil.rst:524 +#: ../../library/shutil.rst:536 msgid "copytree example" msgstr "" -#: ../../library/shutil.rst:526 +#: ../../library/shutil.rst:538 msgid "An example that uses the :func:`ignore_patterns` helper::" msgstr "" -#: ../../library/shutil.rst:528 +#: ../../library/shutil.rst:540 msgid "" "from shutil import copytree, ignore_patterns\n" "\n" @@ -706,17 +720,17 @@ msgstr "" "\n" "copytree(source, destination, ignore=ignore_patterns('*.pyc', 'tmp*'))" -#: ../../library/shutil.rst:532 +#: ../../library/shutil.rst:544 msgid "" "This will copy everything except ``.pyc`` files and files or directories " "whose name starts with ``tmp``." msgstr "" -#: ../../library/shutil.rst:535 +#: ../../library/shutil.rst:547 msgid "Another example that uses the *ignore* argument to add a logging call::" msgstr "" -#: ../../library/shutil.rst:537 +#: ../../library/shutil.rst:549 msgid "" "from shutil import copytree\n" "import logging\n" @@ -728,11 +742,11 @@ msgid "" "copytree(source, destination, ignore=_logpath)" msgstr "" -#: ../../library/shutil.rst:550 +#: ../../library/shutil.rst:562 msgid "rmtree example" msgstr "rmtree 範例" -#: ../../library/shutil.rst:552 +#: ../../library/shutil.rst:564 msgid "" "This example shows how to remove a directory tree on Windows where some of " "the files have their read-only bit set. It uses the onexc callback to clear " @@ -740,7 +754,7 @@ msgid "" "propagate. ::" msgstr "" -#: ../../library/shutil.rst:557 +#: ../../library/shutil.rst:569 msgid "" "import os, stat\n" "import shutil\n" @@ -753,31 +767,31 @@ msgid "" "shutil.rmtree(directory, onexc=remove_readonly)" msgstr "" -#: ../../library/shutil.rst:570 +#: ../../library/shutil.rst:582 msgid "Archiving operations" msgstr "" -#: ../../library/shutil.rst:574 +#: ../../library/shutil.rst:586 msgid "Added support for the *xztar* format." msgstr "新增 *xztar* 格式的支援。" -#: ../../library/shutil.rst:578 +#: ../../library/shutil.rst:590 msgid "" "High-level utilities to create and read compressed and archived files are " "also provided. They rely on the :mod:`zipfile` and :mod:`tarfile` modules." msgstr "" -#: ../../library/shutil.rst:583 +#: ../../library/shutil.rst:595 msgid "Create an archive file (such as zip or tar) and return its name." msgstr "" -#: ../../library/shutil.rst:585 +#: ../../library/shutil.rst:597 msgid "" "*base_name* is the name of the file to create, including the path, minus any " "format-specific extension." msgstr "" -#: ../../library/shutil.rst:588 +#: ../../library/shutil.rst:600 msgid "" "*format* is the archive format: one of \"zip\" (if the :mod:`zlib` module is " "available), \"tar\", \"gztar\" (if the :mod:`zlib` module is available), " @@ -785,14 +799,14 @@ msgid "" "`lzma` module is available)." msgstr "" -#: ../../library/shutil.rst:593 +#: ../../library/shutil.rst:605 msgid "" "*root_dir* is a directory that will be the root directory of the archive, " "all paths in the archive will be relative to it; for example, we typically " "chdir into *root_dir* before creating the archive." msgstr "" -#: ../../library/shutil.rst:597 +#: ../../library/shutil.rst:609 msgid "" "*base_dir* is the directory where we start archiving from; i.e. *base_dir* " "will be the common prefix of all files and directories in the archive. " @@ -800,33 +814,33 @@ msgid "" "example-with-basedir` for how to use *base_dir* and *root_dir* together." msgstr "" -#: ../../library/shutil.rst:603 +#: ../../library/shutil.rst:615 msgid "*root_dir* and *base_dir* both default to the current directory." msgstr "" -#: ../../library/shutil.rst:605 +#: ../../library/shutil.rst:617 msgid "" "If *dry_run* is true, no archive is created, but the operations that would " "be executed are logged to *logger*." msgstr "" -#: ../../library/shutil.rst:608 +#: ../../library/shutil.rst:620 msgid "" "*owner* and *group* are used when creating a tar archive. By default, uses " "the current owner and group." msgstr "" -#: ../../library/shutil.rst:611 +#: ../../library/shutil.rst:623 msgid "" "*logger* must be an object compatible with :pep:`282`, usually an instance " "of :class:`logging.Logger`." msgstr "" -#: ../../library/shutil.rst:614 +#: ../../library/shutil.rst:626 msgid "The *verbose* argument is unused and deprecated." msgstr "" -#: ../../library/shutil.rst:616 +#: ../../library/shutil.rst:628 msgid "" "Raises an :ref:`auditing event ` ``shutil.make_archive`` with " "arguments ``base_name``, ``format``, ``root_dir``, ``base_dir``." @@ -834,7 +848,7 @@ msgstr "" "引發一個附帶引數 ``base_name``、``format``、``root_dir``、``base_dir`` 的\\ :" "ref:`稽核事件 ` ``shutil.make_archive``。" -#: ../../library/shutil.rst:620 +#: ../../library/shutil.rst:632 msgid "" "This function is not thread-safe when custom archivers registered with :func:" "`register_archive_format` do not support the *root_dir* argument. In this " @@ -842,60 +856,60 @@ msgid "" "*root_dir* to perform archiving." msgstr "" -#: ../../library/shutil.rst:626 +#: ../../library/shutil.rst:638 msgid "" "The modern pax (POSIX.1-2001) format is now used instead of the legacy GNU " "format for archives created with ``format=\"tar\"``." msgstr "" -#: ../../library/shutil.rst:630 +#: ../../library/shutil.rst:642 msgid "" "This function is now made thread-safe during creation of standard ``.zip`` " "and tar archives." msgstr "" -#: ../../library/shutil.rst:636 +#: ../../library/shutil.rst:648 msgid "" "Return a list of supported formats for archiving. Each element of the " "returned sequence is a tuple ``(name, description)``." msgstr "" -#: ../../library/shutil.rst:639 ../../library/shutil.rst:750 +#: ../../library/shutil.rst:651 ../../library/shutil.rst:762 msgid "By default :mod:`shutil` provides these formats:" msgstr "" -#: ../../library/shutil.rst:641 +#: ../../library/shutil.rst:653 msgid "*zip*: ZIP file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:642 +#: ../../library/shutil.rst:654 msgid "" "*tar*: Uncompressed tar file. Uses POSIX.1-2001 pax format for new archives." msgstr "" -#: ../../library/shutil.rst:643 ../../library/shutil.rst:755 +#: ../../library/shutil.rst:655 ../../library/shutil.rst:767 msgid "*gztar*: gzip'ed tar-file (if the :mod:`zlib` module is available)." msgstr "" -#: ../../library/shutil.rst:644 ../../library/shutil.rst:756 +#: ../../library/shutil.rst:656 ../../library/shutil.rst:768 msgid "*bztar*: bzip2'ed tar-file (if the :mod:`bz2` module is available)." msgstr "" -#: ../../library/shutil.rst:645 ../../library/shutil.rst:757 +#: ../../library/shutil.rst:657 ../../library/shutil.rst:769 msgid "*xztar*: xz'ed tar-file (if the :mod:`lzma` module is available)." msgstr "" -#: ../../library/shutil.rst:647 +#: ../../library/shutil.rst:659 msgid "" "You can register new formats or provide your own archiver for any existing " "formats, by using :func:`register_archive_format`." msgstr "" -#: ../../library/shutil.rst:653 +#: ../../library/shutil.rst:665 msgid "Register an archiver for the format *name*." msgstr "" -#: ../../library/shutil.rst:655 +#: ../../library/shutil.rst:667 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive the *base_name* of the file to create, followed by the " @@ -904,7 +918,7 @@ msgid "" "*dry_run* and *logger* (as passed in :func:`make_archive`)." msgstr "" -#: ../../library/shutil.rst:661 +#: ../../library/shutil.rst:673 msgid "" "If *function* has the custom attribute ``function.supports_root_dir`` set to " "``True``, the *root_dir* argument is passed as a keyword argument. Otherwise " @@ -913,37 +927,37 @@ msgid "" "not thread-safe." msgstr "" -#: ../../library/shutil.rst:667 +#: ../../library/shutil.rst:679 msgid "" "If given, *extra_args* is a sequence of ``(name, value)`` pairs that will be " "used as extra keywords arguments when the archiver callable is used." msgstr "" -#: ../../library/shutil.rst:670 +#: ../../library/shutil.rst:682 msgid "" "*description* is used by :func:`get_archive_formats` which returns the list " "of archivers. Defaults to an empty string." msgstr "" -#: ../../library/shutil.rst:673 +#: ../../library/shutil.rst:685 msgid "Added support for functions supporting the *root_dir* argument." msgstr "" -#: ../../library/shutil.rst:679 +#: ../../library/shutil.rst:691 msgid "Remove the archive format *name* from the list of supported formats." msgstr "" -#: ../../library/shutil.rst:684 +#: ../../library/shutil.rst:696 msgid "Unpack an archive. *filename* is the full path of the archive." msgstr "" -#: ../../library/shutil.rst:686 +#: ../../library/shutil.rst:698 msgid "" "*extract_dir* is the name of the target directory where the archive is " "unpacked. If not provided, the current working directory is used." msgstr "" -#: ../../library/shutil.rst:689 +#: ../../library/shutil.rst:701 msgid "" "*format* is the archive format: one of \"zip\", \"tar\", \"gztar\", " "\"bztar\", or \"xztar\". Or any other format registered with :func:" @@ -952,7 +966,7 @@ msgid "" "that extension. In case none is found, a :exc:`ValueError` is raised." msgstr "" -#: ../../library/shutil.rst:696 +#: ../../library/shutil.rst:708 msgid "" "The keyword-only *filter* argument is passed to the underlying unpacking " "function. For zip files, *filter* is not accepted. For tar files, it is " @@ -962,7 +976,7 @@ msgid "" "Python 3.14." msgstr "" -#: ../../library/shutil.rst:704 +#: ../../library/shutil.rst:716 msgid "" "Raises an :ref:`auditing event ` ``shutil.unpack_archive`` with " "arguments ``filename``, ``extract_dir``, ``format``." @@ -970,7 +984,7 @@ msgstr "" "引發一個附帶引數 ``filename``、``extract_dir``、``format`` 的\\ :ref:`稽核事" "件 ` ``shutil.unpack_archive``。" -#: ../../library/shutil.rst:708 +#: ../../library/shutil.rst:720 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of the path specified in the " @@ -978,91 +992,91 @@ msgid "" "with \"/\" or filenames with two dots \"..\"." msgstr "" -#: ../../library/shutil.rst:713 +#: ../../library/shutil.rst:725 msgid "Accepts a :term:`path-like object` for *filename* and *extract_dir*." msgstr "" -#: ../../library/shutil.rst:716 +#: ../../library/shutil.rst:728 msgid "Added the *filter* argument." msgstr "新增 *filter* 引數。" -#: ../../library/shutil.rst:721 +#: ../../library/shutil.rst:733 msgid "" "Registers an unpack format. *name* is the name of the format and " "*extensions* is a list of extensions corresponding to the format, like ``." "zip`` for Zip files." msgstr "" -#: ../../library/shutil.rst:725 +#: ../../library/shutil.rst:737 msgid "" "*function* is the callable that will be used to unpack archives. The " "callable will receive:" msgstr "" -#: ../../library/shutil.rst:728 +#: ../../library/shutil.rst:740 msgid "the path of the archive, as a positional argument;" msgstr "" -#: ../../library/shutil.rst:729 +#: ../../library/shutil.rst:741 msgid "" "the directory the archive must be extracted to, as a positional argument;" msgstr "" -#: ../../library/shutil.rst:730 +#: ../../library/shutil.rst:742 msgid "" "possibly a *filter* keyword argument, if it was given to :func:" "`unpack_archive`;" msgstr "" -#: ../../library/shutil.rst:732 +#: ../../library/shutil.rst:744 msgid "" "additional keyword arguments, specified by *extra_args* as a sequence of " "``(name, value)`` tuples." msgstr "" -#: ../../library/shutil.rst:735 +#: ../../library/shutil.rst:747 msgid "" "*description* can be provided to describe the format, and will be returned " "by the :func:`get_unpack_formats` function." msgstr "" -#: ../../library/shutil.rst:741 +#: ../../library/shutil.rst:753 msgid "Unregister an unpack format. *name* is the name of the format." msgstr "" -#: ../../library/shutil.rst:746 +#: ../../library/shutil.rst:758 msgid "" "Return a list of all registered formats for unpacking. Each element of the " "returned sequence is a tuple ``(name, extensions, description)``." msgstr "" -#: ../../library/shutil.rst:752 +#: ../../library/shutil.rst:764 msgid "" "*zip*: ZIP file (unpacking compressed files works only if the corresponding " "module is available)." msgstr "" -#: ../../library/shutil.rst:754 +#: ../../library/shutil.rst:766 msgid "*tar*: uncompressed tar file." msgstr "" -#: ../../library/shutil.rst:759 +#: ../../library/shutil.rst:771 msgid "" "You can register new formats or provide your own unpacker for any existing " "formats, by using :func:`register_unpack_format`." msgstr "" -#: ../../library/shutil.rst:766 +#: ../../library/shutil.rst:778 msgid "Archiving example" msgstr "" -#: ../../library/shutil.rst:768 +#: ../../library/shutil.rst:780 msgid "" "In this example, we create a gzip'ed tar-file archive containing all files " "found in the :file:`.ssh` directory of the user::" msgstr "" -#: ../../library/shutil.rst:771 +#: ../../library/shutil.rst:783 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1072,11 +1086,11 @@ msgid "" "'/Users/tarek/myarchive.tar.gz'" msgstr "" -#: ../../library/shutil.rst:778 +#: ../../library/shutil.rst:790 msgid "The resulting archive contains:" msgstr "" -#: ../../library/shutil.rst:780 +#: ../../library/shutil.rst:792 msgid "" "$ tar -tzvf /Users/tarek/myarchive.tar.gz\n" "drwx------ tarek/staff 0 2010-02-01 16:23:40 ./\n" @@ -1098,18 +1112,18 @@ msgstr "" "-rw-r--r-- tarek/staff 397 2008-06-09 13:26:54 ./id_rsa.pub\n" "-rw-r--r-- tarek/staff 37192 2010-02-06 18:23:10 ./known_hosts" -#: ../../library/shutil.rst:796 +#: ../../library/shutil.rst:808 msgid "Archiving example with *base_dir*" msgstr "" -#: ../../library/shutil.rst:798 +#: ../../library/shutil.rst:810 msgid "" "In this example, similar to the `one above `_, we " "show how to use :func:`make_archive`, but this time with the usage of " "*base_dir*. We now have the following directory structure:" msgstr "" -#: ../../library/shutil.rst:802 +#: ../../library/shutil.rst:814 msgid "" "$ tree tmp\n" "tmp\n" @@ -1127,13 +1141,13 @@ msgstr "" " └── please_add.txt\n" " └── do_not_add.txt" -#: ../../library/shutil.rst:812 +#: ../../library/shutil.rst:824 msgid "" "In the final archive, :file:`please_add.txt` should be included, but :file:" "`do_not_add.txt` should not. Therefore we use the following::" msgstr "" -#: ../../library/shutil.rst:815 +#: ../../library/shutil.rst:827 msgid "" ">>> from shutil import make_archive\n" ">>> import os\n" @@ -1157,11 +1171,11 @@ msgstr "" "... )\n" "'/Users/tarek/my_archive.tar'" -#: ../../library/shutil.rst:826 +#: ../../library/shutil.rst:838 msgid "Listing the files in the resulting archive gives us:" msgstr "" -#: ../../library/shutil.rst:828 +#: ../../library/shutil.rst:840 msgid "" "$ python -m tarfile -l /Users/tarek/myarchive.tar\n" "structure/content/\n" @@ -1171,29 +1185,29 @@ msgstr "" "structure/content/\n" "structure/content/please_add.txt" -#: ../../library/shutil.rst:836 +#: ../../library/shutil.rst:848 msgid "Querying the size of the output terminal" msgstr "" -#: ../../library/shutil.rst:840 +#: ../../library/shutil.rst:852 msgid "Get the size of the terminal window." msgstr "" -#: ../../library/shutil.rst:842 +#: ../../library/shutil.rst:854 msgid "" "For each of the two dimensions, the environment variable, ``COLUMNS`` and " "``LINES`` respectively, is checked. If the variable is defined and the value " "is a positive integer, it is used." msgstr "" -#: ../../library/shutil.rst:846 +#: ../../library/shutil.rst:858 msgid "" "When ``COLUMNS`` or ``LINES`` is not defined, which is the common case, the " "terminal connected to :data:`sys.__stdout__` is queried by invoking :func:" "`os.get_terminal_size`." msgstr "" -#: ../../library/shutil.rst:850 +#: ../../library/shutil.rst:862 msgid "" "If the terminal size cannot be successfully queried, either because the " "system doesn't support querying, or because we are not connected to a " @@ -1202,17 +1216,17 @@ msgid "" "emulators." msgstr "" -#: ../../library/shutil.rst:856 +#: ../../library/shutil.rst:868 msgid "The value returned is a named tuple of type :class:`os.terminal_size`." msgstr "" -#: ../../library/shutil.rst:858 +#: ../../library/shutil.rst:870 msgid "" "See also: The Single UNIX Specification, Version 2, `Other Environment " "Variables`_." msgstr "" -#: ../../library/shutil.rst:863 +#: ../../library/shutil.rst:875 msgid "" "The ``fallback`` values are also used if :func:`os.get_terminal_size` " "returns zeroes." diff --git a/library/signal.po b/library/signal.po index 0b09d2bc20..f177d710de 100644 --- a/library/signal.po +++ b/library/signal.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -53,9 +53,9 @@ msgstr "" #: ../../library/signal.rst:29 msgid "" -"On WebAssembly platforms ``wasm32-emscripten`` and ``wasm32-wasi``, signals " -"are emulated and therefore behave differently. Several functions and signals " -"are not available on these platforms." +"On WebAssembly platforms, signals are emulated and therefore behave " +"differently. Several functions and signals are not available on these " +"platforms." msgstr "" #: ../../library/signal.rst:34 @@ -469,8 +469,10 @@ msgid "See the :manpage:`pidfd_send_signal(2)` man page for more information." msgstr "更多資訊請見 :manpage:`pidfd_send_signal(2)` 手冊頁。" #: ../../library/signal.rst:414 -msgid ":ref:`Availability `: Linux >= 5.1" -msgstr ":ref:`適用 `:Linux 5.1 以上" +msgid "" +":ref:`Availability `: Linux >= 5.1, Android >= :func:`build-" +"time ` API level 31" +msgstr "" #: ../../library/signal.rst:420 msgid "" @@ -950,3 +952,6 @@ msgid "" "serve_forever(httpd)\n" "print(\"Shutdown...\")" msgstr "" + +#~ msgid ":ref:`Availability `: Linux >= 5.1" +#~ msgstr ":ref:`適用 `:Linux 5.1 以上" diff --git a/library/site.po b/library/site.po index 5b00bd3bbc..89fbfeb209 100644 --- a/library/site.po +++ b/library/site.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,18 +55,27 @@ msgid "" "It starts by constructing up to four directories from a head and a tail " "part. For the head part, it uses ``sys.prefix`` and ``sys.exec_prefix``; " "empty heads are skipped. For the tail part, it uses the empty string and " -"then :file:`lib/site-packages` (on Windows) or :file:`lib/python{X.Y}/site-" -"packages` (on Unix and macOS). For each of the distinct head-tail " +"then :file:`lib/site-packages` (on Windows) or :file:`lib/python{X.Y[t]}/" +"site-packages` (on Unix and macOS). (The optional suffix \"t\" indicates " +"the :term:`free threading` build, and is appended if ``\"t\"`` is present in " +"the :attr:`sys.abiflags` constant.) For each of the distinct head-tail " "combinations, it sees if it refers to an existing directory, and if so, adds " "it to ``sys.path`` and also inspects the newly added path for configuration " "files." msgstr "" -#: ../../library/site.rst:41 +#: ../../library/site.rst:44 msgid "Support for the \"site-python\" directory has been removed." msgstr "" -#: ../../library/site.rst:44 +#: ../../library/site.rst:47 +msgid "" +"On Unix, :term:`Free threading ` Python installations are " +"identified by the \"t\" suffix in the version-specific directory name, such " +"as :file:`lib/python3.13t/`." +msgstr "" + +#: ../../library/site.rst:52 msgid "" "If a file named \"pyvenv.cfg\" exists one directory above sys.executable, " "sys.prefix and sys.exec_prefix are set to that directory and it is also " @@ -78,7 +87,7 @@ msgid "" "will." msgstr "" -#: ../../library/site.rst:57 +#: ../../library/site.rst:65 msgid "" "A path configuration file is a file whose name has the form :file:`{name}." "pth` and exists in one of the four directories mentioned above; its contents " @@ -90,7 +99,7 @@ msgid "" "executed." msgstr "" -#: ../../library/site.rst:67 +#: ../../library/site.rst:75 msgid "" "An executable line in a :file:`.pth` file is run at every Python startup, " "regardless of whether a particular module is actually going to be used. Its " @@ -102,7 +111,13 @@ msgid "" "putting anything more complex here." msgstr "" -#: ../../library/site.rst:82 +#: ../../library/site.rst:86 +msgid "" +"The :file:`.pth` files are now decoded by UTF-8 at first and then by the :" +"term:`locale encoding` if it fails." +msgstr "" + +#: ../../library/site.rst:94 msgid "" "For example, suppose ``sys.prefix`` and ``sys.exec_prefix`` are set to :file:" "`/usr/local`. The Python X.Y library is then installed in :file:`/usr/local/" @@ -112,7 +127,7 @@ msgid "" "and :file:`bar.pth`. Assume :file:`foo.pth` contains the following::" msgstr "" -#: ../../library/site.rst:90 +#: ../../library/site.rst:102 msgid "" "# foo package configuration\n" "\n" @@ -121,24 +136,24 @@ msgid "" "bletch" msgstr "" -#: ../../library/site.rst:96 +#: ../../library/site.rst:108 msgid "and :file:`bar.pth` contains::" msgstr "" -#: ../../library/site.rst:98 +#: ../../library/site.rst:110 msgid "" "# bar package configuration\n" "\n" "bar" msgstr "" -#: ../../library/site.rst:102 +#: ../../library/site.rst:114 msgid "" "Then the following version-specific directories are added to ``sys.path``, " "in this order::" msgstr "" -#: ../../library/site.rst:105 +#: ../../library/site.rst:117 msgid "" "/usr/local/lib/pythonX.Y/site-packages/bar\n" "/usr/local/lib/pythonX.Y/site-packages/foo" @@ -146,7 +161,7 @@ msgstr "" "/usr/local/lib/pythonX.Y/site-packages/bar\n" "/usr/local/lib/pythonX.Y/site-packages/foo" -#: ../../library/site.rst:108 +#: ../../library/site.rst:120 msgid "" "Note that :file:`bletch` is omitted because it doesn't exist; the :file:" "`bar` directory precedes the :file:`foo` directory because :file:`bar.pth` " @@ -154,11 +169,11 @@ msgid "" "because it is not mentioned in either path configuration file." msgstr "" -#: ../../library/site.rst:114 +#: ../../library/site.rst:126 msgid ":mod:`sitecustomize`" msgstr ":mod:`sitecustomize`" -#: ../../library/site.rst:118 +#: ../../library/site.rst:130 msgid "" "After these path manipulations, an attempt is made to import a module named :" "mod:`sitecustomize`, which can perform arbitrary site-specific " @@ -172,11 +187,11 @@ msgid "" "mysterious failure of the process." msgstr "" -#: ../../library/site.rst:130 +#: ../../library/site.rst:142 msgid ":mod:`usercustomize`" msgstr ":mod:`usercustomize`" -#: ../../library/site.rst:134 +#: ../../library/site.rst:146 msgid "" "After this, an attempt is made to import a module named :mod:" "`usercustomize`, which can perform arbitrary user-specific customizations, " @@ -188,18 +203,18 @@ msgid "" "ignored." msgstr "" -#: ../../library/site.rst:142 +#: ../../library/site.rst:154 msgid "" "Note that for some non-Unix systems, ``sys.prefix`` and ``sys.exec_prefix`` " "are empty, and the path manipulations are skipped; however the import of :" "mod:`sitecustomize` and :mod:`usercustomize` is still attempted." msgstr "" -#: ../../library/site.rst:151 +#: ../../library/site.rst:163 msgid "Readline configuration" msgstr "" -#: ../../library/site.rst:153 +#: ../../library/site.rst:165 msgid "" "On systems that support :mod:`readline`, this module will also import and " "configure the :mod:`rlcompleter` module, if Python is started in :ref:" @@ -211,19 +226,19 @@ msgid "" "`PYTHONSTARTUP` file." msgstr "" -#: ../../library/site.rst:162 +#: ../../library/site.rst:174 msgid "Activation of rlcompleter and history was made automatic." msgstr "" -#: ../../library/site.rst:167 +#: ../../library/site.rst:179 msgid "Module contents" msgstr "模組內容" -#: ../../library/site.rst:171 +#: ../../library/site.rst:183 msgid "A list of prefixes for site-packages directories." msgstr "" -#: ../../library/site.rst:176 +#: ../../library/site.rst:188 msgid "" "Flag showing the status of the user site-packages directory. ``True`` means " "that it is enabled and was added to ``sys.path``. ``False`` means that it " @@ -232,18 +247,19 @@ msgid "" "(mismatch between user or group id and effective id) or by an administrator." msgstr "" -#: ../../library/site.rst:186 +#: ../../library/site.rst:198 msgid "" "Path to the user site-packages for the running Python. Can be ``None`` if :" "func:`getusersitepackages` hasn't been called yet. Default value is :file:" -"`~/.local/lib/python{X.Y}/site-packages` for UNIX and non-framework macOS " +"`~/.local/lib/python{X.Y}[t]/site-packages` for UNIX and non-framework macOS " "builds, :file:`~/Library/Python/{X.Y}/lib/python/site-packages` for macOS " "framework builds, and :file:`{%APPDATA%}\\\\Python\\\\Python{XY}\\\\site-" -"packages` on Windows. This directory is a site directory, which means that :" -"file:`.pth` files in it will be processed." +"packages` on Windows. The optional \"t\" indicates the free-threaded " +"build. This directory is a site directory, which means that :file:`.pth` " +"files in it will be processed." msgstr "" -#: ../../library/site.rst:197 +#: ../../library/site.rst:210 msgid "" "Path to the base directory for the user site-packages. Can be ``None`` if :" "func:`getuserbase` hasn't been called yet. Default value is :file:`~/." @@ -254,35 +270,35 @@ msgid "" "scheme `. See also :envvar:`PYTHONUSERBASE`." msgstr "" -#: ../../library/site.rst:209 +#: ../../library/site.rst:222 msgid "" "Adds all the standard site-specific directories to the module search path. " "This function is called automatically when this module is imported, unless " "the Python interpreter was started with the :option:`-S` flag." msgstr "" -#: ../../library/site.rst:213 +#: ../../library/site.rst:226 msgid "This function used to be called unconditionally." msgstr "" -#: ../../library/site.rst:219 +#: ../../library/site.rst:232 msgid "" "Add a directory to sys.path and process its :file:`.pth` files. Typically " "used in :mod:`sitecustomize` or :mod:`usercustomize` (see above)." msgstr "" -#: ../../library/site.rst:225 +#: ../../library/site.rst:238 msgid "Return a list containing all global site-packages directories." msgstr "" -#: ../../library/site.rst:232 +#: ../../library/site.rst:245 msgid "" "Return the path of the user base directory, :data:`USER_BASE`. If it is not " "initialized yet, this function will also set it, respecting :envvar:" "`PYTHONUSERBASE`." msgstr "" -#: ../../library/site.rst:241 +#: ../../library/site.rst:254 msgid "" "Return the path of the user-specific site-packages directory, :data:" "`USER_SITE`. If it is not initialized yet, this function will also set it, " @@ -290,17 +306,17 @@ msgid "" "packages was added to ``sys.path`` :data:`ENABLE_USER_SITE` should be used." msgstr "" -#: ../../library/site.rst:253 +#: ../../library/site.rst:266 msgid "Command Line Interface" msgstr "命令列介面" -#: ../../library/site.rst:257 +#: ../../library/site.rst:270 msgid "" "The :mod:`site` module also provides a way to get the user directories from " "the command line:" msgstr "" -#: ../../library/site.rst:260 +#: ../../library/site.rst:273 msgid "" "$ python -m site --user-site\n" "/home/user/.local/lib/python3.11/site-packages" @@ -308,7 +324,7 @@ msgstr "" "$ python -m site --user-site\n" "/home/user/.local/lib/python3.11/site-packages" -#: ../../library/site.rst:265 +#: ../../library/site.rst:278 msgid "" "If it is called without arguments, it will print the contents of :data:`sys." "path` on the standard output, followed by the value of :data:`USER_BASE` and " @@ -316,21 +332,21 @@ msgid "" "finally the value of :data:`ENABLE_USER_SITE`." msgstr "" -#: ../../library/site.rst:272 +#: ../../library/site.rst:285 msgid "Print the path to the user base directory." msgstr "" -#: ../../library/site.rst:276 +#: ../../library/site.rst:289 msgid "Print the path to the user site-packages directory." msgstr "" -#: ../../library/site.rst:278 +#: ../../library/site.rst:291 msgid "" "If both options are given, user base and user site will be printed (always " "in this order), separated by :data:`os.pathsep`." msgstr "" -#: ../../library/site.rst:281 +#: ../../library/site.rst:294 msgid "" "If any option is given, the script will exit with one of these values: ``0`` " "if the user site-packages directory is enabled, ``1`` if it was disabled by " @@ -338,11 +354,11 @@ msgid "" "administrator, and a value greater than 2 if there is an error." msgstr "" -#: ../../library/site.rst:288 +#: ../../library/site.rst:301 msgid ":pep:`370` -- Per user site-packages directory" msgstr "" -#: ../../library/site.rst:289 +#: ../../library/site.rst:302 msgid ":ref:`sys-path-init` -- The initialization of :data:`sys.path`." msgstr "" @@ -354,7 +370,7 @@ msgstr "module(模組)" msgid "search" msgstr "search(搜尋)" -#: ../../library/site.rst:16 ../../library/site.rst:78 +#: ../../library/site.rst:16 ../../library/site.rst:90 msgid "path" msgstr "path(路徑)" @@ -366,30 +382,30 @@ msgstr "site-packages" msgid "directory" msgstr "directory(目錄)" -#: ../../library/site.rst:53 +#: ../../library/site.rst:61 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/site.rst:53 +#: ../../library/site.rst:61 msgid "comment" msgstr "comment(註解)" -#: ../../library/site.rst:53 +#: ../../library/site.rst:61 msgid "statement" msgstr "statement(陳述式)" -#: ../../library/site.rst:53 +#: ../../library/site.rst:61 msgid "import" msgstr "import(引入)" -#: ../../library/site.rst:78 +#: ../../library/site.rst:90 msgid "package" msgstr "package(套件)" -#: ../../library/site.rst:78 +#: ../../library/site.rst:90 msgid "configuration" msgstr "configuration(設定)" -#: ../../library/site.rst:78 +#: ../../library/site.rst:90 msgid "file" msgstr "file(檔案)" diff --git a/library/smtplib.po b/library/smtplib.po index 91addd80b5..b3e25996f0 100644 --- a/library/smtplib.po +++ b/library/smtplib.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,17 +35,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/smtplib.rst:26 msgid "" diff --git a/library/sndhdr.po b/library/sndhdr.po deleted file mode 100644 index 62e9d90ce2..0000000000 --- a/library/sndhdr.po +++ /dev/null @@ -1,231 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -# Liang-Bo Wang , 2015 -# Matt Wang , 2021 -# -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" -"PO-Revision-Date: 2022-06-11 15:40+0800\n" -"Last-Translator: Matt Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.1\n" - -#: ../../library/sndhdr.rst:2 -msgid ":mod:`sndhdr` --- Determine type of sound file" -msgstr ":mod:`sndhdr` --- 判定聲音檔案的型別" - -#: ../../library/sndhdr.rst:11 -msgid "**Source code:** :source:`Lib/sndhdr.py`" -msgstr "**原始碼:**\\ :source:`Lib/sndhdr.py`" - -#: ../../library/sndhdr.rst:17 -msgid "" -"The :mod:`sndhdr` module is deprecated (see :pep:`PEP 594 <594#sndhdr>` for " -"details and alternatives)." -msgstr "" -":mod:`sndhdr` 模組 (module) 即將被棄用(詳情與替代方案請見 :pep:`PEP 594 " -"<594#sndhdr>`)。" - -#: ../../library/sndhdr.rst:23 -msgid "" -"The :mod:`sndhdr` provides utility functions which attempt to determine the " -"type of sound data which is in a file. When these functions are able to " -"determine what type of sound data is stored in a file, they return a :func:" -"`~collections.namedtuple`, containing five attributes: (``filetype``, " -"``framerate``, ``nchannels``, ``nframes``, ``sampwidth``). The value for " -"*type* indicates the data type and will be one of the strings ``'aifc'``, " -"``'aiff'``, ``'au'``, ``'hcom'``, ``'sndr'``, ``'sndt'``, ``'voc'``, " -"``'wav'``, ``'8svx'``, ``'sb'``, ``'ub'``, or ``'ul'``. The *sampling_rate* " -"will be either the actual value or ``0`` if unknown or difficult to decode. " -"Similarly, *channels* will be either the number of channels or ``0`` if it " -"cannot be determined or if the value is difficult to decode. The value for " -"*frames* will be either the number of frames or ``-1``. The last item in " -"the tuple, *bits_per_sample*, will either be the sample size in bits or " -"``'A'`` for A-LAW or ``'U'`` for u-LAW." -msgstr "" -":mod:`sndhdr` 提供了企圖猜測檔案中聲音資料型別的工具函式。當這些函式可以推測" -"出儲存在檔案中聲音資料的型別,它們分別回傳一個 :func:`collections." -"namedtuple`,包含了五種屬性:(``filetype``、``framerate``、``nchannels``、" -"``nframes``、``sampwidth``)。這些 *type* 的值表示資料的型別,會是以下字串之" -"一:``'aifc'``、``'aiff'``、``'au'``、``'hcom'``、``'sndr'``、``'sndt'``、" -"``'voc'``、``'wav'``、``'8svx'``、``'sb'``、``'ub'`` 或 ``'ul'``。" -"*sampling_rate*\\ (取樣頻率)可能是實際值、或者當未知或者難以解碼時為 " -"``0``。同樣的,*channels*\\ (影像通道數)也會回傳實際值或者在無法推測或難以" -"解碼時回傳 ``0``。*frames*\\ (幀數)則是實際值或 ``-1``。tuple 的最後一項," -"*bits_per_sample* 為位元表示的取樣大小,或者在 A-LAW 時為 ``'A'``,u-LAW 時" -"為 ``'U'``。" - -#: ../../library/sndhdr.rst:40 -msgid "" -"Determines the type of sound data stored in the file *filename* using :func:" -"`whathdr`. If it succeeds, returns a namedtuple as described above, " -"otherwise ``None`` is returned." -msgstr "" -"使用 :func:`whathdr` 推測儲存在 *filename* 檔案中聲音資料的型別。如果成功,回" -"傳上述的 namedtuple(附名元組),否則回傳 ``None``。" - -#: ../../library/sndhdr.rst:44 ../../library/sndhdr.rst:54 -msgid "Result changed from a tuple to a namedtuple." -msgstr "結果從 tuple 改為 namedtuple。" - -#: ../../library/sndhdr.rst:50 -msgid "" -"Determines the type of sound data stored in a file based on the file " -"header. The name of the file is given by *filename*. This function returns " -"a namedtuple as described above on success, or ``None``." -msgstr "" -"根據檔案標頭 (header) 推測儲存在檔案中的聲音資料型別。檔名由 *filename* 給" -"定。這個函式在成功時回傳上述 namedtuple,或在失敗時回傳 ``None``。" - -#: ../../library/sndhdr.rst:57 -msgid "" -"The following sound header types are recognized, as listed below with the " -"return value from :func:`whathdr`: and :func:`what`:" -msgstr "" - -#: ../../library/sndhdr.rst:61 -msgid "Value" -msgstr "" - -#: ../../library/sndhdr.rst:61 -msgid "Sound header format" -msgstr "" - -#: ../../library/sndhdr.rst:63 -msgid "``'aifc'``" -msgstr "``'aifc'``" - -#: ../../library/sndhdr.rst:63 -msgid "Compressed Audio Interchange Files" -msgstr "" - -#: ../../library/sndhdr.rst:65 -msgid "``'aiff'``" -msgstr "``'aiff'``" - -#: ../../library/sndhdr.rst:65 -msgid "Audio Interchange Files" -msgstr "" - -#: ../../library/sndhdr.rst:67 -msgid "``'au'``" -msgstr "``'au'``" - -#: ../../library/sndhdr.rst:67 -msgid "Au Files" -msgstr "Au 檔案" - -#: ../../library/sndhdr.rst:69 -msgid "``'hcom'``" -msgstr "``'hcom'``" - -#: ../../library/sndhdr.rst:69 -msgid "HCOM Files" -msgstr "HCOM 檔案" - -#: ../../library/sndhdr.rst:71 -msgid "``'sndt'``" -msgstr "``'sndt'``" - -#: ../../library/sndhdr.rst:71 -msgid "Sndtool Sound Files" -msgstr "" - -#: ../../library/sndhdr.rst:73 -msgid "``'voc'``" -msgstr "``'voc'``" - -#: ../../library/sndhdr.rst:73 -msgid "Creative Labs Audio Files" -msgstr "" - -#: ../../library/sndhdr.rst:75 -msgid "``'wav'``" -msgstr "``'wav'``" - -#: ../../library/sndhdr.rst:75 -msgid "Waveform Audio File Format Files" -msgstr "" - -#: ../../library/sndhdr.rst:77 -msgid "``'8svx'``" -msgstr "``'8svx'``" - -#: ../../library/sndhdr.rst:77 -msgid "8-Bit Sampled Voice Files" -msgstr "" - -#: ../../library/sndhdr.rst:79 -msgid "``'sb'``" -msgstr "``'sb'``" - -#: ../../library/sndhdr.rst:79 -msgid "Signed Byte Audio Data Files" -msgstr "" - -#: ../../library/sndhdr.rst:81 -msgid "``'ub'``" -msgstr "``'ub'``" - -#: ../../library/sndhdr.rst:81 -msgid "UB Files" -msgstr "UB 檔案" - -#: ../../library/sndhdr.rst:83 -msgid "``'ul'``" -msgstr "``'ul'``" - -#: ../../library/sndhdr.rst:83 -msgid "uLAW Audio Files" -msgstr "uLAW 音檔" - -#: ../../library/sndhdr.rst:88 -msgid "" -"A list of functions performing the individual tests. Each function takes " -"two arguments: the byte-stream and an open file-like object. When :func:" -"`what` is called with a byte-stream, the file-like object will be ``None``." -msgstr "" - -#: ../../library/sndhdr.rst:92 -msgid "" -"The test function should return a string describing the image type if the " -"test succeeded, or ``None`` if it failed." -msgstr "" - -#: ../../library/sndhdr.rst:95 -msgid "Example:" -msgstr "範例:" - -#: ../../library/sndhdr.rst:97 -msgid "" -">>> import sndhdr\n" -">>> imghdr.what('bass.wav')\n" -"'wav'\n" -">>> imghdr.whathdr('bass.wav')\n" -"'wav'" -msgstr "" -">>> import sndhdr\n" -">>> imghdr.what('bass.wav')\n" -"'wav'\n" -">>> imghdr.whathdr('bass.wav')\n" -"'wav'" - -#: ../../library/sndhdr.rst:13 -msgid "A-LAW" -msgstr "A-LAW" - -#: ../../library/sndhdr.rst:13 -msgid "u-LAW" -msgstr "u-LAW" diff --git a/library/socket.po b/library/socket.po index 68340d8baf..9d99c82d2a 100644 --- a/library/socket.po +++ b/library/socket.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -38,18 +38,25 @@ msgid "" "operating system socket APIs." msgstr "" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" +#: ../../library/socket.rst:709 ../../library/socket.rst:994 +#: ../../library/socket.rst:1010 ../../library/socket.rst:1023 +#: ../../library/socket.rst:1038 ../../library/socket.rst:1055 +#: ../../library/socket.rst:1066 ../../library/socket.rst:1077 +#: ../../library/socket.rst:1088 ../../library/socket.rst:1412 +#: ../../library/socket.rst:1459 ../../library/socket.rst:1473 +#: ../../library/socket.rst:1493 ../../library/socket.rst:1540 +#: ../../library/socket.rst:1585 ../../library/socket.rst:1969 +#: ../../library/socket.rst:1979 ../../includes/wasm-notavail.rst:3 +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/socket.rst:24 msgid "" @@ -112,8 +119,8 @@ msgid "" "Previously, :const:`AF_UNIX` socket paths were assumed to use UTF-8 encoding." msgstr "" -#: ../../library/socket.rst:66 ../../library/socket.rst:1155 -#: ../../library/socket.rst:1197 ../../library/socket.rst:1958 +#: ../../library/socket.rst:66 ../../library/socket.rst:1160 +#: ../../library/socket.rst:1202 ../../library/socket.rst:1963 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "" @@ -287,8 +294,8 @@ msgstr "" msgid "*feat* and *mask* are unsigned 32bit integers." msgstr "" -#: ../../library/socket.rst:171 ../../library/socket.rst:589 -#: ../../library/socket.rst:1880 +#: ../../library/socket.rst:171 ../../library/socket.rst:594 +#: ../../library/socket.rst:1885 msgid ":ref:`Availability `: Linux >= 2.6.38." msgstr ":ref:`適用 `:Linux >= 2.6.38。" @@ -303,7 +310,7 @@ msgid "" "context ID or CID and port are integers." msgstr "" -#: ../../library/socket.rst:181 ../../library/socket.rst:662 +#: ../../library/socket.rst:181 ../../library/socket.rst:667 msgid ":ref:`Availability `: Linux >= 3.9" msgstr ":ref:`適用 `:Linux 3.9 以上。" @@ -368,7 +375,7 @@ msgid "" "address, whose interpretation depends on the device." msgstr "" -#: ../../library/socket.rst:209 ../../library/socket.rst:537 +#: ../../library/socket.rst:209 ../../library/socket.rst:542 msgid ":ref:`Availability `: Linux >= 2.2." msgstr ":ref:`適用 `:Linux >= 2.2。" @@ -380,7 +387,7 @@ msgid "" "*port* are non-negative integers." msgstr "" -#: ../../library/socket.rst:216 ../../library/socket.rst:638 +#: ../../library/socket.rst:216 ../../library/socket.rst:643 msgid ":ref:`Availability `: Linux >= 4.7." msgstr ":ref:`適用 `:Linux >= 4.7。" @@ -652,166 +659,173 @@ msgid "" "``IP_DROP_SOURCE_MEMBERSHIP``." msgstr "" -#: ../../library/socket.rst:453 ../../library/socket.rst:534 -#: ../../library/socket.rst:558 +#: ../../library/socket.rst:448 +msgid "" +"Added ``SO_BINDTOIFINDEX``. On Linux this constant can be used in the same " +"way that ``SO_BINDTODEVICE`` is used, but with the index of a network " +"interface instead of its name." +msgstr "" + +#: ../../library/socket.rst:458 ../../library/socket.rst:539 +#: ../../library/socket.rst:563 msgid "" "Many constants of these forms, documented in the Linux documentation, are " "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:456 +#: ../../library/socket.rst:461 msgid ":ref:`Availability `: Linux >= 2.6.25, NetBSD >= 8." msgstr ":ref:`適用 `:Linux 2.6.25 以上、NetBSD 8 以上。" -#: ../../library/socket.rst:460 +#: ../../library/socket.rst:465 msgid "NetBSD support was added." msgstr "" -#: ../../library/socket.rst:466 +#: ../../library/socket.rst:471 msgid "" "CAN_BCM, in the CAN protocol family, is the broadcast manager (BCM) " "protocol. Broadcast manager constants, documented in the Linux " "documentation, are also defined in the socket module." msgstr "" -#: ../../library/socket.rst:470 ../../library/socket.rst:505 +#: ../../library/socket.rst:475 ../../library/socket.rst:510 msgid ":ref:`Availability `: Linux >= 2.6.25." msgstr ":ref:`適用 `:Linux >= 2.6.25。" -#: ../../library/socket.rst:473 +#: ../../library/socket.rst:478 msgid "" "The :data:`CAN_BCM_CAN_FD_FRAME` flag is only available on Linux >= 4.8." msgstr "" -#: ../../library/socket.rst:479 +#: ../../library/socket.rst:484 msgid "" "Enables CAN FD support in a CAN_RAW socket. This is disabled by default. " "This allows your application to send both CAN and CAN FD frames; however, " "you must accept both CAN and CAN FD frames when reading from the socket." msgstr "" -#: ../../library/socket.rst:483 ../../library/socket.rst:494 +#: ../../library/socket.rst:488 ../../library/socket.rst:499 msgid "This constant is documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:485 +#: ../../library/socket.rst:490 msgid ":ref:`Availability `: Linux >= 3.6." msgstr ":ref:`適用 `:Linux >= 3.6。" -#: ../../library/socket.rst:491 +#: ../../library/socket.rst:496 msgid "" "Joins the applied CAN filters such that only CAN frames that match all given " "CAN filters are passed to user space." msgstr "" -#: ../../library/socket.rst:496 +#: ../../library/socket.rst:501 msgid ":ref:`Availability `: Linux >= 4.1." msgstr ":ref:`適用 `:Linux >= 4.1。" -#: ../../library/socket.rst:502 +#: ../../library/socket.rst:507 msgid "" "CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2) protocol. " "ISO-TP constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:511 +#: ../../library/socket.rst:516 msgid "" "CAN_J1939, in the CAN protocol family, is the SAE J1939 protocol. J1939 " "constants, documented in the Linux documentation." msgstr "" -#: ../../library/socket.rst:514 +#: ../../library/socket.rst:519 msgid ":ref:`Availability `: Linux >= 5.4." msgstr ":ref:`適用 `:Linux >= 5.4。" -#: ../../library/socket.rst:522 +#: ../../library/socket.rst:527 msgid "" "These two constants, documented in the FreeBSD divert(4) manual page, are " "also defined in the socket module." msgstr "" -#: ../../library/socket.rst:525 +#: ../../library/socket.rst:530 msgid ":ref:`Availability `: FreeBSD >= 14.0." msgstr ":ref:`適用 `:FreeBSD >= 14.0。" -#: ../../library/socket.rst:542 +#: ../../library/socket.rst:547 msgid "" ":data:`!ETH_P_ALL` can be used in the :class:`~socket.socket` constructor as " "*proto* for the :const:`AF_PACKET` family in order to capture every packet, " "regardless of protocol." msgstr "" -#: ../../library/socket.rst:546 +#: ../../library/socket.rst:551 msgid "For more information, see the :manpage:`packet(7)` manpage." msgstr "" -#: ../../library/socket.rst:548 +#: ../../library/socket.rst:553 msgid ":ref:`Availability `: Linux." msgstr ":ref:`適用 `:Linux。" -#: ../../library/socket.rst:561 +#: ../../library/socket.rst:566 msgid ":ref:`Availability `: Linux >= 2.6.30." msgstr ":ref:`適用 `:Linux >= 2.6.30。" -#: ../../library/socket.rst:571 +#: ../../library/socket.rst:576 msgid "" "Constants for Windows' WSAIoctl(). The constants are used as arguments to " "the :meth:`~socket.socket.ioctl` method of socket objects." msgstr "" -#: ../../library/socket.rst:574 ../../library/socket.rst:1570 +#: ../../library/socket.rst:579 ../../library/socket.rst:1575 msgid "``SIO_LOOPBACK_FAST_PATH`` was added." msgstr "加入 ``SIO_LOOPBACK_FAST_PATH``。" -#: ../../library/socket.rst:580 +#: ../../library/socket.rst:585 msgid "" "TIPC related constants, matching the ones exported by the C socket API. See " "the TIPC documentation for more information." msgstr "" -#: ../../library/socket.rst:587 +#: ../../library/socket.rst:592 msgid "Constants for Linux Kernel cryptography." msgstr "" -#: ../../library/socket.rst:599 +#: ../../library/socket.rst:604 msgid "Constants for Linux host/guest communication." msgstr "" -#: ../../library/socket.rst:601 +#: ../../library/socket.rst:606 msgid ":ref:`Availability `: Linux >= 4.8." msgstr ":ref:`適用 `:Linux >= 4.8。" -#: ../../library/socket.rst:607 +#: ../../library/socket.rst:612 msgid ":ref:`Availability `: BSD, macOS." msgstr ":ref:`適用 `:BSD、macOS。" -#: ../../library/socket.rst:613 +#: ../../library/socket.rst:618 msgid "" "This constant contains a boolean value which indicates if IPv6 is supported " "on this platform." msgstr "" -#: ../../library/socket.rst:619 +#: ../../library/socket.rst:624 msgid "" "These are string constants containing Bluetooth addresses with special " "meanings. For example, :const:`BDADDR_ANY` can be used to indicate any " "address when specifying the binding socket with :const:`BTPROTO_RFCOMM`." msgstr "" -#: ../../library/socket.rst:628 +#: ../../library/socket.rst:633 msgid "" "For use with :const:`BTPROTO_HCI`. :const:`HCI_FILTER` is not available for " "NetBSD or DragonFlyBSD. :const:`HCI_TIME_STAMP` and :const:`HCI_DATA_DIR` " "are not available for FreeBSD, NetBSD, or DragonFlyBSD." msgstr "" -#: ../../library/socket.rst:635 +#: ../../library/socket.rst:640 msgid "" "Constant for Qualcomm's IPC router protocol, used to communicate with " "service providing remote processors." msgstr "" -#: ../../library/socket.rst:644 +#: ../../library/socket.rst:649 msgid "" "LOCAL_CREDS and LOCAL_CREDS_PERSISTENT can be used with SOCK_DGRAM, " "SOCK_STREAM sockets, equivalent to Linux/DragonFlyBSD SO_PASSCRED, while " @@ -820,67 +834,55 @@ msgid "" "message type." msgstr "" -#: ../../library/socket.rst:653 +#: ../../library/socket.rst:658 msgid ":ref:`Availability `: FreeBSD." msgstr ":ref:`適用 `:FreeBSD。" -#: ../../library/socket.rst:657 +#: ../../library/socket.rst:662 msgid "" "Constant to optimize CPU locality, to be used in conjunction with :data:" "`SO_REUSEPORT`." msgstr "" -#: ../../library/socket.rst:677 +#: ../../library/socket.rst:682 msgid "Constants for Windows Hyper-V sockets for host/guest communications." msgstr "" -#: ../../library/socket.rst:679 ../../library/socket.rst:893 -#: ../../library/socket.rst:1986 +#: ../../library/socket.rst:684 ../../library/socket.rst:898 +#: ../../library/socket.rst:1991 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/socket.rst:690 +#: ../../library/socket.rst:695 msgid "" "`IEEE 802.3 protocol number `_. constants." msgstr "" -#: ../../library/socket.rst:694 +#: ../../library/socket.rst:699 msgid ":ref:`Availability `: Linux, FreeBSD, macOS." msgstr ":ref:`適用 `:Linux、FreeBSD、macOS。" -#: ../../library/socket.rst:702 +#: ../../library/socket.rst:707 msgid "" "These constants are used by the :meth:`~socket.socket.shutdown` method of " "socket objects." msgstr "" -#: ../../library/socket.rst:704 ../../library/socket.rst:989 -#: ../../library/socket.rst:1005 ../../library/socket.rst:1018 -#: ../../library/socket.rst:1033 ../../library/socket.rst:1050 -#: ../../library/socket.rst:1061 ../../library/socket.rst:1072 -#: ../../library/socket.rst:1083 ../../library/socket.rst:1407 -#: ../../library/socket.rst:1454 ../../library/socket.rst:1468 -#: ../../library/socket.rst:1488 ../../library/socket.rst:1535 -#: ../../library/socket.rst:1580 ../../library/socket.rst:1964 -#: ../../library/socket.rst:1974 -msgid ":ref:`Availability `: not WASI." -msgstr ":ref:`適用 `:非 WASI。" - -#: ../../library/socket.rst:707 +#: ../../library/socket.rst:712 msgid "Functions" msgstr "函式" -#: ../../library/socket.rst:710 +#: ../../library/socket.rst:715 msgid "Creating sockets" msgstr "建立 sockets" -#: ../../library/socket.rst:712 +#: ../../library/socket.rst:717 msgid "" "The following functions all create :ref:`socket objects `." msgstr "" -#: ../../library/socket.rst:717 +#: ../../library/socket.rst:722 msgid "" "Create a new socket using the given address family, socket type and protocol " "number. The address family should be :const:`AF_INET` (the default), :const:" @@ -893,7 +895,7 @@ msgid "" "`CAN_J1939`." msgstr "" -#: ../../library/socket.rst:727 +#: ../../library/socket.rst:732 msgid "" "If *fileno* is specified, the values for *family*, *type*, and *proto* are " "auto-detected from the specified file descriptor. Auto-detection can be " @@ -904,12 +906,12 @@ msgid "" "This may help close a detached socket using :meth:`socket.close`." msgstr "" -#: ../../library/socket.rst:736 ../../library/socket.rst:882 -#: ../../library/socket.rst:1389 ../../library/socket.rst:1483 +#: ../../library/socket.rst:741 ../../library/socket.rst:887 +#: ../../library/socket.rst:1394 ../../library/socket.rst:1488 msgid "The newly created socket is :ref:`non-inheritable `." msgstr "" -#: ../../library/socket.rst:738 +#: ../../library/socket.rst:743 msgid "" "Raises an :ref:`auditing event ` ``socket.__new__`` with arguments " "``self``, ``family``, ``type``, ``protocol``." @@ -917,30 +919,30 @@ msgstr "" "引發一個附帶引數 ``self``、``family``、``type``、``protocol`` 的\\ :ref:`稽核" "事件 ` ``socket.__new__``。" -#: ../../library/socket.rst:740 +#: ../../library/socket.rst:745 msgid "The AF_CAN family was added. The AF_RDS family was added." msgstr "" -#: ../../library/socket.rst:744 +#: ../../library/socket.rst:749 msgid "The CAN_BCM protocol was added." msgstr "新增 CAN_BCM 協定。" -#: ../../library/socket.rst:747 ../../library/socket.rst:884 +#: ../../library/socket.rst:752 ../../library/socket.rst:889 msgid "The returned socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:750 +#: ../../library/socket.rst:755 msgid "The CAN_ISOTP protocol was added." msgstr "新增 CAN_ISOTP 協定。" -#: ../../library/socket.rst:753 +#: ../../library/socket.rst:758 msgid "" "When :const:`SOCK_NONBLOCK` or :const:`SOCK_CLOEXEC` bit flags are applied " "to *type* they are cleared, and :attr:`socket.type` will not reflect them. " "They are still passed to the underlying system ``socket()`` call. Therefore," msgstr "" -#: ../../library/socket.rst:761 +#: ../../library/socket.rst:766 msgid "" "sock = socket.socket(\n" " socket.AF_INET,\n" @@ -950,21 +952,21 @@ msgstr "" " socket.AF_INET,\n" " socket.SOCK_STREAM | socket.SOCK_NONBLOCK)" -#: ../../library/socket.rst:765 +#: ../../library/socket.rst:770 msgid "" "will still create a non-blocking socket on OSes that support " "``SOCK_NONBLOCK``, but ``sock.type`` will be set to ``socket.SOCK_STREAM``." msgstr "" -#: ../../library/socket.rst:769 +#: ../../library/socket.rst:774 msgid "The CAN_J1939 protocol was added." msgstr "新增 CAN_J1939 協定。" -#: ../../library/socket.rst:772 +#: ../../library/socket.rst:777 msgid "The IPPROTO_MPTCP protocol was added." msgstr "新增 IPPROTO_MPTCP 協定。" -#: ../../library/socket.rst:777 +#: ../../library/socket.rst:782 msgid "" "Build a pair of connected socket objects using the given address family, " "socket type, and protocol number. Address family, socket type, and protocol " @@ -973,25 +975,25 @@ msgid "" "default is :const:`AF_INET`." msgstr "" -#: ../../library/socket.rst:782 +#: ../../library/socket.rst:787 msgid "The newly created sockets are :ref:`non-inheritable `." msgstr "" -#: ../../library/socket.rst:784 +#: ../../library/socket.rst:789 msgid "" "The returned socket objects now support the whole socket API, rather than a " "subset." msgstr "" -#: ../../library/socket.rst:788 +#: ../../library/socket.rst:793 msgid "The returned sockets are now non-inheritable." msgstr "" -#: ../../library/socket.rst:791 +#: ../../library/socket.rst:796 msgid "Windows support added." msgstr "新增對 Windows 的支援。" -#: ../../library/socket.rst:797 +#: ../../library/socket.rst:802 msgid "" "Connect to a TCP service listening on the internet *address* (a 2-tuple " "``(host, port)``), and return the socket object. This is a higher-level " @@ -1002,21 +1004,21 @@ msgid "" "IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:805 +#: ../../library/socket.rst:810 msgid "" "Passing the optional *timeout* parameter will set the timeout on the socket " "instance before attempting to connect. If no *timeout* is supplied, the " "global default timeout setting returned by :func:`getdefaulttimeout` is used." msgstr "" -#: ../../library/socket.rst:810 +#: ../../library/socket.rst:815 msgid "" "If supplied, *source_address* must be a 2-tuple ``(host, port)`` for the " "socket to bind to as its source address before connecting. If host or port " "are '' or 0 respectively the OS default behavior will be used." msgstr "" -#: ../../library/socket.rst:814 +#: ../../library/socket.rst:819 msgid "" "When a connection cannot be created, an exception is raised. By default, it " "is the exception from the last address in the list. If *all_errors* is " @@ -1024,21 +1026,21 @@ msgid "" "attempts." msgstr "" -#: ../../library/socket.rst:819 +#: ../../library/socket.rst:824 msgid "*source_address* was added." msgstr "新增 *source_address*。" -#: ../../library/socket.rst:822 +#: ../../library/socket.rst:827 msgid "*all_errors* was added." msgstr "新增 *all_errors*。" -#: ../../library/socket.rst:828 +#: ../../library/socket.rst:833 msgid "" "Convenience function which creates a TCP socket bound to *address* (a 2-" "tuple ``(host, port)``) and returns the socket object." msgstr "" -#: ../../library/socket.rst:831 +#: ../../library/socket.rst:836 msgid "" "*family* should be either :data:`AF_INET` or :data:`AF_INET6`. *backlog* is " "the queue size passed to :meth:`socket.listen`; if not specified , a default " @@ -1046,7 +1048,7 @@ msgid "" "`SO_REUSEPORT` socket option." msgstr "" -#: ../../library/socket.rst:836 +#: ../../library/socket.rst:841 msgid "" "If *dualstack_ipv6* is true and the platform supports it the socket will be " "able to accept both IPv4 and IPv6 connections, else it will raise :exc:" @@ -1059,7 +1061,7 @@ msgid "" "func:`has_dualstack_ipv6`:" msgstr "" -#: ../../library/socket.rst:849 +#: ../../library/socket.rst:854 msgid "" "import socket\n" "\n" @@ -1079,20 +1081,20 @@ msgstr "" "else:\n" " s = socket.create_server(addr)" -#: ../../library/socket.rst:858 +#: ../../library/socket.rst:863 msgid "" "On POSIX platforms the :data:`SO_REUSEADDR` socket option is set in order to " "immediately reuse previous sockets which were bound on the same *address* " "and remained in TIME_WAIT state." msgstr "" -#: ../../library/socket.rst:866 +#: ../../library/socket.rst:871 msgid "" "Return ``True`` if the platform supports creating a TCP socket which can " "handle both IPv4 and IPv6 connections." msgstr "" -#: ../../library/socket.rst:873 +#: ../../library/socket.rst:878 msgid "" "Duplicate the file descriptor *fd* (an integer as returned by a file " "object's :meth:`~io.IOBase.fileno` method) and build a socket object from " @@ -1105,34 +1107,34 @@ msgid "" "daemon). The socket is assumed to be in blocking mode." msgstr "" -#: ../../library/socket.rst:890 +#: ../../library/socket.rst:895 msgid "" "Instantiate a socket from data obtained from the :meth:`socket.share` " "method. The socket is assumed to be in blocking mode." msgstr "" -#: ../../library/socket.rst:900 +#: ../../library/socket.rst:905 msgid "" "This is a Python type object that represents the socket object type. It is " "the same as ``type(socket(...))``." msgstr "" -#: ../../library/socket.rst:905 +#: ../../library/socket.rst:910 msgid "Other functions" msgstr "其他函式" -#: ../../library/socket.rst:907 +#: ../../library/socket.rst:912 msgid "The :mod:`socket` module also offers various network-related services:" msgstr "" -#: ../../library/socket.rst:912 +#: ../../library/socket.rst:917 msgid "" "Close a socket file descriptor. This is like :func:`os.close`, but for " "sockets. On some platforms (most noticeable Windows) :func:`os.close` does " "not work for socket file descriptors." msgstr "" -#: ../../library/socket.rst:920 +#: ../../library/socket.rst:925 msgid "" "Translate the *host*/*port* argument into a sequence of 5-tuples that " "contain all the necessary arguments for creating a socket connected to that " @@ -1142,7 +1144,7 @@ msgid "" "and *port*, you can pass ``NULL`` to the underlying C API." msgstr "" -#: ../../library/socket.rst:927 +#: ../../library/socket.rst:932 msgid "" "The *family*, *type* and *proto* arguments can be optionally specified in " "order to narrow the list of addresses returned. Passing zero as a value for " @@ -1153,15 +1155,15 @@ msgid "" "domain name." msgstr "" -#: ../../library/socket.rst:935 +#: ../../library/socket.rst:940 msgid "The function returns a list of 5-tuples with the following structure:" msgstr "" -#: ../../library/socket.rst:937 +#: ../../library/socket.rst:942 msgid "``(family, type, proto, canonname, sockaddr)``" msgstr "``(family, type, proto, canonname, sockaddr)``" -#: ../../library/socket.rst:939 +#: ../../library/socket.rst:944 msgid "" "In these tuples, *family*, *type*, *proto* are all integers and are meant to " "be passed to the :func:`~socket.socket` function. *canonname* will be a " @@ -1173,7 +1175,7 @@ msgid "" "`AF_INET6`), and is meant to be passed to the :meth:`socket.connect` method." msgstr "" -#: ../../library/socket.rst:949 +#: ../../library/socket.rst:954 msgid "" "Raises an :ref:`auditing event ` ``socket.getaddrinfo`` with " "arguments ``host``, ``port``, ``family``, ``type``, ``protocol``." @@ -1181,14 +1183,14 @@ msgstr "" "引發一個附帶引數 ``host``、``port``、``family``、``type``、``protocol`` 的" "\\ :ref:`稽核事件 ` ``socket.getaddrinfo``。" -#: ../../library/socket.rst:951 +#: ../../library/socket.rst:956 msgid "" "The following example fetches address information for a hypothetical TCP " "connection to ``example.org`` on port 80 (results may differ on your system " "if IPv6 isn't enabled)::" msgstr "" -#: ../../library/socket.rst:955 +#: ../../library/socket.rst:960 msgid "" ">>> socket.getaddrinfo(\"example.org\", 80, proto=socket.IPPROTO_TCP)\n" "[(socket.AF_INET6, socket.SOCK_STREAM,\n" @@ -1202,17 +1204,17 @@ msgstr "" " (socket.AF_INET, socket.SOCK_STREAM,\n" " 6, '', ('93.184.216.34', 80))]" -#: ../../library/socket.rst:961 +#: ../../library/socket.rst:966 msgid "parameters can now be passed using keyword arguments." msgstr "" -#: ../../library/socket.rst:964 +#: ../../library/socket.rst:969 msgid "" "for IPv6 multicast addresses, string representing an address will not " "contain ``%scope_id`` part." msgstr "" -#: ../../library/socket.rst:970 +#: ../../library/socket.rst:975 msgid "" "Return a fully qualified domain name for *name*. If *name* is omitted or " "empty, it is interpreted as the local host. To find the fully qualified " @@ -1223,7 +1225,7 @@ msgid "" "``'0.0.0.0'``, the hostname from :func:`gethostname` is returned." msgstr "" -#: ../../library/socket.rst:981 +#: ../../library/socket.rst:986 msgid "" "Translate a host name to IPv4 address format. The IPv4 address is returned " "as a string, such as ``'100.50.200.5'``. If the host name is an IPv4 " @@ -1233,7 +1235,7 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:987 ../../library/socket.rst:1003 +#: ../../library/socket.rst:992 ../../library/socket.rst:1008 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyname`` with " "argument ``hostname``." @@ -1241,7 +1243,7 @@ msgstr "" "引發一個附帶引數 ``hostname`` 的\\ :ref:`稽核事件 ` ``socket." "gethostbyname``。" -#: ../../library/socket.rst:994 +#: ../../library/socket.rst:999 msgid "" "Translate a host name to IPv4 address format, extended interface. Return a 3-" "tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is the host's " @@ -1253,26 +1255,26 @@ msgid "" "stack support." msgstr "" -#: ../../library/socket.rst:1010 +#: ../../library/socket.rst:1015 msgid "" "Return a string containing the hostname of the machine where the Python " "interpreter is currently executing." msgstr "" -#: ../../library/socket.rst:1013 +#: ../../library/socket.rst:1018 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostname`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``socket.gethostname``。" -#: ../../library/socket.rst:1015 +#: ../../library/socket.rst:1020 msgid "" "Note: :func:`gethostname` doesn't always return the fully qualified domain " "name; use :func:`getfqdn` for that." msgstr "" -#: ../../library/socket.rst:1023 +#: ../../library/socket.rst:1028 msgid "" "Return a 3-tuple ``(hostname, aliaslist, ipaddrlist)`` where *hostname* is " "the primary host name responding to the given *ip_address*, *aliaslist* is a " @@ -1283,7 +1285,7 @@ msgid "" "`gethostbyaddr` supports both IPv4 and IPv6." msgstr "" -#: ../../library/socket.rst:1031 +#: ../../library/socket.rst:1036 msgid "" "Raises an :ref:`auditing event ` ``socket.gethostbyaddr`` with " "argument ``ip_address``." @@ -1291,7 +1293,7 @@ msgstr "" "引發一個附帶引數 ``ip_address`` 的\\ :ref:`稽核事件 ` ``socket." "gethostbyaddr``。" -#: ../../library/socket.rst:1038 +#: ../../library/socket.rst:1043 msgid "" "Translate a socket address *sockaddr* into a 2-tuple ``(host, port)``. " "Depending on the settings of *flags*, the result can contain a fully " @@ -1299,18 +1301,18 @@ msgid "" "Similarly, *port* can contain a string port name or a numeric port number." msgstr "" -#: ../../library/socket.rst:1043 +#: ../../library/socket.rst:1048 msgid "" "For IPv6 addresses, ``%scope_id`` is appended to the host part if *sockaddr* " "contains meaningful *scope_id*. Usually this happens for multicast addresses." msgstr "" -#: ../../library/socket.rst:1046 +#: ../../library/socket.rst:1051 msgid "" "For more information about *flags* you can consult :manpage:`getnameinfo(3)`." msgstr "" -#: ../../library/socket.rst:1048 +#: ../../library/socket.rst:1053 msgid "" "Raises an :ref:`auditing event ` ``socket.getnameinfo`` with " "argument ``sockaddr``." @@ -1318,7 +1320,7 @@ msgstr "" "引發一個附帶引數 ``sockaddr`` 的\\ :ref:`稽核事件 ` ``socket." "getnameinfo``。" -#: ../../library/socket.rst:1055 +#: ../../library/socket.rst:1060 msgid "" "Translate an internet protocol name (for example, ``'icmp'``) to a constant " "suitable for passing as the (optional) third argument to the :func:`~socket." @@ -1327,14 +1329,14 @@ msgid "" "is chosen automatically if the protocol is omitted or zero." msgstr "" -#: ../../library/socket.rst:1066 +#: ../../library/socket.rst:1071 msgid "" "Translate an internet service name and protocol name to a port number for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:1070 +#: ../../library/socket.rst:1075 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyname`` with " "arguments ``servicename``, ``protocolname``." @@ -1342,14 +1344,14 @@ msgstr "" "引發一個附帶引數 ``sockaddr``、``protocolname`` 的\\ :ref:`稽核事件 " "` ``socket.getservbyname``。" -#: ../../library/socket.rst:1077 +#: ../../library/socket.rst:1082 msgid "" "Translate an internet port number and protocol name to a service name for " "that service. The optional protocol name, if given, should be ``'tcp'`` or " "``'udp'``, otherwise any protocol will match." msgstr "" -#: ../../library/socket.rst:1081 +#: ../../library/socket.rst:1086 msgid "" "Raises an :ref:`auditing event ` ``socket.getservbyport`` with " "arguments ``port``, ``protocolname``." @@ -1357,40 +1359,40 @@ msgstr "" "引發一個附帶引數 ``port``、``protocolname`` 的\\ :ref:`稽核事件 ` " "``socket.getservbyport``。" -#: ../../library/socket.rst:1088 +#: ../../library/socket.rst:1093 msgid "" "Convert 32-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:1095 +#: ../../library/socket.rst:1100 msgid "" "Convert 16-bit positive integers from network to host byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:1099 ../../library/socket.rst:1117 +#: ../../library/socket.rst:1104 ../../library/socket.rst:1122 msgid "" "Raises :exc:`OverflowError` if *x* does not fit in a 16-bit unsigned integer." msgstr "" -#: ../../library/socket.rst:1106 +#: ../../library/socket.rst:1111 msgid "" "Convert 32-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 4-byte swap operation." msgstr "" -#: ../../library/socket.rst:1113 +#: ../../library/socket.rst:1118 msgid "" "Convert 16-bit positive integers from host to network byte order. On " "machines where the host byte order is the same as network byte order, this " "is a no-op; otherwise, it performs a 2-byte swap operation." msgstr "" -#: ../../library/socket.rst:1124 +#: ../../library/socket.rst:1129 msgid "" "Convert an IPv4 address from dotted-quad string format (for example, " "'123.45.67.89') to 32-bit packed binary format, as a bytes object four " @@ -1399,26 +1401,26 @@ msgid "" "which is the C type for the 32-bit packed binary this function returns." msgstr "" -#: ../../library/socket.rst:1130 +#: ../../library/socket.rst:1135 msgid "" ":func:`inet_aton` also accepts strings with less than three dots; see the " "Unix manual page :manpage:`inet(3)` for details." msgstr "" -#: ../../library/socket.rst:1133 +#: ../../library/socket.rst:1138 msgid "" "If the IPv4 address string passed to this function is invalid, :exc:" "`OSError` will be raised. Note that exactly what is valid depends on the " "underlying C implementation of :c:func:`inet_aton`." msgstr "" -#: ../../library/socket.rst:1137 +#: ../../library/socket.rst:1142 msgid "" ":func:`inet_aton` does not support IPv6, and :func:`inet_pton` should be " "used instead for IPv4/v6 dual stack support." msgstr "" -#: ../../library/socket.rst:1143 +#: ../../library/socket.rst:1148 msgid "" "Convert a 32-bit packed IPv4 address (a :term:`bytes-like object` four bytes " "in length) to its standard dotted-quad string representation (for example, " @@ -1428,7 +1430,7 @@ msgid "" "argument." msgstr "" -#: ../../library/socket.rst:1150 +#: ../../library/socket.rst:1155 msgid "" "If the byte sequence passed to this function is not exactly 4 bytes in " "length, :exc:`OSError` will be raised. :func:`inet_ntoa` does not support " @@ -1436,7 +1438,7 @@ msgid "" "support." msgstr "" -#: ../../library/socket.rst:1161 +#: ../../library/socket.rst:1166 msgid "" "Convert an IP address from its family-specific string format to a packed, " "binary format. :func:`inet_pton` is useful when a library or network " @@ -1444,7 +1446,7 @@ msgid "" "`inet_aton`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1166 +#: ../../library/socket.rst:1171 msgid "" "Supported values for *address_family* are currently :const:`AF_INET` and :" "const:`AF_INET6`. If the IP address string *ip_string* is invalid, :exc:" @@ -1453,15 +1455,15 @@ msgid "" "`inet_pton`." msgstr "" -#: ../../library/socket.rst:1172 ../../library/socket.rst:1192 +#: ../../library/socket.rst:1177 ../../library/socket.rst:1197 msgid ":ref:`Availability `: Unix, Windows." msgstr ":ref:`適用 `:Unix、Windows。" -#: ../../library/socket.rst:1174 ../../library/socket.rst:1194 +#: ../../library/socket.rst:1179 ../../library/socket.rst:1199 msgid "Windows support added" msgstr "" -#: ../../library/socket.rst:1180 +#: ../../library/socket.rst:1185 msgid "" "Convert a packed IP address (a :term:`bytes-like object` of some number of " "bytes) to its standard, family-specific string representation (for example, " @@ -1470,7 +1472,7 @@ msgid "" "(similar to :func:`inet_ntoa`) or :c:struct:`in6_addr`." msgstr "" -#: ../../library/socket.rst:1187 +#: ../../library/socket.rst:1192 msgid "" "Supported values for *address_family* are currently :const:`AF_INET` and :" "const:`AF_INET6`. If the bytes object *packed_ip* is not the correct length " @@ -1478,7 +1480,7 @@ msgid "" "`OSError` is raised for errors from the call to :func:`inet_ntop`." msgstr "" -#: ../../library/socket.rst:1209 +#: ../../library/socket.rst:1214 msgid "" "Return the total length, without trailing padding, of an ancillary data item " "with associated data of the given *length*. This value can often be used as " @@ -1489,16 +1491,17 @@ msgid "" "the permissible range of values." msgstr "" -#: ../../library/socket.rst:1218 ../../library/socket.rst:1241 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." -msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" +#: ../../library/socket.rst:1223 ../../library/socket.rst:1246 +#: ../../library/socket.rst:1867 +msgid ":ref:`Availability `: Unix, not WASI." +msgstr ":ref:`適用 `:Unix、非 WASI。" -#: ../../library/socket.rst:1220 ../../library/socket.rst:1712 -#: ../../library/socket.rst:1756 ../../library/socket.rst:1864 +#: ../../library/socket.rst:1225 ../../library/socket.rst:1717 +#: ../../library/socket.rst:1761 ../../library/socket.rst:1869 msgid "Most Unix platforms." msgstr "" -#: ../../library/socket.rst:1227 +#: ../../library/socket.rst:1232 msgid "" "Return the buffer size needed for :meth:`~socket.recvmsg` to receive an " "ancillary data item with associated data of the given *length*, along with " @@ -1508,7 +1511,7 @@ msgid "" "values." msgstr "" -#: ../../library/socket.rst:1235 +#: ../../library/socket.rst:1240 msgid "" "Note that some systems might support ancillary data without providing this " "function. Also note that setting the buffer size using the results of this " @@ -1516,31 +1519,31 @@ msgid "" "received, since additional data may be able to fit into the padding area." msgstr "" -#: ../../library/socket.rst:1243 +#: ../../library/socket.rst:1248 msgid "most Unix platforms." msgstr "" -#: ../../library/socket.rst:1250 +#: ../../library/socket.rst:1255 msgid "" "Return the default timeout in seconds (float) for new socket objects. A " "value of ``None`` indicates that new socket objects have no timeout. When " "the socket module is first imported, the default is ``None``." msgstr "" -#: ../../library/socket.rst:1257 +#: ../../library/socket.rst:1262 msgid "" "Set the default timeout in seconds (float) for new socket objects. When the " "socket module is first imported, the default is ``None``. See :meth:" "`~socket.settimeout` for possible values and their respective meanings." msgstr "" -#: ../../library/socket.rst:1265 +#: ../../library/socket.rst:1270 msgid "" "Set the machine's hostname to *name*. This will raise an :exc:`OSError` if " "you don't have enough rights." msgstr "" -#: ../../library/socket.rst:1268 +#: ../../library/socket.rst:1273 msgid "" "Raises an :ref:`auditing event ` ``socket.sethostname`` with " "argument ``name``." @@ -1548,114 +1551,114 @@ msgstr "" "引發一個附帶引數 ``name`` 的\\ :ref:`稽核事件 ` ``socket." "sethostname``。" -#: ../../library/socket.rst:1270 ../../library/socket.rst:1710 -#: ../../library/socket.rst:1754 -msgid ":ref:`Availability `: Unix." -msgstr ":ref:`適用 `:Unix。" +#: ../../library/socket.rst:1275 +#, fuzzy +msgid ":ref:`Availability `: Unix, not Android." +msgstr ":ref:`適用 `:Unix、非 WASI。" -#: ../../library/socket.rst:1277 +#: ../../library/socket.rst:1282 msgid "" "Return a list of network interface information (index int, name string) " "tuples. :exc:`OSError` if the system call fails." msgstr "" -#: ../../library/socket.rst:1281 ../../library/socket.rst:1308 -#: ../../library/socket.rst:1325 ../../library/socket.rst:1342 -#: ../../library/socket.rst:1356 -msgid "" -":ref:`Availability `: Unix, Windows, not Emscripten, not WASI." -msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten、非 WASI。" +#: ../../library/socket.rst:1286 ../../library/socket.rst:1313 +#: ../../library/socket.rst:1330 ../../library/socket.rst:1347 +#: ../../library/socket.rst:1361 +#, fuzzy +msgid ":ref:`Availability `: Unix, Windows, not WASI." +msgstr ":ref:`適用 `:Unix、非 WASI。" -#: ../../library/socket.rst:1285 ../../library/socket.rst:1312 -#: ../../library/socket.rst:1329 +#: ../../library/socket.rst:1290 ../../library/socket.rst:1317 +#: ../../library/socket.rst:1334 msgid "Windows support was added." msgstr "增加對 Windows 的支援。" -#: ../../library/socket.rst:1290 +#: ../../library/socket.rst:1295 msgid "" "On Windows network interfaces have different names in different contexts " "(all names are examples):" msgstr "" -#: ../../library/socket.rst:1293 +#: ../../library/socket.rst:1298 msgid "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" msgstr "UUID: ``{FB605B73-AAC2-49A6-9A2F-25416AEA0573}``" -#: ../../library/socket.rst:1294 +#: ../../library/socket.rst:1299 msgid "name: ``ethernet_32770``" msgstr "" -#: ../../library/socket.rst:1295 +#: ../../library/socket.rst:1300 msgid "friendly name: ``vEthernet (nat)``" msgstr "" -#: ../../library/socket.rst:1296 +#: ../../library/socket.rst:1301 msgid "description: ``Hyper-V Virtual Ethernet Adapter``" msgstr "" -#: ../../library/socket.rst:1298 +#: ../../library/socket.rst:1303 msgid "" "This function returns names of the second form from the list, " "``ethernet_32770`` in this example case." msgstr "" -#: ../../library/socket.rst:1304 +#: ../../library/socket.rst:1309 msgid "" "Return a network interface index number corresponding to an interface name. :" "exc:`OSError` if no interface with the given name exists." msgstr "" -#: ../../library/socket.rst:1316 ../../library/socket.rst:1333 +#: ../../library/socket.rst:1321 ../../library/socket.rst:1338 msgid "\"Interface name\" is a name as documented in :func:`if_nameindex`." msgstr "" -#: ../../library/socket.rst:1321 +#: ../../library/socket.rst:1326 msgid "" "Return a network interface name corresponding to an interface index number. :" "exc:`OSError` if no interface with the given index exists." msgstr "" -#: ../../library/socket.rst:1338 +#: ../../library/socket.rst:1343 msgid "" "Send the list of file descriptors *fds* over an :const:`AF_UNIX` socket " "*sock*. The *fds* parameter is a sequence of file descriptors. Consult :meth:" "`~socket.sendmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1344 ../../library/socket.rst:1358 +#: ../../library/socket.rst:1349 ../../library/socket.rst:1363 msgid "" "Unix platforms supporting :meth:`~socket.sendmsg` and :const:`SCM_RIGHTS` " "mechanism." msgstr "" -#: ../../library/socket.rst:1352 +#: ../../library/socket.rst:1357 msgid "" "Receive up to *maxfds* file descriptors from an :const:`AF_UNIX` socket " "*sock*. Return ``(msg, list(fds), flags, addr)``. Consult :meth:`~socket." "recvmsg` for the documentation of these parameters." msgstr "" -#: ../../library/socket.rst:1365 +#: ../../library/socket.rst:1370 msgid "Any truncated integers at the end of the list of file descriptors." msgstr "" -#: ../../library/socket.rst:1371 +#: ../../library/socket.rst:1376 msgid "Socket Objects" msgstr "Socket 物件" -#: ../../library/socket.rst:1373 +#: ../../library/socket.rst:1378 msgid "" "Socket objects have the following methods. Except for :meth:`~socket." "makefile`, these correspond to Unix system calls applicable to sockets." msgstr "" -#: ../../library/socket.rst:1377 +#: ../../library/socket.rst:1382 msgid "" "Support for the :term:`context manager` protocol was added. Exiting the " "context manager is equivalent to calling :meth:`~socket.close`." msgstr "" -#: ../../library/socket.rst:1384 +#: ../../library/socket.rst:1389 msgid "" "Accept a connection. The socket must be bound to an address and listening " "for connections. The return value is a pair ``(conn, address)`` where *conn* " @@ -1664,27 +1667,27 @@ msgid "" "connection." msgstr "" -#: ../../library/socket.rst:1391 ../../library/socket.rst:1485 +#: ../../library/socket.rst:1396 ../../library/socket.rst:1490 msgid "The socket is now non-inheritable." msgstr "" -#: ../../library/socket.rst:1394 ../../library/socket.rst:1625 -#: ../../library/socket.rst:1639 ../../library/socket.rst:1716 -#: ../../library/socket.rst:1789 ../../library/socket.rst:1808 -#: ../../library/socket.rst:1825 ../../library/socket.rst:1870 +#: ../../library/socket.rst:1399 ../../library/socket.rst:1630 +#: ../../library/socket.rst:1644 ../../library/socket.rst:1721 +#: ../../library/socket.rst:1794 ../../library/socket.rst:1813 +#: ../../library/socket.rst:1830 ../../library/socket.rst:1875 msgid "" "If the system call is interrupted and the signal handler does not raise an " "exception, the method now retries the system call instead of raising an :exc:" "`InterruptedError` exception (see :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1402 +#: ../../library/socket.rst:1407 msgid "" "Bind the socket to *address*. The socket must not already be bound. (The " "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1405 +#: ../../library/socket.rst:1410 msgid "" "Raises an :ref:`auditing event ` ``socket.bind`` with arguments " "``self``, ``address``." @@ -1692,7 +1695,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.bind``。" -#: ../../library/socket.rst:1412 +#: ../../library/socket.rst:1417 msgid "" "Mark the socket closed. The underlying system resource (e.g. a file " "descriptor) is also closed when all file objects from :meth:`makefile` are " @@ -1701,33 +1704,33 @@ msgid "" "flushed)." msgstr "" -#: ../../library/socket.rst:1418 +#: ../../library/socket.rst:1423 msgid "" "Sockets are automatically closed when they are garbage-collected, but it is " "recommended to :meth:`close` them explicitly, or to use a :keyword:`with` " "statement around them." msgstr "" -#: ../../library/socket.rst:1422 +#: ../../library/socket.rst:1427 msgid "" ":exc:`OSError` is now raised if an error occurs when the underlying :c:func:" "`close` call is made." msgstr "" -#: ../../library/socket.rst:1428 +#: ../../library/socket.rst:1433 msgid "" ":meth:`close` releases the resource associated with a connection but does " "not necessarily close the connection immediately. If you want to close the " "connection in a timely fashion, call :meth:`shutdown` before :meth:`close`." msgstr "" -#: ../../library/socket.rst:1436 +#: ../../library/socket.rst:1441 msgid "" "Connect to a remote socket at *address*. (The format of *address* depends on " "the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1439 +#: ../../library/socket.rst:1444 msgid "" "If the connection is interrupted by a signal, the method waits until the " "connection completes, or raise a :exc:`TimeoutError` on timeout, if the " @@ -1737,7 +1740,7 @@ msgid "" "(or the exception raised by the signal handler)." msgstr "" -#: ../../library/socket.rst:1446 ../../library/socket.rst:1466 +#: ../../library/socket.rst:1451 ../../library/socket.rst:1471 msgid "" "Raises an :ref:`auditing event ` ``socket.connect`` with arguments " "``self``, ``address``." @@ -1745,7 +1748,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.connect``。" -#: ../../library/socket.rst:1448 +#: ../../library/socket.rst:1453 msgid "" "The method now waits until the connection completes instead of raising an :" "exc:`InterruptedError` exception if the connection is interrupted by a " @@ -1753,7 +1756,7 @@ msgid "" "blocking or has a timeout (see the :pep:`475` for the rationale)." msgstr "" -#: ../../library/socket.rst:1459 +#: ../../library/socket.rst:1464 msgid "" "Like ``connect(address)``, but return an error indicator instead of raising " "an exception for errors returned by the C-level :c:func:`connect` call " @@ -1763,38 +1766,38 @@ msgid "" "asynchronous connects." msgstr "" -#: ../../library/socket.rst:1472 +#: ../../library/socket.rst:1477 msgid "" "Put the socket object into closed state without actually closing the " "underlying file descriptor. The file descriptor is returned, and can be " "reused for other purposes." msgstr "" -#: ../../library/socket.rst:1481 +#: ../../library/socket.rst:1486 msgid "Duplicate the socket." msgstr "" -#: ../../library/socket.rst:1493 +#: ../../library/socket.rst:1498 msgid "" "Return the socket's file descriptor (a small integer), or -1 on failure. " "This is useful with :func:`select.select`." msgstr "" -#: ../../library/socket.rst:1496 +#: ../../library/socket.rst:1501 msgid "" "Under Windows the small integer returned by this method cannot be used where " "a file descriptor can be used (such as :func:`os.fdopen`). Unix does not " "have this limitation." msgstr "" -#: ../../library/socket.rst:1502 +#: ../../library/socket.rst:1507 msgid "" "Get the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle: ``True`` if the socket can be inherited in " "child processes, ``False`` if it cannot." msgstr "" -#: ../../library/socket.rst:1511 +#: ../../library/socket.rst:1516 msgid "" "Return the remote address to which the socket is connected. This is useful " "to find out the port number of a remote IPv4/v6 socket, for instance. (The " @@ -1802,14 +1805,14 @@ msgid "" "above.) On some systems this function is not supported." msgstr "" -#: ../../library/socket.rst:1519 +#: ../../library/socket.rst:1524 msgid "" "Return the socket's own address. This is useful to find out the port number " "of an IPv4/v6 socket, for instance. (The format of the address returned " "depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1526 +#: ../../library/socket.rst:1531 msgid "" "Return the value of the given socket option (see the Unix man page :manpage:" "`getsockopt(2)`). The needed symbolic constants (:ref:`SO_\\* etc. `_ for more information." msgstr "" -#: ../../library/socket.rst:1564 +#: ../../library/socket.rst:1569 msgid "" "On other platforms, the generic :func:`fcntl.fcntl` and :func:`fcntl.ioctl` " "functions may be used; they accept a socket object as their first argument." msgstr "" -#: ../../library/socket.rst:1567 +#: ../../library/socket.rst:1572 msgid "" "Currently only the following control codes are supported: ``SIO_RCVALL``, " "``SIO_KEEPALIVE_VALS``, and ``SIO_LOOPBACK_FAST_PATH``." msgstr "" -#: ../../library/socket.rst:1575 +#: ../../library/socket.rst:1580 msgid "" "Enable a server to accept connections. If *backlog* is specified, it must " "be at least 0 (if it is lower, it is set to 0); it specifies the number of " @@ -1873,11 +1876,11 @@ msgid "" "connections. If not specified, a default reasonable value is chosen." msgstr "" -#: ../../library/socket.rst:1582 +#: ../../library/socket.rst:1587 msgid "The *backlog* parameter is now optional." msgstr "" -#: ../../library/socket.rst:1591 +#: ../../library/socket.rst:1596 msgid "" "Return a :term:`file object` associated with the socket. The exact returned " "type depends on the arguments given to :meth:`makefile`. These arguments " @@ -1886,28 +1889,28 @@ msgid "" "``'b'``, or a combination of those." msgstr "" -#: ../../library/socket.rst:1597 +#: ../../library/socket.rst:1602 msgid "" "The socket must be in blocking mode; it can have a timeout, but the file " "object's internal buffer may end up in an inconsistent state if a timeout " "occurs." msgstr "" -#: ../../library/socket.rst:1601 +#: ../../library/socket.rst:1606 msgid "" "Closing the file object returned by :meth:`makefile` won't close the " "original socket unless all other file objects have been closed and :meth:" "`socket.close` has been called on the socket object." msgstr "" -#: ../../library/socket.rst:1607 +#: ../../library/socket.rst:1612 msgid "" "On Windows, the file-like object created by :meth:`makefile` cannot be used " "where a file object with a file descriptor is expected, such as the stream " "arguments of :meth:`subprocess.Popen`." msgstr "" -#: ../../library/socket.rst:1614 +#: ../../library/socket.rst:1619 msgid "" "Receive data from the socket. The return value is a bytes object " "representing the data received. The maximum amount of data to be received " @@ -1917,13 +1920,13 @@ msgid "" "zero." msgstr "" -#: ../../library/socket.rst:1622 +#: ../../library/socket.rst:1627 msgid "" "For best match with hardware and network realities, the value of *bufsize* " "should be a relatively small power of 2, for example, 4096." msgstr "" -#: ../../library/socket.rst:1633 +#: ../../library/socket.rst:1638 msgid "" "Receive data from the socket. The return value is a pair ``(bytes, " "address)`` where *bytes* is a bytes object representing the data received " @@ -1933,14 +1936,14 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1644 +#: ../../library/socket.rst:1649 msgid "" "For multicast IPv6 address, first item of *address* does not contain " "``%scope_id`` part anymore. In order to get full IPv6 address use :func:" "`getnameinfo`." msgstr "" -#: ../../library/socket.rst:1651 +#: ../../library/socket.rst:1656 msgid "" "Receive normal data (up to *bufsize* bytes) and ancillary data from the " "socket. The *ancbufsize* argument sets the size in bytes of the internal " @@ -1951,7 +1954,7 @@ msgid "" "*flags* argument defaults to 0 and has the same meaning as for :meth:`recv`." msgstr "" -#: ../../library/socket.rst:1661 +#: ../../library/socket.rst:1666 msgid "" "The return value is a 4-tuple: ``(data, ancdata, msg_flags, address)``. The " "*data* item is a :class:`bytes` object holding the non-ancillary data " @@ -1966,7 +1969,7 @@ msgid "" "socket, if available; otherwise, its value is unspecified." msgstr "" -#: ../../library/socket.rst:1675 +#: ../../library/socket.rst:1680 msgid "" "On some systems, :meth:`sendmsg` and :meth:`recvmsg` can be used to pass " "file descriptors between processes over an :const:`AF_UNIX` socket. When " @@ -1979,7 +1982,7 @@ msgid "" "descriptors received via this mechanism." msgstr "" -#: ../../library/socket.rst:1686 +#: ../../library/socket.rst:1691 msgid "" "Some systems do not indicate the truncated length of ancillary data items " "which have been only partially received. If an item appears to extend " @@ -1988,7 +1991,7 @@ msgid "" "provided it has not been truncated before the start of its associated data." msgstr "" -#: ../../library/socket.rst:1693 +#: ../../library/socket.rst:1698 msgid "" "On systems which support the :const:`SCM_RIGHTS` mechanism, the following " "function will receive up to *maxfds* file descriptors, returning the message " @@ -1997,7 +2000,7 @@ msgid "" "meth:`sendmsg`. ::" msgstr "" -#: ../../library/socket.rst:1699 +#: ../../library/socket.rst:1704 msgid "" "import socket, array\n" "\n" @@ -2014,7 +2017,11 @@ msgid "" " return msg, list(fds)" msgstr "" -#: ../../library/socket.rst:1724 +#: ../../library/socket.rst:1715 ../../library/socket.rst:1759 +msgid ":ref:`Availability `: Unix." +msgstr ":ref:`適用 `:Unix。" + +#: ../../library/socket.rst:1729 msgid "" "Receive normal data and ancillary data from the socket, behaving as :meth:" "`recvmsg` would, but scatter the non-ancillary data into a series of buffers " @@ -2027,7 +2034,7 @@ msgid "" "arguments have the same meaning as for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1735 +#: ../../library/socket.rst:1740 msgid "" "The return value is a 4-tuple: ``(nbytes, ancdata, msg_flags, address)``, " "where *nbytes* is the total number of bytes of non-ancillary data written " @@ -2035,11 +2042,11 @@ msgid "" "for :meth:`recvmsg`." msgstr "" -#: ../../library/socket.rst:1740 +#: ../../library/socket.rst:1745 msgid "Example::" msgstr "範例: ::" -#: ../../library/socket.rst:1742 +#: ../../library/socket.rst:1747 msgid "" ">>> import socket\n" ">>> s1, s2 = socket.socketpair()\n" @@ -2065,7 +2072,7 @@ msgstr "" ">>> [b1, b2, b3]\n" "[bytearray(b'Mary'), bytearray(b'01 had a 9'), bytearray(b'little lamb---')]" -#: ../../library/socket.rst:1763 +#: ../../library/socket.rst:1768 msgid "" "Receive data from the socket, writing it into *buffer* instead of creating a " "new bytestring. The return value is a pair ``(nbytes, address)`` where " @@ -2075,7 +2082,7 @@ msgid "" "format of *address* depends on the address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1773 +#: ../../library/socket.rst:1778 msgid "" "Receive up to *nbytes* bytes from the socket, storing the data into a buffer " "rather than creating a new bytestring. If *nbytes* is not specified (or 0), " @@ -2084,7 +2091,7 @@ msgid "" "of the optional argument *flags*; it defaults to zero." msgstr "" -#: ../../library/socket.rst:1782 +#: ../../library/socket.rst:1787 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2094,7 +2101,7 @@ msgid "" "data. For further information on this topic, consult the :ref:`socket-howto`." msgstr "" -#: ../../library/socket.rst:1797 +#: ../../library/socket.rst:1802 msgid "" "Send data to the socket. The socket must be connected to a remote socket. " "The optional *flags* argument has the same meaning as for :meth:`recv` " @@ -2104,13 +2111,13 @@ msgid "" "to determine how much data, if any, was successfully sent." msgstr "" -#: ../../library/socket.rst:1804 +#: ../../library/socket.rst:1809 msgid "" "The socket timeout is no longer reset each time data is sent successfully. " "The socket timeout is now the maximum total duration to send all data." msgstr "" -#: ../../library/socket.rst:1817 +#: ../../library/socket.rst:1822 msgid "" "Send data to the socket. The socket should not be connected to a remote " "socket, since the destination socket is specified by *address*. The " @@ -2119,7 +2126,7 @@ msgid "" "address family --- see above.)" msgstr "" -#: ../../library/socket.rst:1823 +#: ../../library/socket.rst:1828 msgid "" "Raises an :ref:`auditing event ` ``socket.sendto`` with arguments " "``self``, ``address``." @@ -2127,7 +2134,7 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.sendto``。" -#: ../../library/socket.rst:1833 +#: ../../library/socket.rst:1838 msgid "" "Send normal and ancillary data to the socket, gathering the non-ancillary " "data from a series of buffers and concatenating it into a single message. " @@ -2147,14 +2154,14 @@ msgid "" "bytes of non-ancillary data sent." msgstr "" -#: ../../library/socket.rst:1853 +#: ../../library/socket.rst:1858 msgid "" "The following function sends the list of file descriptors *fds* over an :" "const:`AF_UNIX` socket, on systems which support the :const:`SCM_RIGHTS` " "mechanism. See also :meth:`recvmsg`. ::" msgstr "" -#: ../../library/socket.rst:1857 +#: ../../library/socket.rst:1862 msgid "" "import socket, array\n" "\n" @@ -2168,11 +2175,7 @@ msgstr "" " return sock.sendmsg([msg], [(socket.SOL_SOCKET, socket.SCM_RIGHTS, array." "array(\"i\", fds))])" -#: ../../library/socket.rst:1862 -msgid ":ref:`Availability `: Unix, not WASI." -msgstr ":ref:`適用 `:Unix、非 WASI。" - -#: ../../library/socket.rst:1866 +#: ../../library/socket.rst:1871 msgid "" "Raises an :ref:`auditing event ` ``socket.sendmsg`` with arguments " "``self``, ``address``." @@ -2180,14 +2183,14 @@ msgstr "" "引發一個附帶引數 ``self``、``address`` 的\\ :ref:`稽核事件 ` " "``socket.sendmsg``。" -#: ../../library/socket.rst:1877 +#: ../../library/socket.rst:1882 msgid "" "Specialized version of :meth:`~socket.sendmsg` for :const:`AF_ALG` socket. " "Set mode, IV, AEAD associated data length and flags for :const:`AF_ALG` " "socket." msgstr "" -#: ../../library/socket.rst:1886 +#: ../../library/socket.rst:1891 msgid "" "Send a file until EOF is reached by using high-performance :mod:`os." "sendfile` and return the total number of bytes which were sent. *file* must " @@ -2201,38 +2204,38 @@ msgid "" "be of :const:`SOCK_STREAM` type. Non-blocking sockets are not supported." msgstr "" -#: ../../library/socket.rst:1902 +#: ../../library/socket.rst:1907 msgid "" "Set the :ref:`inheritable flag ` of the socket's file " "descriptor or socket's handle." msgstr "" -#: ../../library/socket.rst:1910 +#: ../../library/socket.rst:1915 msgid "" "Set blocking or non-blocking mode of the socket: if *flag* is false, the " "socket is set to non-blocking, else to blocking mode." msgstr "" -#: ../../library/socket.rst:1913 +#: ../../library/socket.rst:1918 msgid "" "This method is a shorthand for certain :meth:`~socket.settimeout` calls:" msgstr "" -#: ../../library/socket.rst:1915 +#: ../../library/socket.rst:1920 msgid "``sock.setblocking(True)`` is equivalent to ``sock.settimeout(None)``" msgstr "``sock.setblocking(True)`` 等價於 ``sock.settimeout(None)``" -#: ../../library/socket.rst:1917 +#: ../../library/socket.rst:1922 msgid "``sock.setblocking(False)`` is equivalent to ``sock.settimeout(0.0)``" msgstr "``sock.setblocking(False)`` 等價於 ``sock.settimeout(0.0)``" -#: ../../library/socket.rst:1919 +#: ../../library/socket.rst:1924 msgid "" "The method no longer applies :const:`SOCK_NONBLOCK` flag on :attr:`socket." "type`." msgstr "" -#: ../../library/socket.rst:1926 +#: ../../library/socket.rst:1931 msgid "" "Set a timeout on blocking socket operations. The *value* argument can be a " "nonnegative floating-point number expressing seconds, or ``None``. If a non-" @@ -2242,19 +2245,19 @@ msgid "" "blocking mode. If ``None`` is given, the socket is put in blocking mode." msgstr "" -#: ../../library/socket.rst:1933 +#: ../../library/socket.rst:1938 msgid "" "For further information, please consult the :ref:`notes on socket timeouts " "`." msgstr "" -#: ../../library/socket.rst:1935 +#: ../../library/socket.rst:1940 msgid "" "The method no longer toggles :const:`SOCK_NONBLOCK` flag on :attr:`socket." "type`." msgstr "" -#: ../../library/socket.rst:1948 +#: ../../library/socket.rst:1953 msgid "" "Set the value of the given socket option (see the Unix manual page :manpage:" "`setsockopt(2)`). The needed symbolic constants are defined in this module " @@ -2267,11 +2270,11 @@ msgid "" "C function with ``optval=NULL`` and ``optlen=optlen``." msgstr "" -#: ../../library/socket.rst:1961 +#: ../../library/socket.rst:1966 msgid "setsockopt(level, optname, None, optlen: int) form added." msgstr "" -#: ../../library/socket.rst:1969 +#: ../../library/socket.rst:1974 msgid "" "Shut down one or both halves of the connection. If *how* is :const:" "`SHUT_RD`, further receives are disallowed. If *how* is :const:`SHUT_WR`, " @@ -2279,7 +2282,7 @@ msgid "" "and receives are disallowed." msgstr "" -#: ../../library/socket.rst:1979 +#: ../../library/socket.rst:1984 msgid "" "Duplicate a socket and prepare it for sharing with a target process. The " "target process must be provided with *process_id*. The resulting bytes " @@ -2290,48 +2293,48 @@ msgid "" "process." msgstr "" -#: ../../library/socket.rst:1991 +#: ../../library/socket.rst:1996 msgid "" "Note that there are no methods :meth:`read` or :meth:`write`; use :meth:" "`~socket.recv` and :meth:`~socket.send` without *flags* argument instead." msgstr "" -#: ../../library/socket.rst:1994 +#: ../../library/socket.rst:1999 msgid "" "Socket objects also have these (read-only) attributes that correspond to the " "values given to the :class:`~socket.socket` constructor." msgstr "" -#: ../../library/socket.rst:2000 +#: ../../library/socket.rst:2005 msgid "The socket family." msgstr "" -#: ../../library/socket.rst:2005 +#: ../../library/socket.rst:2010 msgid "The socket type." msgstr "" -#: ../../library/socket.rst:2010 +#: ../../library/socket.rst:2015 msgid "The socket protocol." msgstr "" -#: ../../library/socket.rst:2017 +#: ../../library/socket.rst:2022 msgid "Notes on socket timeouts" msgstr "" -#: ../../library/socket.rst:2019 +#: ../../library/socket.rst:2024 msgid "" "A socket object can be in one of three modes: blocking, non-blocking, or " "timeout. Sockets are by default always created in blocking mode, but this " "can be changed by calling :func:`setdefaulttimeout`." msgstr "" -#: ../../library/socket.rst:2023 +#: ../../library/socket.rst:2028 msgid "" "In *blocking mode*, operations block until complete or the system returns an " "error (such as connection timed out)." msgstr "" -#: ../../library/socket.rst:2026 +#: ../../library/socket.rst:2031 msgid "" "In *non-blocking mode*, operations fail (with an error that is unfortunately " "system-dependent) if they cannot be completed immediately: functions from " @@ -2339,14 +2342,14 @@ msgid "" "available for reading or writing." msgstr "" -#: ../../library/socket.rst:2031 +#: ../../library/socket.rst:2036 msgid "" "In *timeout mode*, operations fail if they cannot be completed within the " "timeout specified for the socket (they raise a :exc:`timeout` exception) or " "if the system returns an error." msgstr "" -#: ../../library/socket.rst:2036 +#: ../../library/socket.rst:2041 msgid "" "At the operating system level, sockets in *timeout mode* are internally set " "in non-blocking mode. Also, the blocking and timeout modes are shared " @@ -2355,11 +2358,11 @@ msgid "" "you decide to use the :meth:`~socket.fileno` of a socket." msgstr "" -#: ../../library/socket.rst:2043 +#: ../../library/socket.rst:2048 msgid "Timeouts and the ``connect`` method" msgstr "" -#: ../../library/socket.rst:2045 +#: ../../library/socket.rst:2050 msgid "" "The :meth:`~socket.connect` operation is also subject to the timeout " "setting, and in general it is recommended to call :meth:`~socket.settimeout` " @@ -2369,24 +2372,24 @@ msgid "" "setting." msgstr "" -#: ../../library/socket.rst:2053 +#: ../../library/socket.rst:2058 msgid "Timeouts and the ``accept`` method" msgstr "" -#: ../../library/socket.rst:2055 +#: ../../library/socket.rst:2060 msgid "" "If :func:`getdefaulttimeout` is not :const:`None`, sockets returned by the :" "meth:`~socket.accept` method inherit that timeout. Otherwise, the behaviour " "depends on settings of the listening socket:" msgstr "" -#: ../../library/socket.rst:2059 +#: ../../library/socket.rst:2064 msgid "" "if the listening socket is in *blocking mode* or in *timeout mode*, the " "socket returned by :meth:`~socket.accept` is in *blocking mode*;" msgstr "" -#: ../../library/socket.rst:2062 +#: ../../library/socket.rst:2067 msgid "" "if the listening socket is in *non-blocking mode*, whether the socket " "returned by :meth:`~socket.accept` is in blocking or non-blocking mode is " @@ -2394,11 +2397,11 @@ msgid "" "it is recommended you manually override this setting." msgstr "" -#: ../../library/socket.rst:2071 +#: ../../library/socket.rst:2076 msgid "Example" msgstr "範例" -#: ../../library/socket.rst:2073 +#: ../../library/socket.rst:2078 msgid "" "Here are four minimal example programs using the TCP/IP protocol: a server " "that echoes all data that it receives back (servicing only one client), and " @@ -2411,11 +2414,11 @@ msgid "" "on the new socket returned by :meth:`~socket.accept`." msgstr "" -#: ../../library/socket.rst:2083 +#: ../../library/socket.rst:2088 msgid "The first two examples support IPv4 only. ::" msgstr "前兩個範例只支援 IPv4: ::" -#: ../../library/socket.rst:2085 +#: ../../library/socket.rst:2090 msgid "" "# Echo server program\n" "import socket\n" @@ -2434,7 +2437,7 @@ msgid "" " conn.sendall(data)" msgstr "" -#: ../../library/socket.rst:2103 +#: ../../library/socket.rst:2108 msgid "" "# Echo client program\n" "import socket\n" @@ -2448,7 +2451,7 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2114 +#: ../../library/socket.rst:2119 msgid "" "The next two examples are identical to the above two, but support both IPv4 " "and IPv6. The server side will listen to the first address family available " @@ -2458,7 +2461,7 @@ msgid "" "resolution, and sends traffic to the first one connected successfully. ::" msgstr "" -#: ../../library/socket.rst:2121 +#: ../../library/socket.rst:2126 msgid "" "# Echo server program\n" "import socket\n" @@ -2495,7 +2498,7 @@ msgid "" " conn.send(data)" msgstr "" -#: ../../library/socket.rst:2157 +#: ../../library/socket.rst:2162 msgid "" "# Echo client program\n" "import socket\n" @@ -2528,14 +2531,14 @@ msgid "" "print('Received', repr(data))" msgstr "" -#: ../../library/socket.rst:2186 +#: ../../library/socket.rst:2191 msgid "" "The next example shows how to write a very simple network sniffer with raw " "sockets on Windows. The example requires administrator privileges to modify " "the interface::" msgstr "" -#: ../../library/socket.rst:2190 +#: ../../library/socket.rst:2195 msgid "" "import socket\n" "\n" @@ -2559,29 +2562,29 @@ msgid "" "s.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF)" msgstr "" -#: ../../library/socket.rst:2211 +#: ../../library/socket.rst:2216 msgid "" "The next example shows how to use the socket interface to communicate to a " "CAN network using the raw socket protocol. To use CAN with the broadcast " "manager protocol instead, open a socket with::" msgstr "" -#: ../../library/socket.rst:2215 +#: ../../library/socket.rst:2220 msgid "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" msgstr "socket.socket(socket.AF_CAN, socket.SOCK_DGRAM, socket.CAN_BCM)" -#: ../../library/socket.rst:2217 +#: ../../library/socket.rst:2222 msgid "" "After binding (:const:`CAN_RAW`) or connecting (:const:`CAN_BCM`) the " "socket, you can use the :meth:`socket.send` and :meth:`socket.recv` " "operations (and their counterparts) on the socket object as usual." msgstr "" -#: ../../library/socket.rst:2221 +#: ../../library/socket.rst:2226 msgid "This last example might require special privileges::" msgstr "" -#: ../../library/socket.rst:2223 +#: ../../library/socket.rst:2228 msgid "" "import socket\n" "import struct\n" @@ -2623,29 +2626,29 @@ msgid "" " print('Error sending CAN frame')" msgstr "" -#: ../../library/socket.rst:2261 +#: ../../library/socket.rst:2266 msgid "" "Running an example several times with too small delay between executions, " "could lead to this error::" msgstr "" -#: ../../library/socket.rst:2264 +#: ../../library/socket.rst:2269 msgid "OSError: [Errno 98] Address already in use" msgstr "OSError: [Errno 98] Address already in use" -#: ../../library/socket.rst:2266 +#: ../../library/socket.rst:2271 msgid "" "This is because the previous execution has left the socket in a " "``TIME_WAIT`` state, and can't be immediately reused." msgstr "" -#: ../../library/socket.rst:2269 +#: ../../library/socket.rst:2274 msgid "" "There is a :mod:`socket` flag to set, in order to prevent this, :const:" "`socket.SO_REUSEADDR`::" msgstr "" -#: ../../library/socket.rst:2272 +#: ../../library/socket.rst:2277 msgid "" "s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\n" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" @@ -2655,30 +2658,30 @@ msgstr "" "s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n" "s.bind((HOST, PORT))" -#: ../../library/socket.rst:2276 +#: ../../library/socket.rst:2281 msgid "" "the :data:`SO_REUSEADDR` flag tells the kernel to reuse a local socket in " "``TIME_WAIT`` state, without waiting for its natural timeout to expire." msgstr "" -#: ../../library/socket.rst:2282 +#: ../../library/socket.rst:2287 msgid "" "For an introduction to socket programming (in C), see the following papers:" msgstr "" -#: ../../library/socket.rst:2284 +#: ../../library/socket.rst:2289 msgid "" "*An Introductory 4.3BSD Interprocess Communication Tutorial*, by Stuart " "Sechrest" msgstr "" -#: ../../library/socket.rst:2286 +#: ../../library/socket.rst:2291 msgid "" "*An Advanced 4.3BSD Interprocess Communication Tutorial*, by Samuel J. " "Leffler et al," msgstr "" -#: ../../library/socket.rst:2289 +#: ../../library/socket.rst:2294 msgid "" "both in the UNIX Programmer's Manual, Supplementary Documents 1 (sections " "PS1:7 and PS1:8). The platform-specific reference material for the various " @@ -2697,18 +2700,29 @@ msgstr "object(物件)" msgid "socket" msgstr "socket" -#: ../../library/socket.rst:1589 +#: ../../library/socket.rst:1594 msgid "I/O control" msgstr "I/O control(I/O 控制)" -#: ../../library/socket.rst:1589 +#: ../../library/socket.rst:1594 msgid "buffering" msgstr "buffering(緩衝)" -#: ../../library/socket.rst:1946 +#: ../../library/socket.rst:1951 msgid "module" msgstr "module(模組)" -#: ../../library/socket.rst:1946 +#: ../../library/socket.rst:1951 msgid "struct" msgstr "struct" + +#~ msgid ":ref:`Availability `: not Emscripten, not WASI." +#~ msgstr ":ref:`適用 `:非 Emscripten、非 WASI。" + +#~ msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#~ msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" + +#~ msgid "" +#~ ":ref:`Availability `: Unix, Windows, not Emscripten, not " +#~ "WASI." +#~ msgstr ":ref:`適用 `:Unix、Windows、非 Emscripten、非 WASI。" diff --git a/library/socketserver.po b/library/socketserver.po index d14e7bda2c..ac01c1ed20 100644 --- a/library/socketserver.po +++ b/library/socketserver.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,17 +32,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/socketserver.rst:15 msgid "There are four basic concrete server classes:" diff --git a/library/spwd.po b/library/spwd.po deleted file mode 100644 index 9a726f2c09..0000000000 --- a/library/spwd.po +++ /dev/null @@ -1,226 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" -"PO-Revision-Date: 2022-05-22 02:14+0800\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/spwd.rst:2 -msgid ":mod:`spwd` --- The shadow password database" -msgstr ":mod:`spwd` --- shadow 密碼資料庫" - -#: ../../library/spwd.rst:9 -msgid "" -"The :mod:`spwd` module is deprecated (see :pep:`PEP 594 <594#spwd>` for " -"details and alternatives)." -msgstr "" -":mod:`spwd` 模組 (module) 即將被棄用(詳情與替代方案請見 :pep:`PEP 594 " -"<594#spwd>`\\ )。" - -#: ../../library/spwd.rst:15 -msgid "" -"This module provides access to the Unix shadow password database. It is " -"available on various Unix versions." -msgstr "" - -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: ../../includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" - -#: ../../library/spwd.rst:20 -msgid "" -"You must have enough privileges to access the shadow password database (this " -"usually means you have to be root)." -msgstr "" - -#: ../../library/spwd.rst:23 -msgid "" -"Shadow password database entries are reported as a tuple-like object, whose " -"attributes correspond to the members of the ``spwd`` structure (Attribute " -"field below, see ````):" -msgstr "" - -#: ../../library/spwd.rst:28 -msgid "Index" -msgstr "" - -#: ../../library/spwd.rst:28 -msgid "Attribute" -msgstr "屬性" - -#: ../../library/spwd.rst:28 -msgid "Meaning" -msgstr "含義" - -#: ../../library/spwd.rst:30 -msgid "0" -msgstr "0" - -#: ../../library/spwd.rst:30 -msgid "``sp_namp``" -msgstr "``sp_namp``" - -#: ../../library/spwd.rst:30 -msgid "Login name" -msgstr "" - -#: ../../library/spwd.rst:32 -msgid "1" -msgstr "1" - -#: ../../library/spwd.rst:32 -msgid "``sp_pwdp``" -msgstr "``sp_pwdp``" - -#: ../../library/spwd.rst:32 -msgid "Encrypted password" -msgstr "" - -#: ../../library/spwd.rst:34 -msgid "2" -msgstr "2" - -#: ../../library/spwd.rst:34 -msgid "``sp_lstchg``" -msgstr "``sp_lstchg``" - -#: ../../library/spwd.rst:34 -msgid "Date of last change" -msgstr "" - -#: ../../library/spwd.rst:36 -msgid "3" -msgstr "3" - -#: ../../library/spwd.rst:36 -msgid "``sp_min``" -msgstr "``sp_min``" - -#: ../../library/spwd.rst:36 -msgid "Minimal number of days between changes" -msgstr "" - -#: ../../library/spwd.rst:39 -msgid "4" -msgstr "4" - -#: ../../library/spwd.rst:39 -msgid "``sp_max``" -msgstr "``sp_max``" - -#: ../../library/spwd.rst:39 -msgid "Maximum number of days between changes" -msgstr "" - -#: ../../library/spwd.rst:42 -msgid "5" -msgstr "5" - -#: ../../library/spwd.rst:42 -msgid "``sp_warn``" -msgstr "``sp_warn``" - -#: ../../library/spwd.rst:42 -msgid "Number of days before password expires to warn user about it" -msgstr "" - -#: ../../library/spwd.rst:45 -msgid "6" -msgstr "6" - -#: ../../library/spwd.rst:45 -msgid "``sp_inact``" -msgstr "``sp_inact``" - -#: ../../library/spwd.rst:45 -msgid "Number of days after password expires until account is disabled" -msgstr "" - -#: ../../library/spwd.rst:49 -msgid "7" -msgstr "7" - -#: ../../library/spwd.rst:49 -msgid "``sp_expire``" -msgstr "``sp_expire``" - -#: ../../library/spwd.rst:49 -msgid "Number of days since 1970-01-01 when account expires" -msgstr "" - -#: ../../library/spwd.rst:52 -msgid "8" -msgstr "8" - -#: ../../library/spwd.rst:52 -msgid "``sp_flag``" -msgstr "``sp_flag``" - -#: ../../library/spwd.rst:52 -msgid "Reserved" -msgstr "" - -#: ../../library/spwd.rst:55 -msgid "" -"The sp_namp and sp_pwdp items are strings, all others are integers. :exc:" -"`KeyError` is raised if the entry asked for cannot be found." -msgstr "" - -#: ../../library/spwd.rst:58 -msgid "The following functions are defined:" -msgstr "" - -#: ../../library/spwd.rst:63 -msgid "Return the shadow password database entry for the given user name." -msgstr "" - -#: ../../library/spwd.rst:65 -msgid "" -"Raises a :exc:`PermissionError` instead of :exc:`KeyError` if the user " -"doesn't have privileges." -msgstr "" - -#: ../../library/spwd.rst:71 -msgid "" -"Return a list of all available shadow password database entries, in " -"arbitrary order." -msgstr "" - -#: ../../library/spwd.rst:77 -msgid "Module :mod:`grp`" -msgstr ":mod:`grp` 模組" - -#: ../../library/spwd.rst:78 -msgid "An interface to the group database, similar to this." -msgstr "" - -#: ../../library/spwd.rst:80 -msgid "Module :mod:`pwd`" -msgstr ":mod:`pwd` 模組" - -#: ../../library/spwd.rst:81 -msgid "An interface to the normal password database, similar to this." -msgstr "" diff --git a/library/sqlite3.po b/library/sqlite3.po index 4f0b8b2d0c..05aaa3758b 100644 --- a/library/sqlite3.po +++ b/library/sqlite3.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:10+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -39,7 +39,7 @@ msgstr "" msgid "" "The :mod:`!sqlite3` module was written by Gerhard Häring. It provides an " "SQL interface compliant with the DB-API 2.0 specification described by :pep:" -"`249`, and requires SQLite 3.7.15 or newer." +"`249`, and requires SQLite 3.15.2 or newer." msgstr "" #: ../../library/sqlite3.rst:36 @@ -356,7 +356,7 @@ msgstr ":ref:`sqlite3-adapters`" msgid ":ref:`sqlite3-converters`" msgstr ":ref:`sqlite3-converters`" -#: ../../library/sqlite3.rst:244 ../../library/sqlite3.rst:609 +#: ../../library/sqlite3.rst:244 ../../library/sqlite3.rst:615 msgid ":ref:`sqlite3-connection-context-manager`" msgstr ":ref:`sqlite3-connection-context-manager`" @@ -499,7 +499,14 @@ msgstr "新增 ``sqlite3.connect/handle`` 稽核事件。" msgid "Added the *autocommit* parameter." msgstr "新增 *autocommit* 參數。" -#: ../../library/sqlite3.rst:363 +#: ../../library/sqlite3.rst:361 +msgid "" +"Positional use of the parameters *timeout*, *detect_types*, " +"*isolation_level*, *check_same_thread*, *factory*, *cached_statements*, and " +"*uri* is deprecated. They will become keyword-only parameters in Python 3.15." +msgstr "" + +#: ../../library/sqlite3.rst:369 msgid "" "Return ``True`` if the string *statement* appears to contain one or more " "complete SQL statements. No syntactic verification or parsing of any kind is " @@ -507,11 +514,11 @@ msgid "" "and the statement is terminated by a semicolon." msgstr "" -#: ../../library/sqlite3.rst:369 +#: ../../library/sqlite3.rst:375 msgid "For example:" msgstr "範例:" -#: ../../library/sqlite3.rst:371 +#: ../../library/sqlite3.rst:377 msgid "" ">>> sqlite3.complete_statement(\"SELECT foo FROM bar;\")\n" "True\n" @@ -523,20 +530,20 @@ msgstr "" ">>> sqlite3.complete_statement(\"SELECT foo\")\n" "False" -#: ../../library/sqlite3.rst:378 +#: ../../library/sqlite3.rst:384 msgid "" "This function may be useful during command-line input to determine if the " "entered text seems to form a complete SQL statement, or if additional input " "is needed before calling :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:382 +#: ../../library/sqlite3.rst:388 msgid "" "See :func:`!runsource` in :source:`Lib/sqlite3/__main__.py` for real-world " "use." msgstr "" -#: ../../library/sqlite3.rst:387 +#: ../../library/sqlite3.rst:393 msgid "" "Enable or disable callback tracebacks. By default you will not get any " "tracebacks in user-defined functions, aggregates, converters, authorizer " @@ -545,14 +552,14 @@ msgid "" "on :data:`sys.stderr`. Use ``False`` to disable the feature again." msgstr "" -#: ../../library/sqlite3.rst:396 +#: ../../library/sqlite3.rst:402 msgid "" "Errors in user-defined function callbacks are logged as unraisable " "exceptions. Use an :func:`unraisable hook handler ` for " "introspection of the failed callback." msgstr "" -#: ../../library/sqlite3.rst:402 +#: ../../library/sqlite3.rst:408 msgid "" "Register an *adapter* :term:`callable` to adapt the Python type *type* into " "an SQLite type. The adapter is called with a Python object of type *type* as " @@ -560,7 +567,7 @@ msgid "" "natively understands `." msgstr "" -#: ../../library/sqlite3.rst:410 +#: ../../library/sqlite3.rst:416 msgid "" "Register the *converter* :term:`callable` to convert SQLite objects of type " "*typename* into a Python object of a specific type. The converter is invoked " @@ -570,24 +577,24 @@ msgid "" "type detection works." msgstr "" -#: ../../library/sqlite3.rst:418 +#: ../../library/sqlite3.rst:424 msgid "" "Note: *typename* and the name of the type in your query are matched case-" "insensitively." msgstr "" -#: ../../library/sqlite3.rst:425 +#: ../../library/sqlite3.rst:431 msgid "Module constants" msgstr "" -#: ../../library/sqlite3.rst:429 +#: ../../library/sqlite3.rst:435 msgid "" "Set :attr:`~Connection.autocommit` to this constant to select old style (pre-" "Python 3.12) transaction control behaviour. See :ref:`sqlite3-transaction-" "control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:435 +#: ../../library/sqlite3.rst:441 msgid "" "Pass this flag value to the *detect_types* parameter of :func:`connect` to " "look up a converter function by using the type name, parsed from the query " @@ -595,18 +602,18 @@ msgid "" "in square brackets (``[]``)." msgstr "" -#: ../../library/sqlite3.rst:441 +#: ../../library/sqlite3.rst:447 msgid "" "SELECT p as \"p [point]\" FROM test; ! will look up converter \"point\"" msgstr "" -#: ../../library/sqlite3.rst:445 +#: ../../library/sqlite3.rst:451 msgid "" "This flag may be combined with :const:`PARSE_DECLTYPES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:450 +#: ../../library/sqlite3.rst:456 msgid "" "Pass this flag value to the *detect_types* parameter of :func:`connect` to " "look up a converter function using the declared types for each column. The " @@ -615,7 +622,7 @@ msgid "" "the converter dictionary key. For example:" msgstr "" -#: ../../library/sqlite3.rst:458 +#: ../../library/sqlite3.rst:464 msgid "" "CREATE TABLE test(\n" " i integer primary key, ! will look up a converter named \"integer\"\n" @@ -624,61 +631,61 @@ msgid "" " )" msgstr "" -#: ../../library/sqlite3.rst:466 +#: ../../library/sqlite3.rst:472 msgid "" "This flag may be combined with :const:`PARSE_COLNAMES` using the ``|`` " "(bitwise or) operator." msgstr "" -#: ../../library/sqlite3.rst:473 +#: ../../library/sqlite3.rst:479 msgid "" "Flags that should be returned by the *authorizer_callback* :term:`callable` " "passed to :meth:`Connection.set_authorizer`, to indicate whether:" msgstr "" -#: ../../library/sqlite3.rst:476 +#: ../../library/sqlite3.rst:482 msgid "Access is allowed (:const:`!SQLITE_OK`)," msgstr "" -#: ../../library/sqlite3.rst:477 +#: ../../library/sqlite3.rst:483 msgid "" "The SQL statement should be aborted with an error (:const:`!SQLITE_DENY`)" msgstr "" -#: ../../library/sqlite3.rst:478 +#: ../../library/sqlite3.rst:484 msgid "" "The column should be treated as a ``NULL`` value (:const:`!SQLITE_IGNORE`)" msgstr "" -#: ../../library/sqlite3.rst:482 +#: ../../library/sqlite3.rst:488 msgid "" "String constant stating the supported DB-API level. Required by the DB-API. " "Hard-coded to ``\"2.0\"``." msgstr "" -#: ../../library/sqlite3.rst:487 +#: ../../library/sqlite3.rst:493 msgid "" "String constant stating the type of parameter marker formatting expected by " "the :mod:`!sqlite3` module. Required by the DB-API. Hard-coded to " "``\"qmark\"``." msgstr "" -#: ../../library/sqlite3.rst:493 +#: ../../library/sqlite3.rst:499 msgid "The ``named`` DB-API parameter style is also supported." msgstr "" -#: ../../library/sqlite3.rst:497 +#: ../../library/sqlite3.rst:503 msgid "" "Version number of the runtime SQLite library as a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:501 +#: ../../library/sqlite3.rst:507 msgid "" "Version number of the runtime SQLite library as a :class:`tuple` of :class:" "`integers `." msgstr "" -#: ../../library/sqlite3.rst:506 +#: ../../library/sqlite3.rst:512 msgid "" "Integer constant required by the DB-API 2.0, stating the level of thread " "safety the :mod:`!sqlite3` module supports. This attribute is set based on " @@ -686,181 +693,187 @@ msgid "" "underlying SQLite library is compiled with. The SQLite threading modes are:" msgstr "" -#: ../../library/sqlite3.rst:511 +#: ../../library/sqlite3.rst:517 msgid "" "**Single-thread**: In this mode, all mutexes are disabled and SQLite is " "unsafe to use in more than a single thread at once." msgstr "" -#: ../../library/sqlite3.rst:513 +#: ../../library/sqlite3.rst:519 msgid "" "**Multi-thread**: In this mode, SQLite can be safely used by multiple " "threads provided that no single database connection is used simultaneously " "in two or more threads." msgstr "" -#: ../../library/sqlite3.rst:516 +#: ../../library/sqlite3.rst:522 msgid "" "**Serialized**: In serialized mode, SQLite can be safely used by multiple " "threads with no restriction." msgstr "" -#: ../../library/sqlite3.rst:519 +#: ../../library/sqlite3.rst:525 msgid "" "The mappings from SQLite threading modes to DB-API 2.0 threadsafety levels " "are as follows:" msgstr "" -#: ../../library/sqlite3.rst:523 +#: ../../library/sqlite3.rst:529 msgid "SQLite threading mode" msgstr "" -#: ../../library/sqlite3.rst:523 +#: ../../library/sqlite3.rst:529 msgid ":pep:`threadsafety <0249#threadsafety>`" msgstr "" -#: ../../library/sqlite3.rst:523 +#: ../../library/sqlite3.rst:529 msgid "`SQLITE_THREADSAFE`_" msgstr "`SQLITE_THREADSAFE`_" -#: ../../library/sqlite3.rst:523 +#: ../../library/sqlite3.rst:529 msgid "DB-API 2.0 meaning" msgstr "" -#: ../../library/sqlite3.rst:526 +#: ../../library/sqlite3.rst:532 msgid "single-thread" msgstr "" -#: ../../library/sqlite3.rst:526 +#: ../../library/sqlite3.rst:532 msgid "0" msgstr "0" -#: ../../library/sqlite3.rst:526 +#: ../../library/sqlite3.rst:532 msgid "Threads may not share the module" msgstr "" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:535 msgid "multi-thread" msgstr "" -#: ../../library/sqlite3.rst:529 ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:535 ../../library/sqlite3.rst:538 msgid "1" msgstr "1" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:535 msgid "2" msgstr "2" -#: ../../library/sqlite3.rst:529 +#: ../../library/sqlite3.rst:535 msgid "Threads may share the module, but not connections" msgstr "" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:538 msgid "serialized" msgstr "" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:538 msgid "3" msgstr "3" -#: ../../library/sqlite3.rst:532 +#: ../../library/sqlite3.rst:538 msgid "Threads may share the module, connections and cursors" msgstr "" -#: ../../library/sqlite3.rst:538 +#: ../../library/sqlite3.rst:544 msgid "Set *threadsafety* dynamically instead of hard-coding it to ``1``." msgstr "" -#: ../../library/sqlite3.rst:543 +#: ../../library/sqlite3.rst:549 msgid "" "Version number of this module as a :class:`string `. This is not the " "version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:546 ../../library/sqlite3.rst:556 +#: ../../library/sqlite3.rst:552 ../../library/sqlite3.rst:562 msgid "" "This constant used to reflect the version number of the ``pysqlite`` " "package, a third-party library which used to upstream changes to :mod:`!" "sqlite3`. Today, it carries no meaning or practical value." msgstr "" -#: ../../library/sqlite3.rst:553 +#: ../../library/sqlite3.rst:559 msgid "" "Version number of this module as a :class:`tuple` of :class:`integers " "`. This is not the version of the SQLite library." msgstr "" -#: ../../library/sqlite3.rst:580 +#: ../../library/sqlite3.rst:586 msgid "" "These constants are used for the :meth:`Connection.setconfig` and :meth:" "`~Connection.getconfig` methods." msgstr "" -#: ../../library/sqlite3.rst:583 +#: ../../library/sqlite3.rst:589 msgid "" "The availability of these constants varies depending on the version of " "SQLite Python was compiled with." msgstr "" -#: ../../library/sqlite3.rst:590 +#: ../../library/sqlite3.rst:596 msgid "https://www.sqlite.org/c3ref/c_dbconfig_defensive.html" msgstr "" -#: ../../library/sqlite3.rst:591 +#: ../../library/sqlite3.rst:597 msgid "SQLite docs: Database Connection Configuration Options" msgstr "" -#: ../../library/sqlite3.rst:597 +#: ../../library/sqlite3.rst:603 msgid "Connection objects" msgstr "Connection 物件" -#: ../../library/sqlite3.rst:601 +#: ../../library/sqlite3.rst:607 msgid "" "Each open SQLite database is represented by a ``Connection`` object, which " "is created using :func:`sqlite3.connect`. Their main purpose is creating :" "class:`Cursor` objects, and :ref:`sqlite3-controlling-transactions`." msgstr "" -#: ../../library/sqlite3.rst:608 +#: ../../library/sqlite3.rst:614 msgid ":ref:`sqlite3-connection-shortcuts`" msgstr ":ref:`sqlite3-connection-shortcuts`" -#: ../../library/sqlite3.rst:611 +#: ../../library/sqlite3.rst:620 +msgid "" +"A :exc:`ResourceWarning` is emitted if :meth:`close` is not called before a :" +"class:`!Connection` object is deleted." +msgstr "" + +#: ../../library/sqlite3.rst:623 msgid "An SQLite database connection has the following attributes and methods:" msgstr "" -#: ../../library/sqlite3.rst:615 +#: ../../library/sqlite3.rst:627 msgid "" "Create and return a :class:`Cursor` object. The cursor method accepts a " "single optional parameter *factory*. If supplied, this must be a :term:" "`callable` returning an instance of :class:`Cursor` or its subclasses." msgstr "" -#: ../../library/sqlite3.rst:622 +#: ../../library/sqlite3.rst:634 msgid "" "Open a :class:`Blob` handle to an existing :abbr:`BLOB (Binary Large " "OBject)`." msgstr "" -#: ../../library/sqlite3.rst:625 +#: ../../library/sqlite3.rst:637 msgid "The name of the table where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:628 +#: ../../library/sqlite3.rst:640 msgid "The name of the column where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:631 +#: ../../library/sqlite3.rst:643 msgid "The name of the row where the blob is located." msgstr "" -#: ../../library/sqlite3.rst:634 +#: ../../library/sqlite3.rst:646 msgid "" "Set to ``True`` if the blob should be opened without write permissions. " "Defaults to ``False``." msgstr "" -#: ../../library/sqlite3.rst:639 +#: ../../library/sqlite3.rst:651 msgid "" "The name of the database where the blob is located. Defaults to ``\"main\"``." msgstr "" @@ -869,17 +882,17 @@ msgstr "" msgid "Raises" msgstr "" -#: ../../library/sqlite3.rst:643 +#: ../../library/sqlite3.rst:655 msgid "When trying to open a blob in a ``WITHOUT ROWID`` table." msgstr "" -#: ../../library/sqlite3.rst:650 +#: ../../library/sqlite3.rst:662 msgid "" "The blob size cannot be changed using the :class:`Blob` class. Use the SQL " "function ``zeroblob`` to create a blob with a fixed size." msgstr "" -#: ../../library/sqlite3.rst:657 +#: ../../library/sqlite3.rst:669 msgid "" "Commit any pending transaction to the database. If :attr:`autocommit` is " "``True``, or there is no open transaction, this method does nothing. If :" @@ -887,7 +900,7 @@ msgid "" "pending transaction was committed by this method." msgstr "" -#: ../../library/sqlite3.rst:665 +#: ../../library/sqlite3.rst:677 msgid "" "Roll back to the start of any pending transaction. If :attr:`autocommit` is " "``True``, or there is no open transaction, this method does nothing. If :" @@ -895,7 +908,7 @@ msgid "" "pending transaction was rolled back by this method." msgstr "" -#: ../../library/sqlite3.rst:673 +#: ../../library/sqlite3.rst:685 msgid "" "Close the database connection. If :attr:`autocommit` is ``False``, any " "pending transaction is implicitly rolled back. If :attr:`!autocommit` is " @@ -904,67 +917,63 @@ msgid "" "losing pending changes." msgstr "" -#: ../../library/sqlite3.rst:683 +#: ../../library/sqlite3.rst:695 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.execute` on it " "with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:689 +#: ../../library/sqlite3.rst:701 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executemany` on " "it with the given *sql* and *parameters*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:695 +#: ../../library/sqlite3.rst:707 msgid "" "Create a new :class:`Cursor` object and call :meth:`~Cursor.executescript` " "on it with the given *sql_script*. Return the new cursor object." msgstr "" -#: ../../library/sqlite3.rst:701 +#: ../../library/sqlite3.rst:713 msgid "Create or remove a user-defined SQL function." msgstr "" -#: ../../library/sqlite3.rst:703 +#: ../../library/sqlite3.rst:715 msgid "The name of the SQL function." msgstr "" -#: ../../library/sqlite3.rst:706 +#: ../../library/sqlite3.rst:718 msgid "" "The number of arguments the SQL function can accept. If ``-1``, it may take " "any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:710 +#: ../../library/sqlite3.rst:722 msgid "" "A :term:`callable` that is called when the SQL function is invoked. The " "callable must return :ref:`a type natively supported by SQLite `. Set to ``None`` to remove an existing SQL function." msgstr "" -#: ../../library/sqlite3.rst:717 +#: ../../library/sqlite3.rst:729 msgid "" "If ``True``, the created SQL function is marked as `deterministic `_, which allows SQLite to perform additional " "optimizations." msgstr "" -#: ../../library/sqlite3.rst:722 -msgid "If *deterministic* is used with SQLite versions older than 3.8.3." -msgstr "" - -#: ../../library/sqlite3.rst:725 +#: ../../library/sqlite3.rst:734 msgid "Added the *deterministic* parameter." msgstr "新增 *deterministic* 參數。" -#: ../../library/sqlite3.rst:728 ../../library/sqlite3.rst:767 -#: ../../library/sqlite3.rst:830 ../../library/sqlite3.rst:1090 -#: ../../library/sqlite3.rst:1510 ../../library/sqlite3.rst:1553 +#: ../../library/sqlite3.rst:737 ../../library/sqlite3.rst:781 +#: ../../library/sqlite3.rst:849 ../../library/sqlite3.rst:1128 +#: ../../library/sqlite3.rst:1550 ../../library/sqlite3.rst:1593 msgid "Example:" msgstr "範例:" -#: ../../library/sqlite3.rst:730 +#: ../../library/sqlite3.rst:739 msgid "" ">>> import hashlib\n" ">>> def md5sum(t):\n" @@ -986,21 +995,27 @@ msgstr "" "('acbd18db4cc2f85cedef654fccc4a4d8',)\n" ">>> con.close()" -#: ../../library/sqlite3.rst:745 +#: ../../library/sqlite3.rst:753 +msgid "" +"Passing *name*, *narg*, and *func* as keyword arguments is deprecated. These " +"parameters will become positional-only in Python 3.15." +msgstr "" + +#: ../../library/sqlite3.rst:759 msgid "Create or remove a user-defined SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:747 +#: ../../library/sqlite3.rst:761 msgid "The name of the SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:750 +#: ../../library/sqlite3.rst:764 msgid "" "The number of arguments the SQL aggregate function can accept. If ``-1``, it " "may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:754 +#: ../../library/sqlite3.rst:768 msgid "" "A class must implement the following methods: * ``step()``: Add a row to " "the aggregate. * ``finalize()``: Return the final result of the aggregate " @@ -1009,31 +1024,31 @@ msgid "" "*n_arg*. Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:755 +#: ../../library/sqlite3.rst:769 msgid "A class must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:757 +#: ../../library/sqlite3.rst:771 msgid "``step()``: Add a row to the aggregate." msgstr "" -#: ../../library/sqlite3.rst:758 ../../library/sqlite3.rst:814 +#: ../../library/sqlite3.rst:772 ../../library/sqlite3.rst:833 msgid "" "``finalize()``: Return the final result of the aggregate as :ref:`a type " "natively supported by SQLite `." msgstr "" -#: ../../library/sqlite3.rst:761 +#: ../../library/sqlite3.rst:775 msgid "" "The number of arguments that the ``step()`` method must accept is controlled " "by *n_arg*." msgstr "" -#: ../../library/sqlite3.rst:764 +#: ../../library/sqlite3.rst:778 msgid "Set to ``None`` to remove an existing SQL aggregate function." msgstr "" -#: ../../library/sqlite3.rst:769 +#: ../../library/sqlite3.rst:783 msgid "" "class MySum:\n" " def __init__(self):\n" @@ -1075,21 +1090,27 @@ msgstr "" "\n" "con.close()" -#: ../../library/sqlite3.rst:799 +#: ../../library/sqlite3.rst:812 +msgid "" +"Passing *name*, *n_arg*, and *aggregate_class* as keyword arguments is " +"deprecated. These parameters will become positional-only in Python 3.15." +msgstr "" + +#: ../../library/sqlite3.rst:818 msgid "Create or remove a user-defined aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:801 +#: ../../library/sqlite3.rst:820 msgid "The name of the SQL aggregate window function to create or remove." msgstr "" -#: ../../library/sqlite3.rst:804 +#: ../../library/sqlite3.rst:823 msgid "" "The number of arguments the SQL aggregate window function can accept. If " "``-1``, it may take any number of arguments." msgstr "" -#: ../../library/sqlite3.rst:808 +#: ../../library/sqlite3.rst:827 msgid "" "A class that must implement the following methods: * ``step()``: Add a row " "to the current window. * ``value()``: Return the current value of the " @@ -1101,39 +1122,39 @@ msgid "" "function." msgstr "" -#: ../../library/sqlite3.rst:809 +#: ../../library/sqlite3.rst:828 msgid "A class that must implement the following methods:" msgstr "" -#: ../../library/sqlite3.rst:811 +#: ../../library/sqlite3.rst:830 msgid "``step()``: Add a row to the current window." msgstr "" -#: ../../library/sqlite3.rst:812 +#: ../../library/sqlite3.rst:831 msgid "``value()``: Return the current value of the aggregate." msgstr "" -#: ../../library/sqlite3.rst:813 +#: ../../library/sqlite3.rst:832 msgid "``inverse()``: Remove a row from the current window." msgstr "" -#: ../../library/sqlite3.rst:817 +#: ../../library/sqlite3.rst:836 msgid "" "The number of arguments that the ``step()`` and ``value()`` methods must " "accept is controlled by *num_params*." msgstr "" -#: ../../library/sqlite3.rst:820 +#: ../../library/sqlite3.rst:839 msgid "Set to ``None`` to remove an existing SQL aggregate window function." msgstr "" -#: ../../library/sqlite3.rst:822 +#: ../../library/sqlite3.rst:841 msgid "" "If used with a version of SQLite older than 3.25.0, which does not support " "aggregate window functions." msgstr "" -#: ../../library/sqlite3.rst:832 +#: ../../library/sqlite3.rst:851 msgid "" "# Example taken from https://www.sqlite.org/windowfunctions.html#udfwinfunc\n" "class WindowSumInt:\n" @@ -1181,30 +1202,30 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:886 +#: ../../library/sqlite3.rst:905 msgid "" "Create a collation named *name* using the collating function *callable*. " "*callable* is passed two :class:`string ` arguments, and it should " "return an :class:`integer `:" msgstr "" -#: ../../library/sqlite3.rst:890 +#: ../../library/sqlite3.rst:909 msgid "``1`` if the first is ordered higher than the second" msgstr "" -#: ../../library/sqlite3.rst:891 +#: ../../library/sqlite3.rst:910 msgid "``-1`` if the first is ordered lower than the second" msgstr "" -#: ../../library/sqlite3.rst:892 +#: ../../library/sqlite3.rst:911 msgid "``0`` if they are ordered equal" msgstr "" -#: ../../library/sqlite3.rst:894 +#: ../../library/sqlite3.rst:913 msgid "The following example shows a reverse sorting collation:" msgstr "" -#: ../../library/sqlite3.rst:896 +#: ../../library/sqlite3.rst:915 msgid "" "def collate_reverse(string1, string2):\n" " if string1 == string2:\n" @@ -1242,24 +1263,24 @@ msgstr "" " print(row)\n" "con.close()" -#: ../../library/sqlite3.rst:922 +#: ../../library/sqlite3.rst:941 msgid "Remove a collation function by setting *callable* to ``None``." msgstr "" -#: ../../library/sqlite3.rst:924 +#: ../../library/sqlite3.rst:943 msgid "" "The collation name can contain any Unicode character. Earlier, only ASCII " "characters were allowed." msgstr "" -#: ../../library/sqlite3.rst:931 +#: ../../library/sqlite3.rst:950 msgid "" "Call this method from a different thread to abort any queries that might be " "executing on the connection. Aborted queries will raise an :exc:" "`OperationalError`." msgstr "" -#: ../../library/sqlite3.rst:938 +#: ../../library/sqlite3.rst:957 msgid "" "Register :term:`callable` *authorizer_callback* to be invoked for each " "attempt to access a column of a table in the database. The callback should " @@ -1268,7 +1289,7 @@ msgid "" "underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:945 +#: ../../library/sqlite3.rst:964 msgid "" "The first argument to the callback signifies what kind of operation is to be " "authorized. The second and third argument will be arguments or ``None`` " @@ -1278,7 +1299,7 @@ msgid "" "attempt or ``None`` if this access attempt is directly from input SQL code." msgstr "" -#: ../../library/sqlite3.rst:952 +#: ../../library/sqlite3.rst:971 msgid "" "Please consult the SQLite documentation about the possible values for the " "first argument and the meaning of the second and third argument depending on " @@ -1286,15 +1307,21 @@ msgid "" "module." msgstr "" -#: ../../library/sqlite3.rst:956 +#: ../../library/sqlite3.rst:975 msgid "Passing ``None`` as *authorizer_callback* will disable the authorizer." msgstr "" -#: ../../library/sqlite3.rst:958 +#: ../../library/sqlite3.rst:977 msgid "Added support for disabling the authorizer using ``None``." msgstr "" -#: ../../library/sqlite3.rst:964 +#: ../../library/sqlite3.rst:980 +msgid "" +"Passing *authorizer_callback* as a keyword argument is deprecated. The " +"parameter will become positional-only in Python 3.15." +msgstr "" + +#: ../../library/sqlite3.rst:987 msgid "" "Register :term:`callable` *progress_handler* to be invoked for every *n* " "instructions of the SQLite virtual machine. This is useful if you want to " @@ -1302,26 +1329,32 @@ msgid "" "a GUI." msgstr "" -#: ../../library/sqlite3.rst:969 +#: ../../library/sqlite3.rst:992 msgid "" "If you want to clear any previously installed progress handler, call the " "method with ``None`` for *progress_handler*." msgstr "" -#: ../../library/sqlite3.rst:972 +#: ../../library/sqlite3.rst:995 msgid "" "Returning a non-zero value from the handler function will terminate the " "currently executing query and cause it to raise a :exc:`DatabaseError` " "exception." msgstr "" -#: ../../library/sqlite3.rst:979 +#: ../../library/sqlite3.rst:999 +msgid "" +"Passing *progress_handler* as a keyword argument is deprecated. The " +"parameter will become positional-only in Python 3.15." +msgstr "" + +#: ../../library/sqlite3.rst:1006 msgid "" "Register :term:`callable` *trace_callback* to be invoked for each SQL " "statement that is actually executed by the SQLite backend." msgstr "" -#: ../../library/sqlite3.rst:982 +#: ../../library/sqlite3.rst:1009 msgid "" "The only argument passed to the callback is the statement (as :class:`str`) " "that is being executed. The return value of the callback is ignored. Note " @@ -1331,18 +1364,24 @@ msgid "" "execution of triggers defined in the current database." msgstr "" -#: ../../library/sqlite3.rst:990 +#: ../../library/sqlite3.rst:1017 msgid "Passing ``None`` as *trace_callback* will disable the trace callback." msgstr "" -#: ../../library/sqlite3.rst:993 +#: ../../library/sqlite3.rst:1020 msgid "" "Exceptions raised in the trace callback are not propagated. As a development " "and debugging aid, use :meth:`~sqlite3.enable_callback_tracebacks` to enable " "printing tracebacks from exceptions raised in the trace callback." msgstr "" -#: ../../library/sqlite3.rst:1003 +#: ../../library/sqlite3.rst:1027 +msgid "" +"Passing *trace_callback* as a keyword argument is deprecated. The parameter " +"will become positional-only in Python 3.15." +msgstr "" + +#: ../../library/sqlite3.rst:1034 msgid "" "Enable the SQLite engine to load SQLite extensions from shared libraries if " "*enabled* is ``True``; else, disallow loading SQLite extensions. SQLite " @@ -1351,7 +1390,7 @@ msgid "" "distributed with SQLite." msgstr "" -#: ../../library/sqlite3.rst:1012 +#: ../../library/sqlite3.rst:1043 msgid "" "The :mod:`!sqlite3` module is not built with loadable extension support by " "default, because some platforms (notably macOS) have SQLite libraries which " @@ -1360,7 +1399,7 @@ msgid "" "program:`configure`." msgstr "" -#: ../../library/sqlite3.rst:1019 +#: ../../library/sqlite3.rst:1050 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.enable_load_extension`` " "with arguments ``connection``, ``enabled``." @@ -1368,11 +1407,11 @@ msgstr "" "引發一個附帶引數 ``connection``、``enabled`` 的\\ :ref:`稽核事件 ` " "``sqlite3.enable_load_extension``。" -#: ../../library/sqlite3.rst:1023 +#: ../../library/sqlite3.rst:1054 msgid "Added the ``sqlite3.enable_load_extension`` auditing event." msgstr "加入 ``sqlite3.enable_load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1029 +#: ../../library/sqlite3.rst:1060 msgid "" "con.enable_load_extension(True)\n" "\n" @@ -1402,24 +1441,24 @@ msgid "" " print(row)" msgstr "" -#: ../../library/sqlite3.rst:1055 +#: ../../library/sqlite3.rst:1086 msgid "" "Load an SQLite extension from a shared library. Enable extension loading " "with :meth:`enable_load_extension` before calling this method." msgstr "" -#: ../../library/sqlite3.rst:1059 +#: ../../library/sqlite3.rst:1090 msgid "The path to the SQLite extension." msgstr "" -#: ../../library/sqlite3.rst:1063 +#: ../../library/sqlite3.rst:1094 msgid "" "Entry point name. If ``None`` (the default), SQLite will come up with an " "entry point name of its own; see the SQLite docs `Loading an Extension`_ for " "details." msgstr "" -#: ../../library/sqlite3.rst:1072 +#: ../../library/sqlite3.rst:1103 msgid "" "Raises an :ref:`auditing event ` ``sqlite3.load_extension`` with " "arguments ``connection``, ``path``." @@ -1427,22 +1466,29 @@ msgstr "" "引發一個附帶引數 ``connection``、``path`` 的\\ :ref:`稽核事件 ` " "``sqlite3.load_extension``。" -#: ../../library/sqlite3.rst:1076 +#: ../../library/sqlite3.rst:1107 msgid "Added the ``sqlite3.load_extension`` auditing event." msgstr "加入 ``sqlite3.load_extension`` 稽核事件。" -#: ../../library/sqlite3.rst:1079 +#: ../../library/sqlite3.rst:1110 msgid "Added the *entrypoint* parameter." msgstr "新增 *entrypoint* 參數。" -#: ../../library/sqlite3.rst:1086 +#: ../../library/sqlite3.rst:1117 msgid "" "Return an :term:`iterator` to dump the database as SQL source code. Useful " "when saving an in-memory database for later restoration. Similar to the ``." "dump`` command in the :program:`sqlite3` shell." msgstr "" -#: ../../library/sqlite3.rst:1092 +#: ../../library/sqlite3.rst:1121 +msgid "" +"An optional ``LIKE`` pattern for database objects to dump, e.g. " +"``prefix_%``. If ``None`` (the default), all database objects will be " +"included." +msgstr "" + +#: ../../library/sqlite3.rst:1130 msgid "" "# Convert file example.db to SQL dump file dump.sql\n" "con = sqlite3.connect('example.db')\n" @@ -1452,31 +1498,35 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1103 ../../library/sqlite3.rst:1175 +#: ../../library/sqlite3.rst:1141 ../../library/sqlite3.rst:1215 msgid ":ref:`sqlite3-howto-encoding`" msgstr ":ref:`sqlite3-howto-encoding`" -#: ../../library/sqlite3.rst:1108 +#: ../../library/sqlite3.rst:1143 +msgid "Added the *filter* parameter." +msgstr "新增 *filter* 參數。" + +#: ../../library/sqlite3.rst:1148 msgid "Create a backup of an SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1110 +#: ../../library/sqlite3.rst:1150 msgid "" "Works even if the database is being accessed by other clients or " "concurrently by the same connection." msgstr "" -#: ../../library/sqlite3.rst:1113 +#: ../../library/sqlite3.rst:1153 msgid "The database connection to save the backup to." msgstr "" -#: ../../library/sqlite3.rst:1116 +#: ../../library/sqlite3.rst:1156 msgid "" "The number of pages to copy at a time. If equal to or less than ``0``, the " "entire database is copied in a single step. Defaults to ``-1``." msgstr "" -#: ../../library/sqlite3.rst:1122 +#: ../../library/sqlite3.rst:1162 msgid "" "If set to a :term:`callable`, it is invoked with three integer arguments for " "every backup iteration: the *status* of the last iteration, the *remaining* " @@ -1484,24 +1534,24 @@ msgid "" "Defaults to ``None``." msgstr "" -#: ../../library/sqlite3.rst:1131 +#: ../../library/sqlite3.rst:1171 msgid "" "The name of the database to back up. Either ``\"main\"`` (the default) for " "the main database, ``\"temp\"`` for the temporary database, or the name of a " "custom database as attached using the ``ATTACH DATABASE`` SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1138 +#: ../../library/sqlite3.rst:1178 msgid "" "The number of seconds to sleep between successive attempts to back up " "remaining pages." msgstr "" -#: ../../library/sqlite3.rst:1142 +#: ../../library/sqlite3.rst:1182 msgid "Example 1, copy an existing database into another:" msgstr "" -#: ../../library/sqlite3.rst:1144 +#: ../../library/sqlite3.rst:1184 msgid "" "def progress(status, remaining, total):\n" " print(f'Copied {total-remaining} of {total} pages...')\n" @@ -1523,11 +1573,11 @@ msgstr "" "dst.close()\n" "src.close()" -#: ../../library/sqlite3.rst:1161 +#: ../../library/sqlite3.rst:1201 msgid "Example 2, copy an existing database into a transient copy:" msgstr "" -#: ../../library/sqlite3.rst:1163 +#: ../../library/sqlite3.rst:1203 msgid "" "src = sqlite3.connect('example.db')\n" "dst = sqlite3.connect(':memory:')\n" @@ -1541,25 +1591,25 @@ msgstr "" "dst.close()\n" "src.close()" -#: ../../library/sqlite3.rst:1179 +#: ../../library/sqlite3.rst:1219 msgid "Get a connection runtime limit." msgstr "" -#: ../../library/sqlite3.rst:1181 +#: ../../library/sqlite3.rst:1221 msgid "The `SQLite limit category`_ to be queried." msgstr "" -#: ../../library/sqlite3.rst:1186 ../../library/sqlite3.rst:1223 +#: ../../library/sqlite3.rst:1226 ../../library/sqlite3.rst:1263 msgid "If *category* is not recognised by the underlying SQLite library." msgstr "" -#: ../../library/sqlite3.rst:1189 +#: ../../library/sqlite3.rst:1229 msgid "" "Example, query the maximum length of an SQL statement for :class:" "`Connection` ``con`` (the default is 1000000000):" msgstr "" -#: ../../library/sqlite3.rst:1199 +#: ../../library/sqlite3.rst:1239 msgid "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" @@ -1567,7 +1617,7 @@ msgstr "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_SQL_LENGTH)\n" "1000000000" -#: ../../library/sqlite3.rst:1209 +#: ../../library/sqlite3.rst:1249 msgid "" "Set a connection runtime limit. Attempts to increase a limit above its hard " "upper bound are silently truncated to the hard upper bound. Regardless of " @@ -1575,22 +1625,22 @@ msgid "" "returned." msgstr "" -#: ../../library/sqlite3.rst:1214 +#: ../../library/sqlite3.rst:1254 msgid "The `SQLite limit category`_ to be set." msgstr "" -#: ../../library/sqlite3.rst:1217 +#: ../../library/sqlite3.rst:1257 msgid "" "The value of the new limit. If negative, the current limit is unchanged." msgstr "" -#: ../../library/sqlite3.rst:1226 +#: ../../library/sqlite3.rst:1266 msgid "" "Example, limit the number of attached databases to 1 for :class:`Connection` " "``con`` (the default limit is 10):" msgstr "" -#: ../../library/sqlite3.rst:1229 +#: ../../library/sqlite3.rst:1269 msgid "" ">>> con.setlimit(sqlite3.SQLITE_LIMIT_ATTACHED, 1)\n" "10\n" @@ -1602,25 +1652,25 @@ msgstr "" ">>> con.getlimit(sqlite3.SQLITE_LIMIT_ATTACHED)\n" "1" -#: ../../library/sqlite3.rst:1247 +#: ../../library/sqlite3.rst:1287 msgid "Query a boolean connection configuration option." msgstr "" -#: ../../library/sqlite3.rst:1249 ../../library/sqlite3.rst:1260 +#: ../../library/sqlite3.rst:1289 ../../library/sqlite3.rst:1300 msgid "A :ref:`SQLITE_DBCONFIG code `." msgstr "" -#: ../../library/sqlite3.rst:1258 +#: ../../library/sqlite3.rst:1298 msgid "Set a boolean connection configuration option." msgstr "" -#: ../../library/sqlite3.rst:1263 +#: ../../library/sqlite3.rst:1303 msgid "" "``True`` if the configuration option should be enabled (default); ``False`` " "if it should be disabled." msgstr "" -#: ../../library/sqlite3.rst:1271 +#: ../../library/sqlite3.rst:1311 msgid "" "Serialize a database into a :class:`bytes` object. For an ordinary on-disk " "database file, the serialization is just a copy of the disk file. For an in-" @@ -1629,17 +1679,17 @@ msgid "" "backed up to disk." msgstr "" -#: ../../library/sqlite3.rst:1277 +#: ../../library/sqlite3.rst:1317 msgid "The database name to be serialized. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1285 +#: ../../library/sqlite3.rst:1325 msgid "" "This method is only available if the underlying SQLite library has the " "serialize API." msgstr "" -#: ../../library/sqlite3.rst:1293 +#: ../../library/sqlite3.rst:1333 msgid "" "Deserialize a :meth:`serialized ` database into a :class:" "`Connection`. This method causes the database connection to disconnect from " @@ -1647,96 +1697,96 @@ msgid "" "serialization contained in *data*." msgstr "" -#: ../../library/sqlite3.rst:1299 +#: ../../library/sqlite3.rst:1339 msgid "A serialized database." msgstr "" -#: ../../library/sqlite3.rst:1302 +#: ../../library/sqlite3.rst:1342 msgid "The database name to deserialize into. Defaults to ``\"main\"``." msgstr "" -#: ../../library/sqlite3.rst:1306 +#: ../../library/sqlite3.rst:1346 msgid "" "If the database connection is currently involved in a read transaction or a " "backup operation." msgstr "" -#: ../../library/sqlite3.rst:1310 +#: ../../library/sqlite3.rst:1350 msgid "If *data* does not contain a valid SQLite database." msgstr "" -#: ../../library/sqlite3.rst:1313 +#: ../../library/sqlite3.rst:1353 msgid "If :func:`len(data) ` is larger than ``2**63 - 1``." msgstr "" -#: ../../library/sqlite3.rst:1318 +#: ../../library/sqlite3.rst:1358 msgid "" "This method is only available if the underlying SQLite library has the " "deserialize API." msgstr "" -#: ../../library/sqlite3.rst:1325 +#: ../../library/sqlite3.rst:1365 msgid "" "This attribute controls :pep:`249`-compliant transaction behaviour. :attr:`!" "autocommit` has three allowed values:" msgstr "" -#: ../../library/sqlite3.rst:1328 +#: ../../library/sqlite3.rst:1368 msgid "" "``False``: Select :pep:`249`-compliant transaction behaviour, implying that :" "mod:`!sqlite3` ensures a transaction is always open. Use :meth:`commit` and :" "meth:`rollback` to close transactions." msgstr "" -#: ../../library/sqlite3.rst:1332 +#: ../../library/sqlite3.rst:1372 msgid "This is the recommended value of :attr:`!autocommit`." msgstr "" -#: ../../library/sqlite3.rst:1334 +#: ../../library/sqlite3.rst:1374 msgid "" "``True``: Use SQLite's `autocommit mode`_. :meth:`commit` and :meth:" "`rollback` have no effect in this mode." msgstr "" -#: ../../library/sqlite3.rst:1337 +#: ../../library/sqlite3.rst:1377 msgid "" ":data:`LEGACY_TRANSACTION_CONTROL`: Pre-Python 3.12 (non-:pep:`249`-" "compliant) transaction control. See :attr:`isolation_level` for more details." msgstr "" -#: ../../library/sqlite3.rst:1341 +#: ../../library/sqlite3.rst:1381 msgid "This is currently the default value of :attr:`!autocommit`." msgstr "" -#: ../../library/sqlite3.rst:1343 +#: ../../library/sqlite3.rst:1383 msgid "" "Changing :attr:`!autocommit` to ``False`` will open a new transaction, and " "changing it to ``True`` will commit any pending transaction." msgstr "" -#: ../../library/sqlite3.rst:1346 +#: ../../library/sqlite3.rst:1386 msgid "See :ref:`sqlite3-transaction-control-autocommit` for more details." msgstr "更多詳情請見 :ref:`sqlite3-transaction-control-autocommit`。" -#: ../../library/sqlite3.rst:1350 +#: ../../library/sqlite3.rst:1390 msgid "" "The :attr:`isolation_level` attribute has no effect unless :attr:" "`autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`." msgstr "" -#: ../../library/sqlite3.rst:1357 +#: ../../library/sqlite3.rst:1397 msgid "" "This read-only attribute corresponds to the low-level SQLite `autocommit " "mode`_." msgstr "" -#: ../../library/sqlite3.rst:1360 +#: ../../library/sqlite3.rst:1400 msgid "" "``True`` if a transaction is active (there are uncommitted changes), " "``False`` otherwise." msgstr "" -#: ../../library/sqlite3.rst:1367 +#: ../../library/sqlite3.rst:1407 msgid "" "Controls the :ref:`legacy transaction handling mode ` of :mod:`!sqlite3`. If set to ``None``, " @@ -1746,13 +1796,13 @@ msgid "" "` is performed." msgstr "" -#: ../../library/sqlite3.rst:1375 +#: ../../library/sqlite3.rst:1415 msgid "" "If not overridden by the *isolation_level* parameter of :func:`connect`, the " "default is ``\"\"``, which is an alias for ``\"DEFERRED\"``." msgstr "" -#: ../../library/sqlite3.rst:1380 +#: ../../library/sqlite3.rst:1420 msgid "" "Using :attr:`autocommit` to control transaction handling is recommended over " "using :attr:`!isolation_level`. :attr:`!isolation_level` has no effect " @@ -1760,7 +1810,7 @@ msgid "" "default)." msgstr "" -#: ../../library/sqlite3.rst:1387 +#: ../../library/sqlite3.rst:1427 msgid "" "The initial :attr:`~Cursor.row_factory` for :class:`Cursor` objects created " "from this connection. Assigning to this attribute does not affect the :attr:" @@ -1769,33 +1819,33 @@ msgid "" "`tuple`." msgstr "" -#: ../../library/sqlite3.rst:1394 ../../library/sqlite3.rst:1680 -#: ../../library/sqlite3.rst:1703 +#: ../../library/sqlite3.rst:1434 ../../library/sqlite3.rst:1720 +#: ../../library/sqlite3.rst:1743 msgid "See :ref:`sqlite3-howto-row-factory` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-row-factory`。" -#: ../../library/sqlite3.rst:1398 +#: ../../library/sqlite3.rst:1438 msgid "" "A :term:`callable` that accepts a :class:`bytes` parameter and returns a " "text representation of it. The callable is invoked for SQLite values with " "the ``TEXT`` data type. By default, this attribute is set to :class:`str`." msgstr "" -#: ../../library/sqlite3.rst:1403 +#: ../../library/sqlite3.rst:1443 msgid "See :ref:`sqlite3-howto-encoding` for more details." msgstr "更多詳情請見 :ref:`sqlite3-howto-encoding`。" -#: ../../library/sqlite3.rst:1407 +#: ../../library/sqlite3.rst:1447 msgid "" "Return the total number of database rows that have been modified, inserted, " "or deleted since the database connection was opened." msgstr "" -#: ../../library/sqlite3.rst:1414 +#: ../../library/sqlite3.rst:1454 msgid "Cursor objects" msgstr "Cursor 物件" -#: ../../library/sqlite3.rst:1416 +#: ../../library/sqlite3.rst:1456 msgid "" "A ``Cursor`` object represents a `database cursor`_ which is used to execute " "SQL statements, and manage the context of a fetch operation. Cursors are " @@ -1803,14 +1853,14 @@ msgid "" "`connection shortcut methods `." msgstr "" -#: ../../library/sqlite3.rst:1423 +#: ../../library/sqlite3.rst:1463 msgid "" "Cursor objects are :term:`iterators `, meaning that if you :meth:" "`~Cursor.execute` a ``SELECT`` query, you can simply iterate over the cursor " "to fetch the resulting rows:" msgstr "" -#: ../../library/sqlite3.rst:1434 +#: ../../library/sqlite3.rst:1474 msgid "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" @@ -1818,32 +1868,32 @@ msgstr "" "for row in cur.execute(\"SELECT t FROM data\"):\n" " print(row)" -#: ../../library/sqlite3.rst:1448 +#: ../../library/sqlite3.rst:1488 msgid "A :class:`Cursor` instance has the following attributes and methods." msgstr "" -#: ../../library/sqlite3.rst:1455 +#: ../../library/sqlite3.rst:1495 msgid "" "Execute a single SQL statement, optionally binding Python values using :ref:" "`placeholders `." msgstr "" -#: ../../library/sqlite3.rst:1459 +#: ../../library/sqlite3.rst:1499 msgid "A single SQL statement." msgstr "單一個 SQL 陳述式。" -#: ../../library/sqlite3.rst:1462 +#: ../../library/sqlite3.rst:1502 msgid "" "Python values to bind to placeholders in *sql*. A :class:`!dict` if named " "placeholders are used. A :term:`!sequence` if unnamed placeholders are used. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1469 +#: ../../library/sqlite3.rst:1509 msgid "If *sql* contains more than one SQL statement." msgstr "" -#: ../../library/sqlite3.rst:1472 +#: ../../library/sqlite3.rst:1512 msgid "" "If :attr:`~Connection.autocommit` is :data:`LEGACY_TRANSACTION_CONTROL`, :" "attr:`~Connection.isolation_level` is not ``None``, *sql* is an ``INSERT``, " @@ -1851,7 +1901,7 @@ msgid "" "transaction, a transaction is implicitly opened before executing *sql*." msgstr "" -#: ../../library/sqlite3.rst:1481 +#: ../../library/sqlite3.rst:1521 msgid "" ":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and *parameters* is a sequence instead of a :class:" @@ -1859,37 +1909,37 @@ msgid "" "instead." msgstr "" -#: ../../library/sqlite3.rst:1487 +#: ../../library/sqlite3.rst:1527 msgid "Use :meth:`executescript` to execute multiple SQL statements." msgstr "" -#: ../../library/sqlite3.rst:1491 +#: ../../library/sqlite3.rst:1531 msgid "" "For every item in *parameters*, repeatedly execute the :ref:`parameterized " "` :abbr:`DML (Data Manipulation Language)` SQL " "statement *sql*." msgstr "" -#: ../../library/sqlite3.rst:1495 +#: ../../library/sqlite3.rst:1535 msgid "Uses the same implicit transaction handling as :meth:`~Cursor.execute`." msgstr "" -#: ../../library/sqlite3.rst:1497 +#: ../../library/sqlite3.rst:1537 msgid "A single SQL DML statement." msgstr "" -#: ../../library/sqlite3.rst:1500 +#: ../../library/sqlite3.rst:1540 msgid "" "An :term:`!iterable` of parameters to bind with the placeholders in *sql*. " "See :ref:`sqlite3-placeholders`." msgstr "" -#: ../../library/sqlite3.rst:1506 +#: ../../library/sqlite3.rst:1546 msgid "" "If *sql* contains more than one SQL statement, or is not a DML statement." msgstr "" -#: ../../library/sqlite3.rst:1512 +#: ../../library/sqlite3.rst:1552 msgid "" "rows = [\n" " (\"row1\",),\n" @@ -1905,13 +1955,13 @@ msgstr "" "# cur 是一個 sqlite3.Cursor 物件\n" "cur.executemany(\"INSERT INTO data VALUES(?)\", rows)" -#: ../../library/sqlite3.rst:1527 +#: ../../library/sqlite3.rst:1567 msgid "" "Any resulting rows are discarded, including DML statements with `RETURNING " "clauses`_." msgstr "" -#: ../../library/sqlite3.rst:1534 +#: ../../library/sqlite3.rst:1574 msgid "" ":exc:`DeprecationWarning` is emitted if :ref:`named placeholders ` are used and the items in *parameters* are sequences instead " @@ -1919,7 +1969,7 @@ msgid "" "be raised instead." msgstr "" -#: ../../library/sqlite3.rst:1543 +#: ../../library/sqlite3.rst:1583 msgid "" "Execute the SQL statements in *sql_script*. If the :attr:`~Connection." "autocommit` is :data:`LEGACY_TRANSACTION_CONTROL` and there is a pending " @@ -1928,11 +1978,11 @@ msgid "" "added to *sql_script*." msgstr "" -#: ../../library/sqlite3.rst:1551 +#: ../../library/sqlite3.rst:1591 msgid "*sql_script* must be a :class:`string `." msgstr "" -#: ../../library/sqlite3.rst:1555 +#: ../../library/sqlite3.rst:1595 msgid "" "# cur is an sqlite3.Cursor object\n" "cur.executescript(\"\"\"\n" @@ -1952,20 +2002,20 @@ msgstr "" " COMMIT;\n" "\"\"\")" -#: ../../library/sqlite3.rst:1568 +#: ../../library/sqlite3.rst:1608 msgid "" "If :attr:`~Cursor.row_factory` is ``None``, return the next row query result " "set as a :class:`tuple`. Else, pass it to the row factory and return its " "result. Return ``None`` if no more data is available." msgstr "" -#: ../../library/sqlite3.rst:1576 +#: ../../library/sqlite3.rst:1616 msgid "" "Return the next set of rows of a query result as a :class:`list`. Return an " "empty list if no more rows are available." msgstr "" -#: ../../library/sqlite3.rst:1579 +#: ../../library/sqlite3.rst:1619 msgid "" "The number of rows to fetch per call is specified by the *size* parameter. " "If *size* is not given, :attr:`arraysize` determines the number of rows to " @@ -1973,7 +2023,7 @@ msgid "" "available are returned." msgstr "" -#: ../../library/sqlite3.rst:1585 +#: ../../library/sqlite3.rst:1625 msgid "" "Note there are performance considerations involved with the *size* " "parameter. For optimal performance, it is usually best to use the arraysize " @@ -1981,36 +2031,36 @@ msgid "" "the same value from one :meth:`fetchmany` call to the next." msgstr "" -#: ../../library/sqlite3.rst:1592 +#: ../../library/sqlite3.rst:1632 msgid "" "Return all (remaining) rows of a query result as a :class:`list`. Return an " "empty list if no rows are available. Note that the :attr:`arraysize` " "attribute can affect the performance of this operation." msgstr "" -#: ../../library/sqlite3.rst:1599 +#: ../../library/sqlite3.rst:1639 msgid "Close the cursor now (rather than whenever ``__del__`` is called)." msgstr "" -#: ../../library/sqlite3.rst:1601 +#: ../../library/sqlite3.rst:1641 msgid "" "The cursor will be unusable from this point forward; a :exc:" "`ProgrammingError` exception will be raised if any operation is attempted " "with the cursor." msgstr "" -#: ../../library/sqlite3.rst:1606 ../../library/sqlite3.rst:1610 +#: ../../library/sqlite3.rst:1646 ../../library/sqlite3.rst:1650 msgid "Required by the DB-API. Does nothing in :mod:`!sqlite3`." msgstr "" -#: ../../library/sqlite3.rst:1614 +#: ../../library/sqlite3.rst:1654 msgid "" "Read/write attribute that controls the number of rows returned by :meth:" "`fetchmany`. The default value is 1 which means a single row would be " "fetched per call." msgstr "" -#: ../../library/sqlite3.rst:1619 +#: ../../library/sqlite3.rst:1659 msgid "" "Read-only attribute that provides the SQLite database :class:`Connection` " "belonging to the cursor. A :class:`Cursor` object created by calling :meth:" @@ -2018,7 +2068,7 @@ msgid "" "that refers to *con*:" msgstr "" -#: ../../library/sqlite3.rst:1624 +#: ../../library/sqlite3.rst:1664 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> cur = con.cursor()\n" @@ -2032,18 +2082,18 @@ msgstr "" "True\n" ">>> con.close()" -#: ../../library/sqlite3.rst:1634 +#: ../../library/sqlite3.rst:1674 msgid "" "Read-only attribute that provides the column names of the last query. To " "remain compatible with the Python DB API, it returns a 7-tuple for each " "column where the last six items of each tuple are ``None``." msgstr "" -#: ../../library/sqlite3.rst:1638 +#: ../../library/sqlite3.rst:1678 msgid "It is set for ``SELECT`` statements without any matching rows as well." msgstr "" -#: ../../library/sqlite3.rst:1642 +#: ../../library/sqlite3.rst:1682 msgid "" "Read-only attribute that provides the row id of the last inserted row. It is " "only updated after successful ``INSERT`` or ``REPLACE`` statements using " @@ -2053,15 +2103,15 @@ msgid "" "``None``." msgstr "" -#: ../../library/sqlite3.rst:1650 +#: ../../library/sqlite3.rst:1690 msgid "Inserts into ``WITHOUT ROWID`` tables are not recorded." msgstr "" -#: ../../library/sqlite3.rst:1652 +#: ../../library/sqlite3.rst:1692 msgid "Added support for the ``REPLACE`` statement." msgstr "新增 ``REPLACE`` 陳述式的支援。" -#: ../../library/sqlite3.rst:1657 +#: ../../library/sqlite3.rst:1697 msgid "" "Read-only attribute that provides the number of modified rows for " "``INSERT``, ``UPDATE``, ``DELETE``, and ``REPLACE`` statements; is ``-1`` " @@ -2071,7 +2121,7 @@ msgid "" "resulting rows must be fetched in order for :attr:`!rowcount` to be updated." msgstr "" -#: ../../library/sqlite3.rst:1668 +#: ../../library/sqlite3.rst:1708 msgid "" "Control how a row fetched from this :class:`!Cursor` is represented. If " "``None``, a row is represented as a :class:`tuple`. Can be set to the " @@ -2080,18 +2130,18 @@ msgid "" "and returns a custom object representing an SQLite row." msgstr "" -#: ../../library/sqlite3.rst:1675 +#: ../../library/sqlite3.rst:1715 msgid "" "Defaults to what :attr:`Connection.row_factory` was set to when the :class:`!" "Cursor` was created. Assigning to this attribute does not affect :attr:" "`Connection.row_factory` of the parent connection." msgstr "" -#: ../../library/sqlite3.rst:1691 +#: ../../library/sqlite3.rst:1731 msgid "Row objects" msgstr "Row 物件" -#: ../../library/sqlite3.rst:1695 +#: ../../library/sqlite3.rst:1735 msgid "" "A :class:`!Row` instance serves as a highly optimized :attr:`~Connection." "row_factory` for :class:`Connection` objects. It supports iteration, " @@ -2099,28 +2149,28 @@ msgid "" "index." msgstr "" -#: ../../library/sqlite3.rst:1700 +#: ../../library/sqlite3.rst:1740 msgid "" "Two :class:`!Row` objects compare equal if they have identical column names " "and values." msgstr "" -#: ../../library/sqlite3.rst:1707 +#: ../../library/sqlite3.rst:1747 msgid "" "Return a :class:`list` of column names as :class:`strings `. " "Immediately after a query, it is the first member of each tuple in :attr:" "`Cursor.description`." msgstr "" -#: ../../library/sqlite3.rst:1711 +#: ../../library/sqlite3.rst:1751 msgid "Added support of slicing." msgstr "新增對切片的支援。" -#: ../../library/sqlite3.rst:1718 +#: ../../library/sqlite3.rst:1758 msgid "Blob objects" msgstr "Blob 物件" -#: ../../library/sqlite3.rst:1724 +#: ../../library/sqlite3.rst:1764 msgid "" "A :class:`Blob` instance is a :term:`file-like object` that can read and " "write data in an SQLite :abbr:`BLOB (Binary Large OBject)`. Call :func:" @@ -2128,13 +2178,13 @@ msgid "" "and :term:`slices ` for direct access to the blob data." msgstr "" -#: ../../library/sqlite3.rst:1729 +#: ../../library/sqlite3.rst:1769 msgid "" "Use the :class:`Blob` as a :term:`context manager` to ensure that the blob " "handle is closed after use." msgstr "" -#: ../../library/sqlite3.rst:1732 +#: ../../library/sqlite3.rst:1772 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE test(blob_col blob)\")\n" @@ -2156,18 +2206,18 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:1760 +#: ../../library/sqlite3.rst:1800 msgid "Close the blob." msgstr "" -#: ../../library/sqlite3.rst:1762 +#: ../../library/sqlite3.rst:1802 msgid "" "The blob will be unusable from this point onward. An :class:`~sqlite3." "Error` (or subclass) exception will be raised if any further operation is " "attempted with the blob." msgstr "" -#: ../../library/sqlite3.rst:1768 +#: ../../library/sqlite3.rst:1808 msgid "" "Read *length* bytes of data from the blob at the current offset position. If " "the end of the blob is reached, the data up to :abbr:`EOF (End of File)` " @@ -2175,18 +2225,18 @@ msgid "" "`~Blob.read` will read until the end of the blob." msgstr "" -#: ../../library/sqlite3.rst:1776 +#: ../../library/sqlite3.rst:1816 msgid "" "Write *data* to the blob at the current offset. This function cannot change " "the blob length. Writing beyond the end of the blob will raise :exc:" "`ValueError`." msgstr "" -#: ../../library/sqlite3.rst:1782 +#: ../../library/sqlite3.rst:1822 msgid "Return the current access position of the blob." msgstr "" -#: ../../library/sqlite3.rst:1786 +#: ../../library/sqlite3.rst:1826 msgid "" "Set the current access position of the blob to *offset*. The *origin* " "argument defaults to :const:`os.SEEK_SET` (absolute blob positioning). Other " @@ -2194,26 +2244,26 @@ msgid "" "position) and :const:`os.SEEK_END` (seek relative to the blob’s end)." msgstr "" -#: ../../library/sqlite3.rst:1794 +#: ../../library/sqlite3.rst:1834 msgid "PrepareProtocol objects" msgstr "PrepareProtocol 物件" -#: ../../library/sqlite3.rst:1798 +#: ../../library/sqlite3.rst:1838 msgid "" "The PrepareProtocol type's single purpose is to act as a :pep:`246` style " "adaption protocol for objects that can :ref:`adapt themselves ` to :ref:`native SQLite types `." msgstr "" -#: ../../library/sqlite3.rst:1806 +#: ../../library/sqlite3.rst:1846 msgid "Exceptions" msgstr "例外" -#: ../../library/sqlite3.rst:1808 +#: ../../library/sqlite3.rst:1848 msgid "The exception hierarchy is defined by the DB-API 2.0 (:pep:`249`)." msgstr "" -#: ../../library/sqlite3.rst:1812 +#: ../../library/sqlite3.rst:1852 msgid "" "This exception is not currently raised by the :mod:`!sqlite3` module, but " "may be raised by applications using :mod:`!sqlite3`, for example if a user-" @@ -2221,39 +2271,39 @@ msgid "" "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1819 +#: ../../library/sqlite3.rst:1859 msgid "" "The base class of the other exceptions in this module. Use this to catch all " "errors with one single :keyword:`except` statement. ``Error`` is a subclass " "of :exc:`Exception`." msgstr "" -#: ../../library/sqlite3.rst:1823 +#: ../../library/sqlite3.rst:1863 msgid "" "If the exception originated from within the SQLite library, the following " "two attributes are added to the exception:" msgstr "" -#: ../../library/sqlite3.rst:1828 +#: ../../library/sqlite3.rst:1868 msgid "" "The numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1835 +#: ../../library/sqlite3.rst:1875 msgid "" "The symbolic name of the numeric error code from the `SQLite API `_" msgstr "" -#: ../../library/sqlite3.rst:1842 +#: ../../library/sqlite3.rst:1882 msgid "" "Exception raised for misuse of the low-level SQLite C API. In other words, " "if this exception is raised, it probably indicates a bug in the :mod:`!" "sqlite3` module. ``InterfaceError`` is a subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1849 +#: ../../library/sqlite3.rst:1889 msgid "" "Exception raised for errors that are related to the database. This serves as " "the base exception for several types of database errors. It is only raised " @@ -2261,14 +2311,14 @@ msgid "" "subclass of :exc:`Error`." msgstr "" -#: ../../library/sqlite3.rst:1856 +#: ../../library/sqlite3.rst:1896 msgid "" "Exception raised for errors caused by problems with the processed data, like " "numeric values out of range, and strings which are too long. ``DataError`` " "is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1862 +#: ../../library/sqlite3.rst:1902 msgid "" "Exception raised for errors that are related to the database's operation, " "and not necessarily under the control of the programmer. For example, the " @@ -2276,20 +2326,20 @@ msgid "" "``OperationalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1870 +#: ../../library/sqlite3.rst:1910 msgid "" "Exception raised when the relational integrity of the database is affected, " "e.g. a foreign key check fails. It is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1875 +#: ../../library/sqlite3.rst:1915 msgid "" "Exception raised when SQLite encounters an internal error. If this is " "raised, it may indicate that there is a problem with the runtime SQLite " "library. ``InternalError`` is a subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1882 +#: ../../library/sqlite3.rst:1922 msgid "" "Exception raised for :mod:`!sqlite3` API programming errors, for example " "supplying the wrong number of bindings to a query, or trying to operate on a " @@ -2297,7 +2347,7 @@ msgid "" "`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1889 +#: ../../library/sqlite3.rst:1929 msgid "" "Exception raised in case a method or database API is not supported by the " "underlying SQLite library. For example, setting *deterministic* to ``True`` " @@ -2306,78 +2356,78 @@ msgid "" "subclass of :exc:`DatabaseError`." msgstr "" -#: ../../library/sqlite3.rst:1899 +#: ../../library/sqlite3.rst:1939 msgid "SQLite and Python types" msgstr "" -#: ../../library/sqlite3.rst:1901 +#: ../../library/sqlite3.rst:1941 msgid "" "SQLite natively supports the following types: ``NULL``, ``INTEGER``, " "``REAL``, ``TEXT``, ``BLOB``." msgstr "" -#: ../../library/sqlite3.rst:1904 +#: ../../library/sqlite3.rst:1944 msgid "" "The following Python types can thus be sent to SQLite without any problem:" msgstr "" -#: ../../library/sqlite3.rst:1907 ../../library/sqlite3.rst:1924 +#: ../../library/sqlite3.rst:1947 ../../library/sqlite3.rst:1964 msgid "Python type" msgstr "" -#: ../../library/sqlite3.rst:1907 ../../library/sqlite3.rst:1924 +#: ../../library/sqlite3.rst:1947 ../../library/sqlite3.rst:1964 msgid "SQLite type" msgstr "" -#: ../../library/sqlite3.rst:1909 ../../library/sqlite3.rst:1926 +#: ../../library/sqlite3.rst:1949 ../../library/sqlite3.rst:1966 msgid "``None``" msgstr "``None``" -#: ../../library/sqlite3.rst:1909 ../../library/sqlite3.rst:1926 +#: ../../library/sqlite3.rst:1949 ../../library/sqlite3.rst:1966 msgid "``NULL``" msgstr "``NULL``" -#: ../../library/sqlite3.rst:1911 ../../library/sqlite3.rst:1928 +#: ../../library/sqlite3.rst:1951 ../../library/sqlite3.rst:1968 msgid ":class:`int`" msgstr ":class:`int`" -#: ../../library/sqlite3.rst:1911 ../../library/sqlite3.rst:1928 +#: ../../library/sqlite3.rst:1951 ../../library/sqlite3.rst:1968 msgid "``INTEGER``" msgstr "``INTEGER``" -#: ../../library/sqlite3.rst:1913 ../../library/sqlite3.rst:1930 +#: ../../library/sqlite3.rst:1953 ../../library/sqlite3.rst:1970 msgid ":class:`float`" msgstr ":class:`float`" -#: ../../library/sqlite3.rst:1913 ../../library/sqlite3.rst:1930 +#: ../../library/sqlite3.rst:1953 ../../library/sqlite3.rst:1970 msgid "``REAL``" msgstr "``REAL``" -#: ../../library/sqlite3.rst:1915 +#: ../../library/sqlite3.rst:1955 msgid ":class:`str`" msgstr ":class:`str`" -#: ../../library/sqlite3.rst:1915 ../../library/sqlite3.rst:1932 +#: ../../library/sqlite3.rst:1955 ../../library/sqlite3.rst:1972 msgid "``TEXT``" msgstr "``TEXT``" -#: ../../library/sqlite3.rst:1917 ../../library/sqlite3.rst:1935 +#: ../../library/sqlite3.rst:1957 ../../library/sqlite3.rst:1975 msgid ":class:`bytes`" msgstr ":class:`bytes`" -#: ../../library/sqlite3.rst:1917 ../../library/sqlite3.rst:1935 +#: ../../library/sqlite3.rst:1957 ../../library/sqlite3.rst:1975 msgid "``BLOB``" msgstr "``BLOB``" -#: ../../library/sqlite3.rst:1921 +#: ../../library/sqlite3.rst:1961 msgid "This is how SQLite types are converted to Python types by default:" msgstr "" -#: ../../library/sqlite3.rst:1932 +#: ../../library/sqlite3.rst:1972 msgid "depends on :attr:`~Connection.text_factory`, :class:`str` by default" msgstr "" -#: ../../library/sqlite3.rst:1938 +#: ../../library/sqlite3.rst:1978 msgid "" "The type system of the :mod:`!sqlite3` module is extensible in two ways: you " "can store additional Python types in an SQLite database via :ref:`object " @@ -2386,47 +2436,47 @@ msgid "" "converters>`." msgstr "" -#: ../../library/sqlite3.rst:1948 +#: ../../library/sqlite3.rst:1988 msgid "Default adapters and converters (deprecated)" msgstr "" -#: ../../library/sqlite3.rst:1952 +#: ../../library/sqlite3.rst:1992 msgid "" "The default adapters and converters are deprecated as of Python 3.12. " "Instead, use the :ref:`sqlite3-adapter-converter-recipes` and tailor them to " "your needs." msgstr "" -#: ../../library/sqlite3.rst:1956 +#: ../../library/sqlite3.rst:1996 msgid "The deprecated default adapters and converters consist of:" msgstr "" -#: ../../library/sqlite3.rst:1958 +#: ../../library/sqlite3.rst:1998 msgid "" "An adapter for :class:`datetime.date` objects to :class:`strings ` in " "`ISO 8601`_ format." msgstr "" -#: ../../library/sqlite3.rst:1960 +#: ../../library/sqlite3.rst:2000 msgid "" "An adapter for :class:`datetime.datetime` objects to strings in ISO 8601 " "format." msgstr "" -#: ../../library/sqlite3.rst:1962 +#: ../../library/sqlite3.rst:2002 msgid "" "A converter for :ref:`declared ` \"date\" types to :" "class:`datetime.date` objects." msgstr "" -#: ../../library/sqlite3.rst:1964 +#: ../../library/sqlite3.rst:2004 msgid "" "A converter for declared \"timestamp\" types to :class:`datetime.datetime` " "objects. Fractional parts will be truncated to 6 digits (microsecond " "precision)." msgstr "" -#: ../../library/sqlite3.rst:1970 +#: ../../library/sqlite3.rst:2010 msgid "" "The default \"timestamp\" converter ignores UTC offsets in the database and " "always returns a naive :class:`datetime.datetime` object. To preserve UTC " @@ -2434,42 +2484,42 @@ msgid "" "offset-aware converter with :func:`register_converter`." msgstr "" -#: ../../library/sqlite3.rst:1983 +#: ../../library/sqlite3.rst:2023 msgid "Command-line interface" msgstr "命令列介面" -#: ../../library/sqlite3.rst:1985 +#: ../../library/sqlite3.rst:2025 msgid "" "The :mod:`!sqlite3` module can be invoked as a script, using the " "interpreter's :option:`-m` switch, in order to provide a simple SQLite " "shell. The argument signature is as follows::" msgstr "" -#: ../../library/sqlite3.rst:1990 +#: ../../library/sqlite3.rst:2030 msgid "python -m sqlite3 [-h] [-v] [filename] [sql]" msgstr "python -m sqlite3 [-h] [-v] [filename] [sql]" -#: ../../library/sqlite3.rst:1992 +#: ../../library/sqlite3.rst:2032 msgid "Type ``.quit`` or CTRL-D to exit the shell." msgstr "" -#: ../../library/sqlite3.rst:1998 +#: ../../library/sqlite3.rst:2038 msgid "Print CLI help." msgstr "" -#: ../../library/sqlite3.rst:2002 +#: ../../library/sqlite3.rst:2042 msgid "Print underlying SQLite library version." msgstr "" -#: ../../library/sqlite3.rst:2010 +#: ../../library/sqlite3.rst:2050 msgid "How-to guides" msgstr "" -#: ../../library/sqlite3.rst:2015 +#: ../../library/sqlite3.rst:2055 msgid "How to use placeholders to bind values in SQL queries" msgstr "" -#: ../../library/sqlite3.rst:2017 +#: ../../library/sqlite3.rst:2057 msgid "" "SQL operations usually need to use values from Python variables. However, " "beware of using Python's string operations to assemble queries, as they are " @@ -2477,7 +2527,7 @@ msgid "" "close the single quote and inject ``OR TRUE`` to select all rows::" msgstr "" -#: ../../library/sqlite3.rst:2022 +#: ../../library/sqlite3.rst:2062 msgid "" ">>> # Never do this -- insecure!\n" ">>> symbol = input()\n" @@ -2488,7 +2538,7 @@ msgid "" ">>> cur.execute(sql)" msgstr "" -#: ../../library/sqlite3.rst:2030 +#: ../../library/sqlite3.rst:2070 msgid "" "Instead, use the DB-API's parameter substitution. To insert a variable into " "a query string, use a placeholder in the string, and substitute the actual " @@ -2496,7 +2546,7 @@ msgid "" "second argument of the cursor's :meth:`~Cursor.execute` method." msgstr "" -#: ../../library/sqlite3.rst:2035 +#: ../../library/sqlite3.rst:2075 msgid "" "An SQL statement may use one of two kinds of placeholders: question marks " "(qmark style) or named placeholders (named style). For the qmark style, " @@ -2507,7 +2557,7 @@ msgid "" "ignored. Here's an example of both styles:" msgstr "" -#: ../../library/sqlite3.rst:2046 +#: ../../library/sqlite3.rst:2086 msgid "" "con = sqlite3.connect(\":memory:\")\n" "cur = con.execute(\"CREATE TABLE lang(name, first_appeared)\")\n" @@ -2528,24 +2578,24 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2073 +#: ../../library/sqlite3.rst:2113 msgid "" ":pep:`249` numeric placeholders are *not* supported. If used, they will be " "interpreted as named placeholders." msgstr "" -#: ../../library/sqlite3.rst:2080 +#: ../../library/sqlite3.rst:2120 msgid "How to adapt custom Python types to SQLite values" msgstr "" -#: ../../library/sqlite3.rst:2082 +#: ../../library/sqlite3.rst:2122 msgid "" "SQLite supports only a limited set of data types natively. To store custom " "Python types in SQLite databases, *adapt* them to one of the :ref:`Python " "types SQLite natively understands `." msgstr "" -#: ../../library/sqlite3.rst:2086 +#: ../../library/sqlite3.rst:2126 msgid "" "There are two ways to adapt Python objects to SQLite types: letting your " "object adapt itself, or using an *adapter callable*. The latter will take " @@ -2555,11 +2605,11 @@ msgid "" "custom adapter functions." msgstr "" -#: ../../library/sqlite3.rst:2098 +#: ../../library/sqlite3.rst:2138 msgid "How to write adaptable objects" msgstr "" -#: ../../library/sqlite3.rst:2100 +#: ../../library/sqlite3.rst:2140 msgid "" "Suppose we have a :class:`!Point` class that represents a pair of " "coordinates, ``x`` and ``y``, in a Cartesian coordinate system. The " @@ -2569,7 +2619,7 @@ msgid "" "object passed to *protocol* will be of type :class:`PrepareProtocol`." msgstr "" -#: ../../library/sqlite3.rst:2108 +#: ../../library/sqlite3.rst:2148 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2601,18 +2651,18 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2132 +#: ../../library/sqlite3.rst:2172 msgid "How to register adapter callables" msgstr "" -#: ../../library/sqlite3.rst:2134 +#: ../../library/sqlite3.rst:2174 msgid "" "The other possibility is to create a function that converts the Python " "object to an SQLite-compatible type. This function can then be registered " "using :func:`register_adapter`." msgstr "" -#: ../../library/sqlite3.rst:2138 +#: ../../library/sqlite3.rst:2178 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2646,36 +2696,36 @@ msgstr "" "print(cur.fetchone()[0])\n" "con.close()" -#: ../../library/sqlite3.rst:2165 +#: ../../library/sqlite3.rst:2205 msgid "How to convert SQLite values to custom Python types" msgstr "" -#: ../../library/sqlite3.rst:2167 +#: ../../library/sqlite3.rst:2207 msgid "" "Writing an adapter lets you convert *from* custom Python types *to* SQLite " "values. To be able to convert *from* SQLite values *to* custom Python types, " "we use *converters*." msgstr "" -#: ../../library/sqlite3.rst:2172 +#: ../../library/sqlite3.rst:2212 msgid "" "Let's go back to the :class:`!Point` class. We stored the x and y " "coordinates separated via semicolons as strings in SQLite." msgstr "" -#: ../../library/sqlite3.rst:2175 +#: ../../library/sqlite3.rst:2215 msgid "" "First, we'll define a converter function that accepts the string as a " "parameter and constructs a :class:`!Point` object from it." msgstr "" -#: ../../library/sqlite3.rst:2180 +#: ../../library/sqlite3.rst:2220 msgid "" "Converter functions are **always** passed a :class:`bytes` object, no matter " "the underlying SQLite data type." msgstr "" -#: ../../library/sqlite3.rst:2183 +#: ../../library/sqlite3.rst:2223 msgid "" "def convert_point(s):\n" " x, y = map(float, s.split(b\";\"))\n" @@ -2685,32 +2735,32 @@ msgstr "" " x, y = map(float, s.split(b\";\"))\n" " return Point(x, y)" -#: ../../library/sqlite3.rst:2189 +#: ../../library/sqlite3.rst:2229 msgid "" "We now need to tell :mod:`!sqlite3` when it should convert a given SQLite " "value. This is done when connecting to a database, using the *detect_types* " "parameter of :func:`connect`. There are three options:" msgstr "" -#: ../../library/sqlite3.rst:2193 +#: ../../library/sqlite3.rst:2233 msgid "Implicit: set *detect_types* to :const:`PARSE_DECLTYPES`" msgstr "" -#: ../../library/sqlite3.rst:2194 +#: ../../library/sqlite3.rst:2234 msgid "Explicit: set *detect_types* to :const:`PARSE_COLNAMES`" msgstr "" -#: ../../library/sqlite3.rst:2195 +#: ../../library/sqlite3.rst:2235 msgid "" "Both: set *detect_types* to ``sqlite3.PARSE_DECLTYPES | sqlite3." "PARSE_COLNAMES``. Column names take precedence over declared types." msgstr "" -#: ../../library/sqlite3.rst:2199 +#: ../../library/sqlite3.rst:2239 msgid "The following example illustrates the implicit and explicit approaches:" msgstr "" -#: ../../library/sqlite3.rst:2201 +#: ../../library/sqlite3.rst:2241 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -2752,15 +2802,15 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2252 +#: ../../library/sqlite3.rst:2292 msgid "Adapter and converter recipes" msgstr "" -#: ../../library/sqlite3.rst:2254 +#: ../../library/sqlite3.rst:2294 msgid "This section shows recipes for common adapters and converters." msgstr "" -#: ../../library/sqlite3.rst:2256 +#: ../../library/sqlite3.rst:2296 msgid "" "import datetime\n" "import sqlite3\n" @@ -2798,11 +2848,11 @@ msgid "" "sqlite3.register_converter(\"timestamp\", convert_timestamp)" msgstr "" -#: ../../library/sqlite3.rst:2316 +#: ../../library/sqlite3.rst:2356 msgid "How to use connection shortcut methods" msgstr "" -#: ../../library/sqlite3.rst:2318 +#: ../../library/sqlite3.rst:2358 msgid "" "Using the :meth:`~Connection.execute`, :meth:`~Connection.executemany`, and :" "meth:`~Connection.executescript` methods of the :class:`Connection` class, " @@ -2814,7 +2864,7 @@ msgid "" "object." msgstr "" -#: ../../library/sqlite3.rst:2327 +#: ../../library/sqlite3.rst:2367 msgid "" "# Create and fill the table.\n" "con = sqlite3.connect(\":memory:\")\n" @@ -2838,11 +2888,11 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2359 +#: ../../library/sqlite3.rst:2399 msgid "How to use the connection context manager" msgstr "" -#: ../../library/sqlite3.rst:2361 +#: ../../library/sqlite3.rst:2401 msgid "" "A :class:`Connection` object can be used as a context manager that " "automatically commits or rolls back open transactions when leaving the body " @@ -2854,21 +2904,21 @@ msgid "" "rolling back." msgstr "" -#: ../../library/sqlite3.rst:2372 +#: ../../library/sqlite3.rst:2412 msgid "" "If there is no open transaction upon leaving the body of the ``with`` " "statement, or if :attr:`~Connection.autocommit` is ``True``, the context " "manager does nothing." msgstr "" -#: ../../library/sqlite3.rst:2377 +#: ../../library/sqlite3.rst:2417 msgid "" "The context manager neither implicitly opens a new transaction nor closes " "the connection. If you need a closing context manager, consider using :meth:" "`contextlib.closing`." msgstr "" -#: ../../library/sqlite3.rst:2381 +#: ../../library/sqlite3.rst:2421 msgid "" "con = sqlite3.connect(\":memory:\")\n" "con.execute(\"CREATE TABLE lang(id INTEGER PRIMARY KEY, name VARCHAR " @@ -2892,19 +2942,19 @@ msgid "" "con.close()" msgstr "" -#: ../../library/sqlite3.rst:2411 +#: ../../library/sqlite3.rst:2451 msgid "How to work with SQLite URIs" msgstr "" -#: ../../library/sqlite3.rst:2413 +#: ../../library/sqlite3.rst:2453 msgid "Some useful URI tricks include:" msgstr "" -#: ../../library/sqlite3.rst:2415 +#: ../../library/sqlite3.rst:2455 msgid "Open a database in read-only mode:" msgstr "" -#: ../../library/sqlite3.rst:2417 +#: ../../library/sqlite3.rst:2457 msgid "" ">>> con = sqlite3.connect(\"file:tutorial.db?mode=ro\", uri=True)\n" ">>> con.execute(\"CREATE TABLE readonly(data)\")\n" @@ -2916,13 +2966,13 @@ msgstr "" "Traceback (most recent call last):\n" "OperationalError: attempt to write a readonly database" -#: ../../library/sqlite3.rst:2424 +#: ../../library/sqlite3.rst:2464 msgid "" "Do not implicitly create a new database file if it does not already exist; " "will raise :exc:`~sqlite3.OperationalError` if unable to create a new file:" msgstr "" -#: ../../library/sqlite3.rst:2427 +#: ../../library/sqlite3.rst:2467 msgid "" ">>> con = sqlite3.connect(\"file:nosuchdb.db?mode=rw\", uri=True)\n" "Traceback (most recent call last):\n" @@ -2932,11 +2982,11 @@ msgstr "" "Traceback (most recent call last):\n" "OperationalError: unable to open database file" -#: ../../library/sqlite3.rst:2434 +#: ../../library/sqlite3.rst:2474 msgid "Create a shared named in-memory database:" msgstr "" -#: ../../library/sqlite3.rst:2436 +#: ../../library/sqlite3.rst:2476 msgid "" "db = \"file:mem1?mode=memory&cache=shared\"\n" "con1 = sqlite3.connect(db, uri=True)\n" @@ -2962,24 +3012,24 @@ msgstr "" "con1.close()\n" "con2.close()" -#: ../../library/sqlite3.rst:2450 +#: ../../library/sqlite3.rst:2490 msgid "" "More information about this feature, including a list of parameters, can be " "found in the `SQLite URI documentation`_." msgstr "" -#: ../../library/sqlite3.rst:2459 +#: ../../library/sqlite3.rst:2499 msgid "How to create and use row factories" msgstr "" -#: ../../library/sqlite3.rst:2461 +#: ../../library/sqlite3.rst:2501 msgid "" "By default, :mod:`!sqlite3` represents each row as a :class:`tuple`. If a :" "class:`!tuple` does not suit your needs, you can use the :class:`sqlite3." "Row` class or a custom :attr:`~Cursor.row_factory`." msgstr "" -#: ../../library/sqlite3.rst:2466 +#: ../../library/sqlite3.rst:2506 msgid "" "While :attr:`!row_factory` exists as an attribute both on the :class:" "`Cursor` and the :class:`Connection`, it is recommended to set :class:" @@ -2987,7 +3037,7 @@ msgid "" "use the same row factory." msgstr "" -#: ../../library/sqlite3.rst:2471 +#: ../../library/sqlite3.rst:2511 msgid "" ":class:`!Row` provides indexed and case-insensitive named access to columns, " "with minimal memory overhead and performance impact over a :class:`!tuple`. " @@ -2995,7 +3045,7 @@ msgid "" "attribute:" msgstr "" -#: ../../library/sqlite3.rst:2476 +#: ../../library/sqlite3.rst:2516 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" @@ -3003,11 +3053,11 @@ msgstr "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = sqlite3.Row" -#: ../../library/sqlite3.rst:2481 +#: ../../library/sqlite3.rst:2521 msgid "Queries now return :class:`!Row` objects:" msgstr "" -#: ../../library/sqlite3.rst:2483 +#: ../../library/sqlite3.rst:2523 msgid "" ">>> res = con.execute(\"SELECT 'Earth' AS name, 6378 AS radius\")\n" ">>> row = res.fetchone()\n" @@ -3022,7 +3072,7 @@ msgid "" ">>> con.close()" msgstr "" -#: ../../library/sqlite3.rst:2499 +#: ../../library/sqlite3.rst:2539 msgid "" "The ``FROM`` clause can be omitted in the ``SELECT`` statement, as in the " "above example. In such cases, SQLite returns a single row with columns " @@ -3030,13 +3080,13 @@ msgid "" "alias``." msgstr "" -#: ../../library/sqlite3.rst:2504 +#: ../../library/sqlite3.rst:2544 msgid "" "You can create a custom :attr:`~Cursor.row_factory` that returns each row as " "a :class:`dict`, with column names mapped to values:" msgstr "" -#: ../../library/sqlite3.rst:2507 +#: ../../library/sqlite3.rst:2547 msgid "" "def dict_factory(cursor, row):\n" " fields = [column[0] for column in cursor.description]\n" @@ -3046,12 +3096,12 @@ msgstr "" " fields = [column[0] for column in cursor.description]\n" " return {key: value for key, value in zip(fields, row)}" -#: ../../library/sqlite3.rst:2513 +#: ../../library/sqlite3.rst:2553 msgid "" "Using it, queries now return a :class:`!dict` instead of a :class:`!tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2515 +#: ../../library/sqlite3.rst:2555 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = dict_factory\n" @@ -3067,11 +3117,11 @@ msgstr "" "{'a': 1, 'b': 2}\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2524 +#: ../../library/sqlite3.rst:2564 msgid "The following row factory returns a :term:`named tuple`:" msgstr "" -#: ../../library/sqlite3.rst:2526 +#: ../../library/sqlite3.rst:2566 msgid "" "from collections import namedtuple\n" "\n" @@ -3087,11 +3137,11 @@ msgstr "" " cls = namedtuple(\"Row\", fields)\n" " return cls._make(row)" -#: ../../library/sqlite3.rst:2535 +#: ../../library/sqlite3.rst:2575 msgid ":func:`!namedtuple_factory` can be used as follows:" msgstr "" -#: ../../library/sqlite3.rst:2537 +#: ../../library/sqlite3.rst:2577 msgid "" ">>> con = sqlite3.connect(\":memory:\")\n" ">>> con.row_factory = namedtuple_factory\n" @@ -3117,18 +3167,18 @@ msgstr "" "2\n" ">>> con.close()" -#: ../../library/sqlite3.rst:2551 +#: ../../library/sqlite3.rst:2591 msgid "" "With some adjustments, the above recipe can be adapted to use a :class:" "`~dataclasses.dataclass`, or any other custom class, instead of a :class:" "`~collections.namedtuple`." msgstr "" -#: ../../library/sqlite3.rst:2559 +#: ../../library/sqlite3.rst:2599 msgid "How to handle non-UTF-8 text encodings" msgstr "" -#: ../../library/sqlite3.rst:2561 +#: ../../library/sqlite3.rst:2601 msgid "" "By default, :mod:`!sqlite3` uses :class:`str` to adapt SQLite values with " "the ``TEXT`` data type. This works well for UTF-8 encoded text, but it might " @@ -3136,7 +3186,7 @@ msgid "" "`~Connection.text_factory` to handle such cases." msgstr "" -#: ../../library/sqlite3.rst:2567 +#: ../../library/sqlite3.rst:2607 msgid "" "Because of SQLite's `flexible typing`_, it is not uncommon to encounter " "table columns with the ``TEXT`` data type containing non-UTF-8 encodings, or " @@ -3147,39 +3197,39 @@ msgid "" "text using this :attr:`~Connection.text_factory`:" msgstr "" -#: ../../library/sqlite3.rst:2576 +#: ../../library/sqlite3.rst:2616 msgid "con.text_factory = lambda data: str(data, encoding=\"latin2\")" msgstr "con.text_factory = lambda data: str(data, encoding=\"latin2\")" -#: ../../library/sqlite3.rst:2580 +#: ../../library/sqlite3.rst:2620 msgid "" "For invalid UTF-8 or arbitrary data in stored in ``TEXT`` table columns, you " "can use the following technique, borrowed from the :ref:`unicode-howto`:" msgstr "" -#: ../../library/sqlite3.rst:2583 +#: ../../library/sqlite3.rst:2623 msgid "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" msgstr "con.text_factory = lambda data: str(data, errors=\"surrogateescape\")" -#: ../../library/sqlite3.rst:2589 +#: ../../library/sqlite3.rst:2629 msgid "" "The :mod:`!sqlite3` module API does not support strings containing " "surrogates." msgstr "" -#: ../../library/sqlite3.rst:2594 +#: ../../library/sqlite3.rst:2634 msgid ":ref:`unicode-howto`" msgstr ":ref:`unicode-howto`" -#: ../../library/sqlite3.rst:2600 +#: ../../library/sqlite3.rst:2640 msgid "Explanation" msgstr "解釋" -#: ../../library/sqlite3.rst:2606 +#: ../../library/sqlite3.rst:2646 msgid "Transaction control" msgstr "" -#: ../../library/sqlite3.rst:2608 +#: ../../library/sqlite3.rst:2648 msgid "" ":mod:`!sqlite3` offers multiple methods of controlling whether, when and how " "database transactions are opened and closed. :ref:`sqlite3-transaction-" @@ -3187,24 +3237,24 @@ msgid "" "isolation-level` retains the pre-Python 3.12 behaviour." msgstr "" -#: ../../library/sqlite3.rst:2617 +#: ../../library/sqlite3.rst:2657 msgid "Transaction control via the ``autocommit`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2619 +#: ../../library/sqlite3.rst:2659 msgid "" "The recommended way of controlling transaction behaviour is through the :" "attr:`Connection.autocommit` attribute, which should preferably be set using " "the *autocommit* parameter of :func:`connect`." msgstr "" -#: ../../library/sqlite3.rst:2624 +#: ../../library/sqlite3.rst:2664 msgid "" "It is suggested to set *autocommit* to ``False``, which implies :pep:`249`-" "compliant transaction control. This means:" msgstr "" -#: ../../library/sqlite3.rst:2628 +#: ../../library/sqlite3.rst:2668 msgid "" ":mod:`!sqlite3` ensures that a transaction is always open, so :func:" "`connect`, :meth:`Connection.commit`, and :meth:`Connection.rollback` will " @@ -3213,21 +3263,21 @@ msgid "" "when opening transactions." msgstr "" -#: ../../library/sqlite3.rst:2633 +#: ../../library/sqlite3.rst:2673 msgid "Transactions should be committed explicitly using :meth:`!commit`." msgstr "" -#: ../../library/sqlite3.rst:2634 +#: ../../library/sqlite3.rst:2674 msgid "Transactions should be rolled back explicitly using :meth:`!rollback`." msgstr "" -#: ../../library/sqlite3.rst:2635 +#: ../../library/sqlite3.rst:2675 msgid "" "An implicit rollback is performed if the database is :meth:`~Connection." "close`-ed with pending changes." msgstr "" -#: ../../library/sqlite3.rst:2638 +#: ../../library/sqlite3.rst:2678 msgid "" "Set *autocommit* to ``True`` to enable SQLite's `autocommit mode`_. In this " "mode, :meth:`Connection.commit` and :meth:`Connection.rollback` have no " @@ -3236,25 +3286,25 @@ msgid "" "in_transaction` to query the low-level SQLite autocommit mode." msgstr "" -#: ../../library/sqlite3.rst:2646 +#: ../../library/sqlite3.rst:2686 msgid "" "Set *autocommit* to :data:`LEGACY_TRANSACTION_CONTROL` to leave transaction " "control behaviour to the :attr:`Connection.isolation_level` attribute. See :" "ref:`sqlite3-transaction-control-isolation-level` for more information." msgstr "" -#: ../../library/sqlite3.rst:2655 +#: ../../library/sqlite3.rst:2695 msgid "Transaction control via the ``isolation_level`` attribute" msgstr "" -#: ../../library/sqlite3.rst:2659 +#: ../../library/sqlite3.rst:2699 msgid "" "The recommended way of controlling transactions is via the :attr:" "`~Connection.autocommit` attribute. See :ref:`sqlite3-transaction-control-" "autocommit`." msgstr "" -#: ../../library/sqlite3.rst:2663 +#: ../../library/sqlite3.rst:2703 msgid "" "If :attr:`Connection.autocommit` is set to :data:" "`LEGACY_TRANSACTION_CONTROL` (the default), transaction behaviour is " @@ -3262,7 +3312,7 @@ msgid "" "Otherwise, :attr:`!isolation_level` has no effect." msgstr "" -#: ../../library/sqlite3.rst:2669 +#: ../../library/sqlite3.rst:2709 msgid "" "If the connection attribute :attr:`~Connection.isolation_level` is not " "``None``, new transactions are implicitly opened before :meth:`~Cursor." @@ -3276,7 +3326,7 @@ msgid "" "attribute." msgstr "" -#: ../../library/sqlite3.rst:2682 +#: ../../library/sqlite3.rst:2722 msgid "" "If :attr:`~Connection.isolation_level` is set to ``None``, no transactions " "are implicitly opened at all. This leaves the underlying SQLite library in " @@ -3286,34 +3336,34 @@ msgid "" "in_transaction` attribute." msgstr "" -#: ../../library/sqlite3.rst:2690 +#: ../../library/sqlite3.rst:2730 msgid "" "The :meth:`~Cursor.executescript` method implicitly commits any pending " "transaction before execution of the given SQL script, regardless of the " "value of :attr:`~Connection.isolation_level`." msgstr "" -#: ../../library/sqlite3.rst:2694 +#: ../../library/sqlite3.rst:2734 msgid "" ":mod:`!sqlite3` used to implicitly commit an open transaction before DDL " "statements. This is no longer the case." msgstr "" -#: ../../library/sqlite3.rst:2698 +#: ../../library/sqlite3.rst:2738 msgid "" "The recommended way of controlling transactions is now via the :attr:" "`~Connection.autocommit` attribute." msgstr "" -#: ../../library/sqlite3.rst:1450 +#: ../../library/sqlite3.rst:1490 msgid "? (question mark)" msgstr "? (問號)" -#: ../../library/sqlite3.rst:1450 ../../library/sqlite3.rst:1451 +#: ../../library/sqlite3.rst:1490 ../../library/sqlite3.rst:1491 msgid "in SQL statements" msgstr "於 SQL 陳述式中" -#: ../../library/sqlite3.rst:1451 +#: ../../library/sqlite3.rst:1491 msgid ": (colon)" msgstr ": (冒號)" diff --git a/library/ssl.po b/library/ssl.po index 95d08ef7f3..342879d494 100644 --- a/library/ssl.po +++ b/library/ssl.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2024-08-28 00:43+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -60,17 +60,16 @@ msgstr "" "安全性認知,因為 ssl 模組的預設設定未必適合你的應用程式。" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr ":ref:`適用 `: 非 Emscripten、非 WASI。" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/ssl.rst:38 msgid "" @@ -82,13 +81,16 @@ msgstr "" "可以去參考此章節底部的「詳情」部分。" #: ../../library/ssl.rst:42 +#, fuzzy msgid "" "This module provides a class, :class:`ssl.SSLSocket`, which is derived from " "the :class:`socket.socket` type, and provides a socket-like wrapper that " "also encrypts and decrypts the data going over the socket with SSL. It " "supports additional methods such as :meth:`getpeercert`, which retrieves the " -"certificate of the other side of the connection, and :meth:`cipher`, which " -"retrieves the cipher being used for the secure connection." +"certificate of the other side of the connection, :meth:`cipher`, which " +"retrieves the cipher being used for the secure connection or :meth:" +"`get_verified_chain`, :meth:`get_unverified_chain` which retrieves " +"certificate chain." msgstr "" "此模組提供了一個 :class:`ssl.SSLSocket` 類別,它是從 :class:`socket.socket` " "衍生出來的,並且提供類似 socket 的包裝器,讓使用 SSL 進行資料傳輸時,可以進行" @@ -96,7 +98,7 @@ msgstr "" "連結另一端的憑證,以及 :meth:`cipher`,用於搜尋用於安全連接的加密方法 " "(cipher)。" -#: ../../library/ssl.rst:49 +#: ../../library/ssl.rst:51 msgid "" "For more sophisticated applications, the :class:`ssl.SSLContext` class helps " "manage settings and certificates, which can then be inherited by SSL sockets " @@ -106,11 +108,11 @@ msgstr "" "可以透過 :meth:`SSLContext.wrap_socket` 方法建立的 SSL socket 繼承這些設定和" "認證。" -#: ../../library/ssl.rst:53 +#: ../../library/ssl.rst:55 msgid "Updated to support linking with OpenSSL 1.1.0" msgstr "更新以支援與 OpenSSL 1.1.0 進行連結" -#: ../../library/ssl.rst:58 +#: ../../library/ssl.rst:60 msgid "" "OpenSSL 0.9.8, 1.0.0 and 1.0.1 are deprecated and no longer supported. In " "the future the ssl module will require at least OpenSSL 1.0.2 or 1.1.0." @@ -118,26 +120,26 @@ msgstr "" "OpenSSL 0.9.8, 1.0.0 及 1.0.1 版本已被棄用且不再支援。在未來 ssl 模組將需要至" "少 OpenSSL 1.0.2 版本或 1.1.0 版本。" -#: ../../library/ssl.rst:64 +#: ../../library/ssl.rst:66 msgid "" ":pep:`644` has been implemented. The ssl module requires OpenSSL 1.1.1 or " "newer." msgstr ":pep:`644` 已經被實作。ssl 模組需要 OpenSSL 1.1.1 以上的版本才能使用。" -#: ../../library/ssl.rst:67 +#: ../../library/ssl.rst:69 msgid "" "Use of deprecated constants and functions result in deprecation warnings." msgstr "使用已經被棄用的常數或函式將會導致棄用警示。" -#: ../../library/ssl.rst:71 +#: ../../library/ssl.rst:73 msgid "Functions, Constants, and Exceptions" msgstr "函式、常數與例外" -#: ../../library/ssl.rst:75 +#: ../../library/ssl.rst:77 msgid "Socket creation" msgstr "Socket 建立" -#: ../../library/ssl.rst:77 +#: ../../library/ssl.rst:79 msgid "" "Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." "wrap_socket` method. The helper function :func:`create_default_context` " @@ -147,11 +149,11 @@ msgstr "" "助函式 :func:`create_default_context` 會回傳有安全預設設定的新語境 " "(context)。" -#: ../../library/ssl.rst:82 +#: ../../library/ssl.rst:84 msgid "Client socket example with default context and IPv4/IPv6 dual stack::" msgstr "使用預設語境及 IPv4/IPv6 雙協定堆疊的客戶端 socket 範例: ::" -#: ../../library/ssl.rst:84 +#: ../../library/ssl.rst:86 msgid "" "import socket\n" "import ssl\n" @@ -173,11 +175,11 @@ msgstr "" " with context.wrap_socket(sock, server_hostname=hostname) as ssock:\n" " print(ssock.version())" -#: ../../library/ssl.rst:95 +#: ../../library/ssl.rst:97 msgid "Client socket example with custom context and IPv4::" msgstr "使用自訂語境及 IPv4 的客戶端 socket範例: ::" -#: ../../library/ssl.rst:97 +#: ../../library/ssl.rst:99 msgid "" "hostname = 'www.python.org'\n" "# PROTOCOL_TLS_CLIENT requires valid cert chain and hostname\n" @@ -189,11 +191,11 @@ msgid "" " print(ssock.version())" msgstr "" -#: ../../library/ssl.rst:107 +#: ../../library/ssl.rst:109 msgid "Server socket example listening on localhost IPv4::" msgstr "在本地 IPv4 上監聽伺服器 socket 的範例: ::" -#: ../../library/ssl.rst:109 +#: ../../library/ssl.rst:111 msgid "" "context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n" "context.load_cert_chain('/path/to/certchain.pem', '/path/to/private.key')\n" @@ -215,17 +217,17 @@ msgstr "" " conn, addr = ssock.accept()\n" " ..." -#: ../../library/ssl.rst:121 +#: ../../library/ssl.rst:123 msgid "Context creation" msgstr "語境建立" -#: ../../library/ssl.rst:123 +#: ../../library/ssl.rst:125 msgid "" "A convenience function helps create :class:`SSLContext` objects for common " "purposes." msgstr "一個可以幫忙建立出 :class:`SSLContext` 物件以用於一般目的的方便函式。" -#: ../../library/ssl.rst:128 +#: ../../library/ssl.rst:130 msgid "" "Return a new :class:`SSLContext` object with default settings for the given " "*purpose*. The settings are chosen by the :mod:`ssl` module, and usually " @@ -235,7 +237,7 @@ msgstr "" "回傳一個新的 :class:`SSLContext` 物件,使用給定 *purpose* 的預設值。這些設定" "是由 :mod:`ssl` 選擇,通常比直接呼叫 :class:`SSLContext` 有更高的安全性。" -#: ../../library/ssl.rst:133 +#: ../../library/ssl.rst:135 msgid "" "*cafile*, *capath*, *cadata* represent optional CA certificates to trust for " "certificate verification, as in :meth:`SSLContext.load_verify_locations`. " @@ -249,7 +251,7 @@ msgstr "" # Skylull: `high encryption cipher` 可能是指 https://superuser.com/questions/1751902/how-to-check-which-ciphers-are-included-in-high-ciphers-constant # 其文中表示可能是指 128bit 以上 key length 的加密算法,需要其他來源佐證。 # 或是 https://help.fortinet.com/fweb/582/Content/FortiWeb/fortiweb-admin/supported_cipher_suites.htm#ssl_414712646_1189301 -#: ../../library/ssl.rst:139 +#: ../../library/ssl.rst:141 msgid "" "The settings are: :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER`, :data:`OP_NO_SSLv2`, and :data:`OP_NO_SSLv3` with " @@ -268,7 +270,7 @@ msgstr "" "個值有被設定時) 或使用預設的 CA 憑證 :meth:`SSLContext." "load_default_certs` 。" -#: ../../library/ssl.rst:148 +#: ../../library/ssl.rst:150 msgid "" "When :attr:`~SSLContext.keylog_filename` is supported and the environment " "variable :envvar:`SSLKEYLOGFILE` is set, :func:`create_default_context` " @@ -278,7 +280,16 @@ msgstr "" "`SSLKEYLOGFILE` 時 :func:`create_default_context` 會啟用密鑰日誌記錄 " "(logging)。" -#: ../../library/ssl.rst:153 +#: ../../library/ssl.rst:154 +msgid "" +"The default settings for this context include :data:" +"`VERIFY_X509_PARTIAL_CHAIN` and :data:`VERIFY_X509_STRICT`. These make the " +"underlying OpenSSL implementation behave more like a conforming " +"implementation of :rfc:`5280`, in exchange for a small amount of " +"incompatibility with older X.509 certificates." +msgstr "" + +#: ../../library/ssl.rst:161 msgid "" "The protocol, options, cipher and other settings may change to more " "restrictive values anytime without prior deprecation. The values represent " @@ -287,7 +298,7 @@ msgstr "" "協定、選項、加密方式和其它設定可以在不捨棄舊值的情況下直接更改成新的值,這些" "值代表了在相容性和安全性之間取得的合理平衡。" -#: ../../library/ssl.rst:157 +#: ../../library/ssl.rst:165 msgid "" "If your application needs specific settings, you should create a :class:" "`SSLContext` and apply the settings yourself." @@ -295,7 +306,7 @@ msgstr "" "如果你的應用程式需要特殊的設定,你應該要自行建立一個 :class:`SSLContext` 並自" "行調整設定。" -#: ../../library/ssl.rst:161 +#: ../../library/ssl.rst:169 msgid "" "If you find that when certain older clients or servers attempt to connect " "with a :class:`SSLContext` created by this function that they get an error " @@ -311,7 +322,7 @@ msgstr "" "SSL3.0 已經\\ `被完全破解 `_。如果你仍" "然希望在允許 SSL3.0 連線的情況下使用此函式,可以使用下面的方法: ::" -#: ../../library/ssl.rst:170 +#: ../../library/ssl.rst:178 msgid "" "ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" "ctx.options &= ~ssl.OP_NO_SSLv3" @@ -319,23 +330,40 @@ msgstr "" "ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" "ctx.options &= ~ssl.OP_NO_SSLv3" -#: ../../library/ssl.rst:177 +#: ../../library/ssl.rst:182 +msgid "" +"This context enables :data:`VERIFY_X509_STRICT` by default, which may reject " +"pre-:rfc:`5280` or malformed certificates that the underlying OpenSSL " +"implementation otherwise would accept. While disabling this is not " +"recommended, you can do so using::" +msgstr "" + +#: ../../library/ssl.rst:187 +#, fuzzy +msgid "" +"ctx = ssl.create_default_context()\n" +"ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" +msgstr "" +"ctx = ssl.create_default_context(Purpose.CLIENT_AUTH)\n" +"ctx.options &= ~ssl.OP_NO_SSLv3" + +#: ../../library/ssl.rst:194 msgid "RC4 was dropped from the default cipher string." msgstr "把 RC4 從預設加密方法字串中捨棄。" -#: ../../library/ssl.rst:181 +#: ../../library/ssl.rst:198 msgid "ChaCha20/Poly1305 was added to the default cipher string." msgstr "把 ChaCha20/Poly1305 加入預設加密方法字串。" -#: ../../library/ssl.rst:183 +#: ../../library/ssl.rst:200 msgid "3DES was dropped from the default cipher string." msgstr "把 3DES 從預設加密方法字串中捨棄。" -#: ../../library/ssl.rst:187 +#: ../../library/ssl.rst:204 msgid "Support for key logging to :envvar:`SSLKEYLOGFILE` was added." msgstr "增加了 :envvar:`SSLKEYLOGFILE` 對密鑰日誌記錄 (logging) 的支援。" -#: ../../library/ssl.rst:191 +#: ../../library/ssl.rst:208 msgid "" "The context now uses :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER` protocol instead of generic :data:`PROTOCOL_TLS`." @@ -343,11 +371,17 @@ msgstr "" "當前語境使用 :data:`PROTOCOL_TLS_CLIENT` 協定或 :data:`PROTOCOL_TLS_SERVER` " "協定而非通用的 :data:`PROTOCOL_TLS`。" -#: ../../library/ssl.rst:197 +#: ../../library/ssl.rst:214 +msgid "" +"The context now uses :data:`VERIFY_X509_PARTIAL_CHAIN` and :data:" +"`VERIFY_X509_STRICT` in its default verify flags." +msgstr "" + +#: ../../library/ssl.rst:219 msgid "Exceptions" msgstr "例外" -#: ../../library/ssl.rst:201 +#: ../../library/ssl.rst:223 msgid "" "Raised to signal an error from the underlying SSL implementation (currently " "provided by the OpenSSL library). This signifies some problem in the higher-" @@ -361,11 +395,11 @@ msgstr "" "`OSError` 的一個子型別。:exc:`SSLError` 實例的錯誤程式代碼和訊息是由 OpenSSL " "函式庫提供。" -#: ../../library/ssl.rst:208 +#: ../../library/ssl.rst:230 msgid ":exc:`SSLError` used to be a subtype of :exc:`socket.error`." msgstr ":exc:`SSLError` 曾經是 :exc:`socket.error` 的一個子型別。" -#: ../../library/ssl.rst:213 +#: ../../library/ssl.rst:235 msgid "" "A string mnemonic designating the OpenSSL submodule in which the error " "occurred, such as ``SSL``, ``PEM`` or ``X509``. The range of possible " @@ -374,7 +408,7 @@ msgstr "" "一個字串符號 (string mnemonic),用來指定發生錯誤的 OpenSSL 子模組,如:" "``SSL``、``PEM`` 或 ``X509``。可能值的範圍取決於 OpenSSL 的版本。" -#: ../../library/ssl.rst:221 +#: ../../library/ssl.rst:243 msgid "" "A string mnemonic designating the reason this error occurred, for example " "``CERTIFICATE_VERIFY_FAILED``. The range of possible values depends on the " @@ -383,7 +417,7 @@ msgstr "" "一個字串符號,用來指定發生錯誤的原因,如:``CERTIFICATE_VERIFY_FAILED``。可能" "值的範圍取決於 OpenSSL 的版本。" -#: ../../library/ssl.rst:229 +#: ../../library/ssl.rst:251 msgid "" "A subclass of :exc:`SSLError` raised when trying to read or write and the " "SSL connection has been closed cleanly. Note that this doesn't mean that " @@ -392,7 +426,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去讀寫已經被完全關閉的 SSL 連線時會被引" "發。請注意,這並不表示底層傳輸(例如 TCP)已經被關閉。" -#: ../../library/ssl.rst:237 +#: ../../library/ssl.rst:259 msgid "" "A subclass of :exc:`SSLError` raised by a :ref:`non-blocking SSL socket ` when trying to read or write data, but more data needs to be " @@ -401,7 +435,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去讀寫資料前,底層 TCP 傳輸需要先接收更" "多資料時會由\\ :ref:`非阻塞的 SSL socket ` 引發該錯誤。" -#: ../../library/ssl.rst:246 +#: ../../library/ssl.rst:268 msgid "" "A subclass of :exc:`SSLError` raised by a :ref:`non-blocking SSL socket ` when trying to read or write data, but more data needs to be " @@ -410,7 +444,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去讀寫資料前,底層 TCP 傳輸需要先發送更" "多資料時會由\\ :ref:`非阻塞的 SSL socket ` 引發該錯誤。" -#: ../../library/ssl.rst:255 +#: ../../library/ssl.rst:277 msgid "" "A subclass of :exc:`SSLError` raised when a system error was encountered " "while trying to fulfill an operation on a SSL socket. Unfortunately, there " @@ -419,7 +453,7 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當嘗試去操作 SSL socket 時有系統錯誤產生會引發" "此錯誤。不幸的是,目前沒有任何簡單的方法可以去檢查原本的的 errno 編號。" -#: ../../library/ssl.rst:263 +#: ../../library/ssl.rst:285 msgid "" "A subclass of :exc:`SSLError` raised when the SSL connection has been " "terminated abruptly. Generally, you shouldn't try to reuse the underlying " @@ -428,32 +462,32 @@ msgstr "" "一個 :exc:`SSLError` 的子類別,當 SSL 連線被突然終止時會引發此錯誤。通常,當" "此錯誤發生時,你不該再去重新使用底層傳輸。" -#: ../../library/ssl.rst:271 +#: ../../library/ssl.rst:293 msgid "" "A subclass of :exc:`SSLError` raised when certificate validation has failed." msgstr "當憑證驗證失敗時會引發的一個 :exc:`SSLError` 子類別。" -#: ../../library/ssl.rst:278 +#: ../../library/ssl.rst:300 msgid "A numeric error number that denotes the verification error." msgstr "一個表示驗證錯誤的錯誤數值編號。" -#: ../../library/ssl.rst:282 +#: ../../library/ssl.rst:304 msgid "A human readable string of the verification error." msgstr "一個人類可讀的驗證錯誤字串。" -#: ../../library/ssl.rst:286 +#: ../../library/ssl.rst:308 msgid "An alias for :exc:`SSLCertVerificationError`." msgstr ":exc:`SSLCertVerificationError` 的別名。" -#: ../../library/ssl.rst:288 +#: ../../library/ssl.rst:310 msgid "The exception is now an alias for :exc:`SSLCertVerificationError`." msgstr "此例外現在是 :exc:`SSLCertVerificationError` 的別名。" -#: ../../library/ssl.rst:293 +#: ../../library/ssl.rst:315 msgid "Random generation" msgstr "隨機產生" -#: ../../library/ssl.rst:297 +#: ../../library/ssl.rst:319 msgid "" "Return *num* cryptographically strong pseudo-random bytes. Raises an :class:" "`SSLError` if the PRNG has not been seeded with enough data or if the " @@ -466,11 +500,11 @@ msgstr "" "func:`RAND_status` 函式可以用來檢查 PRNG 函式,而 :func:`RAND_add` 則可以用來" "為 PRNG 設定隨機種子。" -#: ../../library/ssl.rst:303 +#: ../../library/ssl.rst:325 msgid "For almost all applications :func:`os.urandom` is preferable." msgstr "在幾乎所有的應用程式中,:func:`os.urandom` 會是較好的選擇。" -#: ../../library/ssl.rst:305 +#: ../../library/ssl.rst:327 msgid "" "Read the Wikipedia article, `Cryptographically secure pseudorandom number " "generator (CSPRNG) `_\\ 文章來了" "解密碼學安全偽隨機數產生器的需求。" -#: ../../library/ssl.rst:314 +#: ../../library/ssl.rst:336 msgid "" "Return ``True`` if the SSL pseudo-random number generator has been seeded " "with 'enough' randomness, and ``False`` otherwise. You can use :func:`ssl." @@ -492,7 +526,7 @@ msgstr "" "``True`` ,否則回傳 ``False``。你可以使用 :func:`ssl.RAND_egd` 函式和 :func:" "`ssl.RAND_add` 函式來增加偽隨機數產生器的隨機性。" -#: ../../library/ssl.rst:321 +#: ../../library/ssl.rst:343 msgid "" "Mix the given *bytes* into the SSL pseudo-random number generator. The " "parameter *entropy* (a float) is a lower bound on the entropy contained in " @@ -503,15 +537,15 @@ msgstr "" "指字串中包含熵值的下限(因此你可以將其設為 ``0.0``\\ )。請參閱 :rfc:`1750` " "了解有關熵源的更多資訊。" -#: ../../library/ssl.rst:326 +#: ../../library/ssl.rst:348 msgid "Writable :term:`bytes-like object` is now accepted." msgstr "可寫入的\\ :term:`類位元組物件 `\\ 現在可被接受。" -#: ../../library/ssl.rst:330 +#: ../../library/ssl.rst:352 msgid "Certificate handling" msgstr "認證處理" -#: ../../library/ssl.rst:338 +#: ../../library/ssl.rst:360 msgid "" "Return the time in seconds since the Epoch, given the ``cert_time`` string " "representing the \"notBefore\" or \"notAfter\" date from a certificate in " @@ -521,11 +555,11 @@ msgstr "" "\"notAfter\" 日期,字串採用 ``\"%b %d %H:%M:%S %Y %Z\"`` 格式(C 語言區域設" "定)。" -#: ../../library/ssl.rst:343 +#: ../../library/ssl.rst:365 msgid "Here's an example:" msgstr "以下是一個範例:" -#: ../../library/ssl.rst:345 +#: ../../library/ssl.rst:367 msgid "" ">>> import ssl\n" ">>> timestamp = ssl.cert_time_to_seconds(\"Jan 5 09:34:43 2018 GMT\")\n" @@ -543,11 +577,11 @@ msgstr "" ">>> print(datetime.utcfromtimestamp(timestamp)) \n" "2018-01-05 09:34:43" -#: ../../library/ssl.rst:355 +#: ../../library/ssl.rst:377 msgid "\"notBefore\" or \"notAfter\" dates must use GMT (:rfc:`5280`)." msgstr "\"notBefore\" 或 \"notAfter\" 日期必須使用 GMT (:rfc:`5280`)。" -#: ../../library/ssl.rst:357 +#: ../../library/ssl.rst:379 msgid "" "Interpret the input time as a time in UTC as specified by 'GMT' timezone in " "the input string. Local timezone was used previously. Return an integer (no " @@ -556,7 +590,7 @@ msgstr "" "將輸入的時間直譯為 UTC 時間,如輸入字串中指定的 'GMT' 時區。在之前是使用本地" "的時區。回傳一個整數(在輸入格式中不包括秒的小數部分)。" -#: ../../library/ssl.rst:366 +#: ../../library/ssl.rst:388 msgid "" "Given the address ``addr`` of an SSL-protected server, as a (*hostname*, " "*port-number*) pair, fetches the server's certificate, and returns it as a " @@ -577,11 +611,11 @@ msgstr "" "組根憑證對伺服器憑證進行驗證,如果驗證失敗,呼叫將失敗。可以使用 ``timeout`` " "參數指定超時時間。" -#: ../../library/ssl.rst:377 +#: ../../library/ssl.rst:399 msgid "This function is now IPv6-compatible." msgstr "此函式現在是與 IPv6 相容的。" -#: ../../library/ssl.rst:380 +#: ../../library/ssl.rst:402 msgid "" "The default *ssl_version* is changed from :data:`PROTOCOL_SSLv3` to :data:" "`PROTOCOL_TLS` for maximum compatibility with modern servers." @@ -589,11 +623,11 @@ msgstr "" "預設的 *ssl_version* 已經從 :data:`PROTOCOL_SSLv3` 改為 :data:" "`PROTOCOL_TLS`,已確保與現今的伺服器有最大的相容性。" -#: ../../library/ssl.rst:384 +#: ../../library/ssl.rst:406 msgid "The *timeout* parameter was added." msgstr "新增 *timeout* 參數。" -#: ../../library/ssl.rst:389 +#: ../../library/ssl.rst:411 msgid "" "Given a certificate as a DER-encoded blob of bytes, returns a PEM-encoded " "string version of the same certificate." @@ -601,14 +635,14 @@ msgstr "" "給定一個以 DER 編碼的位元組 blob 作為憑證,回傳以 PEM 編碼字串版本的相同憑" "證。" -#: ../../library/ssl.rst:394 +#: ../../library/ssl.rst:416 msgid "" "Given a certificate as an ASCII PEM string, returns a DER-encoded sequence " "of bytes for that same certificate." msgstr "" "給定一個以 ASCII PEM 的字串作為憑證,回傳以 DER 編碼的位元組序列的相同憑證。" -#: ../../library/ssl.rst:399 +#: ../../library/ssl.rst:421 msgid "" "Returns a named tuple with paths to OpenSSL's default cafile and capath. The " "paths are the same as used by :meth:`SSLContext.set_default_verify_paths`. " @@ -618,39 +652,39 @@ msgstr "" "meth:`SSLContext.set_default_verify_paths` 使用的相同。回傳值是一個 :term:" "`named tuple` ``DefaultVerifyPaths``:" -#: ../../library/ssl.rst:404 +#: ../../library/ssl.rst:426 msgid "" ":attr:`cafile` - resolved path to cafile or ``None`` if the file doesn't " "exist," msgstr ":attr:`cafile` - 解析後的 cafile 路徑,如果檔案不存在則為 ``None``," -#: ../../library/ssl.rst:405 +#: ../../library/ssl.rst:427 msgid "" ":attr:`capath` - resolved path to capath or ``None`` if the directory " "doesn't exist," msgstr ":attr:`capath` - 解析後的 capath 路徑,如果目錄不存在則為 ``None``," -#: ../../library/ssl.rst:406 +#: ../../library/ssl.rst:428 msgid "" ":attr:`openssl_cafile_env` - OpenSSL's environment key that points to a " "cafile," msgstr ":attr:`openssl_cafile_env` - 指向 cafile 的 OpenSSL 環境密鑰," -#: ../../library/ssl.rst:407 +#: ../../library/ssl.rst:429 msgid ":attr:`openssl_cafile` - hard coded path to a cafile," msgstr ":attr:`openssl_cafile` - hard coded 的 cafile 路徑," -#: ../../library/ssl.rst:408 +#: ../../library/ssl.rst:430 msgid "" ":attr:`openssl_capath_env` - OpenSSL's environment key that points to a " "capath," msgstr ":attr:`openssl_capath_env` - 指向 capath 的 OpenSSL 環境密鑰," -#: ../../library/ssl.rst:409 +#: ../../library/ssl.rst:431 msgid ":attr:`openssl_capath` - hard coded path to a capath directory" msgstr ":attr:`openssl_capath` - hard coded 的 capath 目錄路徑" -#: ../../library/ssl.rst:415 +#: ../../library/ssl.rst:437 msgid "" "Retrieve certificates from Windows' system cert store. *store_name* may be " "one of ``CA``, ``ROOT`` or ``MY``. Windows may provide additional cert " @@ -659,7 +693,7 @@ msgstr "" "從 Windows 的系統憑證儲存庫中搜尋憑證。*store_name* 可以是 ``CA``、``ROOT`` " "或 ``MY`` 的其中一個。Windows 也可能會提供額外的憑證儲存庫。" -#: ../../library/ssl.rst:419 +#: ../../library/ssl.rst:441 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " "The encoding_type specifies the encoding of cert_bytes. It is either :const:" @@ -672,12 +706,12 @@ msgstr "" "`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。Trust 通過一" "組 OIDS 來指定憑證的用途,或是如果憑證對所有用途都可以使用則回傳 ``True``。" -#: ../../library/ssl.rst:426 ../../library/ssl.rst:1555 -#: ../../library/ssl.rst:1853 +#: ../../library/ssl.rst:448 ../../library/ssl.rst:1599 +#: ../../library/ssl.rst:1898 msgid "Example::" msgstr "範例: ::" -#: ../../library/ssl.rst:428 +#: ../../library/ssl.rst:450 msgid "" ">>> ssl.enum_certificates(\"CA\")\n" "[(b'data...', 'x509_asn', {'1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2'}),\n" @@ -687,11 +721,11 @@ msgstr "" "[(b'data...', 'x509_asn', {'1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2'}),\n" " (b'data...', 'x509_asn', True)]" -#: ../../library/ssl.rst:432 ../../library/ssl.rst:447 +#: ../../library/ssl.rst:454 ../../library/ssl.rst:469 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:只有 Windows。" -#: ../../library/ssl.rst:438 +#: ../../library/ssl.rst:460 msgid "" "Retrieve CRLs from Windows' system cert store. *store_name* may be one of " "``CA``, ``ROOT`` or ``MY``. Windows may provide additional cert stores, too." @@ -699,7 +733,7 @@ msgstr "" "從 Windows 的系統憑證儲存庫中搜尋 CRLs。*store_name* 可以是 ``CA``、``ROOT`` " "或 ``MY`` 的其中一個。Windows 也可能會提供額外的憑證儲存庫。" -#: ../../library/ssl.rst:442 +#: ../../library/ssl.rst:464 msgid "" "The function returns a list of (cert_bytes, encoding_type, trust) tuples. " "The encoding_type specifies the encoding of cert_bytes. It is either :const:" @@ -709,18 +743,18 @@ msgstr "" "指定了 cert_bytes 的編碼格式。它可以是用來表示 X.509 ASN.1 資料的 :const:" "`x509_asn` 或是用來表示 PKCS#7 ASN.1 資料的 :const:`pkcs_7_asn`。" -#: ../../library/ssl.rst:453 +#: ../../library/ssl.rst:475 msgid "Constants" msgstr "常數" -#: ../../library/ssl.rst:455 +#: ../../library/ssl.rst:477 msgid "" "All constants are now :class:`enum.IntEnum` or :class:`enum.IntFlag` " "collections." msgstr "" "所有的常數現在都是 :class:`enum.IntEnum` 或 :class:`enum.IntFlag` 的集合。" -#: ../../library/ssl.rst:461 +#: ../../library/ssl.rst:483 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. Except for :const:" "`PROTOCOL_TLS_CLIENT`, it is the default mode. With client-side sockets, " @@ -731,7 +765,7 @@ msgstr "" "外,這是預設的模式。對於客戶端的 sockets,幾乎任何憑證都能被允許。驗證錯誤," "像是不被信任或是過期的憑證,會被忽略並不會中止 TLS/SSL 握手。" -#: ../../library/ssl.rst:467 +#: ../../library/ssl.rst:489 msgid "" "In server mode, no certificate is requested from the client, so the client " "does not send any for client cert authentication." @@ -739,11 +773,11 @@ msgstr "" "在伺服器模式下,不會從客戶端請求任何憑證,所以客戶端不用發送任何用於客戶端憑" "證身分驗證的憑證。" -#: ../../library/ssl.rst:470 ../../library/ssl.rst:2261 +#: ../../library/ssl.rst:492 ../../library/ssl.rst:2400 msgid "See the discussion of :ref:`ssl-security` below." msgstr "參閱下方 :ref:`ssl-security` 的討論。" -#: ../../library/ssl.rst:474 +#: ../../library/ssl.rst:496 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In client mode, :const:" "`CERT_OPTIONAL` has the same meaning as :const:`CERT_REQUIRED`. It is " @@ -753,7 +787,7 @@ msgstr "" "`CERT_OPTIONAL` 具有與 :const:`CERT_REQUIRED` 相同的含意。對於客戶端 sockets " "推薦改用 :const:`CERT_REQUIRED`。" -#: ../../library/ssl.rst:479 +#: ../../library/ssl.rst:501 msgid "" "In server mode, a client certificate request is sent to the client. The " "client may either ignore the request or send a certificate in order perform " @@ -765,7 +799,7 @@ msgstr "" "發送憑證來執行 TLS 客戶端憑證身分驗證。如果客戶端選擇發送憑證,則會對其進行驗" "證。任何驗證錯誤都會立刻終止 TLS 握手。" -#: ../../library/ssl.rst:485 ../../library/ssl.rst:504 +#: ../../library/ssl.rst:507 ../../library/ssl.rst:526 msgid "" "Use of this setting requires a valid set of CA certificates to be passed to :" "meth:`SSLContext.load_verify_locations`." @@ -773,7 +807,7 @@ msgstr "" "使用此設定需要將一組有效的 CA 憑證傳送給 :meth:`SSLContext." "load_verify_locations`。" -#: ../../library/ssl.rst:490 +#: ../../library/ssl.rst:512 msgid "" "Possible value for :attr:`SSLContext.verify_mode`. In this mode, " "certificates are required from the other side of the socket connection; an :" @@ -791,7 +825,7 @@ msgstr "" "`PROTOCOL_TLS_CLIENT` 會使用 :const:`CERT_REQUIRED` 並預設開啟 :attr:" "`~SSLContext.check_hostname`。" -#: ../../library/ssl.rst:500 +#: ../../library/ssl.rst:522 msgid "" "With server socket, this mode provides mandatory TLS client cert " "authentication. A client certificate request is sent to the client and the " @@ -800,11 +834,11 @@ msgstr "" "對於 socket 伺服器,此模式會提供強制的 TLS 客戶端憑證驗證。客戶端憑證請求會被" "發送給客戶端並且客戶端必須提供有效且被信任的憑證。" -#: ../../library/ssl.rst:509 +#: ../../library/ssl.rst:531 msgid ":class:`enum.IntEnum` collection of CERT_* constants." msgstr ":class:`enum.IntEnum` 為 CERT_* 常數的一個集合。" -#: ../../library/ssl.rst:515 +#: ../../library/ssl.rst:537 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, " "certificate revocation lists (CRLs) are not checked. By default OpenSSL does " @@ -813,7 +847,7 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。在此模式下,不會檢查憑證吊銷列表 " "(CRLs)。預設的 OpenSSL 並不會請求及驗證 CRLs。" -#: ../../library/ssl.rst:523 +#: ../../library/ssl.rst:545 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, only the " "peer cert is checked but none of the intermediate CA certificates. The mode " @@ -826,7 +860,7 @@ msgstr "" "效的 CRL 簽名。如果沒有用 :attr:`SSLContext.load_verify_locations` 載入適當" "的 CRL,則會驗證失敗。" -#: ../../library/ssl.rst:533 +#: ../../library/ssl.rst:555 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. In this mode, CRLs of " "all certificates in the peer cert chain are checked." @@ -834,7 +868,7 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。在此模式下,會檢查對等憑證鍊中所有" "憑證的 CRLs。" -#: ../../library/ssl.rst:540 +#: ../../library/ssl.rst:562 msgid "" "Possible value for :attr:`SSLContext.verify_flags` to disable workarounds " "for broken X.509 certificates." @@ -842,13 +876,13 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值,用來禁用已損壞的 X.509 憑證的解決方" "法。" -#: ../../library/ssl.rst:547 +#: ../../library/ssl.rst:569 msgid "" "Possible value for :attr:`SSLContext.verify_flags` to enables proxy " "certificate verification." msgstr ":attr:`SSLContext.verify_flags` 可能的值,用來啟用憑證代理驗證。" -#: ../../library/ssl.rst:554 +#: ../../library/ssl.rst:576 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to " "prefer trusted certificates when building the trust chain to validate a " @@ -857,7 +891,7 @@ msgstr "" ":attr:`SSLContext.verify_flags` 可能的值。它指示 OpenSSL 在構建信任鍊來驗證憑" "證時會優先使用被信任的憑證。此旗標預設開啟。" -#: ../../library/ssl.rst:562 +#: ../../library/ssl.rst:584 msgid "" "Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to " "accept intermediate CAs in the trust store to be treated as trust-anchors, " @@ -869,11 +903,11 @@ msgstr "" "間 CAs 作為信任錨,就像自簽名的根 CA 憑證。這樣就能去信任中間 CA 所頒發的憑" "證,而不一定非要去信任其祖先的根 CA。" -#: ../../library/ssl.rst:573 +#: ../../library/ssl.rst:595 msgid ":class:`enum.IntFlag` collection of VERIFY_* constants." msgstr ":class:`enum.IntFlag` 為 VERIFY_* 常數的其中一個集合。" -#: ../../library/ssl.rst:579 +#: ../../library/ssl.rst:601 msgid "" "Selects the highest protocol version that both the client and server " "support. Despite the name, this option can select both \"SSL\" and \"TLS\" " @@ -882,7 +916,7 @@ msgstr "" "選擇客戶端及伺服器均可以支援最高協定版本。儘管名稱只有 「TLS」,但實際上" "「SSL」和「TLS」均可以選擇。" -#: ../../library/ssl.rst:586 +#: ../../library/ssl.rst:608 msgid "" "TLS clients and servers require different default settings for secure " "communication. The generic TLS protocol constant is deprecated in favor of :" @@ -891,7 +925,7 @@ msgstr "" "TLS 的客戶端及伺服器端需要不同的預設值來實現安全通訊。通用的 TLS 協定常數已被" "廢除,並改用 :data:`PROTOCOL_TLS_CLIENT` 和 :data:`PROTOCOL_TLS_SERVER`。" -#: ../../library/ssl.rst:592 +#: ../../library/ssl.rst:614 msgid "" "Auto-negotiate the highest protocol version that both the client and server " "support, and configure the context client-side connections. The protocol " @@ -901,35 +935,35 @@ msgstr "" "自動協商客戶端和服務器都支援的最高協議版本,並配置客戶端語境連線。該協定預設" "啟用 :data:`CERT_REQUIRED` 和 :attr:`~SSLContext.check_hostname`。" -#: ../../library/ssl.rst:601 +#: ../../library/ssl.rst:623 msgid "" "Auto-negotiate the highest protocol version that both the client and server " "support, and configure the context server-side connections." msgstr "自動協商客戶端和服務器都支援的最高協議版本,並配置客戶端語境連線。" -#: ../../library/ssl.rst:608 +#: ../../library/ssl.rst:630 msgid "Alias for :data:`PROTOCOL_TLS`." msgstr ":data:`PROTOCOL_TLS` 的別名。" -#: ../../library/ssl.rst:612 +#: ../../library/ssl.rst:634 msgid "Use :data:`PROTOCOL_TLS` instead." msgstr "請改用 :data:`PROTOCOL_TLS`。" -#: ../../library/ssl.rst:616 +#: ../../library/ssl.rst:638 msgid "Selects SSL version 3 as the channel encryption protocol." msgstr "選擇第三版的 SSL 做為通道加密協定。" -#: ../../library/ssl.rst:618 +#: ../../library/ssl.rst:640 msgid "" "This protocol is not available if OpenSSL is compiled with the ``no-ssl3`` " "option." msgstr "如果 OpenSSL 是用 ``no-ssl3`` 編譯的,則此項協議無法使用。" -#: ../../library/ssl.rst:623 +#: ../../library/ssl.rst:645 msgid "SSL version 3 is insecure. Its use is highly discouraged." msgstr "第三版的 SSL 是不安全的,強烈建議不要使用。" -#: ../../library/ssl.rst:627 +#: ../../library/ssl.rst:649 msgid "" "OpenSSL has deprecated all version specific protocols. Use the default " "protocol :data:`PROTOCOL_TLS_SERVER` or :data:`PROTOCOL_TLS_CLIENT` with :" @@ -940,16 +974,16 @@ msgstr "" "`PROTOCOL_TLS_SERVER` 協定或帶有 :attr:`SSLContext.minimum_version` 和 :attr:" "`SSLContext.maximum_version` 的 :data:`PROTOCOL_TLS_CLIENT`。" -#: ../../library/ssl.rst:635 +#: ../../library/ssl.rst:657 msgid "Selects TLS version 1.0 as the channel encryption protocol." msgstr "選擇 1.0 版的 TLS 做為通道加密協定。" -#: ../../library/ssl.rst:639 ../../library/ssl.rst:650 -#: ../../library/ssl.rst:661 +#: ../../library/ssl.rst:661 ../../library/ssl.rst:672 +#: ../../library/ssl.rst:683 msgid "OpenSSL has deprecated all version specific protocols." msgstr "OpenSSL 已經將所有版本特定的協定棄用。" -#: ../../library/ssl.rst:643 +#: ../../library/ssl.rst:665 msgid "" "Selects TLS version 1.1 as the channel encryption protocol. Available only " "with openssl version 1.0.1+." @@ -957,7 +991,7 @@ msgstr "" "選擇 1.1 版的 TLS 做為通道加密協定。只有在 1.0.1 版本以上的 OpenSSL 才可以選" "用。" -#: ../../library/ssl.rst:654 +#: ../../library/ssl.rst:676 msgid "" "Selects TLS version 1.2 as the channel encryption protocol. Available only " "with openssl version 1.0.1+." @@ -965,7 +999,7 @@ msgstr "" "選擇 1.2 版的 TLS 做為通道加密協定。只有在 1.0.1 版本以上的 OpenSSL 才可以選" "用。" -#: ../../library/ssl.rst:665 +#: ../../library/ssl.rst:687 msgid "" "Enables workarounds for various bugs present in other SSL implementations. " "This option is set by default. It does not necessarily set the same flags " @@ -974,7 +1008,7 @@ msgstr "" "啟用對 SSL 實作時所產生的各種錯誤的緩解措施。此選項預設被設定。它不一定設定" "與 OpenSSL 的 ``SSL_OP_ALL`` 常數相同的旗標。" -#: ../../library/ssl.rst:673 +#: ../../library/ssl.rst:695 msgid "" "Prevents an SSLv2 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing SSLv2 as " @@ -983,11 +1017,11 @@ msgstr "" "防止 SSLv2 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同級 " "(peer)選用 SSLv2 做為協定版本。" -#: ../../library/ssl.rst:681 +#: ../../library/ssl.rst:703 msgid "SSLv2 is deprecated" msgstr "SSLv2 已被棄用" -#: ../../library/ssl.rst:685 +#: ../../library/ssl.rst:707 msgid "" "Prevents an SSLv3 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing SSLv3 as " @@ -996,11 +1030,11 @@ msgstr "" "防止 SSLv3 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同級" "選用 SSLv3 做為協定版本。" -#: ../../library/ssl.rst:693 +#: ../../library/ssl.rst:715 msgid "SSLv3 is deprecated" msgstr "SSLv3 已被棄用" -#: ../../library/ssl.rst:697 +#: ../../library/ssl.rst:719 msgid "" "Prevents a TLSv1 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1 as " @@ -1009,7 +1043,7 @@ msgstr "" "防止 TLSv1 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同級" "選用 TLSv1 做為協定版本。" -#: ../../library/ssl.rst:703 +#: ../../library/ssl.rst:725 msgid "" "The option is deprecated since OpenSSL 1.1.0, use the new :attr:`SSLContext." "minimum_version` and :attr:`SSLContext.maximum_version` instead." @@ -1017,7 +1051,7 @@ msgstr "" "該選項自從 OpenSSL 1.1.0 以後已被棄用,請改用新的 :attr:`SSLContext." "minimum_version` 及 :attr:`SSLContext.maximum_version` 代替。" -#: ../../library/ssl.rst:710 +#: ../../library/ssl.rst:732 msgid "" "Prevents a TLSv1.1 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.1 as " @@ -1026,11 +1060,11 @@ msgstr "" "防止 TLSv1.1 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同" "級選用 TLSv1.1 做為協定版本。只有 1.0.1 版後的 OpenSSL 版本才能使用。" -#: ../../library/ssl.rst:716 ../../library/ssl.rst:727 +#: ../../library/ssl.rst:738 ../../library/ssl.rst:749 msgid "The option is deprecated since OpenSSL 1.1.0." msgstr "此選項自 OpenSSL 1.1.0 版已被棄用。" -#: ../../library/ssl.rst:721 +#: ../../library/ssl.rst:743 msgid "" "Prevents a TLSv1.2 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.2 as " @@ -1039,7 +1073,7 @@ msgstr "" "防止 TLSv1.2 連線。此選項只可以跟 :const:`PROTOCOL_TLS` 一起使用。它會防止同" "級選用 TLSv1.2 做為協定版本。只有 1.0.1 版後的 OpenSSL 版本才能使用。" -#: ../../library/ssl.rst:732 +#: ../../library/ssl.rst:754 msgid "" "Prevents a TLSv1.3 connection. This option is only applicable in conjunction " "with :const:`PROTOCOL_TLS`. It prevents the peers from choosing TLSv1.3 as " @@ -1051,7 +1085,7 @@ msgstr "" "級選用 TLSv1.3 做為協定版本。TSL1.3 只適用於 1.1.1 版以後的 OpenSSL。當使用 " "Python 編譯舊版的 OpenSSL 時,該標志預設為 *0*。" -#: ../../library/ssl.rst:740 +#: ../../library/ssl.rst:762 msgid "" "The option is deprecated since OpenSSL 1.1.0. It was added to 2.7.15 and " "3.6.3 for backwards compatibility with OpenSSL 1.0.2." @@ -1059,7 +1093,7 @@ msgstr "" "此選項自 OpenSSL 1.1.0 以後已被棄用。它被添加到 2.7.15 和 3.6.3 中,以向後相" "容 OpenSSL 1.0.2。" -#: ../../library/ssl.rst:746 +#: ../../library/ssl.rst:768 msgid "" "Disable all renegotiation in TLSv1.2 and earlier. Do not send HelloRequest " "messages, and ignore renegotiation requests via ClientHello." @@ -1067,11 +1101,11 @@ msgstr "" "停用所有在 TLSv1.2 及更早版本的重協商 (renegotiation)。不發送 HelloRequest 訊" "息,並忽略通過 ClientHello 的重協商請求。" -#: ../../library/ssl.rst:749 +#: ../../library/ssl.rst:771 msgid "This option is only available with OpenSSL 1.1.0h and later." msgstr "此選項僅適用於 OpenSSL 1.1.0h 及更新版本。" -#: ../../library/ssl.rst:755 +#: ../../library/ssl.rst:777 msgid "" "Use the server's cipher ordering preference, rather than the client's. This " "option has no effect on client sockets and SSLv2 server sockets." @@ -1079,7 +1113,7 @@ msgstr "" "使用伺服器的加密方法名稱字串排序優先順序,而不是客戶端的。此選項並不會影響到" "客戶端及 SSLv2 伺服器的 sockets。" -#: ../../library/ssl.rst:762 +#: ../../library/ssl.rst:784 msgid "" "Prevents reuse of the same DH key for distinct SSL sessions. This improves " "forward secrecy but requires more computational resources. This option only " @@ -1088,7 +1122,7 @@ msgstr "" "防止對不同的 SSL 會談重複使用相同的 DH 密鑰。這會加強向前保密但需要更多的運算" "資源。此選項只適用於伺服器 sockets。" -#: ../../library/ssl.rst:770 +#: ../../library/ssl.rst:792 msgid "" "Prevents reuse of the same ECDH key for distinct SSL sessions. This " "improves forward secrecy but requires more computational resources. This " @@ -1097,7 +1131,7 @@ msgstr "" "防止對不同的 SSL 會談重複使用相同的 ECDH 密鑰。這會加強向前保密但需要更多的運" "算資源。此選項只適用於伺服器 sockets。" -#: ../../library/ssl.rst:778 +#: ../../library/ssl.rst:800 msgid "" "Send dummy Change Cipher Spec (CCS) messages in TLS 1.3 handshake to make a " "TLS 1.3 connection look more like a TLS 1.2 connection." @@ -1105,34 +1139,34 @@ msgstr "" "在 TLS 1.3 握手中發送虛擬的變更加密方法規範 (CCS) 消息,以使 TLS 1.3 連接看起" "來更像 TLS 1.2 連線。" -#: ../../library/ssl.rst:781 +#: ../../library/ssl.rst:803 msgid "This option is only available with OpenSSL 1.1.1 and later." msgstr "此選項僅適用於 OpenSSL 1.1.1 及更新版本。" -#: ../../library/ssl.rst:787 +#: ../../library/ssl.rst:809 msgid "" "Disable compression on the SSL channel. This is useful if the application " "protocol supports its own compression scheme." msgstr "" "在 SSL 通道上禁用壓縮。如果應用程序協定支援自己的壓縮方案,這會很有用。" -#: ../../library/ssl.rst:794 +#: ../../library/ssl.rst:816 msgid ":class:`enum.IntFlag` collection of OP_* constants." msgstr ":class:`enum.IntFlag` 為 OP_* 常數中的一個集合。" -#: ../../library/ssl.rst:798 +#: ../../library/ssl.rst:820 msgid "Prevent client side from requesting a session ticket." msgstr "防止客戶端請求會談票據。" -#: ../../library/ssl.rst:804 +#: ../../library/ssl.rst:826 msgid "Ignore unexpected shutdown of TLS connections." msgstr "忽略意外關閉的 TLS 連線。" -#: ../../library/ssl.rst:806 ../../library/ssl.rst:822 +#: ../../library/ssl.rst:828 ../../library/ssl.rst:844 msgid "This option is only available with OpenSSL 3.0.0 and later." msgstr "此選項僅適用於 OpenSSL 3.0.0 及更新版本。" -#: ../../library/ssl.rst:812 +#: ../../library/ssl.rst:834 msgid "" "Enable the use of the kernel TLS. To benefit from the feature, OpenSSL must " "have been compiled with support for it, and the negotiated cipher suites and " @@ -1143,7 +1177,7 @@ msgstr "" "的加密套件及擴充套件也必須被該功能支援 (該功能所支援的列表可能會因平台及核心" "而有所差異)。" -#: ../../library/ssl.rst:817 +#: ../../library/ssl.rst:839 msgid "" "Note that with enabled kernel TLS some cryptographic operations are " "performed by the kernel directly and not via any available OpenSSL " @@ -1154,13 +1188,13 @@ msgstr "" "的 OpenSSL 所提供的程序,而這可能並非你所想使用的,例如:當應用程式要求所有的" "加密操作由 FIPS 提供執行。" -#: ../../library/ssl.rst:828 +#: ../../library/ssl.rst:850 msgid "" "Allow legacy insecure renegotiation between OpenSSL and unpatched servers " "only." msgstr "只允許 OpenSSL 與未修補的伺服器進行遺留 (legacy) 不安全重協商。" -#: ../../library/ssl.rst:835 +#: ../../library/ssl.rst:857 msgid "" "Whether the OpenSSL library has built-in support for the *Application-Layer " "Protocol Negotiation* TLS extension as described in :rfc:`7301`." @@ -1168,7 +1202,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援 *應用層協定協商* TLS 擴充套件,該擴充套件描述在 :" "rfc:`7301` 中。" -#: ../../library/ssl.rst:842 +#: ../../library/ssl.rst:864 msgid "" "Whether the OpenSSL library has built-in support not checking subject common " "name and :attr:`SSLContext.hostname_checks_common_name` is writeable." @@ -1176,7 +1210,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援不檢查主題通用名稱及 :attr:`SSLContext." "hostname_checks_common_name` 是否可寫。" -#: ../../library/ssl.rst:850 +#: ../../library/ssl.rst:872 msgid "" "Whether the OpenSSL library has built-in support for the Elliptic Curve-" "based Diffie-Hellman key exchange. This should be true unless the feature " @@ -1185,7 +1219,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援基於橢圓曲線的 (Elliptic Curve-based) Diffie-" "Hellman 金鑰交換。此回傳值應該要為 true 除非發布者明確禁用此功能。" -#: ../../library/ssl.rst:858 +#: ../../library/ssl.rst:880 msgid "" "Whether the OpenSSL library has built-in support for the *Server Name " "Indication* extension (as defined in :rfc:`6066`)." @@ -1193,7 +1227,7 @@ msgstr "" "OpenSSL 函式庫是否內建支援 *伺服器名稱提示* 擴充套件 (在 :rfc:`6066` 中定" "義)。" -#: ../../library/ssl.rst:865 +#: ../../library/ssl.rst:887 msgid "" "Whether the OpenSSL library has built-in support for the *Next Protocol " "Negotiation* as described in the `Application Layer Protocol Negotiation " @@ -1206,37 +1240,42 @@ msgstr "" "描述。當此值為 true 時,你可以使用 :meth:`SSLContext.set_npn_protocols` 方法" "來公告你想支援的協定。" -#: ../../library/ssl.rst:875 +#: ../../library/ssl.rst:897 msgid "" "Whether the OpenSSL library has built-in support for the SSL 2.0 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 SSL 2.0 協定。" -#: ../../library/ssl.rst:881 +#: ../../library/ssl.rst:903 msgid "" "Whether the OpenSSL library has built-in support for the SSL 3.0 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 SSL 3.0 協定。" -#: ../../library/ssl.rst:887 +#: ../../library/ssl.rst:909 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.0 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.0 協定。" -#: ../../library/ssl.rst:893 +#: ../../library/ssl.rst:915 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.1 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.1 協定。" -#: ../../library/ssl.rst:899 +#: ../../library/ssl.rst:921 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.2 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.2 協定。" -#: ../../library/ssl.rst:905 +#: ../../library/ssl.rst:927 msgid "" "Whether the OpenSSL library has built-in support for the TLS 1.3 protocol." msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.3 協定。" -#: ../../library/ssl.rst:911 +#: ../../library/ssl.rst:933 +#, fuzzy +msgid "Whether the OpenSSL library has built-in support for TLS-PSK." +msgstr "此 OpenSSL 函式庫是否內建支援 TLS 1.0 協定。" + +#: ../../library/ssl.rst:939 msgid "" "List of supported TLS channel binding types. Strings in this list can be " "used as arguments to :meth:`SSLSocket.get_channel_binding`." @@ -1244,11 +1283,11 @@ msgstr "" "支援的 TLS 通道綁定類型列表。列表中的字串可以作為 :meth:`SSLSocket." "get_channel_binding` 的參數。" -#: ../../library/ssl.rst:918 +#: ../../library/ssl.rst:946 msgid "The version string of the OpenSSL library loaded by the interpreter::" msgstr "直譯器所加載的 OpenSSL 函式庫的版本字串::" -#: ../../library/ssl.rst:920 +#: ../../library/ssl.rst:948 msgid "" ">>> ssl.OPENSSL_VERSION\n" "'OpenSSL 1.0.2k 26 Jan 2017'" @@ -1256,13 +1295,13 @@ msgstr "" ">>> ssl.OPENSSL_VERSION\n" "'OpenSSL 1.0.2k 26 Jan 2017'" -#: ../../library/ssl.rst:927 +#: ../../library/ssl.rst:955 msgid "" "A tuple of five integers representing version information about the OpenSSL " "library::" msgstr "代表 OpenSSL 函式庫版本資訊的五個整數的元組: ::" -#: ../../library/ssl.rst:930 +#: ../../library/ssl.rst:958 msgid "" ">>> ssl.OPENSSL_VERSION_INFO\n" "(1, 0, 2, 11, 15)" @@ -1270,11 +1309,11 @@ msgstr "" ">>> ssl.OPENSSL_VERSION_INFO\n" "(1, 0, 2, 11, 15)" -#: ../../library/ssl.rst:937 +#: ../../library/ssl.rst:965 msgid "The raw version number of the OpenSSL library, as a single integer::" msgstr "OpenSSL 函式庫的初始版本,以單一整數表示::" -#: ../../library/ssl.rst:939 +#: ../../library/ssl.rst:967 msgid "" ">>> ssl.OPENSSL_VERSION_NUMBER\n" "268443839\n" @@ -1286,7 +1325,7 @@ msgstr "" ">>> hex(ssl.OPENSSL_VERSION_NUMBER)\n" "'0x100020bf'" -#: ../../library/ssl.rst:950 +#: ../../library/ssl.rst:978 msgid "" "Alert Descriptions from :rfc:`5246` and others. The `IANA TLS Alert Registry " "`_ 包" "含了此列表以及其含義定義所在的 RFC 的引用。" -#: ../../library/ssl.rst:954 +#: ../../library/ssl.rst:982 msgid "" "Used as the return value of the callback function in :meth:`SSLContext." "set_servername_callback`." msgstr "" "被用來做為 :meth:`SSLContext.set_servername_callback` 中回呼函式的回傳值。" -#: ../../library/ssl.rst:961 +#: ../../library/ssl.rst:989 msgid ":class:`enum.IntEnum` collection of ALERT_DESCRIPTION_* constants." msgstr ":class:`enum.IntEnum` 為 ALERT_DESCRIPTION_* 常數中的一個集合。" -#: ../../library/ssl.rst:967 +#: ../../library/ssl.rst:995 msgid "" "Option for :func:`create_default_context` and :meth:`SSLContext." "load_default_certs`. This value indicates that the context may be used to " @@ -1318,7 +1357,7 @@ msgstr "" ":func:`create_default_context` 和 :meth:`SSLContext.load_default_certs` 的選" "項。此值表示該語境可能會用於驗證網頁伺服器 (因此它將用於建立用戶端 socket)。" -#: ../../library/ssl.rst:976 +#: ../../library/ssl.rst:1004 msgid "" "Option for :func:`create_default_context` and :meth:`SSLContext." "load_default_certs`. This value indicates that the context may be used to " @@ -1329,11 +1368,11 @@ msgstr "" "項。此值表示該語境可能會用於驗證網頁用戶端 (因此,它將用於建立伺服器端的 " "socket)。" -#: ../../library/ssl.rst:985 +#: ../../library/ssl.rst:1013 msgid ":class:`enum.IntEnum` collection of SSL_ERROR_* constants." msgstr ":class:`enum.IntEnum` 為 SSL_ERROR_* 常數中的一個集合。" -#: ../../library/ssl.rst:991 +#: ../../library/ssl.rst:1019 msgid "" ":class:`enum.IntEnum` collection of SSL and TLS versions for :attr:" "`SSLContext.maximum_version` and :attr:`SSLContext.minimum_version`." @@ -1341,7 +1380,7 @@ msgstr "" "用於 :attr:`SSLContext.maximum_version` 和 :attr:`SSLContext." "minimum_version` 的 SSL 和 TLS 版本 :class:`enum.IntEnum` 集合。" -#: ../../library/ssl.rst:999 +#: ../../library/ssl.rst:1027 msgid "" "The minimum or maximum supported SSL or TLS version. These are magic " "constants. Their values don't reflect the lowest and highest available TLS/" @@ -1350,11 +1389,11 @@ msgstr "" "最低或最高支援的 SSL 或 TLS 版本。這些是特殊常數。它們的值並不反映可用的最低" "和最高 TLS/SSL 版本。" -#: ../../library/ssl.rst:1009 +#: ../../library/ssl.rst:1037 msgid "SSL 3.0 to TLS 1.3." msgstr "SSL 3.0 到 TLS 1.3。" -#: ../../library/ssl.rst:1013 +#: ../../library/ssl.rst:1041 msgid "" "All :class:`TLSVersion` members except :attr:`TLSVersion.TLSv1_2` and :attr:" "`TLSVersion.TLSv1_3` are deprecated." @@ -1362,47 +1401,47 @@ msgstr "" "除了 :attr:`TLSVersion.TLSv1_2` 和 :attr:`TLSVersion.TLSv1_3` 之外,所有的 :" "class:`TLSVersion` 成員都已被棄用。" -#: ../../library/ssl.rst:1018 +#: ../../library/ssl.rst:1046 msgid "SSL Sockets" msgstr "SSL Sockets" -#: ../../library/ssl.rst:1022 +#: ../../library/ssl.rst:1050 msgid "SSL sockets provide the following methods of :ref:`socket-objects`:" msgstr "SSL sockets 提供以下 :ref:`socket-objects` 方法:" -#: ../../library/ssl.rst:1024 +#: ../../library/ssl.rst:1052 msgid ":meth:`~socket.socket.accept`" msgstr ":meth:`~socket.socket.accept`" -#: ../../library/ssl.rst:1025 +#: ../../library/ssl.rst:1053 msgid ":meth:`~socket.socket.bind`" msgstr ":meth:`~socket.socket.bind`" -#: ../../library/ssl.rst:1026 +#: ../../library/ssl.rst:1054 msgid ":meth:`~socket.socket.close`" msgstr ":meth:`~socket.socket.close`" -#: ../../library/ssl.rst:1027 +#: ../../library/ssl.rst:1055 msgid ":meth:`~socket.socket.connect`" msgstr ":meth:`~socket.socket.connect`" -#: ../../library/ssl.rst:1028 +#: ../../library/ssl.rst:1056 msgid ":meth:`~socket.socket.detach`" msgstr ":meth:`~socket.socket.detach`" -#: ../../library/ssl.rst:1029 +#: ../../library/ssl.rst:1057 msgid ":meth:`~socket.socket.fileno`" msgstr ":meth:`~socket.socket.fileno`" -#: ../../library/ssl.rst:1030 +#: ../../library/ssl.rst:1058 msgid ":meth:`~socket.socket.getpeername`, :meth:`~socket.socket.getsockname`" msgstr ":meth:`~socket.socket.getpeername`、:meth:`~socket.socket.getsockname`" -#: ../../library/ssl.rst:1031 +#: ../../library/ssl.rst:1059 msgid ":meth:`~socket.socket.getsockopt`, :meth:`~socket.socket.setsockopt`" msgstr ":meth:`~socket.socket.getsockopt`、:meth:`~socket.socket.setsockopt`" -#: ../../library/ssl.rst:1032 +#: ../../library/ssl.rst:1060 msgid "" ":meth:`~socket.socket.gettimeout`, :meth:`~socket.socket.settimeout`, :meth:" "`~socket.socket.setblocking`" @@ -1410,15 +1449,15 @@ msgstr "" ":meth:`~socket.socket.gettimeout`、:meth:`~socket.socket.settimeout`、:meth:" "`~socket.socket.setblocking`" -#: ../../library/ssl.rst:1034 +#: ../../library/ssl.rst:1062 msgid ":meth:`~socket.socket.listen`" msgstr ":meth:`~socket.socket.listen`" -#: ../../library/ssl.rst:1035 +#: ../../library/ssl.rst:1063 msgid ":meth:`~socket.socket.makefile`" msgstr ":meth:`~socket.socket.makefile`" -#: ../../library/ssl.rst:1036 +#: ../../library/ssl.rst:1064 msgid "" ":meth:`~socket.socket.recv`, :meth:`~socket.socket.recv_into` (but passing a " "non-zero ``flags`` argument is not allowed)" @@ -1426,7 +1465,7 @@ msgstr "" ":meth:`~socket.socket.recv`、:meth:`~socket.socket.recv_into` (但不允許傳遞" "非零的 ``flags`` 引數)" -#: ../../library/ssl.rst:1038 +#: ../../library/ssl.rst:1066 msgid "" ":meth:`~socket.socket.send`, :meth:`~socket.socket.sendall` (with the same " "limitation)" @@ -1434,7 +1473,7 @@ msgstr "" ":meth:`~socket.socket.send`、:meth:`~socket.socket.sendall` (同樣不允許傳遞" "非零的 ``flags`` 引數)" -#: ../../library/ssl.rst:1040 +#: ../../library/ssl.rst:1068 msgid "" ":meth:`~socket.socket.sendfile` (but :mod:`os.sendfile` will be used for " "plain-text sockets only, else :meth:`~socket.socket.send` will be used)" @@ -1442,11 +1481,11 @@ msgstr "" ":meth:`~socket.socket.sendfile` (但 :mod:`os.sendfile` 只能用於純文本 " "sockets,其餘則會使用 :meth:`~socket.socket.send`)" -#: ../../library/ssl.rst:1042 +#: ../../library/ssl.rst:1070 msgid ":meth:`~socket.socket.shutdown`" msgstr ":meth:`~socket.socket.shutdown`" -#: ../../library/ssl.rst:1044 +#: ../../library/ssl.rst:1072 msgid "" "However, since the SSL (and TLS) protocol has its own framing atop of TCP, " "the SSL sockets abstraction can, in certain respects, diverge from the " @@ -1457,18 +1496,18 @@ msgstr "" "sockets 的抽象可能會與普通操作系統級別的 sockets 規範有所不同。特別是請參閱" "\\ :ref:`關於 non-blocking sockets 的說明 `。" -#: ../../library/ssl.rst:1049 +#: ../../library/ssl.rst:1077 msgid "" "Instances of :class:`SSLSocket` must be created using the :meth:`SSLContext." "wrap_socket` method." msgstr "" ":class:`SSLSocket` 的實例必須使用 :meth:`SSLContext.wrap_socket` 方法建立。" -#: ../../library/ssl.rst:1052 +#: ../../library/ssl.rst:1080 msgid "The :meth:`sendfile` method was added." msgstr "新增 :meth:`sendfile` 方法。" -#: ../../library/ssl.rst:1055 +#: ../../library/ssl.rst:1083 msgid "" "The :meth:`shutdown` does not reset the socket timeout each time bytes are " "received or sent. The socket timeout is now the maximum total duration of " @@ -1477,7 +1516,7 @@ msgstr "" ":meth:`shutdown` 不會在每次接收或發送位元組時重置 socket 超時時間。現在," "socket 超時時間是關閉操作的最大總持續時間。" -#: ../../library/ssl.rst:1060 +#: ../../library/ssl.rst:1088 msgid "" "It is deprecated to create a :class:`SSLSocket` instance directly, use :meth:" "`SSLContext.wrap_socket` to wrap a socket." @@ -1485,7 +1524,7 @@ msgstr "" "直接建立 :class:`SSLSocket` 實例的方式已被棄用,請使用 :meth:`SSLContext." "wrap_socket` 來包裝 socket。" -#: ../../library/ssl.rst:1064 +#: ../../library/ssl.rst:1092 msgid "" ":class:`SSLSocket` instances must to created with :meth:`~SSLContext." "wrap_socket`. In earlier versions, it was possible to create instances " @@ -1494,7 +1533,7 @@ msgstr "" ":class:`SSLSocket` 實例必須使用 :meth:`~SSLContext.wrap_socket` 建立。在較早" "的版本中可以直接建立實例,但這從未被記錄或正式支援。" -#: ../../library/ssl.rst:1070 +#: ../../library/ssl.rst:1098 msgid "" "Python now uses ``SSL_read_ex`` and ``SSL_write_ex`` internally. The " "functions support reading and writing of data larger than 2 GB. Writing zero-" @@ -1503,11 +1542,11 @@ msgstr "" "Python 現在內部使用了 ``SSL_read_ex`` 和 ``SSL_write_ex`` 函式。這些函式支援" "讀取和寫入大於 2 GB 的資料。寫入零長度的資料不再會導致協定違規錯誤。" -#: ../../library/ssl.rst:1075 +#: ../../library/ssl.rst:1103 msgid "SSL sockets also have the following additional methods and attributes:" msgstr "SSL sockets 還具有以下附加方法和屬性:" -#: ../../library/ssl.rst:1079 +#: ../../library/ssl.rst:1107 msgid "" "Read up to *len* bytes of data from the SSL socket and return the result as " "a ``bytes`` instance. If *buffer* is specified, then read into the buffer " @@ -1516,7 +1555,7 @@ msgstr "" "從 SSL socket 讀取 *len* 位元組的資料,並將結果以 ``bytes`` 實例的形式回傳。" "如果指定了 *buffer*,則將資料讀入緩衝區,並回傳讀取的位元組。" -#: ../../library/ssl.rst:1083 +#: ../../library/ssl.rst:1111 msgid "" "Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" "ref:`non-blocking ` and the read would block." @@ -1524,14 +1563,14 @@ msgstr "" "如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" "`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且讀取操作將會被阻塞。" -#: ../../library/ssl.rst:1086 +#: ../../library/ssl.rst:1114 msgid "" "As at any time a re-negotiation is possible, a call to :meth:`read` can also " "cause write operations." msgstr "" "由於在任何時刻都可能發生重新協商,呼叫 :meth:`read` 也可能觸發寫入操作。" -#: ../../library/ssl.rst:1089 +#: ../../library/ssl.rst:1117 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration to read up to *len* " @@ -1540,11 +1579,11 @@ msgstr "" "當接收或發送位元組時,socket 的超時時間將不再重置。現在,socket 超時時間是讀" "取最多 *len* 位元組的總最大持續時間。" -#: ../../library/ssl.rst:1094 +#: ../../library/ssl.rst:1122 msgid "Use :meth:`~SSLSocket.recv` instead of :meth:`~SSLSocket.read`." msgstr "請改用 :meth:`~SSLSocket.recv` 來替換掉 :meth:`~SSLSocket.read`。" -#: ../../library/ssl.rst:1099 +#: ../../library/ssl.rst:1127 msgid "" "Write *buf* to the SSL socket and return the number of bytes written. The " "*buf* argument must be an object supporting the buffer interface." @@ -1552,7 +1591,7 @@ msgstr "" "將 *buf* 寫入 SSL socket 並回傳寫入的位元組數量。*buf* 引數必須是支援緩衝區介" "面的物件。" -#: ../../library/ssl.rst:1102 +#: ../../library/ssl.rst:1130 msgid "" "Raise :exc:`SSLWantReadError` or :exc:`SSLWantWriteError` if the socket is :" "ref:`non-blocking ` and the write would block." @@ -1560,14 +1599,14 @@ msgstr "" "如果 socket 是\\ :ref:`非阻塞的 `\\ 則會引發 :exc:" "`SSLWantReadError` 或 :exc:`SSLWantWriteError` 並且寫入操作將會被阻塞。" -#: ../../library/ssl.rst:1105 +#: ../../library/ssl.rst:1133 msgid "" "As at any time a re-negotiation is possible, a call to :meth:`write` can " "also cause read operations." msgstr "" "由於在任何時刻都可能發生重新協商,呼叫 :meth:`write` 也可能觸發讀取操作。" -#: ../../library/ssl.rst:1108 +#: ../../library/ssl.rst:1136 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration to write *buf*." @@ -1575,11 +1614,11 @@ msgstr "" "當接收或發送位元組時,socket 的超時時間將不再重置。現在,socket 超時時間是寫" "入 *buf* 的總最大持續時間。" -#: ../../library/ssl.rst:1112 +#: ../../library/ssl.rst:1140 msgid "Use :meth:`~SSLSocket.send` instead of :meth:`~SSLSocket.write`." msgstr "請改用 :meth:`~SSLSocket.send` 來替換掉 :meth:`~SSLSocket.write`。" -#: ../../library/ssl.rst:1117 +#: ../../library/ssl.rst:1145 msgid "" "The :meth:`~SSLSocket.read` and :meth:`~SSLSocket.write` methods are the low-" "level methods that read and write unencrypted, application-level data and " @@ -1591,7 +1630,7 @@ msgstr "" "讀取和寫入未加密的應用層資料,並將其加密/解密為加密的寫入層資料。這些方法需要" "一個已建立的 SSL 連接,即握手已完成,且未呼叫 :meth:`SSLSocket.unwrap`。" -#: ../../library/ssl.rst:1123 +#: ../../library/ssl.rst:1151 msgid "" "Normally you should use the socket API methods like :meth:`~socket.socket." "recv` and :meth:`~socket.socket.send` instead of these methods." @@ -1599,11 +1638,11 @@ msgstr "" "通常你應該使用像 :meth:`~socket.socket.recv` 和 :meth:`~socket.socket.send` " "這樣的 socket API 方法,而不是直接使用這些方法。" -#: ../../library/ssl.rst:1129 +#: ../../library/ssl.rst:1157 msgid "Perform the SSL setup handshake." msgstr "執行 SSL 設定握手。" -#: ../../library/ssl.rst:1131 +#: ../../library/ssl.rst:1159 msgid "" "The handshake method also performs :func:`match_hostname` when the :attr:" "`~SSLContext.check_hostname` attribute of the socket's :attr:`~SSLSocket." @@ -1612,7 +1651,7 @@ msgstr "" "當 socket 的 :attr:`~SSLSocket.context` 的 :attr:`~SSLContext." "check_hostname` 屬性質為 true 時,握手方法也會執行 :func:`match_hostname`。" -#: ../../library/ssl.rst:1136 +#: ../../library/ssl.rst:1164 msgid "" "The socket timeout is no longer reset each time bytes are received or sent. " "The socket timeout is now the maximum total duration of the handshake." @@ -1620,7 +1659,7 @@ msgstr "" "Socket 超時時間已經不會在每次接收或傳送位元組時重置。現在,超時時間是握手過程" "的最大總持續時間。" -#: ../../library/ssl.rst:1140 +#: ../../library/ssl.rst:1168 msgid "" "Hostname or IP address is matched by OpenSSL during handshake. The function :" "func:`match_hostname` is no longer used. In case OpenSSL refuses a hostname " @@ -1631,7 +1670,7 @@ msgstr "" "`match_hostname` 函式。如果 OpenSSL 拒絕某個主機名稱或 IP 地址,握手將會提前" "中止,並向對方發送 TLS 警報訊息。" -#: ../../library/ssl.rst:1148 +#: ../../library/ssl.rst:1176 msgid "" "If there is no certificate for the peer on the other end of the connection, " "return ``None``. If the SSL handshake hasn't been done yet, raise :exc:" @@ -1640,7 +1679,7 @@ msgstr "" "如果連線端沒有證書,則回傳 ``None``。如果 SSL 握手尚未完成,則引發 :exc:" "`ValueError`。" -#: ../../library/ssl.rst:1152 +#: ../../library/ssl.rst:1180 msgid "" "If the ``binary_form`` parameter is :const:`False`, and a certificate was " "received from the peer, this method returns a :class:`dict` instance. If " @@ -1657,7 +1696,7 @@ msgstr "" "``issuer`` (簽發證書的主體)。如果證書中包含 *Subject Alternative Name* 擴充 " "(參考\\ :rfc:`3280`\\ ),字典中還會有一個 ``subjectAltName`` 鍵。" -#: ../../library/ssl.rst:1161 +#: ../../library/ssl.rst:1189 msgid "" "The ``subject`` and ``issuer`` fields are tuples containing the sequence of " "relative distinguished names (RDNs) given in the certificate's data " @@ -1668,7 +1707,7 @@ msgstr "" "names, RDNs) 序列的元組,這些 RDN 來自證書資料結構中的相應欄位。每個 RDN 都是" "一組名稱與值的對。以下是現實中的範例: ::" -#: ../../library/ssl.rst:1166 +#: ../../library/ssl.rst:1194 msgid "" "{'issuer': ((('countryName', 'IL'),),\n" " (('organizationName', 'StartCom Ltd.'),),\n" @@ -1710,7 +1749,7 @@ msgstr "" " 'subjectAltName': (('DNS', '*.eff.org'), ('DNS', 'eff.org')),\n" " 'version': 3}" -#: ../../library/ssl.rst:1185 +#: ../../library/ssl.rst:1213 msgid "" "If the ``binary_form`` parameter is :const:`True`, and a certificate was " "provided, this method returns the DER-encoded form of the entire certificate " @@ -1719,16 +1758,16 @@ msgid "" "socket's role:" msgstr "" "如果 ``binary_form`` 參數設定為 :const:`True`,且對等提供了證書,則該方法會" -"以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回傳:" +"以 DER 編碼形式 將整個證書以位元組序列形式回傳。如果對等未提供證書,則回傳 :" "const:`None`。對等是否提供證書取決於 SSL socket 的腳色:" -#: ../../library/ssl.rst:1191 +#: ../../library/ssl.rst:1219 msgid "" "for a client SSL socket, the server will always provide a certificate, " "regardless of whether validation was required;" msgstr "對於客戶端 SSL socket,伺服器將永遠提供證書,無論是否需要進行驗證;" -#: ../../library/ssl.rst:1194 +#: ../../library/ssl.rst:1222 msgid "" "for a server SSL socket, the client will only provide a certificate when " "requested by the server; therefore :meth:`getpeercert` will return :const:" @@ -1739,28 +1778,41 @@ msgstr "" "是 :const:`CERT_NONE` (而非 :const:`CERT_OPTIONAL` 或 :const:" "`CERT_REQUIRED`),則 :meth:`getpeercert` 會回傳 :const:`None`。" -#: ../../library/ssl.rst:1199 +#: ../../library/ssl.rst:1227 msgid "See also :attr:`SSLContext.check_hostname`." msgstr "請見 :attr:`SSLContext.check_hostname`。" -#: ../../library/ssl.rst:1201 +#: ../../library/ssl.rst:1229 msgid "" "The returned dictionary includes additional items such as ``issuer`` and " "``notBefore``." msgstr "" -#: ../../library/ssl.rst:1205 +#: ../../library/ssl.rst:1233 msgid "" ":exc:`ValueError` is raised when the handshake isn't done. The returned " "dictionary includes additional X509v3 extension items such as " "``crlDistributionPoints``, ``caIssuers`` and ``OCSP`` URIs." msgstr "" -#: ../../library/ssl.rst:1210 +#: ../../library/ssl.rst:1238 msgid "IPv6 address strings no longer have a trailing new line." msgstr "" -#: ../../library/ssl.rst:1215 +#: ../../library/ssl.rst:1243 +msgid "" +"Returns verified certificate chain provided by the other end of the SSL " +"channel as a list of DER-encoded bytes. If certificate verification was " +"disabled method acts the same as :meth:`~SSLSocket.get_unverified_chain`." +msgstr "" + +#: ../../library/ssl.rst:1252 +msgid "" +"Returns raw certificate chain provided by the other end of the SSL channel " +"as a list of DER-encoded bytes." +msgstr "" + +#: ../../library/ssl.rst:1259 msgid "" "Returns a three-value tuple containing the name of the cipher being used, " "the version of the SSL protocol that defines its use, and the number of " @@ -1768,7 +1820,7 @@ msgid "" "``None``." msgstr "" -#: ../../library/ssl.rst:1221 +#: ../../library/ssl.rst:1265 msgid "" "Return the list of ciphers available in both the client and server. Each " "entry of the returned list is a three-value tuple containing the name of the " @@ -1778,25 +1830,25 @@ msgid "" "socket." msgstr "" -#: ../../library/ssl.rst:1232 +#: ../../library/ssl.rst:1276 msgid "" "Return the compression algorithm being used as a string, or ``None`` if the " "connection isn't compressed." msgstr "" -#: ../../library/ssl.rst:1235 +#: ../../library/ssl.rst:1279 msgid "" "If the higher-level protocol supports its own compression mechanism, you can " "use :data:`OP_NO_COMPRESSION` to disable SSL-level compression." msgstr "" -#: ../../library/ssl.rst:1242 +#: ../../library/ssl.rst:1286 msgid "" "Get channel binding data for current connection, as a bytes object. Returns " "``None`` if not connected or the handshake has not been completed." msgstr "" -#: ../../library/ssl.rst:1245 +#: ../../library/ssl.rst:1289 msgid "" "The *cb_type* parameter allow selection of the desired channel binding type. " "Valid channel binding types are listed in the :data:`CHANNEL_BINDING_TYPES` " @@ -1805,7 +1857,7 @@ msgid "" "channel binding type is requested." msgstr "" -#: ../../library/ssl.rst:1255 +#: ../../library/ssl.rst:1299 msgid "" "Return the protocol that was selected during the TLS handshake. If :meth:" "`SSLContext.set_alpn_protocols` was not called, if the other party does not " @@ -1813,7 +1865,7 @@ msgid "" "protocols, or if the handshake has not happened yet, ``None`` is returned." msgstr "" -#: ../../library/ssl.rst:1265 +#: ../../library/ssl.rst:1309 msgid "" "Return the higher-level protocol that was selected during the TLS/SSL " "handshake. If :meth:`SSLContext.set_npn_protocols` was not called, or if the " @@ -1821,11 +1873,11 @@ msgid "" "this will return ``None``." msgstr "" -#: ../../library/ssl.rst:1274 ../../library/ssl.rst:1643 +#: ../../library/ssl.rst:1318 ../../library/ssl.rst:1687 msgid "NPN has been superseded by ALPN" msgstr "" -#: ../../library/ssl.rst:1278 +#: ../../library/ssl.rst:1322 msgid "" "Performs the SSL shutdown handshake, which removes the TLS layer from the " "underlying socket, and returns the underlying socket object. This can be " @@ -1834,7 +1886,7 @@ msgid "" "other side of the connection, rather than the original socket." msgstr "" -#: ../../library/ssl.rst:1286 +#: ../../library/ssl.rst:1330 msgid "" "Requests post-handshake authentication (PHA) from a TLS 1.3 client. PHA can " "only be initiated for a TLS 1.3 connection from a server-side socket, after " @@ -1842,26 +1894,26 @@ msgid "" "`SSLContext.post_handshake_auth`." msgstr "" -#: ../../library/ssl.rst:1291 +#: ../../library/ssl.rst:1335 msgid "" "The method does not perform a cert exchange immediately. The server-side " "sends a CertificateRequest during the next write event and expects the " "client to respond with a certificate on the next read event." msgstr "" -#: ../../library/ssl.rst:1295 +#: ../../library/ssl.rst:1339 msgid "" "If any precondition isn't met (e.g. not TLS 1.3, PHA not enabled), an :exc:" "`SSLError` is raised." msgstr "" -#: ../../library/ssl.rst:1299 +#: ../../library/ssl.rst:1343 msgid "" "Only available with OpenSSL 1.1.1 and TLS 1.3 enabled. Without TLS 1.3 " "support, the method raises :exc:`NotImplementedError`." msgstr "" -#: ../../library/ssl.rst:1306 +#: ../../library/ssl.rst:1350 msgid "" "Return the actual SSL protocol version negotiated by the connection as a " "string, or ``None`` if no secure connection is established. As of this " @@ -1870,29 +1922,29 @@ msgid "" "may define more return values." msgstr "" -#: ../../library/ssl.rst:1316 +#: ../../library/ssl.rst:1360 msgid "" "Returns the number of already decrypted bytes available for read, pending on " "the connection." msgstr "" -#: ../../library/ssl.rst:1321 +#: ../../library/ssl.rst:1365 msgid "The :class:`SSLContext` object this SSL socket is tied to." msgstr "" -#: ../../library/ssl.rst:1327 +#: ../../library/ssl.rst:1371 msgid "" "A boolean which is ``True`` for server-side sockets and ``False`` for client-" "side sockets." msgstr "" -#: ../../library/ssl.rst:1334 +#: ../../library/ssl.rst:1378 msgid "" "Hostname of the server: :class:`str` type, or ``None`` for server-side " "socket or if the hostname was not specified in the constructor." msgstr "" -#: ../../library/ssl.rst:1339 +#: ../../library/ssl.rst:1383 msgid "" "The attribute is now always ASCII text. When ``server_hostname`` is an " "internationalized domain name (IDN), this attribute now stores the A-label " @@ -1900,7 +1952,7 @@ msgid "" "org\"``)." msgstr "" -#: ../../library/ssl.rst:1347 +#: ../../library/ssl.rst:1391 msgid "" "The :class:`SSLSession` for this SSL connection. The session is available " "for client and server side sockets after the TLS handshake has been " @@ -1908,11 +1960,11 @@ msgid "" "`~SSLSocket.do_handshake` has been called to reuse a session." msgstr "" -#: ../../library/ssl.rst:1360 +#: ../../library/ssl.rst:1404 msgid "SSL Contexts" msgstr "" -#: ../../library/ssl.rst:1364 +#: ../../library/ssl.rst:1408 msgid "" "An SSL context holds various data longer-lived than single SSL connections, " "such as SSL configuration options, certificate(s) and private key(s). It " @@ -1920,7 +1972,7 @@ msgid "" "speed up repeated connections from the same clients." msgstr "" -#: ../../library/ssl.rst:1371 +#: ../../library/ssl.rst:1415 msgid "" "Create a new SSL context. You may pass *protocol* which must be one of the " "``PROTOCOL_*`` constants defined in this module. The parameter specifies " @@ -1931,109 +1983,109 @@ msgid "" "provides the most compatibility with other versions." msgstr "" -#: ../../library/ssl.rst:1380 +#: ../../library/ssl.rst:1424 msgid "" "Here's a table showing which versions in a client (down the side) can " "connect to which versions in a server (along the top):" msgstr "" -#: ../../library/ssl.rst:1386 +#: ../../library/ssl.rst:1430 msgid "*client* / **server**" msgstr "*client* / **server**" -#: ../../library/ssl.rst:1386 +#: ../../library/ssl.rst:1430 msgid "**SSLv2**" msgstr "**SSLv2**" -#: ../../library/ssl.rst:1386 +#: ../../library/ssl.rst:1430 msgid "**SSLv3**" msgstr "**SSLv3**" -#: ../../library/ssl.rst:1386 +#: ../../library/ssl.rst:1430 msgid "**TLS** [3]_" msgstr "**TLS** [3]_" -#: ../../library/ssl.rst:1386 +#: ../../library/ssl.rst:1430 msgid "**TLSv1**" msgstr "**TLSv1**" -#: ../../library/ssl.rst:1386 +#: ../../library/ssl.rst:1430 msgid "**TLSv1.1**" msgstr "**TLSv1.1**" -#: ../../library/ssl.rst:1386 +#: ../../library/ssl.rst:1430 msgid "**TLSv1.2**" msgstr "**TLSv1.2**" -#: ../../library/ssl.rst:1388 +#: ../../library/ssl.rst:1432 msgid "*SSLv2*" msgstr "*SSLv2*" -#: ../../library/ssl.rst:1388 ../../library/ssl.rst:1389 -#: ../../library/ssl.rst:1390 ../../library/ssl.rst:1391 -#: ../../library/ssl.rst:1392 ../../library/ssl.rst:1393 +#: ../../library/ssl.rst:1432 ../../library/ssl.rst:1433 +#: ../../library/ssl.rst:1434 ../../library/ssl.rst:1435 +#: ../../library/ssl.rst:1436 ../../library/ssl.rst:1437 msgid "yes" msgstr "" -#: ../../library/ssl.rst:1388 ../../library/ssl.rst:1389 -#: ../../library/ssl.rst:1391 ../../library/ssl.rst:1392 -#: ../../library/ssl.rst:1393 +#: ../../library/ssl.rst:1432 ../../library/ssl.rst:1433 +#: ../../library/ssl.rst:1435 ../../library/ssl.rst:1436 +#: ../../library/ssl.rst:1437 msgid "no" msgstr "" -#: ../../library/ssl.rst:1388 ../../library/ssl.rst:1390 +#: ../../library/ssl.rst:1432 ../../library/ssl.rst:1434 msgid "no [1]_" msgstr "" -#: ../../library/ssl.rst:1389 +#: ../../library/ssl.rst:1433 msgid "*SSLv3*" msgstr "*SSLv3*" -#: ../../library/ssl.rst:1389 ../../library/ssl.rst:1390 +#: ../../library/ssl.rst:1433 ../../library/ssl.rst:1434 msgid "no [2]_" msgstr "" -#: ../../library/ssl.rst:1390 +#: ../../library/ssl.rst:1434 msgid "*TLS* (*SSLv23*) [3]_" msgstr "*TLS* (*SSLv23*) [3]_" -#: ../../library/ssl.rst:1391 +#: ../../library/ssl.rst:1435 msgid "*TLSv1*" msgstr "*TLSv1*" -#: ../../library/ssl.rst:1392 +#: ../../library/ssl.rst:1436 msgid "*TLSv1.1*" msgstr "*TLSv1.1*" -#: ../../library/ssl.rst:1393 +#: ../../library/ssl.rst:1437 msgid "*TLSv1.2*" msgstr "*TLSv1.2*" -#: ../../library/ssl.rst:1396 +#: ../../library/ssl.rst:1440 msgid "Footnotes" msgstr "註解" -#: ../../library/ssl.rst:1397 +#: ../../library/ssl.rst:1441 msgid ":class:`SSLContext` disables SSLv2 with :data:`OP_NO_SSLv2` by default." msgstr ":class:`SSLContext` 預設會關閉 SSLv2 的 :data:`OP_NO_SSLv2`。" -#: ../../library/ssl.rst:1398 +#: ../../library/ssl.rst:1442 msgid ":class:`SSLContext` disables SSLv3 with :data:`OP_NO_SSLv3` by default." msgstr ":class:`SSLContext` 預設會關閉 SSLv3 的 :data:`OP_NO_SSLv3`。" -#: ../../library/ssl.rst:1399 +#: ../../library/ssl.rst:1443 msgid "" "TLS 1.3 protocol will be available with :data:`PROTOCOL_TLS` in OpenSSL >= " "1.1.1. There is no dedicated PROTOCOL constant for just TLS 1.3." msgstr "" -#: ../../library/ssl.rst:1404 +#: ../../library/ssl.rst:1448 msgid "" ":func:`create_default_context` lets the :mod:`ssl` module choose security " "settings for a given purpose." msgstr "" -#: ../../library/ssl.rst:1409 +#: ../../library/ssl.rst:1453 msgid "" "The context is created with secure default values. The options :data:" "`OP_NO_COMPRESSION`, :data:`OP_CIPHER_SERVER_PREFERENCE`, :data:" @@ -2043,14 +2095,14 @@ msgid "" "ciphers and no ``MD5`` ciphers." msgstr "" -#: ../../library/ssl.rst:1419 +#: ../../library/ssl.rst:1463 msgid "" ":class:`SSLContext` without protocol argument is deprecated. The context " "class will either require :data:`PROTOCOL_TLS_CLIENT` or :data:" "`PROTOCOL_TLS_SERVER` protocol in the future." msgstr "" -#: ../../library/ssl.rst:1425 +#: ../../library/ssl.rst:1469 msgid "" "The default cipher suites now include only secure AES and ChaCha20 ciphers " "with forward secrecy and security level 2. RSA and DH keys with less than " @@ -2059,7 +2111,7 @@ msgid "" "use TLS 1.2 as minimum TLS version." msgstr "" -#: ../../library/ssl.rst:1433 +#: ../../library/ssl.rst:1477 msgid "" ":class:`SSLContext` only supports limited mutation once it has been used by " "a connection. Adding new certificates to the internal trust store is " @@ -2067,29 +2119,29 @@ msgid "" "may result in surprising behavior." msgstr "" -#: ../../library/ssl.rst:1440 +#: ../../library/ssl.rst:1484 msgid "" ":class:`SSLContext` is designed to be shared and used by multiple " "connections. Thus, it is thread-safe as long as it is not reconfigured after " "being used by a connection." msgstr "" -#: ../../library/ssl.rst:1445 +#: ../../library/ssl.rst:1489 msgid ":class:`SSLContext` objects have the following methods and attributes:" msgstr "" -#: ../../library/ssl.rst:1449 +#: ../../library/ssl.rst:1493 msgid "" "Get statistics about quantities of loaded X.509 certificates, count of X.509 " "certificates flagged as CA certificates and certificate revocation lists as " "dictionary." msgstr "" -#: ../../library/ssl.rst:1453 +#: ../../library/ssl.rst:1497 msgid "Example for a context with one CA cert and one other cert::" msgstr "" -#: ../../library/ssl.rst:1455 +#: ../../library/ssl.rst:1499 msgid "" ">>> context.cert_store_stats()\n" "{'crl': 0, 'x509_ca': 1, 'x509': 2}" @@ -2097,7 +2149,7 @@ msgstr "" ">>> context.cert_store_stats()\n" "{'crl': 0, 'x509_ca': 1, 'x509': 2}" -#: ../../library/ssl.rst:1463 +#: ../../library/ssl.rst:1507 msgid "" "Load a private key and the corresponding certificate. The *certfile* string " "must be the path to a single file in PEM format containing the certificate " @@ -2108,7 +2160,7 @@ msgid "" "more information on how the certificate is stored in the *certfile*." msgstr "" -#: ../../library/ssl.rst:1472 +#: ../../library/ssl.rst:1516 msgid "" "The *password* argument may be a function to call to get the password for " "decrypting the private key. It will only be called if the private key is " @@ -2120,24 +2172,24 @@ msgid "" "encrypted and no password is needed." msgstr "" -#: ../../library/ssl.rst:1481 +#: ../../library/ssl.rst:1525 msgid "" "If the *password* argument is not specified and a password is required, " "OpenSSL's built-in password prompting mechanism will be used to " "interactively prompt the user for a password." msgstr "" -#: ../../library/ssl.rst:1485 +#: ../../library/ssl.rst:1529 msgid "" "An :class:`SSLError` is raised if the private key doesn't match with the " "certificate." msgstr "" -#: ../../library/ssl.rst:1488 +#: ../../library/ssl.rst:1532 msgid "New optional argument *password*." msgstr "" -#: ../../library/ssl.rst:1493 +#: ../../library/ssl.rst:1537 msgid "" "Load a set of default \"certification authority\" (CA) certificates from " "default locations. On Windows it loads CA certs from the ``CA`` and ``ROOT`` " @@ -2146,7 +2198,7 @@ msgid "" "from other locations, too." msgstr "" -#: ../../library/ssl.rst:1499 +#: ../../library/ssl.rst:1543 msgid "" "The *purpose* flag specifies what kind of CA certificates are loaded. The " "default settings :const:`Purpose.SERVER_AUTH` loads certificates, that are " @@ -2155,35 +2207,35 @@ msgid "" "certificate verification on the server side." msgstr "" -#: ../../library/ssl.rst:1509 +#: ../../library/ssl.rst:1553 msgid "" "Load a set of \"certification authority\" (CA) certificates used to validate " "other peers' certificates when :data:`verify_mode` is other than :data:" "`CERT_NONE`. At least one of *cafile* or *capath* must be specified." msgstr "" -#: ../../library/ssl.rst:1513 +#: ../../library/ssl.rst:1557 msgid "" "This method can also load certification revocation lists (CRLs) in PEM or " "DER format. In order to make use of CRLs, :attr:`SSLContext.verify_flags` " "must be configured properly." msgstr "" -#: ../../library/ssl.rst:1517 +#: ../../library/ssl.rst:1561 msgid "" "The *cafile* string, if present, is the path to a file of concatenated CA " "certificates in PEM format. See the discussion of :ref:`ssl-certificates` " "for more information about how to arrange the certificates in this file." msgstr "" -#: ../../library/ssl.rst:1522 +#: ../../library/ssl.rst:1566 msgid "" "The *capath* string, if present, is the path to a directory containing " "several CA certificates in PEM format, following an `OpenSSL specific layout " "`_." msgstr "" -#: ../../library/ssl.rst:1527 +#: ../../library/ssl.rst:1571 msgid "" "The *cadata* object, if present, is either an ASCII string of one or more " "PEM-encoded certificates or a :term:`bytes-like object` of DER-encoded " @@ -2191,11 +2243,11 @@ msgid "" "are ignored but at least one certificate must be present." msgstr "" -#: ../../library/ssl.rst:1532 +#: ../../library/ssl.rst:1576 msgid "New optional argument *cadata*" msgstr "" -#: ../../library/ssl.rst:1537 +#: ../../library/ssl.rst:1581 msgid "" "Get a list of loaded \"certification authority\" (CA) certificates. If the " "``binary_form`` parameter is :const:`False` each list entry is a dict like " @@ -2205,19 +2257,19 @@ msgid "" "a SSL connection." msgstr "" -#: ../../library/ssl.rst:1545 +#: ../../library/ssl.rst:1589 msgid "" "Certificates in a capath directory aren't loaded unless they have been used " "at least once." msgstr "" -#: ../../library/ssl.rst:1552 +#: ../../library/ssl.rst:1596 msgid "" "Get a list of enabled ciphers. The list is in order of cipher priority. See :" "meth:`SSLContext.set_ciphers`." msgstr "" -#: ../../library/ssl.rst:1557 +#: ../../library/ssl.rst:1601 msgid "" ">>> ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)\n" ">>> ctx.set_ciphers('ECDHE+AESGCM:!ECDSA')\n" @@ -2275,7 +2327,7 @@ msgstr "" " 'strength_bits': 128,\n" " 'symmetric': 'aes-128-gcm'}]" -#: ../../library/ssl.rst:1589 +#: ../../library/ssl.rst:1633 msgid "" "Load a set of default \"certification authority\" (CA) certificates from a " "filesystem path defined when building the OpenSSL library. Unfortunately, " @@ -2285,7 +2337,7 @@ msgid "" "configured properly." msgstr "" -#: ../../library/ssl.rst:1598 +#: ../../library/ssl.rst:1642 msgid "" "Set the available ciphers for sockets created with this context. It should " "be a string in the `OpenSSL cipher list format `_" msgstr "" -#: ../../library/ssl.rst:1736 +#: ../../library/ssl.rst:1781 msgid "Vincent Bernat." msgstr "" -#: ../../library/ssl.rst:1742 +#: ../../library/ssl.rst:1787 msgid "" "Wrap an existing Python socket *sock* and return an instance of :attr:" "`SSLContext.sslsocket_class` (default :class:`SSLSocket`). The returned SSL " @@ -2474,13 +2527,13 @@ msgid "" "a :const:`~socket.SOCK_STREAM` socket; other socket types are unsupported." msgstr "" -#: ../../library/ssl.rst:1748 +#: ../../library/ssl.rst:1793 msgid "" "The parameter ``server_side`` is a boolean which identifies whether server-" "side or client-side behavior is desired from this socket." msgstr "" -#: ../../library/ssl.rst:1751 +#: ../../library/ssl.rst:1796 msgid "" "For client-side sockets, the context construction is lazy; if the underlying " "socket isn't connected yet, the context construction will be performed " @@ -2491,7 +2544,7 @@ msgid "" "exc:`SSLError`." msgstr "" -#: ../../library/ssl.rst:1759 +#: ../../library/ssl.rst:1804 msgid "" "On client connections, the optional parameter *server_hostname* specifies " "the hostname of the service which we are connecting to. This allows a " @@ -2500,7 +2553,7 @@ msgid "" "*server_hostname* will raise a :exc:`ValueError` if *server_side* is true." msgstr "" -#: ../../library/ssl.rst:1765 +#: ../../library/ssl.rst:1810 msgid "" "The parameter ``do_handshake_on_connect`` specifies whether to do the SSL " "handshake automatically after doing a :meth:`socket.connect`, or whether the " @@ -2510,7 +2563,7 @@ msgid "" "socket I/O involved in the handshake." msgstr "" -#: ../../library/ssl.rst:1772 +#: ../../library/ssl.rst:1817 msgid "" "The parameter ``suppress_ragged_eofs`` specifies how the :meth:`SSLSocket." "recv` method should signal unexpected EOF from the other end of the " @@ -2520,40 +2573,40 @@ msgid "" "exceptions back to the caller." msgstr "" -#: ../../library/ssl.rst:1779 +#: ../../library/ssl.rst:1824 msgid "*session*, see :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:1781 +#: ../../library/ssl.rst:1826 msgid "" "To wrap an :class:`SSLSocket` in another :class:`SSLSocket`, use :meth:" "`SSLContext.wrap_bio`." msgstr "" -#: ../../library/ssl.rst:1784 +#: ../../library/ssl.rst:1829 msgid "" "Always allow a server_hostname to be passed, even if OpenSSL does not have " "SNI." msgstr "" -#: ../../library/ssl.rst:1788 ../../library/ssl.rst:1814 +#: ../../library/ssl.rst:1833 ../../library/ssl.rst:1859 msgid "*session* argument was added." msgstr "新增 *session* 引數。" -#: ../../library/ssl.rst:1791 +#: ../../library/ssl.rst:1836 msgid "" "The method returns an instance of :attr:`SSLContext.sslsocket_class` instead " "of hard-coded :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1797 +#: ../../library/ssl.rst:1842 msgid "" "The return type of :meth:`SSLContext.wrap_socket`, defaults to :class:" "`SSLSocket`. The attribute can be overridden on instance of class in order " "to return a custom subclass of :class:`SSLSocket`." msgstr "" -#: ../../library/ssl.rst:1806 +#: ../../library/ssl.rst:1851 msgid "" "Wrap the BIO objects *incoming* and *outgoing* and return an instance of :" "attr:`SSLContext.sslobject_class` (default :class:`SSLObject`). The SSL " @@ -2561,26 +2614,26 @@ msgid "" "outgoing BIO." msgstr "" -#: ../../library/ssl.rst:1811 +#: ../../library/ssl.rst:1856 msgid "" "The *server_side*, *server_hostname* and *session* parameters have the same " "meaning as in :meth:`SSLContext.wrap_socket`." msgstr "" -#: ../../library/ssl.rst:1817 +#: ../../library/ssl.rst:1862 msgid "" "The method returns an instance of :attr:`SSLContext.sslobject_class` instead " "of hard-coded :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1823 +#: ../../library/ssl.rst:1868 msgid "" "The return type of :meth:`SSLContext.wrap_bio`, defaults to :class:" "`SSLObject`. The attribute can be overridden on instance of class in order " "to return a custom subclass of :class:`SSLObject`." msgstr "" -#: ../../library/ssl.rst:1831 +#: ../../library/ssl.rst:1876 msgid "" "Get statistics about the SSL sessions created or managed by this context. A " "dictionary is returned which maps the names of each `piece of information " @@ -2589,7 +2642,7 @@ msgid "" "the session cache since the context was created::" msgstr "" -#: ../../library/ssl.rst:1836 +#: ../../library/ssl.rst:1881 msgid "" ">>> stats = context.session_stats()\n" ">>> stats['hits'], stats['misses']\n" @@ -2599,7 +2652,7 @@ msgstr "" ">>> stats['hits'], stats['misses']\n" "(0, 0)" -#: ../../library/ssl.rst:1842 +#: ../../library/ssl.rst:1887 msgid "" "Whether to match the peer cert's hostname in :meth:`SSLSocket.do_handshake`. " "The context's :attr:`~SSLContext.verify_mode` must be set to :data:" @@ -2612,7 +2665,7 @@ msgid "" "With other protocols, hostname checking must be enabled explicitly." msgstr "" -#: ../../library/ssl.rst:1855 +#: ../../library/ssl.rst:1900 msgid "" "import socket, ssl\n" "\n" @@ -2636,7 +2689,7 @@ msgstr "" "ssl_sock = context.wrap_socket(s, server_hostname='www.verisign.com')\n" "ssl_sock.connect(('www.verisign.com', 443))" -#: ../../library/ssl.rst:1870 +#: ../../library/ssl.rst:1915 msgid "" ":attr:`~SSLContext.verify_mode` is now automatically changed to :data:" "`CERT_REQUIRED` when hostname checking is enabled and :attr:`~SSLContext." @@ -2644,7 +2697,7 @@ msgid "" "failed with a :exc:`ValueError`." msgstr "" -#: ../../library/ssl.rst:1877 +#: ../../library/ssl.rst:1922 msgid "" "Write TLS keys to a keylog file, whenever key material is generated or " "received. The keylog file is designed for debugging purposes only. The file " @@ -2653,7 +2706,7 @@ msgid "" "synchronized between threads, but not between processes." msgstr "" -#: ../../library/ssl.rst:1887 +#: ../../library/ssl.rst:1932 msgid "" "A :class:`TLSVersion` enum member representing the highest supported TLS " "version. The value defaults to :attr:`TLSVersion.MAXIMUM_SUPPORTED`. The " @@ -2661,7 +2714,7 @@ msgid "" "`PROTOCOL_TLS_CLIENT`, and :attr:`PROTOCOL_TLS_SERVER`." msgstr "" -#: ../../library/ssl.rst:1892 +#: ../../library/ssl.rst:1937 msgid "" "The attributes :attr:`~SSLContext.maximum_version`, :attr:`~SSLContext." "minimum_version` and :attr:`SSLContext.options` all affect the supported SSL " @@ -2671,38 +2724,38 @@ msgid "" "`TLSVersion.TLSv1_2` will not be able to establish a TLS 1.2 connection." msgstr "" -#: ../../library/ssl.rst:1905 +#: ../../library/ssl.rst:1950 msgid "" "Like :attr:`SSLContext.maximum_version` except it is the lowest supported " "version or :attr:`TLSVersion.MINIMUM_SUPPORTED`." msgstr "" -#: ../../library/ssl.rst:1912 +#: ../../library/ssl.rst:1957 msgid "" "Control the number of TLS 1.3 session tickets of a :attr:" "`PROTOCOL_TLS_SERVER` context. The setting has no impact on TLS 1.0 to 1.2 " "connections." msgstr "" -#: ../../library/ssl.rst:1920 +#: ../../library/ssl.rst:1965 msgid "" "An integer representing the set of SSL options enabled on this context. The " "default value is :data:`OP_ALL`, but you can specify other options such as :" "data:`OP_NO_SSLv2` by ORing them together." msgstr "" -#: ../../library/ssl.rst:1924 +#: ../../library/ssl.rst:1969 msgid ":attr:`SSLContext.options` returns :class:`Options` flags:" msgstr "" -#: ../../library/ssl.rst:1932 +#: ../../library/ssl.rst:1977 msgid "" "All ``OP_NO_SSL*`` and ``OP_NO_TLS*`` options have been deprecated since " "Python 3.7. Use :attr:`SSLContext.minimum_version` and :attr:`SSLContext." "maximum_version` instead." msgstr "" -#: ../../library/ssl.rst:1938 +#: ../../library/ssl.rst:1983 msgid "" "Enable TLS 1.3 post-handshake client authentication. Post-handshake auth is " "disabled by default and a server can only request a TLS client certificate " @@ -2710,13 +2763,13 @@ msgid "" "client certificate at any time after the handshake." msgstr "" -#: ../../library/ssl.rst:1943 +#: ../../library/ssl.rst:1988 msgid "" "When enabled on client-side sockets, the client signals the server that it " "supports post-handshake authentication." msgstr "" -#: ../../library/ssl.rst:1946 +#: ../../library/ssl.rst:1991 msgid "" "When enabled on server-side sockets, :attr:`SSLContext.verify_mode` must be " "set to :data:`CERT_OPTIONAL` or :data:`CERT_REQUIRED`, too. The actual " @@ -2724,59 +2777,176 @@ msgid "" "verify_client_post_handshake` is called and some I/O is performed." msgstr "" -#: ../../library/ssl.rst:1956 +#: ../../library/ssl.rst:2001 msgid "" "The protocol version chosen when constructing the context. This attribute " "is read-only." msgstr "" -#: ../../library/ssl.rst:1961 +#: ../../library/ssl.rst:2006 msgid "" "Whether :attr:`~SSLContext.check_hostname` falls back to verify the cert's " "subject common name in the absence of a subject alternative name extension " "(default: true)." msgstr "" -#: ../../library/ssl.rst:1969 +#: ../../library/ssl.rst:2014 msgid "" "The flag had no effect with OpenSSL before version 1.1.1l. Python 3.8.9, " "3.9.3, and 3.10 include workarounds for previous versions." msgstr "" -#: ../../library/ssl.rst:1974 +#: ../../library/ssl.rst:2019 msgid "" "An integer representing the `security level `_ for the context. This attribute is read-" "only." msgstr "" -#: ../../library/ssl.rst:1982 +#: ../../library/ssl.rst:2027 msgid "" "The flags for certificate verification operations. You can set flags like :" "data:`VERIFY_CRL_CHECK_LEAF` by ORing them together. By default OpenSSL does " "neither require nor verify certificate revocation lists (CRLs)." msgstr "" -#: ../../library/ssl.rst:1988 +#: ../../library/ssl.rst:2033 msgid ":attr:`SSLContext.verify_flags` returns :class:`VerifyFlags` flags:" msgstr "" -#: ../../library/ssl.rst:1996 +#: ../../library/ssl.rst:2041 msgid "" "Whether to try to verify other peers' certificates and how to behave if " "verification fails. This attribute must be one of :data:`CERT_NONE`, :data:" "`CERT_OPTIONAL` or :data:`CERT_REQUIRED`." msgstr "" -#: ../../library/ssl.rst:2000 +#: ../../library/ssl.rst:2045 msgid ":attr:`SSLContext.verify_mode` returns :class:`VerifyMode` enum:" msgstr "" -#: ../../library/ssl.rst:2013 +#: ../../library/ssl.rst:2053 +msgid "" +"Enables TLS-PSK (pre-shared key) authentication on a client-side connection." +msgstr "" + +#: ../../library/ssl.rst:2055 ../../library/ssl.rst:2104 +msgid "" +"In general, certificate based authentication should be preferred over this " +"method." +msgstr "" + +#: ../../library/ssl.rst:2057 +msgid "" +"The parameter ``callback`` is a callable object with the signature: ``def " +"callback(hint: str | None) -> tuple[str | None, bytes]``. The ``hint`` " +"parameter is an optional identity hint sent by the server. The return value " +"is a tuple in the form (client-identity, psk). Client-identity is an " +"optional string which may be used by the server to select a corresponding " +"PSK for the client. The string must be less than or equal to ``256`` octets " +"when UTF-8 encoded. PSK is a :term:`bytes-like object` representing the pre-" +"shared key. Return a zero length PSK to reject the connection." +msgstr "" + +#: ../../library/ssl.rst:2067 ../../library/ssl.rst:2113 +msgid "Setting ``callback`` to :const:`None` removes any existing callback." +msgstr "" + +#: ../../library/ssl.rst:2070 +msgid "When using TLS 1.3:" +msgstr "" + +#: ../../library/ssl.rst:2072 +msgid "the ``hint`` parameter is always :const:`None`." +msgstr "" + +#: ../../library/ssl.rst:2073 +msgid "client-identity must be a non-empty string." +msgstr "" + +#: ../../library/ssl.rst:2075 ../../library/ssl.rst:2122 +#, fuzzy +msgid "Example usage::" +msgstr "範例: ::" + +#: ../../library/ssl.rst:2077 +msgid "" +"context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" +"context.check_hostname = False\n" +"context.verify_mode = ssl.CERT_NONE\n" +"context.maximum_version = ssl.TLSVersion.TLSv1_2\n" +"context.set_ciphers('PSK')\n" +"\n" +"# A simple lambda:\n" +"psk = bytes.fromhex('c0ffee')\n" +"context.set_psk_client_callback(lambda hint: (None, psk))\n" +"\n" +"# A table using the hint from the server:\n" +"psk_table = { 'ServerId_1': bytes.fromhex('c0ffee'),\n" +" 'ServerId_2': bytes.fromhex('facade')\n" +"}\n" +"def callback(hint):\n" +" return 'ClientId_1', psk_table.get(hint, b'')\n" +"context.set_psk_client_callback(callback)" +msgstr "" + +#: ../../library/ssl.rst:2095 ../../library/ssl.rst:2140 +msgid "" +"This method will raise :exc:`NotImplementedError` if :data:`HAS_PSK` is " +"``False``." +msgstr "" + +#: ../../library/ssl.rst:2102 +msgid "" +"Enables TLS-PSK (pre-shared key) authentication on a server-side connection." +msgstr "" + +#: ../../library/ssl.rst:2106 +msgid "" +"The parameter ``callback`` is a callable object with the signature: ``def " +"callback(identity: str | None) -> bytes``. The ``identity`` parameter is an " +"optional identity sent by the client which can be used to select a " +"corresponding PSK. The return value is a :term:`bytes-like object` " +"representing the pre-shared key. Return a zero length PSK to reject the " +"connection." +msgstr "" + +#: ../../library/ssl.rst:2115 +msgid "" +"The parameter ``identity_hint`` is an optional identity hint string sent to " +"the client. The string must be less than or equal to ``256`` octets when " +"UTF-8 encoded." +msgstr "" + +#: ../../library/ssl.rst:2120 +msgid "" +"When using TLS 1.3 the ``identity_hint`` parameter is not sent to the client." +msgstr "" + +#: ../../library/ssl.rst:2124 +msgid "" +"context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)\n" +"context.maximum_version = ssl.TLSVersion.TLSv1_2\n" +"context.set_ciphers('PSK')\n" +"\n" +"# A simple lambda:\n" +"psk = bytes.fromhex('c0ffee')\n" +"context.set_psk_server_callback(lambda identity: psk)\n" +"\n" +"# A table using the identity of the client:\n" +"psk_table = { 'ClientId_1': bytes.fromhex('c0ffee'),\n" +" 'ClientId_2': bytes.fromhex('facade')\n" +"}\n" +"def callback(identity):\n" +" return psk_table.get(identity, b'')\n" +"context.set_psk_server_callback(callback, 'ServerId_1')" +msgstr "" + +#: ../../library/ssl.rst:2152 msgid "Certificates" msgstr "" -#: ../../library/ssl.rst:2015 +#: ../../library/ssl.rst:2154 msgid "" "Certificates in general are part of a public-key / private-key system. In " "this system, each *principal*, (which may be a machine, or a person, or an " @@ -2787,7 +2957,7 @@ msgid "" "other part, and **only** with the other part." msgstr "" -#: ../../library/ssl.rst:2023 +#: ../../library/ssl.rst:2162 msgid "" "A certificate contains information about two principals. It contains the " "name of a *subject*, and the subject's public key. It also contains a " @@ -2801,7 +2971,7 @@ msgid "" "as two fields, called \"notBefore\" and \"notAfter\"." msgstr "" -#: ../../library/ssl.rst:2033 +#: ../../library/ssl.rst:2172 msgid "" "In the Python use of certificates, a client or server can use a certificate " "to prove who they are. The other side of a network connection can also be " @@ -2814,14 +2984,14 @@ msgid "" "take place." msgstr "" -#: ../../library/ssl.rst:2043 +#: ../../library/ssl.rst:2182 msgid "" "Python uses files to contain certificates. They should be formatted as " "\"PEM\" (see :rfc:`1422`), which is a base-64 encoded form wrapped with a " "header line and a footer line::" msgstr "" -#: ../../library/ssl.rst:2047 +#: ../../library/ssl.rst:2186 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate in base64 PEM encoding) ...\n" @@ -2831,11 +3001,11 @@ msgstr "" "... (certificate in base64 PEM encoding) ...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2052 +#: ../../library/ssl.rst:2191 msgid "Certificate chains" msgstr "" -#: ../../library/ssl.rst:2054 +#: ../../library/ssl.rst:2193 msgid "" "The Python files which contain certificates can contain a sequence of " "certificates, sometimes called a *certificate chain*. This chain should " @@ -2851,7 +3021,7 @@ msgid "" "agency which issued the certification authority's certificate::" msgstr "" -#: ../../library/ssl.rst:2067 +#: ../../library/ssl.rst:2206 msgid "" "-----BEGIN CERTIFICATE-----\n" "... (certificate for your server)...\n" @@ -2873,11 +3043,11 @@ msgstr "" "... (the root certificate for the CA's issuer)...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2078 +#: ../../library/ssl.rst:2217 msgid "CA certificates" msgstr "" -#: ../../library/ssl.rst:2080 +#: ../../library/ssl.rst:2219 msgid "" "If you are going to require validation of the other side of the connection's " "certificate, you need to provide a \"CA certs\" file, filled with the " @@ -2889,11 +3059,11 @@ msgid "" "create_default_context`." msgstr "" -#: ../../library/ssl.rst:2089 +#: ../../library/ssl.rst:2228 msgid "Combined key and certificate" msgstr "" -#: ../../library/ssl.rst:2091 +#: ../../library/ssl.rst:2230 msgid "" "Often the private key is stored in the same file as the certificate; in this " "case, only the ``certfile`` parameter to :meth:`SSLContext.load_cert_chain` " @@ -2901,7 +3071,7 @@ msgid "" "should come before the first certificate in the certificate chain::" msgstr "" -#: ../../library/ssl.rst:2097 +#: ../../library/ssl.rst:2236 msgid "" "-----BEGIN RSA PRIVATE KEY-----\n" "... (private key in base64 encoding) ...\n" @@ -2917,11 +3087,11 @@ msgstr "" "... (certificate in base64 PEM encoding) ...\n" "-----END CERTIFICATE-----" -#: ../../library/ssl.rst:2105 +#: ../../library/ssl.rst:2244 msgid "Self-signed certificates" msgstr "" -#: ../../library/ssl.rst:2107 +#: ../../library/ssl.rst:2246 msgid "" "If you are going to create a server that provides SSL-encrypted connection " "services, you will need to acquire a certificate for that service. There " @@ -2931,7 +3101,7 @@ msgid "" "package, using something like the following::" msgstr "" -#: ../../library/ssl.rst:2114 +#: ../../library/ssl.rst:2253 msgid "" "% openssl req -new -x509 -days 365 -nodes -out cert.pem -keyout cert.pem\n" "Generating a 1024 bit RSA private key\n" @@ -2957,28 +3127,28 @@ msgid "" "%" msgstr "" -#: ../../library/ssl.rst:2136 +#: ../../library/ssl.rst:2275 msgid "" "The disadvantage of a self-signed certificate is that it is its own root " "certificate, and no one else will have it in their cache of known (and " "trusted) root certificates." msgstr "" -#: ../../library/ssl.rst:2142 +#: ../../library/ssl.rst:2281 msgid "Examples" msgstr "範例" -#: ../../library/ssl.rst:2145 +#: ../../library/ssl.rst:2284 msgid "Testing for SSL support" msgstr "" -#: ../../library/ssl.rst:2147 +#: ../../library/ssl.rst:2286 msgid "" "To test for the presence of SSL support in a Python installation, user code " "should use the following idiom::" msgstr "" -#: ../../library/ssl.rst:2150 +#: ../../library/ssl.rst:2289 msgid "" "try:\n" " import ssl\n" @@ -2988,27 +3158,27 @@ msgid "" " ... # do something that requires SSL support" msgstr "" -#: ../../library/ssl.rst:2158 +#: ../../library/ssl.rst:2297 msgid "Client-side operation" msgstr "" -#: ../../library/ssl.rst:2160 +#: ../../library/ssl.rst:2299 msgid "" "This example creates a SSL context with the recommended security settings " "for client sockets, including automatic certificate verification::" msgstr "" -#: ../../library/ssl.rst:2163 +#: ../../library/ssl.rst:2302 msgid ">>> context = ssl.create_default_context()" msgstr ">>> context = ssl.create_default_context()" -#: ../../library/ssl.rst:2165 +#: ../../library/ssl.rst:2304 msgid "" "If you prefer to tune security settings yourself, you might create a context " "from scratch (but beware that you might not get the settings right)::" msgstr "" -#: ../../library/ssl.rst:2169 +#: ../../library/ssl.rst:2308 msgid "" ">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" @@ -3016,14 +3186,14 @@ msgstr "" ">>> context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> context.load_verify_locations(\"/etc/ssl/certs/ca-bundle.crt\")" -#: ../../library/ssl.rst:2172 +#: ../../library/ssl.rst:2311 msgid "" "(this snippet assumes your operating system places a bundle of all CA " "certificates in ``/etc/ssl/certs/ca-bundle.crt``; if not, you'll get an " "error and have to adjust the location)" msgstr "" -#: ../../library/ssl.rst:2176 +#: ../../library/ssl.rst:2315 msgid "" "The :data:`PROTOCOL_TLS_CLIENT` protocol configures the context for cert " "validation and hostname verification. :attr:`~SSLContext.verify_mode` is set " @@ -3031,7 +3201,7 @@ msgid "" "``True``. All other protocols create SSL contexts with insecure defaults." msgstr "" -#: ../../library/ssl.rst:2181 +#: ../../library/ssl.rst:2320 msgid "" "When you use the context to connect to a server, :const:`CERT_REQUIRED` and :" "attr:`~SSLContext.check_hostname` validate the server certificate: it " @@ -3040,7 +3210,7 @@ msgid "" "properties like validity and identity of the hostname::" msgstr "" -#: ../../library/ssl.rst:2187 +#: ../../library/ssl.rst:2326 msgid "" ">>> conn = context.wrap_socket(socket.socket(socket.AF_INET),\n" "... server_hostname=\"www.python.org\")\n" @@ -3050,21 +3220,21 @@ msgstr "" "... server_hostname=\"www.python.org\")\n" ">>> conn.connect((\"www.python.org\", 443))" -#: ../../library/ssl.rst:2191 +#: ../../library/ssl.rst:2330 msgid "You may then fetch the certificate::" msgstr "" -#: ../../library/ssl.rst:2193 +#: ../../library/ssl.rst:2332 msgid ">>> cert = conn.getpeercert()" msgstr ">>> cert = conn.getpeercert()" -#: ../../library/ssl.rst:2195 +#: ../../library/ssl.rst:2334 msgid "" "Visual inspection shows that the certificate does identify the desired " "service (that is, the HTTPS host ``www.python.org``)::" msgstr "" -#: ../../library/ssl.rst:2198 +#: ../../library/ssl.rst:2337 msgid "" ">>> pprint.pprint(cert)\n" "{'OCSP': ('http://ocsp.digicert.com',),\n" @@ -3154,13 +3324,13 @@ msgstr "" " ('DNS', 'id.python.org')),\n" " 'version': 3}" -#: ../../library/ssl.rst:2238 +#: ../../library/ssl.rst:2377 msgid "" "Now the SSL channel is established and the certificate verified, you can " "proceed to talk with the server::" msgstr "" -#: ../../library/ssl.rst:2241 +#: ../../library/ssl.rst:2380 msgid "" ">>> conn.sendall(b\"HEAD / HTTP/1.0\\r\\nHost: linuxfr.org\\r\\n\\r\\n\")\n" ">>> pprint.pprint(conn.recv(1024).split(b\"\\r\\n\"))\n" @@ -3202,11 +3372,11 @@ msgstr "" " b'',\n" " b'']" -#: ../../library/ssl.rst:2265 +#: ../../library/ssl.rst:2404 msgid "Server-side operation" msgstr "" -#: ../../library/ssl.rst:2267 +#: ../../library/ssl.rst:2406 msgid "" "For server operation, typically you'll need to have a server certificate, " "and private key, each in a file. You'll first create a context holding the " @@ -3215,7 +3385,7 @@ msgid "" "start waiting for clients to connect::" msgstr "" -#: ../../library/ssl.rst:2273 +#: ../../library/ssl.rst:2412 msgid "" "import socket, ssl\n" "\n" @@ -3235,14 +3405,14 @@ msgstr "" "bindsocket.bind(('myaddr.example.com', 10023))\n" "bindsocket.listen(5)" -#: ../../library/ssl.rst:2282 +#: ../../library/ssl.rst:2421 msgid "" "When a client connects, you'll call :meth:`accept` on the socket to get the " "new socket from the other end, and use the context's :meth:`SSLContext." "wrap_socket` method to create a server-side SSL socket for the connection::" msgstr "" -#: ../../library/ssl.rst:2286 +#: ../../library/ssl.rst:2425 msgid "" "while True:\n" " newsocket, fromaddr = bindsocket.accept()\n" @@ -3262,13 +3432,13 @@ msgstr "" " connstream.shutdown(socket.SHUT_RDWR)\n" " connstream.close()" -#: ../../library/ssl.rst:2295 +#: ../../library/ssl.rst:2434 msgid "" "Then you'll read data from the ``connstream`` and do something with it till " "you are finished with the client (or the client is finished with you)::" msgstr "" -#: ../../library/ssl.rst:2298 +#: ../../library/ssl.rst:2437 msgid "" "def deal_with_client(connstream):\n" " data = connstream.recv(1024)\n" @@ -3282,7 +3452,7 @@ msgid "" " # finished with client" msgstr "" -#: ../../library/ssl.rst:2309 +#: ../../library/ssl.rst:2448 msgid "" "And go back to listening for new client connections (of course, a real " "server would probably handle each client connection in a separate thread, or " @@ -3290,18 +3460,18 @@ msgid "" "event loop)." msgstr "" -#: ../../library/ssl.rst:2317 +#: ../../library/ssl.rst:2456 msgid "Notes on non-blocking sockets" msgstr "" -#: ../../library/ssl.rst:2319 +#: ../../library/ssl.rst:2458 msgid "" "SSL sockets behave slightly different than regular sockets in non-blocking " "mode. When working with non-blocking sockets, there are thus several things " "you need to be aware of:" msgstr "" -#: ../../library/ssl.rst:2323 +#: ../../library/ssl.rst:2462 msgid "" "Most :class:`SSLSocket` methods will raise either :exc:`SSLWantWriteError` " "or :exc:`SSLWantReadError` instead of :exc:`BlockingIOError` if an I/O " @@ -3313,13 +3483,13 @@ msgid "" "require a prior *write* to the underlying socket." msgstr "" -#: ../../library/ssl.rst:2335 +#: ../../library/ssl.rst:2474 msgid "" "In earlier Python versions, the :meth:`!SSLSocket.send` method returned zero " "instead of raising :exc:`SSLWantWriteError` or :exc:`SSLWantReadError`." msgstr "" -#: ../../library/ssl.rst:2339 +#: ../../library/ssl.rst:2478 msgid "" "Calling :func:`~select.select` tells you that the OS-level socket can be " "read from (or written to), but it does not imply that there is sufficient " @@ -3329,7 +3499,7 @@ msgid "" "`~select.select`." msgstr "" -#: ../../library/ssl.rst:2346 +#: ../../library/ssl.rst:2485 msgid "" "Conversely, since the SSL layer has its own framing, a SSL socket may still " "have data available for reading without :func:`~select.select` being aware " @@ -3338,13 +3508,13 @@ msgid "" "call if still necessary." msgstr "" -#: ../../library/ssl.rst:2352 +#: ../../library/ssl.rst:2491 msgid "" "(of course, similar provisions apply when using other primitives such as :" "func:`~select.poll`, or those in the :mod:`selectors` module)" msgstr "" -#: ../../library/ssl.rst:2355 +#: ../../library/ssl.rst:2494 msgid "" "The SSL handshake itself will be non-blocking: the :meth:`SSLSocket." "do_handshake` method has to be retried until it returns successfully. Here " @@ -3352,7 +3522,7 @@ msgid "" "readiness::" msgstr "" -#: ../../library/ssl.rst:2360 +#: ../../library/ssl.rst:2499 msgid "" "while True:\n" " try:\n" @@ -3372,7 +3542,7 @@ msgstr "" " except ssl.SSLWantWriteError:\n" " select.select([], [sock], [])" -#: ../../library/ssl.rst:2371 +#: ../../library/ssl.rst:2510 msgid "" "The :mod:`asyncio` module supports :ref:`non-blocking SSL sockets ` and provides a higher level API. It polls for events using " @@ -3381,26 +3551,26 @@ msgid "" "handshake asynchronously as well." msgstr "" -#: ../../library/ssl.rst:2380 +#: ../../library/ssl.rst:2519 msgid "Memory BIO Support" msgstr "" -#: ../../library/ssl.rst:2384 +#: ../../library/ssl.rst:2523 msgid "" "Ever since the SSL module was introduced in Python 2.6, the :class:" "`SSLSocket` class has provided two related but distinct areas of " "functionality:" msgstr "" -#: ../../library/ssl.rst:2387 +#: ../../library/ssl.rst:2526 msgid "SSL protocol handling" msgstr "" -#: ../../library/ssl.rst:2388 +#: ../../library/ssl.rst:2527 msgid "Network IO" msgstr "" -#: ../../library/ssl.rst:2390 +#: ../../library/ssl.rst:2529 msgid "" "The network IO API is identical to that provided by :class:`socket.socket`, " "from which :class:`SSLSocket` also inherits. This allows an SSL socket to be " @@ -3408,7 +3578,7 @@ msgid "" "add SSL support to an existing application." msgstr "" -#: ../../library/ssl.rst:2395 +#: ../../library/ssl.rst:2534 msgid "" "Combining SSL protocol handling and network IO usually works well, but there " "are some cases where it doesn't. An example is async IO frameworks that want " @@ -3420,7 +3590,7 @@ msgid "" "`SSLObject` is provided." msgstr "" -#: ../../library/ssl.rst:2406 +#: ../../library/ssl.rst:2545 msgid "" "A reduced-scope variant of :class:`SSLSocket` representing an SSL protocol " "instance that does not contain any network IO methods. This class is " @@ -3428,7 +3598,7 @@ msgid "" "for SSL through memory buffers." msgstr "" -#: ../../library/ssl.rst:2411 +#: ../../library/ssl.rst:2550 msgid "" "This class implements an interface on top of a low-level SSL object as " "implemented by OpenSSL. This object captures the state of an SSL connection " @@ -3436,7 +3606,7 @@ msgid "" "separate \"BIO\" objects which are OpenSSL's IO abstraction layer." msgstr "" -#: ../../library/ssl.rst:2416 +#: ../../library/ssl.rst:2555 msgid "" "This class has no public constructor. An :class:`SSLObject` instance must " "be created using the :meth:`~SSLContext.wrap_bio` method. This method will " @@ -3445,207 +3615,215 @@ msgid "" "instance, while the *outgoing* BIO is used to pass data the other way around." msgstr "" -#: ../../library/ssl.rst:2423 +#: ../../library/ssl.rst:2562 msgid "The following methods are available:" msgstr "" -#: ../../library/ssl.rst:2425 +#: ../../library/ssl.rst:2564 msgid ":attr:`~SSLSocket.context`" msgstr ":attr:`~SSLSocket.context`" -#: ../../library/ssl.rst:2426 +#: ../../library/ssl.rst:2565 msgid ":attr:`~SSLSocket.server_side`" msgstr ":attr:`~SSLSocket.server_side`" -#: ../../library/ssl.rst:2427 +#: ../../library/ssl.rst:2566 msgid ":attr:`~SSLSocket.server_hostname`" msgstr ":attr:`~SSLSocket.server_hostname`" -#: ../../library/ssl.rst:2428 +#: ../../library/ssl.rst:2567 msgid ":attr:`~SSLSocket.session`" msgstr ":attr:`~SSLSocket.session`" -#: ../../library/ssl.rst:2429 +#: ../../library/ssl.rst:2568 msgid ":attr:`~SSLSocket.session_reused`" msgstr ":attr:`~SSLSocket.session_reused`" -#: ../../library/ssl.rst:2430 +#: ../../library/ssl.rst:2569 msgid ":meth:`~SSLSocket.read`" msgstr ":meth:`~SSLSocket.read`" -#: ../../library/ssl.rst:2431 +#: ../../library/ssl.rst:2570 msgid ":meth:`~SSLSocket.write`" msgstr ":meth:`~SSLSocket.write`" -#: ../../library/ssl.rst:2432 +#: ../../library/ssl.rst:2571 msgid ":meth:`~SSLSocket.getpeercert`" msgstr ":meth:`~SSLSocket.getpeercert`" -#: ../../library/ssl.rst:2433 +#: ../../library/ssl.rst:2572 +msgid ":meth:`~SSLSocket.get_verified_chain`" +msgstr ":meth:`~SSLSocket.get_verified_chain`" + +#: ../../library/ssl.rst:2573 +msgid ":meth:`~SSLSocket.get_unverified_chain`" +msgstr ":meth:`~SSLSocket.get_unverified_chain`" + +#: ../../library/ssl.rst:2574 msgid ":meth:`~SSLSocket.selected_alpn_protocol`" msgstr ":meth:`~SSLSocket.selected_alpn_protocol`" -#: ../../library/ssl.rst:2434 +#: ../../library/ssl.rst:2575 msgid ":meth:`~SSLSocket.selected_npn_protocol`" msgstr ":meth:`~SSLSocket.selected_npn_protocol`" -#: ../../library/ssl.rst:2435 +#: ../../library/ssl.rst:2576 msgid ":meth:`~SSLSocket.cipher`" msgstr ":meth:`~SSLSocket.cipher`" -#: ../../library/ssl.rst:2436 +#: ../../library/ssl.rst:2577 msgid ":meth:`~SSLSocket.shared_ciphers`" msgstr ":meth:`~SSLSocket.shared_ciphers`" -#: ../../library/ssl.rst:2437 +#: ../../library/ssl.rst:2578 msgid ":meth:`~SSLSocket.compression`" msgstr ":meth:`~SSLSocket.compression`" -#: ../../library/ssl.rst:2438 +#: ../../library/ssl.rst:2579 msgid ":meth:`~SSLSocket.pending`" msgstr ":meth:`~SSLSocket.pending`" -#: ../../library/ssl.rst:2439 +#: ../../library/ssl.rst:2580 msgid ":meth:`~SSLSocket.do_handshake`" msgstr ":meth:`~SSLSocket.do_handshake`" -#: ../../library/ssl.rst:2440 +#: ../../library/ssl.rst:2581 msgid ":meth:`~SSLSocket.verify_client_post_handshake`" msgstr ":meth:`~SSLSocket.verify_client_post_handshake`" -#: ../../library/ssl.rst:2441 +#: ../../library/ssl.rst:2582 msgid ":meth:`~SSLSocket.unwrap`" msgstr ":meth:`~SSLSocket.unwrap`" -#: ../../library/ssl.rst:2442 +#: ../../library/ssl.rst:2583 msgid ":meth:`~SSLSocket.get_channel_binding`" msgstr ":meth:`~SSLSocket.get_channel_binding`" -#: ../../library/ssl.rst:2443 +#: ../../library/ssl.rst:2584 msgid ":meth:`~SSLSocket.version`" msgstr ":meth:`~SSLSocket.version`" -#: ../../library/ssl.rst:2445 +#: ../../library/ssl.rst:2586 msgid "" "When compared to :class:`SSLSocket`, this object lacks the following " "features:" msgstr "" -#: ../../library/ssl.rst:2448 +#: ../../library/ssl.rst:2589 msgid "" "Any form of network IO; ``recv()`` and ``send()`` read and write only to the " "underlying :class:`MemoryBIO` buffers." msgstr "" -#: ../../library/ssl.rst:2451 +#: ../../library/ssl.rst:2592 msgid "" "There is no *do_handshake_on_connect* machinery. You must always manually " "call :meth:`~SSLSocket.do_handshake` to start the handshake." msgstr "" -#: ../../library/ssl.rst:2454 +#: ../../library/ssl.rst:2595 msgid "" "There is no handling of *suppress_ragged_eofs*. All end-of-file conditions " "that are in violation of the protocol are reported via the :exc:" "`SSLEOFError` exception." msgstr "" -#: ../../library/ssl.rst:2458 +#: ../../library/ssl.rst:2599 msgid "" "The method :meth:`~SSLSocket.unwrap` call does not return anything, unlike " "for an SSL socket where it returns the underlying socket." msgstr "" -#: ../../library/ssl.rst:2461 +#: ../../library/ssl.rst:2602 msgid "" "The *server_name_callback* callback passed to :meth:`SSLContext." "set_servername_callback` will get an :class:`SSLObject` instance instead of " "a :class:`SSLSocket` instance as its first parameter." msgstr "" -#: ../../library/ssl.rst:2465 +#: ../../library/ssl.rst:2606 msgid "Some notes related to the use of :class:`SSLObject`:" msgstr "" -#: ../../library/ssl.rst:2467 +#: ../../library/ssl.rst:2608 msgid "" "All IO on an :class:`SSLObject` is :ref:`non-blocking `. " "This means that for example :meth:`~SSLSocket.read` will raise an :exc:" "`SSLWantReadError` if it needs more data than the incoming BIO has available." msgstr "" -#: ../../library/ssl.rst:2472 +#: ../../library/ssl.rst:2613 msgid "" ":class:`SSLObject` instances must be created with :meth:`~SSLContext." "wrap_bio`. In earlier versions, it was possible to create instances " "directly. This was never documented or officially supported." msgstr "" -#: ../../library/ssl.rst:2478 +#: ../../library/ssl.rst:2619 msgid "" "An SSLObject communicates with the outside world using memory buffers. The " "class :class:`MemoryBIO` provides a memory buffer that can be used for this " "purpose. It wraps an OpenSSL memory BIO (Basic IO) object:" msgstr "" -#: ../../library/ssl.rst:2484 +#: ../../library/ssl.rst:2625 msgid "" "A memory buffer that can be used to pass data between Python and an SSL " "protocol instance." msgstr "" -#: ../../library/ssl.rst:2489 +#: ../../library/ssl.rst:2630 msgid "Return the number of bytes currently in the memory buffer." msgstr "" -#: ../../library/ssl.rst:2493 +#: ../../library/ssl.rst:2634 msgid "" "A boolean indicating whether the memory BIO is current at the end-of-file " "position." msgstr "" -#: ../../library/ssl.rst:2498 +#: ../../library/ssl.rst:2639 msgid "" "Read up to *n* bytes from the memory buffer. If *n* is not specified or " "negative, all bytes are returned." msgstr "" -#: ../../library/ssl.rst:2503 +#: ../../library/ssl.rst:2644 msgid "" "Write the bytes from *buf* to the memory BIO. The *buf* argument must be an " "object supporting the buffer protocol." msgstr "" -#: ../../library/ssl.rst:2506 +#: ../../library/ssl.rst:2647 msgid "" "The return value is the number of bytes written, which is always equal to " "the length of *buf*." msgstr "" -#: ../../library/ssl.rst:2511 +#: ../../library/ssl.rst:2652 msgid "" "Write an EOF marker to the memory BIO. After this method has been called, it " "is illegal to call :meth:`~MemoryBIO.write`. The attribute :attr:`eof` will " "become true after all data currently in the buffer has been read." msgstr "" -#: ../../library/ssl.rst:2517 +#: ../../library/ssl.rst:2658 msgid "SSL session" msgstr "" -#: ../../library/ssl.rst:2523 +#: ../../library/ssl.rst:2664 msgid "Session object used by :attr:`~SSLSocket.session`." msgstr "" -#: ../../library/ssl.rst:2535 +#: ../../library/ssl.rst:2676 msgid "Security considerations" msgstr "" -#: ../../library/ssl.rst:2538 +#: ../../library/ssl.rst:2679 msgid "Best defaults" msgstr "" -#: ../../library/ssl.rst:2540 +#: ../../library/ssl.rst:2681 msgid "" "For **client use**, if you don't have any special requirements for your " "security policy, it is highly recommended that you use the :func:" @@ -3655,13 +3833,13 @@ msgid "" "settings." msgstr "" -#: ../../library/ssl.rst:2547 +#: ../../library/ssl.rst:2688 msgid "" "For example, here is how you would use the :class:`smtplib.SMTP` class to " "create a trusted, secure connection to a SMTP server::" msgstr "" -#: ../../library/ssl.rst:2550 +#: ../../library/ssl.rst:2691 msgid "" ">>> import ssl, smtplib\n" ">>> smtp = smtplib.SMTP(\"mail.python.org\", port=587)\n" @@ -3675,13 +3853,13 @@ msgstr "" ">>> smtp.starttls(context=context)\n" "(220, b'2.0.0 Ready to start TLS')" -#: ../../library/ssl.rst:2556 +#: ../../library/ssl.rst:2697 msgid "" "If a client certificate is needed for the connection, it can be added with :" "meth:`SSLContext.load_cert_chain`." msgstr "" -#: ../../library/ssl.rst:2559 +#: ../../library/ssl.rst:2700 msgid "" "By contrast, if you create the SSL context by calling the :class:" "`SSLContext` constructor yourself, it will not have certificate validation " @@ -3689,15 +3867,15 @@ msgid "" "paragraphs below to achieve a good security level." msgstr "" -#: ../../library/ssl.rst:2565 +#: ../../library/ssl.rst:2706 msgid "Manual settings" msgstr "手動設定" -#: ../../library/ssl.rst:2568 +#: ../../library/ssl.rst:2709 msgid "Verifying certificates" msgstr "驗證憑證" -#: ../../library/ssl.rst:2570 +#: ../../library/ssl.rst:2711 msgid "" "When calling the :class:`SSLContext` constructor directly, :const:" "`CERT_NONE` is the default. Since it does not authenticate the other peer, " @@ -3712,13 +3890,13 @@ msgid "" "enabled." msgstr "" -#: ../../library/ssl.rst:2582 +#: ../../library/ssl.rst:2723 msgid "" "Hostname matchings is now performed by OpenSSL. Python no longer uses :func:" "`match_hostname`." msgstr "" -#: ../../library/ssl.rst:2586 +#: ../../library/ssl.rst:2727 msgid "" "In server mode, if you want to authenticate your clients using the SSL layer " "(rather than using a higher-level authentication mechanism), you'll also " @@ -3726,11 +3904,11 @@ msgid "" "certificate." msgstr "" -#: ../../library/ssl.rst:2592 +#: ../../library/ssl.rst:2733 msgid "Protocol versions" msgstr "協定版本" -#: ../../library/ssl.rst:2594 +#: ../../library/ssl.rst:2735 msgid "" "SSL versions 2 and 3 are considered insecure and are therefore dangerous to " "use. If you want maximum compatibility between clients and servers, it is " @@ -3739,7 +3917,7 @@ msgid "" "by default." msgstr "" -#: ../../library/ssl.rst:2602 +#: ../../library/ssl.rst:2743 msgid "" ">>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)\n" ">>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3\n" @@ -3749,7 +3927,7 @@ msgstr "" ">>> client_context.minimum_version = ssl.TLSVersion.TLSv1_3\n" ">>> client_context.maximum_version = ssl.TLSVersion.TLSv1_3" -#: ../../library/ssl.rst:2607 +#: ../../library/ssl.rst:2748 msgid "" "The SSL context created above will only allow TLSv1.3 and later (if " "supported by your system) connections to a server. :const:" @@ -3757,11 +3935,11 @@ msgid "" "default. You have to load certificates into the context." msgstr "" -#: ../../library/ssl.rst:2614 +#: ../../library/ssl.rst:2755 msgid "Cipher selection" msgstr "" -#: ../../library/ssl.rst:2616 +#: ../../library/ssl.rst:2757 msgid "" "If you have advanced security requirements, fine-tuning of the ciphers " "enabled when negotiating a SSL session is possible through the :meth:" @@ -3774,11 +3952,11 @@ msgid "" "command on your system." msgstr "" -#: ../../library/ssl.rst:2627 +#: ../../library/ssl.rst:2768 msgid "Multi-processing" msgstr "" -#: ../../library/ssl.rst:2629 +#: ../../library/ssl.rst:2770 msgid "" "If using this module as part of a multi-processed application (using, for " "example the :mod:`multiprocessing` or :mod:`concurrent.futures` modules), be " @@ -3789,17 +3967,17 @@ msgid "" "sufficient." msgstr "" -#: ../../library/ssl.rst:2641 +#: ../../library/ssl.rst:2782 msgid "TLS 1.3" msgstr "TLS 1.3" -#: ../../library/ssl.rst:2645 +#: ../../library/ssl.rst:2786 msgid "" "The TLS 1.3 protocol behaves slightly differently than previous version of " "TLS/SSL. Some new TLS 1.3 features are not yet available." msgstr "" -#: ../../library/ssl.rst:2648 +#: ../../library/ssl.rst:2789 msgid "" "TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20 " "cipher suites are enabled by default. The method :meth:`SSLContext." @@ -3807,14 +3985,14 @@ msgid "" "`SSLContext.get_ciphers` returns them." msgstr "" -#: ../../library/ssl.rst:2652 +#: ../../library/ssl.rst:2793 msgid "" "Session tickets are no longer sent as part of the initial handshake and are " "handled differently. :attr:`SSLSocket.session` and :class:`SSLSession` are " "not compatible with TLS 1.3." msgstr "" -#: ../../library/ssl.rst:2655 +#: ../../library/ssl.rst:2796 msgid "" "Client-side certificates are also no longer verified during the initial " "handshake. A server can request a certificate at any time. Clients process " @@ -3822,21 +4000,21 @@ msgid "" "server." msgstr "" -#: ../../library/ssl.rst:2659 +#: ../../library/ssl.rst:2800 msgid "" "TLS 1.3 features like early data, deferred TLS client cert request, " "signature algorithm configuration, and rekeying are not supported yet." msgstr "" -#: ../../library/ssl.rst:2665 +#: ../../library/ssl.rst:2806 msgid "Class :class:`socket.socket`" msgstr ":class:`socket.socket` 類別" -#: ../../library/ssl.rst:2666 +#: ../../library/ssl.rst:2807 msgid "Documentation of underlying :mod:`socket` class" msgstr "底層 :mod:`socket` 類別的文件" -#: ../../library/ssl.rst:2668 +#: ../../library/ssl.rst:2809 msgid "" "`SSL/TLS Strong Encryption: An Introduction `_" @@ -3844,11 +4022,11 @@ msgstr "" "`SSL/TLS Strong Encryption: An Introduction `_" -#: ../../library/ssl.rst:2669 +#: ../../library/ssl.rst:2810 msgid "Intro from the Apache HTTP Server documentation" msgstr "Apache HTTP Server 文件的介紹" -#: ../../library/ssl.rst:2671 +#: ../../library/ssl.rst:2812 msgid "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" @@ -3856,19 +4034,19 @@ msgstr "" ":rfc:`RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: " "Certificate-Based Key Management <1422>`" -#: ../../library/ssl.rst:2672 +#: ../../library/ssl.rst:2813 msgid "Steve Kent" msgstr "Steve Kent" -#: ../../library/ssl.rst:2674 +#: ../../library/ssl.rst:2815 msgid ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" msgstr ":rfc:`RFC 4086: Randomness Requirements for Security <4086>`" -#: ../../library/ssl.rst:2675 +#: ../../library/ssl.rst:2816 msgid "Donald E., Jeffrey I. Schiller" msgstr "Donald E., Jeffrey I. Schiller" -#: ../../library/ssl.rst:2677 +#: ../../library/ssl.rst:2818 msgid "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" @@ -3876,11 +4054,11 @@ msgstr "" ":rfc:`RFC 5280: Internet X.509 Public Key Infrastructure Certificate and " "Certificate Revocation List (CRL) Profile <5280>`" -#: ../../library/ssl.rst:2678 +#: ../../library/ssl.rst:2819 msgid "D. Cooper" msgstr "D. Cooper" -#: ../../library/ssl.rst:2680 +#: ../../library/ssl.rst:2821 msgid "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" @@ -3888,19 +4066,19 @@ msgstr "" ":rfc:`RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2 " "<5246>`" -#: ../../library/ssl.rst:2681 +#: ../../library/ssl.rst:2822 msgid "T. Dierks et. al." msgstr "T. Dierks et. al." -#: ../../library/ssl.rst:2683 +#: ../../library/ssl.rst:2824 msgid ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" msgstr ":rfc:`RFC 6066: Transport Layer Security (TLS) Extensions <6066>`" -#: ../../library/ssl.rst:2684 +#: ../../library/ssl.rst:2825 msgid "D. Eastlake" msgstr "D. Eastlake" -#: ../../library/ssl.rst:2686 +#: ../../library/ssl.rst:2827 msgid "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" @@ -3908,11 +4086,11 @@ msgstr "" "`IANA TLS: Transport Layer Security (TLS) Parameters `_" -#: ../../library/ssl.rst:2687 +#: ../../library/ssl.rst:2828 msgid "IANA" msgstr "IANA" -#: ../../library/ssl.rst:2689 +#: ../../library/ssl.rst:2830 msgid "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" @@ -3920,11 +4098,11 @@ msgstr "" ":rfc:`RFC 7525: Recommendations for Secure Use of Transport Layer Security " "(TLS) and Datagram Transport Layer Security (DTLS) <7525>`" -#: ../../library/ssl.rst:2690 +#: ../../library/ssl.rst:2831 msgid "IETF" msgstr "IETF" -#: ../../library/ssl.rst:2692 +#: ../../library/ssl.rst:2833 msgid "" "`Mozilla's Server Side TLS recommendations `_" @@ -3932,7 +4110,7 @@ msgstr "" "`Mozilla's Server Side TLS recommendations `_" -#: ../../library/ssl.rst:2693 +#: ../../library/ssl.rst:2834 msgid "Mozilla" msgstr "Mozilla" @@ -3960,10 +4138,13 @@ msgstr "Transport Layer Security(傳輸層安全)" msgid "Secure Sockets Layer" msgstr "Secure Sockets Layer(安全 socket 層)" -#: ../../library/ssl.rst:2006 +#: ../../library/ssl.rst:2145 msgid "certificates" msgstr "certificates(憑證)" -#: ../../library/ssl.rst:2008 +#: ../../library/ssl.rst:2147 msgid "X509 certificate" msgstr "X509 certificate(X509 憑證)" + +#~ msgid ":ref:`Availability `: not Emscripten, not WASI." +#~ msgstr ":ref:`適用 `: 非 Emscripten、非 WASI。" diff --git a/library/stat.po b/library/stat.po index e0d8fce823..83b937fed9 100644 --- a/library/stat.po +++ b/library/stat.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2016-11-19 00:34+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -381,48 +381,88 @@ msgid "" msgstr "" #: ../../library/stat.rst:355 +msgid "All user settable flags." +msgstr "" + +#: ../../library/stat.rst:361 msgid "Do not dump the file." msgstr "" -#: ../../library/stat.rst:359 ../../library/stat.rst:387 +#: ../../library/stat.rst:365 ../../library/stat.rst:427 msgid "The file may not be changed." msgstr "" -#: ../../library/stat.rst:363 ../../library/stat.rst:391 +#: ../../library/stat.rst:369 ../../library/stat.rst:431 msgid "The file may only be appended to." msgstr "" -#: ../../library/stat.rst:367 +#: ../../library/stat.rst:373 msgid "The directory is opaque when viewed through a union stack." msgstr "" -#: ../../library/stat.rst:371 ../../library/stat.rst:395 +#: ../../library/stat.rst:377 ../../library/stat.rst:441 msgid "The file may not be renamed or deleted." msgstr "" -#: ../../library/stat.rst:375 +#: ../../library/stat.rst:381 msgid "The file is stored compressed (macOS 10.6+)." msgstr "" -#: ../../library/stat.rst:379 +#: ../../library/stat.rst:385 +msgid "Used for handling document IDs (macOS)" +msgstr "" + +#: ../../library/stat.rst:391 +msgid "The file needs an entitlement for reading or writing (macOS 10.13+)" +msgstr "" + +#: ../../library/stat.rst:397 msgid "The file should not be displayed in a GUI (macOS 10.5+)." msgstr "" -#: ../../library/stat.rst:383 +#: ../../library/stat.rst:401 +msgid "All super-user changeable flags" +msgstr "" + +#: ../../library/stat.rst:407 +msgid "All super-user supported flags" +msgstr "" + +#: ../../library/stat.rst:409 ../../library/stat.rst:417 +msgid ":ref:`Availability `: macOS" +msgstr "" + +#: ../../library/stat.rst:415 +msgid "All super-user read-only synthetic flags" +msgstr "" + +#: ../../library/stat.rst:423 msgid "The file may be archived." msgstr "" -#: ../../library/stat.rst:399 +#: ../../library/stat.rst:435 +msgid "The file needs an entitlement to write to (macOS 10.13+)" +msgstr "" + +#: ../../library/stat.rst:445 msgid "The file is a snapshot file." msgstr "" -#: ../../library/stat.rst:401 +#: ../../library/stat.rst:449 +msgid "The file is a firmlink (macOS 10.15+)" +msgstr "" + +#: ../../library/stat.rst:455 +msgid "The file is a dataless object (macOS 10.15+)" +msgstr "" + +#: ../../library/stat.rst:459 msgid "" "See the \\*BSD or macOS systems man page :manpage:`chflags(2)` for more " "information." msgstr "" -#: ../../library/stat.rst:403 +#: ../../library/stat.rst:461 msgid "" "On Windows, the following file attribute constants are available for use " "when testing bits in the ``st_file_attributes`` member returned by :func:`os." @@ -431,7 +471,7 @@ msgid "" "these constants." msgstr "" -#: ../../library/stat.rst:429 +#: ../../library/stat.rst:487 msgid "" "On Windows, the following constants are available for comparing against the " "``st_reparse_tag`` member returned by :func:`os.lstat`. These are well-known " diff --git a/library/statistics.po b/library/statistics.po index 94309c5a09..1337bd2d8f 100644 --- a/library/statistics.po +++ b/library/statistics.po @@ -5,9 +5,9 @@ # KentHsu , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-07-22 21:15+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -143,143 +143,159 @@ msgid "Harmonic mean of data." msgstr "資料的調和平均數。" #: ../../library/statistics.rst:79 +msgid ":func:`kde`" +msgstr ":func:`kde`" + +#: ../../library/statistics.rst:79 +msgid "Estimate the probability density distribution of the data." +msgstr "" + +#: ../../library/statistics.rst:80 +msgid ":func:`kde_random`" +msgstr ":func:`kde_random`" + +#: ../../library/statistics.rst:80 +msgid "Random sampling from the PDF generated by kde()." +msgstr "" + +#: ../../library/statistics.rst:81 msgid ":func:`median`" msgstr ":func:`median`" -#: ../../library/statistics.rst:79 +#: ../../library/statistics.rst:81 msgid "Median (middle value) of data." msgstr "資料的中位數(中間值)。" -#: ../../library/statistics.rst:80 +#: ../../library/statistics.rst:82 msgid ":func:`median_low`" msgstr ":func:`median_low`" -#: ../../library/statistics.rst:80 +#: ../../library/statistics.rst:82 msgid "Low median of data." msgstr "資料中較小的中位數。" -#: ../../library/statistics.rst:81 +#: ../../library/statistics.rst:83 msgid ":func:`median_high`" msgstr ":func:`median_high`" -#: ../../library/statistics.rst:81 +#: ../../library/statistics.rst:83 msgid "High median of data." msgstr "資料中較大的中位數。" -#: ../../library/statistics.rst:82 +#: ../../library/statistics.rst:84 msgid ":func:`median_grouped`" msgstr ":func:`median_grouped`" -#: ../../library/statistics.rst:82 +#: ../../library/statistics.rst:84 msgid "Median (50th percentile) of grouped data." msgstr "分組資料的中位數(第 50 百分位數)。" -#: ../../library/statistics.rst:83 +#: ../../library/statistics.rst:85 msgid ":func:`mode`" msgstr ":func:`mode`" -#: ../../library/statistics.rst:83 +#: ../../library/statistics.rst:85 msgid "Single mode (most common value) of discrete or nominal data." msgstr "" "離散 (discrete) 或名目 (nomial) 資料中的眾數(出現次數最多次的值),只回傳一" "個。" -#: ../../library/statistics.rst:84 +#: ../../library/statistics.rst:86 msgid ":func:`multimode`" msgstr ":func:`multimode`" -#: ../../library/statistics.rst:84 +#: ../../library/statistics.rst:86 msgid "List of modes (most common values) of discrete or nominal data." msgstr "離散或名目資料中的眾數(出現次數最多次的值)組成的 list。" -#: ../../library/statistics.rst:85 +#: ../../library/statistics.rst:87 msgid ":func:`quantiles`" msgstr ":func:`quantiles`" -#: ../../library/statistics.rst:85 +#: ../../library/statistics.rst:87 msgid "Divide data into intervals with equal probability." msgstr "將資料分成數個具有相等機率的區間,即分位數 (quantile)。" -#: ../../library/statistics.rst:89 +#: ../../library/statistics.rst:91 msgid "Measures of spread" msgstr "離度 (spread) 的測量" -#: ../../library/statistics.rst:91 +#: ../../library/statistics.rst:93 msgid "" "These functions calculate a measure of how much the population or sample " "tends to deviate from the typical or average values." msgstr "這些函式計算母體或樣本偏離平均值的程度。" -#: ../../library/statistics.rst:95 +#: ../../library/statistics.rst:97 msgid ":func:`pstdev`" msgstr ":func:`pstdev`" -#: ../../library/statistics.rst:95 +#: ../../library/statistics.rst:97 msgid "Population standard deviation of data." msgstr "資料的母體標準差。" -#: ../../library/statistics.rst:96 +#: ../../library/statistics.rst:98 msgid ":func:`pvariance`" msgstr ":func:`pvariance`" -#: ../../library/statistics.rst:96 +#: ../../library/statistics.rst:98 msgid "Population variance of data." msgstr "資料的母體變異數。" -#: ../../library/statistics.rst:97 +#: ../../library/statistics.rst:99 msgid ":func:`stdev`" msgstr ":func:`stdev`" -#: ../../library/statistics.rst:97 +#: ../../library/statistics.rst:99 msgid "Sample standard deviation of data." msgstr "資料的樣本標準差。" -#: ../../library/statistics.rst:98 +#: ../../library/statistics.rst:100 msgid ":func:`variance`" msgstr ":func:`variance`" -#: ../../library/statistics.rst:98 +#: ../../library/statistics.rst:100 msgid "Sample variance of data." msgstr "資料的樣本變異數。" -#: ../../library/statistics.rst:102 +#: ../../library/statistics.rst:104 msgid "Statistics for relations between two inputs" msgstr "兩個輸入之間的關係統計" -#: ../../library/statistics.rst:104 +#: ../../library/statistics.rst:106 msgid "" "These functions calculate statistics regarding relations between two inputs." msgstr "這些函式計算兩個輸入之間的關係統計數據。" -#: ../../library/statistics.rst:107 +#: ../../library/statistics.rst:109 msgid ":func:`covariance`" msgstr ":func:`covariance`" -#: ../../library/statistics.rst:107 +#: ../../library/statistics.rst:109 msgid "Sample covariance for two variables." msgstr "兩變數的樣本共變異數。" -#: ../../library/statistics.rst:108 +#: ../../library/statistics.rst:110 msgid ":func:`correlation`" msgstr ":func:`correlation`" -#: ../../library/statistics.rst:108 +#: ../../library/statistics.rst:110 msgid "Pearson and Spearman's correlation coefficients." msgstr "Pearson 與 Spearman 相關係數 (correlation coefficient)。" -#: ../../library/statistics.rst:109 +#: ../../library/statistics.rst:111 msgid ":func:`linear_regression`" msgstr ":func:`linear_regression`" -#: ../../library/statistics.rst:109 +#: ../../library/statistics.rst:111 msgid "Slope and intercept for simple linear regression." msgstr "簡單線性迴歸的斜率和截距。" -#: ../../library/statistics.rst:114 +#: ../../library/statistics.rst:116 msgid "Function details" msgstr "函式細節" -#: ../../library/statistics.rst:116 +#: ../../library/statistics.rst:118 msgid "" "Note: The functions do not require the data given to them to be sorted. " "However, for reading convenience, most of the examples show sorted sequences." @@ -287,13 +303,13 @@ msgstr "" "註:這些函數並不要求輸入的資料必須排序過。為了閱讀方便,大部份的範例仍已排序" "過。" -#: ../../library/statistics.rst:121 +#: ../../library/statistics.rst:123 msgid "" "Return the sample arithmetic mean of *data* which can be a sequence or " "iterable." msgstr "回傳 *data* 的樣本算數平均數,輸入可為一個 sequence 或者 iterable。" -#: ../../library/statistics.rst:123 +#: ../../library/statistics.rst:125 msgid "" "The arithmetic mean is the sum of the data divided by the number of data " "points. It is commonly called \"the average\", although it is only one of " @@ -303,15 +319,15 @@ msgstr "" "算數平均數為資料總和除以資料點的數目。他通常被稱為「平均值」,儘管它只是眾多" "不同的數學平均值之一。它是衡量資料集中位置的一種指標。" -#: ../../library/statistics.rst:128 +#: ../../library/statistics.rst:130 msgid "If *data* is empty, :exc:`StatisticsError` will be raised." msgstr "若 *data* 為空,則會引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:130 +#: ../../library/statistics.rst:132 msgid "Some examples of use:" msgstr "使用範例:" -#: ../../library/statistics.rst:132 +#: ../../library/statistics.rst:134 msgid "" ">>> mean([1, 2, 3, 4, 4])\n" "2.8\n" @@ -339,7 +355,7 @@ msgstr "" ">>> mean([D(\"0.5\"), D(\"0.75\"), D(\"0.625\"), D(\"0.375\")])\n" "Decimal('0.5625')" -#: ../../library/statistics.rst:149 +#: ../../library/statistics.rst:151 msgid "" "The mean is strongly affected by `outliers `_ and is not necessarily a typical example of the data points. For " @@ -351,7 +367,7 @@ msgstr "" "低的\\ `集中趨勢 (central tendency) `_ 度量,請參考 :func:`median`。" -#: ../../library/statistics.rst:155 +#: ../../library/statistics.rst:157 msgid "" "The sample mean gives an unbiased estimate of the true population mean, so " "that when taken on average over all the possible samples, ``mean(sample)`` " @@ -364,11 +380,11 @@ msgstr "" "*data* 為整個母體而非單一樣本,則 ``mean(data)`` 等同於計算真實的母體平均數 " "μ。" -#: ../../library/statistics.rst:164 +#: ../../library/statistics.rst:166 msgid "Convert *data* to floats and compute the arithmetic mean." msgstr "將 *data* 轉換為浮點數並計算其算數平均數。" -#: ../../library/statistics.rst:166 +#: ../../library/statistics.rst:168 msgid "" "This runs faster than the :func:`mean` function and it always returns a :" "class:`float`. The *data* may be a sequence or iterable. If the input " @@ -378,7 +394,7 @@ msgstr "" "可以是一個 sequence 或者 iterable。如果輸入的資料為空,則引發 :exc:" "`StatisticsError`。" -#: ../../library/statistics.rst:170 +#: ../../library/statistics.rst:172 msgid "" ">>> fmean([3.5, 4.0, 5.25])\n" "4.25" @@ -386,7 +402,7 @@ msgstr "" ">>> fmean([3.5, 4.0, 5.25])\n" "4.25" -#: ../../library/statistics.rst:175 +#: ../../library/statistics.rst:177 msgid "" "Optional weighting is supported. For example, a professor assigns a grade " "for a course by weighting quizzes at 20%, homework at 20%, a midterm exam at " @@ -395,7 +411,7 @@ msgstr "" "支援選擇性的加權。例如,一位教授以 20% 的比重計算小考分數,20% 的比重計算作業" "分數,30% 的比重計算期中考試分數,以及 30% 的比重計算期末考試分數:" -#: ../../library/statistics.rst:179 +#: ../../library/statistics.rst:181 msgid "" ">>> grades = [85, 92, 83, 91]\n" ">>> weights = [0.20, 0.20, 0.30, 0.30]\n" @@ -407,7 +423,7 @@ msgstr "" ">>> fmean(grades, weights)\n" "87.6" -#: ../../library/statistics.rst:186 +#: ../../library/statistics.rst:188 msgid "" "If *weights* is supplied, it must be the same length as the *data* or a :exc:" "`ValueError` will be raised." @@ -415,15 +431,15 @@ msgstr "" "如果有提供 *weights*,它必須與 *data* 長度相同,否則將引發 :exc:" "`ValueError`。" -#: ../../library/statistics.rst:191 ../../library/statistics.rst:259 +#: ../../library/statistics.rst:193 ../../library/statistics.rst:261 msgid "Added support for *weights*." msgstr "新增 *weights* 的支援。" -#: ../../library/statistics.rst:197 +#: ../../library/statistics.rst:199 msgid "Convert *data* to floats and compute the geometric mean." msgstr "將 *data* 轉換成浮點數並計算其幾何平均數。" -#: ../../library/statistics.rst:199 +#: ../../library/statistics.rst:201 msgid "" "The geometric mean indicates the central tendency or typical value of the " "*data* using the product of the values (as opposed to the arithmetic mean " @@ -432,7 +448,7 @@ msgstr "" "幾何平均數使用數值的乘積(與之對照,算數平均數使用的是數值的和)來表示 " "*data* 的集中趨勢或典型值。" -#: ../../library/statistics.rst:203 +#: ../../library/statistics.rst:205 msgid "" "Raises a :exc:`StatisticsError` if the input dataset is empty, if it " "contains a zero, or if it contains a negative value. The *data* may be a " @@ -441,19 +457,19 @@ msgstr "" "若輸入的資料集為空、包含零、包含負值,則引發 :exc:`StatisticsError`。*data* " "可為 sequence 或者 iterable。" -#: ../../library/statistics.rst:207 +#: ../../library/statistics.rst:209 msgid "" "No special efforts are made to achieve exact results. (However, this may " "change in the future.)" msgstr "目前沒有特別為了精確結果而特別多下什麼工夫。(然而,未來或許會有。)" -#: ../../library/statistics.rst:210 +#: ../../library/statistics.rst:212 msgid "" ">>> round(geometric_mean([54, 24, 36]), 1)\n" "36.0" msgstr "" -#: ../../library/statistics.rst:220 +#: ../../library/statistics.rst:222 msgid "" "Return the harmonic mean of *data*, a sequence or iterable of real-valued " "numbers. If *weights* is omitted or ``None``, then equal weighting is " @@ -462,7 +478,7 @@ msgstr "" "回傳 *data* 的調和平均數。*data* 可為實數 (real-valued) sequence 或者 " "iterable。如果省略 *weights* 或者 *weights* 為 ``None``,則假設各權重相等。" -#: ../../library/statistics.rst:224 +#: ../../library/statistics.rst:226 msgid "" "The harmonic mean is the reciprocal of the arithmetic :func:`mean` of the " "reciprocals of the data. For example, the harmonic mean of three values *a*, " @@ -473,7 +489,7 @@ msgstr "" "三個數 *a*,*b* 與 *c* 的調和平均數等於 ``3/(1/a + 1/b + 1/c)``。若其中一個值" "為零,結果將為零。" -#: ../../library/statistics.rst:229 +#: ../../library/statistics.rst:231 msgid "" "The harmonic mean is a type of average, a measure of the central location of " "the data. It is often appropriate when averaging ratios or rates, for " @@ -482,7 +498,7 @@ msgstr "" "調和平均數是一種平均數,是衡量資料中心位置的一種方法。它通常用於計算比率 " "(ratio) 或率 (rate) 的平均,例如速率(speed)。" -#: ../../library/statistics.rst:233 +#: ../../library/statistics.rst:235 msgid "" "Suppose a car travels 10 km at 40 km/hr, then another 10 km at 60 km/hr. " "What is the average speed?" @@ -490,7 +506,7 @@ msgstr "" "假設一輛汽車以時速 40 公里的速率行駛 10 公里,然後再以時速 60 公里的速率行駛 " "10 公里,求汽車的平均速率?" -#: ../../library/statistics.rst:236 +#: ../../library/statistics.rst:238 msgid "" ">>> harmonic_mean([40, 60])\n" "48.0" @@ -498,7 +514,7 @@ msgstr "" ">>> harmonic_mean([40, 60])\n" "48.0" -#: ../../library/statistics.rst:241 +#: ../../library/statistics.rst:243 msgid "" "Suppose a car travels 40 km/hr for 5 km, and when traffic clears, speeds-up " "to 60 km/hr for the remaining 30 km of the journey. What is the average " @@ -507,7 +523,7 @@ msgstr "" "假設一輛汽車以時速 40 公里的速率行駛 5 公里,然後在交通順暢時,加速到時速 60 " "公里,以此速度行駛剩下的 30 公里。求汽車的平均速率?" -#: ../../library/statistics.rst:245 +#: ../../library/statistics.rst:247 msgid "" ">>> harmonic_mean([40, 60], weights=[5, 30])\n" "56.0" @@ -515,7 +531,7 @@ msgstr "" ">>> harmonic_mean([40, 60], weights=[5, 30])\n" "56.0" -#: ../../library/statistics.rst:250 +#: ../../library/statistics.rst:252 msgid "" ":exc:`StatisticsError` is raised if *data* is empty, any element is less " "than zero, or if the weighted sum isn't positive." @@ -523,7 +539,7 @@ msgstr "" "若 *data* 為空、含有任何小於零的元素、或者加權總和不為正數,則引發 :exc:" "`StatisticsError`。" -#: ../../library/statistics.rst:253 +#: ../../library/statistics.rst:255 msgid "" "The current algorithm has an early-out when it encounters a zero in the " "input. This means that the subsequent inputs are not tested for validity. " @@ -532,7 +548,113 @@ msgstr "" "目前的演算法設計為,若在輸入當中遇到零,則會提前退出。這意味著後續的輸入並未" "進行有效性檢查。(這種行為在未來可能會改變。)" -#: ../../library/statistics.rst:264 +#: ../../library/statistics.rst:267 +msgid "" +"`Kernel Density Estimation (KDE) `_: Create a continuous " +"probability density function or cumulative distribution function from " +"discrete samples." +msgstr "" + +#: ../../library/statistics.rst:272 +msgid "" +"The basic idea is to smooth the data using `a kernel function `_. to help draw inferences about a " +"population from a sample." +msgstr "" + +#: ../../library/statistics.rst:276 +msgid "" +"The degree of smoothing is controlled by the scaling parameter *h* which is " +"called the bandwidth. Smaller values emphasize local features while larger " +"values give smoother results." +msgstr "" + +#: ../../library/statistics.rst:280 +msgid "" +"The *kernel* determines the relative weights of the sample data points. " +"Generally, the choice of kernel shape does not matter as much as the more " +"influential bandwidth smoothing parameter." +msgstr "" + +#: ../../library/statistics.rst:284 +msgid "" +"Kernels that give some weight to every sample point include *normal* " +"(*gauss*), *logistic*, and *sigmoid*." +msgstr "" + +#: ../../library/statistics.rst:287 +msgid "" +"Kernels that only give weight to sample points within the bandwidth include " +"*rectangular* (*uniform*), *triangular*, *parabolic* (*epanechnikov*), " +"*quartic* (*biweight*), *triweight*, and *cosine*." +msgstr "" + +#: ../../library/statistics.rst:291 +msgid "" +"If *cumulative* is true, will return a cumulative distribution function." +msgstr "" + +#: ../../library/statistics.rst:293 ../../library/statistics.rst:324 +#, fuzzy +msgid "" +"A :exc:`StatisticsError` will be raised if the *data* sequence is empty." +msgstr "若 *data* 為空,則引發 :exc:`StatisticsError`。" + +#: ../../library/statistics.rst:295 +#, fuzzy +msgid "" +"`Wikipedia has an example `_ where we can use :func:`kde` to " +"generate and plot a probability density function estimated from a small " +"sample:" +msgstr "" +"`維基百科有一個範例 `_,我們可以使用 ``kde_normal()`` 這個錦囊" +"妙計來生成並繪製從小樣本估計的機率密度函式:" + +#: ../../library/statistics.rst:300 +#, fuzzy +msgid "" +">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" +">>> f_hat = kde(sample, h=1.5)\n" +">>> xarr = [i/100 for i in range(-750, 1100)]\n" +">>> yarr = [f_hat(x) for x in xarr]" +msgstr "" +">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" +">>> pdf, cdf, rand = kde_normal(sample, h=1.5)\n" +">>> xarr = [i/100 for i in range(-750, 1100)]\n" +">>> yarr = [pdf(x) for x in xarr]" + +#: ../../library/statistics.rst:307 +msgid "The points in ``xarr`` and ``yarr`` can be used to make a PDF plot:" +msgstr "``xarr`` 和 ``yarr`` 中的點可用於繪製 PDF 圖:" + +#: ../../library/statistics.rst:309 +msgid "Scatter plot of the estimated probability density function." +msgstr "估計機率密度函式的散點圖 (scatter plot)。" + +#: ../../library/statistics.rst:317 +msgid "" +"Return a function that makes a random selection from the estimated " +"probability density function produced by ``kde(data, h, kernel)``." +msgstr "" + +#: ../../library/statistics.rst:320 +msgid "" +"Providing a *seed* allows reproducible selections. In the future, the values " +"may change slightly as more accurate kernel inverse CDF estimates are " +"implemented. The seed may be an integer, float, str, or bytes." +msgstr "" + +#: ../../library/statistics.rst:326 +msgid "" +"Continuing the example for :func:`kde`, we can use :func:`kde_random` to " +"generate new random selections from an estimated probability density " +"function:" +msgstr "" + +#: ../../library/statistics.rst:341 msgid "" "Return the median (middle value) of numeric data, using the common \"mean of " "middle two\" method. If *data* is empty, :exc:`StatisticsError` is raised. " @@ -541,7 +663,7 @@ msgstr "" "使用常見的「中間兩數取平均」方法回傳數值資料的中位數 (中間值)。若 *data* 為" "空,則會引發 :exc:`StatisticsError`。*data* 可為一個 sequence 或者 iterable。" -#: ../../library/statistics.rst:268 +#: ../../library/statistics.rst:345 msgid "" "The median is a robust measure of central location and is less affected by " "the presence of outliers. When the number of data points is odd, the middle " @@ -550,7 +672,7 @@ msgstr "" "中位數是一種穩健的衡量資料中心位置的方法,較不易被離群值影響。當資料點數量為" "奇數時,會回傳中間的資料點:" -#: ../../library/statistics.rst:272 +#: ../../library/statistics.rst:349 msgid "" ">>> median([1, 3, 5])\n" "3" @@ -558,13 +680,13 @@ msgstr "" ">>> median([1, 3, 5])\n" "3" -#: ../../library/statistics.rst:277 +#: ../../library/statistics.rst:354 msgid "" "When the number of data points is even, the median is interpolated by taking " "the average of the two middle values:" msgstr "當資料點數量為偶數時,中位數透過中間兩個值的平均數來插值計算:" -#: ../../library/statistics.rst:280 +#: ../../library/statistics.rst:357 msgid "" ">>> median([1, 3, 5, 7])\n" "4.0" @@ -572,7 +694,7 @@ msgstr "" ">>> median([1, 3, 5, 7])\n" "4.0" -#: ../../library/statistics.rst:285 +#: ../../library/statistics.rst:362 msgid "" "This is suited for when your data is discrete, and you don't mind that the " "median may not be an actual data point." @@ -580,7 +702,7 @@ msgstr "" "若你的資料為離散資料,並且你不介意中位數可能並非真實的資料點,那這函式適合" "你。" -#: ../../library/statistics.rst:288 +#: ../../library/statistics.rst:365 msgid "" "If the data is ordinal (supports order operations) but not numeric (doesn't " "support addition), consider using :func:`median_low` or :func:`median_high` " @@ -589,7 +711,7 @@ msgstr "" "若你的資料為順序 (ordinal) 資料(支援排序操作)但並非數值型(不支援加法),可" "以考慮改用 :func:`median_low` 或是 :func:`median_high` 代替。" -#: ../../library/statistics.rst:294 +#: ../../library/statistics.rst:371 msgid "" "Return the low median of numeric data. If *data* is empty, :exc:" "`StatisticsError` is raised. *data* can be a sequence or iterable." @@ -597,7 +719,7 @@ msgstr "" "回傳數值型資料的低中位數 (low median)。若 *data* 為空,則引發 :exc:" "`StatisticsError`。*data* 可為 sequence 或者 iterable。" -#: ../../library/statistics.rst:297 +#: ../../library/statistics.rst:374 msgid "" "The low median is always a member of the data set. When the number of data " "points is odd, the middle value is returned. When it is even, the smaller " @@ -606,7 +728,7 @@ msgstr "" "低中位數一定會在原本的資料集當中。當資料點數量為奇數時,回傳中間值。當數量為" "偶數時,回傳兩個中間值當中較小的值。" -#: ../../library/statistics.rst:301 +#: ../../library/statistics.rst:378 msgid "" ">>> median_low([1, 3, 5])\n" "3\n" @@ -618,7 +740,7 @@ msgstr "" ">>> median_low([1, 3, 5, 7])\n" "3" -#: ../../library/statistics.rst:308 +#: ../../library/statistics.rst:385 msgid "" "Use the low median when your data are discrete and you prefer the median to " "be an actual data point rather than interpolated." @@ -626,7 +748,7 @@ msgstr "" "當你的資料為離散資料,且你希望中位數是實際的資料點而不是插值時,可以用低中位" "數。" -#: ../../library/statistics.rst:314 +#: ../../library/statistics.rst:391 msgid "" "Return the high median of data. If *data* is empty, :exc:`StatisticsError` " "is raised. *data* can be a sequence or iterable." @@ -634,7 +756,7 @@ msgstr "" "回傳數值型資料的高中位數 (high median)。若 *data* 為空,則引發 :exc:" "`StatisticsError`。*data* 可為 sequence 或者 iterable。" -#: ../../library/statistics.rst:317 +#: ../../library/statistics.rst:394 msgid "" "The high median is always a member of the data set. When the number of data " "points is odd, the middle value is returned. When it is even, the larger of " @@ -643,7 +765,7 @@ msgstr "" "高中位數一定會在原本的資料集當中。當資料點數量為奇數時,回傳中間值。當數量為" "偶數時,回傳兩個中間值當中較大的值。" -#: ../../library/statistics.rst:321 +#: ../../library/statistics.rst:398 msgid "" ">>> median_high([1, 3, 5])\n" "3\n" @@ -655,7 +777,7 @@ msgstr "" ">>> median_high([1, 3, 5, 7])\n" "5" -#: ../../library/statistics.rst:328 +#: ../../library/statistics.rst:405 msgid "" "Use the high median when your data are discrete and you prefer the median to " "be an actual data point rather than interpolated." @@ -663,31 +785,31 @@ msgstr "" "當你的資料為離散資料,且你希望中位數是實際的資料點而不是插值時,可以用高中位" "數。" -#: ../../library/statistics.rst:334 +#: ../../library/statistics.rst:411 msgid "" "Estimates the median for numeric data that has been `grouped or binned " "`_ around the midpoints of " "consecutive, fixed-width intervals." msgstr "" -#: ../../library/statistics.rst:338 +#: ../../library/statistics.rst:415 msgid "" "The *data* can be any iterable of numeric data with each value being exactly " "the midpoint of a bin. At least one value must be present." msgstr "" -#: ../../library/statistics.rst:341 +#: ../../library/statistics.rst:418 msgid "The *interval* is the width of each bin." msgstr "" -#: ../../library/statistics.rst:343 +#: ../../library/statistics.rst:420 msgid "" "For example, demographic information may have been summarized into " "consecutive ten-year age groups with each group being represented by the 5-" "year midpoints of the intervals:" msgstr "" -#: ../../library/statistics.rst:347 +#: ../../library/statistics.rst:424 msgid "" ">>> from collections import Counter\n" ">>> demographics = Counter({\n" @@ -709,13 +831,13 @@ msgstr "" "... })\n" "..." -#: ../../library/statistics.rst:359 +#: ../../library/statistics.rst:436 msgid "" "The 50th percentile (median) is the 536th person out of the 1071 member " "cohort. That person is in the 30 to 40 year old age group." msgstr "" -#: ../../library/statistics.rst:362 +#: ../../library/statistics.rst:439 msgid "" "The regular :func:`median` function would assume that everyone in the " "tricenarian age group was exactly 35 years old. A more tenable assumption " @@ -723,7 +845,7 @@ msgid "" "and 40. For that, we use :func:`median_grouped`:" msgstr "" -#: ../../library/statistics.rst:368 +#: ../../library/statistics.rst:445 msgid "" ">>> data = list(demographics.elements())\n" ">>> median(data)\n" @@ -737,20 +859,20 @@ msgstr "" ">>> round(median_grouped(data, interval=10), 1)\n" "37.5" -#: ../../library/statistics.rst:376 +#: ../../library/statistics.rst:453 msgid "" "The caller is responsible for making sure the data points are separated by " "exact multiples of *interval*. This is essential for getting a correct " "result. The function does not check this precondition." msgstr "" -#: ../../library/statistics.rst:380 +#: ../../library/statistics.rst:457 msgid "" "Inputs may be any numeric type that can be coerced to a float during the " "interpolation step." msgstr "" -#: ../../library/statistics.rst:386 +#: ../../library/statistics.rst:463 msgid "" "Return the single most common data point from discrete or nominal *data*. " "The mode (when it exists) is the most typical value and serves as a measure " @@ -759,7 +881,7 @@ msgstr "" "回傳離散或名目 *data* 中出現次數最多次的值,只回傳一個。眾數(如果存在)是最" "典型的值,並用來衡量資料的中心位置。" -#: ../../library/statistics.rst:390 +#: ../../library/statistics.rst:467 msgid "" "If there are multiple modes with the same frequency, returns the first one " "encountered in the *data*. If the smallest or largest of those is desired " @@ -771,14 +893,14 @@ msgstr "" "``max(multimode(data))``。如果輸入的 *data* 為空,則會引發 :exc:" "`StatisticsError`。" -#: ../../library/statistics.rst:395 +#: ../../library/statistics.rst:472 msgid "" "``mode`` assumes discrete data and returns a single value. This is the " "standard treatment of the mode as commonly taught in schools:" msgstr "" "``mode`` 假定為離散資料,並回傳單一的值。這也是一般學校教授的標準眾數定義:" -#: ../../library/statistics.rst:398 +#: ../../library/statistics.rst:475 msgid "" ">>> mode([1, 1, 2, 3, 3, 3, 3, 4])\n" "3" @@ -786,13 +908,13 @@ msgstr "" ">>> mode([1, 1, 2, 3, 3, 3, 3, 4])\n" "3" -#: ../../library/statistics.rst:403 +#: ../../library/statistics.rst:480 msgid "" "The mode is unique in that it is the only statistic in this package that " "also applies to nominal (non-numeric) data:" msgstr "眾數特別之處在於它是此套件中唯一也適用於名目(非數值型)資料的統計量:" -#: ../../library/statistics.rst:406 +#: ../../library/statistics.rst:483 msgid "" ">>> mode([\"red\", \"blue\", \"blue\", \"red\", \"green\", \"red\", " "\"red\"])\n" @@ -802,7 +924,7 @@ msgstr "" "\"red\"])\n" "'red'" -#: ../../library/statistics.rst:411 +#: ../../library/statistics.rst:488 msgid "" "Only hashable inputs are supported. To handle type :class:`set`, consider " "casting to :class:`frozenset`. To handle type :class:`list`, consider " @@ -811,7 +933,7 @@ msgid "" "key=data.count)``." msgstr "" -#: ../../library/statistics.rst:417 +#: ../../library/statistics.rst:494 msgid "" "Now handles multimodal datasets by returning the first mode encountered. " "Formerly, it raised :exc:`StatisticsError` when more than one mode was found." @@ -819,7 +941,7 @@ msgstr "" "現在,遇到資料中有多個眾數時,會回傳第一個遇到的眾數。在以前,當找到大於一個" "眾數時,會引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:425 +#: ../../library/statistics.rst:502 msgid "" "Return a list of the most frequently occurring values in the order they were " "first encountered in the *data*. Will return more than one result if there " @@ -829,7 +951,7 @@ msgstr "" "次出現的順序排列。如果有多個眾數,將會回傳所有結果。若 *data* 為空,則回傳空" "的 list:" -#: ../../library/statistics.rst:429 +#: ../../library/statistics.rst:506 msgid "" ">>> multimode('aabbbbccddddeeffffgg')\n" "['b', 'd', 'f']\n" @@ -841,7 +963,7 @@ msgstr "" ">>> multimode('')\n" "[]" -#: ../../library/statistics.rst:441 +#: ../../library/statistics.rst:518 msgid "" "Return the population standard deviation (the square root of the population " "variance). See :func:`pvariance` for arguments and other details." @@ -849,7 +971,7 @@ msgstr "" "回傳母體標準差(即母體變異數的平方根)。有關引數以及其他細節,請參見 :func:" "`pvariance`。" -#: ../../library/statistics.rst:444 +#: ../../library/statistics.rst:521 msgid "" ">>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n" "0.986893273527251" @@ -857,7 +979,7 @@ msgstr "" ">>> pstdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n" "0.986893273527251" -#: ../../library/statistics.rst:452 +#: ../../library/statistics.rst:529 msgid "" "Return the population variance of *data*, a non-empty sequence or iterable " "of real-valued numbers. Variance, or second moment about the mean, is a " @@ -869,7 +991,7 @@ msgstr "" "數,或者以平均數為中心的二階動差,用於衡量資料的變異性(離度或分散程度)。變" "異數大表示資料分散,變異數小表示資料集中在平均數附近。" -#: ../../library/statistics.rst:458 +#: ../../library/statistics.rst:535 msgid "" "If the optional second argument *mu* is given, it should be the *population* " "mean of the *data*. It can also be used to compute the second moment around " @@ -880,7 +1002,7 @@ msgstr "" "(population mean)。它也可以用於計算非以平均值為中心的第二動差。如果沒有傳入此" "引數或者引數為 ``None`` (預設值),則自動計算資料的算數平均數。" -#: ../../library/statistics.rst:463 +#: ../../library/statistics.rst:540 msgid "" "Use this function to calculate the variance from the entire population. To " "estimate the variance from a sample, the :func:`variance` function is " @@ -889,16 +1011,16 @@ msgstr "" "使用此函式來計算整個母體的變異數。如果要從樣本估算變異數,:func:`variance` 通" "常是較好的選擇。" -#: ../../library/statistics.rst:467 +#: ../../library/statistics.rst:544 msgid "Raises :exc:`StatisticsError` if *data* is empty." msgstr "若 *data* 為空,則引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:469 ../../library/statistics.rst:539 -#: ../../library/statistics.rst:643 +#: ../../library/statistics.rst:546 ../../library/statistics.rst:616 +#: ../../library/statistics.rst:725 msgid "Examples:" msgstr "範例:" -#: ../../library/statistics.rst:471 +#: ../../library/statistics.rst:548 msgid "" ">>> data = [0.0, 0.25, 0.25, 1.25, 1.5, 1.75, 2.75, 3.25]\n" ">>> pvariance(data)\n" @@ -908,7 +1030,7 @@ msgstr "" ">>> pvariance(data)\n" "1.25" -#: ../../library/statistics.rst:477 +#: ../../library/statistics.rst:554 msgid "" "If you have already calculated the mean of your data, you can pass it as the " "optional second argument *mu* to avoid recalculation:" @@ -916,7 +1038,7 @@ msgstr "" "如果已經計算出資料的平均值,你可以將其作為選擇性的第二個引數 *mu* 傳遞以避免" "重新計算:" -#: ../../library/statistics.rst:480 +#: ../../library/statistics.rst:557 msgid "" ">>> mu = mean(data)\n" ">>> pvariance(data, mu)\n" @@ -926,11 +1048,11 @@ msgstr "" ">>> pvariance(data, mu)\n" "1.25" -#: ../../library/statistics.rst:486 +#: ../../library/statistics.rst:563 msgid "Decimals and Fractions are supported:" msgstr "支援小數 (decimal) 與分數 (fraction):" -#: ../../library/statistics.rst:488 +#: ../../library/statistics.rst:565 msgid "" ">>> from decimal import Decimal as D\n" ">>> pvariance([D(\"27.5\"), D(\"30.25\"), D(\"30.25\"), D(\"34.5\"), " @@ -950,7 +1072,7 @@ msgstr "" ">>> pvariance([F(1, 4), F(5, 4), F(1, 2)])\n" "Fraction(13, 72)" -#: ../../library/statistics.rst:500 +#: ../../library/statistics.rst:577 msgid "" "When called with the entire population, this gives the population variance " "σ². When called on a sample instead, this is the biased sample variance s², " @@ -959,7 +1081,7 @@ msgstr "" "當在整個母體上呼叫此函式時,會回傳母體變異數 σ²。當在樣本上呼叫此函式時,會回" "傳有偏差的樣本變異數 s²,也就是具有 N 個自由度的變異數。" -#: ../../library/statistics.rst:504 +#: ../../library/statistics.rst:581 msgid "" "If you somehow know the true population mean μ, you may use this function to " "calculate the variance of a sample, giving the known population mean as the " @@ -971,7 +1093,7 @@ msgstr "" "引數提供給此函式,用以計算樣本的變異數。只要資料點是母體的隨機樣本,結果將是" "母體變異數的不偏估計。" -#: ../../library/statistics.rst:513 +#: ../../library/statistics.rst:590 msgid "" "Return the sample standard deviation (the square root of the sample " "variance). See :func:`variance` for arguments and other details." @@ -979,7 +1101,7 @@ msgstr "" "回傳樣本標準差(即樣本變異數的平方根)。有關引數以及其他細節,請參見 :func:" "`variance`。" -#: ../../library/statistics.rst:516 +#: ../../library/statistics.rst:593 msgid "" ">>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n" "1.0810874155219827" @@ -987,7 +1109,7 @@ msgstr "" ">>> stdev([1.5, 2.5, 2.5, 2.75, 3.25, 4.75])\n" "1.0810874155219827" -#: ../../library/statistics.rst:524 +#: ../../library/statistics.rst:601 msgid "" "Return the sample variance of *data*, an iterable of at least two real-" "valued numbers. Variance, or second moment about the mean, is a measure of " @@ -999,7 +1121,7 @@ msgstr "" "平均數為中心的二階動差,用於衡量資料的變異性(離度或分散程度)。變異數大表示" "資料分散,變異數小表示資料集中在平均數附近。" -#: ../../library/statistics.rst:530 +#: ../../library/statistics.rst:607 msgid "" "If the optional second argument *xbar* is given, it should be the *sample* " "mean of *data*. If it is missing or ``None`` (the default), the mean is " @@ -1009,7 +1131,7 @@ msgstr "" "(sample mean)。如果沒有傳入或者為 ``None`` (預設值),則自動計算資料的平均" "值。" -#: ../../library/statistics.rst:534 +#: ../../library/statistics.rst:611 msgid "" "Use this function when your data is a sample from a population. To calculate " "the variance from the entire population, see :func:`pvariance`." @@ -1017,11 +1139,11 @@ msgstr "" "當你的資料是來自母體的樣本時,請使用此函式。若要從整個母體計算變異數,請參" "見 :func:`pvariance`。" -#: ../../library/statistics.rst:537 +#: ../../library/statistics.rst:614 msgid "Raises :exc:`StatisticsError` if *data* has fewer than two values." msgstr "若 *data* 內少於兩個值,則引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:541 +#: ../../library/statistics.rst:618 msgid "" ">>> data = [2.75, 1.75, 1.25, 0.25, 0.5, 1.25, 3.5]\n" ">>> variance(data)\n" @@ -1031,7 +1153,7 @@ msgstr "" ">>> variance(data)\n" "1.3720238095238095" -#: ../../library/statistics.rst:547 +#: ../../library/statistics.rst:624 msgid "" "If you have already calculated the sample mean of your data, you can pass it " "as the optional second argument *xbar* to avoid recalculation:" @@ -1039,7 +1161,7 @@ msgstr "" "如果已經計算出資料的樣本平均值,你可以將其作為選擇性的第二個引數 *mu* 傳遞以" "避免重新計算:" -#: ../../library/statistics.rst:550 +#: ../../library/statistics.rst:627 msgid "" ">>> m = mean(data)\n" ">>> variance(data, m)\n" @@ -1049,7 +1171,7 @@ msgstr "" ">>> variance(data, m)\n" "1.3720238095238095" -#: ../../library/statistics.rst:556 +#: ../../library/statistics.rst:633 msgid "" "This function does not attempt to verify that you have passed the actual " "mean as *xbar*. Using arbitrary values for *xbar* can lead to invalid or " @@ -1058,11 +1180,11 @@ msgstr "" "此函式不會驗證你傳入的 *xbar* 是否為實際的平均數。傳入任意的 *xbar* 會導致無" "效或不可能的結果。" -#: ../../library/statistics.rst:560 +#: ../../library/statistics.rst:637 msgid "Decimal and Fraction values are supported:" msgstr "支援小數 (decimal) 與分數 (fraction):" -#: ../../library/statistics.rst:562 +#: ../../library/statistics.rst:639 msgid "" ">>> from decimal import Decimal as D\n" ">>> variance([D(\"27.5\"), D(\"30.25\"), D(\"30.25\"), D(\"34.5\"), " @@ -1082,7 +1204,7 @@ msgstr "" ">>> variance([F(1, 6), F(1, 2), F(5, 3)])\n" "Fraction(67, 108)" -#: ../../library/statistics.rst:574 +#: ../../library/statistics.rst:651 msgid "" "This is the sample variance s² with Bessel's correction, also known as " "variance with N-1 degrees of freedom. Provided that the data points are " @@ -1093,7 +1215,7 @@ msgstr "" "為 N-1 的變異數。只要資料點具有代表性(例如:獨立且具有相同分布),結果應該會" "是對真實母體變異數的不偏估計。" -#: ../../library/statistics.rst:579 +#: ../../library/statistics.rst:656 msgid "" "If you somehow know the actual population mean μ you should pass it to the :" "func:`pvariance` function as the *mu* parameter to get the variance of a " @@ -1102,7 +1224,7 @@ msgstr "" "若你剛好知道真正的母體平均數 μ,你應該將其作為 *mu* 參數傳入 :func:" "`pvariance` 函式來計算樣本變異數。" -#: ../../library/statistics.rst:585 +#: ../../library/statistics.rst:662 msgid "" "Divide *data* into *n* continuous intervals with equal probability. Returns " "a list of ``n - 1`` cut points separating the intervals." @@ -1110,7 +1232,7 @@ msgstr "" "將 *data* 分成 *n* 個具有相等機率的連續區間。回傳一個包含 ``n - 1`` 個用於切" "分各區間的分隔點的 list。" -#: ../../library/statistics.rst:588 +#: ../../library/statistics.rst:665 msgid "" "Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set " "*n* to 100 for percentiles which gives the 99 cuts points that separate " @@ -1121,16 +1243,17 @@ msgstr "" "分位數 (percentile),這將給出 99 個分隔點將 *data* 分成 100 個大小相等的組。" "如果 *n* 不是至少為 1,則引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:593 +#: ../../library/statistics.rst:670 +#, fuzzy msgid "" "The *data* can be any iterable containing sample data. For meaningful " "results, the number of data points in *data* should be larger than *n*. " -"Raises :exc:`StatisticsError` if there are not at least two data points." +"Raises :exc:`StatisticsError` if there is not at least one data point." msgstr "" "*data* 可以是包含樣本資料的任何 iterable。為了取得有意義的結果,*data* 中的資" "料點數量應大於 *n*。如果資料點少於兩個,則引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:597 +#: ../../library/statistics.rst:674 msgid "" "The cut points are linearly interpolated from the two nearest data points. " "For example, if a cut point falls one-third of the distance between two " @@ -1139,7 +1262,7 @@ msgstr "" "分隔點是從兩個最近的資料點線性內插值計算出來的。舉例來說,如果分隔點落在兩個" "樣本值 ``100`` 與 ``112`` 之間的距離三分之一處,則分隔點的值將為 ``104``。" -#: ../../library/statistics.rst:602 +#: ../../library/statistics.rst:679 msgid "" "The *method* for computing quantiles can be varied depending on whether the " "*data* includes or excludes the lowest and highest possible values from the " @@ -1148,7 +1271,7 @@ msgstr "" "計算分位數的 *method* 可以根據 *data* 是否包含或排除來自母體的最小與最大可能" "的值而改變。" -#: ../../library/statistics.rst:606 +#: ../../library/statistics.rst:683 msgid "" "The default *method* is \"exclusive\" and is used for data sampled from a " "population that can have more extreme values than found in the samples. The " @@ -1162,7 +1285,7 @@ msgstr "" "1)``。給定九個樣本資料,此方法將對資料排序且計算下列百分位數:10%、20%、30%、" "40%、50%、60%、70%、80%、90%。" -#: ../../library/statistics.rst:613 +#: ../../library/statistics.rst:690 msgid "" "Setting the *method* to \"inclusive\" is used for describing population data " "or for samples that are known to include the most extreme values from the " @@ -1179,7 +1302,7 @@ msgstr "" "給定十一個個樣本資料,此方法將對資料排序且計算下列百分位數:0%、10%、20%、" "30%、40%、50%、60%、70%、80%、90%、100%。" -#: ../../library/statistics.rst:622 +#: ../../library/statistics.rst:699 msgid "" "# Decile cut points for empirically sampled data\n" ">>> data = [105, 129, 87, 86, 111, 111, 89, 81, 108, 92, 110,\n" @@ -1191,7 +1314,14 @@ msgid "" "[81.0, 86.2, 89.0, 99.4, 102.5, 103.6, 106.0, 109.8, 111.0]" msgstr "" -#: ../../library/statistics.rst:637 +#: ../../library/statistics.rst:712 +msgid "" +"No longer raises an exception for an input with only a single data point. " +"This allows quantile estimates to be built up one sample point at a time " +"becoming gradually more refined with each new data point." +msgstr "" + +#: ../../library/statistics.rst:719 msgid "" "Return the sample covariance of two inputs *x* and *y*. Covariance is a " "measure of the joint variability of two inputs." @@ -1199,14 +1329,14 @@ msgstr "" "回傳兩輸入 *x* 與 *y* 的樣本共變異數 (sample covariance)。共變異數是衡量兩輸" "入的聯合變異性 (joint variability) 的指標。" -#: ../../library/statistics.rst:640 +#: ../../library/statistics.rst:722 msgid "" "Both inputs must be of the same length (no less than two), otherwise :exc:" "`StatisticsError` is raised." msgstr "" "兩輸入必須具有相同長度(至少兩個),否則會引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:645 +#: ../../library/statistics.rst:727 msgid "" ">>> x = [1, 2, 3, 4, 5, 6, 7, 8, 9]\n" ">>> y = [1, 2, 3, 1, 2, 3, 1, 2, 3]\n" @@ -1228,7 +1358,7 @@ msgstr "" ">>> covariance(z, x)\n" "-7.5" -#: ../../library/statistics.rst:661 +#: ../../library/statistics.rst:743 msgid "" "Return the `Pearson's correlation coefficient `_ for two inputs. Pearson's correlation " @@ -1239,7 +1369,7 @@ msgstr "" "en.wikipedia.org/wiki/Pearson_correlation_coefficient>`_。Pearson 相關係數 " "*r* 的值介於 -1 與 +1 之間。它衡量線性關係的強度與方向。" -#: ../../library/statistics.rst:667 +#: ../../library/statistics.rst:749 msgid "" "If *method* is \"ranked\", computes `Spearman's rank correlation coefficient " "`_ " @@ -1253,7 +1383,7 @@ msgstr "" "則取平均,令相同的值排名也相同。所得係數衡量單調關係 (monotonic " "relationship) 的強度。" -#: ../../library/statistics.rst:673 +#: ../../library/statistics.rst:755 msgid "" "Spearman's correlation coefficient is appropriate for ordinal data or for " "continuous data that doesn't meet the linear proportion requirement for " @@ -1262,7 +1392,7 @@ msgstr "" "Spearman 相關係數適用於順序型資料,或者不符合 Pearson 相關係數要求的線性比例" "關係的連續型 (continuous) 資料。" -#: ../../library/statistics.rst:677 +#: ../../library/statistics.rst:759 msgid "" "Both inputs must be of the same length (no less than two), and need not to " "be constant, otherwise :exc:`StatisticsError` is raised." @@ -1270,7 +1400,7 @@ msgstr "" "兩輸入必須具有相同長度(至少兩個),且不須為常數,否則會引發 :exc:" "`StatisticsError`。" -#: ../../library/statistics.rst:680 +#: ../../library/statistics.rst:762 msgid "" "Example with `Kepler's laws of planetary motion `_:" @@ -1278,7 +1408,7 @@ msgstr "" "以 `Kepler 行星運動定律 `_\\ 為例:" -#: ../../library/statistics.rst:683 +#: ../../library/statistics.rst:765 msgid "" ">>> # Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and Neptune\n" ">>> orbital_period = [88, 225, 365, 687, 4331, 10_756, 30_687, 60_190] # " @@ -1303,11 +1433,11 @@ msgid "" "1.0" msgstr "" -#: ../../library/statistics.rst:707 +#: ../../library/statistics.rst:789 msgid "Added support for Spearman's rank correlation coefficient." msgstr "新增了對 Spearman 等級相關係數的支援。" -#: ../../library/statistics.rst:712 +#: ../../library/statistics.rst:794 msgid "" "Return the slope and intercept of `simple linear regression `_ parameters estimated using " @@ -1321,11 +1451,11 @@ msgstr "" "迴歸描述自變數 (independent variable) *x* 與應變數 (dependent variable) *y* " "之間的關係,用以下的線性函式表示:" -#: ../../library/statistics.rst:718 +#: ../../library/statistics.rst:800 msgid "*y = slope \\* x + intercept + noise*" msgstr "*y = slope \\* x + intercept + noise*" -#: ../../library/statistics.rst:720 +#: ../../library/statistics.rst:802 msgid "" "where ``slope`` and ``intercept`` are the regression parameters that are " "estimated, and ``noise`` represents the variability of the data that was not " @@ -1335,7 +1465,7 @@ msgstr "" "其中 ``slope`` 和 ``intercept`` 是被估計的迴歸參數,而 ``noise`` 表示由線性迴" "歸未解釋的資料變異性(它等於應變數的預測值與實際值之差)。" -#: ../../library/statistics.rst:726 +#: ../../library/statistics.rst:808 msgid "" "Both inputs must be of the same length (no less than two), and the " "independent variable *x* cannot be constant; otherwise a :exc:" @@ -1344,7 +1474,7 @@ msgstr "" "兩輸入必須具有相同長度(至少兩個),且自變數 *x* 不得為常數,否則會引發 :exc:" "`StatisticsError`。" -#: ../../library/statistics.rst:730 +#: ../../library/statistics.rst:812 msgid "" "For example, we can use the `release dates of the Monty Python films " "`_ to predict the " @@ -1355,7 +1485,7 @@ msgstr "" "wikipedia.org/wiki/Monty_Python#Films>`_\\ 來預測至 2019 年為止,假設他們保持" "固定的製作速度,應該會產生的 Monty Python 電影的累計數量。" -#: ../../library/statistics.rst:736 +#: ../../library/statistics.rst:818 msgid "" ">>> year = [1971, 1975, 1979, 1982, 1983]\n" ">>> films_total = [1, 2, 3, 4, 5]\n" @@ -1369,7 +1499,7 @@ msgstr "" ">>> round(slope * 2019 + intercept)\n" "16" -#: ../../library/statistics.rst:744 +#: ../../library/statistics.rst:826 msgid "" "If *proportional* is true, the independent variable *x* and the dependent " "variable *y* are assumed to be directly proportional. The data is fit to a " @@ -1380,11 +1510,11 @@ msgstr "" "資料座落在通過原點的一直線上。由於 *intercept* 始終為 0.0,因此線性函式可簡化" "如下:" -#: ../../library/statistics.rst:750 +#: ../../library/statistics.rst:832 msgid "*y = slope \\* x + noise*" msgstr "*y = slope \\* x + noise*" -#: ../../library/statistics.rst:752 +#: ../../library/statistics.rst:834 msgid "" "Continuing the example from :func:`correlation`, we look to see how well a " "model based on major planets can predict the orbital distances for dwarf " @@ -1393,7 +1523,7 @@ msgstr "" "繼續 :func:`correlation` 中的範例,我們看看基於主要行星的模型可以如何很好地預" "測矮行星的軌道距離:" -#: ../../library/statistics.rst:756 +#: ../../library/statistics.rst:838 msgid "" ">>> model = linear_regression(period_squared, dist_cubed, " "proportional=True)\n" @@ -1409,27 +1539,27 @@ msgid "" "[5906, 10152, 6796, 6450, 414]" msgstr "" -#: ../../library/statistics.rst:772 +#: ../../library/statistics.rst:854 msgid "Added support for *proportional*." msgstr "新增 *proportional* 的支援。" -#: ../../library/statistics.rst:776 +#: ../../library/statistics.rst:858 msgid "Exceptions" msgstr "例外" -#: ../../library/statistics.rst:778 +#: ../../library/statistics.rst:860 msgid "A single exception is defined:" msgstr "定義了一個單一的例外:" -#: ../../library/statistics.rst:782 +#: ../../library/statistics.rst:864 msgid "Subclass of :exc:`ValueError` for statistics-related exceptions." msgstr ":exc:`ValueError` 的子類別,用於和統計相關的例外。" -#: ../../library/statistics.rst:786 +#: ../../library/statistics.rst:868 msgid ":class:`NormalDist` objects" msgstr ":class:`NormalDist` 物件" -#: ../../library/statistics.rst:788 +#: ../../library/statistics.rst:870 msgid "" ":class:`NormalDist` is a tool for creating and manipulating normal " "distributions of a `random variable `_ 的常態分布的工" "具。它是一個將量測資料的平均數與標準差視為單一實體的類別。" -#: ../../library/statistics.rst:794 +#: ../../library/statistics.rst:876 msgid "" "Normal distributions arise from the `Central Limit Theorem `_ and have a wide range of " @@ -1449,7 +1579,7 @@ msgstr "" "常態分布源自於\\ `中央極限定理 (Central Limit Theorem) `_,在統計學中有著廣泛的應用。" -#: ../../library/statistics.rst:800 +#: ../../library/statistics.rst:882 msgid "" "Returns a new *NormalDist* object where *mu* represents the `arithmetic mean " "`_ and *sigma* represents the " @@ -1459,11 +1589,11 @@ msgstr "" "en.wikipedia.org/wiki/Arithmetic_mean>`_\\ 而 *sigma* 代表\\ `標準差 " "`_。" -#: ../../library/statistics.rst:805 +#: ../../library/statistics.rst:887 msgid "If *sigma* is negative, raises :exc:`StatisticsError`." msgstr "若 *sigma* 為負值,則引發 :exc:`StatisticsError`。" -#: ../../library/statistics.rst:809 +#: ../../library/statistics.rst:891 msgid "" "A read-only property for the `arithmetic mean `_ of a normal distribution." @@ -1471,14 +1601,14 @@ msgstr "" "常態分布中的\\ `算數平均數 `_\\ 唯讀屬性。" -#: ../../library/statistics.rst:815 +#: ../../library/statistics.rst:897 msgid "" "A read-only property for the `median `_ of a normal distribution." msgstr "" "常態分布中的\\ `中位數 `_\\ 唯讀屬性。" -#: ../../library/statistics.rst:821 +#: ../../library/statistics.rst:903 msgid "" "A read-only property for the `mode `_ of a normal distribution." @@ -1486,7 +1616,7 @@ msgstr "" "常態分布中的\\ `眾數 `_\\ 唯" "讀屬性。" -#: ../../library/statistics.rst:827 +#: ../../library/statistics.rst:909 msgid "" "A read-only property for the `standard deviation `_ of a normal distribution." @@ -1494,7 +1624,7 @@ msgstr "" "常態分布中的\\ `標準差 `_\\ 唯讀屬性。" -#: ../../library/statistics.rst:833 +#: ../../library/statistics.rst:915 msgid "" "A read-only property for the `variance `_ of a normal distribution. Equal to the square of the standard " @@ -1503,7 +1633,7 @@ msgstr "" "常態分布中的\\ `變異數 `_\\ 唯讀屬" "性。" -#: ../../library/statistics.rst:839 +#: ../../library/statistics.rst:921 msgid "" "Makes a normal distribution instance with *mu* and *sigma* parameters " "estimated from the *data* using :func:`fmean` and :func:`stdev`." @@ -1511,7 +1641,7 @@ msgstr "" "利用 :func:`fmean` 與 :func:`stdev` 函式,估計 *data* 的 *mu* 與 *sigma* 參" "數,建立一個常態分布的實例。" -#: ../../library/statistics.rst:842 +#: ../../library/statistics.rst:924 msgid "" "The *data* can be any :term:`iterable` and should consist of values that can " "be converted to type :class:`float`. If *data* does not contain at least " @@ -1523,7 +1653,7 @@ msgstr "" "若 *data* 沒有包含至少兩個以上的元素在內,則引發 :exc:`StatisticsError`,因為" "至少需要一個點來估計中央值且至少需要兩個點來估計分散情形。" -#: ../../library/statistics.rst:850 +#: ../../library/statistics.rst:932 msgid "" "Generates *n* random samples for a given mean and standard deviation. " "Returns a :class:`list` of :class:`float` values." @@ -1531,7 +1661,7 @@ msgstr "" "給定平均值與標準差,產生 *n* 個隨機樣本。回傳一個由 :class:`float` 組成的 :" "class:`list`。" -#: ../../library/statistics.rst:853 +#: ../../library/statistics.rst:935 msgid "" "If *seed* is given, creates a new instance of the underlying random number " "generator. This is useful for creating reproducible results, even in a " @@ -1540,7 +1670,13 @@ msgstr "" "若有給定 *seed*,則會建立一個以此為基礎的亂數產生器實例。這對於建立可重現的結" "果很有幫助,即使在多執行緒情境下也是如此。" -#: ../../library/statistics.rst:859 +#: ../../library/statistics.rst:941 +msgid "" +"Switched to a faster algorithm. To reproduce samples from previous " +"versions, use :func:`random.seed` and :func:`random.gauss`." +msgstr "" + +#: ../../library/statistics.rst:946 msgid "" "Using a `probability density function (pdf) `_, compute the relative likelihood that a " @@ -1552,7 +1688,7 @@ msgstr "" "值 *x* 的相對概度 (relative likelihood)。數學上,它是比率 ``P(x <= X < " "x+dx) / dx`` 在 *dx* 趨近於零時的極限值。" -#: ../../library/statistics.rst:865 +#: ../../library/statistics.rst:952 msgid "" "The relative likelihood is computed as the probability of a sample occurring " "in a narrow range divided by the width of the range (hence the word " @@ -1562,7 +1698,7 @@ msgstr "" "相對概度是樣本出現在狹窄範圍的機率,除以該範圍的寬度(故稱為「密度」)計算而" "得。由於概度是相對於其它點,故其值可大於 ``1.0``。" -#: ../../library/statistics.rst:872 +#: ../../library/statistics.rst:959 msgid "" "Using a `cumulative distribution function (cdf) `_, compute the probability that a " @@ -1573,7 +1709,7 @@ msgstr "" "wikipedia.org/wiki/Cumulative_distribution_function>`_ 計算隨機變數 *X* 小於" "或等於 *x* 的機率。數學上,它記為 ``P(X <= x)``。" -#: ../../library/statistics.rst:879 +#: ../../library/statistics.rst:966 msgid "" "Compute the inverse cumulative distribution function, also known as the " "`quantile function `_ or " @@ -1587,7 +1723,7 @@ msgstr "" "org/web/20190203145224/https://www.statisticshowto.datasciencecentral.com/" "inverse-distribution-function/>`_ 函式。數學上記為 ``x : P(X <= x) = p``。" -#: ../../library/statistics.rst:885 +#: ../../library/statistics.rst:972 msgid "" "Finds the value *x* of the random variable *X* such that the probability of " "the variable being less than or equal to that value equals the given " @@ -1595,7 +1731,7 @@ msgid "" msgstr "" "找出一個值 *x*,使得隨機變數 *X* 小於或等於該值的機率等於給定的機率 *p*。" -#: ../../library/statistics.rst:891 +#: ../../library/statistics.rst:978 msgid "" "Measures the agreement between two normal probability distributions. Returns " "a value between 0.0 and 1.0 giving `the overlapping area for the two " @@ -1604,7 +1740,7 @@ msgstr "" "衡量兩常態分布之間的一致性。回傳一個介於 0.0 與 1.0 之間的值,表示\\ `兩機率" "密度函式的重疊區域 `_。" -#: ../../library/statistics.rst:898 +#: ../../library/statistics.rst:985 msgid "" "Divide the normal distribution into *n* continuous intervals with equal " "probability. Returns a list of (n - 1) cut points separating the intervals." @@ -1612,7 +1748,7 @@ msgstr "" "將常態分布分割成 *n* 個具有相等機率的連續區間。回傳一個 list,包含 (n-1) 個切" "割區間的分隔點。" -#: ../../library/statistics.rst:902 +#: ../../library/statistics.rst:989 msgid "" "Set *n* to 4 for quartiles (the default). Set *n* to 10 for deciles. Set " "*n* to 100 for percentiles which gives the 99 cuts points that separate the " @@ -1622,7 +1758,7 @@ msgstr "" "*n* 設定為 100 表示百分位數,這會產生 99 個分隔點,將常態分布切割成大小相等的" "群組。" -#: ../../library/statistics.rst:908 +#: ../../library/statistics.rst:995 msgid "" "Compute the `Standard Score `_ describing *x* in terms of the number of standard " @@ -1633,7 +1769,7 @@ msgstr "" "probability-and-statistics/z-score/>`_,用以描述在常態分布中,*x* 高出或低於" "平均數幾個標準差:``(x - mean) / stdev``。" -#: ../../library/statistics.rst:916 +#: ../../library/statistics.rst:1003 msgid "" "Instances of :class:`NormalDist` support addition, subtraction, " "multiplication and division by a constant. These operations are used for " @@ -1642,21 +1778,21 @@ msgstr "" ":class:`NormalDist` 的實例支援對常數的加法、減法、乘法與除法。這些操作用於平" "移與縮放。例如:" -#: ../../library/statistics.rst:920 +#: ../../library/statistics.rst:1007 msgid "" ">>> temperature_february = NormalDist(5, 2.5) # Celsius\n" ">>> temperature_february * (9/5) + 32 # Fahrenheit\n" "NormalDist(mu=41.0, sigma=4.5)" msgstr "" -#: ../../library/statistics.rst:926 +#: ../../library/statistics.rst:1013 msgid "" "Dividing a constant by an instance of :class:`NormalDist` is not supported " "because the result wouldn't be normally distributed." msgstr "" "不支援將常數除以 :class:`NormalDist` 的實例,因為結果將不符合常態分布。" -#: ../../library/statistics.rst:929 +#: ../../library/statistics.rst:1016 msgid "" "Since normal distributions arise from additive effects of independent " "variables, it is possible to `add and subtract two independent normally " @@ -1669,7 +1805,7 @@ msgstr "" "Sum_of_normally_distributed_random_variables>`_,並且表示為 :class:" "`NormalDist` 的實例。例如:" -#: ../../library/statistics.rst:935 +#: ../../library/statistics.rst:1022 msgid "" ">>> birth_weights = NormalDist.from_samples([2.5, 3.1, 2.1, 2.4, 2.7, 3.5])\n" ">>> drug_effects = NormalDist(0.4, 0.15)\n" @@ -1687,19 +1823,19 @@ msgstr "" ">>> round(combined.stdev, 1)\n" "0.5" -#: ../../library/statistics.rst:949 +#: ../../library/statistics.rst:1036 msgid "Examples and Recipes" msgstr "範例與錦囊妙計" -#: ../../library/statistics.rst:953 +#: ../../library/statistics.rst:1040 msgid "Classic probability problems" msgstr "經典機率問題" -#: ../../library/statistics.rst:955 +#: ../../library/statistics.rst:1042 msgid ":class:`NormalDist` readily solves classic probability problems." msgstr ":class:`NormalDist` 可以輕易地解決經典的機率問題。" -#: ../../library/statistics.rst:957 +#: ../../library/statistics.rst:1044 msgid "" "For example, given `historical data for SAT exams `_ showing that scores are " @@ -1711,7 +1847,7 @@ msgstr "" "tables/dt17_226.40.asp>`_,顯示成績為平均 1060、標準差 195 的常態分布。我們要" "求出分數在 1100 與 1200 之間(四捨五入至最接近的整數)的學生的百分比:" -#: ../../library/statistics.rst:963 +#: ../../library/statistics.rst:1050 msgid "" ">>> sat = NormalDist(1060, 195)\n" ">>> fraction = sat.cdf(1200 + 0.5) - sat.cdf(1100 - 0.5)\n" @@ -1723,7 +1859,7 @@ msgstr "" ">>> round(fraction * 100.0, 1)\n" "18.4" -#: ../../library/statistics.rst:970 +#: ../../library/statistics.rst:1057 msgid "" "Find the `quartiles `_ and `deciles " "`_ for the SAT scores:" @@ -1731,7 +1867,7 @@ msgstr "" "找出 SAT 分數的\\ `四分位數 `_\\ 以及" "\\ `十分位數 `_:" -#: ../../library/statistics.rst:973 +#: ../../library/statistics.rst:1060 msgid "" ">>> list(map(round, sat.quantiles()))\n" "[928, 1060, 1192]\n" @@ -1743,11 +1879,11 @@ msgstr "" ">>> list(map(round, sat.quantiles(n=10)))\n" "[810, 896, 958, 1011, 1060, 1109, 1162, 1224, 1310]" -#: ../../library/statistics.rst:982 +#: ../../library/statistics.rst:1069 msgid "Monte Carlo inputs for simulations" msgstr "用於模擬的蒙地卡羅 (Monte Carlo) 輸入" -#: ../../library/statistics.rst:984 +#: ../../library/statistics.rst:1071 msgid "" "To estimate the distribution for a model that isn't easy to solve " "analytically, :class:`NormalDist` can generate input samples for a `Monte " @@ -1757,7 +1893,7 @@ msgstr "" "樣本以進行\\ `蒙地卡羅模擬 `_:" -#: ../../library/statistics.rst:988 +#: ../../library/statistics.rst:1075 msgid "" ">>> def model(x, y, z):\n" "... return (3*x + 7*x*y - 5*y) / (11 * z)\n" @@ -1779,11 +1915,11 @@ msgstr "" ">>> quantiles(map(model, X, Y, Z)) \n" "[1.4591308524824727, 1.8035946855390597, 2.175091447274739]" -#: ../../library/statistics.rst:1001 +#: ../../library/statistics.rst:1088 msgid "Approximating binomial distributions" msgstr "近似二項分布" -#: ../../library/statistics.rst:1003 +#: ../../library/statistics.rst:1090 msgid "" "Normal distributions can be used to approximate `Binomial distributions " "`_ when the sample " @@ -1793,7 +1929,7 @@ msgstr "" "(Binomial distributions) `_。" -#: ../../library/statistics.rst:1008 +#: ../../library/statistics.rst:1095 msgid "" "For example, an open source conference has 750 attendees and two rooms with " "a 500 person capacity. There is a talk about Python and another about Ruby. " @@ -1806,7 +1942,7 @@ msgstr "" "向參與 Python 講座。假設參與者的偏好沒有改變,那麼 Python 會議室未超過自身容" "量限制的機率是?" -#: ../../library/statistics.rst:1014 +#: ../../library/statistics.rst:1101 msgid "" ">>> n = 750 # Sample size\n" ">>> p = 0.65 # Preference for Python\n" @@ -1830,15 +1966,15 @@ msgid "" "0.8406" msgstr "" -#: ../../library/statistics.rst:1039 +#: ../../library/statistics.rst:1126 msgid "Naive bayesian classifier" msgstr "單純貝氏分類器 (Naive bayesian classifier)" -#: ../../library/statistics.rst:1041 +#: ../../library/statistics.rst:1128 msgid "Normal distributions commonly arise in machine learning problems." msgstr "常態分布常在機器學習問題中出現。" -#: ../../library/statistics.rst:1043 +#: ../../library/statistics.rst:1130 msgid "" "Wikipedia has a `nice example of a Naive Bayesian Classifier `_. The " @@ -1849,7 +1985,7 @@ msgstr "" "wiki/Naive_Bayes_classifier#Person_classification>`_。課題為從身高、體重與鞋" "子尺寸等符合常態分布的特徵量測值中判斷一個人的性別。" -#: ../../library/statistics.rst:1048 +#: ../../library/statistics.rst:1135 msgid "" "We're given a training dataset with measurements for eight people. The " "measurements are assumed to be normally distributed, so we summarize the " @@ -1858,7 +1994,7 @@ msgstr "" "給定一組包含八個人的量測值的訓練資料集。假設這些量測值服從常態分布,我們可以" "利用 :class:`NormalDist` 來總結資料:" -#: ../../library/statistics.rst:1052 +#: ../../library/statistics.rst:1139 msgid "" ">>> height_male = NormalDist.from_samples([6, 5.92, 5.58, 5.92])\n" ">>> height_female = NormalDist.from_samples([5, 5.5, 5.42, 5.75])\n" @@ -1874,20 +2010,20 @@ msgstr "" ">>> foot_size_male = NormalDist.from_samples([12, 11, 12, 10])\n" ">>> foot_size_female = NormalDist.from_samples([6, 8, 7, 9])" -#: ../../library/statistics.rst:1061 +#: ../../library/statistics.rst:1148 msgid "" "Next, we encounter a new person whose feature measurements are known but " "whose gender is unknown:" msgstr "接著,我們遇到一個新的人,他的特徵量測值已知,但性別未知:" -#: ../../library/statistics.rst:1064 +#: ../../library/statistics.rst:1151 msgid "" ">>> ht = 6.0 # height\n" ">>> wt = 130 # weight\n" ">>> fs = 8 # foot size" msgstr "" -#: ../../library/statistics.rst:1070 +#: ../../library/statistics.rst:1157 msgid "" "Starting with a 50% `prior probability `_ of being male or female, we compute the posterior as " @@ -1898,7 +2034,7 @@ msgstr "" "org/wiki/Prior_probability>`_ 為開端,我們將後驗機率 (posterior probability) " "計算為先驗機率乘以給定性別下,各特徵量測值的概度乘積:" -#: ../../library/statistics.rst:1075 +#: ../../library/statistics.rst:1162 msgid "" ">>> prior_male = 0.5\n" ">>> prior_female = 0.5\n" @@ -1916,7 +2052,7 @@ msgstr "" ">>> posterior_female = (prior_female * height_female.pdf(ht) *\n" "... weight_female.pdf(wt) * foot_size_female.pdf(fs))" -#: ../../library/statistics.rst:1085 +#: ../../library/statistics.rst:1172 msgid "" "The final prediction goes to the largest posterior. This is known as the " "`maximum a posteriori `_ 或者 MAP:" -#: ../../library/statistics.rst:1089 +#: ../../library/statistics.rst:1176 msgid "" ">>> 'male' if posterior_male > posterior_female else 'female'\n" "'female'" @@ -1934,117 +2070,42 @@ msgstr "" ">>> 'male' if posterior_male > posterior_female else 'female'\n" "'female'" -#: ../../library/statistics.rst:1096 -msgid "Kernel density estimation" -msgstr "核密度估計 (Kernel density estimation)" - -#: ../../library/statistics.rst:1098 -msgid "" -"It is possible to estimate a continuous probability distribution from a " -"fixed number of discrete samples." -msgstr "可以從固定數量的離散樣本估計出連續機率分布。" - -#: ../../library/statistics.rst:1101 -msgid "" -"The basic idea is to smooth the data using `a kernel function such as a " -"normal distribution, triangular distribution, or uniform distribution " -"`_. The degree of " -"smoothing is controlled by a scaling parameter, ``h``, which is called the " -"*bandwidth*." -msgstr "" -"基本想法是使用\\ `一個核函式如常態分布、三角分布或均勻分布 `_\\ 來" -"使資料更加平滑。平滑程度由一個縮放參數 ``h`` 控制,被稱為 *bandwidth*。" - -#: ../../library/statistics.rst:1107 -msgid "" -"from random import choice, random\n" -"\n" -"def kde_normal(data, h):\n" -" \"Create a continuous probability distribution from discrete samples.\"\n" -"\n" -" # Smooth the data with a normal distribution kernel scaled by h.\n" -" K_h = NormalDist(0.0, h)\n" -"\n" -" def pdf(x):\n" -" 'Probability density function. P(x <= X < x+dx) / dx'\n" -" return sum(K_h.pdf(x - x_i) for x_i in data) / len(data)\n" -"\n" -" def cdf(x):\n" -" 'Cumulative distribution function. P(X <= x)'\n" -" return sum(K_h.cdf(x - x_i) for x_i in data) / len(data)\n" -"\n" -" def rand():\n" -" 'Random selection from the probability distribution.'\n" -" return choice(data) + K_h.inv_cdf(random())\n" -"\n" -" return pdf, cdf, rand" -msgstr "" - -#: ../../library/statistics.rst:1131 -msgid "" -"`Wikipedia has an example `_ where we can use the ``kde_normal()`` " -"recipe to generate and plot a probability density function estimated from a " -"small sample:" -msgstr "" -"`維基百科有一個範例 `_,我們可以使用 ``kde_normal()`` 這個錦囊" -"妙計來生成並繪製從小樣本估計的機率密度函式:" - -#: ../../library/statistics.rst:1136 -msgid "" -">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" -">>> pdf, cdf, rand = kde_normal(sample, h=1.5)\n" -">>> xarr = [i/100 for i in range(-750, 1100)]\n" -">>> yarr = [pdf(x) for x in xarr]" -msgstr "" -">>> sample = [-2.1, -1.3, -0.4, 1.9, 5.1, 6.2]\n" -">>> pdf, cdf, rand = kde_normal(sample, h=1.5)\n" -">>> xarr = [i/100 for i in range(-750, 1100)]\n" -">>> yarr = [pdf(x) for x in xarr]" - -#: ../../library/statistics.rst:1143 -msgid "The points in ``xarr`` and ``yarr`` can be used to make a PDF plot:" -msgstr "``xarr`` 和 ``yarr`` 中的點可用於繪製 PDF 圖:" - -#: ../../library/statistics.rst:1145 -msgid "Scatter plot of the estimated probability density function." -msgstr "估計機率密度函式的散點圖 (scatter plot)。" - -#: ../../library/statistics.rst:1148 -msgid "" -"`Resample `_ the data " -"to produce 100 new selections:" -msgstr "" - -#: ../../library/statistics.rst:1151 -msgid ">>> new_selections = [rand() for i in range(100)]" -msgstr ">>> new_selections = [rand() for i in range(100)]" - -#: ../../library/statistics.rst:1155 -msgid "Determine the probability of a new selection being below ``2.0``:" -msgstr "" - -#: ../../library/statistics.rst:1157 -msgid "" -">>> round(cdf(2.0), 4)\n" -"0.5794" -msgstr "" -">>> round(cdf(2.0), 4)\n" -"0.5794" - -#: ../../library/statistics.rst:1162 -msgid "Add a new sample data point and find the new CDF at ``2.0``:" -msgstr "" - -#: ../../library/statistics.rst:1164 -msgid "" -">>> sample.append(4.9)\n" -">>> round(cdf(2.0), 4)\n" -"0.5005" -msgstr "" -">>> sample.append(4.9)\n" -">>> round(cdf(2.0), 4)\n" -"0.5005" +#~ msgid "Kernel density estimation" +#~ msgstr "核密度估計 (Kernel density estimation)" + +#~ msgid "" +#~ "It is possible to estimate a continuous probability distribution from a " +#~ "fixed number of discrete samples." +#~ msgstr "可以從固定數量的離散樣本估計出連續機率分布。" + +#~ msgid "" +#~ "The basic idea is to smooth the data using `a kernel function such as a " +#~ "normal distribution, triangular distribution, or uniform distribution " +#~ "`_. The degree of " +#~ "smoothing is controlled by a scaling parameter, ``h``, which is called " +#~ "the *bandwidth*." +#~ msgstr "" +#~ "基本想法是使用\\ `一個核函式如常態分布、三角分布或均勻分布 `_\\ 來使資料更加平滑。" +#~ "平滑程度由一個縮放參數 ``h`` 控制,被稱為 *bandwidth*。" + +#~ msgid ">>> new_selections = [rand() for i in range(100)]" +#~ msgstr ">>> new_selections = [rand() for i in range(100)]" + +#~ msgid "" +#~ ">>> round(cdf(2.0), 4)\n" +#~ "0.5794" +#~ msgstr "" +#~ ">>> round(cdf(2.0), 4)\n" +#~ "0.5794" + +#~ msgid "" +#~ ">>> sample.append(4.9)\n" +#~ ">>> round(cdf(2.0), 4)\n" +#~ "0.5005" +#~ msgstr "" +#~ ">>> sample.append(4.9)\n" +#~ ">>> round(cdf(2.0), 4)\n" +#~ "0.5005" diff --git a/library/stdtypes.po b/library/stdtypes.po index 9689fb6885..6ba75aed17 100644 --- a/library/stdtypes.po +++ b/library/stdtypes.po @@ -7,9 +7,9 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2022-06-12 15:22+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,7 +35,7 @@ msgstr "以下章節描述了直譯器中内建的標準型別。" msgid "" "The principal built-in types are numerics, sequences, mappings, classes, " "instances and exceptions." -msgstr "主要內建型別為數字、序列、映射、class(類別)、實例和例外。" +msgstr "主要內建型別為數字、序列、對映、class(類別)、實例和例外。" #: ../../library/stdtypes.rst:18 msgid "" @@ -135,8 +135,8 @@ msgstr "結果" #: ../../library/stdtypes.rst:86 ../../library/stdtypes.rst:276 #: ../../library/stdtypes.rst:416 ../../library/stdtypes.rst:965 -#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2423 -#: ../../library/stdtypes.rst:3642 +#: ../../library/stdtypes.rst:1170 ../../library/stdtypes.rst:2432 +#: ../../library/stdtypes.rst:3651 msgid "Notes" msgstr "註解" @@ -150,7 +150,7 @@ msgstr "假如 *x* 為真,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:88 ../../library/stdtypes.rst:967 #: ../../library/stdtypes.rst:970 ../../library/stdtypes.rst:1181 -#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:3648 +#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 msgid "\\(1)" msgstr "\\(1)" @@ -164,8 +164,8 @@ msgstr "假如 *x* 為假,則 *x*,否則 *y*" #: ../../library/stdtypes.rst:91 ../../library/stdtypes.rst:289 #: ../../library/stdtypes.rst:309 ../../library/stdtypes.rst:1209 -#: ../../library/stdtypes.rst:2433 ../../library/stdtypes.rst:2435 -#: ../../library/stdtypes.rst:3652 ../../library/stdtypes.rst:3654 +#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:2444 +#: ../../library/stdtypes.rst:3661 ../../library/stdtypes.rst:3663 msgid "\\(2)" msgstr "\\(2)" @@ -178,18 +178,18 @@ msgid "if *x* is false, then ``True``, else ``False``" msgstr "假如 *x* 為假,則 ``True``,否則 ``False``" #: ../../library/stdtypes.rst:94 ../../library/stdtypes.rst:979 -#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2437 -#: ../../library/stdtypes.rst:2439 ../../library/stdtypes.rst:2441 -#: ../../library/stdtypes.rst:2443 ../../library/stdtypes.rst:3656 -#: ../../library/stdtypes.rst:3658 ../../library/stdtypes.rst:3660 -#: ../../library/stdtypes.rst:3662 +#: ../../library/stdtypes.rst:1212 ../../library/stdtypes.rst:2446 +#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:2450 +#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3665 +#: ../../library/stdtypes.rst:3667 ../../library/stdtypes.rst:3669 +#: ../../library/stdtypes.rst:3671 msgid "\\(3)" msgstr "\\(3)" #: ../../library/stdtypes.rst:103 ../../library/stdtypes.rst:320 #: ../../library/stdtypes.rst:434 ../../library/stdtypes.rst:1016 -#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2469 -#: ../../library/stdtypes.rst:3692 +#: ../../library/stdtypes.rst:1221 ../../library/stdtypes.rst:2478 +#: ../../library/stdtypes.rst:3701 msgid "Notes:" msgstr "註解:" @@ -236,9 +236,9 @@ msgstr "" msgid "This table summarizes the comparison operations:" msgstr "這個表格統整所有比較運算:" -#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2400 -#: ../../library/stdtypes.rst:2423 ../../library/stdtypes.rst:3619 -#: ../../library/stdtypes.rst:3642 +#: ../../library/stdtypes.rst:144 ../../library/stdtypes.rst:2409 +#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3628 +#: ../../library/stdtypes.rst:3651 msgid "Meaning" msgstr "含義" @@ -559,7 +559,7 @@ msgid "" msgstr "一個複數,其實部為 *re*,虛部為 *im*。*im* 預設為零。" #: ../../library/stdtypes.rst:302 ../../library/stdtypes.rst:1202 -#: ../../library/stdtypes.rst:2431 ../../library/stdtypes.rst:3679 +#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3688 msgid "\\(6)" msgstr "\\(6)" @@ -597,9 +597,9 @@ msgstr "*x* 的 *y* 次方" #: ../../library/stdtypes.rst:311 ../../library/stdtypes.rst:313 #: ../../library/stdtypes.rst:1191 ../../library/stdtypes.rst:1194 -#: ../../library/stdtypes.rst:2456 ../../library/stdtypes.rst:2459 -#: ../../library/stdtypes.rst:2462 ../../library/stdtypes.rst:3675 -#: ../../library/stdtypes.rst:3682 +#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:2468 +#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:3684 +#: ../../library/stdtypes.rst:3691 msgid "\\(5)" msgstr "\\(5)" @@ -758,8 +758,8 @@ msgstr "*x* 及 *y* 的位元 :dfn:`或`" #: ../../library/stdtypes.rst:418 ../../library/stdtypes.rst:421 #: ../../library/stdtypes.rst:424 ../../library/stdtypes.rst:1216 -#: ../../library/stdtypes.rst:2445 ../../library/stdtypes.rst:2449 -#: ../../library/stdtypes.rst:3664 ../../library/stdtypes.rst:3668 +#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:2458 +#: ../../library/stdtypes.rst:3673 ../../library/stdtypes.rst:3677 msgid "\\(4)" msgstr "\\(4)" @@ -1684,7 +1684,7 @@ msgid "" "before index *j*)" msgstr "" -#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3650 +#: ../../library/stdtypes.rst:992 ../../library/stdtypes.rst:3659 msgid "\\(8)" msgstr "\\(8)" @@ -2592,7 +2592,7 @@ msgstr "" msgid "" "The casefolding algorithm is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." +"Unicode15.1.0/ch03.pdf>`__." msgstr "" #: ../../library/stdtypes.rst:1653 @@ -2619,7 +2619,7 @@ msgstr "" msgid "Return the string encoded to :class:`bytes`." msgstr "" -#: ../../library/stdtypes.rst:1673 ../../library/stdtypes.rst:2815 +#: ../../library/stdtypes.rst:1673 ../../library/stdtypes.rst:2824 msgid "" "*encoding* defaults to ``'utf-8'``; see :ref:`standard-encodings` for " "possible values." @@ -2641,11 +2641,11 @@ msgid "" "ref:`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:1688 ../../library/stdtypes.rst:2834 +#: ../../library/stdtypes.rst:1688 ../../library/stdtypes.rst:2843 msgid "Added support for keyword arguments." msgstr "新增關鍵字引數的支援。" -#: ../../library/stdtypes.rst:1691 ../../library/stdtypes.rst:2837 +#: ../../library/stdtypes.rst:1691 ../../library/stdtypes.rst:2846 msgid "" "The value of the *errors* argument is now checked in :ref:`devmode` and in :" "ref:`debug mode `." @@ -2759,7 +2759,7 @@ msgid "" "e., those with general category property being one of \"Lm\", \"Lt\", " "\"Lu\", \"Ll\", or \"Lo\". Note that this is different from the `Alphabetic " "property defined in the section 4.10 'Letters, Alphabetic, and Ideographic' " -"of the Unicode Standard `_." msgstr "" @@ -2900,7 +2900,7 @@ msgstr "" msgid "" "The lowercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." +"Unicode15.1.0/ch03.pdf>`__." msgstr "" #: ../../library/stdtypes.rst:1951 @@ -3012,31 +3012,37 @@ msgstr "" #: ../../library/stdtypes.rst:2023 msgid "" "Return a copy of the string with all occurrences of substring *old* replaced " -"by *new*. If the optional argument *count* is given, only the first *count* " -"occurrences are replaced." +"by *new*. If *count* is given, only the first *count* occurrences are " +"replaced. If *count* is not specified or ``-1``, then all occurrences are " +"replaced." msgstr "" -#: ../../library/stdtypes.rst:2030 +#: ../../library/stdtypes.rst:2027 +#, fuzzy +msgid "*count* is now supported as a keyword argument." +msgstr "新增關鍵字引數的支援。" + +#: ../../library/stdtypes.rst:2033 msgid "" "Return the highest index in the string where substring *sub* is found, such " "that *sub* is contained within ``s[start:end]``. Optional arguments *start* " "and *end* are interpreted as in slice notation. Return ``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2037 +#: ../../library/stdtypes.rst:2040 msgid "" "Like :meth:`rfind` but raises :exc:`ValueError` when the substring *sub* is " "not found." msgstr "" -#: ../../library/stdtypes.rst:2043 +#: ../../library/stdtypes.rst:2046 msgid "" "Return the string right justified in a string of length *width*. Padding is " "done using the specified *fillchar* (default is an ASCII space). The " "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2050 +#: ../../library/stdtypes.rst:2053 msgid "" "Split the string at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself, and the part " @@ -3044,7 +3050,7 @@ msgid "" "containing two empty strings, followed by the string itself." msgstr "" -#: ../../library/stdtypes.rst:2058 +#: ../../library/stdtypes.rst:2061 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done, the " @@ -3053,7 +3059,7 @@ msgid "" "behaves like :meth:`split` which is described in detail below." msgstr "" -#: ../../library/stdtypes.rst:2067 +#: ../../library/stdtypes.rst:2070 msgid "" "Return a copy of the string with trailing characters removed. The *chars* " "argument is a string specifying the set of characters to be removed. If " @@ -3062,7 +3068,7 @@ msgid "" "are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2072 +#: ../../library/stdtypes.rst:2075 msgid "" ">>> ' spacious '.rstrip()\n" "' spacious'\n" @@ -3074,13 +3080,13 @@ msgstr "" ">>> 'mississippi'.rstrip('ipz')\n" "'mississ'" -#: ../../library/stdtypes.rst:2077 +#: ../../library/stdtypes.rst:2080 msgid "" "See :meth:`str.removesuffix` for a method that will remove a single suffix " "string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:2080 +#: ../../library/stdtypes.rst:2083 msgid "" ">>> 'Monty Python'.rstrip(' Python')\n" "'M'\n" @@ -3092,7 +3098,7 @@ msgstr "" ">>> 'Monty Python'.removesuffix(' Python')\n" "'Monty'" -#: ../../library/stdtypes.rst:2087 +#: ../../library/stdtypes.rst:2090 msgid "" "Return a list of the words in the string, using *sep* as the delimiter " "string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, " @@ -3101,7 +3107,7 @@ msgid "" "possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:2093 +#: ../../library/stdtypes.rst:2096 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty strings (for example, ``'1,,2'.split(',')`` returns " @@ -3111,20 +3117,20 @@ msgid "" "``['']``." msgstr "" -#: ../../library/stdtypes.rst:2100 ../../library/stdtypes.rst:2118 -#: ../../library/stdtypes.rst:2170 ../../library/stdtypes.rst:2238 -#: ../../library/stdtypes.rst:2306 ../../library/stdtypes.rst:3152 -#: ../../library/stdtypes.rst:3170 ../../library/stdtypes.rst:3261 -#: ../../library/stdtypes.rst:3277 ../../library/stdtypes.rst:3302 -#: ../../library/stdtypes.rst:3316 ../../library/stdtypes.rst:3344 -#: ../../library/stdtypes.rst:3358 ../../library/stdtypes.rst:3376 -#: ../../library/stdtypes.rst:3403 ../../library/stdtypes.rst:3426 -#: ../../library/stdtypes.rst:3453 ../../library/stdtypes.rst:3495 -#: ../../library/stdtypes.rst:3519 +#: ../../library/stdtypes.rst:2103 ../../library/stdtypes.rst:2121 +#: ../../library/stdtypes.rst:2173 ../../library/stdtypes.rst:2241 +#: ../../library/stdtypes.rst:2309 ../../library/stdtypes.rst:3161 +#: ../../library/stdtypes.rst:3179 ../../library/stdtypes.rst:3270 +#: ../../library/stdtypes.rst:3286 ../../library/stdtypes.rst:3311 +#: ../../library/stdtypes.rst:3325 ../../library/stdtypes.rst:3353 +#: ../../library/stdtypes.rst:3367 ../../library/stdtypes.rst:3385 +#: ../../library/stdtypes.rst:3412 ../../library/stdtypes.rst:3435 +#: ../../library/stdtypes.rst:3462 ../../library/stdtypes.rst:3504 +#: ../../library/stdtypes.rst:3528 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/stdtypes.rst:2102 +#: ../../library/stdtypes.rst:2105 msgid "" ">>> '1,2,3'.split(',')\n" "['1', '2', '3']\n" @@ -3144,7 +3150,7 @@ msgstr "" ">>> '1<>2<>3<4'.split('<>')\n" "['1', '2', '3<4']" -#: ../../library/stdtypes.rst:2111 +#: ../../library/stdtypes.rst:2114 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive whitespace are regarded as a single separator, " @@ -3154,7 +3160,7 @@ msgid "" "returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:2120 +#: ../../library/stdtypes.rst:2123 msgid "" ">>> '1 2 3'.split()\n" "['1', '2', '3']\n" @@ -3170,120 +3176,120 @@ msgstr "" ">>> ' 1 2 3 '.split()\n" "['1', '2', '3']" -#: ../../library/stdtypes.rst:2133 +#: ../../library/stdtypes.rst:2136 msgid "" "Return a list of the lines in the string, breaking at line boundaries. Line " "breaks are not included in the resulting list unless *keepends* is given and " "true." msgstr "" -#: ../../library/stdtypes.rst:2137 +#: ../../library/stdtypes.rst:2140 msgid "" "This method splits on the following line boundaries. In particular, the " "boundaries are a superset of :term:`universal newlines`." msgstr "" -#: ../../library/stdtypes.rst:2141 +#: ../../library/stdtypes.rst:2144 msgid "Representation" msgstr "" -#: ../../library/stdtypes.rst:2141 +#: ../../library/stdtypes.rst:2144 msgid "Description" msgstr "描述" -#: ../../library/stdtypes.rst:2143 +#: ../../library/stdtypes.rst:2146 msgid "``\\n``" msgstr "``\\n``" -#: ../../library/stdtypes.rst:2143 +#: ../../library/stdtypes.rst:2146 msgid "Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2145 +#: ../../library/stdtypes.rst:2148 msgid "``\\r``" msgstr "``\\r``" -#: ../../library/stdtypes.rst:2145 +#: ../../library/stdtypes.rst:2148 msgid "Carriage Return" msgstr "" -#: ../../library/stdtypes.rst:2147 +#: ../../library/stdtypes.rst:2150 msgid "``\\r\\n``" msgstr "``\\r\\n``" -#: ../../library/stdtypes.rst:2147 +#: ../../library/stdtypes.rst:2150 msgid "Carriage Return + Line Feed" msgstr "" -#: ../../library/stdtypes.rst:2149 +#: ../../library/stdtypes.rst:2152 msgid "``\\v`` or ``\\x0b``" msgstr "``\\v`` 或 ``\\x0b``" -#: ../../library/stdtypes.rst:2149 +#: ../../library/stdtypes.rst:2152 msgid "Line Tabulation" msgstr "" -#: ../../library/stdtypes.rst:2151 +#: ../../library/stdtypes.rst:2154 msgid "``\\f`` or ``\\x0c``" msgstr "``\\f`` 或 ``\\x0c``" -#: ../../library/stdtypes.rst:2151 +#: ../../library/stdtypes.rst:2154 msgid "Form Feed" msgstr "" -#: ../../library/stdtypes.rst:2153 +#: ../../library/stdtypes.rst:2156 msgid "``\\x1c``" msgstr "``\\x1c``" -#: ../../library/stdtypes.rst:2153 +#: ../../library/stdtypes.rst:2156 msgid "File Separator" msgstr "" -#: ../../library/stdtypes.rst:2155 +#: ../../library/stdtypes.rst:2158 msgid "``\\x1d``" msgstr "``\\x1d``" -#: ../../library/stdtypes.rst:2155 +#: ../../library/stdtypes.rst:2158 msgid "Group Separator" msgstr "" -#: ../../library/stdtypes.rst:2157 +#: ../../library/stdtypes.rst:2160 msgid "``\\x1e``" msgstr "``\\x1e``" -#: ../../library/stdtypes.rst:2157 +#: ../../library/stdtypes.rst:2160 msgid "Record Separator" msgstr "" -#: ../../library/stdtypes.rst:2159 +#: ../../library/stdtypes.rst:2162 msgid "``\\x85``" msgstr "``\\x85``" -#: ../../library/stdtypes.rst:2159 +#: ../../library/stdtypes.rst:2162 msgid "Next Line (C1 Control Code)" msgstr "" -#: ../../library/stdtypes.rst:2161 +#: ../../library/stdtypes.rst:2164 msgid "``\\u2028``" msgstr "``\\u2028``" -#: ../../library/stdtypes.rst:2161 +#: ../../library/stdtypes.rst:2164 msgid "Line Separator" msgstr "" -#: ../../library/stdtypes.rst:2163 +#: ../../library/stdtypes.rst:2166 msgid "``\\u2029``" msgstr "``\\u2029``" -#: ../../library/stdtypes.rst:2163 +#: ../../library/stdtypes.rst:2166 msgid "Paragraph Separator" msgstr "" -#: ../../library/stdtypes.rst:2168 +#: ../../library/stdtypes.rst:2171 msgid "``\\v`` and ``\\f`` added to list of line boundaries." msgstr "" -#: ../../library/stdtypes.rst:2172 +#: ../../library/stdtypes.rst:2175 msgid "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "['ab c', '', 'de fg', 'kl']\n" @@ -3295,14 +3301,14 @@ msgstr "" ">>> 'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "['ab c\\n', '\\n', 'de fg\\r', 'kl\\r\\n']" -#: ../../library/stdtypes.rst:2177 +#: ../../library/stdtypes.rst:2180 msgid "" "Unlike :meth:`~str.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:2181 +#: ../../library/stdtypes.rst:2184 msgid "" ">>> \"\".splitlines()\n" "[]\n" @@ -3314,11 +3320,11 @@ msgstr "" ">>> \"One line\\n\".splitlines()\n" "['One line']" -#: ../../library/stdtypes.rst:2186 +#: ../../library/stdtypes.rst:2189 msgid "For comparison, ``split('\\n')`` gives::" msgstr "" -#: ../../library/stdtypes.rst:2188 +#: ../../library/stdtypes.rst:2191 msgid "" ">>> ''.split('\\n')\n" "['']\n" @@ -3330,7 +3336,7 @@ msgstr "" ">>> 'Two lines\\n'.split('\\n')\n" "['Two lines', '']" -#: ../../library/stdtypes.rst:2196 +#: ../../library/stdtypes.rst:2199 msgid "" "Return ``True`` if string starts with the *prefix*, otherwise return " "``False``. *prefix* can also be a tuple of prefixes to look for. With " @@ -3338,7 +3344,7 @@ msgid "" "*end*, stop comparing string at that position." msgstr "" -#: ../../library/stdtypes.rst:2204 +#: ../../library/stdtypes.rst:2207 msgid "" "Return a copy of the string with the leading and trailing characters " "removed. The *chars* argument is a string specifying the set of characters " @@ -3347,7 +3353,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:2210 +#: ../../library/stdtypes.rst:2213 msgid "" ">>> ' spacious '.strip()\n" "'spacious'\n" @@ -3359,7 +3365,7 @@ msgstr "" ">>> 'www.example.com'.strip('cmowz.')\n" "'example'" -#: ../../library/stdtypes.rst:2215 +#: ../../library/stdtypes.rst:2218 msgid "" "The outermost leading and trailing *chars* argument values are stripped from " "the string. Characters are removed from the leading end until reaching a " @@ -3367,7 +3373,7 @@ msgid "" "A similar action takes place on the trailing end. For example::" msgstr "" -#: ../../library/stdtypes.rst:2221 +#: ../../library/stdtypes.rst:2224 msgid "" ">>> comment_string = '#....... Section 3.2.1 Issue #32 .......'\n" ">>> comment_string.strip('.#! ')\n" @@ -3377,20 +3383,20 @@ msgstr "" ">>> comment_string.strip('.#! ')\n" "'Section 3.2.1 Issue #32'" -#: ../../library/stdtypes.rst:2228 +#: ../../library/stdtypes.rst:2231 msgid "" "Return a copy of the string with uppercase characters converted to lowercase " "and vice versa. Note that it is not necessarily true that ``s.swapcase()." "swapcase() == s``." msgstr "" -#: ../../library/stdtypes.rst:2235 +#: ../../library/stdtypes.rst:2238 msgid "" "Return a titlecased version of the string where words start with an " "uppercase character and the remaining characters are lowercase." msgstr "" -#: ../../library/stdtypes.rst:2240 +#: ../../library/stdtypes.rst:2243 msgid "" ">>> 'Hello world'.title()\n" "'Hello World'" @@ -3398,7 +3404,7 @@ msgstr "" ">>> 'Hello world'.title()\n" "'Hello World'" -#: ../../library/stdtypes.rst:2243 ../../library/stdtypes.rst:3463 +#: ../../library/stdtypes.rst:2246 ../../library/stdtypes.rst:3472 msgid "" "The algorithm uses a simple language-independent definition of a word as " "groups of consecutive letters. The definition works in many contexts but it " @@ -3406,7 +3412,7 @@ msgid "" "which may not be the desired result::" msgstr "" -#: ../../library/stdtypes.rst:2248 +#: ../../library/stdtypes.rst:2251 msgid "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" @@ -3414,19 +3420,19 @@ msgstr "" ">>> \"they're bill's friends from the UK\".title()\n" "\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:2251 +#: ../../library/stdtypes.rst:2254 msgid "" "The :func:`string.capwords` function does not have this problem, as it " "splits words on spaces only." msgstr "" -#: ../../library/stdtypes.rst:2254 +#: ../../library/stdtypes.rst:2257 msgid "" "Alternatively, a workaround for apostrophes can be constructed using regular " "expressions::" msgstr "" -#: ../../library/stdtypes.rst:2257 +#: ../../library/stdtypes.rst:2260 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -3446,7 +3452,7 @@ msgstr "" ">>> titlecase(\"they're bill's friends.\")\n" "\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:2269 +#: ../../library/stdtypes.rst:2272 msgid "" "Return a copy of the string in which each character has been mapped through " "the given translation table. The table must be an object that implements " @@ -3458,19 +3464,19 @@ msgid "" "exception, to map the character to itself." msgstr "" -#: ../../library/stdtypes.rst:2278 +#: ../../library/stdtypes.rst:2281 msgid "" "You can use :meth:`str.maketrans` to create a translation map from character-" "to-character mappings in different formats." msgstr "" -#: ../../library/stdtypes.rst:2281 +#: ../../library/stdtypes.rst:2284 msgid "" "See also the :mod:`codecs` module for a more flexible approach to custom " "character mappings." msgstr "" -#: ../../library/stdtypes.rst:2287 +#: ../../library/stdtypes.rst:2290 msgid "" "Return a copy of the string with all the cased characters [4]_ converted to " "uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s`` " @@ -3479,14 +3485,14 @@ msgid "" "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:2293 +#: ../../library/stdtypes.rst:2296 msgid "" "The uppercasing algorithm used is `described in section 3.13 'Default Case " "Folding' of the Unicode Standard `__." +"Unicode15.1.0/ch03.pdf>`__." msgstr "" -#: ../../library/stdtypes.rst:2300 +#: ../../library/stdtypes.rst:2303 msgid "" "Return a copy of the string left filled with ASCII ``'0'`` digits to make a " "string of length *width*. A leading sign prefix (``'+'``/``'-'``) is handled " @@ -3494,7 +3500,7 @@ msgid "" "original string is returned if *width* is less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:2308 +#: ../../library/stdtypes.rst:2311 msgid "" ">>> \"42\".zfill(5)\n" "'00042'\n" @@ -3506,11 +3512,11 @@ msgstr "" ">>> \"-42\".zfill(5)\n" "'-0042'" -#: ../../library/stdtypes.rst:2318 +#: ../../library/stdtypes.rst:2321 msgid "``printf``-style String Formatting" msgstr "" -#: ../../library/stdtypes.rst:2331 +#: ../../library/stdtypes.rst:2334 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -3521,17 +3527,23 @@ msgid "" "or extensibility." msgstr "" -#: ../../library/stdtypes.rst:2339 +#: ../../library/stdtypes.rst:2342 msgid "" "String objects have one unique built-in operation: the ``%`` operator " "(modulo). This is also known as the string *formatting* or *interpolation* " "operator. Given ``format % values`` (where *format* is a string), ``%`` " "conversion specifications in *format* are replaced with zero or more " "elements of *values*. The effect is similar to using the :c:func:`sprintf` " -"in the C language." +"function in the C language. For example:" +msgstr "" + +#: ../../library/stdtypes.rst:2349 +msgid "" +">>> print('%s has %d quote types.' % ('Python', 2))\n" +"Python has 2 quote types." msgstr "" -#: ../../library/stdtypes.rst:2345 +#: ../../library/stdtypes.rst:2354 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -3539,36 +3551,36 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:2355 ../../library/stdtypes.rst:3574 +#: ../../library/stdtypes.rst:2364 ../../library/stdtypes.rst:3583 msgid "" "A conversion specifier contains two or more characters and has the following " "components, which must occur in this order:" msgstr "" -#: ../../library/stdtypes.rst:2358 ../../library/stdtypes.rst:3577 +#: ../../library/stdtypes.rst:2367 ../../library/stdtypes.rst:3586 msgid "The ``'%'`` character, which marks the start of the specifier." msgstr "" -#: ../../library/stdtypes.rst:2360 ../../library/stdtypes.rst:3579 +#: ../../library/stdtypes.rst:2369 ../../library/stdtypes.rst:3588 msgid "" "Mapping key (optional), consisting of a parenthesised sequence of characters " "(for example, ``(somename)``)." msgstr "" -#: ../../library/stdtypes.rst:2363 ../../library/stdtypes.rst:3582 +#: ../../library/stdtypes.rst:2372 ../../library/stdtypes.rst:3591 msgid "" "Conversion flags (optional), which affect the result of some conversion " "types." msgstr "" -#: ../../library/stdtypes.rst:2366 ../../library/stdtypes.rst:3585 +#: ../../library/stdtypes.rst:2375 ../../library/stdtypes.rst:3594 msgid "" "Minimum field width (optional). If specified as an ``'*'`` (asterisk), the " "actual width is read from the next element of the tuple in *values*, and the " "object to convert comes after the minimum field width and optional precision." msgstr "" -#: ../../library/stdtypes.rst:2370 ../../library/stdtypes.rst:3589 +#: ../../library/stdtypes.rst:2379 ../../library/stdtypes.rst:3598 msgid "" "Precision (optional), given as a ``'.'`` (dot) followed by the precision. " "If specified as ``'*'`` (an asterisk), the actual precision is read from the " @@ -3576,15 +3588,15 @@ msgid "" "the precision." msgstr "" -#: ../../library/stdtypes.rst:2375 ../../library/stdtypes.rst:3594 +#: ../../library/stdtypes.rst:2384 ../../library/stdtypes.rst:3603 msgid "Length modifier (optional)." msgstr "" -#: ../../library/stdtypes.rst:2377 ../../library/stdtypes.rst:3596 +#: ../../library/stdtypes.rst:2386 ../../library/stdtypes.rst:3605 msgid "Conversion type." msgstr "" -#: ../../library/stdtypes.rst:2379 +#: ../../library/stdtypes.rst:2388 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the string *must* include a parenthesised mapping key into that " @@ -3592,279 +3604,279 @@ msgid "" "selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:2388 ../../library/stdtypes.rst:3607 +#: ../../library/stdtypes.rst:2397 ../../library/stdtypes.rst:3616 msgid "" "In this case no ``*`` specifiers may occur in a format (since they require a " "sequential parameter list)." msgstr "" -#: ../../library/stdtypes.rst:2391 ../../library/stdtypes.rst:3610 +#: ../../library/stdtypes.rst:2400 ../../library/stdtypes.rst:3619 msgid "The conversion flag characters are:" msgstr "" -#: ../../library/stdtypes.rst:2400 ../../library/stdtypes.rst:3619 +#: ../../library/stdtypes.rst:2409 ../../library/stdtypes.rst:3628 msgid "Flag" msgstr "" -#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2411 ../../library/stdtypes.rst:3630 msgid "``'#'``" msgstr "``'#'``" -#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:3621 +#: ../../library/stdtypes.rst:2411 ../../library/stdtypes.rst:3630 msgid "" "The value conversion will use the \"alternate form\" (where defined below)." msgstr "" -#: ../../library/stdtypes.rst:2405 ../../library/stdtypes.rst:3624 +#: ../../library/stdtypes.rst:2414 ../../library/stdtypes.rst:3633 msgid "``'0'``" msgstr "``'0'``" -#: ../../library/stdtypes.rst:2405 ../../library/stdtypes.rst:3624 +#: ../../library/stdtypes.rst:2414 ../../library/stdtypes.rst:3633 msgid "The conversion will be zero padded for numeric values." msgstr "" -#: ../../library/stdtypes.rst:2407 ../../library/stdtypes.rst:3626 +#: ../../library/stdtypes.rst:2416 ../../library/stdtypes.rst:3635 msgid "``'-'``" msgstr "``'-'``" -#: ../../library/stdtypes.rst:2407 ../../library/stdtypes.rst:3626 +#: ../../library/stdtypes.rst:2416 ../../library/stdtypes.rst:3635 msgid "" "The converted value is left adjusted (overrides the ``'0'`` conversion if " "both are given)." msgstr "" -#: ../../library/stdtypes.rst:2410 ../../library/stdtypes.rst:3629 +#: ../../library/stdtypes.rst:2419 ../../library/stdtypes.rst:3638 msgid "``' '``" msgstr "``' '``" -#: ../../library/stdtypes.rst:2410 ../../library/stdtypes.rst:3629 +#: ../../library/stdtypes.rst:2419 ../../library/stdtypes.rst:3638 msgid "" "(a space) A blank should be left before a positive number (or empty string) " "produced by a signed conversion." msgstr "" -#: ../../library/stdtypes.rst:2413 ../../library/stdtypes.rst:3632 +#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3641 msgid "``'+'``" msgstr "``'+'``" -#: ../../library/stdtypes.rst:2413 ../../library/stdtypes.rst:3632 +#: ../../library/stdtypes.rst:2422 ../../library/stdtypes.rst:3641 msgid "" "A sign character (``'+'`` or ``'-'``) will precede the conversion (overrides " "a \"space\" flag)." msgstr "" -#: ../../library/stdtypes.rst:2417 ../../library/stdtypes.rst:3636 +#: ../../library/stdtypes.rst:2426 ../../library/stdtypes.rst:3645 msgid "" "A length modifier (``h``, ``l``, or ``L``) may be present, but is ignored as " "it is not necessary for Python -- so e.g. ``%ld`` is identical to ``%d``." msgstr "" -#: ../../library/stdtypes.rst:2420 ../../library/stdtypes.rst:3639 +#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:3648 msgid "The conversion types are:" msgstr "" -#: ../../library/stdtypes.rst:2423 ../../library/stdtypes.rst:3642 +#: ../../library/stdtypes.rst:2432 ../../library/stdtypes.rst:3651 msgid "Conversion" msgstr "" -#: ../../library/stdtypes.rst:2425 ../../library/stdtypes.rst:3644 +#: ../../library/stdtypes.rst:2434 ../../library/stdtypes.rst:3653 msgid "``'d'``" msgstr "``'d'``" -#: ../../library/stdtypes.rst:2425 ../../library/stdtypes.rst:2427 -#: ../../library/stdtypes.rst:3644 ../../library/stdtypes.rst:3646 +#: ../../library/stdtypes.rst:2434 ../../library/stdtypes.rst:2436 +#: ../../library/stdtypes.rst:3653 ../../library/stdtypes.rst:3655 msgid "Signed integer decimal." msgstr "" -#: ../../library/stdtypes.rst:2427 ../../library/stdtypes.rst:3646 +#: ../../library/stdtypes.rst:2436 ../../library/stdtypes.rst:3655 msgid "``'i'``" msgstr "``'i'``" -#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:3648 +#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 msgid "``'o'``" msgstr "``'o'``" -#: ../../library/stdtypes.rst:2429 ../../library/stdtypes.rst:3648 +#: ../../library/stdtypes.rst:2438 ../../library/stdtypes.rst:3657 msgid "Signed octal value." msgstr "" -#: ../../library/stdtypes.rst:2431 ../../library/stdtypes.rst:3650 +#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3659 msgid "``'u'``" msgstr "``'u'``" -#: ../../library/stdtypes.rst:2431 ../../library/stdtypes.rst:3650 +#: ../../library/stdtypes.rst:2440 ../../library/stdtypes.rst:3659 msgid "Obsolete type -- it is identical to ``'d'``." msgstr "" -#: ../../library/stdtypes.rst:2433 ../../library/stdtypes.rst:3652 +#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:3661 msgid "``'x'``" msgstr "``'x'``" -#: ../../library/stdtypes.rst:2433 ../../library/stdtypes.rst:3652 +#: ../../library/stdtypes.rst:2442 ../../library/stdtypes.rst:3661 msgid "Signed hexadecimal (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2435 ../../library/stdtypes.rst:3654 +#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 msgid "``'X'``" msgstr "``'X'``" -#: ../../library/stdtypes.rst:2435 ../../library/stdtypes.rst:3654 +#: ../../library/stdtypes.rst:2444 ../../library/stdtypes.rst:3663 msgid "Signed hexadecimal (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2437 ../../library/stdtypes.rst:3656 +#: ../../library/stdtypes.rst:2446 ../../library/stdtypes.rst:3665 msgid "``'e'``" msgstr "``'e'``" -#: ../../library/stdtypes.rst:2437 ../../library/stdtypes.rst:3656 +#: ../../library/stdtypes.rst:2446 ../../library/stdtypes.rst:3665 msgid "Floating-point exponential format (lowercase)." msgstr "" -#: ../../library/stdtypes.rst:2439 ../../library/stdtypes.rst:3658 +#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:3667 msgid "``'E'``" msgstr "``'E'``" -#: ../../library/stdtypes.rst:2439 ../../library/stdtypes.rst:3658 +#: ../../library/stdtypes.rst:2448 ../../library/stdtypes.rst:3667 msgid "Floating-point exponential format (uppercase)." msgstr "" -#: ../../library/stdtypes.rst:2441 ../../library/stdtypes.rst:3660 +#: ../../library/stdtypes.rst:2450 ../../library/stdtypes.rst:3669 msgid "``'f'``" msgstr "``'f'``" -#: ../../library/stdtypes.rst:2441 ../../library/stdtypes.rst:2443 -#: ../../library/stdtypes.rst:3660 ../../library/stdtypes.rst:3662 +#: ../../library/stdtypes.rst:2450 ../../library/stdtypes.rst:2452 +#: ../../library/stdtypes.rst:3669 ../../library/stdtypes.rst:3671 msgid "Floating-point decimal format." msgstr "" -#: ../../library/stdtypes.rst:2443 ../../library/stdtypes.rst:3662 +#: ../../library/stdtypes.rst:2452 ../../library/stdtypes.rst:3671 msgid "``'F'``" msgstr "``'F'``" -#: ../../library/stdtypes.rst:2445 ../../library/stdtypes.rst:3664 +#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:3673 msgid "``'g'``" msgstr "``'g'``" -#: ../../library/stdtypes.rst:2445 ../../library/stdtypes.rst:3664 +#: ../../library/stdtypes.rst:2454 ../../library/stdtypes.rst:3673 msgid "" "Floating-point format. Uses lowercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2449 ../../library/stdtypes.rst:3668 +#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3677 msgid "``'G'``" msgstr "``'G'``" -#: ../../library/stdtypes.rst:2449 ../../library/stdtypes.rst:3668 +#: ../../library/stdtypes.rst:2458 ../../library/stdtypes.rst:3677 msgid "" "Floating-point format. Uses uppercase exponential format if exponent is less " "than -4 or not less than precision, decimal format otherwise." msgstr "" -#: ../../library/stdtypes.rst:2453 ../../library/stdtypes.rst:3672 +#: ../../library/stdtypes.rst:2462 ../../library/stdtypes.rst:3681 msgid "``'c'``" msgstr "``'c'``" -#: ../../library/stdtypes.rst:2453 +#: ../../library/stdtypes.rst:2462 msgid "Single character (accepts integer or single character string)." msgstr "" -#: ../../library/stdtypes.rst:2456 ../../library/stdtypes.rst:3685 +#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:3694 msgid "``'r'``" msgstr "``'r'``" -#: ../../library/stdtypes.rst:2456 +#: ../../library/stdtypes.rst:2465 msgid "String (converts any Python object using :func:`repr`)." msgstr "" -#: ../../library/stdtypes.rst:2459 ../../library/stdtypes.rst:3679 +#: ../../library/stdtypes.rst:2468 ../../library/stdtypes.rst:3688 msgid "``'s'``" msgstr "``'s'``" -#: ../../library/stdtypes.rst:2459 +#: ../../library/stdtypes.rst:2468 msgid "String (converts any Python object using :func:`str`)." msgstr "" -#: ../../library/stdtypes.rst:2462 ../../library/stdtypes.rst:3682 +#: ../../library/stdtypes.rst:2471 ../../library/stdtypes.rst:3691 msgid "``'a'``" msgstr "``'a'``" -#: ../../library/stdtypes.rst:2462 +#: ../../library/stdtypes.rst:2471 msgid "String (converts any Python object using :func:`ascii`)." msgstr "" -#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:2474 ../../library/stdtypes.rst:3697 msgid "``'%'``" msgstr "``'%'``" -#: ../../library/stdtypes.rst:2465 ../../library/stdtypes.rst:3688 +#: ../../library/stdtypes.rst:2474 ../../library/stdtypes.rst:3697 msgid "No argument is converted, results in a ``'%'`` character in the result." msgstr "" -#: ../../library/stdtypes.rst:2472 ../../library/stdtypes.rst:3695 +#: ../../library/stdtypes.rst:2481 ../../library/stdtypes.rst:3704 msgid "" "The alternate form causes a leading octal specifier (``'0o'``) to be " "inserted before the first digit." msgstr "" -#: ../../library/stdtypes.rst:2476 ../../library/stdtypes.rst:3699 +#: ../../library/stdtypes.rst:2485 ../../library/stdtypes.rst:3708 msgid "" "The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on " "whether the ``'x'`` or ``'X'`` format was used) to be inserted before the " "first digit." msgstr "" -#: ../../library/stdtypes.rst:2480 ../../library/stdtypes.rst:3703 +#: ../../library/stdtypes.rst:2489 ../../library/stdtypes.rst:3712 msgid "" "The alternate form causes the result to always contain a decimal point, even " "if no digits follow it." msgstr "" -#: ../../library/stdtypes.rst:2483 ../../library/stdtypes.rst:3706 +#: ../../library/stdtypes.rst:2492 ../../library/stdtypes.rst:3715 msgid "" "The precision determines the number of digits after the decimal point and " "defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2487 ../../library/stdtypes.rst:3710 +#: ../../library/stdtypes.rst:2496 ../../library/stdtypes.rst:3719 msgid "" "The alternate form causes the result to always contain a decimal point, and " "trailing zeroes are not removed as they would otherwise be." msgstr "" -#: ../../library/stdtypes.rst:2490 ../../library/stdtypes.rst:3713 +#: ../../library/stdtypes.rst:2499 ../../library/stdtypes.rst:3722 msgid "" "The precision determines the number of significant digits before and after " "the decimal point and defaults to 6." msgstr "" -#: ../../library/stdtypes.rst:2494 ../../library/stdtypes.rst:3717 +#: ../../library/stdtypes.rst:2503 ../../library/stdtypes.rst:3726 msgid "If precision is ``N``, the output is truncated to ``N`` characters." msgstr "" -#: ../../library/stdtypes.rst:2497 ../../library/stdtypes.rst:3726 +#: ../../library/stdtypes.rst:2506 ../../library/stdtypes.rst:3735 msgid "See :pep:`237`." msgstr "參閱 :pep:`237`。" -#: ../../library/stdtypes.rst:2499 +#: ../../library/stdtypes.rst:2508 msgid "" "Since Python strings have an explicit length, ``%s`` conversions do not " "assume that ``'\\0'`` is the end of the string." msgstr "" -#: ../../library/stdtypes.rst:2504 +#: ../../library/stdtypes.rst:2513 msgid "" "``%f`` conversions for numbers whose absolute value is over 1e50 are no " "longer replaced by ``%g`` conversions." msgstr "" -#: ../../library/stdtypes.rst:2515 +#: ../../library/stdtypes.rst:2524 msgid "" "Binary Sequence Types --- :class:`bytes`, :class:`bytearray`, :class:" "`memoryview`" msgstr "" -#: ../../library/stdtypes.rst:2523 +#: ../../library/stdtypes.rst:2532 msgid "" "The core built-in types for manipulating binary data are :class:`bytes` and :" "class:`bytearray`. They are supported by :class:`memoryview` which uses the :" @@ -3872,17 +3884,17 @@ msgid "" "objects without needing to make a copy." msgstr "" -#: ../../library/stdtypes.rst:2528 +#: ../../library/stdtypes.rst:2537 msgid "" "The :mod:`array` module supports efficient storage of basic data types like " "32-bit integers and IEEE754 double-precision floating values." msgstr "" -#: ../../library/stdtypes.rst:2534 +#: ../../library/stdtypes.rst:2543 msgid "Bytes Objects" msgstr "" -#: ../../library/stdtypes.rst:2538 +#: ../../library/stdtypes.rst:2547 msgid "" "Bytes objects are immutable sequences of single bytes. Since many major " "binary protocols are based on the ASCII text encoding, bytes objects offer " @@ -3890,40 +3902,40 @@ msgid "" "and are closely related to string objects in a variety of other ways." msgstr "" -#: ../../library/stdtypes.rst:2545 +#: ../../library/stdtypes.rst:2554 msgid "" "Firstly, the syntax for bytes literals is largely the same as that for " "string literals, except that a ``b`` prefix is added:" msgstr "" -#: ../../library/stdtypes.rst:2548 +#: ../../library/stdtypes.rst:2557 msgid "Single quotes: ``b'still allows embedded \"double\" quotes'``" msgstr "" -#: ../../library/stdtypes.rst:2549 +#: ../../library/stdtypes.rst:2558 msgid "Double quotes: ``b\"still allows embedded 'single' quotes\"``" msgstr "" -#: ../../library/stdtypes.rst:2550 +#: ../../library/stdtypes.rst:2559 msgid "" "Triple quoted: ``b'''3 single quotes'''``, ``b\"\"\"3 double quotes\"\"\"``" msgstr "" -#: ../../library/stdtypes.rst:2552 +#: ../../library/stdtypes.rst:2561 msgid "" "Only ASCII characters are permitted in bytes literals (regardless of the " "declared source code encoding). Any binary values over 127 must be entered " "into bytes literals using the appropriate escape sequence." msgstr "" -#: ../../library/stdtypes.rst:2556 +#: ../../library/stdtypes.rst:2565 msgid "" "As with string literals, bytes literals may also use a ``r`` prefix to " "disable processing of escape sequences. See :ref:`strings` for more about " "the various forms of bytes literal, including supported escape sequences." msgstr "" -#: ../../library/stdtypes.rst:2560 +#: ../../library/stdtypes.rst:2569 msgid "" "While bytes literals and representations are based on ASCII text, bytes " "objects actually behave like immutable sequences of integers, with each " @@ -3936,29 +3948,29 @@ msgid "" "compatible will usually lead to data corruption)." msgstr "" -#: ../../library/stdtypes.rst:2570 +#: ../../library/stdtypes.rst:2579 msgid "" "In addition to the literal forms, bytes objects can be created in a number " "of other ways:" msgstr "" -#: ../../library/stdtypes.rst:2573 +#: ../../library/stdtypes.rst:2582 msgid "A zero-filled bytes object of a specified length: ``bytes(10)``" msgstr "" -#: ../../library/stdtypes.rst:2574 +#: ../../library/stdtypes.rst:2583 msgid "From an iterable of integers: ``bytes(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2575 +#: ../../library/stdtypes.rst:2584 msgid "Copying existing binary data via the buffer protocol: ``bytes(obj)``" msgstr "" -#: ../../library/stdtypes.rst:2577 +#: ../../library/stdtypes.rst:2586 msgid "Also see the :ref:`bytes ` built-in." msgstr "" -#: ../../library/stdtypes.rst:2579 +#: ../../library/stdtypes.rst:2588 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -3966,32 +3978,32 @@ msgid "" "that format:" msgstr "" -#: ../../library/stdtypes.rst:2585 +#: ../../library/stdtypes.rst:2594 msgid "" "This :class:`bytes` class method returns a bytes object, decoding the given " "string object. The string must contain two hexadecimal digits per byte, " "with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2592 +#: ../../library/stdtypes.rst:2601 msgid "" ":meth:`bytes.fromhex` now skips all ASCII whitespace in the string, not just " "spaces." msgstr "" -#: ../../library/stdtypes.rst:2596 +#: ../../library/stdtypes.rst:2605 msgid "" "A reverse conversion function exists to transform a bytes object into its " "hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2601 ../../library/stdtypes.rst:2686 +#: ../../library/stdtypes.rst:2610 ../../library/stdtypes.rst:2695 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the instance." msgstr "" -#: ../../library/stdtypes.rst:2607 +#: ../../library/stdtypes.rst:2616 msgid "" "If you want to make the hex string easier to read, you can specify a single " "character separator *sep* parameter to include in the output. By default, " @@ -4000,13 +4012,13 @@ msgid "" "the separator position from the right, negative values from the left." msgstr "" -#: ../../library/stdtypes.rst:2624 +#: ../../library/stdtypes.rst:2633 msgid "" ":meth:`bytes.hex` now supports optional *sep* and *bytes_per_sep* parameters " "to insert separators between bytes in the hex output." msgstr "" -#: ../../library/stdtypes.rst:2628 +#: ../../library/stdtypes.rst:2637 msgid "" "Since bytes objects are sequences of integers (akin to a tuple), for a bytes " "object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes " @@ -4014,58 +4026,58 @@ msgid "" "and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2633 +#: ../../library/stdtypes.rst:2642 msgid "" "The representation of bytes objects uses the literal format (``b'...'``) " "since it is often more useful than e.g. ``bytes([46, 46, 46])``. You can " "always convert a bytes object into a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2641 +#: ../../library/stdtypes.rst:2650 msgid "Bytearray Objects" msgstr "" -#: ../../library/stdtypes.rst:2645 +#: ../../library/stdtypes.rst:2654 msgid "" ":class:`bytearray` objects are a mutable counterpart to :class:`bytes` " "objects." msgstr "" -#: ../../library/stdtypes.rst:2650 +#: ../../library/stdtypes.rst:2659 msgid "" "There is no dedicated literal syntax for bytearray objects, instead they are " "always created by calling the constructor:" msgstr "" -#: ../../library/stdtypes.rst:2653 +#: ../../library/stdtypes.rst:2662 msgid "Creating an empty instance: ``bytearray()``" msgstr "" -#: ../../library/stdtypes.rst:2654 +#: ../../library/stdtypes.rst:2663 msgid "Creating a zero-filled instance with a given length: ``bytearray(10)``" msgstr "" -#: ../../library/stdtypes.rst:2655 +#: ../../library/stdtypes.rst:2664 msgid "From an iterable of integers: ``bytearray(range(20))``" msgstr "" -#: ../../library/stdtypes.rst:2656 +#: ../../library/stdtypes.rst:2665 msgid "" "Copying existing binary data via the buffer protocol: ``bytearray(b'Hi!')``" msgstr "" -#: ../../library/stdtypes.rst:2658 +#: ../../library/stdtypes.rst:2667 msgid "" "As bytearray objects are mutable, they support the :ref:`mutable ` sequence operations in addition to the common bytes and bytearray " "operations described in :ref:`bytes-methods`." msgstr "" -#: ../../library/stdtypes.rst:2662 +#: ../../library/stdtypes.rst:2671 msgid "Also see the :ref:`bytearray ` built-in." msgstr "" -#: ../../library/stdtypes.rst:2664 +#: ../../library/stdtypes.rst:2673 msgid "" "Since 2 hexadecimal digits correspond precisely to a single byte, " "hexadecimal numbers are a commonly used format for describing binary data. " @@ -4073,33 +4085,33 @@ msgid "" "in that format:" msgstr "" -#: ../../library/stdtypes.rst:2670 +#: ../../library/stdtypes.rst:2679 msgid "" "This :class:`bytearray` class method returns bytearray object, decoding the " "given string object. The string must contain two hexadecimal digits per " "byte, with ASCII whitespace being ignored." msgstr "" -#: ../../library/stdtypes.rst:2677 +#: ../../library/stdtypes.rst:2686 msgid "" ":meth:`bytearray.fromhex` now skips all ASCII whitespace in the string, not " "just spaces." msgstr "" -#: ../../library/stdtypes.rst:2681 +#: ../../library/stdtypes.rst:2690 msgid "" "A reverse conversion function exists to transform a bytearray object into " "its hexadecimal representation." msgstr "" -#: ../../library/stdtypes.rst:2694 +#: ../../library/stdtypes.rst:2703 msgid "" "Similar to :meth:`bytes.hex`, :meth:`bytearray.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:2699 +#: ../../library/stdtypes.rst:2708 msgid "" "Since bytearray objects are sequences of integers (akin to a list), for a " "bytearray object *b*, ``b[0]`` will be an integer, while ``b[0:1]`` will be " @@ -4107,7 +4119,7 @@ msgid "" "both indexing and slicing will produce a string of length 1)" msgstr "" -#: ../../library/stdtypes.rst:2704 +#: ../../library/stdtypes.rst:2713 msgid "" "The representation of bytearray objects uses the bytes literal format " "(``bytearray(b'...')``) since it is often more useful than e.g. " @@ -4115,11 +4127,11 @@ msgid "" "a list of integers using ``list(b)``." msgstr "" -#: ../../library/stdtypes.rst:2713 +#: ../../library/stdtypes.rst:2722 msgid "Bytes and Bytearray Operations" msgstr "" -#: ../../library/stdtypes.rst:2718 +#: ../../library/stdtypes.rst:2727 msgid "" "Both bytes and bytearray objects support the :ref:`common ` " "sequence operations. They interoperate not just with operands of the same " @@ -4128,14 +4140,14 @@ msgid "" "return type of the result may depend on the order of operands." msgstr "" -#: ../../library/stdtypes.rst:2726 +#: ../../library/stdtypes.rst:2735 msgid "" "The methods on bytes and bytearray objects don't accept strings as their " "arguments, just as the methods on strings don't accept bytes as their " "arguments. For example, you have to write::" msgstr "" -#: ../../library/stdtypes.rst:2730 +#: ../../library/stdtypes.rst:2739 msgid "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" @@ -4143,11 +4155,11 @@ msgstr "" "a = \"abc\"\n" "b = a.replace(\"a\", \"f\")" -#: ../../library/stdtypes.rst:2733 +#: ../../library/stdtypes.rst:2742 msgid "and::" msgstr "和: ::" -#: ../../library/stdtypes.rst:2735 +#: ../../library/stdtypes.rst:2744 msgid "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" @@ -4155,60 +4167,60 @@ msgstr "" "a = b\"abc\"\n" "b = a.replace(b\"a\", b\"f\")" -#: ../../library/stdtypes.rst:2738 +#: ../../library/stdtypes.rst:2747 msgid "" "Some bytes and bytearray operations assume the use of ASCII compatible " "binary formats, and hence should be avoided when working with arbitrary " "binary data. These restrictions are covered below." msgstr "" -#: ../../library/stdtypes.rst:2743 +#: ../../library/stdtypes.rst:2752 msgid "" "Using these ASCII based operations to manipulate binary data that is not " "stored in an ASCII based format may lead to data corruption." msgstr "" -#: ../../library/stdtypes.rst:2746 +#: ../../library/stdtypes.rst:2755 msgid "" "The following methods on bytes and bytearray objects can be used with " "arbitrary binary data." msgstr "" -#: ../../library/stdtypes.rst:2752 +#: ../../library/stdtypes.rst:2761 msgid "" "Return the number of non-overlapping occurrences of subsequence *sub* in the " "range [*start*, *end*]. Optional arguments *start* and *end* are " "interpreted as in slice notation." msgstr "" -#: ../../library/stdtypes.rst:2756 ../../library/stdtypes.rst:2861 -#: ../../library/stdtypes.rst:2883 ../../library/stdtypes.rst:2949 -#: ../../library/stdtypes.rst:2962 +#: ../../library/stdtypes.rst:2765 ../../library/stdtypes.rst:2870 +#: ../../library/stdtypes.rst:2892 ../../library/stdtypes.rst:2958 +#: ../../library/stdtypes.rst:2971 msgid "" "The subsequence to search for may be any :term:`bytes-like object` or an " "integer in the range 0 to 255." msgstr "" -#: ../../library/stdtypes.rst:2759 +#: ../../library/stdtypes.rst:2768 msgid "" "If *sub* is empty, returns the number of empty slices between characters " "which is the length of the bytes object plus one." msgstr "" -#: ../../library/stdtypes.rst:2762 ../../library/stdtypes.rst:2873 -#: ../../library/stdtypes.rst:2886 ../../library/stdtypes.rst:2952 -#: ../../library/stdtypes.rst:2965 +#: ../../library/stdtypes.rst:2771 ../../library/stdtypes.rst:2882 +#: ../../library/stdtypes.rst:2895 ../../library/stdtypes.rst:2961 +#: ../../library/stdtypes.rst:2974 msgid "Also accept an integer in the range 0 to 255 as the subsequence." msgstr "" -#: ../../library/stdtypes.rst:2769 +#: ../../library/stdtypes.rst:2778 msgid "" "If the binary data starts with the *prefix* string, return " "``bytes[len(prefix):]``. Otherwise, return a copy of the original binary " "data::" msgstr "" -#: ../../library/stdtypes.rst:2773 +#: ../../library/stdtypes.rst:2782 msgid "" ">>> b'TestHook'.removeprefix(b'Test')\n" "b'Hook'\n" @@ -4220,32 +4232,32 @@ msgstr "" ">>> b'BaseTestCase'.removeprefix(b'Test')\n" "b'BaseTestCase'" -#: ../../library/stdtypes.rst:2778 +#: ../../library/stdtypes.rst:2787 msgid "The *prefix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2782 ../../library/stdtypes.rst:2804 -#: ../../library/stdtypes.rst:2937 ../../library/stdtypes.rst:3030 -#: ../../library/stdtypes.rst:3044 ../../library/stdtypes.rst:3075 -#: ../../library/stdtypes.rst:3089 ../../library/stdtypes.rst:3131 -#: ../../library/stdtypes.rst:3202 ../../library/stdtypes.rst:3220 -#: ../../library/stdtypes.rst:3248 ../../library/stdtypes.rst:3387 -#: ../../library/stdtypes.rst:3442 ../../library/stdtypes.rst:3485 -#: ../../library/stdtypes.rst:3506 ../../library/stdtypes.rst:3528 -#: ../../library/stdtypes.rst:3730 +#: ../../library/stdtypes.rst:2791 ../../library/stdtypes.rst:2813 +#: ../../library/stdtypes.rst:2946 ../../library/stdtypes.rst:3039 +#: ../../library/stdtypes.rst:3053 ../../library/stdtypes.rst:3084 +#: ../../library/stdtypes.rst:3098 ../../library/stdtypes.rst:3140 +#: ../../library/stdtypes.rst:3211 ../../library/stdtypes.rst:3229 +#: ../../library/stdtypes.rst:3257 ../../library/stdtypes.rst:3396 +#: ../../library/stdtypes.rst:3451 ../../library/stdtypes.rst:3494 +#: ../../library/stdtypes.rst:3515 ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:3739 msgid "" "The bytearray version of this method does *not* operate in place - it always " "produces a new object, even if no changes were made." msgstr "" -#: ../../library/stdtypes.rst:2791 +#: ../../library/stdtypes.rst:2800 msgid "" "If the binary data ends with the *suffix* string and that *suffix* is not " "empty, return ``bytes[:-len(suffix)]``. Otherwise, return a copy of the " "original binary data::" msgstr "" -#: ../../library/stdtypes.rst:2795 +#: ../../library/stdtypes.rst:2804 msgid "" ">>> b'MiscTests'.removesuffix(b'Tests')\n" "b'Misc'\n" @@ -4257,15 +4269,15 @@ msgstr "" ">>> b'TmpDirMixin'.removesuffix(b'Tests')\n" "b'TmpDirMixin'" -#: ../../library/stdtypes.rst:2800 +#: ../../library/stdtypes.rst:2809 msgid "The *suffix* may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2813 +#: ../../library/stdtypes.rst:2822 msgid "Return the bytes decoded to a :class:`str`." msgstr "" -#: ../../library/stdtypes.rst:2818 +#: ../../library/stdtypes.rst:2827 msgid "" "*errors* controls how decoding errors are handled. If ``'strict'`` (the " "default), a :exc:`UnicodeError` exception is raised. Other possible values " @@ -4273,21 +4285,21 @@ msgid "" "`codecs.register_error`. See :ref:`error-handlers` for details." msgstr "" -#: ../../library/stdtypes.rst:2824 +#: ../../library/stdtypes.rst:2833 msgid "" "For performance reasons, the value of *errors* is not checked for validity " "unless a decoding error actually occurs, :ref:`devmode` is enabled or a :ref:" "`debug build ` is used." msgstr "" -#: ../../library/stdtypes.rst:2830 +#: ../../library/stdtypes.rst:2839 msgid "" "Passing the *encoding* argument to :class:`str` allows decoding any :term:" "`bytes-like object` directly, without needing to make a temporary :class:`!" "bytes` or :class:`!bytearray` object." msgstr "" -#: ../../library/stdtypes.rst:2845 +#: ../../library/stdtypes.rst:2854 msgid "" "Return ``True`` if the binary data ends with the specified *suffix*, " "otherwise return ``False``. *suffix* can also be a tuple of suffixes to " @@ -4295,11 +4307,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:2850 +#: ../../library/stdtypes.rst:2859 msgid "The suffix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2856 +#: ../../library/stdtypes.rst:2865 msgid "" "Return the lowest index in the data where the subsequence *sub* is found, " "such that *sub* is contained in the slice ``s[start:end]``. Optional " @@ -4307,14 +4319,14 @@ msgid "" "``-1`` if *sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:2866 +#: ../../library/stdtypes.rst:2875 msgid "" "The :meth:`~bytes.find` method should be used only if you need to know the " "position of *sub*. To check if *sub* is a substring or not, use the :" "keyword:`in` operator::" msgstr "" -#: ../../library/stdtypes.rst:2870 +#: ../../library/stdtypes.rst:2879 msgid "" ">>> b'Py' in b'Python'\n" "True" @@ -4322,13 +4334,13 @@ msgstr "" ">>> b'Py' in b'Python'\n" "True" -#: ../../library/stdtypes.rst:2880 +#: ../../library/stdtypes.rst:2889 msgid "" "Like :meth:`~bytes.find`, but raise :exc:`ValueError` when the subsequence " "is not found." msgstr "" -#: ../../library/stdtypes.rst:2893 +#: ../../library/stdtypes.rst:2902 msgid "" "Return a bytes or bytearray object which is the concatenation of the binary " "data sequences in *iterable*. A :exc:`TypeError` will be raised if there " @@ -4338,7 +4350,7 @@ msgid "" "method." msgstr "" -#: ../../library/stdtypes.rst:2904 +#: ../../library/stdtypes.rst:2913 msgid "" "This static method returns a translation table usable for :meth:`bytes." "translate` that will map each character in *from* into the character at the " @@ -4346,7 +4358,7 @@ msgid "" "objects ` and have the same length." msgstr "" -#: ../../library/stdtypes.rst:2915 +#: ../../library/stdtypes.rst:2924 msgid "" "Split the sequence at the first occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4355,24 +4367,24 @@ msgid "" "by two empty bytes or bytearray objects." msgstr "" -#: ../../library/stdtypes.rst:2922 ../../library/stdtypes.rst:2979 +#: ../../library/stdtypes.rst:2931 ../../library/stdtypes.rst:2988 msgid "The separator to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2928 +#: ../../library/stdtypes.rst:2937 msgid "" "Return a copy of the sequence with all occurrences of subsequence *old* " "replaced by *new*. If the optional argument *count* is given, only the " "first *count* occurrences are replaced." msgstr "" -#: ../../library/stdtypes.rst:2932 +#: ../../library/stdtypes.rst:2941 msgid "" "The subsequence to search for and its replacement may be any :term:`bytes-" "like object`." msgstr "" -#: ../../library/stdtypes.rst:2944 +#: ../../library/stdtypes.rst:2953 msgid "" "Return the highest index in the sequence where the subsequence *sub* is " "found, such that *sub* is contained within ``s[start:end]``. Optional " @@ -4380,13 +4392,13 @@ msgid "" "``-1`` on failure." msgstr "" -#: ../../library/stdtypes.rst:2959 +#: ../../library/stdtypes.rst:2968 msgid "" "Like :meth:`~bytes.rfind` but raises :exc:`ValueError` when the subsequence " "*sub* is not found." msgstr "" -#: ../../library/stdtypes.rst:2972 +#: ../../library/stdtypes.rst:2981 msgid "" "Split the sequence at the last occurrence of *sep*, and return a 3-tuple " "containing the part before the separator, the separator itself or its " @@ -4395,7 +4407,7 @@ msgid "" "followed by a copy of the original sequence." msgstr "" -#: ../../library/stdtypes.rst:2985 +#: ../../library/stdtypes.rst:2994 msgid "" "Return ``True`` if the binary data starts with the specified *prefix*, " "otherwise return ``False``. *prefix* can also be a tuple of prefixes to " @@ -4403,11 +4415,11 @@ msgid "" "optional *end*, stop comparing at that position." msgstr "" -#: ../../library/stdtypes.rst:2990 +#: ../../library/stdtypes.rst:2999 msgid "The prefix(es) to search for may be any :term:`bytes-like object`." msgstr "" -#: ../../library/stdtypes.rst:2996 +#: ../../library/stdtypes.rst:3005 msgid "" "Return a copy of the bytes or bytearray object where all bytes occurring in " "the optional argument *delete* are removed, and the remaining bytes have " @@ -4415,18 +4427,18 @@ msgid "" "object of length 256." msgstr "" -#: ../../library/stdtypes.rst:3001 +#: ../../library/stdtypes.rst:3010 msgid "" "You can use the :func:`bytes.maketrans` method to create a translation table." msgstr "" -#: ../../library/stdtypes.rst:3004 +#: ../../library/stdtypes.rst:3013 msgid "" "Set the *table* argument to ``None`` for translations that only delete " "characters::" msgstr "" -#: ../../library/stdtypes.rst:3007 +#: ../../library/stdtypes.rst:3016 msgid "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" @@ -4434,11 +4446,11 @@ msgstr "" ">>> b'read this short text'.translate(None, b'aeiou')\n" "b'rd ths shrt txt'" -#: ../../library/stdtypes.rst:3010 +#: ../../library/stdtypes.rst:3019 msgid "*delete* is now supported as a keyword argument." msgstr "" -#: ../../library/stdtypes.rst:3014 +#: ../../library/stdtypes.rst:3023 msgid "" "The following methods on bytes and bytearray objects have default behaviours " "that assume the use of ASCII compatible binary formats, but can still be " @@ -4447,7 +4459,7 @@ msgid "" "instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3023 +#: ../../library/stdtypes.rst:3032 msgid "" "Return a copy of the object centered in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4455,7 +4467,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3037 +#: ../../library/stdtypes.rst:3046 msgid "" "Return a copy of the object left justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4463,7 +4475,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3051 +#: ../../library/stdtypes.rst:3060 msgid "" "Return a copy of the sequence with specified leading bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -4473,7 +4485,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3058 +#: ../../library/stdtypes.rst:3067 msgid "" ">>> b' spacious '.lstrip()\n" "b'spacious '\n" @@ -4485,14 +4497,14 @@ msgstr "" ">>> b'www.example.com'.lstrip(b'cmowz.')\n" "b'example.com'" -#: ../../library/stdtypes.rst:3063 +#: ../../library/stdtypes.rst:3072 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removeprefix` for a method that will remove a " "single prefix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3068 +#: ../../library/stdtypes.rst:3077 msgid "" ">>> b'Arthur: three!'.lstrip(b'Arthur: ')\n" "b'ee!'\n" @@ -4504,7 +4516,7 @@ msgstr "" ">>> b'Arthur: three!'.removeprefix(b'Arthur: ')\n" "b'three!'" -#: ../../library/stdtypes.rst:3082 +#: ../../library/stdtypes.rst:3091 msgid "" "Return a copy of the object right justified in a sequence of length *width*. " "Padding is done using the specified *fillbyte* (default is an ASCII space). " @@ -4512,7 +4524,7 @@ msgid "" "less than or equal to ``len(s)``." msgstr "" -#: ../../library/stdtypes.rst:3096 +#: ../../library/stdtypes.rst:3105 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are " @@ -4522,7 +4534,7 @@ msgid "" "described in detail below." msgstr "" -#: ../../library/stdtypes.rst:3107 +#: ../../library/stdtypes.rst:3116 msgid "" "Return a copy of the sequence with specified trailing bytes removed. The " "*chars* argument is a binary sequence specifying the set of byte values to " @@ -4532,7 +4544,7 @@ msgid "" "all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3114 +#: ../../library/stdtypes.rst:3123 msgid "" ">>> b' spacious '.rstrip()\n" "b' spacious'\n" @@ -4544,14 +4556,14 @@ msgstr "" ">>> b'mississippi'.rstrip(b'ipz')\n" "b'mississ'" -#: ../../library/stdtypes.rst:3119 +#: ../../library/stdtypes.rst:3128 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`. See :meth:`~bytes.removesuffix` for a method that will remove a " "single suffix string rather than all of a set of characters. For example::" msgstr "" -#: ../../library/stdtypes.rst:3124 +#: ../../library/stdtypes.rst:3133 msgid "" ">>> b'Monty Python'.rstrip(b' Python')\n" "b'M'\n" @@ -4563,7 +4575,7 @@ msgstr "" ">>> b'Monty Python'.removesuffix(b' Python')\n" "b'Monty'" -#: ../../library/stdtypes.rst:3138 +#: ../../library/stdtypes.rst:3147 msgid "" "Split the binary sequence into subsequences of the same type, using *sep* as " "the delimiter string. If *maxsplit* is given and non-negative, at most " @@ -4572,7 +4584,7 @@ msgid "" "limit on the number of splits (all possible splits are made)." msgstr "" -#: ../../library/stdtypes.rst:3144 +#: ../../library/stdtypes.rst:3153 msgid "" "If *sep* is given, consecutive delimiters are not grouped together and are " "deemed to delimit empty subsequences (for example, ``b'1,,2'.split(b',')`` " @@ -4583,7 +4595,7 @@ msgid "" "like object`." msgstr "" -#: ../../library/stdtypes.rst:3154 +#: ../../library/stdtypes.rst:3163 msgid "" ">>> b'1,2,3'.split(b',')\n" "[b'1', b'2', b'3']\n" @@ -4603,7 +4615,7 @@ msgstr "" ">>> b'1<>2<>3<4'.split(b'<>')\n" "[b'1', b'2', b'3<4']" -#: ../../library/stdtypes.rst:3163 +#: ../../library/stdtypes.rst:3172 msgid "" "If *sep* is not specified or is ``None``, a different splitting algorithm is " "applied: runs of consecutive ASCII whitespace are regarded as a single " @@ -4613,7 +4625,7 @@ msgid "" "without a specified separator returns ``[]``." msgstr "" -#: ../../library/stdtypes.rst:3173 +#: ../../library/stdtypes.rst:3182 msgid "" ">>> b'1 2 3'.split()\n" "[b'1', b'2', b'3']\n" @@ -4629,7 +4641,7 @@ msgstr "" ">>> b' 1 2 3 '.split()\n" "[b'1', b'2', b'3']" -#: ../../library/stdtypes.rst:3184 +#: ../../library/stdtypes.rst:3193 msgid "" "Return a copy of the sequence with specified leading and trailing bytes " "removed. The *chars* argument is a binary sequence specifying the set of " @@ -4639,7 +4651,7 @@ msgid "" "a prefix or suffix; rather, all combinations of its values are stripped::" msgstr "" -#: ../../library/stdtypes.rst:3192 +#: ../../library/stdtypes.rst:3201 msgid "" ">>> b' spacious '.strip()\n" "b'spacious'\n" @@ -4651,13 +4663,13 @@ msgstr "" ">>> b'www.example.com'.strip(b'cmowz.')\n" "b'example'" -#: ../../library/stdtypes.rst:3197 +#: ../../library/stdtypes.rst:3206 msgid "" "The binary sequence of byte values to remove may be any :term:`bytes-like " "object`." msgstr "" -#: ../../library/stdtypes.rst:3206 +#: ../../library/stdtypes.rst:3215 msgid "" "The following methods on bytes and bytearray objects assume the use of ASCII " "compatible binary formats and should not be applied to arbitrary binary " @@ -4665,14 +4677,14 @@ msgid "" "operate in place, and instead produce new objects." msgstr "" -#: ../../library/stdtypes.rst:3214 +#: ../../library/stdtypes.rst:3223 msgid "" "Return a copy of the sequence with each byte interpreted as an ASCII " "character, and the first byte capitalized and the rest lowercased. Non-ASCII " "byte values are passed through unchanged." msgstr "" -#: ../../library/stdtypes.rst:3227 +#: ../../library/stdtypes.rst:3236 msgid "" "Return a copy of the sequence where all ASCII tab characters are replaced by " "one or more ASCII spaces, depending on the current column and the given tab " @@ -4688,7 +4700,7 @@ msgid "" "by one regardless of how the byte value is represented when printed::" msgstr "" -#: ../../library/stdtypes.rst:3241 +#: ../../library/stdtypes.rst:3250 msgid "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs()\n" "b'01 012 0123 01234'\n" @@ -4700,7 +4712,7 @@ msgstr "" ">>> b'01\\t012\\t0123\\t01234'.expandtabs(4)\n" "b'01 012 0123 01234'" -#: ../../library/stdtypes.rst:3255 +#: ../../library/stdtypes.rst:3264 msgid "" "Return ``True`` if all bytes in the sequence are alphabetical ASCII " "characters or ASCII decimal digits and the sequence is not empty, ``False`` " @@ -4709,7 +4721,7 @@ msgid "" "digits are those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3263 +#: ../../library/stdtypes.rst:3272 msgid "" ">>> b'ABCabc1'.isalnum()\n" "True\n" @@ -4721,7 +4733,7 @@ msgstr "" ">>> b'ABC abc1'.isalnum()\n" "False" -#: ../../library/stdtypes.rst:3272 +#: ../../library/stdtypes.rst:3281 msgid "" "Return ``True`` if all bytes in the sequence are alphabetic ASCII characters " "and the sequence is not empty, ``False`` otherwise. Alphabetic ASCII " @@ -4729,7 +4741,7 @@ msgid "" "``b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3279 +#: ../../library/stdtypes.rst:3288 msgid "" ">>> b'ABCabc'.isalpha()\n" "True\n" @@ -4741,20 +4753,20 @@ msgstr "" ">>> b'ABCabc1'.isalpha()\n" "False" -#: ../../library/stdtypes.rst:3288 +#: ../../library/stdtypes.rst:3297 msgid "" "Return ``True`` if the sequence is empty or all bytes in the sequence are " "ASCII, ``False`` otherwise. ASCII bytes are in the range 0-0x7F." msgstr "" -#: ../../library/stdtypes.rst:3298 +#: ../../library/stdtypes.rst:3307 msgid "" "Return ``True`` if all bytes in the sequence are ASCII decimal digits and " "the sequence is not empty, ``False`` otherwise. ASCII decimal digits are " "those byte values in the sequence ``b'0123456789'``." msgstr "" -#: ../../library/stdtypes.rst:3304 +#: ../../library/stdtypes.rst:3313 msgid "" ">>> b'1234'.isdigit()\n" "True\n" @@ -4766,13 +4778,13 @@ msgstr "" ">>> b'1.23'.isdigit()\n" "False" -#: ../../library/stdtypes.rst:3313 +#: ../../library/stdtypes.rst:3322 msgid "" "Return ``True`` if there is at least one lowercase ASCII character in the " "sequence and no uppercase ASCII characters, ``False`` otherwise." msgstr "" -#: ../../library/stdtypes.rst:3318 +#: ../../library/stdtypes.rst:3327 msgid "" ">>> b'hello world'.islower()\n" "True\n" @@ -4784,16 +4796,16 @@ msgstr "" ">>> b'Hello world'.islower()\n" "False" -#: ../../library/stdtypes.rst:3323 ../../library/stdtypes.rst:3365 -#: ../../library/stdtypes.rst:3381 ../../library/stdtypes.rst:3431 -#: ../../library/stdtypes.rst:3500 +#: ../../library/stdtypes.rst:3332 ../../library/stdtypes.rst:3374 +#: ../../library/stdtypes.rst:3390 ../../library/stdtypes.rst:3440 +#: ../../library/stdtypes.rst:3509 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " "values in the sequence ``b'ABCDEFGHIJKLMNOPQRSTUVWXYZ'``." msgstr "" -#: ../../library/stdtypes.rst:3331 +#: ../../library/stdtypes.rst:3340 msgid "" "Return ``True`` if all bytes in the sequence are ASCII whitespace and the " "sequence is not empty, ``False`` otherwise. ASCII whitespace characters are " @@ -4801,14 +4813,14 @@ msgid "" "newline, carriage return, vertical tab, form feed)." msgstr "" -#: ../../library/stdtypes.rst:3340 +#: ../../library/stdtypes.rst:3349 msgid "" "Return ``True`` if the sequence is ASCII titlecase and the sequence is not " "empty, ``False`` otherwise. See :meth:`bytes.title` for more details on the " "definition of \"titlecase\"." msgstr "" -#: ../../library/stdtypes.rst:3346 +#: ../../library/stdtypes.rst:3355 msgid "" ">>> b'Hello World'.istitle()\n" "True\n" @@ -4820,14 +4832,14 @@ msgstr "" ">>> b'Hello world'.istitle()\n" "False" -#: ../../library/stdtypes.rst:3355 +#: ../../library/stdtypes.rst:3364 msgid "" "Return ``True`` if there is at least one uppercase alphabetic ASCII " "character in the sequence and no lowercase ASCII characters, ``False`` " "otherwise." msgstr "" -#: ../../library/stdtypes.rst:3360 +#: ../../library/stdtypes.rst:3369 msgid "" ">>> b'HELLO WORLD'.isupper()\n" "True\n" @@ -4839,13 +4851,13 @@ msgstr "" ">>> b'Hello world'.isupper()\n" "False" -#: ../../library/stdtypes.rst:3373 +#: ../../library/stdtypes.rst:3382 msgid "" "Return a copy of the sequence with all the uppercase ASCII characters " "converted to their corresponding lowercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3378 +#: ../../library/stdtypes.rst:3387 msgid "" ">>> b'Hello World'.lower()\n" "b'hello world'" @@ -4853,7 +4865,7 @@ msgstr "" ">>> b'Hello World'.lower()\n" "b'hello world'" -#: ../../library/stdtypes.rst:3398 +#: ../../library/stdtypes.rst:3407 msgid "" "Return a list of the lines in the binary sequence, breaking at ASCII line " "boundaries. This method uses the :term:`universal newlines` approach to " @@ -4861,7 +4873,7 @@ msgid "" "*keepends* is given and true." msgstr "" -#: ../../library/stdtypes.rst:3405 +#: ../../library/stdtypes.rst:3414 msgid "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines()\n" "[b'ab c', b'', b'de fg', b'kl']\n" @@ -4873,14 +4885,14 @@ msgstr "" ">>> b'ab c\\n\\nde fg\\rkl\\r\\n'.splitlines(keepends=True)\n" "[b'ab c\\n', b'\\n', b'de fg\\r', b'kl\\r\\n']" -#: ../../library/stdtypes.rst:3410 +#: ../../library/stdtypes.rst:3419 msgid "" "Unlike :meth:`~bytes.split` when a delimiter string *sep* is given, this " "method returns an empty list for the empty string, and a terminal line break " "does not result in an extra line::" msgstr "" -#: ../../library/stdtypes.rst:3414 +#: ../../library/stdtypes.rst:3423 msgid "" ">>> b\"\".split(b'\\n'), b\"Two lines\\n\".split(b'\\n')\n" "([b''], [b'Two lines', b''])\n" @@ -4892,13 +4904,13 @@ msgstr "" ">>> b\"\".splitlines(), b\"One line\\n\".splitlines()\n" "([], [b'One line'])" -#: ../../library/stdtypes.rst:3423 +#: ../../library/stdtypes.rst:3432 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart and vice-versa." msgstr "" -#: ../../library/stdtypes.rst:3428 +#: ../../library/stdtypes.rst:3437 msgid "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" @@ -4906,7 +4918,7 @@ msgstr "" ">>> b'Hello World'.swapcase()\n" "b'hELLO wORLD'" -#: ../../library/stdtypes.rst:3435 +#: ../../library/stdtypes.rst:3444 msgid "" "Unlike :func:`str.swapcase`, it is always the case that ``bin.swapcase()." "swapcase() == bin`` for the binary versions. Case conversions are " @@ -4914,14 +4926,14 @@ msgid "" "Unicode code points." msgstr "" -#: ../../library/stdtypes.rst:3449 +#: ../../library/stdtypes.rst:3458 msgid "" "Return a titlecased version of the binary sequence where words start with an " "uppercase ASCII character and the remaining characters are lowercase. " "Uncased byte values are left unmodified." msgstr "" -#: ../../library/stdtypes.rst:3455 +#: ../../library/stdtypes.rst:3464 msgid "" ">>> b'Hello world'.title()\n" "b'Hello World'" @@ -4929,7 +4941,7 @@ msgstr "" ">>> b'Hello world'.title()\n" "b'Hello World'" -#: ../../library/stdtypes.rst:3458 +#: ../../library/stdtypes.rst:3467 msgid "" "Lowercase ASCII characters are those byte values in the sequence " "``b'abcdefghijklmnopqrstuvwxyz'``. Uppercase ASCII characters are those byte " @@ -4937,7 +4949,7 @@ msgid "" "values are uncased." msgstr "" -#: ../../library/stdtypes.rst:3468 +#: ../../library/stdtypes.rst:3477 msgid "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" @@ -4945,12 +4957,12 @@ msgstr "" ">>> b\"they're bill's friends from the UK\".title()\n" "b\"They'Re Bill'S Friends From The Uk\"" -#: ../../library/stdtypes.rst:3471 +#: ../../library/stdtypes.rst:3480 msgid "" "A workaround for apostrophes can be constructed using regular expressions::" msgstr "" -#: ../../library/stdtypes.rst:3473 +#: ../../library/stdtypes.rst:3482 msgid "" ">>> import re\n" ">>> def titlecase(s):\n" @@ -4972,13 +4984,13 @@ msgstr "" ">>> titlecase(b\"they're bill's friends.\")\n" "b\"They're Bill's Friends.\"" -#: ../../library/stdtypes.rst:3492 +#: ../../library/stdtypes.rst:3501 msgid "" "Return a copy of the sequence with all the lowercase ASCII characters " "converted to their corresponding uppercase counterpart." msgstr "" -#: ../../library/stdtypes.rst:3497 +#: ../../library/stdtypes.rst:3506 msgid "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" @@ -4986,7 +4998,7 @@ msgstr "" ">>> b'Hello World'.upper()\n" "b'HELLO WORLD'" -#: ../../library/stdtypes.rst:3513 +#: ../../library/stdtypes.rst:3522 msgid "" "Return a copy of the sequence left filled with ASCII ``b'0'`` digits to make " "a sequence of length *width*. A leading sign prefix (``b'+'``/ ``b'-'``) is " @@ -4995,7 +5007,7 @@ msgid "" "*width* is less than or equal to ``len(seq)``." msgstr "" -#: ../../library/stdtypes.rst:3521 +#: ../../library/stdtypes.rst:3530 msgid "" ">>> b\"42\".zfill(5)\n" "b'00042'\n" @@ -5007,11 +5019,11 @@ msgstr "" ">>> b\"-42\".zfill(5)\n" "b'-0042'" -#: ../../library/stdtypes.rst:3535 +#: ../../library/stdtypes.rst:3544 msgid "``printf``-style Bytes Formatting" msgstr "" -#: ../../library/stdtypes.rst:3552 +#: ../../library/stdtypes.rst:3561 msgid "" "The formatting operations described here exhibit a variety of quirks that " "lead to a number of common errors (such as failing to display tuples and " @@ -5019,7 +5031,7 @@ msgid "" "dictionary, wrap it in a tuple." msgstr "" -#: ../../library/stdtypes.rst:3557 +#: ../../library/stdtypes.rst:3566 msgid "" "Bytes objects (``bytes``/``bytearray``) have one unique built-in operation: " "the ``%`` operator (modulo). This is also known as the bytes *formatting* or " @@ -5029,7 +5041,7 @@ msgid "" "func:`sprintf` in the C language." msgstr "" -#: ../../library/stdtypes.rst:3564 +#: ../../library/stdtypes.rst:3573 msgid "" "If *format* requires a single argument, *values* may be a single non-tuple " "object. [5]_ Otherwise, *values* must be a tuple with exactly the number of " @@ -5037,7 +5049,7 @@ msgid "" "example, a dictionary)." msgstr "" -#: ../../library/stdtypes.rst:3598 +#: ../../library/stdtypes.rst:3607 msgid "" "When the right argument is a dictionary (or other mapping type), then the " "formats in the bytes object *must* include a parenthesised mapping key into " @@ -5045,73 +5057,73 @@ msgid "" "mapping key selects the value to be formatted from the mapping. For example:" msgstr "" -#: ../../library/stdtypes.rst:3672 +#: ../../library/stdtypes.rst:3681 msgid "Single byte (accepts integer or single byte objects)." msgstr "" -#: ../../library/stdtypes.rst:3675 +#: ../../library/stdtypes.rst:3684 msgid "``'b'``" msgstr "``'b'``" -#: ../../library/stdtypes.rst:3675 +#: ../../library/stdtypes.rst:3684 msgid "" "Bytes (any object that follows the :ref:`buffer protocol ` or " "has :meth:`~object.__bytes__`)." msgstr "" -#: ../../library/stdtypes.rst:3679 +#: ../../library/stdtypes.rst:3688 msgid "" "``'s'`` is an alias for ``'b'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3682 +#: ../../library/stdtypes.rst:3691 msgid "" "Bytes (converts any Python object using ``repr(obj).encode('ascii', " "'backslashreplace')``)." msgstr "" -#: ../../library/stdtypes.rst:3685 +#: ../../library/stdtypes.rst:3694 msgid "" "``'r'`` is an alias for ``'a'`` and should only be used for Python2/3 code " "bases." msgstr "" -#: ../../library/stdtypes.rst:3685 +#: ../../library/stdtypes.rst:3694 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/stdtypes.rst:3720 +#: ../../library/stdtypes.rst:3729 msgid "``b'%s'`` is deprecated, but will not be removed during the 3.x series." msgstr "" -#: ../../library/stdtypes.rst:3723 +#: ../../library/stdtypes.rst:3732 msgid "``b'%r'`` is deprecated, but will not be removed during the 3.x series." msgstr "" -#: ../../library/stdtypes.rst:3735 +#: ../../library/stdtypes.rst:3744 msgid ":pep:`461` - Adding % formatting to bytes and bytearray" msgstr "" -#: ../../library/stdtypes.rst:3742 +#: ../../library/stdtypes.rst:3751 msgid "Memory Views" msgstr "" -#: ../../library/stdtypes.rst:3744 +#: ../../library/stdtypes.rst:3753 msgid "" ":class:`memoryview` objects allow Python code to access the internal data of " "an object that supports the :ref:`buffer protocol ` without " "copying." msgstr "" -#: ../../library/stdtypes.rst:3750 +#: ../../library/stdtypes.rst:3759 msgid "" "Create a :class:`memoryview` that references *object*. *object* must " "support the buffer protocol. Built-in objects that support the buffer " "protocol include :class:`bytes` and :class:`bytearray`." msgstr "" -#: ../../library/stdtypes.rst:3754 +#: ../../library/stdtypes.rst:3763 msgid "" "A :class:`memoryview` has the notion of an *element*, which is the atomic " "memory unit handled by the originating *object*. For many simple types such " @@ -5119,32 +5131,32 @@ msgid "" "other types such as :class:`array.array` may have bigger elements." msgstr "" -#: ../../library/stdtypes.rst:3759 +#: ../../library/stdtypes.rst:3768 msgid "" "``len(view)`` is equal to the length of :class:`~memoryview.tolist`, which " "is the nested list representation of the view. If ``view.ndim = 1``, this is " "equal to the number of elements in the view." msgstr "" -#: ../../library/stdtypes.rst:3763 +#: ../../library/stdtypes.rst:3772 msgid "" "If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of " "returning 1." msgstr "" -#: ../../library/stdtypes.rst:3766 +#: ../../library/stdtypes.rst:3775 msgid "" "The :class:`~memoryview.itemsize` attribute will give you the number of " "bytes in a single element." msgstr "" -#: ../../library/stdtypes.rst:3769 +#: ../../library/stdtypes.rst:3778 msgid "" "A :class:`memoryview` supports slicing and indexing to expose its data. One-" "dimensional slicing will result in a subview::" msgstr "" -#: ../../library/stdtypes.rst:3772 +#: ../../library/stdtypes.rst:3781 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> v[1]\n" @@ -5166,7 +5178,7 @@ msgstr "" ">>> bytes(v[1:4])\n" "b'bce'" -#: ../../library/stdtypes.rst:3782 +#: ../../library/stdtypes.rst:3791 msgid "" "If :class:`~memoryview.format` is one of the native format specifiers from " "the :mod:`struct` module, indexing with an integer or a tuple of integers is " @@ -5177,11 +5189,11 @@ msgid "" "memoryviews can be indexed with the empty tuple." msgstr "" -#: ../../library/stdtypes.rst:3791 +#: ../../library/stdtypes.rst:3800 msgid "Here is an example with a non-byte format::" msgstr "" -#: ../../library/stdtypes.rst:3793 +#: ../../library/stdtypes.rst:3802 msgid "" ">>> import array\n" ">>> a = array.array('l', [-11111111, 22222222, -33333333, 44444444])\n" @@ -5203,13 +5215,13 @@ msgstr "" ">>> m[::2].tolist()\n" "[-11111111, -33333333]" -#: ../../library/stdtypes.rst:3803 +#: ../../library/stdtypes.rst:3812 msgid "" "If the underlying object is writable, the memoryview supports one-" "dimensional slice assignment. Resizing is not allowed::" msgstr "" -#: ../../library/stdtypes.rst:3806 +#: ../../library/stdtypes.rst:3815 msgid "" ">>> data = bytearray(b'abcefg')\n" ">>> v = memoryview(data)\n" @@ -5249,14 +5261,14 @@ msgstr "" ">>> data\n" "bytearray(b'z1spam')" -#: ../../library/stdtypes.rst:3824 +#: ../../library/stdtypes.rst:3833 msgid "" "One-dimensional memoryviews of :term:`hashable` (read-only) types with " "formats 'B', 'b' or 'c' are also hashable. The hash is defined as ``hash(m) " "== hash(m.tobytes())``::" msgstr "" -#: ../../library/stdtypes.rst:3828 +#: ../../library/stdtypes.rst:3837 msgid "" ">>> v = memoryview(b'abcefg')\n" ">>> hash(v) == hash(b'abcefg')\n" @@ -5274,40 +5286,40 @@ msgstr "" ">>> hash(v[::-2]) == hash(b'abcefg'[::-2])\n" "True" -#: ../../library/stdtypes.rst:3836 +#: ../../library/stdtypes.rst:3845 msgid "" "One-dimensional memoryviews can now be sliced. One-dimensional memoryviews " "with formats 'B', 'b' or 'c' are now :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:3840 +#: ../../library/stdtypes.rst:3849 msgid "" "memoryview is now registered automatically with :class:`collections.abc." "Sequence`" msgstr "" -#: ../../library/stdtypes.rst:3844 +#: ../../library/stdtypes.rst:3853 msgid "memoryviews can now be indexed with tuple of integers." msgstr "" -#: ../../library/stdtypes.rst:3847 +#: ../../library/stdtypes.rst:3856 msgid ":class:`memoryview` has several methods:" msgstr "" -#: ../../library/stdtypes.rst:3851 +#: ../../library/stdtypes.rst:3860 msgid "" "A memoryview and a :pep:`3118` exporter are equal if their shapes are " "equivalent and if all corresponding values are equal when the operands' " "respective format codes are interpreted using :mod:`struct` syntax." msgstr "" -#: ../../library/stdtypes.rst:3855 +#: ../../library/stdtypes.rst:3864 msgid "" "For the subset of :mod:`struct` format strings currently supported by :meth:" "`tolist`, ``v`` and ``w`` are equal if ``v.tolist() == w.tolist()``::" msgstr "" -#: ../../library/stdtypes.rst:3858 +#: ../../library/stdtypes.rst:3867 msgid "" ">>> import array\n" ">>> a = array.array('I', [1, 2, 3, 4, 5])\n" @@ -5341,14 +5353,14 @@ msgstr "" ">>> z.tolist() == c.tolist()\n" "True" -#: ../../library/stdtypes.rst:3874 +#: ../../library/stdtypes.rst:3883 msgid "" "If either format string is not supported by the :mod:`struct` module, then " "the objects will always compare as unequal (even if the format strings and " "buffer contents are identical)::" msgstr "" -#: ../../library/stdtypes.rst:3878 +#: ../../library/stdtypes.rst:3887 msgid "" ">>> from ctypes import BigEndianStructure, c_long\n" ">>> class BEPoint(BigEndianStructure):\n" @@ -5374,25 +5386,25 @@ msgstr "" ">>> a == b\n" "False" -#: ../../library/stdtypes.rst:3890 +#: ../../library/stdtypes.rst:3899 msgid "" "Note that, as with floating-point numbers, ``v is w`` does *not* imply ``v " "== w`` for memoryview objects." msgstr "" -#: ../../library/stdtypes.rst:3893 +#: ../../library/stdtypes.rst:3902 msgid "" "Previous versions compared the raw memory disregarding the item format and " "the logical array structure." msgstr "" -#: ../../library/stdtypes.rst:3899 +#: ../../library/stdtypes.rst:3908 msgid "" "Return the data in the buffer as a bytestring. This is equivalent to " "calling the :class:`bytes` constructor on the memoryview. ::" msgstr "" -#: ../../library/stdtypes.rst:3902 +#: ../../library/stdtypes.rst:3911 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.tobytes()\n" @@ -5406,7 +5418,7 @@ msgstr "" ">>> bytes(m)\n" "b'abc'" -#: ../../library/stdtypes.rst:3908 +#: ../../library/stdtypes.rst:3917 msgid "" "For non-contiguous arrays the result is equal to the flattened list " "representation with all elements converted to bytes. :meth:`tobytes` " @@ -5414,7 +5426,7 @@ msgid "" "module syntax." msgstr "" -#: ../../library/stdtypes.rst:3913 +#: ../../library/stdtypes.rst:3922 msgid "" "*order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data of the " "original array is converted to C or Fortran order. For contiguous views, 'A' " @@ -5423,13 +5435,13 @@ msgid "" "to C first. *order=None* is the same as *order='C'*." msgstr "" -#: ../../library/stdtypes.rst:3922 +#: ../../library/stdtypes.rst:3931 msgid "" "Return a string object containing two hexadecimal digits for each byte in " "the buffer. ::" msgstr "" -#: ../../library/stdtypes.rst:3925 +#: ../../library/stdtypes.rst:3934 msgid "" ">>> m = memoryview(b\"abc\")\n" ">>> m.hex()\n" @@ -5439,18 +5451,18 @@ msgstr "" ">>> m.hex()\n" "'616263'" -#: ../../library/stdtypes.rst:3931 +#: ../../library/stdtypes.rst:3940 msgid "" "Similar to :meth:`bytes.hex`, :meth:`memoryview.hex` now supports optional " "*sep* and *bytes_per_sep* parameters to insert separators between bytes in " "the hex output." msgstr "" -#: ../../library/stdtypes.rst:3938 +#: ../../library/stdtypes.rst:3947 msgid "Return the data in the buffer as a list of elements. ::" msgstr "" -#: ../../library/stdtypes.rst:3940 +#: ../../library/stdtypes.rst:3949 msgid "" ">>> memoryview(b'abc').tolist()\n" "[97, 98, 99]\n" @@ -5468,19 +5480,19 @@ msgstr "" ">>> m.tolist()\n" "[1.1, 2.2, 3.3]" -#: ../../library/stdtypes.rst:3948 +#: ../../library/stdtypes.rst:3957 msgid "" ":meth:`tolist` now supports all single character native formats in :mod:" "`struct` module syntax as well as multi-dimensional representations." msgstr "" -#: ../../library/stdtypes.rst:3955 +#: ../../library/stdtypes.rst:3964 msgid "" "Return a readonly version of the memoryview object. The original memoryview " "object is unchanged. ::" msgstr "" -#: ../../library/stdtypes.rst:3958 +#: ../../library/stdtypes.rst:3967 msgid "" ">>> m = memoryview(bytearray(b'abc'))\n" ">>> mm = m.toreadonly()\n" @@ -5506,7 +5518,7 @@ msgstr "" ">>> mm.tolist()\n" "[43, 98, 99]" -#: ../../library/stdtypes.rst:3974 +#: ../../library/stdtypes.rst:3983 msgid "" "Release the underlying buffer exposed by the memoryview object. Many " "objects take special actions when a view is held on them (for example, a :" @@ -5515,14 +5527,14 @@ msgid "" "resources) as soon as possible." msgstr "" -#: ../../library/stdtypes.rst:3980 +#: ../../library/stdtypes.rst:3989 msgid "" "After this method has been called, any further operation on the view raises " "a :class:`ValueError` (except :meth:`release` itself which can be called " "multiple times)::" msgstr "" -#: ../../library/stdtypes.rst:3984 +#: ../../library/stdtypes.rst:3993 msgid "" ">>> m = memoryview(b'abc')\n" ">>> m.release()\n" @@ -5538,13 +5550,13 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:3991 +#: ../../library/stdtypes.rst:4000 msgid "" "The context management protocol can be used for a similar effect, using the " "``with`` statement::" msgstr "" -#: ../../library/stdtypes.rst:3994 +#: ../../library/stdtypes.rst:4003 msgid "" ">>> with memoryview(b'abc') as m:\n" "... m[0]\n" @@ -5564,7 +5576,7 @@ msgstr "" " File \"\", line 1, in \n" "ValueError: operation forbidden on released memoryview object" -#: ../../library/stdtypes.rst:4007 +#: ../../library/stdtypes.rst:4016 msgid "" "Cast a memoryview to a new format or shape. *shape* defaults to " "``[byte_length//new_itemsize]``, which means that the result view will be " @@ -5573,7 +5585,7 @@ msgid "" "contiguous -> 1D." msgstr "" -#: ../../library/stdtypes.rst:4013 +#: ../../library/stdtypes.rst:4022 msgid "" "The destination format is restricted to a single element native format in :" "mod:`struct` syntax. One of the formats must be a byte format ('B', 'b' or " @@ -5581,11 +5593,11 @@ msgid "" "Note that all byte lengths may depend on the operating system." msgstr "" -#: ../../library/stdtypes.rst:4019 +#: ../../library/stdtypes.rst:4028 msgid "Cast 1D/long to 1D/unsigned bytes::" msgstr "" -#: ../../library/stdtypes.rst:4021 +#: ../../library/stdtypes.rst:4030 msgid "" ">>> import array\n" ">>> a = array.array('l', [1,2,3])\n" @@ -5629,11 +5641,11 @@ msgstr "" ">>> y.nbytes\n" "24" -#: ../../library/stdtypes.rst:4042 +#: ../../library/stdtypes.rst:4051 msgid "Cast 1D/unsigned bytes to 1D/char::" msgstr "" -#: ../../library/stdtypes.rst:4044 +#: ../../library/stdtypes.rst:4053 msgid "" ">>> b = bytearray(b'zyz')\n" ">>> x = memoryview(b)\n" @@ -5657,11 +5669,11 @@ msgstr "" ">>> b\n" "bytearray(b'ayz')" -#: ../../library/stdtypes.rst:4055 +#: ../../library/stdtypes.rst:4064 msgid "Cast 1D/bytes to 3D/ints to 1D/signed char::" msgstr "" -#: ../../library/stdtypes.rst:4057 +#: ../../library/stdtypes.rst:4066 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"i\"*12, *list(range(12)))\n" @@ -5711,11 +5723,11 @@ msgstr "" ">>> z.nbytes\n" "48" -#: ../../library/stdtypes.rst:4081 +#: ../../library/stdtypes.rst:4090 msgid "Cast 1D/unsigned long to 2D/unsigned long::" msgstr "" -#: ../../library/stdtypes.rst:4083 +#: ../../library/stdtypes.rst:4092 msgid "" ">>> buf = struct.pack(\"L\"*6, *list(range(6)))\n" ">>> x = memoryview(buf)\n" @@ -5737,19 +5749,19 @@ msgstr "" ">>> y.tolist()\n" "[[0, 1, 2], [3, 4, 5]]" -#: ../../library/stdtypes.rst:4095 +#: ../../library/stdtypes.rst:4104 msgid "The source format is no longer restricted when casting to a byte view." msgstr "" -#: ../../library/stdtypes.rst:4098 +#: ../../library/stdtypes.rst:4107 msgid "There are also several readonly attributes available:" msgstr "" -#: ../../library/stdtypes.rst:4102 +#: ../../library/stdtypes.rst:4111 msgid "The underlying object of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4104 +#: ../../library/stdtypes.rst:4113 msgid "" ">>> b = bytearray(b'xyz')\n" ">>> m = memoryview(b)\n" @@ -5761,14 +5773,14 @@ msgstr "" ">>> m.obj is b\n" "True" -#: ../../library/stdtypes.rst:4113 +#: ../../library/stdtypes.rst:4122 msgid "" "``nbytes == product(shape) * itemsize == len(m.tobytes())``. This is the " "amount of space in bytes that the array would use in a contiguous " "representation. It is not necessarily equal to ``len(m)``::" msgstr "" -#: ../../library/stdtypes.rst:4117 +#: ../../library/stdtypes.rst:4126 msgid "" ">>> import array\n" ">>> a = array.array('i', [1,2,3,4,5])\n" @@ -5800,11 +5812,11 @@ msgstr "" ">>> len(y.tobytes())\n" "12" -#: ../../library/stdtypes.rst:4132 +#: ../../library/stdtypes.rst:4141 msgid "Multi-dimensional arrays::" msgstr "" -#: ../../library/stdtypes.rst:4134 +#: ../../library/stdtypes.rst:4143 msgid "" ">>> import struct\n" ">>> buf = struct.pack(\"d\"*12, *[1.5*x for x in range(12)])\n" @@ -5828,11 +5840,11 @@ msgstr "" ">>> y.nbytes\n" "96" -#: ../../library/stdtypes.rst:4149 +#: ../../library/stdtypes.rst:4158 msgid "A bool indicating whether the memory is read only." msgstr "" -#: ../../library/stdtypes.rst:4153 +#: ../../library/stdtypes.rst:4162 msgid "" "A string containing the format (in :mod:`struct` module style) for each " "element in the view. A memoryview can be created from exporters with " @@ -5840,17 +5852,17 @@ msgid "" "restricted to native single element formats." msgstr "" -#: ../../library/stdtypes.rst:4158 +#: ../../library/stdtypes.rst:4167 msgid "" "format ``'B'`` is now handled according to the struct module syntax. This " "means that ``memoryview(b'abc')[0] == b'abc'[0] == 97``." msgstr "" -#: ../../library/stdtypes.rst:4164 +#: ../../library/stdtypes.rst:4173 msgid "The size in bytes of each element of the memoryview::" msgstr "" -#: ../../library/stdtypes.rst:4166 +#: ../../library/stdtypes.rst:4175 msgid "" ">>> import array, struct\n" ">>> m = memoryview(array.array('H', [32000, 32001, 32002]))\n" @@ -5870,49 +5882,49 @@ msgstr "" ">>> struct.calcsize('H') == m.itemsize\n" "True" -#: ../../library/stdtypes.rst:4177 +#: ../../library/stdtypes.rst:4186 msgid "" "An integer indicating how many dimensions of a multi-dimensional array the " "memory represents." msgstr "" -#: ../../library/stdtypes.rst:4182 +#: ../../library/stdtypes.rst:4191 msgid "" "A tuple of integers the length of :attr:`ndim` giving the shape of the " "memory as an N-dimensional array." msgstr "" -#: ../../library/stdtypes.rst:4185 ../../library/stdtypes.rst:4193 +#: ../../library/stdtypes.rst:4194 ../../library/stdtypes.rst:4202 msgid "An empty tuple instead of ``None`` when ndim = 0." msgstr "" -#: ../../library/stdtypes.rst:4190 +#: ../../library/stdtypes.rst:4199 msgid "" "A tuple of integers the length of :attr:`ndim` giving the size in bytes to " "access each element for each dimension of the array." msgstr "" -#: ../../library/stdtypes.rst:4198 +#: ../../library/stdtypes.rst:4207 msgid "Used internally for PIL-style arrays. The value is informational only." msgstr "" -#: ../../library/stdtypes.rst:4202 +#: ../../library/stdtypes.rst:4211 msgid "A bool indicating whether the memory is C-:term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4208 +#: ../../library/stdtypes.rst:4217 msgid "A bool indicating whether the memory is Fortran :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4214 +#: ../../library/stdtypes.rst:4223 msgid "A bool indicating whether the memory is :term:`contiguous`." msgstr "" -#: ../../library/stdtypes.rst:4222 +#: ../../library/stdtypes.rst:4231 msgid "Set Types --- :class:`set`, :class:`frozenset`" msgstr "" -#: ../../library/stdtypes.rst:4226 +#: ../../library/stdtypes.rst:4235 msgid "" "A :dfn:`set` object is an unordered collection of distinct :term:`hashable` " "objects. Common uses include membership testing, removing duplicates from a " @@ -5922,7 +5934,7 @@ msgid "" "`collections` module.)" msgstr "" -#: ../../library/stdtypes.rst:4233 +#: ../../library/stdtypes.rst:4242 msgid "" "Like other collections, sets support ``x in set``, ``len(set)``, and ``for x " "in set``. Being an unordered collection, sets do not record element " @@ -5930,7 +5942,7 @@ msgid "" "slicing, or other sequence-like behavior." msgstr "" -#: ../../library/stdtypes.rst:4238 +#: ../../library/stdtypes.rst:4247 msgid "" "There are currently two built-in set types, :class:`set` and :class:" "`frozenset`. The :class:`set` type is mutable --- the contents can be " @@ -5942,18 +5954,18 @@ msgid "" "of another set." msgstr "" -#: ../../library/stdtypes.rst:4246 +#: ../../library/stdtypes.rst:4255 msgid "" "Non-empty sets (not frozensets) can be created by placing a comma-separated " "list of elements within braces, for example: ``{'jack', 'sjoerd'}``, in " "addition to the :class:`set` constructor." msgstr "" -#: ../../library/stdtypes.rst:4250 +#: ../../library/stdtypes.rst:4259 msgid "The constructors for both classes work the same:" msgstr "" -#: ../../library/stdtypes.rst:4255 +#: ../../library/stdtypes.rst:4264 msgid "" "Return a new set or frozenset object whose elements are taken from " "*iterable*. The elements of a set must be :term:`hashable`. To represent " @@ -5961,92 +5973,92 @@ msgid "" "*iterable* is not specified, a new empty set is returned." msgstr "" -#: ../../library/stdtypes.rst:4261 +#: ../../library/stdtypes.rst:4270 msgid "Sets can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4263 +#: ../../library/stdtypes.rst:4272 msgid "" "Use a comma-separated list of elements within braces: ``{'jack', 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4264 +#: ../../library/stdtypes.rst:4273 msgid "" "Use a set comprehension: ``{c for c in 'abracadabra' if c not in 'abc'}``" msgstr "" -#: ../../library/stdtypes.rst:4265 +#: ../../library/stdtypes.rst:4274 msgid "" "Use the type constructor: ``set()``, ``set('foobar')``, ``set(['a', 'b', " "'foo'])``" msgstr "" -#: ../../library/stdtypes.rst:4267 +#: ../../library/stdtypes.rst:4276 msgid "" "Instances of :class:`set` and :class:`frozenset` provide the following " "operations:" msgstr "" -#: ../../library/stdtypes.rst:4272 +#: ../../library/stdtypes.rst:4281 msgid "Return the number of elements in set *s* (cardinality of *s*)." msgstr "" -#: ../../library/stdtypes.rst:4276 +#: ../../library/stdtypes.rst:4285 msgid "Test *x* for membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4280 +#: ../../library/stdtypes.rst:4289 msgid "Test *x* for non-membership in *s*." msgstr "" -#: ../../library/stdtypes.rst:4284 +#: ../../library/stdtypes.rst:4293 msgid "" "Return ``True`` if the set has no elements in common with *other*. Sets are " "disjoint if and only if their intersection is the empty set." msgstr "" -#: ../../library/stdtypes.rst:4290 +#: ../../library/stdtypes.rst:4299 msgid "Test whether every element in the set is in *other*." msgstr "" -#: ../../library/stdtypes.rst:4294 +#: ../../library/stdtypes.rst:4303 msgid "" "Test whether the set is a proper subset of *other*, that is, ``set <= other " "and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4300 +#: ../../library/stdtypes.rst:4309 msgid "Test whether every element in *other* is in the set." msgstr "" -#: ../../library/stdtypes.rst:4304 +#: ../../library/stdtypes.rst:4313 msgid "" "Test whether the set is a proper superset of *other*, that is, ``set >= " "other and set != other``." msgstr "" -#: ../../library/stdtypes.rst:4310 +#: ../../library/stdtypes.rst:4319 msgid "Return a new set with elements from the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4315 +#: ../../library/stdtypes.rst:4324 msgid "Return a new set with elements common to the set and all others." msgstr "" -#: ../../library/stdtypes.rst:4320 +#: ../../library/stdtypes.rst:4329 msgid "Return a new set with elements in the set that are not in the others." msgstr "" -#: ../../library/stdtypes.rst:4325 +#: ../../library/stdtypes.rst:4334 msgid "" "Return a new set with elements in either the set or *other* but not both." msgstr "" -#: ../../library/stdtypes.rst:4329 +#: ../../library/stdtypes.rst:4338 msgid "Return a shallow copy of the set." msgstr "" -#: ../../library/stdtypes.rst:4332 +#: ../../library/stdtypes.rst:4341 msgid "" "Note, the non-operator versions of :meth:`union`, :meth:`intersection`, :" "meth:`difference`, :meth:`symmetric_difference`, :meth:`issubset`, and :meth:" @@ -6056,7 +6068,7 @@ msgid "" "the more readable ``set('abc').intersection('cbs')``." msgstr "" -#: ../../library/stdtypes.rst:4339 +#: ../../library/stdtypes.rst:4348 msgid "" "Both :class:`set` and :class:`frozenset` support set to set comparisons. Two " "sets are equal if and only if every element of each set is contained in the " @@ -6066,14 +6078,14 @@ msgid "" "set is a proper superset of the second set (is a superset, but is not equal)." msgstr "" -#: ../../library/stdtypes.rst:4346 +#: ../../library/stdtypes.rst:4355 msgid "" "Instances of :class:`set` are compared to instances of :class:`frozenset` " "based on their members. For example, ``set('abc') == frozenset('abc')`` " "returns ``True`` and so does ``set('abc') in set([frozenset('abc')])``." msgstr "" -#: ../../library/stdtypes.rst:4350 +#: ../../library/stdtypes.rst:4359 msgid "" "The subset and equality comparisons do not generalize to a total ordering " "function. For example, any two nonempty disjoint sets are not equal and are " @@ -6081,71 +6093,71 @@ msgid "" "``ab``." msgstr "" -#: ../../library/stdtypes.rst:4355 +#: ../../library/stdtypes.rst:4364 msgid "" "Since sets only define partial ordering (subset relationships), the output " "of the :meth:`list.sort` method is undefined for lists of sets." msgstr "" -#: ../../library/stdtypes.rst:4358 +#: ../../library/stdtypes.rst:4367 msgid "Set elements, like dictionary keys, must be :term:`hashable`." msgstr "" -#: ../../library/stdtypes.rst:4360 +#: ../../library/stdtypes.rst:4369 msgid "" "Binary operations that mix :class:`set` instances with :class:`frozenset` " "return the type of the first operand. For example: ``frozenset('ab') | " "set('bc')`` returns an instance of :class:`frozenset`." msgstr "" -#: ../../library/stdtypes.rst:4364 +#: ../../library/stdtypes.rst:4373 msgid "" "The following table lists operations available for :class:`set` that do not " "apply to immutable instances of :class:`frozenset`:" msgstr "" -#: ../../library/stdtypes.rst:4370 +#: ../../library/stdtypes.rst:4379 msgid "Update the set, adding elements from all others." msgstr "" -#: ../../library/stdtypes.rst:4375 +#: ../../library/stdtypes.rst:4384 msgid "Update the set, keeping only elements found in it and all others." msgstr "" -#: ../../library/stdtypes.rst:4380 +#: ../../library/stdtypes.rst:4389 msgid "Update the set, removing elements found in others." msgstr "" -#: ../../library/stdtypes.rst:4385 +#: ../../library/stdtypes.rst:4394 msgid "" "Update the set, keeping only elements found in either set, but not in both." msgstr "" -#: ../../library/stdtypes.rst:4389 +#: ../../library/stdtypes.rst:4398 msgid "Add element *elem* to the set." msgstr "" -#: ../../library/stdtypes.rst:4393 +#: ../../library/stdtypes.rst:4402 msgid "" "Remove element *elem* from the set. Raises :exc:`KeyError` if *elem* is not " "contained in the set." msgstr "" -#: ../../library/stdtypes.rst:4398 +#: ../../library/stdtypes.rst:4407 msgid "Remove element *elem* from the set if it is present." msgstr "" -#: ../../library/stdtypes.rst:4402 +#: ../../library/stdtypes.rst:4411 msgid "" "Remove and return an arbitrary element from the set. Raises :exc:`KeyError` " "if the set is empty." msgstr "" -#: ../../library/stdtypes.rst:4407 +#: ../../library/stdtypes.rst:4416 msgid "Remove all elements from the set." msgstr "" -#: ../../library/stdtypes.rst:4410 +#: ../../library/stdtypes.rst:4419 msgid "" "Note, the non-operator versions of the :meth:`update`, :meth:" "`intersection_update`, :meth:`difference_update`, and :meth:" @@ -6153,18 +6165,18 @@ msgid "" "argument." msgstr "" -#: ../../library/stdtypes.rst:4415 +#: ../../library/stdtypes.rst:4424 msgid "" "Note, the *elem* argument to the :meth:`~object.__contains__`, :meth:" "`remove`, and :meth:`discard` methods may be a set. To support searching " "for an equivalent frozenset, a temporary one is created from *elem*." msgstr "" -#: ../../library/stdtypes.rst:4424 +#: ../../library/stdtypes.rst:4433 msgid "Mapping Types --- :class:`dict`" msgstr "" -#: ../../library/stdtypes.rst:4434 +#: ../../library/stdtypes.rst:4443 msgid "" "A :term:`mapping` object maps :term:`hashable` values to arbitrary objects. " "Mappings are mutable objects. There is currently only one standard mapping " @@ -6173,7 +6185,7 @@ msgid "" "module.)" msgstr "" -#: ../../library/stdtypes.rst:4440 +#: ../../library/stdtypes.rst:4449 msgid "" "A dictionary's keys are *almost* arbitrary values. Values that are not :" "term:`hashable`, that is, values containing lists, dictionaries or other " @@ -6182,33 +6194,33 @@ msgid "" "and ``True``) can be used interchangeably to index the same dictionary entry." msgstr "" -#: ../../library/stdtypes.rst:4451 +#: ../../library/stdtypes.rst:4460 msgid "" "Return a new dictionary initialized from an optional positional argument and " "a possibly empty set of keyword arguments." msgstr "" -#: ../../library/stdtypes.rst:4454 +#: ../../library/stdtypes.rst:4463 msgid "Dictionaries can be created by several means:" msgstr "" -#: ../../library/stdtypes.rst:4456 +#: ../../library/stdtypes.rst:4465 msgid "" "Use a comma-separated list of ``key: value`` pairs within braces: ``{'jack': " "4098, 'sjoerd': 4127}`` or ``{4098: 'jack', 4127: 'sjoerd'}``" msgstr "" -#: ../../library/stdtypes.rst:4458 +#: ../../library/stdtypes.rst:4467 msgid "Use a dict comprehension: ``{}``, ``{x: x ** 2 for x in range(10)}``" msgstr "" -#: ../../library/stdtypes.rst:4459 +#: ../../library/stdtypes.rst:4468 msgid "" "Use the type constructor: ``dict()``, ``dict([('foo', 100), ('bar', " "200)])``, ``dict(foo=100, bar=200)``" msgstr "" -#: ../../library/stdtypes.rst:4462 +#: ../../library/stdtypes.rst:4471 msgid "" "If no positional argument is given, an empty dictionary is created. If a " "positional argument is given and it is a mapping object, a dictionary is " @@ -6220,7 +6232,7 @@ msgid "" "value for that key becomes the corresponding value in the new dictionary." msgstr "" -#: ../../library/stdtypes.rst:4472 +#: ../../library/stdtypes.rst:4481 msgid "" "If keyword arguments are given, the keyword arguments and their values are " "added to the dictionary created from the positional argument. If a key " @@ -6228,13 +6240,13 @@ msgid "" "the value from the positional argument." msgstr "" -#: ../../library/stdtypes.rst:4477 +#: ../../library/stdtypes.rst:4486 msgid "" "To illustrate, the following examples all return a dictionary equal to " "``{\"one\": 1, \"two\": 2, \"three\": 3}``::" msgstr "" -#: ../../library/stdtypes.rst:4480 +#: ../../library/stdtypes.rst:4489 msgid "" ">>> a = dict(one=1, two=2, three=3)\n" ">>> b = {'one': 1, 'two': 2, 'three': 3}\n" @@ -6254,33 +6266,33 @@ msgstr "" ">>> a == b == c == d == e == f\n" "True" -#: ../../library/stdtypes.rst:4489 +#: ../../library/stdtypes.rst:4498 msgid "" "Providing keyword arguments as in the first example only works for keys that " "are valid Python identifiers. Otherwise, any valid keys can be used." msgstr "" -#: ../../library/stdtypes.rst:4493 +#: ../../library/stdtypes.rst:4502 msgid "" "These are the operations that dictionaries support (and therefore, custom " "mapping types should support too):" msgstr "" -#: ../../library/stdtypes.rst:4498 +#: ../../library/stdtypes.rst:4507 msgid "Return a list of all the keys used in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4502 +#: ../../library/stdtypes.rst:4511 msgid "Return the number of items in the dictionary *d*." msgstr "" -#: ../../library/stdtypes.rst:4506 +#: ../../library/stdtypes.rst:4515 msgid "" "Return the item of *d* with key *key*. Raises a :exc:`KeyError` if *key* is " "not in the map." msgstr "" -#: ../../library/stdtypes.rst:4511 +#: ../../library/stdtypes.rst:4520 msgid "" "If a subclass of dict defines a method :meth:`__missing__` and *key* is not " "present, the ``d[key]`` operation calls that method with the key *key* as " @@ -6291,7 +6303,7 @@ msgid "" "an instance variable::" msgstr "" -#: ../../library/stdtypes.rst:4519 +#: ../../library/stdtypes.rst:4528 msgid "" ">>> class Counter(dict):\n" "... def __missing__(self, key):\n" @@ -6315,51 +6327,51 @@ msgstr "" ">>> c['red']\n" "1" -#: ../../library/stdtypes.rst:4530 +#: ../../library/stdtypes.rst:4539 msgid "" "The example above shows part of the implementation of :class:`collections." "Counter`. A different ``__missing__`` method is used by :class:`collections." "defaultdict`." msgstr "" -#: ../../library/stdtypes.rst:4536 +#: ../../library/stdtypes.rst:4545 msgid "Set ``d[key]`` to *value*." msgstr "" -#: ../../library/stdtypes.rst:4540 +#: ../../library/stdtypes.rst:4549 msgid "" "Remove ``d[key]`` from *d*. Raises a :exc:`KeyError` if *key* is not in the " "map." msgstr "" -#: ../../library/stdtypes.rst:4545 +#: ../../library/stdtypes.rst:4554 msgid "Return ``True`` if *d* has a key *key*, else ``False``." msgstr "" -#: ../../library/stdtypes.rst:4549 +#: ../../library/stdtypes.rst:4558 msgid "Equivalent to ``not key in d``." msgstr "" -#: ../../library/stdtypes.rst:4553 +#: ../../library/stdtypes.rst:4562 msgid "" "Return an iterator over the keys of the dictionary. This is a shortcut for " "``iter(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4558 +#: ../../library/stdtypes.rst:4567 msgid "Remove all items from the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4562 +#: ../../library/stdtypes.rst:4571 msgid "Return a shallow copy of the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4566 +#: ../../library/stdtypes.rst:4575 msgid "" "Create a new dictionary with keys from *iterable* and values set to *value*." msgstr "" -#: ../../library/stdtypes.rst:4568 +#: ../../library/stdtypes.rst:4577 msgid "" ":meth:`fromkeys` is a class method that returns a new dictionary. *value* " "defaults to ``None``. All of the values refer to just a single instance, so " @@ -6368,70 +6380,70 @@ msgid "" "` instead." msgstr "" -#: ../../library/stdtypes.rst:4576 +#: ../../library/stdtypes.rst:4585 msgid "" "Return the value for *key* if *key* is in the dictionary, else *default*. If " "*default* is not given, it defaults to ``None``, so that this method never " "raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4582 +#: ../../library/stdtypes.rst:4591 msgid "" "Return a new view of the dictionary's items (``(key, value)`` pairs). See " "the :ref:`documentation of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4587 +#: ../../library/stdtypes.rst:4596 msgid "" "Return a new view of the dictionary's keys. See the :ref:`documentation of " "view objects `." msgstr "" -#: ../../library/stdtypes.rst:4592 +#: ../../library/stdtypes.rst:4601 msgid "" "If *key* is in the dictionary, remove it and return its value, else return " "*default*. If *default* is not given and *key* is not in the dictionary, a :" "exc:`KeyError` is raised." msgstr "" -#: ../../library/stdtypes.rst:4598 +#: ../../library/stdtypes.rst:4607 msgid "" "Remove and return a ``(key, value)`` pair from the dictionary. Pairs are " "returned in :abbr:`LIFO (last-in, first-out)` order." msgstr "" -#: ../../library/stdtypes.rst:4601 +#: ../../library/stdtypes.rst:4610 msgid "" ":meth:`popitem` is useful to destructively iterate over a dictionary, as " "often used in set algorithms. If the dictionary is empty, calling :meth:" "`popitem` raises a :exc:`KeyError`." msgstr "" -#: ../../library/stdtypes.rst:4605 +#: ../../library/stdtypes.rst:4614 msgid "" "LIFO order is now guaranteed. In prior versions, :meth:`popitem` would " "return an arbitrary key/value pair." msgstr "" -#: ../../library/stdtypes.rst:4611 +#: ../../library/stdtypes.rst:4620 msgid "" "Return a reverse iterator over the keys of the dictionary. This is a " "shortcut for ``reversed(d.keys())``." msgstr "" -#: ../../library/stdtypes.rst:4618 +#: ../../library/stdtypes.rst:4627 msgid "" "If *key* is in the dictionary, return its value. If not, insert *key* with " "a value of *default* and return *default*. *default* defaults to ``None``." msgstr "" -#: ../../library/stdtypes.rst:4624 +#: ../../library/stdtypes.rst:4633 msgid "" "Update the dictionary with the key/value pairs from *other*, overwriting " "existing keys. Return ``None``." msgstr "" -#: ../../library/stdtypes.rst:4627 +#: ../../library/stdtypes.rst:4636 msgid "" ":meth:`update` accepts either another dictionary object or an iterable of " "key/value pairs (as tuples or other iterables of length two). If keyword " @@ -6439,20 +6451,20 @@ msgid "" "pairs: ``d.update(red=1, blue=2)``." msgstr "" -#: ../../library/stdtypes.rst:4634 +#: ../../library/stdtypes.rst:4643 msgid "" "Return a new view of the dictionary's values. See the :ref:`documentation " "of view objects `." msgstr "" -#: ../../library/stdtypes.rst:4637 +#: ../../library/stdtypes.rst:4646 msgid "" "An equality comparison between one ``dict.values()`` view and another will " "always return ``False``. This also applies when comparing ``dict.values()`` " "to itself::" msgstr "" -#: ../../library/stdtypes.rst:4641 +#: ../../library/stdtypes.rst:4650 msgid "" ">>> d = {'a': 1}\n" ">>> d.values() == d.values()\n" @@ -6462,34 +6474,34 @@ msgstr "" ">>> d.values() == d.values()\n" "False" -#: ../../library/stdtypes.rst:4647 +#: ../../library/stdtypes.rst:4656 msgid "" "Create a new dictionary with the merged keys and values of *d* and *other*, " "which must both be dictionaries. The values of *other* take priority when " "*d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4655 +#: ../../library/stdtypes.rst:4664 msgid "" "Update the dictionary *d* with keys and values from *other*, which may be " "either a :term:`mapping` or an :term:`iterable` of key/value pairs. The " "values of *other* take priority when *d* and *other* share keys." msgstr "" -#: ../../library/stdtypes.rst:4661 +#: ../../library/stdtypes.rst:4670 msgid "" "Dictionaries compare equal if and only if they have the same ``(key, " "value)`` pairs (regardless of ordering). Order comparisons ('<', '<=', '>=', " "'>') raise :exc:`TypeError`." msgstr "" -#: ../../library/stdtypes.rst:4665 +#: ../../library/stdtypes.rst:4674 msgid "" "Dictionaries preserve insertion order. Note that updating a key does not " "affect the order. Keys added after deletion are inserted at the end. ::" msgstr "" -#: ../../library/stdtypes.rst:4668 +#: ../../library/stdtypes.rst:4677 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6521,17 +6533,17 @@ msgstr "" ">>> d\n" "{'one': 42, 'three': 3, 'four': 4, 'two': None}" -#: ../../library/stdtypes.rst:4683 +#: ../../library/stdtypes.rst:4692 msgid "" "Dictionary order is guaranteed to be insertion order. This behavior was an " "implementation detail of CPython from 3.6." msgstr "" -#: ../../library/stdtypes.rst:4687 +#: ../../library/stdtypes.rst:4696 msgid "Dictionaries and dictionary views are reversible. ::" msgstr "" -#: ../../library/stdtypes.rst:4689 +#: ../../library/stdtypes.rst:4698 msgid "" ">>> d = {\"one\": 1, \"two\": 2, \"three\": 3, \"four\": 4}\n" ">>> d\n" @@ -6553,21 +6565,21 @@ msgstr "" ">>> list(reversed(d.items()))\n" "[('four', 4), ('three', 3), ('two', 2), ('one', 1)]" -#: ../../library/stdtypes.rst:4699 +#: ../../library/stdtypes.rst:4708 msgid "Dictionaries are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4704 +#: ../../library/stdtypes.rst:4713 msgid "" ":class:`types.MappingProxyType` can be used to create a read-only view of a :" "class:`dict`." msgstr "" -#: ../../library/stdtypes.rst:4711 +#: ../../library/stdtypes.rst:4720 msgid "Dictionary view objects" msgstr "字典視圖物件" -#: ../../library/stdtypes.rst:4713 +#: ../../library/stdtypes.rst:4722 msgid "" "The objects returned by :meth:`dict.keys`, :meth:`dict.values` and :meth:" "`dict.items` are *view objects*. They provide a dynamic view on the " @@ -6575,23 +6587,23 @@ msgid "" "reflects these changes." msgstr "" -#: ../../library/stdtypes.rst:4718 +#: ../../library/stdtypes.rst:4727 msgid "" "Dictionary views can be iterated over to yield their respective data, and " "support membership tests:" msgstr "" -#: ../../library/stdtypes.rst:4723 +#: ../../library/stdtypes.rst:4732 msgid "Return the number of entries in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4727 +#: ../../library/stdtypes.rst:4736 msgid "" "Return an iterator over the keys, values or items (represented as tuples of " "``(key, value)``) in the dictionary." msgstr "" -#: ../../library/stdtypes.rst:4730 +#: ../../library/stdtypes.rst:4739 msgid "" "Keys and values are iterated over in insertion order. This allows the " "creation of ``(value, key)`` pairs using :func:`zip`: ``pairs = zip(d." @@ -6599,39 +6611,39 @@ msgid "" "[(v, k) for (k, v) in d.items()]``." msgstr "" -#: ../../library/stdtypes.rst:4735 +#: ../../library/stdtypes.rst:4744 msgid "" "Iterating views while adding or deleting entries in the dictionary may raise " "a :exc:`RuntimeError` or fail to iterate over all entries." msgstr "" -#: ../../library/stdtypes.rst:4738 +#: ../../library/stdtypes.rst:4747 msgid "Dictionary order is guaranteed to be insertion order." msgstr "" -#: ../../library/stdtypes.rst:4743 +#: ../../library/stdtypes.rst:4752 msgid "" "Return ``True`` if *x* is in the underlying dictionary's keys, values or " "items (in the latter case, *x* should be a ``(key, value)`` tuple)." msgstr "" -#: ../../library/stdtypes.rst:4748 +#: ../../library/stdtypes.rst:4757 msgid "" "Return a reverse iterator over the keys, values or items of the dictionary. " "The view will be iterated in reverse order of the insertion." msgstr "" -#: ../../library/stdtypes.rst:4751 +#: ../../library/stdtypes.rst:4760 msgid "Dictionary views are now reversible." msgstr "" -#: ../../library/stdtypes.rst:4756 +#: ../../library/stdtypes.rst:4765 msgid "" "Return a :class:`types.MappingProxyType` that wraps the original dictionary " "to which the view refers." msgstr "" -#: ../../library/stdtypes.rst:4761 +#: ../../library/stdtypes.rst:4770 msgid "" "Keys views are set-like since their entries are unique and :term:`hashable`. " "Items views also have set-like operations since the (key, value) pairs are " @@ -6645,11 +6657,11 @@ msgid "" "input." msgstr "" -#: ../../library/stdtypes.rst:4773 +#: ../../library/stdtypes.rst:4782 msgid "An example of dictionary view usage::" msgstr "" -#: ../../library/stdtypes.rst:4775 +#: ../../library/stdtypes.rst:4784 msgid "" ">>> dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}\n" ">>> keys = dishes.keys()\n" @@ -6690,11 +6702,11 @@ msgid "" "500" msgstr "" -#: ../../library/stdtypes.rst:4817 +#: ../../library/stdtypes.rst:4826 msgid "Context Manager Types" msgstr "情境管理器型別" -#: ../../library/stdtypes.rst:4824 +#: ../../library/stdtypes.rst:4833 msgid "" "Python's :keyword:`with` statement supports the concept of a runtime context " "defined by a context manager. This is implemented using a pair of methods " @@ -6705,7 +6717,7 @@ msgstr "" "要使用兩個方法來實作,該方法讓使用者定義類別能夠去定義 runtime 情境,且該情境" "在執行陳述式主體 (statement body) 之前進入、在陳述式結束時退出:" -#: ../../library/stdtypes.rst:4832 +#: ../../library/stdtypes.rst:4841 msgid "" "Enter the runtime context and return either this object or another object " "related to the runtime context. The value returned by this method is bound " @@ -6716,7 +6728,7 @@ msgstr "" "的值有被綁定到使用此情境管理器的 :keyword:`with` 陳述式的 :keyword:`!as` 子句" "中的識別字。" -#: ../../library/stdtypes.rst:4837 +#: ../../library/stdtypes.rst:4846 msgid "" "An example of a context manager that returns itself is a :term:`file " "object`. File objects return themselves from __enter__() to allow :func:" @@ -6725,7 +6737,7 @@ msgstr "" "一個會回傳自己的情境管理器範例是 :term:`file object`。檔案物件從 __enter__() " "回傳自己,以允許將 :func:`open` 用作 :keyword:`with` 陳述式中的情境運算式。" -#: ../../library/stdtypes.rst:4841 +#: ../../library/stdtypes.rst:4850 msgid "" "An example of a context manager that returns a related object is the one " "returned by :func:`decimal.localcontext`. These managers set the active " @@ -6739,7 +6751,7 @@ msgstr "" "本。這允許對 :keyword:`with` 陳述式主體中的當前十進位情境進行更改,而不會影" "響 :keyword:`!with` 陳述式外部的程式碼。" -#: ../../library/stdtypes.rst:4851 +#: ../../library/stdtypes.rst:4860 msgid "" "Exit the runtime context and return a Boolean flag indicating if any " "exception that occurred should be suppressed. If an exception occurred while " @@ -6751,7 +6763,7 @@ msgstr "" "keyword:`with` 陳述式主體時發生例外,則引數包含例外型別、值和回溯 " "(traceback) 資訊。否則,所有三個引數都是 ``None``。" -#: ../../library/stdtypes.rst:4856 +#: ../../library/stdtypes.rst:4865 msgid "" "Returning a true value from this method will cause the :keyword:`with` " "statement to suppress the exception and continue execution with the " @@ -6766,7 +6778,7 @@ msgstr "" "(propagate)。執行此方法期間發生的例外會取代 :keyword:`!with` 陳述式主體中發生" "的任何例外。" -#: ../../library/stdtypes.rst:4863 +#: ../../library/stdtypes.rst:4872 msgid "" "The exception passed in should never be reraised explicitly - instead, this " "method should return a false value to indicate that the method completed " @@ -6778,7 +6790,7 @@ msgstr "" "已成功完成且不希望抑制引發的例外。這讓情境管理程式碼能輕鬆檢測 :meth:" "`__exit__` 方法是否曾實際失敗過。" -#: ../../library/stdtypes.rst:4869 +#: ../../library/stdtypes.rst:4878 msgid "" "Python defines several context managers to support easy thread " "synchronisation, prompt closure of files or other objects, and simpler " @@ -6790,7 +6802,7 @@ msgstr "" "及對有效十進位算術情境的更簡單操作。除了情境管理協定的實作之外,不會對特定型" "別進行特殊處理。更多範例請參閱 :mod:`contextlib` 模組。" -#: ../../library/stdtypes.rst:4875 +#: ../../library/stdtypes.rst:4884 msgid "" "Python's :term:`generator`\\s and the :class:`contextlib.contextmanager` " "decorator provide a convenient way to implement these protocols. If a " @@ -6805,7 +6817,7 @@ msgstr "" "`~contextmanager.__enter__` 和 :meth:`~contextmanager.__exit__` 方法的情境管" "理器,而不是由未裝飾產生器函式產生的疊代器。" -#: ../../library/stdtypes.rst:4882 +#: ../../library/stdtypes.rst:4891 msgid "" "Note that there is no specific slot for any of these methods in the type " "structure for Python objects in the Python/C API. Extension types wanting to " @@ -6817,7 +6829,7 @@ msgstr "" "定義這些方法的擴充型別必須將它們作為普通的 Python 可存取方法提供。與設定 " "runtime 情境的開銷相比,單一類別字典查找的開銷可以忽略不計。" -#: ../../library/stdtypes.rst:4890 +#: ../../library/stdtypes.rst:4899 msgid "" "Type Annotation Types --- :ref:`Generic Alias `, :ref:" "`Union `" @@ -6825,7 +6837,7 @@ msgstr "" "型別註釋的型別 --- :ref:`泛型別名 (Generic Alias) `、:" "ref:`聯合 (Union) `" -#: ../../library/stdtypes.rst:4895 +#: ../../library/stdtypes.rst:4904 msgid "" "The core built-in types for :term:`type annotations ` are :ref:" "`Generic Alias ` and :ref:`Union `." @@ -6833,11 +6845,11 @@ msgstr "" ":term:`型別註釋 ` 的核心內建型別是\\ :ref:`泛型別名 `\\ 和\\ :ref:`聯合 `。" -#: ../../library/stdtypes.rst:4902 +#: ../../library/stdtypes.rst:4911 msgid "Generic Alias Type" msgstr "泛型別名型別" -#: ../../library/stdtypes.rst:4908 +#: ../../library/stdtypes.rst:4917 msgid "" "``GenericAlias`` objects are generally created by :ref:`subscripting " "` a class. They are most often used with :ref:`container " @@ -6852,7 +6864,7 @@ msgstr "" "物件,它是透過使用引數 :class:`int` 來下標 ``list`` 類別而建立的。" "``GenericAlias`` 物件主要會與\\ :term:`型別註釋 ` 一起使用。" -#: ../../library/stdtypes.rst:4918 +#: ../../library/stdtypes.rst:4927 msgid "" "It is generally only possible to subscript a class if the class implements " "the special method :meth:`~object.__class_getitem__`." @@ -6860,7 +6872,7 @@ msgstr "" "通常只有當類別有實作特殊方法 :meth:`~object.__class_getitem__` 時才可以去下標" "該類別。" -#: ../../library/stdtypes.rst:4921 +#: ../../library/stdtypes.rst:4930 msgid "" "A ``GenericAlias`` object acts as a proxy for a :term:`generic type`, " "implementing *parameterized generics*." @@ -6868,7 +6880,7 @@ msgstr "" "將一個 ``GenericAlias`` 物件用作 :term:`generic type` 的代理,實作\\ *參數化" "泛型 (parameterized generics)*。" -#: ../../library/stdtypes.rst:4924 +#: ../../library/stdtypes.rst:4933 msgid "" "For a container class, the argument(s) supplied to a :ref:`subscription " "` of the class may indicate the type(s) of the elements an " @@ -6880,7 +6892,7 @@ msgstr "" "物件所包含元素的型別。例如 ``set[bytes]`` 可以用於型別註釋來表示一個 :class:" "`set`,其中所有元素的型別都是 :class:`bytes`。" -#: ../../library/stdtypes.rst:4930 +#: ../../library/stdtypes.rst:4939 msgid "" "For a class which defines :meth:`~object.__class_getitem__` but is not a " "container, the argument(s) supplied to a subscription of the class will " @@ -6892,7 +6904,7 @@ msgstr "" "標引數通常會指示物件上有定義的一個或多個方法的回傳型別。例如\\ :mod:`正規表示" "式 `\\ 可以用於 :class:`str` 和 :class:`bytes` 資料型別:" -#: ../../library/stdtypes.rst:4936 +#: ../../library/stdtypes.rst:4945 msgid "" "If ``x = re.search('foo', 'foo')``, ``x`` will be a :ref:`re.Match ` object where the return values of ``x.group(0)`` and ``x[0]`` will " @@ -6904,7 +6916,7 @@ msgstr "" "別。我們就可以用 ``GenericAlias`` ``re.Match[str]`` 在型別註釋中表示這種物" "件。" -#: ../../library/stdtypes.rst:4942 +#: ../../library/stdtypes.rst:4951 msgid "" "If ``y = re.search(b'bar', b'bar')``, (note the ``b`` for :class:`bytes`), " "``y`` will also be an instance of ``re.Match``, but the return values of ``y." @@ -6917,7 +6929,7 @@ msgstr "" "別都是 :class:`bytes`。在型別註釋中,我們將用 ``re.Match[bytes]`` 來表示各" "種 :ref:`re.Match ` 物件。" -#: ../../library/stdtypes.rst:4948 +#: ../../library/stdtypes.rst:4957 msgid "" "``GenericAlias`` objects are instances of the class :class:`types." "GenericAlias`, which can also be used to create ``GenericAlias`` objects " @@ -6926,7 +6938,7 @@ msgstr "" "``GenericAlias`` 物件是 :class:`types.GenericAlias` 類別的實例,也可以用來直" "接建立 ``GenericAlias`` 物件。" -#: ../../library/stdtypes.rst:4954 +#: ../../library/stdtypes.rst:4963 msgid "" "Creates a ``GenericAlias`` representing a type ``T`` parameterized by types " "*X*, *Y*, and more depending on the ``T`` used. For example, a function " @@ -6936,7 +6948,7 @@ msgstr "" "所使用的 ``T``)來參數化。例如,一個函式需要一個包含 :class:`float` 元素的 :" "class:`list`: ::" -#: ../../library/stdtypes.rst:4959 +#: ../../library/stdtypes.rst:4968 msgid "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" @@ -6944,7 +6956,7 @@ msgstr "" "def average(values: list[float]) -> float:\n" " return sum(values) / len(values)" -#: ../../library/stdtypes.rst:4962 +#: ../../library/stdtypes.rst:4971 msgid "" "Another example for :term:`mapping` objects, using a :class:`dict`, which is " "a generic type expecting two type parameters representing the key type and " @@ -6955,7 +6967,7 @@ msgstr "" "別,需要兩個型別參數,分別表示鍵型別和值型別。在此範例中,函式需要一個 " "``dict``,其帶有 :class:`str` 型別的鍵和 :class:`int` 型別的值: ::" -#: ../../library/stdtypes.rst:4967 +#: ../../library/stdtypes.rst:4976 msgid "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." @@ -6963,7 +6975,7 @@ msgstr "" "def send_post_request(url: str, body: dict[str, int]) -> None:\n" " ..." -#: ../../library/stdtypes.rst:4970 +#: ../../library/stdtypes.rst:4979 msgid "" "The builtin functions :func:`isinstance` and :func:`issubclass` do not " "accept ``GenericAlias`` types for their second argument::" @@ -6971,7 +6983,7 @@ msgstr "" "內建函式 :func:`isinstance` 和 :func:`issubclass` 不接受 ``GenericAlias`` 型" "別作為第二個引數: ::" -#: ../../library/stdtypes.rst:4973 +#: ../../library/stdtypes.rst:4982 msgid "" ">>> isinstance([1, 2], list[str])\n" "Traceback (most recent call last):\n" @@ -6983,7 +6995,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: isinstance() argument 2 cannot be a parameterized generic" -#: ../../library/stdtypes.rst:4978 +#: ../../library/stdtypes.rst:4987 msgid "" "The Python runtime does not enforce :term:`type annotations `. " "This extends to generic types and their type parameters. When creating a " @@ -6995,7 +7007,7 @@ msgstr "" "及其型別參數。當從 ``GenericAlias`` 建立容器物件時,不會檢查容器中元素的型" "別。例如,不鼓勵使用以下程式碼,但 runtime 不會出現錯誤: ::" -#: ../../library/stdtypes.rst:4984 +#: ../../library/stdtypes.rst:4993 msgid "" ">>> t = list[str]\n" ">>> t([1, 2, 3])\n" @@ -7005,13 +7017,13 @@ msgstr "" ">>> t([1, 2, 3])\n" "[1, 2, 3]" -#: ../../library/stdtypes.rst:4988 +#: ../../library/stdtypes.rst:4997 msgid "" "Furthermore, parameterized generics erase type parameters during object " "creation::" msgstr "此外,參數化泛型在物件建立期間會擦除 (erase) 型別參數: ::" -#: ../../library/stdtypes.rst:4991 +#: ../../library/stdtypes.rst:5000 msgid "" ">>> t = list[str]\n" ">>> type(t)\n" @@ -7029,13 +7041,13 @@ msgstr "" ">>> type(l)\n" "" -#: ../../library/stdtypes.rst:4999 +#: ../../library/stdtypes.rst:5008 msgid "" "Calling :func:`repr` or :func:`str` on a generic shows the parameterized " "type::" msgstr "在泛型上呼叫 :func:`repr` 或 :func:`str` 會顯示參數化型別: ::" -#: ../../library/stdtypes.rst:5001 +#: ../../library/stdtypes.rst:5010 msgid "" ">>> repr(list[int])\n" "'list[int]'\n" @@ -7049,7 +7061,7 @@ msgstr "" ">>> str(list[int])\n" "'list[int]'" -#: ../../library/stdtypes.rst:5007 +#: ../../library/stdtypes.rst:5016 msgid "" "The :meth:`~object.__getitem__` method of generic containers will raise an " "exception to disallow mistakes like ``dict[str][str]``::" @@ -7057,7 +7069,7 @@ msgstr "" "為防止像是 ``dict[str][str]`` 的錯誤出現,泛型容器的 :meth:`~object." "__getitem__` 方法會在這種情況下引發例外: ::" -#: ../../library/stdtypes.rst:5010 +#: ../../library/stdtypes.rst:5019 msgid "" ">>> dict[str][str]\n" "Traceback (most recent call last):\n" @@ -7069,7 +7081,7 @@ msgstr "" " ...\n" "TypeError: dict[str] is not a generic class" -#: ../../library/stdtypes.rst:5015 +#: ../../library/stdtypes.rst:5024 msgid "" "However, such expressions are valid when :ref:`type variables ` " "are used. The index must have as many elements as there are type variable " @@ -7079,7 +7091,7 @@ msgstr "" "的。索引的元素數量必須與 ``GenericAlias`` 物件的 :attr:`~genericalias." "__args__` 中的型別變數項目一樣多: ::" -#: ../../library/stdtypes.rst:5019 +#: ../../library/stdtypes.rst:5028 msgid "" ">>> from typing import TypeVar\n" ">>> Y = TypeVar('Y')\n" @@ -7091,245 +7103,245 @@ msgstr "" ">>> dict[str, Y][int]\n" "dict[str, int]" -#: ../../library/stdtypes.rst:5026 +#: ../../library/stdtypes.rst:5035 msgid "Standard Generic Classes" msgstr "標準泛型類別" -#: ../../library/stdtypes.rst:5028 +#: ../../library/stdtypes.rst:5037 msgid "" "The following standard library classes support parameterized generics. This " "list is non-exhaustive." msgstr "以下標準函式庫類別有支援參數化泛型。此列表並非詳盡無遺。" -#: ../../library/stdtypes.rst:5031 +#: ../../library/stdtypes.rst:5040 msgid ":class:`tuple`" msgstr ":class:`tuple`" -#: ../../library/stdtypes.rst:5032 +#: ../../library/stdtypes.rst:5041 msgid ":class:`list`" msgstr ":class:`list`" -#: ../../library/stdtypes.rst:5033 +#: ../../library/stdtypes.rst:5042 msgid ":class:`dict`" msgstr ":class:`dict`" -#: ../../library/stdtypes.rst:5034 +#: ../../library/stdtypes.rst:5043 msgid ":class:`set`" msgstr ":class:`set`" -#: ../../library/stdtypes.rst:5035 +#: ../../library/stdtypes.rst:5044 msgid ":class:`frozenset`" msgstr ":class:`frozenset`" -#: ../../library/stdtypes.rst:5036 +#: ../../library/stdtypes.rst:5045 msgid ":class:`type`" msgstr ":class:`type`" -#: ../../library/stdtypes.rst:5037 +#: ../../library/stdtypes.rst:5046 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../library/stdtypes.rst:5038 +#: ../../library/stdtypes.rst:5047 msgid ":class:`collections.defaultdict`" msgstr ":class:`collections.defaultdict`" -#: ../../library/stdtypes.rst:5039 +#: ../../library/stdtypes.rst:5048 msgid ":class:`collections.OrderedDict`" msgstr ":class:`collections.OrderedDict`" -#: ../../library/stdtypes.rst:5040 +#: ../../library/stdtypes.rst:5049 msgid ":class:`collections.Counter`" msgstr ":class:`collections.Counter`" -#: ../../library/stdtypes.rst:5041 +#: ../../library/stdtypes.rst:5050 msgid ":class:`collections.ChainMap`" msgstr ":class:`collections.ChainMap`" -#: ../../library/stdtypes.rst:5042 +#: ../../library/stdtypes.rst:5051 msgid ":class:`collections.abc.Awaitable`" msgstr ":class:`collections.abc.Awaitable`" -#: ../../library/stdtypes.rst:5043 +#: ../../library/stdtypes.rst:5052 msgid ":class:`collections.abc.Coroutine`" msgstr ":class:`collections.abc.Coroutine`" -#: ../../library/stdtypes.rst:5044 +#: ../../library/stdtypes.rst:5053 msgid ":class:`collections.abc.AsyncIterable`" msgstr ":class:`collections.abc.AsyncIterable`" -#: ../../library/stdtypes.rst:5045 +#: ../../library/stdtypes.rst:5054 msgid ":class:`collections.abc.AsyncIterator`" msgstr ":class:`collections.abc.AsyncIterator`" -#: ../../library/stdtypes.rst:5046 +#: ../../library/stdtypes.rst:5055 msgid ":class:`collections.abc.AsyncGenerator`" msgstr ":class:`collections.abc.AsyncGenerator`" -#: ../../library/stdtypes.rst:5047 +#: ../../library/stdtypes.rst:5056 msgid ":class:`collections.abc.Iterable`" msgstr ":class:`collections.abc.Iterable`" -#: ../../library/stdtypes.rst:5048 +#: ../../library/stdtypes.rst:5057 msgid ":class:`collections.abc.Iterator`" msgstr ":class:`collections.abc.Iterator`" -#: ../../library/stdtypes.rst:5049 +#: ../../library/stdtypes.rst:5058 msgid ":class:`collections.abc.Generator`" msgstr ":class:`collections.abc.Generator`" -#: ../../library/stdtypes.rst:5050 +#: ../../library/stdtypes.rst:5059 msgid ":class:`collections.abc.Reversible`" msgstr ":class:`collections.abc.Reversible`" -#: ../../library/stdtypes.rst:5051 +#: ../../library/stdtypes.rst:5060 msgid ":class:`collections.abc.Container`" msgstr ":class:`collections.abc.Container`" -#: ../../library/stdtypes.rst:5052 +#: ../../library/stdtypes.rst:5061 msgid ":class:`collections.abc.Collection`" msgstr ":class:`collections.abc.Collection`" -#: ../../library/stdtypes.rst:5053 +#: ../../library/stdtypes.rst:5062 msgid ":class:`collections.abc.Callable`" msgstr ":class:`collections.abc.Callable`" -#: ../../library/stdtypes.rst:5054 +#: ../../library/stdtypes.rst:5063 msgid ":class:`collections.abc.Set`" msgstr ":class:`collections.abc.Set`" -#: ../../library/stdtypes.rst:5055 +#: ../../library/stdtypes.rst:5064 msgid ":class:`collections.abc.MutableSet`" msgstr ":class:`collections.abc.MutableSet`" -#: ../../library/stdtypes.rst:5056 +#: ../../library/stdtypes.rst:5065 msgid ":class:`collections.abc.Mapping`" msgstr ":class:`collections.abc.Mapping`" -#: ../../library/stdtypes.rst:5057 +#: ../../library/stdtypes.rst:5066 msgid ":class:`collections.abc.MutableMapping`" msgstr ":class:`collections.abc.MutableMapping`" -#: ../../library/stdtypes.rst:5058 +#: ../../library/stdtypes.rst:5067 msgid ":class:`collections.abc.Sequence`" msgstr ":class:`collections.abc.Sequence`" -#: ../../library/stdtypes.rst:5059 +#: ../../library/stdtypes.rst:5068 msgid ":class:`collections.abc.MutableSequence`" msgstr ":class:`collections.abc.MutableSequence`" -#: ../../library/stdtypes.rst:5060 +#: ../../library/stdtypes.rst:5069 msgid ":class:`collections.abc.ByteString`" msgstr ":class:`collections.abc.ByteString`" -#: ../../library/stdtypes.rst:5061 +#: ../../library/stdtypes.rst:5070 msgid ":class:`collections.abc.MappingView`" msgstr ":class:`collections.abc.MappingView`" -#: ../../library/stdtypes.rst:5062 +#: ../../library/stdtypes.rst:5071 msgid ":class:`collections.abc.KeysView`" msgstr ":class:`collections.abc.KeysView`" -#: ../../library/stdtypes.rst:5063 +#: ../../library/stdtypes.rst:5072 msgid ":class:`collections.abc.ItemsView`" msgstr ":class:`collections.abc.ItemsView`" -#: ../../library/stdtypes.rst:5064 +#: ../../library/stdtypes.rst:5073 msgid ":class:`collections.abc.ValuesView`" msgstr ":class:`collections.abc.ValuesView`" -#: ../../library/stdtypes.rst:5065 +#: ../../library/stdtypes.rst:5074 msgid ":class:`contextlib.AbstractContextManager`" msgstr ":class:`contextlib.AbstractContextManager`" -#: ../../library/stdtypes.rst:5066 +#: ../../library/stdtypes.rst:5075 msgid ":class:`contextlib.AbstractAsyncContextManager`" msgstr ":class:`contextlib.AbstractAsyncContextManager`" -#: ../../library/stdtypes.rst:5067 +#: ../../library/stdtypes.rst:5076 msgid ":class:`dataclasses.Field`" msgstr ":class:`dataclasses.Field`" -#: ../../library/stdtypes.rst:5068 +#: ../../library/stdtypes.rst:5077 msgid ":class:`functools.cached_property`" msgstr ":class:`functools.cached_property`" -#: ../../library/stdtypes.rst:5069 +#: ../../library/stdtypes.rst:5078 msgid ":class:`functools.partialmethod`" msgstr ":class:`functools.partialmethod`" -#: ../../library/stdtypes.rst:5070 +#: ../../library/stdtypes.rst:5079 msgid ":class:`os.PathLike`" msgstr ":class:`os.PathLike`" -#: ../../library/stdtypes.rst:5071 +#: ../../library/stdtypes.rst:5080 msgid ":class:`queue.LifoQueue`" msgstr ":class:`queue.LifoQueue`" -#: ../../library/stdtypes.rst:5072 +#: ../../library/stdtypes.rst:5081 msgid ":class:`queue.Queue`" msgstr ":class:`queue.Queue`" -#: ../../library/stdtypes.rst:5073 +#: ../../library/stdtypes.rst:5082 msgid ":class:`queue.PriorityQueue`" msgstr ":class:`queue.PriorityQueue`" -#: ../../library/stdtypes.rst:5074 +#: ../../library/stdtypes.rst:5083 msgid ":class:`queue.SimpleQueue`" msgstr ":class:`queue.SimpleQueue`" -#: ../../library/stdtypes.rst:5075 +#: ../../library/stdtypes.rst:5084 msgid ":ref:`re.Pattern `" msgstr ":ref:`re.Pattern `" -#: ../../library/stdtypes.rst:5076 +#: ../../library/stdtypes.rst:5085 msgid ":ref:`re.Match `" msgstr ":ref:`re.Match `" -#: ../../library/stdtypes.rst:5077 +#: ../../library/stdtypes.rst:5086 msgid ":class:`shelve.BsdDbShelf`" msgstr ":class:`shelve.BsdDbShelf`" -#: ../../library/stdtypes.rst:5078 +#: ../../library/stdtypes.rst:5087 msgid ":class:`shelve.DbfilenameShelf`" msgstr ":class:`shelve.DbfilenameShelf`" -#: ../../library/stdtypes.rst:5079 +#: ../../library/stdtypes.rst:5088 msgid ":class:`shelve.Shelf`" msgstr ":class:`shelve.Shelf`" -#: ../../library/stdtypes.rst:5080 +#: ../../library/stdtypes.rst:5089 msgid ":class:`types.MappingProxyType`" msgstr ":class:`types.MappingProxyType`" -#: ../../library/stdtypes.rst:5081 +#: ../../library/stdtypes.rst:5090 msgid ":class:`weakref.WeakKeyDictionary`" msgstr ":class:`weakref.WeakKeyDictionary`" -#: ../../library/stdtypes.rst:5082 +#: ../../library/stdtypes.rst:5091 msgid ":class:`weakref.WeakMethod`" msgstr ":class:`weakref.WeakMethod`" -#: ../../library/stdtypes.rst:5083 +#: ../../library/stdtypes.rst:5092 msgid ":class:`weakref.WeakSet`" msgstr ":class:`weakref.WeakSet`" -#: ../../library/stdtypes.rst:5084 +#: ../../library/stdtypes.rst:5093 msgid ":class:`weakref.WeakValueDictionary`" msgstr ":class:`weakref.WeakValueDictionary`" -#: ../../library/stdtypes.rst:5089 +#: ../../library/stdtypes.rst:5098 msgid "Special Attributes of ``GenericAlias`` objects" msgstr "``GenericAlias`` 物件的特殊屬性" -#: ../../library/stdtypes.rst:5091 +#: ../../library/stdtypes.rst:5100 msgid "All parameterized generics implement special read-only attributes." msgstr "所有參數化泛型都有實作特殊的唯讀屬性。" -#: ../../library/stdtypes.rst:5095 +#: ../../library/stdtypes.rst:5104 msgid "This attribute points at the non-parameterized generic class::" msgstr "此屬性指向非參數化泛型類別: ::" -#: ../../library/stdtypes.rst:5097 +#: ../../library/stdtypes.rst:5106 msgid "" ">>> list[int].__origin__\n" "" @@ -7337,7 +7349,7 @@ msgstr "" ">>> list[int].__origin__\n" "" -#: ../../library/stdtypes.rst:5103 +#: ../../library/stdtypes.rst:5112 msgid "" "This attribute is a :class:`tuple` (possibly of length 1) of generic types " "passed to the original :meth:`~object.__class_getitem__` of the generic " @@ -7346,7 +7358,7 @@ msgstr "" "此屬性是傳遞給泛型類別之原始 :meth:`~object.__class_getitem__` 的泛型型別 :" "class:`tuple`\\ (長度可以為 1): ::" -#: ../../library/stdtypes.rst:5107 +#: ../../library/stdtypes.rst:5116 msgid "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" @@ -7354,7 +7366,7 @@ msgstr "" ">>> dict[str, list[int]].__args__\n" "(, list[int])" -#: ../../library/stdtypes.rst:5113 +#: ../../library/stdtypes.rst:5122 msgid "" "This attribute is a lazily computed tuple (possibly empty) of unique type " "variables found in ``__args__``::" @@ -7362,7 +7374,7 @@ msgstr "" "此屬性是個會被延遲計算 (lazily computed) 的元組(可能為空),包含了在 " "``__args__`` 中找得到的不重複型別變數: ::" -#: ../../library/stdtypes.rst:5116 +#: ../../library/stdtypes.rst:5125 msgid "" ">>> from typing import TypeVar\n" "\n" @@ -7376,7 +7388,7 @@ msgstr "" ">>> list[T].__parameters__\n" "(~T,)" -#: ../../library/stdtypes.rst:5124 +#: ../../library/stdtypes.rst:5133 msgid "" "A ``GenericAlias`` object with :class:`typing.ParamSpec` parameters may not " "have correct ``__parameters__`` after substitution because :class:`typing." @@ -7386,7 +7398,7 @@ msgstr "" "有正確的 ``__parameters__``,因為 :class:`typing.ParamSpec` 主要用於靜態型別" "檢查。" -#: ../../library/stdtypes.rst:5131 +#: ../../library/stdtypes.rst:5140 msgid "" "A boolean that is true if the alias has been unpacked using the ``*`` " "operator (see :data:`~typing.TypeVarTuple`)." @@ -7394,19 +7406,19 @@ msgstr "" "如果別名已使用 ``*`` 運算子解包 (unpack) 則為 true 的布林值(請參閱 :data:" "`~typing.TypeVarTuple`\\ )。" -#: ../../library/stdtypes.rst:5139 +#: ../../library/stdtypes.rst:5148 msgid ":pep:`484` - Type Hints" msgstr ":pep:`484` - 型別提示" -#: ../../library/stdtypes.rst:5140 +#: ../../library/stdtypes.rst:5149 msgid "Introducing Python's framework for type annotations." msgstr "引入 Python 的型別註釋框架。" -#: ../../library/stdtypes.rst:5142 +#: ../../library/stdtypes.rst:5151 msgid ":pep:`585` - Type Hinting Generics In Standard Collections" msgstr ":pep:`585` - 標準集合 (Standard Collections) 中的型別提示泛型" -#: ../../library/stdtypes.rst:5143 +#: ../../library/stdtypes.rst:5152 msgid "" "Introducing the ability to natively parameterize standard-library classes, " "provided they implement the special class method :meth:`~object." @@ -7415,7 +7427,7 @@ msgstr "" "引入原生參數化標準函式庫類別的能力,前提是它們有實作特殊的類別方法 :meth:" "`~object.__class_getitem__`。" -#: ../../library/stdtypes.rst:5147 +#: ../../library/stdtypes.rst:5156 msgid "" ":ref:`Generics`, :ref:`user-defined generics ` and :" "class:`typing.Generic`" @@ -7423,18 +7435,18 @@ msgstr "" ":ref:`Generics`、:ref:`使用者定義泛型 `\\ 和 :class:" "`typing.Generic`" -#: ../../library/stdtypes.rst:5148 +#: ../../library/stdtypes.rst:5157 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" "有關如何實作可以在 runtime 參數化並能被靜態型別檢查器理解的泛型類別的文件。" -#: ../../library/stdtypes.rst:5157 +#: ../../library/stdtypes.rst:5166 msgid "Union Type" msgstr "聯合型別 (Union Type)" -#: ../../library/stdtypes.rst:5163 +#: ../../library/stdtypes.rst:5172 msgid "" "A union object holds the value of the ``|`` (bitwise or) operation on " "multiple :ref:`type objects `. These types are intended " @@ -7447,7 +7459,7 @@ msgstr "" "釋 (type annotation) `。與 :data:`typing.Union` 相比,聯合型別運" "算式可以讓型別提示語法更清晰簡潔。" -#: ../../library/stdtypes.rst:5170 +#: ../../library/stdtypes.rst:5179 msgid "" "Defines a union object which holds types *X*, *Y*, and so forth. ``X | Y`` " "means either X or Y. It is equivalent to ``typing.Union[X, Y]``. For " @@ -7458,7 +7470,7 @@ msgstr "" "``typing.Union[X, Y]``。舉例來說,下列函式需要一個型別為 :class:`int` 或 :" "class:`float` 的引數: ::" -#: ../../library/stdtypes.rst:5175 +#: ../../library/stdtypes.rst:5184 msgid "" "def square(number: int | float) -> int | float:\n" " return number ** 2" @@ -7466,7 +7478,7 @@ msgstr "" "def square(number: int | float) -> int | float:\n" " return number ** 2" -#: ../../library/stdtypes.rst:5180 +#: ../../library/stdtypes.rst:5189 msgid "" "The ``|`` operand cannot be used at runtime to define unions where one or " "more members is a forward reference. For example, ``int | \"Foo\"``, where " @@ -7479,58 +7491,58 @@ msgstr "" "義類別的參照,將在 runtime 失敗。對於包含向前參照的聯合,請將整個運算式以字串" "呈現,例如 ``\"int | Foo\"``。" -#: ../../library/stdtypes.rst:5188 +#: ../../library/stdtypes.rst:5197 msgid "" "Union objects can be tested for equality with other union objects. Details:" msgstr "聯合物件可以與其他聯合物件一起進行相等性測試。細節如下:" -#: ../../library/stdtypes.rst:5190 +#: ../../library/stdtypes.rst:5199 msgid "Unions of unions are flattened::" msgstr "聯合的聯合會被扁平化: ::" -#: ../../library/stdtypes.rst:5192 +#: ../../library/stdtypes.rst:5201 msgid "(int | str) | float == int | str | float" msgstr "(int | str) | float == int | str | float" -#: ../../library/stdtypes.rst:5194 +#: ../../library/stdtypes.rst:5203 msgid "Redundant types are removed::" msgstr "冗餘型別會被刪除: ::" -#: ../../library/stdtypes.rst:5196 +#: ../../library/stdtypes.rst:5205 msgid "int | str | int == int | str" msgstr "int | str | int == int | str" -#: ../../library/stdtypes.rst:5198 +#: ../../library/stdtypes.rst:5207 msgid "When comparing unions, the order is ignored::" msgstr "比較聯合時,順序會被忽略: ::" -#: ../../library/stdtypes.rst:5200 +#: ../../library/stdtypes.rst:5209 msgid "int | str == str | int" msgstr "int | str == str | int" -#: ../../library/stdtypes.rst:5202 +#: ../../library/stdtypes.rst:5211 msgid "It is compatible with :data:`typing.Union`::" msgstr "它與 :data:`typing.Union` 相容: ::" -#: ../../library/stdtypes.rst:5204 +#: ../../library/stdtypes.rst:5213 msgid "int | str == typing.Union[int, str]" msgstr "int | str == typing.Union[int, str]" -#: ../../library/stdtypes.rst:5206 +#: ../../library/stdtypes.rst:5215 msgid "Optional types can be spelled as a union with ``None``::" msgstr "可選型別可以表示為與 ``None`` 的聯合: ::" -#: ../../library/stdtypes.rst:5208 +#: ../../library/stdtypes.rst:5217 msgid "str | None == typing.Optional[str]" msgstr "str | None == typing.Optional[str]" -#: ../../library/stdtypes.rst:5213 +#: ../../library/stdtypes.rst:5222 msgid "" "Calls to :func:`isinstance` and :func:`issubclass` are also supported with a " "union object::" msgstr "聯合物件也支援 :func:`isinstance` 和 :func:`issubclass` 的呼叫: ::" -#: ../../library/stdtypes.rst:5216 +#: ../../library/stdtypes.rst:5225 msgid "" ">>> isinstance(\"\", int | str)\n" "True" @@ -7538,14 +7550,14 @@ msgstr "" ">>> isinstance(\"\", int | str)\n" "True" -#: ../../library/stdtypes.rst:5219 +#: ../../library/stdtypes.rst:5228 msgid "" "However, :ref:`parameterized generics ` in union objects " "cannot be checked::" msgstr "" "然而聯合物件中的\\ :ref:`參數化泛型 `\\ 則無法被檢查: ::" -#: ../../library/stdtypes.rst:5222 +#: ../../library/stdtypes.rst:5231 msgid "" ">>> isinstance(1, int | list[int]) # short-circuit evaluation\n" "True\n" @@ -7555,7 +7567,7 @@ msgid "" "TypeError: isinstance() argument 2 cannot be a parameterized generic" msgstr "" -#: ../../library/stdtypes.rst:5229 +#: ../../library/stdtypes.rst:5238 msgid "" "The user-exposed type for the union object can be accessed from :data:`types." "UnionType` and used for :func:`isinstance` checks. An object cannot be " @@ -7564,7 +7576,7 @@ msgstr "" "構成聯合物件的對使用者公開型別 (user-exposed type) 可以透過 :data:`types." "UnionType` 存取並用於 :func:`isinstance` 檢查。物件不能以型別來實例化: ::" -#: ../../library/stdtypes.rst:5233 +#: ../../library/stdtypes.rst:5242 msgid "" ">>> import types\n" ">>> isinstance(int | str, types.UnionType)\n" @@ -7582,7 +7594,7 @@ msgstr "" " File \"\", line 1, in \n" "TypeError: cannot create 'types.UnionType' instances" -#: ../../library/stdtypes.rst:5242 +#: ../../library/stdtypes.rst:5251 msgid "" "The :meth:`!__or__` method for type objects was added to support the syntax " "``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may " @@ -7591,7 +7603,7 @@ msgstr "" "新增了型別物件的 :meth:`!__or__` 方法來支援 ``X | Y`` 語法。如果元類別有實" "作 :meth:`!__or__`,則 Union 可以覆寫 (override) 它: ::" -#: ../../library/stdtypes.rst:5246 +#: ../../library/stdtypes.rst:5255 msgid "" ">>> class M(type):\n" "... def __or__(self, other):\n" @@ -7617,25 +7629,25 @@ msgstr "" ">>> int | C\n" "int | C" -#: ../../library/stdtypes.rst:5262 +#: ../../library/stdtypes.rst:5271 msgid ":pep:`604` -- PEP proposing the ``X | Y`` syntax and the Union type." msgstr ":pep:`604` -- PEP 提出 ``X | Y`` 語法和聯合型別。" -#: ../../library/stdtypes.rst:5270 +#: ../../library/stdtypes.rst:5279 msgid "Other Built-in Types" msgstr "" -#: ../../library/stdtypes.rst:5272 +#: ../../library/stdtypes.rst:5281 msgid "" "The interpreter supports several other kinds of objects. Most of these " "support only one or two operations." msgstr "" -#: ../../library/stdtypes.rst:5279 +#: ../../library/stdtypes.rst:5288 msgid "Modules" msgstr "模組" -#: ../../library/stdtypes.rst:5281 +#: ../../library/stdtypes.rst:5290 msgid "" "The only special operation on a module is attribute access: ``m.name``, " "where *m* is a module and *name* accesses a name defined in *m*'s symbol " @@ -7646,7 +7658,7 @@ msgid "" "*foo* somewhere.)" msgstr "" -#: ../../library/stdtypes.rst:5288 +#: ../../library/stdtypes.rst:5297 msgid "" "A special attribute of every module is :attr:`~object.__dict__`. This is the " "dictionary containing the module's symbol table. Modifying this dictionary " @@ -7657,32 +7669,32 @@ msgid "" "recommended." msgstr "" -#: ../../library/stdtypes.rst:5296 +#: ../../library/stdtypes.rst:5305 msgid "" -"Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." +"Modules built into the interpreter are written like this: ````. If loaded from a file, they are written as ````." msgstr "" -#: ../../library/stdtypes.rst:5304 +#: ../../library/stdtypes.rst:5313 msgid "Classes and Class Instances" msgstr "" -#: ../../library/stdtypes.rst:5306 +#: ../../library/stdtypes.rst:5315 msgid "See :ref:`objects` and :ref:`class` for these." msgstr "" -#: ../../library/stdtypes.rst:5312 +#: ../../library/stdtypes.rst:5321 msgid "Functions" msgstr "函式" -#: ../../library/stdtypes.rst:5314 +#: ../../library/stdtypes.rst:5323 msgid "" "Function objects are created by function definitions. The only operation on " "a function object is to call it: ``func(argument-list)``." msgstr "" -#: ../../library/stdtypes.rst:5317 +#: ../../library/stdtypes.rst:5326 msgid "" "There are really two flavors of function objects: built-in functions and " "user-defined functions. Both support the same operation (to call the " @@ -7690,15 +7702,15 @@ msgid "" "types." msgstr "" -#: ../../library/stdtypes.rst:5321 +#: ../../library/stdtypes.rst:5330 msgid "See :ref:`function` for more information." msgstr "更多資訊請見 :ref:`function`。" -#: ../../library/stdtypes.rst:5327 +#: ../../library/stdtypes.rst:5336 msgid "Methods" msgstr "" -#: ../../library/stdtypes.rst:5331 +#: ../../library/stdtypes.rst:5340 msgid "" "Methods are functions that are called using the attribute notation. There " "are two flavors: :ref:`built-in methods ` (such as :meth:" @@ -7706,7 +7718,7 @@ msgid "" "Built-in methods are described with the types that support them." msgstr "" -#: ../../library/stdtypes.rst:5336 +#: ../../library/stdtypes.rst:5345 msgid "" "If you access a method (a function defined in a class namespace) through an " "instance, you get a special object: a :dfn:`bound method` (also called :ref:" @@ -7719,7 +7731,7 @@ msgid "" "arg-2, ..., arg-n)``." msgstr "" -#: ../../library/stdtypes.rst:5347 +#: ../../library/stdtypes.rst:5356 msgid "" "Like :ref:`function objects `, bound method objects " "support getting arbitrary attributes. However, since method attributes are " @@ -7730,7 +7742,7 @@ msgid "" "underlying function object:" msgstr "" -#: ../../library/stdtypes.rst:5355 +#: ../../library/stdtypes.rst:5364 msgid "" ">>> class C:\n" "... def method(self):\n" @@ -7758,15 +7770,15 @@ msgstr "" ">>> c.method.whoami\n" "'my name is method'" -#: ../../library/stdtypes.rst:5370 +#: ../../library/stdtypes.rst:5379 msgid "See :ref:`instance-methods` for more information." msgstr "更多資訊請見 :ref:`instance-methods`。" -#: ../../library/stdtypes.rst:5378 +#: ../../library/stdtypes.rst:5387 msgid "Code Objects" msgstr "" -#: ../../library/stdtypes.rst:5384 +#: ../../library/stdtypes.rst:5393 msgid "" "Code objects are used by the implementation to represent \"pseudo-compiled\" " "executable Python code such as a function body. They differ from function " @@ -7776,7 +7788,7 @@ msgid "" "`~function.__code__` attribute. See also the :mod:`code` module." msgstr "" -#: ../../library/stdtypes.rst:5391 +#: ../../library/stdtypes.rst:5400 msgid "" "Accessing :attr:`~function.__code__` raises an :ref:`auditing event " "` ``object.__getattr__`` with arguments ``obj`` and " @@ -7785,21 +7797,21 @@ msgstr "" "存取 :attr:`~function.__code__` 會引發一個附帶引數 ``obj`` 與 " "``\"__code__\"`` 的\\ :ref:`稽核事件 ` ``object.__getattr__``。" -#: ../../library/stdtypes.rst:5398 +#: ../../library/stdtypes.rst:5407 msgid "" "A code object can be executed or evaluated by passing it (instead of a " "source string) to the :func:`exec` or :func:`eval` built-in functions." msgstr "" -#: ../../library/stdtypes.rst:5401 +#: ../../library/stdtypes.rst:5410 msgid "See :ref:`types` for more information." msgstr "更多資訊請見 :ref:`types`。" -#: ../../library/stdtypes.rst:5407 +#: ../../library/stdtypes.rst:5416 msgid "Type Objects" msgstr "" -#: ../../library/stdtypes.rst:5413 +#: ../../library/stdtypes.rst:5422 msgid "" "Type objects represent the various object types. An object's type is " "accessed by the built-in function :func:`type`. There are no special " @@ -7807,30 +7819,30 @@ msgid "" "standard built-in types." msgstr "" -#: ../../library/stdtypes.rst:5418 +#: ../../library/stdtypes.rst:5427 msgid "Types are written like this: ````." msgstr "" -#: ../../library/stdtypes.rst:5424 +#: ../../library/stdtypes.rst:5433 msgid "The Null Object" msgstr "" -#: ../../library/stdtypes.rst:5426 +#: ../../library/stdtypes.rst:5435 msgid "" "This object is returned by functions that don't explicitly return a value. " "It supports no special operations. There is exactly one null object, named " "``None`` (a built-in name). ``type(None)()`` produces the same singleton." msgstr "" -#: ../../library/stdtypes.rst:5430 +#: ../../library/stdtypes.rst:5439 msgid "It is written as ``None``." msgstr "它被寫為 ``None``。" -#: ../../library/stdtypes.rst:5437 +#: ../../library/stdtypes.rst:5446 msgid "The Ellipsis Object" msgstr "" -#: ../../library/stdtypes.rst:5439 +#: ../../library/stdtypes.rst:5448 msgid "" "This object is commonly used by slicing (see :ref:`slicings`). It supports " "no special operations. There is exactly one ellipsis object, named :const:" @@ -7838,15 +7850,15 @@ msgid "" "`Ellipsis` singleton." msgstr "" -#: ../../library/stdtypes.rst:5444 +#: ../../library/stdtypes.rst:5453 msgid "It is written as ``Ellipsis`` or ``...``." msgstr "它被寫為 ``Ellipsis`` 或 ``...``。" -#: ../../library/stdtypes.rst:5450 +#: ../../library/stdtypes.rst:5459 msgid "The NotImplemented Object" msgstr "NotImplemented 物件" -#: ../../library/stdtypes.rst:5452 +#: ../../library/stdtypes.rst:5461 msgid "" "This object is returned from comparisons and binary operations when they are " "asked to operate on types they don't support. See :ref:`comparisons` for " @@ -7854,98 +7866,64 @@ msgid "" "`type(NotImplemented)()` produces the singleton instance." msgstr "" -#: ../../library/stdtypes.rst:5457 +#: ../../library/stdtypes.rst:5466 msgid "It is written as :code:`NotImplemented`." msgstr "" -#: ../../library/stdtypes.rst:5463 +#: ../../library/stdtypes.rst:5472 msgid "Internal Objects" msgstr "" -#: ../../library/stdtypes.rst:5465 +#: ../../library/stdtypes.rst:5474 msgid "" "See :ref:`types` for this information. It describes :ref:`stack frame " "objects `, :ref:`traceback objects `, and " "slice objects." msgstr "" -#: ../../library/stdtypes.rst:5473 +#: ../../library/stdtypes.rst:5482 msgid "Special Attributes" msgstr "特殊屬性" -#: ../../library/stdtypes.rst:5475 +#: ../../library/stdtypes.rst:5484 msgid "" "The implementation adds a few special read-only attributes to several object " "types, where they are relevant. Some of these are not reported by the :func:" "`dir` built-in function." msgstr "" -#: ../../library/stdtypes.rst:5482 -msgid "" -"A dictionary or other mapping object used to store an object's (writable) " -"attributes." -msgstr "" - -#: ../../library/stdtypes.rst:5488 -msgid "The class to which a class instance belongs." -msgstr "" - -#: ../../library/stdtypes.rst:5493 -msgid "The tuple of base classes of a class object." -msgstr "" - -#: ../../library/stdtypes.rst:5498 +#: ../../library/stdtypes.rst:5491 msgid "" "The name of the class, function, method, descriptor, or generator instance." msgstr "" -#: ../../library/stdtypes.rst:5504 +#: ../../library/stdtypes.rst:5497 msgid "" "The :term:`qualified name` of the class, function, method, descriptor, or " "generator instance." msgstr "" -#: ../../library/stdtypes.rst:5512 -msgid "" -"The :ref:`type parameters ` of generic classes, functions, and :" -"ref:`type aliases `." +#: ../../library/stdtypes.rst:5505 +msgid "The name of the module in which a class or function was defined." msgstr "" -#: ../../library/stdtypes.rst:5520 +#: ../../library/stdtypes.rst:5510 msgid "" -"This attribute is a tuple of classes that are considered when looking for " -"base classes during method resolution." +"The documentation string of a class or function, or ``None`` if undefined." msgstr "" -#: ../../library/stdtypes.rst:5526 +#: ../../library/stdtypes.rst:5515 msgid "" -"This method can be overridden by a metaclass to customize the method " -"resolution order for its instances. It is called at class instantiation, " -"and its result is stored in :attr:`~class.__mro__`." -msgstr "" - -#: ../../library/stdtypes.rst:5533 -msgid "" -"Each class keeps a list of weak references to its immediate subclasses. " -"This method returns a list of all those references still alive. The list is " -"in definition order. Example::" -msgstr "" - -#: ../../library/stdtypes.rst:5537 -msgid "" -">>> int.__subclasses__()\n" -"[, , , ]" +"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 "" -">>> int.__subclasses__()\n" -"[, , , ]" -#: ../../library/stdtypes.rst:5544 +#: ../../library/stdtypes.rst:5525 msgid "Integer string conversion length limitation" msgstr "" -#: ../../library/stdtypes.rst:5546 +#: ../../library/stdtypes.rst:5527 msgid "" "CPython has a global limit for converting between :class:`int` and :class:" "`str` to mitigate denial of service attacks. This limit *only* applies to " @@ -7953,7 +7931,7 @@ msgid "" "binary conversions are unlimited. The limit can be configured." msgstr "" -#: ../../library/stdtypes.rst:5551 +#: ../../library/stdtypes.rst:5532 msgid "" "The :class:`int` type in CPython is an arbitrary length number stored in " "binary form (commonly known as a \"bignum\"). There exists no algorithm that " @@ -7963,24 +7941,24 @@ msgid "" "value such as ``int('1' * 500_000)`` can take over a second on a fast CPU." msgstr "" -#: ../../library/stdtypes.rst:5558 +#: ../../library/stdtypes.rst:5539 msgid "" "Limiting conversion size offers a practical way to avoid :cve:`2020-10735`." msgstr "" -#: ../../library/stdtypes.rst:5560 +#: ../../library/stdtypes.rst:5541 msgid "" "The limit is applied to the number of digit characters in the input or " "output string when a non-linear conversion algorithm would be involved. " "Underscores and the sign are not counted towards the limit." msgstr "" -#: ../../library/stdtypes.rst:5564 +#: ../../library/stdtypes.rst:5545 msgid "" "When an operation would exceed the limit, a :exc:`ValueError` is raised:" msgstr "" -#: ../../library/stdtypes.rst:5566 +#: ../../library/stdtypes.rst:5547 msgid "" ">>> import sys\n" ">>> sys.set_int_max_str_digits(4300) # Illustrative, this is the default.\n" @@ -8004,7 +7982,7 @@ msgid "" ">>> assert int(hex(i_squared), base=16) == i*i # Hexadecimal is unlimited." msgstr "" -#: ../../library/stdtypes.rst:5586 +#: ../../library/stdtypes.rst:5567 msgid "" "The default limit is 4300 digits as provided in :data:`sys.int_info." "default_max_str_digits `. The lowest limit that can be " @@ -8012,11 +7990,11 @@ msgid "" "str_digits_check_threshold `." msgstr "" -#: ../../library/stdtypes.rst:5591 +#: ../../library/stdtypes.rst:5572 msgid "Verification:" msgstr "" -#: ../../library/stdtypes.rst:5593 +#: ../../library/stdtypes.rst:5574 msgid "" ">>> import sys\n" ">>> assert sys.int_info.default_max_str_digits == 4300, sys.int_info\n" @@ -8027,84 +8005,84 @@ msgid "" "..." msgstr "" -#: ../../library/stdtypes.rst:5606 +#: ../../library/stdtypes.rst:5587 msgid "Affected APIs" msgstr "受影響的 API" -#: ../../library/stdtypes.rst:5608 +#: ../../library/stdtypes.rst:5589 msgid "" "The limitation only applies to potentially slow conversions between :class:" "`int` and :class:`str` or :class:`bytes`:" msgstr "" -#: ../../library/stdtypes.rst:5611 +#: ../../library/stdtypes.rst:5592 msgid "``int(string)`` with default base 10." msgstr "``int(string)`` 以預設的 10 為底。" -#: ../../library/stdtypes.rst:5612 +#: ../../library/stdtypes.rst:5593 msgid "``int(string, base)`` for all bases that are not a power of 2." msgstr "" -#: ../../library/stdtypes.rst:5613 +#: ../../library/stdtypes.rst:5594 msgid "``str(integer)``." msgstr "``str(integer)``。" -#: ../../library/stdtypes.rst:5614 +#: ../../library/stdtypes.rst:5595 msgid "``repr(integer)``." msgstr "``repr(integer)``。" -#: ../../library/stdtypes.rst:5615 +#: ../../library/stdtypes.rst:5596 msgid "" "any other string conversion to base 10, for example ``f\"{integer}\"``, " "``\"{}\".format(integer)``, or ``b\"%d\" % integer``." msgstr "" -#: ../../library/stdtypes.rst:5618 +#: ../../library/stdtypes.rst:5599 msgid "The limitations do not apply to functions with a linear algorithm:" msgstr "" -#: ../../library/stdtypes.rst:5620 +#: ../../library/stdtypes.rst:5601 msgid "``int(string, base)`` with base 2, 4, 8, 16, or 32." msgstr "" -#: ../../library/stdtypes.rst:5621 +#: ../../library/stdtypes.rst:5602 msgid ":func:`int.from_bytes` and :func:`int.to_bytes`." msgstr ":func:`int.from_bytes` 和 :func:`int.to_bytes`。" -#: ../../library/stdtypes.rst:5622 +#: ../../library/stdtypes.rst:5603 msgid ":func:`hex`, :func:`oct`, :func:`bin`." msgstr ":func:`hex`、:func:`oct`、:func:`bin`。" -#: ../../library/stdtypes.rst:5623 +#: ../../library/stdtypes.rst:5604 msgid ":ref:`formatspec` for hex, octal, and binary numbers." msgstr "" -#: ../../library/stdtypes.rst:5624 +#: ../../library/stdtypes.rst:5605 msgid ":class:`str` to :class:`float`." msgstr "" -#: ../../library/stdtypes.rst:5625 +#: ../../library/stdtypes.rst:5606 msgid ":class:`str` to :class:`decimal.Decimal`." msgstr "" -#: ../../library/stdtypes.rst:5628 +#: ../../library/stdtypes.rst:5609 msgid "Configuring the limit" msgstr "設定限制" -#: ../../library/stdtypes.rst:5630 +#: ../../library/stdtypes.rst:5611 msgid "" "Before Python starts up you can use an environment variable or an " "interpreter command line flag to configure the limit:" msgstr "" -#: ../../library/stdtypes.rst:5633 +#: ../../library/stdtypes.rst:5614 msgid "" ":envvar:`PYTHONINTMAXSTRDIGITS`, e.g. ``PYTHONINTMAXSTRDIGITS=640 python3`` " "to set the limit to 640 or ``PYTHONINTMAXSTRDIGITS=0 python3`` to disable " "the limitation." msgstr "" -#: ../../library/stdtypes.rst:5636 +#: ../../library/stdtypes.rst:5617 msgid "" ":option:`-X int_max_str_digits <-X>`, e.g. ``python3 -X " "int_max_str_digits=640``" @@ -8112,7 +8090,7 @@ msgstr "" ":option:`-X int_max_str_digits <-X>`,例如 ``python3 -X " "int_max_str_digits=640``" -#: ../../library/stdtypes.rst:5638 +#: ../../library/stdtypes.rst:5619 msgid "" ":data:`sys.flags.int_max_str_digits` contains the value of :envvar:" "`PYTHONINTMAXSTRDIGITS` or :option:`-X int_max_str_digits <-X>`. If both the " @@ -8121,38 +8099,38 @@ msgid "" "int_info.default_max_str_digits` was used during initialization." msgstr "" -#: ../../library/stdtypes.rst:5644 +#: ../../library/stdtypes.rst:5625 msgid "" "From code, you can inspect the current limit and set a new one using these :" "mod:`sys` APIs:" msgstr "" -#: ../../library/stdtypes.rst:5647 +#: ../../library/stdtypes.rst:5628 msgid "" ":func:`sys.get_int_max_str_digits` and :func:`sys.set_int_max_str_digits` " "are a getter and setter for the interpreter-wide limit. Subinterpreters have " "their own limit." msgstr "" -#: ../../library/stdtypes.rst:5651 +#: ../../library/stdtypes.rst:5632 msgid "" "Information about the default and minimum can be found in :data:`sys." "int_info`:" msgstr "" -#: ../../library/stdtypes.rst:5653 +#: ../../library/stdtypes.rst:5634 msgid "" ":data:`sys.int_info.default_max_str_digits ` is the compiled-" "in default limit." msgstr "" -#: ../../library/stdtypes.rst:5655 +#: ../../library/stdtypes.rst:5636 msgid "" ":data:`sys.int_info.str_digits_check_threshold ` is the lowest " "accepted value for the limit (other than 0 which disables it)." msgstr "" -#: ../../library/stdtypes.rst:5662 +#: ../../library/stdtypes.rst:5643 msgid "" "Setting a low limit *can* lead to problems. While rare, code exists that " "contains integer constants in decimal in their source that exceed the " @@ -8164,7 +8142,7 @@ msgid "" "constants is to convert them to ``0x`` hexadecimal form as it has no limit." msgstr "" -#: ../../library/stdtypes.rst:5671 +#: ../../library/stdtypes.rst:5652 msgid "" "Test your application thoroughly if you use a low limit. Ensure your tests " "run with the limit set early via the environment or flag so that it applies " @@ -8172,11 +8150,11 @@ msgid "" "to precompile ``.py`` sources to ``.pyc`` files." msgstr "" -#: ../../library/stdtypes.rst:5677 +#: ../../library/stdtypes.rst:5658 msgid "Recommended configuration" msgstr "建議的配置" -#: ../../library/stdtypes.rst:5679 +#: ../../library/stdtypes.rst:5660 msgid "" "The default :data:`sys.int_info.default_max_str_digits` is expected to be " "reasonable for most applications. If your application requires a different " @@ -8184,11 +8162,11 @@ msgid "" "as these APIs were added in security patch releases in versions before 3.12." msgstr "" -#: ../../library/stdtypes.rst:5684 +#: ../../library/stdtypes.rst:5665 msgid "Example::" msgstr "範例: ::" -#: ../../library/stdtypes.rst:5686 +#: ../../library/stdtypes.rst:5667 msgid "" ">>> import sys\n" ">>> if hasattr(sys, \"set_int_max_str_digits\"):\n" @@ -8201,38 +8179,38 @@ msgid "" "... sys.set_int_max_str_digits(lower_bound)" msgstr "" -#: ../../library/stdtypes.rst:5696 +#: ../../library/stdtypes.rst:5677 msgid "If you need to disable it entirely, set it to ``0``." msgstr "" -#: ../../library/stdtypes.rst:5700 +#: ../../library/stdtypes.rst:5681 msgid "Footnotes" msgstr "註腳" -#: ../../library/stdtypes.rst:5701 +#: ../../library/stdtypes.rst:5682 msgid "" "Additional information on these special methods may be found in the Python " "Reference Manual (:ref:`customization`)." msgstr "" -#: ../../library/stdtypes.rst:5704 +#: ../../library/stdtypes.rst:5685 msgid "" "As a consequence, the list ``[1, 2]`` is considered equal to ``[1.0, 2.0]``, " "and similarly for tuples." msgstr "" -#: ../../library/stdtypes.rst:5707 +#: ../../library/stdtypes.rst:5688 msgid "They must have since the parser can't tell the type of the operands." msgstr "" -#: ../../library/stdtypes.rst:5709 +#: ../../library/stdtypes.rst:5690 msgid "" "Cased characters are those with general category property being one of " "\"Lu\" (Letter, uppercase), \"Ll\" (Letter, lowercase), or \"Lt\" (Letter, " "titlecase)." msgstr "" -#: ../../library/stdtypes.rst:5712 +#: ../../library/stdtypes.rst:5693 msgid "" "To format only a tuple you should therefore provide a singleton tuple whose " "only element is the tuple to be formatted." @@ -8245,13 +8223,13 @@ msgstr "built-in(內建)" #: ../../library/stdtypes.rst:13 ../../library/stdtypes.rst:316 #: ../../library/stdtypes.rst:393 ../../library/stdtypes.rst:950 #: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:1139 -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4426 -#: ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:5418 msgid "types" msgstr "type(型別)" #: ../../library/stdtypes.rst:34 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:4435 msgid "statement" msgstr "statement(陳述式)" @@ -8373,11 +8351,11 @@ msgstr "is not" #: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:1260 #: ../../library/stdtypes.rst:1339 ../../library/stdtypes.rst:1383 #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1540 -#: ../../library/stdtypes.rst:2517 ../../library/stdtypes.rst:2536 -#: ../../library/stdtypes.rst:2643 ../../library/stdtypes.rst:4224 -#: ../../library/stdtypes.rst:4426 ../../library/stdtypes.rst:4904 -#: ../../library/stdtypes.rst:5159 ../../library/stdtypes.rst:5329 -#: ../../library/stdtypes.rst:5373 +#: ../../library/stdtypes.rst:2526 ../../library/stdtypes.rst:2545 +#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:4233 +#: ../../library/stdtypes.rst:4435 ../../library/stdtypes.rst:4913 +#: ../../library/stdtypes.rst:5168 ../../library/stdtypes.rst:5338 +#: ../../library/stdtypes.rst:5382 msgid "object" msgstr "object(物件)" @@ -8469,9 +8447,9 @@ msgid "arithmetic" msgstr "arithmetic(算術)" #: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:950 -#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4426 -#: ../../library/stdtypes.rst:5380 ../../library/stdtypes.rst:5394 -#: ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:1117 ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:5389 ../../library/stdtypes.rst:5403 +#: ../../library/stdtypes.rst:5418 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -8487,8 +8465,8 @@ msgstr "float" msgid "complex" msgstr "complex(複數)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2393 -#: ../../library/stdtypes.rst:3612 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2402 +#: ../../library/stdtypes.rst:3621 msgid "+ (plus)" msgstr "+ (加號)" @@ -8500,13 +8478,13 @@ msgstr "unary operator(一元運算子)" msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2393 -#: ../../library/stdtypes.rst:3612 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2402 +#: ../../library/stdtypes.rst:3621 msgid "- (minus)" msgstr "- (減號)" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2350 -#: ../../library/stdtypes.rst:3569 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2359 +#: ../../library/stdtypes.rst:3578 msgid "* (asterisk)" msgstr "* (星號)" @@ -8518,8 +8496,8 @@ msgstr "/ (斜線)" msgid "//" msgstr "//" -#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2320 -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:246 ../../library/stdtypes.rst:2323 +#: ../../library/stdtypes.rst:3546 msgid "% (percent)" msgstr "% (百分號)" @@ -8529,7 +8507,7 @@ msgstr "**" #: ../../library/stdtypes.rst:316 ../../library/stdtypes.rst:393 #: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:1154 -#: ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:4435 msgid "operations on" msgstr "operations on(操作於)" @@ -8538,7 +8516,7 @@ msgid "conjugate() (complex number method)" msgstr "conjugate()(複數方法)" #: ../../library/stdtypes.rst:335 ../../library/stdtypes.rst:1606 -#: ../../library/stdtypes.rst:2517 ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:2526 ../../library/stdtypes.rst:5418 msgid "module" msgstr "模組" @@ -8606,7 +8584,7 @@ msgstr "values" msgid "iterator protocol" msgstr "iterator protocol(疊代器協定)" -#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4819 +#: ../../library/stdtypes.rst:847 ../../library/stdtypes.rst:4828 msgid "protocol" msgstr "protocol(協定)" @@ -8632,7 +8610,7 @@ msgstr "container(容器)" msgid "iteration over" msgstr "iteration over(疊代於)" -#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:950 ../../library/stdtypes.rst:4435 msgid "len" msgstr "len" @@ -8709,14 +8687,14 @@ msgstr "mutable(可變)" msgid "list" msgstr "list(串列)" -#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2517 -#: ../../library/stdtypes.rst:2643 ../../library/stdtypes.rst:2715 -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:1139 ../../library/stdtypes.rst:2526 +#: ../../library/stdtypes.rst:2652 ../../library/stdtypes.rst:2724 +#: ../../library/stdtypes.rst:3546 msgid "bytearray" msgstr "bytearray(位元組陣列)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4426 -#: ../../library/stdtypes.rst:5159 ../../library/stdtypes.rst:5409 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 +#: ../../library/stdtypes.rst:5168 ../../library/stdtypes.rst:5418 msgid "type" msgstr "type(型別)" @@ -8724,7 +8702,7 @@ msgstr "type(型別)" msgid "assignment" msgstr "assignment(賦值)" -#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:1154 ../../library/stdtypes.rst:4435 msgid "del" msgstr "del" @@ -8765,7 +8743,7 @@ msgid "range" msgstr "range" #: ../../library/stdtypes.rst:1504 ../../library/stdtypes.rst:1553 -#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2320 +#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2323 msgid "string" msgstr "string(字串)" @@ -8786,17 +8764,17 @@ msgstr "(亦請見 string)" msgid "io.StringIO" msgstr "io.StringIO" -#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2509 +#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2518 msgid "buffer protocol" msgstr "buffer protocol(緩衝區協定)" -#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2517 -#: ../../library/stdtypes.rst:2536 ../../library/stdtypes.rst:2715 -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:1571 ../../library/stdtypes.rst:2526 +#: ../../library/stdtypes.rst:2545 ../../library/stdtypes.rst:2724 +#: ../../library/stdtypes.rst:3546 msgid "bytes" msgstr "bytes(位元組)" -#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2715 +#: ../../library/stdtypes.rst:1598 ../../library/stdtypes.rst:2724 msgid "methods" msgstr "methods(方法)" @@ -8804,183 +8782,192 @@ msgstr "methods(方法)" msgid "re" msgstr "re" -#: ../../library/stdtypes.rst:2128 ../../library/stdtypes.rst:3391 +#: ../../library/stdtypes.rst:2131 ../../library/stdtypes.rst:3400 msgid "universal newlines" msgstr "universal newlines" -#: ../../library/stdtypes.rst:2128 +#: ../../library/stdtypes.rst:2131 msgid "str.splitlines method" msgstr "str.splitlines 方法" -#: ../../library/stdtypes.rst:2320 +#: ../../library/stdtypes.rst:2323 msgid "formatting, string (%)" msgstr "formatting(格式化)、字串 (%)" -#: ../../library/stdtypes.rst:2320 +#: ../../library/stdtypes.rst:2323 msgid "interpolation, string (%)" msgstr "interpolation(插值)、字串 (%)" -#: ../../library/stdtypes.rst:2320 +#: ../../library/stdtypes.rst:2323 msgid "formatting, printf" msgstr "formatting(格式化)、printf" -#: ../../library/stdtypes.rst:2320 +#: ../../library/stdtypes.rst:2323 msgid "interpolation, printf" msgstr "interpolation(插值)、printf" -#: ../../library/stdtypes.rst:2320 ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:2323 ../../library/stdtypes.rst:3546 msgid "printf-style formatting" msgstr "printf 風格格式化" -#: ../../library/stdtypes.rst:2320 ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:2323 ../../library/stdtypes.rst:3546 msgid "sprintf-style formatting" msgstr "sprintf 風格格式化" -#: ../../library/stdtypes.rst:2350 ../../library/stdtypes.rst:3569 +#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:3578 msgid "() (parentheses)" msgstr "() (圓括號)" -#: ../../library/stdtypes.rst:2350 ../../library/stdtypes.rst:2393 -#: ../../library/stdtypes.rst:3569 ../../library/stdtypes.rst:3612 +#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:2402 +#: ../../library/stdtypes.rst:3578 ../../library/stdtypes.rst:3621 msgid "in printf-style formatting" msgstr "於 printf 風格格式化" -#: ../../library/stdtypes.rst:2350 ../../library/stdtypes.rst:3569 +#: ../../library/stdtypes.rst:2359 ../../library/stdtypes.rst:3578 msgid ". (dot)" msgstr ". (點)" -#: ../../library/stdtypes.rst:2393 ../../library/stdtypes.rst:3612 +#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:3621 msgid "# (hash)" msgstr "# (井字號)" -#: ../../library/stdtypes.rst:2393 ../../library/stdtypes.rst:3612 +#: ../../library/stdtypes.rst:2402 ../../library/stdtypes.rst:3621 msgid "space" msgstr "space(空白)" -#: ../../library/stdtypes.rst:2509 +#: ../../library/stdtypes.rst:2518 msgid "binary sequence types" msgstr "binary sequence types(二進位序列型別)" -#: ../../library/stdtypes.rst:2517 +#: ../../library/stdtypes.rst:2526 msgid "memoryview" msgstr "memoryview(記憶體視圖)" -#: ../../library/stdtypes.rst:2517 +#: ../../library/stdtypes.rst:2526 msgid "array" msgstr "array(陣列)" -#: ../../library/stdtypes.rst:3391 +#: ../../library/stdtypes.rst:3400 msgid "bytes.splitlines method" msgstr "bytes.splitlines 方法" -#: ../../library/stdtypes.rst:3391 +#: ../../library/stdtypes.rst:3400 msgid "bytearray.splitlines method" msgstr "bytearray.splitlines 方法" -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:3546 msgid "formatting" msgstr "formatting(格式化)" -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:3546 msgid "bytes (%)" msgstr "bytes (%)" -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:3546 msgid "bytearray (%)" msgstr "bytearray (%)" -#: ../../library/stdtypes.rst:3537 +#: ../../library/stdtypes.rst:3546 msgid "interpolation" msgstr "interpolation(插值)" -#: ../../library/stdtypes.rst:4224 +#: ../../library/stdtypes.rst:4233 msgid "set" msgstr "set(集合)" -#: ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:4435 msgid "mapping" msgstr "mapping(對映)" -#: ../../library/stdtypes.rst:4426 +#: ../../library/stdtypes.rst:4435 msgid "dictionary" msgstr "dictionary(字典)" -#: ../../library/stdtypes.rst:4509 +#: ../../library/stdtypes.rst:4518 msgid "__missing__()" msgstr "__missing__()" -#: ../../library/stdtypes.rst:4819 +#: ../../library/stdtypes.rst:4828 msgid "context manager" msgstr "context manager(情境管理器)" -#: ../../library/stdtypes.rst:4819 +#: ../../library/stdtypes.rst:4828 msgid "context management protocol" msgstr "context management protocol(情境管理協定)" -#: ../../library/stdtypes.rst:4819 +#: ../../library/stdtypes.rst:4828 msgid "context management" msgstr "context management(情境管理)" -#: ../../library/stdtypes.rst:4892 +#: ../../library/stdtypes.rst:4901 msgid "annotation" msgstr "annotation(註記)" -#: ../../library/stdtypes.rst:4892 +#: ../../library/stdtypes.rst:4901 msgid "type annotation; type hint" msgstr "type annotation(型別註記);type hint(型別提示)" -#: ../../library/stdtypes.rst:4904 +#: ../../library/stdtypes.rst:4913 msgid "GenericAlias" msgstr "GenericAlias(泛型別名)" -#: ../../library/stdtypes.rst:4904 +#: ../../library/stdtypes.rst:4913 msgid "Generic" msgstr "Generic(泛型)" -#: ../../library/stdtypes.rst:4904 +#: ../../library/stdtypes.rst:4913 msgid "Alias" msgstr "Alias(別名)" -#: ../../library/stdtypes.rst:5159 +#: ../../library/stdtypes.rst:5168 msgid "Union" msgstr "Union(聯合)" -#: ../../library/stdtypes.rst:5159 +#: ../../library/stdtypes.rst:5168 msgid "union" msgstr "union(聯集)" -#: ../../library/stdtypes.rst:5329 +#: ../../library/stdtypes.rst:5338 msgid "method" msgstr "method(方法)" -#: ../../library/stdtypes.rst:5373 +#: ../../library/stdtypes.rst:5382 msgid "code" msgstr "code(程式碼)" -#: ../../library/stdtypes.rst:5373 +#: ../../library/stdtypes.rst:5382 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../library/stdtypes.rst:5380 +#: ../../library/stdtypes.rst:5389 msgid "compile" msgstr "compile(編譯)" -#: ../../library/stdtypes.rst:5380 +#: ../../library/stdtypes.rst:5389 msgid "__code__ (function object attribute)" msgstr "__code__(函式物件屬性)" -#: ../../library/stdtypes.rst:5394 +#: ../../library/stdtypes.rst:5403 msgid "exec" msgstr "exec" -#: ../../library/stdtypes.rst:5394 +#: ../../library/stdtypes.rst:5403 msgid "eval" msgstr "eval" -#: ../../library/stdtypes.rst:5433 +#: ../../library/stdtypes.rst:5442 msgid "..." msgstr "..." -#: ../../library/stdtypes.rst:5433 +#: ../../library/stdtypes.rst:5442 msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" + +#~ msgid "" +#~ ">>> int.__subclasses__()\n" +#~ "[, , , ]" +#~ msgstr "" +#~ ">>> int.__subclasses__()\n" +#~ "[, , , ]" diff --git a/library/string.po b/library/string.po index 0f15f60e61..f35d8e3922 100644 --- a/library/string.po +++ b/library/string.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-03-10 15:57+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -884,36 +884,37 @@ msgstr "" #: ../../library/string.rst:577 msgid "" -"For :class:`float` this is the same as ``'g'``, except that when fixed-point " -"notation is used to format the result, it always includes at least one digit " -"past the decimal point. The precision used is as large as needed to " -"represent the given value faithfully." +"For :class:`float` this is like the ``'g'`` type, except that when fixed-" +"point notation is used to format the result, it always includes at least one " +"digit past the decimal point, and switches to the scientific notation when " +"``exp >= p - 1``. When the precision is not specified, the latter will be " +"as large as needed to represent the given value faithfully." msgstr "" -#: ../../library/string.rst:583 +#: ../../library/string.rst:585 msgid "" "For :class:`~decimal.Decimal`, this is the same as either ``'g'`` or ``'G'`` " "depending on the value of ``context.capitals`` for the current decimal " "context." msgstr "" -#: ../../library/string.rst:587 +#: ../../library/string.rst:589 msgid "" "The overall effect is to match the output of :func:`str` as altered by the " "other format modifiers." msgstr "" -#: ../../library/string.rst:595 +#: ../../library/string.rst:597 msgid "Format examples" msgstr "格式範例" -#: ../../library/string.rst:597 +#: ../../library/string.rst:599 msgid "" "This section contains examples of the :meth:`str.format` syntax and " "comparison with the old ``%``-formatting." msgstr "本節包含 :meth:`str.format` 語法以及與舊式 ``%`` 格式的比較。" -#: ../../library/string.rst:600 +#: ../../library/string.rst:602 msgid "" "In most of the cases the syntax is similar to the old ``%``-formatting, with " "the addition of the ``{}`` and with ``:`` used instead of ``%``. For " @@ -922,17 +923,17 @@ msgstr "" "此語法在大多情況下與舊式的 ``%`` 格式類似,只是增加了 ``{}`` 和 ``:`` 來取代 " "``%``。例如,``'%03.2f'`` 可以改寫為 ``'{:03.2f}'``。" -#: ../../library/string.rst:604 +#: ../../library/string.rst:606 msgid "" "The new format syntax also supports new and different options, shown in the " "following examples." msgstr "新的語法還支援新的選項,將在以下的範例中說明。" -#: ../../library/string.rst:607 +#: ../../library/string.rst:609 msgid "Accessing arguments by position::" msgstr "按位置存取引數: ::" -#: ../../library/string.rst:609 +#: ../../library/string.rst:611 msgid "" ">>> '{0}, {1}, {2}'.format('a', 'b', 'c')\n" "'a, b, c'\n" @@ -947,11 +948,11 @@ msgid "" "'abracadabra'" msgstr "" -#: ../../library/string.rst:620 +#: ../../library/string.rst:622 msgid "Accessing arguments by name::" msgstr "按名稱存取引數: ::" -#: ../../library/string.rst:622 +#: ../../library/string.rst:624 msgid "" ">>> 'Coordinates: {latitude}, {longitude}'.format(latitude='37.24N', " "longitude='-115.81W')\n" @@ -961,11 +962,11 @@ msgid "" "'Coordinates: 37.24N, -115.81W'" msgstr "" -#: ../../library/string.rst:628 +#: ../../library/string.rst:630 msgid "Accessing arguments' attributes::" msgstr "存取引數的屬性: ::" -#: ../../library/string.rst:630 +#: ../../library/string.rst:632 msgid "" ">>> c = 3-5j\n" ">>> ('The complex number {0} is formed from the real part {0.real} '\n" @@ -982,22 +983,22 @@ msgid "" "'Point(4, 2)'" msgstr "" -#: ../../library/string.rst:643 +#: ../../library/string.rst:645 msgid "Accessing arguments' items::" msgstr "存取引數的內容: ::" -#: ../../library/string.rst:645 +#: ../../library/string.rst:647 msgid "" ">>> coord = (3, 5)\n" ">>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n" "'X: 3; Y: 5'" msgstr "" -#: ../../library/string.rst:649 +#: ../../library/string.rst:651 msgid "Replacing ``%s`` and ``%r``::" msgstr "替換 ``%s`` 和 ``%r``: ::" -#: ../../library/string.rst:651 +#: ../../library/string.rst:653 msgid "" ">>> \"repr() shows quotes: {!r}; str() doesn't: {!s}\".format('test1', " "'test2')\n" @@ -1007,11 +1008,11 @@ msgstr "" "'test2')\n" "\"repr() shows quotes: 'test1'; str() doesn't: test2\"" -#: ../../library/string.rst:654 +#: ../../library/string.rst:656 msgid "Aligning the text and specifying a width::" msgstr "對齊文字以及指定寬度: ::" -#: ../../library/string.rst:656 +#: ../../library/string.rst:658 msgid "" ">>> '{:<30}'.format('left aligned')\n" "'left aligned '\n" @@ -1023,11 +1024,11 @@ msgid "" "'***********centered***********'" msgstr "" -#: ../../library/string.rst:665 +#: ../../library/string.rst:667 msgid "Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::" msgstr "替換 ``%+f``、``%-f`` 和 ``% f`` 以及指定正負號: ::" -#: ../../library/string.rst:667 +#: ../../library/string.rst:669 msgid "" ">>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always\n" "'+3.140000; -3.140000'\n" @@ -1038,12 +1039,12 @@ msgid "" "'3.140000; -3.140000'" msgstr "" -#: ../../library/string.rst:674 +#: ../../library/string.rst:676 msgid "" "Replacing ``%x`` and ``%o`` and converting the value to different bases::" msgstr "替換 ``%x`` 和 ``%o`` 並將其值轉換為不同的進位制: ::" -#: ../../library/string.rst:676 +#: ../../library/string.rst:678 msgid "" ">>> # format also supports binary numbers\n" ">>> \"int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}\".format(42)\n" @@ -1053,11 +1054,11 @@ msgid "" "'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'" msgstr "" -#: ../../library/string.rst:683 +#: ../../library/string.rst:685 msgid "Using the comma as a thousands separator::" msgstr "使用逗號作為千位分隔符: ::" -#: ../../library/string.rst:685 +#: ../../library/string.rst:687 msgid "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" @@ -1065,11 +1066,11 @@ msgstr "" ">>> '{:,}'.format(1234567890)\n" "'1,234,567,890'" -#: ../../library/string.rst:688 +#: ../../library/string.rst:690 msgid "Expressing a percentage::" msgstr "表示為百分比: ::" -#: ../../library/string.rst:690 +#: ../../library/string.rst:692 msgid "" ">>> points = 19\n" ">>> total = 22\n" @@ -1081,11 +1082,11 @@ msgstr "" ">>> 'Correct answers: {:.2%}'.format(points/total)\n" "'Correct answers: 86.36%'" -#: ../../library/string.rst:695 +#: ../../library/string.rst:697 msgid "Using type-specific formatting::" msgstr "作為特定型別格式: ::" -#: ../../library/string.rst:697 +#: ../../library/string.rst:699 msgid "" ">>> import datetime\n" ">>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n" @@ -1097,11 +1098,11 @@ msgstr "" ">>> '{:%Y-%m-%d %H:%M:%S}'.format(d)\n" "'2010-07-04 12:15:58'" -#: ../../library/string.rst:702 +#: ../../library/string.rst:704 msgid "Nesting arguments and more complex examples::" msgstr "巢狀引數及更多複雜範例: ::" -#: ../../library/string.rst:704 +#: ../../library/string.rst:706 msgid "" ">>> for align, text in zip('<^>', ['left', 'center', 'right']):\n" "... '{0:{fill}{align}16}'.format(text, fill=align, align=align)\n" @@ -1159,11 +1160,11 @@ msgstr "" " 10 A 12 1010\n" " 11 B 13 1011" -#: ../../library/string.rst:736 +#: ../../library/string.rst:738 msgid "Template strings" msgstr "模板字串" -#: ../../library/string.rst:738 +#: ../../library/string.rst:740 msgid "" "Template strings provide simpler string substitutions as described in :pep:" "`292`. A primary use case for template strings is for internationalization " @@ -1177,17 +1178,17 @@ msgstr "" "化工具更容易翻譯。基於模板字串建構的 i18n 函式庫範例,請參閱 `flufl.i18n " "`_ 套件。" -#: ../../library/string.rst:748 +#: ../../library/string.rst:750 msgid "" "Template strings support ``$``-based substitutions, using the following " "rules:" msgstr "" -#: ../../library/string.rst:750 +#: ../../library/string.rst:752 msgid "``$$`` is an escape; it is replaced with a single ``$``." msgstr "" -#: ../../library/string.rst:752 +#: ../../library/string.rst:754 msgid "" "``$identifier`` names a substitution placeholder matching a mapping key of " "``\"identifier\"``. By default, ``\"identifier\"`` is restricted to any " @@ -1197,30 +1198,30 @@ msgid "" "specification." msgstr "" -#: ../../library/string.rst:759 +#: ../../library/string.rst:761 msgid "" "``${identifier}`` is equivalent to ``$identifier``. It is required when " "valid identifier characters follow the placeholder but are not part of the " "placeholder, such as ``\"${noun}ification\"``." msgstr "" -#: ../../library/string.rst:763 +#: ../../library/string.rst:765 msgid "" "Any other appearance of ``$`` in the string will result in a :exc:" "`ValueError` being raised." msgstr "" -#: ../../library/string.rst:766 +#: ../../library/string.rst:768 msgid "" "The :mod:`string` module provides a :class:`Template` class that implements " "these rules. The methods of :class:`Template` are:" msgstr "" -#: ../../library/string.rst:772 +#: ../../library/string.rst:774 msgid "The constructor takes a single argument which is the template string." msgstr "" -#: ../../library/string.rst:777 +#: ../../library/string.rst:779 msgid "" "Performs the template substitution, returning a new string. *mapping* is " "any dictionary-like object with keys that match the placeholders in the " @@ -1232,7 +1233,7 @@ msgstr "" "的字典型物件。或者如果關鍵字就是佔位符號時,你也可以改提供關鍵字引數。當 " "*mapping* 跟 *kwds* 同時給定並存在重複時,*kwds* 的佔位符號會被優先使用。" -#: ../../library/string.rst:786 +#: ../../library/string.rst:788 msgid "" "Like :meth:`substitute`, except that if placeholders are missing from " "*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the " @@ -1245,7 +1246,7 @@ msgstr "" "與 :meth:`substitute` 不同的是,任何包含 ``$`` 的字句會直接回傳 ``$`` 而非引" "發 :exc:`ValueError`。" -#: ../../library/string.rst:792 +#: ../../library/string.rst:794 msgid "" "While other exceptions may still occur, this method is called \"safe\" " "because it always tries to return a usable string instead of raising an " @@ -1259,7 +1260,7 @@ msgstr "" "完全安全,因為它會默默忽略格式錯誤的模板,這些模板包含了多餘的左右定界符、不" "匹配的括號,或者不是有效的 Python 識別字的佔位符號。" -#: ../../library/string.rst:802 +#: ../../library/string.rst:804 msgid "" "Returns false if the template has invalid placeholders that will cause :meth:" "`substitute` to raise :exc:`ValueError`." @@ -1267,18 +1268,18 @@ msgstr "" "如果模板有將導致 :meth:`substitute` 引發 :exc:`ValueError` 的無效佔位符號,就" "會回傳 false。" -#: ../../library/string.rst:810 +#: ../../library/string.rst:812 msgid "" "Returns a list of the valid identifiers in the template, in the order they " "first appear, ignoring any invalid identifiers." msgstr "" "回傳模板中有效識別字的串列,按照它們首次出現的順序,並忽略任何無效的識別字。" -#: ../../library/string.rst:815 +#: ../../library/string.rst:817 msgid ":class:`Template` instances also provide one public data attribute:" msgstr ":class:`Template` 實例也提供一個公開的資料屬性:" -#: ../../library/string.rst:819 +#: ../../library/string.rst:821 msgid "" "This is the object passed to the constructor's *template* argument. In " "general, you shouldn't change it, but read-only access is not enforced." @@ -1286,11 +1287,11 @@ msgstr "" "這是傳遞給建構函式 *template* 引數的物件。一般來說,你不應該改變它,但並沒有" "強制設定成唯讀。" -#: ../../library/string.rst:822 +#: ../../library/string.rst:824 msgid "Here is an example of how to use a Template::" msgstr "以下是如何使用 Template 的一個範例: ::" -#: ../../library/string.rst:824 +#: ../../library/string.rst:826 msgid "" ">>> from string import Template\n" ">>> s = Template('$who likes $what')\n" @@ -1324,7 +1325,7 @@ msgstr "" ">>> Template('$who likes $what').safe_substitute(d)\n" "'tim likes $what'" -#: ../../library/string.rst:840 +#: ../../library/string.rst:842 msgid "" "Advanced usage: you can derive subclasses of :class:`Template` to customize " "the placeholder syntax, delimiter character, or the entire regular " @@ -1334,7 +1335,7 @@ msgstr "" "進階用法:你可以衍生 :class:`Template` 類別來自定義佔位符號語法、左右定界符字" "元,或者用於剖析模板字串的正規表示式。你可以透過覆寫這些類別屬性來達成:" -#: ../../library/string.rst:845 +#: ../../library/string.rst:847 msgid "" "*delimiter* -- This is the literal string describing a placeholder " "introducing delimiter. The default value is ``$``. Note that this should " @@ -1348,7 +1349,7 @@ msgstr "" "注意你不能在建立類別後修改左右定界符。(意即在子類別的命名空間中必須設置不同" "的左右定界符)" -#: ../../library/string.rst:852 +#: ../../library/string.rst:854 msgid "" "*idpattern* -- This is the regular expression describing the pattern for non-" "braced placeholders. The default value is the regular expression ``(?a:[_a-" @@ -1356,19 +1357,19 @@ msgid "" "pattern will also apply to braced placeholders." msgstr "" -#: ../../library/string.rst:859 +#: ../../library/string.rst:861 msgid "" "Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with " "some non-ASCII characters. That's why we use the local ``a`` flag here." msgstr "" -#: ../../library/string.rst:863 +#: ../../library/string.rst:865 msgid "" "*braceidpattern* can be used to define separate patterns used inside and " "outside the braces." msgstr "" -#: ../../library/string.rst:867 +#: ../../library/string.rst:869 msgid "" "*braceidpattern* -- This is like *idpattern* but describes the pattern for " "braced placeholders. Defaults to ``None`` which means to fall back to " @@ -1377,7 +1378,7 @@ msgid "" "unbraced placeholders." msgstr "" -#: ../../library/string.rst:875 +#: ../../library/string.rst:877 msgid "" "*flags* -- The regular expression flags that will be applied when compiling " "the regular expression used for recognizing substitutions. The default " @@ -1386,7 +1387,7 @@ msgid "" "regular expressions." msgstr "" -#: ../../library/string.rst:883 +#: ../../library/string.rst:885 msgid "" "Alternatively, you can provide the entire regular expression pattern by " "overriding the class attribute *pattern*. If you do this, the value must be " @@ -1395,13 +1396,13 @@ msgid "" "placeholder rule:" msgstr "" -#: ../../library/string.rst:889 +#: ../../library/string.rst:891 msgid "" "*escaped* -- This group matches the escape sequence, e.g. ``$$``, in the " "default pattern." msgstr "*escaped* -- 此群組與跳脫序列匹配,例如在預設模式下為 ``$$``。" -#: ../../library/string.rst:892 +#: ../../library/string.rst:894 msgid "" "*named* -- This group matches the unbraced placeholder name; it should not " "include the delimiter in capturing group." @@ -1409,7 +1410,7 @@ msgstr "" "*named* -- 此群組與不帶大括號的佔位符號名稱匹配;它不應包含擷取群組中的左右定" "界符號。" -#: ../../library/string.rst:895 +#: ../../library/string.rst:897 msgid "" "*braced* -- This group matches the brace enclosed placeholder name; it " "should not include either the delimiter or braces in the capturing group." @@ -1417,7 +1418,7 @@ msgstr "" "*braced* -- 此群組與大括號括起來的佔位符號名稱匹配;它不應在擷取群組中包含左" "右定界符或大括號。" -#: ../../library/string.rst:898 +#: ../../library/string.rst:900 msgid "" "*invalid* -- This group matches any other delimiter pattern (usually a " "single delimiter), and it should appear last in the regular expression." @@ -1425,7 +1426,7 @@ msgstr "" "*invalid* -- 此群組與任何其他左右定界符模式(通常是單一左右定界符)匹配,且它" "應該出現在正規表示式的最後。" -#: ../../library/string.rst:901 +#: ../../library/string.rst:903 msgid "" "The methods on this class will raise :exc:`ValueError` if the pattern " "matches the template without one of these named groups matching." @@ -1433,11 +1434,11 @@ msgstr "" "當此模式有匹配於模板但這些命名組中卻有任一個不匹配,此類別的方法將引發 :exc:" "`ValueError`。" -#: ../../library/string.rst:906 +#: ../../library/string.rst:908 msgid "Helper functions" msgstr "輔助函式" -#: ../../library/string.rst:910 +#: ../../library/string.rst:912 msgid "" "Split the argument into words using :meth:`str.split`, capitalize each word " "using :meth:`str.capitalize`, and join the capitalized words using :meth:" @@ -1518,10 +1519,10 @@ msgstr ", (逗號)" msgid "_ (underscore)" msgstr "_ (底線)" -#: ../../library/string.rst:746 +#: ../../library/string.rst:748 msgid "$ (dollar)" msgstr "$ (金錢符號)" -#: ../../library/string.rst:746 +#: ../../library/string.rst:748 msgid "in template strings" msgstr "於 template strings(模板字串)" diff --git a/library/stringprep.po b/library/stringprep.po index 6f7ee577b7..7999df6a59 100644 --- a/library/stringprep.po +++ b/library/stringprep.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2016-11-19 00:34+0000\n" diff --git a/library/struct.po b/library/struct.po index ccc6400608..812644b7bc 100644 --- a/library/struct.po +++ b/library/struct.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -22,11 +22,11 @@ msgstr "" msgid ":mod:`!struct` --- Interpret bytes as packed binary data" msgstr ":mod:`!struct` --- 將位元組直譯為打包起來的二進位資料" -#: ../../library/struct.rst:7 +#: ../../library/struct.rst:11 msgid "**Source code:** :source:`Lib/struct.py`" msgstr "**原始碼:**\\ :source:`Lib/struct.py`" -#: ../../library/struct.rst:15 +#: ../../library/struct.rst:19 msgid "" "This module converts between Python values and C structs represented as " "Python :class:`bytes` objects. Compact :ref:`format strings `, which " @@ -138,11 +138,11 @@ msgid "" "characters which describe the actual data values and padding." msgstr "" -#: ../../library/struct.rst:121 +#: ../../library/struct.rst:125 msgid "Byte Order, Size, and Alignment" msgstr "" -#: ../../library/struct.rst:123 +#: ../../library/struct.rst:127 msgid "" "By default, C types are represented in the machine's native format and byte " "order, and properly aligned by skipping pad bytes if necessary (according to " @@ -152,98 +152,98 @@ msgid "" "standard formats depends on the application." msgstr "" -#: ../../library/struct.rst:139 +#: ../../library/struct.rst:143 msgid "" "Alternatively, the first character of the format string can be used to " "indicate the byte order, size and alignment of the packed data, according to " "the following table:" msgstr "" -#: ../../library/struct.rst:144 +#: ../../library/struct.rst:148 msgid "Character" msgstr "" -#: ../../library/struct.rst:144 +#: ../../library/struct.rst:148 msgid "Byte order" msgstr "" -#: ../../library/struct.rst:144 +#: ../../library/struct.rst:148 msgid "Size" msgstr "" -#: ../../library/struct.rst:144 +#: ../../library/struct.rst:148 msgid "Alignment" msgstr "" -#: ../../library/struct.rst:146 +#: ../../library/struct.rst:150 msgid "``@``" msgstr "``@``" -#: ../../library/struct.rst:146 ../../library/struct.rst:148 +#: ../../library/struct.rst:150 ../../library/struct.rst:152 msgid "native" msgstr "" -#: ../../library/struct.rst:148 +#: ../../library/struct.rst:152 msgid "``=``" msgstr "``=``" -#: ../../library/struct.rst:148 ../../library/struct.rst:150 #: ../../library/struct.rst:152 ../../library/struct.rst:154 +#: ../../library/struct.rst:156 ../../library/struct.rst:158 msgid "standard" msgstr "" -#: ../../library/struct.rst:148 ../../library/struct.rst:150 #: ../../library/struct.rst:152 ../../library/struct.rst:154 +#: ../../library/struct.rst:156 ../../library/struct.rst:158 msgid "none" msgstr "" -#: ../../library/struct.rst:150 +#: ../../library/struct.rst:154 msgid "``<``" msgstr "``<``" -#: ../../library/struct.rst:150 +#: ../../library/struct.rst:154 msgid "little-endian" msgstr "" -#: ../../library/struct.rst:152 +#: ../../library/struct.rst:156 msgid "``>``" msgstr "``>``" -#: ../../library/struct.rst:152 +#: ../../library/struct.rst:156 msgid "big-endian" msgstr "" -#: ../../library/struct.rst:154 +#: ../../library/struct.rst:158 msgid "``!``" msgstr "``!``" -#: ../../library/struct.rst:154 +#: ../../library/struct.rst:158 msgid "network (= big-endian)" msgstr "" -#: ../../library/struct.rst:157 +#: ../../library/struct.rst:161 msgid "If the first character is not one of these, ``'@'`` is assumed." msgstr "" -#: ../../library/struct.rst:161 +#: ../../library/struct.rst:165 msgid "" "The number 1023 (``0x3ff`` in hexadecimal) has the following byte " "representations:" msgstr "" -#: ../../library/struct.rst:163 +#: ../../library/struct.rst:167 msgid "``03 ff`` in big-endian (``>``)" msgstr "" -#: ../../library/struct.rst:164 +#: ../../library/struct.rst:168 msgid "``ff 03`` in little-endian (``<``)" msgstr "" -#: ../../library/struct.rst:166 +#: ../../library/struct.rst:170 msgid "Python example:" msgstr "" -#: ../../library/struct.rst:174 +#: ../../library/struct.rst:178 msgid "" "Native byte order is big-endian or little-endian, depending on the host " "system. For example, Intel x86, AMD64 (x86-64), and Apple M1 are little-" @@ -251,64 +251,64 @@ msgid "" "byteorder` to check the endianness of your system." msgstr "" -#: ../../library/struct.rst:179 +#: ../../library/struct.rst:183 msgid "" "Native size and alignment are determined using the C compiler's ``sizeof`` " "expression. This is always combined with native byte order." msgstr "" -#: ../../library/struct.rst:182 +#: ../../library/struct.rst:186 msgid "" "Standard size depends only on the format character; see the table in the :" "ref:`format-characters` section." msgstr "" -#: ../../library/struct.rst:185 +#: ../../library/struct.rst:189 msgid "" "Note the difference between ``'@'`` and ``'='``: both use native byte order, " "but the size and alignment of the latter is standardized." msgstr "" -#: ../../library/struct.rst:188 +#: ../../library/struct.rst:192 msgid "" "The form ``'!'`` represents the network byte order which is always big-" "endian as defined in `IETF RFC 1700 `_." msgstr "" -#: ../../library/struct.rst:191 +#: ../../library/struct.rst:195 msgid "" "There is no way to indicate non-native byte order (force byte-swapping); use " "the appropriate choice of ``'<'`` or ``'>'``." msgstr "" -#: ../../library/struct.rst:194 ../../library/struct.rst:273 +#: ../../library/struct.rst:198 ../../library/struct.rst:277 msgid "Notes:" msgstr "註解:" -#: ../../library/struct.rst:196 +#: ../../library/struct.rst:200 msgid "" "Padding is only automatically added between successive structure members. No " "padding is added at the beginning or the end of the encoded struct." msgstr "" -#: ../../library/struct.rst:199 +#: ../../library/struct.rst:203 msgid "" "No padding is added when using non-native size and alignment, e.g. with '<', " "'>', '=', and '!'." msgstr "" -#: ../../library/struct.rst:202 +#: ../../library/struct.rst:206 msgid "" "To align the end of a structure to the alignment requirement of a particular " "type, end the format with the code for that type with a repeat count of " "zero. See :ref:`struct-examples`." msgstr "" -#: ../../library/struct.rst:210 +#: ../../library/struct.rst:214 msgid "Format Characters" msgstr "" -#: ../../library/struct.rst:212 +#: ../../library/struct.rst:216 msgid "" "Format characters have the following meaning; the conversion between C and " "Python values should be obvious given their types. The 'Standard size' " @@ -318,309 +318,309 @@ msgid "" "platform-dependent." msgstr "" -#: ../../library/struct.rst:220 +#: ../../library/struct.rst:224 msgid "Format" msgstr "" -#: ../../library/struct.rst:220 +#: ../../library/struct.rst:224 msgid "C Type" msgstr "C Type" -#: ../../library/struct.rst:220 +#: ../../library/struct.rst:224 msgid "Python type" msgstr "" -#: ../../library/struct.rst:220 +#: ../../library/struct.rst:224 msgid "Standard size" msgstr "" -#: ../../library/struct.rst:220 +#: ../../library/struct.rst:224 msgid "Notes" msgstr "註解" -#: ../../library/struct.rst:222 +#: ../../library/struct.rst:226 msgid "``x``" msgstr "``x``" -#: ../../library/struct.rst:222 +#: ../../library/struct.rst:226 msgid "pad byte" msgstr "" -#: ../../library/struct.rst:222 +#: ../../library/struct.rst:226 msgid "no value" msgstr "" -#: ../../library/struct.rst:222 +#: ../../library/struct.rst:226 msgid "\\(7)" msgstr "\\(7)" -#: ../../library/struct.rst:224 +#: ../../library/struct.rst:228 msgid "``c``" msgstr "``c``" -#: ../../library/struct.rst:224 +#: ../../library/struct.rst:228 msgid ":c:expr:`char`" msgstr ":c:expr:`char`" -#: ../../library/struct.rst:224 +#: ../../library/struct.rst:228 msgid "bytes of length 1" msgstr "" -#: ../../library/struct.rst:224 ../../library/struct.rst:226 #: ../../library/struct.rst:228 ../../library/struct.rst:230 +#: ../../library/struct.rst:232 ../../library/struct.rst:234 msgid "1" msgstr "1" -#: ../../library/struct.rst:226 +#: ../../library/struct.rst:230 msgid "``b``" msgstr "``b``" -#: ../../library/struct.rst:226 +#: ../../library/struct.rst:230 msgid ":c:expr:`signed char`" msgstr ":c:expr:`signed char`" -#: ../../library/struct.rst:226 ../../library/struct.rst:228 -#: ../../library/struct.rst:232 ../../library/struct.rst:234 +#: ../../library/struct.rst:230 ../../library/struct.rst:232 #: ../../library/struct.rst:236 ../../library/struct.rst:238 #: ../../library/struct.rst:240 ../../library/struct.rst:242 #: ../../library/struct.rst:244 ../../library/struct.rst:246 -#: ../../library/struct.rst:249 ../../library/struct.rst:251 -#: ../../library/struct.rst:263 +#: ../../library/struct.rst:248 ../../library/struct.rst:250 +#: ../../library/struct.rst:253 ../../library/struct.rst:255 +#: ../../library/struct.rst:267 msgid "integer" msgstr "" -#: ../../library/struct.rst:226 +#: ../../library/struct.rst:230 msgid "\\(1), \\(2)" msgstr "\\(1), \\(2)" -#: ../../library/struct.rst:228 +#: ../../library/struct.rst:232 msgid "``B``" msgstr "``B``" -#: ../../library/struct.rst:228 +#: ../../library/struct.rst:232 msgid ":c:expr:`unsigned char`" msgstr ":c:expr:`unsigned char`" -#: ../../library/struct.rst:228 ../../library/struct.rst:232 -#: ../../library/struct.rst:234 ../../library/struct.rst:236 +#: ../../library/struct.rst:232 ../../library/struct.rst:236 #: ../../library/struct.rst:238 ../../library/struct.rst:240 #: ../../library/struct.rst:242 ../../library/struct.rst:244 -#: ../../library/struct.rst:246 +#: ../../library/struct.rst:246 ../../library/struct.rst:248 +#: ../../library/struct.rst:250 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/struct.rst:230 +#: ../../library/struct.rst:234 msgid "``?``" msgstr "``?``" -#: ../../library/struct.rst:230 +#: ../../library/struct.rst:234 msgid ":c:expr:`_Bool`" msgstr ":c:expr:`_Bool`" -#: ../../library/struct.rst:230 +#: ../../library/struct.rst:234 msgid "bool" msgstr "bool" -#: ../../library/struct.rst:230 +#: ../../library/struct.rst:234 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/struct.rst:232 +#: ../../library/struct.rst:236 msgid "``h``" msgstr "``h``" -#: ../../library/struct.rst:232 +#: ../../library/struct.rst:236 msgid ":c:expr:`short`" msgstr ":c:expr:`short`" -#: ../../library/struct.rst:232 ../../library/struct.rst:234 -#: ../../library/struct.rst:253 +#: ../../library/struct.rst:236 ../../library/struct.rst:238 +#: ../../library/struct.rst:257 msgid "2" msgstr "2" -#: ../../library/struct.rst:234 +#: ../../library/struct.rst:238 msgid "``H``" msgstr "``H``" -#: ../../library/struct.rst:234 +#: ../../library/struct.rst:238 msgid ":c:expr:`unsigned short`" msgstr ":c:expr:`unsigned short`" -#: ../../library/struct.rst:236 +#: ../../library/struct.rst:240 msgid "``i``" msgstr "``i``" -#: ../../library/struct.rst:236 +#: ../../library/struct.rst:240 msgid ":c:expr:`int`" msgstr ":c:expr:`int`" -#: ../../library/struct.rst:236 ../../library/struct.rst:238 #: ../../library/struct.rst:240 ../../library/struct.rst:242 -#: ../../library/struct.rst:255 +#: ../../library/struct.rst:244 ../../library/struct.rst:246 +#: ../../library/struct.rst:259 msgid "4" msgstr "4" -#: ../../library/struct.rst:238 +#: ../../library/struct.rst:242 msgid "``I``" msgstr "``I``" -#: ../../library/struct.rst:238 +#: ../../library/struct.rst:242 msgid ":c:expr:`unsigned int`" msgstr ":c:expr:`unsigned int`" -#: ../../library/struct.rst:240 +#: ../../library/struct.rst:244 msgid "``l``" msgstr "``l``" -#: ../../library/struct.rst:240 +#: ../../library/struct.rst:244 msgid ":c:expr:`long`" msgstr ":c:expr:`long`" -#: ../../library/struct.rst:242 +#: ../../library/struct.rst:246 msgid "``L``" msgstr "``L``" -#: ../../library/struct.rst:242 +#: ../../library/struct.rst:246 msgid ":c:expr:`unsigned long`" msgstr ":c:expr:`unsigned long`" -#: ../../library/struct.rst:244 +#: ../../library/struct.rst:248 msgid "``q``" msgstr "``q``" -#: ../../library/struct.rst:244 +#: ../../library/struct.rst:248 msgid ":c:expr:`long long`" msgstr ":c:expr:`long long`" -#: ../../library/struct.rst:244 ../../library/struct.rst:246 -#: ../../library/struct.rst:257 +#: ../../library/struct.rst:248 ../../library/struct.rst:250 +#: ../../library/struct.rst:261 msgid "8" msgstr "8" -#: ../../library/struct.rst:246 +#: ../../library/struct.rst:250 msgid "``Q``" msgstr "``Q``" -#: ../../library/struct.rst:246 +#: ../../library/struct.rst:250 msgid ":c:expr:`unsigned long long`" msgstr ":c:expr:`unsigned long long`" -#: ../../library/struct.rst:249 +#: ../../library/struct.rst:253 msgid "``n``" msgstr "``n``" -#: ../../library/struct.rst:249 +#: ../../library/struct.rst:253 msgid ":c:type:`ssize_t`" msgstr ":c:type:`ssize_t`" -#: ../../library/struct.rst:249 ../../library/struct.rst:251 +#: ../../library/struct.rst:253 ../../library/struct.rst:255 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/struct.rst:251 +#: ../../library/struct.rst:255 msgid "``N``" msgstr "``N``" -#: ../../library/struct.rst:251 +#: ../../library/struct.rst:255 msgid ":c:type:`size_t`" msgstr ":c:type:`size_t`" -#: ../../library/struct.rst:253 +#: ../../library/struct.rst:257 msgid "``e``" msgstr "``e``" -#: ../../library/struct.rst:253 +#: ../../library/struct.rst:257 msgid "\\(6)" msgstr "\\(6)" -#: ../../library/struct.rst:253 ../../library/struct.rst:255 -#: ../../library/struct.rst:257 +#: ../../library/struct.rst:257 ../../library/struct.rst:259 +#: ../../library/struct.rst:261 msgid "float" msgstr "float" -#: ../../library/struct.rst:253 ../../library/struct.rst:255 -#: ../../library/struct.rst:257 +#: ../../library/struct.rst:257 ../../library/struct.rst:259 +#: ../../library/struct.rst:261 msgid "\\(4)" msgstr "\\(4)" -#: ../../library/struct.rst:255 +#: ../../library/struct.rst:259 msgid "``f``" msgstr "``f``" -#: ../../library/struct.rst:255 +#: ../../library/struct.rst:259 msgid ":c:expr:`float`" msgstr ":c:expr:`float`" -#: ../../library/struct.rst:257 +#: ../../library/struct.rst:261 msgid "``d``" msgstr "``d``" -#: ../../library/struct.rst:257 +#: ../../library/struct.rst:261 msgid ":c:expr:`double`" msgstr ":c:expr:`double`" -#: ../../library/struct.rst:259 +#: ../../library/struct.rst:263 msgid "``s``" msgstr "``s``" -#: ../../library/struct.rst:259 ../../library/struct.rst:261 +#: ../../library/struct.rst:263 ../../library/struct.rst:265 msgid ":c:expr:`char[]`" msgstr ":c:expr:`char[]`" -#: ../../library/struct.rst:259 ../../library/struct.rst:261 +#: ../../library/struct.rst:263 ../../library/struct.rst:265 msgid "bytes" msgstr "" -#: ../../library/struct.rst:259 +#: ../../library/struct.rst:263 msgid "\\(9)" msgstr "\\(9)" -#: ../../library/struct.rst:261 +#: ../../library/struct.rst:265 msgid "``p``" msgstr "``p``" -#: ../../library/struct.rst:261 +#: ../../library/struct.rst:265 msgid "\\(8)" msgstr "\\(8)" -#: ../../library/struct.rst:263 +#: ../../library/struct.rst:267 msgid "``P``" msgstr "``P``" -#: ../../library/struct.rst:263 +#: ../../library/struct.rst:267 msgid ":c:expr:`void \\*`" msgstr ":c:expr:`void \\*`" -#: ../../library/struct.rst:263 +#: ../../library/struct.rst:267 msgid "\\(5)" msgstr "\\(5)" -#: ../../library/struct.rst:266 +#: ../../library/struct.rst:270 msgid "Added support for the ``'n'`` and ``'N'`` formats." msgstr "新增 ``'n'`` 與 ``'N'`` 格式的支援。" -#: ../../library/struct.rst:269 +#: ../../library/struct.rst:273 msgid "Added support for the ``'e'`` format." msgstr "新增 ``'e'`` 格式的支援。" -#: ../../library/struct.rst:278 +#: ../../library/struct.rst:282 msgid "" "The ``'?'`` conversion code corresponds to the :c:expr:`_Bool` type defined " "by C standards since C99. In standard mode, it is represented by one byte." msgstr "" -#: ../../library/struct.rst:283 +#: ../../library/struct.rst:287 msgid "" "When attempting to pack a non-integer using any of the integer conversion " "codes, if the non-integer has a :meth:`~object.__index__` method then that " "method is called to convert the argument to an integer before packing." msgstr "" -#: ../../library/struct.rst:287 +#: ../../library/struct.rst:291 msgid "Added use of the :meth:`~object.__index__` method for non-integers." msgstr "" -#: ../../library/struct.rst:291 +#: ../../library/struct.rst:295 msgid "" "The ``'n'`` and ``'N'`` conversion codes are only available for the native " "size (selected as the default or with the ``'@'`` byte order character). For " @@ -628,7 +628,7 @@ msgid "" "your application." msgstr "" -#: ../../library/struct.rst:297 +#: ../../library/struct.rst:301 msgid "" "For the ``'f'``, ``'d'`` and ``'e'`` conversion codes, the packed " "representation uses the IEEE 754 binary32, binary64 or binary16 format (for " @@ -636,7 +636,7 @@ msgid "" "format used by the platform." msgstr "" -#: ../../library/struct.rst:303 +#: ../../library/struct.rst:307 msgid "" "The ``'P'`` format character is only available for the native byte ordering " "(selected as the default or with the ``'@'`` byte order character). The byte " @@ -645,7 +645,7 @@ msgid "" "ordering, so the ``'P'`` format is not available." msgstr "" -#: ../../library/struct.rst:310 +#: ../../library/struct.rst:314 msgid "" "The IEEE 754 binary16 \"half precision\" type was introduced in the 2008 " "revision of the `IEEE 754 standard `_. It has a sign " @@ -657,11 +657,11 @@ msgid "" "format `_ for more information." msgstr "" -#: ../../library/struct.rst:320 +#: ../../library/struct.rst:324 msgid "When packing, ``'x'`` inserts one NUL byte." msgstr "" -#: ../../library/struct.rst:323 +#: ../../library/struct.rst:327 msgid "" "The ``'p'`` format character encodes a \"Pascal string\", meaning a short " "variable-length string stored in a *fixed number of bytes*, given by the " @@ -675,7 +675,7 @@ msgid "" "more than 255 bytes." msgstr "" -#: ../../library/struct.rst:335 +#: ../../library/struct.rst:339 msgid "" "For the ``'s'`` format character, the count is interpreted as the length of " "the bytes, not a repeat count like for the other format characters; for " @@ -690,19 +690,19 @@ msgid "" "(while ``'0c'`` means 0 characters)." msgstr "" -#: ../../library/struct.rst:348 +#: ../../library/struct.rst:352 msgid "" "A format character may be preceded by an integral repeat count. For " "example, the format string ``'4h'`` means exactly the same as ``'hhhh'``." msgstr "" -#: ../../library/struct.rst:351 +#: ../../library/struct.rst:355 msgid "" "Whitespace characters between formats are ignored; a count and its format " "must not contain whitespace though." msgstr "" -#: ../../library/struct.rst:354 +#: ../../library/struct.rst:358 msgid "" "When packing a value ``x`` using one of the integer formats (``'b'``, " "``'B'``, ``'h'``, ``'H'``, ``'i'``, ``'I'``, ``'l'``, ``'L'``, ``'q'``, " @@ -710,13 +710,13 @@ msgid "" "`struct.error` is raised." msgstr "" -#: ../../library/struct.rst:359 +#: ../../library/struct.rst:363 msgid "" "Previously, some of the integer formats wrapped out-of-range values and " "raised :exc:`DeprecationWarning` instead of :exc:`struct.error`." msgstr "" -#: ../../library/struct.rst:365 +#: ../../library/struct.rst:369 msgid "" "For the ``'?'`` format character, the return value is either :const:`True` " "or :const:`False`. When packing, the truth value of the argument object is " @@ -724,24 +724,24 @@ msgid "" "packed, and any non-zero value will be ``True`` when unpacking." msgstr "" -#: ../../library/struct.rst:375 +#: ../../library/struct.rst:379 msgid "Examples" msgstr "範例" -#: ../../library/struct.rst:378 +#: ../../library/struct.rst:382 msgid "" "Native byte order examples (designated by the ``'@'`` format prefix or lack " "of any prefix character) may not match what the reader's machine produces as " "that depends on the platform and compiler." msgstr "" -#: ../../library/struct.rst:383 +#: ../../library/struct.rst:387 msgid "" "Pack and unpack integers of three different sizes, using big endian " "ordering::" msgstr "" -#: ../../library/struct.rst:386 +#: ../../library/struct.rst:390 msgid "" ">>> from struct import *\n" ">>> pack(\">bhl\", 1, 2, 3)\n" @@ -759,11 +759,11 @@ msgstr "" ">>> calcsize('>bhl')\n" "7" -#: ../../library/struct.rst:394 +#: ../../library/struct.rst:398 msgid "Attempt to pack an integer which is too large for the defined field::" msgstr "" -#: ../../library/struct.rst:396 +#: ../../library/struct.rst:400 msgid "" ">>> pack(\">h\", 99999)\n" "Traceback (most recent call last):\n" @@ -775,12 +775,12 @@ msgstr "" " File \"\", line 1, in \n" "struct.error: 'h' format requires -32768 <= number <= 32767" -#: ../../library/struct.rst:401 +#: ../../library/struct.rst:405 msgid "" "Demonstrate the difference between ``'s'`` and ``'c'`` format characters::" msgstr "" -#: ../../library/struct.rst:404 +#: ../../library/struct.rst:408 msgid "" ">>> pack(\"@ccc\", b'1', b'2', b'3')\n" "b'123'\n" @@ -792,13 +792,13 @@ msgstr "" ">>> pack(\"@3s\", b'123')\n" "b'123'" -#: ../../library/struct.rst:409 +#: ../../library/struct.rst:413 msgid "" "Unpacked fields can be named by assigning them to variables or by wrapping " "the result in a named tuple::" msgstr "" -#: ../../library/struct.rst:412 +#: ../../library/struct.rst:416 msgid "" ">>> record = b'raymond \\x32\\x12\\x08\\x01\\x08'\n" ">>> name, serialnum, school, gradelevel = unpack('<10sHHb', record)\n" @@ -816,7 +816,7 @@ msgstr "" ">>> Student._make(unpack('<10sHHb', record))\n" "Student(name=b'raymond ', serialnum=4658, school=264, gradelevel=8)" -#: ../../library/struct.rst:420 +#: ../../library/struct.rst:424 msgid "" "The ordering of format characters may have an impact on size in native mode " "since padding is implicit. In standard mode, the user is responsible for " @@ -826,7 +826,7 @@ msgid "" "a little endian machine::" msgstr "" -#: ../../library/struct.rst:428 +#: ../../library/struct.rst:432 msgid "" ">>> pack('@ci', b'#', 0x12131415)\n" "b'#\\x00\\x00\\x00\\x15\\x14\\x13\\x12'\n" @@ -846,13 +846,13 @@ msgstr "" ">>> calcsize('@ic')\n" "5" -#: ../../library/struct.rst:437 +#: ../../library/struct.rst:441 msgid "" "The following format ``'llh0l'`` results in two pad bytes being added at the " "end, assuming the platform's longs are aligned on 4-byte boundaries::" msgstr "" -#: ../../library/struct.rst:440 +#: ../../library/struct.rst:444 msgid "" ">>> pack('@llh0l', 1, 2, 3)\n" "b'\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x02\\x00\\x03\\x00\\x00'" @@ -860,35 +860,35 @@ msgstr "" ">>> pack('@llh0l', 1, 2, 3)\n" "b'\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x02\\x00\\x03\\x00\\x00'" -#: ../../library/struct.rst:446 +#: ../../library/struct.rst:450 msgid "Module :mod:`array`" msgstr ":mod:`array` 模組" -#: ../../library/struct.rst:447 +#: ../../library/struct.rst:451 msgid "Packed binary storage of homogeneous data." msgstr "" -#: ../../library/struct.rst:449 +#: ../../library/struct.rst:453 msgid "Module :mod:`json`" msgstr ":mod:`json` 模組" -#: ../../library/struct.rst:450 +#: ../../library/struct.rst:454 msgid "JSON encoder and decoder." msgstr "" -#: ../../library/struct.rst:452 +#: ../../library/struct.rst:456 msgid "Module :mod:`pickle`" msgstr ":mod:`pickle` 模組" -#: ../../library/struct.rst:453 +#: ../../library/struct.rst:457 msgid "Python object serialization." msgstr "" -#: ../../library/struct.rst:459 +#: ../../library/struct.rst:463 msgid "Applications" msgstr "" -#: ../../library/struct.rst:461 +#: ../../library/struct.rst:465 msgid "" "Two main applications for the :mod:`struct` module exist, data interchange " "between Python and C code within an application or another application " @@ -898,11 +898,11 @@ msgid "" "speaking, the format strings constructed for these two domains are distinct." msgstr "" -#: ../../library/struct.rst:472 +#: ../../library/struct.rst:476 msgid "Native Formats" msgstr "" -#: ../../library/struct.rst:474 +#: ../../library/struct.rst:478 msgid "" "When constructing format strings which mimic native layouts, the compiler " "and machine architecture determine byte ordering and padding. In such cases, " @@ -913,12 +913,12 @@ msgid "" "of consecutive chunks of data." msgstr "" -#: ../../library/struct.rst:482 +#: ../../library/struct.rst:486 msgid "" "Consider these two simple examples (on a 64-bit, little-endian machine)::" msgstr "" -#: ../../library/struct.rst:485 +#: ../../library/struct.rst:489 msgid "" ">>> calcsize('@lhl')\n" "24\n" @@ -930,14 +930,14 @@ msgstr "" ">>> calcsize('@llh')\n" "18" -#: ../../library/struct.rst:490 +#: ../../library/struct.rst:494 msgid "" "Data is not padded to an 8-byte boundary at the end of the second format " "string without the use of extra padding. A zero-repeat format code solves " "that problem::" msgstr "" -#: ../../library/struct.rst:494 +#: ../../library/struct.rst:498 msgid "" ">>> calcsize('@llh0l')\n" "24" @@ -945,23 +945,23 @@ msgstr "" ">>> calcsize('@llh0l')\n" "24" -#: ../../library/struct.rst:497 +#: ../../library/struct.rst:501 msgid "" "The ``'x'`` format code can be used to specify the repeat, but for native " "formats it is better to use a zero-repeat format like ``'0l'``." msgstr "" -#: ../../library/struct.rst:500 +#: ../../library/struct.rst:504 msgid "" "By default, native byte ordering and alignment is used, but it is better to " "be explicit and use the ``'@'`` prefix character." msgstr "" -#: ../../library/struct.rst:507 +#: ../../library/struct.rst:511 msgid "Standard Formats" msgstr "" -#: ../../library/struct.rst:509 +#: ../../library/struct.rst:513 msgid "" "When exchanging data beyond your process such as networking or storage, be " "precise. Specify the exact byte order, size, and alignment. Do not assume " @@ -975,7 +975,7 @@ msgid "" "from the previous section, we have::" msgstr "" -#: ../../library/struct.rst:521 +#: ../../library/struct.rst:525 msgid "" ">>> calcsize('>> pack('@llh0l', 1, 2, 3) == pack('>> calcsize('>> pack('@llh0l', 1, 2, 3) == pack(' (greater)" msgstr "> (大於)" -#: ../../library/struct.rst:132 +#: ../../library/struct.rst:136 msgid "! (exclamation)" msgstr "! (驚嘆號)" -#: ../../library/struct.rst:276 ../../library/struct.rst:363 +#: ../../library/struct.rst:280 ../../library/struct.rst:367 msgid "? (question mark)" msgstr "? (問號)" diff --git a/library/subprocess.po b/library/subprocess.po index 3250c5378d..d6d98f3bfc 100644 --- a/library/subprocess.po +++ b/library/subprocess.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:11+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -50,18 +50,17 @@ msgstr "" msgid ":pep:`324` -- PEP proposing the subprocess module" msgstr ":pep:`324` -- 提議 subprocess 模組的 PEP" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +#: ../../includes/wasm-mobile-notavail.rst:3 +msgid ":ref:`Availability `: not Android, not iOS, not WASI." +msgstr ":ref:`適用 `:、非 Android、非 iOS、非 WASI。" -#: ../../includes/wasm-notavail.rst:5 +#: ../../includes/wasm-mobile-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module is not supported on :ref:`mobile platforms ` or :ref:`WebAssembly platforms `." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在\\ :ref:`行動平台 `\\ 或\\ :ref:`WebAssembly 平" +"台 `\\ 上不支援。" #: ../../library/subprocess.rst:31 msgid "Using the :mod:`subprocess` Module" @@ -190,8 +189,8 @@ msgid "" msgstr "" #: ../../library/subprocess.rst:122 ../../library/subprocess.rst:506 -#: ../../library/subprocess.rst:1198 ../../library/subprocess.rst:1238 -#: ../../library/subprocess.rst:1301 +#: ../../library/subprocess.rst:1214 ../../library/subprocess.rst:1254 +#: ../../library/subprocess.rst:1317 msgid "" "Changed Windows shell search order for ``shell=True``. The current directory " "and ``%PATH%`` are replaced with ``%COMSPEC%`` and ``%SystemRoot%" @@ -392,8 +391,8 @@ msgid "" "binary streams. No encoding or line ending conversion is performed." msgstr "" -#: ../../library/subprocess.rst:314 ../../library/subprocess.rst:1553 -#: ../../library/subprocess.rst:1571 +#: ../../library/subprocess.rst:314 ../../library/subprocess.rst:1569 +#: ../../library/subprocess.rst:1587 msgid "Added the *encoding* and *errors* parameters." msgstr "新增 *encoding* 與 *errors* 參數。" @@ -863,7 +862,7 @@ msgstr "" msgid "*encoding* and *errors* were added." msgstr "新增 *encoding* 與 *errors*。" -#: ../../library/subprocess.rst:665 ../../library/subprocess.rst:1296 +#: ../../library/subprocess.rst:665 ../../library/subprocess.rst:1312 msgid "*text* was added as a more readable alias for *universal_newlines*." msgstr "" @@ -1100,8 +1099,8 @@ msgid "" msgstr "" #: ../../library/subprocess.rst:811 ../../library/subprocess.rst:852 -#: ../../library/subprocess.rst:1193 ../../library/subprocess.rst:1233 -#: ../../library/subprocess.rst:1287 +#: ../../library/subprocess.rst:1209 ../../library/subprocess.rst:1249 +#: ../../library/subprocess.rst:1303 msgid "*timeout* was added." msgstr "新增 *timeout*。" @@ -1422,52 +1421,65 @@ msgstr "" #: ../../library/subprocess.rst:1071 msgid "" +"A :attr:`STARTUPINFO.dwFlags` parameter to specify that the *Working in " +"Background* mouse cursor will be displayed while a process is launching. " +"This is the default behavior for GUI processes." +msgstr "" + +#: ../../library/subprocess.rst:1080 +msgid "" +"A :attr:`STARTUPINFO.dwFlags` parameter to specify that the mouse cursor " +"will not be changed when launching a process." +msgstr "" + +#: ../../library/subprocess.rst:1087 +msgid "" "The new process has a new console, instead of inheriting its parent's " "console (the default)." msgstr "" -#: ../../library/subprocess.rst:1076 +#: ../../library/subprocess.rst:1092 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "group will be created. This flag is necessary for using :func:`os.kill` on " "the subprocess." msgstr "" -#: ../../library/subprocess.rst:1080 +#: ../../library/subprocess.rst:1096 msgid "This flag is ignored if :data:`CREATE_NEW_CONSOLE` is specified." msgstr "" -#: ../../library/subprocess.rst:1084 +#: ../../library/subprocess.rst:1100 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have an above average priority." msgstr "" -#: ../../library/subprocess.rst:1091 +#: ../../library/subprocess.rst:1107 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a below average priority." msgstr "" -#: ../../library/subprocess.rst:1098 +#: ../../library/subprocess.rst:1114 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a high priority." msgstr "" -#: ../../library/subprocess.rst:1105 +#: ../../library/subprocess.rst:1121 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have an idle (lowest) priority." msgstr "" -#: ../../library/subprocess.rst:1112 +#: ../../library/subprocess.rst:1128 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have a normal priority. (default)" msgstr "" -#: ../../library/subprocess.rst:1119 +#: ../../library/subprocess.rst:1135 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will have realtime priority. You should almost never use " @@ -1477,20 +1489,20 @@ msgid "" "perform brief tasks that should have limited interruptions." msgstr "" -#: ../../library/subprocess.rst:1130 +#: ../../library/subprocess.rst:1146 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will not create a window." msgstr "" -#: ../../library/subprocess.rst:1137 +#: ../../library/subprocess.rst:1153 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "will not inherit its parent's console. This value cannot be used with " "CREATE_NEW_CONSOLE." msgstr "" -#: ../../library/subprocess.rst:1145 +#: ../../library/subprocess.rst:1161 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "does not inherit the error mode of the calling process. Instead, the new " @@ -1498,43 +1510,43 @@ msgid "" "multithreaded shell applications that run with hard errors disabled." msgstr "" -#: ../../library/subprocess.rst:1155 +#: ../../library/subprocess.rst:1171 msgid "" "A :class:`Popen` ``creationflags`` parameter to specify that a new process " "is not associated with the job." msgstr "" -#: ../../library/subprocess.rst:1163 +#: ../../library/subprocess.rst:1179 msgid "Older high-level API" msgstr "" -#: ../../library/subprocess.rst:1165 +#: ../../library/subprocess.rst:1181 msgid "" "Prior to Python 3.5, these three functions comprised the high level API to " "subprocess. You can now use :func:`run` in many cases, but lots of existing " "code calls these functions." msgstr "" -#: ../../library/subprocess.rst:1172 +#: ../../library/subprocess.rst:1188 msgid "" "Run the command described by *args*. Wait for command to complete, then " "return the :attr:`~Popen.returncode` attribute." msgstr "" -#: ../../library/subprocess.rst:1175 ../../library/subprocess.rst:1215 +#: ../../library/subprocess.rst:1191 ../../library/subprocess.rst:1231 msgid "" "Code needing to capture stdout or stderr should use :func:`run` instead::" msgstr "" -#: ../../library/subprocess.rst:1177 +#: ../../library/subprocess.rst:1193 msgid "run(...).returncode" msgstr "run(...).returncode" -#: ../../library/subprocess.rst:1179 ../../library/subprocess.rst:1219 +#: ../../library/subprocess.rst:1195 ../../library/subprocess.rst:1235 msgid "To suppress stdout or stderr, supply a value of :data:`DEVNULL`." msgstr "" -#: ../../library/subprocess.rst:1181 ../../library/subprocess.rst:1221 +#: ../../library/subprocess.rst:1197 ../../library/subprocess.rst:1237 msgid "" "The arguments shown above are merely some common ones. The full function " "signature is the same as that of the :class:`Popen` constructor - this " @@ -1542,14 +1554,14 @@ msgid "" "to that interface." msgstr "" -#: ../../library/subprocess.rst:1188 ../../library/subprocess.rst:1228 +#: ../../library/subprocess.rst:1204 ../../library/subprocess.rst:1244 msgid "" "Do not use ``stdout=PIPE`` or ``stderr=PIPE`` with this function. The child " "process will block if it generates enough output to a pipe to fill up the OS " "pipe buffer as the pipes are not being read from." msgstr "" -#: ../../library/subprocess.rst:1208 +#: ../../library/subprocess.rst:1224 msgid "" "Run command with arguments. Wait for command to complete. If the return " "code was zero then return, otherwise raise :exc:`CalledProcessError`. The :" @@ -1558,15 +1570,15 @@ msgid "" "to start the process it will propagate the exception that was raised." msgstr "" -#: ../../library/subprocess.rst:1217 +#: ../../library/subprocess.rst:1233 msgid "run(..., check=True)" msgstr "run(..., check=True)" -#: ../../library/subprocess.rst:1250 +#: ../../library/subprocess.rst:1266 msgid "Run command with arguments and return its output." msgstr "" -#: ../../library/subprocess.rst:1252 +#: ../../library/subprocess.rst:1268 msgid "" "If the return code was non-zero it raises a :exc:`CalledProcessError`. The :" "exc:`CalledProcessError` object will have the return code in the :attr:" @@ -1574,15 +1586,15 @@ msgid "" "`~CalledProcessError.output` attribute." msgstr "" -#: ../../library/subprocess.rst:1257 +#: ../../library/subprocess.rst:1273 msgid "This is equivalent to::" msgstr "這等同於: ::" -#: ../../library/subprocess.rst:1259 +#: ../../library/subprocess.rst:1275 msgid "run(..., check=True, stdout=PIPE).stdout" msgstr "run(..., check=True, stdout=PIPE).stdout" -#: ../../library/subprocess.rst:1261 +#: ../../library/subprocess.rst:1277 msgid "" "The arguments shown above are merely some common ones. The full function " "signature is largely the same as that of :func:`run` - most arguments are " @@ -1592,27 +1604,27 @@ msgid "" "using the parent's standard input file handle." msgstr "" -#: ../../library/subprocess.rst:1268 +#: ../../library/subprocess.rst:1284 msgid "" "By default, this function will return the data as encoded bytes. The actual " "encoding of the output data may depend on the command being invoked, so the " "decoding to text will often need to be handled at the application level." msgstr "" -#: ../../library/subprocess.rst:1272 +#: ../../library/subprocess.rst:1288 msgid "" "This behaviour may be overridden by setting *text*, *encoding*, *errors*, or " "*universal_newlines* to ``True`` as described in :ref:`frequently-used-" "arguments` and :func:`run`." msgstr "" -#: ../../library/subprocess.rst:1276 +#: ../../library/subprocess.rst:1292 msgid "" "To also capture standard error in the result, use ``stderr=subprocess." "STDOUT``::" msgstr "" -#: ../../library/subprocess.rst:1279 +#: ../../library/subprocess.rst:1295 msgid "" ">>> subprocess.check_output(\n" "... \"ls non_existent_file; exit 0\",\n" @@ -1626,32 +1638,32 @@ msgstr "" "... shell=True)\n" "'ls: non_existent_file: No such file or directory\\n'" -#: ../../library/subprocess.rst:1290 +#: ../../library/subprocess.rst:1306 msgid "Support for the *input* keyword argument was added." msgstr "新增 *input* 關鍵字引數的支援。" -#: ../../library/subprocess.rst:1293 +#: ../../library/subprocess.rst:1309 msgid "*encoding* and *errors* were added. See :func:`run` for details." msgstr "新增 *encoding* 與 *errors*。細節請見 :func:`run`。" -#: ../../library/subprocess.rst:1311 +#: ../../library/subprocess.rst:1327 msgid "Replacing Older Functions with the :mod:`subprocess` Module" msgstr "" -#: ../../library/subprocess.rst:1313 +#: ../../library/subprocess.rst:1329 msgid "" "In this section, \"a becomes b\" means that b can be used as a replacement " "for a." msgstr "" -#: ../../library/subprocess.rst:1317 +#: ../../library/subprocess.rst:1333 msgid "" "All \"a\" functions in this section fail (more or less) silently if the " "executed program cannot be found; the \"b\" replacements raise :exc:" "`OSError` instead." msgstr "" -#: ../../library/subprocess.rst:1321 +#: ../../library/subprocess.rst:1337 msgid "" "In addition, the replacements using :func:`check_output` will fail with a :" "exc:`CalledProcessError` if the requested operation produces a non-zero " @@ -1659,38 +1671,38 @@ msgid "" "output` attribute of the raised exception." msgstr "" -#: ../../library/subprocess.rst:1326 +#: ../../library/subprocess.rst:1342 msgid "" "In the following examples, we assume that the relevant functions have " "already been imported from the :mod:`subprocess` module." msgstr "" -#: ../../library/subprocess.rst:1331 +#: ../../library/subprocess.rst:1347 msgid "Replacing :program:`/bin/sh` shell command substitution" msgstr "" -#: ../../library/subprocess.rst:1333 +#: ../../library/subprocess.rst:1349 msgid "output=$(mycmd myarg)" msgstr "output=$(mycmd myarg)" -#: ../../library/subprocess.rst:1337 ../../library/subprocess.rst:1348 -#: ../../library/subprocess.rst:1365 +#: ../../library/subprocess.rst:1353 ../../library/subprocess.rst:1364 +#: ../../library/subprocess.rst:1381 msgid "becomes::" msgstr "變成: ::" -#: ../../library/subprocess.rst:1339 +#: ../../library/subprocess.rst:1355 msgid "output = check_output([\"mycmd\", \"myarg\"])" msgstr "output = check_output([\"mycmd\", \"myarg\"])" -#: ../../library/subprocess.rst:1342 +#: ../../library/subprocess.rst:1358 msgid "Replacing shell pipeline" msgstr "" -#: ../../library/subprocess.rst:1344 ../../library/subprocess.rst:1361 +#: ../../library/subprocess.rst:1360 ../../library/subprocess.rst:1377 msgid "output=$(dmesg | grep hda)" msgstr "output=$(dmesg | grep hda)" -#: ../../library/subprocess.rst:1350 +#: ../../library/subprocess.rst:1366 msgid "" "p1 = Popen([\"dmesg\"], stdout=PIPE)\n" "p2 = Popen([\"grep\", \"hda\"], stdin=p1.stdout, stdout=PIPE)\n" @@ -1698,27 +1710,27 @@ msgid "" "output = p2.communicate()[0]" msgstr "" -#: ../../library/subprocess.rst:1355 +#: ../../library/subprocess.rst:1371 msgid "" "The ``p1.stdout.close()`` call after starting the p2 is important in order " "for p1 to receive a SIGPIPE if p2 exits before p1." msgstr "" -#: ../../library/subprocess.rst:1358 +#: ../../library/subprocess.rst:1374 msgid "" "Alternatively, for trusted input, the shell's own pipeline support may still " "be used directly:" msgstr "" -#: ../../library/subprocess.rst:1367 +#: ../../library/subprocess.rst:1383 msgid "output = check_output(\"dmesg | grep hda\", shell=True)" msgstr "output = check_output(\"dmesg | grep hda\", shell=True)" -#: ../../library/subprocess.rst:1371 +#: ../../library/subprocess.rst:1387 msgid "Replacing :func:`os.system`" msgstr "" -#: ../../library/subprocess.rst:1375 +#: ../../library/subprocess.rst:1391 msgid "" "sts = os.system(\"mycmd\" + \" myarg\")\n" "# becomes\n" @@ -1728,32 +1740,32 @@ msgstr "" "# 變成\n" "retcode = call(\"mycmd\" + \" myarg\", shell=True)" -#: ../../library/subprocess.rst:1379 +#: ../../library/subprocess.rst:1395 msgid "Notes:" msgstr "註解:" -#: ../../library/subprocess.rst:1381 +#: ../../library/subprocess.rst:1397 msgid "Calling the program through the shell is usually not required." msgstr "" -#: ../../library/subprocess.rst:1382 +#: ../../library/subprocess.rst:1398 msgid "" "The :func:`call` return value is encoded differently to that of :func:`os." "system`." msgstr "" -#: ../../library/subprocess.rst:1385 +#: ../../library/subprocess.rst:1401 msgid "" "The :func:`os.system` function ignores SIGINT and SIGQUIT signals while the " "command is running, but the caller must do this separately when using the :" "mod:`subprocess` module." msgstr "" -#: ../../library/subprocess.rst:1389 +#: ../../library/subprocess.rst:1405 msgid "A more realistic example would look like this::" msgstr "" -#: ../../library/subprocess.rst:1391 +#: ../../library/subprocess.rst:1407 msgid "" "try:\n" " retcode = call(\"mycmd\" + \" myarg\", shell=True)\n" @@ -1775,15 +1787,15 @@ msgstr "" "except OSError as e:\n" " print(\"Execution failed:\", e, file=sys.stderr)" -#: ../../library/subprocess.rst:1402 +#: ../../library/subprocess.rst:1418 msgid "Replacing the :func:`os.spawn ` family" msgstr "" -#: ../../library/subprocess.rst:1404 +#: ../../library/subprocess.rst:1420 msgid "P_NOWAIT example::" msgstr "P_NOWAIT 範例: ::" -#: ../../library/subprocess.rst:1406 +#: ../../library/subprocess.rst:1422 msgid "" "pid = os.spawnlp(os.P_NOWAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\")\n" "==>\n" @@ -1793,11 +1805,11 @@ msgstr "" "==>\n" "pid = Popen([\"/bin/mycmd\", \"myarg\"]).pid" -#: ../../library/subprocess.rst:1410 +#: ../../library/subprocess.rst:1426 msgid "P_WAIT example::" msgstr "P_WAIT 範例: ::" -#: ../../library/subprocess.rst:1412 +#: ../../library/subprocess.rst:1428 msgid "" "retcode = os.spawnlp(os.P_WAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\")\n" "==>\n" @@ -1807,11 +1819,11 @@ msgstr "" "==>\n" "retcode = call([\"/bin/mycmd\", \"myarg\"])" -#: ../../library/subprocess.rst:1416 +#: ../../library/subprocess.rst:1432 msgid "Vector example::" msgstr "" -#: ../../library/subprocess.rst:1418 +#: ../../library/subprocess.rst:1434 msgid "" "os.spawnvp(os.P_NOWAIT, path, args)\n" "==>\n" @@ -1821,11 +1833,11 @@ msgstr "" "==>\n" "Popen([path] + args[1:])" -#: ../../library/subprocess.rst:1422 +#: ../../library/subprocess.rst:1438 msgid "Environment example::" msgstr "" -#: ../../library/subprocess.rst:1424 +#: ../../library/subprocess.rst:1440 msgid "" "os.spawnlpe(os.P_NOWAIT, \"/bin/mycmd\", \"mycmd\", \"myarg\", env)\n" "==>\n" @@ -1835,11 +1847,11 @@ msgstr "" "==>\n" "Popen([\"/bin/mycmd\", \"myarg\"], env={\"PATH\": \"/usr/bin\"})" -#: ../../library/subprocess.rst:1431 +#: ../../library/subprocess.rst:1447 msgid "Replacing :func:`os.popen`, :func:`os.popen2`, :func:`os.popen3`" msgstr "" -#: ../../library/subprocess.rst:1435 +#: ../../library/subprocess.rst:1451 msgid "" "(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize)\n" "==>\n" @@ -1853,7 +1865,7 @@ msgstr "" " stdin=PIPE, stdout=PIPE, close_fds=True)\n" "(child_stdin, child_stdout) = (p.stdin, p.stdout)" -#: ../../library/subprocess.rst:1443 +#: ../../library/subprocess.rst:1459 msgid "" "(child_stdin,\n" " child_stdout,\n" @@ -1875,7 +1887,7 @@ msgstr "" " child_stdout,\n" " child_stderr) = (p.stdin, p.stdout, p.stderr)" -#: ../../library/subprocess.rst:1455 +#: ../../library/subprocess.rst:1471 msgid "" "(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize)\n" "==>\n" @@ -1889,11 +1901,11 @@ msgstr "" " stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)\n" "(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)" -#: ../../library/subprocess.rst:1461 +#: ../../library/subprocess.rst:1477 msgid "Return code handling translates as follows::" msgstr "" -#: ../../library/subprocess.rst:1463 +#: ../../library/subprocess.rst:1479 msgid "" "pipe = os.popen(cmd, 'w')\n" "...\n" @@ -1919,17 +1931,17 @@ msgstr "" "if process.wait() != 0:\n" " print(\"There were some errors\")" -#: ../../library/subprocess.rst:1477 +#: ../../library/subprocess.rst:1493 msgid "Replacing functions from the :mod:`!popen2` module" msgstr "" -#: ../../library/subprocess.rst:1481 +#: ../../library/subprocess.rst:1497 msgid "" "If the cmd argument to popen2 functions is a string, the command is executed " "through /bin/sh. If it is a list, the command is directly executed." msgstr "" -#: ../../library/subprocess.rst:1486 +#: ../../library/subprocess.rst:1502 msgid "" "(child_stdout, child_stdin) = popen2.popen2(\"somestring\", bufsize, mode)\n" "==>\n" @@ -1943,7 +1955,7 @@ msgstr "" " stdin=PIPE, stdout=PIPE, close_fds=True)\n" "(child_stdout, child_stdin) = (p.stdout, p.stdin)" -#: ../../library/subprocess.rst:1494 +#: ../../library/subprocess.rst:1510 msgid "" "(child_stdout, child_stdin) = popen2.popen2([\"mycmd\", \"myarg\"], bufsize, " "mode)\n" @@ -1959,36 +1971,36 @@ msgstr "" " stdin=PIPE, stdout=PIPE, close_fds=True)\n" "(child_stdout, child_stdin) = (p.stdout, p.stdin)" -#: ../../library/subprocess.rst:1500 +#: ../../library/subprocess.rst:1516 msgid "" ":class:`popen2.Popen3` and :class:`popen2.Popen4` basically work as :class:" "`subprocess.Popen`, except that:" msgstr "" -#: ../../library/subprocess.rst:1503 +#: ../../library/subprocess.rst:1519 msgid ":class:`Popen` raises an exception if the execution fails." msgstr "" -#: ../../library/subprocess.rst:1505 +#: ../../library/subprocess.rst:1521 msgid "The *capturestderr* argument is replaced with the *stderr* argument." msgstr "" -#: ../../library/subprocess.rst:1507 +#: ../../library/subprocess.rst:1523 msgid "``stdin=PIPE`` and ``stdout=PIPE`` must be specified." msgstr "" -#: ../../library/subprocess.rst:1509 +#: ../../library/subprocess.rst:1525 msgid "" "popen2 closes all file descriptors by default, but you have to specify " "``close_fds=True`` with :class:`Popen` to guarantee this behavior on all " "platforms or past Python versions." msgstr "" -#: ../../library/subprocess.rst:1515 +#: ../../library/subprocess.rst:1531 msgid "Legacy Shell Invocation Functions" msgstr "" -#: ../../library/subprocess.rst:1517 +#: ../../library/subprocess.rst:1533 msgid "" "This module also provides the following legacy functions from the 2.x " "``commands`` module. These operations implicitly invoke the system shell and " @@ -1996,11 +2008,11 @@ msgid "" "handling consistency are valid for these functions." msgstr "" -#: ../../library/subprocess.rst:1524 +#: ../../library/subprocess.rst:1540 msgid "Return ``(exitcode, output)`` of executing *cmd* in a shell." msgstr "" -#: ../../library/subprocess.rst:1526 +#: ../../library/subprocess.rst:1542 msgid "" "Execute the string *cmd* in a shell with :meth:`Popen.check_output` and " "return a 2-tuple ``(exitcode, output)``. *encoding* and *errors* are used to " @@ -2008,13 +2020,13 @@ msgid "" "details." msgstr "" -#: ../../library/subprocess.rst:1531 +#: ../../library/subprocess.rst:1547 msgid "" "A trailing newline is stripped from the output. The exit code for the " "command can be interpreted as the return code of subprocess. Example::" msgstr "" -#: ../../library/subprocess.rst:1535 +#: ../../library/subprocess.rst:1551 msgid "" ">>> subprocess.getstatusoutput('ls /bin/ls')\n" "(0, '/bin/ls')\n" @@ -2034,32 +2046,32 @@ msgstr "" ">>> subprocess.getstatusoutput('/bin/kill $$')\n" "(-15, '')" -#: ../../library/subprocess.rst:1544 ../../library/subprocess.rst:1566 +#: ../../library/subprocess.rst:1560 ../../library/subprocess.rst:1582 msgid ":ref:`Availability `: Unix, Windows." msgstr ":ref:`適用 `:Unix 和 Windows。" -#: ../../library/subprocess.rst:1546 +#: ../../library/subprocess.rst:1562 msgid "Windows support was added." msgstr "新增對 Windows 的支援。" -#: ../../library/subprocess.rst:1549 +#: ../../library/subprocess.rst:1565 msgid "" "The function now returns (exitcode, output) instead of (status, output) as " "it did in Python 3.3.3 and earlier. exitcode has the same value as :attr:" "`~Popen.returncode`." msgstr "" -#: ../../library/subprocess.rst:1558 +#: ../../library/subprocess.rst:1574 msgid "Return output (stdout and stderr) of executing *cmd* in a shell." msgstr "" -#: ../../library/subprocess.rst:1560 +#: ../../library/subprocess.rst:1576 msgid "" "Like :func:`getstatusoutput`, except the exit code is ignored and the return " "value is a string containing the command's output. Example::" msgstr "" -#: ../../library/subprocess.rst:1563 +#: ../../library/subprocess.rst:1579 msgid "" ">>> subprocess.getoutput('ls /bin/ls')\n" "'/bin/ls'" @@ -2067,50 +2079,50 @@ msgstr "" ">>> subprocess.getoutput('ls /bin/ls')\n" "'/bin/ls'" -#: ../../library/subprocess.rst:1568 +#: ../../library/subprocess.rst:1584 msgid "Windows support added" msgstr "新增對 Windows 的支援" -#: ../../library/subprocess.rst:1576 +#: ../../library/subprocess.rst:1592 msgid "Notes" msgstr "註解" -#: ../../library/subprocess.rst:1581 +#: ../../library/subprocess.rst:1597 msgid "Converting an argument sequence to a string on Windows" msgstr "" -#: ../../library/subprocess.rst:1583 +#: ../../library/subprocess.rst:1599 msgid "" "On Windows, an *args* sequence is converted to a string that can be parsed " "using the following rules (which correspond to the rules used by the MS C " "runtime):" msgstr "" -#: ../../library/subprocess.rst:1587 +#: ../../library/subprocess.rst:1603 msgid "" "Arguments are delimited by white space, which is either a space or a tab." msgstr "" -#: ../../library/subprocess.rst:1590 +#: ../../library/subprocess.rst:1606 msgid "" "A string surrounded by double quotation marks is interpreted as a single " "argument, regardless of white space contained within. A quoted string can " "be embedded in an argument." msgstr "" -#: ../../library/subprocess.rst:1595 +#: ../../library/subprocess.rst:1611 msgid "" "A double quotation mark preceded by a backslash is interpreted as a literal " "double quotation mark." msgstr "" -#: ../../library/subprocess.rst:1598 +#: ../../library/subprocess.rst:1614 msgid "" "Backslashes are interpreted literally, unless they immediately precede a " "double quotation mark." msgstr "" -#: ../../library/subprocess.rst:1601 +#: ../../library/subprocess.rst:1617 msgid "" "If backslashes immediately precede a double quotation mark, every pair of " "backslashes is interpreted as a literal backslash. If the number of " @@ -2118,19 +2130,19 @@ msgid "" "mark as described in rule 3." msgstr "" -#: ../../library/subprocess.rst:1610 +#: ../../library/subprocess.rst:1626 msgid ":mod:`shlex`" msgstr ":mod:`shlex`" -#: ../../library/subprocess.rst:1611 +#: ../../library/subprocess.rst:1627 msgid "Module which provides function to parse and escape command lines." msgstr "" -#: ../../library/subprocess.rst:1618 +#: ../../library/subprocess.rst:1634 msgid "Disabling use of ``vfork()`` or ``posix_spawn()``" msgstr "停用 ``vfork()`` 或 ``posix_spawn()``" -#: ../../library/subprocess.rst:1620 +#: ../../library/subprocess.rst:1636 msgid "" "On Linux, :mod:`subprocess` defaults to using the ``vfork()`` system call " "internally when it is safe to do so rather than ``fork()``. This greatly " @@ -2139,7 +2151,7 @@ msgstr "" "在 Linux 上,:mod:`subprocess` 在安全的情況下預設會在內部使用 ``vfork()`` 系" "統呼叫,而不是 ``fork()``,這顯著地提高了性能。" -#: ../../library/subprocess.rst:1624 +#: ../../library/subprocess.rst:1640 msgid "" "If you ever encounter a presumed highly unusual situation where you need to " "prevent ``vfork()`` from being used by Python, you can set the :const:" @@ -2148,11 +2160,11 @@ msgstr "" "如果你遇到了一個推定為極異常的情況,需要防止 Python 使用 ``vfork()``,你可以" "將 :const:`subprocess._USE_VFORK` 屬性設為 false 值。" -#: ../../library/subprocess.rst:1630 +#: ../../library/subprocess.rst:1646 msgid "subprocess._USE_VFORK = False # See CPython issue gh-NNNNNN." msgstr "subprocess._USE_VFORK = False # 見 CPython 問題 gh-NNNNNN." -#: ../../library/subprocess.rst:1632 +#: ../../library/subprocess.rst:1648 msgid "" "Setting this has no impact on use of ``posix_spawn()`` which could use " "``vfork()`` internally within its libc implementation. There is a similar :" @@ -2163,11 +2175,11 @@ msgstr "" "``vfork()``。如果你需要封鎖該屬性的使用,則有一個類似的 :const:`subprocess." "_USE_POSIX_SPAWN` 屬性。" -#: ../../library/subprocess.rst:1639 +#: ../../library/subprocess.rst:1655 msgid "subprocess._USE_POSIX_SPAWN = False # See CPython issue gh-NNNNNN." msgstr "subprocess._USE_POSIX_SPAWN = False # 見 CPython 問題 gh-NNNNNN." -#: ../../library/subprocess.rst:1641 +#: ../../library/subprocess.rst:1657 msgid "" "It is safe to set these to false on any Python version. They will have no " "effect on older versions when unsupported. Do not assume the attributes are " @@ -2178,7 +2190,7 @@ msgstr "" "沒有影響。不要假設屬性可供讀取。儘管有它們的名稱,真實值並不表示將使用相應的" "函式,而只是表示可能會使用。" -#: ../../library/subprocess.rst:1646 +#: ../../library/subprocess.rst:1662 msgid "" "Please file issues any time you have to use these private knobs with a way " "to reproduce the issue you were seeing. Link to that issue from a comment in " @@ -2187,11 +2199,11 @@ msgstr "" "每當你需要使用這些私有開關以重現你所看到的問題時,請隨時提出問題 (file " "issues)。從程式碼中的註解連結到該問題。" -#: ../../library/subprocess.rst:1650 +#: ../../library/subprocess.rst:1666 msgid "``_USE_POSIX_SPAWN``" msgstr "``_USE_POSIX_SPAWN``" -#: ../../library/subprocess.rst:1651 +#: ../../library/subprocess.rst:1667 msgid "``_USE_VFORK``" msgstr "``_USE_VFORK``" @@ -2202,3 +2214,13 @@ msgstr "universal newlines" #: ../../library/subprocess.rst:296 msgid "subprocess module" msgstr "subprocess 模組" + +#, fuzzy +#~ msgid "" +#~ "This module does not work or is not available on WebAssembly platforms, " +#~ "or on iOS. See :ref:`wasm-availability` for more information on WASM " +#~ "availability; see :ref:`iOS-availability` for more information on iOS " +#~ "availability." +#~ msgstr "" +#~ "此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法" +#~ "作用或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" diff --git a/library/sunau.po b/library/sunau.po deleted file mode 100644 index 1a7f604acb..0000000000 --- a/library/sunau.po +++ /dev/null @@ -1,386 +0,0 @@ -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -# Adrian Liaw , 2018 -# Matt Wang , 2022 -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" -"PO-Revision-Date: 2018-05-23 16:11+0000\n" -"Last-Translator: Matt Wang \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/sunau.rst:2 -msgid ":mod:`sunau` --- Read and write Sun AU files" -msgstr ":mod:`sunau` --- 讀寫 Sun AU 檔案" - -#: ../../library/sunau.rst:10 -msgid "**Source code:** :source:`Lib/sunau.py`" -msgstr "**原始碼:**\\ :source:`Lib/sunau.py`" - -#: ../../library/sunau.rst:12 -msgid "" -"The :mod:`sunau` module is deprecated (see :pep:`PEP 594 <594#sunau>` for " -"details)." -msgstr "" -":mod:`sunau` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#sunau>`\\ )。" - -#: ../../library/sunau.rst:18 -msgid "" -"The :mod:`sunau` module provides a convenient interface to the Sun AU sound " -"format. Note that this module is interface-compatible with the modules :mod:" -"`aifc` and :mod:`wave`." -msgstr "" -":mod:`sunau` 模組 (module) 提供了一個處理 Sun AU 聲音格式的便利介面。請注意此" -"模組與 :mod:`aifc` 和 :mod:`wave` 的介面是相容的。" - -#: ../../library/sunau.rst:22 -msgid "" -"An audio file consists of a header followed by the data. The fields of the " -"header are:" -msgstr "音訊檔案由標頭 (header) 和資料組成。標頭包含以下欄位:" - -#: ../../library/sunau.rst:26 -msgid "Field" -msgstr "欄位" - -#: ../../library/sunau.rst:26 -msgid "Contents" -msgstr "內容" - -#: ../../library/sunau.rst:28 -msgid "magic word" -msgstr "magic word" - -#: ../../library/sunau.rst:28 -msgid "The four bytes ``.snd``." -msgstr "四個位元組 ``.snd``。" - -#: ../../library/sunau.rst:30 -msgid "header size" -msgstr "header size" - -#: ../../library/sunau.rst:30 -msgid "Size of the header, including info, in bytes." -msgstr "標頭的大小,包括資訊,以位元組為單位。" - -#: ../../library/sunau.rst:32 -msgid "data size" -msgstr "data size" - -#: ../../library/sunau.rst:32 -msgid "Physical size of the data, in bytes." -msgstr "資料的物理大小,以位元組為單位。" - -#: ../../library/sunau.rst:34 -msgid "encoding" -msgstr "encoding" - -#: ../../library/sunau.rst:34 -msgid "Indicates how the audio samples are encoded." -msgstr "表示音訊取樣的編碼方式。" - -#: ../../library/sunau.rst:36 -msgid "sample rate" -msgstr "sample rate" - -#: ../../library/sunau.rst:36 -msgid "The sampling rate." -msgstr "取樣頻率。" - -#: ../../library/sunau.rst:38 -msgid "# of channels" -msgstr "# of channels" - -#: ../../library/sunau.rst:38 -msgid "The number of channels in the samples." -msgstr "取樣中的聲道數。" - -#: ../../library/sunau.rst:40 -msgid "info" -msgstr "info" - -#: ../../library/sunau.rst:40 -msgid "" -"ASCII string giving a description of the audio file (padded with null bytes)." -msgstr "音訊檔案描述的 ASCII 字串(會以空位元組填補 (pad))。" - -#: ../../library/sunau.rst:44 -msgid "" -"Apart from the info field, all header fields are 4 bytes in size. They are " -"all 32-bit unsigned integers encoded in big-endian byte order." -msgstr "" -"除了 info 欄位以外,所有其他標頭中欄位的大小都是 4 位元組,他們都是以 big-" -"endian 位元組順序所編碼的 32-bit(位元)unsigned integers(無符號整數)" - -#: ../../library/sunau.rst:47 -msgid "The :mod:`sunau` module defines the following functions:" -msgstr ":mod:`sunau` 模組定義了以下函式:" - -#: ../../library/sunau.rst:52 -msgid "" -"If *file* is a string, open the file by that name, otherwise treat it as a " -"seekable file-like object. *mode* can be any of" -msgstr "" -"如 *file* 是一個字串,則以此名開啟檔案,否則把它當作一個可以被搜尋的 file-" -"like object(類檔案物件)。*mode* 可以是以下任一" - -#: ../../library/sunau.rst:55 -msgid "``'r'``" -msgstr "``'r'``" - -#: ../../library/sunau.rst:56 -msgid "Read only mode." -msgstr "唯讀模式。" - -#: ../../library/sunau.rst:58 -msgid "``'w'``" -msgstr "``'w'``" - -#: ../../library/sunau.rst:59 -msgid "Write only mode." -msgstr "唯寫模式。" - -#: ../../library/sunau.rst:61 -msgid "Note that it does not allow read/write files." -msgstr "請注意這並不允許讀/寫檔案。" - -#: ../../library/sunau.rst:63 -msgid "" -"A *mode* of ``'r'`` returns an :class:`AU_read` object, while a *mode* of " -"``'w'`` or ``'wb'`` returns an :class:`AU_write` object." -msgstr "" -"*mode* 若設為 ``'r'`` 則會回傳一個 :class:`AU_read` 物件,若設為 ``'w'`` 或 " -"``'wb'`` 則回傳 :class:`AU_write` 物件。" - -#: ../../library/sunau.rst:67 -msgid "The :mod:`sunau` module defines the following exception:" -msgstr ":mod:`sunau` 模組定義了以下例外:" - -#: ../../library/sunau.rst:71 -msgid "" -"An error raised when something is impossible because of Sun AU specs or " -"implementation deficiency." -msgstr "在不符合 Sun AU 規格或實作上有所不足而無法達成某些目的時會引發的錯誤。" - -#: ../../library/sunau.rst:75 -msgid "The :mod:`sunau` module defines the following data items:" -msgstr ":mod:`sunau` 模組定義了以下資料條目:" - -#: ../../library/sunau.rst:79 -msgid "" -"An integer every valid Sun AU file begins with, stored in big-endian form. " -"This is the string ``.snd`` interpreted as an integer." -msgstr "" -"每個 Sun AU 檔案都會作為開頭的一個整數,以 big-endian 形式儲存。這也是 ``." -"snd`` 所直接轉譯成一個整數的字串。" - -#: ../../library/sunau.rst:90 -msgid "" -"Values of the encoding field from the AU header which are supported by this " -"module." -msgstr "此模組有支援的 AU 標頭中 encoding 欄位值。" - -#: ../../library/sunau.rst:101 -msgid "" -"Additional known values of the encoding field from the AU header, but which " -"are not supported by this module." -msgstr "額外已知的 AU 標頭中 encoding 欄位值,但不被此模組支援。" - -#: ../../library/sunau.rst:108 -msgid "AU_read Objects" -msgstr "AU_read 物件" - -#: ../../library/sunau.rst:110 -msgid "" -"AU_read objects, as returned by :func:`.open` above, have the following " -"methods:" -msgstr "如上述 :func:`.open` 所回傳的 AU_read 物件擁有以下 method(方法):" - -#: ../../library/sunau.rst:115 -msgid "" -"Close the stream, and make the instance unusable. (This is called " -"automatically on deletion.)" -msgstr "關閉串流 (stream),並使該實例無法被使用。(這會自動在刪除時呼叫。)" - -#: ../../library/sunau.rst:121 -msgid "Returns number of audio channels (1 for mono, 2 for stereo)." -msgstr "回傳音訊聲道數量(單聲道為 1,雙聲道為 2)。" - -#: ../../library/sunau.rst:126 -msgid "Returns sample width in bytes." -msgstr "回傳取樣位元組長度。" - -#: ../../library/sunau.rst:131 -msgid "Returns sampling frequency." -msgstr "回傳取樣頻率。" - -#: ../../library/sunau.rst:136 -msgid "Returns number of audio frames." -msgstr "回傳音訊總幀數。" - -#: ../../library/sunau.rst:141 -msgid "" -"Returns compression type. Supported compression types are ``'ULAW'``, " -"``'ALAW'`` and ``'NONE'``." -msgstr "回傳壓縮種類。支援的壓縮種類有 ``'ULAW'``、``'ALAW'`` 和 ``'NONE'``。" - -#: ../../library/sunau.rst:147 -msgid "" -"Human-readable version of :meth:`getcomptype`. The supported types have the " -"respective names ``'CCITT G.711 u-law'``, ``'CCITT G.711 A-law'`` and ``'not " -"compressed'``." -msgstr "" -"可被人類讀懂 (human-readable) 的 :meth:`getcomptype`。有被支援的種類分別有這" -"些名稱 ``'CCITT G.711 u-law'``、``'CCITT G.711 A-law'`` 和 ``'not " -"compressed'``。" - -#: ../../library/sunau.rst:154 -msgid "" -"Returns a :func:`~collections.namedtuple` ``(nchannels, sampwidth, " -"framerate, nframes, comptype, compname)``, equivalent to output of the :meth:" -"`get\\*` methods." -msgstr "" -"回傳一個 :func:`~collections.namedtuple` ``(nchannels, sampwidth, framerate, " -"nframes, comptype, compname)``,與 :meth:`get\\*` methods 的輸出相同。" - -#: ../../library/sunau.rst:161 -msgid "" -"Reads and returns at most *n* frames of audio, as a :class:`bytes` object. " -"The data will be returned in linear format. If the original data is in u-" -"LAW format, it will be converted." -msgstr "" -"讀取並以 :class:`bytes` 物件形式回傳音檔中至多 *n* 幀,資料會以線性格式 " -"(linear format) 回傳,如果原始資料是 u-LAW 格式,則它會被轉換。" - -#: ../../library/sunau.rst:168 -msgid "Rewind the file pointer to the beginning of the audio stream." -msgstr "重置檔案指標 (file pointer) 至音訊開頭。" - -#: ../../library/sunau.rst:170 -msgid "" -"The following two methods define a term \"position\" which is compatible " -"between them, and is otherwise implementation dependent." -msgstr "" -"以下兩個 methods 都定義了在它們之間相容的 \"position\",否則會與實作相依。" - -#: ../../library/sunau.rst:176 -msgid "" -"Set the file pointer to the specified position. Only values returned from :" -"meth:`tell` should be used for *pos*." -msgstr "" -"設定檔案指標至指定的位置,只有 :meth:`tell` 的回傳值應被做為 *pos* 使用。" - -#: ../../library/sunau.rst:182 -msgid "" -"Return current file pointer position. Note that the returned value has " -"nothing to do with the actual position in the file." -msgstr "回傳當前檔案指標位置,要注意回傳值和真實檔案中的位置無關。" - -#: ../../library/sunau.rst:185 -msgid "" -"The following two functions are defined for compatibility with the :mod:" -"`aifc`, and don't do anything interesting." -msgstr "以下兩個函式單純是為了和 :mod:`aifc` 相容而定義,並沒有做什麼特別的。" - -#: ../../library/sunau.rst:191 -msgid "Returns ``None``." -msgstr "回傳 ``None``。" - -#: ../../library/sunau.rst:196 -msgid "Raise an error." -msgstr "引發錯誤。" - -#: ../../library/sunau.rst:202 -msgid "AU_write Objects" -msgstr "AU_write 物件" - -#: ../../library/sunau.rst:204 -msgid "" -"AU_write objects, as returned by :func:`.open` above, have the following " -"methods:" -msgstr "如上述 :func:`.open` 所回傳的 AU_write 物件擁有以下 methods:" - -#: ../../library/sunau.rst:209 -msgid "Set the number of channels." -msgstr "設定聲道數。" - -#: ../../library/sunau.rst:214 -msgid "Set the sample width (in bytes.)" -msgstr "設定取樣寬度(以位元組為單位)。" - -#: ../../library/sunau.rst:216 -msgid "Added support for 24-bit samples." -msgstr "新增對於 24-bit 取樣的支援。" - -#: ../../library/sunau.rst:222 -msgid "Set the frame rate." -msgstr "設定影格率 (frame rate)。" - -#: ../../library/sunau.rst:227 -msgid "" -"Set the number of frames. This can be later changed, when and if more " -"frames are written." -msgstr "設定幀數,該值可以在寫入更多幀後修改。" - -#: ../../library/sunau.rst:233 -msgid "" -"Set the compression type and description. Only ``'NONE'`` and ``'ULAW'`` are " -"supported on output." -msgstr "設定壓縮種類和敘述,輸出只支援 ``'NONE'`` 和 ``'ULAW'``。" - -#: ../../library/sunau.rst:239 -msgid "" -"The *tuple* should be ``(nchannels, sampwidth, framerate, nframes, comptype, " -"compname)``, with values valid for the :meth:`set\\*` methods. Set all " -"parameters." -msgstr "" -"*tuple* 應為 ``(nchannels, sampwidth, framerate, nframes, comptype, " -"compname)`` 形式,各個值應該要是 :meth:`set\\*` methods 能有效接受的值。該函" -"數會一次設定所有參數。" - -#: ../../library/sunau.rst:246 -msgid "" -"Return current position in the file, with the same disclaimer for the :meth:" -"`AU_read.tell` and :meth:`AU_read.setpos` methods." -msgstr "" -"回傳當前檔案中的位置,帶有和 :meth:`AU_read.tell` 與 :meth:`AU_read.setpos` " -"方法相同的免責聲明 (disclaimer)。" - -#: ../../library/sunau.rst:252 -msgid "Write audio frames, without correcting *nframes*." -msgstr "寫入音訊資料但不更新 *nframes*。" - -#: ../../library/sunau.rst:254 ../../library/sunau.rst:262 -msgid "Any :term:`bytes-like object` is now accepted." -msgstr "現在可接受任意 :term:`bytes-like object`。" - -#: ../../library/sunau.rst:260 -msgid "Write audio frames and make sure *nframes* is correct." -msgstr "寫入音訊資料並更新 *nframes* 以確保其正確性。" - -#: ../../library/sunau.rst:268 -msgid "Make sure *nframes* is correct, and close the file." -msgstr "確保 *nframes* 是正確的,並關閉檔案。" - -#: ../../library/sunau.rst:270 -msgid "This method is called upon deletion." -msgstr "此 method 會在刪除時呼叫。" - -#: ../../library/sunau.rst:272 -msgid "" -"Note that it is invalid to set any parameters after calling :meth:" -"`writeframes` or :meth:`writeframesraw`." -msgstr "" -"請注意,在呼叫 :meth:`writeframes` 或 :meth:`writeframesraw` 後設定任何參數都" -"是無效的。" diff --git a/library/superseded.po b/library/superseded.po index 81bdaff9d0..179f3bcb8a 100644 --- a/library/superseded.po +++ b/library/superseded.po @@ -5,9 +5,9 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-26 18:54+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-02-15 20:45+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -24,9 +24,11 @@ msgid "Superseded Modules" msgstr "已被取代的模組" #: ../../library/superseded.rst:7 +#, fuzzy msgid "" -"The modules described in this chapter are deprecated and only kept for " -"backwards compatibility. They have been superseded by other modules." +"The modules described in this chapter are deprecated or :term:`soft " +"deprecated` and only kept for backwards compatibility. They have been " +"superseded by other modules." msgstr "" "此章節所描述的模組 (modules) 均已被棄用,僅為了向後相容性而被保留下來。它們已" "經被其他模組所取代。" diff --git a/library/symtable.po b/library/symtable.po index fb4abb8401..48c873ff47 100644 --- a/library/symtable.po +++ b/library/symtable.po @@ -5,9 +5,9 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,24 +55,63 @@ msgid "Examining Symbol Tables" msgstr "檢查符號表" #: ../../library/symtable.rst:36 +msgid "An enumeration indicating the type of a :class:`SymbolTable` object." +msgstr "" + +#: ../../library/symtable.rst:41 +msgid "Used for the symbol table of a module." +msgstr "" + +#: ../../library/symtable.rst:46 +msgid "Used for the symbol table of a function." +msgstr "" + +#: ../../library/symtable.rst:51 +msgid "Used for the symbol table of a class." +msgstr "" + +#: ../../library/symtable.rst:53 +msgid "" +"The following members refer to different flavors of :ref:`annotation scopes " +"`." +msgstr "" + +#: ../../library/symtable.rst:59 +msgid "" +"Used for annotations if ``from __future__ import annotations`` is active." +msgstr "" + +#: ../../library/symtable.rst:64 +msgid "Used for the symbol table of :keyword:`type` constructions." +msgstr "" + +#: ../../library/symtable.rst:69 +msgid "" +"Used for the symbol table of :ref:`generic functions ` " +"or :ref:`generic classes `." +msgstr "" + +#: ../../library/symtable.rst:75 +msgid "" +"Used for the symbol table of the bound, the constraint tuple or the default " +"value of a single type variable in the formal sense, i.e., a TypeVar, a " +"TypeVarTuple or a ParamSpec object (the latter two do not support a bound or " +"a constraint tuple)." +msgstr "" + +#: ../../library/symtable.rst:84 msgid "A namespace table for a block. The constructor is not public." msgstr "" "一個區塊 (block) 的命名空間表 (namespace table) 。建構函式 (constructor) 並不" "公開。" -#: ../../library/symtable.rst:40 +#: ../../library/symtable.rst:88 msgid "" -"Return the type of the symbol table. Possible values are ``'class'``, " -"``'module'``, ``'function'``, ``'annotation'``, ``'TypeVar bound'``, ``'type " -"alias'``, and ``'type parameter'``. The latter four refer to different " -"flavors of :ref:`annotation scopes `." +"Return the type of the symbol table. Possible values are members of the :" +"class:`SymbolTableType` enumeration." msgstr "" -"回傳符號表的種類。可能的值為 ``'class'``、``'module'``、``'function'``、" -"``'annotation'``、``'TypeVar bound'``、``'type alias'`` 和 ``'type " -"parameter'``。後四個是指不同的\\ :ref:`註釋範圍 (annotation scopes) " -"`。" -#: ../../library/symtable.rst:45 +#: ../../library/symtable.rst:91 msgid "" "Added ``'annotation'``, ``'TypeVar bound'``, ``'type alias'``, and ``'type " "parameter'`` as possible return values." @@ -80,11 +119,22 @@ msgstr "" "新增了 ``'annotation'``、``'TypeVar bound'``、``'type alias'`` 和 ``'type " "parameter'`` 作為可能的回傳值。" -#: ../../library/symtable.rst:51 +#: ../../library/symtable.rst:95 +msgid "Return values are members of the :class:`SymbolTableType` enumeration." +msgstr "" + +#: ../../library/symtable.rst:98 +msgid "" +"The exact values of the returned string may change in the future, and thus, " +"it is recommended to use :class:`SymbolTableType` members instead of hard-" +"coded strings." +msgstr "" + +#: ../../library/symtable.rst:104 msgid "Return the table's identifier." msgstr "回傳表的識別器。" -#: ../../library/symtable.rst:55 +#: ../../library/symtable.rst:108 msgid "" "Return the table's name. This is the name of the class if the table is for " "a class, the name of the function if the table is for a function, or " @@ -100,19 +150,19 @@ msgstr "" "類別、函式或型別別名的名稱。對於型別別名作用域,它是型別別名的名稱。對於 :" "class:`~typing.TypeVar` 綁定範圍,它會是 ``TypeVar`` 的名稱。" -#: ../../library/symtable.rst:65 +#: ../../library/symtable.rst:118 msgid "Return the number of the first line in the block this table represents." msgstr "回傳此表所代表的區塊中第一行的編號。" -#: ../../library/symtable.rst:69 +#: ../../library/symtable.rst:122 msgid "Return ``True`` if the locals in this table can be optimized." msgstr "如果可以最佳化該表中的區域變數,則回傳 ``True``。" -#: ../../library/symtable.rst:73 +#: ../../library/symtable.rst:126 msgid "Return ``True`` if the block is a nested class or function." msgstr "如果區塊是巢狀類別或函式,則回傳 ``True``。" -#: ../../library/symtable.rst:77 +#: ../../library/symtable.rst:130 msgid "" "Return ``True`` if the block has nested namespaces within it. These can be " "obtained with :meth:`get_children`." @@ -120,7 +170,7 @@ msgstr "" "如果區塊內有巢狀命名空間,則回傳 ``True``。這些可以通過 :meth:`get_children` " "獲得。" -#: ../../library/symtable.rst:82 +#: ../../library/symtable.rst:135 msgid "" "Return a view object containing the names of symbols in the table. See the :" "ref:`documentation of view objects `." @@ -128,121 +178,121 @@ msgstr "" "回傳包含表中符號之名稱的視圖物件 (view object)。請參閱\\ :ref:`視圖物件的文" "件 `。" -#: ../../library/symtable.rst:87 +#: ../../library/symtable.rst:140 msgid "Lookup *name* in the table and return a :class:`Symbol` instance." msgstr "在表中查找 *name* 並回傳一個 :class:`Symbol` 實例。" -#: ../../library/symtable.rst:91 +#: ../../library/symtable.rst:144 msgid "Return a list of :class:`Symbol` instances for names in the table." msgstr "回傳表中名稱的 :class:`Symbol` 實例串列。" -#: ../../library/symtable.rst:95 +#: ../../library/symtable.rst:148 msgid "Return a list of the nested symbol tables." msgstr "回傳巢狀符號表的串列。" -#: ../../library/symtable.rst:100 +#: ../../library/symtable.rst:153 msgid "" "A namespace for a function or method. This class inherits from :class:" "`SymbolTable`." msgstr "一個函式或方法的命名空間。該類別繼承自 :class:`SymbolTable`。" -#: ../../library/symtable.rst:105 +#: ../../library/symtable.rst:158 msgid "Return a tuple containing names of parameters to this function." msgstr "回傳一個包含此函式參數名稱的元組 (tuple)。" -#: ../../library/symtable.rst:109 +#: ../../library/symtable.rst:162 msgid "Return a tuple containing names of locals in this function." msgstr "回傳一個包含此函式中區域變數 (locals) 名稱的元組。" -#: ../../library/symtable.rst:113 +#: ../../library/symtable.rst:166 msgid "Return a tuple containing names of globals in this function." msgstr "回傳一個包含此函式中全域變數 (globals) 名稱的元組。" -#: ../../library/symtable.rst:117 +#: ../../library/symtable.rst:170 msgid "Return a tuple containing names of nonlocals in this function." msgstr "回傳一個包含此函式中非區域變數 (nonlocals) 名稱的元組。" -#: ../../library/symtable.rst:121 +#: ../../library/symtable.rst:174 msgid "Return a tuple containing names of free variables in this function." msgstr "回傳一個包含此函式中自由變數 (free variables) 名稱的元組。" -#: ../../library/symtable.rst:126 +#: ../../library/symtable.rst:179 msgid "A namespace of a class. This class inherits from :class:`SymbolTable`." msgstr "一個類別的命名空間。該類別繼承自 :class:`SymbolTable`。" -#: ../../library/symtable.rst:130 +#: ../../library/symtable.rst:183 msgid "" "Return a tuple containing the names of method-like functions declared in the " "class." msgstr "回傳一個包含類別中聲明的類似方法之函式名稱的元組。" -#: ../../library/symtable.rst:133 +#: ../../library/symtable.rst:186 msgid "" "Here, the term 'method' designates *any* function defined in the class body " "via :keyword:`def` or :keyword:`async def`." msgstr "" -#: ../../library/symtable.rst:136 +#: ../../library/symtable.rst:189 msgid "" "Functions defined in a deeper scope (e.g., in an inner class) are not picked " "up by :meth:`get_methods`." msgstr "" -#: ../../library/symtable.rst:139 +#: ../../library/symtable.rst:192 msgid "For example:" msgstr "舉例來說:" -#: ../../library/symtable.rst:161 +#: ../../library/symtable.rst:214 msgid "" "Although ``A().f()`` raises :exc:`TypeError` at runtime, ``A.f`` is still " "considered as a method-like function." msgstr "" -#: ../../library/symtable.rst:166 +#: ../../library/symtable.rst:219 msgid "" "An entry in a :class:`SymbolTable` corresponding to an identifier in the " "source. The constructor is not public." msgstr "" ":class:`SymbolTable` 中的條目對應於來源中的識別器。建構函式不是公開的。" -#: ../../library/symtable.rst:171 +#: ../../library/symtable.rst:224 msgid "Return the symbol's name." msgstr "回傳符號的名稱。" -#: ../../library/symtable.rst:175 +#: ../../library/symtable.rst:228 msgid "Return ``True`` if the symbol is used in its block." msgstr "如果該符號在其區塊中使用,則回傳 ``True``。" -#: ../../library/symtable.rst:179 +#: ../../library/symtable.rst:232 msgid "Return ``True`` if the symbol is created from an import statement." msgstr "如果符號是從 import 陳述式建立的,則回傳 ``True``。" -#: ../../library/symtable.rst:183 +#: ../../library/symtable.rst:236 msgid "Return ``True`` if the symbol is a parameter." msgstr "如果符號是一個參數,則回傳 ``True``。" -#: ../../library/symtable.rst:187 +#: ../../library/symtable.rst:240 msgid "Return ``True`` if the symbol is global." msgstr "如果符號是全域的,則回傳 ``True``。" -#: ../../library/symtable.rst:191 +#: ../../library/symtable.rst:244 msgid "Return ``True`` if the symbol is nonlocal." msgstr "如果符號是非區域的,則回傳 ``True``。" -#: ../../library/symtable.rst:195 +#: ../../library/symtable.rst:248 msgid "" "Return ``True`` if the symbol is declared global with a global statement." msgstr "如果使用全域陳述式將符號聲明為全域的,則回傳 ``True``。" -#: ../../library/symtable.rst:199 +#: ../../library/symtable.rst:252 msgid "Return ``True`` if the symbol is local to its block." msgstr "如果符號是其區塊的區域符號,則回傳 ``True``。" -#: ../../library/symtable.rst:203 +#: ../../library/symtable.rst:256 msgid "Return ``True`` if the symbol is annotated." msgstr "如果符號有被註釋,則回傳 ``True``。" -#: ../../library/symtable.rst:209 +#: ../../library/symtable.rst:262 msgid "" "Return ``True`` if the symbol is referenced in its block, but not assigned " "to." @@ -250,25 +300,25 @@ msgstr "" "如果該符號在其區塊中被參照 (referenced) 但未被賦值 (assigned),則回傳 " "``True``。" -#: ../../library/symtable.rst:214 +#: ../../library/symtable.rst:267 msgid "Return ``True`` if the symbol is assigned to in its block." msgstr "如果該符號被賦值到其區塊中,則回傳 ``True``。" -#: ../../library/symtable.rst:218 +#: ../../library/symtable.rst:271 msgid "Return ``True`` if name binding introduces new namespace." msgstr "如果名稱綁定引入 (introduce) 新的命名空間,則回傳 ``True``。" -#: ../../library/symtable.rst:220 +#: ../../library/symtable.rst:273 msgid "" "If the name is used as the target of a function or class statement, this " "will be true." msgstr "如果名稱用作函式或類別陳述式的目標,則這將會是 true。" -#: ../../library/symtable.rst:223 +#: ../../library/symtable.rst:276 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/symtable.rst:225 +#: ../../library/symtable.rst:278 msgid "" ">>> table = symtable.symtable(\"def some_func(): pass\", \"string\", " "\"exec\")\n" @@ -280,7 +330,7 @@ msgstr "" ">>> table.lookup(\"some_func\").is_namespace()\n" "True" -#: ../../library/symtable.rst:229 +#: ../../library/symtable.rst:282 msgid "" "Note that a single name can be bound to multiple objects. If the result is " "``True``, the name may also be bound to other objects, like an int or list, " @@ -289,14 +339,44 @@ msgstr "" "請注意,單個名稱可以綁定到多個物件。如果結果為 ``True``,則該名稱也可能被綁定" "到其他物件,例如 int 或 list,而不會引入新的命名空間。" -#: ../../library/symtable.rst:235 +#: ../../library/symtable.rst:288 msgid "Return a list of namespaces bound to this name." msgstr "回傳綁定到該名稱的命名空間的串列。" -#: ../../library/symtable.rst:239 +#: ../../library/symtable.rst:292 msgid "" "Return the namespace bound to this name. If more than one or no namespace is " "bound to this name, a :exc:`ValueError` is raised." msgstr "" "回傳綁定到該名稱的命名空間。如果該名稱綁定了多個命名空間或沒有命名空間,則會" "引發 :exc:`ValueError`。" + +#: ../../library/symtable.rst:299 +msgid "Command-Line Usage" +msgstr "" + +#: ../../library/symtable.rst:303 +msgid "" +"The :mod:`symtable` module can be executed as a script from the command line." +msgstr "" + +#: ../../library/symtable.rst:305 +msgid "python -m symtable [infile...]" +msgstr "" + +#: ../../library/symtable.rst:309 +msgid "" +"Symbol tables are generated for the specified Python source files and dumped " +"to stdout. If no input file is specified, the content is read from stdin." +msgstr "" + +#~ msgid "" +#~ "Return the type of the symbol table. Possible values are ``'class'``, " +#~ "``'module'``, ``'function'``, ``'annotation'``, ``'TypeVar bound'``, " +#~ "``'type alias'``, and ``'type parameter'``. The latter four refer to " +#~ "different flavors of :ref:`annotation scopes `." +#~ msgstr "" +#~ "回傳符號表的種類。可能的值為 ``'class'``、``'module'``、``'function'``、" +#~ "``'annotation'``、``'TypeVar bound'``、``'type alias'`` 和 ``'type " +#~ "parameter'``。後四個是指不同的\\ :ref:`註釋範圍 (annotation scopes) " +#~ "`。" diff --git a/library/sys.monitoring.po b/library/sys.monitoring.po index b77818bc27..99edc3a8a0 100644 --- a/library/sys.monitoring.po +++ b/library/sys.monitoring.po @@ -5,9 +5,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -121,114 +121,107 @@ msgstr "" "sys.monitoring.PROFILER_ID = 2\n" "sys.monitoring.OPTIMIZER_ID = 5" -#: ../../library/sys.monitoring.rst:78 -msgid "" -"There is no obligation to set an ID, nor is there anything preventing a tool " -"from using an ID even it is already in use. However, tools are encouraged to " -"use a unique ID and respect other tools." -msgstr "" - -#: ../../library/sys.monitoring.rst:83 +#: ../../library/sys.monitoring.rst:80 msgid "Events" msgstr "事件" -#: ../../library/sys.monitoring.rst:85 +#: ../../library/sys.monitoring.rst:82 msgid "The following events are supported:" msgstr "" -#: ../../library/sys.monitoring.rst:89 +#: ../../library/sys.monitoring.rst:86 msgid "A conditional branch is taken (or not)." msgstr "" -#: ../../library/sys.monitoring.rst:93 +#: ../../library/sys.monitoring.rst:90 msgid "A call in Python code (event occurs before the call)." msgstr "" -#: ../../library/sys.monitoring.rst:97 +#: ../../library/sys.monitoring.rst:94 msgid "" "An exception raised from any callable, except for Python functions (event " "occurs after the exit)." msgstr "" -#: ../../library/sys.monitoring.rst:101 +#: ../../library/sys.monitoring.rst:98 msgid "" "Return from any callable, except for Python functions (event occurs after " "the return)." msgstr "" -#: ../../library/sys.monitoring.rst:105 +#: ../../library/sys.monitoring.rst:102 msgid "An exception is handled." msgstr "" -#: ../../library/sys.monitoring.rst:109 +#: ../../library/sys.monitoring.rst:106 msgid "A VM instruction is about to be executed." msgstr "" -#: ../../library/sys.monitoring.rst:113 +#: ../../library/sys.monitoring.rst:110 msgid "An unconditional jump in the control flow graph is made." msgstr "" -#: ../../library/sys.monitoring.rst:117 +#: ../../library/sys.monitoring.rst:114 msgid "" "An instruction is about to be executed that has a different line number from " "the preceding instruction." msgstr "" -#: ../../library/sys.monitoring.rst:121 +#: ../../library/sys.monitoring.rst:118 msgid "" "Resumption of a Python function (for generator and coroutine functions), " "except for ``throw()`` calls." msgstr "" -#: ../../library/sys.monitoring.rst:125 +#: ../../library/sys.monitoring.rst:122 msgid "" "Return from a Python function (occurs immediately before the return, the " "callee's frame will be on the stack)." msgstr "" -#: ../../library/sys.monitoring.rst:129 +#: ../../library/sys.monitoring.rst:126 msgid "" "Start of a Python function (occurs immediately after the call, the callee's " "frame will be on the stack)" msgstr "" -#: ../../library/sys.monitoring.rst:133 +#: ../../library/sys.monitoring.rst:130 msgid "A Python function is resumed by a ``throw()`` call." msgstr "" -#: ../../library/sys.monitoring.rst:137 +#: ../../library/sys.monitoring.rst:134 msgid "Exit from a Python function during exception unwinding." msgstr "" -#: ../../library/sys.monitoring.rst:141 +#: ../../library/sys.monitoring.rst:138 msgid "" "Yield from a Python function (occurs immediately before the yield, the " "callee's frame will be on the stack)." msgstr "" -#: ../../library/sys.monitoring.rst:145 +#: ../../library/sys.monitoring.rst:142 msgid "" "An exception is raised, except those that cause a :monitoring-event:" "`STOP_ITERATION` event." msgstr "" -#: ../../library/sys.monitoring.rst:149 +#: ../../library/sys.monitoring.rst:146 msgid "" "An exception is re-raised, for example at the end of a :keyword:`finally` " "block." msgstr "" -#: ../../library/sys.monitoring.rst:153 +#: ../../library/sys.monitoring.rst:150 msgid "" "An artificial :exc:`StopIteration` is raised; see `the STOP_ITERATION " "event`_." msgstr "" -#: ../../library/sys.monitoring.rst:156 +#: ../../library/sys.monitoring.rst:153 msgid "More events may be added in the future." msgstr "" -#: ../../library/sys.monitoring.rst:158 +#: ../../library/sys.monitoring.rst:155 msgid "" "These events are attributes of the :mod:`!sys.monitoring.events` namespace. " "Each event is represented as a power-of-2 integer constant. To define a set " @@ -237,11 +230,11 @@ msgid "" "events, use the expression ``PY_RETURN | PY_START``." msgstr "" -#: ../../library/sys.monitoring.rst:166 +#: ../../library/sys.monitoring.rst:163 msgid "An alias for ``0`` so users can do explicit comparisons like::" msgstr "" -#: ../../library/sys.monitoring.rst:168 +#: ../../library/sys.monitoring.rst:165 msgid "" "if get_events(DEBUGGER_ID) == NO_EVENTS:\n" " ..." @@ -249,80 +242,80 @@ msgstr "" "if get_events(DEBUGGER_ID) == NO_EVENTS:\n" " ..." -#: ../../library/sys.monitoring.rst:171 +#: ../../library/sys.monitoring.rst:168 msgid "Events are divided into three groups:" msgstr "" -#: ../../library/sys.monitoring.rst:174 +#: ../../library/sys.monitoring.rst:171 msgid "Local events" msgstr "" -#: ../../library/sys.monitoring.rst:176 +#: ../../library/sys.monitoring.rst:173 msgid "" "Local events are associated with normal execution of the program and happen " "at clearly defined locations. All local events can be disabled. The local " "events are:" msgstr "" -#: ../../library/sys.monitoring.rst:180 +#: ../../library/sys.monitoring.rst:177 msgid ":monitoring-event:`PY_START`" msgstr ":monitoring-event:`PY_START`" -#: ../../library/sys.monitoring.rst:181 +#: ../../library/sys.monitoring.rst:178 msgid ":monitoring-event:`PY_RESUME`" msgstr ":monitoring-event:`PY_RESUME`" -#: ../../library/sys.monitoring.rst:182 +#: ../../library/sys.monitoring.rst:179 msgid ":monitoring-event:`PY_RETURN`" msgstr ":monitoring-event:`PY_RETURN`" -#: ../../library/sys.monitoring.rst:183 +#: ../../library/sys.monitoring.rst:180 msgid ":monitoring-event:`PY_YIELD`" msgstr ":monitoring-event:`PY_YIELD`" -#: ../../library/sys.monitoring.rst:184 +#: ../../library/sys.monitoring.rst:181 msgid ":monitoring-event:`CALL`" msgstr ":monitoring-event:`CALL`" -#: ../../library/sys.monitoring.rst:185 +#: ../../library/sys.monitoring.rst:182 msgid ":monitoring-event:`LINE`" msgstr ":monitoring-event:`LINE`" -#: ../../library/sys.monitoring.rst:186 +#: ../../library/sys.monitoring.rst:183 msgid ":monitoring-event:`INSTRUCTION`" msgstr ":monitoring-event:`INSTRUCTION`" -#: ../../library/sys.monitoring.rst:187 +#: ../../library/sys.monitoring.rst:184 msgid ":monitoring-event:`JUMP`" msgstr ":monitoring-event:`JUMP`" -#: ../../library/sys.monitoring.rst:188 +#: ../../library/sys.monitoring.rst:185 msgid ":monitoring-event:`BRANCH`" msgstr ":monitoring-event:`BRANCH`" -#: ../../library/sys.monitoring.rst:189 +#: ../../library/sys.monitoring.rst:186 msgid ":monitoring-event:`STOP_ITERATION`" msgstr ":monitoring-event:`STOP_ITERATION`" -#: ../../library/sys.monitoring.rst:192 +#: ../../library/sys.monitoring.rst:189 msgid "Ancillary events" msgstr "輔助事件" -#: ../../library/sys.monitoring.rst:194 +#: ../../library/sys.monitoring.rst:191 msgid "" "Ancillary events can be monitored like other events, but are controlled by " "another event:" msgstr "" -#: ../../library/sys.monitoring.rst:197 +#: ../../library/sys.monitoring.rst:194 msgid ":monitoring-event:`C_RAISE`" msgstr ":monitoring-event:`C_RAISE`" -#: ../../library/sys.monitoring.rst:198 +#: ../../library/sys.monitoring.rst:195 msgid ":monitoring-event:`C_RETURN`" msgstr ":monitoring-event:`C_RETURN`" -#: ../../library/sys.monitoring.rst:200 +#: ../../library/sys.monitoring.rst:197 msgid "" "The :monitoring-event:`C_RETURN` and :monitoring-event:`C_RAISE` events are " "controlled by the :monitoring-event:`CALL` event. :monitoring-event:" @@ -330,41 +323,41 @@ msgid "" "corresponding :monitoring-event:`CALL` event is being monitored." msgstr "" -#: ../../library/sys.monitoring.rst:206 +#: ../../library/sys.monitoring.rst:203 msgid "Other events" msgstr "其他事件" -#: ../../library/sys.monitoring.rst:208 +#: ../../library/sys.monitoring.rst:205 msgid "" "Other events are not necessarily tied to a specific location in the program " "and cannot be individually disabled." msgstr "" -#: ../../library/sys.monitoring.rst:211 +#: ../../library/sys.monitoring.rst:208 msgid "The other events that can be monitored are:" msgstr "" -#: ../../library/sys.monitoring.rst:213 +#: ../../library/sys.monitoring.rst:210 msgid ":monitoring-event:`PY_THROW`" msgstr ":monitoring-event:`PY_THROW`" -#: ../../library/sys.monitoring.rst:214 +#: ../../library/sys.monitoring.rst:211 msgid ":monitoring-event:`PY_UNWIND`" msgstr ":monitoring-event:`PY_UNWIND`" -#: ../../library/sys.monitoring.rst:215 +#: ../../library/sys.monitoring.rst:212 msgid ":monitoring-event:`RAISE`" msgstr ":monitoring-event:`RAISE`" -#: ../../library/sys.monitoring.rst:216 +#: ../../library/sys.monitoring.rst:213 msgid ":monitoring-event:`EXCEPTION_HANDLED`" msgstr ":monitoring-event:`EXCEPTION_HANDLED`" -#: ../../library/sys.monitoring.rst:220 +#: ../../library/sys.monitoring.rst:217 msgid "The STOP_ITERATION event" msgstr "" -#: ../../library/sys.monitoring.rst:222 +#: ../../library/sys.monitoring.rst:219 msgid "" ":pep:`PEP 380 <380#use-of-stopiteration-to-return-values>` specifies that a :" "exc:`StopIteration` exception is raised when returning a value from a " @@ -373,7 +366,7 @@ msgid "" "an exception unless it would be visible to other code." msgstr "" -#: ../../library/sys.monitoring.rst:228 +#: ../../library/sys.monitoring.rst:225 msgid "" "To allow tools to monitor for real exceptions without slowing down " "generators and coroutines, the :monitoring-event:`STOP_ITERATION` event is " @@ -381,47 +374,51 @@ msgid "" "unlike :monitoring-event:`RAISE`." msgstr "" -#: ../../library/sys.monitoring.rst:234 +#: ../../library/sys.monitoring.rst:231 msgid "Turning events on and off" msgstr "" -#: ../../library/sys.monitoring.rst:236 +#: ../../library/sys.monitoring.rst:233 msgid "" "In order to monitor an event, it must be turned on and a corresponding " "callback must be registered. Events can be turned on or off by setting the " "events either globally or for a particular code object." msgstr "" -#: ../../library/sys.monitoring.rst:243 +#: ../../library/sys.monitoring.rst:240 msgid "Setting events globally" msgstr "" -#: ../../library/sys.monitoring.rst:245 +#: ../../library/sys.monitoring.rst:242 msgid "" "Events can be controlled globally by modifying the set of events being " "monitored." msgstr "" -#: ../../library/sys.monitoring.rst:249 +#: ../../library/sys.monitoring.rst:246 msgid "Returns the ``int`` representing all the active events." msgstr "" -#: ../../library/sys.monitoring.rst:253 +#: ../../library/sys.monitoring.rst:250 msgid "" "Activates all events which are set in *event_set*. Raises a :exc:" "`ValueError` if *tool_id* is not in use." msgstr "" -#: ../../library/sys.monitoring.rst:256 +#: ../../library/sys.monitoring.rst:253 msgid "No events are active by default." msgstr "" -#: ../../library/sys.monitoring.rst:259 +#: ../../library/sys.monitoring.rst:256 msgid "Per code object events" msgstr "" -#: ../../library/sys.monitoring.rst:261 -msgid "Events can also be controlled on a per code object basis." +#: ../../library/sys.monitoring.rst:258 +msgid "" +"Events can also be controlled on a per code object basis. The functions " +"defined below which accept a :class:`types.CodeType` should be prepared to " +"accept a look-alike object from functions which are not defined in Python " +"(see :ref:`c-api-monitoring`)." msgstr "" #: ../../library/sys.monitoring.rst:265 diff --git a/library/sys.po b/library/sys.po index aaa348c462..32c11aa68d 100644 --- a/library/sys.po +++ b/library/sys.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-04-26 02:54+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,8 +42,8 @@ msgid "" "removed)." msgstr "" -#: ../../library/sys.rst:25 ../../library/sys.rst:765 -#: ../../library/sys.rst:1459 +#: ../../library/sys.rst:25 ../../library/sys.rst:778 +#: ../../library/sys.rst:1489 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" @@ -248,13 +248,23 @@ msgid "" "during reference leak debugging." msgstr "" -#: ../../library/sys.rst:196 ../../library/sys.rst:212 -#: ../../library/sys.rst:225 +#: ../../library/sys.rst:196 ../../library/sys.rst:223 +#: ../../library/sys.rst:236 msgid "" "This function should be used for internal and specialized purposes only." msgstr "" -#: ../../library/sys.rst:201 +#: ../../library/sys.rst:198 +msgid "Use the more general :func:`_clear_internal_caches` function instead." +msgstr "" + +#: ../../library/sys.rst:204 +msgid "" +"Clear all internal performance-related caches. Use this function *only* to " +"release unnecessary references and memory blocks when hunting for leaks." +msgstr "" + +#: ../../library/sys.rst:212 msgid "" "Return a dictionary mapping each thread's identifier to the topmost stack " "frame currently active in that thread at the time the function is called. " @@ -262,7 +272,7 @@ msgid "" "given such a frame." msgstr "" -#: ../../library/sys.rst:206 +#: ../../library/sys.rst:217 msgid "" "This is most useful for debugging deadlock: this function does not require " "the deadlocked threads' cooperation, and such threads' call stacks are " @@ -271,14 +281,14 @@ msgid "" "by the time calling code examines the frame." msgstr "" -#: ../../library/sys.rst:214 +#: ../../library/sys.rst:225 msgid "" "Raises an :ref:`auditing event ` ``sys._current_frames`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys._current_frames``。" -#: ../../library/sys.rst:218 +#: ../../library/sys.rst:229 msgid "" "Return a dictionary mapping each thread's identifier to the topmost " "exception currently active in that thread at the time the function is " @@ -286,11 +296,11 @@ msgid "" "included in the result dictionary." msgstr "" -#: ../../library/sys.rst:223 +#: ../../library/sys.rst:234 msgid "This is most useful for statistical profiling." msgstr "" -#: ../../library/sys.rst:227 +#: ../../library/sys.rst:238 msgid "" "Raises an :ref:`auditing event ` ``sys._current_exceptions`` with " "no arguments." @@ -298,20 +308,20 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "_current_exceptions``。" -#: ../../library/sys.rst:229 +#: ../../library/sys.rst:240 msgid "" "Each value in the dictionary is now a single exception instance, rather than " "a 3-tuple as returned from ``sys.exc_info()``." msgstr "" -#: ../../library/sys.rst:235 +#: ../../library/sys.rst:246 msgid "" "This hook function is called by built-in :func:`breakpoint`. By default, it " "drops you into the :mod:`pdb` debugger, but it can be set to any other " "function so that you can choose which debugger gets used." msgstr "" -#: ../../library/sys.rst:239 +#: ../../library/sys.rst:250 msgid "" "The signature of this function is dependent on what it calls. For example, " "the default binding (e.g. ``pdb.set_trace()``) expects no arguments, but you " @@ -321,7 +331,7 @@ msgid "" "returns is returned from ``breakpoint()``." msgstr "" -#: ../../library/sys.rst:246 +#: ../../library/sys.rst:257 msgid "" "The default implementation first consults the environment variable :envvar:" "`PYTHONBREAKPOINT`. If that is set to ``\"0\"`` then this function returns " @@ -335,48 +345,48 @@ msgid "" "breakpointhook()`` returns to the built-in :func:`breakpoint` function." msgstr "" -#: ../../library/sys.rst:258 +#: ../../library/sys.rst:269 msgid "" "Note that if anything goes wrong while importing the callable named by :" "envvar:`PYTHONBREAKPOINT`, a :exc:`RuntimeWarning` is reported and the " "breakpoint is ignored." msgstr "" -#: ../../library/sys.rst:262 +#: ../../library/sys.rst:273 msgid "" "Also note that if ``sys.breakpointhook()`` is overridden programmatically, :" "envvar:`PYTHONBREAKPOINT` is *not* consulted." msgstr "" -#: ../../library/sys.rst:269 +#: ../../library/sys.rst:280 msgid "" "Print low-level information to stderr about the state of CPython's memory " "allocator." msgstr "" -#: ../../library/sys.rst:272 +#: ../../library/sys.rst:283 msgid "" "If Python is :ref:`built in debug mode ` (:option:`configure --" "with-pydebug option <--with-pydebug>`), it also performs some expensive " "internal consistency checks." msgstr "" -#: ../../library/sys.rst:280 +#: ../../library/sys.rst:291 msgid "" "This function is specific to CPython. The exact output format is not " "defined here, and may change." msgstr "" -#: ../../library/sys.rst:286 +#: ../../library/sys.rst:297 msgid "Integer specifying the handle of the Python DLL." msgstr "" -#: ../../library/sys.rst:288 ../../library/sys.rst:978 -#: ../../library/sys.rst:1745 ../../library/sys.rst:1981 +#: ../../library/sys.rst:299 ../../library/sys.rst:991 +#: ../../library/sys.rst:1769 ../../library/sys.rst:2013 msgid ":ref:`Availability `: Windows." msgstr ":ref:`適用 `:Windows。" -#: ../../library/sys.rst:293 +#: ../../library/sys.rst:304 msgid "" "If *value* is not ``None``, this function prints ``repr(value)`` to ``sys." "stdout``, and saves *value* in ``builtins._``. If ``repr(value)`` is not " @@ -385,7 +395,7 @@ msgid "" "encoding`` with ``'backslashreplace'`` error handler." msgstr "" -#: ../../library/sys.rst:299 +#: ../../library/sys.rst:310 msgid "" "``sys.displayhook`` is called on the result of evaluating an :term:" "`expression` entered in an interactive Python session. The display of these " @@ -393,11 +403,11 @@ msgid "" "displayhook``." msgstr "" -#: ../../library/sys.rst:303 +#: ../../library/sys.rst:314 msgid "Pseudo-code::" msgstr "" -#: ../../library/sys.rst:305 +#: ../../library/sys.rst:316 msgid "" "def displayhook(value):\n" " if value is None:\n" @@ -418,11 +428,11 @@ msgid "" " builtins._ = value" msgstr "" -#: ../../library/sys.rst:323 +#: ../../library/sys.rst:334 msgid "Use ``'backslashreplace'`` error handler on :exc:`UnicodeEncodeError`." msgstr "" -#: ../../library/sys.rst:329 +#: ../../library/sys.rst:340 msgid "" "If this is true, Python won't try to write ``.pyc`` files on the import of " "source modules. This value is initially set to ``True`` or ``False`` " @@ -431,20 +441,20 @@ msgid "" "to control bytecode file generation." msgstr "" -#: ../../library/sys.rst:338 +#: ../../library/sys.rst:349 msgid "" "A :term:`named tuple` holding information about the environment on the " "*wasm32-emscripten* platform. The named tuple is provisional and may change " "in the future." msgstr "" -#: ../../library/sys.rst:344 +#: ../../library/sys.rst:355 msgid "" "Emscripten version as tuple of ints (major, minor, micro), e.g. ``(3, 1, " "8)``." msgstr "" -#: ../../library/sys.rst:348 +#: ../../library/sys.rst:359 msgid "" "Runtime string, e.g. browser user agent, ``'Node.js v14.18.2'``, or " "``'UNKNOWN'``." @@ -452,19 +462,19 @@ msgstr "" "運行環境字串,例如瀏覽器使用者代理 (browser user agent) ``'Node.js " "v14.18.2'`` 或 ``'UNKNOWN'``。" -#: ../../library/sys.rst:352 +#: ../../library/sys.rst:363 msgid "``True`` if Python is compiled with Emscripten pthreads support." msgstr "" -#: ../../library/sys.rst:356 +#: ../../library/sys.rst:367 msgid "``True`` if Python is compiled with shared memory support." msgstr "" -#: ../../library/sys.rst:358 +#: ../../library/sys.rst:369 msgid ":ref:`Availability `: Emscripten." msgstr ":ref:`適用 `:Emscripten。" -#: ../../library/sys.rst:365 +#: ../../library/sys.rst:376 msgid "" "If this is set (not ``None``), Python will write bytecode-cache ``.pyc`` " "files to (and read them from) a parallel directory tree rooted at this " @@ -475,12 +485,12 @@ msgid "" "with the same pycache prefix (if any) that you will use at runtime." msgstr "" -#: ../../library/sys.rst:373 +#: ../../library/sys.rst:384 msgid "" "A relative path is interpreted relative to the current working directory." msgstr "" -#: ../../library/sys.rst:375 +#: ../../library/sys.rst:386 msgid "" "This value is initially set based on the value of the :option:`-X` " "``pycache_prefix=PATH`` command-line option or the :envvar:" @@ -488,12 +498,12 @@ msgid "" "If neither are set, it is ``None``." msgstr "" -#: ../../library/sys.rst:385 +#: ../../library/sys.rst:396 msgid "" "This function prints out a given traceback and exception to ``sys.stderr``." msgstr "" -#: ../../library/sys.rst:387 +#: ../../library/sys.rst:398 msgid "" "When an exception other than :exc:`SystemExit` is raised and uncaught, the " "interpreter calls ``sys.excepthook`` with three arguments, the exception " @@ -504,7 +514,7 @@ msgid "" "argument function to ``sys.excepthook``." msgstr "" -#: ../../library/sys.rst:394 ../../library/sys.rst:396 +#: ../../library/sys.rst:405 ../../library/sys.rst:407 msgid "" "Raise an auditing event ``sys.excepthook`` with arguments ``hook``, " "``type``, ``value``, ``traceback`` when an uncaught exception occurs. If no " @@ -514,14 +524,14 @@ msgid "" "excepthook`` will be called." msgstr "" -#: ../../library/sys.rst:405 +#: ../../library/sys.rst:416 msgid "" "The :func:`sys.unraisablehook` function handles unraisable exceptions and " "the :func:`threading.excepthook` function handles exception raised by :func:" "`threading.Thread.run`." msgstr "" -#: ../../library/sys.rst:415 +#: ../../library/sys.rst:426 msgid "" "These objects contain the original values of ``breakpointhook``, " "``displayhook``, ``excepthook``, and ``unraisablehook`` at the start of the " @@ -530,15 +540,15 @@ msgid "" "get replaced with broken or alternative objects." msgstr "" -#: ../../library/sys.rst:421 +#: ../../library/sys.rst:432 msgid "__breakpointhook__" msgstr "__breakpointhook__" -#: ../../library/sys.rst:424 +#: ../../library/sys.rst:435 msgid "__unraisablehook__" msgstr "__unraisablehook__" -#: ../../library/sys.rst:430 +#: ../../library/sys.rst:441 msgid "" "This function, when called while an exception handler is executing (such as " "an ``except`` or ``except*`` clause), returns the exception instance that " @@ -546,11 +556,11 @@ msgid "" "another, only the exception handled by the innermost handler is accessible." msgstr "" -#: ../../library/sys.rst:435 +#: ../../library/sys.rst:446 msgid "If no exception handler is executing, this function returns ``None``." msgstr "" -#: ../../library/sys.rst:442 +#: ../../library/sys.rst:453 msgid "" "This function returns the old-style representation of the handled exception. " "If an exception ``e`` is currently handled (so :func:`exception` would " @@ -561,13 +571,13 @@ msgid "" "stack at the point where the exception last occurred." msgstr "" -#: ../../library/sys.rst:453 +#: ../../library/sys.rst:464 msgid "" "If no exception is being handled anywhere on the stack, this function return " "a tuple containing three ``None`` values." msgstr "" -#: ../../library/sys.rst:456 +#: ../../library/sys.rst:467 msgid "" "The ``type`` and ``traceback`` fields are now derived from the ``value`` " "(the exception instance), so when an exception is modified while it is being " @@ -575,7 +585,7 @@ msgid "" "func:`exc_info`." msgstr "" -#: ../../library/sys.rst:464 +#: ../../library/sys.rst:475 msgid "" "A string giving the site-specific directory prefix where the platform-" "dependent Python files are installed; by default, this is also ``'/usr/" @@ -587,7 +597,7 @@ msgid "" "is the version number of Python, for example ``3.2``." msgstr "" -#: ../../library/sys.rst:475 +#: ../../library/sys.rst:486 msgid "" "If a :ref:`virtual environment ` is in effect, this value will be " "changed in ``site.py`` to point to the virtual environment. The value for " @@ -595,7 +605,7 @@ msgid "" "`base_exec_prefix`." msgstr "" -#: ../../library/sys.rst:483 +#: ../../library/sys.rst:494 msgid "" "A string giving the absolute path of the executable binary for the Python " "interpreter, on systems where this makes sense. If Python is unable to " @@ -603,13 +613,13 @@ msgid "" "empty string or ``None``." msgstr "" -#: ../../library/sys.rst:491 +#: ../../library/sys.rst:502 msgid "" "Raise a :exc:`SystemExit` exception, signaling an intention to exit the " "interpreter." msgstr "" -#: ../../library/sys.rst:493 +#: ../../library/sys.rst:504 msgid "" "The optional argument *arg* can be an integer giving the exit status " "(defaulting to zero), or another type of object. If it is an integer, zero " @@ -625,7 +635,7 @@ msgid "" "way to exit a program when an error occurs." msgstr "" -#: ../../library/sys.rst:506 +#: ../../library/sys.rst:517 msgid "" "Since :func:`exit` ultimately \"only\" raises an exception, it will only " "exit the process when called from the main thread, and the exception is not " @@ -634,113 +644,113 @@ msgid "" "an outer level." msgstr "" -#: ../../library/sys.rst:511 +#: ../../library/sys.rst:522 msgid "" "If an error occurs in the cleanup after the Python interpreter has caught :" "exc:`SystemExit` (such as an error flushing buffered data in the standard " "streams), the exit status is changed to 120." msgstr "" -#: ../../library/sys.rst:519 +#: ../../library/sys.rst:530 msgid "" "The :term:`named tuple` *flags* exposes the status of command line flags. " "The attributes are read only." msgstr "" -#: ../../library/sys.rst:525 +#: ../../library/sys.rst:536 msgid ":option:`-d`" msgstr ":option:`-d`" -#: ../../library/sys.rst:528 ../../library/sys.rst:531 +#: ../../library/sys.rst:539 ../../library/sys.rst:542 msgid ":option:`-i`" msgstr ":option:`-i`" -#: ../../library/sys.rst:534 +#: ../../library/sys.rst:545 msgid ":option:`-I`" msgstr ":option:`-I`" -#: ../../library/sys.rst:537 +#: ../../library/sys.rst:548 msgid ":option:`-O` or :option:`-OO`" msgstr ":option:`-O` 或 :option:`-OO`" -#: ../../library/sys.rst:540 +#: ../../library/sys.rst:551 msgid ":option:`-B`" msgstr ":option:`-B`" -#: ../../library/sys.rst:543 +#: ../../library/sys.rst:554 msgid ":option:`-s`" msgstr ":option:`-s`" -#: ../../library/sys.rst:546 +#: ../../library/sys.rst:557 msgid ":option:`-S`" msgstr ":option:`-S`" -#: ../../library/sys.rst:549 +#: ../../library/sys.rst:560 msgid ":option:`-E`" msgstr ":option:`-E`" -#: ../../library/sys.rst:552 +#: ../../library/sys.rst:563 msgid ":option:`-v`" msgstr ":option:`-v`" -#: ../../library/sys.rst:555 +#: ../../library/sys.rst:566 msgid ":option:`-b`" msgstr ":option:`-b`" -#: ../../library/sys.rst:558 +#: ../../library/sys.rst:569 msgid ":option:`-q`" msgstr ":option:`-q`" -#: ../../library/sys.rst:561 +#: ../../library/sys.rst:572 msgid ":option:`-R`" msgstr ":option:`-R`" -#: ../../library/sys.rst:564 +#: ../../library/sys.rst:575 msgid ":option:`-X dev <-X>` (:ref:`Python Development Mode `)" msgstr ":option:`-X dev <-X>` (:ref:`Python 開發模式 `)" -#: ../../library/sys.rst:567 +#: ../../library/sys.rst:578 msgid ":option:`-X utf8 <-X>`" msgstr ":option:`-X utf8 <-X>`" -#: ../../library/sys.rst:570 +#: ../../library/sys.rst:581 msgid ":option:`-P`" msgstr ":option:`-P`" -#: ../../library/sys.rst:573 +#: ../../library/sys.rst:584 msgid "" ":option:`-X int_max_str_digits <-X>` (:ref:`integer string conversion length " "limitation `)" msgstr "" -#: ../../library/sys.rst:577 +#: ../../library/sys.rst:588 msgid ":option:`-X warn_default_encoding <-X>`" msgstr ":option:`-X warn_default_encoding <-X>`" -#: ../../library/sys.rst:579 +#: ../../library/sys.rst:590 msgid "Added ``quiet`` attribute for the new :option:`-q` flag." msgstr "新增 ``quiet`` 屬性,用於新的 :option:`-q` 旗標。" -#: ../../library/sys.rst:582 +#: ../../library/sys.rst:593 msgid "The ``hash_randomization`` attribute." msgstr "``hash_randomization`` 屬性。" -#: ../../library/sys.rst:585 +#: ../../library/sys.rst:596 msgid "Removed obsolete ``division_warning`` attribute." msgstr "移除過時的 ``division_warning`` 屬性。" -#: ../../library/sys.rst:588 +#: ../../library/sys.rst:599 msgid "Added ``isolated`` attribute for :option:`-I` ``isolated`` flag." msgstr "新增 ``isolated`` 屬性,用於 :option:`-I` ``isolated`` 旗標。" -#: ../../library/sys.rst:591 +#: ../../library/sys.rst:602 msgid "" "Added the ``dev_mode`` attribute for the new :ref:`Python Development Mode " "` and the ``utf8_mode`` attribute for the new :option:`-X` " "``utf8`` flag." msgstr "" -#: ../../library/sys.rst:596 +#: ../../library/sys.rst:607 msgid "" "Added ``warn_default_encoding`` attribute for :option:`-X` " "``warn_default_encoding`` flag." @@ -748,15 +758,15 @@ msgstr "" "新增 ``warn_default_encoding`` 屬性,用於 :option:`-X` " "``warn_default_encoding`` 旗標。" -#: ../../library/sys.rst:599 +#: ../../library/sys.rst:610 msgid "Added the ``safe_path`` attribute for :option:`-P` option." msgstr "新增 ``safe_path`` 屬性,用於 :option:`-P` 選項。" -#: ../../library/sys.rst:602 +#: ../../library/sys.rst:613 msgid "Added the ``int_max_str_digits`` attribute." msgstr "新增 ``int_max_str_digits`` 屬性。" -#: ../../library/sys.rst:608 +#: ../../library/sys.rst:619 msgid "" "A :term:`named tuple` holding information about the float type. It contains " "low level information about the precision and internal representation. The " @@ -766,161 +776,161 @@ msgid "" "floating types', for details." msgstr "" -#: ../../library/sys.rst:615 +#: ../../library/sys.rst:626 msgid "Attributes of the :data:`!float_info` :term:`named tuple`" msgstr "" -#: ../../library/sys.rst:618 +#: ../../library/sys.rst:629 msgid "attribute" msgstr "屬性" -#: ../../library/sys.rst:619 +#: ../../library/sys.rst:630 msgid "float.h macro" msgstr "float.h macro" -#: ../../library/sys.rst:620 +#: ../../library/sys.rst:631 msgid "explanation" msgstr "解釋" -#: ../../library/sys.rst:623 +#: ../../library/sys.rst:634 msgid ":c:macro:`!DBL_EPSILON`" msgstr ":c:macro:`!DBL_EPSILON`" -#: ../../library/sys.rst:624 +#: ../../library/sys.rst:635 msgid "" "difference between 1.0 and the least value greater than 1.0 that is " "representable as a float." msgstr "" -#: ../../library/sys.rst:627 +#: ../../library/sys.rst:638 msgid "See also :func:`math.ulp`." msgstr "另請參閱 :func:`math.ulp`。" -#: ../../library/sys.rst:630 +#: ../../library/sys.rst:641 msgid ":c:macro:`!DBL_DIG`" msgstr ":c:macro:`!DBL_DIG`" -#: ../../library/sys.rst:631 +#: ../../library/sys.rst:642 msgid "" "The maximum number of decimal digits that can be faithfully represented in a " "float; see below." msgstr "" -#: ../../library/sys.rst:635 +#: ../../library/sys.rst:646 msgid ":c:macro:`!DBL_MANT_DIG`" msgstr ":c:macro:`!DBL_MANT_DIG`" -#: ../../library/sys.rst:636 +#: ../../library/sys.rst:647 msgid "" "Float precision: the number of base-``radix`` digits in the significand of a " "float." msgstr "" -#: ../../library/sys.rst:640 +#: ../../library/sys.rst:651 msgid ":c:macro:`!DBL_MAX`" msgstr ":c:macro:`!DBL_MAX`" -#: ../../library/sys.rst:641 +#: ../../library/sys.rst:652 msgid "The maximum representable positive finite float." msgstr "" -#: ../../library/sys.rst:644 +#: ../../library/sys.rst:655 msgid ":c:macro:`!DBL_MAX_EXP`" msgstr ":c:macro:`!DBL_MAX_EXP`" -#: ../../library/sys.rst:645 +#: ../../library/sys.rst:656 msgid "" "The maximum integer *e* such that ``radix**(e-1)`` is a representable finite " "float." msgstr "" -#: ../../library/sys.rst:649 +#: ../../library/sys.rst:660 msgid ":c:macro:`!DBL_MAX_10_EXP`" msgstr ":c:macro:`!DBL_MAX_10_EXP`" -#: ../../library/sys.rst:650 +#: ../../library/sys.rst:661 msgid "" "The maximum integer *e* such that ``10**e`` is in the range of representable " "finite floats." msgstr "" -#: ../../library/sys.rst:654 +#: ../../library/sys.rst:665 msgid ":c:macro:`!DBL_MIN`" msgstr ":c:macro:`!DBL_MIN`" -#: ../../library/sys.rst:655 +#: ../../library/sys.rst:666 msgid "The minimum representable positive *normalized* float." msgstr "" -#: ../../library/sys.rst:657 +#: ../../library/sys.rst:668 msgid "" "Use :func:`math.ulp(0.0) ` to get the smallest positive " "*denormalized* representable float." msgstr "" -#: ../../library/sys.rst:661 +#: ../../library/sys.rst:672 msgid ":c:macro:`!DBL_MIN_EXP`" msgstr ":c:macro:`!DBL_MIN_EXP`" -#: ../../library/sys.rst:662 +#: ../../library/sys.rst:673 msgid "" "The minimum integer *e* such that ``radix**(e-1)`` is a normalized float." msgstr "" -#: ../../library/sys.rst:666 +#: ../../library/sys.rst:677 msgid ":c:macro:`!DBL_MIN_10_EXP`" msgstr ":c:macro:`!DBL_MIN_10_EXP`" -#: ../../library/sys.rst:667 +#: ../../library/sys.rst:678 msgid "The minimum integer *e* such that ``10**e`` is a normalized float." msgstr "" -#: ../../library/sys.rst:670 +#: ../../library/sys.rst:681 msgid ":c:macro:`!FLT_RADIX`" msgstr ":c:macro:`!FLT_RADIX`" -#: ../../library/sys.rst:671 +#: ../../library/sys.rst:682 msgid "The radix of exponent representation." msgstr "" -#: ../../library/sys.rst:674 +#: ../../library/sys.rst:685 msgid ":c:macro:`!FLT_ROUNDS`" msgstr ":c:macro:`!FLT_ROUNDS`" -#: ../../library/sys.rst:675 +#: ../../library/sys.rst:686 msgid "" "An integer representing the rounding mode for floating-point arithmetic. " "This reflects the value of the system :c:macro:`!FLT_ROUNDS` macro at " "interpreter startup time:" msgstr "" -#: ../../library/sys.rst:679 +#: ../../library/sys.rst:690 msgid "``-1``: indeterminable" msgstr "" -#: ../../library/sys.rst:680 +#: ../../library/sys.rst:691 msgid "``0``: toward zero" msgstr "" -#: ../../library/sys.rst:681 +#: ../../library/sys.rst:692 msgid "``1``: to nearest" msgstr "" -#: ../../library/sys.rst:682 +#: ../../library/sys.rst:693 msgid "``2``: toward positive infinity" msgstr "" -#: ../../library/sys.rst:683 +#: ../../library/sys.rst:694 msgid "``3``: toward negative infinity" msgstr "" -#: ../../library/sys.rst:685 +#: ../../library/sys.rst:696 msgid "" "All other values for :c:macro:`!FLT_ROUNDS` characterize implementation-" "defined rounding behavior." msgstr "" -#: ../../library/sys.rst:688 +#: ../../library/sys.rst:699 msgid "" "The attribute :attr:`sys.float_info.dig` needs further explanation. If " "``s`` is any string representing a decimal number with at most :attr:`!sys." @@ -928,7 +938,7 @@ msgid "" "back again will recover a string representing the same decimal value::" msgstr "" -#: ../../library/sys.rst:694 +#: ../../library/sys.rst:705 msgid "" ">>> import sys\n" ">>> sys.float_info.dig\n" @@ -938,20 +948,20 @@ msgid "" "'3.14159265358979'" msgstr "" -#: ../../library/sys.rst:701 +#: ../../library/sys.rst:712 msgid "" "But for strings with more than :attr:`sys.float_info.dig` significant " "digits, this isn't always true::" msgstr "" -#: ../../library/sys.rst:704 +#: ../../library/sys.rst:715 msgid "" ">>> s = '9876543211234567' # 16 significant digits is too many!\n" ">>> format(float(s), '.16g') # conversion changes value\n" "'9876543211234568'" msgstr "" -#: ../../library/sys.rst:710 +#: ../../library/sys.rst:721 msgid "" "A string indicating how the :func:`repr` function behaves for floats. If " "the string has value ``'short'`` then for a finite float ``x``, ``repr(x)`` " @@ -961,47 +971,51 @@ msgid "" "same way as it did in versions of Python prior to 3.1." msgstr "" -#: ../../library/sys.rst:723 +#: ../../library/sys.rst:734 msgid "" "Return the number of memory blocks currently allocated by the interpreter, " "regardless of their size. This function is mainly useful for tracking and " "debugging memory leaks. Because of the interpreter's internal caches, the " "result can vary from call to call; you may have to call :func:" -"`_clear_type_cache` and :func:`gc.collect` to get more predictable results." +"`_clear_internal_caches` and :func:`gc.collect` to get more predictable " +"results." msgstr "" -#: ../../library/sys.rst:730 +#: ../../library/sys.rst:741 msgid "" "If a Python build or implementation cannot reasonably compute this " "information, :func:`getallocatedblocks` is allowed to return 0 instead." msgstr "" -#: ../../library/sys.rst:738 +#: ../../library/sys.rst:749 msgid "Return the number of unicode objects that have been interned." msgstr "" -#: ../../library/sys.rst:745 -msgid "Return the build time API version of Android as an integer." +#: ../../library/sys.rst:756 +msgid "" +"Return the build-time API level of Android as an integer. This represents " +"the minimum version of Android this build of Python can run on. For runtime " +"version information, see :func:`platform.android_ver`." msgstr "" -#: ../../library/sys.rst:747 +#: ../../library/sys.rst:760 msgid ":ref:`Availability `: Android." msgstr ":ref:`適用 `:Android。" -#: ../../library/sys.rst:754 +#: ../../library/sys.rst:767 msgid "" "Return the name of the current default string encoding used by the Unicode " "implementation." msgstr "" -#: ../../library/sys.rst:760 +#: ../../library/sys.rst:773 msgid "" "Return the current value of the flags that are used for :c:func:`dlopen` " "calls. Symbolic names for the flag values can be found in the :mod:`os` " "module (:samp:`RTLD_{xxx}` constants, e.g. :const:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:770 +#: ../../library/sys.rst:783 msgid "" "Get the :term:`filesystem encoding `: " "the encoding used with the :term:`filesystem error handler ` is enabled." msgstr "" -#: ../../library/sys.rst:803 +#: ../../library/sys.rst:816 msgid "" "Get the :term:`filesystem error handler `: the error handler used with the :term:`filesystem encoding " @@ -1056,35 +1070,35 @@ msgid "" "func:`getfilesystemencoding`." msgstr "" -#: ../../library/sys.rst:821 +#: ../../library/sys.rst:834 msgid "" "Returns the current value for the :ref:`integer string conversion length " "limitation `. See also :func:`set_int_max_str_digits`." msgstr "" -#: ../../library/sys.rst:828 +#: ../../library/sys.rst:841 msgid "" "Return the reference count of the *object*. The count returned is generally " "one higher than you might expect, because it includes the (temporary) " "reference as an argument to :func:`getrefcount`." msgstr "" -#: ../../library/sys.rst:832 +#: ../../library/sys.rst:845 msgid "" "Note that the returned value may not actually reflect how many references to " -"the object are actually held. For example, some objects are \"immortal\" " -"and have a very high refcount that does not reflect the actual number of " -"references. Consequently, do not rely on the returned value to be accurate, " -"other than a value of 0 or 1." +"the object are actually held. For example, some objects are :term:" +"`immortal` and have a very high refcount that does not reflect the actual " +"number of references. Consequently, do not rely on the returned value to be " +"accurate, other than a value of 0 or 1." msgstr "" -#: ../../library/sys.rst:838 +#: ../../library/sys.rst:851 msgid "" "Immortal objects have very large refcounts that do not match the actual " "number of references to the object." msgstr "" -#: ../../library/sys.rst:844 +#: ../../library/sys.rst:857 msgid "" "Return the current value of the recursion limit, the maximum depth of the " "Python interpreter stack. This limit prevents infinite recursion from " @@ -1092,33 +1106,33 @@ msgid "" "func:`setrecursionlimit`." msgstr "" -#: ../../library/sys.rst:852 +#: ../../library/sys.rst:865 msgid "" "Return the size of an object in bytes. The object can be any type of object. " "All built-in objects will return correct results, but this does not have to " "hold true for third-party extensions as it is implementation specific." msgstr "" -#: ../../library/sys.rst:857 +#: ../../library/sys.rst:870 msgid "" "Only the memory consumption directly attributed to the object is accounted " "for, not the memory consumption of objects it refers to." msgstr "" -#: ../../library/sys.rst:860 +#: ../../library/sys.rst:873 msgid "" "If given, *default* will be returned if the object does not provide means to " "retrieve the size. Otherwise a :exc:`TypeError` will be raised." msgstr "" -#: ../../library/sys.rst:863 +#: ../../library/sys.rst:876 msgid "" ":func:`getsizeof` calls the object's ``__sizeof__`` method and adds an " "additional garbage collector overhead if the object is managed by the " "garbage collector." msgstr "" -#: ../../library/sys.rst:867 +#: ../../library/sys.rst:880 msgid "" "See `recursive sizeof recipe `_ for an example of " @@ -1126,13 +1140,13 @@ msgid "" "their contents." msgstr "" -#: ../../library/sys.rst:873 +#: ../../library/sys.rst:886 msgid "" "Return the interpreter's \"thread switch interval\"; see :func:" "`setswitchinterval`." msgstr "" -#: ../../library/sys.rst:881 +#: ../../library/sys.rst:894 msgid "" "Return a frame object from the call stack. If optional integer *depth* is " "given, return the frame object that many calls below the top of the stack. " @@ -1141,7 +1155,7 @@ msgid "" "stack." msgstr "" -#: ../../library/sys.rst:886 +#: ../../library/sys.rst:899 msgid "" "Raises an :ref:`auditing event ` ``sys._getframe`` with argument " "``frame``." @@ -1149,13 +1163,13 @@ msgstr "" "引發一個附帶引數 ``frame`` 的\\ :ref:`稽核事件 ` ``sys." "_getframe``。" -#: ../../library/sys.rst:890 ../../library/sys.rst:906 +#: ../../library/sys.rst:903 ../../library/sys.rst:919 msgid "" "This function should be used for internal and specialized purposes only. It " "is not guaranteed to exist in all implementations of Python." msgstr "" -#: ../../library/sys.rst:896 +#: ../../library/sys.rst:909 msgid "" "Return the name of a module from the call stack. If optional integer " "*depth* is given, return the module that many calls below the top of the " @@ -1164,7 +1178,7 @@ msgid "" "returning the module at the top of the call stack." msgstr "" -#: ../../library/sys.rst:902 +#: ../../library/sys.rst:915 msgid "" "Raises an :ref:`auditing event ` ``sys._getframemodulename`` with " "argument ``depth``." @@ -1172,15 +1186,15 @@ msgstr "" "引發一個附帶引數 ``depth`` 的\\ :ref:`稽核事件 ` ``sys." "_getframemodulename``。" -#: ../../library/sys.rst:916 +#: ../../library/sys.rst:929 msgid "Get the profiler function as set by :func:`setprofile`." msgstr "" -#: ../../library/sys.rst:925 +#: ../../library/sys.rst:938 msgid "Get the trace function as set by :func:`settrace`." msgstr "" -#: ../../library/sys.rst:929 +#: ../../library/sys.rst:942 msgid "" "The :func:`gettrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -1188,7 +1202,7 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:937 +#: ../../library/sys.rst:950 msgid "" "Return a named tuple describing the Windows version currently running. The " "named elements are *major*, *minor*, *build*, *platform*, *service_pack*, " @@ -1200,54 +1214,54 @@ msgid "" "first 5 elements are retrievable by indexing." msgstr "" -#: ../../library/sys.rst:948 +#: ../../library/sys.rst:961 msgid "*platform* will be ``2`` (VER_PLATFORM_WIN32_NT)." msgstr "" -#: ../../library/sys.rst:950 +#: ../../library/sys.rst:963 msgid "*product_type* may be one of the following values:" msgstr "" -#: ../../library/sys.rst:953 +#: ../../library/sys.rst:966 msgid "Constant" msgstr "" -#: ../../library/sys.rst:953 +#: ../../library/sys.rst:966 msgid "Meaning" msgstr "含義" -#: ../../library/sys.rst:955 +#: ../../library/sys.rst:968 msgid "``1`` (VER_NT_WORKSTATION)" msgstr "``1`` (VER_NT_WORKSTATION)" -#: ../../library/sys.rst:955 +#: ../../library/sys.rst:968 msgid "The system is a workstation." msgstr "" -#: ../../library/sys.rst:957 +#: ../../library/sys.rst:970 msgid "``2`` (VER_NT_DOMAIN_CONTROLLER)" msgstr "``2`` (VER_NT_DOMAIN_CONTROLLER)" -#: ../../library/sys.rst:957 +#: ../../library/sys.rst:970 msgid "The system is a domain controller." msgstr "" -#: ../../library/sys.rst:960 +#: ../../library/sys.rst:973 msgid "``3`` (VER_NT_SERVER)" msgstr "``3`` (VER_NT_SERVER)" -#: ../../library/sys.rst:960 +#: ../../library/sys.rst:973 msgid "The system is a server, but not a domain controller." msgstr "" -#: ../../library/sys.rst:964 +#: ../../library/sys.rst:977 msgid "" "This function wraps the Win32 :c:func:`!GetVersionEx` function; see the " "Microsoft documentation on :c:func:`!OSVERSIONINFOEX` for more information " "about these fields." msgstr "" -#: ../../library/sys.rst:968 +#: ../../library/sys.rst:981 msgid "" "*platform_version* returns the major version, minor version and build number " "of the current operating system, rather than the version that is being " @@ -1255,24 +1269,24 @@ msgid "" "feature detection." msgstr "" -#: ../../library/sys.rst:974 +#: ../../library/sys.rst:987 msgid "" "*platform_version* derives the version from kernel32.dll which can be of a " "different version than the OS version. Please use :mod:`platform` module for " "achieving accurate OS version." msgstr "" -#: ../../library/sys.rst:980 +#: ../../library/sys.rst:993 msgid "" "Changed to a named tuple and added *service_pack_minor*, " "*service_pack_major*, *suite_mask*, and *product_type*." msgstr "" -#: ../../library/sys.rst:984 +#: ../../library/sys.rst:997 msgid "Added *platform_version*" msgstr "新增 *platform_version*" -#: ../../library/sys.rst:990 +#: ../../library/sys.rst:1003 msgid "" "Returns an *asyncgen_hooks* object, which is similar to a :class:" "`~collections.namedtuple` of the form ``(firstiter, finalizer)``, where " @@ -1282,71 +1296,71 @@ msgid "" "loop." msgstr "" -#: ../../library/sys.rst:997 +#: ../../library/sys.rst:1010 msgid "See :pep:`525` for more details." msgstr "更多細節請見 :pep:`525`。" -#: ../../library/sys.rst:1001 ../../library/sys.rst:1677 +#: ../../library/sys.rst:1014 ../../library/sys.rst:1701 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.)" msgstr "" -#: ../../library/sys.rst:1007 +#: ../../library/sys.rst:1020 msgid "" "Get the current coroutine origin tracking depth, as set by :func:" "`set_coroutine_origin_tracking_depth`." msgstr "" -#: ../../library/sys.rst:1013 ../../library/sys.rst:1698 +#: ../../library/sys.rst:1026 ../../library/sys.rst:1722 msgid "" "This function has been added on a provisional basis (see :pep:`411` for " "details.) Use it only for debugging purposes." msgstr "" -#: ../../library/sys.rst:1019 +#: ../../library/sys.rst:1032 msgid "" "A :term:`named tuple` giving parameters of the numeric hash implementation. " "For more details about hashing of numeric types, see :ref:`numeric-hash`." msgstr "" -#: ../../library/sys.rst:1025 +#: ../../library/sys.rst:1038 msgid "The width in bits used for hash values" msgstr "" -#: ../../library/sys.rst:1029 +#: ../../library/sys.rst:1042 msgid "The prime modulus P used for numeric hash scheme" msgstr "" -#: ../../library/sys.rst:1033 +#: ../../library/sys.rst:1046 msgid "The hash value returned for a positive infinity" msgstr "" -#: ../../library/sys.rst:1037 +#: ../../library/sys.rst:1050 msgid "(This attribute is no longer used)" msgstr "" -#: ../../library/sys.rst:1041 +#: ../../library/sys.rst:1054 msgid "The multiplier used for the imaginary part of a complex number" msgstr "" -#: ../../library/sys.rst:1045 +#: ../../library/sys.rst:1058 msgid "The name of the algorithm for hashing of str, bytes, and memoryview" msgstr "" -#: ../../library/sys.rst:1049 +#: ../../library/sys.rst:1062 msgid "The internal output size of the hash algorithm" msgstr "" -#: ../../library/sys.rst:1053 +#: ../../library/sys.rst:1066 msgid "The size of the seed key of the hash algorithm" msgstr "" -#: ../../library/sys.rst:1057 +#: ../../library/sys.rst:1070 msgid "Added *algorithm*, *hash_bits* and *seed_bits*" msgstr "新增 *algorithm*、*hash_bits* 與 *seed_bits*" -#: ../../library/sys.rst:1063 +#: ../../library/sys.rst:1076 msgid "" "The version number encoded as a single integer. This is guaranteed to " "increase with each version, including proper support for non-production " @@ -1354,7 +1368,7 @@ msgid "" "version 1.5.2, use::" msgstr "" -#: ../../library/sys.rst:1067 +#: ../../library/sys.rst:1080 msgid "" "if sys.hexversion >= 0x010502F0:\n" " # use some advanced feature\n" @@ -1364,7 +1378,7 @@ msgid "" " ..." msgstr "" -#: ../../library/sys.rst:1074 +#: ../../library/sys.rst:1087 msgid "" "This is called ``hexversion`` since it only really looks meaningful when " "viewed as the result of passing it to the built-in :func:`hex` function. " @@ -1372,25 +1386,25 @@ msgid "" "human-friendly encoding of the same information." msgstr "" -#: ../../library/sys.rst:1079 +#: ../../library/sys.rst:1092 msgid "More details of ``hexversion`` can be found at :ref:`apiabiversion`." msgstr "" -#: ../../library/sys.rst:1084 +#: ../../library/sys.rst:1097 msgid "" "An object containing information about the implementation of the currently " "running Python interpreter. The following attributes are required to exist " "in all Python implementations." msgstr "" -#: ../../library/sys.rst:1088 +#: ../../library/sys.rst:1101 msgid "" "*name* is the implementation's identifier, e.g. ``'cpython'``. The actual " "string is defined by the Python implementation, but it is guaranteed to be " "lower case." msgstr "" -#: ../../library/sys.rst:1092 +#: ../../library/sys.rst:1105 msgid "" "*version* is a named tuple, in the same format as :data:`sys.version_info`. " "It represents the version of the Python *implementation*. This has a " @@ -1402,13 +1416,13 @@ msgid "" "the same value, since it is the reference implementation." msgstr "" -#: ../../library/sys.rst:1102 +#: ../../library/sys.rst:1115 msgid "" "*hexversion* is the implementation version in hexadecimal format, like :data:" "`sys.hexversion`." msgstr "" -#: ../../library/sys.rst:1105 +#: ../../library/sys.rst:1118 msgid "" "*cache_tag* is the tag used by the import machinery in the filenames of " "cached modules. By convention, it would be a composite of the " @@ -1417,7 +1431,7 @@ msgid "" "set to ``None``, it indicates that module caching should be disabled." msgstr "" -#: ../../library/sys.rst:1112 +#: ../../library/sys.rst:1125 msgid "" ":data:`sys.implementation` may contain additional attributes specific to the " "Python implementation. These non-standard attributes must start with an " @@ -1427,41 +1441,41 @@ msgid "" "versions, however.) See :pep:`421` for more information." msgstr "" -#: ../../library/sys.rst:1123 +#: ../../library/sys.rst:1136 msgid "" "The addition of new required attributes must go through the normal PEP " "process. See :pep:`421` for more information." msgstr "" -#: ../../library/sys.rst:1128 +#: ../../library/sys.rst:1141 msgid "" "A :term:`named tuple` that holds information about Python's internal " "representation of integers. The attributes are read only." msgstr "" -#: ../../library/sys.rst:1133 +#: ../../library/sys.rst:1146 msgid "" "The number of bits held in each digit. Python integers are stored internally " "in base ``2**int_info.bits_per_digit``." msgstr "" -#: ../../library/sys.rst:1138 +#: ../../library/sys.rst:1151 msgid "The size in bytes of the C type used to represent a digit." msgstr "" -#: ../../library/sys.rst:1142 +#: ../../library/sys.rst:1155 msgid "" "The default value for :func:`sys.get_int_max_str_digits` when it is not " "otherwise explicitly configured." msgstr "" -#: ../../library/sys.rst:1147 +#: ../../library/sys.rst:1160 msgid "" "The minimum non-zero value for :func:`sys.set_int_max_str_digits`, :envvar:" "`PYTHONINTMAXSTRDIGITS`, or :option:`-X int_max_str_digits <-X>`." msgstr "" -#: ../../library/sys.rst:1154 +#: ../../library/sys.rst:1167 msgid "" "Added :attr:`~int_info.default_max_str_digits` and :attr:`~int_info." "str_digits_check_threshold`." @@ -1469,7 +1483,7 @@ msgstr "" "新增 :attr:`~int_info.default_max_str_digits` 和 :attr:`~int_info." "str_digits_check_threshold`。" -#: ../../library/sys.rst:1160 +#: ../../library/sys.rst:1173 msgid "" "When this attribute exists, its value is automatically called (with no " "arguments) when the interpreter is launched in :ref:`interactive mode `." msgstr "" -#: ../../library/sys.rst:1166 ../../library/sys.rst:1168 +#: ../../library/sys.rst:1179 ../../library/sys.rst:1181 msgid "" "Raises an :ref:`auditing event ` ``cpython.run_interactivehook`` " "with the hook object as the argument when the hook is called on startup." msgstr "" -#: ../../library/sys.rst:1177 +#: ../../library/sys.rst:1190 msgid "" "Enter *string* in the table of \"interned\" strings and return the interned " "string -- which is *string* itself or a copy. Interning strings is useful to " @@ -1496,19 +1510,29 @@ msgid "" "attributes have interned keys." msgstr "" -#: ../../library/sys.rst:1185 +#: ../../library/sys.rst:1198 msgid "" -"Interned strings are not immortal; you must keep a reference to the return " -"value of :func:`intern` around to benefit from it." +"Interned strings are not :term:`immortal`; you must keep a reference to the " +"return value of :func:`intern` around to benefit from it." msgstr "" -#: ../../library/sys.rst:1191 +#: ../../library/sys.rst:1204 msgid "" -"Return :const:`True` if the Python interpreter is :term:`shutting down " -"`, :const:`False` otherwise." +"Return :const:`True` if the :term:`GIL` is enabled and :const:`False` if it " +"is disabled." msgstr "" -#: ../../library/sys.rst:1198 +#: ../../library/sys.rst:1212 +msgid "" +"Return :const:`True` if the main Python interpreter is :term:`shutting down " +"`. Return :const:`False` otherwise." +msgstr "" + +#: ../../library/sys.rst:1215 +msgid "See also the :exc:`PythonFinalizationError` exception." +msgstr "" + +#: ../../library/sys.rst:1221 msgid "" "This variable is not always defined; it is set to the exception instance " "when an exception is not handled and the interpreter prints an error message " @@ -1519,34 +1543,44 @@ msgid "" "more information.)" msgstr "" -#: ../../library/sys.rst:1212 +#: ../../library/sys.rst:1233 +msgid "" +"Return :const:`True` if the given string is \"interned\", :const:`False` " +"otherwise." +msgstr "" + +#: ../../library/sys.rst:1240 +msgid "It is not guaranteed to exist in all implementations of Python." +msgstr "" + +#: ../../library/sys.rst:1247 msgid "" "These three variables are deprecated; use :data:`sys.last_exc` instead. They " "hold the legacy representation of ``sys.last_exc``, as returned from :func:" "`exc_info` above." msgstr "" -#: ../../library/sys.rst:1218 +#: ../../library/sys.rst:1253 msgid "" "An integer giving the maximum value a variable of type :c:type:`Py_ssize_t` " "can take. It's usually ``2**31 - 1`` on a 32-bit platform and ``2**63 - 1`` " "on a 64-bit platform." msgstr "" -#: ../../library/sys.rst:1225 +#: ../../library/sys.rst:1260 msgid "" "An integer giving the value of the largest Unicode code point, i.e. " "``1114111`` (``0x10FFFF`` in hexadecimal)." msgstr "" -#: ../../library/sys.rst:1228 +#: ../../library/sys.rst:1263 msgid "" "Before :pep:`393`, ``sys.maxunicode`` used to be either ``0xFFFF`` or " "``0x10FFFF``, depending on the configuration option that specified whether " "Unicode characters were stored as UCS-2 or UCS-4." msgstr "" -#: ../../library/sys.rst:1236 +#: ../../library/sys.rst:1271 msgid "" "A list of :term:`meta path finder` objects that have their :meth:`~importlib." "abc.MetaPathFinder.find_spec` methods called to see if one of the objects " @@ -1559,40 +1593,40 @@ msgid "" "if the module cannot be found." msgstr "" -#: ../../library/sys.rst:1248 +#: ../../library/sys.rst:1283 msgid ":class:`importlib.abc.MetaPathFinder`" msgstr ":class:`importlib.abc.MetaPathFinder`" -#: ../../library/sys.rst:1249 +#: ../../library/sys.rst:1284 msgid "" "The abstract base class defining the interface of finder objects on :data:" "`meta_path`." msgstr "" -#: ../../library/sys.rst:1251 +#: ../../library/sys.rst:1286 msgid ":class:`importlib.machinery.ModuleSpec`" msgstr ":class:`importlib.machinery.ModuleSpec`" -#: ../../library/sys.rst:1252 +#: ../../library/sys.rst:1287 msgid "" "The concrete class which :meth:`~importlib.abc.MetaPathFinder.find_spec` " "should return instances of." msgstr "" -#: ../../library/sys.rst:1258 +#: ../../library/sys.rst:1293 msgid "" ":term:`Module specs ` were introduced in Python 3.4, by :pep:" "`451`." msgstr "" -#: ../../library/sys.rst:1263 +#: ../../library/sys.rst:1298 msgid "" "Removed the fallback that looked for a :meth:`!find_module` method if a :" "data:`meta_path` entry didn't have a :meth:`~importlib.abc.MetaPathFinder." "find_spec` method." msgstr "" -#: ../../library/sys.rst:1269 +#: ../../library/sys.rst:1304 msgid "" "This is a dictionary that maps module names to modules which have already " "been loaded. This can be manipulated to force reloading of modules and " @@ -1604,13 +1638,13 @@ msgid "" "other threads." msgstr "" -#: ../../library/sys.rst:1281 +#: ../../library/sys.rst:1316 msgid "" "The list of the original command line arguments passed to the Python " "executable." msgstr "" -#: ../../library/sys.rst:1284 +#: ../../library/sys.rst:1319 msgid "" "The elements of :data:`sys.orig_argv` are the arguments to the Python " "interpreter, while the elements of :data:`sys.argv` are the arguments to the " @@ -1618,68 +1652,68 @@ msgid "" "in :data:`sys.orig_argv` and missing from :data:`sys.argv`." msgstr "" -#: ../../library/sys.rst:1296 +#: ../../library/sys.rst:1331 msgid "" "A list of strings that specifies the search path for modules. Initialized " "from the environment variable :envvar:`PYTHONPATH`, plus an installation-" "dependent default." msgstr "" -#: ../../library/sys.rst:1300 +#: ../../library/sys.rst:1335 msgid "" "By default, as initialized upon program startup, a potentially unsafe path " "is prepended to :data:`sys.path` (*before* the entries inserted as a result " "of :envvar:`PYTHONPATH`):" msgstr "" -#: ../../library/sys.rst:1304 +#: ../../library/sys.rst:1339 msgid "" "``python -m module`` command line: prepend the current working directory." msgstr "" -#: ../../library/sys.rst:1306 +#: ../../library/sys.rst:1341 msgid "" "``python script.py`` command line: prepend the script's directory. If it's a " "symbolic link, resolve symbolic links." msgstr "" -#: ../../library/sys.rst:1308 +#: ../../library/sys.rst:1343 msgid "" "``python -c code`` and ``python`` (REPL) command lines: prepend an empty " "string, which means the current working directory." msgstr "" -#: ../../library/sys.rst:1311 +#: ../../library/sys.rst:1346 msgid "" "To not prepend this potentially unsafe path, use the :option:`-P` command " "line option or the :envvar:`PYTHONSAFEPATH` environment variable." msgstr "" -#: ../../library/sys.rst:1314 +#: ../../library/sys.rst:1349 msgid "" "A program is free to modify this list for its own purposes. Only strings " "should be added to :data:`sys.path`; all other data types are ignored during " "import." msgstr "" -#: ../../library/sys.rst:1320 +#: ../../library/sys.rst:1355 msgid "" "Module :mod:`site` This describes how to use .pth files to extend :data:`sys." "path`." msgstr "" -#: ../../library/sys.rst:1325 +#: ../../library/sys.rst:1360 msgid "" "A list of callables that take a path argument to try to create a :term:" "`finder` for the path. If a finder can be created, it is to be returned by " "the callable, else raise :exc:`ImportError`." msgstr "" -#: ../../library/sys.rst:1329 ../../library/sys.rst:1340 +#: ../../library/sys.rst:1364 ../../library/sys.rst:1375 msgid "Originally specified in :pep:`302`." msgstr "" -#: ../../library/sys.rst:1334 +#: ../../library/sys.rst:1369 msgid "" "A dictionary acting as a cache for :term:`finder` objects. The keys are " "paths that have been passed to :data:`sys.path_hooks` and the values are the " @@ -1687,166 +1721,175 @@ msgid "" "is found on :data:`sys.path_hooks` then ``None`` is stored." msgstr "" -#: ../../library/sys.rst:1345 -msgid "" -"This string contains a platform identifier that can be used to append " -"platform-specific components to :data:`sys.path`, for instance." -msgstr "" - -#: ../../library/sys.rst:1348 -msgid "" -"For Unix systems, except on Linux and AIX, this is the lowercased OS name as " -"returned by ``uname -s`` with the first part of the version as returned by " -"``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, *at the time " -"when Python was built*. Unless you want to test for a specific system " -"version, it is therefore recommended to use the following idiom::" -msgstr "" - -#: ../../library/sys.rst:1354 -msgid "" -"if sys.platform.startswith('freebsd'):\n" -" # FreeBSD-specific code here...\n" -"elif sys.platform.startswith('linux'):\n" -" # Linux-specific code here...\n" -"elif sys.platform.startswith('aix'):\n" -" # AIX-specific code here..." +#: ../../library/sys.rst:1380 +msgid "A string containing a platform identifier. Known values are:" msgstr "" -#: ../../library/sys.rst:1361 -msgid "For other systems, the values are:" -msgstr "" - -#: ../../library/sys.rst:1364 +#: ../../library/sys.rst:1383 msgid "System" msgstr "" -#: ../../library/sys.rst:1364 +#: ../../library/sys.rst:1383 msgid "``platform`` value" msgstr "" -#: ../../library/sys.rst:1366 +#: ../../library/sys.rst:1385 msgid "AIX" msgstr "AIX" -#: ../../library/sys.rst:1366 +#: ../../library/sys.rst:1385 msgid "``'aix'``" msgstr "``'aix'``" -#: ../../library/sys.rst:1367 +#: ../../library/sys.rst:1386 +msgid "Android" +msgstr "" + +#: ../../library/sys.rst:1386 +#, fuzzy +msgid "``'android'``" +msgstr "``'aix'``" + +#: ../../library/sys.rst:1387 msgid "Emscripten" msgstr "Emscripten" -#: ../../library/sys.rst:1367 +#: ../../library/sys.rst:1387 msgid "``'emscripten'``" msgstr "``'emscripten'``" -#: ../../library/sys.rst:1368 +#: ../../library/sys.rst:1388 +msgid "iOS" +msgstr "" + +#: ../../library/sys.rst:1388 +msgid "``'ios'``" +msgstr "``'ios'``" + +#: ../../library/sys.rst:1389 msgid "Linux" msgstr "Linux" -#: ../../library/sys.rst:1368 +#: ../../library/sys.rst:1389 msgid "``'linux'``" msgstr "``'linux'``" -#: ../../library/sys.rst:1369 -msgid "WASI" -msgstr "WASI" +#: ../../library/sys.rst:1390 +msgid "macOS" +msgstr "macOS" -#: ../../library/sys.rst:1369 -msgid "``'wasi'``" -msgstr "``'wasi'``" +#: ../../library/sys.rst:1390 +msgid "``'darwin'``" +msgstr "``'darwin'``" -#: ../../library/sys.rst:1370 +#: ../../library/sys.rst:1391 msgid "Windows" msgstr "Windows" -#: ../../library/sys.rst:1370 +#: ../../library/sys.rst:1391 msgid "``'win32'``" msgstr "``'win32'``" -#: ../../library/sys.rst:1371 +#: ../../library/sys.rst:1392 msgid "Windows/Cygwin" msgstr "Windows/Cygwin" -#: ../../library/sys.rst:1371 +#: ../../library/sys.rst:1392 msgid "``'cygwin'``" msgstr "``'cygwin'``" -#: ../../library/sys.rst:1372 -msgid "macOS" -msgstr "macOS" +#: ../../library/sys.rst:1393 +msgid "WASI" +msgstr "WASI" -#: ../../library/sys.rst:1372 -msgid "``'darwin'``" -msgstr "``'darwin'``" +#: ../../library/sys.rst:1393 +msgid "``'wasi'``" +msgstr "``'wasi'``" + +#: ../../library/sys.rst:1396 +msgid "" +"On Unix systems not listed in the table, the value is the lowercased OS name " +"as returned by ``uname -s``, with the first part of the version as returned " +"by ``uname -r`` appended, e.g. ``'sunos5'`` or ``'freebsd8'``, *at the time " +"when Python was built*. Unless you want to test for a specific system " +"version, it is therefore recommended to use the following idiom::" +msgstr "" -#: ../../library/sys.rst:1375 +#: ../../library/sys.rst:1402 +msgid "" +"if sys.platform.startswith('freebsd'):\n" +" # FreeBSD-specific code here..." +msgstr "" + +#: ../../library/sys.rst:1405 msgid "" "On Linux, :data:`sys.platform` doesn't contain the major version anymore. It " -"is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``. Since older " -"Python versions include the version number, it is recommended to always use " -"the ``startswith`` idiom presented above." +"is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``." msgstr "" -#: ../../library/sys.rst:1381 +#: ../../library/sys.rst:1409 msgid "" "On AIX, :data:`sys.platform` doesn't contain the major version anymore. It " -"is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``. Since older " -"Python versions include the version number, it is recommended to always use " -"the ``startswith`` idiom presented above." +"is always ``'aix'``, instead of ``'aix5'`` or ``'aix7'``." msgstr "" -#: ../../library/sys.rst:1389 +#: ../../library/sys.rst:1413 +msgid "" +"On Android, :data:`sys.platform` now returns ``'android'`` rather than " +"``'linux'``." +msgstr "" + +#: ../../library/sys.rst:1419 msgid "" ":data:`os.name` has a coarser granularity. :func:`os.uname` gives system-" "dependent version information." msgstr "" -#: ../../library/sys.rst:1392 +#: ../../library/sys.rst:1422 msgid "" "The :mod:`platform` module provides detailed checks for the system's " "identity." msgstr "" -#: ../../library/sys.rst:1398 +#: ../../library/sys.rst:1428 msgid "" "Name of the platform-specific library directory. It is used to build the " "path of standard library and the paths of installed extension modules." msgstr "" -#: ../../library/sys.rst:1401 +#: ../../library/sys.rst:1431 msgid "" "It is equal to ``\"lib\"`` on most platforms. On Fedora and SuSE, it is " "equal to ``\"lib64\"`` on 64-bit platforms which gives the following ``sys." "path`` paths (where ``X.Y`` is the Python ``major.minor`` version):" msgstr "" -#: ../../library/sys.rst:1405 +#: ../../library/sys.rst:1435 msgid "" "``/usr/lib64/pythonX.Y/``: Standard library (like ``os.py`` of the :mod:`os` " "module)" msgstr "" -#: ../../library/sys.rst:1407 +#: ../../library/sys.rst:1437 msgid "" "``/usr/lib64/pythonX.Y/lib-dynload/``: C extension modules of the standard " "library (like the :mod:`errno` module, the exact filename is platform " "specific)" msgstr "" -#: ../../library/sys.rst:1410 +#: ../../library/sys.rst:1440 msgid "" "``/usr/lib/pythonX.Y/site-packages/`` (always use ``lib``, not :data:`sys." "platlibdir`): Third-party modules" msgstr "" -#: ../../library/sys.rst:1412 +#: ../../library/sys.rst:1442 msgid "" "``/usr/lib64/pythonX.Y/site-packages/``: C extension modules of third-party " "packages" msgstr "" -#: ../../library/sys.rst:1420 +#: ../../library/sys.rst:1450 msgid "" "A string giving the site-specific directory prefix where the platform " "independent Python files are installed; on Unix, the default is :file:`/usr/" @@ -1855,14 +1898,14 @@ msgid "" "derived paths." msgstr "" -#: ../../library/sys.rst:1426 +#: ../../library/sys.rst:1456 msgid "" "If a :ref:`virtual environment ` is in effect, this value will be " "changed in ``site.py`` to point to the virtual environment. The value for " "the Python installation will still be available, via :data:`base_prefix`." msgstr "" -#: ../../library/sys.rst:1441 +#: ../../library/sys.rst:1471 msgid "" "Strings specifying the primary and secondary prompt of the interpreter. " "These are only defined if the interpreter is in interactive mode. Their " @@ -1872,7 +1915,7 @@ msgid "" "used to implement a dynamic prompt." msgstr "" -#: ../../library/sys.rst:1451 +#: ../../library/sys.rst:1481 msgid "" "Set the flags used by the interpreter for :c:func:`dlopen` calls, such as " "when the interpreter loads extension modules. Among other things, this will " @@ -1883,14 +1926,14 @@ msgid "" "g. :const:`os.RTLD_LAZY`)." msgstr "" -#: ../../library/sys.rst:1463 +#: ../../library/sys.rst:1493 msgid "" "Set the :ref:`integer string conversion length limitation " "` used by this interpreter. See also :func:" "`get_int_max_str_digits`." msgstr "" -#: ../../library/sys.rst:1475 +#: ../../library/sys.rst:1505 msgid "" "Set the system's profile function, which allows you to implement a Python " "source code profiler in Python. See chapter :ref:`profile` for more " @@ -1905,14 +1948,14 @@ msgid "" "in the profile function will cause itself unset." msgstr "" -#: ../../library/sys.rst:1487 +#: ../../library/sys.rst:1517 msgid "" "The same tracing mechanism is used for :func:`!setprofile` as :func:" "`settrace`. To trace calls with :func:`!setprofile` inside a tracing " "function (e.g. in a debugger breakpoint), see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1491 +#: ../../library/sys.rst:1521 msgid "" "Profile functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -1920,71 +1963,71 @@ msgid "" "depends on the event type." msgstr "" -#: ../../library/sys.rst:1496 ../../library/sys.rst:1583 +#: ../../library/sys.rst:1526 ../../library/sys.rst:1613 msgid "The events have the following meaning:" msgstr "" -#: ../../library/sys.rst:1498 ../../library/sys.rst:1585 +#: ../../library/sys.rst:1528 ../../library/sys.rst:1615 msgid "``'call'``" msgstr "``'call'``" -#: ../../library/sys.rst:1499 +#: ../../library/sys.rst:1529 msgid "" "A function is called (or some other code block entered). The profile " "function is called; *arg* is ``None``." msgstr "" -#: ../../library/sys.rst:1502 ../../library/sys.rst:1600 +#: ../../library/sys.rst:1532 ../../library/sys.rst:1630 msgid "``'return'``" msgstr "``'return'``" -#: ../../library/sys.rst:1503 +#: ../../library/sys.rst:1533 msgid "" "A function (or other code block) is about to return. The profile function " "is called; *arg* is the value that will be returned, or ``None`` if the " "event is caused by an exception being raised." msgstr "" -#: ../../library/sys.rst:1507 +#: ../../library/sys.rst:1537 msgid "``'c_call'``" msgstr "``'c_call'``" -#: ../../library/sys.rst:1508 +#: ../../library/sys.rst:1538 msgid "" "A C function is about to be called. This may be an extension function or a " "built-in. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1511 +#: ../../library/sys.rst:1541 msgid "``'c_return'``" msgstr "``'c_return'``" -#: ../../library/sys.rst:1512 +#: ../../library/sys.rst:1542 msgid "A C function has returned. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1514 +#: ../../library/sys.rst:1544 msgid "``'c_exception'``" msgstr "``'c_exception'``" -#: ../../library/sys.rst:1515 +#: ../../library/sys.rst:1545 msgid "A C function has raised an exception. *arg* is the C function object." msgstr "" -#: ../../library/sys.rst:1517 +#: ../../library/sys.rst:1547 msgid "" "Raises an :ref:`auditing event ` ``sys.setprofile`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.setprofile``。" -#: ../../library/sys.rst:1522 +#: ../../library/sys.rst:1552 msgid "" "Set the maximum depth of the Python interpreter stack to *limit*. This " "limit prevents infinite recursion from causing an overflow of the C stack " "and crashing Python." msgstr "" -#: ../../library/sys.rst:1526 +#: ../../library/sys.rst:1556 msgid "" "The highest possible limit is platform-dependent. A user may need to set " "the limit higher when they have a program that requires deep recursion and a " @@ -1992,19 +2035,19 @@ msgid "" "because a too-high limit can lead to a crash." msgstr "" -#: ../../library/sys.rst:1531 +#: ../../library/sys.rst:1561 msgid "" "If the new limit is too low at the current recursion depth, a :exc:" "`RecursionError` exception is raised." msgstr "" -#: ../../library/sys.rst:1534 +#: ../../library/sys.rst:1564 msgid "" "A :exc:`RecursionError` exception is now raised if the new limit is too low " "at the current recursion depth." msgstr "" -#: ../../library/sys.rst:1541 +#: ../../library/sys.rst:1571 msgid "" "Set the interpreter's thread switch interval (in seconds). This floating-" "point value determines the ideal duration of the \"timeslices\" allocated to " @@ -2015,7 +2058,7 @@ msgid "" "scheduler." msgstr "" -#: ../../library/sys.rst:1558 +#: ../../library/sys.rst:1588 msgid "" "Set the system's trace function, which allows you to implement a Python " "source code debugger in Python. The function is thread-specific; for a " @@ -2024,7 +2067,7 @@ msgid "" "`threading.settrace`." msgstr "" -#: ../../library/sys.rst:1563 +#: ../../library/sys.rst:1593 msgid "" "Trace functions should have three arguments: *frame*, *event*, and *arg*. " "*frame* is the current stack frame. *event* is a string: ``'call'``, " @@ -2032,7 +2075,7 @@ msgid "" "the event type." msgstr "" -#: ../../library/sys.rst:1568 +#: ../../library/sys.rst:1598 msgid "" "The trace function is invoked (with *event* set to ``'call'``) whenever a " "new local scope is entered; it should return a reference to a local trace " @@ -2040,36 +2083,36 @@ msgid "" "traced." msgstr "" -#: ../../library/sys.rst:1573 +#: ../../library/sys.rst:1603 msgid "" "The local trace function should return a reference to itself, or to another " "function which would then be used as the local trace function for the scope." msgstr "" -#: ../../library/sys.rst:1576 +#: ../../library/sys.rst:1606 msgid "" "If there is any error occurred in the trace function, it will be unset, just " "like ``settrace(None)`` is called." msgstr "" -#: ../../library/sys.rst:1580 +#: ../../library/sys.rst:1610 msgid "" "Tracing is disabled while calling the trace function (e.g. a function set " "by :func:`!settrace`). For recursive tracing see :func:`call_tracing`." msgstr "" -#: ../../library/sys.rst:1586 +#: ../../library/sys.rst:1616 msgid "" "A function is called (or some other code block entered). The global trace " "function is called; *arg* is ``None``; the return value specifies the local " "trace function." msgstr "" -#: ../../library/sys.rst:1590 +#: ../../library/sys.rst:1620 msgid "``'line'``" msgstr "``'line'``" -#: ../../library/sys.rst:1591 +#: ../../library/sys.rst:1621 msgid "" "The interpreter is about to execute a new line of code or re-execute the " "condition of a loop. The local trace function is called; *arg* is ``None``; " @@ -2079,7 +2122,7 @@ msgid "" "to :const:`False` on that :ref:`frame `." msgstr "" -#: ../../library/sys.rst:1601 +#: ../../library/sys.rst:1631 msgid "" "A function (or other code block) is about to return. The local trace " "function is called; *arg* is the value that will be returned, or ``None`` if " @@ -2087,22 +2130,22 @@ msgid "" "return value is ignored." msgstr "" -#: ../../library/sys.rst:1606 +#: ../../library/sys.rst:1636 msgid "``'exception'``" msgstr "``'exception'``" -#: ../../library/sys.rst:1607 +#: ../../library/sys.rst:1637 msgid "" "An exception has occurred. The local trace function is called; *arg* is a " "tuple ``(exception, value, traceback)``; the return value specifies the new " "local trace function." msgstr "" -#: ../../library/sys.rst:1611 +#: ../../library/sys.rst:1641 msgid "``'opcode'``" msgstr "``'opcode'``" -#: ../../library/sys.rst:1612 +#: ../../library/sys.rst:1642 msgid "" "The interpreter is about to execute a new opcode (see :mod:`dis` for opcode " "details). The local trace function is called; *arg* is ``None``; the return " @@ -2112,13 +2155,13 @@ msgid "" "objects>`." msgstr "" -#: ../../library/sys.rst:1619 +#: ../../library/sys.rst:1649 msgid "" "Note that as an exception is propagated down the chain of callers, an " "``'exception'`` event is generated at each level." msgstr "" -#: ../../library/sys.rst:1622 +#: ../../library/sys.rst:1652 msgid "" "For more fine-grained usage, it's possible to set a trace function by " "assigning ``frame.f_trace = tracefunc`` explicitly, rather than relying on " @@ -2132,17 +2175,17 @@ msgid "" "on each frame)." msgstr "" -#: ../../library/sys.rst:1633 +#: ../../library/sys.rst:1663 msgid "For more information on code and frame objects, refer to :ref:`types`." msgstr "" -#: ../../library/sys.rst:1635 +#: ../../library/sys.rst:1665 msgid "" "Raises an :ref:`auditing event ` ``sys.settrace`` with no " "arguments." msgstr "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys.settrace``。" -#: ../../library/sys.rst:1639 +#: ../../library/sys.rst:1669 msgid "" "The :func:`settrace` function is intended only for implementing debuggers, " "profilers, coverage tools and the like. Its behavior is part of the " @@ -2150,21 +2193,13 @@ msgid "" "thus may not be available in all Python implementations." msgstr "" -#: ../../library/sys.rst:1646 +#: ../../library/sys.rst:1676 msgid "" "``'opcode'`` event type added; :attr:`~frame.f_trace_lines` and :attr:" "`~frame.f_trace_opcodes` attributes added to frames" msgstr "" -#: ../../library/sys.rst:1649 -msgid "" -"``'opcode'`` event will only be emitted if :attr:`~frame.f_trace_opcodes` of " -"at least one frame has been set to :const:`True` before :func:`settrace` is " -"called. This behavior will be changed back in 3.13 to be consistent with " -"previous versions." -msgstr "" - -#: ../../library/sys.rst:1657 +#: ../../library/sys.rst:1681 msgid "" "Accepts two optional keyword arguments which are callables that accept an :" "term:`asynchronous generator iterator` as an argument. The *firstiter* " @@ -2173,7 +2208,7 @@ msgid "" "about to be garbage collected." msgstr "" -#: ../../library/sys.rst:1663 +#: ../../library/sys.rst:1687 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_firstiter`` with no arguments." @@ -2181,7 +2216,7 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "set_asyncgen_hooks_firstiter``。" -#: ../../library/sys.rst:1665 +#: ../../library/sys.rst:1689 msgid "" "Raises an :ref:`auditing event ` ``sys." "set_asyncgen_hooks_finalizer`` with no arguments." @@ -2189,20 +2224,20 @@ msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 ` ``sys." "set_asyncgen_hooks_finalizer``。" -#: ../../library/sys.rst:1667 +#: ../../library/sys.rst:1691 msgid "" "Two auditing events are raised because the underlying API consists of two " "calls, each of which must raise its own event." msgstr "" -#: ../../library/sys.rst:1670 +#: ../../library/sys.rst:1694 msgid "" "See :pep:`525` for more details, and for a reference example of a " "*finalizer* method see the implementation of ``asyncio.Loop." "shutdown_asyncgens`` in :source:`Lib/asyncio/base_events.py`" msgstr "" -#: ../../library/sys.rst:1682 +#: ../../library/sys.rst:1706 msgid "" "Allows enabling or disabling coroutine origin tracking. When enabled, the " "``cr_origin`` attribute on coroutine objects will contain a tuple of " @@ -2211,105 +2246,116 @@ msgid "" "disabled, ``cr_origin`` will be ``None``." msgstr "" -#: ../../library/sys.rst:1689 +#: ../../library/sys.rst:1713 msgid "" "To enable, pass a *depth* value greater than zero; this sets the number of " "frames whose information will be captured. To disable, pass set *depth* to " "zero." msgstr "" -#: ../../library/sys.rst:1693 +#: ../../library/sys.rst:1717 msgid "This setting is thread-specific." msgstr "" -#: ../../library/sys.rst:1703 +#: ../../library/sys.rst:1727 msgid "" "Activate the stack profiler trampoline *backend*. The only supported backend " "is ``\"perf\"``." msgstr "" -#: ../../library/sys.rst:1706 ../../library/sys.rst:1721 -#: ../../library/sys.rst:1729 +#: ../../library/sys.rst:1730 ../../library/sys.rst:1745 +#: ../../library/sys.rst:1753 msgid ":ref:`Availability `: Linux." msgstr ":ref:`適用 `:Linux。" -#: ../../library/sys.rst:1712 +#: ../../library/sys.rst:1736 msgid ":ref:`perf_profiling`" msgstr ":ref:`perf_profiling`" -#: ../../library/sys.rst:1713 +#: ../../library/sys.rst:1737 msgid "https://perf.wiki.kernel.org" msgstr "https://perf.wiki.kernel.org" -#: ../../library/sys.rst:1717 +#: ../../library/sys.rst:1741 msgid "Deactivate the current stack profiler trampoline backend." msgstr "" -#: ../../library/sys.rst:1719 +#: ../../library/sys.rst:1743 msgid "If no stack profiler is activated, this function has no effect." msgstr "" -#: ../../library/sys.rst:1727 +#: ../../library/sys.rst:1751 msgid "Return ``True`` if a stack profiler trampoline is active." msgstr "" -#: ../../library/sys.rst:1735 +#: ../../library/sys.rst:1759 msgid "" "Changes the :term:`filesystem encoding and error handler` to 'mbcs' and " "'replace' respectively, for consistency with versions of Python prior to 3.6." msgstr "" -#: ../../library/sys.rst:1739 +#: ../../library/sys.rst:1763 msgid "" "This is equivalent to defining the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " "environment variable before launching Python." msgstr "" -#: ../../library/sys.rst:1742 +#: ../../library/sys.rst:1766 msgid "" "See also :func:`sys.getfilesystemencoding` and :func:`sys." "getfilesystemencodeerrors`." msgstr "" -#: ../../library/sys.rst:1747 +#: ../../library/sys.rst:1772 +msgid "" +"Changing the filesystem encoding after Python startup is risky because the " +"old fsencoding or paths encoded by the old fsencoding may be cached " +"somewhere. Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." +msgstr "" + +#: ../../library/sys.rst:1776 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../library/sys.rst:1754 +#: ../../library/sys.rst:1779 +msgid "Use :envvar:`PYTHONLEGACYWINDOWSFSENCODING` instead." +msgstr "" + +#: ../../library/sys.rst:1786 msgid "" ":term:`File objects ` used by the interpreter for standard " "input, output and errors:" msgstr "" -#: ../../library/sys.rst:1757 +#: ../../library/sys.rst:1789 msgid "" "``stdin`` is used for all interactive input (including calls to :func:" "`input`);" msgstr "" -#: ../../library/sys.rst:1759 +#: ../../library/sys.rst:1791 msgid "" "``stdout`` is used for the output of :func:`print` and :term:`expression` " "statements and for the prompts of :func:`input`;" msgstr "" -#: ../../library/sys.rst:1761 +#: ../../library/sys.rst:1793 msgid "The interpreter's own prompts and its error messages go to ``stderr``." msgstr "" -#: ../../library/sys.rst:1763 +#: ../../library/sys.rst:1795 msgid "" "These streams are regular :term:`text files ` like those returned " "by the :func:`open` function. Their parameters are chosen as follows:" msgstr "" -#: ../../library/sys.rst:1767 +#: ../../library/sys.rst:1799 msgid "" "The encoding and error handling are is initialized from :c:member:`PyConfig." "stdio_encoding` and :c:member:`PyConfig.stdio_errors`." msgstr "" -#: ../../library/sys.rst:1770 +#: ../../library/sys.rst:1802 msgid "" "On Windows, UTF-8 is used for the console device. Non-character devices " "such as disk files and pipes use the system locale encoding (i.e. the ANSI " @@ -2320,14 +2366,14 @@ msgid "" "initially attached to a console." msgstr "" -#: ../../library/sys.rst:1779 +#: ../../library/sys.rst:1811 msgid "" "The special behaviour of the console can be overridden by setting the " "environment variable PYTHONLEGACYWINDOWSSTDIO before starting Python. In " "that case, the console codepages are used as for any other character device." msgstr "" -#: ../../library/sys.rst:1784 +#: ../../library/sys.rst:1816 msgid "" "Under all platforms, you can override the character encoding by setting the :" "envvar:`PYTHONIOENCODING` environment variable before starting Python or by " @@ -2336,7 +2382,7 @@ msgid "" "only applies when :envvar:`PYTHONLEGACYWINDOWSSTDIO` is also set." msgstr "" -#: ../../library/sys.rst:1791 +#: ../../library/sys.rst:1823 msgid "" "When interactive, the ``stdout`` stream is line-buffered. Otherwise, it is " "block-buffered like regular text files. The ``stderr`` stream is line-" @@ -2345,19 +2391,19 @@ msgid "" "`PYTHONUNBUFFERED` environment variable." msgstr "" -#: ../../library/sys.rst:1797 +#: ../../library/sys.rst:1829 msgid "" "Non-interactive ``stderr`` is now line-buffered instead of fully buffered." msgstr "" -#: ../../library/sys.rst:1803 +#: ../../library/sys.rst:1835 msgid "" "To write or read binary data from/to the standard streams, use the " "underlying binary :data:`~io.TextIOBase.buffer` object. For example, to " "write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``." msgstr "" -#: ../../library/sys.rst:1807 +#: ../../library/sys.rst:1839 msgid "" "However, if you are writing a library (and do not control in which context " "its code will be executed), be aware that the standard streams may be " @@ -2365,7 +2411,7 @@ msgid "" "support the :attr:`!buffer` attribute." msgstr "" -#: ../../library/sys.rst:1817 +#: ../../library/sys.rst:1849 msgid "" "These objects contain the original values of ``stdin``, ``stderr`` and " "``stdout`` at the start of the program. They are used during finalization, " @@ -2373,7 +2419,7 @@ msgid "" "``sys.std*`` object has been redirected." msgstr "" -#: ../../library/sys.rst:1822 +#: ../../library/sys.rst:1854 msgid "" "It can also be used to restore the actual files to known working file " "objects in case they have been overwritten with a broken object. However, " @@ -2381,7 +2427,7 @@ msgid "" "before replacing it, and restore the saved object." msgstr "" -#: ../../library/sys.rst:1828 +#: ../../library/sys.rst:1860 msgid "" "Under some conditions ``stdin``, ``stdout`` and ``stderr`` as well as the " "original values ``__stdin__``, ``__stdout__`` and ``__stderr__`` can be " @@ -2389,12 +2435,12 @@ msgid "" "to a console and Python apps started with :program:`pythonw`." msgstr "" -#: ../../library/sys.rst:1836 +#: ../../library/sys.rst:1868 msgid "" "A frozenset of strings containing the names of standard library modules." msgstr "" -#: ../../library/sys.rst:1838 +#: ../../library/sys.rst:1870 msgid "" "It is the same on all platforms. Modules which are not available on some " "platforms and modules disabled at Python build are also listed. All module " @@ -2402,7 +2448,7 @@ msgid "" "modules are excluded." msgstr "" -#: ../../library/sys.rst:1843 +#: ../../library/sys.rst:1875 msgid "" "For packages, only the main package is listed: sub-packages and sub-modules " "are not listed. For example, the ``email`` package is listed, but the " @@ -2410,60 +2456,60 @@ msgid "" "listed." msgstr "" -#: ../../library/sys.rst:1848 +#: ../../library/sys.rst:1880 msgid "See also the :data:`sys.builtin_module_names` list." msgstr "另請參閱 :attr:`sys.builtin_module_names` 清單。" -#: ../../library/sys.rst:1855 +#: ../../library/sys.rst:1887 msgid "" "A :term:`named tuple` holding information about the thread implementation." msgstr "" -#: ../../library/sys.rst:1860 +#: ../../library/sys.rst:1892 msgid "The name of the thread implementation:" msgstr "" -#: ../../library/sys.rst:1862 +#: ../../library/sys.rst:1894 msgid "``\"nt\"``: Windows threads" msgstr "``\"nt\"``: Windows 執行緒" -#: ../../library/sys.rst:1863 +#: ../../library/sys.rst:1895 msgid "``\"pthread\"``: POSIX threads" msgstr "``\"pthread\"``: POSIX 執行緒" -#: ../../library/sys.rst:1864 +#: ../../library/sys.rst:1896 msgid "" "``\"pthread-stubs\"``: stub POSIX threads (on WebAssembly platforms without " "threading support)" msgstr "" -#: ../../library/sys.rst:1866 +#: ../../library/sys.rst:1898 msgid "``\"solaris\"``: Solaris threads" msgstr "" -#: ../../library/sys.rst:1870 +#: ../../library/sys.rst:1902 msgid "The name of the lock implementation:" msgstr "" -#: ../../library/sys.rst:1872 +#: ../../library/sys.rst:1904 msgid "``\"semaphore\"``: a lock uses a semaphore" msgstr "" -#: ../../library/sys.rst:1873 +#: ../../library/sys.rst:1905 msgid "``\"mutex+cond\"``: a lock uses a mutex and a condition variable" msgstr "" -#: ../../library/sys.rst:1874 +#: ../../library/sys.rst:1906 msgid "``None`` if this information is unknown" msgstr "為 ``None`` 表示此資訊未知" -#: ../../library/sys.rst:1878 +#: ../../library/sys.rst:1910 msgid "" "The name and version of the thread library. It is a string, or ``None`` if " "this information is unknown." msgstr "" -#: ../../library/sys.rst:1886 +#: ../../library/sys.rst:1918 msgid "" "When this variable is set to an integer value, it determines the maximum " "number of levels of traceback information printed when an unhandled " @@ -2472,73 +2518,73 @@ msgid "" "are printed." msgstr "" -#: ../../library/sys.rst:1894 +#: ../../library/sys.rst:1926 msgid "Handle an unraisable exception." msgstr "處理一個不可被引發的例外。" -#: ../../library/sys.rst:1896 +#: ../../library/sys.rst:1928 msgid "" "Called when an exception has occurred but there is no way for Python to " "handle it. For example, when a destructor raises an exception or during " "garbage collection (:func:`gc.collect`)." msgstr "" -#: ../../library/sys.rst:1900 +#: ../../library/sys.rst:1932 msgid "The *unraisable* argument has the following attributes:" msgstr "" -#: ../../library/sys.rst:1902 +#: ../../library/sys.rst:1934 msgid ":attr:`!exc_type`: Exception type." msgstr ":attr:`!exc_type`: 例外型別。" -#: ../../library/sys.rst:1903 +#: ../../library/sys.rst:1935 msgid ":attr:`!exc_value`: Exception value, can be ``None``." msgstr ":attr:`!exc_value`: 例外值,可以為 ``None``。" -#: ../../library/sys.rst:1904 +#: ../../library/sys.rst:1936 msgid ":attr:`!exc_traceback`: Exception traceback, can be ``None``." msgstr ":attr:`!exc_traceback`: 例外追蹤,可以為 ``None``。" -#: ../../library/sys.rst:1905 +#: ../../library/sys.rst:1937 msgid ":attr:`!err_msg`: Error message, can be ``None``." msgstr ":attr:`!err_msg`: 錯誤訊息,可以為 ``None``。" -#: ../../library/sys.rst:1906 +#: ../../library/sys.rst:1938 msgid ":attr:`!object`: Object causing the exception, can be ``None``." msgstr ":attr:`!object`: 導致例外的物件,可以為 ``None``。" -#: ../../library/sys.rst:1908 +#: ../../library/sys.rst:1940 msgid "" "The default hook formats :attr:`!err_msg` and :attr:`!object` as: " "``f'{err_msg}: {object!r}'``; use \"Exception ignored in\" error message if :" "attr:`!err_msg` is ``None``." msgstr "" -#: ../../library/sys.rst:1912 +#: ../../library/sys.rst:1944 msgid "" ":func:`sys.unraisablehook` can be overridden to control how unraisable " "exceptions are handled." msgstr "" -#: ../../library/sys.rst:1917 +#: ../../library/sys.rst:1949 msgid ":func:`excepthook` which handles uncaught exceptions." msgstr "處理未被捕捉到例外的 :func:`excepthook`。" -#: ../../library/sys.rst:1921 +#: ../../library/sys.rst:1953 msgid "" "Storing :attr:`!exc_value` using a custom hook can create a reference cycle. " "It should be cleared explicitly to break the reference cycle when the " "exception is no longer needed." msgstr "" -#: ../../library/sys.rst:1925 +#: ../../library/sys.rst:1957 msgid "" "Storing :attr:`!object` using a custom hook can resurrect it if it is set to " "an object which is being finalized. Avoid storing :attr:`!object` after the " "custom hook completes to avoid resurrecting objects." msgstr "" -#: ../../library/sys.rst:1929 ../../library/sys.rst:1931 +#: ../../library/sys.rst:1961 ../../library/sys.rst:1963 msgid "" "Raise an auditing event ``sys.unraisablehook`` with arguments *hook*, " "*unraisable* when an exception that cannot be handled occurs. The " @@ -2546,7 +2592,7 @@ msgid "" "hook has been set, *hook* may be ``None``." msgstr "" -#: ../../library/sys.rst:1940 +#: ../../library/sys.rst:1972 msgid "" "A string containing the version number of the Python interpreter plus " "additional information on the build number and compiler used. This string " @@ -2555,13 +2601,13 @@ msgid "" "functions provided by the :mod:`platform` module." msgstr "" -#: ../../library/sys.rst:1949 +#: ../../library/sys.rst:1981 msgid "" "The C API version for this interpreter. Programmers may find this useful " "when debugging version conflicts between Python and extension modules." msgstr "" -#: ../../library/sys.rst:1955 +#: ../../library/sys.rst:1987 msgid "" "A tuple containing the five components of the version number: *major*, " "*minor*, *micro*, *releaselevel*, and *serial*. All values except " @@ -2572,18 +2618,18 @@ msgid "" "version_info.major`` and so on." msgstr "" -#: ../../library/sys.rst:1963 +#: ../../library/sys.rst:1995 msgid "Added named component attributes." msgstr "新增了附名的元件屬性。" -#: ../../library/sys.rst:1968 +#: ../../library/sys.rst:2000 msgid "" "This is an implementation detail of the warnings framework; do not modify " "this value. Refer to the :mod:`warnings` module for more information on the " "warnings framework." msgstr "" -#: ../../library/sys.rst:1975 +#: ../../library/sys.rst:2007 msgid "" "The version number used to form registry keys on Windows platforms. This is " "stored as string resource 1000 in the Python DLL. The value is normally the " @@ -2592,20 +2638,20 @@ msgid "" "has no effect on the registry keys used by Python." msgstr "" -#: ../../library/sys.rst:1987 +#: ../../library/sys.rst:2019 msgid "" "Namespace containing functions and constants for register callbacks and " "controlling monitoring events. See :mod:`sys.monitoring` for details." msgstr "" -#: ../../library/sys.rst:1993 +#: ../../library/sys.rst:2025 msgid "" "A dictionary of the various implementation-specific flags passed through " "the :option:`-X` command-line option. Option names are either mapped to " "their values, if given explicitly, or to :const:`True`. Example:" msgstr "" -#: ../../library/sys.rst:1997 +#: ../../library/sys.rst:2029 msgid "" "$ ./python -Xa=b -Xc\n" "Python 3.2a3+ (py3k, Oct 16 2010, 20:14:50)\n" @@ -2625,18 +2671,18 @@ msgstr "" ">>> sys._xoptions\n" "{'a': 'b', 'c': True}" -#: ../../library/sys.rst:2009 +#: ../../library/sys.rst:2041 msgid "" "This is a CPython-specific way of accessing options passed through :option:`-" "X`. Other implementations may export them through other means, or not at " "all." msgstr "" -#: ../../library/sys.rst:2017 +#: ../../library/sys.rst:2049 msgid "Citations" msgstr "引用" -#: ../../library/sys.rst:2018 +#: ../../library/sys.rst:2050 msgid "" "ISO/IEC 9899:1999. \"Programming languages -- C.\" A public draft of this " "standard is available at https://www.open-std.org/jtc1/sc22/wg14/www/docs/" @@ -2649,58 +2695,58 @@ msgstr "" msgid "auditing" msgstr "" -#: ../../library/sys.rst:451 +#: ../../library/sys.rst:462 msgid "object" msgstr "object(物件)" -#: ../../library/sys.rst:451 +#: ../../library/sys.rst:462 msgid "traceback" msgstr "traceback" -#: ../../library/sys.rst:912 ../../library/sys.rst:1471 +#: ../../library/sys.rst:925 ../../library/sys.rst:1501 msgid "profile function" msgstr "" -#: ../../library/sys.rst:912 ../../library/sys.rst:1471 +#: ../../library/sys.rst:925 ../../library/sys.rst:1501 msgid "profiler" msgstr "" -#: ../../library/sys.rst:921 ../../library/sys.rst:1554 +#: ../../library/sys.rst:934 ../../library/sys.rst:1584 msgid "trace function" msgstr "" -#: ../../library/sys.rst:921 ../../library/sys.rst:1554 +#: ../../library/sys.rst:934 ../../library/sys.rst:1584 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/sys.rst:1294 +#: ../../library/sys.rst:1329 msgid "module" msgstr "module(模組)" -#: ../../library/sys.rst:1294 +#: ../../library/sys.rst:1329 msgid "search" msgstr "search(搜尋)" -#: ../../library/sys.rst:1294 +#: ../../library/sys.rst:1329 msgid "path" msgstr "path(路徑)" -#: ../../library/sys.rst:1435 +#: ../../library/sys.rst:1465 msgid "interpreter prompts" msgstr "interpreter prompts(直譯器提示)" -#: ../../library/sys.rst:1435 +#: ../../library/sys.rst:1465 msgid "prompts, interpreter" msgstr "prompts, interpreter(提示、直譯器)" -#: ../../library/sys.rst:1435 +#: ../../library/sys.rst:1465 msgid ">>>" msgstr ">>>" -#: ../../library/sys.rst:1435 +#: ../../library/sys.rst:1465 msgid "interpreter prompt" msgstr "interpreter prompt(直譯器提示)" -#: ../../library/sys.rst:1435 +#: ../../library/sys.rst:1465 msgid "..." msgstr "..." diff --git a/library/sys_path_init.po b/library/sys_path_init.po index d71020ccda..4e699203ea 100644 --- a/library/sys_path_init.po +++ b/library/sys_path_init.po @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-10-15 20:43+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -171,14 +171,13 @@ msgid "" "If Python is embedded within another application :c:func:" "`Py_InitializeFromConfig` and the :c:type:`PyConfig` structure can be used " "to initialize Python. The path specific details are described at :ref:`init-" -"path-config`. Alternatively the older :c:func:`Py_SetPath` can be used to " -"bypass the initialization of the module search path." +"path-config`." msgstr "" -#: ../../library/sys_path_init.rst:107 +#: ../../library/sys_path_init.rst:106 msgid ":ref:`windows_finding_modules` for detailed Windows notes." msgstr "" -#: ../../library/sys_path_init.rst:108 +#: ../../library/sys_path_init.rst:107 msgid ":ref:`using-on-unix` for Unix details." msgstr "" diff --git a/library/sysconfig.po b/library/sysconfig.po index 0fc713e9d1..7a2c3ec0df 100644 --- a/library/sysconfig.po +++ b/library/sysconfig.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,7 +23,8 @@ msgid "" msgstr ":mod:`!sysconfig` --- 提供 Python 設定資訊的存取" #: ../../library/sysconfig.rst:12 -msgid "**Source code:** :source:`Lib/sysconfig.py`" +#, fuzzy +msgid "**Source code:** :source:`Lib/sysconfig`" msgstr "**原始碼:**\\ :source:`Lib/sysconfig.py`" #: ../../library/sysconfig.rst:19 diff --git a/library/syslog.po b/library/syslog.po index 51d5c2be48..9fb0489e10 100644 --- a/library/syslog.po +++ b/library/syslog.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -30,14 +30,15 @@ msgid "" msgstr "" #: ../../library/syslog.rst:14 -msgid ":ref:`Availability `: Unix, not Emscripten, not WASI." +#, fuzzy +msgid ":ref:`Availability `: Unix, not WASI, not iOS." msgstr ":ref:`適用 `:Unix、非 Emscripten、非 WASI。" #: ../../library/syslog.rst:16 msgid "" "This module wraps the system ``syslog`` family of routines. A pure Python " "library that can speak to a syslog server is available in the :mod:`logging." -"handlers` module as :class:`SysLogHandler`." +"handlers` module as :class:`~logging.handlers.SysLogHandler`." msgstr "" #: ../../library/syslog.rst:20 @@ -165,53 +166,42 @@ msgstr "" msgid "The module defines the following constants:" msgstr "" -#: ../../library/syslog.rst:110 -msgid "Priority levels (high to low):" +#: ../../library/syslog.rst:120 +msgid "Priority levels (high to low)." msgstr "" -#: ../../library/syslog.rst:111 +#: ../../library/syslog.rst:149 msgid "" -":const:`LOG_EMERG`, :const:`LOG_ALERT`, :const:`LOG_CRIT`, :const:" -"`LOG_ERR`, :const:`LOG_WARNING`, :const:`LOG_NOTICE`, :const:`LOG_INFO`, :" -"const:`LOG_DEBUG`." +"Facilities, depending on availability in ```` for :const:" +"`LOG_AUTHPRIV`, :const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:" +"`LOG_REMOTEAUTH`, :const:`LOG_INSTALL` and :const:`LOG_RAS`." msgstr "" -#: ../../library/syslog.rst:115 -msgid "Facilities:" -msgstr "" - -#: ../../library/syslog.rst:116 +#: ../../library/syslog.rst:153 msgid "" -":const:`LOG_KERN`, :const:`LOG_USER`, :const:`LOG_MAIL`, :const:" -"`LOG_DAEMON`, :const:`LOG_AUTH`, :const:`LOG_LPR`, :const:`LOG_NEWS`, :const:" -"`LOG_UUCP`, :const:`LOG_CRON`, :const:`LOG_SYSLOG`, :const:`LOG_LOCAL0` to :" -"const:`LOG_LOCAL7`, and, if defined in ````, :const:`LOG_AUTHPRIV`." -msgstr "" - -#: ../../library/syslog.rst:122 -msgid "Log options:" +"Added :const:`LOG_FTP`, :const:`LOG_NETINFO`, :const:`LOG_REMOTEAUTH`, :" +"const:`LOG_INSTALL`, :const:`LOG_RAS`, and :const:`LOG_LAUNCHD`." msgstr "" -#: ../../library/syslog.rst:123 +#: ../../library/syslog.rst:164 msgid "" -":const:`LOG_PID`, :const:`LOG_CONS`, :const:`LOG_NDELAY`, and, if defined in " -"````, :const:`LOG_ODELAY`, :const:`LOG_NOWAIT`, and :const:" -"`LOG_PERROR`." +"Log options, depending on availability in ```` for :const:" +"`LOG_ODELAY`, :const:`LOG_NOWAIT` and :const:`LOG_PERROR`." msgstr "" -#: ../../library/syslog.rst:129 +#: ../../library/syslog.rst:169 msgid "Examples" msgstr "範例" -#: ../../library/syslog.rst:132 +#: ../../library/syslog.rst:172 msgid "Simple example" msgstr "簡單範例" -#: ../../library/syslog.rst:134 +#: ../../library/syslog.rst:174 msgid "A simple set of examples::" msgstr "一組簡單範例: ::" -#: ../../library/syslog.rst:136 +#: ../../library/syslog.rst:176 msgid "" "import syslog\n" "\n" @@ -225,14 +215,14 @@ msgstr "" "if error:\n" " syslog.syslog(syslog.LOG_ERR, 'Processing started')" -#: ../../library/syslog.rst:142 +#: ../../library/syslog.rst:182 msgid "" "An example of setting some log options, these would include the process ID " "in logged messages, and write the messages to the destination facility used " "for mail logging::" msgstr "" -#: ../../library/syslog.rst:146 +#: ../../library/syslog.rst:186 msgid "" "syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_MAIL)\n" "syslog.syslog('E-mail processing initiated...')" diff --git a/library/tabnanny.po b/library/tabnanny.po index 18b3dbbf2a..0ed61a596b 100644 --- a/library/tabnanny.po +++ b/library/tabnanny.po @@ -7,7 +7,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-11-17 21:19+0800\n" diff --git a/library/tarfile.po b/library/tarfile.po index 05905efced..285f869c65 100644 --- a/library/tarfile.po +++ b/library/tarfile.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -343,12 +343,12 @@ msgstr "``'w|xz'``" msgid "Open an lzma compressed *stream* for writing." msgstr "" -#: ../../library/tarfile.rst:158 ../../library/tarfile.rst:422 +#: ../../library/tarfile.rst:158 ../../library/tarfile.rst:425 msgid "The ``'x'`` (exclusive creation) mode was added." msgstr "" -#: ../../library/tarfile.rst:161 ../../library/tarfile.rst:425 -#: ../../library/tarfile.rst:660 +#: ../../library/tarfile.rst:161 ../../library/tarfile.rst:428 +#: ../../library/tarfile.rst:673 msgid "The *name* parameter accepts a :term:`path-like object`." msgstr "" @@ -668,41 +668,51 @@ msgid "" "be added as a pax global header if *format* is :const:`PAX_FORMAT`." msgstr "" -#: ../../library/tarfile.rst:419 ../../library/tarfile.rst:729 +#: ../../library/tarfile.rst:419 +msgid "" +"If *stream* is set to :const:`True` then while reading the archive info " +"about files in the archive are not cached, saving memory." +msgstr "" + +#: ../../library/tarfile.rst:422 ../../library/tarfile.rst:742 msgid "Use ``'surrogateescape'`` as the default for the *errors* argument." msgstr "" #: ../../library/tarfile.rst:431 +msgid "Add the *stream* parameter." +msgstr "新增 *stream* 參數。" + +#: ../../library/tarfile.rst:436 msgid "" "Alternative constructor. The :func:`tarfile.open` function is actually a " "shortcut to this classmethod." msgstr "" -#: ../../library/tarfile.rst:437 +#: ../../library/tarfile.rst:442 msgid "" "Return a :class:`TarInfo` object for member *name*. If *name* can not be " "found in the archive, :exc:`KeyError` is raised." msgstr "" -#: ../../library/tarfile.rst:442 +#: ../../library/tarfile.rst:447 msgid "" "If a member occurs more than once in the archive, its last occurrence is " "assumed to be the most up-to-date version." msgstr "" -#: ../../library/tarfile.rst:448 +#: ../../library/tarfile.rst:453 msgid "" "Return the members of the archive as a list of :class:`TarInfo` objects. The " "list has the same order as the members in the archive." msgstr "" -#: ../../library/tarfile.rst:454 +#: ../../library/tarfile.rst:459 msgid "" "Return the members as a list of their names. It has the same order as the " "list returned by :meth:`getmembers`." msgstr "" -#: ../../library/tarfile.rst:460 +#: ../../library/tarfile.rst:465 msgid "" "Print a table of contents to ``sys.stdout``. If *verbose* is :const:`False`, " "only the names of the members are printed. If it is :const:`True`, output " @@ -710,18 +720,18 @@ msgid "" "given, it must be a subset of the list returned by :meth:`getmembers`." msgstr "" -#: ../../library/tarfile.rst:465 +#: ../../library/tarfile.rst:470 msgid "Added the *members* parameter." msgstr "新增 *members* 參數。" -#: ../../library/tarfile.rst:471 +#: ../../library/tarfile.rst:476 msgid "" "Return the next member of the archive as a :class:`TarInfo` object, when :" "class:`TarFile` is opened for reading. Return :const:`None` if there is no " "more available." msgstr "" -#: ../../library/tarfile.rst:478 +#: ../../library/tarfile.rst:483 msgid "" "Extract all members from the archive to the current working directory or " "directory *path*. If optional *members* is given, it must be a subset of the " @@ -733,14 +743,14 @@ msgid "" "fail." msgstr "" -#: ../../library/tarfile.rst:486 +#: ../../library/tarfile.rst:491 msgid "" "If *numeric_owner* is :const:`True`, the uid and gid numbers from the " "tarfile are used to set the owner/group for the extracted files. Otherwise, " "the named values from the tarfile are used." msgstr "" -#: ../../library/tarfile.rst:490 +#: ../../library/tarfile.rst:495 msgid "" "The *filter* argument specifies how ``members`` are modified or rejected " "before extraction. See :ref:`tarfile-extraction-filter` for details. It is " @@ -748,7 +758,7 @@ msgid "" "need to support." msgstr "" -#: ../../library/tarfile.rst:498 +#: ../../library/tarfile.rst:503 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of *path*, e.g. members that have " @@ -756,26 +766,26 @@ msgid "" "\"``." msgstr "" -#: ../../library/tarfile.rst:503 ../../library/tarfile.rst:536 +#: ../../library/tarfile.rst:508 ../../library/tarfile.rst:541 msgid "" "Set ``filter='data'`` to prevent the most dangerous security issues, and " "read the :ref:`tarfile-extraction-filter` section for details." msgstr "" -#: ../../library/tarfile.rst:506 ../../library/tarfile.rst:542 +#: ../../library/tarfile.rst:511 ../../library/tarfile.rst:547 msgid "Added the *numeric_owner* parameter." msgstr "新增 *numeric_owner* 參數。" -#: ../../library/tarfile.rst:509 ../../library/tarfile.rst:545 +#: ../../library/tarfile.rst:514 ../../library/tarfile.rst:550 msgid "The *path* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/tarfile.rst:512 ../../library/tarfile.rst:548 -#: ../../library/tarfile.rst:626 +#: ../../library/tarfile.rst:517 ../../library/tarfile.rst:553 +#: ../../library/tarfile.rst:635 msgid "Added the *filter* parameter." msgstr "新增 *filter* 參數。" -#: ../../library/tarfile.rst:518 +#: ../../library/tarfile.rst:523 msgid "" "Extract a member from the archive to the current working directory, using " "its full name. Its file information is extracted as accurately as possible. " @@ -784,27 +794,27 @@ msgid "" "File attributes (owner, mtime, mode) are set unless *set_attrs* is false." msgstr "" -#: ../../library/tarfile.rst:524 +#: ../../library/tarfile.rst:529 msgid "" "The *numeric_owner* and *filter* arguments are the same as for :meth:" "`extractall`." msgstr "" -#: ../../library/tarfile.rst:529 +#: ../../library/tarfile.rst:534 msgid "" "The :meth:`extract` method does not take care of several extraction issues. " "In most cases you should consider using the :meth:`extractall` method." msgstr "" -#: ../../library/tarfile.rst:534 +#: ../../library/tarfile.rst:539 msgid "See the warning for :meth:`extractall`." msgstr "參閱 :meth:`extractall` 的警告。" -#: ../../library/tarfile.rst:539 +#: ../../library/tarfile.rst:544 msgid "Added the *set_attrs* parameter." msgstr "增加 *set_attrs* 參數。" -#: ../../library/tarfile.rst:554 +#: ../../library/tarfile.rst:559 msgid "" "Extract a member from the archive as a file object. *member* may be a " "filename or a :class:`TarInfo` object. If *member* is a regular file or a " @@ -813,11 +823,17 @@ msgid "" "the archive, :exc:`KeyError` is raised." msgstr "" -#: ../../library/tarfile.rst:560 +#: ../../library/tarfile.rst:565 msgid "Return an :class:`io.BufferedReader` object." msgstr "" -#: ../../library/tarfile.rst:566 +#: ../../library/tarfile.rst:568 +msgid "" +"The returned :class:`io.BufferedReader` object has the :attr:`!mode` " +"attribute which is always equal to ``'rb'``." +msgstr "" + +#: ../../library/tarfile.rst:575 msgid "" "If *errorlevel* is ``0``, errors are ignored when using :meth:`TarFile." "extract` and :meth:`TarFile.extractall`. Nevertheless, they appear as error " @@ -827,39 +843,39 @@ msgid "" "exc:`TarError` exceptions as well." msgstr "" -#: ../../library/tarfile.rst:574 +#: ../../library/tarfile.rst:583 msgid "" "Some exceptions, e.g. ones caused by wrong argument types or data " "corruption, are always raised." msgstr "" -#: ../../library/tarfile.rst:577 +#: ../../library/tarfile.rst:586 msgid "" "Custom :ref:`extraction filters ` should raise :" "exc:`FilterError` for *fatal* errors and :exc:`ExtractError` for *non-fatal* " "ones." msgstr "" -#: ../../library/tarfile.rst:581 +#: ../../library/tarfile.rst:590 msgid "" "Note that when an exception is raised, the archive may be partially " "extracted. It is the user’s responsibility to clean up." msgstr "" -#: ../../library/tarfile.rst:588 +#: ../../library/tarfile.rst:597 msgid "" "The :ref:`extraction filter ` used as a default " "for the *filter* argument of :meth:`~TarFile.extract` and :meth:`~TarFile." "extractall`." msgstr "" -#: ../../library/tarfile.rst:592 +#: ../../library/tarfile.rst:601 msgid "" "The attribute may be ``None`` or a callable. String names are not allowed " "for this attribute, unlike the *filter* argument to :meth:`~TarFile.extract`." msgstr "" -#: ../../library/tarfile.rst:596 +#: ../../library/tarfile.rst:605 msgid "" "If ``extraction_filter`` is ``None`` (the default), calling an extraction " "method without a *filter* argument will raise a ``DeprecationWarning``, and " @@ -867,13 +883,13 @@ msgid "" "dangerous behavior matches previous versions of Python." msgstr "" -#: ../../library/tarfile.rst:602 +#: ../../library/tarfile.rst:611 msgid "" "In Python 3.14+, leaving ``extraction_filter=None`` will cause extraction " "methods to use the :func:`data ` filter by default." msgstr "" -#: ../../library/tarfile.rst:605 +#: ../../library/tarfile.rst:614 msgid "" "The attribute may be set on instances or overridden in subclasses. It also " "is possible to set it on the ``TarFile`` class itself to set a global " @@ -883,7 +899,7 @@ msgid "" "wrapped in :func:`staticmethod` to prevent injection of a ``self`` argument." msgstr "" -#: ../../library/tarfile.rst:615 +#: ../../library/tarfile.rst:624 msgid "" "Add the file *name* to the archive. *name* may be any type of file " "(directory, fifo, symbolic link, etc.). If given, *arcname* specifies an " @@ -896,19 +912,24 @@ msgid "" "ref:`tar-examples` for an example." msgstr "" -#: ../../library/tarfile.rst:629 +#: ../../library/tarfile.rst:638 msgid "Recursion adds entries in sorted order." msgstr "" -#: ../../library/tarfile.rst:635 +#: ../../library/tarfile.rst:644 msgid "" -"Add the :class:`TarInfo` object *tarinfo* to the archive. If *fileobj* is " -"given, it should be a :term:`binary file`, and ``tarinfo.size`` bytes are " -"read from it and added to the archive. You can create :class:`TarInfo` " -"objects directly, or by using :meth:`gettarinfo`." +"Add the :class:`TarInfo` object *tarinfo* to the archive. If *tarinfo* " +"represents a non zero-size regular file, the *fileobj* argument should be a :" +"term:`binary file`, and ``tarinfo.size`` bytes are read from it and added to " +"the archive. You can create :class:`TarInfo` objects directly, or by using :" +"meth:`gettarinfo`." +msgstr "" + +#: ../../library/tarfile.rst:651 +msgid "*fileobj* must be given for non-zero-sized regular files." msgstr "" -#: ../../library/tarfile.rst:643 +#: ../../library/tarfile.rst:656 msgid "" "Create a :class:`TarInfo` object from the result of :func:`os.stat` or " "equivalent on an existing file. The file is either named by *name*, or " @@ -919,7 +940,7 @@ msgid "" "The name should be a text string." msgstr "" -#: ../../library/tarfile.rst:652 +#: ../../library/tarfile.rst:665 msgid "" "You can modify some of the :class:`TarInfo`’s attributes before you add it " "using :meth:`addfile`. If the file object is not an ordinary file object " @@ -929,21 +950,21 @@ msgid "" "case *arcname* could be a dummy string." msgstr "" -#: ../../library/tarfile.rst:666 +#: ../../library/tarfile.rst:679 msgid "" "Close the :class:`TarFile`. In write mode, two finishing zero blocks are " "appended to the archive." msgstr "" -#: ../../library/tarfile.rst:673 +#: ../../library/tarfile.rst:686 msgid "A dictionary containing key-value pairs of pax global headers." msgstr "" -#: ../../library/tarfile.rst:680 +#: ../../library/tarfile.rst:693 msgid "TarInfo Objects" msgstr "TarInfo 物件" -#: ../../library/tarfile.rst:682 +#: ../../library/tarfile.rst:695 msgid "" "A :class:`TarInfo` object represents one member in a :class:`TarFile`. Aside " "from storing all required attributes of a file (like file type, size, time, " @@ -951,14 +972,14 @@ msgid "" "type. It does *not* contain the file's data itself." msgstr "" -#: ../../library/tarfile.rst:687 +#: ../../library/tarfile.rst:700 msgid "" ":class:`TarInfo` objects are returned by :class:`TarFile`'s methods :meth:" "`~TarFile.getmember`, :meth:`~TarFile.getmembers` and :meth:`~TarFile." "gettarinfo`." msgstr "" -#: ../../library/tarfile.rst:691 +#: ../../library/tarfile.rst:704 msgid "" "Modifying the objects returned by :meth:`~TarFile.getmember` or :meth:" "`~TarFile.getmembers` will affect all subsequent operations on the archive. " @@ -967,82 +988,82 @@ msgid "" "step." msgstr "" -#: ../../library/tarfile.rst:697 +#: ../../library/tarfile.rst:710 msgid "" "Several attributes can be set to ``None`` to indicate that a piece of " "metadata is unused or unknown. Different :class:`TarInfo` methods handle " "``None`` differently:" msgstr "" -#: ../../library/tarfile.rst:701 +#: ../../library/tarfile.rst:714 msgid "" "The :meth:`~TarFile.extract` or :meth:`~TarFile.extractall` methods will " "ignore the corresponding metadata, leaving it set to a default." msgstr "" -#: ../../library/tarfile.rst:703 +#: ../../library/tarfile.rst:716 msgid ":meth:`~TarFile.addfile` will fail." msgstr "" -#: ../../library/tarfile.rst:704 +#: ../../library/tarfile.rst:717 msgid ":meth:`~TarFile.list` will print a placeholder string." msgstr "" -#: ../../library/tarfile.rst:708 +#: ../../library/tarfile.rst:721 msgid "Create a :class:`TarInfo` object." msgstr "" -#: ../../library/tarfile.rst:713 +#: ../../library/tarfile.rst:726 msgid "Create and return a :class:`TarInfo` object from string buffer *buf*." msgstr "" -#: ../../library/tarfile.rst:715 +#: ../../library/tarfile.rst:728 msgid "Raises :exc:`HeaderError` if the buffer is invalid." msgstr "" -#: ../../library/tarfile.rst:720 +#: ../../library/tarfile.rst:733 msgid "" "Read the next member from the :class:`TarFile` object *tarfile* and return " "it as a :class:`TarInfo` object." msgstr "" -#: ../../library/tarfile.rst:726 +#: ../../library/tarfile.rst:739 msgid "" "Create a string buffer from a :class:`TarInfo` object. For information on " "the arguments see the constructor of the :class:`TarFile` class." msgstr "" -#: ../../library/tarfile.rst:733 +#: ../../library/tarfile.rst:746 msgid "A ``TarInfo`` object has the following public data attributes:" msgstr "" -#: ../../library/tarfile.rst:739 +#: ../../library/tarfile.rst:752 msgid "Name of the archive member." msgstr "" -#: ../../library/tarfile.rst:745 +#: ../../library/tarfile.rst:758 msgid "Size in bytes." msgstr "" -#: ../../library/tarfile.rst:751 +#: ../../library/tarfile.rst:764 msgid "" "Time of last modification in seconds since the :ref:`epoch `, as in :" "attr:`os.stat_result.st_mtime`." msgstr "" -#: ../../library/tarfile.rst:756 ../../library/tarfile.rst:767 -#: ../../library/tarfile.rst:799 ../../library/tarfile.rst:810 -#: ../../library/tarfile.rst:821 ../../library/tarfile.rst:832 +#: ../../library/tarfile.rst:769 ../../library/tarfile.rst:780 +#: ../../library/tarfile.rst:812 ../../library/tarfile.rst:823 +#: ../../library/tarfile.rst:834 ../../library/tarfile.rst:845 msgid "" "Can be set to ``None`` for :meth:`~TarFile.extract` and :meth:`~TarFile." "extractall`, causing extraction to skip applying this attribute." msgstr "" -#: ../../library/tarfile.rst:763 +#: ../../library/tarfile.rst:776 msgid "Permission bits, as for :func:`os.chmod`." msgstr "" -#: ../../library/tarfile.rst:773 +#: ../../library/tarfile.rst:786 msgid "" "File type. *type* is usually one of these constants: :const:`REGTYPE`, :" "const:`AREGTYPE`, :const:`LNKTYPE`, :const:`SYMTYPE`, :const:`DIRTYPE`, :" @@ -1051,128 +1072,128 @@ msgid "" "more conveniently, use the ``is*()`` methods below." msgstr "" -#: ../../library/tarfile.rst:783 +#: ../../library/tarfile.rst:796 msgid "" "Name of the target file name, which is only present in :class:`TarInfo` " "objects of type :const:`LNKTYPE` and :const:`SYMTYPE`." msgstr "" -#: ../../library/tarfile.rst:786 +#: ../../library/tarfile.rst:799 msgid "" "For symbolic links (``SYMTYPE``), the *linkname* is relative to the " "directory that contains the link. For hard links (``LNKTYPE``), the " "*linkname* is relative to the root of the archive." msgstr "" -#: ../../library/tarfile.rst:795 +#: ../../library/tarfile.rst:808 msgid "User ID of the user who originally stored this member." msgstr "" -#: ../../library/tarfile.rst:806 +#: ../../library/tarfile.rst:819 msgid "Group ID of the user who originally stored this member." msgstr "" -#: ../../library/tarfile.rst:817 +#: ../../library/tarfile.rst:830 msgid "User name." msgstr "" -#: ../../library/tarfile.rst:828 +#: ../../library/tarfile.rst:841 msgid "Group name." msgstr "" -#: ../../library/tarfile.rst:839 +#: ../../library/tarfile.rst:852 msgid "Header checksum." msgstr "" -#: ../../library/tarfile.rst:845 +#: ../../library/tarfile.rst:858 msgid "Device major number." msgstr "" -#: ../../library/tarfile.rst:851 +#: ../../library/tarfile.rst:864 msgid "Device minor number." msgstr "" -#: ../../library/tarfile.rst:857 +#: ../../library/tarfile.rst:870 msgid "The tar header starts here." msgstr "" -#: ../../library/tarfile.rst:863 +#: ../../library/tarfile.rst:876 msgid "The file's data starts here." msgstr "" -#: ../../library/tarfile.rst:868 +#: ../../library/tarfile.rst:881 msgid "Sparse member information." msgstr "" -#: ../../library/tarfile.rst:874 +#: ../../library/tarfile.rst:887 msgid "" "A dictionary containing key-value pairs of an associated pax extended header." msgstr "" -#: ../../library/tarfile.rst:882 +#: ../../library/tarfile.rst:895 msgid "" "Return a *new* copy of the :class:`!TarInfo` object with the given " "attributes changed. For example, to return a ``TarInfo`` with the group name " "set to ``'staff'``, use::" msgstr "" -#: ../../library/tarfile.rst:886 +#: ../../library/tarfile.rst:899 msgid "new_tarinfo = old_tarinfo.replace(gname='staff')" msgstr "new_tarinfo = old_tarinfo.replace(gname='staff')" -#: ../../library/tarfile.rst:888 +#: ../../library/tarfile.rst:901 msgid "" "By default, a deep copy is made. If *deep* is false, the copy is shallow, i." "e. ``pax_headers`` and any custom attributes are shared with the original " "``TarInfo`` object." msgstr "" -#: ../../library/tarfile.rst:892 +#: ../../library/tarfile.rst:905 msgid "A :class:`TarInfo` object also provides some convenient query methods:" msgstr "" -#: ../../library/tarfile.rst:897 +#: ../../library/tarfile.rst:910 msgid "Return :const:`True` if the :class:`TarInfo` object is a regular file." msgstr "" -#: ../../library/tarfile.rst:902 +#: ../../library/tarfile.rst:915 msgid "Same as :meth:`isfile`." msgstr "" -#: ../../library/tarfile.rst:907 +#: ../../library/tarfile.rst:920 msgid "Return :const:`True` if it is a directory." msgstr "" -#: ../../library/tarfile.rst:912 +#: ../../library/tarfile.rst:925 msgid "Return :const:`True` if it is a symbolic link." msgstr "" -#: ../../library/tarfile.rst:917 +#: ../../library/tarfile.rst:930 msgid "Return :const:`True` if it is a hard link." msgstr "" -#: ../../library/tarfile.rst:922 +#: ../../library/tarfile.rst:935 msgid "Return :const:`True` if it is a character device." msgstr "" -#: ../../library/tarfile.rst:927 +#: ../../library/tarfile.rst:940 msgid "Return :const:`True` if it is a block device." msgstr "" -#: ../../library/tarfile.rst:932 +#: ../../library/tarfile.rst:945 msgid "Return :const:`True` if it is a FIFO." msgstr "" -#: ../../library/tarfile.rst:937 +#: ../../library/tarfile.rst:950 msgid "" "Return :const:`True` if it is one of character device, block device or FIFO." msgstr "" -#: ../../library/tarfile.rst:943 +#: ../../library/tarfile.rst:956 msgid "Extraction filters" msgstr "" -#: ../../library/tarfile.rst:947 +#: ../../library/tarfile.rst:960 msgid "" "The *tar* format is designed to capture all details of a UNIX-like " "filesystem, which makes it very powerful. Unfortunately, the features make " @@ -1182,66 +1203,66 @@ msgid "" "components, or symlinks that affect later members)." msgstr "" -#: ../../library/tarfile.rst:955 +#: ../../library/tarfile.rst:968 msgid "" "In most cases, the full functionality is not needed. Therefore, *tarfile* " "supports extraction filters: a mechanism to limit functionality, and thus " "mitigate some of the security issues." msgstr "" -#: ../../library/tarfile.rst:961 +#: ../../library/tarfile.rst:974 msgid ":pep:`706`" msgstr ":pep:`706`" -#: ../../library/tarfile.rst:962 +#: ../../library/tarfile.rst:975 msgid "Contains further motivation and rationale behind the design." msgstr "" -#: ../../library/tarfile.rst:964 +#: ../../library/tarfile.rst:977 msgid "" "The *filter* argument to :meth:`TarFile.extract` or :meth:`~TarFile." "extractall` can be:" msgstr "" -#: ../../library/tarfile.rst:967 +#: ../../library/tarfile.rst:980 msgid "" "the string ``'fully_trusted'``: Honor all metadata as specified in the " "archive. Should be used if the user trusts the archive completely, or " "implements their own complex verification." msgstr "" -#: ../../library/tarfile.rst:972 +#: ../../library/tarfile.rst:985 msgid "" "the string ``'tar'``: Honor most *tar*-specific features (i.e. features of " "UNIX-like filesystems), but block features that are very likely to be " "surprising or malicious. See :func:`tar_filter` for details." msgstr "" -#: ../../library/tarfile.rst:976 +#: ../../library/tarfile.rst:989 msgid "" "the string ``'data'``: Ignore or block most features specific to UNIX-like " "filesystems. Intended for extracting cross-platform data archives. See :func:" "`data_filter` for details." msgstr "" -#: ../../library/tarfile.rst:980 +#: ../../library/tarfile.rst:993 msgid "``None`` (default): Use :attr:`TarFile.extraction_filter`." msgstr "" -#: ../../library/tarfile.rst:982 +#: ../../library/tarfile.rst:995 msgid "" "If that is also ``None`` (the default), raise a ``DeprecationWarning``, and " "fall back to the ``'fully_trusted'`` filter, whose dangerous behavior " "matches previous versions of Python." msgstr "" -#: ../../library/tarfile.rst:986 +#: ../../library/tarfile.rst:999 msgid "" "In Python 3.14, the ``'data'`` filter will become the default instead. It's " "possible to switch earlier; see :attr:`TarFile.extraction_filter`." msgstr "" -#: ../../library/tarfile.rst:989 +#: ../../library/tarfile.rst:1002 msgid "" "A callable which will be called for each extracted member with a :ref:" "`TarInfo ` describing the member and the destination path " @@ -1249,27 +1270,27 @@ msgid "" "members)::" msgstr "" -#: ../../library/tarfile.rst:994 +#: ../../library/tarfile.rst:1007 msgid "filter(member: TarInfo, path: str, /) -> TarInfo | None" msgstr "filter(member: TarInfo, path: str, /) -> TarInfo | None" -#: ../../library/tarfile.rst:996 +#: ../../library/tarfile.rst:1009 msgid "" "The callable is called just before each member is extracted, so it can take " "the current state of the disk into account. It can:" msgstr "" -#: ../../library/tarfile.rst:1000 +#: ../../library/tarfile.rst:1013 msgid "" "return a :class:`TarInfo` object which will be used instead of the metadata " "in the archive, or" msgstr "" -#: ../../library/tarfile.rst:1002 +#: ../../library/tarfile.rst:1015 msgid "return ``None``, in which case the member will be skipped, or" msgstr "" -#: ../../library/tarfile.rst:1003 +#: ../../library/tarfile.rst:1016 msgid "" "raise an exception to abort the operation or skip the member, depending on :" "attr:`~TarFile.errorlevel`. Note that when extraction is aborted, :meth:" @@ -1277,118 +1298,118 @@ msgid "" "attempt to clean up." msgstr "" -#: ../../library/tarfile.rst:1009 +#: ../../library/tarfile.rst:1022 msgid "Default named filters" msgstr "" -#: ../../library/tarfile.rst:1011 +#: ../../library/tarfile.rst:1024 msgid "" "The pre-defined, named filters are available as functions, so they can be " "reused in custom filters:" msgstr "" -#: ../../library/tarfile.rst:1016 +#: ../../library/tarfile.rst:1029 msgid "Return *member* unchanged." msgstr "" -#: ../../library/tarfile.rst:1018 +#: ../../library/tarfile.rst:1031 msgid "This implements the ``'fully_trusted'`` filter." msgstr "" -#: ../../library/tarfile.rst:1022 +#: ../../library/tarfile.rst:1035 msgid "Implements the ``'tar'`` filter." msgstr "" -#: ../../library/tarfile.rst:1024 +#: ../../library/tarfile.rst:1037 msgid "Strip leading slashes (``/`` and :data:`os.sep`) from filenames." msgstr "" -#: ../../library/tarfile.rst:1025 +#: ../../library/tarfile.rst:1038 msgid "" ":ref:`Refuse ` to extract files with absolute " "paths (in case the name is absolute even after stripping slashes, e.g. ``C:/" "foo`` on Windows). This raises :class:`~tarfile.AbsolutePathError`." msgstr "" -#: ../../library/tarfile.rst:1029 +#: ../../library/tarfile.rst:1042 msgid "" ":ref:`Refuse ` to extract files whose absolute " "path (after following symlinks) would end up outside the destination. This " "raises :class:`~tarfile.OutsideDestinationError`." msgstr "" -#: ../../library/tarfile.rst:1032 +#: ../../library/tarfile.rst:1045 msgid "" "Clear high mode bits (setuid, setgid, sticky) and group/other write bits (:" "const:`~stat.S_IWGRP` | :const:`~stat.S_IWOTH`)." msgstr "" -#: ../../library/tarfile.rst:1035 ../../library/tarfile.rst:1068 +#: ../../library/tarfile.rst:1048 ../../library/tarfile.rst:1081 msgid "Return the modified ``TarInfo`` member." msgstr "" -#: ../../library/tarfile.rst:1039 +#: ../../library/tarfile.rst:1052 msgid "" "Implements the ``'data'`` filter. In addition to what ``tar_filter`` does:" msgstr "" -#: ../../library/tarfile.rst:1042 +#: ../../library/tarfile.rst:1055 msgid "" ":ref:`Refuse ` to extract links (hard or soft) " "that link to absolute paths, or ones that link outside the destination." msgstr "" -#: ../../library/tarfile.rst:1045 +#: ../../library/tarfile.rst:1058 msgid "" "This raises :class:`~tarfile.AbsoluteLinkError` or :class:`~tarfile." "LinkOutsideDestinationError`." msgstr "" -#: ../../library/tarfile.rst:1048 +#: ../../library/tarfile.rst:1061 msgid "" "Note that such files are refused even on platforms that do not support " "symbolic links." msgstr "" -#: ../../library/tarfile.rst:1051 +#: ../../library/tarfile.rst:1064 msgid "" ":ref:`Refuse ` to extract device files (including " "pipes). This raises :class:`~tarfile.SpecialFileError`." msgstr "" -#: ../../library/tarfile.rst:1055 +#: ../../library/tarfile.rst:1068 msgid "For regular files, including hard links:" msgstr "" -#: ../../library/tarfile.rst:1057 +#: ../../library/tarfile.rst:1070 msgid "" "Set the owner read and write permissions (:const:`~stat.S_IRUSR` | :const:" "`~stat.S_IWUSR`)." msgstr "" -#: ../../library/tarfile.rst:1059 +#: ../../library/tarfile.rst:1072 msgid "" "Remove the group & other executable permission (:const:`~stat.S_IXGRP` | :" "const:`~stat.S_IXOTH`) if the owner doesn’t have it (:const:`~stat.S_IXUSR`)." msgstr "" -#: ../../library/tarfile.rst:1063 +#: ../../library/tarfile.rst:1076 msgid "" "For other files (directories), set ``mode`` to ``None``, so that extraction " "methods skip applying permission bits." msgstr "" -#: ../../library/tarfile.rst:1065 +#: ../../library/tarfile.rst:1078 msgid "" "Set user and group info (``uid``, ``gid``, ``uname``, ``gname``) to " "``None``, so that extraction methods skip setting it." msgstr "" -#: ../../library/tarfile.rst:1074 +#: ../../library/tarfile.rst:1087 msgid "Filter errors" msgstr "" -#: ../../library/tarfile.rst:1076 +#: ../../library/tarfile.rst:1089 msgid "" "When a filter refuses to extract a file, it will raise an appropriate " "exception, a subclass of :class:`~tarfile.FilterError`. This will abort the " @@ -1397,11 +1418,11 @@ msgid "" "continue." msgstr "" -#: ../../library/tarfile.rst:1084 +#: ../../library/tarfile.rst:1097 msgid "Hints for further verification" msgstr "" -#: ../../library/tarfile.rst:1086 +#: ../../library/tarfile.rst:1099 msgid "" "Even with ``filter='data'``, *tarfile* is not suited for extracting " "untrusted files without prior inspection. Among other issues, the pre-" @@ -1409,69 +1430,69 @@ msgid "" "additional checks." msgstr "" -#: ../../library/tarfile.rst:1091 +#: ../../library/tarfile.rst:1104 msgid "Here is an incomplete list of things to consider:" msgstr "" -#: ../../library/tarfile.rst:1093 +#: ../../library/tarfile.rst:1106 msgid "" "Extract to a :func:`new temporary directory ` to prevent e." "g. exploiting pre-existing links, and to make it easier to clean up after a " "failed extraction." msgstr "" -#: ../../library/tarfile.rst:1096 +#: ../../library/tarfile.rst:1109 msgid "" "When working with untrusted data, use external (e.g. OS-level) limits on " "disk, memory and CPU usage." msgstr "" -#: ../../library/tarfile.rst:1098 +#: ../../library/tarfile.rst:1111 msgid "" "Check filenames against an allow-list of characters (to filter out control " "characters, confusables, foreign path separators, etc.)." msgstr "" -#: ../../library/tarfile.rst:1101 +#: ../../library/tarfile.rst:1114 msgid "" "Check that filenames have expected extensions (discouraging files that " "execute when you “click on them”, or extension-less files like Windows " "special device names)." msgstr "" -#: ../../library/tarfile.rst:1103 +#: ../../library/tarfile.rst:1116 msgid "" "Limit the number of extracted files, total size of extracted data, filename " "length (including symlink length), and size of individual files." msgstr "" -#: ../../library/tarfile.rst:1105 +#: ../../library/tarfile.rst:1118 msgid "Check for files that would be shadowed on case-insensitive filesystems." msgstr "" -#: ../../library/tarfile.rst:1107 +#: ../../library/tarfile.rst:1120 msgid "Also note that:" msgstr "" -#: ../../library/tarfile.rst:1109 +#: ../../library/tarfile.rst:1122 msgid "" "Tar files may contain multiple versions of the same file. Later ones are " "expected to overwrite any earlier ones. This feature is crucial to allow " "updating tape archives, but can be abused maliciously." msgstr "" -#: ../../library/tarfile.rst:1113 +#: ../../library/tarfile.rst:1126 msgid "" "*tarfile* does not protect against issues with “live” data, e.g. an attacker " "tinkering with the destination (or source) directory while extraction (or " "archiving) is in progress." msgstr "" -#: ../../library/tarfile.rst:1119 +#: ../../library/tarfile.rst:1132 msgid "Supporting older Python versions" msgstr "" -#: ../../library/tarfile.rst:1121 +#: ../../library/tarfile.rst:1134 msgid "" "Extraction filters were added to Python 3.12, but may be backported to older " "versions as security updates. To check whether the feature is available, use " @@ -1479,18 +1500,18 @@ msgid "" "version." msgstr "" -#: ../../library/tarfile.rst:1126 +#: ../../library/tarfile.rst:1139 msgid "" "The following examples show how to support Python versions with and without " "the feature. Note that setting ``extraction_filter`` will affect any " "subsequent operations." msgstr "" -#: ../../library/tarfile.rst:1130 +#: ../../library/tarfile.rst:1143 msgid "Fully trusted archive::" msgstr "" -#: ../../library/tarfile.rst:1132 +#: ../../library/tarfile.rst:1145 msgid "" "my_tarfile.extraction_filter = (lambda member, path: member)\n" "my_tarfile.extractall()" @@ -1498,13 +1519,13 @@ msgstr "" "my_tarfile.extraction_filter = (lambda member, path: member)\n" "my_tarfile.extractall()" -#: ../../library/tarfile.rst:1135 +#: ../../library/tarfile.rst:1148 msgid "" "Use the ``'data'`` filter if available, but revert to Python 3.11 behavior " "(``'fully_trusted'``) if this feature is not available::" msgstr "" -#: ../../library/tarfile.rst:1138 +#: ../../library/tarfile.rst:1151 msgid "" "my_tarfile.extraction_filter = getattr(tarfile, 'data_filter',\n" " (lambda member, path: member))\n" @@ -1514,19 +1535,19 @@ msgstr "" " (lambda member, path: member))\n" "my_tarfile.extractall()" -#: ../../library/tarfile.rst:1142 +#: ../../library/tarfile.rst:1155 msgid "Use the ``'data'`` filter; *fail* if it is not available::" msgstr "" -#: ../../library/tarfile.rst:1144 +#: ../../library/tarfile.rst:1157 msgid "my_tarfile.extractall(filter=tarfile.data_filter)" msgstr "my_tarfile.extractall(filter=tarfile.data_filter)" -#: ../../library/tarfile.rst:1146 +#: ../../library/tarfile.rst:1159 msgid "or::" msgstr "或: ::" -#: ../../library/tarfile.rst:1148 +#: ../../library/tarfile.rst:1161 msgid "" "my_tarfile.extraction_filter = tarfile.data_filter\n" "my_tarfile.extractall()" @@ -1534,11 +1555,11 @@ msgstr "" "my_tarfile.extraction_filter = tarfile.data_filter\n" "my_tarfile.extractall()" -#: ../../library/tarfile.rst:1151 +#: ../../library/tarfile.rst:1164 msgid "Use the ``'data'`` filter; *warn* if it is not available::" msgstr "" -#: ../../library/tarfile.rst:1153 +#: ../../library/tarfile.rst:1166 msgid "" "if hasattr(tarfile, 'data_filter'):\n" " my_tarfile.extractall(filter='data')\n" @@ -1548,18 +1569,18 @@ msgid "" " my_tarfile.extractall()" msgstr "" -#: ../../library/tarfile.rst:1162 +#: ../../library/tarfile.rst:1175 msgid "Stateful extraction filter example" msgstr "" -#: ../../library/tarfile.rst:1164 +#: ../../library/tarfile.rst:1177 msgid "" "While *tarfile*'s extraction methods take a simple *filter* callable, custom " "filters may be more complex objects with an internal state. It may be useful " "to write these as context managers, to be used like this::" msgstr "" -#: ../../library/tarfile.rst:1168 +#: ../../library/tarfile.rst:1181 msgid "" "with StatefulFilter() as filter_func:\n" " tar.extractall(path, filter=filter_func)" @@ -1567,11 +1588,11 @@ msgstr "" "with StatefulFilter() as filter_func:\n" " tar.extractall(path, filter=filter_func)" -#: ../../library/tarfile.rst:1171 +#: ../../library/tarfile.rst:1184 msgid "Such a filter can be written as, for example::" msgstr "" -#: ../../library/tarfile.rst:1173 +#: ../../library/tarfile.rst:1186 msgid "" "class StatefulFilter:\n" " def __init__(self):\n" @@ -1588,103 +1609,103 @@ msgid "" " print(f'{self.file_count} files extracted')" msgstr "" -#: ../../library/tarfile.rst:1193 +#: ../../library/tarfile.rst:1206 msgid "Command-Line Interface" msgstr "" -#: ../../library/tarfile.rst:1197 +#: ../../library/tarfile.rst:1210 msgid "" "The :mod:`tarfile` module provides a simple command-line interface to " "interact with tar archives." msgstr "" -#: ../../library/tarfile.rst:1200 +#: ../../library/tarfile.rst:1213 msgid "" "If you want to create a new tar archive, specify its name after the :option:" "`-c` option and then list the filename(s) that should be included:" msgstr "" -#: ../../library/tarfile.rst:1203 +#: ../../library/tarfile.rst:1216 msgid "$ python -m tarfile -c monty.tar spam.txt eggs.txt" msgstr "$ python -m tarfile -c monty.tar spam.txt eggs.txt" -#: ../../library/tarfile.rst:1207 +#: ../../library/tarfile.rst:1220 msgid "Passing a directory is also acceptable:" msgstr "" -#: ../../library/tarfile.rst:1209 +#: ../../library/tarfile.rst:1222 msgid "$ python -m tarfile -c monty.tar life-of-brian_1979/" msgstr "$ python -m tarfile -c monty.tar life-of-brian_1979/" -#: ../../library/tarfile.rst:1213 +#: ../../library/tarfile.rst:1226 msgid "" "If you want to extract a tar archive into the current directory, use the :" "option:`-e` option:" msgstr "" -#: ../../library/tarfile.rst:1216 +#: ../../library/tarfile.rst:1229 msgid "$ python -m tarfile -e monty.tar" msgstr "$ python -m tarfile -e monty.tar" -#: ../../library/tarfile.rst:1220 +#: ../../library/tarfile.rst:1233 msgid "" "You can also extract a tar archive into a different directory by passing the " "directory's name:" msgstr "" -#: ../../library/tarfile.rst:1223 +#: ../../library/tarfile.rst:1236 msgid "$ python -m tarfile -e monty.tar other-dir/" msgstr "$ python -m tarfile -e monty.tar other-dir/" -#: ../../library/tarfile.rst:1227 +#: ../../library/tarfile.rst:1240 msgid "For a list of the files in a tar archive, use the :option:`-l` option:" msgstr "" -#: ../../library/tarfile.rst:1229 +#: ../../library/tarfile.rst:1242 msgid "$ python -m tarfile -l monty.tar" msgstr "$ python -m tarfile -l monty.tar" -#: ../../library/tarfile.rst:1235 +#: ../../library/tarfile.rst:1248 msgid "Command-line options" msgstr "命令列選項" -#: ../../library/tarfile.rst:1240 +#: ../../library/tarfile.rst:1253 msgid "List files in a tarfile." msgstr "" -#: ../../library/tarfile.rst:1245 +#: ../../library/tarfile.rst:1258 msgid "Create tarfile from source files." msgstr "" -#: ../../library/tarfile.rst:1250 +#: ../../library/tarfile.rst:1263 msgid "" "Extract tarfile into the current directory if *output_dir* is not specified." msgstr "" -#: ../../library/tarfile.rst:1255 +#: ../../library/tarfile.rst:1268 msgid "Test whether the tarfile is valid or not." msgstr "" -#: ../../library/tarfile.rst:1259 +#: ../../library/tarfile.rst:1272 msgid "Verbose output." msgstr "" -#: ../../library/tarfile.rst:1263 +#: ../../library/tarfile.rst:1276 msgid "" "Specifies the *filter* for ``--extract``. See :ref:`tarfile-extraction-" "filter` for details. Only string names are accepted (that is, " "``fully_trusted``, ``tar``, and ``data``)." msgstr "" -#: ../../library/tarfile.rst:1271 +#: ../../library/tarfile.rst:1284 msgid "Examples" msgstr "範例" -#: ../../library/tarfile.rst:1273 +#: ../../library/tarfile.rst:1286 msgid "How to extract an entire tar archive to the current working directory::" msgstr "" -#: ../../library/tarfile.rst:1275 +#: ../../library/tarfile.rst:1288 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar.gz\")\n" @@ -1696,13 +1717,13 @@ msgstr "" "tar.extractall(filter='data')\n" "tar.close()" -#: ../../library/tarfile.rst:1280 +#: ../../library/tarfile.rst:1293 msgid "" "How to extract a subset of a tar archive with :meth:`TarFile.extractall` " "using a generator function instead of a list::" msgstr "" -#: ../../library/tarfile.rst:1283 +#: ../../library/tarfile.rst:1296 msgid "" "import os\n" "import tarfile\n" @@ -1728,11 +1749,11 @@ msgstr "" "tar.extractall(members=py_files(tar))\n" "tar.close()" -#: ../../library/tarfile.rst:1295 +#: ../../library/tarfile.rst:1308 msgid "How to create an uncompressed tar archive from a list of filenames::" msgstr "" -#: ../../library/tarfile.rst:1297 +#: ../../library/tarfile.rst:1310 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar\", \"w\")\n" @@ -1746,11 +1767,11 @@ msgstr "" " tar.add(name)\n" "tar.close()" -#: ../../library/tarfile.rst:1303 +#: ../../library/tarfile.rst:1316 msgid "The same example using the :keyword:`with` statement::" msgstr "" -#: ../../library/tarfile.rst:1305 +#: ../../library/tarfile.rst:1318 msgid "" "import tarfile\n" "with tarfile.open(\"sample.tar\", \"w\") as tar:\n" @@ -1762,13 +1783,13 @@ msgstr "" " for name in [\"foo\", \"bar\", \"quux\"]:\n" " tar.add(name)" -#: ../../library/tarfile.rst:1310 +#: ../../library/tarfile.rst:1323 msgid "" "How to read a gzip compressed tar archive and display some member " "information::" msgstr "" -#: ../../library/tarfile.rst:1312 +#: ../../library/tarfile.rst:1325 msgid "" "import tarfile\n" "tar = tarfile.open(\"sample.tar.gz\", \"r:gz\")\n" @@ -1784,13 +1805,13 @@ msgid "" "tar.close()" msgstr "" -#: ../../library/tarfile.rst:1324 +#: ../../library/tarfile.rst:1337 msgid "" "How to create an archive and reset the user information using the *filter* " "parameter in :meth:`TarFile.add`::" msgstr "" -#: ../../library/tarfile.rst:1327 +#: ../../library/tarfile.rst:1340 msgid "" "import tarfile\n" "def reset(tarinfo):\n" @@ -1810,17 +1831,17 @@ msgstr "" "tar.add(\"foo\", filter=reset)\n" "tar.close()" -#: ../../library/tarfile.rst:1340 +#: ../../library/tarfile.rst:1353 msgid "Supported tar formats" msgstr "" -#: ../../library/tarfile.rst:1342 +#: ../../library/tarfile.rst:1355 msgid "" "There are three tar formats that can be created with the :mod:`tarfile` " "module:" msgstr "" -#: ../../library/tarfile.rst:1344 +#: ../../library/tarfile.rst:1357 msgid "" "The POSIX.1-1988 ustar format (:const:`USTAR_FORMAT`). It supports filenames " "up to a length of at best 256 characters and linknames up to 100 characters. " @@ -1828,7 +1849,7 @@ msgid "" "supported format." msgstr "" -#: ../../library/tarfile.rst:1349 +#: ../../library/tarfile.rst:1362 msgid "" "The GNU tar format (:const:`GNU_FORMAT`). It supports long filenames and " "linknames, files bigger than 8 GiB and sparse files. It is the de facto " @@ -1836,7 +1857,7 @@ msgid "" "extensions for long names, sparse file support is read-only." msgstr "" -#: ../../library/tarfile.rst:1354 +#: ../../library/tarfile.rst:1367 msgid "" "The POSIX.1-2001 pax format (:const:`PAX_FORMAT`). It is the most flexible " "format with virtually no limits. It supports long filenames and linknames, " @@ -1847,7 +1868,7 @@ msgid "" "*ustar* format. It is the current default format for new archives." msgstr "" -#: ../../library/tarfile.rst:1362 +#: ../../library/tarfile.rst:1375 msgid "" "It extends the existing *ustar* format with extra headers for information " "that cannot be stored otherwise. There are two flavours of pax headers: " @@ -1856,13 +1877,13 @@ msgid "" "in a pax header is encoded in *UTF-8* for portability reasons." msgstr "" -#: ../../library/tarfile.rst:1368 +#: ../../library/tarfile.rst:1381 msgid "" "There are some more variants of the tar format which can be read, but not " "created:" msgstr "" -#: ../../library/tarfile.rst:1371 +#: ../../library/tarfile.rst:1384 msgid "" "The ancient V7 format. This is the first tar format from Unix Seventh " "Edition, storing only regular files and directories. Names must not be " @@ -1871,17 +1892,17 @@ msgid "" "ASCII characters." msgstr "" -#: ../../library/tarfile.rst:1376 +#: ../../library/tarfile.rst:1389 msgid "" "The SunOS tar extended format. This format is a variant of the POSIX.1-2001 " "pax format, but is not compatible." msgstr "" -#: ../../library/tarfile.rst:1382 +#: ../../library/tarfile.rst:1395 msgid "Unicode issues" msgstr "" -#: ../../library/tarfile.rst:1384 +#: ../../library/tarfile.rst:1397 msgid "" "The tar format was originally conceived to make backups on tape drives with " "the main focus on preserving file system information. Nowadays tar archives " @@ -1896,13 +1917,13 @@ msgid "" "It stores non-ASCII metadata using the universal character encoding *UTF-8*." msgstr "" -#: ../../library/tarfile.rst:1396 +#: ../../library/tarfile.rst:1409 msgid "" "The details of character conversion in :mod:`tarfile` are controlled by the " "*encoding* and *errors* keyword arguments of the :class:`TarFile` class." msgstr "" -#: ../../library/tarfile.rst:1399 +#: ../../library/tarfile.rst:1412 msgid "" "*encoding* defines the character encoding to use for the metadata in the " "archive. The default value is :func:`sys.getfilesystemencoding` or " @@ -1911,7 +1932,7 @@ msgid "" "not set appropriately, this conversion may fail." msgstr "" -#: ../../library/tarfile.rst:1405 +#: ../../library/tarfile.rst:1418 msgid "" "The *errors* argument defines how characters are treated that cannot be " "converted. Possible values are listed in section :ref:`error-handlers`. The " @@ -1919,7 +1940,7 @@ msgid "" "system calls, see :ref:`os-filenames`." msgstr "" -#: ../../library/tarfile.rst:1410 +#: ../../library/tarfile.rst:1423 msgid "" "For :const:`PAX_FORMAT` archives (the default), *encoding* is generally not " "needed because all the metadata is stored using *UTF-8*. *encoding* is only " diff --git a/library/telnetlib.po b/library/telnetlib.po deleted file mode 100644 index c5ee1769d3..0000000000 --- a/library/telnetlib.po +++ /dev/null @@ -1,369 +0,0 @@ -# Copyright (C) 2001-2024, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-05-22 02:15+0800\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/telnetlib.rst:2 -msgid ":mod:`telnetlib` --- Telnet client" -msgstr ":mod:`telnetlib` --- Telnet 客戶端" - -#: ../../library/telnetlib.rst:10 -msgid "**Source code:** :source:`Lib/telnetlib.py`" -msgstr "**原始碼:**\\ :source:`Lib/telnetlib.py`" - -#: ../../library/telnetlib.rst:14 -msgid "" -"The :mod:`telnetlib` module is deprecated (see :pep:`PEP 594 " -"<594#telnetlib>` for details and alternatives)." -msgstr "" -":mod:`telnetlib` 模組 (module) 即將被棄用(詳情與替代方案請見 :pep:`PEP 594 " -"<594#telnetlib>`\\ )。" - -#: ../../library/telnetlib.rst:20 -msgid "" -"The :mod:`telnetlib` module provides a :class:`Telnet` class that implements " -"the Telnet protocol. See :rfc:`854` for details about the protocol. In " -"addition, it provides symbolic constants for the protocol characters (see " -"below), and for the telnet options. The symbolic names of the telnet options " -"follow the definitions in ``arpa/telnet.h``, with the leading ``TELOPT_`` " -"removed. For symbolic names of options which are traditionally not included " -"in ``arpa/telnet.h``, see the module source itself." -msgstr "" - -#: ../../library/telnetlib.rst:28 -msgid "" -"The symbolic constants for the telnet commands are: IAC, DONT, DO, WONT, " -"WILL, SE (Subnegotiation End), NOP (No Operation), DM (Data Mark), BRK " -"(Break), IP (Interrupt process), AO (Abort output), AYT (Are You There), EC " -"(Erase Character), EL (Erase Line), GA (Go Ahead), SB (Subnegotiation Begin)." -msgstr "" - -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" - -#: ../../includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" - -#: ../../library/telnetlib.rst:37 -msgid "" -":class:`Telnet` represents a connection to a Telnet server. The instance is " -"initially not connected by default; the :meth:`~Telnet.open` method must be " -"used to establish a connection. Alternatively, the host name and optional " -"port number can be passed to the constructor too, in which case the " -"connection to the server will be established before the constructor " -"returns. The optional *timeout* parameter specifies a timeout in seconds " -"for blocking operations like the connection attempt (if not specified, the " -"global default timeout setting will be used)." -msgstr "" - -#: ../../library/telnetlib.rst:46 -msgid "Do not reopen an already connected instance." -msgstr "" - -#: ../../library/telnetlib.rst:48 -msgid "" -"This class has many :meth:`read_\\*` methods. Note that some of them " -"raise :exc:`EOFError` when the end of the connection is read, because they " -"can return an empty string for other reasons. See the individual " -"descriptions below." -msgstr "" - -#: ../../library/telnetlib.rst:52 -msgid "" -"A :class:`Telnet` object is a context manager and can be used in a :keyword:" -"`with` statement. When the :keyword:`!with` block ends, the :meth:`close` " -"method is called::" -msgstr "" - -#: ../../library/telnetlib.rst:56 -msgid "" -">>> from telnetlib import Telnet\n" -">>> with Telnet('localhost', 23) as tn:\n" -"... tn.interact()\n" -"..." -msgstr "" -">>> from telnetlib import Telnet\n" -">>> with Telnet('localhost', 23) as tn:\n" -"... tn.interact()\n" -"..." - -#: ../../library/telnetlib.rst:61 -msgid "Context manager support added" -msgstr "" - -#: ../../library/telnetlib.rst:66 -msgid ":rfc:`854` - Telnet Protocol Specification" -msgstr "" - -#: ../../library/telnetlib.rst:67 -msgid "Definition of the Telnet protocol." -msgstr "" - -#: ../../library/telnetlib.rst:73 -msgid "Telnet Objects" -msgstr "" - -#: ../../library/telnetlib.rst:75 -msgid ":class:`Telnet` instances have the following methods:" -msgstr "" - -#: ../../library/telnetlib.rst:80 -msgid "" -"Read until a given byte string, *expected*, is encountered or until " -"*timeout* seconds have passed." -msgstr "" - -#: ../../library/telnetlib.rst:83 -msgid "" -"When no match is found, return whatever is available instead, possibly empty " -"bytes. Raise :exc:`EOFError` if the connection is closed and no cooked data " -"is available." -msgstr "" - -#: ../../library/telnetlib.rst:90 -msgid "Read all data until EOF as bytes; block until connection closed." -msgstr "" - -#: ../../library/telnetlib.rst:95 -msgid "" -"Read at least one byte of cooked data unless EOF is hit. Return ``b''`` if " -"EOF is hit. Block if no data is immediately available." -msgstr "" - -#: ../../library/telnetlib.rst:101 -msgid "Read everything that can be without blocking in I/O (eager)." -msgstr "" - -#: ../../library/telnetlib.rst:103 ../../library/telnetlib.rst:112 -msgid "" -"Raise :exc:`EOFError` if connection closed and no cooked data available. " -"Return ``b''`` if no cooked data available otherwise. Do not block unless in " -"the midst of an IAC sequence." -msgstr "" - -#: ../../library/telnetlib.rst:110 -msgid "Read readily available data." -msgstr "" - -#: ../../library/telnetlib.rst:119 -msgid "Process and return data already in the queues (lazy)." -msgstr "" - -#: ../../library/telnetlib.rst:121 -msgid "" -"Raise :exc:`EOFError` if connection closed and no data available. Return " -"``b''`` if no cooked data available otherwise. Do not block unless in the " -"midst of an IAC sequence." -msgstr "" - -#: ../../library/telnetlib.rst:128 -msgid "Return any data available in the cooked queue (very lazy)." -msgstr "" - -#: ../../library/telnetlib.rst:130 -msgid "" -"Raise :exc:`EOFError` if connection closed and no data available. Return " -"``b''`` if no cooked data available otherwise. This method never blocks." -msgstr "" - -#: ../../library/telnetlib.rst:136 -msgid "" -"Return the data collected between a SB/SE pair (suboption begin/end). The " -"callback should access these data when it was invoked with a ``SE`` command. " -"This method never blocks." -msgstr "" - -#: ../../library/telnetlib.rst:143 -msgid "" -"Connect to a host. The optional second argument is the port number, which " -"defaults to the standard Telnet port (23). The optional *timeout* parameter " -"specifies a timeout in seconds for blocking operations like the connection " -"attempt (if not specified, the global default timeout setting will be used)." -msgstr "" - -#: ../../library/telnetlib.rst:148 -msgid "Do not try to reopen an already connected instance." -msgstr "" - -#: ../../library/telnetlib.rst:150 -msgid "" -"Raises an :ref:`auditing event ` ``telnetlib.Telnet.open`` with " -"arguments ``self``, ``host``, ``port``." -msgstr "" -"引發一個附帶引數 ``self``、``host``、``port`` 的\\ :ref:`稽核事件 " -"` ``telnetlib.Telnet.open``。" - -#: ../../library/telnetlib.rst:155 -msgid "" -"Print a debug message when the debug level is ``>`` 0. If extra arguments " -"are present, they are substituted in the message using the standard string " -"formatting operator." -msgstr "" - -#: ../../library/telnetlib.rst:162 -msgid "" -"Set the debug level. The higher the value of *debuglevel*, the more debug " -"output you get (on ``sys.stdout``)." -msgstr "" - -#: ../../library/telnetlib.rst:168 -msgid "Close the connection." -msgstr "" - -#: ../../library/telnetlib.rst:173 -msgid "Return the socket object used internally." -msgstr "" - -#: ../../library/telnetlib.rst:178 -msgid "Return the file descriptor of the socket object used internally." -msgstr "" - -#: ../../library/telnetlib.rst:183 -msgid "" -"Write a byte string to the socket, doubling any IAC characters. This can " -"block if the connection is blocked. May raise :exc:`OSError` if the " -"connection is closed." -msgstr "" - -#: ../../library/telnetlib.rst:187 -msgid "" -"Raises an :ref:`auditing event ` ``telnetlib.Telnet.write`` with " -"arguments ``self``, ``buffer``." -msgstr "" -"引發一個附帶引數 ``self``、``buffer`` 的\\ :ref:`稽核事件 ` " -"``telnetlib.Telnet.write``。" - -#: ../../library/telnetlib.rst:189 -msgid "" -"This method used to raise :exc:`socket.error`, which is now an alias of :exc:" -"`OSError`." -msgstr "" - -#: ../../library/telnetlib.rst:196 -msgid "Interaction function, emulates a very dumb Telnet client." -msgstr "" - -#: ../../library/telnetlib.rst:201 -msgid "Multithreaded version of :meth:`interact`." -msgstr "" - -#: ../../library/telnetlib.rst:206 -msgid "Read until one from a list of a regular expressions matches." -msgstr "" - -#: ../../library/telnetlib.rst:208 -msgid "" -"The first argument is a list of regular expressions, either compiled (:ref:" -"`regex objects `) or uncompiled (byte strings). The optional " -"second argument is a timeout, in seconds; the default is to block " -"indefinitely." -msgstr "" - -#: ../../library/telnetlib.rst:213 -msgid "" -"Return a tuple of three items: the index in the list of the first regular " -"expression that matches; the match object returned; and the bytes read up " -"till and including the match." -msgstr "" - -#: ../../library/telnetlib.rst:217 -msgid "" -"If end of file is found and no bytes were read, raise :exc:`EOFError`. " -"Otherwise, when nothing matches, return ``(-1, None, data)`` where *data* is " -"the bytes received so far (may be empty bytes if a timeout happened)." -msgstr "" - -#: ../../library/telnetlib.rst:221 -msgid "" -"If a regular expression ends with a greedy match (such as ``.*``) or if more " -"than one expression can match the same input, the results are non-" -"deterministic, and may depend on the I/O timing." -msgstr "" - -#: ../../library/telnetlib.rst:228 -msgid "" -"Each time a telnet option is read on the input flow, this *callback* (if " -"set) is called with the following parameters: callback(telnet socket, " -"command (DO/DONT/WILL/WONT), option). No other action is done afterwards by " -"telnetlib." -msgstr "" - -#: ../../library/telnetlib.rst:236 -msgid "Telnet Example" -msgstr "Telnet 範例" - -#: ../../library/telnetlib.rst:241 -msgid "A simple example illustrating typical use::" -msgstr "" - -#: ../../library/telnetlib.rst:243 -msgid "" -"import getpass\n" -"import telnetlib\n" -"\n" -"HOST = \"localhost\"\n" -"user = input(\"Enter your remote account: \")\n" -"password = getpass.getpass()\n" -"\n" -"tn = telnetlib.Telnet(HOST)\n" -"\n" -"tn.read_until(b\"login: \")\n" -"tn.write(user.encode('ascii') + b\"\\n\")\n" -"if password:\n" -" tn.read_until(b\"Password: \")\n" -" tn.write(password.encode('ascii') + b\"\\n\")\n" -"\n" -"tn.write(b\"ls\\n\")\n" -"tn.write(b\"exit\\n\")\n" -"\n" -"print(tn.read_all().decode('ascii'))" -msgstr "" -"import getpass\n" -"import telnetlib\n" -"\n" -"HOST = \"localhost\"\n" -"user = input(\"Enter your remote account: \")\n" -"password = getpass.getpass()\n" -"\n" -"tn = telnetlib.Telnet(HOST)\n" -"\n" -"tn.read_until(b\"login: \")\n" -"tn.write(user.encode('ascii') + b\"\\n\")\n" -"if password:\n" -" tn.read_until(b\"Password: \")\n" -" tn.write(password.encode('ascii') + b\"\\n\")\n" -"\n" -"tn.write(b\"ls\\n\")\n" -"tn.write(b\"exit\\n\")\n" -"\n" -"print(tn.read_all().decode('ascii'))" - -#: ../../library/telnetlib.rst:12 -msgid "protocol" -msgstr "protocol(協定)" - -#: ../../library/telnetlib.rst:12 -msgid "Telnet" -msgstr "Telnet" diff --git a/library/tempfile.po b/library/tempfile.po index 4a3088d1d0..1263ef9a43 100644 --- a/library/tempfile.po +++ b/library/tempfile.po @@ -6,7 +6,7 @@ # Matt Wang , 2021-2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-06-12 15:17+0800\n" diff --git a/library/termios.po b/library/termios.po index b0123afdc3..d801678336 100644 --- a/library/termios.po +++ b/library/termios.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" diff --git a/library/test.po b/library/test.po index 79851fd564..e0fe8b9e31 100644 --- a/library/test.po +++ b/library/test.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -784,7 +784,7 @@ msgid "Context manager to swap out an attribute with a new object." msgstr "" #: ../../library/test.rst:607 ../../library/test.rst:625 -#: ../../library/test.rst:860 ../../library/test.rst:1326 +#: ../../library/test.rst:866 ../../library/test.rst:1332 msgid "Usage::" msgstr "用法: ::" @@ -927,54 +927,60 @@ msgid "" msgstr "" #: ../../library/test.rst:736 +msgid "" +"Decorator for skipping tests on the free-threaded build. If the :term:`GIL` " +"is disabled, the test is skipped." +msgstr "" + +#: ../../library/test.rst:742 msgid "Decorator for skipping tests on non-IEEE 754 platforms." msgstr "" -#: ../../library/test.rst:741 +#: ../../library/test.rst:747 msgid "Decorator for skipping tests if :mod:`zlib` doesn't exist." msgstr "如果 :mod:`zlib` 不存在則跳過測試的裝飾器。" -#: ../../library/test.rst:746 +#: ../../library/test.rst:752 msgid "Decorator for skipping tests if :mod:`gzip` doesn't exist." msgstr "如果 :mod:`gzip` 不存在則跳過測試的裝飾器。" -#: ../../library/test.rst:751 +#: ../../library/test.rst:757 msgid "Decorator for skipping tests if :mod:`bz2` doesn't exist." msgstr "如果 :mod:`bz2` 不存在則跳過測試的裝飾器。" -#: ../../library/test.rst:756 +#: ../../library/test.rst:762 msgid "Decorator for skipping tests if :mod:`lzma` doesn't exist." msgstr "如果 :mod:`lzma` 不存在則跳過測試的裝飾器。" -#: ../../library/test.rst:761 +#: ../../library/test.rst:767 msgid "Decorator for skipping tests if *resource* is not available." msgstr "如果 *resource* 不可用則跳過測試的裝飾器。" -#: ../../library/test.rst:766 +#: ../../library/test.rst:772 msgid "Decorator for only running the test if :data:`HAVE_DOCSTRINGS`." msgstr "" -#: ../../library/test.rst:771 +#: ../../library/test.rst:777 msgid "" "Decorator for only running the test if :ref:`Limited C API ` " "is available." msgstr "" -#: ../../library/test.rst:777 +#: ../../library/test.rst:783 msgid "Decorator for tests only applicable to CPython." msgstr "" -#: ../../library/test.rst:782 +#: ../../library/test.rst:788 msgid "" "Decorator for invoking :func:`check_impl_detail` on *guards*. If that " "returns ``False``, then uses *msg* as the reason for skipping the test." msgstr "" -#: ../../library/test.rst:788 +#: ../../library/test.rst:794 msgid "Decorator to temporarily turn off tracing for the duration of the test." msgstr "" -#: ../../library/test.rst:793 +#: ../../library/test.rst:799 msgid "" "Decorator for tests which involve reference counting. The decorator does " "not run the test if it is not run by CPython. Any trace function is unset " @@ -982,11 +988,11 @@ msgid "" "trace function." msgstr "" -#: ../../library/test.rst:801 +#: ../../library/test.rst:807 msgid "Decorator for bigmem tests." msgstr "大記憶體測試的裝飾器。" -#: ../../library/test.rst:803 +#: ../../library/test.rst:809 msgid "" "*size* is a requested size for the test (in arbitrary, test-interpreted " "units.) *memuse* is the number of bytes per unit for the test, or a good " @@ -994,7 +1000,7 @@ msgid "" "each, could be decorated with ``@bigmemtest(size=_4G, memuse=2)``." msgstr "" -#: ../../library/test.rst:808 +#: ../../library/test.rst:814 msgid "" "The *size* argument is normally passed to the decorated test method as an " "extra argument. If *dry_run* is ``True``, the value passed to the test " @@ -1002,11 +1008,11 @@ msgid "" "means the test doesn't support dummy runs when ``-M`` is not specified." msgstr "" -#: ../../library/test.rst:816 +#: ../../library/test.rst:822 msgid "Decorator for tests that fill the address space." msgstr "" -#: ../../library/test.rst:821 +#: ../../library/test.rst:827 msgid "" "Test for syntax errors in *statement* by attempting to compile *statement*. " "*testcase* is the :mod:`unittest` instance for the test. *errtext* is the " @@ -1016,44 +1022,44 @@ msgid "" "of the exception." msgstr "" -#: ../../library/test.rst:831 +#: ../../library/test.rst:837 msgid "Open *url*. If open fails, raises :exc:`TestFailed`." msgstr "" -#: ../../library/test.rst:836 +#: ../../library/test.rst:842 msgid "" "Use this at the end of ``test_main`` whenever sub-processes are started. " "This will help ensure that no extra children (zombies) stick around to hog " "resources and create problems when looking for refleaks." msgstr "" -#: ../../library/test.rst:843 +#: ../../library/test.rst:849 msgid "" "Get an attribute, raising :exc:`unittest.SkipTest` if :exc:`AttributeError` " "is raised." msgstr "" -#: ../../library/test.rst:849 +#: ../../library/test.rst:855 msgid "" "Context manager catching unraisable exception using :func:`sys." "unraisablehook`." msgstr "" -#: ../../library/test.rst:852 +#: ../../library/test.rst:858 msgid "" "Storing the exception value (``cm.unraisable.exc_value``) creates a " "reference cycle. The reference cycle is broken explicitly when the context " "manager exits." msgstr "" -#: ../../library/test.rst:856 +#: ../../library/test.rst:862 msgid "" "Storing the object (``cm.unraisable.object``) can resurrect it if it is set " "to an object which is being finalized. Exiting the context manager clears " "the stored object." msgstr "" -#: ../../library/test.rst:862 +#: ../../library/test.rst:868 msgid "" "with support.catch_unraisable_exception() as cm:\n" " # code creating an \"unraisable exception\"\n" @@ -1066,7 +1072,7 @@ msgid "" "# (to break a reference cycle)" msgstr "" -#: ../../library/test.rst:877 +#: ../../library/test.rst:883 msgid "" "Generic implementation of the :mod:`unittest` ``load_tests`` protocol for " "use in test packages. *pkg_dir* is the root directory of the package; " @@ -1075,7 +1081,7 @@ msgid "" "the following::" msgstr "" -#: ../../library/test.rst:883 +#: ../../library/test.rst:889 msgid "" "import os\n" "from test.support import load_package_tests\n" @@ -1089,14 +1095,14 @@ msgstr "" "def load_tests(*args):\n" " return load_package_tests(os.path.dirname(__file__), *args)" -#: ../../library/test.rst:892 +#: ../../library/test.rst:898 msgid "" "Returns the set of attributes, functions or methods of *ref_api* not found " "on *other_api*, except for a defined list of items to be ignored in this " "check specified in *ignore*." msgstr "" -#: ../../library/test.rst:896 +#: ../../library/test.rst:902 msgid "" "By default this skips private attributes beginning with '_' but includes all " "magic methods, i.e. those starting and ending in '__'." @@ -1104,42 +1110,42 @@ msgstr "" "這預設會跳過以 '_' 開頭的私有屬性,但會包含所有魔術方法,即以 '__' 開頭和結尾" "的方法。" -#: ../../library/test.rst:904 +#: ../../library/test.rst:910 msgid "" "Override *object_to_patch.attr_name* with *new_value*. Also add cleanup " "procedure to *test_instance* to restore *object_to_patch* for *attr_name*. " "The *attr_name* should be a valid attribute for *object_to_patch*." msgstr "" -#: ../../library/test.rst:912 +#: ../../library/test.rst:918 msgid "" "Run *code* in subinterpreter. Raise :exc:`unittest.SkipTest` if :mod:" "`tracemalloc` is enabled." msgstr "" -#: ../../library/test.rst:918 +#: ../../library/test.rst:924 msgid "Assert instances of *cls* are deallocated after iterating." msgstr "" -#: ../../library/test.rst:923 +#: ../../library/test.rst:929 msgid "" "Check for the existence of the compiler executables whose names are listed " "in *cmd_names* or all the compiler executables when *cmd_names* is empty and " "return the first missing executable or ``None`` when none is found missing." msgstr "" -#: ../../library/test.rst:931 +#: ../../library/test.rst:937 msgid "" "Assert that the ``__all__`` variable of *module* contains all public names." msgstr "" -#: ../../library/test.rst:933 +#: ../../library/test.rst:939 msgid "" "The module's public names (its API) are detected automatically based on " "whether they match the public name convention and were defined in *module*." msgstr "" -#: ../../library/test.rst:937 +#: ../../library/test.rst:943 msgid "" "The *name_of_module* argument can specify (as a string or tuple thereof) " "what module(s) an API could be defined in order to be detected as a public " @@ -1147,25 +1153,25 @@ msgid "" "other modules, possibly a C backend (like ``csv`` and its ``_csv``)." msgstr "" -#: ../../library/test.rst:942 +#: ../../library/test.rst:948 msgid "" "The *extra* argument can be a set of names that wouldn't otherwise be " -"automatically detected as \"public\", like objects without a proper " -"``__module__`` attribute. If provided, it will be added to the automatically " -"detected ones." +"automatically detected as \"public\", like objects without a proper :attr:" +"`~definition.__module__` attribute. If provided, it will be added to the " +"automatically detected ones." msgstr "" -#: ../../library/test.rst:946 +#: ../../library/test.rst:952 msgid "" "The *not_exported* argument can be a set of names that must not be treated " "as part of the public API even though their names indicate otherwise." msgstr "" -#: ../../library/test.rst:949 ../../library/test.rst:1576 +#: ../../library/test.rst:955 ../../library/test.rst:1582 msgid "Example use::" msgstr "用法範例: ::" -#: ../../library/test.rst:951 +#: ../../library/test.rst:957 msgid "" "import bar\n" "import foo\n" @@ -1185,18 +1191,18 @@ msgid "" " extra=extra, not_exported=not_exported)" msgstr "" -#: ../../library/test.rst:972 +#: ../../library/test.rst:978 msgid "" "Skip tests if the :mod:`multiprocessing.synchronize` module is missing, if " "there is no available semaphore implementation, or if creating a lock raises " "an :exc:`OSError`." msgstr "" -#: ../../library/test.rst:981 +#: ../../library/test.rst:987 msgid "Assert that type *tp* cannot be instantiated using *args* and *kwds*." msgstr "" -#: ../../library/test.rst:988 +#: ../../library/test.rst:994 msgid "" "This function returns a context manager that will change the global :func:" "`sys.set_int_max_str_digits` setting for the duration of the context to " @@ -1204,73 +1210,73 @@ msgid "" "digits when converting between an integer and string." msgstr "" -#: ../../library/test.rst:996 +#: ../../library/test.rst:1002 msgid "The :mod:`test.support` module defines the following classes:" msgstr ":mod:`test.support` 模組定義了以下類別:" -#: ../../library/test.rst:1001 +#: ../../library/test.rst:1007 msgid "" "A context manager used to try to prevent crash dialog popups on tests that " "are expected to crash a subprocess." msgstr "" -#: ../../library/test.rst:1004 +#: ../../library/test.rst:1010 msgid "" "On Windows, it disables Windows Error Reporting dialogs using `SetErrorMode " "`_." msgstr "" -#: ../../library/test.rst:1007 +#: ../../library/test.rst:1013 msgid "" "On UNIX, :func:`resource.setrlimit` is used to set :const:`resource." "RLIMIT_CORE`'s soft limit to 0 to prevent coredump file creation." msgstr "" -#: ../../library/test.rst:1011 +#: ../../library/test.rst:1017 msgid "" "On both platforms, the old value is restored by :meth:`~object.__exit__`." msgstr "在兩個平台上,舊值會被 :meth:`~object.__exit__` 還原。" -#: ../../library/test.rst:1016 +#: ../../library/test.rst:1022 msgid "" "Class to save and restore signal handlers registered by the Python signal " "handler." msgstr "" -#: ../../library/test.rst:1021 +#: ../../library/test.rst:1027 msgid "" "Save the signal handlers to a dictionary mapping signal numbers to the " "current signal handler." msgstr "" -#: ../../library/test.rst:1026 +#: ../../library/test.rst:1032 msgid "" "Set the signal numbers from the :meth:`save` dictionary to the saved handler." msgstr "" -#: ../../library/test.rst:1034 +#: ../../library/test.rst:1040 msgid "Try to match a single dict with the supplied arguments." msgstr "" -#: ../../library/test.rst:1039 +#: ../../library/test.rst:1045 msgid "Try to match a single stored value (*dv*) with a supplied value (*v*)." msgstr "" -#: ../../library/test.rst:1043 +#: ../../library/test.rst:1049 msgid ":mod:`test.support.socket_helper` --- Utilities for socket tests" msgstr ":mod:`test.support.socket_helper` --- 用於 socket 測試的工具" -#: ../../library/test.rst:1049 +#: ../../library/test.rst:1055 msgid "" "The :mod:`test.support.socket_helper` module provides support for socket " "tests." msgstr "" -#: ../../library/test.rst:1056 +#: ../../library/test.rst:1062 msgid "Set to ``True`` if IPv6 is enabled on this host, ``False`` otherwise." msgstr "" -#: ../../library/test.rst:1061 +#: ../../library/test.rst:1067 msgid "" "Returns an unused port that should be suitable for binding. This is " "achieved by creating a temporary socket with the same family and type as the " @@ -1281,7 +1287,7 @@ msgid "" "port is returned." msgstr "" -#: ../../library/test.rst:1070 +#: ../../library/test.rst:1076 msgid "" "Either this method or :func:`bind_port` should be used for any tests where a " "server socket needs to be bound to a particular port for the duration of the " @@ -1294,7 +1300,7 @@ msgid "" "simultaneously, which is a problem for buildbots." msgstr "" -#: ../../library/test.rst:1084 +#: ../../library/test.rst:1090 msgid "" "Bind the socket to a free port and return the port number. Relies on " "ephemeral ports in order to ensure we are using an unbound port. This is " @@ -1307,7 +1313,7 @@ msgid "" "testing multicasting via multiple UDP sockets." msgstr "" -#: ../../library/test.rst:1095 +#: ../../library/test.rst:1101 msgid "" "Additionally, if the :const:`~socket.SO_EXCLUSIVEADDRUSE` socket option is " "available (i.e. on Windows), it will be set on the socket. This will " @@ -1315,59 +1321,59 @@ msgid "" "test." msgstr "" -#: ../../library/test.rst:1103 +#: ../../library/test.rst:1109 msgid "" "Bind a Unix socket, raising :exc:`unittest.SkipTest` if :exc:" "`PermissionError` is raised." msgstr "" -#: ../../library/test.rst:1109 +#: ../../library/test.rst:1115 msgid "" "A decorator for running tests that require a functional ``bind()`` for Unix " "sockets." msgstr "" -#: ../../library/test.rst:1115 +#: ../../library/test.rst:1121 msgid "" "A context manager that raises :exc:`~test.support.ResourceDenied` when " "various issues with the internet connection manifest themselves as " "exceptions." msgstr "" -#: ../../library/test.rst:1121 +#: ../../library/test.rst:1127 msgid "" ":mod:`test.support.script_helper` --- Utilities for the Python execution " "tests" msgstr ":mod:`test.support.script_helper` --- 用於 Python 執行測試的工具" -#: ../../library/test.rst:1127 +#: ../../library/test.rst:1133 msgid "" "The :mod:`test.support.script_helper` module provides support for Python's " "script execution tests." msgstr "" ":mod:`test.support.script_helper` 模組提供 Python 的腳本執行測試的支援。" -#: ../../library/test.rst:1132 +#: ../../library/test.rst:1138 msgid "" "Return ``True`` if ``sys.executable interpreter`` requires environment " "variables in order to be able to run at all." msgstr "" -#: ../../library/test.rst:1135 +#: ../../library/test.rst:1141 msgid "" "This is designed to be used with ``@unittest.skipIf()`` to annotate tests " "that need to use an ``assert_python*()`` function to launch an isolated mode " "(``-I``) or no environment mode (``-E``) sub-interpreter process." msgstr "" -#: ../../library/test.rst:1139 +#: ../../library/test.rst:1145 msgid "" "A normal build & test does not run into this situation but it can happen " "when trying to run the standard library test suite from an interpreter that " "doesn't have an obvious home with Python's current home finding logic." msgstr "" -#: ../../library/test.rst:1143 +#: ../../library/test.rst:1149 msgid "" "Setting :envvar:`PYTHONHOME` is one way to get most of the testsuite to run " "in that situation. :envvar:`PYTHONPATH` or :envvar:`PYTHONUSERSITE` are " @@ -1375,85 +1381,85 @@ msgid "" "interpreter can start." msgstr "" -#: ../../library/test.rst:1151 +#: ../../library/test.rst:1157 msgid "" "Set up the environment based on *env_vars* for running the interpreter in a " "subprocess. The values can include ``__isolated``, ``__cleanenv``, " "``__cwd``, and ``TERM``." msgstr "" -#: ../../library/test.rst:1155 ../../library/test.rst:1171 -#: ../../library/test.rst:1183 +#: ../../library/test.rst:1161 ../../library/test.rst:1177 +#: ../../library/test.rst:1189 msgid "The function no longer strips whitespaces from *stderr*." msgstr "此函式不再從 *stderr* 中移除空白。" -#: ../../library/test.rst:1161 +#: ../../library/test.rst:1167 msgid "" "Assert that running the interpreter with *args* and optional environment " "variables *env_vars* succeeds (``rc == 0``) and return a ``(return code, " "stdout, stderr)`` tuple." msgstr "" -#: ../../library/test.rst:1165 +#: ../../library/test.rst:1171 msgid "" "If the *__cleanenv* keyword-only parameter is set, *env_vars* is used as a " "fresh environment." msgstr "" -#: ../../library/test.rst:1168 +#: ../../library/test.rst:1174 msgid "" "Python is started in isolated mode (command line option ``-I``), except if " "the *__isolated* keyword-only parameter is set to ``False``." msgstr "" -#: ../../library/test.rst:1177 +#: ../../library/test.rst:1183 msgid "" "Assert that running the interpreter with *args* and optional environment " "variables *env_vars* fails (``rc != 0``) and return a ``(return code, " "stdout, stderr)`` tuple." msgstr "" -#: ../../library/test.rst:1181 +#: ../../library/test.rst:1187 msgid "See :func:`assert_python_ok` for more options." msgstr "更多選項請見 :func:`assert_python_ok`。" -#: ../../library/test.rst:1189 +#: ../../library/test.rst:1195 msgid "Run a Python subprocess with the given arguments." msgstr "" -#: ../../library/test.rst:1191 +#: ../../library/test.rst:1197 msgid "" "*kw* is extra keyword args to pass to :func:`subprocess.Popen`. Returns a :" "class:`subprocess.Popen` object." msgstr "" -#: ../../library/test.rst:1197 +#: ../../library/test.rst:1203 msgid "" "Run the given :class:`subprocess.Popen` process until completion and return " "stdout." msgstr "" -#: ../../library/test.rst:1203 +#: ../../library/test.rst:1209 msgid "" "Create script containing *source* in path *script_dir* and " "*script_basename*. If *omit_suffix* is ``False``, append ``.py`` to the " "name. Return the full script path." msgstr "" -#: ../../library/test.rst:1210 +#: ../../library/test.rst:1216 msgid "" "Create zip file at *zip_dir* and *zip_basename* with extension ``zip`` which " "contains the files in *script_name*. *name_in_zip* is the archive name. " "Return a tuple containing ``(full path, full path of archive name)``." msgstr "" -#: ../../library/test.rst:1217 +#: ../../library/test.rst:1223 msgid "" "Create a directory named *pkg_dir* containing an ``__init__`` file with " "*init_source* as its contents." msgstr "" -#: ../../library/test.rst:1224 +#: ../../library/test.rst:1230 msgid "" "Create a zip package directory with a path of *zip_dir* and *zip_basename* " "containing an empty ``__init__`` file and a file *script_basename* " @@ -1462,62 +1468,62 @@ msgid "" "path and the archive name for the zip file." msgstr "" -#: ../../library/test.rst:1232 +#: ../../library/test.rst:1238 msgid "" ":mod:`test.support.bytecode_helper` --- Support tools for testing correct " "bytecode generation" msgstr "" ":mod:`test.support.bytecode_helper` --- 用於測試位元組碼能正確產生的支援工具" -#: ../../library/test.rst:1237 +#: ../../library/test.rst:1243 msgid "" "The :mod:`test.support.bytecode_helper` module provides support for testing " "and inspecting bytecode generation." msgstr "" ":mod:`test.support.bytecode_helper` 模組提供測試和檢查位元組碼產生的支援。" -#: ../../library/test.rst:1242 +#: ../../library/test.rst:1248 msgid "The module defines the following class:" msgstr "此模組定義了以下類別:" -#: ../../library/test.rst:1246 +#: ../../library/test.rst:1252 msgid "This class has custom assertion methods for inspecting bytecode." msgstr "" -#: ../../library/test.rst:1250 +#: ../../library/test.rst:1256 msgid "Return the disassembly of *co* as string." msgstr "" -#: ../../library/test.rst:1255 +#: ../../library/test.rst:1261 msgid "" "Return instr if *opname* is found, otherwise throws :exc:`AssertionError`." msgstr "" -#: ../../library/test.rst:1260 +#: ../../library/test.rst:1266 msgid "Throws :exc:`AssertionError` if *opname* is found." msgstr "" -#: ../../library/test.rst:1264 +#: ../../library/test.rst:1270 msgid ":mod:`test.support.threading_helper` --- Utilities for threading tests" msgstr "" -#: ../../library/test.rst:1269 +#: ../../library/test.rst:1275 msgid "" "The :mod:`test.support.threading_helper` module provides support for " "threading tests." msgstr "" -#: ../../library/test.rst:1276 +#: ../../library/test.rst:1282 msgid "" "Join a *thread* within *timeout*. Raise an :exc:`AssertionError` if thread " "is still alive after *timeout* seconds." msgstr "" -#: ../../library/test.rst:1282 +#: ../../library/test.rst:1288 msgid "Decorator to ensure the threads are cleaned up even if the test fails." msgstr "" -#: ../../library/test.rst:1287 +#: ../../library/test.rst:1293 msgid "" "Context manager to start *threads*, which is a sequence of threads. *unlock* " "is a function called after the threads are started, even if an exception was " @@ -1525,57 +1531,57 @@ msgid "" "will attempt to join the started threads upon exit." msgstr "" -#: ../../library/test.rst:1295 +#: ../../library/test.rst:1301 msgid "" "Cleanup up threads not specified in *original_values*. Designed to emit a " "warning if a test leaves running threads in the background." msgstr "" -#: ../../library/test.rst:1301 +#: ../../library/test.rst:1307 msgid "Return current thread count and copy of dangling threads." msgstr "" -#: ../../library/test.rst:1306 +#: ../../library/test.rst:1312 msgid "" "Context manager to wait until all threads created in the ``with`` statement " "exit." msgstr "" -#: ../../library/test.rst:1312 +#: ../../library/test.rst:1318 msgid "" "Context manager catching :class:`threading.Thread` exception using :func:" "`threading.excepthook`." msgstr "" -#: ../../library/test.rst:1315 +#: ../../library/test.rst:1321 msgid "Attributes set when an exception is caught:" msgstr "當捕捉到例外時會設定的屬性:" -#: ../../library/test.rst:1317 +#: ../../library/test.rst:1323 msgid "``exc_type``" msgstr "``exc_type``" -#: ../../library/test.rst:1318 +#: ../../library/test.rst:1324 msgid "``exc_value``" msgstr "``exc_value``" -#: ../../library/test.rst:1319 +#: ../../library/test.rst:1325 msgid "``exc_traceback``" msgstr "``exc_traceback``" -#: ../../library/test.rst:1320 +#: ../../library/test.rst:1326 msgid "``thread``" msgstr "``thread``" -#: ../../library/test.rst:1322 +#: ../../library/test.rst:1328 msgid "See :func:`threading.excepthook` documentation." msgstr "參閱 :func:`threading.excepthook` 文件。" -#: ../../library/test.rst:1324 +#: ../../library/test.rst:1330 msgid "These attributes are deleted at the context manager exit." msgstr "這些屬性會在離開情境管理器時被刪除。" -#: ../../library/test.rst:1328 +#: ../../library/test.rst:1334 msgid "" "with threading_helper.catch_threading_exception() as cm:\n" " # code spawning a thread which raises an exception\n" @@ -1590,29 +1596,29 @@ msgid "" "# (to avoid reference cycles)" msgstr "" -#: ../../library/test.rst:1344 +#: ../../library/test.rst:1350 msgid ":mod:`test.support.os_helper` --- Utilities for os tests" msgstr ":mod:`test.support.os_helper` --- 用於 os 測試的工具" -#: ../../library/test.rst:1349 +#: ../../library/test.rst:1355 msgid "The :mod:`test.support.os_helper` module provides support for os tests." msgstr ":mod:`test.support.os_helper` 模組提供 os 測試的支援。" -#: ../../library/test.rst:1356 +#: ../../library/test.rst:1362 msgid "A non-ASCII character encodable by :func:`os.fsencode`." msgstr "" -#: ../../library/test.rst:1361 +#: ../../library/test.rst:1367 msgid "Set to :func:`os.getcwd`." msgstr "設定為 :func:`os.getcwd`。" -#: ../../library/test.rst:1366 +#: ../../library/test.rst:1372 msgid "" "Set to a name that is safe to use as the name of a temporary file. Any " "temporary file that is created should be closed and unlinked (removed)." msgstr "" -#: ../../library/test.rst:1372 +#: ../../library/test.rst:1378 msgid "" "Set to a filename containing the :data:`FS_NONASCII` character, if it " "exists. This guarantees that if the filename exists, it can be encoded and " @@ -1620,25 +1626,25 @@ msgid "" "a non-ASCII filename to be easily skipped on platforms where they can't work." msgstr "" -#: ../../library/test.rst:1380 +#: ../../library/test.rst:1386 msgid "" "Set to a filename (str type) that should not be able to be encoded by file " "system encoding in strict mode. It may be ``None`` if it's not possible to " "generate such a filename." msgstr "" -#: ../../library/test.rst:1387 +#: ../../library/test.rst:1393 msgid "" "Set to a filename (bytes type) that should not be able to be decoded by file " "system encoding in strict mode. It may be ``None`` if it's not possible to " "generate such a filename." msgstr "" -#: ../../library/test.rst:1394 +#: ../../library/test.rst:1400 msgid "Set to a non-ASCII name for a temporary file." msgstr "" -#: ../../library/test.rst:1399 +#: ../../library/test.rst:1405 msgid "" "Class used to temporarily set or unset environment variables. Instances can " "be used as a context manager and have a complete dictionary interface for " @@ -1647,75 +1653,75 @@ msgid "" "instance will be rolled back." msgstr "" -#: ../../library/test.rst:1405 +#: ../../library/test.rst:1411 msgid "Added dictionary interface." msgstr "新增字典介面。" -#: ../../library/test.rst:1411 +#: ../../library/test.rst:1417 msgid "" "Simple :term:`path-like object`. It implements the :meth:`~os.PathLike." "__fspath__` method which just returns the *path* argument. If *path* is an " "exception, it will be raised in :meth:`!__fspath__`." msgstr "" -#: ../../library/test.rst:1419 +#: ../../library/test.rst:1425 msgid "" "Temporarily set the environment variable ``envvar`` to the value of " "``value``." msgstr "" -#: ../../library/test.rst:1425 +#: ../../library/test.rst:1431 msgid "Temporarily unset the environment variable ``envvar``." msgstr "暫時取消環境變數 ``envvar``。" -#: ../../library/test.rst:1430 +#: ../../library/test.rst:1436 msgid "Return ``True`` if the OS supports symbolic links, ``False`` otherwise." msgstr "如果作業系統支援符號連結則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/test.rst:1436 +#: ../../library/test.rst:1442 msgid "Return ``True`` if the OS supports xattr, ``False`` otherwise." msgstr "如果作業系統支援 xattr 則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/test.rst:1442 +#: ../../library/test.rst:1448 msgid "" "A context manager that temporarily changes the current working directory to " "*path* and yields the directory." msgstr "" -#: ../../library/test.rst:1445 +#: ../../library/test.rst:1451 msgid "" "If *quiet* is ``False``, the context manager raises an exception on error. " "Otherwise, it issues only a warning and keeps the current working directory " "the same." msgstr "" -#: ../../library/test.rst:1452 +#: ../../library/test.rst:1458 msgid "" "Create an empty file with *filename*. If it already exists, truncate it." msgstr "" -#: ../../library/test.rst:1457 +#: ../../library/test.rst:1463 msgid "Count the number of open file descriptors." msgstr "" -#: ../../library/test.rst:1462 +#: ../../library/test.rst:1468 msgid "Return ``True`` if the file system for *directory* is case-insensitive." msgstr "" -#: ../../library/test.rst:1467 +#: ../../library/test.rst:1473 msgid "" "Create an invalid file descriptor by opening and closing a temporary file, " "and returning its descriptor." msgstr "" -#: ../../library/test.rst:1473 +#: ../../library/test.rst:1479 msgid "" "Call :func:`os.rmdir` on *filename*. On Windows platforms, this is wrapped " "with a wait loop that checks for the existence of the file, which is needed " "due to antivirus programs that can hold files open and prevent deletion." msgstr "" -#: ../../library/test.rst:1481 +#: ../../library/test.rst:1487 msgid "" "Call :func:`shutil.rmtree` on *path* or call :func:`os.lstat` and :func:`os." "rmdir` to remove a path and its contents. As with :func:`rmdir`, on Windows " @@ -1723,21 +1729,21 @@ msgid "" "the files." msgstr "" -#: ../../library/test.rst:1489 +#: ../../library/test.rst:1495 msgid "A decorator for running tests that require support for symbolic links." msgstr "" -#: ../../library/test.rst:1494 +#: ../../library/test.rst:1500 msgid "A decorator for running tests that require support for xattr." msgstr "" -#: ../../library/test.rst:1499 +#: ../../library/test.rst:1505 msgid "" "A context manager that temporarily creates a new directory and changes the " "current working directory (CWD)." msgstr "" -#: ../../library/test.rst:1502 +#: ../../library/test.rst:1508 msgid "" "The context manager creates a temporary directory in the current directory " "with name *name* before temporarily changing the current working directory. " @@ -1745,20 +1751,20 @@ msgid "" "`tempfile.mkdtemp`." msgstr "" -#: ../../library/test.rst:1507 +#: ../../library/test.rst:1513 msgid "" "If *quiet* is ``False`` and it is not possible to create or change the CWD, " "an error is raised. Otherwise, only a warning is raised and the original " "CWD is used." msgstr "" -#: ../../library/test.rst:1514 +#: ../../library/test.rst:1520 msgid "" "A context manager that creates a temporary directory at *path* and yields " "the directory." msgstr "" -#: ../../library/test.rst:1517 +#: ../../library/test.rst:1523 msgid "" "If *path* is ``None``, the temporary directory is created using :func:" "`tempfile.mkdtemp`. If *quiet* is ``False``, the context manager raises an " @@ -1766,34 +1772,34 @@ msgid "" "created, only a warning is issued." msgstr "" -#: ../../library/test.rst:1525 +#: ../../library/test.rst:1531 msgid "A context manager that temporarily sets the process umask." msgstr "" -#: ../../library/test.rst:1530 +#: ../../library/test.rst:1536 msgid "" "Call :func:`os.unlink` on *filename*. As with :func:`rmdir`, on Windows " "platforms, this is wrapped with a wait loop that checks for the existence of " "the file." msgstr "" -#: ../../library/test.rst:1536 +#: ../../library/test.rst:1542 msgid ":mod:`test.support.import_helper` --- Utilities for import tests" msgstr ":mod:`test.support.import_helper` --- 用於 import 測試的工具" -#: ../../library/test.rst:1541 +#: ../../library/test.rst:1547 msgid "" "The :mod:`test.support.import_helper` module provides support for import " "tests." msgstr ":mod:`test.support.import_helper` 模組提供 import 測試的支援。" -#: ../../library/test.rst:1548 +#: ../../library/test.rst:1554 msgid "" "Remove the module named *module_name* from ``sys.modules`` and delete any " "byte-compiled files of the module." msgstr "" -#: ../../library/test.rst:1554 +#: ../../library/test.rst:1560 msgid "" "This function imports and returns a fresh copy of the named Python module by " "removing the named module from ``sys.modules`` before doing the import. Note " @@ -1801,39 +1807,39 @@ msgid "" "operation." msgstr "" -#: ../../library/test.rst:1559 +#: ../../library/test.rst:1565 msgid "" "*fresh* is an iterable of additional module names that are also removed from " "the ``sys.modules`` cache before doing the import." msgstr "" -#: ../../library/test.rst:1562 +#: ../../library/test.rst:1568 msgid "" "*blocked* is an iterable of module names that are replaced with ``None`` in " "the module cache during the import to ensure that attempts to import them " "raise :exc:`ImportError`." msgstr "" -#: ../../library/test.rst:1566 +#: ../../library/test.rst:1572 msgid "" "The named module and any modules named in the *fresh* and *blocked* " "parameters are saved before starting the import and then reinserted into " "``sys.modules`` when the fresh import is complete." msgstr "" -#: ../../library/test.rst:1570 +#: ../../library/test.rst:1576 msgid "" "Module and package deprecation messages are suppressed during this import if " "*deprecated* is ``True``." msgstr "" -#: ../../library/test.rst:1573 +#: ../../library/test.rst:1579 msgid "" "This function will raise :exc:`ImportError` if the named module cannot be " "imported." msgstr "如果無法引入指定的模組則此函式會引發 :exc:`ImportError`。" -#: ../../library/test.rst:1578 +#: ../../library/test.rst:1584 msgid "" "# Get copies of the warnings module for testing without affecting the\n" "# version being used by the rest of the test suite. One copy uses the\n" @@ -1843,14 +1849,14 @@ msgid "" "c_warnings = import_fresh_module('warnings', fresh=['_warnings'])" msgstr "" -#: ../../library/test.rst:1590 +#: ../../library/test.rst:1596 msgid "" "This function imports and returns the named module. Unlike a normal import, " "this function raises :exc:`unittest.SkipTest` if the module cannot be " "imported." msgstr "" -#: ../../library/test.rst:1594 +#: ../../library/test.rst:1600 msgid "" "Module and package deprecation messages are suppressed during this import if " "*deprecated* is ``True``. If a module is required on a platform but " @@ -1858,21 +1864,21 @@ msgid "" "which will be compared against :data:`sys.platform`." msgstr "" -#: ../../library/test.rst:1604 +#: ../../library/test.rst:1610 msgid "Return a copy of :data:`sys.modules`." msgstr "回傳 :data:`sys.modules` 的複本。" -#: ../../library/test.rst:1609 +#: ../../library/test.rst:1615 msgid "" "Remove modules except for *oldmodules* and ``encodings`` in order to " "preserve internal cache." msgstr "" -#: ../../library/test.rst:1615 +#: ../../library/test.rst:1621 msgid "Delete *name* from ``sys.modules``." msgstr "從 ``sys.modules`` 中刪除 *name*。" -#: ../../library/test.rst:1620 +#: ../../library/test.rst:1626 msgid "" "Move a :pep:`3147`/:pep:`488` pyc file to its legacy pyc location and return " "the file system path to the legacy pyc file. The *source* value is the file " @@ -1880,48 +1886,48 @@ msgid "" "3147/488 pyc file must exist." msgstr "" -#: ../../library/test.rst:1628 +#: ../../library/test.rst:1634 msgid "" "A context manager to force import to return a new module reference. This is " "useful for testing module-level behaviors, such as the emission of a :exc:" "`DeprecationWarning` on import. Example usage::" msgstr "" -#: ../../library/test.rst:1632 +#: ../../library/test.rst:1638 msgid "" "with CleanImport('foo'):\n" " importlib.import_module('foo') # New reference." msgstr "" -#: ../../library/test.rst:1638 +#: ../../library/test.rst:1644 msgid "A context manager to temporarily add directories to :data:`sys.path`." msgstr "" -#: ../../library/test.rst:1640 +#: ../../library/test.rst:1646 msgid "" "This makes a copy of :data:`sys.path`, appends any directories given as " "positional arguments, then reverts :data:`sys.path` to the copied settings " "when the context ends." msgstr "" -#: ../../library/test.rst:1644 +#: ../../library/test.rst:1650 msgid "" "Note that *all* :data:`sys.path` modifications in the body of the context " "manager, including replacement of the object, will be reverted at the end of " "the block." msgstr "" -#: ../../library/test.rst:1650 +#: ../../library/test.rst:1656 msgid ":mod:`test.support.warnings_helper` --- Utilities for warnings tests" msgstr ":mod:`test.support.warnings_helper` --- 用於 warnings 測試的工具" -#: ../../library/test.rst:1655 +#: ../../library/test.rst:1661 msgid "" "The :mod:`test.support.warnings_helper` module provides support for warnings " "tests." msgstr ":mod:`test.support.warnings_helper` 模組提供 warnings 測試的支援。" -#: ../../library/test.rst:1662 +#: ../../library/test.rst:1668 msgid "" "Suppress warnings that are instances of *category*, which must be :exc:" "`Warning` or a subclass. Roughly equivalent to :func:`warnings." @@ -1929,21 +1935,21 @@ msgid "" "category=category) `. For example::" msgstr "" -#: ../../library/test.rst:1668 +#: ../../library/test.rst:1674 msgid "" "@warning_helper.ignore_warnings(category=DeprecationWarning)\n" "def test_suppress_warning():\n" " # do something" msgstr "" -#: ../../library/test.rst:1677 +#: ../../library/test.rst:1683 msgid "" "Context manager to check that no :exc:`ResourceWarning` was raised. You " "must remove the object which may emit :exc:`ResourceWarning` before the end " "of the context manager." msgstr "" -#: ../../library/test.rst:1684 +#: ../../library/test.rst:1690 msgid "" "Test for syntax warning in *statement* by attempting to compile *statement*. " "Test also that the :exc:`SyntaxWarning` is emitted only once, and that it " @@ -1955,7 +1961,7 @@ msgid "" "``None``, compares to the offset of the exception." msgstr "" -#: ../../library/test.rst:1698 +#: ../../library/test.rst:1704 msgid "" "A convenience wrapper for :func:`warnings.catch_warnings` that makes it " "easier to test that a warning was correctly raised. It is approximately " @@ -1964,7 +1970,7 @@ msgid "" "automatically validate the results that are recorded." msgstr "" -#: ../../library/test.rst:1704 +#: ../../library/test.rst:1710 msgid "" "``check_warnings`` accepts 2-tuples of the form ``(\"message regexp\", " "WarningCategory)`` as positional arguments. If one or more *filters* are " @@ -1976,19 +1982,19 @@ msgid "" "*quiet* to ``True``." msgstr "" -#: ../../library/test.rst:1713 +#: ../../library/test.rst:1719 msgid "If no arguments are specified, it defaults to::" msgstr "如果沒有指定引數,預設為: ::" -#: ../../library/test.rst:1715 +#: ../../library/test.rst:1721 msgid "check_warnings((\"\", Warning), quiet=True)" msgstr "check_warnings((\"\", Warning), quiet=True)" -#: ../../library/test.rst:1717 +#: ../../library/test.rst:1723 msgid "In this case all warnings are caught and no errors are raised." msgstr "" -#: ../../library/test.rst:1719 +#: ../../library/test.rst:1725 msgid "" "On entry to the context manager, a :class:`WarningRecorder` instance is " "returned. The underlying warnings list from :func:`~warnings.catch_warnings` " @@ -2000,17 +2006,17 @@ msgid "" "return ``None``." msgstr "" -#: ../../library/test.rst:1728 +#: ../../library/test.rst:1734 msgid "" "The recorder object also has a :meth:`reset` method, which clears the " "warnings list." msgstr "" -#: ../../library/test.rst:1731 +#: ../../library/test.rst:1737 msgid "The context manager is designed to be used like this::" msgstr "" -#: ../../library/test.rst:1733 +#: ../../library/test.rst:1739 msgid "" "with check_warnings((\"assertion is always true\", SyntaxWarning),\n" " (\"\", UserWarning)):\n" @@ -2018,19 +2024,19 @@ msgid "" " warnings.warn(UserWarning(\"Hide me!\"))" msgstr "" -#: ../../library/test.rst:1738 +#: ../../library/test.rst:1744 msgid "" "In this case if either warning was not raised, or some other warning was " "raised, :func:`check_warnings` would raise an error." msgstr "" -#: ../../library/test.rst:1741 +#: ../../library/test.rst:1747 msgid "" "When a test needs to look more deeply into the warnings, rather than just " "checking whether or not they occurred, code like this can be used::" msgstr "" -#: ../../library/test.rst:1744 +#: ../../library/test.rst:1750 msgid "" "with check_warnings(quiet=True) as w:\n" " warnings.warn(\"foo\")\n" @@ -2052,17 +2058,17 @@ msgstr "" " w.reset()\n" " assert len(w.warnings) == 0" -#: ../../library/test.rst:1755 +#: ../../library/test.rst:1761 msgid "" "Here all warnings will be caught, and the test code tests the captured " "warnings directly." msgstr "" -#: ../../library/test.rst:1758 +#: ../../library/test.rst:1764 msgid "New optional arguments *filters* and *quiet*." msgstr "新的可選引數 *filters* 和 *quiet*。" -#: ../../library/test.rst:1764 +#: ../../library/test.rst:1770 msgid "" "Class used to record warnings for unit tests. See documentation of :func:" "`check_warnings` above for more details." diff --git a/library/text.po b/library/text.po index d1455bb8d7..4170b9d6b2 100644 --- a/library/text.po +++ b/library/text.po @@ -7,7 +7,7 @@ # Jordan Su , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-10-17 22:18+0800\n" diff --git a/library/textwrap.po b/library/textwrap.po index b705c13901..659303b7f8 100644 --- a/library/textwrap.po +++ b/library/textwrap.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2015-12-09 17:51+0000\n" diff --git a/library/threading.po b/library/threading.po index 9409ef71ff..35adbe0595 100644 --- a/library/threading.po +++ b/library/threading.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:12+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -74,17 +74,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/threading.rst:50 msgid "This module defines the following functions:" @@ -196,13 +195,17 @@ msgid "" "after which the value may be recycled by the OS)." msgstr "" -#: ../../library/threading.rst:130 ../../library/threading.rst:465 +#: ../../library/threading.rst:130 msgid "" ":ref:`Availability `: Windows, FreeBSD, Linux, macOS, OpenBSD, " -"NetBSD, AIX, DragonFlyBSD." +"NetBSD, AIX, DragonFlyBSD, GNU/kFreeBSD." +msgstr "" + +#: ../../library/threading.rst:134 +msgid "Added support for GNU/kFreeBSD." msgstr "" -#: ../../library/threading.rst:137 +#: ../../library/threading.rst:140 msgid "" "Return a list of all :class:`Thread` objects currently active. The list " "includes daemonic threads and dummy thread objects created by :func:" @@ -211,59 +214,59 @@ msgid "" "even when terminated." msgstr "" -#: ../../library/threading.rst:146 +#: ../../library/threading.rst:149 msgid "" "Return the main :class:`Thread` object. In normal conditions, the main " "thread is the thread from which the Python interpreter was started." msgstr "" -#: ../../library/threading.rst:157 +#: ../../library/threading.rst:160 msgid "" "Set a trace function for all threads started from the :mod:`threading` " "module. The *func* will be passed to :func:`sys.settrace` for each thread, " "before its :meth:`~Thread.run` method is called." msgstr "" -#: ../../library/threading.rst:163 +#: ../../library/threading.rst:166 msgid "" "Set a trace function for all threads started from the :mod:`threading` " "module and all Python threads that are currently executing." msgstr "" -#: ../../library/threading.rst:166 +#: ../../library/threading.rst:169 msgid "" "The *func* will be passed to :func:`sys.settrace` for each thread, before " "its :meth:`~Thread.run` method is called." msgstr "" -#: ../../library/threading.rst:177 +#: ../../library/threading.rst:180 msgid "Get the trace function as set by :func:`settrace`." msgstr "" -#: ../../library/threading.rst:186 +#: ../../library/threading.rst:189 msgid "" "Set a profile function for all threads started from the :mod:`threading` " "module. The *func* will be passed to :func:`sys.setprofile` for each " "thread, before its :meth:`~Thread.run` method is called." msgstr "" -#: ../../library/threading.rst:192 +#: ../../library/threading.rst:195 msgid "" "Set a profile function for all threads started from the :mod:`threading` " "module and all Python threads that are currently executing." msgstr "" -#: ../../library/threading.rst:195 +#: ../../library/threading.rst:198 msgid "" "The *func* will be passed to :func:`sys.setprofile` for each thread, before " "its :meth:`~Thread.run` method is called." msgstr "" -#: ../../library/threading.rst:204 +#: ../../library/threading.rst:207 msgid "Get the profiler function as set by :func:`setprofile`." msgstr "" -#: ../../library/threading.rst:211 +#: ../../library/threading.rst:214 msgid "" "Return the thread stack size used when creating new threads. The optional " "*size* argument specifies the stack size to be used for subsequently created " @@ -282,19 +285,19 @@ msgid "" "information)." msgstr "" -#: ../../library/threading.rst:226 +#: ../../library/threading.rst:229 msgid ":ref:`Availability `: Windows, pthreads." msgstr ":ref:`適用 `:Windows, pthreads。" -#: ../../library/threading.rst:228 +#: ../../library/threading.rst:231 msgid "Unix platforms with POSIX threads support." msgstr "" -#: ../../library/threading.rst:231 +#: ../../library/threading.rst:234 msgid "This module also defines the following constant:" msgstr "" -#: ../../library/threading.rst:235 +#: ../../library/threading.rst:238 msgid "" "The maximum value allowed for the *timeout* parameter of blocking functions " "(:meth:`Lock.acquire`, :meth:`RLock.acquire`, :meth:`Condition.wait`, etc.). " @@ -302,13 +305,13 @@ msgid "" "`OverflowError`." msgstr "" -#: ../../library/threading.rst:243 +#: ../../library/threading.rst:246 msgid "" "This module defines a number of classes, which are detailed in the sections " "below." msgstr "" -#: ../../library/threading.rst:246 +#: ../../library/threading.rst:249 msgid "" "The design of this module is loosely based on Java's threading model. " "However, where Java makes locks and condition variables basic behavior of " @@ -319,22 +322,22 @@ msgid "" "Thread class, when implemented, are mapped to module-level functions." msgstr "" -#: ../../library/threading.rst:254 +#: ../../library/threading.rst:257 msgid "All of the methods described below are executed atomically." msgstr "" -#: ../../library/threading.rst:258 +#: ../../library/threading.rst:261 msgid "Thread-Local Data" msgstr "" -#: ../../library/threading.rst:260 +#: ../../library/threading.rst:263 msgid "" "Thread-local data is data whose values are thread specific. To manage " "thread-local data, just create an instance of :class:`local` (or a subclass) " "and store attributes on it::" msgstr "" -#: ../../library/threading.rst:264 +#: ../../library/threading.rst:267 msgid "" "mydata = threading.local()\n" "mydata.x = 1" @@ -342,25 +345,25 @@ msgstr "" "mydata = threading.local()\n" "mydata.x = 1" -#: ../../library/threading.rst:267 +#: ../../library/threading.rst:270 msgid "The instance's values will be different for separate threads." msgstr "" -#: ../../library/threading.rst:272 +#: ../../library/threading.rst:275 msgid "A class that represents thread-local data." msgstr "" -#: ../../library/threading.rst:274 +#: ../../library/threading.rst:277 msgid "" "For more details and extensive examples, see the documentation string of " "the :mod:`!_threading_local` module: :source:`Lib/_threading_local.py`." msgstr "" -#: ../../library/threading.rst:281 +#: ../../library/threading.rst:284 msgid "Thread Objects" msgstr "" -#: ../../library/threading.rst:283 +#: ../../library/threading.rst:286 msgid "" "The :class:`Thread` class represents an activity that is run in a separate " "thread of control. There are two ways to specify the activity: by passing a " @@ -370,14 +373,14 @@ msgid "" "``__init__()`` and :meth:`~Thread.run` methods of this class." msgstr "" -#: ../../library/threading.rst:290 +#: ../../library/threading.rst:293 msgid "" "Once a thread object is created, its activity must be started by calling the " "thread's :meth:`~Thread.start` method. This invokes the :meth:`~Thread.run` " "method in a separate thread of control." msgstr "" -#: ../../library/threading.rst:294 +#: ../../library/threading.rst:297 msgid "" "Once the thread's activity is started, the thread is considered 'alive'. It " "stops being alive when its :meth:`~Thread.run` method terminates -- either " @@ -385,27 +388,27 @@ msgid "" "is_alive` method tests whether the thread is alive." msgstr "" -#: ../../library/threading.rst:299 +#: ../../library/threading.rst:302 msgid "" "Other threads can call a thread's :meth:`~Thread.join` method. This blocks " "the calling thread until the thread whose :meth:`~Thread.join` method is " "called is terminated." msgstr "" -#: ../../library/threading.rst:303 +#: ../../library/threading.rst:306 msgid "" "A thread has a name. The name can be passed to the constructor, and read or " "changed through the :attr:`~Thread.name` attribute." msgstr "" -#: ../../library/threading.rst:306 +#: ../../library/threading.rst:309 msgid "" "If the :meth:`~Thread.run` method raises an exception, :func:`threading." "excepthook` is called to handle it. By default, :func:`threading.excepthook` " "ignores silently :exc:`SystemExit`." msgstr "" -#: ../../library/threading.rst:310 +#: ../../library/threading.rst:313 msgid "" "A thread can be flagged as a \"daemon thread\". The significance of this " "flag is that the entire Python program exits when only daemon threads are " @@ -414,7 +417,7 @@ msgid "" "constructor argument." msgstr "" -#: ../../library/threading.rst:317 +#: ../../library/threading.rst:320 msgid "" "Daemon threads are abruptly stopped at shutdown. Their resources (such as " "open files, database transactions, etc.) may not be released properly. If " @@ -422,13 +425,13 @@ msgid "" "suitable signalling mechanism such as an :class:`Event`." msgstr "" -#: ../../library/threading.rst:322 +#: ../../library/threading.rst:325 msgid "" "There is a \"main thread\" object; this corresponds to the initial thread of " "control in the Python program. It is not a daemon thread." msgstr "" -#: ../../library/threading.rst:325 +#: ../../library/threading.rst:328 msgid "" "There is the possibility that \"dummy thread objects\" are created. These " "are thread objects corresponding to \"alien threads\", which are threads of " @@ -439,25 +442,25 @@ msgid "" "threads." msgstr "" -#: ../../library/threading.rst:336 +#: ../../library/threading.rst:339 msgid "" "This constructor should always be called with keyword arguments. Arguments " "are:" msgstr "" -#: ../../library/threading.rst:339 +#: ../../library/threading.rst:342 msgid "" "*group* should be ``None``; reserved for future extension when a :class:`!" "ThreadGroup` class is implemented." msgstr "" -#: ../../library/threading.rst:342 +#: ../../library/threading.rst:345 msgid "" "*target* is the callable object to be invoked by the :meth:`run` method. " "Defaults to ``None``, meaning nothing is called." msgstr "" -#: ../../library/threading.rst:345 +#: ../../library/threading.rst:348 msgid "" "*name* is the thread name. By default, a unique name is constructed of the " "form \"Thread-*N*\" where *N* is a small decimal number, or \"Thread-*N* " @@ -465,62 +468,62 @@ msgid "" "is specified." msgstr "" -#: ../../library/threading.rst:350 +#: ../../library/threading.rst:353 msgid "" "*args* is a list or tuple of arguments for the target invocation. Defaults " "to ``()``." msgstr "" -#: ../../library/threading.rst:352 +#: ../../library/threading.rst:355 msgid "" "*kwargs* is a dictionary of keyword arguments for the target invocation. " "Defaults to ``{}``." msgstr "" -#: ../../library/threading.rst:355 +#: ../../library/threading.rst:358 msgid "" "If not ``None``, *daemon* explicitly sets whether the thread is daemonic. If " "``None`` (the default), the daemonic property is inherited from the current " "thread." msgstr "" -#: ../../library/threading.rst:359 +#: ../../library/threading.rst:362 msgid "" "If the subclass overrides the constructor, it must make sure to invoke the " "base class constructor (``Thread.__init__()``) before doing anything else to " "the thread." msgstr "" -#: ../../library/threading.rst:363 +#: ../../library/threading.rst:366 msgid "Added the *daemon* parameter." msgstr "新增 *daemon* 參數。" -#: ../../library/threading.rst:366 +#: ../../library/threading.rst:369 msgid "Use the *target* name if *name* argument is omitted." msgstr "" -#: ../../library/threading.rst:371 +#: ../../library/threading.rst:374 msgid "Start the thread's activity." msgstr "" -#: ../../library/threading.rst:373 +#: ../../library/threading.rst:376 msgid "" "It must be called at most once per thread object. It arranges for the " "object's :meth:`~Thread.run` method to be invoked in a separate thread of " "control." msgstr "" -#: ../../library/threading.rst:377 +#: ../../library/threading.rst:380 msgid "" "This method will raise a :exc:`RuntimeError` if called more than once on the " "same thread object." msgstr "" -#: ../../library/threading.rst:382 +#: ../../library/threading.rst:385 msgid "Method representing the thread's activity." msgstr "" -#: ../../library/threading.rst:384 +#: ../../library/threading.rst:387 msgid "" "You may override this method in a subclass. The standard :meth:`run` method " "invokes the callable object passed to the object's constructor as the " @@ -528,17 +531,17 @@ msgid "" "the *args* and *kwargs* arguments, respectively." msgstr "" -#: ../../library/threading.rst:389 +#: ../../library/threading.rst:392 msgid "" "Using list or tuple as the *args* argument which passed to the :class:" "`Thread` could achieve the same effect." msgstr "" -#: ../../library/threading.rst:392 +#: ../../library/threading.rst:395 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/threading.rst:394 +#: ../../library/threading.rst:397 msgid "" ">>> from threading import Thread\n" ">>> t = Thread(target=print, args=[1])\n" @@ -556,7 +559,7 @@ msgstr "" ">>> t.run()\n" "1" -#: ../../library/threading.rst:406 +#: ../../library/threading.rst:409 msgid "" "Wait until the thread terminates. This blocks the calling thread until the " "thread whose :meth:`~Thread.join` method is called terminates -- either " @@ -564,7 +567,7 @@ msgid "" "occurs." msgstr "" -#: ../../library/threading.rst:411 +#: ../../library/threading.rst:414 msgid "" "When the *timeout* argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds (or " @@ -574,17 +577,17 @@ msgid "" "`~Thread.join` call timed out." msgstr "" -#: ../../library/threading.rst:418 +#: ../../library/threading.rst:421 msgid "" "When the *timeout* argument is not present or ``None``, the operation will " "block until the thread terminates." msgstr "" -#: ../../library/threading.rst:421 +#: ../../library/threading.rst:424 msgid "A thread can be joined many times." msgstr "" -#: ../../library/threading.rst:423 +#: ../../library/threading.rst:426 msgid "" ":meth:`~Thread.join` raises a :exc:`RuntimeError` if an attempt is made to " "join the current thread as that would cause a deadlock. It is also an error " @@ -592,20 +595,20 @@ msgid "" "do so raise the same exception." msgstr "" -#: ../../library/threading.rst:430 +#: ../../library/threading.rst:433 msgid "" "A string used for identification purposes only. It has no semantics. " "Multiple threads may be given the same name. The initial name is set by the " "constructor." msgstr "" -#: ../../library/threading.rst:437 +#: ../../library/threading.rst:440 msgid "" "Deprecated getter/setter API for :attr:`~Thread.name`; use it directly as a " "property instead." msgstr "" -#: ../../library/threading.rst:444 +#: ../../library/threading.rst:447 msgid "" "The 'thread identifier' of this thread or ``None`` if the thread has not " "been started. This is a nonzero integer. See the :func:`get_ident` " @@ -614,7 +617,7 @@ msgid "" "thread has exited." msgstr "" -#: ../../library/threading.rst:452 +#: ../../library/threading.rst:455 msgid "" "The Thread ID (``TID``) of this thread, as assigned by the OS (kernel). This " "is a non-negative integer, or ``None`` if the thread has not been started. " @@ -623,25 +626,31 @@ msgid "" "after which the value may be recycled by the OS)." msgstr "" -#: ../../library/threading.rst:461 +#: ../../library/threading.rst:464 msgid "" "Similar to Process IDs, Thread IDs are only valid (guaranteed unique system-" "wide) from the time the thread is created until the thread has been " "terminated." msgstr "" -#: ../../library/threading.rst:471 +#: ../../library/threading.rst:468 +msgid "" +":ref:`Availability `: Windows, FreeBSD, Linux, macOS, OpenBSD, " +"NetBSD, AIX, DragonFlyBSD." +msgstr "" + +#: ../../library/threading.rst:474 msgid "Return whether the thread is alive." msgstr "" -#: ../../library/threading.rst:473 +#: ../../library/threading.rst:476 msgid "" "This method returns ``True`` just before the :meth:`~Thread.run` method " "starts until just after the :meth:`~Thread.run` method terminates. The " "module function :func:`.enumerate` returns a list of all alive threads." msgstr "" -#: ../../library/threading.rst:479 +#: ../../library/threading.rst:482 msgid "" "A boolean value indicating whether this thread is a daemon thread (``True``) " "or not (``False``). This must be set before :meth:`~Thread.start` is " @@ -651,30 +660,33 @@ msgid "" "`~Thread.daemon` = ``False``." msgstr "" -#: ../../library/threading.rst:486 +#: ../../library/threading.rst:489 msgid "" "The entire Python program exits when no alive non-daemon threads are left." msgstr "" -#: ../../library/threading.rst:491 +#: ../../library/threading.rst:494 msgid "" "Deprecated getter/setter API for :attr:`~Thread.daemon`; use it directly as " "a property instead." msgstr "" -#: ../../library/threading.rst:500 +#: ../../library/threading.rst:503 msgid "Lock Objects" -msgstr "" +msgstr "Lock 物件" -#: ../../library/threading.rst:502 +#: ../../library/threading.rst:505 msgid "" "A primitive lock is a synchronization primitive that is not owned by a " "particular thread when locked. In Python, it is currently the lowest level " "synchronization primitive available, implemented directly by the :mod:" "`_thread` extension module." msgstr "" +"原始鎖 (primitive lock) 是一種同步原語 (synchronization primitive),在鎖定時" +"不屬於特定執行緒。在 Python 中,它是目前可用的最低階同步原語,直接由 :mod:" +"`_thread` 擴充模組實作。" -#: ../../library/threading.rst:507 +#: ../../library/threading.rst:510 msgid "" "A primitive lock is in one of two states, \"locked\" or \"unlocked\". It is " "created in the unlocked state. It has two basic methods, :meth:`~Lock." @@ -687,55 +699,74 @@ msgid "" "state to unlocked and returns immediately. If an attempt is made to release " "an unlocked lock, a :exc:`RuntimeError` will be raised." msgstr "" +"原始鎖會處於兩種狀態之一:「鎖定 (locked)」或「未鎖定 (unclocked)」,建立時會" +"處於未鎖定狀態。它有兩個基本方法 :meth:`~Lock.acquire` 和 :meth:`~Lock." +"release`。當狀態為未鎖定時,:meth:`~Lock.acquire` 會將狀態變更為鎖定並立即回" +"傳。當狀態被鎖定時,:meth:`~Lock.acquire` 會阻塞 (block),直到另一個執行緒中" +"對 :meth:`~Lock.release` 的呼叫將其更改為未鎖定狀態,然後 :meth:`~Lock." +"acquire` 呼叫會將其重置為鎖定並回傳。:meth:`~Lock.release` 方法只能在鎖定狀態" +"下呼叫;它將狀態更改為未鎖定並立即回傳。如果嘗試釋放未鎖定的鎖,則會引發 :" +"exc:`RuntimeError`。" -#: ../../library/threading.rst:518 +#: ../../library/threading.rst:521 msgid "Locks also support the :ref:`context management protocol `." -msgstr "" +msgstr "鎖也支援\\ :ref:`情境管理協定 `。" -#: ../../library/threading.rst:520 +#: ../../library/threading.rst:523 msgid "" "When more than one thread is blocked in :meth:`~Lock.acquire` waiting for " "the state to turn to unlocked, only one thread proceeds when a :meth:`~Lock." "release` call resets the state to unlocked; which one of the waiting threads " "proceeds is not defined, and may vary across implementations." msgstr "" +"當多個執行緒阻塞在 :meth:`~Lock.acquire` 中等待狀態轉變為未鎖定,此時若呼叫 :" +"meth:`~Lock.release` 將狀態重置為未鎖定,則只會有一個執行緒繼續進行;哪一個等" +"待執行緒會繼續進行是未定義的,並且可能因實作而異。" -#: ../../library/threading.rst:525 +#: ../../library/threading.rst:528 msgid "All methods are executed atomically." -msgstr "" +msgstr "所有方法均以最小不可分割的操作方式 (atomically) 執行。" -#: ../../library/threading.rst:530 +#: ../../library/threading.rst:533 msgid "" "The class implementing primitive lock objects. Once a thread has acquired a " "lock, subsequent attempts to acquire it block, until it is released; any " "thread may release it." msgstr "" +"實作原始鎖物件的類別。一旦執行緒獲得了鎖,後續再嘗試獲得它就會被阻塞,直到鎖" +"被釋放;任何執行緒都可以去釋放它。" -#: ../../library/threading.rst:534 +#: ../../library/threading.rst:537 msgid "" -"Note that ``Lock`` is actually a factory function which returns an instance " -"of the most efficient version of the concrete Lock class that is supported " -"by the platform." +"``Lock`` is now a class. In earlier Pythons, ``Lock`` was a factory function " +"which returned an instance of the underlying private lock type." msgstr "" +"``Lock`` 現在是一個類別。在早期的 Python 中,``Lock`` 是一個會回傳底層私有鎖" +"型別實例的工廠函式。" -#: ../../library/threading.rst:541 ../../library/threading.rst:632 +#: ../../library/threading.rst:545 ../../library/threading.rst:636 msgid "Acquire a lock, blocking or non-blocking." -msgstr "" +msgstr "阻塞或非阻塞地取得鎖。" -#: ../../library/threading.rst:543 +#: ../../library/threading.rst:547 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default), " "block until the lock is unlocked, then set it to locked and return ``True``." msgstr "" +"當以 *blocking* 引數設為 ``True``\\ (預設值)來調用,將會阻塞直到鎖被解鎖," +"然後將其設為鎖定並回傳 ``True``。" -#: ../../library/threading.rst:546 +#: ../../library/threading.rst:550 msgid "" "When invoked with the *blocking* argument set to ``False``, do not block. If " "a call with *blocking* set to ``True`` would block, return ``False`` " "immediately; otherwise, set the lock to locked and return ``True``." msgstr "" +"當以 *blocking* 引數設為 ``False`` 調用則不會阻塞。如果 *blocking* 設定為 " +"``True`` 的呼叫會阻塞,則立即回傳 ``False``;否則將鎖設為鎖定並回傳 " +"``True``。" -#: ../../library/threading.rst:550 +#: ../../library/threading.rst:554 msgid "" "When invoked with the floating-point *timeout* argument set to a positive " "value, block for at most the number of seconds specified by *timeout* and as " @@ -743,54 +774,61 @@ msgid "" "specifies an unbounded wait. It is forbidden to specify a *timeout* when " "*blocking* is ``False``." msgstr "" +"當使用設定為正值的浮點 *timeout* 引數進行調用,只要持續無法取得鎖,最多會阻" +"塞 *timeout* 指定的秒數。``-1`` 的 *timeout* 引數代表指定為不會停止的等待。" +"當 *blocking* 為 ``False`` 時禁止指定 *timeout*。" -#: ../../library/threading.rst:556 +#: ../../library/threading.rst:560 msgid "" "The return value is ``True`` if the lock is acquired successfully, ``False`` " "if not (for example if the *timeout* expired)." msgstr "" +"如果成功取得鎖,則回傳值為 ``True``,否則回傳值為 ``False``\\ (例如像是 " +"*timeout* 已逾期)。" -#: ../../library/threading.rst:559 ../../library/threading.rst:670 -#: ../../library/threading.rst:917 +#: ../../library/threading.rst:563 ../../library/threading.rst:674 +#: ../../library/threading.rst:921 msgid "The *timeout* parameter is new." -msgstr "" +msgstr "新的 *timeout* 參數。" -#: ../../library/threading.rst:562 +#: ../../library/threading.rst:566 msgid "" "Lock acquisition can now be interrupted by signals on POSIX if the " "underlying threading implementation supports it." -msgstr "" +msgstr "如果底層執行緒實作支援的話,鎖的獲取現在可以被 POSIX 上的訊號中斷。" -#: ../../library/threading.rst:569 +#: ../../library/threading.rst:573 msgid "" "Release a lock. This can be called from any thread, not only the thread " "which has acquired the lock." -msgstr "" +msgstr "釋放鎖。這可以從任何執行緒呼叫,而不是只有獲得鎖的執行緒。" -#: ../../library/threading.rst:572 +#: ../../library/threading.rst:576 msgid "" "When the lock is locked, reset it to unlocked, and return. If any other " "threads are blocked waiting for the lock to become unlocked, allow exactly " "one of them to proceed." msgstr "" +"當鎖被鎖定時,將其重置為未鎖定然後回傳。如果任何其他執行緒在等待鎖被解鎖時被" +"阻塞,只允許其中一個執行緒繼續進行。" -#: ../../library/threading.rst:576 +#: ../../library/threading.rst:580 msgid "When invoked on an unlocked lock, a :exc:`RuntimeError` is raised." -msgstr "" +msgstr "當在未鎖定的鎖上調用時,會引發 :exc:`RuntimeError`" -#: ../../library/threading.rst:578 ../../library/threading.rst:686 +#: ../../library/threading.rst:582 ../../library/threading.rst:690 msgid "There is no return value." -msgstr "" +msgstr "沒有回傳值。" -#: ../../library/threading.rst:582 +#: ../../library/threading.rst:586 msgid "Return ``True`` if the lock is acquired." -msgstr "" +msgstr "如果有取得了鎖,則回傳 ``True``。" -#: ../../library/threading.rst:589 +#: ../../library/threading.rst:593 msgid "RLock Objects" msgstr "RLock 物件" -#: ../../library/threading.rst:591 +#: ../../library/threading.rst:595 msgid "" "A reentrant lock is a synchronization primitive that may be acquired " "multiple times by the same thread. Internally, it uses the concepts of " @@ -798,22 +836,31 @@ msgid "" "state used by primitive locks. In the locked state, some thread owns the " "lock; in the unlocked state, no thread owns it." msgstr "" +"可重入鎖 (reentrant lock) 是一種同步原語,同一執行緒可以多次取得它。在內部," +"除了原始鎖使用的鎖定/未鎖定狀態之外,它還使用「所屬執行緒 (owning thread)」和" +"「遞迴等級 (recursion level)」的概念。在鎖定狀態下,某個執行緒會擁有鎖;在未" +"鎖定狀態下則沒有執行緒擁有它。" -#: ../../library/threading.rst:597 +#: ../../library/threading.rst:601 msgid "" "Threads call a lock's :meth:`~RLock.acquire` method to lock it, and its :" "meth:`~Lock.release` method to unlock it." msgstr "" +"執行緒呼叫鎖的 :meth:`~RLock.acquire` 方法來鎖定它,並呼叫它的 :meth:`~Lock." +"release` 方法來解鎖它。" -#: ../../library/threading.rst:602 +#: ../../library/threading.rst:606 msgid "" "Reentrant locks support the :ref:`context management protocol `, " "so it is recommended to use :keyword:`with` instead of manually calling :" "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:607 +#: ../../library/threading.rst:611 msgid "" "RLock's :meth:`~RLock.acquire`/:meth:`~RLock.release` call pairs may be " "nested, unlike Lock's :meth:`~Lock.acquire`/:meth:`~Lock.release`. Only the " @@ -821,92 +868,115 @@ msgid "" "pair) resets the lock to an unlocked state and allows another thread blocked " "in :meth:`~RLock.acquire` to proceed." msgstr "" +"RLock 的 :meth:`~RLock.acquire`/:meth:`~RLock.release` 呼叫成對組合可以嵌套使" +"用,這與 Lock 的 :meth:`~Lock.acquire`/:meth:`~Lock.release` 不同。只有最後一" +"個 :meth:`~RLock.release`\\ (最外面一對的 :meth:`~Lock.release`)會將鎖重置" +"為未鎖定狀態,並允許在 :meth:`~RLock.acquire` 中阻塞的另一個執行緒繼續進行。" -#: ../../library/threading.rst:613 +#: ../../library/threading.rst:617 msgid "" ":meth:`~RLock.acquire`/:meth:`~RLock.release` must be used in pairs: each " "acquire must have a release in the thread that has acquired the lock. " "Failing to call release as many times the lock has been acquired can lead to " "deadlock." msgstr "" +":meth:`~RLock.acquire`/:meth:`~RLock.release` 必須成對使用:每次獲得都必須在" +"已獲得鎖的執行緒中有一個釋放。如果鎖釋放的次數不能和獲取的次數一樣的話,可能" +"會導致死鎖 (deadlock)。" -#: ../../library/threading.rst:620 +#: ../../library/threading.rst:624 msgid "" "This class implements reentrant lock objects. A reentrant lock must be " "released by the thread that acquired it. Once a thread has acquired a " "reentrant lock, the same thread may acquire it again without blocking; the " "thread must release it once for each time it has acquired it." msgstr "" +"此類別實作了可重入鎖物件。可重入鎖必須由獲得它的執行緒釋放。一旦一個執行緒獲" +"得了可重入鎖,同一個執行緒可以再次獲得它而不會阻塞;執行緒每次獲得它也都必須" +"釋放它一次。" -#: ../../library/threading.rst:625 +#: ../../library/threading.rst:629 msgid "" "Note that ``RLock`` is actually a factory function which returns an instance " "of the most efficient version of the concrete RLock class that is supported " "by the platform." msgstr "" +"請注意,``RLock`` 實際上是一個工廠函式,它會回傳平台有支援的特定 RLock 類別的" +"最高效率版本的實例。" -#: ../../library/threading.rst:636 +#: ../../library/threading.rst:640 msgid ":ref:`Using RLock as a context manager `" -msgstr "" +msgstr ":ref:`將 RLock 用作為情境管理器 `" -#: ../../library/threading.rst:637 +#: ../../library/threading.rst:641 msgid "" "Recommended over manual :meth:`!acquire` and :meth:`release` calls whenever " "practical." msgstr "" +"若是使用場景合理,和手動呼叫 :meth:`!acquire` 和 :meth:`release` 相比,會是更" +"為推薦的使用方式。" -#: ../../library/threading.rst:641 +#: ../../library/threading.rst:645 msgid "" "When invoked with the *blocking* argument set to ``True`` (the default):" -msgstr "" +msgstr "當以 *blocking* 引數設為 ``True``\\ (預設值)來調用:" -#: ../../library/threading.rst:643 ../../library/threading.rst:655 +#: ../../library/threading.rst:647 ../../library/threading.rst:659 msgid "If no thread owns the lock, acquire the lock and return immediately." -msgstr "" +msgstr "如果沒有執行緒擁有鎖,則獲得鎖並立即回傳。" -#: ../../library/threading.rst:645 +#: ../../library/threading.rst:649 msgid "" "If another thread owns the lock, block until we are able to acquire lock, or " "*timeout*, if set to a positive float value." msgstr "" +"如果另一個執行緒擁有鎖,則阻塞直到能夠取得鎖,或者達到 *timeout*\\ (如果設定" +"為正浮點值)。" -#: ../../library/threading.rst:648 +#: ../../library/threading.rst:652 msgid "" "If the same thread owns the lock, acquire the lock again, and return " "immediately. This is the difference between :class:`Lock` and :class:`!" "RLock`; :class:`Lock` handles this case the same as the previous, blocking " "until the lock can be acquired." msgstr "" +"如果同一個執行緒擁有鎖,則再次取得鎖,並立即回傳。這就是 :class:`Lock` 和 :" +"class:`!RLock` 之間的差別;:class:`Lock` 處理方式與上一種情況相同,會阻塞直到" +"能夠取得鎖。" -#: ../../library/threading.rst:653 +#: ../../library/threading.rst:657 msgid "When invoked with the *blocking* argument set to ``False``:" -msgstr "" +msgstr "當以 *blocking* 引數設為 ``False`` 來調用:" -#: ../../library/threading.rst:657 +#: ../../library/threading.rst:661 msgid "If another thread owns the lock, return immediately." -msgstr "" +msgstr "如果另一個執行緒擁有該鎖,則立即回傳。" -#: ../../library/threading.rst:659 +#: ../../library/threading.rst:663 msgid "" "If the same thread owns the lock, acquire the lock again and return " "immediately." -msgstr "" +msgstr "如果同一個執行緒擁有鎖,則再次取得鎖並立即回傳。" -#: ../../library/threading.rst:662 +#: ../../library/threading.rst:666 msgid "" "In all cases, if the thread was able to acquire the lock, return ``True``. " "If the thread was unable to acquire the lock (i.e. if not blocking or the " "timeout was reached) return ``False``." msgstr "" +"在所有情況下,如果執行緒能夠取得鎖則回傳 ``True``。如果執行緒無法取得鎖(即沒" +"有阻塞或已達超時限制)則回傳 ``False``。" -#: ../../library/threading.rst:666 +#: ../../library/threading.rst:670 msgid "" "If called multiple times, failing to call :meth:`~RLock.release` as many " "times may lead to deadlock. Consider using :class:`!RLock` as a context " "manager rather than calling acquire/release directly." msgstr "" +"如果多次呼叫,又未能呼叫相同次數的 :meth:`~RLock.release`,則可能會導致死鎖。" +"考慮將 :class:`!RLock` 作為情境管理器使用,而不是直接呼叫 acquire/release。" -#: ../../library/threading.rst:676 +#: ../../library/threading.rst:680 msgid "" "Release a lock, decrementing the recursion level. If after the decrement it " "is zero, reset the lock to unlocked (not owned by any thread), and if any " @@ -914,19 +984,24 @@ msgid "" "exactly one of them to proceed. If after the decrement the recursion level " "is still nonzero, the lock remains locked and owned by the calling thread." msgstr "" +"釋放鎖並減少遞迴等級。如果被減至零,則將鎖重置為未鎖定(不屬於任何執行緒)," +"並且如果任何其他執行緒被阻塞以等待鎖變成未鎖定狀態,則僅允許其中一個執行緒繼" +"續進行。如果遞減後遞迴等級仍然非零,則鎖會保持鎖定並由呼叫它的執行緒所擁有。" -#: ../../library/threading.rst:682 +#: ../../library/threading.rst:686 msgid "" "Only call this method when the calling thread owns the lock. A :exc:" "`RuntimeError` is raised if this method is called when the lock is not " "acquired." msgstr "" +"僅當呼叫的執行緒擁有鎖時才能呼叫此方法。如果在未取得鎖時呼叫此方法則會引發 :" +"exc:`RuntimeError`。" -#: ../../library/threading.rst:692 +#: ../../library/threading.rst:696 msgid "Condition Objects" msgstr "" -#: ../../library/threading.rst:694 +#: ../../library/threading.rst:698 msgid "" "A condition variable is always associated with some kind of lock; this can " "be passed in or one will be created by default. Passing one in is useful " @@ -934,7 +1009,7 @@ msgid "" "of the condition object: you don't have to track it separately." msgstr "" -#: ../../library/threading.rst:699 +#: ../../library/threading.rst:703 msgid "" "A condition variable obeys the :ref:`context management protocol `: using the ``with`` statement acquires the associated lock for the " @@ -943,7 +1018,7 @@ msgid "" "associated lock." msgstr "" -#: ../../library/threading.rst:705 +#: ../../library/threading.rst:709 msgid "" "Other methods must be called with the associated lock held. The :meth:" "`~Condition.wait` method releases the lock, and then blocks until another " @@ -952,14 +1027,14 @@ msgid "" "and returns. It is also possible to specify a timeout." msgstr "" -#: ../../library/threading.rst:711 +#: ../../library/threading.rst:715 msgid "" "The :meth:`~Condition.notify` method wakes up one of the threads waiting for " "the condition variable, if any are waiting. The :meth:`~Condition." "notify_all` method wakes up all threads waiting for the condition variable." msgstr "" -#: ../../library/threading.rst:715 +#: ../../library/threading.rst:719 msgid "" "Note: the :meth:`~Condition.notify` and :meth:`~Condition.notify_all` " "methods don't release the lock; this means that the thread or threads " @@ -968,7 +1043,7 @@ msgid "" "or :meth:`~Condition.notify_all` finally relinquishes ownership of the lock." msgstr "" -#: ../../library/threading.rst:721 +#: ../../library/threading.rst:725 msgid "" "The typical programming style using condition variables uses the lock to " "synchronize access to some shared state; threads that are interested in a " @@ -980,7 +1055,7 @@ msgid "" "situation with unlimited buffer capacity::" msgstr "" -#: ../../library/threading.rst:730 +#: ../../library/threading.rst:734 msgid "" "# Consume one item\n" "with cv:\n" @@ -994,7 +1069,7 @@ msgid "" " cv.notify()" msgstr "" -#: ../../library/threading.rst:741 +#: ../../library/threading.rst:745 msgid "" "The ``while`` loop checking for the application's condition is necessary " "because :meth:`~Condition.wait` can return after an arbitrary long time, and " @@ -1004,7 +1079,7 @@ msgid "" "checking, and eases the computation of timeouts::" msgstr "" -#: ../../library/threading.rst:748 +#: ../../library/threading.rst:752 msgid "" "# Consume an item\n" "with cv:\n" @@ -1012,7 +1087,7 @@ msgid "" " get_an_available_item()" msgstr "" -#: ../../library/threading.rst:753 +#: ../../library/threading.rst:757 msgid "" "To choose between :meth:`~Condition.notify` and :meth:`~Condition." "notify_all`, consider whether one state change can be interesting for only " @@ -1021,45 +1096,45 @@ msgid "" "thread." msgstr "" -#: ../../library/threading.rst:761 +#: ../../library/threading.rst:765 msgid "" "This class implements condition variable objects. A condition variable " "allows one or more threads to wait until they are notified by another thread." msgstr "" -#: ../../library/threading.rst:764 +#: ../../library/threading.rst:768 msgid "" "If the *lock* argument is given and not ``None``, it must be a :class:`Lock` " "or :class:`RLock` object, and it is used as the underlying lock. Otherwise, " "a new :class:`RLock` object is created and used as the underlying lock." msgstr "" -#: ../../library/threading.rst:768 ../../library/threading.rst:892 -#: ../../library/threading.rst:938 ../../library/threading.rst:990 -#: ../../library/threading.rst:1058 +#: ../../library/threading.rst:772 ../../library/threading.rst:896 +#: ../../library/threading.rst:942 ../../library/threading.rst:994 +#: ../../library/threading.rst:1062 msgid "changed from a factory function to a class." msgstr "" -#: ../../library/threading.rst:773 +#: ../../library/threading.rst:777 msgid "" "Acquire the underlying lock. This method calls the corresponding method on " "the underlying lock; the return value is whatever that method returns." msgstr "" -#: ../../library/threading.rst:778 +#: ../../library/threading.rst:782 msgid "" "Release the underlying lock. This method calls the corresponding method on " "the underlying lock; there is no return value." msgstr "" -#: ../../library/threading.rst:783 +#: ../../library/threading.rst:787 msgid "" "Wait until notified or until a timeout occurs. If the calling thread has not " "acquired the lock when this method is called, a :exc:`RuntimeError` is " "raised." msgstr "" -#: ../../library/threading.rst:787 +#: ../../library/threading.rst:791 msgid "" "This method releases the underlying lock, and then blocks until it is " "awakened by a :meth:`notify` or :meth:`notify_all` call for the same " @@ -1067,14 +1142,14 @@ msgid "" "Once awakened or timed out, it re-acquires the lock and returns." msgstr "" -#: ../../library/threading.rst:792 +#: ../../library/threading.rst:796 msgid "" "When the *timeout* argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds (or " "fractions thereof)." msgstr "" -#: ../../library/threading.rst:796 +#: ../../library/threading.rst:800 msgid "" "When the underlying lock is an :class:`RLock`, it is not released using its :" "meth:`release` method, since this may not actually unlock the lock when it " @@ -1084,24 +1159,24 @@ msgid "" "used to restore the recursion level when the lock is reacquired." msgstr "" -#: ../../library/threading.rst:804 +#: ../../library/threading.rst:808 msgid "" "The return value is ``True`` unless a given *timeout* expired, in which case " "it is ``False``." msgstr "" -#: ../../library/threading.rst:807 ../../library/threading.rst:1023 +#: ../../library/threading.rst:811 ../../library/threading.rst:1027 msgid "Previously, the method always returned ``None``." msgstr "" -#: ../../library/threading.rst:812 +#: ../../library/threading.rst:816 msgid "" "Wait until a condition evaluates to true. *predicate* should be a callable " "which result will be interpreted as a boolean value. A *timeout* may be " "provided giving the maximum time to wait." msgstr "" -#: ../../library/threading.rst:816 +#: ../../library/threading.rst:820 msgid "" "This utility method may call :meth:`wait` repeatedly until the predicate is " "satisfied, or until a timeout occurs. The return value is the last return " @@ -1109,13 +1184,13 @@ msgid "" "out." msgstr "" -#: ../../library/threading.rst:821 +#: ../../library/threading.rst:825 msgid "" "Ignoring the timeout feature, calling this method is roughly equivalent to " "writing::" msgstr "" -#: ../../library/threading.rst:824 +#: ../../library/threading.rst:828 msgid "" "while not predicate():\n" " cv.wait()" @@ -1123,27 +1198,27 @@ msgstr "" "while not predicate():\n" " cv.wait()" -#: ../../library/threading.rst:827 +#: ../../library/threading.rst:831 msgid "" "Therefore, the same rules apply as with :meth:`wait`: The lock must be held " "when called and is re-acquired on return. The predicate is evaluated with " "the lock held." msgstr "" -#: ../../library/threading.rst:835 +#: ../../library/threading.rst:839 msgid "" "By default, wake up one thread waiting on this condition, if any. If the " "calling thread has not acquired the lock when this method is called, a :exc:" "`RuntimeError` is raised." msgstr "" -#: ../../library/threading.rst:839 +#: ../../library/threading.rst:843 msgid "" "This method wakes up at most *n* of the threads waiting for the condition " "variable; it is a no-op if no threads are waiting." msgstr "" -#: ../../library/threading.rst:842 +#: ../../library/threading.rst:846 msgid "" "The current implementation wakes up exactly *n* threads, if at least *n* " "threads are waiting. However, it's not safe to rely on this behavior. A " @@ -1151,14 +1226,14 @@ msgid "" "threads." msgstr "" -#: ../../library/threading.rst:847 +#: ../../library/threading.rst:851 msgid "" "Note: an awakened thread does not actually return from its :meth:`wait` call " "until it can reacquire the lock. Since :meth:`notify` does not release the " "lock, its caller should." msgstr "" -#: ../../library/threading.rst:853 +#: ../../library/threading.rst:857 msgid "" "Wake up all threads waiting on this condition. This method acts like :meth:" "`notify`, but wakes up all waiting threads instead of one. If the calling " @@ -1166,15 +1241,15 @@ msgid "" "`RuntimeError` is raised." msgstr "" -#: ../../library/threading.rst:858 +#: ../../library/threading.rst:862 msgid "The method ``notifyAll`` is a deprecated alias for this method." msgstr "" -#: ../../library/threading.rst:864 +#: ../../library/threading.rst:868 msgid "Semaphore Objects" msgstr "" -#: ../../library/threading.rst:866 +#: ../../library/threading.rst:870 msgid "" "This is one of the oldest synchronization primitives in the history of " "computer science, invented by the early Dutch computer scientist Edsger W. " @@ -1182,7 +1257,7 @@ msgid "" "acquire` and :meth:`~Semaphore.release`)." msgstr "" -#: ../../library/threading.rst:871 +#: ../../library/threading.rst:875 msgid "" "A semaphore manages an internal counter which is decremented by each :meth:" "`~Semaphore.acquire` call and incremented by each :meth:`~Semaphore.release` " @@ -1191,12 +1266,12 @@ msgid "" "meth:`~Semaphore.release`." msgstr "" -#: ../../library/threading.rst:877 +#: ../../library/threading.rst:881 msgid "" "Semaphores also support the :ref:`context management protocol `." msgstr "" -#: ../../library/threading.rst:882 +#: ../../library/threading.rst:886 msgid "" "This class implements semaphore objects. A semaphore manages an atomic " "counter representing the number of :meth:`release` calls minus the number " @@ -1205,28 +1280,28 @@ msgid "" "If not given, *value* defaults to 1." msgstr "" -#: ../../library/threading.rst:888 +#: ../../library/threading.rst:892 msgid "" "The optional argument gives the initial *value* for the internal counter; it " "defaults to ``1``. If the *value* given is less than 0, :exc:`ValueError` is " "raised." msgstr "" -#: ../../library/threading.rst:897 +#: ../../library/threading.rst:901 msgid "Acquire a semaphore." msgstr "" -#: ../../library/threading.rst:899 +#: ../../library/threading.rst:903 msgid "When invoked without arguments:" msgstr "" -#: ../../library/threading.rst:901 +#: ../../library/threading.rst:905 msgid "" "If the internal counter is larger than zero on entry, decrement it by one " "and return ``True`` immediately." msgstr "" -#: ../../library/threading.rst:903 +#: ../../library/threading.rst:907 msgid "" "If the internal counter is zero on entry, block until awoken by a call to :" "meth:`~Semaphore.release`. Once awoken (and the counter is greater than 0), " @@ -1235,32 +1310,32 @@ msgid "" "threads are awoken should not be relied on." msgstr "" -#: ../../library/threading.rst:909 +#: ../../library/threading.rst:913 msgid "" "When invoked with *blocking* set to ``False``, do not block. If a call " "without an argument would block, return ``False`` immediately; otherwise, do " "the same thing as when called without arguments, and return ``True``." msgstr "" -#: ../../library/threading.rst:913 +#: ../../library/threading.rst:917 msgid "" "When invoked with a *timeout* other than ``None``, it will block for at most " "*timeout* seconds. If acquire does not complete successfully in that " "interval, return ``False``. Return ``True`` otherwise." msgstr "" -#: ../../library/threading.rst:922 +#: ../../library/threading.rst:926 msgid "" "Release a semaphore, incrementing the internal counter by *n*. When it was " "zero on entry and other threads are waiting for it to become larger than " "zero again, wake up *n* of those threads." msgstr "" -#: ../../library/threading.rst:926 +#: ../../library/threading.rst:930 msgid "Added the *n* parameter to release multiple waiting threads at once." msgstr "" -#: ../../library/threading.rst:932 +#: ../../library/threading.rst:936 msgid "" "Class implementing bounded semaphore objects. A bounded semaphore checks to " "make sure its current value doesn't exceed its initial value. If it does, :" @@ -1269,11 +1344,11 @@ msgid "" "times it's a sign of a bug. If not given, *value* defaults to 1." msgstr "" -#: ../../library/threading.rst:945 +#: ../../library/threading.rst:949 msgid ":class:`Semaphore` Example" msgstr ":class:`Semaphore` 範例" -#: ../../library/threading.rst:947 +#: ../../library/threading.rst:951 msgid "" "Semaphores are often used to guard resources with limited capacity, for " "example, a database server. In any situation where the size of the resource " @@ -1281,7 +1356,7 @@ msgid "" "threads, your main thread would initialize the semaphore::" msgstr "" -#: ../../library/threading.rst:952 +#: ../../library/threading.rst:956 msgid "" "maxconnections = 5\n" "# ...\n" @@ -1291,13 +1366,13 @@ msgstr "" "# ...\n" "pool_sema = BoundedSemaphore(value=maxconnections)" -#: ../../library/threading.rst:956 +#: ../../library/threading.rst:960 msgid "" "Once spawned, worker threads call the semaphore's acquire and release " "methods when they need to connect to the server::" msgstr "" -#: ../../library/threading.rst:959 +#: ../../library/threading.rst:963 msgid "" "with pool_sema:\n" " conn = connectdb()\n" @@ -1313,31 +1388,31 @@ msgstr "" " finally:\n" " conn.close()" -#: ../../library/threading.rst:966 +#: ../../library/threading.rst:970 msgid "" "The use of a bounded semaphore reduces the chance that a programming error " "which causes the semaphore to be released more than it's acquired will go " "undetected." msgstr "" -#: ../../library/threading.rst:973 +#: ../../library/threading.rst:977 msgid "Event Objects" msgstr "" -#: ../../library/threading.rst:975 +#: ../../library/threading.rst:979 msgid "" "This is one of the simplest mechanisms for communication between threads: " "one thread signals an event and other threads wait for it." msgstr "" -#: ../../library/threading.rst:978 +#: ../../library/threading.rst:982 msgid "" "An event object manages an internal flag that can be set to true with the :" "meth:`~Event.set` method and reset to false with the :meth:`~Event.clear` " "method. The :meth:`~Event.wait` method blocks until the flag is true." msgstr "" -#: ../../library/threading.rst:985 +#: ../../library/threading.rst:989 msgid "" "Class implementing event objects. An event manages a flag that can be set " "to true with the :meth:`~Event.set` method and reset to false with the :meth:" @@ -1345,29 +1420,29 @@ msgid "" "flag is initially false." msgstr "" -#: ../../library/threading.rst:995 +#: ../../library/threading.rst:999 msgid "Return ``True`` if and only if the internal flag is true." msgstr "" -#: ../../library/threading.rst:997 +#: ../../library/threading.rst:1001 msgid "The method ``isSet`` is a deprecated alias for this method." msgstr "" -#: ../../library/threading.rst:1001 +#: ../../library/threading.rst:1005 msgid "" "Set the internal flag to true. All threads waiting for it to become true are " "awakened. Threads that call :meth:`wait` once the flag is true will not " "block at all." msgstr "" -#: ../../library/threading.rst:1007 +#: ../../library/threading.rst:1011 msgid "" "Reset the internal flag to false. Subsequently, threads calling :meth:`wait` " "will block until :meth:`.set` is called to set the internal flag to true " "again." msgstr "" -#: ../../library/threading.rst:1013 +#: ../../library/threading.rst:1017 msgid "" "Block as long as the internal flag is false and the timeout, if given, has " "not expired. The return value represents the reason that this blocking " @@ -1376,18 +1451,18 @@ msgid "" "become true within the given wait time." msgstr "" -#: ../../library/threading.rst:1019 +#: ../../library/threading.rst:1023 msgid "" "When the timeout argument is present and not ``None``, it should be a " "floating-point number specifying a timeout for the operation in seconds, or " "fractions thereof." msgstr "" -#: ../../library/threading.rst:1030 +#: ../../library/threading.rst:1034 msgid "Timer Objects" msgstr "" -#: ../../library/threading.rst:1032 +#: ../../library/threading.rst:1036 msgid "" "This class represents an action that should be run only after a certain " "amount of time has passed --- a timer. :class:`Timer` is a subclass of :" @@ -1395,7 +1470,7 @@ msgid "" "threads." msgstr "" -#: ../../library/threading.rst:1036 +#: ../../library/threading.rst:1040 msgid "" "Timers are started, as with threads, by calling their :meth:`Timer.start " "` method. The timer can be stopped (before its action has " @@ -1404,11 +1479,11 @@ msgid "" "interval specified by the user." msgstr "" -#: ../../library/threading.rst:1042 +#: ../../library/threading.rst:1046 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/threading.rst:1044 +#: ../../library/threading.rst:1048 msgid "" "def hello():\n" " print(\"hello, world\")\n" @@ -1422,7 +1497,7 @@ msgstr "" "t = Timer(30.0, hello)\n" "t.start() # 30 秒後會印出 \"hello, world\"" -#: ../../library/threading.rst:1053 +#: ../../library/threading.rst:1057 msgid "" "Create a timer that will run *function* with arguments *args* and keyword " "arguments *kwargs*, after *interval* seconds have passed. If *args* is " @@ -1430,17 +1505,17 @@ msgid "" "``None`` (the default) then an empty dict will be used." msgstr "" -#: ../../library/threading.rst:1063 +#: ../../library/threading.rst:1067 msgid "" "Stop the timer, and cancel the execution of the timer's action. This will " "only work if the timer is still in its waiting stage." msgstr "" -#: ../../library/threading.rst:1068 +#: ../../library/threading.rst:1072 msgid "Barrier Objects" msgstr "" -#: ../../library/threading.rst:1072 +#: ../../library/threading.rst:1076 msgid "" "This class provides a simple synchronization primitive for use by a fixed " "number of threads that need to wait for each other. Each of the threads " @@ -1449,18 +1524,18 @@ msgid "" "calls. At this point, the threads are released simultaneously." msgstr "" -#: ../../library/threading.rst:1078 +#: ../../library/threading.rst:1082 msgid "" "The barrier can be reused any number of times for the same number of threads." msgstr "" -#: ../../library/threading.rst:1080 +#: ../../library/threading.rst:1084 msgid "" "As an example, here is a simple way to synchronize a client and server " "thread::" msgstr "" -#: ../../library/threading.rst:1082 +#: ../../library/threading.rst:1086 msgid "" "b = Barrier(2, timeout=5)\n" "\n" @@ -1492,7 +1567,7 @@ msgstr "" " connection = make_connection()\n" " process_client_connection(connection)" -#: ../../library/threading.rst:1100 +#: ../../library/threading.rst:1104 msgid "" "Create a barrier object for *parties* number of threads. An *action*, when " "provided, is a callable to be called by one of the threads when they are " @@ -1500,7 +1575,7 @@ msgid "" "the :meth:`wait` method." msgstr "" -#: ../../library/threading.rst:1107 +#: ../../library/threading.rst:1111 msgid "" "Pass the barrier. When all the threads party to the barrier have called " "this function, they are all released simultaneously. If a *timeout* is " @@ -1508,14 +1583,14 @@ msgid "" "constructor." msgstr "" -#: ../../library/threading.rst:1112 +#: ../../library/threading.rst:1116 msgid "" "The return value is an integer in the range 0 to *parties* -- 1, different " "for each thread. This can be used to select a thread to do some special " "housekeeping, e.g.::" msgstr "" -#: ../../library/threading.rst:1116 +#: ../../library/threading.rst:1120 msgid "" "i = barrier.wait()\n" "if i == 0:\n" @@ -1527,37 +1602,37 @@ msgstr "" " # 只會有一個執行緒會印出這個\n" " print(\"passed the barrier\")" -#: ../../library/threading.rst:1121 +#: ../../library/threading.rst:1125 msgid "" "If an *action* was provided to the constructor, one of the threads will have " "called it prior to being released. Should this call raise an error, the " "barrier is put into the broken state." msgstr "" -#: ../../library/threading.rst:1125 +#: ../../library/threading.rst:1129 msgid "If the call times out, the barrier is put into the broken state." msgstr "" -#: ../../library/threading.rst:1127 +#: ../../library/threading.rst:1131 msgid "" "This method may raise a :class:`BrokenBarrierError` exception if the barrier " "is broken or reset while a thread is waiting." msgstr "" -#: ../../library/threading.rst:1132 +#: ../../library/threading.rst:1136 msgid "" "Return the barrier to the default, empty state. Any threads waiting on it " "will receive the :class:`BrokenBarrierError` exception." msgstr "" -#: ../../library/threading.rst:1135 +#: ../../library/threading.rst:1139 msgid "" "Note that using this function may require some external synchronization if " "there are other threads whose state is unknown. If a barrier is broken it " "may be better to just leave it and create a new one." msgstr "" -#: ../../library/threading.rst:1141 +#: ../../library/threading.rst:1145 msgid "" "Put the barrier into a broken state. This causes any active or future calls " "to :meth:`wait` to fail with the :class:`BrokenBarrierError`. Use this for " @@ -1565,36 +1640,36 @@ msgid "" "application." msgstr "" -#: ../../library/threading.rst:1146 +#: ../../library/threading.rst:1150 msgid "" "It may be preferable to simply create the barrier with a sensible *timeout* " "value to automatically guard against one of the threads going awry." msgstr "" -#: ../../library/threading.rst:1152 +#: ../../library/threading.rst:1156 msgid "The number of threads required to pass the barrier." msgstr "" -#: ../../library/threading.rst:1156 +#: ../../library/threading.rst:1160 msgid "The number of threads currently waiting in the barrier." msgstr "" -#: ../../library/threading.rst:1160 +#: ../../library/threading.rst:1164 msgid "A boolean that is ``True`` if the barrier is in the broken state." msgstr "" -#: ../../library/threading.rst:1165 +#: ../../library/threading.rst:1169 msgid "" "This exception, a subclass of :exc:`RuntimeError`, is raised when the :class:" "`Barrier` object is reset or broken." msgstr "" -#: ../../library/threading.rst:1172 +#: ../../library/threading.rst:1176 msgid "" "Using locks, conditions, and semaphores in the :keyword:`!with` statement" msgstr "" -#: ../../library/threading.rst:1174 +#: ../../library/threading.rst:1178 msgid "" "All of the objects provided by this module that have ``acquire`` and " "``release`` methods can be used as context managers for a :keyword:`with` " @@ -1603,7 +1678,7 @@ msgid "" "following snippet::" msgstr "" -#: ../../library/threading.rst:1180 +#: ../../library/threading.rst:1184 msgid "" "with some_lock:\n" " # do something..." @@ -1611,11 +1686,11 @@ msgstr "" "with some_lock:\n" " # 做某些事情..." -#: ../../library/threading.rst:1183 +#: ../../library/threading.rst:1187 msgid "is equivalent to::" msgstr "" -#: ../../library/threading.rst:1185 +#: ../../library/threading.rst:1189 msgid "" "some_lock.acquire()\n" "try:\n" @@ -1629,21 +1704,21 @@ msgstr "" "finally:\n" " some_lock.release()" -#: ../../library/threading.rst:1191 +#: ../../library/threading.rst:1195 msgid "" "Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, :class:" "`Semaphore`, and :class:`BoundedSemaphore` objects may be used as :keyword:" "`with` statement context managers." msgstr "" -#: ../../library/threading.rst:155 ../../library/threading.rst:173 +#: ../../library/threading.rst:158 ../../library/threading.rst:176 msgid "trace function" msgstr "" -#: ../../library/threading.rst:173 +#: ../../library/threading.rst:176 msgid "debugger" msgstr "debugger(除錯器)" -#: ../../library/threading.rst:184 ../../library/threading.rst:202 +#: ../../library/threading.rst:187 ../../library/threading.rst:205 msgid "profile function" msgstr "" diff --git a/library/time.po b/library/time.po index 1262f3248e..a31807549b 100644 --- a/library/time.po +++ b/library/time.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2024-08-14 16:05+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -282,10 +282,9 @@ msgstr "" "參閱 :ref:`time-clock-id-constants`。" #: ../../library/time.rst:161 ../../library/time.rst:174 -#: ../../library/time.rst:183 ../../library/time.rst:196 -#: ../../library/time.rst:205 ../../library/time.rst:716 -#: ../../library/time.rst:833 ../../library/time.rst:852 -#: ../../library/time.rst:880 ../../library/time.rst:915 +#: ../../library/time.rst:183 ../../library/time.rst:745 +#: ../../library/time.rst:862 ../../library/time.rst:890 +#: ../../library/time.rst:918 ../../library/time.rst:962 msgid ":ref:`Availability `: Unix." msgstr ":ref:`適用 `:Unix。" @@ -324,6 +323,10 @@ msgid "" msgstr "" "使用 :func:`clock_settime_ns` 以避免 :class:`float` 型別造成的精確度損失。" +#: ../../library/time.rst:196 ../../library/time.rst:205 +msgid ":ref:`Availability `: Unix, not Android, not iOS." +msgstr ":ref:`適用 `:Unix、非 Android、非 iOS。" + #: ../../library/time.rst:203 msgid "Similar to :func:`clock_settime` but set time with nanoseconds." msgstr "類似於 :func:`clock_settime`,但設定以奈秒為單位的時間。" @@ -474,25 +477,51 @@ msgstr "" "示)。該時鐘不受系統時鐘更新的影響。回傳值的參考點沒有定義,因此只有兩次呼叫" "結果之間的差異才是有效的。" -#: ../../library/time.rst:290 +#: ../../library/time.rst:290 ../../library/time.rst:687 +msgid "Clock:" +msgstr "" + +#: ../../library/time.rst:292 +msgid "" +"On Windows, call ``QueryPerformanceCounter()`` and " +"``QueryPerformanceFrequency()``." +msgstr "" + +#: ../../library/time.rst:294 +msgid "On macOS, call ``mach_absolute_time()`` and ``mach_timebase_info()``." +msgstr "" + +#: ../../library/time.rst:295 +msgid "On HP-UX, call ``gethrtime()``." +msgstr "" + +#: ../../library/time.rst:296 +msgid "Call ``clock_gettime(CLOCK_HIGHRES)`` if available." +msgstr "" + +#: ../../library/time.rst:297 +msgid "Otherwise, call ``clock_gettime(CLOCK_MONOTONIC)``." +msgstr "" + +#: ../../library/time.rst:299 msgid "" "Use :func:`monotonic_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "使用 :func:`monotonic_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:295 +#: ../../library/time.rst:304 msgid "The function is now always available and always system-wide." msgstr "此函式現在始終可用且涵蓋整個系統。" -#: ../../library/time.rst:298 +#: ../../library/time.rst:307 msgid "On macOS, the function is now system-wide." msgstr "在 macOS 上,此函式現在涵蓋整個系統。" -#: ../../library/time.rst:304 +#: ../../library/time.rst:313 msgid "Similar to :func:`monotonic`, but return time as nanoseconds." msgstr "類似於 :func:`monotonic`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:313 +#: ../../library/time.rst:322 msgid "" "Return the value (in fractional seconds) of a performance counter, i.e. a " "clock with the highest available resolution to measure a short duration. It " @@ -504,22 +533,33 @@ msgstr "" "間隔的時鐘。它包括睡眠時經過的時間,並且涵蓋整個系統。回傳值的參考點沒有定" "義,因此只有兩次呼叫結果之間的差異才是有效的。" -#: ../../library/time.rst:319 +#: ../../library/time.rst:330 +msgid "" +"On CPython, use the same clock than :func:`time.monotonic` and is a " +"monotonic clock, i.e. a clock that cannot go backwards." +msgstr "" + +#: ../../library/time.rst:333 msgid "" "Use :func:`perf_counter_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" "使用 :func:`perf_counter_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:324 +#: ../../library/time.rst:338 msgid "On Windows, the function is now system-wide." msgstr "在 Windows 上,此函式現在涵蓋整個系統。" -#: ../../library/time.rst:329 +#: ../../library/time.rst:341 +#, fuzzy +msgid "Use the same clock than :func:`time.monotonic`." +msgstr "``'monotonic'``::func:`time.monotonic`" + +#: ../../library/time.rst:347 msgid "Similar to :func:`perf_counter`, but return time as nanoseconds." msgstr "類似於 :func:`perf_counter`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:341 +#: ../../library/time.rst:359 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current process. It does not include time elapsed during " @@ -531,18 +571,18 @@ msgstr "" "經過的時間。根據定義,它涵蓋整個行程。回傳值的參考點沒有定義,因此只有兩次呼" "叫結果之間的差異才是有效的。" -#: ../../library/time.rst:347 +#: ../../library/time.rst:365 msgid "" "Use :func:`process_time_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" "使用 :func:`process_time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:354 +#: ../../library/time.rst:372 msgid "Similar to :func:`process_time` but return time as nanoseconds." msgstr "類似於 :func:`process_time`,但回傳以奈秒為單位的時間。" -#: ../../library/time.rst:360 +#: ../../library/time.rst:378 msgid "" "Suspend execution of the calling thread for the given number of seconds. The " "argument may be a floating-point number to indicate a more precise sleep " @@ -551,7 +591,7 @@ msgstr "" "在一個給定的秒數內暫停呼叫執行緒 (calling thread) 的執行。引數可以是浮點數," "以表示更精確的睡眠時間。" -#: ../../library/time.rst:364 +#: ../../library/time.rst:382 msgid "" "If the sleep is interrupted by a signal and no exception is raised by the " "signal handler, the sleep is restarted with a recomputed timeout." @@ -559,13 +599,13 @@ msgstr "" "如果睡眠被訊號中斷且訊號處理器未引發例外,則睡眠將以重新計算過的逾時 " "(timeout) 重新開始。" -#: ../../library/time.rst:367 +#: ../../library/time.rst:385 msgid "" "The suspension time may be longer than requested by an arbitrary amount, " "because of the scheduling of other activity in the system." msgstr "由於系統中其他活動的調度,暫停時間可能會比請求的時間長任意的量。" -#: ../../library/time.rst:370 +#: ../../library/time.rst:388 msgid "" "On Windows, if *secs* is zero, the thread relinquishes the remainder of its " "time slice to any other thread that is ready to run. If there are no other " @@ -581,23 +621,29 @@ msgstr "" "docs.microsoft.com/en-us/windows-hardware/drivers/kernel/high-resolution-" "timers>`_,其解析度為 100 奈秒。如果 *secs* 為零,則使用 ``Sleep(0)``。" -#: ../../library/time.rst:378 +#: ../../library/time.rst:396 msgid "Unix implementation:" msgstr "Unix 實作:" -#: ../../library/time.rst:380 +#: ../../library/time.rst:398 msgid "Use ``clock_nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "如果可以,使用 ``clock_nanosleep()``\\ (解析度:1 奈秒);" -#: ../../library/time.rst:381 +#: ../../library/time.rst:399 msgid "Or use ``nanosleep()`` if available (resolution: 1 nanosecond);" msgstr "或者使用 ``nanosleep()``\\ (解析度:1 奈秒);" -#: ../../library/time.rst:382 +#: ../../library/time.rst:400 msgid "Or use ``select()`` (resolution: 1 microsecond)." msgstr "或使用 ``select()``\\ (解析度:1 微秒)。" -#: ../../library/time.rst:384 +#: ../../library/time.rst:402 +msgid "" +"Raises an :ref:`auditing event ` ``time.sleep`` with argument " +"``secs``." +msgstr "" + +#: ../../library/time.rst:404 msgid "" "The function now sleeps at least *secs* even if the sleep is interrupted by " "a signal, except if the signal handler raises an exception (see :pep:`475` " @@ -606,7 +652,7 @@ msgstr "" "即使睡眠被訊號中斷,此函式現在至少還是會睡眠 *secs*,除非訊號處理器引發例外" "(理由請參閱 :pep:`475`)。" -#: ../../library/time.rst:389 +#: ../../library/time.rst:409 msgid "" "On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now " "used if available. On Windows, a waitable timer is now used." @@ -614,7 +660,11 @@ msgstr "" "在 Unix 上,如果可以的話現在會使用 ``clock_nanosleep()`` 和 ``nanosleep()`` " "函式。在 Windows 上,現在使用可等待的計時器。" -#: ../../library/time.rst:398 +#: ../../library/time.rst:413 +msgid "Raises an auditing event." +msgstr "" + +#: ../../library/time.rst:421 msgid "" "Convert a tuple or :class:`struct_time` representing a time as returned by :" "func:`gmtime` or :func:`localtime` to a string as specified by the *format* " @@ -627,7 +677,7 @@ msgstr "" "func:`localtime` 回傳的當前時間。*format* 必須是一個字串。如果 *t* 中的任何欄" "位超出允許範圍,將會引發 :exc:`ValueError`。" -#: ../../library/time.rst:404 +#: ../../library/time.rst:427 msgid "" "0 is a legal argument for any position in the time tuple; if it is normally " "illegal the value is forced to a correct one." @@ -635,7 +685,7 @@ msgstr "" "0 在時間元組中的任何位置都是合法引數;如果元組中出現常見的錯誤,該值將被強制" "更改為正確的值。" -#: ../../library/time.rst:407 +#: ../../library/time.rst:430 msgid "" "The following directives can be embedded in the *format* string. They are " "shown without the optional field width and precision specification, and are " @@ -644,151 +694,151 @@ msgstr "" "以下指令可以嵌入在 *format* 字串中。它們顯示時不帶可選的欄位寬度和精度規範," "並在 :func:`strftime` 的結果中被標示的字元替換:" -#: ../../library/time.rst:412 +#: ../../library/time.rst:435 msgid "Directive" msgstr "指令" -#: ../../library/time.rst:412 +#: ../../library/time.rst:435 msgid "Meaning" msgstr "意義" -#: ../../library/time.rst:412 +#: ../../library/time.rst:435 msgid "Notes" msgstr "註解" -#: ../../library/time.rst:414 +#: ../../library/time.rst:437 msgid "``%a``" msgstr "``%a``" -#: ../../library/time.rst:414 +#: ../../library/time.rst:437 msgid "Locale's abbreviated weekday name." msgstr "區域設定的週間日 (weekday) 縮寫名稱。" -#: ../../library/time.rst:417 +#: ../../library/time.rst:440 msgid "``%A``" msgstr "``%A``" -#: ../../library/time.rst:417 +#: ../../library/time.rst:440 msgid "Locale's full weekday name." msgstr "區域設定的完整週間日名稱。" -#: ../../library/time.rst:419 +#: ../../library/time.rst:442 msgid "``%b``" msgstr "``%b``" -#: ../../library/time.rst:419 +#: ../../library/time.rst:442 msgid "Locale's abbreviated month name." msgstr "區域設定的縮寫月份名稱。" -#: ../../library/time.rst:422 +#: ../../library/time.rst:445 msgid "``%B``" msgstr "``%B``" -#: ../../library/time.rst:422 +#: ../../library/time.rst:445 msgid "Locale's full month name." msgstr "區域設定的完整月份名稱。" -#: ../../library/time.rst:424 +#: ../../library/time.rst:447 msgid "``%c``" msgstr "``%c``" -#: ../../library/time.rst:424 +#: ../../library/time.rst:447 msgid "Locale's appropriate date and time representation." msgstr "區域設定的合適的日期和時間的表示法。" -#: ../../library/time.rst:427 +#: ../../library/time.rst:450 msgid "``%d``" msgstr "``%d``" -#: ../../library/time.rst:427 +#: ../../library/time.rst:450 msgid "Day of the month as a decimal number [01,31]." msgstr "月份中的日期,表示為十進位數 [01,31]。" -#: ../../library/time.rst:430 +#: ../../library/time.rst:453 msgid "``%f``" msgstr "``%f``" -#: ../../library/time.rst:430 +#: ../../library/time.rst:453 msgid "Microseconds as a decimal number" msgstr "微秒,表示為十進位數" -#: ../../library/time.rst:431 +#: ../../library/time.rst:454 msgid "[000000,999999]." msgstr "[000000,999999]。" -#: ../../library/time.rst:430 +#: ../../library/time.rst:453 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/time.rst:434 +#: ../../library/time.rst:457 msgid "``%H``" msgstr "``%H``" -#: ../../library/time.rst:434 +#: ../../library/time.rst:457 msgid "Hour (24-hour clock) as a decimal number [00,23]." msgstr "小時(24 小時制),表示為十進位數 [00,23]。" -#: ../../library/time.rst:437 +#: ../../library/time.rst:460 msgid "``%I``" msgstr "``%I``" -#: ../../library/time.rst:437 +#: ../../library/time.rst:460 msgid "Hour (12-hour clock) as a decimal number [01,12]." msgstr "小時(12 小時制),表示為十進位數 [01,12]。" -#: ../../library/time.rst:440 +#: ../../library/time.rst:463 msgid "``%j``" msgstr "``%j``" -#: ../../library/time.rst:440 +#: ../../library/time.rst:463 msgid "Day of the year as a decimal number [001,366]." msgstr "一年中的第幾天,表示為十進位數 [001,366]。" -#: ../../library/time.rst:443 +#: ../../library/time.rst:466 msgid "``%m``" msgstr "``%m``" -#: ../../library/time.rst:443 +#: ../../library/time.rst:466 msgid "Month as a decimal number [01,12]." msgstr "月份,表示為十進位數 [01,12]。" -#: ../../library/time.rst:446 +#: ../../library/time.rst:469 msgid "``%M``" msgstr "``%M``" -#: ../../library/time.rst:446 +#: ../../library/time.rst:469 msgid "Minute as a decimal number [00,59]." msgstr "分鐘,表示為十進位數 [00,59]。" -#: ../../library/time.rst:449 +#: ../../library/time.rst:472 msgid "``%p``" msgstr "``%p``" -#: ../../library/time.rst:449 +#: ../../library/time.rst:472 msgid "Locale's equivalent of either AM or PM." msgstr "區域設定中相當於 AM 或 PM 的表示。" -#: ../../library/time.rst:449 +#: ../../library/time.rst:472 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/time.rst:452 +#: ../../library/time.rst:475 msgid "``%S``" msgstr "``%S``" -#: ../../library/time.rst:452 +#: ../../library/time.rst:475 msgid "Second as a decimal number [00,61]." msgstr "秒,表示為十進位數 [00,61]。" -#: ../../library/time.rst:452 +#: ../../library/time.rst:475 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/time.rst:455 +#: ../../library/time.rst:478 msgid "``%U``" msgstr "``%U``" -#: ../../library/time.rst:455 +#: ../../library/time.rst:478 msgid "" "Week number of the year (Sunday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Sunday are " @@ -797,23 +847,23 @@ msgstr "" "一年中的週數(星期天作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期天之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:455 ../../library/time.rst:466 +#: ../../library/time.rst:478 ../../library/time.rst:489 msgid "\\(4)" msgstr "\\(4)" -#: ../../library/time.rst:463 +#: ../../library/time.rst:486 msgid "``%w``" msgstr "``%w``" -#: ../../library/time.rst:463 +#: ../../library/time.rst:486 msgid "Weekday as a decimal number [0(Sunday),6]." msgstr "週間日,表示為十進位數 [0(星期天),6]。" -#: ../../library/time.rst:466 +#: ../../library/time.rst:489 msgid "``%W``" msgstr "``%W``" -#: ../../library/time.rst:466 +#: ../../library/time.rst:489 msgid "" "Week number of the year (Monday as the first day of the week) as a decimal " "number [00,53]. All days in a new year preceding the first Monday are " @@ -822,43 +872,43 @@ msgstr "" "一年中的週數(星期一作為一週的第一天),表示為十進位數 [00,53]。新的一年中," "在第一個星期一之前的所有日子都被認定為第 0 週。" -#: ../../library/time.rst:474 +#: ../../library/time.rst:497 msgid "``%x``" msgstr "``%x``" -#: ../../library/time.rst:474 +#: ../../library/time.rst:497 msgid "Locale's appropriate date representation." msgstr "區域設定的合適的日期表示法。" -#: ../../library/time.rst:477 +#: ../../library/time.rst:500 msgid "``%X``" msgstr "``%X``" -#: ../../library/time.rst:477 +#: ../../library/time.rst:500 msgid "Locale's appropriate time representation." msgstr "區域設定的合適的時間表示法。" -#: ../../library/time.rst:480 +#: ../../library/time.rst:503 msgid "``%y``" msgstr "``%y``" -#: ../../library/time.rst:480 +#: ../../library/time.rst:503 msgid "Year without century as a decimal number [00,99]." msgstr "去掉世紀的年份,表示為十進位數 [00,99]。" -#: ../../library/time.rst:483 +#: ../../library/time.rst:506 msgid "``%Y``" msgstr "``%Y``" -#: ../../library/time.rst:483 +#: ../../library/time.rst:506 msgid "Year with century as a decimal number." msgstr "帶世紀的年份,表示為十進位數。" -#: ../../library/time.rst:486 +#: ../../library/time.rst:509 msgid "``%z``" msgstr "``%z``" -#: ../../library/time.rst:486 +#: ../../library/time.rst:509 msgid "" "Time zone offset indicating a positive or negative time difference from UTC/" "GMT of the form +HHMM or -HHMM, where H represents decimal hour digits and M " @@ -867,27 +917,27 @@ msgstr "" "時區偏移量,表示與 UTC/GMT 的正或負時間差,形式為 +HHMM 或 -HHMM,其中 H 代表" "十進位的小時數碼 (digits),M 代表十進位的分鐘數碼 [-23:59, +23:59]。 [1]_" -#: ../../library/time.rst:492 +#: ../../library/time.rst:515 msgid "``%Z``" msgstr "``%Z``" -#: ../../library/time.rst:492 +#: ../../library/time.rst:515 msgid "Time zone name (no characters if no time zone exists). Deprecated. [1]_" msgstr "時區名稱(如果不存在時區,則無字元)。已被棄用。 [1]_" -#: ../../library/time.rst:495 +#: ../../library/time.rst:518 msgid "``%%``" msgstr "``%%``" -#: ../../library/time.rst:495 +#: ../../library/time.rst:518 msgid "A literal ``'%'`` character." msgstr "字面意義上的 ``'%'`` 字元。" -#: ../../library/time.rst:498 +#: ../../library/time.rst:521 msgid "Notes:" msgstr "註解:" -#: ../../library/time.rst:501 +#: ../../library/time.rst:524 msgid "" "The ``%f`` format directive only applies to :func:`strptime`, not to :func:" "`strftime`. However, see also :meth:`datetime.datetime.strptime` and :meth:" @@ -898,7 +948,7 @@ msgstr "" "在 :meth:`datetime.datetime.strptime` 和 :meth:`datetime.datetime.strftime` " "其中的 ``%f`` 格式的指令\\ :ref:`適用於微秒 `。" -#: ../../library/time.rst:507 +#: ../../library/time.rst:530 msgid "" "When used with the :func:`strptime` function, the ``%p`` directive only " "affects the output hour field if the ``%I`` directive is used to parse the " @@ -907,7 +957,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%p`` 指令僅在使用 ``%I`` 指令剖析小時" "時影響輸出小時的欄位。" -#: ../../library/time.rst:513 +#: ../../library/time.rst:536 msgid "" "The range really is ``0`` to ``61``; value ``60`` is valid in timestamps " "representing `leap seconds`_ and value ``61`` is supported for historical " @@ -916,7 +966,7 @@ msgstr "" "範圍確實是從 ``0`` 到 ``61``;數值 ``60`` 在表示 `leap seconds`_ 的時間戳中是" "有效的,而數值 ``61`` 是出於歷史因素而被支援。" -#: ../../library/time.rst:518 +#: ../../library/time.rst:541 msgid "" "When used with the :func:`strptime` function, ``%U`` and ``%W`` are only " "used in calculations when the day of the week and the year are specified." @@ -924,7 +974,7 @@ msgstr "" "當與 :func:`strptime` 函式一起使用時,``%U`` 和 ``%W`` 僅在指定週間的某天和年" "份時用於計算中。" -#: ../../library/time.rst:521 +#: ../../library/time.rst:544 msgid "" "Here is an example, a format for dates compatible with that specified in " "the :rfc:`2822` Internet email standard. [1]_ ::" @@ -932,7 +982,7 @@ msgstr "" "以下是一個範例,其為一種與 :rfc:`2822` 網際網路電子郵件標準中指定的日期格式兼" "容的格式。 [1]_: ::" -#: ../../library/time.rst:524 +#: ../../library/time.rst:547 msgid "" ">>> from time import gmtime, strftime\n" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" @@ -942,7 +992,7 @@ msgstr "" ">>> strftime(\"%a, %d %b %Y %H:%M:%S +0000\", gmtime())\n" "'Thu, 28 Jun 2001 14:17:15 +0000'" -#: ../../library/time.rst:528 +#: ../../library/time.rst:551 msgid "" "Additional directives may be supported on certain platforms, but only the " "ones listed here have a meaning standardized by ANSI C. To see the full set " @@ -952,7 +1002,7 @@ msgstr "" "某些平台可能支援額外的指令,但只有這裡列出的指令具有 ANSI C 標準化的意義。要" "查看你的平台上支援的完整格式碼集,請參閱 :manpage:`strftime(3)` 文件。" -#: ../../library/time.rst:533 +#: ../../library/time.rst:556 msgid "" "On some platforms, an optional field width and precision specification can " "immediately follow the initial ``'%'`` of a directive in the following " @@ -962,7 +1012,7 @@ msgstr "" "在某些平台上,可選的欄位寬度和精度規範可以以此順序緊跟在指令初始的 ``'%'`` 之" "後;這也是不可攜 (portable) 的。欄位寬度通常為 2,除了 ``%j`` 為 3。" -#: ../../library/time.rst:544 +#: ../../library/time.rst:567 msgid "" "Parse a string representing a time according to a format. The return value " "is a :class:`struct_time` as returned by :func:`gmtime` or :func:`localtime`." @@ -970,7 +1020,7 @@ msgstr "" "根據格式剖析表示時間的字串。回傳值是 :class:`struct_time`,如同由 :func:" "`gmtime` 或 :func:`localtime` 回傳的一樣。" -#: ../../library/time.rst:548 +#: ../../library/time.rst:571 msgid "" "The *format* parameter uses the same directives as those used by :func:" "`strftime`; it defaults to ``\"%a %b %d %H:%M:%S %Y\"`` which matches the " @@ -986,11 +1036,11 @@ msgstr "" "時,用來填充任何缺失資料的預設值為 ``(1900, 1, 1, 0, 0, 0, 0, 1, -1)``。" "*string* 和 *format* 都必須是字串。" -#: ../../library/time.rst:556 +#: ../../library/time.rst:579 msgid "For example:" msgstr "例如:" -#: ../../library/time.rst:563 +#: ../../library/time.rst:586 msgid "" "Support for the ``%Z`` directive is based on the values contained in " "``tzname`` and whether ``daylight`` is true. Because of this, it is " @@ -1001,7 +1051,7 @@ msgstr "" "因此,除了識別始終已知的 UTC 和 GMT(且被考慮為非日光節約時區)外,這是特定於" "平台的。" -#: ../../library/time.rst:568 +#: ../../library/time.rst:591 msgid "" "Only the directives specified in the documentation are supported. Because " "``strftime()`` is implemented per platform it can sometimes offer more " @@ -1013,7 +1063,7 @@ msgstr "" "提供比列出的還要更多的指令。但是 ``strptime()`` 與任何平台無關,因此不一定支" "援所有未記載為支援的指令。" -#: ../../library/time.rst:577 +#: ../../library/time.rst:600 msgid "" "The type of the time value sequence returned by :func:`gmtime`, :func:" "`localtime`, and :func:`strptime`. It is an object with a :term:`named " @@ -1024,110 +1074,110 @@ msgstr "" "別。它是一個具有 :term:`named tuple` 介面的物件:值可以通過索引和屬性名稱存" "取。包含以下值:" -#: ../../library/time.rst:584 +#: ../../library/time.rst:607 msgid "Index" msgstr "索引" -#: ../../library/time.rst:585 +#: ../../library/time.rst:608 msgid "Attribute" msgstr "屬性" -#: ../../library/time.rst:586 +#: ../../library/time.rst:609 msgid "Values" msgstr "值" -#: ../../library/time.rst:588 +#: ../../library/time.rst:611 msgid "0" msgstr "0" -#: ../../library/time.rst:590 +#: ../../library/time.rst:613 msgid "(for example, 1993)" msgstr "(例如 1993)" -#: ../../library/time.rst:592 +#: ../../library/time.rst:615 msgid "1" msgstr "1" -#: ../../library/time.rst:594 +#: ../../library/time.rst:617 msgid "range [1, 12]" msgstr "範圍 [1, 12]" -#: ../../library/time.rst:596 +#: ../../library/time.rst:619 msgid "2" msgstr "2" -#: ../../library/time.rst:598 +#: ../../library/time.rst:621 msgid "range [1, 31]" msgstr "範圍 [1, 31]" -#: ../../library/time.rst:600 +#: ../../library/time.rst:623 msgid "3" msgstr "3" -#: ../../library/time.rst:602 +#: ../../library/time.rst:625 msgid "range [0, 23]" msgstr "範圍 [0, 23]" -#: ../../library/time.rst:604 +#: ../../library/time.rst:627 msgid "4" msgstr "4" -#: ../../library/time.rst:606 +#: ../../library/time.rst:629 msgid "range [0, 59]" msgstr "範圍 [0, 59]" -#: ../../library/time.rst:608 +#: ../../library/time.rst:631 msgid "5" msgstr "5" -#: ../../library/time.rst:610 +#: ../../library/time.rst:633 msgid "range [0, 61]; see :ref:`Note (2) ` in :func:`strftime`" msgstr "" "範圍 [0, 61];參見 :func:`strftime` 中的\\ :ref:`註釋 (2) `" -#: ../../library/time.rst:612 +#: ../../library/time.rst:635 msgid "6" msgstr "6" -#: ../../library/time.rst:614 +#: ../../library/time.rst:637 msgid "range [0, 6]; Monday is 0" msgstr "範圍 [0, 6];星期一是 0" -#: ../../library/time.rst:616 +#: ../../library/time.rst:639 msgid "7" msgstr "7" -#: ../../library/time.rst:618 +#: ../../library/time.rst:641 msgid "range [1, 366]" msgstr "範圍 [1, 366]" -#: ../../library/time.rst:620 +#: ../../library/time.rst:643 msgid "8" msgstr "8" -#: ../../library/time.rst:622 +#: ../../library/time.rst:645 msgid "0, 1 or -1; see below" msgstr "0、1 或 -1;見下文" -#: ../../library/time.rst:624 ../../library/time.rst:628 +#: ../../library/time.rst:647 ../../library/time.rst:651 msgid "N/A" msgstr "N/A" -#: ../../library/time.rst:626 +#: ../../library/time.rst:649 msgid "abbreviation of timezone name" msgstr "時區名稱的縮寫" -#: ../../library/time.rst:630 +#: ../../library/time.rst:653 msgid "offset east of UTC in seconds" msgstr "UTC 向東的偏移量(以秒為單位)" -#: ../../library/time.rst:632 +#: ../../library/time.rst:655 msgid "" "Note that unlike the C structure, the month value is a range of [1, 12], not " "[0, 11]." msgstr "請注意,與 C 結構不同,月份值的範圍是 [1, 12],而不是 [0, 11]。" -#: ../../library/time.rst:635 +#: ../../library/time.rst:658 msgid "" "In calls to :func:`mktime`, :attr:`tm_isdst` may be set to 1 when daylight " "savings time is in effect, and 0 when it is not. A value of -1 indicates " @@ -1137,7 +1187,7 @@ msgstr "" "在呼叫 :func:`mktime` 時,當日光節約時間生效的時候,:attr:`tm_isdst` 可以設定" "為 1,不生效時設定為 0。值 -1 表示未知是否生效,通常結果會填入正確的狀態。" -#: ../../library/time.rst:639 +#: ../../library/time.rst:662 msgid "" "When a tuple with an incorrect length is passed to a function expecting a :" "class:`struct_time`, or having elements of the wrong type, a :exc:" @@ -1146,7 +1196,7 @@ msgstr "" "當一個長度不正確的元組被傳遞給預期得到 :class:`struct_time` 的函式時,或者其" "中有元素型別錯誤時,將引發 :exc:`TypeError`。" -#: ../../library/time.rst:645 +#: ../../library/time.rst:668 msgid "" "Return the time in seconds since the epoch_ as a floating-point number. The " "handling of `leap seconds`_ is platform dependent. On Windows and most Unix " @@ -1158,7 +1208,7 @@ msgstr "" "關的。在 Windows 和大多數 Unix 系統上,閏秒不計入自 epoch_ 起的秒數中。這通常" "被稱為 `Unix 時間 `_。" -#: ../../library/time.rst:651 +#: ../../library/time.rst:674 msgid "" "Note that even though the time is always returned as a floating-point " "number, not all systems provide time with a better precision than 1 second. " @@ -1170,7 +1220,7 @@ msgstr "" "間。雖然此函式通常回傳非遞減的值,但如果在兩次呼叫之間系統時鐘被回調,則它可" "能回傳比之前呼叫更小的值。" -#: ../../library/time.rst:657 +#: ../../library/time.rst:680 msgid "" "The number returned by :func:`.time` may be converted into a more common " "time format (i.e. year, month, day, hour, etc...) in UTC by passing it to :" @@ -1184,19 +1234,31 @@ msgstr "" "為當地時間。在這兩種情況下都會回傳一個 :class:`struct_time` 物件,從中可以作" "為屬性存取日曆日期的組成部分。" -#: ../../library/time.rst:664 +#: ../../library/time.rst:689 +msgid "On Windows, call ``GetSystemTimeAsFileTime()``." +msgstr "" + +#: ../../library/time.rst:690 +msgid "Call ``clock_gettime(CLOCK_REALTIME)`` if available." +msgstr "" + +#: ../../library/time.rst:691 +msgid "Otherwise, call ``gettimeofday()``." +msgstr "" + +#: ../../library/time.rst:693 msgid "" "Use :func:`time_ns` to avoid the precision loss caused by the :class:`float` " "type." msgstr "使用 :func:`time_ns` 以避免 :class:`float` 型別造成的精確度損失。" -#: ../../library/time.rst:670 +#: ../../library/time.rst:699 msgid "" "Similar to :func:`~time.time` but returns time as an integer number of " "nanoseconds since the epoch_." msgstr "類似於 :func:`~time.time`,但回傳自 epoch_ 起的以奈秒為單位的整數。" -#: ../../library/time.rst:683 +#: ../../library/time.rst:712 msgid "" "Return the value (in fractional seconds) of the sum of the system and user " "CPU time of the current thread. It does not include time elapsed during " @@ -1205,25 +1267,25 @@ msgid "" "of two calls in the same thread is valid." msgstr "" -#: ../../library/time.rst:689 +#: ../../library/time.rst:718 msgid "" "Use :func:`thread_time_ns` to avoid the precision loss caused by the :class:" "`float` type." msgstr "" -#: ../../library/time.rst:692 +#: ../../library/time.rst:721 msgid ":ref:`Availability `: Linux, Unix, Windows." msgstr ":ref:`適用 `:Linux、Unix、Windows。" -#: ../../library/time.rst:694 +#: ../../library/time.rst:723 msgid "Unix systems supporting ``CLOCK_THREAD_CPUTIME_ID``." msgstr "" -#: ../../library/time.rst:701 +#: ../../library/time.rst:730 msgid "Similar to :func:`thread_time` but return time as nanoseconds." msgstr "" -#: ../../library/time.rst:708 +#: ../../library/time.rst:737 msgid "" "Reset the time conversion rules used by the library routines. The " "environment variable :envvar:`TZ` specifies how this is done. It will also " @@ -1234,46 +1296,46 @@ msgid "" "when daylight saving time applies)." msgstr "" -#: ../../library/time.rst:720 +#: ../../library/time.rst:749 msgid "" "Although in many cases, changing the :envvar:`TZ` environment variable may " "affect the output of functions like :func:`localtime` without calling :func:" "`tzset`, this behavior should not be relied on." msgstr "" -#: ../../library/time.rst:724 +#: ../../library/time.rst:753 msgid "The :envvar:`TZ` environment variable should contain no whitespace." msgstr "" -#: ../../library/time.rst:726 +#: ../../library/time.rst:755 msgid "" "The standard format of the :envvar:`TZ` environment variable is (whitespace " "added for clarity)::" msgstr "" -#: ../../library/time.rst:729 +#: ../../library/time.rst:758 msgid "std offset [dst [offset [,start[/time], end[/time]]]]" msgstr "std offset [dst [offset [,start[/time], end[/time]]]]" -#: ../../library/time.rst:731 +#: ../../library/time.rst:760 msgid "Where the components are:" msgstr "" -#: ../../library/time.rst:733 +#: ../../library/time.rst:762 msgid "``std`` and ``dst``" msgstr "``std`` 和 ``dst``" -#: ../../library/time.rst:734 +#: ../../library/time.rst:763 msgid "" "Three or more alphanumerics giving the timezone abbreviations. These will be " "propagated into time.tzname" msgstr "" -#: ../../library/time.rst:737 +#: ../../library/time.rst:766 msgid "``offset``" msgstr "``offset``" -#: ../../library/time.rst:738 +#: ../../library/time.rst:767 msgid "" "The offset has the form: ``± hh[:mm[:ss]]``. This indicates the value added " "the local time to arrive at UTC. If preceded by a '-', the timezone is east " @@ -1281,41 +1343,41 @@ msgid "" "summer time is assumed to be one hour ahead of standard time." msgstr "" -#: ../../library/time.rst:743 +#: ../../library/time.rst:772 msgid "``start[/time], end[/time]``" msgstr "``start[/time], end[/time]``" -#: ../../library/time.rst:744 +#: ../../library/time.rst:773 msgid "" "Indicates when to change to and back from DST. The format of the start and " "end dates are one of the following:" msgstr "" -#: ../../library/time.rst:747 +#: ../../library/time.rst:776 msgid ":samp:`J{n}`" msgstr ":samp:`J{n}`" -#: ../../library/time.rst:748 +#: ../../library/time.rst:777 msgid "" "The Julian day *n* (1 <= *n* <= 365). Leap days are not counted, so in all " "years February 28 is day 59 and March 1 is day 60." msgstr "" -#: ../../library/time.rst:751 +#: ../../library/time.rst:780 msgid ":samp:`{n}`" msgstr ":samp:`{n}`" -#: ../../library/time.rst:752 +#: ../../library/time.rst:781 msgid "" "The zero-based Julian day (0 <= *n* <= 365). Leap days are counted, and it " "is possible to refer to February 29." msgstr "" -#: ../../library/time.rst:755 +#: ../../library/time.rst:784 msgid ":samp:`M{m}.{n}.{d}`" msgstr ":samp:`M{m}.{n}.{d}`" -#: ../../library/time.rst:756 +#: ../../library/time.rst:785 msgid "" "The *d*'th day (0 <= *d* <= 6) of week *n* of month *m* of the year (1 <= " "*n* <= 5, 1 <= *m* <= 12, where week 5 means \"the last *d* day in month " @@ -1323,13 +1385,13 @@ msgid "" "first week in which the *d*'th day occurs. Day zero is a Sunday." msgstr "" -#: ../../library/time.rst:762 +#: ../../library/time.rst:791 msgid "" "``time`` has the same format as ``offset`` except that no leading sign ('-' " "or '+') is allowed. The default, if time is not given, is 02:00:00." msgstr "" -#: ../../library/time.rst:767 +#: ../../library/time.rst:796 msgid "" ">>> os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'\n" ">>> time.tzset()\n" @@ -1349,7 +1411,7 @@ msgstr "" ">>> time.strftime('%X %x %Z')\n" "'16:08:12 05/08/03 AEST'" -#: ../../library/time.rst:776 +#: ../../library/time.rst:805 msgid "" "On many Unix systems (including \\*BSD, Linux, Solaris, and Darwin), it is " "more convenient to use the system's zoneinfo (:manpage:`tzfile(5)`) " @@ -1360,7 +1422,7 @@ msgid "" "``'Australia/Melbourne'``, ``'Egypt'`` or ``'Europe/Amsterdam'``. ::" msgstr "" -#: ../../library/time.rst:784 +#: ../../library/time.rst:813 msgid "" ">>> os.environ['TZ'] = 'US/Eastern'\n" ">>> time.tzset()\n" @@ -1372,23 +1434,23 @@ msgid "" "('EET', 'EEST')" msgstr "" -#: ../../library/time.rst:797 +#: ../../library/time.rst:826 msgid "Clock ID Constants" msgstr "" -#: ../../library/time.rst:799 +#: ../../library/time.rst:828 msgid "" "These constants are used as parameters for :func:`clock_getres` and :func:" "`clock_gettime`." msgstr "" -#: ../../library/time.rst:804 +#: ../../library/time.rst:833 msgid "" "Identical to :data:`CLOCK_MONOTONIC`, except it also includes any time that " "the system is suspended." msgstr "" -#: ../../library/time.rst:807 +#: ../../library/time.rst:836 msgid "" "This allows applications to get a suspend-aware monotonic clock without " "having to deal with the complications of :data:`CLOCK_REALTIME`, which may " @@ -1396,103 +1458,116 @@ msgid "" "similar." msgstr "" -#: ../../library/time.rst:812 +#: ../../library/time.rst:841 msgid ":ref:`Availability `: Linux >= 2.6.39." msgstr ":ref:`適用 `:Linux 2.6.39 以上。" -#: ../../library/time.rst:819 +#: ../../library/time.rst:848 msgid "" "The Solaris OS has a ``CLOCK_HIGHRES`` timer that attempts to use an optimal " "hardware source, and may give close to nanosecond resolution. " "``CLOCK_HIGHRES`` is the nonadjustable, high-resolution clock." msgstr "" -#: ../../library/time.rst:823 +#: ../../library/time.rst:852 msgid ":ref:`Availability `: Solaris." msgstr ":ref:`適用 `:Solaris。" -#: ../../library/time.rst:830 +#: ../../library/time.rst:859 msgid "" "Clock that cannot be set and represents monotonic time since some " "unspecified starting point." msgstr "" -#: ../../library/time.rst:840 +#: ../../library/time.rst:869 msgid "" "Similar to :data:`CLOCK_MONOTONIC`, but provides access to a raw hardware-" "based time that is not subject to NTP adjustments." msgstr "" -#: ../../library/time.rst:843 +#: ../../library/time.rst:872 msgid ":ref:`Availability `: Linux >= 2.6.28, macOS >= 10.12." msgstr ":ref:`適用 `:Linux 2.6.28 以上、macOS 10.12 以上。" -#: ../../library/time.rst:850 ../../library/time.rst:859 +#: ../../library/time.rst:878 +msgid "" +"Similar to :data:`CLOCK_MONOTONIC_RAW`, but reads a value cached by the " +"system at context switch and hence has less accuracy." +msgstr "" + +#: ../../library/time.rst:881 ../../library/time.rst:940 +#: ../../library/time.rst:949 +msgid ":ref:`Availability `: macOS >= 10.12." +msgstr ":ref:`適用 `:macOS 10.12 以上。" + +#: ../../library/time.rst:888 ../../library/time.rst:897 msgid "High-resolution per-process timer from the CPU." msgstr "" -#: ../../library/time.rst:861 +#: ../../library/time.rst:899 msgid ":ref:`Availability `: FreeBSD, NetBSD >= 7, OpenBSD." msgstr ":ref:`適用 `:FreeBSD、NetBSD 7 以上、OpenBSD。" -#: ../../library/time.rst:867 +#: ../../library/time.rst:905 msgid "" "`International Atomic Time `_" msgstr "" -#: ../../library/time.rst:869 +#: ../../library/time.rst:907 msgid "" "The system must have a current leap second table in order for this to give " "the correct answer. PTP or NTP software can maintain a leap second table." msgstr "" -#: ../../library/time.rst:872 +#: ../../library/time.rst:910 msgid ":ref:`Availability `: Linux." msgstr ":ref:`適用 `:Linux。" -#: ../../library/time.rst:878 +#: ../../library/time.rst:916 msgid "Thread-specific CPU-time clock." msgstr "" -#: ../../library/time.rst:887 +#: ../../library/time.rst:925 msgid "" "Time whose absolute value is the time the system has been running and not " "suspended, providing accurate uptime measurement, both absolute and interval." msgstr "" -#: ../../library/time.rst:891 +#: ../../library/time.rst:929 msgid ":ref:`Availability `: FreeBSD, OpenBSD >= 5.5." msgstr ":ref:`適用 `:FreeBSD、OpenBSD 5.5 以上。" -#: ../../library/time.rst:898 +#: ../../library/time.rst:936 msgid "" "Clock that increments monotonically, tracking the time since an arbitrary " "point, unaffected by frequency or time adjustments and not incremented while " "the system is asleep." msgstr "" -#: ../../library/time.rst:902 -msgid ":ref:`Availability `: macOS >= 10.12." -msgstr ":ref:`適用 `:macOS 10.12 以上。" +#: ../../library/time.rst:946 +msgid "" +"Like :data:`CLOCK_UPTIME_RAW`, but the value is cached by the system at " +"context switches and therefore has less accuracy." +msgstr "" -#: ../../library/time.rst:906 +#: ../../library/time.rst:953 msgid "" "The following constant is the only parameter that can be sent to :func:" "`clock_settime`." msgstr "" -#: ../../library/time.rst:912 +#: ../../library/time.rst:959 msgid "" "System-wide real-time clock. Setting this clock requires appropriate " "privileges." msgstr "" -#: ../../library/time.rst:923 +#: ../../library/time.rst:970 msgid "Timezone Constants" msgstr "" -#: ../../library/time.rst:927 +#: ../../library/time.rst:974 msgid "" "The offset of the local DST timezone, in seconds west of UTC, if one is " "defined. This is negative if the local DST timezone is east of UTC (as in " @@ -1500,25 +1575,25 @@ msgid "" "nonzero. See note below." msgstr "" -#: ../../library/time.rst:933 +#: ../../library/time.rst:980 msgid "Nonzero if a DST timezone is defined. See note below." msgstr "" -#: ../../library/time.rst:937 +#: ../../library/time.rst:984 msgid "" "The offset of the local (non-DST) timezone, in seconds west of UTC (negative " "in most of Western Europe, positive in the US, zero in the UK). See note " "below." msgstr "" -#: ../../library/time.rst:942 +#: ../../library/time.rst:989 msgid "" "A tuple of two strings: the first is the name of the local non-DST timezone, " "the second is the name of the local DST timezone. If no DST timezone is " "defined, the second string should not be used. See note below." msgstr "" -#: ../../library/time.rst:948 +#: ../../library/time.rst:995 msgid "" "For the above Timezone constants (:data:`altzone`, :data:`daylight`, :data:" "`timezone`, and :data:`tzname`), the value is determined by the timezone " @@ -1528,40 +1603,40 @@ msgid "" "func:`localtime` to obtain timezone information." msgstr "" -#: ../../library/time.rst:957 +#: ../../library/time.rst:1004 msgid "Module :mod:`datetime`" msgstr ":mod:`datetime` 模組" -#: ../../library/time.rst:958 +#: ../../library/time.rst:1005 msgid "More object-oriented interface to dates and times." msgstr "" -#: ../../library/time.rst:960 +#: ../../library/time.rst:1007 msgid "Module :mod:`locale`" msgstr ":mod:`locale` 模組" -#: ../../library/time.rst:961 +#: ../../library/time.rst:1008 msgid "" "Internationalization services. The locale setting affects the " "interpretation of many format specifiers in :func:`strftime` and :func:" "`strptime`." msgstr "" -#: ../../library/time.rst:964 +#: ../../library/time.rst:1011 msgid "Module :mod:`calendar`" msgstr ":mod:`calendar` 模組" -#: ../../library/time.rst:965 +#: ../../library/time.rst:1012 msgid "" "General calendar-related functions. :func:`~calendar.timegm` is the " "inverse of :func:`gmtime` from this module." msgstr "" -#: ../../library/time.rst:969 +#: ../../library/time.rst:1016 msgid "Footnotes" msgstr "註解" -#: ../../library/time.rst:970 +#: ../../library/time.rst:1017 msgid "" "The use of ``%Z`` is now deprecated, but the ``%z`` escape that expands to " "the preferred hour/minute offset is not supported by all ANSI C libraries. " @@ -1600,24 +1675,24 @@ msgstr "Greenwich Mean Time(格林威治標準時間)" msgid "Daylight Saving Time" msgstr "Daylight Saving Time(日光節約時間)" -#: ../../library/time.rst:310 ../../library/time.rst:336 -#: ../../library/time.rst:678 +#: ../../library/time.rst:319 ../../library/time.rst:354 +#: ../../library/time.rst:707 msgid "benchmarking" msgstr "benchmarking(基準測試)" -#: ../../library/time.rst:336 ../../library/time.rst:678 +#: ../../library/time.rst:354 ../../library/time.rst:707 msgid "CPU time" msgstr "CPU time(CPU 時間)" -#: ../../library/time.rst:336 ../../library/time.rst:678 +#: ../../library/time.rst:354 ../../library/time.rst:707 msgid "processor time" msgstr "processor time(處理器時間)" -#: ../../library/time.rst:393 ../../library/time.rst:539 +#: ../../library/time.rst:416 ../../library/time.rst:562 msgid "% (percent)" msgstr "% (百分號)" -#: ../../library/time.rst:393 ../../library/time.rst:539 +#: ../../library/time.rst:416 ../../library/time.rst:562 msgid "datetime format" msgstr "datetime format(日期時間格式)" diff --git a/library/timeit.po b/library/timeit.po index 9f039857c6..b7a9d153b8 100644 --- a/library/timeit.po +++ b/library/timeit.po @@ -6,7 +6,7 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-05-20 13:21+0800\n" diff --git a/library/tk.po b/library/tk.po index 184e8e98a4..7b366eefa0 100644 --- a/library/tk.po +++ b/library/tk.po @@ -6,9 +6,9 @@ # Matt Wang , 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-05-09 00:15+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-06-24 17:09+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -25,17 +25,18 @@ msgid "Graphical User Interfaces with Tk" msgstr "以 Tk 打造圖形使用者介面 (Graphical User Interfaces)" #: ../../library/tk.rst:13 +#, fuzzy msgid "" "Tk/Tcl has long been an integral part of Python. It provides a robust and " "platform independent windowing toolkit, that is available to Python " "programmers using the :mod:`tkinter` package, and its extension, the :mod:" -"`tkinter.tix` and the :mod:`tkinter.ttk` modules." +"`tkinter.ttk` module." msgstr "" "Tk/Tcl 長期以來一直是 Python 不可或缺的一部分。它提供了一個強大且獨立於平台的" "視窗工具包,可供使用 :mod:`tkinter` 套件及其擴充套件 :mod:`tkinter.tix` 和 :" "mod:`tkinter.ttk` 模組的 Python 開發者使用。" -#: ../../library/tk.rst:18 +#: ../../library/tk.rst:17 msgid "" "The :mod:`tkinter` package is a thin object-oriented layer on top of Tcl/Tk. " "To use :mod:`tkinter`, you don't need to write Tcl code, but you will need " @@ -47,7 +48,7 @@ msgstr "" "`tkinter`,你不需要編寫 Tcl 程式,但會需要查閱 Tk 文件和部份 Tcl 文件。:mod:" "`tkinter` 是一組將 Tk 小工具 (widget) 實作為 Python 類別的包裝器。" -#: ../../library/tk.rst:24 +#: ../../library/tk.rst:23 msgid "" ":mod:`tkinter`'s chief virtues are that it is fast, and that it usually " "comes bundled with Python. Although its standard documentation is weak, good " diff --git a/library/tkinter.colorchooser.po b/library/tkinter.colorchooser.po index b154b07475..f85fe7c89d 100644 --- a/library/tkinter.colorchooser.po +++ b/library/tkinter.colorchooser.po @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2024-02-15 12:16+0800\n" diff --git a/library/tkinter.dnd.po b/library/tkinter.dnd.po index cddc3334f6..0425c9d7de 100644 --- a/library/tkinter.dnd.po +++ b/library/tkinter.dnd.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/library/tkinter.font.po b/library/tkinter.font.po index 9be214ecf3..5560f48175 100644 --- a/library/tkinter.font.po +++ b/library/tkinter.font.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2024-02-15 23:09+0800\n" diff --git a/library/tkinter.messagebox.po b/library/tkinter.messagebox.po index a66422680a..c6ba507cf3 100644 --- a/library/tkinter.messagebox.po +++ b/library/tkinter.messagebox.po @@ -5,7 +5,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2024-02-22 15:59+0800\n" diff --git a/library/tkinter.po b/library/tkinter.po index 6e6844eb52..cff143b797 100644 --- a/library/tkinter.po +++ b/library/tkinter.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -130,7 +130,7 @@ msgid "" "python-gui-programming-with-tkinter-9781788835886>`_" msgstr "" "`Python GUI programming with Tkinter `_" +"python-gui-programming-with-tkinter-9781788835886>`_" #: ../../library/tkinter.rst:62 msgid "By Alan D. Moore. (ISBN 978-1788835886)" @@ -190,7 +190,7 @@ msgid "" "difference (see `Threading model`_ for details)." msgstr "" -#: ../../library/tkinter.rst:92 ../../library/tkinter.rst:911 +#: ../../library/tkinter.rst:92 ../../library/tkinter.rst:907 msgid "Tk" msgstr "Tk" @@ -503,28 +503,18 @@ msgid "" msgstr "" #: ../../library/tkinter.rst:258 -msgid ":mod:`tkinter.tix`" -msgstr ":mod:`tkinter.tix`" - -#: ../../library/tkinter.rst:259 -msgid "" -"(deprecated) An older third-party Tcl/Tk package that adds several new " -"widgets. Better alternatives for most can be found in :mod:`tkinter.ttk`." -msgstr "" - -#: ../../library/tkinter.rst:262 msgid ":mod:`turtle`" msgstr ":mod:`turtle`" -#: ../../library/tkinter.rst:263 +#: ../../library/tkinter.rst:259 msgid "Turtle graphics in a Tk window." msgstr "" -#: ../../library/tkinter.rst:267 +#: ../../library/tkinter.rst:263 msgid "Tkinter Life Preserver" msgstr "" -#: ../../library/tkinter.rst:269 +#: ../../library/tkinter.rst:265 msgid "" "This section is not designed to be an exhaustive tutorial on either Tk or " "Tkinter. For that, refer to one of the external resources noted earlier. " @@ -533,7 +523,7 @@ msgid "" "how the Tkinter wrapper is structured." msgstr "" -#: ../../library/tkinter.rst:275 +#: ../../library/tkinter.rst:271 msgid "" "The remainder of this section will help you to identify the classes, " "methods, and options you'll need in your Tkinter application, and where to " @@ -541,18 +531,18 @@ msgid "" "reference manual." msgstr "" -#: ../../library/tkinter.rst:282 +#: ../../library/tkinter.rst:278 msgid "A Hello World Program" msgstr "" -#: ../../library/tkinter.rst:284 +#: ../../library/tkinter.rst:280 msgid "" "We'll start by walking through a \"Hello World\" application in Tkinter. " "This isn't the smallest one we could write, but has enough to illustrate " "some key concepts you'll need to know." msgstr "" -#: ../../library/tkinter.rst:290 +#: ../../library/tkinter.rst:286 msgid "" "from tkinter import *\n" "from tkinter import ttk\n" @@ -572,7 +562,7 @@ msgstr "" "ttk.Button(frm, text=\"Quit\", command=root.destroy).grid(column=1, row=0)\n" "root.mainloop()" -#: ../../library/tkinter.rst:300 +#: ../../library/tkinter.rst:296 msgid "" "After the imports, the next line creates an instance of the :class:`Tk` " "class, which initializes Tk and creates its associated Tcl interpreter. It " @@ -580,56 +570,56 @@ msgid "" "the main window of the application." msgstr "" -#: ../../library/tkinter.rst:305 +#: ../../library/tkinter.rst:301 msgid "" "The following line creates a frame widget, which in this case will contain a " "label and a button we'll create next. The frame is fit inside the root " "window." msgstr "" -#: ../../library/tkinter.rst:309 +#: ../../library/tkinter.rst:305 msgid "" "The next line creates a label widget holding a static text string. The :meth:" "`grid` method is used to specify the relative layout (position) of the label " "within its containing frame widget, similar to how tables in HTML work." msgstr "" -#: ../../library/tkinter.rst:313 +#: ../../library/tkinter.rst:309 msgid "" "A button widget is then created, and placed to the right of the label. When " "pressed, it will call the :meth:`destroy` method of the root window." msgstr "" -#: ../../library/tkinter.rst:316 +#: ../../library/tkinter.rst:312 msgid "" "Finally, the :meth:`mainloop` method puts everything on the display, and " "responds to user input until the program terminates." msgstr "" -#: ../../library/tkinter.rst:322 +#: ../../library/tkinter.rst:318 msgid "Important Tk Concepts" msgstr "" -#: ../../library/tkinter.rst:324 +#: ../../library/tkinter.rst:320 msgid "Even this simple program illustrates the following key Tk concepts:" msgstr "" -#: ../../library/tkinter.rst:326 +#: ../../library/tkinter.rst:322 msgid "widgets" msgstr "" -#: ../../library/tkinter.rst:327 +#: ../../library/tkinter.rst:323 msgid "" "A Tkinter user interface is made up of individual *widgets*. Each widget is " "represented as a Python object, instantiated from classes like :class:`ttk." "Frame`, :class:`ttk.Label`, and :class:`ttk.Button`." msgstr "" -#: ../../library/tkinter.rst:331 +#: ../../library/tkinter.rst:327 msgid "widget hierarchy" msgstr "" -#: ../../library/tkinter.rst:332 +#: ../../library/tkinter.rst:328 msgid "" "Widgets are arranged in a *hierarchy*. The label and button were contained " "within a frame, which in turn was contained within the root window. When " @@ -637,44 +627,44 @@ msgid "" "argument to the widget constructor." msgstr "" -#: ../../library/tkinter.rst:337 +#: ../../library/tkinter.rst:333 msgid "configuration options" msgstr "" -#: ../../library/tkinter.rst:338 +#: ../../library/tkinter.rst:334 msgid "" "Widgets have *configuration options*, which modify their appearance and " "behavior, such as the text to display in a label or button. Different " "classes of widgets will have different sets of options." msgstr "" -#: ../../library/tkinter.rst:342 +#: ../../library/tkinter.rst:338 msgid "geometry management" msgstr "" -#: ../../library/tkinter.rst:343 +#: ../../library/tkinter.rst:339 msgid "" "Widgets aren't automatically added to the user interface when they are " "created. A *geometry manager* like ``grid`` controls where in the user " "interface they are placed." msgstr "" -#: ../../library/tkinter.rst:347 +#: ../../library/tkinter.rst:343 msgid "event loop" msgstr "" -#: ../../library/tkinter.rst:348 +#: ../../library/tkinter.rst:344 msgid "" "Tkinter reacts to user input, changes from your program, and even refreshes " "the display only when actively running an *event loop*. If your program " "isn't running the event loop, your user interface won't update." msgstr "" -#: ../../library/tkinter.rst:354 +#: ../../library/tkinter.rst:350 msgid "Understanding How Tkinter Wraps Tcl/Tk" msgstr "" -#: ../../library/tkinter.rst:356 +#: ../../library/tkinter.rst:352 msgid "" "When your application uses Tkinter's classes and methods, internally Tkinter " "is assembling strings representing Tcl/Tk commands, and executing those " @@ -682,7 +672,7 @@ msgid "" "instance." msgstr "" -#: ../../library/tkinter.rst:361 +#: ../../library/tkinter.rst:357 msgid "" "Whether it's trying to navigate reference documentation, trying to find the " "right method or option, adapting some existing code, or debugging your " @@ -690,13 +680,13 @@ msgid "" "what those underlying Tcl/Tk commands look like." msgstr "" -#: ../../library/tkinter.rst:366 +#: ../../library/tkinter.rst:362 msgid "" "To illustrate, here is the Tcl/Tk equivalent of the main part of the Tkinter " "script above." msgstr "" -#: ../../library/tkinter.rst:371 +#: ../../library/tkinter.rst:367 msgid "" "ttk::frame .frm -padding 10\n" "grid .frm\n" @@ -710,7 +700,7 @@ msgstr "" "grid [ttk::button .frm.btn -text \"Quit\" -command \"destroy .\"] -column 1 -" "row 0" -#: ../../library/tkinter.rst:377 +#: ../../library/tkinter.rst:373 msgid "" "Tcl's syntax is similar to many shell languages, where the first word is the " "command to be executed, with arguments to that command following it, " @@ -718,25 +708,25 @@ msgid "" "following:" msgstr "" -#: ../../library/tkinter.rst:381 +#: ../../library/tkinter.rst:377 msgid "" "The commands used to create widgets (like ``ttk::frame``) correspond to " "widget classes in Tkinter." msgstr "" -#: ../../library/tkinter.rst:384 +#: ../../library/tkinter.rst:380 msgid "" "Tcl widget options (like ``-text``) correspond to keyword arguments in " "Tkinter." msgstr "" -#: ../../library/tkinter.rst:387 +#: ../../library/tkinter.rst:383 msgid "" "Widgets are referred to by a *pathname* in Tcl (like ``.frm.btn``), whereas " "Tkinter doesn't use names but object references." msgstr "" -#: ../../library/tkinter.rst:390 +#: ../../library/tkinter.rst:386 msgid "" "A widget's place in the widget hierarchy is encoded in its (hierarchical) " "pathname, which uses a ``.`` (dot) as a path separator. The pathname for the " @@ -744,7 +734,7 @@ msgid "" "pathname but by specifying the parent widget when creating each child widget." msgstr "" -#: ../../library/tkinter.rst:396 +#: ../../library/tkinter.rst:392 msgid "" "Operations which are implemented as separate *commands* in Tcl (like " "``grid`` or ``destroy``) are represented as *methods* on Tkinter widget " @@ -753,18 +743,18 @@ msgid "" "in Tkinter." msgstr "" -#: ../../library/tkinter.rst:404 +#: ../../library/tkinter.rst:400 msgid "How do I...? What option does...?" msgstr "" -#: ../../library/tkinter.rst:406 +#: ../../library/tkinter.rst:402 msgid "" "If you're not sure how to do something in Tkinter, and you can't immediately " "find it in the tutorial or reference documentation you're using, there are a " "few strategies that can be helpful." msgstr "" -#: ../../library/tkinter.rst:410 +#: ../../library/tkinter.rst:406 msgid "" "First, remember that the details of how individual widgets work may vary " "across different versions of both Tkinter and Tcl/Tk. If you're searching " @@ -772,7 +762,7 @@ msgid "" "installed on your system." msgstr "" -#: ../../library/tkinter.rst:415 +#: ../../library/tkinter.rst:411 msgid "" "When searching for how to use an API, it helps to know the exact name of the " "class, option, or method that you're using. Introspection, either in an " @@ -780,7 +770,7 @@ msgid "" "you need." msgstr "" -#: ../../library/tkinter.rst:420 +#: ../../library/tkinter.rst:416 msgid "" "To find out what configuration options are available on any widget, call " "its :meth:`configure` method, which returns a dictionary containing a " @@ -788,7 +778,7 @@ msgid "" "values. Use :meth:`keys` to get just the names of each option." msgstr "" -#: ../../library/tkinter.rst:427 +#: ../../library/tkinter.rst:423 msgid "" "btn = ttk.Button(frm, ...)\n" "print(btn.configure().keys())" @@ -796,7 +786,7 @@ msgstr "" "btn = ttk.Button(frm, ...)\n" "print(btn.configure().keys())" -#: ../../library/tkinter.rst:430 +#: ../../library/tkinter.rst:426 msgid "" "As most widgets have many configuration options in common, it can be useful " "to find out which are specific to a particular widget class. Comparing the " @@ -804,11 +794,11 @@ msgid "" "that." msgstr "" -#: ../../library/tkinter.rst:437 +#: ../../library/tkinter.rst:433 msgid "print(set(btn.configure().keys()) - set(frm.configure().keys()))" msgstr "print(set(btn.configure().keys()) - set(frm.configure().keys()))" -#: ../../library/tkinter.rst:439 +#: ../../library/tkinter.rst:435 msgid "" "Similarly, you can find the available methods for a widget object using the " "standard :func:`dir` function. If you try it, you'll see there are over 200 " @@ -816,7 +806,7 @@ msgid "" "is helpful." msgstr "" -#: ../../library/tkinter.rst:446 +#: ../../library/tkinter.rst:442 msgid "" "print(dir(btn))\n" "print(set(dir(btn)) - set(dir(frm)))" @@ -824,11 +814,11 @@ msgstr "" "print(dir(btn))\n" "print(set(dir(btn)) - set(dir(frm)))" -#: ../../library/tkinter.rst:451 +#: ../../library/tkinter.rst:447 msgid "Navigating the Tcl/Tk Reference Manual" msgstr "" -#: ../../library/tkinter.rst:453 +#: ../../library/tkinter.rst:449 msgid "" "As noted, the official `Tk commands `_ reference manual (man pages) is often the most accurate " @@ -837,7 +827,7 @@ msgid "" "places to look." msgstr "" -#: ../../library/tkinter.rst:458 +#: ../../library/tkinter.rst:454 msgid "" "While all operations in Tkinter are implemented as method calls on widget " "objects, you've seen that many Tcl/Tk operations appear as commands that " @@ -845,7 +835,7 @@ msgid "" "parameters, e.g." msgstr "" -#: ../../library/tkinter.rst:465 +#: ../../library/tkinter.rst:461 msgid "" "destroy .\n" "grid .frm.btn -column 0 -row 0" @@ -853,7 +843,7 @@ msgstr "" "destroy .\n" "grid .frm.btn -column 0 -row 0" -#: ../../library/tkinter.rst:468 +#: ../../library/tkinter.rst:464 msgid "" "Others, however, look more like methods called on a widget object (in fact, " "when you create a widget in Tcl/Tk, it creates a Tcl command with the name " @@ -861,7 +851,7 @@ msgid "" "name of a method to call)." msgstr "" -#: ../../library/tkinter.rst:475 +#: ../../library/tkinter.rst:471 msgid "" ".frm.btn invoke\n" ".frm.lbl configure -text \"Goodbye\"" @@ -869,7 +859,7 @@ msgstr "" ".frm.btn invoke\n" ".frm.lbl configure -text \"Goodbye\"" -#: ../../library/tkinter.rst:479 +#: ../../library/tkinter.rst:475 msgid "" "In the official Tcl/Tk reference documentation, you'll find most operations " "that look like method calls on the man page for a specific widget (e.g., " @@ -879,7 +869,7 @@ msgid "" "www.tcl.tk/man/tcl8.6/TkCmd/grid.htm>`_)." msgstr "" -#: ../../library/tkinter.rst:487 +#: ../../library/tkinter.rst:483 msgid "" "You'll find many common options and methods in the `options `_ or `ttk::widget `_ man page." msgstr "" -#: ../../library/tkinter.rst:498 +#: ../../library/tkinter.rst:494 msgid "" "Somewhat confusingly, there are also methods on all Tkinter widgets that " "don't actually operate on the widget, but operate at a global scope, " @@ -904,17 +894,17 @@ msgid "" "class:`Widget` class that all Tkinter widgets inherit from)." msgstr "" -#: ../../library/tkinter.rst:507 +#: ../../library/tkinter.rst:503 msgid "Threading model" msgstr "" -#: ../../library/tkinter.rst:509 +#: ../../library/tkinter.rst:505 msgid "" "Python and Tcl/Tk have very different threading models, which :mod:`tkinter` " "tries to bridge. If you use threads, you may need to be aware of this." msgstr "" -#: ../../library/tkinter.rst:512 +#: ../../library/tkinter.rst:508 msgid "" "A Python interpreter may have many threads associated with it. In Tcl, " "multiple threads can be created, but each thread has a separate Tcl " @@ -923,7 +913,7 @@ msgid "" "by the one thread that created it." msgstr "" -#: ../../library/tkinter.rst:517 +#: ../../library/tkinter.rst:513 msgid "" "Each :class:`Tk` object created by :mod:`tkinter` contains a Tcl " "interpreter. It also keeps track of which thread created that interpreter. " @@ -933,7 +923,7 @@ msgid "" "executed, the result is returned to the calling Python thread." msgstr "" -#: ../../library/tkinter.rst:524 +#: ../../library/tkinter.rst:520 msgid "" "Tcl/Tk applications are normally event-driven, meaning that after " "initialization, the interpreter runs an event loop (i.e. :func:`Tk." @@ -946,18 +936,18 @@ msgid "" "event handlers." msgstr "" -#: ../../library/tkinter.rst:533 +#: ../../library/tkinter.rst:529 msgid "" "If the Tcl interpreter is not running the event loop and processing events, " "any :mod:`tkinter` calls made from threads other than the one running the " "Tcl interpreter will fail." msgstr "" -#: ../../library/tkinter.rst:537 +#: ../../library/tkinter.rst:533 msgid "A number of special cases exist:" msgstr "" -#: ../../library/tkinter.rst:539 +#: ../../library/tkinter.rst:535 msgid "" "Tcl/Tk libraries can be built so they are not thread-aware. In this case, :" "mod:`tkinter` calls the library from the originating Python thread, even if " @@ -965,7 +955,7 @@ msgid "" "lock ensures only one call occurs at a time." msgstr "" -#: ../../library/tkinter.rst:544 +#: ../../library/tkinter.rst:540 msgid "" "While :mod:`tkinter` allows you to create more than one instance of a :class:" "`Tk` object (with its own interpreter), all interpreters that are part of " @@ -975,7 +965,7 @@ msgid "" "running a thread-aware Tcl/Tk build." msgstr "" -#: ../../library/tkinter.rst:550 +#: ../../library/tkinter.rst:546 msgid "" "Blocking event handlers are not the only way to prevent the Tcl interpreter " "from reentering the event loop. It is even possible to run multiple nested " @@ -983,39 +973,39 @@ msgid "" "tricky when it comes to events or threads, be aware of these possibilities." msgstr "" -#: ../../library/tkinter.rst:555 +#: ../../library/tkinter.rst:551 msgid "" "There are a few select :mod:`tkinter` functions that presently work only " "when called from the thread that created the Tcl interpreter." msgstr "" -#: ../../library/tkinter.rst:560 +#: ../../library/tkinter.rst:556 msgid "Handy Reference" msgstr "" -#: ../../library/tkinter.rst:566 +#: ../../library/tkinter.rst:562 msgid "Setting Options" msgstr "" -#: ../../library/tkinter.rst:568 +#: ../../library/tkinter.rst:564 msgid "" "Options control things like the color and border width of a widget. Options " "can be set in three ways:" msgstr "" -#: ../../library/tkinter.rst:571 +#: ../../library/tkinter.rst:567 msgid "At object creation time, using keyword arguments" msgstr "" -#: ../../library/tkinter.rst:574 +#: ../../library/tkinter.rst:570 msgid "fred = Button(self, fg=\"red\", bg=\"blue\")" msgstr "fred = Button(self, fg=\"red\", bg=\"blue\")" -#: ../../library/tkinter.rst:576 +#: ../../library/tkinter.rst:572 msgid "After object creation, treating the option name like a dictionary index" msgstr "" -#: ../../library/tkinter.rst:579 +#: ../../library/tkinter.rst:575 msgid "" "fred[\"fg\"] = \"red\"\n" "fred[\"bg\"] = \"blue\"" @@ -1023,23 +1013,23 @@ msgstr "" "fred[\"fg\"] = \"red\"\n" "fred[\"bg\"] = \"blue\"" -#: ../../library/tkinter.rst:582 +#: ../../library/tkinter.rst:578 msgid "" "Use the config() method to update multiple attrs subsequent to object " "creation" msgstr "" -#: ../../library/tkinter.rst:585 +#: ../../library/tkinter.rst:581 msgid "fred.config(fg=\"red\", bg=\"blue\")" msgstr "fred.config(fg=\"red\", bg=\"blue\")" -#: ../../library/tkinter.rst:587 +#: ../../library/tkinter.rst:583 msgid "" "For a complete explanation of a given option and its behavior, see the Tk " "man pages for the widget in question." msgstr "" -#: ../../library/tkinter.rst:590 +#: ../../library/tkinter.rst:586 msgid "" "Note that the man pages list \"STANDARD OPTIONS\" and \"WIDGET SPECIFIC " "OPTIONS\" for each widget. The former is a list of options that are common " @@ -1048,7 +1038,7 @@ msgid "" "`options(3)` man page." msgstr "" -#: ../../library/tkinter.rst:596 +#: ../../library/tkinter.rst:592 msgid "" "No distinction between standard and widget-specific options is made in this " "document. Some options don't apply to some kinds of widgets. Whether a " @@ -1056,7 +1046,7 @@ msgid "" "widget; buttons have a ``command`` option, labels do not." msgstr "" -#: ../../library/tkinter.rst:601 +#: ../../library/tkinter.rst:597 msgid "" "The options supported by a given widget are listed in that widget's man " "page, or can be queried at runtime by calling the :meth:`config` method " @@ -1065,7 +1055,7 @@ msgid "" "option as a string (for example, ``'relief'``) and whose values are 5-tuples." msgstr "" -#: ../../library/tkinter.rst:607 +#: ../../library/tkinter.rst:603 msgid "" "Some options, like ``bg`` are synonyms for common options with long names " "(``bg`` is shorthand for \"background\"). Passing the ``config()`` method " @@ -1074,79 +1064,79 @@ msgid "" "option (such as ``('bg', 'background')``)." msgstr "" -#: ../../library/tkinter.rst:614 +#: ../../library/tkinter.rst:610 msgid "Index" msgstr "" -#: ../../library/tkinter.rst:614 +#: ../../library/tkinter.rst:610 msgid "Meaning" msgstr "含義" -#: ../../library/tkinter.rst:614 +#: ../../library/tkinter.rst:610 msgid "Example" msgstr "範例" -#: ../../library/tkinter.rst:616 +#: ../../library/tkinter.rst:612 msgid "0" msgstr "0" -#: ../../library/tkinter.rst:616 +#: ../../library/tkinter.rst:612 msgid "option name" msgstr "" -#: ../../library/tkinter.rst:616 ../../library/tkinter.rst:618 +#: ../../library/tkinter.rst:612 ../../library/tkinter.rst:614 msgid "``'relief'``" msgstr "``'relief'``" -#: ../../library/tkinter.rst:618 +#: ../../library/tkinter.rst:614 msgid "1" msgstr "1" -#: ../../library/tkinter.rst:618 +#: ../../library/tkinter.rst:614 msgid "option name for database lookup" msgstr "" -#: ../../library/tkinter.rst:620 +#: ../../library/tkinter.rst:616 msgid "2" msgstr "2" -#: ../../library/tkinter.rst:620 +#: ../../library/tkinter.rst:616 msgid "option class for database lookup" msgstr "" -#: ../../library/tkinter.rst:620 +#: ../../library/tkinter.rst:616 msgid "``'Relief'``" msgstr "``'Relief'``" -#: ../../library/tkinter.rst:623 +#: ../../library/tkinter.rst:619 msgid "3" msgstr "3" -#: ../../library/tkinter.rst:623 +#: ../../library/tkinter.rst:619 msgid "default value" msgstr "" -#: ../../library/tkinter.rst:623 +#: ../../library/tkinter.rst:619 msgid "``'raised'``" msgstr "``'raised'``" -#: ../../library/tkinter.rst:625 +#: ../../library/tkinter.rst:621 msgid "4" msgstr "4" -#: ../../library/tkinter.rst:625 +#: ../../library/tkinter.rst:621 msgid "current value" msgstr "" -#: ../../library/tkinter.rst:625 +#: ../../library/tkinter.rst:621 msgid "``'groove'``" msgstr "``'groove'``" -#: ../../library/tkinter.rst:628 +#: ../../library/tkinter.rst:624 msgid "Example::" msgstr "範例: ::" -#: ../../library/tkinter.rst:630 +#: ../../library/tkinter.rst:626 msgid "" ">>> print(fred.config())\n" "{'relief': ('relief', 'relief', 'Relief', 'raised', 'groove')}" @@ -1154,17 +1144,17 @@ msgstr "" ">>> print(fred.config())\n" "{'relief': ('relief', 'relief', 'Relief', 'raised', 'groove')}" -#: ../../library/tkinter.rst:633 +#: ../../library/tkinter.rst:629 msgid "" "Of course, the dictionary printed will include all the options available and " "their values. This is meant only as an example." msgstr "" -#: ../../library/tkinter.rst:638 +#: ../../library/tkinter.rst:634 msgid "The Packer" msgstr "" -#: ../../library/tkinter.rst:642 +#: ../../library/tkinter.rst:638 msgid "" "The packer is one of Tk's geometry-management mechanisms. Geometry " "managers are used to specify the relative positioning of widgets within " @@ -1175,7 +1165,7 @@ msgid "" "coordinates for you." msgstr "" -#: ../../library/tkinter.rst:649 +#: ../../library/tkinter.rst:645 msgid "" "The size of any *master* widget is determined by the size of the \"slave " "widgets\" inside. The packer is used to control where slave widgets appear " @@ -1185,7 +1175,7 @@ msgid "" "accommodate incremental changes to the configuration, once it is packed." msgstr "" -#: ../../library/tkinter.rst:656 +#: ../../library/tkinter.rst:652 msgid "" "Note that widgets do not appear until they have had their geometry specified " "with a geometry manager. It's a common early mistake to leave out the " @@ -1194,86 +1184,86 @@ msgid "" "the packer's :meth:`pack` method applied to it." msgstr "" -#: ../../library/tkinter.rst:662 +#: ../../library/tkinter.rst:658 msgid "" "The pack() method can be called with keyword-option/value pairs that control " "where the widget is to appear within its container, and how it is to behave " "when the main application window is resized. Here are some examples::" msgstr "" -#: ../../library/tkinter.rst:666 +#: ../../library/tkinter.rst:662 msgid "" "fred.pack() # defaults to side = \"top\"\n" "fred.pack(side=\"left\")\n" "fred.pack(expand=1)" msgstr "" -#: ../../library/tkinter.rst:672 +#: ../../library/tkinter.rst:668 msgid "Packer Options" msgstr "" -#: ../../library/tkinter.rst:674 +#: ../../library/tkinter.rst:670 msgid "" "For more extensive information on the packer and the options that it can " "take, see the man pages and page 183 of John Ousterhout's book." msgstr "" -#: ../../library/tkinter.rst:677 ../../library/tkinter.rst:796 +#: ../../library/tkinter.rst:673 ../../library/tkinter.rst:792 msgid "anchor" msgstr "" -#: ../../library/tkinter.rst:678 +#: ../../library/tkinter.rst:674 msgid "" "Anchor type. Denotes where the packer is to place each slave in its parcel." msgstr "" -#: ../../library/tkinter.rst:680 +#: ../../library/tkinter.rst:676 msgid "expand" msgstr "" -#: ../../library/tkinter.rst:681 +#: ../../library/tkinter.rst:677 msgid "Boolean, ``0`` or ``1``." msgstr "" -#: ../../library/tkinter.rst:683 +#: ../../library/tkinter.rst:679 msgid "fill" msgstr "" -#: ../../library/tkinter.rst:684 +#: ../../library/tkinter.rst:680 msgid "Legal values: ``'x'``, ``'y'``, ``'both'``, ``'none'``." msgstr "" -#: ../../library/tkinter.rst:686 +#: ../../library/tkinter.rst:682 msgid "ipadx and ipady" msgstr "" -#: ../../library/tkinter.rst:687 +#: ../../library/tkinter.rst:683 msgid "" "A distance - designating internal padding on each side of the slave widget." msgstr "" -#: ../../library/tkinter.rst:689 +#: ../../library/tkinter.rst:685 msgid "padx and pady" msgstr "" -#: ../../library/tkinter.rst:690 +#: ../../library/tkinter.rst:686 msgid "" "A distance - designating external padding on each side of the slave widget." msgstr "" -#: ../../library/tkinter.rst:692 +#: ../../library/tkinter.rst:688 msgid "side" msgstr "" -#: ../../library/tkinter.rst:693 +#: ../../library/tkinter.rst:689 msgid "Legal values are: ``'left'``, ``'right'``, ``'top'``, ``'bottom'``." msgstr "" -#: ../../library/tkinter.rst:697 +#: ../../library/tkinter.rst:693 msgid "Coupling Widget Variables" msgstr "" -#: ../../library/tkinter.rst:699 +#: ../../library/tkinter.rst:695 msgid "" "The current-value setting of some widgets (like text entry widgets) can be " "connected directly to application variables by using special options. These " @@ -1283,7 +1273,7 @@ msgid "" "value." msgstr "" -#: ../../library/tkinter.rst:705 +#: ../../library/tkinter.rst:701 msgid "" "Unfortunately, in the current implementation of :mod:`tkinter` it is not " "possible to hand over an arbitrary Python variable to a widget through a " @@ -1292,7 +1282,7 @@ msgid "" "Variable, defined in :mod:`tkinter`." msgstr "" -#: ../../library/tkinter.rst:711 +#: ../../library/tkinter.rst:707 msgid "" "There are many useful subclasses of Variable already defined: :class:" "`StringVar`, :class:`IntVar`, :class:`DoubleVar`, and :class:`BooleanVar`. " @@ -1302,11 +1292,11 @@ msgid "" "no further intervention on your part." msgstr "" -#: ../../library/tkinter.rst:718 ../../library/tkinter.rst:898 +#: ../../library/tkinter.rst:714 ../../library/tkinter.rst:894 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/tkinter.rst:720 +#: ../../library/tkinter.rst:716 msgid "" "import tkinter as tk\n" "\n" @@ -1339,11 +1329,11 @@ msgid "" "myapp.mainloop()" msgstr "" -#: ../../library/tkinter.rst:751 +#: ../../library/tkinter.rst:747 msgid "The Window Manager" msgstr "" -#: ../../library/tkinter.rst:755 +#: ../../library/tkinter.rst:751 msgid "" "In Tk, there is a utility command, ``wm``, for interacting with the window " "manager. Options to the ``wm`` command allow you to control things like " @@ -1353,7 +1343,7 @@ msgid "" "the :class:`Wm` methods directly." msgstr "" -#: ../../library/tkinter.rst:762 +#: ../../library/tkinter.rst:758 msgid "" "To get at the toplevel window that contains a given widget, you can often " "just refer to the widget's master. Of course if the widget has been packed " @@ -1364,11 +1354,11 @@ msgid "" "to Tk functionality." msgstr "" -#: ../../library/tkinter.rst:769 +#: ../../library/tkinter.rst:765 msgid "Here are some examples of typical usage::" msgstr "以下是一些常見用法範例: ::" -#: ../../library/tkinter.rst:771 +#: ../../library/tkinter.rst:767 msgid "" "import tkinter as tk\n" "\n" @@ -1390,22 +1380,22 @@ msgid "" "myapp.mainloop()" msgstr "" -#: ../../library/tkinter.rst:792 ../../library/tkinter.rst:794 +#: ../../library/tkinter.rst:788 ../../library/tkinter.rst:790 msgid "Tk Option Data Types" msgstr "" -#: ../../library/tkinter.rst:797 +#: ../../library/tkinter.rst:793 msgid "" "Legal values are points of the compass: ``\"n\"``, ``\"ne\"``, ``\"e\"``, " "``\"se\"``, ``\"s\"``, ``\"sw\"``, ``\"w\"``, ``\"nw\"``, and also " "``\"center\"``." msgstr "" -#: ../../library/tkinter.rst:800 +#: ../../library/tkinter.rst:796 msgid "bitmap" msgstr "" -#: ../../library/tkinter.rst:801 +#: ../../library/tkinter.rst:797 msgid "" "There are eight built-in, named bitmaps: ``'error'``, ``'gray25'``, " "``'gray50'``, ``'hourglass'``, ``'info'``, ``'questhead'``, ``'question'``, " @@ -1413,23 +1403,23 @@ msgid "" "file, preceded with an ``@``, as in ``\"@/usr/contrib/bitmap/gumby.bit\"``." msgstr "" -#: ../../library/tkinter.rst:806 +#: ../../library/tkinter.rst:802 msgid "boolean" msgstr "" -#: ../../library/tkinter.rst:807 +#: ../../library/tkinter.rst:803 msgid "You can pass integers 0 or 1 or the strings ``\"yes\"`` or ``\"no\"``." msgstr "" -#: ../../library/tkinter.rst:809 +#: ../../library/tkinter.rst:805 msgid "callback" msgstr "" -#: ../../library/tkinter.rst:810 +#: ../../library/tkinter.rst:806 msgid "This is any Python function that takes no arguments. For example::" msgstr "" -#: ../../library/tkinter.rst:812 +#: ../../library/tkinter.rst:808 msgid "" "def print_it():\n" " print(\"hi there\")\n" @@ -1439,11 +1429,11 @@ msgstr "" " print(\"hi there\")\n" "fred[\"command\"] = print_it" -#: ../../library/tkinter.rst:816 +#: ../../library/tkinter.rst:812 msgid "color" msgstr "" -#: ../../library/tkinter.rst:817 +#: ../../library/tkinter.rst:813 msgid "" "Colors can be given as the names of X colors in the rgb.txt file, or as " "strings representing RGB values in 4 bit: ``\"#RGB\"``, 8 bit: " @@ -1452,11 +1442,11 @@ msgid "" "digit. See page 160 of Ousterhout's book for details." msgstr "" -#: ../../library/tkinter.rst:822 +#: ../../library/tkinter.rst:818 msgid "cursor" msgstr "" -#: ../../library/tkinter.rst:823 +#: ../../library/tkinter.rst:819 msgid "" "The standard X cursor names from :file:`cursorfont.h` can be used, without " "the ``XC_`` prefix. For example to get a hand cursor (:const:`XC_hand2`), " @@ -1464,11 +1454,11 @@ msgid "" "of your own. See page 179 of Ousterhout's book." msgstr "" -#: ../../library/tkinter.rst:828 +#: ../../library/tkinter.rst:824 msgid "distance" msgstr "" -#: ../../library/tkinter.rst:829 +#: ../../library/tkinter.rst:825 msgid "" "Screen distances can be specified in either pixels or absolute distances. " "Pixels are given as numbers and absolute distances as strings, with the " @@ -1477,124 +1467,124 @@ msgid "" "is expressed as ``\"3.5i\"``." msgstr "" -#: ../../library/tkinter.rst:835 +#: ../../library/tkinter.rst:831 msgid "font" msgstr "" -#: ../../library/tkinter.rst:836 +#: ../../library/tkinter.rst:832 msgid "" "Tk uses a list font name format, such as ``{courier 10 bold}``. Font sizes " "with positive numbers are measured in points; sizes with negative numbers " "are measured in pixels." msgstr "" -#: ../../library/tkinter.rst:840 +#: ../../library/tkinter.rst:836 msgid "geometry" msgstr "" -#: ../../library/tkinter.rst:841 +#: ../../library/tkinter.rst:837 msgid "" "This is a string of the form ``widthxheight``, where width and height are " "measured in pixels for most widgets (in characters for widgets displaying " "text). For example: ``fred[\"geometry\"] = \"200x100\"``." msgstr "" -#: ../../library/tkinter.rst:845 +#: ../../library/tkinter.rst:841 msgid "justify" msgstr "" -#: ../../library/tkinter.rst:846 +#: ../../library/tkinter.rst:842 msgid "" "Legal values are the strings: ``\"left\"``, ``\"center\"``, ``\"right\"``, " "and ``\"fill\"``." msgstr "" -#: ../../library/tkinter.rst:849 +#: ../../library/tkinter.rst:845 msgid "region" msgstr "" -#: ../../library/tkinter.rst:850 +#: ../../library/tkinter.rst:846 msgid "" "This is a string with four space-delimited elements, each of which is a " "legal distance (see above). For example: ``\"2 3 4 5\"`` and ``\"3i 2i 4.5i " "2i\"`` and ``\"3c 2c 4c 10.43c\"`` are all legal regions." msgstr "" -#: ../../library/tkinter.rst:854 +#: ../../library/tkinter.rst:850 msgid "relief" msgstr "" -#: ../../library/tkinter.rst:855 +#: ../../library/tkinter.rst:851 msgid "" "Determines what the border style of a widget will be. Legal values are: " "``\"raised\"``, ``\"sunken\"``, ``\"flat\"``, ``\"groove\"``, and " "``\"ridge\"``." msgstr "" -#: ../../library/tkinter.rst:858 +#: ../../library/tkinter.rst:854 msgid "scrollcommand" msgstr "" -#: ../../library/tkinter.rst:859 +#: ../../library/tkinter.rst:855 msgid "" "This is almost always the :meth:`!set` method of some scrollbar widget, but " "can be any widget method that takes a single argument." msgstr "" -#: ../../library/tkinter.rst:862 +#: ../../library/tkinter.rst:858 msgid "wrap" msgstr "" -#: ../../library/tkinter.rst:863 +#: ../../library/tkinter.rst:859 msgid "Must be one of: ``\"none\"``, ``\"char\"``, or ``\"word\"``." msgstr "" -#: ../../library/tkinter.rst:868 +#: ../../library/tkinter.rst:864 msgid "Bindings and Events" msgstr "" -#: ../../library/tkinter.rst:874 +#: ../../library/tkinter.rst:870 msgid "" "The bind method from the widget command allows you to watch for certain " "events and to have a callback function trigger when that event type occurs. " "The form of the bind method is::" msgstr "" -#: ../../library/tkinter.rst:878 +#: ../../library/tkinter.rst:874 msgid "def bind(self, sequence, func, add=''):" msgstr "def bind(self, sequence, func, add=''):" -#: ../../library/tkinter.rst:880 +#: ../../library/tkinter.rst:876 msgid "where:" msgstr "" -#: ../../library/tkinter.rst:882 +#: ../../library/tkinter.rst:878 msgid "sequence" msgstr "sequence(序列)" -#: ../../library/tkinter.rst:883 +#: ../../library/tkinter.rst:879 msgid "" "is a string that denotes the target kind of event. (See the :manpage:" "`bind(3tk)` man page, and page 201 of John Ousterhout's book, :title-" "reference:`Tcl and the Tk Toolkit (2nd edition)`, for details)." msgstr "" -#: ../../library/tkinter.rst:887 +#: ../../library/tkinter.rst:883 msgid "func" msgstr "" -#: ../../library/tkinter.rst:888 +#: ../../library/tkinter.rst:884 msgid "" "is a Python function, taking one argument, to be invoked when the event " "occurs. An Event instance will be passed as the argument. (Functions " "deployed this way are commonly known as *callbacks*.)" msgstr "" -#: ../../library/tkinter.rst:892 +#: ../../library/tkinter.rst:888 msgid "add" msgstr "" -#: ../../library/tkinter.rst:893 +#: ../../library/tkinter.rst:889 msgid "" "is optional, either ``''`` or ``'+'``. Passing an empty string denotes that " "this binding is to replace any other bindings that this event is associated " @@ -1602,7 +1592,7 @@ msgid "" "of functions bound to this event type." msgstr "" -#: ../../library/tkinter.rst:900 +#: ../../library/tkinter.rst:896 msgid "" "def turn_red(self, event):\n" " event.widget[\"activeforeground\"] = \"red\"\n" @@ -1614,7 +1604,7 @@ msgstr "" "\n" "self.button.bind(\"\", self.turn_red)" -#: ../../library/tkinter.rst:905 +#: ../../library/tkinter.rst:901 msgid "" "Notice how the widget field of the event is being accessed in the " "``turn_red()`` callback. This field contains the widget that caught the X " @@ -1623,209 +1613,209 @@ msgid "" "pages." msgstr "" -#: ../../library/tkinter.rst:911 +#: ../../library/tkinter.rst:907 msgid "Tkinter Event Field" msgstr "" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:909 msgid "%f" msgstr "%f" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:909 msgid "focus" msgstr "" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:909 msgid "%A" msgstr "%A" -#: ../../library/tkinter.rst:913 +#: ../../library/tkinter.rst:909 msgid "char" msgstr "char" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:911 msgid "%h" msgstr "%h" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:911 msgid "height" msgstr "" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:911 msgid "%E" msgstr "%E" -#: ../../library/tkinter.rst:915 +#: ../../library/tkinter.rst:911 msgid "send_event" msgstr "send_event" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:913 msgid "%k" msgstr "%k" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:913 msgid "keycode" msgstr "" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:913 msgid "%K" msgstr "%K" -#: ../../library/tkinter.rst:917 +#: ../../library/tkinter.rst:913 msgid "keysym" msgstr "" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:915 msgid "%s" msgstr "%s" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:915 msgid "state" msgstr "" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:915 msgid "%N" msgstr "%N" -#: ../../library/tkinter.rst:919 +#: ../../library/tkinter.rst:915 msgid "keysym_num" msgstr "keysym_num" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:917 msgid "%t" msgstr "%t" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:917 msgid "time" msgstr "" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:917 msgid "%T" msgstr "%T" -#: ../../library/tkinter.rst:921 +#: ../../library/tkinter.rst:917 msgid "type" msgstr "" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:919 msgid "%w" msgstr "%w" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:919 msgid "width" msgstr "" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:919 msgid "%W" msgstr "%W" -#: ../../library/tkinter.rst:923 +#: ../../library/tkinter.rst:919 msgid "widget" msgstr "" -#: ../../library/tkinter.rst:925 +#: ../../library/tkinter.rst:921 msgid "%x" msgstr "%x" -#: ../../library/tkinter.rst:925 +#: ../../library/tkinter.rst:921 msgid "x" msgstr "x" -#: ../../library/tkinter.rst:925 +#: ../../library/tkinter.rst:921 msgid "%X" msgstr "%X" -#: ../../library/tkinter.rst:925 +#: ../../library/tkinter.rst:921 msgid "x_root" msgstr "x_root" -#: ../../library/tkinter.rst:927 +#: ../../library/tkinter.rst:923 msgid "%y" msgstr "%y" -#: ../../library/tkinter.rst:927 +#: ../../library/tkinter.rst:923 msgid "y" msgstr "y" -#: ../../library/tkinter.rst:927 +#: ../../library/tkinter.rst:923 msgid "%Y" msgstr "%Y" -#: ../../library/tkinter.rst:927 +#: ../../library/tkinter.rst:923 msgid "y_root" msgstr "y_root" -#: ../../library/tkinter.rst:932 +#: ../../library/tkinter.rst:928 msgid "The index Parameter" msgstr "" -#: ../../library/tkinter.rst:934 +#: ../../library/tkinter.rst:930 msgid "" "A number of widgets require \"index\" parameters to be passed. These are " "used to point at a specific place in a Text widget, or to particular " "characters in an Entry widget, or to particular menu items in a Menu widget." msgstr "" -#: ../../library/tkinter.rst:938 +#: ../../library/tkinter.rst:934 msgid "Entry widget indexes (index, view index, etc.)" msgstr "" -#: ../../library/tkinter.rst:939 +#: ../../library/tkinter.rst:935 msgid "" "Entry widgets have options that refer to character positions in the text " "being displayed. You can use these :mod:`tkinter` functions to access these " "special points in text widgets:" msgstr "" -#: ../../library/tkinter.rst:943 +#: ../../library/tkinter.rst:939 msgid "Text widget indexes" msgstr "" -#: ../../library/tkinter.rst:944 +#: ../../library/tkinter.rst:940 msgid "" "The index notation for Text widgets is very rich and is best described in " "the Tk man pages." msgstr "" -#: ../../library/tkinter.rst:947 +#: ../../library/tkinter.rst:943 msgid "Menu indexes (menu.invoke(), menu.entryconfig(), etc.)" msgstr "" -#: ../../library/tkinter.rst:948 +#: ../../library/tkinter.rst:944 msgid "" "Some options and methods for menus manipulate specific menu entries. Anytime " "a menu index is needed for an option or a parameter, you may pass in:" msgstr "" -#: ../../library/tkinter.rst:951 +#: ../../library/tkinter.rst:947 msgid "" "an integer which refers to the numeric position of the entry in the widget, " "counted from the top, starting with 0;" msgstr "" -#: ../../library/tkinter.rst:954 +#: ../../library/tkinter.rst:950 msgid "" "the string ``\"active\"``, which refers to the menu position that is " "currently under the cursor;" msgstr "" -#: ../../library/tkinter.rst:957 +#: ../../library/tkinter.rst:953 msgid "the string ``\"last\"`` which refers to the last menu item;" msgstr "" -#: ../../library/tkinter.rst:959 +#: ../../library/tkinter.rst:955 msgid "" "An integer preceded by ``@``, as in ``@6``, where the integer is interpreted " "as a y pixel coordinate in the menu's coordinate system;" msgstr "" -#: ../../library/tkinter.rst:962 +#: ../../library/tkinter.rst:958 msgid "" "the string ``\"none\"``, which indicates no menu entry at all, most often " "used with menu.activate() to deactivate all entries, and finally," msgstr "" -#: ../../library/tkinter.rst:965 +#: ../../library/tkinter.rst:961 msgid "" "a text string that is pattern matched against the label of the menu entry, " "as scanned from the top of the menu to the bottom. Note that this index " @@ -1834,33 +1824,42 @@ msgid "" "above literals, instead." msgstr "" -#: ../../library/tkinter.rst:973 +#: ../../library/tkinter.rst:969 msgid "Images" msgstr "" -#: ../../library/tkinter.rst:975 +#: ../../library/tkinter.rst:971 msgid "" "Images of different formats can be created through the corresponding " "subclass of :class:`tkinter.Image`:" msgstr "" -#: ../../library/tkinter.rst:978 +#: ../../library/tkinter.rst:974 msgid ":class:`BitmapImage` for images in XBM format." msgstr "" -#: ../../library/tkinter.rst:980 +#: ../../library/tkinter.rst:976 msgid "" ":class:`PhotoImage` for images in PGM, PPM, GIF and PNG formats. The latter " "is supported starting with Tk 8.6." msgstr "" -#: ../../library/tkinter.rst:983 +#: ../../library/tkinter.rst:979 msgid "" "Either type of image is created through either the ``file`` or the ``data`` " "option (other options are available as well)." msgstr "" -#: ../../library/tkinter.rst:986 +#: ../../library/tkinter.rst:982 +msgid "" +"Added the :class:`!PhotoImage` method :meth:`!copy_replace` to copy a region " +"from one image to other image, possibly with pixel zooming and/or " +"subsampling. Add *from_coords* parameter to :class:`!PhotoImage` methods :" +"meth:`!copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and " +"*subsample* parameters to :class:`!PhotoImage` method :meth:`!copy`." +msgstr "" + +#: ../../library/tkinter.rst:991 msgid "" "The image object can then be used wherever an ``image`` option is supported " "by some widget (e.g. labels, buttons, menus). In these cases, Tk will not " @@ -1869,24 +1868,24 @@ msgid "" "empty box wherever the image was used." msgstr "" -#: ../../library/tkinter.rst:994 +#: ../../library/tkinter.rst:999 msgid "" "The `Pillow `_ package adds support for formats " "such as BMP, JPEG, TIFF, and WebP, among others." msgstr "" -#: ../../library/tkinter.rst:1000 +#: ../../library/tkinter.rst:1005 msgid "File Handlers" msgstr "" -#: ../../library/tkinter.rst:1002 +#: ../../library/tkinter.rst:1007 msgid "" "Tk allows you to register and unregister a callback function which will be " "called from the Tk mainloop when I/O is possible on a file descriptor. Only " "one handler may be registered per file descriptor. Example code::" msgstr "" -#: ../../library/tkinter.rst:1006 +#: ../../library/tkinter.rst:1011 msgid "" "import tkinter\n" "widget = tkinter.Tk()\n" @@ -1902,11 +1901,11 @@ msgstr "" "...\n" "widget.tk.deletefilehandler(file)" -#: ../../library/tkinter.rst:1013 +#: ../../library/tkinter.rst:1018 msgid "This feature is not available on Windows." msgstr "" -#: ../../library/tkinter.rst:1015 +#: ../../library/tkinter.rst:1020 msgid "" "Since you don't know how many bytes are available for reading, you may not " "want to use the :class:`~io.BufferedIOBase` or :class:`~io.TextIOBase` :meth:" @@ -1917,7 +1916,7 @@ msgid "" "maxbytecount)``." msgstr "" -#: ../../library/tkinter.rst:1026 +#: ../../library/tkinter.rst:1031 msgid "" "Registers the file handler callback function *func*. The *file* argument may " "either be an object with a :meth:`~io.IOBase.fileno` method (such as a file " @@ -1926,30 +1925,33 @@ msgid "" "as follows::" msgstr "" -#: ../../library/tkinter.rst:1032 +#: ../../library/tkinter.rst:1037 msgid "callback(file, mask)" msgstr "callback(file, mask)" -#: ../../library/tkinter.rst:1037 +#: ../../library/tkinter.rst:1042 msgid "Unregisters a file handler." msgstr "" -#: ../../library/tkinter.rst:1044 +#: ../../library/tkinter.rst:1049 msgid "Constants used in the *mask* arguments." msgstr "" -#: ../../library/tkinter.rst:640 +#: ../../library/tkinter.rst:636 msgid "packing (widgets)" msgstr "" -#: ../../library/tkinter.rst:753 +#: ../../library/tkinter.rst:749 msgid "window manager (widgets)" msgstr "" -#: ../../library/tkinter.rst:870 +#: ../../library/tkinter.rst:866 msgid "bind (widgets)" msgstr "" -#: ../../library/tkinter.rst:870 +#: ../../library/tkinter.rst:866 msgid "events (widgets)" msgstr "" + +#~ msgid ":mod:`tkinter.tix`" +#~ msgstr ":mod:`tkinter.tix`" diff --git a/library/tkinter.scrolledtext.po b/library/tkinter.scrolledtext.po index 820167e086..4076832764 100644 --- a/library/tkinter.scrolledtext.po +++ b/library/tkinter.scrolledtext.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2016-11-19 00:35+0000\n" diff --git a/library/tkinter.tix.po b/library/tkinter.tix.po deleted file mode 100644 index a8cd31502b..0000000000 --- a/library/tkinter.tix.po +++ /dev/null @@ -1,553 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2022-10-01 14:35+0800\n" -"Last-Translator: Adrian Liaw \n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.1.1\n" - -#: ../../library/tkinter.tix.rst:2 -msgid ":mod:`tkinter.tix` --- Extension widgets for Tk" -msgstr ":mod:`tkinter.tix` --- Tk 擴充小工具" - -#: ../../library/tkinter.tix.rst:9 -msgid "**Source code:** :source:`Lib/tkinter/tix.py`" -msgstr "**原始碼:**\\ :source:`Lib/tkinter/tix.py`" - -#: ../../library/tkinter.tix.rst:13 -msgid "" -"This Tk extension is unmaintained and should not be used in new code. Use :" -"mod:`tkinter.ttk` instead." -msgstr "" - -#: ../../library/tkinter.tix.rst:19 -msgid "" -"The :mod:`tkinter.tix` (Tk Interface Extension) module provides an " -"additional rich set of widgets. Although the standard Tk library has many " -"useful widgets, they are far from complete. The :mod:`tkinter.tix` library " -"provides most of the commonly needed widgets that are missing from standard " -"Tk: :class:`HList`, :class:`ComboBox`, :class:`Control` (a.k.a. SpinBox) and " -"an assortment of scrollable widgets. :mod:`tkinter.tix` also includes many " -"more widgets that are generally useful in a wide range of applications: :" -"class:`NoteBook`, :class:`FileEntry`, :class:`PanedWindow`, etc; there are " -"more than 40 of them." -msgstr "" - -#: ../../library/tkinter.tix.rst:29 -msgid "" -"With all these new widgets, you can introduce new interaction techniques " -"into applications, creating more useful and more intuitive user interfaces. " -"You can design your application by choosing the most appropriate widgets to " -"match the special needs of your application and users." -msgstr "" - -#: ../../library/tkinter.tix.rst:36 -msgid "`Tix Homepage `_" -msgstr "`Tix 首頁 `_" - -#: ../../library/tkinter.tix.rst:37 -msgid "" -"The home page for :mod:`Tix`. This includes links to additional " -"documentation and downloads." -msgstr "" - -#: ../../library/tkinter.tix.rst:40 -msgid "`Tix Man Pages `_" -msgstr "`Tix 首頁 `_" - -#: ../../library/tkinter.tix.rst:41 -msgid "On-line version of the man pages and reference material." -msgstr "" - -#: ../../library/tkinter.tix.rst:43 -msgid "" -"`Tix Programming Guide `_" -msgstr "" -"`Tix 程式指南 `_" - -#: ../../library/tkinter.tix.rst:44 -msgid "On-line version of the programmer's reference material." -msgstr "" - -#: ../../library/tkinter.tix.rst:46 -msgid "" -"`Tix Development Applications `_" -msgstr "" -"`Tix 開發應用程式 `_" - -#: ../../library/tkinter.tix.rst:47 -msgid "" -"Tix applications for development of Tix and Tkinter programs. Tide " -"applications work under Tk or Tkinter, and include :program:`TixInspect`, an " -"inspector to remotely modify and debug Tix/Tk/Tkinter applications." -msgstr "" - -#: ../../library/tkinter.tix.rst:53 -msgid "Using Tix" -msgstr "" - -#: ../../library/tkinter.tix.rst:58 -msgid "" -"Toplevel widget of Tix which represents mostly the main window of an " -"application. It has an associated Tcl interpreter." -msgstr "" - -#: ../../library/tkinter.tix.rst:61 -msgid "" -"Classes in the :mod:`tkinter.tix` module subclasses the classes in the :mod:" -"`tkinter`. The former imports the latter, so to use :mod:`tkinter.tix` with " -"Tkinter, all you need to do is to import one module. In general, you can " -"just import :mod:`tkinter.tix`, and replace the toplevel call to :class:" -"`tkinter.Tk` with :class:`tix.Tk`::" -msgstr "" - -#: ../../library/tkinter.tix.rst:67 -msgid "" -"from tkinter import tix\n" -"from tkinter.constants import *\n" -"root = tix.Tk()" -msgstr "" -"from tkinter import tix\n" -"from tkinter.constants import *\n" -"root = tix.Tk()" - -#: ../../library/tkinter.tix.rst:71 -msgid "" -"To use :mod:`tkinter.tix`, you must have the Tix widgets installed, usually " -"alongside your installation of the Tk widgets. To test your installation, " -"try the following::" -msgstr "" - -#: ../../library/tkinter.tix.rst:75 -msgid "" -"from tkinter import tix\n" -"root = tix.Tk()\n" -"root.tk.eval('package require Tix')" -msgstr "" -"from tkinter import tix\n" -"root = tix.Tk()\n" -"root.tk.eval('package require Tix')" - -#: ../../library/tkinter.tix.rst:81 -msgid "Tix Widgets" -msgstr "" - -#: ../../library/tkinter.tix.rst:83 -msgid "" -"`Tix `_ introduces over 40 widget classes to the :mod:`tkinter` repertoire." -msgstr "" - -#: ../../library/tkinter.tix.rst:88 -msgid "Basic Widgets" -msgstr "" - -#: ../../library/tkinter.tix.rst:93 -msgid "" -"A `Balloon `_ that pops up over a widget to provide help. When the user " -"moves the cursor inside a widget to which a Balloon widget has been bound, a " -"small pop-up window with a descriptive message will be shown on the screen." -msgstr "" - -#: ../../library/tkinter.tix.rst:105 -msgid "" -"The `ButtonBox `_ widget creates a box of buttons, such as is commonly " -"used for ``Ok Cancel``." -msgstr "" - -#: ../../library/tkinter.tix.rst:115 -msgid "" -"The `ComboBox `_ widget is similar to the combo box control in MS Windows. " -"The user can select a choice by either typing in the entry subwidget or " -"selecting from the listbox subwidget." -msgstr "" - -#: ../../library/tkinter.tix.rst:127 -msgid "" -"The `Control `_ widget is also known as the :class:`SpinBox` widget. The " -"user can adjust the value by pressing the two arrow buttons or by entering " -"the value directly into the entry. The new value will be checked against the " -"user-defined upper and lower limits." -msgstr "" - -#: ../../library/tkinter.tix.rst:140 -msgid "" -"The `LabelEntry `_ widget packages an entry widget and a label into one " -"mega widget. It can be used to simplify the creation of \"entry-form\" type " -"of interface." -msgstr "" - -#: ../../library/tkinter.tix.rst:151 -msgid "" -"The `LabelFrame `_ widget packages a frame widget and a label into one " -"mega widget. To create widgets inside a LabelFrame widget, one creates the " -"new widgets relative to the :attr:`frame` subwidget and manage them inside " -"the :attr:`frame` subwidget." -msgstr "" - -#: ../../library/tkinter.tix.rst:163 -msgid "" -"The `Meter `_ widget can be used to show the progress of a background job " -"which may take a long time to execute." -msgstr "" - -#: ../../library/tkinter.tix.rst:174 -msgid "" -"The `OptionMenu `_ creates a menu button of options." -msgstr "" - -#: ../../library/tkinter.tix.rst:184 -msgid "" -"The `PopupMenu `_ widget can be used as a replacement of the ``tk_popup`` " -"command. The advantage of the :mod:`Tix` :class:`PopupMenu` widget is it " -"requires less application code to manipulate." -msgstr "" - -#: ../../library/tkinter.tix.rst:196 -msgid "" -"The `Select `_ widget is a container of button subwidgets. It can be used " -"to provide radio-box or check-box style of selection options for the user." -msgstr "" - -#: ../../library/tkinter.tix.rst:207 -msgid "" -"The `StdButtonBox `_ widget is a group of standard buttons for Motif-like " -"dialog boxes." -msgstr "" - -#: ../../library/tkinter.tix.rst:216 -msgid "File Selectors" -msgstr "" - -#: ../../library/tkinter.tix.rst:221 -msgid "" -"The `DirList `_ widget displays a list view of a directory, its previous " -"directories and its sub-directories. The user can choose one of the " -"directories displayed in the list or change to another directory." -msgstr "" - -#: ../../library/tkinter.tix.rst:233 -msgid "" -"The `DirTree `_ widget displays a tree view of a directory, its previous " -"directories and its sub-directories. The user can choose one of the " -"directories displayed in the list or change to another directory." -msgstr "" - -#: ../../library/tkinter.tix.rst:245 -msgid "" -"The `DirSelectDialog `_ widget presents the directories in the file " -"system in a dialog window. The user can use this dialog window to navigate " -"through the file system to select the desired directory." -msgstr "" - -#: ../../library/tkinter.tix.rst:257 -msgid "" -"The :class:`DirSelectBox` is similar to the standard Motif(TM) directory-" -"selection box. It is generally used for the user to choose a directory. " -"DirSelectBox stores the directories mostly recently selected into a ComboBox " -"widget so that they can be quickly selected again." -msgstr "" - -#: ../../library/tkinter.tix.rst:265 -msgid "" -"The `ExFileSelectBox `_ widget is usually embedded in a " -"tixExFileSelectDialog widget. It provides a convenient method for the user " -"to select files. The style of the :class:`ExFileSelectBox` widget is very " -"similar to the standard file dialog on MS Windows 3.1." -msgstr "" - -#: ../../library/tkinter.tix.rst:278 -msgid "" -"The `FileSelectBox `_ is similar to the standard Motif(TM) file-selection " -"box. It is generally used for the user to choose a file. FileSelectBox " -"stores the files mostly recently selected into a :class:`ComboBox` widget so " -"that they can be quickly selected again." -msgstr "" - -#: ../../library/tkinter.tix.rst:291 -msgid "" -"The `FileEntry `_ widget can be used to input a filename. The user can " -"type in the filename manually. Alternatively, the user can press the button " -"widget that sits next to the entry, which will bring up a file selection " -"dialog." -msgstr "" - -#: ../../library/tkinter.tix.rst:302 -msgid "Hierarchical ListBox" -msgstr "" - -#: ../../library/tkinter.tix.rst:307 -msgid "" -"The `HList `_ widget can be used to display any data that have a " -"hierarchical structure, for example, file system directory trees. The list " -"entries are indented and connected by branch lines according to their places " -"in the hierarchy." -msgstr "" - -#: ../../library/tkinter.tix.rst:319 -msgid "" -"The `CheckList `_ widget displays a list of items to be selected by the " -"user. CheckList acts similarly to the Tk checkbutton or radiobutton widgets, " -"except it is capable of handling many more items than checkbuttons or " -"radiobuttons." -msgstr "" - -#: ../../library/tkinter.tix.rst:335 -msgid "" -"The `Tree `_ widget can be used to display hierarchical data in a tree form. The " -"user can adjust the view of the tree by opening or closing parts of the tree." -msgstr "" - -#: ../../library/tkinter.tix.rst:347 -msgid "Tabular ListBox" -msgstr "" - -#: ../../library/tkinter.tix.rst:352 -msgid "" -"The `TList `_ widget can be used to display data in a tabular format. The " -"list entries of a :class:`TList` widget are similar to the entries in the Tk " -"listbox widget. The main differences are (1) the :class:`TList` widget can " -"display the list entries in a two dimensional format and (2) you can use " -"graphical images as well as multiple colors and fonts for the list entries." -msgstr "" - -#: ../../library/tkinter.tix.rst:375 -msgid "Manager Widgets" -msgstr "" - -#: ../../library/tkinter.tix.rst:380 -msgid "" -"The `PanedWindow `_ widget allows the user to interactively manipulate the " -"sizes of several panes. The panes can be arranged either vertically or " -"horizontally. The user changes the sizes of the panes by dragging the " -"resize handle between two panes." -msgstr "" - -#: ../../library/tkinter.tix.rst:392 -msgid "" -"The `ListNoteBook `_ widget is very similar to the :class:`TixNoteBook` " -"widget: it can be used to display many windows in a limited space using a " -"notebook metaphor. The notebook is divided into a stack of pages (windows). " -"At one time only one of these pages can be shown. The user can navigate " -"through these pages by choosing the name of the desired page in the :attr:" -"`hlist` subwidget." -msgstr "" - -#: ../../library/tkinter.tix.rst:406 -msgid "" -"The `NoteBook `_ widget can be used to display many windows in a limited " -"space using a notebook metaphor. The notebook is divided into a stack of " -"pages. At one time only one of these pages can be shown. The user can " -"navigate through these pages by choosing the visual \"tabs\" at the top of " -"the NoteBook widget." -msgstr "" - -#: ../../library/tkinter.tix.rst:428 -msgid "Image Types" -msgstr "" - -#: ../../library/tkinter.tix.rst:430 -msgid "The :mod:`tkinter.tix` module adds:" -msgstr "" - -#: ../../library/tkinter.tix.rst:432 -msgid "" -"`pixmap `_ capabilities to all :mod:`tkinter.tix` and :mod:`tkinter` widgets to " -"create color images from XPM files." -msgstr "" - -#: ../../library/tkinter.tix.rst:441 -msgid "" -"`Compound `_ image types can be used to create images that consists of multiple " -"horizontal lines; each line is composed of a series of items (texts, " -"bitmaps, images or spaces) arranged from left to right. For example, a " -"compound image can be used to display a bitmap and a text string " -"simultaneously in a Tk :class:`Button` widget." -msgstr "" - -#: ../../library/tkinter.tix.rst:460 -msgid "Miscellaneous Widgets" -msgstr "" - -#: ../../library/tkinter.tix.rst:465 -msgid "" -"The `InputOnly `_ widgets are to accept inputs from the user, which can be " -"done with the ``bind`` command (Unix only)." -msgstr "" - -#: ../../library/tkinter.tix.rst:472 -msgid "Form Geometry Manager" -msgstr "" - -#: ../../library/tkinter.tix.rst:474 -msgid "In addition, :mod:`tkinter.tix` augments :mod:`tkinter` by providing:" -msgstr "" - -#: ../../library/tkinter.tix.rst:479 -msgid "" -"The `Form `_ geometry manager based on attachment rules for all Tk widgets." -msgstr "" - -#: ../../library/tkinter.tix.rst:485 -msgid "Tix Commands" -msgstr "Tix 指令" - -#: ../../library/tkinter.tix.rst:490 -msgid "" -"The `tix commands `_ provide access to miscellaneous elements of :mod:`Tix`'s internal " -"state and the :mod:`Tix` application context. Most of the information " -"manipulated by these methods pertains to the application as a whole, or to a " -"screen or display, rather than to a particular window." -msgstr "" - -#: ../../library/tkinter.tix.rst:497 -msgid "To view the current settings, the common usage is::" -msgstr "" - -#: ../../library/tkinter.tix.rst:499 -msgid "" -"from tkinter import tix\n" -"root = tix.Tk()\n" -"print(root.tix_configure())" -msgstr "" -"from tkinter import tix\n" -"root = tix.Tk()\n" -"print(root.tix_configure())" - -#: ../../library/tkinter.tix.rst:506 -msgid "" -"Query or modify the configuration options of the Tix application context. If " -"no option is specified, returns a dictionary all of the available options. " -"If option is specified with no value, then the method returns a list " -"describing the one named option (this list will be identical to the " -"corresponding sublist of the value returned if no option is specified). If " -"one or more option-value pairs are specified, then the method modifies the " -"given option(s) to have the given value(s); in this case the method returns " -"an empty string. Option may be any of the configuration options." -msgstr "" - -#: ../../library/tkinter.tix.rst:518 -msgid "" -"Returns the current value of the configuration option given by *option*. " -"Option may be any of the configuration options." -msgstr "" - -#: ../../library/tkinter.tix.rst:524 -msgid "" -"Locates a bitmap file of the name ``name.xpm`` or ``name`` in one of the " -"bitmap directories (see the :meth:`tix_addbitmapdir` method). By using :" -"meth:`tix_getbitmap`, you can avoid hard coding the pathnames of the bitmap " -"files in your application. When successful, it returns the complete pathname " -"of the bitmap file, prefixed with the character ``@``. The returned value " -"can be used to configure the ``bitmap`` option of the Tk and Tix widgets." -msgstr "" - -#: ../../library/tkinter.tix.rst:534 -msgid "" -"Tix maintains a list of directories under which the :meth:`tix_getimage` " -"and :meth:`tix_getbitmap` methods will search for image files. The standard " -"bitmap directory is :file:`$TIX_LIBRARY/bitmaps`. The :meth:" -"`tix_addbitmapdir` method adds *directory* into this list. By using this " -"method, the image files of an applications can also be located using the :" -"meth:`tix_getimage` or :meth:`tix_getbitmap` method." -msgstr "" - -#: ../../library/tkinter.tix.rst:544 -msgid "" -"Returns the file selection dialog that may be shared among different calls " -"from this application. This method will create a file selection dialog " -"widget when it is called the first time. This dialog will be returned by all " -"subsequent calls to :meth:`tix_filedialog`. An optional dlgclass parameter " -"can be passed as a string to specified what type of file selection dialog " -"widget is desired. Possible options are ``tix``, ``FileSelectDialog`` or " -"``tixExFileSelectDialog``." -msgstr "" - -#: ../../library/tkinter.tix.rst:554 -msgid "" -"Locates an image file of the name :file:`name.xpm`, :file:`name.xbm` or :" -"file:`name.ppm` in one of the bitmap directories (see the :meth:" -"`tix_addbitmapdir` method above). If more than one file with the same name " -"(but different extensions) exist, then the image type is chosen according to " -"the depth of the X display: xbm images are chosen on monochrome displays and " -"color images are chosen on color displays. By using :meth:`tix_getimage`, " -"you can avoid hard coding the pathnames of the image files in your " -"application. When successful, this method returns the name of the newly " -"created image, which can be used to configure the ``image`` option of the Tk " -"and Tix widgets." -msgstr "" - -#: ../../library/tkinter.tix.rst:567 -msgid "Gets the options maintained by the Tix scheme mechanism." -msgstr "" - -#: ../../library/tkinter.tix.rst:572 -msgid "" -"Resets the scheme and fontset of the Tix application to *newScheme* and " -"*newFontSet*, respectively. This affects only those widgets created after " -"this call. Therefore, it is best to call the resetoptions method before the " -"creation of any widgets in a Tix application." -msgstr "" - -#: ../../library/tkinter.tix.rst:577 -msgid "" -"The optional parameter *newScmPrio* can be given to reset the priority level " -"of the Tk options set by the Tix schemes." -msgstr "" - -#: ../../library/tkinter.tix.rst:580 -msgid "" -"Because of the way Tk handles the X option database, after Tix has been has " -"imported and inited, it is not possible to reset the color schemes and font " -"sets using the :meth:`tix_config` method. Instead, the :meth:" -"`tix_resetoptions` method must be used." -msgstr "" - -#: ../../library/tkinter.tix.rst:11 -msgid "Tix" -msgstr "Tix" diff --git a/library/tkinter.ttk.po b/library/tkinter.ttk.po index 572a9b9cf0..52ae5a7140 100644 --- a/library/tkinter.ttk.po +++ b/library/tkinter.ttk.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1532,7 +1532,7 @@ msgid "" msgstr "" #: ../../library/tkinter.ttk.rst:987 ../../library/tkinter.ttk.rst:1042 -#: ../../library/tkinter.ttk.rst:1520 +#: ../../library/tkinter.ttk.rst:1578 msgid "The valid options/values are:" msgstr "有效的選項/值為:" @@ -2120,71 +2120,73 @@ msgstr "" #: ../../library/tkinter.ttk.rst:1393 msgid "" "Create a new element in the current theme, of the given *etype* which is " -"expected to be either \"image\" or \"from\"." +"expected to be either \"image\", \"from\" or \"vsapi\". The latter is only " +"available in Tk 8.6 on Windows." msgstr "" -#: ../../library/tkinter.ttk.rst:1396 +#: ../../library/tkinter.ttk.rst:1397 msgid "" "If \"image\" is used, *args* should contain the default image name followed " "by statespec/value pairs (this is the imagespec), and *kw* may have the " "following options:" msgstr "" -#: ../../library/tkinter.ttk.rst:1400 +#: ../../library/tkinter.ttk.rst:1401 msgid "border=padding" msgstr "border=padding" -#: ../../library/tkinter.ttk.rst:1401 +#: ../../library/tkinter.ttk.rst:1402 msgid "" "padding is a list of up to four integers, specifying the left, top, right, " "and bottom borders, respectively." msgstr "" -#: ../../library/tkinter.ttk.rst:1404 +#: ../../library/tkinter.ttk.rst:1405 ../../library/tkinter.ttk.rst:1479 msgid "height=height" msgstr "height=height" -#: ../../library/tkinter.ttk.rst:1405 +#: ../../library/tkinter.ttk.rst:1406 msgid "" "Specifies a minimum height for the element. If less than zero, the base " "image's height is used as a default." msgstr "" -#: ../../library/tkinter.ttk.rst:1408 +#: ../../library/tkinter.ttk.rst:1409 ../../library/tkinter.ttk.rst:1453 msgid "padding=padding" msgstr "padding=padding" -#: ../../library/tkinter.ttk.rst:1409 +#: ../../library/tkinter.ttk.rst:1410 msgid "" "Specifies the element's interior padding. Defaults to border's value if not " "specified." msgstr "" -#: ../../library/tkinter.ttk.rst:1412 +#: ../../library/tkinter.ttk.rst:1413 msgid "sticky=spec" msgstr "sticky=spec" -#: ../../library/tkinter.ttk.rst:1413 +#: ../../library/tkinter.ttk.rst:1414 msgid "" "Specifies how the image is placed within the final parcel. spec contains " "zero or more characters \"n\", \"s\", \"w\", or \"e\"." msgstr "" -#: ../../library/tkinter.ttk.rst:1416 +#: ../../library/tkinter.ttk.rst:1417 ../../library/tkinter.ttk.rst:1471 msgid "width=width" msgstr "width=width" -#: ../../library/tkinter.ttk.rst:1417 +#: ../../library/tkinter.ttk.rst:1418 msgid "" "Specifies a minimum width for the element. If less than zero, the base " "image's width is used as a default." msgstr "" -#: ../../library/tkinter.ttk.rst:1420 ../../library/tkinter.ttk.rst:1437 +#: ../../library/tkinter.ttk.rst:1421 ../../library/tkinter.ttk.rst:1438 +#: ../../library/tkinter.ttk.rst:1483 msgid "Example::" msgstr "範例: ::" -#: ../../library/tkinter.ttk.rst:1422 +#: ../../library/tkinter.ttk.rst:1423 msgid "" "img1 = tkinter.PhotoImage(master=root, file='button.png')\n" "img1 = tkinter.PhotoImage(master=root, file='button-pressed.png')\n" @@ -2202,7 +2204,7 @@ msgstr "" " img1, ('pressed', img2), ('active', img3),\n" " border=(2, 4), sticky='we')" -#: ../../library/tkinter.ttk.rst:1430 +#: ../../library/tkinter.ttk.rst:1431 msgid "" "If \"from\" is used as the value of *etype*, :meth:`element_create` will " "clone an existing element. *args* is expected to contain a themename, from " @@ -2211,7 +2213,7 @@ msgid "" "used. *kw* is discarded." msgstr "" -#: ../../library/tkinter.ttk.rst:1439 +#: ../../library/tkinter.ttk.rst:1440 msgid "" "style = ttk.Style(root)\n" "style.element_create('plain.background', 'from', 'default')" @@ -2219,19 +2221,86 @@ msgstr "" "style = ttk.Style(root)\n" "style.element_create('plain.background', 'from', 'default')" -#: ../../library/tkinter.ttk.rst:1445 +#: ../../library/tkinter.ttk.rst:1443 +msgid "" +"If \"vsapi\" is used as the value of *etype*, :meth:`element_create` will " +"create a new element in the current theme whose visual appearance is drawn " +"using the Microsoft Visual Styles API which is responsible for the themed " +"styles on Windows XP and Vista. *args* is expected to contain the Visual " +"Styles class and part as given in the Microsoft documentation followed by an " +"optional sequence of tuples of ttk states and the corresponding Visual " +"Styles API state value. *kw* may have the following options:" +msgstr "" + +#: ../../library/tkinter.ttk.rst:1454 +msgid "" +"Specify the element's interior padding. *padding* is a list of up to four " +"integers specifying the left, top, right and bottom padding quantities " +"respectively. If fewer than four elements are specified, bottom defaults to " +"top, right defaults to left, and top defaults to left. In other words, a " +"list of three numbers specify the left, vertical, and right padding; a list " +"of two numbers specify the horizontal and the vertical padding; a single " +"number specifies the same padding all the way around the widget. This option " +"may not be mixed with any other options." +msgstr "" + +#: ../../library/tkinter.ttk.rst:1465 +#, fuzzy +msgid "margins=padding" +msgstr "padding=padding" + +#: ../../library/tkinter.ttk.rst:1466 +msgid "" +"Specifies the elements exterior padding. *padding* is a list of up to four " +"integers specifying the left, top, right and bottom padding quantities " +"respectively. This option may not be mixed with any other options." +msgstr "" + +#: ../../library/tkinter.ttk.rst:1472 +msgid "" +"Specifies the width for the element. If this option is set then the Visual " +"Styles API will not be queried for the recommended size or the part. If this " +"option is set then *height* should also be set. The *width* and *height* " +"options cannot be mixed with the *padding* or *margins* options." +msgstr "" + +#: ../../library/tkinter.ttk.rst:1480 +msgid "Specifies the height of the element. See the comments for *width*." +msgstr "" + +#: ../../library/tkinter.ttk.rst:1485 +msgid "" +"style = ttk.Style(root)\n" +"style.element_create('pin', 'vsapi', 'EXPLORERBAR', 3, [\n" +" ('pressed', '!selected', 3),\n" +" ('active', '!selected', 2),\n" +" ('pressed', 'selected', 6),\n" +" ('active', 'selected', 5),\n" +" ('selected', 4),\n" +" ('', 1)])\n" +"style.layout('Explorer.Pin',\n" +" [('Explorer.Pin.pin', {'sticky': 'news'})])\n" +"pin = ttk.Checkbutton(style='Explorer.Pin')\n" +"pin.pack(expand=True, fill='both')" +msgstr "" + +#: ../../library/tkinter.ttk.rst:1498 +msgid "Added support of the \"vsapi\" element factory." +msgstr "" + +#: ../../library/tkinter.ttk.rst:1503 msgid "Returns the list of elements defined in the current theme." msgstr "" -#: ../../library/tkinter.ttk.rst:1450 +#: ../../library/tkinter.ttk.rst:1508 msgid "Returns the list of *elementname*'s options." msgstr "" -#: ../../library/tkinter.ttk.rst:1455 +#: ../../library/tkinter.ttk.rst:1513 msgid "Create a new theme." msgstr "" -#: ../../library/tkinter.ttk.rst:1457 +#: ../../library/tkinter.ttk.rst:1515 msgid "" "It is an error if *themename* already exists. If *parent* is specified, the " "new theme will inherit styles, elements and layouts from the parent theme. " @@ -2239,13 +2308,13 @@ msgid "" "for :meth:`theme_settings`." msgstr "" -#: ../../library/tkinter.ttk.rst:1465 +#: ../../library/tkinter.ttk.rst:1523 msgid "" "Temporarily sets the current theme to *themename*, apply specified " "*settings* and then restore the previous theme." msgstr "" -#: ../../library/tkinter.ttk.rst:1468 +#: ../../library/tkinter.ttk.rst:1526 msgid "" "Each key in *settings* is a style and each value may contain the keys " "'configure', 'map', 'layout' and 'element create' and they are expected to " @@ -2254,11 +2323,11 @@ msgid "" "respectively." msgstr "" -#: ../../library/tkinter.ttk.rst:1474 +#: ../../library/tkinter.ttk.rst:1532 msgid "As an example, let's change the Combobox for the default theme a bit::" msgstr "" -#: ../../library/tkinter.ttk.rst:1476 +#: ../../library/tkinter.ttk.rst:1534 msgid "" "from tkinter import ttk\n" "import tkinter\n" @@ -2306,22 +2375,22 @@ msgstr "" "\n" "root.mainloop()" -#: ../../library/tkinter.ttk.rst:1502 +#: ../../library/tkinter.ttk.rst:1560 msgid "Returns a list of all known themes." msgstr "回傳所有已知的主題。" -#: ../../library/tkinter.ttk.rst:1507 +#: ../../library/tkinter.ttk.rst:1565 msgid "" "If *themename* is not given, returns the theme in use. Otherwise, sets the " "current theme to *themename*, refreshes all widgets and emits a " "<> event." msgstr "" -#: ../../library/tkinter.ttk.rst:1513 +#: ../../library/tkinter.ttk.rst:1571 msgid "Layouts" msgstr "" -#: ../../library/tkinter.ttk.rst:1515 +#: ../../library/tkinter.ttk.rst:1573 msgid "" "A layout can be just ``None``, if it takes no options, or a dict of options " "specifying how to arrange the element. The layout mechanism uses a " @@ -2329,40 +2398,40 @@ msgid "" "each element is allocated a parcel." msgstr "" -#: ../../library/tkinter.ttk.rst:1522 +#: ../../library/tkinter.ttk.rst:1580 msgid "*side*: whichside" msgstr "" -#: ../../library/tkinter.ttk.rst:1523 +#: ../../library/tkinter.ttk.rst:1581 msgid "" "Specifies which side of the cavity to place the element; one of top, right, " "bottom or left. If omitted, the element occupies the entire cavity." msgstr "" -#: ../../library/tkinter.ttk.rst:1527 +#: ../../library/tkinter.ttk.rst:1585 msgid "*sticky*: nswe" msgstr "" -#: ../../library/tkinter.ttk.rst:1528 +#: ../../library/tkinter.ttk.rst:1586 msgid "Specifies where the element is placed inside its allocated parcel." msgstr "" -#: ../../library/tkinter.ttk.rst:1530 +#: ../../library/tkinter.ttk.rst:1588 msgid "*unit*: 0 or 1" msgstr "*unit*:0 或 1" -#: ../../library/tkinter.ttk.rst:1531 +#: ../../library/tkinter.ttk.rst:1589 msgid "" "If set to 1, causes the element and all of its descendants to be treated as " "a single element for the purposes of :meth:`Widget.identify` et al. It's " "used for things like scrollbar thumbs with grips." msgstr "" -#: ../../library/tkinter.ttk.rst:1535 +#: ../../library/tkinter.ttk.rst:1593 msgid "*children*: [sublayout... ]" msgstr "" -#: ../../library/tkinter.ttk.rst:1536 +#: ../../library/tkinter.ttk.rst:1594 msgid "" "Specifies a list of elements to place inside the element. Each element is a " "tuple (or other sequence type) where the first item is the layout name, and " diff --git a/library/token.po b/library/token.po index c1ca41b9e8..bd30000c13 100644 --- a/library/token.po +++ b/library/token.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-08-30 18:24+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -288,7 +288,7 @@ msgid "" msgstr "" #: ../../library/token.rst:82 -msgid "Added :data:`AWAIT` and :data:`ASYNC` tokens." +msgid "Added :data:`!AWAIT` and :data:`!ASYNC` tokens." msgstr "" #: ../../library/token.rst:85 @@ -297,14 +297,18 @@ msgstr "" #: ../../library/token.rst:88 msgid "" -"Removed :data:`AWAIT` and :data:`ASYNC` tokens. \"async\" and \"await\" are " -"now tokenized as :data:`NAME` tokens." +"Removed :data:`!AWAIT` and :data:`!ASYNC` tokens. \"async\" and \"await\" " +"are now tokenized as :data:`NAME` tokens." msgstr "" #: ../../library/token.rst:92 msgid "" "Added :data:`TYPE_COMMENT`, :data:`TYPE_IGNORE`, :data:`COLONEQUAL`. Added :" -"data:`AWAIT` and :data:`ASYNC` tokens back (they're needed to support " +"data:`!AWAIT` and :data:`!ASYNC` tokens back (they're needed to support " "parsing older Python versions for :func:`ast.parse` with ``feature_version`` " "set to 6 or lower)." msgstr "" + +#: ../../library/token.rst:98 +msgid "Removed :data:`!AWAIT` and :data:`!ASYNC` tokens again." +msgstr "" diff --git a/library/tokenize.po b/library/tokenize.po index 29113c47b9..32d1dd0754 100644 --- a/library/tokenize.po +++ b/library/tokenize.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/tomllib.po b/library/tomllib.po index 9f0fda8290..45bf2403d2 100644 --- a/library/tomllib.po +++ b/library/tomllib.po @@ -5,9 +5,9 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-11 21:40+0800\n" +"POT-Creation-Date: 2024-09-24 23:08+0000\n" "PO-Revision-Date: 2022-11-18 01:56+0800\n" "Last-Translator: Matt Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" diff --git a/library/trace.po b/library/trace.po index 6d8c7bc01b..6149b689ae 100644 --- a/library/trace.po +++ b/library/trace.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -232,7 +232,7 @@ msgstr "" msgid "Merge in data from another :class:`CoverageResults` object." msgstr "" -#: ../../library/trace.rst:192 +#: ../../library/trace.rst:193 msgid "" "Write coverage results. Set *show_missing* to show lines that had no hits. " "Set *summary* to include in the output the coverage summary per module. " @@ -241,11 +241,22 @@ msgid "" "directory." msgstr "" -#: ../../library/trace.rst:198 +#: ../../library/trace.rst:199 +msgid "" +"If *ignore_missing_files* is ``True``, coverage counts for files that no " +"longer exist are silently ignored. Otherwise, a missing file will raise a :" +"exc:`FileNotFoundError`." +msgstr "" + +#: ../../library/trace.rst:203 +msgid "Added *ignore_missing_files* parameter." +msgstr "" + +#: ../../library/trace.rst:206 msgid "A simple example demonstrating the use of the programmatic interface::" msgstr "" -#: ../../library/trace.rst:200 +#: ../../library/trace.rst:208 msgid "" "import sys\n" "import trace\n" diff --git a/library/traceback.po b/library/traceback.po index 850a2f458f..5d2a56c436 100644 --- a/library/traceback.po +++ b/library/traceback.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -128,11 +128,11 @@ msgid "" "when printing an unhandled exception." msgstr "" -#: ../../library/traceback.rst:87 ../../library/traceback.rst:184 +#: ../../library/traceback.rst:87 ../../library/traceback.rst:191 msgid "The *etype* argument is ignored and inferred from the type of *value*." msgstr "" -#: ../../library/traceback.rst:90 ../../library/traceback.rst:167 +#: ../../library/traceback.rst:90 ../../library/traceback.rst:171 msgid "" "The *etype* parameter has been renamed to *exc* and is now positional-only." msgstr "" @@ -209,13 +209,24 @@ msgid "" "ignored in order to provide backwards compatibility." msgstr "" -#: ../../library/traceback.rst:171 +#: ../../library/traceback.rst:167 ../../library/traceback.rst:394 +msgid "" +"When *show_group* is ``True``, and the exception is an instance of :exc:" +"`BaseExceptionGroup`, the nested exceptions are included as well, " +"recursively, with indentation relative to their nesting depth." +msgstr "" + +#: ../../library/traceback.rst:175 msgid "" "The returned list now includes any :attr:`notes ` " "attached to the exception." msgstr "" -#: ../../library/traceback.rst:178 +#: ../../library/traceback.rst:179 +msgid "*show_group* parameter was added." +msgstr "" + +#: ../../library/traceback.rst:185 msgid "" "Format a stack trace and the exception information. The arguments have the " "same meaning as the corresponding arguments to :func:`print_exception`. The " @@ -224,68 +235,68 @@ msgid "" "printed, exactly the same text is printed as does :func:`print_exception`." msgstr "" -#: ../../library/traceback.rst:187 +#: ../../library/traceback.rst:194 msgid "" "This function's behavior and signature were modified to match :func:" "`print_exception`." msgstr "" -#: ../../library/traceback.rst:194 +#: ../../library/traceback.rst:201 msgid "" "This is like ``print_exc(limit)`` but returns a string instead of printing " "to a file." msgstr "" -#: ../../library/traceback.rst:200 +#: ../../library/traceback.rst:207 msgid "A shorthand for ``format_list(extract_tb(tb, limit))``." msgstr "``format_list(extract_tb(tb, limit))`` 的簡寫。" -#: ../../library/traceback.rst:205 +#: ../../library/traceback.rst:212 msgid "A shorthand for ``format_list(extract_stack(f, limit))``." msgstr "``format_list(extract_stack(f, limit))`` 的簡寫。" -#: ../../library/traceback.rst:209 +#: ../../library/traceback.rst:216 msgid "" "Clears the local variables of all the stack frames in a :ref:`traceback " "` *tb* by calling the :meth:`~frame.clear` method of " "each :ref:`frame object `." msgstr "" -#: ../../library/traceback.rst:218 +#: ../../library/traceback.rst:225 msgid "" "Walk a stack following :attr:`f.f_back ` from the given frame, " "yielding the frame and line number for each frame. If *f* is ``None``, the " "current stack is used. This helper is used with :meth:`StackSummary.extract`." msgstr "" -#: ../../library/traceback.rst:227 +#: ../../library/traceback.rst:234 msgid "" "Walk a traceback following :attr:`~traceback.tb_next` yielding the frame and " "line number for each frame. This helper is used with :meth:`StackSummary." "extract`." msgstr "" -#: ../../library/traceback.rst:233 +#: ../../library/traceback.rst:240 msgid "The module also defines the following classes:" msgstr "" -#: ../../library/traceback.rst:236 +#: ../../library/traceback.rst:243 msgid ":class:`!TracebackException` Objects" msgstr ":class:`!TracebackException` 物件" -#: ../../library/traceback.rst:240 +#: ../../library/traceback.rst:247 msgid "" ":class:`!TracebackException` objects are created from actual exceptions to " "capture data for later printing in a lightweight fashion." msgstr "" -#: ../../library/traceback.rst:245 ../../library/traceback.rst:344 +#: ../../library/traceback.rst:252 ../../library/traceback.rst:359 msgid "" "Capture an exception for later rendering. *limit*, *lookup_lines* and " "*capture_locals* are as for the :class:`StackSummary` class." msgstr "" -#: ../../library/traceback.rst:248 +#: ../../library/traceback.rst:255 msgid "" "If *compact* is true, only data that is required by :class:`!" "TracebackException`'s :meth:`format` method is saved in the class " @@ -293,12 +304,12 @@ msgid "" "if :attr:`__cause__` is ``None`` and :attr:`__suppress_context__` is false." msgstr "" -#: ../../library/traceback.rst:254 ../../library/traceback.rst:347 +#: ../../library/traceback.rst:261 ../../library/traceback.rst:362 msgid "" "Note that when locals are captured, they are also shown in the traceback." msgstr "" -#: ../../library/traceback.rst:256 +#: ../../library/traceback.rst:263 msgid "" "*max_group_width* and *max_group_depth* control the formatting of exception " "groups (see :exc:`BaseExceptionGroup`). The depth refers to the nesting " @@ -307,147 +318,157 @@ msgid "" "limit is exceeded." msgstr "" -#: ../../library/traceback.rst:262 +#: ../../library/traceback.rst:269 msgid "Added the *compact* parameter." msgstr "新增 *compact* 參數。" -#: ../../library/traceback.rst:265 +#: ../../library/traceback.rst:272 msgid "Added the *max_group_width* and *max_group_depth* parameters." msgstr "新增 *max_group_width* 和 *max_group_depth* 參數。" -#: ../../library/traceback.rst:270 +#: ../../library/traceback.rst:277 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__cause__`." msgstr "" -#: ../../library/traceback.rst:275 +#: ../../library/traceback.rst:282 msgid "" "A :class:`!TracebackException` of the original :attr:`~BaseException." "__context__`." msgstr "" -#: ../../library/traceback.rst:280 +#: ../../library/traceback.rst:287 msgid "" "If ``self`` represents an :exc:`ExceptionGroup`, this field holds a list of :" "class:`!TracebackException` instances representing the nested exceptions. " "Otherwise it is ``None``." msgstr "" -#: ../../library/traceback.rst:288 +#: ../../library/traceback.rst:295 msgid "" "The :attr:`~BaseException.__suppress_context__` value from the original " "exception." msgstr "" -#: ../../library/traceback.rst:293 +#: ../../library/traceback.rst:300 msgid "" "The :attr:`~BaseException.__notes__` value from the original exception, or " "``None`` if the exception does not have any notes. If it is not ``None`` is " "it formatted in the traceback after the exception string." msgstr "" -#: ../../library/traceback.rst:302 +#: ../../library/traceback.rst:309 msgid "A :class:`StackSummary` representing the traceback." msgstr "" -#: ../../library/traceback.rst:306 +#: ../../library/traceback.rst:313 msgid "The class of the original traceback." msgstr "" -#: ../../library/traceback.rst:310 +#: ../../library/traceback.rst:319 +msgid "String display of the class of the original exception." +msgstr "" + +#: ../../library/traceback.rst:325 msgid "For syntax errors - the file name where the error occurred." msgstr "" -#: ../../library/traceback.rst:314 +#: ../../library/traceback.rst:329 msgid "For syntax errors - the line number where the error occurred." msgstr "" -#: ../../library/traceback.rst:318 +#: ../../library/traceback.rst:333 msgid "" "For syntax errors - the end line number where the error occurred. Can be " "``None`` if not present." msgstr "" -#: ../../library/traceback.rst:325 +#: ../../library/traceback.rst:340 msgid "For syntax errors - the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:329 +#: ../../library/traceback.rst:344 msgid "For syntax errors - the offset into the text where the error occurred." msgstr "" -#: ../../library/traceback.rst:333 +#: ../../library/traceback.rst:348 msgid "" "For syntax errors - the end offset into the text where the error occurred. " "Can be ``None`` if not present." msgstr "" -#: ../../library/traceback.rst:340 +#: ../../library/traceback.rst:355 msgid "For syntax errors - the compiler error message." msgstr "" -#: ../../library/traceback.rst:351 +#: ../../library/traceback.rst:366 msgid "" "Print to *file* (default ``sys.stderr``) the exception information returned " "by :meth:`format`." msgstr "" -#: ../../library/traceback.rst:358 +#: ../../library/traceback.rst:373 msgid "Format the exception." msgstr "" -#: ../../library/traceback.rst:360 +#: ../../library/traceback.rst:375 msgid "" "If *chain* is not ``True``, :attr:`__cause__` and :attr:`__context__` will " "not be formatted." msgstr "" -#: ../../library/traceback.rst:363 +#: ../../library/traceback.rst:378 msgid "" "The return value is a generator of strings, each ending in a newline and " "some containing internal newlines. :func:`~traceback.print_exception` is a " "wrapper around this method which just prints the lines to a file." msgstr "" -#: ../../library/traceback.rst:369 +#: ../../library/traceback.rst:384 msgid "Format the exception part of the traceback." msgstr "" -#: ../../library/traceback.rst:371 +#: ../../library/traceback.rst:386 msgid "The return value is a generator of strings, each ending in a newline." msgstr "" -#: ../../library/traceback.rst:373 +#: ../../library/traceback.rst:388 msgid "" -"The generator emits the exception's message followed by its notes (if it has " -"any). The exception message is normally a single string; however, for :exc:" -"`SyntaxError` exceptions, it consists of several lines that (when printed) " -"display detailed information about where the syntax error occurred." +"When *show_group* is ``False``, the generator emits the exception's message " +"followed by its notes (if it has any). The exception message is normally a " +"single string; however, for :exc:`SyntaxError` exceptions, it consists of " +"several lines that (when printed) display detailed information about where " +"the syntax error occurred." msgstr "" -#: ../../library/traceback.rst:379 +#: ../../library/traceback.rst:398 msgid "" "The exception's :attr:`notes ` are now included in " "the output." msgstr "" -#: ../../library/traceback.rst:386 +#: ../../library/traceback.rst:402 +#, fuzzy +msgid "Added the *show_group* parameter." +msgstr "新增 *compact* 參數。" + +#: ../../library/traceback.rst:407 msgid ":class:`!StackSummary` Objects" msgstr ":class:`!StackSummary` 物件" -#: ../../library/traceback.rst:390 +#: ../../library/traceback.rst:411 msgid "" ":class:`!StackSummary` objects represent a call stack ready for formatting." msgstr "" -#: ../../library/traceback.rst:396 +#: ../../library/traceback.rst:417 msgid "" "Construct a :class:`!StackSummary` object from a frame generator (such as is " "returned by :func:`~traceback.walk_stack` or :func:`~traceback.walk_tb`)." msgstr "" -#: ../../library/traceback.rst:400 +#: ../../library/traceback.rst:421 msgid "" "If *limit* is supplied, only this many frames are taken from *frame_gen*. If " "*lookup_lines* is ``False``, the returned :class:`FrameSummary` objects will " @@ -457,20 +478,20 @@ msgid "" "class:`!FrameSummary` are captured as object representations." msgstr "" -#: ../../library/traceback.rst:408 +#: ../../library/traceback.rst:429 msgid "" "Exceptions raised from :func:`repr` on a local variable (when " "*capture_locals* is ``True``) are no longer propagated to the caller." msgstr "" -#: ../../library/traceback.rst:414 +#: ../../library/traceback.rst:435 msgid "" "Construct a :class:`!StackSummary` object from a supplied list of :class:" "`FrameSummary` objects or old-style list of tuples. Each tuple should be a " "4-tuple with *filename*, *lineno*, *name*, *line* as the elements." msgstr "" -#: ../../library/traceback.rst:421 +#: ../../library/traceback.rst:442 msgid "" "Returns a list of strings ready for printing. Each string in the resulting " "list corresponds to a single :ref:`frame ` from the stack. " @@ -478,18 +499,18 @@ msgid "" "well, for those items with source text lines." msgstr "" -#: ../../library/traceback.rst:427 +#: ../../library/traceback.rst:448 msgid "" "For long sequences of the same frame and line, the first few repetitions are " "shown, followed by a summary line stating the exact number of further " "repetitions." msgstr "" -#: ../../library/traceback.rst:431 +#: ../../library/traceback.rst:452 msgid "Long sequences of repeated frames are now abbreviated." msgstr "" -#: ../../library/traceback.rst:436 +#: ../../library/traceback.rst:457 msgid "" "Returns a string for printing one of the :ref:`frames ` " "involved in the stack. This method is called for each :class:`FrameSummary` " @@ -497,17 +518,17 @@ msgid "" "the frame is omitted from the output." msgstr "" -#: ../../library/traceback.rst:446 +#: ../../library/traceback.rst:467 msgid ":class:`!FrameSummary` Objects" msgstr ":class:`!FrameSummary` 物件" -#: ../../library/traceback.rst:450 +#: ../../library/traceback.rst:471 msgid "" "A :class:`!FrameSummary` object represents a single :ref:`frame ` in a :ref:`traceback `." msgstr "" -#: ../../library/traceback.rst:455 +#: ../../library/traceback.rst:476 msgid "" "Represents a single :ref:`frame ` in the :ref:`traceback " "` or stack that is being formatted or printed. It may " @@ -516,43 +537,43 @@ msgid "" "class:`!FrameSummary` has the :attr:`~FrameSummary.line` attribute accessed " "(which also happens when casting it to a :class:`tuple`). :attr:" "`~FrameSummary.line` may be directly provided, and will prevent line lookups " -"happening at all. *locals* is an optional local variable dictionary, and if " +"happening at all. *locals* is an optional local variable mapping, and if " "supplied the variable representations are stored in the summary for later " "display." msgstr "" -#: ../../library/traceback.rst:466 +#: ../../library/traceback.rst:487 msgid ":class:`!FrameSummary` instances have the following attributes:" msgstr "" -#: ../../library/traceback.rst:470 +#: ../../library/traceback.rst:491 msgid "" "The filename of the source code for this frame. Equivalent to accessing :" "attr:`f.f_code.co_filename ` on a :ref:`frame object " "` *f*." msgstr "" -#: ../../library/traceback.rst:476 +#: ../../library/traceback.rst:497 msgid "The line number of the source code for this frame." msgstr "" -#: ../../library/traceback.rst:480 +#: ../../library/traceback.rst:501 msgid "" "Equivalent to accessing :attr:`f.f_code.co_name ` on a :" "ref:`frame object ` *f*." msgstr "" -#: ../../library/traceback.rst:485 +#: ../../library/traceback.rst:506 msgid "" "A string representing the source code for this frame, with leading and " "trailing whitespace stripped. If the source is not available, it is ``None``." msgstr "" -#: ../../library/traceback.rst:492 +#: ../../library/traceback.rst:513 msgid "Traceback Examples" msgstr "" -#: ../../library/traceback.rst:494 +#: ../../library/traceback.rst:515 msgid "" "This simple example implements a basic read-eval-print loop, similar to (but " "less useful than) the standard Python interactive interpreter loop. For a " @@ -560,7 +581,7 @@ msgid "" "`code` module. ::" msgstr "" -#: ../../library/traceback.rst:499 +#: ../../library/traceback.rst:520 msgid "" "import sys, traceback\n" "\n" @@ -579,13 +600,13 @@ msgid "" " run_user_code(envdir)" msgstr "" -#: ../../library/traceback.rst:516 +#: ../../library/traceback.rst:537 msgid "" "The following example demonstrates the different ways to print and format " "the exception and traceback:" msgstr "" -#: ../../library/traceback.rst:519 +#: ../../library/traceback.rst:540 msgid "" "import sys, traceback\n" "\n" @@ -618,28 +639,33 @@ msgid "" " print(\"*** tb_lineno:\", exc.__traceback__.tb_lineno)" msgstr "" -#: ../../library/traceback.rst:551 +#: ../../library/traceback.rst:572 msgid "The output for the example would look similar to this:" msgstr "" -#: ../../library/traceback.rst:553 +#: ../../library/traceback.rst:574 msgid "" "*** print_tb:\n" " File \"\", line 10, in \n" " lumberjack()\n" +" ~~~~~~~~~~^^\n" "*** print_exception:\n" "Traceback (most recent call last):\n" " File \"\", line 10, in \n" " lumberjack()\n" +" ~~~~~~~~~~^^\n" " File \"\", line 4, in lumberjack\n" " bright_side_of_life()\n" +" ~~~~~~~~~~~~~~~~~~~^^\n" "IndexError: tuple index out of range\n" "*** print_exc:\n" "Traceback (most recent call last):\n" " File \"\", line 10, in \n" " lumberjack()\n" +" ~~~~~~~~~~^^\n" " File \"\", line 4, in lumberjack\n" " bright_side_of_life()\n" +" ~~~~~~~~~~~~~~~~~~~^^\n" "IndexError: tuple index out of range\n" "*** format_exc, first and last line:\n" "Traceback (most recent call last):\n" @@ -647,9 +673,9 @@ msgid "" "*** format_exception:\n" "['Traceback (most recent call last):\\n',\n" " ' File \"\", line 10, in \\n " -"lumberjack()\\n',\n" +"lumberjack()\\n ~~~~~~~~~~^^\\n',\n" " ' File \"\", line 4, in lumberjack\\n " -"bright_side_of_life()\\n',\n" +"bright_side_of_life()\\n ~~~~~~~~~~~~~~~~~~~^^\\n',\n" " ' File \"\", line 7, in bright_side_of_life\\n " "return tuple()[0]\\n ~~~~~~~^^^\\n',\n" " 'IndexError: tuple index out of range\\n']\n" @@ -659,21 +685,21 @@ msgid "" " , line 7 in bright_side_of_life>]\n" "*** format_tb:\n" "[' File \"\", line 10, in \\n " -"lumberjack()\\n',\n" +"lumberjack()\\n ~~~~~~~~~~^^\\n',\n" " ' File \"\", line 4, in lumberjack\\n " -"bright_side_of_life()\\n',\n" +"bright_side_of_life()\\n ~~~~~~~~~~~~~~~~~~~^^\\n',\n" " ' File \"\", line 7, in bright_side_of_life\\n " "return tuple()[0]\\n ~~~~~~~^^^\\n']\n" "*** tb_lineno: 10" msgstr "" -#: ../../library/traceback.rst:593 +#: ../../library/traceback.rst:619 msgid "" "The following example shows the different ways to print and format the " "stack::" msgstr "" -#: ../../library/traceback.rst:595 +#: ../../library/traceback.rst:621 msgid "" ">>> import traceback\n" ">>> def another_function():\n" @@ -725,11 +751,11 @@ msgstr "" " ' File \"\", line 8, in lumberstack\\n print(repr(traceback." "format_stack()))\\n']" -#: ../../library/traceback.rst:619 +#: ../../library/traceback.rst:645 msgid "This last example demonstrates the final few formatting functions:" msgstr "" -#: ../../library/traceback.rst:621 +#: ../../library/traceback.rst:647 msgid "" ">>> import traceback\n" ">>> traceback.format_list([('spam.py', 3, '', 'spam.eggs()'),\n" diff --git a/library/tracemalloc.po b/library/tracemalloc.po index 7ca51be507..8ce369cc18 100644 --- a/library/tracemalloc.po +++ b/library/tracemalloc.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" diff --git a/library/tty.po b/library/tty.po index 24e56b4d40..56c833a6f6 100644 --- a/library/tty.po +++ b/library/tty.po @@ -7,7 +7,7 @@ # Matt Wang , 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2021-12-17 17:00+0800\n" diff --git a/library/turtle.po b/library/turtle.po index ef4f54f410..3a6d1eb7aa 100644 --- a/library/turtle.po +++ b/library/turtle.po @@ -5,9 +5,9 @@ # Renyuan Lyu , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:13+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -41,25 +41,38 @@ msgstr "" "org/wiki/Turtle_ (robot)>`_。" #: ../../library/turtle.rst:29 +msgid "Get started" +msgstr "" + +#: ../../library/turtle.rst:31 +msgid "" +"Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an " +"``import turtle``, give it the command ``turtle.forward(15)``, and it moves " +"(on-screen!) 15 pixels in the direction it is facing, drawing a line as it " +"moves. Give it the command ``turtle.right(25)``, and it rotates in-place 25 " +"degrees clockwise." +msgstr "" + +#: ../../library/turtle.rst:38 msgid "" "Turtle can draw intricate shapes using programs that repeat simple moves." msgstr "龜可以使用重複簡單動作之程式來畫出複雜的形狀。" -#: ../../library/turtle.rst:35 +#: ../../library/turtle.rst:44 msgid "" "In Python, turtle graphics provides a representation of a physical " "\"turtle\" (a little robot with a pen) that draws on a sheet of paper on the " "floor." msgstr "" -#: ../../library/turtle.rst:38 +#: ../../library/turtle.rst:47 msgid "" "It's an effective and well-proven way for learners to encounter programming " "concepts and interaction with software, as it provides instant, visible " "feedback. It also provides convenient access to graphical output in general." msgstr "" -#: ../../library/turtle.rst:43 +#: ../../library/turtle.rst:52 msgid "" "Turtle drawing was originally created as an educational tool, to be used by " "teachers in the classroom. For the programmer who needs to produce some " @@ -67,62 +80,62 @@ msgid "" "introducing more complex or external libraries into their work." msgstr "" -#: ../../library/turtle.rst:52 +#: ../../library/turtle.rst:61 msgid "Tutorial" msgstr "教學" -#: ../../library/turtle.rst:54 +#: ../../library/turtle.rst:63 msgid "" "New users should start here. In this tutorial we'll explore some of the " "basics of turtle drawing." msgstr "" -#: ../../library/turtle.rst:59 +#: ../../library/turtle.rst:68 msgid "Starting a turtle environment" msgstr "啟動一個烏龜環境" -#: ../../library/turtle.rst:61 +#: ../../library/turtle.rst:70 msgid "In a Python shell, import all the objects of the ``turtle`` module::" msgstr "在 Python shell 中,引入 ``turtle`` 模組中所有物件: ::" -#: ../../library/turtle.rst:63 +#: ../../library/turtle.rst:72 msgid "from turtle import *" msgstr "from turtle import *" -#: ../../library/turtle.rst:65 +#: ../../library/turtle.rst:74 msgid "" "If you run into a ``No module named '_tkinter'`` error, you'll have to " "install the :mod:`Tk interface package ` on your system." msgstr "" -#: ../../library/turtle.rst:70 +#: ../../library/turtle.rst:79 msgid "Basic drawing" msgstr "基本繪圖" -#: ../../library/turtle.rst:72 +#: ../../library/turtle.rst:81 msgid "Send the turtle forward 100 steps::" msgstr "" -#: ../../library/turtle.rst:74 +#: ../../library/turtle.rst:83 msgid "forward(100)" msgstr "forward(100)" -#: ../../library/turtle.rst:76 +#: ../../library/turtle.rst:85 msgid "" "You should see (most likely, in a new window on your display) a line drawn " "by the turtle, heading East. Change the direction of the turtle, so that it " "turns 120 degrees left (anti-clockwise)::" msgstr "" -#: ../../library/turtle.rst:80 +#: ../../library/turtle.rst:89 msgid "left(120)" msgstr "left(120)" -#: ../../library/turtle.rst:82 +#: ../../library/turtle.rst:91 msgid "Let's continue by drawing a triangle::" msgstr "" -#: ../../library/turtle.rst:84 +#: ../../library/turtle.rst:93 msgid "" "forward(100)\n" "left(120)\n" @@ -132,81 +145,81 @@ msgstr "" "left(120)\n" "forward(100)" -#: ../../library/turtle.rst:88 +#: ../../library/turtle.rst:97 msgid "" "Notice how the turtle, represented by an arrow, points in different " "directions as you steer it." msgstr "" -#: ../../library/turtle.rst:91 +#: ../../library/turtle.rst:100 msgid "" "Experiment with those commands, and also with ``backward()`` and ``right()``." msgstr "" -#: ../../library/turtle.rst:96 ../../library/turtle.rst:325 -#: ../../library/turtle.rst:1016 +#: ../../library/turtle.rst:105 ../../library/turtle.rst:334 +#: ../../library/turtle.rst:1024 msgid "Pen control" msgstr "" -#: ../../library/turtle.rst:98 +#: ../../library/turtle.rst:107 msgid "" "Try changing the color - for example, ``color('blue')`` - and width of the " "line - for example, ``width(3)`` - and then drawing again." msgstr "" -#: ../../library/turtle.rst:101 +#: ../../library/turtle.rst:110 msgid "" "You can also move the turtle around without drawing, by lifting up the pen: " "``up()`` before moving. To start drawing again, use ``down()``." msgstr "" -#: ../../library/turtle.rst:106 +#: ../../library/turtle.rst:115 msgid "The turtle's position" msgstr "" -#: ../../library/turtle.rst:108 +#: ../../library/turtle.rst:117 msgid "" "Send your turtle back to its starting-point (useful if it has disappeared " "off-screen)::" msgstr "" -#: ../../library/turtle.rst:111 +#: ../../library/turtle.rst:120 msgid "home()" msgstr "home()" -#: ../../library/turtle.rst:113 +#: ../../library/turtle.rst:122 msgid "" "The home position is at the center of the turtle's screen. If you ever need " "to know them, get the turtle's x-y coordinates with::" msgstr "" -#: ../../library/turtle.rst:116 +#: ../../library/turtle.rst:125 msgid "pos()" msgstr "pos()" -#: ../../library/turtle.rst:118 +#: ../../library/turtle.rst:127 msgid "Home is at ``(0, 0)``." msgstr "" -#: ../../library/turtle.rst:120 +#: ../../library/turtle.rst:129 msgid "" "And after a while, it will probably help to clear the window so we can start " "anew::" msgstr "" -#: ../../library/turtle.rst:123 +#: ../../library/turtle.rst:132 msgid "clearscreen()" msgstr "clearscreen()" -#: ../../library/turtle.rst:127 +#: ../../library/turtle.rst:136 msgid "Making algorithmic patterns" msgstr "" -#: ../../library/turtle.rst:129 +#: ../../library/turtle.rst:138 msgid "Using loops, it's possible to build up geometric patterns::" msgstr "" -#: ../../library/turtle.rst:131 +#: ../../library/turtle.rst:140 msgid "" "for steps in range(100):\n" " for c in ('blue', 'red', 'green'):\n" @@ -220,17 +233,17 @@ msgstr "" " forward(steps)\n" " right(30)" -#: ../../library/turtle.rst:138 +#: ../../library/turtle.rst:147 msgid "\\ - which of course, are limited only by the imagination!" msgstr "" -#: ../../library/turtle.rst:140 +#: ../../library/turtle.rst:149 msgid "" "Let's draw the star shape at the top of this page. We want red lines, filled " "in with yellow::" msgstr "" -#: ../../library/turtle.rst:143 +#: ../../library/turtle.rst:152 msgid "" "color('red')\n" "fillcolor('yellow')" @@ -238,21 +251,21 @@ msgstr "" "color('red')\n" "fillcolor('yellow')" -#: ../../library/turtle.rst:146 +#: ../../library/turtle.rst:155 msgid "" "Just as ``up()`` and ``down()`` determine whether lines will be drawn, " "filling can be turned on and off::" msgstr "" -#: ../../library/turtle.rst:149 +#: ../../library/turtle.rst:158 msgid "begin_fill()" msgstr "begin_fill()" -#: ../../library/turtle.rst:151 +#: ../../library/turtle.rst:160 msgid "Next we'll create a loop::" msgstr "" -#: ../../library/turtle.rst:153 +#: ../../library/turtle.rst:162 msgid "" "while True:\n" " forward(200)\n" @@ -266,39 +279,39 @@ msgstr "" " if abs(pos()) < 1:\n" " break" -#: ../../library/turtle.rst:159 +#: ../../library/turtle.rst:168 msgid "" "``abs(pos()) < 1`` is a good way to know when the turtle is back at its home " "position." msgstr "" -#: ../../library/turtle.rst:162 +#: ../../library/turtle.rst:171 msgid "Finally, complete the filling::" msgstr "" -#: ../../library/turtle.rst:164 +#: ../../library/turtle.rst:173 msgid "end_fill()" msgstr "end_fill()" -#: ../../library/turtle.rst:166 +#: ../../library/turtle.rst:175 msgid "" "(Note that filling only actually takes place when you give the " "``end_fill()`` command.)" msgstr "" -#: ../../library/turtle.rst:173 +#: ../../library/turtle.rst:182 msgid "How to..." msgstr "" -#: ../../library/turtle.rst:175 +#: ../../library/turtle.rst:184 msgid "This section covers some typical turtle use-cases and approaches." msgstr "" -#: ../../library/turtle.rst:179 +#: ../../library/turtle.rst:188 msgid "Get started as quickly as possible" msgstr "" -#: ../../library/turtle.rst:181 +#: ../../library/turtle.rst:190 msgid "" "One of the joys of turtle graphics is the immediate, visual feedback that's " "available from simple commands - it's an excellent way to introduce children " @@ -306,21 +319,21 @@ msgid "" "course)." msgstr "" -#: ../../library/turtle.rst:186 +#: ../../library/turtle.rst:195 msgid "" "The turtle module makes this possible by exposing all its basic " "functionality as functions, available with ``from turtle import *``. The :" "ref:`turtle graphics tutorial ` covers this approach." msgstr "" -#: ../../library/turtle.rst:190 +#: ../../library/turtle.rst:199 msgid "" "It's worth noting that many of the turtle commands also have even more terse " "equivalents, such as ``fd()`` for :func:`forward`. These are especially " "useful when working with learners for whom typing is not a skill." msgstr "" -#: ../../library/turtle.rst:196 +#: ../../library/turtle.rst:205 msgid "" "You'll need to have the :mod:`Tk interface package ` installed on " "your system for turtle graphics to work. Be warned that this is not always " @@ -328,11 +341,11 @@ msgid "" "graphics with a learner." msgstr "" -#: ../../library/turtle.rst:203 +#: ../../library/turtle.rst:212 msgid "Use the ``turtle`` module namespace" msgstr "" -#: ../../library/turtle.rst:205 +#: ../../library/turtle.rst:214 msgid "" "Using ``from turtle import *`` is convenient - but be warned that it imports " "a rather large collection of objects, and if you're doing anything but " @@ -341,7 +354,7 @@ msgid "" "might be imported)." msgstr "" -#: ../../library/turtle.rst:211 +#: ../../library/turtle.rst:220 msgid "" "The solution is to use ``import turtle`` - ``fd()`` becomes ``turtle.fd()``, " "``width()`` becomes ``turtle.width()`` and so on. (If typing \"turtle\" over " @@ -349,17 +362,17 @@ msgid "" "instead.)" msgstr "" -#: ../../library/turtle.rst:218 +#: ../../library/turtle.rst:227 msgid "Use turtle graphics in a script" msgstr "" -#: ../../library/turtle.rst:220 +#: ../../library/turtle.rst:229 msgid "" "It's recommended to use the ``turtle`` module namespace as described " "immediately above, for example::" msgstr "" -#: ../../library/turtle.rst:223 +#: ../../library/turtle.rst:232 msgid "" "import turtle as t\n" "from random import random\n" @@ -379,33 +392,33 @@ msgstr "" " t.right(angle)\n" " t.fd(steps)" -#: ../../library/turtle.rst:232 +#: ../../library/turtle.rst:241 msgid "" "Another step is also required though - as soon as the script ends, Python " "will also close the turtle's window. Add::" msgstr "" -#: ../../library/turtle.rst:235 +#: ../../library/turtle.rst:244 msgid "t.mainloop()" msgstr "t.mainloop()" -#: ../../library/turtle.rst:237 +#: ../../library/turtle.rst:246 msgid "" "to the end of the script. The script will now wait to be dismissed and will " "not exit until it is terminated, for example by closing the turtle graphics " "window." msgstr "" -#: ../../library/turtle.rst:243 +#: ../../library/turtle.rst:252 msgid "Use object-oriented turtle graphics" msgstr "" -#: ../../library/turtle.rst:245 +#: ../../library/turtle.rst:254 msgid "" ":ref:`Explanation of the object-oriented interface `" msgstr "" -#: ../../library/turtle.rst:247 +#: ../../library/turtle.rst:256 msgid "" "Other than for very basic introductory purposes, or for trying things out as " "quickly as possible, it's more usual and much more powerful to use the " @@ -413,18 +426,18 @@ msgid "" "multiple turtles on screen at once." msgstr "" -#: ../../library/turtle.rst:252 +#: ../../library/turtle.rst:261 msgid "" "In this approach, the various turtle commands are methods of objects (mostly " "of ``Turtle`` objects). You *can* use the object-oriented approach in the " "shell, but it would be more typical in a Python script." msgstr "" -#: ../../library/turtle.rst:256 +#: ../../library/turtle.rst:265 msgid "The example above then becomes::" msgstr "" -#: ../../library/turtle.rst:258 +#: ../../library/turtle.rst:267 msgid "" "from turtle import Turtle\n" "from random import random\n" @@ -450,43 +463,43 @@ msgstr "" "\n" "t.screen.mainloop()" -#: ../../library/turtle.rst:270 +#: ../../library/turtle.rst:279 msgid "" "Note the last line. ``t.screen`` is an instance of the :class:`Screen` that " "a Turtle instance exists on; it's created automatically along with the " "turtle." msgstr "" -#: ../../library/turtle.rst:274 +#: ../../library/turtle.rst:283 msgid "The turtle's screen can be customised, for example::" msgstr "" -#: ../../library/turtle.rst:276 +#: ../../library/turtle.rst:285 msgid "" "t.screen.title('Object-oriented turtle demo')\n" "t.screen.bgcolor(\"orange\")" msgstr "" -#: ../../library/turtle.rst:281 +#: ../../library/turtle.rst:290 msgid "Turtle graphics reference" msgstr "" -#: ../../library/turtle.rst:285 +#: ../../library/turtle.rst:294 msgid "" "In the following documentation the argument list for functions is given. " "Methods, of course, have the additional first argument *self* which is " "omitted here." msgstr "" -#: ../../library/turtle.rst:291 +#: ../../library/turtle.rst:300 msgid "Turtle methods" msgstr "" -#: ../../library/turtle.rst:293 ../../library/turtle.rst:433 +#: ../../library/turtle.rst:302 ../../library/turtle.rst:441 msgid "Turtle motion" msgstr "" -#: ../../library/turtle.rst:294 +#: ../../library/turtle.rst:303 msgid "Move and draw" msgstr "" @@ -530,7 +543,7 @@ msgstr ":func:`setheading` | :func:`seth`" msgid ":func:`home`" msgstr ":func:`home`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2723 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2709 msgid ":func:`circle`" msgstr ":func:`circle`" @@ -538,7 +551,7 @@ msgstr ":func:`circle`" msgid ":func:`dot`" msgstr ":func:`dot`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2701 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2687 msgid ":func:`stamp`" msgstr ":func:`stamp`" @@ -558,7 +571,7 @@ msgstr ":func:`undo`" msgid ":func:`speed`" msgstr ":func:`speed`" -#: ../../library/turtle.rst:313 ../../library/turtle.rst:865 +#: ../../library/turtle.rst:322 ../../library/turtle.rst:873 msgid "Tell Turtle's state" msgstr "" @@ -586,7 +599,7 @@ msgstr ":func:`heading`" msgid ":func:`distance`" msgstr ":func:`distance`" -#: ../../library/turtle.rst:321 +#: ../../library/turtle.rst:330 msgid "Setting and measurement" msgstr "" @@ -598,7 +611,7 @@ msgstr ":func:`degrees`" msgid ":func:`radians`" msgstr ":func:`radians`" -#: ../../library/turtle.rst:326 ../../library/turtle.rst:1019 +#: ../../library/turtle.rst:335 ../../library/turtle.rst:1027 msgid "Drawing state" msgstr "" @@ -622,7 +635,7 @@ msgstr ":func:`pen`" msgid ":func:`isdown`" msgstr ":func:`isdown`" -#: ../../library/turtle.rst:333 ../../library/turtle.rst:1111 +#: ../../library/turtle.rst:342 ../../library/turtle.rst:1119 msgid "Color control" msgstr "" @@ -638,7 +651,7 @@ msgstr ":func:`pencolor`" msgid ":func:`fillcolor`" msgstr ":func:`fillcolor`" -#: ../../library/turtle.rst:338 ../../library/turtle.rst:1243 +#: ../../library/turtle.rst:347 ../../library/turtle.rst:1251 msgid "Filling" msgstr "" @@ -654,7 +667,7 @@ msgstr ":func:`begin_fill`" msgid ":func:`end_fill`" msgstr ":func:`end_fill`" -#: ../../library/turtle.rst:343 ../../library/turtle.rst:1290 +#: ../../library/turtle.rst:352 ../../library/turtle.rst:1298 msgid "More drawing control" msgstr "" @@ -670,11 +683,11 @@ msgstr ":func:`clear`" msgid ":func:`write`" msgstr ":func:`write`" -#: ../../library/turtle.rst:348 ../../library/turtle.rst:1336 +#: ../../library/turtle.rst:357 ../../library/turtle.rst:1344 msgid "Turtle state" msgstr "" -#: ../../library/turtle.rst:349 ../../library/turtle.rst:1339 +#: ../../library/turtle.rst:358 ../../library/turtle.rst:1347 msgid "Visibility" msgstr "" @@ -690,7 +703,7 @@ msgstr ":func:`hideturtle` | :func:`ht`" msgid ":func:`isvisible`" msgstr ":func:`isvisible`" -#: ../../library/turtle.rst:354 ../../library/turtle.rst:1378 +#: ../../library/turtle.rst:363 ../../library/turtle.rst:1386 msgid "Appearance" msgstr "" @@ -710,10 +723,6 @@ msgstr ":func:`shapesize` | :func:`turtlesize`" msgid ":func:`shearfactor`" msgstr ":func:`shearfactor`" -#: ../../library/turtle.rst:0 -msgid ":func:`settiltangle`" -msgstr ":func:`settiltangle`" - #: ../../library/turtle.rst:0 msgid ":func:`tiltangle`" msgstr ":func:`tiltangle`" @@ -730,11 +739,11 @@ msgstr ":func:`shapetransform`" msgid ":func:`get_shapepoly`" msgstr ":func:`get_shapepoly`" -#: ../../library/turtle.rst:365 ../../library/turtle.rst:1583 +#: ../../library/turtle.rst:373 ../../library/turtle.rst:1569 msgid "Using events" msgstr "" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2695 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2681 msgid ":func:`onclick`" msgstr ":func:`onclick`" @@ -742,11 +751,11 @@ msgstr ":func:`onclick`" msgid ":func:`onrelease`" msgstr ":func:`onrelease`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2678 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2664 msgid ":func:`ondrag`" msgstr ":func:`ondrag`" -#: ../../library/turtle.rst:370 ../../library/turtle.rst:1657 +#: ../../library/turtle.rst:378 ../../library/turtle.rst:1643 msgid "Special Turtle methods" msgstr "" @@ -762,7 +771,7 @@ msgstr ":func:`end_poly`" msgid ":func:`get_poly`" msgstr ":func:`get_poly`" -#: ../../library/turtle.rst:0 ../../library/turtle.rst:2717 +#: ../../library/turtle.rst:0 ../../library/turtle.rst:2703 msgid ":func:`clone`" msgstr ":func:`clone`" @@ -782,11 +791,11 @@ msgstr ":func:`setundobuffer`" msgid ":func:`undobufferentries`" msgstr ":func:`undobufferentries`" -#: ../../library/turtle.rst:382 +#: ../../library/turtle.rst:390 msgid "Methods of TurtleScreen/Screen" msgstr "" -#: ../../library/turtle.rst:384 ../../library/turtle.rst:1811 +#: ../../library/turtle.rst:392 ../../library/turtle.rst:1797 msgid "Window control" msgstr "" @@ -814,7 +823,7 @@ msgstr ":func:`screensize`" msgid ":func:`setworldcoordinates`" msgstr ":func:`setworldcoordinates`" -#: ../../library/turtle.rst:392 ../../library/turtle.rst:1934 +#: ../../library/turtle.rst:400 ../../library/turtle.rst:1920 msgid "Animation control" msgstr "" @@ -830,7 +839,7 @@ msgstr ":func:`tracer`" msgid ":func:`update`" msgstr ":func:`update`" -#: ../../library/turtle.rst:397 ../../library/turtle.rst:1987 +#: ../../library/turtle.rst:405 ../../library/turtle.rst:1973 msgid "Using screen events" msgstr "" @@ -858,7 +867,7 @@ msgstr ":func:`ontimer`" msgid ":func:`mainloop` | :func:`done`" msgstr ":func:`mainloop` | :func:`done`" -#: ../../library/turtle.rst:405 ../../library/turtle.rst:2132 +#: ../../library/turtle.rst:413 ../../library/turtle.rst:2118 msgid "Settings and special methods" msgstr "" @@ -894,7 +903,7 @@ msgstr ":func:`window_height`" msgid ":func:`window_width`" msgstr ":func:`window_width`" -#: ../../library/turtle.rst:415 ../../library/turtle.rst:2096 +#: ../../library/turtle.rst:423 ../../library/turtle.rst:2082 msgid "Input methods" msgstr "" @@ -906,7 +915,7 @@ msgstr ":func:`textinput`" msgid ":func:`numinput`" msgstr ":func:`numinput`" -#: ../../library/turtle.rst:419 +#: ../../library/turtle.rst:427 msgid "Methods specific to Screen" msgstr "" @@ -926,11 +935,11 @@ msgstr ":func:`setup`" msgid ":func:`title`" msgstr ":func:`title`" -#: ../../library/turtle.rst:427 +#: ../../library/turtle.rst:435 msgid "Methods of RawTurtle/Turtle and corresponding functions" msgstr "" -#: ../../library/turtle.rst:429 +#: ../../library/turtle.rst:437 msgid "" "Most of the examples in this section refer to a Turtle instance called " "``turtle``." @@ -940,19 +949,19 @@ msgstr "" msgid "Parameters" msgstr "參數" -#: ../../library/turtle.rst:438 ../../library/turtle.rst:483 -#: ../../library/turtle.rst:508 ../../library/turtle.rst:606 -#: ../../library/turtle.rst:629 ../../library/turtle.rst:652 +#: ../../library/turtle.rst:446 ../../library/turtle.rst:491 +#: ../../library/turtle.rst:516 ../../library/turtle.rst:614 +#: ../../library/turtle.rst:637 ../../library/turtle.rst:660 msgid "a number (integer or float)" msgstr "" -#: ../../library/turtle.rst:440 +#: ../../library/turtle.rst:448 msgid "" "Move the turtle forward by the specified *distance*, in the direction the " "turtle is headed." msgstr "" -#: ../../library/turtle.rst:443 +#: ../../library/turtle.rst:451 msgid "" ">>> turtle.position()\n" "(0.00,0.00)\n" @@ -972,19 +981,18 @@ msgstr "" ">>> turtle.position()\n" "(-50.00,0.00)" -#: ../../library/turtle.rst:460 ../../library/turtle.rst:702 -#: ../../library/turtle.rst:969 ../../library/turtle.rst:1477 -#: ../../library/turtle.rst:1496 +#: ../../library/turtle.rst:468 ../../library/turtle.rst:710 +#: ../../library/turtle.rst:977 ../../library/turtle.rst:1485 msgid "a number" msgstr "" -#: ../../library/turtle.rst:462 +#: ../../library/turtle.rst:470 msgid "" "Move the turtle backward by *distance*, opposite to the direction the turtle " "is headed. Do not change the turtle's heading." msgstr "" -#: ../../library/turtle.rst:470 +#: ../../library/turtle.rst:478 msgid "" ">>> turtle.position()\n" "(0.00,0.00)\n" @@ -998,14 +1006,14 @@ msgstr "" ">>> turtle.position()\n" "(-30.00,0.00)" -#: ../../library/turtle.rst:485 +#: ../../library/turtle.rst:493 msgid "" "Turn turtle right by *angle* units. (Units are by default degrees, but can " "be set via the :func:`degrees` and :func:`radians` functions.) Angle " "orientation depends on the turtle mode, see :func:`mode`." msgstr "" -#: ../../library/turtle.rst:495 +#: ../../library/turtle.rst:503 msgid "" ">>> turtle.heading()\n" "22.0\n" @@ -1019,14 +1027,14 @@ msgstr "" ">>> turtle.heading()\n" "337.0" -#: ../../library/turtle.rst:510 +#: ../../library/turtle.rst:518 msgid "" "Turn turtle left by *angle* units. (Units are by default degrees, but can " "be set via the :func:`degrees` and :func:`radians` functions.) Angle " "orientation depends on the turtle mode, see :func:`mode`." msgstr "" -#: ../../library/turtle.rst:520 +#: ../../library/turtle.rst:528 msgid "" ">>> turtle.heading()\n" "22.0\n" @@ -1040,28 +1048,28 @@ msgstr "" ">>> turtle.heading()\n" "67.0" -#: ../../library/turtle.rst:534 +#: ../../library/turtle.rst:542 msgid "a number or a pair/vector of numbers" msgstr "" -#: ../../library/turtle.rst:535 ../../library/turtle.rst:568 -#: ../../library/turtle.rst:569 +#: ../../library/turtle.rst:543 ../../library/turtle.rst:576 +#: ../../library/turtle.rst:577 msgid "a number or ``None``" msgstr "" -#: ../../library/turtle.rst:537 +#: ../../library/turtle.rst:545 msgid "" "If *y* is ``None``, *x* must be a pair of coordinates or a :class:`Vec2D` (e." "g. as returned by :func:`pos`)." msgstr "" -#: ../../library/turtle.rst:540 +#: ../../library/turtle.rst:548 msgid "" "Move turtle to an absolute position. If the pen is down, draw line. Do not " "change the turtle's orientation." msgstr "" -#: ../../library/turtle.rst:549 +#: ../../library/turtle.rst:557 msgid "" ">>> tp = turtle.pos()\n" ">>> tp\n" @@ -1089,11 +1097,11 @@ msgstr "" ">>> turtle.pos()\n" "(0.00,0.00)" -#: ../../library/turtle.rst:570 +#: ../../library/turtle.rst:578 msgid "a boolean" msgstr "" -#: ../../library/turtle.rst:572 +#: ../../library/turtle.rst:580 msgid "" "Move turtle to an absolute position. Unlike goto(x, y), a line will not be " "drawn. The turtle's orientation does not change. If currently filling, the " @@ -1103,7 +1111,7 @@ msgid "" "barrier like in goto(x, y)." msgstr "" -#: ../../library/turtle.rst:585 +#: ../../library/turtle.rst:593 msgid "" ">>> tp = turtle.pos()\n" ">>> tp\n" @@ -1131,12 +1139,12 @@ msgstr "" ">>> turtle.pos()\n" "(20.00,30.00)" -#: ../../library/turtle.rst:608 +#: ../../library/turtle.rst:616 msgid "" "Set the turtle's first coordinate to *x*, leave second coordinate unchanged." msgstr "" -#: ../../library/turtle.rst:617 +#: ../../library/turtle.rst:625 msgid "" ">>> turtle.position()\n" "(0.00,240.00)\n" @@ -1150,12 +1158,12 @@ msgstr "" ">>> turtle.position()\n" "(10.00,240.00)" -#: ../../library/turtle.rst:631 +#: ../../library/turtle.rst:639 msgid "" "Set the turtle's second coordinate to *y*, leave first coordinate unchanged." msgstr "" -#: ../../library/turtle.rst:639 +#: ../../library/turtle.rst:647 msgid "" ">>> turtle.position()\n" "(0.00,40.00)\n" @@ -1169,53 +1177,53 @@ msgstr "" ">>> turtle.position()\n" "(0.00,-10.00)" -#: ../../library/turtle.rst:654 +#: ../../library/turtle.rst:662 msgid "" "Set the orientation of the turtle to *to_angle*. Here are some common " "directions in degrees:" msgstr "" -#: ../../library/turtle.rst:658 +#: ../../library/turtle.rst:666 msgid "standard mode" msgstr "" -#: ../../library/turtle.rst:658 +#: ../../library/turtle.rst:666 msgid "logo mode" msgstr "" -#: ../../library/turtle.rst:660 +#: ../../library/turtle.rst:668 msgid "0 - east" msgstr "" -#: ../../library/turtle.rst:660 +#: ../../library/turtle.rst:668 msgid "0 - north" msgstr "" -#: ../../library/turtle.rst:661 +#: ../../library/turtle.rst:669 msgid "90 - north" msgstr "" -#: ../../library/turtle.rst:661 +#: ../../library/turtle.rst:669 msgid "90 - east" msgstr "" -#: ../../library/turtle.rst:662 +#: ../../library/turtle.rst:670 msgid "180 - west" msgstr "" -#: ../../library/turtle.rst:662 +#: ../../library/turtle.rst:670 msgid "180 - south" msgstr "" -#: ../../library/turtle.rst:663 +#: ../../library/turtle.rst:671 msgid "270 - south" msgstr "" -#: ../../library/turtle.rst:663 +#: ../../library/turtle.rst:671 msgid "270 - west" msgstr "" -#: ../../library/turtle.rst:666 +#: ../../library/turtle.rst:674 msgid "" ">>> turtle.setheading(90)\n" ">>> turtle.heading()\n" @@ -1225,13 +1233,13 @@ msgstr "" ">>> turtle.heading()\n" "90.0" -#: ../../library/turtle.rst:676 +#: ../../library/turtle.rst:684 msgid "" "Move turtle to the origin -- coordinates (0,0) -- and set its heading to its " "start-orientation (which depends on the mode, see :func:`mode`)." msgstr "" -#: ../../library/turtle.rst:686 +#: ../../library/turtle.rst:694 msgid "" ">>> turtle.heading()\n" "90.0\n" @@ -1253,15 +1261,15 @@ msgstr "" ">>> turtle.heading()\n" "0.0" -#: ../../library/turtle.rst:703 +#: ../../library/turtle.rst:711 msgid "a number (or ``None``)" msgstr "" -#: ../../library/turtle.rst:704 ../../library/turtle.rst:797 +#: ../../library/turtle.rst:712 ../../library/turtle.rst:805 msgid "an integer (or ``None``)" msgstr "" -#: ../../library/turtle.rst:706 +#: ../../library/turtle.rst:714 msgid "" "Draw a circle with given *radius*. The center is *radius* units left of the " "turtle; *extent* -- an angle -- determines which part of the circle is " @@ -1272,14 +1280,14 @@ msgid "" "changed by the amount of *extent*." msgstr "" -#: ../../library/turtle.rst:714 +#: ../../library/turtle.rst:722 msgid "" "As the circle is approximated by an inscribed regular polygon, *steps* " "determines the number of steps to use. If not given, it will be calculated " "automatically. May be used to draw regular polygons." msgstr "" -#: ../../library/turtle.rst:718 +#: ../../library/turtle.rst:726 msgid "" ">>> turtle.home()\n" ">>> turtle.position()\n" @@ -1298,21 +1306,21 @@ msgid "" "180.0" msgstr "" -#: ../../library/turtle.rst:740 +#: ../../library/turtle.rst:748 msgid "an integer >= 1 (if given)" msgstr "" -#: ../../library/turtle.rst:741 +#: ../../library/turtle.rst:749 msgid "a colorstring or a numeric color tuple" msgstr "" -#: ../../library/turtle.rst:743 +#: ../../library/turtle.rst:751 msgid "" "Draw a circular dot with diameter *size*, using *color*. If *size* is not " "given, the maximum of pensize+4 and 2*pensize is used." msgstr "" -#: ../../library/turtle.rst:747 +#: ../../library/turtle.rst:755 msgid "" ">>> turtle.home()\n" ">>> turtle.dot()\n" @@ -1330,14 +1338,14 @@ msgstr "" ">>> turtle.heading()\n" "0.0" -#: ../../library/turtle.rst:761 +#: ../../library/turtle.rst:769 msgid "" "Stamp a copy of the turtle shape onto the canvas at the current turtle " "position. Return a stamp_id for that stamp, which can be used to delete it " "by calling ``clearstamp(stamp_id)``." msgstr "" -#: ../../library/turtle.rst:765 +#: ../../library/turtle.rst:773 msgid "" ">>> turtle.color(\"blue\")\n" ">>> stamp_id = turtle.stamp()\n" @@ -1347,15 +1355,15 @@ msgstr "" ">>> stamp_id = turtle.stamp()\n" ">>> turtle.fd(50)" -#: ../../library/turtle.rst:775 +#: ../../library/turtle.rst:783 msgid "an integer, must be return value of previous :func:`stamp` call" msgstr "" -#: ../../library/turtle.rst:778 +#: ../../library/turtle.rst:786 msgid "Delete stamp with given *stampid*." msgstr "" -#: ../../library/turtle.rst:780 +#: ../../library/turtle.rst:788 msgid "" ">>> turtle.position()\n" "(150.00,-0.00)\n" @@ -1379,14 +1387,14 @@ msgstr "" ">>> turtle.position()\n" "(200.00,-0.00)" -#: ../../library/turtle.rst:799 +#: ../../library/turtle.rst:807 msgid "" "Delete all or first/last *n* of turtle's stamps. If *n* is ``None``, delete " "all stamps, if *n* > 0 delete first *n* stamps, else if *n* < 0 delete last " "*n* stamps." msgstr "" -#: ../../library/turtle.rst:803 +#: ../../library/turtle.rst:811 msgid "" ">>> for i in range(8):\n" "... unused_stamp_id = turtle.stamp()\n" @@ -1402,13 +1410,13 @@ msgstr "" ">>> turtle.clearstamps(-2)\n" ">>> turtle.clearstamps()" -#: ../../library/turtle.rst:815 +#: ../../library/turtle.rst:823 msgid "" "Undo (repeatedly) the last turtle action(s). Number of available undo " "actions is determined by the size of the undobuffer." msgstr "" -#: ../../library/turtle.rst:818 +#: ../../library/turtle.rst:826 msgid "" ">>> for i in range(4):\n" "... turtle.fd(50); turtle.lt(80)\n" @@ -1422,55 +1430,55 @@ msgstr "" ">>> for i in range(8):\n" "... turtle.undo()" -#: ../../library/turtle.rst:830 +#: ../../library/turtle.rst:838 msgid "an integer in the range 0..10 or a speedstring (see below)" msgstr "" -#: ../../library/turtle.rst:832 +#: ../../library/turtle.rst:840 msgid "" "Set the turtle's speed to an integer value in the range 0..10. If no " "argument is given, return current speed." msgstr "" -#: ../../library/turtle.rst:835 +#: ../../library/turtle.rst:843 msgid "" "If input is a number greater than 10 or smaller than 0.5, speed is set to " "0. Speedstrings are mapped to speedvalues as follows:" msgstr "" -#: ../../library/turtle.rst:838 +#: ../../library/turtle.rst:846 msgid "\"fastest\": 0" msgstr "" -#: ../../library/turtle.rst:839 +#: ../../library/turtle.rst:847 msgid "\"fast\": 10" msgstr "" -#: ../../library/turtle.rst:840 +#: ../../library/turtle.rst:848 msgid "\"normal\": 6" msgstr "" -#: ../../library/turtle.rst:841 +#: ../../library/turtle.rst:849 msgid "\"slow\": 3" msgstr "" -#: ../../library/turtle.rst:842 +#: ../../library/turtle.rst:850 msgid "\"slowest\": 1" msgstr "" -#: ../../library/turtle.rst:844 +#: ../../library/turtle.rst:852 msgid "" "Speeds from 1 to 10 enforce increasingly faster animation of line drawing " "and turtle turning." msgstr "" -#: ../../library/turtle.rst:847 +#: ../../library/turtle.rst:855 msgid "" "Attention: *speed* = 0 means that *no* animation takes place. forward/back " "makes turtle jump and likewise left/right make the turtle turn instantly." msgstr "" -#: ../../library/turtle.rst:851 +#: ../../library/turtle.rst:859 msgid "" ">>> turtle.speed()\n" "3\n" @@ -1490,12 +1498,12 @@ msgstr "" ">>> turtle.speed()\n" "9" -#: ../../library/turtle.rst:870 +#: ../../library/turtle.rst:878 msgid "" "Return the turtle's current location (x,y) (as a :class:`Vec2D` vector)." msgstr "" -#: ../../library/turtle.rst:872 +#: ../../library/turtle.rst:880 msgid "" ">>> turtle.pos()\n" "(440.00,-0.00)" @@ -1503,15 +1511,15 @@ msgstr "" ">>> turtle.pos()\n" "(440.00,-0.00)" -#: ../../library/turtle.rst:881 ../../library/turtle.rst:944 +#: ../../library/turtle.rst:889 ../../library/turtle.rst:952 msgid "a number or a pair/vector of numbers or a turtle instance" msgstr "" -#: ../../library/turtle.rst:882 ../../library/turtle.rst:945 +#: ../../library/turtle.rst:890 ../../library/turtle.rst:953 msgid "a number if *x* is a number, else ``None``" msgstr "" -#: ../../library/turtle.rst:884 +#: ../../library/turtle.rst:892 msgid "" "Return the angle between the line from turtle position to position specified " "by (x,y), the vector or the other turtle. This depends on the turtle's " @@ -1519,7 +1527,7 @@ msgid "" "\"logo\"." msgstr "" -#: ../../library/turtle.rst:888 +#: ../../library/turtle.rst:896 msgid "" ">>> turtle.goto(10, 10)\n" ">>> turtle.towards(0,0)\n" @@ -1529,11 +1537,11 @@ msgstr "" ">>> turtle.towards(0,0)\n" "225.0" -#: ../../library/turtle.rst:898 +#: ../../library/turtle.rst:906 msgid "Return the turtle's x coordinate." msgstr "" -#: ../../library/turtle.rst:900 +#: ../../library/turtle.rst:908 msgid "" ">>> turtle.home()\n" ">>> turtle.left(50)\n" @@ -1551,11 +1559,11 @@ msgstr "" ">>> print(round(turtle.xcor(), 5))\n" "64.27876" -#: ../../library/turtle.rst:914 +#: ../../library/turtle.rst:922 msgid "Return the turtle's y coordinate." msgstr "" -#: ../../library/turtle.rst:916 +#: ../../library/turtle.rst:924 msgid "" ">>> turtle.home()\n" ">>> turtle.left(60)\n" @@ -1573,13 +1581,13 @@ msgstr "" ">>> print(round(turtle.ycor(), 5))\n" "86.60254" -#: ../../library/turtle.rst:930 +#: ../../library/turtle.rst:938 msgid "" "Return the turtle's current heading (value depends on the turtle mode, see :" "func:`mode`)." msgstr "" -#: ../../library/turtle.rst:933 +#: ../../library/turtle.rst:941 msgid "" ">>> turtle.home()\n" ">>> turtle.left(67)\n" @@ -1591,13 +1599,13 @@ msgstr "" ">>> turtle.heading()\n" "67.0" -#: ../../library/turtle.rst:947 +#: ../../library/turtle.rst:955 msgid "" "Return the distance from the turtle to (x,y), the given vector, or the given " "other turtle, in turtle step units." msgstr "" -#: ../../library/turtle.rst:950 +#: ../../library/turtle.rst:958 msgid "" ">>> turtle.home()\n" ">>> turtle.distance(30,40)\n" @@ -1619,17 +1627,17 @@ msgstr "" ">>> turtle.distance(joe)\n" "77.0" -#: ../../library/turtle.rst:965 +#: ../../library/turtle.rst:973 msgid "Settings for measurement" msgstr "" -#: ../../library/turtle.rst:971 +#: ../../library/turtle.rst:979 msgid "" "Set angle measurement units, i.e. set number of \"degrees\" for a full " "circle. Default value is 360 degrees." msgstr "" -#: ../../library/turtle.rst:974 +#: ../../library/turtle.rst:982 msgid "" ">>> turtle.home()\n" ">>> turtle.left(90)\n" @@ -1646,13 +1654,13 @@ msgid "" "90.0" msgstr "" -#: ../../library/turtle.rst:994 +#: ../../library/turtle.rst:1002 msgid "" "Set the angle measurement units to radians. Equivalent to ``degrees(2*math." "pi)``." msgstr "" -#: ../../library/turtle.rst:997 +#: ../../library/turtle.rst:1005 msgid "" ">>> turtle.home()\n" ">>> turtle.left(90)\n" @@ -1670,87 +1678,87 @@ msgstr "" ">>> turtle.heading()\n" "1.5707963267948966" -#: ../../library/turtle.rst:1025 +#: ../../library/turtle.rst:1033 msgid "Pull the pen down -- drawing when moving." msgstr "" -#: ../../library/turtle.rst:1032 +#: ../../library/turtle.rst:1040 msgid "Pull the pen up -- no drawing when moving." msgstr "" -#: ../../library/turtle.rst:1038 +#: ../../library/turtle.rst:1046 msgid "a positive number" msgstr "" -#: ../../library/turtle.rst:1040 +#: ../../library/turtle.rst:1048 msgid "" "Set the line thickness to *width* or return it. If resizemode is set to " "\"auto\" and turtleshape is a polygon, that polygon is drawn with the same " "line thickness. If no argument is given, the current pensize is returned." msgstr "" -#: ../../library/turtle.rst:1044 +#: ../../library/turtle.rst:1052 msgid "" ">>> turtle.pensize()\n" "1\n" ">>> turtle.pensize(10) # from here on lines of width 10 are drawn" msgstr "" -#: ../../library/turtle.rst:1054 +#: ../../library/turtle.rst:1062 msgid "a dictionary with some or all of the below listed keys" msgstr "" -#: ../../library/turtle.rst:1055 +#: ../../library/turtle.rst:1063 msgid "one or more keyword-arguments with the below listed keys as keywords" msgstr "" -#: ../../library/turtle.rst:1057 +#: ../../library/turtle.rst:1065 msgid "" "Return or set the pen's attributes in a \"pen-dictionary\" with the " "following key/value pairs:" msgstr "" -#: ../../library/turtle.rst:1060 +#: ../../library/turtle.rst:1068 msgid "\"shown\": True/False" msgstr "" -#: ../../library/turtle.rst:1061 +#: ../../library/turtle.rst:1069 msgid "\"pendown\": True/False" msgstr "" -#: ../../library/turtle.rst:1062 +#: ../../library/turtle.rst:1070 msgid "\"pencolor\": color-string or color-tuple" msgstr "" -#: ../../library/turtle.rst:1063 +#: ../../library/turtle.rst:1071 msgid "\"fillcolor\": color-string or color-tuple" msgstr "" -#: ../../library/turtle.rst:1064 +#: ../../library/turtle.rst:1072 msgid "\"pensize\": positive number" msgstr "" -#: ../../library/turtle.rst:1065 +#: ../../library/turtle.rst:1073 msgid "\"speed\": number in range 0..10" msgstr "" -#: ../../library/turtle.rst:1066 +#: ../../library/turtle.rst:1074 msgid "\"resizemode\": \"auto\" or \"user\" or \"noresize\"" msgstr "" -#: ../../library/turtle.rst:1067 +#: ../../library/turtle.rst:1075 msgid "\"stretchfactor\": (positive number, positive number)" msgstr "" -#: ../../library/turtle.rst:1068 +#: ../../library/turtle.rst:1076 msgid "\"outline\": positive number" msgstr "" -#: ../../library/turtle.rst:1069 +#: ../../library/turtle.rst:1077 msgid "\"tilt\": number" msgstr "" -#: ../../library/turtle.rst:1071 +#: ../../library/turtle.rst:1079 msgid "" "This dictionary can be used as argument for a subsequent call to :func:`pen` " "to restore the former pen-state. Moreover one or more of these attributes " @@ -1758,7 +1766,7 @@ msgid "" "attributes in one statement." msgstr "" -#: ../../library/turtle.rst:1076 +#: ../../library/turtle.rst:1084 msgid "" ">>> turtle.pen(fillcolor=\"black\", pencolor=\"red\", pensize=10)\n" ">>> sorted(turtle.pen().items())\n" @@ -1790,11 +1798,11 @@ msgstr "" ">>> sorted(turtle.pen().items())[:3]\n" "[('fillcolor', 'green'), ('outline', 1), ('pencolor', 'red')]" -#: ../../library/turtle.rst:1097 +#: ../../library/turtle.rst:1105 msgid "Return ``True`` if pen is down, ``False`` if it's up." msgstr "" -#: ../../library/turtle.rst:1099 +#: ../../library/turtle.rst:1107 msgid "" ">>> turtle.penup()\n" ">>> turtle.isdown()\n" @@ -1810,62 +1818,62 @@ msgstr "" ">>> turtle.isdown()\n" "True" -#: ../../library/turtle.rst:1115 +#: ../../library/turtle.rst:1123 msgid "Return or set the pencolor." msgstr "" -#: ../../library/turtle.rst:1117 ../../library/turtle.rst:1166 +#: ../../library/turtle.rst:1125 ../../library/turtle.rst:1174 msgid "Four input formats are allowed:" msgstr "" -#: ../../library/turtle.rst:1119 +#: ../../library/turtle.rst:1127 msgid "``pencolor()``" msgstr "``pencolor()``" -#: ../../library/turtle.rst:1120 +#: ../../library/turtle.rst:1128 msgid "" "Return the current pencolor as color specification string or as a tuple (see " "example). May be used as input to another color/pencolor/fillcolor call." msgstr "" -#: ../../library/turtle.rst:1124 +#: ../../library/turtle.rst:1132 msgid "``pencolor(colorstring)``" msgstr "``pencolor(colorstring)``" -#: ../../library/turtle.rst:1125 +#: ../../library/turtle.rst:1133 msgid "" "Set pencolor to *colorstring*, which is a Tk color specification string, " "such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: ../../library/turtle.rst:1128 +#: ../../library/turtle.rst:1136 msgid "``pencolor((r, g, b))``" msgstr "``pencolor((r, g, b))``" -#: ../../library/turtle.rst:1129 +#: ../../library/turtle.rst:1137 msgid "" "Set pencolor to the RGB color represented by the tuple of *r*, *g*, and " "*b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where " "colormode is either 1.0 or 255 (see :func:`colormode`)." msgstr "" -#: ../../library/turtle.rst:1133 +#: ../../library/turtle.rst:1141 msgid "``pencolor(r, g, b)``" msgstr "``pencolor(r, g, b)``" -#: ../../library/turtle.rst:1134 +#: ../../library/turtle.rst:1142 msgid "" "Set pencolor to the RGB color represented by *r*, *g*, and *b*. Each of " "*r*, *g*, and *b* must be in the range 0..colormode." msgstr "" -#: ../../library/turtle.rst:1137 +#: ../../library/turtle.rst:1145 msgid "" "If turtleshape is a polygon, the outline of that polygon is drawn with the " "newly set pencolor." msgstr "" -#: ../../library/turtle.rst:1140 +#: ../../library/turtle.rst:1148 msgid "" ">>> colormode()\n" "1.0\n" @@ -1903,59 +1911,59 @@ msgstr "" ">>> turtle.pencolor()\n" "(50.0, 193.0, 143.0)" -#: ../../library/turtle.rst:1164 +#: ../../library/turtle.rst:1172 msgid "Return or set the fillcolor." msgstr "" -#: ../../library/turtle.rst:1168 +#: ../../library/turtle.rst:1176 msgid "``fillcolor()``" msgstr "``fillcolor()``" -#: ../../library/turtle.rst:1169 +#: ../../library/turtle.rst:1177 msgid "" "Return the current fillcolor as color specification string, possibly in " "tuple format (see example). May be used as input to another color/pencolor/" "fillcolor call." msgstr "" -#: ../../library/turtle.rst:1173 +#: ../../library/turtle.rst:1181 msgid "``fillcolor(colorstring)``" msgstr "``fillcolor(colorstring)``" -#: ../../library/turtle.rst:1174 +#: ../../library/turtle.rst:1182 msgid "" "Set fillcolor to *colorstring*, which is a Tk color specification string, " "such as ``\"red\"``, ``\"yellow\"``, or ``\"#33cc8c\"``." msgstr "" -#: ../../library/turtle.rst:1177 +#: ../../library/turtle.rst:1185 msgid "``fillcolor((r, g, b))``" msgstr "``fillcolor((r, g, b))``" -#: ../../library/turtle.rst:1178 +#: ../../library/turtle.rst:1186 msgid "" "Set fillcolor to the RGB color represented by the tuple of *r*, *g*, and " "*b*. Each of *r*, *g*, and *b* must be in the range 0..colormode, where " "colormode is either 1.0 or 255 (see :func:`colormode`)." msgstr "" -#: ../../library/turtle.rst:1182 +#: ../../library/turtle.rst:1190 msgid "``fillcolor(r, g, b)``" msgstr "``fillcolor(r, g, b)``" -#: ../../library/turtle.rst:1183 +#: ../../library/turtle.rst:1191 msgid "" "Set fillcolor to the RGB color represented by *r*, *g*, and *b*. Each of " "*r*, *g*, and *b* must be in the range 0..colormode." msgstr "" -#: ../../library/turtle.rst:1186 +#: ../../library/turtle.rst:1194 msgid "" "If turtleshape is a polygon, the interior of that polygon is drawn with the " "newly set fillcolor." msgstr "" -#: ../../library/turtle.rst:1189 +#: ../../library/turtle.rst:1197 msgid "" ">>> turtle.fillcolor(\"violet\")\n" ">>> turtle.fillcolor()\n" @@ -1981,55 +1989,55 @@ msgstr "" ">>> turtle.fillcolor()\n" "(255.0, 255.0, 255.0)" -#: ../../library/turtle.rst:1207 +#: ../../library/turtle.rst:1215 msgid "Return or set pencolor and fillcolor." msgstr "" -#: ../../library/turtle.rst:1209 +#: ../../library/turtle.rst:1217 msgid "" "Several input formats are allowed. They use 0 to 3 arguments as follows:" msgstr "" -#: ../../library/turtle.rst:1212 +#: ../../library/turtle.rst:1220 msgid "``color()``" msgstr "``color()``" -#: ../../library/turtle.rst:1213 +#: ../../library/turtle.rst:1221 msgid "" "Return the current pencolor and the current fillcolor as a pair of color " "specification strings or tuples as returned by :func:`pencolor` and :func:" "`fillcolor`." msgstr "" -#: ../../library/turtle.rst:1217 +#: ../../library/turtle.rst:1225 msgid "``color(colorstring)``, ``color((r,g,b))``, ``color(r,g,b)``" msgstr "``color(colorstring)``, ``color((r,g,b))``, ``color(r,g,b)``" -#: ../../library/turtle.rst:1218 +#: ../../library/turtle.rst:1226 msgid "" "Inputs as in :func:`pencolor`, set both, fillcolor and pencolor, to the " "given value." msgstr "" -#: ../../library/turtle.rst:1221 +#: ../../library/turtle.rst:1229 msgid "" "``color(colorstring1, colorstring2)``, ``color((r1,g1,b1), (r2,g2,b2))``" msgstr "" "``color(colorstring1, colorstring2)``, ``color((r1,g1,b1), (r2,g2,b2))``" -#: ../../library/turtle.rst:1222 +#: ../../library/turtle.rst:1230 msgid "" "Equivalent to ``pencolor(colorstring1)`` and ``fillcolor(colorstring2)`` and " "analogously if the other input format is used." msgstr "" -#: ../../library/turtle.rst:1225 +#: ../../library/turtle.rst:1233 msgid "" "If turtleshape is a polygon, outline and interior of that polygon is drawn " "with the newly set colors." msgstr "" -#: ../../library/turtle.rst:1228 +#: ../../library/turtle.rst:1236 msgid "" ">>> turtle.color(\"red\", \"green\")\n" ">>> turtle.color()\n" @@ -2045,15 +2053,15 @@ msgstr "" ">>> color()\n" "((40.0, 80.0, 120.0), (160.0, 200.0, 240.0))" -#: ../../library/turtle.rst:1239 +#: ../../library/turtle.rst:1247 msgid "See also: Screen method :func:`colormode`." msgstr "" -#: ../../library/turtle.rst:1253 +#: ../../library/turtle.rst:1261 msgid "Return fillstate (``True`` if filling, ``False`` else)." msgstr "" -#: ../../library/turtle.rst:1255 +#: ../../library/turtle.rst:1263 msgid "" ">>> turtle.begin_fill()\n" ">>> if turtle.filling():\n" @@ -2067,15 +2075,15 @@ msgstr "" "... else:\n" "... turtle.pensize(3)" -#: ../../library/turtle.rst:1268 +#: ../../library/turtle.rst:1276 msgid "To be called just before drawing a shape to be filled." msgstr "" -#: ../../library/turtle.rst:1273 +#: ../../library/turtle.rst:1281 msgid "Fill the shape drawn after the last call to :func:`begin_fill`." msgstr "" -#: ../../library/turtle.rst:1275 +#: ../../library/turtle.rst:1283 msgid "" "Whether or not overlap regions for self-intersecting polygons or multiple " "shapes are filled depends on the operating system graphics, type of overlap, " @@ -2083,7 +2091,7 @@ msgid "" "all yellow or have some white regions." msgstr "" -#: ../../library/turtle.rst:1280 +#: ../../library/turtle.rst:1288 msgid "" ">>> turtle.color(\"black\", \"red\")\n" ">>> turtle.begin_fill()\n" @@ -2095,13 +2103,13 @@ msgstr "" ">>> turtle.circle(80)\n" ">>> turtle.end_fill()" -#: ../../library/turtle.rst:1294 +#: ../../library/turtle.rst:1302 msgid "" "Delete the turtle's drawings from the screen, re-center the turtle and set " "variables to the default values." msgstr "" -#: ../../library/turtle.rst:1297 +#: ../../library/turtle.rst:1305 msgid "" ">>> turtle.goto(0,-22)\n" ">>> turtle.left(100)\n" @@ -2127,30 +2135,30 @@ msgstr "" ">>> turtle.heading()\n" "0.0" -#: ../../library/turtle.rst:1315 +#: ../../library/turtle.rst:1323 msgid "" "Delete the turtle's drawings from the screen. Do not move turtle. State " "and position of the turtle as well as drawings of other turtles are not " "affected." msgstr "" -#: ../../library/turtle.rst:1321 +#: ../../library/turtle.rst:1329 msgid "object to be written to the TurtleScreen" msgstr "" -#: ../../library/turtle.rst:1322 +#: ../../library/turtle.rst:1330 msgid "True/False" msgstr "True/False" -#: ../../library/turtle.rst:1323 +#: ../../library/turtle.rst:1331 msgid "one of the strings \"left\", \"center\" or right\"" msgstr "" -#: ../../library/turtle.rst:1324 +#: ../../library/turtle.rst:1332 msgid "a triple (fontname, fontsize, fonttype)" msgstr "" -#: ../../library/turtle.rst:1326 +#: ../../library/turtle.rst:1334 msgid "" "Write text - the string representation of *arg* - at the current turtle " "position according to *align* (\"left\", \"center\" or \"right\") and with " @@ -2158,34 +2166,34 @@ msgid "" "corner of the text. By default, *move* is ``False``." msgstr "" -#: ../../library/turtle.rst:1344 +#: ../../library/turtle.rst:1352 msgid "" "Make the turtle invisible. It's a good idea to do this while you're in the " "middle of doing some complex drawing, because hiding the turtle speeds up " "the drawing observably." msgstr "" -#: ../../library/turtle.rst:1348 +#: ../../library/turtle.rst:1356 msgid ">>> turtle.hideturtle()" msgstr ">>> turtle.hideturtle()" -#: ../../library/turtle.rst:1357 +#: ../../library/turtle.rst:1365 msgid "Make the turtle visible." msgstr "" -#: ../../library/turtle.rst:1359 +#: ../../library/turtle.rst:1367 msgid ">>> turtle.showturtle()" msgstr ">>> turtle.showturtle()" -#: ../../library/turtle.rst:1367 +#: ../../library/turtle.rst:1375 msgid "Return ``True`` if the Turtle is shown, ``False`` if it's hidden." msgstr "" -#: ../../library/turtle.rst:1382 +#: ../../library/turtle.rst:1390 msgid "a string which is a valid shapename" msgstr "" -#: ../../library/turtle.rst:1384 +#: ../../library/turtle.rst:1392 msgid "" "Set turtle shape to shape with given *name* or, if name is not given, return " "name of current shape. Shape with *name* must exist in the TurtleScreen's " @@ -2195,7 +2203,7 @@ msgid "" "`register_shape`." msgstr "" -#: ../../library/turtle.rst:1390 +#: ../../library/turtle.rst:1398 msgid "" ">>> turtle.shape()\n" "'classic'\n" @@ -2209,40 +2217,40 @@ msgstr "" ">>> turtle.shape()\n" "'turtle'" -#: ../../library/turtle.rst:1402 +#: ../../library/turtle.rst:1410 msgid "one of the strings \"auto\", \"user\", \"noresize\"" msgstr "" -#: ../../library/turtle.rst:1404 +#: ../../library/turtle.rst:1412 msgid "" "Set resizemode to one of the values: \"auto\", \"user\", \"noresize\". If " "*rmode* is not given, return current resizemode. Different resizemodes have " "the following effects:" msgstr "" -#: ../../library/turtle.rst:1408 +#: ../../library/turtle.rst:1416 msgid "" "\"auto\": adapts the appearance of the turtle corresponding to the value of " "pensize." msgstr "" -#: ../../library/turtle.rst:1409 +#: ../../library/turtle.rst:1417 msgid "" "\"user\": adapts the appearance of the turtle according to the values of " "stretchfactor and outlinewidth (outline), which are set by :func:`shapesize`." msgstr "" -#: ../../library/turtle.rst:1412 +#: ../../library/turtle.rst:1420 msgid "\"noresize\": no adaption of the turtle's appearance takes place." msgstr "" -#: ../../library/turtle.rst:1414 +#: ../../library/turtle.rst:1422 msgid "" "``resizemode(\"user\")`` is called by :func:`shapesize` when used with " "arguments." msgstr "" -#: ../../library/turtle.rst:1416 +#: ../../library/turtle.rst:1424 msgid "" ">>> turtle.resizemode()\n" "'noresize'\n" @@ -2256,12 +2264,12 @@ msgstr "" ">>> turtle.resizemode()\n" "'auto'" -#: ../../library/turtle.rst:1429 ../../library/turtle.rst:1430 -#: ../../library/turtle.rst:1431 +#: ../../library/turtle.rst:1437 ../../library/turtle.rst:1438 +#: ../../library/turtle.rst:1439 msgid "positive number" msgstr "" -#: ../../library/turtle.rst:1433 +#: ../../library/turtle.rst:1441 msgid "" "Return or set the pen's attributes x/y-stretchfactors and/or outline. Set " "resizemode to \"user\". If and only if resizemode is set to \"user\", the " @@ -2271,7 +2279,7 @@ msgid "" "determines the width of the shape's outline." msgstr "" -#: ../../library/turtle.rst:1440 +#: ../../library/turtle.rst:1448 msgid "" ">>> turtle.shapesize()\n" "(1.0, 1.0, 1)\n" @@ -2293,12 +2301,12 @@ msgstr "" ">>> turtle.shapesize()\n" "(5, 5, 8)" -#: ../../library/turtle.rst:1456 ../../library/turtle.rst:2115 -#: ../../library/turtle.rst:2116 ../../library/turtle.rst:2117 +#: ../../library/turtle.rst:1464 ../../library/turtle.rst:2101 +#: ../../library/turtle.rst:2102 ../../library/turtle.rst:2103 msgid "number (optional)" msgstr "" -#: ../../library/turtle.rst:1458 +#: ../../library/turtle.rst:1466 msgid "" "Set or return the current shearfactor. Shear the turtleshape according to " "the given shearfactor shear, which is the tangent of the shear angle. Do " @@ -2307,7 +2315,7 @@ msgid "" "by which lines parallel to the heading of the turtle are sheared." msgstr "" -#: ../../library/turtle.rst:1465 +#: ../../library/turtle.rst:1473 msgid "" ">>> turtle.shape(\"circle\")\n" ">>> turtle.shapesize(5,2)\n" @@ -2321,13 +2329,13 @@ msgstr "" ">>> turtle.shearfactor()\n" "0.5" -#: ../../library/turtle.rst:1479 +#: ../../library/turtle.rst:1487 msgid "" "Rotate the turtleshape by *angle* from its current tilt-angle, but do *not* " "change the turtle's heading (direction of movement)." msgstr "" -#: ../../library/turtle.rst:1482 +#: ../../library/turtle.rst:1490 msgid "" ">>> turtle.reset()\n" ">>> turtle.shape(\"circle\")\n" @@ -2345,38 +2353,13 @@ msgstr "" ">>> turtle.tilt(30)\n" ">>> turtle.fd(50)" -#: ../../library/turtle.rst:1498 -msgid "" -"Rotate the turtleshape to point in the direction specified by *angle*, " -"regardless of its current tilt-angle. *Do not* change the turtle's heading " -"(direction of movement)." -msgstr "" - -#: ../../library/turtle.rst:1502 -msgid "" -">>> turtle.reset()\n" -">>> turtle.shape(\"circle\")\n" -">>> turtle.shapesize(5,2)\n" -">>> turtle.settiltangle(45)\n" -">>> turtle.fd(50)\n" -">>> turtle.settiltangle(-45)\n" -">>> turtle.fd(50)" -msgstr "" -">>> turtle.reset()\n" -">>> turtle.shape(\"circle\")\n" -">>> turtle.shapesize(5,2)\n" -">>> turtle.settiltangle(45)\n" -">>> turtle.fd(50)\n" -">>> turtle.settiltangle(-45)\n" -">>> turtle.fd(50)" - -#: ../../library/turtle.rst:1518 ../../library/turtle.rst:1541 -#: ../../library/turtle.rst:1542 ../../library/turtle.rst:1543 -#: ../../library/turtle.rst:1544 +#: ../../library/turtle.rst:1504 ../../library/turtle.rst:1527 +#: ../../library/turtle.rst:1528 ../../library/turtle.rst:1529 +#: ../../library/turtle.rst:1530 msgid "a number (optional)" msgstr "" -#: ../../library/turtle.rst:1520 +#: ../../library/turtle.rst:1506 msgid "" "Set or return the current tilt-angle. If angle is given, rotate the " "turtleshape to point in the direction specified by angle, regardless of its " @@ -2386,7 +2369,7 @@ msgid "" "turtle (its direction of movement)." msgstr "" -#: ../../library/turtle.rst:1528 +#: ../../library/turtle.rst:1514 msgid "" ">>> turtle.reset()\n" ">>> turtle.shape(\"circle\")\n" @@ -2402,11 +2385,11 @@ msgstr "" ">>> turtle.tiltangle()\n" "45.0" -#: ../../library/turtle.rst:1546 +#: ../../library/turtle.rst:1532 msgid "Set or return the current transformation matrix of the turtle shape." msgstr "" -#: ../../library/turtle.rst:1548 +#: ../../library/turtle.rst:1534 msgid "" "If none of the matrix elements are given, return the transformation matrix " "as a tuple of 4 elements. Otherwise set the given elements and transform the " @@ -2416,7 +2399,7 @@ msgid "" "tiltangle according to the given matrix." msgstr "" -#: ../../library/turtle.rst:1557 +#: ../../library/turtle.rst:1543 msgid "" ">>> turtle = Turtle()\n" ">>> turtle.shape(\"square\")\n" @@ -2432,13 +2415,13 @@ msgstr "" ">>> turtle.shapetransform()\n" "(4.0, -1.0, -0.0, 2.0)" -#: ../../library/turtle.rst:1570 +#: ../../library/turtle.rst:1556 msgid "" "Return the current shape polygon as tuple of coordinate pairs. This can be " "used to define a new shape or components of a compound shape." msgstr "" -#: ../../library/turtle.rst:1573 +#: ../../library/turtle.rst:1559 msgid "" ">>> turtle.shape(\"square\")\n" ">>> turtle.shapetransform(4, -1, 0, 2)\n" @@ -2450,33 +2433,33 @@ msgstr "" ">>> turtle.get_shapepoly()\n" "((50, -20), (30, 20), (-50, 20), (-30, -20))" -#: ../../library/turtle.rst:1588 ../../library/turtle.rst:1610 -#: ../../library/turtle.rst:1635 ../../library/turtle.rst:2039 +#: ../../library/turtle.rst:1574 ../../library/turtle.rst:1596 +#: ../../library/turtle.rst:1621 ../../library/turtle.rst:2025 msgid "" "a function with two arguments which will be called with the coordinates of " "the clicked point on the canvas" msgstr "" -#: ../../library/turtle.rst:1590 ../../library/turtle.rst:1612 -#: ../../library/turtle.rst:1637 ../../library/turtle.rst:2041 +#: ../../library/turtle.rst:1576 ../../library/turtle.rst:1598 +#: ../../library/turtle.rst:1623 ../../library/turtle.rst:2027 msgid "number of the mouse-button, defaults to 1 (left mouse button)" msgstr "" -#: ../../library/turtle.rst:1591 ../../library/turtle.rst:1613 -#: ../../library/turtle.rst:1638 ../../library/turtle.rst:2042 +#: ../../library/turtle.rst:1577 ../../library/turtle.rst:1599 +#: ../../library/turtle.rst:1624 ../../library/turtle.rst:2028 msgid "" "``True`` or ``False`` -- if ``True``, a new binding will be added, otherwise " "it will replace a former binding" msgstr "" -#: ../../library/turtle.rst:1594 +#: ../../library/turtle.rst:1580 msgid "" "Bind *fun* to mouse-click events on this turtle. If *fun* is ``None``, " "existing bindings are removed. Example for the anonymous turtle, i.e. the " "procedural way:" msgstr "" -#: ../../library/turtle.rst:1598 +#: ../../library/turtle.rst:1584 msgid "" ">>> def turn(x, y):\n" "... left(180)\n" @@ -2485,13 +2468,13 @@ msgid "" ">>> onclick(None) # event-binding will be removed" msgstr "" -#: ../../library/turtle.rst:1616 +#: ../../library/turtle.rst:1602 msgid "" "Bind *fun* to mouse-button-release events on this turtle. If *fun* is " "``None``, existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:1619 +#: ../../library/turtle.rst:1605 msgid "" ">>> class MyTurtle(Turtle):\n" "... def glow(self,x,y):\n" @@ -2505,45 +2488,45 @@ msgid "" ">>> turtle.onrelease(turtle.unglow) # releasing turns it to transparent." msgstr "" -#: ../../library/turtle.rst:1641 +#: ../../library/turtle.rst:1627 msgid "" "Bind *fun* to mouse-move events on this turtle. If *fun* is ``None``, " "existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:1644 +#: ../../library/turtle.rst:1630 msgid "" "Remark: Every sequence of mouse-move-events on a turtle is preceded by a " "mouse-click event on that turtle." msgstr "" -#: ../../library/turtle.rst:1647 +#: ../../library/turtle.rst:1633 msgid ">>> turtle.ondrag(turtle.goto)" msgstr ">>> turtle.ondrag(turtle.goto)" -#: ../../library/turtle.rst:1652 +#: ../../library/turtle.rst:1638 msgid "" "Subsequently, clicking and dragging the Turtle will move it across the " "screen thereby producing handdrawings (if pen is down)." msgstr "" -#: ../../library/turtle.rst:1661 +#: ../../library/turtle.rst:1647 msgid "" "Start recording the vertices of a polygon. Current turtle position is first " "vertex of polygon." msgstr "" -#: ../../library/turtle.rst:1667 +#: ../../library/turtle.rst:1653 msgid "" "Stop recording the vertices of a polygon. Current turtle position is last " "vertex of polygon. This will be connected with the first vertex." msgstr "" -#: ../../library/turtle.rst:1673 +#: ../../library/turtle.rst:1659 msgid "Return the last recorded polygon." msgstr "" -#: ../../library/turtle.rst:1675 +#: ../../library/turtle.rst:1661 msgid "" ">>> turtle.home()\n" ">>> turtle.begin_poly()\n" @@ -2567,13 +2550,13 @@ msgstr "" ">>> p = turtle.get_poly()\n" ">>> register_shape(\"myFavouriteShape\", p)" -#: ../../library/turtle.rst:1692 +#: ../../library/turtle.rst:1678 msgid "" "Create and return a clone of the turtle with same position, heading and " "turtle properties." msgstr "" -#: ../../library/turtle.rst:1695 +#: ../../library/turtle.rst:1681 msgid "" ">>> mick = Turtle()\n" ">>> joe = mick.clone()" @@ -2581,13 +2564,13 @@ msgstr "" ">>> mick = Turtle()\n" ">>> joe = mick.clone()" -#: ../../library/turtle.rst:1705 +#: ../../library/turtle.rst:1691 msgid "" "Return the Turtle object itself. Only reasonable use: as a function to " "return the \"anonymous turtle\":" msgstr "" -#: ../../library/turtle.rst:1708 +#: ../../library/turtle.rst:1694 msgid "" ">>> pet = getturtle()\n" ">>> pet.fd(50)\n" @@ -2599,13 +2582,13 @@ msgstr "" ">>> pet\n" "" -#: ../../library/turtle.rst:1719 +#: ../../library/turtle.rst:1705 msgid "" "Return the :class:`TurtleScreen` object the turtle is drawing on. " "TurtleScreen methods can then be called for that object." msgstr "" -#: ../../library/turtle.rst:1722 +#: ../../library/turtle.rst:1708 msgid "" ">>> ts = turtle.getscreen()\n" ">>> ts\n" @@ -2617,11 +2600,11 @@ msgstr "" "\n" ">>> ts.bgcolor(\"pink\")" -#: ../../library/turtle.rst:1733 +#: ../../library/turtle.rst:1719 msgid "an integer or ``None``" msgstr "一個整數或 ``None``" -#: ../../library/turtle.rst:1735 +#: ../../library/turtle.rst:1721 msgid "" "Set or disable undobuffer. If *size* is an integer, an empty undobuffer of " "given size is installed. *size* gives the maximum number of turtle actions " @@ -2629,15 +2612,15 @@ msgid "" "``None``, the undobuffer is disabled." msgstr "" -#: ../../library/turtle.rst:1740 +#: ../../library/turtle.rst:1726 msgid ">>> turtle.setundobuffer(42)" msgstr ">>> turtle.setundobuffer(42)" -#: ../../library/turtle.rst:1748 +#: ../../library/turtle.rst:1734 msgid "Return number of entries in the undobuffer." msgstr "" -#: ../../library/turtle.rst:1750 +#: ../../library/turtle.rst:1736 msgid "" ">>> while undobufferentries():\n" "... undo()" @@ -2645,32 +2628,32 @@ msgstr "" ">>> while undobufferentries():\n" "... undo()" -#: ../../library/turtle.rst:1761 +#: ../../library/turtle.rst:1747 msgid "Compound shapes" msgstr "" -#: ../../library/turtle.rst:1763 +#: ../../library/turtle.rst:1749 msgid "" "To use compound turtle shapes, which consist of several polygons of " "different color, you must use the helper class :class:`Shape` explicitly as " "described below:" msgstr "" -#: ../../library/turtle.rst:1767 +#: ../../library/turtle.rst:1753 msgid "Create an empty Shape object of type \"compound\"." msgstr "" -#: ../../library/turtle.rst:1768 +#: ../../library/turtle.rst:1754 msgid "" "Add as many components to this object as desired, using the :meth:`~Shape." "addcomponent` method." msgstr "" -#: ../../library/turtle.rst:1771 +#: ../../library/turtle.rst:1757 msgid "For example:" msgstr "舉例來說:" -#: ../../library/turtle.rst:1773 +#: ../../library/turtle.rst:1759 msgid "" ">>> s = Shape(\"compound\")\n" ">>> poly1 = ((0,0),(10,-5),(0,10),(-10,-5))\n" @@ -2684,11 +2667,11 @@ msgstr "" ">>> poly2 = ((0,0),(10,-5),(-10,-5))\n" ">>> s.addcomponent(poly2, \"blue\", \"red\")" -#: ../../library/turtle.rst:1782 +#: ../../library/turtle.rst:1768 msgid "Now add the Shape to the Screen's shapelist and use it:" msgstr "" -#: ../../library/turtle.rst:1784 +#: ../../library/turtle.rst:1770 msgid "" ">>> register_shape(\"myshape\", s)\n" ">>> shape(\"myshape\")" @@ -2696,34 +2679,34 @@ msgstr "" ">>> register_shape(\"myshape\", s)\n" ">>> shape(\"myshape\")" -#: ../../library/turtle.rst:1793 +#: ../../library/turtle.rst:1779 msgid "" "The :class:`Shape` class is used internally by the :func:`register_shape` " "method in different ways. The application programmer has to deal with the " "Shape class *only* when using compound shapes like shown above!" msgstr "" -#: ../../library/turtle.rst:1799 +#: ../../library/turtle.rst:1785 msgid "Methods of TurtleScreen/Screen and corresponding functions" msgstr "" -#: ../../library/turtle.rst:1801 +#: ../../library/turtle.rst:1787 msgid "" "Most of the examples in this section refer to a TurtleScreen instance called " "``screen``." msgstr "" -#: ../../library/turtle.rst:1815 +#: ../../library/turtle.rst:1801 msgid "" "a color string or three numbers in the range 0..colormode or a 3-tuple of " "such numbers" msgstr "" -#: ../../library/turtle.rst:1819 +#: ../../library/turtle.rst:1805 msgid "Set or return background color of the TurtleScreen." msgstr "" -#: ../../library/turtle.rst:1821 +#: ../../library/turtle.rst:1807 msgid "" ">>> screen.bgcolor(\"orange\")\n" ">>> screen.bgcolor()\n" @@ -2739,11 +2722,11 @@ msgstr "" ">>> screen.bgcolor()\n" "(128.0, 0.0, 128.0)" -#: ../../library/turtle.rst:1834 +#: ../../library/turtle.rst:1820 msgid "a string, name of a gif-file or ``\"nopic\"``, or ``None``" msgstr "" -#: ../../library/turtle.rst:1836 +#: ../../library/turtle.rst:1822 msgid "" "Set background image or return name of current backgroundimage. If " "*picname* is a filename, set the corresponding image as background. If " @@ -2751,7 +2734,7 @@ msgid "" "*picname* is ``None``, return the filename of the current backgroundimage. ::" msgstr "" -#: ../../library/turtle.rst:1841 +#: ../../library/turtle.rst:1827 msgid "" ">>> screen.bgpic()\n" "'nopic'\n" @@ -2765,44 +2748,44 @@ msgstr "" ">>> screen.bgpic()\n" "\"landscape.gif\"" -#: ../../library/turtle.rst:1852 +#: ../../library/turtle.rst:1838 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``clearscreen``. The global function ``clear`` is a different one " "derived from the Turtle method ``clear``." msgstr "" -#: ../../library/turtle.rst:1859 +#: ../../library/turtle.rst:1845 msgid "" "Delete all drawings and all turtles from the TurtleScreen. Reset the now " "empty TurtleScreen to its initial state: white background, no background " "image, no event bindings and tracing on." msgstr "" -#: ../../library/turtle.rst:1868 +#: ../../library/turtle.rst:1854 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``resetscreen``. The global function ``reset`` is another one derived " "from the Turtle method ``reset``." msgstr "" -#: ../../library/turtle.rst:1875 +#: ../../library/turtle.rst:1861 msgid "Reset all Turtles on the Screen to their initial state." msgstr "" -#: ../../library/turtle.rst:1880 +#: ../../library/turtle.rst:1866 msgid "positive integer, new width of canvas in pixels" msgstr "" -#: ../../library/turtle.rst:1881 +#: ../../library/turtle.rst:1867 msgid "positive integer, new height of canvas in pixels" msgstr "" -#: ../../library/turtle.rst:1882 +#: ../../library/turtle.rst:1868 msgid "colorstring or color-tuple, new background color" msgstr "" -#: ../../library/turtle.rst:1884 +#: ../../library/turtle.rst:1870 msgid "" "If no arguments are given, return current (canvaswidth, canvasheight). Else " "resize the canvas the turtles are drawing on. Do not alter the drawing " @@ -2811,40 +2794,40 @@ msgid "" "outside the canvas before." msgstr "" -#: ../../library/turtle.rst:1896 +#: ../../library/turtle.rst:1882 msgid "e.g. to search for an erroneously escaped turtle ;-)" msgstr "" -#: ../../library/turtle.rst:1901 +#: ../../library/turtle.rst:1887 msgid "a number, x-coordinate of lower left corner of canvas" msgstr "" -#: ../../library/turtle.rst:1902 +#: ../../library/turtle.rst:1888 msgid "a number, y-coordinate of lower left corner of canvas" msgstr "" -#: ../../library/turtle.rst:1903 +#: ../../library/turtle.rst:1889 msgid "a number, x-coordinate of upper right corner of canvas" msgstr "" -#: ../../library/turtle.rst:1904 +#: ../../library/turtle.rst:1890 msgid "a number, y-coordinate of upper right corner of canvas" msgstr "" -#: ../../library/turtle.rst:1906 +#: ../../library/turtle.rst:1892 msgid "" "Set up user-defined coordinate system and switch to mode \"world\" if " "necessary. This performs a ``screen.reset()``. If mode \"world\" is " "already active, all drawings are redrawn according to the new coordinates." msgstr "" -#: ../../library/turtle.rst:1910 +#: ../../library/turtle.rst:1896 msgid "" "**ATTENTION**: in user-defined coordinate systems angles may appear " "distorted." msgstr "" -#: ../../library/turtle.rst:1913 +#: ../../library/turtle.rst:1899 msgid "" ">>> screen.reset()\n" ">>> screen.setworldcoordinates(-50,-7.5,50,7.5)\n" @@ -2855,22 +2838,22 @@ msgid "" "... left(45); fd(2) # a regular octagon" msgstr "" -#: ../../library/turtle.rst:1938 +#: ../../library/turtle.rst:1924 msgid "positive integer" msgstr "" -#: ../../library/turtle.rst:1940 +#: ../../library/turtle.rst:1926 msgid "" "Set or return the drawing *delay* in milliseconds. (This is approximately " "the time interval between two consecutive canvas updates.) The longer the " "drawing delay, the slower the animation." msgstr "" -#: ../../library/turtle.rst:1944 +#: ../../library/turtle.rst:1930 msgid "Optional argument:" msgstr "" -#: ../../library/turtle.rst:1946 +#: ../../library/turtle.rst:1932 msgid "" ">>> screen.delay()\n" "10\n" @@ -2884,11 +2867,11 @@ msgstr "" ">>> screen.delay()\n" "5" -#: ../../library/turtle.rst:1958 ../../library/turtle.rst:1959 +#: ../../library/turtle.rst:1944 ../../library/turtle.rst:1945 msgid "nonnegative integer" msgstr "" -#: ../../library/turtle.rst:1961 +#: ../../library/turtle.rst:1947 msgid "" "Turn turtle animation on/off and set delay for update drawings. If *n* is " "given, only each n-th regular screen update is really performed. (Can be " @@ -2897,7 +2880,7 @@ msgid "" "delay value (see :func:`delay`)." msgstr "" -#: ../../library/turtle.rst:1968 +#: ../../library/turtle.rst:1954 msgid "" ">>> screen.tracer(8, 25)\n" ">>> dist = 2\n" @@ -2913,37 +2896,37 @@ msgstr "" "... rt(90)\n" "... dist += 2" -#: ../../library/turtle.rst:1981 +#: ../../library/turtle.rst:1967 msgid "Perform a TurtleScreen update. To be used when tracer is turned off." msgstr "" -#: ../../library/turtle.rst:1983 +#: ../../library/turtle.rst:1969 msgid "See also the RawTurtle/Turtle method :func:`speed`." msgstr "" -#: ../../library/turtle.rst:1991 +#: ../../library/turtle.rst:1977 msgid "" "Set focus on TurtleScreen (in order to collect key-events). Dummy arguments " "are provided in order to be able to pass :func:`listen` to the onclick " "method." msgstr "" -#: ../../library/turtle.rst:1998 ../../library/turtle.rst:2018 +#: ../../library/turtle.rst:1984 ../../library/turtle.rst:2004 msgid "a function with no arguments or ``None``" msgstr "" -#: ../../library/turtle.rst:1999 ../../library/turtle.rst:2019 +#: ../../library/turtle.rst:1985 ../../library/turtle.rst:2005 msgid "a string: key (e.g. \"a\") or key-symbol (e.g. \"space\")" msgstr "" -#: ../../library/turtle.rst:2001 +#: ../../library/turtle.rst:1987 msgid "" "Bind *fun* to key-release event of key. If *fun* is ``None``, event " "bindings are removed. Remark: in order to be able to register key-events, " "TurtleScreen must have the focus. (See method :func:`listen`.)" msgstr "" -#: ../../library/turtle.rst:2005 +#: ../../library/turtle.rst:1991 msgid "" ">>> def f():\n" "... fd(50)\n" @@ -2959,14 +2942,14 @@ msgstr "" ">>> screen.onkey(f, \"Up\")\n" ">>> screen.listen()" -#: ../../library/turtle.rst:2021 +#: ../../library/turtle.rst:2007 msgid "" "Bind *fun* to key-press event of key if key is given, or to any key-press-" "event if no key is given. Remark: in order to be able to register key-" "events, TurtleScreen must have focus. (See method :func:`listen`.)" msgstr "" -#: ../../library/turtle.rst:2026 +#: ../../library/turtle.rst:2012 msgid "" ">>> def f():\n" "... fd(50)\n" @@ -2980,19 +2963,19 @@ msgstr "" ">>> screen.onkey(f, \"Up\")\n" ">>> screen.listen()" -#: ../../library/turtle.rst:2045 +#: ../../library/turtle.rst:2031 msgid "" "Bind *fun* to mouse-click events on this screen. If *fun* is ``None``, " "existing bindings are removed." msgstr "" -#: ../../library/turtle.rst:2048 +#: ../../library/turtle.rst:2034 msgid "" "Example for a TurtleScreen instance named ``screen`` and a Turtle instance " "named ``turtle``:" msgstr "" -#: ../../library/turtle.rst:2051 +#: ../../library/turtle.rst:2037 msgid "" ">>> screen.onclick(turtle.goto) # Subsequently clicking into the " "TurtleScreen will\n" @@ -3001,26 +2984,26 @@ msgid "" ">>> screen.onclick(None) # remove event binding again" msgstr "" -#: ../../library/turtle.rst:2059 +#: ../../library/turtle.rst:2045 msgid "" "This TurtleScreen method is available as a global function only under the " "name ``onscreenclick``. The global function ``onclick`` is another one " "derived from the Turtle method ``onclick``." msgstr "" -#: ../../library/turtle.rst:2066 +#: ../../library/turtle.rst:2052 msgid "a function with no arguments" msgstr "" -#: ../../library/turtle.rst:2067 +#: ../../library/turtle.rst:2053 msgid "a number >= 0" msgstr "" -#: ../../library/turtle.rst:2069 +#: ../../library/turtle.rst:2055 msgid "Install a timer that calls *fun* after *t* milliseconds." msgstr "" -#: ../../library/turtle.rst:2071 +#: ../../library/turtle.rst:2057 msgid "" ">>> running = True\n" ">>> def f():\n" @@ -3032,7 +3015,7 @@ msgid "" ">>> running = False" msgstr "" -#: ../../library/turtle.rst:2087 +#: ../../library/turtle.rst:2073 msgid "" "Starts event loop - calling Tkinter's mainloop function. Must be the last " "statement in a turtle graphics program. Must *not* be used if a script is " @@ -3040,16 +3023,16 @@ msgid "" "turtle graphics. ::" msgstr "" -#: ../../library/turtle.rst:2092 +#: ../../library/turtle.rst:2078 msgid ">>> screen.mainloop()" msgstr ">>> screen.mainloop()" -#: ../../library/turtle.rst:2100 ../../library/turtle.rst:2101 -#: ../../library/turtle.rst:2113 ../../library/turtle.rst:2114 +#: ../../library/turtle.rst:2086 ../../library/turtle.rst:2087 +#: ../../library/turtle.rst:2099 ../../library/turtle.rst:2100 msgid "string" msgstr "string(字串)" -#: ../../library/turtle.rst:2103 +#: ../../library/turtle.rst:2089 msgid "" "Pop up a dialog window for input of a string. Parameter title is the title " "of the dialog window, prompt is a text mostly describing what information to " @@ -3057,11 +3040,11 @@ msgid "" "``None``. ::" msgstr "" -#: ../../library/turtle.rst:2108 +#: ../../library/turtle.rst:2094 msgid ">>> screen.textinput(\"NIM\", \"Name of first player:\")" msgstr ">>> screen.textinput(\"NIM\", \"Name of first player:\")" -#: ../../library/turtle.rst:2119 +#: ../../library/turtle.rst:2105 msgid "" "Pop up a dialog window for input of a number. title is the title of the " "dialog window, prompt is a text mostly describing what numerical information " @@ -3072,7 +3055,7 @@ msgid "" "return ``None``. ::" msgstr "" -#: ../../library/turtle.rst:2128 +#: ../../library/turtle.rst:2114 msgid "" ">>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, " "maxval=10000)" @@ -3080,17 +3063,17 @@ msgstr "" ">>> screen.numinput(\"Poker\", \"Your stakes:\", 1000, minval=10, " "maxval=10000)" -#: ../../library/turtle.rst:2136 +#: ../../library/turtle.rst:2122 msgid "one of the strings \"standard\", \"logo\" or \"world\"" msgstr "" -#: ../../library/turtle.rst:2138 +#: ../../library/turtle.rst:2124 msgid "" "Set turtle mode (\"standard\", \"logo\" or \"world\") and perform reset. If " "mode is not given, current mode is returned." msgstr "" -#: ../../library/turtle.rst:2141 +#: ../../library/turtle.rst:2127 msgid "" "Mode \"standard\" is compatible with old :mod:`turtle`. Mode \"logo\" is " "compatible with most Logo turtle graphics. Mode \"world\" uses user-defined " @@ -3098,60 +3081,60 @@ msgid "" "if ``x/y`` unit-ratio doesn't equal 1." msgstr "" -#: ../../library/turtle.rst:2147 +#: ../../library/turtle.rst:2133 msgid "Mode" msgstr "" -#: ../../library/turtle.rst:2147 +#: ../../library/turtle.rst:2133 msgid "Initial turtle heading" msgstr "" -#: ../../library/turtle.rst:2147 +#: ../../library/turtle.rst:2133 msgid "positive angles" msgstr "" -#: ../../library/turtle.rst:2149 +#: ../../library/turtle.rst:2135 msgid "\"standard\"" msgstr "" -#: ../../library/turtle.rst:2149 +#: ../../library/turtle.rst:2135 msgid "to the right (east)" msgstr "" -#: ../../library/turtle.rst:2149 +#: ../../library/turtle.rst:2135 msgid "counterclockwise" msgstr "" -#: ../../library/turtle.rst:2150 +#: ../../library/turtle.rst:2136 msgid "\"logo\"" msgstr "" -#: ../../library/turtle.rst:2150 +#: ../../library/turtle.rst:2136 msgid "upward (north)" msgstr "" -#: ../../library/turtle.rst:2150 +#: ../../library/turtle.rst:2136 msgid "clockwise" msgstr "" -#: ../../library/turtle.rst:2153 +#: ../../library/turtle.rst:2139 msgid "" ">>> mode(\"logo\") # resets turtle heading to north\n" ">>> mode()\n" "'logo'" msgstr "" -#: ../../library/turtle.rst:2163 +#: ../../library/turtle.rst:2149 msgid "one of the values 1.0 or 255" msgstr "" -#: ../../library/turtle.rst:2165 +#: ../../library/turtle.rst:2151 msgid "" "Return the colormode or set it to 1.0 or 255. Subsequently *r*, *g*, *b* " "values of color triples have to be in the range 0..*cmode*." msgstr "" -#: ../../library/turtle.rst:2168 +#: ../../library/turtle.rst:2154 msgid "" ">>> screen.colormode(1)\n" ">>> turtle.pencolor(240, 160, 80)\n" @@ -3177,13 +3160,13 @@ msgstr "" "255\n" ">>> turtle.pencolor(240,160,80)" -#: ../../library/turtle.rst:2186 +#: ../../library/turtle.rst:2172 msgid "" "Return the Canvas of this TurtleScreen. Useful for insiders who know what " "to do with a Tkinter Canvas." msgstr "" -#: ../../library/turtle.rst:2189 +#: ../../library/turtle.rst:2175 msgid "" ">>> cv = screen.getcanvas()\n" ">>> cv\n" @@ -3193,11 +3176,11 @@ msgstr "" ">>> cv\n" "" -#: ../../library/turtle.rst:2199 +#: ../../library/turtle.rst:2185 msgid "Return a list of names of all currently available turtle shapes." msgstr "" -#: ../../library/turtle.rst:2201 +#: ../../library/turtle.rst:2187 msgid "" ">>> screen.getshapes()\n" "['arrow', 'blank', 'circle', ..., 'turtle']" @@ -3205,53 +3188,53 @@ msgstr "" ">>> screen.getshapes()\n" "['arrow', 'blank', 'circle', ..., 'turtle']" -#: ../../library/turtle.rst:2211 +#: ../../library/turtle.rst:2197 msgid "There are three different ways to call this function:" msgstr "" -#: ../../library/turtle.rst:2213 +#: ../../library/turtle.rst:2199 msgid "" "*name* is the name of a gif-file and *shape* is ``None``: Install the " "corresponding image shape. ::" msgstr "" -#: ../../library/turtle.rst:2216 +#: ../../library/turtle.rst:2202 msgid ">>> screen.register_shape(\"turtle.gif\")" msgstr ">>> screen.register_shape(\"turtle.gif\")" -#: ../../library/turtle.rst:2219 +#: ../../library/turtle.rst:2205 msgid "" "Image shapes *do not* rotate when turning the turtle, so they do not display " "the heading of the turtle!" msgstr "" -#: ../../library/turtle.rst:2222 +#: ../../library/turtle.rst:2208 msgid "" "*name* is an arbitrary string and *shape* is a tuple of pairs of " "coordinates: Install the corresponding polygon shape." msgstr "" -#: ../../library/turtle.rst:2225 +#: ../../library/turtle.rst:2211 msgid ">>> screen.register_shape(\"triangle\", ((5,-3), (0,5), (-5,-3)))" msgstr ">>> screen.register_shape(\"triangle\", ((5,-3), (0,5), (-5,-3)))" -#: ../../library/turtle.rst:2230 +#: ../../library/turtle.rst:2216 msgid "" "*name* is an arbitrary string and *shape* is a (compound) :class:`Shape` " "object: Install the corresponding compound shape." msgstr "" -#: ../../library/turtle.rst:2233 +#: ../../library/turtle.rst:2219 msgid "" "Add a turtle shape to TurtleScreen's shapelist. Only thusly registered " "shapes can be used by issuing the command ``shape(shapename)``." msgstr "" -#: ../../library/turtle.rst:2239 +#: ../../library/turtle.rst:2225 msgid "Return the list of turtles on the screen." msgstr "" -#: ../../library/turtle.rst:2241 +#: ../../library/turtle.rst:2227 msgid "" ">>> for turtle in screen.turtles():\n" "... turtle.color(\"red\")" @@ -3259,11 +3242,11 @@ msgstr "" ">>> for turtle in screen.turtles():\n" "... turtle.color(\"red\")" -#: ../../library/turtle.rst:2250 +#: ../../library/turtle.rst:2236 msgid "Return the height of the turtle window. ::" msgstr "" -#: ../../library/turtle.rst:2252 +#: ../../library/turtle.rst:2238 msgid "" ">>> screen.window_height()\n" "480" @@ -3271,11 +3254,11 @@ msgstr "" ">>> screen.window_height()\n" "480" -#: ../../library/turtle.rst:2258 +#: ../../library/turtle.rst:2244 msgid "Return the width of the turtle window. ::" msgstr "" -#: ../../library/turtle.rst:2260 +#: ../../library/turtle.rst:2246 msgid "" ">>> screen.window_width()\n" "640" @@ -3283,19 +3266,19 @@ msgstr "" ">>> screen.window_width()\n" "640" -#: ../../library/turtle.rst:2267 +#: ../../library/turtle.rst:2253 msgid "Methods specific to Screen, not inherited from TurtleScreen" msgstr "" -#: ../../library/turtle.rst:2271 +#: ../../library/turtle.rst:2257 msgid "Shut the turtlegraphics window." msgstr "" -#: ../../library/turtle.rst:2276 +#: ../../library/turtle.rst:2262 msgid "Bind ``bye()`` method to mouse clicks on the Screen." msgstr "" -#: ../../library/turtle.rst:2279 +#: ../../library/turtle.rst:2265 msgid "" "If the value \"using_IDLE\" in the configuration dictionary is ``False`` " "(default value), also enter mainloop. Remark: If IDLE with the ``-n`` " @@ -3304,38 +3287,38 @@ msgid "" "client script." msgstr "" -#: ../../library/turtle.rst:2288 +#: ../../library/turtle.rst:2274 msgid "" "Set the size and position of the main window. Default values of arguments " "are stored in the configuration dictionary and can be changed via a :file:" "`turtle.cfg` file." msgstr "" -#: ../../library/turtle.rst:2292 +#: ../../library/turtle.rst:2278 msgid "" "if an integer, a size in pixels, if a float, a fraction of the screen; " "default is 50% of screen" msgstr "" -#: ../../library/turtle.rst:2294 +#: ../../library/turtle.rst:2280 msgid "" "if an integer, the height in pixels, if a float, a fraction of the screen; " "default is 75% of screen" msgstr "" -#: ../../library/turtle.rst:2296 +#: ../../library/turtle.rst:2282 msgid "" "if positive, starting position in pixels from the left edge of the screen, " "if negative from the right edge, if ``None``, center window horizontally" msgstr "" -#: ../../library/turtle.rst:2299 +#: ../../library/turtle.rst:2285 msgid "" "if positive, starting position in pixels from the top edge of the screen, if " "negative from the bottom edge, if ``None``, center window vertically" msgstr "" -#: ../../library/turtle.rst:2303 +#: ../../library/turtle.rst:2289 msgid "" ">>> screen.setup (width=200, height=200, startx=0, starty=0)\n" ">>> # sets window to 200x200 pixels, in upper left of screen\n" @@ -3343,128 +3326,128 @@ msgid "" ">>> # sets window to 75% of screen by 50% of screen and centers" msgstr "" -#: ../../library/turtle.rst:2314 +#: ../../library/turtle.rst:2300 msgid "a string that is shown in the titlebar of the turtle graphics window" msgstr "" -#: ../../library/turtle.rst:2317 +#: ../../library/turtle.rst:2303 msgid "Set title of turtle window to *titlestring*." msgstr "" -#: ../../library/turtle.rst:2319 +#: ../../library/turtle.rst:2305 msgid ">>> screen.title(\"Welcome to the turtle zoo!\")" msgstr ">>> screen.title(\"Welcome to the turtle zoo!\")" -#: ../../library/turtle.rst:2326 +#: ../../library/turtle.rst:2312 msgid "Public classes" msgstr "" -#: ../../library/turtle.rst:2332 +#: ../../library/turtle.rst:2318 msgid "" "a :class:`!tkinter.Canvas`, a :class:`ScrolledCanvas` or a :class:" "`TurtleScreen`" msgstr "" -#: ../../library/turtle.rst:2335 +#: ../../library/turtle.rst:2321 msgid "" "Create a turtle. The turtle has all methods described above as \"methods of " "Turtle/RawTurtle\"." msgstr "" -#: ../../library/turtle.rst:2341 +#: ../../library/turtle.rst:2327 msgid "" "Subclass of RawTurtle, has the same interface but draws on a default :class:" "`Screen` object created automatically when needed for the first time." msgstr "" -#: ../../library/turtle.rst:2347 +#: ../../library/turtle.rst:2333 msgid "a :class:`!tkinter.Canvas`" msgstr "" -#: ../../library/turtle.rst:2349 +#: ../../library/turtle.rst:2335 msgid "" "Provides screen oriented methods like :func:`bgcolor` etc. that are " "described above." msgstr "" -#: ../../library/turtle.rst:2354 +#: ../../library/turtle.rst:2340 msgid "" "Subclass of TurtleScreen, with :ref:`four methods added `." msgstr "" -#: ../../library/turtle.rst:2359 +#: ../../library/turtle.rst:2345 msgid "" "some Tkinter widget to contain the ScrolledCanvas, i.e. a Tkinter-canvas " "with scrollbars added" msgstr "" -#: ../../library/turtle.rst:2362 +#: ../../library/turtle.rst:2348 msgid "" "Used by class Screen, which thus automatically provides a ScrolledCanvas as " "playground for the turtles." msgstr "" -#: ../../library/turtle.rst:2367 +#: ../../library/turtle.rst:2353 msgid "one of the strings \"polygon\", \"image\", \"compound\"" msgstr "" -#: ../../library/turtle.rst:2369 +#: ../../library/turtle.rst:2355 msgid "" "Data structure modeling shapes. The pair ``(type_, data)`` must follow this " "specification:" msgstr "" -#: ../../library/turtle.rst:2374 +#: ../../library/turtle.rst:2360 msgid "*type_*" msgstr "*type_*" -#: ../../library/turtle.rst:2374 +#: ../../library/turtle.rst:2360 msgid "*data*" msgstr "*data*" -#: ../../library/turtle.rst:2376 +#: ../../library/turtle.rst:2362 msgid "\"polygon\"" msgstr "\"polygon\"" -#: ../../library/turtle.rst:2376 +#: ../../library/turtle.rst:2362 msgid "a polygon-tuple, i.e. a tuple of pairs of coordinates" msgstr "" -#: ../../library/turtle.rst:2377 +#: ../../library/turtle.rst:2363 msgid "\"image\"" msgstr "\"image\"" -#: ../../library/turtle.rst:2377 +#: ../../library/turtle.rst:2363 msgid "an image (in this form only used internally!)" msgstr "" -#: ../../library/turtle.rst:2378 +#: ../../library/turtle.rst:2364 msgid "\"compound\"" msgstr "\"compound\"" -#: ../../library/turtle.rst:2378 +#: ../../library/turtle.rst:2364 msgid "" "``None`` (a compound shape has to be constructed using the :meth:" "`addcomponent` method)" msgstr "" -#: ../../library/turtle.rst:2384 +#: ../../library/turtle.rst:2370 msgid "a polygon, i.e. a tuple of pairs of numbers" msgstr "" -#: ../../library/turtle.rst:2385 +#: ../../library/turtle.rst:2371 msgid "a color the *poly* will be filled with" msgstr "" -#: ../../library/turtle.rst:2386 +#: ../../library/turtle.rst:2372 msgid "a color for the poly's outline (if given)" msgstr "" -#: ../../library/turtle.rst:2388 +#: ../../library/turtle.rst:2374 msgid "Example:" msgstr "例如:" -#: ../../library/turtle.rst:2390 +#: ../../library/turtle.rst:2376 msgid "" ">>> poly = ((0,0),(10,-5),(0,10),(-10,-5))\n" ">>> s = Shape(\"compound\")\n" @@ -3472,63 +3455,63 @@ msgid "" ">>> # ... add more components and then use register_shape()" msgstr "" -#: ../../library/turtle.rst:2398 +#: ../../library/turtle.rst:2384 msgid "See :ref:`compoundshapes`." msgstr "請見\\ :ref:`compoundshapes`。" -#: ../../library/turtle.rst:2403 +#: ../../library/turtle.rst:2389 msgid "" "A two-dimensional vector class, used as a helper class for implementing " "turtle graphics. May be useful for turtle graphics programs too. Derived " "from tuple, so a vector is a tuple!" msgstr "" -#: ../../library/turtle.rst:2407 +#: ../../library/turtle.rst:2393 msgid "Provides (for *a*, *b* vectors, *k* number):" msgstr "" -#: ../../library/turtle.rst:2409 +#: ../../library/turtle.rst:2395 msgid "``a + b`` vector addition" msgstr "``a + b`` 向量加法" -#: ../../library/turtle.rst:2410 +#: ../../library/turtle.rst:2396 msgid "``a - b`` vector subtraction" msgstr "``a - b`` 向量減法" -#: ../../library/turtle.rst:2411 +#: ../../library/turtle.rst:2397 msgid "``a * b`` inner product" msgstr "``a * b`` 內積" -#: ../../library/turtle.rst:2412 +#: ../../library/turtle.rst:2398 msgid "``k * a`` and ``a * k`` multiplication with scalar" msgstr "" -#: ../../library/turtle.rst:2413 +#: ../../library/turtle.rst:2399 msgid "``abs(a)`` absolute value of a" msgstr "``abs(a)`` a 的絕對值" -#: ../../library/turtle.rst:2414 +#: ../../library/turtle.rst:2400 msgid "``a.rotate(angle)`` rotation" msgstr "``a.rotate(angle)`` 旋轉" -#: ../../library/turtle.rst:2420 +#: ../../library/turtle.rst:2406 msgid "Explanation" msgstr "解釋" -#: ../../library/turtle.rst:2422 +#: ../../library/turtle.rst:2408 msgid "" "A turtle object draws on a screen object, and there a number of key classes " "in the turtle object-oriented interface that can be used to create them and " "relate them to each other." msgstr "" -#: ../../library/turtle.rst:2426 +#: ../../library/turtle.rst:2412 msgid "" "A :class:`Turtle` instance will automatically create a :class:`Screen` " "instance if one is not already present." msgstr "" -#: ../../library/turtle.rst:2429 +#: ../../library/turtle.rst:2415 msgid "" "``Turtle`` is a subclass of :class:`RawTurtle`, which *doesn't* " "automatically create a drawing surface - a *canvas* will need to be provided " @@ -3536,7 +3519,7 @@ msgid "" "`ScrolledCanvas` or :class:`TurtleScreen`." msgstr "" -#: ../../library/turtle.rst:2435 +#: ../../library/turtle.rst:2421 msgid "" ":class:`TurtleScreen` is the basic drawing surface for a turtle. :class:" "`Screen` is a subclass of ``TurtleScreen``, and includes :ref:`some " @@ -3545,7 +3528,7 @@ msgid "" "`!tkinter.Canvas` or a :class:`ScrolledCanvas` as an argument." msgstr "" -#: ../../library/turtle.rst:2442 +#: ../../library/turtle.rst:2428 msgid "" "The functional interface for turtle graphics uses the various methods of " "``Turtle`` and ``TurtleScreen``/``Screen``. Behind the scenes, a screen " @@ -3554,38 +3537,38 @@ msgid "" "created whenever any of the functions derived from a Turtle method is called." msgstr "" -#: ../../library/turtle.rst:2448 +#: ../../library/turtle.rst:2434 msgid "" "To use multiple turtles on a screen, the object-oriented interface must be " "used." msgstr "" -#: ../../library/turtle.rst:2453 +#: ../../library/turtle.rst:2439 msgid "Help and configuration" msgstr "" -#: ../../library/turtle.rst:2456 +#: ../../library/turtle.rst:2442 msgid "How to use help" msgstr "" -#: ../../library/turtle.rst:2458 +#: ../../library/turtle.rst:2444 msgid "" "The public methods of the Screen and Turtle classes are documented " "extensively via docstrings. So these can be used as online-help via the " "Python help facilities:" msgstr "" -#: ../../library/turtle.rst:2462 +#: ../../library/turtle.rst:2448 msgid "" "When using IDLE, tooltips show the signatures and first lines of the " "docstrings of typed in function-/method calls." msgstr "" -#: ../../library/turtle.rst:2465 +#: ../../library/turtle.rst:2451 msgid "Calling :func:`help` on methods or functions displays the docstrings::" msgstr "" -#: ../../library/turtle.rst:2467 +#: ../../library/turtle.rst:2453 msgid "" ">>> help(Screen.bgcolor)\n" "Help on method bgcolor in module turtle:\n" @@ -3645,13 +3628,13 @@ msgstr "" "\n" " >>> turtle.penup()" -#: ../../library/turtle.rst:2496 +#: ../../library/turtle.rst:2482 msgid "" "The docstrings of the functions which are derived from methods have a " "modified form::" msgstr "" -#: ../../library/turtle.rst:2499 +#: ../../library/turtle.rst:2485 msgid "" ">>> help(bgcolor)\n" "Help on function bgcolor in module turtle:\n" @@ -3715,28 +3698,28 @@ msgstr "" " Example:\n" " >>> penup()" -#: ../../library/turtle.rst:2530 +#: ../../library/turtle.rst:2516 msgid "" "These modified docstrings are created automatically together with the " "function definitions that are derived from the methods at import time." msgstr "" -#: ../../library/turtle.rst:2535 +#: ../../library/turtle.rst:2521 msgid "Translation of docstrings into different languages" msgstr "" -#: ../../library/turtle.rst:2537 +#: ../../library/turtle.rst:2523 msgid "" "There is a utility to create a dictionary the keys of which are the method " "names and the values of which are the docstrings of the public methods of " "the classes Screen and Turtle." msgstr "" -#: ../../library/turtle.rst:2543 +#: ../../library/turtle.rst:2529 msgid "a string, used as filename" msgstr "" -#: ../../library/turtle.rst:2545 +#: ../../library/turtle.rst:2531 msgid "" "Create and write docstring-dictionary to a Python script with the given " "filename. This function has to be called explicitly (it is not used by the " @@ -3745,37 +3728,37 @@ msgid "" "for translation of the docstrings into different languages." msgstr "" -#: ../../library/turtle.rst:2551 +#: ../../library/turtle.rst:2537 msgid "" "If you (or your students) want to use :mod:`turtle` with online help in your " "native language, you have to translate the docstrings and save the resulting " "file as e.g. :file:`turtle_docstringdict_german.py`." msgstr "" -#: ../../library/turtle.rst:2555 +#: ../../library/turtle.rst:2541 msgid "" "If you have an appropriate entry in your :file:`turtle.cfg` file this " "dictionary will be read in at import time and will replace the original " "English docstrings." msgstr "" -#: ../../library/turtle.rst:2558 +#: ../../library/turtle.rst:2544 msgid "" "At the time of this writing there are docstring dictionaries in German and " "in Italian. (Requests please to glingl@aon.at.)" msgstr "" -#: ../../library/turtle.rst:2564 +#: ../../library/turtle.rst:2550 msgid "How to configure Screen and Turtles" msgstr "" -#: ../../library/turtle.rst:2566 +#: ../../library/turtle.rst:2552 msgid "" "The built-in default configuration mimics the appearance and behaviour of " "the old turtle module in order to retain best possible compatibility with it." msgstr "" -#: ../../library/turtle.rst:2569 +#: ../../library/turtle.rst:2555 msgid "" "If you want to use a different configuration which better reflects the " "features of this module or which better fits to your needs, e.g. for use in " @@ -3784,12 +3767,12 @@ msgid "" "settings." msgstr "" -#: ../../library/turtle.rst:2574 +#: ../../library/turtle.rst:2560 msgid "" "The built in configuration would correspond to the following ``turtle.cfg``:" msgstr "" -#: ../../library/turtle.rst:2576 +#: ../../library/turtle.rst:2562 msgid "" "width = 0.5\n" "height = 0.75\n" @@ -3833,49 +3816,49 @@ msgstr "" "title = Python Turtle Graphics\n" "using_IDLE = False" -#: ../../library/turtle.rst:2599 +#: ../../library/turtle.rst:2585 msgid "Short explanation of selected entries:" msgstr "" -#: ../../library/turtle.rst:2601 +#: ../../library/turtle.rst:2587 msgid "" "The first four lines correspond to the arguments of the :func:`Screen.setup " "` method." msgstr "" -#: ../../library/turtle.rst:2603 +#: ../../library/turtle.rst:2589 msgid "" "Line 5 and 6 correspond to the arguments of the method :func:`Screen." "screensize `." msgstr "" -#: ../../library/turtle.rst:2605 +#: ../../library/turtle.rst:2591 msgid "" "*shape* can be any of the built-in shapes, e.g: arrow, turtle, etc. For " "more info try ``help(shape)``." msgstr "" -#: ../../library/turtle.rst:2607 +#: ../../library/turtle.rst:2593 msgid "" "If you want to use no fill color (i.e. make the turtle transparent), you " "have to write ``fillcolor = \"\"`` (but all nonempty strings must not have " "quotes in the cfg file)." msgstr "" -#: ../../library/turtle.rst:2610 +#: ../../library/turtle.rst:2596 msgid "" "If you want to reflect the turtle its state, you have to use ``resizemode = " "auto``." msgstr "" -#: ../../library/turtle.rst:2612 +#: ../../library/turtle.rst:2598 msgid "" "If you set e.g. ``language = italian`` the docstringdict :file:" "`turtle_docstringdict_italian.py` will be loaded at import time (if present " "on the import path, e.g. in the same directory as :mod:`turtle`)." msgstr "" -#: ../../library/turtle.rst:2615 +#: ../../library/turtle.rst:2601 msgid "" "The entries *exampleturtle* and *examplescreen* define the names of these " "objects as they occur in the docstrings. The transformation of method-" @@ -3883,309 +3866,309 @@ msgid "" "docstrings." msgstr "" -#: ../../library/turtle.rst:2619 +#: ../../library/turtle.rst:2605 msgid "" "*using_IDLE*: Set this to ``True`` if you regularly work with IDLE and its " "``-n`` switch (\"no subprocess\"). This will prevent :func:`exitonclick` to " "enter the mainloop." msgstr "" -#: ../../library/turtle.rst:2623 +#: ../../library/turtle.rst:2609 msgid "" "There can be a :file:`turtle.cfg` file in the directory where :mod:`turtle` " "is stored and an additional one in the current working directory. The " "latter will override the settings of the first one." msgstr "" -#: ../../library/turtle.rst:2627 +#: ../../library/turtle.rst:2613 msgid "" "The :file:`Lib/turtledemo` directory contains a :file:`turtle.cfg` file. " "You can study it as an example and see its effects when running the demos " "(preferably not from within the demo-viewer)." msgstr "" -#: ../../library/turtle.rst:2633 +#: ../../library/turtle.rst:2619 msgid ":mod:`turtledemo` --- Demo scripts" msgstr "" -#: ../../library/turtle.rst:2638 +#: ../../library/turtle.rst:2624 msgid "" "The :mod:`turtledemo` package includes a set of demo scripts. These scripts " "can be run and viewed using the supplied demo viewer as follows::" msgstr "" -#: ../../library/turtle.rst:2641 +#: ../../library/turtle.rst:2627 msgid "python -m turtledemo" msgstr "python -m turtledemo" -#: ../../library/turtle.rst:2643 +#: ../../library/turtle.rst:2629 msgid "" "Alternatively, you can run the demo scripts individually. For example, ::" msgstr "" -#: ../../library/turtle.rst:2645 +#: ../../library/turtle.rst:2631 msgid "python -m turtledemo.bytedesign" msgstr "python -m turtledemo.bytedesign" -#: ../../library/turtle.rst:2647 +#: ../../library/turtle.rst:2633 msgid "The :mod:`turtledemo` package directory contains:" msgstr "" -#: ../../library/turtle.rst:2649 +#: ../../library/turtle.rst:2635 msgid "" "A demo viewer :file:`__main__.py` which can be used to view the sourcecode " "of the scripts and run them at the same time." msgstr "" -#: ../../library/turtle.rst:2651 +#: ../../library/turtle.rst:2637 msgid "" "Multiple scripts demonstrating different features of the :mod:`turtle` " "module. Examples can be accessed via the Examples menu. They can also be " "run standalone." msgstr "" -#: ../../library/turtle.rst:2654 +#: ../../library/turtle.rst:2640 msgid "" "A :file:`turtle.cfg` file which serves as an example of how to write and use " "such files." msgstr "" -#: ../../library/turtle.rst:2657 +#: ../../library/turtle.rst:2643 msgid "The demo scripts are:" msgstr "" -#: ../../library/turtle.rst:2664 +#: ../../library/turtle.rst:2650 msgid "Name" msgstr "" -#: ../../library/turtle.rst:2664 +#: ../../library/turtle.rst:2650 msgid "Description" msgstr "描述" -#: ../../library/turtle.rst:2664 +#: ../../library/turtle.rst:2650 msgid "Features" msgstr "" -#: ../../library/turtle.rst:2666 +#: ../../library/turtle.rst:2652 msgid "bytedesign" msgstr "" -#: ../../library/turtle.rst:2666 +#: ../../library/turtle.rst:2652 msgid "complex classical turtle graphics pattern" msgstr "" -#: ../../library/turtle.rst:2666 +#: ../../library/turtle.rst:2652 msgid ":func:`tracer`, delay, :func:`update`" msgstr "" -#: ../../library/turtle.rst:2669 +#: ../../library/turtle.rst:2655 msgid "chaos" msgstr "" -#: ../../library/turtle.rst:2669 +#: ../../library/turtle.rst:2655 msgid "" "graphs Verhulst dynamics, shows that computer's computations can generate " "results sometimes against the common sense expectations" msgstr "" -#: ../../library/turtle.rst:2669 +#: ../../library/turtle.rst:2655 msgid "world coordinates" msgstr "" -#: ../../library/turtle.rst:2675 +#: ../../library/turtle.rst:2661 msgid "clock" msgstr "" -#: ../../library/turtle.rst:2675 +#: ../../library/turtle.rst:2661 msgid "analog clock showing time of your computer" msgstr "" -#: ../../library/turtle.rst:2675 +#: ../../library/turtle.rst:2661 msgid "turtles as clock's hands, ontimer" msgstr "" -#: ../../library/turtle.rst:2678 +#: ../../library/turtle.rst:2664 msgid "colormixer" msgstr "" -#: ../../library/turtle.rst:2678 +#: ../../library/turtle.rst:2664 msgid "experiment with r, g, b" msgstr "" -#: ../../library/turtle.rst:2680 +#: ../../library/turtle.rst:2666 msgid "forest" msgstr "" -#: ../../library/turtle.rst:2680 +#: ../../library/turtle.rst:2666 msgid "3 breadth-first trees" msgstr "" -#: ../../library/turtle.rst:2680 +#: ../../library/turtle.rst:2666 msgid "randomization" msgstr "" -#: ../../library/turtle.rst:2682 +#: ../../library/turtle.rst:2668 msgid "fractalcurves" msgstr "" -#: ../../library/turtle.rst:2682 +#: ../../library/turtle.rst:2668 msgid "Hilbert & Koch curves" msgstr "" -#: ../../library/turtle.rst:2682 +#: ../../library/turtle.rst:2668 msgid "recursion" msgstr "" -#: ../../library/turtle.rst:2684 +#: ../../library/turtle.rst:2670 msgid "lindenmayer" msgstr "" -#: ../../library/turtle.rst:2684 +#: ../../library/turtle.rst:2670 msgid "ethnomathematics (indian kolams)" msgstr "" -#: ../../library/turtle.rst:2684 +#: ../../library/turtle.rst:2670 msgid "L-System" msgstr "" -#: ../../library/turtle.rst:2687 +#: ../../library/turtle.rst:2673 msgid "minimal_hanoi" msgstr "minimal_hanoi" -#: ../../library/turtle.rst:2687 +#: ../../library/turtle.rst:2673 msgid "Towers of Hanoi" msgstr "" -#: ../../library/turtle.rst:2687 +#: ../../library/turtle.rst:2673 msgid "Rectangular Turtles as Hanoi discs (shape, shapesize)" msgstr "" -#: ../../library/turtle.rst:2691 +#: ../../library/turtle.rst:2677 msgid "nim" msgstr "" -#: ../../library/turtle.rst:2691 +#: ../../library/turtle.rst:2677 msgid "" "play the classical nim game with three heaps of sticks against the computer." msgstr "" -#: ../../library/turtle.rst:2691 +#: ../../library/turtle.rst:2677 msgid "turtles as nimsticks, event driven (mouse, keyboard)" msgstr "" -#: ../../library/turtle.rst:2695 +#: ../../library/turtle.rst:2681 msgid "paint" msgstr "" -#: ../../library/turtle.rst:2695 +#: ../../library/turtle.rst:2681 msgid "super minimalistic drawing program" msgstr "" -#: ../../library/turtle.rst:2698 +#: ../../library/turtle.rst:2684 msgid "peace" msgstr "" -#: ../../library/turtle.rst:2698 +#: ../../library/turtle.rst:2684 msgid "elementary" msgstr "" -#: ../../library/turtle.rst:2698 +#: ../../library/turtle.rst:2684 msgid "turtle: appearance and animation" msgstr "" -#: ../../library/turtle.rst:2701 +#: ../../library/turtle.rst:2687 msgid "penrose" msgstr "" -#: ../../library/turtle.rst:2701 +#: ../../library/turtle.rst:2687 msgid "aperiodic tiling with kites and darts" msgstr "" -#: ../../library/turtle.rst:2704 +#: ../../library/turtle.rst:2690 msgid "planet_and_moon" msgstr "planet_and_moon" -#: ../../library/turtle.rst:2704 +#: ../../library/turtle.rst:2690 msgid "simulation of gravitational system" msgstr "" -#: ../../library/turtle.rst:2704 +#: ../../library/turtle.rst:2690 msgid "compound shapes, :class:`Vec2D`" msgstr "" -#: ../../library/turtle.rst:2707 +#: ../../library/turtle.rst:2693 msgid "rosette" msgstr "" -#: ../../library/turtle.rst:2707 +#: ../../library/turtle.rst:2693 msgid "a pattern from the wikipedia article on turtle graphics" msgstr "" -#: ../../library/turtle.rst:2707 +#: ../../library/turtle.rst:2693 msgid ":func:`clone`, :func:`undo`" msgstr ":func:`clone`, :func:`undo`" -#: ../../library/turtle.rst:2710 +#: ../../library/turtle.rst:2696 msgid "round_dance" msgstr "round_dance" -#: ../../library/turtle.rst:2710 +#: ../../library/turtle.rst:2696 msgid "dancing turtles rotating pairwise in opposite direction" msgstr "" -#: ../../library/turtle.rst:2710 +#: ../../library/turtle.rst:2696 msgid "compound shapes, clone shapesize, tilt, get_shapepoly, update" msgstr "" -#: ../../library/turtle.rst:2714 +#: ../../library/turtle.rst:2700 msgid "sorting_animate" msgstr "sorting_animate" -#: ../../library/turtle.rst:2714 +#: ../../library/turtle.rst:2700 msgid "visual demonstration of different sorting methods" msgstr "" -#: ../../library/turtle.rst:2714 +#: ../../library/turtle.rst:2700 msgid "simple alignment, randomization" msgstr "" -#: ../../library/turtle.rst:2717 +#: ../../library/turtle.rst:2703 msgid "tree" msgstr "" -#: ../../library/turtle.rst:2717 +#: ../../library/turtle.rst:2703 msgid "a (graphical) breadth first tree (using generators)" msgstr "" -#: ../../library/turtle.rst:2720 +#: ../../library/turtle.rst:2706 msgid "two_canvases" msgstr "two_canvases" -#: ../../library/turtle.rst:2720 +#: ../../library/turtle.rst:2706 msgid "simple design" msgstr "" -#: ../../library/turtle.rst:2720 +#: ../../library/turtle.rst:2706 msgid "turtles on two canvases" msgstr "" -#: ../../library/turtle.rst:2723 +#: ../../library/turtle.rst:2709 msgid "yinyang" msgstr "" -#: ../../library/turtle.rst:2723 +#: ../../library/turtle.rst:2709 msgid "another elementary example" msgstr "" -#: ../../library/turtle.rst:2726 +#: ../../library/turtle.rst:2712 msgid "Have fun!" msgstr "" -#: ../../library/turtle.rst:2730 +#: ../../library/turtle.rst:2716 msgid "Changes since Python 2.6" msgstr "" -#: ../../library/turtle.rst:2732 +#: ../../library/turtle.rst:2718 msgid "" "The methods :func:`Turtle.tracer `, :func:`Turtle.window_width " "` and :func:`Turtle.window_height ` have been " @@ -4196,14 +4179,14 @@ msgid "" "methods.)" msgstr "" -#: ../../library/turtle.rst:2740 +#: ../../library/turtle.rst:2726 msgid "" "The method :func:`!Turtle.fill` has been eliminated. The behaviour of :func:" "`begin_fill` and :func:`end_fill` have changed slightly: now every filling " "process must be completed with an ``end_fill()`` call." msgstr "" -#: ../../library/turtle.rst:2745 +#: ../../library/turtle.rst:2731 msgid "" "A method :func:`Turtle.filling ` has been added. It returns a " "boolean value: ``True`` if a filling process is under way, ``False`` " @@ -4211,42 +4194,62 @@ msgid "" "in Python 2.6." msgstr "" -#: ../../library/turtle.rst:2751 +#: ../../library/turtle.rst:2737 msgid "Changes since Python 3.0" msgstr "" -#: ../../library/turtle.rst:2753 +#: ../../library/turtle.rst:2739 msgid "" "The :class:`Turtle` methods :func:`shearfactor`, :func:`shapetransform` and :" "func:`get_shapepoly` have been added. Thus the full range of regular linear " "transforms is now available for transforming turtle shapes. :func:" "`tiltangle` has been enhanced in functionality: it now can be used to get or " -"set the tilt angle. :func:`settiltangle` has been deprecated." +"set the tilt angle." msgstr "" -#: ../../library/turtle.rst:2760 +#: ../../library/turtle.rst:2745 msgid "" "The :class:`Screen` method :func:`onkeypress` has been added as a complement " "to :func:`onkey`. As the latter binds actions to the key release event, an " "alias: :func:`onkeyrelease` was also added for it." msgstr "" -#: ../../library/turtle.rst:2764 +#: ../../library/turtle.rst:2749 msgid "" "The method :func:`Screen.mainloop ` has been added, so there is no " "longer a need to use the standalone :func:`mainloop` function when working " "with :class:`Screen` and :class:`Turtle` objects." msgstr "" -#: ../../library/turtle.rst:2768 +#: ../../library/turtle.rst:2753 msgid "" "Two input methods have been added: :func:`Screen.textinput ` and :" "func:`Screen.numinput `. These pop up input dialogs and return " "strings and numbers respectively." msgstr "" -#: ../../library/turtle.rst:2772 +#: ../../library/turtle.rst:2757 msgid "" "Two example scripts :file:`tdemo_nim.py` and :file:`tdemo_round_dance.py` " "have been added to the :file:`Lib/turtledemo` directory." msgstr "" + +#~ msgid ":func:`settiltangle`" +#~ msgstr ":func:`settiltangle`" + +#~ msgid "" +#~ ">>> turtle.reset()\n" +#~ ">>> turtle.shape(\"circle\")\n" +#~ ">>> turtle.shapesize(5,2)\n" +#~ ">>> turtle.settiltangle(45)\n" +#~ ">>> turtle.fd(50)\n" +#~ ">>> turtle.settiltangle(-45)\n" +#~ ">>> turtle.fd(50)" +#~ msgstr "" +#~ ">>> turtle.reset()\n" +#~ ">>> turtle.shape(\"circle\")\n" +#~ ">>> turtle.shapesize(5,2)\n" +#~ ">>> turtle.settiltangle(45)\n" +#~ ">>> turtle.fd(50)\n" +#~ ">>> turtle.settiltangle(-45)\n" +#~ ">>> turtle.fd(50)" diff --git a/library/types.po b/library/types.po index 6e9918622d..cd7e8ca1ba 100644 --- a/library/types.po +++ b/library/types.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -141,7 +141,8 @@ msgstr "" msgid "" "For classes that have an ``__orig_bases__`` attribute, this function returns " "the value of ``cls.__orig_bases__``. For classes without the " -"``__orig_bases__`` attribute, ``cls.__bases__`` is returned." +"``__orig_bases__`` attribute, :attr:`cls.__bases__ ` is " +"returned." msgstr "" #: ../../library/types.rst:97 @@ -510,7 +511,7 @@ msgid "" "In addition, when a class is defined with a :attr:`~object.__slots__` " "attribute, then for each slot, an instance of :class:`!MemberDescriptorType` " "will be added as an attribute on the class. This allows the slot to appear " -"in the class's :attr:`~object.__dict__`." +"in the class's :attr:`~type.__dict__`." msgstr "" #: ../../library/types.rst:399 @@ -586,30 +587,45 @@ msgid "Return a hash of the underlying mapping." msgstr "" #: ../../library/types.rst:471 +msgid "The type of :ref:`capsule objects `." +msgstr "" + +#: ../../library/types.rst:477 msgid "Additional Utility Classes and Functions" msgstr "" -#: ../../library/types.rst:475 +#: ../../library/types.rst:481 msgid "" "A simple :class:`object` subclass that provides attribute access to its " "namespace, as well as a meaningful repr." msgstr "" -#: ../../library/types.rst:478 +#: ../../library/types.rst:484 +msgid "" +"Unlike :class:`object`, with :class:`!SimpleNamespace` you can add and " +"remove attributes." +msgstr "" + +#: ../../library/types.rst:487 msgid "" -"Unlike :class:`object`, with ``SimpleNamespace`` you can add and remove " -"attributes. If a ``SimpleNamespace`` object is initialized with keyword " -"arguments, those are directly added to the underlying namespace." +":py:class:`SimpleNamespace` objects may be initialized in the same way as :" +"class:`dict`: either with keyword arguments, with a single positional " +"argument, or with both. When initialized with keyword arguments, those are " +"directly added to the underlying namespace. Alternatively, when initialized " +"with a positional argument, the underlying namespace will be updated with " +"key-value pairs from that argument (either a mapping object or an :term:" +"`iterable` object producing key-value pairs). All such keys must be strings." msgstr "" -#: ../../library/types.rst:482 +#: ../../library/types.rst:498 msgid "The type is roughly equivalent to the following code::" msgstr "" -#: ../../library/types.rst:484 +#: ../../library/types.rst:500 msgid "" "class SimpleNamespace:\n" -" def __init__(self, /, **kwargs):\n" +" def __init__(self, mapping_or_iterable=(), /, **kwargs):\n" +" self.__dict__.update(mapping_or_iterable)\n" " self.__dict__.update(kwargs)\n" "\n" " def __repr__(self):\n" @@ -623,7 +639,8 @@ msgid "" " return NotImplemented" msgstr "" "class SimpleNamespace:\n" -" def __init__(self, /, **kwargs):\n" +" def __init__(self, mapping_or_iterable=(), /, **kwargs):\n" +" self.__dict__.update(mapping_or_iterable)\n" " self.__dict__.update(kwargs)\n" "\n" " def __repr__(self):\n" @@ -636,24 +653,33 @@ msgstr "" " return self.__dict__ == other.__dict__\n" " return NotImplemented" -#: ../../library/types.rst:497 +#: ../../library/types.rst:514 msgid "" "``SimpleNamespace`` may be useful as a replacement for ``class NS: pass``. " "However, for a structured record type use :func:`~collections.namedtuple` " "instead." msgstr "" -#: ../../library/types.rst:503 +#: ../../library/types.rst:518 +msgid "" +":class:`!SimpleNamespace` objects are supported by :func:`copy.replace`." +msgstr "" + +#: ../../library/types.rst:522 msgid "" "Attribute order in the repr changed from alphabetical to insertion (like " "``dict``)." msgstr "" -#: ../../library/types.rst:509 +#: ../../library/types.rst:526 +msgid "Added support for an optional positional argument." +msgstr "" + +#: ../../library/types.rst:531 msgid "Route attribute access on a class to __getattr__." msgstr "" -#: ../../library/types.rst:511 +#: ../../library/types.rst:533 msgid "" "This is a descriptor, used to define attributes that act differently when " "accessed through an instance and through a class. Instance access remains " @@ -661,18 +687,18 @@ msgid "" "class's __getattr__ method; this is done by raising AttributeError." msgstr "" -#: ../../library/types.rst:516 +#: ../../library/types.rst:538 msgid "" "This allows one to have properties active on an instance, and have virtual " "attributes on the class with the same name (see :class:`enum.Enum` for an " "example)." msgstr "" -#: ../../library/types.rst:523 +#: ../../library/types.rst:545 msgid "Coroutine Utility Functions" msgstr "" -#: ../../library/types.rst:527 +#: ../../library/types.rst:549 msgid "" "This function transforms a :term:`generator` function into a :term:" "`coroutine function` which returns a generator-based coroutine. The " @@ -682,11 +708,11 @@ msgid "" "method." msgstr "" -#: ../../library/types.rst:534 +#: ../../library/types.rst:556 msgid "If *gen_func* is a generator function, it will be modified in-place." msgstr "" -#: ../../library/types.rst:536 +#: ../../library/types.rst:558 msgid "" "If *gen_func* is not a generator function, it will be wrapped. If it returns " "an instance of :class:`collections.abc.Generator`, the instance will be " diff --git a/library/typing.po b/library/typing.po index 9f336ece63..f9b1cfb9a4 100644 --- a/library/typing.po +++ b/library/typing.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-30 09:19+0000\n" "PO-Revision-Date: 2024-07-11 11:12+0800\n" "Last-Translator: Li-Hung Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -387,8 +387,8 @@ msgstr "" "str]`` 象徵為一個函式,可以接受一個型別為 :class:`int` 的引數,並回傳一個 :" "class:`str`。" -#: ../../library/typing.rst:215 ../../library/typing.rst:2897 -#: ../../library/typing.rst:3043 +#: ../../library/typing.rst:215 ../../library/typing.rst:3128 +#: ../../library/typing.rst:3308 msgid "For example:" msgstr "舉例來說:" @@ -492,7 +492,7 @@ msgstr "" "``Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], " "ReturnType]`` 的形式。" -#: ../../library/typing.rst:285 ../../library/typing.rst:3522 +#: ../../library/typing.rst:285 ../../library/typing.rst:3798 msgid "" "``Callable`` now supports :class:`ParamSpec` and :data:`Concatenate`. See :" "pep:`612` for more details." @@ -772,11 +772,22 @@ msgstr "" #: ../../library/typing.rst:464 msgid "" -"If your generator will only yield values, set the ``SendType`` and " -"``ReturnType`` to ``None``::" +"The ``SendType`` and ``ReturnType`` parameters default to :const:`!None`::" msgstr "" -#: ../../library/typing.rst:467 +#: ../../library/typing.rst:466 +msgid "" +"def infinite_stream(start: int) -> Generator[int]:\n" +" while True:\n" +" yield start\n" +" start += 1" +msgstr "" + +#: ../../library/typing.rst:471 +msgid "It is also possible to set these types explicitly::" +msgstr "" + +#: ../../library/typing.rst:473 msgid "" "def infinite_stream(start: int) -> Generator[int, None, None]:\n" " while True:\n" @@ -784,13 +795,14 @@ msgid "" " start += 1" msgstr "" -#: ../../library/typing.rst:472 +#: ../../library/typing.rst:478 msgid "" -"Alternatively, annotate your generator as having a return type of either " -"``Iterable[YieldType]`` or ``Iterator[YieldType]``::" +"Simple generators that only ever yield values can also be annotated as " +"having a return type of either :class:`Iterable[YieldType] ` or :class:`Iterator[YieldType] `::" msgstr "" -#: ../../library/typing.rst:475 +#: ../../library/typing.rst:483 msgid "" "def infinite_stream(start: int) -> Iterator[int]:\n" " while True:\n" @@ -798,29 +810,35 @@ msgid "" " start += 1" msgstr "" -#: ../../library/typing.rst:480 +#: ../../library/typing.rst:488 msgid "" "Async generators are handled in a similar fashion, but don't expect a " "``ReturnType`` type argument (:class:`AsyncGenerator[YieldType, SendType] " -"`)::" +"`). The ``SendType`` argument defaults to :" +"const:`!None`, so the following definitions are equivalent::" msgstr "" -#: ../../library/typing.rst:484 +#: ../../library/typing.rst:494 msgid "" +"async def infinite_stream(start: int) -> AsyncGenerator[int]:\n" +" while True:\n" +" yield start\n" +" start = await increment(start)\n" +"\n" "async def infinite_stream(start: int) -> AsyncGenerator[int, None]:\n" " while True:\n" " yield start\n" " start = await increment(start)" msgstr "" -#: ../../library/typing.rst:489 +#: ../../library/typing.rst:504 msgid "" "As in the synchronous case, :class:`AsyncIterable[YieldType] ` and :class:`AsyncIterator[YieldType] ` are available as well::" msgstr "" -#: ../../library/typing.rst:494 +#: ../../library/typing.rst:509 msgid "" "async def infinite_stream(start: int) -> AsyncIterator[int]:\n" " while True:\n" @@ -828,14 +846,14 @@ msgid "" " start = await increment(start)" msgstr "" -#: ../../library/typing.rst:499 +#: ../../library/typing.rst:514 msgid "" "Coroutines can be annotated using :class:`Coroutine[YieldType, SendType, " "ReturnType] `. Generic arguments correspond to " "those of :class:`~collections.abc.Generator`, for example::" msgstr "" -#: ../../library/typing.rst:504 +#: ../../library/typing.rst:519 msgid "" "from collections.abc import Coroutine\n" "c: Coroutine[list[str], str, int] # Some coroutine defined elsewhere\n" @@ -844,15 +862,15 @@ msgid "" " y = await c # Inferred type of 'y' is int" msgstr "" -#: ../../library/typing.rst:513 +#: ../../library/typing.rst:528 msgid "User-defined generic types" msgstr "使用者定義泛型型別" -#: ../../library/typing.rst:515 +#: ../../library/typing.rst:530 msgid "A user-defined class can be defined as a generic class." msgstr "一個使用者定義的類別可以被定義成一個泛型類別。" -#: ../../library/typing.rst:519 +#: ../../library/typing.rst:534 msgid "" "from logging import Logger\n" "\n" @@ -874,7 +892,7 @@ msgid "" " self.logger.info('%s: %s', self.name, message)" msgstr "" -#: ../../library/typing.rst:538 +#: ../../library/typing.rst:553 msgid "" "This syntax indicates that the class ``LoggedVar`` is parameterised around a " "single :ref:`type variable ` ``T`` . This also makes ``T`` valid as " @@ -883,7 +901,7 @@ msgstr "" "這個語法指出類別 ``LoggedVar`` 透過一個單一的 :ref:`型別變數 ` " "``T`` 進行參數化 (parameterised)。這使得 ``T`` 在類別中有效的成為型別。" -#: ../../library/typing.rst:542 +#: ../../library/typing.rst:557 msgid "" "Generic classes implicitly inherit from :class:`Generic`. For compatibility " "with Python 3.11 and lower, it is also possible to inherit explicitly from :" @@ -892,7 +910,7 @@ msgstr "" "泛型類別隱性繼承了 :class:`Generic`。為了相容 Python 3.11 及更早版本,也可以" "明確的繼承 :class:`Generic` 並指出是一個泛型類別: ::" -#: ../../library/typing.rst:546 +#: ../../library/typing.rst:561 msgid "" "from typing import TypeVar, Generic\n" "\n" @@ -902,7 +920,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:553 +#: ../../library/typing.rst:568 msgid "" "Generic classes have :meth:`~object.__class_getitem__` methods, meaning they " "can be parameterised at runtime (e.g. ``LoggedVar[int]`` below)::" @@ -910,7 +928,7 @@ msgstr "" "泛型類別有 :meth:`~object.__class_getitem__` 方法,其意味著可以在 runtime 進" "行參數化(如下述的 ``LoggedVar[int]``): ::" -#: ../../library/typing.rst:556 +#: ../../library/typing.rst:571 msgid "" "from collections.abc import Iterable\n" "\n" @@ -919,7 +937,7 @@ msgid "" " var.set(0)" msgstr "" -#: ../../library/typing.rst:562 +#: ../../library/typing.rst:577 msgid "" "A generic type can have any number of type variables. All varieties of :" "class:`TypeVar` are permissible as parameters for a generic type::" @@ -927,7 +945,7 @@ msgstr "" "一個泛型型別可以有任意數量的型別變數。所有種類的 :class:`TypeVar` 都可以作為" "泛型型別的參數: ::" -#: ../../library/typing.rst:565 +#: ../../library/typing.rst:580 msgid "" "from typing import TypeVar, Generic, Sequence\n" "\n" @@ -942,13 +960,13 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:577 +#: ../../library/typing.rst:592 msgid "" "Each type variable argument to :class:`Generic` must be distinct. This is " "thus invalid::" msgstr ":class:`Generic` 的每個型別變數引數必不相同。因此以下是無效的: ::" -#: ../../library/typing.rst:580 +#: ../../library/typing.rst:595 msgid "" "from typing import TypeVar, Generic\n" "...\n" @@ -962,11 +980,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:591 +#: ../../library/typing.rst:606 msgid "Generic classes can also inherit from other classes::" msgstr "泛型類別亦可以繼承其他類別: ::" -#: ../../library/typing.rst:593 +#: ../../library/typing.rst:608 msgid "" "from collections.abc import Sized\n" "\n" @@ -974,12 +992,12 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:598 +#: ../../library/typing.rst:613 msgid "" "When inheriting from generic classes, some type parameters could be fixed::" msgstr "當繼承泛型類別時,部份的型別參數可固定: ::" -#: ../../library/typing.rst:600 +#: ../../library/typing.rst:615 msgid "" "from collections.abc import Mapping\n" "\n" @@ -987,11 +1005,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:605 +#: ../../library/typing.rst:620 msgid "In this case ``MyDict`` has a single parameter, ``T``." msgstr "在這種情況下 ``MyDict`` 有一個單一的參數 ``T``。" -#: ../../library/typing.rst:607 +#: ../../library/typing.rst:622 msgid "" "Using a generic class without specifying type parameters assumes :data:`Any` " "for each position. In the following example, ``MyIterable`` is not generic " @@ -1000,7 +1018,7 @@ msgstr "" "若使用泛型類別卻沒有特指型別參數,則會將每個位置視為 :data:`Any`。在下列的範" "例中 ``MyIterable`` 不是泛型,但隱性繼承了 ``Iterable[Any]``: ::" -#: ../../library/typing.rst:611 +#: ../../library/typing.rst:626 msgid "" "from collections.abc import Iterable\n" "\n" @@ -1008,11 +1026,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:618 +#: ../../library/typing.rst:633 msgid "User-defined generic type aliases are also supported. Examples::" msgstr "使用者定義的泛型型別別名也有支援。例如: ::" -#: ../../library/typing.rst:620 +#: ../../library/typing.rst:635 msgid "" "from collections.abc import Iterable\n" "\n" @@ -1029,13 +1047,13 @@ msgid "" " return sum(x*y for x, y in v)" msgstr "" -#: ../../library/typing.rst:633 +#: ../../library/typing.rst:648 msgid "" "For backward compatibility, generic type aliases can also be created through " "a simple assignment::" msgstr "為了向後相容性,泛型型別別名可以透過簡單的賦值來建立: ::" -#: ../../library/typing.rst:636 +#: ../../library/typing.rst:651 msgid "" "from collections.abc import Iterable\n" "from typing import TypeVar\n" @@ -1044,11 +1062,11 @@ msgid "" "Response = Iterable[S] | int" msgstr "" -#: ../../library/typing.rst:642 +#: ../../library/typing.rst:657 msgid ":class:`Generic` no longer has a custom metaclass." msgstr ":class:`Generic` 不再是一個自訂的 metaclass。" -#: ../../library/typing.rst:645 +#: ../../library/typing.rst:660 msgid "" "Syntactic support for generics and type aliases is new in version 3.12. " "Previously, generic classes had to explicitly inherit from :class:`Generic` " @@ -1057,7 +1075,7 @@ msgstr "" "在版本 3.12 新增了泛型及型別別名的語法支援。在之前的版本中,泛型類別必須顯性" "繼承 :class:`Generic` 或是包含一個型別變數在基底類別 (base) 當中。" -#: ../../library/typing.rst:650 +#: ../../library/typing.rst:665 msgid "" "User-defined generics for parameter expressions are also supported via " "parameter specification variables in the form ``[**P]``. The behavior is " @@ -1071,7 +1089,7 @@ msgstr "" "別模組視為一個特定的型別變數。對此,其中一個例外是一個型別列表可以替代 :" "class:`ParamSpec`: ::" -#: ../../library/typing.rst:656 +#: ../../library/typing.rst:671 msgid "" ">>> class Z[T, **P]: ... # T is a TypeVar; P is a ParamSpec\n" "...\n" @@ -1079,7 +1097,7 @@ msgid "" "__main__.Z[int, [dict, float]]" msgstr "" -#: ../../library/typing.rst:661 +#: ../../library/typing.rst:676 msgid "" "Classes generic over a :class:`ParamSpec` can also be created using explicit " "inheritance from :class:`Generic`. In this case, ``**`` is not used::" @@ -1087,7 +1105,7 @@ msgstr "" "具有 :class:`ParamSpec` 的泛型類別可以透過顯性繼承 :class:`Generic` 進行建" "立。在這種情況下,不需要使用 ``**``: ::" -#: ../../library/typing.rst:664 +#: ../../library/typing.rst:679 msgid "" "from typing import ParamSpec, Generic\n" "\n" @@ -1097,7 +1115,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:671 +#: ../../library/typing.rst:686 msgid "" "Another difference between :class:`TypeVar` and :class:`ParamSpec` is that a " "generic with only one parameter specification variable will accept parameter " @@ -1110,7 +1128,7 @@ msgstr "" "``X[Type1, Type2, ...]`` 的參數列表。在內部中,後者會被轉換為前者,所以在下方" "的範例中為相等的: ::" -#: ../../library/typing.rst:677 +#: ../../library/typing.rst:692 msgid "" ">>> class X[**P]: ...\n" "...\n" @@ -1120,7 +1138,7 @@ msgid "" "__main__.X[[int, str]]" msgstr "" -#: ../../library/typing.rst:684 +#: ../../library/typing.rst:699 msgid "" "Note that generics with :class:`ParamSpec` may not have correct " "``__parameters__`` after substitution in some cases because they are " @@ -1129,7 +1147,7 @@ msgstr "" "請記得,具有 :class:`ParamSpec` 的泛型在某些情況下替換之後可能不會有正確的 " "``__parameters__``,因為參數規格主要還是用於靜態型別檢查。" -#: ../../library/typing.rst:688 +#: ../../library/typing.rst:703 msgid "" ":class:`Generic` can now be parameterized over parameter expressions. See :" "class:`ParamSpec` and :pep:`612` for more details." @@ -1137,7 +1155,7 @@ msgstr "" ":class:`Generic` 現在可以透過參數運算式來進行參數化。詳細內容請見 :class:" "`ParamSpec` 以及 :pep:`612`。" -#: ../../library/typing.rst:692 +#: ../../library/typing.rst:707 msgid "" "A user-defined generic class can have ABCs as base classes without a " "metaclass conflict. Generic metaclasses are not supported. The outcome of " @@ -1148,11 +1166,11 @@ msgstr "" "突。泛型的 metaclass 則不支援。參數化泛型的輸出將被存為快取,而在型別模組中多" "數的型別皆為 :term:`hashable` 且可以比較相等性。" -#: ../../library/typing.rst:699 +#: ../../library/typing.rst:714 msgid "The :data:`Any` type" msgstr ":data:`Any` 型別" -#: ../../library/typing.rst:701 +#: ../../library/typing.rst:716 msgid "" "A special kind of type is :data:`Any`. A static type checker will treat " "every type as being compatible with :data:`Any` and :data:`Any` as being " @@ -1161,7 +1179,7 @@ msgstr "" ":data:`Any` 是一種特別的型別。一個靜態型別檢查器會將每個型別視為可相容於 :" "data:`Any` 且 :data:`Any` 也可以相容於每個型別。" -#: ../../library/typing.rst:705 +#: ../../library/typing.rst:720 msgid "" "This means that it is possible to perform any operation or method call on a " "value of type :data:`Any` and assign it to any variable::" @@ -1169,7 +1187,7 @@ msgstr "" "這意味著如果在一個為 :data:`Any` 的值上執行任何操作或呼叫方法是可行的,且可以" "賦值給任意變數: ::" -#: ../../library/typing.rst:708 +#: ../../library/typing.rst:723 msgid "" "from typing import Any\n" "\n" @@ -1187,7 +1205,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:723 +#: ../../library/typing.rst:738 msgid "" "Notice that no type checking is performed when assigning a value of type :" "data:`Any` to a more precise type. For example, the static type checker did " @@ -1199,13 +1217,13 @@ msgstr "" "舉例來說,靜態型別檢查器不會在 runtime 中,將 ``a`` 賦值給 ``s`` 的情況下回報" "錯誤,儘管 ``s`` 是被宣告為型別 :class:`str` 卻接收到 :class:`int` 的值!" -#: ../../library/typing.rst:729 +#: ../../library/typing.rst:744 msgid "" "Furthermore, all functions without a return type or parameter types will " "implicitly default to using :data:`Any`::" msgstr "另外,所有缺少回傳型別或參數型別的函式將會隱性預設為 :data:`Any`: ::" -#: ../../library/typing.rst:732 +#: ../../library/typing.rst:747 msgid "" "def legacy_parser(text):\n" " ...\n" @@ -1218,7 +1236,7 @@ msgid "" " return data" msgstr "" -#: ../../library/typing.rst:742 +#: ../../library/typing.rst:757 msgid "" "This behavior allows :data:`Any` to be used as an *escape hatch* when you " "need to mix dynamically and statically typed code." @@ -1226,7 +1244,7 @@ msgstr "" "當你需要混和動態及靜態的型別程式碼,這個行為允許 :data:`Any` 被當作一個\\ *緊" "急出口 (escape hatch)*\\使用。" -#: ../../library/typing.rst:745 +#: ../../library/typing.rst:760 msgid "" "Contrast the behavior of :data:`Any` with the behavior of :class:`object`. " "Similar to :data:`Any`, every type is a subtype of :class:`object`. However, " @@ -1237,7 +1255,7 @@ msgstr "" "別會作為 :class:`object` 的子型別。然而,不像 :data:`Any`,反之不亦然::" "class:`object` 並\\ *不是*\\一個其他型別的子型別。" -#: ../../library/typing.rst:750 +#: ../../library/typing.rst:765 msgid "" "That means when the type of a value is :class:`object`, a type checker will " "reject almost all operations on it, and assigning it to a variable (or using " @@ -1248,7 +1266,7 @@ msgstr "" "並將賦予這個值到一個特定型別變數(或是當作回傳值使用)視為一個型別錯誤。舉例" "來說: ::" -#: ../../library/typing.rst:754 +#: ../../library/typing.rst:769 msgid "" "def hash_a(item: object) -> int:\n" " # Fails type checking; an object does not have a 'magic' method.\n" @@ -1269,7 +1287,7 @@ msgid "" "hash_b(\"foo\")" msgstr "" -#: ../../library/typing.rst:772 +#: ../../library/typing.rst:787 msgid "" "Use :class:`object` to indicate that a value could be any type in a typesafe " "manner. Use :data:`Any` to indicate that a value is dynamically typed." @@ -1277,11 +1295,11 @@ msgstr "" "使用 :class:`object` ,將指出在型別安全 (typesafe) 的習慣之下一個值可以為任意" "型別。使用 :data:`Any`,將指出這個值是個動態型別。" -#: ../../library/typing.rst:777 +#: ../../library/typing.rst:792 msgid "Nominal vs structural subtyping" msgstr "標稱 (nominal) 子型別 vs 結構子型別" -#: ../../library/typing.rst:779 +#: ../../library/typing.rst:794 msgid "" "Initially :pep:`484` defined the Python static type system as using *nominal " "subtyping*. This means that a class ``A`` is allowed where a class ``B`` is " @@ -1290,7 +1308,7 @@ msgstr "" "最初 :pep:`484` 定義 Python 靜態型別系統使用\\ *標稱子型別*。這意味著只有 " "``A`` 為 ``B`` 的子類別時,``A`` 才被允許使用在預期是類別 ``B`` 出現的地方。" -#: ../../library/typing.rst:783 +#: ../../library/typing.rst:798 msgid "" "This requirement previously also applied to abstract base classes, such as :" "class:`~collections.abc.Iterable`. The problem with this approach is that a " @@ -1303,7 +1321,7 @@ msgstr "" "格,也不像一個常見的慣用動態型別 Python 程式碼。舉例來說,下列程式碼符合 :" "pep:`484`: ::" -#: ../../library/typing.rst:789 +#: ../../library/typing.rst:804 msgid "" "from collections.abc import Sized, Iterable, Iterator\n" "\n" @@ -1313,7 +1331,7 @@ msgid "" " def __iter__(self) -> Iterator[int]: ..." msgstr "" -#: ../../library/typing.rst:796 +#: ../../library/typing.rst:811 msgid "" ":pep:`544` allows to solve this problem by allowing users to write the above " "code without explicit base classes in the class definition, allowing " @@ -1326,7 +1344,7 @@ msgstr "" "``Iterable[int]`` 兩者的子型別。這就是眾所周知的\\ *結構子型別*\\ (或是靜態" "鴨子型別): ::" -#: ../../library/typing.rst:802 +#: ../../library/typing.rst:817 msgid "" "from collections.abc import Iterator, Iterable\n" "\n" @@ -1339,7 +1357,7 @@ msgid "" "result = collect(Bucket()) # Passes type check" msgstr "" -#: ../../library/typing.rst:812 +#: ../../library/typing.rst:827 msgid "" "Moreover, by subclassing a special class :class:`Protocol`, a user can " "define new custom protocols to fully enjoy structural subtyping (see " @@ -1348,43 +1366,43 @@ msgstr "" "而且,基於一個特別的型別 :class:`Protocol` 建立子型別時,使用者可以定義新的" "協定並充份發揮結構子型別的優勢(請見下方範例)。" -#: ../../library/typing.rst:817 +#: ../../library/typing.rst:832 msgid "Module contents" msgstr "模組內容" -#: ../../library/typing.rst:819 +#: ../../library/typing.rst:834 msgid "" "The ``typing`` module defines the following classes, functions and " "decorators." msgstr "模組 ``typing`` 定義了下列的類別、函式以及裝飾器。" -#: ../../library/typing.rst:822 +#: ../../library/typing.rst:837 msgid "Special typing primitives" msgstr "特別型別原語 (primitive)" -#: ../../library/typing.rst:825 +#: ../../library/typing.rst:840 msgid "Special types" msgstr "特別型別" -#: ../../library/typing.rst:827 +#: ../../library/typing.rst:842 msgid "" "These can be used as types in annotations. They do not support subscription " "using ``[]``." msgstr "這些可以在註釋中做為型別。他們並不支援 ``[]`` 的下標使用。" -#: ../../library/typing.rst:832 +#: ../../library/typing.rst:847 msgid "Special type indicating an unconstrained type." msgstr "特別型別,指出一個不受約束 (unconstrained) 的型別。" -#: ../../library/typing.rst:834 +#: ../../library/typing.rst:849 msgid "Every type is compatible with :data:`Any`." msgstr "所有型別皆與 :data:`Any` 相容。" -#: ../../library/typing.rst:835 +#: ../../library/typing.rst:850 msgid ":data:`Any` is compatible with every type." msgstr ":data:`Any` 相容於所有型別。" -#: ../../library/typing.rst:837 +#: ../../library/typing.rst:852 msgid "" ":data:`Any` can now be used as a base class. This can be useful for avoiding " "type checker errors with classes that can duck type anywhere or are highly " @@ -1393,19 +1411,19 @@ msgstr "" ":data:`Any` 可以作為一個基礎類別。這對於在任何地方使用鴨子型別或是高度動態的" "型別,避免型別檢查器的錯誤是非常有用的。" -#: ../../library/typing.rst:844 +#: ../../library/typing.rst:859 msgid "A :ref:`constrained type variable `." msgstr "一個\\ :ref:`不受約束的型別變數 `。" -#: ../../library/typing.rst:846 +#: ../../library/typing.rst:861 msgid "Definition::" msgstr "定義: ::" -#: ../../library/typing.rst:848 +#: ../../library/typing.rst:863 msgid "AnyStr = TypeVar('AnyStr', str, bytes)" msgstr "" -#: ../../library/typing.rst:850 +#: ../../library/typing.rst:865 msgid "" "``AnyStr`` is meant to be used for functions that may accept :class:`str` " "or :class:`bytes` arguments but cannot allow the two to mix." @@ -1413,14 +1431,15 @@ msgstr "" "``AnyStr`` 是對於函式有用的,他可以接受 :class:`str` 或 :class:`bytes` 引數但" "不可以將此兩種混合。" -#: ../../library/typing.rst:853 ../../library/typing.rst:961 -#: ../../library/typing.rst:1018 ../../library/typing.rst:1184 -#: ../../library/typing.rst:1241 ../../library/typing.rst:1450 -#: ../../library/typing.rst:2837 +#: ../../library/typing.rst:868 ../../library/typing.rst:986 +#: ../../library/typing.rst:1043 ../../library/typing.rst:1209 +#: ../../library/typing.rst:1270 ../../library/typing.rst:1312 +#: ../../library/typing.rst:1527 ../../library/typing.rst:1588 +#: ../../library/typing.rst:3065 ../../library/typing.rst:3293 msgid "For example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:855 +#: ../../library/typing.rst:870 msgid "" "def concat(a: AnyStr, b: AnyStr) -> AnyStr:\n" " return a + b\n" @@ -1430,7 +1449,7 @@ msgid "" "concat(\"foo\", b\"bar\") # Error, cannot mix str and bytes" msgstr "" -#: ../../library/typing.rst:862 +#: ../../library/typing.rst:877 msgid "" "Note that, despite its name, ``AnyStr`` has nothing to do with the :class:" "`Any` type, nor does it mean \"any string\". In particular, ``AnyStr`` and " @@ -1440,7 +1459,7 @@ msgstr "" "何字串」的意思。尤其,``AnyStr`` 與 ``str | bytes`` 兩者不同且具有不同的使用" "情境: ::" -#: ../../library/typing.rst:867 +#: ../../library/typing.rst:882 msgid "" "# Invalid use of AnyStr:\n" "# The type variable is used only once in the function signature,\n" @@ -1453,11 +1472,26 @@ msgid "" " return \"hi there!\" if cond else b\"greetings!\"" msgstr "" -#: ../../library/typing.rst:879 +#: ../../library/typing.rst:892 +msgid "" +"Deprecated in favor of the new :ref:`type parameter syntax `. " +"Use ``class A[T: (str, bytes)]: ...`` instead of importing ``AnyStr``. See :" +"pep:`695` for more details." +msgstr "" + +#: ../../library/typing.rst:897 +msgid "" +"In Python 3.16, ``AnyStr`` will be removed from ``typing.__all__``, and " +"deprecation warnings will be emitted at runtime when it is accessed or " +"imported from ``typing``. ``AnyStr`` will be removed from ``typing`` in " +"Python 3.18." +msgstr "" + +#: ../../library/typing.rst:904 msgid "Special type that includes only literal strings." msgstr "特別型別,只包含文本字串。" -#: ../../library/typing.rst:881 +#: ../../library/typing.rst:906 msgid "" "Any string literal is compatible with ``LiteralString``, as is another " "``LiteralString``. However, an object typed as just ``str`` is not. A string " @@ -1468,11 +1502,11 @@ msgstr "" "此。然而,若是一個型別僅為 ``str`` 的物件則不相容。一個字串若是透過組合多個 " "``LiteralString`` 型別的物件建立,則此字串也可以視為 ``LiteralString``。" -#: ../../library/typing.rst:887 ../../library/typing.rst:1965 +#: ../../library/typing.rst:912 ../../library/typing.rst:2159 msgid "Example:" msgstr "舉例來說: ::" -#: ../../library/typing.rst:889 +#: ../../library/typing.rst:914 msgid "" "def run_query(sql: LiteralString) -> None:\n" " ...\n" @@ -1487,7 +1521,7 @@ msgid "" " )" msgstr "" -#: ../../library/typing.rst:903 +#: ../../library/typing.rst:928 msgid "" "``LiteralString`` is useful for sensitive APIs where arbitrary user-" "generated strings could generate problems. For example, the two cases above " @@ -1498,11 +1532,11 @@ msgstr "" "會產生問題。舉例來說,上面兩個案例中產生的型別檢查器錯誤是脆弱的且容易受到 " "SQL 注入攻擊。" -#: ../../library/typing.rst:908 +#: ../../library/typing.rst:933 msgid "See :pep:`675` for more details." msgstr "更多細節請見 :pep:`675`。" -#: ../../library/typing.rst:915 +#: ../../library/typing.rst:940 msgid "" ":data:`!Never` and :data:`!NoReturn` represent the `bottom type `_, a type that has no members." @@ -1510,13 +1544,13 @@ msgstr "" ":data:`!Never` 和 :data:`!NoReturn` 表示\\ `底部型別 (bottom type) `_,為一個沒有任何成員的型別。" -#: ../../library/typing.rst:919 +#: ../../library/typing.rst:944 msgid "" "They can be used to indicate that a function never returns, such as :func:" "`sys.exit`::" msgstr "它們可以被用來代表一個不會回傳的函式,像是 :func:`sys.exit`: ::" -#: ../../library/typing.rst:922 +#: ../../library/typing.rst:947 msgid "" "from typing import Never # or NoReturn\n" "\n" @@ -1524,7 +1558,7 @@ msgid "" " raise RuntimeError('no way')" msgstr "" -#: ../../library/typing.rst:927 +#: ../../library/typing.rst:952 msgid "" "Or to define a function that should never be called, as there are no valid " "arguments, such as :func:`assert_never`::" @@ -1532,7 +1566,7 @@ msgstr "" "或被用來定義一個不應被呼叫的函式,因為不會有有效的引數,、像是 :func:" "`assert_never`: ::" -#: ../../library/typing.rst:931 +#: ../../library/typing.rst:956 msgid "" "from typing import Never # or NoReturn\n" "\n" @@ -1550,7 +1584,7 @@ msgid "" " never_call_me(arg) # OK, arg is of type Never (or NoReturn)" msgstr "" -#: ../../library/typing.rst:946 +#: ../../library/typing.rst:971 msgid "" ":data:`!Never` and :data:`!NoReturn` have the same meaning in the type " "system and static type checkers treat both equivalently." @@ -1558,19 +1592,19 @@ msgstr "" ":data:`!Never` 以及 :data:`!NoReturn` 在型別系統中具有相同的意義且靜態型別檢" "查器會將兩者視為相等。" -#: ../../library/typing.rst:951 +#: ../../library/typing.rst:976 msgid "Added :data:`NoReturn`." msgstr "新增 :data:`NoReturn`。" -#: ../../library/typing.rst:955 +#: ../../library/typing.rst:980 msgid "Added :data:`Never`." msgstr "新增 :data:`Never`。" -#: ../../library/typing.rst:959 +#: ../../library/typing.rst:984 msgid "Special type to represent the current enclosed class." msgstr "特別型別,用來表示當前類別之內 (enclosed class)。" -#: ../../library/typing.rst:963 +#: ../../library/typing.rst:988 msgid "" "from typing import Self, reveal_type\n" "\n" @@ -1586,13 +1620,13 @@ msgid "" "\"SubclassOfFoo\"" msgstr "" -#: ../../library/typing.rst:975 +#: ../../library/typing.rst:1000 msgid "" "This annotation is semantically equivalent to the following, albeit in a " "more succinct fashion::" msgstr "這個註釋在語意上相等於下列內容,且形式更為簡潔: ::" -#: ../../library/typing.rst:978 +#: ../../library/typing.rst:1003 msgid "" "from typing import TypeVar\n" "\n" @@ -1612,7 +1646,7 @@ msgstr "" " ...\n" " return self" -#: ../../library/typing.rst:987 +#: ../../library/typing.rst:1012 msgid "" "In general, if something returns ``self``, as in the above examples, you " "should use ``Self`` as the return annotation. If ``Foo.return_self`` was " @@ -1625,11 +1659,11 @@ msgstr "" "器應該推論這個從 ``SubclassOfFoo.return_self`` 回傳的物件為 ``Foo`` 型別,而" "並非回傳 ``SubclassOfFoo`` 型別。" -#: ../../library/typing.rst:993 +#: ../../library/typing.rst:1018 msgid "Other common use cases include:" msgstr "其他常見的使用案例包含: ::" -#: ../../library/typing.rst:995 +#: ../../library/typing.rst:1020 msgid "" ":class:`classmethod`\\s that are used as alternative constructors and return " "instances of the ``cls`` parameter." @@ -1637,11 +1671,11 @@ msgstr "" ":class:`classmethod` 被用來作為替代的建構函式 (constructor) 並回傳 ``cls`` 參" "數的實例。" -#: ../../library/typing.rst:997 +#: ../../library/typing.rst:1022 msgid "Annotating an :meth:`~object.__enter__` method which returns self." msgstr "註釋一個回傳自己的 :meth:`~object.__enter__` 方法。" -#: ../../library/typing.rst:999 +#: ../../library/typing.rst:1024 msgid "" "You should not use ``Self`` as the return annotation if the method is not " "guaranteed to return an instance of a subclass when the class is subclassed::" @@ -1649,7 +1683,7 @@ msgstr "" "當類別被子類別化時,若方法不保證回傳一個子類別的實例,你不應該使用 ``Self`` " "作為回傳註釋: ::" -#: ../../library/typing.rst:1003 +#: ../../library/typing.rst:1028 msgid "" "class Eggs:\n" " # Self would be an incorrect return annotation here,\n" @@ -1659,17 +1693,17 @@ msgid "" " return Eggs()" msgstr "" -#: ../../library/typing.rst:1010 +#: ../../library/typing.rst:1035 msgid "See :pep:`673` for more details." msgstr "更多細節請見 :pep:`673`。" -#: ../../library/typing.rst:1016 +#: ../../library/typing.rst:1041 msgid "" "Special annotation for explicitly declaring a :ref:`type alias `." msgstr "做為明確宣告一個\\ :ref:`型別別名 ` 的特別註釋。" -#: ../../library/typing.rst:1020 +#: ../../library/typing.rst:1045 msgid "" "from typing import TypeAlias\n" "\n" @@ -1679,7 +1713,7 @@ msgstr "" "\n" "Factors: TypeAlias = list[int]" -#: ../../library/typing.rst:1024 +#: ../../library/typing.rst:1049 msgid "" "``TypeAlias`` is particularly useful on older Python versions for annotating " "aliases that make use of forward references, as it can be hard for type " @@ -1689,7 +1723,7 @@ msgstr "" "(forward reference),因為對於型別檢查器來說,分辨這些別名與一般的變數賦值相當" "困難: ::" -#: ../../library/typing.rst:1028 +#: ../../library/typing.rst:1053 msgid "" "from typing import Generic, TypeAlias, TypeVar\n" "\n" @@ -1707,11 +1741,11 @@ msgid "" " def make_box_of_strings(cls) -> BoxOfStrings: ..." msgstr "" -#: ../../library/typing.rst:1044 +#: ../../library/typing.rst:1069 msgid "See :pep:`613` for more details." msgstr "更多細節請見 :pep:`613`。" -#: ../../library/typing.rst:1048 +#: ../../library/typing.rst:1073 msgid "" ":data:`TypeAlias` is deprecated in favor of the :keyword:`type` statement, " "which creates instances of :class:`TypeAliasType` and which natively " @@ -1727,11 +1761,11 @@ msgstr "" "是不同的,且後者不是前者的型別。現在還沒有移除 :data:`TypeAlias` 的計畫,但鼓" "勵使用者們遷移 (migrate) 至 :keyword:`type` 陳述式。" -#: ../../library/typing.rst:1059 +#: ../../library/typing.rst:1084 msgid "Special forms" msgstr "特別型式" -#: ../../library/typing.rst:1061 +#: ../../library/typing.rst:1086 msgid "" "These can be used as types in annotations. They all support subscription " "using ``[]``, but each has a unique syntax." @@ -1739,14 +1773,14 @@ msgstr "" "這些在註釋中可以當作型別使用。他們全都支援 ``[]`` 的下標使用,但每個都具有獨" "特的語法。" -#: ../../library/typing.rst:1066 +#: ../../library/typing.rst:1091 msgid "" "Union type; ``Union[X, Y]`` is equivalent to ``X | Y`` and means either X or " "Y." msgstr "" "聯集型別;``Union[X, Y]`` 與 ``X | Y`` 是相等的,且都意味著 X 或 Y 兩者其一。" -#: ../../library/typing.rst:1068 +#: ../../library/typing.rst:1093 msgid "" "To define a union, use e.g. ``Union[int, str]`` or the shorthand ``int | " "str``. Using that shorthand is recommended. Details:" @@ -1754,66 +1788,66 @@ msgstr "" "為了定義聯集,例如可以使用 ``Union[int, str]`` 或是使用簡寫 (shorthand) " "``int | str``。使用這種簡寫是非常推薦的。詳細請看: ::" -#: ../../library/typing.rst:1070 +#: ../../library/typing.rst:1095 msgid "The arguments must be types and there must be at least one." msgstr "引數必須為型別且必須有至少一個。" -#: ../../library/typing.rst:1072 +#: ../../library/typing.rst:1097 msgid "Unions of unions are flattened, e.g.::" msgstr "聯集中的聯集會是扁平化的 (flattened),舉例來說: ::" -#: ../../library/typing.rst:1074 +#: ../../library/typing.rst:1099 msgid "Union[Union[int, str], float] == Union[int, str, float]" msgstr "Union[Union[int, str], float] == Union[int, str, float]" -#: ../../library/typing.rst:1076 +#: ../../library/typing.rst:1101 msgid "Unions of a single argument vanish, e.g.::" msgstr "單一引數的聯集會消失不見,舉例來說: ::" -#: ../../library/typing.rst:1078 +#: ../../library/typing.rst:1103 msgid "Union[int] == int # The constructor actually returns int" msgstr "Union[int] == int # The constructor actually returns int" -#: ../../library/typing.rst:1080 +#: ../../library/typing.rst:1105 msgid "Redundant arguments are skipped, e.g.::" msgstr "多餘的引數會被略過,舉例來說: ::" -#: ../../library/typing.rst:1082 +#: ../../library/typing.rst:1107 msgid "Union[int, str, int] == Union[int, str] == int | str" msgstr "" -#: ../../library/typing.rst:1084 +#: ../../library/typing.rst:1109 msgid "When comparing unions, the argument order is ignored, e.g.::" msgstr "當比較聯集時,引數的順序會被忽略,舉例來說: ::" -#: ../../library/typing.rst:1086 +#: ../../library/typing.rst:1111 msgid "Union[int, str] == Union[str, int]" msgstr "Union[int, str] == Union[str, int]" -#: ../../library/typing.rst:1088 +#: ../../library/typing.rst:1113 msgid "You cannot subclass or instantiate a ``Union``." msgstr "你不能建立 ``Union`` 的子類別或是實例。" -#: ../../library/typing.rst:1090 +#: ../../library/typing.rst:1115 msgid "You cannot write ``Union[X][Y]``." msgstr "你不能寫成 ``Union[X][Y]``。" -#: ../../library/typing.rst:1092 +#: ../../library/typing.rst:1117 msgid "Don't remove explicit subclasses from unions at runtime." msgstr "請勿在 runtime 中將顯性子類別從聯集中移除。" -#: ../../library/typing.rst:1095 +#: ../../library/typing.rst:1120 msgid "" "Unions can now be written as ``X | Y``. See :ref:`union type " "expressions`." msgstr "" "現在可以將聯集寫成 ``X | Y``。請見\\ :ref:`聯集型別運算式 `。" -#: ../../library/typing.rst:1101 +#: ../../library/typing.rst:1126 msgid "``Optional[X]`` is equivalent to ``X | None`` (or ``Union[X, None]``)." msgstr "``Optional[X]`` 與 ``X | None`` 是相等的(或是 ``Union[X, None]``)。" -#: ../../library/typing.rst:1103 +#: ../../library/typing.rst:1128 msgid "" "Note that this is not the same concept as an optional argument, which is one " "that has a default. An optional argument with a default does not require " @@ -1824,7 +1858,7 @@ msgstr "" "有預設值的選擇性引數的型別註釋中不具有 ``Optional`` 限定符 (qualifier),單純" "的因為它就是選擇性的。舉例來說: ::" -#: ../../library/typing.rst:1108 +#: ../../library/typing.rst:1133 msgid "" "def foo(arg: int = 0) -> None:\n" " ..." @@ -1832,7 +1866,7 @@ msgstr "" "def foo(arg: int = 0) -> None:\n" " ..." -#: ../../library/typing.rst:1111 +#: ../../library/typing.rst:1136 msgid "" "On the other hand, if an explicit value of ``None`` is allowed, the use of " "``Optional`` is appropriate, whether the argument is optional or not. For " @@ -1841,7 +1875,7 @@ msgstr "" "另一方面,如果一個顯性的值 ``None`` 是被允許的,不論引數是不是選擇性的," "``Optional`` 都適用。舉例來說: ::" -#: ../../library/typing.rst:1115 +#: ../../library/typing.rst:1140 msgid "" "def foo(arg: Optional[int] = None) -> None:\n" " ..." @@ -1849,7 +1883,7 @@ msgstr "" "def foo(arg: Optional[int] = None) -> None:\n" " ..." -#: ../../library/typing.rst:1118 +#: ../../library/typing.rst:1143 msgid "" "Optional can now be written as ``X | None``. See :ref:`union type " "expressions`." @@ -1857,11 +1891,11 @@ msgstr "" "現在可以將 Optional 寫成 ``X | None``。請見\\ :ref:`聯集型別運算式 `。" -#: ../../library/typing.rst:1124 +#: ../../library/typing.rst:1149 msgid "Special form for annotating higher-order functions." msgstr "用於註釋高階函式的特別型式。" -#: ../../library/typing.rst:1126 +#: ../../library/typing.rst:1151 msgid "" "``Concatenate`` can be used in conjunction with :ref:`Callable ` and :class:`ParamSpec` to annotate a higher-order callable which " @@ -1879,7 +1913,7 @@ msgstr "" "效。``Concatenate`` 的最後一個參數必須為一個 :class:`ParamSpec` 或是刪節號 " "(``...``)。" -#: ../../library/typing.rst:1135 +#: ../../library/typing.rst:1160 msgid "" "For example, to annotate a decorator ``with_lock`` which provides a :class:" "`threading.Lock` to the decorated function, ``Concatenate`` can be used to " @@ -1895,7 +1929,7 @@ msgstr "" "Callable 物件。在這種情況下,:class:`ParamSpec` 指出回傳的 Callable 物件的參" "數型別會依賴傳遞的 Callable 物件的參數型別: ::" -#: ../../library/typing.rst:1143 +#: ../../library/typing.rst:1168 msgid "" "from collections.abc import Callable\n" "from threading import Lock\n" @@ -1923,32 +1957,32 @@ msgid "" "sum_threadsafe([1.1, 2.2, 3.3])" msgstr "" -#: ../../library/typing.rst:1171 ../../library/typing.rst:1933 +#: ../../library/typing.rst:1196 ../../library/typing.rst:2127 msgid "" ":pep:`612` -- Parameter Specification Variables (the PEP which introduced " "``ParamSpec`` and ``Concatenate``)" msgstr ":pep:`612` -- 參數技術規範變數" -#: ../../library/typing.rst:1173 +#: ../../library/typing.rst:1198 msgid ":class:`ParamSpec`" msgstr ":class:`ParamSpec`" -#: ../../library/typing.rst:1174 ../../library/typing.rst:1936 +#: ../../library/typing.rst:1199 ../../library/typing.rst:2130 msgid ":ref:`annotating-callables`" msgstr ":ref:`annotating-callables`" -#: ../../library/typing.rst:1178 +#: ../../library/typing.rst:1203 msgid "Special typing form to define \"literal types\"." msgstr "特殊型別格式,用於定義「文本型別 (literal type)」。" -#: ../../library/typing.rst:1180 +#: ../../library/typing.rst:1205 msgid "" "``Literal`` can be used to indicate to type checkers that the annotated " "object has a value equivalent to one of the provided literals." msgstr "" "``Literal`` 可以用於型別檢查器並指出註釋物件具有一個與提供的文本相同的值。" -#: ../../library/typing.rst:1186 +#: ../../library/typing.rst:1211 msgid "" "def validate_simple(data: Any) -> Literal[True]: # always returns True\n" " ...\n" @@ -1961,7 +1995,7 @@ msgid "" "open_helper('/other/path', 'typo') # Error in type checker" msgstr "" -#: ../../library/typing.rst:1196 +#: ../../library/typing.rst:1221 msgid "" "``Literal[...]`` cannot be subclassed. At runtime, an arbitrary value is " "allowed as type argument to ``Literal[...]``, but type checkers may impose " @@ -1971,7 +2005,7 @@ msgstr "" "``Literal[...]`` 的型別引數,但型別檢查器可能會加強限制。更多有關文本型別的詳" "細資訊請看 :pep:`586`。" -#: ../../library/typing.rst:1202 +#: ../../library/typing.rst:1227 msgid "" "``Literal`` now de-duplicates parameters. Equality comparisons of " "``Literal`` objects are no longer order dependent. ``Literal`` objects will " @@ -1982,11 +2016,11 @@ msgstr "" "比較不再依照相依性排序。``Literal`` 物件現在會在相等性比較期間,若任一個其中" "的參數無法 :term:`hashable` 時,則會引發一個 :exc:`TypeError` 例外。" -#: ../../library/typing.rst:1210 +#: ../../library/typing.rst:1235 msgid "Special type construct to mark class variables." msgstr "特殊型別建構,用來標記類別變數。" -#: ../../library/typing.rst:1212 +#: ../../library/typing.rst:1237 msgid "" "As introduced in :pep:`526`, a variable annotation wrapped in ClassVar " "indicates that a given attribute is intended to be used as a class variable " @@ -1996,18 +2030,18 @@ msgstr "" "定的屬性 (attribute) 意圖被當作類別變數使用,且不該被設定成該類別的實例。使用" "方法如下: ::" -#: ../../library/typing.rst:1216 +#: ../../library/typing.rst:1241 msgid "" "class Starship:\n" " stats: ClassVar[dict[str, int]] = {} # class variable\n" " damage: int = 10 # instance variable" msgstr "" -#: ../../library/typing.rst:1220 +#: ../../library/typing.rst:1245 msgid ":data:`ClassVar` accepts only types and cannot be further subscribed." msgstr ":data:`ClassVar` 只接受型別請不得使用下標。" -#: ../../library/typing.rst:1222 +#: ../../library/typing.rst:1247 msgid "" ":data:`ClassVar` is not a class itself, and should not be used with :func:" "`isinstance` or :func:`issubclass`. :data:`ClassVar` does not change Python " @@ -2019,18 +2053,22 @@ msgstr "" "但它可以被第三方的型別檢查器使用。舉例來說,一個型別檢查器可能會標記下方的程" "式碼為一個錯誤: ::" -#: ../../library/typing.rst:1228 +#: ../../library/typing.rst:1253 msgid "" "enterprise_d = Starship(3000)\n" "enterprise_d.stats = {} # Error, setting class variable on instance\n" "Starship.stats = {} # This is OK" msgstr "" -#: ../../library/typing.rst:1236 +#: ../../library/typing.rst:1261 +msgid ":data:`ClassVar` can now be nested in :data:`Final` and vice versa." +msgstr "" + +#: ../../library/typing.rst:1265 msgid "Special typing construct to indicate final names to type checkers." -msgstr "特殊型別建構,用來指出最終名稱給型別檢查器。" +msgstr "特殊型別建構,用來指出給型別檢查器的最終名稱。" -#: ../../library/typing.rst:1238 +#: ../../library/typing.rst:1267 msgid "" "Final names cannot be reassigned in any scope. Final names declared in class " "scopes cannot be overridden in subclasses." @@ -2038,7 +2076,7 @@ msgstr "" "最終名稱不可以在任何作用域 (scope) 中重新賦值。在類別作用域中宣告的最終名稱," "不得在子類別中進行覆寫 (override)。" -#: ../../library/typing.rst:1243 +#: ../../library/typing.rst:1272 msgid "" "MAX_SIZE: Final = 9000\n" "MAX_SIZE += 1 # Error reported by type checker\n" @@ -2050,18 +2088,22 @@ msgid "" " TIMEOUT = 1 # Error reported by type checker" msgstr "" -#: ../../library/typing.rst:1252 ../../library/typing.rst:2853 +#: ../../library/typing.rst:1281 ../../library/typing.rst:3081 msgid "" "There is no runtime checking of these properties. See :pep:`591` for more " "details." msgstr "" "這些屬性 (property) 不會在 runtime 時進行檢查。更多詳細資訊請看 :pep:`591`。" -#: ../../library/typing.rst:1259 +#: ../../library/typing.rst:1288 +msgid ":data:`Final` can now be nested in :data:`ClassVar` and vice versa." +msgstr "" + +#: ../../library/typing.rst:1292 msgid "Special typing construct to mark a :class:`TypedDict` key as required." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是必須的。" -#: ../../library/typing.rst:1261 +#: ../../library/typing.rst:1294 msgid "" "This is mainly useful for ``total=False`` TypedDicts. See :class:`TypedDict` " "and :pep:`655` for more details." @@ -2069,21 +2111,46 @@ msgstr "" "主要用於 ``total=False`` 的 TypedDict。更多細節請見 :class:`TypedDict` 與 :" "pep:`655`。" -#: ../../library/typing.rst:1268 +#: ../../library/typing.rst:1301 msgid "" "Special typing construct to mark a :class:`TypedDict` key as potentially " "missing." msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 鍵值是可能消失的。" -#: ../../library/typing.rst:1271 +#: ../../library/typing.rst:1304 msgid "See :class:`TypedDict` and :pep:`655` for more details." msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`655`。" -#: ../../library/typing.rst:1277 +#: ../../library/typing.rst:1310 +msgid "" +"A special typing construct to mark an item of a :class:`TypedDict` as read-" +"only." +msgstr "特殊型別建構,用來標記一個 :class:`TypedDict` 的項目是唯讀的。" + +#: ../../library/typing.rst:1314 +msgid "" +"class Movie(TypedDict):\n" +" title: ReadOnly[str]\n" +" year: int\n" +"\n" +"def mutate_movie(m: Movie) -> None:\n" +" m[\"year\"] = 1999 # allowed\n" +" m[\"title\"] = \"The Matrix\" # typechecker error" +msgstr "" + +#: ../../library/typing.rst:1322 +msgid "There is no runtime checking for this property." +msgstr "這些屬性 (property) 不會在 runtime 時進行檢查。" + +#: ../../library/typing.rst:1324 +msgid "See :class:`TypedDict` and :pep:`705` for more details." +msgstr "更多細節請見 :class:`TypedDict` 與 :pep:`705`。" + +#: ../../library/typing.rst:1330 msgid "Special typing form to add context-specific metadata to an annotation." msgstr "" -#: ../../library/typing.rst:1279 +#: ../../library/typing.rst:1332 msgid "" "Add metadata ``x`` to a given type ``T`` by using the annotation " "``Annotated[T, x]``. Metadata added using ``Annotated`` can be used by " @@ -2091,7 +2158,7 @@ msgid "" "a :attr:`!__metadata__` attribute." msgstr "" -#: ../../library/typing.rst:1284 +#: ../../library/typing.rst:1337 msgid "" "If a library or tool encounters an annotation ``Annotated[T, x]`` and has no " "special logic for the metadata, it should ignore the metadata and simply " @@ -2100,7 +2167,7 @@ msgid "" "system." msgstr "" -#: ../../library/typing.rst:1290 +#: ../../library/typing.rst:1343 msgid "" "Using ``Annotated[T, x]`` as an annotation still allows for static " "typechecking of ``T``, as type checkers will simply ignore the metadata " @@ -2110,7 +2177,7 @@ msgid "" "for a function or class." msgstr "" -#: ../../library/typing.rst:1297 +#: ../../library/typing.rst:1350 msgid "" "The responsibility of how to interpret the metadata lies with the tool or " "library encountering an ``Annotated`` annotation. A tool or library " @@ -2118,13 +2185,13 @@ msgid "" "determine if they are of interest (e.g., using :func:`isinstance`)." msgstr "" -#: ../../library/typing.rst:1305 +#: ../../library/typing.rst:1358 msgid "" "Here is an example of how you might use ``Annotated`` to add metadata to " "type annotations if you were doing range analysis:" msgstr "" -#: ../../library/typing.rst:1308 +#: ../../library/typing.rst:1361 msgid "" "@dataclass\n" "class ValueRange:\n" @@ -2142,21 +2209,21 @@ msgstr "" "T1 = Annotated[int, ValueRange(-10, 5)]\n" "T2 = Annotated[T1, ValueRange(-20, 3)]" -#: ../../library/typing.rst:1318 +#: ../../library/typing.rst:1371 msgid "Details of the syntax:" msgstr "" -#: ../../library/typing.rst:1320 +#: ../../library/typing.rst:1373 msgid "The first argument to ``Annotated`` must be a valid type" msgstr "" -#: ../../library/typing.rst:1322 +#: ../../library/typing.rst:1375 msgid "" "Multiple metadata elements can be supplied (``Annotated`` supports variadic " "arguments)::" msgstr "" -#: ../../library/typing.rst:1325 +#: ../../library/typing.rst:1378 msgid "" "@dataclass\n" "class ctype:\n" @@ -2170,26 +2237,26 @@ msgstr "" "\n" "Annotated[int, ValueRange(3, 10), ctype(\"char\")]" -#: ../../library/typing.rst:1331 +#: ../../library/typing.rst:1384 msgid "" "It is up to the tool consuming the annotations to decide whether the client " "is allowed to add multiple metadata elements to one annotation and how to " "merge those annotations." msgstr "" -#: ../../library/typing.rst:1335 +#: ../../library/typing.rst:1388 msgid "" "``Annotated`` must be subscripted with at least two arguments " "( ``Annotated[int]`` is not valid)" msgstr "" -#: ../../library/typing.rst:1338 +#: ../../library/typing.rst:1391 msgid "" "The order of the metadata elements is preserved and matters for equality " "checks::" msgstr "" -#: ../../library/typing.rst:1341 +#: ../../library/typing.rst:1394 msgid "" "assert Annotated[int, ValueRange(3, 10), ctype(\"char\")] != Annotated[\n" " int, ctype(\"char\"), ValueRange(3, 10)\n" @@ -2199,13 +2266,13 @@ msgstr "" " int, ctype(\"char\"), ValueRange(3, 10)\n" "]" -#: ../../library/typing.rst:1345 +#: ../../library/typing.rst:1398 msgid "" "Nested ``Annotated`` types are flattened. The order of the metadata elements " "starts with the innermost annotation::" msgstr "" -#: ../../library/typing.rst:1348 +#: ../../library/typing.rst:1401 msgid "" "assert Annotated[Annotated[int, ValueRange(3, 10)], ctype(\"char\")] == " "Annotated[\n" @@ -2217,11 +2284,11 @@ msgstr "" " int, ValueRange(3, 10), ctype(\"char\")\n" "]" -#: ../../library/typing.rst:1352 +#: ../../library/typing.rst:1405 msgid "Duplicated metadata elements are not removed::" msgstr "" -#: ../../library/typing.rst:1354 +#: ../../library/typing.rst:1407 msgid "" "assert Annotated[int, ValueRange(3, 10)] != Annotated[\n" " int, ValueRange(3, 10), ValueRange(3, 10)\n" @@ -2231,11 +2298,11 @@ msgstr "" " int, ValueRange(3, 10), ValueRange(3, 10)\n" "]" -#: ../../library/typing.rst:1358 +#: ../../library/typing.rst:1411 msgid "``Annotated`` can be used with nested and generic aliases:" msgstr "" -#: ../../library/typing.rst:1360 +#: ../../library/typing.rst:1413 msgid "" "@dataclass\n" "class MaxLen:\n" @@ -2249,35 +2316,35 @@ msgid "" "type V = Vec[int]" msgstr "" -#: ../../library/typing.rst:1372 +#: ../../library/typing.rst:1425 msgid "``Annotated`` cannot be used with an unpacked :class:`TypeVarTuple`::" msgstr "" -#: ../../library/typing.rst:1374 +#: ../../library/typing.rst:1427 msgid "type Variadic[*Ts] = Annotated[*Ts, Ann1] # NOT valid" msgstr "" -#: ../../library/typing.rst:1376 +#: ../../library/typing.rst:1429 msgid "This would be equivalent to::" msgstr "這會等價於: ::" -#: ../../library/typing.rst:1378 +#: ../../library/typing.rst:1431 msgid "Annotated[T1, T2, T3, ..., Ann1]" msgstr "Annotated[T1, T2, T3, ..., Ann1]" -#: ../../library/typing.rst:1380 +#: ../../library/typing.rst:1433 msgid "" "where ``T1``, ``T2``, etc. are :class:`TypeVars `. This would be " "invalid: only one type should be passed to Annotated." msgstr "" -#: ../../library/typing.rst:1383 +#: ../../library/typing.rst:1436 msgid "" "By default, :func:`get_type_hints` strips the metadata from annotations. " "Pass ``include_extras=True`` to have the metadata preserved:" msgstr "" -#: ../../library/typing.rst:1386 +#: ../../library/typing.rst:1439 msgid "" ">>> from typing import Annotated, get_type_hints\n" ">>> def func(x: Annotated[int, \"metadata\"]) -> None: pass\n" @@ -2295,13 +2362,13 @@ msgstr "" ">>> get_type_hints(func, include_extras=True)\n" "{'x': typing.Annotated[int, 'metadata'], 'return': }" -#: ../../library/typing.rst:1396 +#: ../../library/typing.rst:1449 msgid "" "At runtime, the metadata associated with an ``Annotated`` type can be " "retrieved via the :attr:`!__metadata__` attribute:" msgstr "" -#: ../../library/typing.rst:1399 +#: ../../library/typing.rst:1452 msgid "" ">>> from typing import Annotated\n" ">>> X = Annotated[int, \"very\", \"important\", \"metadata\"]\n" @@ -2317,38 +2384,71 @@ msgstr "" ">>> X.__metadata__\n" "('very', 'important', 'metadata')" -#: ../../library/typing.rst:1410 +#: ../../library/typing.rst:1461 +msgid "" +"At runtime, if you want to retrieve the original type wrapped by " +"``Annotated``, use the :attr:`!__origin__` attribute:" +msgstr "" + +#: ../../library/typing.rst:1464 +msgid "" +">>> from typing import Annotated, get_origin\n" +">>> Password = Annotated[str, \"secret\"]\n" +">>> Password.__origin__\n" +"" +msgstr "" +">>> from typing import Annotated, get_origin\n" +">>> Password = Annotated[str, \"secret\"]\n" +">>> Password.__origin__\n" +"" + +#: ../../library/typing.rst:1471 +msgid "Note that using :func:`get_origin` will return ``Annotated`` itself:" +msgstr "" + +#: ../../library/typing.rst:1473 +msgid "" +">>> get_origin(Password)\n" +"typing.Annotated" +msgstr "" +">>> get_origin(Password)\n" +"typing.Annotated" + +#: ../../library/typing.rst:1480 msgid ":pep:`593` - Flexible function and variable annotations" msgstr "" -#: ../../library/typing.rst:1411 +#: ../../library/typing.rst:1481 msgid "The PEP introducing ``Annotated`` to the standard library." msgstr "" -#: ../../library/typing.rst:1418 -msgid "Special typing construct for marking user-defined type guard functions." +#: ../../library/typing.rst:1488 ../../library/typing.rst:1572 +msgid "" +"Special typing construct for marking user-defined type predicate functions." msgstr "" -#: ../../library/typing.rst:1420 +#: ../../library/typing.rst:1490 msgid "" -"``TypeGuard`` can be used to annotate the return type of a user-defined type " -"guard function. ``TypeGuard`` only accepts a single type argument. At " -"runtime, functions marked this way should return a boolean." +"``TypeIs`` can be used to annotate the return type of a user-defined type " +"predicate function. ``TypeIs`` only accepts a single type argument. At " +"runtime, functions marked this way should return a boolean and take at least " +"one positional argument." msgstr "" -#: ../../library/typing.rst:1424 +#: ../../library/typing.rst:1495 msgid "" -"``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static " +"``TypeIs`` aims to benefit *type narrowing* -- a technique used by static " "type checkers to determine a more precise type of an expression within a " "program's code flow. Usually type narrowing is done by analyzing " "conditional code flow and applying the narrowing to a block of code. The " -"conditional expression here is sometimes referred to as a \"type guard\"::" +"conditional expression here is sometimes referred to as a \"type " +"predicate\"::" msgstr "" -#: ../../library/typing.rst:1430 +#: ../../library/typing.rst:1501 msgid "" "def is_str(val: str | float):\n" -" # \"isinstance\" type guard\n" +" # \"isinstance\" type predicate\n" " if isinstance(val, str):\n" " # Type of ``val`` is narrowed to ``str``\n" " ...\n" @@ -2357,30 +2457,119 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1439 +#: ../../library/typing.rst:1510 msgid "" "Sometimes it would be convenient to use a user-defined boolean function as a " -"type guard. Such a function should use ``TypeGuard[...]`` as its return " -"type to alert static type checkers to this intention." +"type predicate. Such a function should use ``TypeIs[...]`` or :data:" +"`TypeGuard` as its return type to alert static type checkers to this " +"intention. ``TypeIs`` usually has more intuitive behavior than " +"``TypeGuard``, but it cannot be used when the input and output types are " +"incompatible (e.g., ``list[object]`` to ``list[int]``) or when the function " +"does not return ``True`` for all instances of the narrowed type." msgstr "" -#: ../../library/typing.rst:1443 +#: ../../library/typing.rst:1518 msgid "" -"Using ``-> TypeGuard`` tells the static type checker that for a given " -"function:" +"Using ``-> TypeIs[NarrowedType]`` tells the static type checker that for a " +"given function:" msgstr "" -#: ../../library/typing.rst:1446 +#: ../../library/typing.rst:1521 ../../library/typing.rst:1582 msgid "The return value is a boolean." msgstr "" -#: ../../library/typing.rst:1447 +#: ../../library/typing.rst:1522 +msgid "" +"If the return value is ``True``, the type of its argument is the " +"intersection of the argument's original type and ``NarrowedType``." +msgstr "" + +#: ../../library/typing.rst:1524 +msgid "" +"If the return value is ``False``, the type of its argument is narrowed to " +"exclude ``NarrowedType``." +msgstr "" + +#: ../../library/typing.rst:1529 +msgid "" +"from typing import assert_type, final, TypeIs\n" +"\n" +"class Parent: pass\n" +"class Child(Parent): pass\n" +"@final\n" +"class Unrelated: pass\n" +"\n" +"def is_parent(val: object) -> TypeIs[Parent]:\n" +" return isinstance(val, Parent)\n" +"\n" +"def run(arg: Child | Unrelated):\n" +" if is_parent(arg):\n" +" # Type of ``arg`` is narrowed to the intersection\n" +" # of ``Parent`` and ``Child``, which is equivalent to\n" +" # ``Child``.\n" +" assert_type(arg, Child)\n" +" else:\n" +" # Type of ``arg`` is narrowed to exclude ``Parent``,\n" +" # so only ``Unrelated`` is left.\n" +" assert_type(arg, Unrelated)" +msgstr "" + +#: ../../library/typing.rst:1550 +msgid "" +"The type inside ``TypeIs`` must be consistent with the type of the " +"function's argument; if it is not, static type checkers will raise an " +"error. An incorrectly written ``TypeIs`` function can lead to unsound " +"behavior in the type system; it is the user's responsibility to write such " +"functions in a type-safe manner." +msgstr "" + +#: ../../library/typing.rst:1556 +msgid "" +"If a ``TypeIs`` function is a class or instance method, then the type in " +"``TypeIs`` maps to the type of the second parameter (after ``cls`` or " +"``self``)." +msgstr "" + +#: ../../library/typing.rst:1560 +msgid "" +"In short, the form ``def foo(arg: TypeA) -> TypeIs[TypeB]: ...``, means that " +"if ``foo(arg)`` returns ``True``, then ``arg`` is an instance of ``TypeB``, " +"and if it returns ``False``, it is not an instance of ``TypeB``." +msgstr "" + +#: ../../library/typing.rst:1564 +msgid "" +"``TypeIs`` also works with type variables. For more information, see :pep:" +"`742` (Narrowing types with ``TypeIs``)." +msgstr "" + +#: ../../library/typing.rst:1574 +msgid "" +"Type predicate functions are user-defined functions that return whether " +"their argument is an instance of a particular type. ``TypeGuard`` works " +"similarly to :data:`TypeIs`, but has subtly different effects on type " +"checking behavior (see below)." +msgstr "" + +#: ../../library/typing.rst:1579 +msgid "" +"Using ``-> TypeGuard`` tells the static type checker that for a given " +"function:" +msgstr "" + +#: ../../library/typing.rst:1583 msgid "" "If the return value is ``True``, the type of its argument is the type inside " "``TypeGuard``." msgstr "" -#: ../../library/typing.rst:1452 +#: ../../library/typing.rst:1586 +msgid "" +"``TypeGuard`` also works with type variables. See :pep:`647` for more " +"details." +msgstr "" + +#: ../../library/typing.rst:1590 msgid "" "def is_str_list(val: list[object]) -> TypeGuard[list[str]]:\n" " '''Determines whether all objects in the list are strings'''\n" @@ -2395,47 +2584,47 @@ msgid "" " print(\"Not a list of strings!\")" msgstr "" -#: ../../library/typing.rst:1464 -msgid "" -"If ``is_str_list`` is a class or instance method, then the type in " -"``TypeGuard`` maps to the type of the second parameter (after ``cls`` or " -"``self``)." +#: ../../library/typing.rst:1602 +msgid "``TypeIs`` and ``TypeGuard`` differ in the following ways:" msgstr "" -#: ../../library/typing.rst:1468 +#: ../../library/typing.rst:1604 msgid "" -"In short, the form ``def foo(arg: TypeA) -> TypeGuard[TypeB]: ...``, means " -"that if ``foo(arg)`` returns ``True``, then ``arg`` narrows from ``TypeA`` " -"to ``TypeB``." +"``TypeIs`` requires the narrowed type to be a subtype of the input type, " +"while ``TypeGuard`` does not. The main reason is to allow for things like " +"narrowing ``list[object]`` to ``list[str]`` even though the latter is not a " +"subtype of the former, since ``list`` is invariant." msgstr "" -#: ../../library/typing.rst:1474 +#: ../../library/typing.rst:1608 msgid "" -"``TypeB`` need not be a narrower form of ``TypeA`` -- it can even be a wider " -"form. The main reason is to allow for things like narrowing ``list[object]`` " -"to ``list[str]`` even though the latter is not a subtype of the former, " -"since ``list`` is invariant. The responsibility of writing type-safe type " -"guards is left to the user." +"When a ``TypeGuard`` function returns ``True``, type checkers narrow the " +"type of the variable to exactly the ``TypeGuard`` type. When a ``TypeIs`` " +"function returns ``True``, type checkers can infer a more precise type " +"combining the previously known type of the variable with the ``TypeIs`` " +"type. (Technically, this is known as an intersection type.)" msgstr "" -#: ../../library/typing.rst:1480 +#: ../../library/typing.rst:1612 msgid "" -"``TypeGuard`` also works with type variables. See :pep:`647` for more " -"details." +"When a ``TypeGuard`` function returns ``False``, type checkers cannot narrow " +"the type of the variable at all. When a ``TypeIs`` function returns " +"``False``, type checkers can narrow the type of the variable to exclude the " +"``TypeIs`` type." msgstr "" -#: ../../library/typing.rst:1487 +#: ../../library/typing.rst:1621 msgid "Typing operator to conceptually mark an object as having been unpacked." msgstr "" -#: ../../library/typing.rst:1489 +#: ../../library/typing.rst:1623 msgid "" "For example, using the unpack operator ``*`` on a :ref:`type variable tuple " "` is equivalent to using ``Unpack`` to mark the type variable " "tuple as having been unpacked::" msgstr "" -#: ../../library/typing.rst:1493 +#: ../../library/typing.rst:1627 msgid "" "Ts = TypeVarTuple('Ts')\n" "tup: tuple[*Ts]\n" @@ -2443,7 +2632,7 @@ msgid "" "tup: tuple[Unpack[Ts]]" msgstr "" -#: ../../library/typing.rst:1498 +#: ../../library/typing.rst:1632 msgid "" "In fact, ``Unpack`` can be used interchangeably with ``*`` in the context " "of :class:`typing.TypeVarTuple ` and :class:`builtins.tuple " @@ -2451,7 +2640,7 @@ msgid "" "versions of Python, where ``*`` couldn't be used in certain places::" msgstr "" -#: ../../library/typing.rst:1504 +#: ../../library/typing.rst:1638 msgid "" "# In older versions of Python, TypeVarTuple and Unpack\n" "# are located in the `typing_extensions` backports package.\n" @@ -2462,13 +2651,13 @@ msgid "" "tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible" msgstr "" -#: ../../library/typing.rst:1512 +#: ../../library/typing.rst:1646 msgid "" "``Unpack`` can also be used along with :class:`typing.TypedDict` for typing " "``**kwargs`` in a function signature::" msgstr "" -#: ../../library/typing.rst:1515 +#: ../../library/typing.rst:1649 msgid "" "from typing import TypedDict, Unpack\n" "\n" @@ -2481,23 +2670,23 @@ msgid "" "def foo(**kwargs: Unpack[Movie]): ..." msgstr "" -#: ../../library/typing.rst:1525 +#: ../../library/typing.rst:1659 msgid "" "See :pep:`692` for more details on using ``Unpack`` for ``**kwargs`` typing." msgstr "" -#: ../../library/typing.rst:1530 +#: ../../library/typing.rst:1664 msgid "Building generic types and type aliases" msgstr "" -#: ../../library/typing.rst:1532 +#: ../../library/typing.rst:1666 msgid "" "The following classes should not be used directly as annotations. Their " "intended purpose is to be building blocks for creating generic types and " "type aliases." msgstr "" -#: ../../library/typing.rst:1536 +#: ../../library/typing.rst:1670 msgid "" "These objects can be created through special syntax (:ref:`type parameter " "lists ` and the :keyword:`type` statement). For compatibility " @@ -2505,17 +2694,17 @@ msgid "" "syntax, as documented below." msgstr "" -#: ../../library/typing.rst:1543 +#: ../../library/typing.rst:1677 msgid "Abstract base class for generic types." msgstr "" -#: ../../library/typing.rst:1545 +#: ../../library/typing.rst:1679 msgid "" "A generic type is typically declared by adding a list of type parameters " "after the class name::" msgstr "" -#: ../../library/typing.rst:1548 +#: ../../library/typing.rst:1682 msgid "" "class Mapping[KT, VT]:\n" " def __getitem__(self, key: KT) -> VT:\n" @@ -2523,17 +2712,17 @@ msgid "" " # Etc." msgstr "" -#: ../../library/typing.rst:1553 +#: ../../library/typing.rst:1687 msgid "" "Such a class implicitly inherits from ``Generic``. The runtime semantics of " "this syntax are discussed in the :ref:`Language Reference `." msgstr "" -#: ../../library/typing.rst:1557 +#: ../../library/typing.rst:1691 msgid "This class can then be used as follows::" msgstr "" -#: ../../library/typing.rst:1559 +#: ../../library/typing.rst:1693 msgid "" "def lookup_name[X, Y](mapping: Mapping[X, Y], key: X, default: Y) -> Y:\n" " try:\n" @@ -2547,20 +2736,20 @@ msgstr "" " except KeyError:\n" " return default" -#: ../../library/typing.rst:1565 +#: ../../library/typing.rst:1699 msgid "" "Here the brackets after the function name indicate a :ref:`generic function " "`." msgstr "" -#: ../../library/typing.rst:1568 +#: ../../library/typing.rst:1702 msgid "" "For backwards compatibility, generic classes can also be declared by " "explicitly inheriting from ``Generic``. In this case, the type parameters " "must be declared separately::" msgstr "" -#: ../../library/typing.rst:1573 +#: ../../library/typing.rst:1707 msgid "" "KT = TypeVar('KT')\n" "VT = TypeVar('VT')\n" @@ -2578,18 +2767,18 @@ msgstr "" " ...\n" " # Etc." -#: ../../library/typing.rst:1585 +#: ../../library/typing.rst:1719 msgid "Type variable." msgstr "" -#: ../../library/typing.rst:1587 +#: ../../library/typing.rst:1721 msgid "" "The preferred way to construct a type variable is via the dedicated syntax " "for :ref:`generic functions `, :ref:`generic classes " "`, and :ref:`generic type aliases `::" msgstr "" -#: ../../library/typing.rst:1592 +#: ../../library/typing.rst:1726 msgid "" "class Sequence[T]: # T is a TypeVar\n" " ..." @@ -2597,12 +2786,12 @@ msgstr "" "class Sequence[T]: # T 是一個 TypeVar\n" " ..." -#: ../../library/typing.rst:1595 +#: ../../library/typing.rst:1729 msgid "" "This syntax can also be used to create bound and constrained type variables::" msgstr "" -#: ../../library/typing.rst:1598 +#: ../../library/typing.rst:1732 msgid "" "class StrSequence[S: str]: # S is a TypeVar bound to str\n" " ...\n" @@ -2613,20 +2802,20 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:1605 +#: ../../library/typing.rst:1739 msgid "" "However, if desired, reusable type variables can also be constructed " "manually, like so::" msgstr "" -#: ../../library/typing.rst:1607 +#: ../../library/typing.rst:1741 msgid "" "T = TypeVar('T') # Can be anything\n" "S = TypeVar('S', bound=str) # Can be any subtype of str\n" "A = TypeVar('A', str, bytes) # Must be exactly str or bytes" msgstr "" -#: ../../library/typing.rst:1611 +#: ../../library/typing.rst:1745 msgid "" "Type variables exist primarily for the benefit of static type checkers. " "They serve as the parameters for generic types as well as for generic " @@ -2634,7 +2823,7 @@ msgid "" "information on generic types. Generic functions work as follows::" msgstr "" -#: ../../library/typing.rst:1617 +#: ../../library/typing.rst:1751 msgid "" "def repeat[T](x: T, n: int) -> Sequence[T]:\n" " \"\"\"Return a list containing n references to x.\"\"\"\n" @@ -2652,13 +2841,13 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:1632 +#: ../../library/typing.rst:1766 msgid "" "Note that type variables can be *bound*, *constrained*, or neither, but " "cannot be both bound *and* constrained." msgstr "" -#: ../../library/typing.rst:1635 +#: ../../library/typing.rst:1769 msgid "" "The variance of type variables is inferred by type checkers when they are " "created through the :ref:`type parameter syntax ` or when " @@ -2668,14 +2857,14 @@ msgid "" "invariant. See :pep:`484` and :pep:`695` for more details." msgstr "" -#: ../../library/typing.rst:1643 +#: ../../library/typing.rst:1777 msgid "" "Bound type variables and constrained type variables have different semantics " "in several important ways. Using a *bound* type variable means that the " "``TypeVar`` will be solved using the most specific type possible::" msgstr "" -#: ../../library/typing.rst:1647 +#: ../../library/typing.rst:1781 msgid "" "x = print_capitalized('a string')\n" "reveal_type(x) # revealed type is str\n" @@ -2689,13 +2878,13 @@ msgid "" "z = print_capitalized(45) # error: int is not a subtype of str" msgstr "" -#: ../../library/typing.rst:1658 +#: ../../library/typing.rst:1792 msgid "" "Type variables can be bound to concrete types, abstract types (ABCs or " "protocols), and even unions of types::" msgstr "" -#: ../../library/typing.rst:1661 +#: ../../library/typing.rst:1795 msgid "" "# Can be anything with an __abs__ method\n" "def print_abs[T: SupportsAbs](arg: T) -> None:\n" @@ -2706,13 +2895,13 @@ msgid "" "V = TypeVar('V', bound=SupportsAbs) # Can be anything with an __abs__ method" msgstr "" -#: ../../library/typing.rst:1670 +#: ../../library/typing.rst:1804 msgid "" "Using a *constrained* type variable, however, means that the ``TypeVar`` can " "only ever be solved as being exactly one of the constraints given::" msgstr "" -#: ../../library/typing.rst:1673 +#: ../../library/typing.rst:1807 msgid "" "a = concatenate('one', 'two')\n" "reveal_type(a) # revealed type is str\n" @@ -2725,69 +2914,88 @@ msgid "" "or bytes in a function call, but not both" msgstr "" -#: ../../library/typing.rst:1681 +#: ../../library/typing.rst:1815 msgid "At runtime, ``isinstance(x, T)`` will raise :exc:`TypeError`." msgstr "" -#: ../../library/typing.rst:1685 +#: ../../library/typing.rst:1819 msgid "The name of the type variable." msgstr "" -#: ../../library/typing.rst:1689 +#: ../../library/typing.rst:1823 msgid "Whether the type var has been explicitly marked as covariant." msgstr "" -#: ../../library/typing.rst:1693 +#: ../../library/typing.rst:1827 msgid "Whether the type var has been explicitly marked as contravariant." msgstr "" -#: ../../library/typing.rst:1697 +#: ../../library/typing.rst:1831 msgid "" "Whether the type variable's variance should be inferred by type checkers." msgstr "" -#: ../../library/typing.rst:1703 +#: ../../library/typing.rst:1837 msgid "The bound of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1707 +#: ../../library/typing.rst:1841 msgid "" "For type variables created through :ref:`type parameter syntax `, the bound is evaluated only when the attribute is accessed, not " "when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1713 +#: ../../library/typing.rst:1847 msgid "A tuple containing the constraints of the type variable, if any." msgstr "" -#: ../../library/typing.rst:1717 +#: ../../library/typing.rst:1851 msgid "" "For type variables created through :ref:`type parameter syntax `, the constraints are evaluated only when the attribute is accessed, " "not when the type variable is created (see :ref:`lazy-evaluation`)." msgstr "" -#: ../../library/typing.rst:1723 +#: ../../library/typing.rst:1857 +msgid "" +"The default value of the type variable, or :data:`typing.NoDefault` if it " +"has no default." +msgstr "" + +#: ../../library/typing.rst:1864 +msgid "" +"Return whether or not the type variable has a default value. This is " +"equivalent to checking whether :attr:`__default__` is not the :data:`typing." +"NoDefault` singleton, except that it does not force evaluation of the :ref:" +"`lazily evaluated ` default value." +msgstr "" + +#: ../../library/typing.rst:1873 msgid "" "Type variables can now be declared using the :ref:`type parameter ` syntax introduced by :pep:`695`. The ``infer_variance`` parameter " "was added." msgstr "" -#: ../../library/typing.rst:1731 +#: ../../library/typing.rst:1879 ../../library/typing.rst:2018 +#: ../../library/typing.rst:2120 +msgid "Support for default values was added." +msgstr "" + +#: ../../library/typing.rst:1885 msgid "" "Type variable tuple. A specialized form of :ref:`type variable ` " "that enables *variadic* generics." msgstr "" -#: ../../library/typing.rst:1734 +#: ../../library/typing.rst:1888 msgid "" "Type variable tuples can be declared in :ref:`type parameter lists ` using a single asterisk (``*``) before the name::" msgstr "" -#: ../../library/typing.rst:1737 +#: ../../library/typing.rst:1891 msgid "" "def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, " "T]:\n" @@ -2797,11 +3005,11 @@ msgstr "" "T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1740 +#: ../../library/typing.rst:1894 msgid "Or by explicitly invoking the ``TypeVarTuple`` constructor::" msgstr "" -#: ../../library/typing.rst:1742 +#: ../../library/typing.rst:1896 msgid "" "T = TypeVar(\"T\")\n" "Ts = TypeVarTuple(\"Ts\")\n" @@ -2815,7 +3023,7 @@ msgstr "" "def move_first_element_to_last(tup: tuple[T, *Ts]) -> tuple[*Ts, T]:\n" " return (*tup[1:], tup[0])" -#: ../../library/typing.rst:1748 +#: ../../library/typing.rst:1902 msgid "" "A normal type variable enables parameterization with a single type. A type " "variable tuple, in contrast, allows parameterization with an *arbitrary* " @@ -2823,7 +3031,7 @@ msgid "" "wrapped in a tuple. For example::" msgstr "" -#: ../../library/typing.rst:1753 +#: ../../library/typing.rst:1907 msgid "" "# T is bound to int, Ts is bound to ()\n" "# Return value is (1,), which has type tuple[int]\n" @@ -2843,7 +3051,7 @@ msgid "" "move_first_element_to_last(tup=())" msgstr "" -#: ../../library/typing.rst:1770 +#: ../../library/typing.rst:1924 msgid "" "Note the use of the unpacking operator ``*`` in ``tuple[T, *Ts]``. " "Conceptually, you can think of ``Ts`` as a tuple of type variables ``(T1, " @@ -2853,26 +3061,26 @@ msgid "" "` instead, as ``Unpack[Ts]``.)" msgstr "" -#: ../../library/typing.rst:1778 +#: ../../library/typing.rst:1932 msgid "" "Type variable tuples must *always* be unpacked. This helps distinguish type " "variable tuples from normal type variables::" msgstr "" -#: ../../library/typing.rst:1781 +#: ../../library/typing.rst:1935 msgid "" "x: Ts # Not valid\n" "x: tuple[Ts] # Not valid\n" "x: tuple[*Ts] # The correct way to do it" msgstr "" -#: ../../library/typing.rst:1785 +#: ../../library/typing.rst:1939 msgid "" "Type variable tuples can be used in the same contexts as normal type " "variables. For example, in class definitions, arguments, and return types::" msgstr "" -#: ../../library/typing.rst:1788 +#: ../../library/typing.rst:1942 msgid "" "class Array[*Shape]:\n" " def __getitem__(self, key: tuple[*Shape]) -> float: ...\n" @@ -2884,12 +3092,12 @@ msgstr "" " def __abs__(self) -> \"Array[*Shape]\": ...\n" " def get_shape(self) -> tuple[*Shape]: ..." -#: ../../library/typing.rst:1793 +#: ../../library/typing.rst:1947 msgid "" "Type variable tuples can be happily combined with normal type variables:" msgstr "" -#: ../../library/typing.rst:1795 +#: ../../library/typing.rst:1949 msgid "" "class Array[DType, *Shape]: # This is fine\n" " pass\n" @@ -2904,26 +3112,26 @@ msgid "" "int_array_2d: Array[int, Height, Width] = Array() # Yup, fine too" msgstr "" -#: ../../library/typing.rst:1809 +#: ../../library/typing.rst:1963 msgid "" "However, note that at most one type variable tuple may appear in a single " "list of type arguments or type parameters::" msgstr "" -#: ../../library/typing.rst:1812 +#: ../../library/typing.rst:1966 msgid "" "x: tuple[*Ts, *Ts] # Not valid\n" "class Array[*Shape, *Shape]: # Not valid\n" " pass" msgstr "" -#: ../../library/typing.rst:1816 +#: ../../library/typing.rst:1970 msgid "" "Finally, an unpacked type variable tuple can be used as the type annotation " "of ``*args``::" msgstr "" -#: ../../library/typing.rst:1819 +#: ../../library/typing.rst:1973 msgid "" "def call_soon[*Ts](\n" " callback: Callable[[*Ts], None],\n" @@ -2939,7 +3147,7 @@ msgstr "" " ...\n" " callback(*args)" -#: ../../library/typing.rst:1826 +#: ../../library/typing.rst:1980 msgid "" "In contrast to non-unpacked annotations of ``*args`` - e.g. ``*args: int``, " "which would specify that *all* arguments are ``int`` - ``*args: *Ts`` " @@ -2948,47 +3156,61 @@ msgid "" "``call_soon`` match the types of the (positional) arguments of ``callback``." msgstr "" -#: ../../library/typing.rst:1833 +#: ../../library/typing.rst:1987 msgid "See :pep:`646` for more details on type variable tuples." msgstr "" -#: ../../library/typing.rst:1837 +#: ../../library/typing.rst:1991 msgid "The name of the type variable tuple." msgstr "" -#: ../../library/typing.rst:1843 +#: ../../library/typing.rst:1995 +msgid "" +"The default value of the type variable tuple, or :data:`typing.NoDefault` if " +"it has no default." +msgstr "" + +#: ../../library/typing.rst:2002 +msgid "" +"Return whether or not the type variable tuple has a default value. This is " +"equivalent to checking whether :attr:`__default__` is not the :data:`typing." +"NoDefault` singleton, except that it does not force evaluation of the :ref:" +"`lazily evaluated ` default value." +msgstr "" + +#: ../../library/typing.rst:2013 msgid "" "Type variable tuples can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:1848 +#: ../../library/typing.rst:2022 msgid "" "Parameter specification variable. A specialized version of :ref:`type " "variables `." msgstr "" -#: ../../library/typing.rst:1851 +#: ../../library/typing.rst:2025 msgid "" "In :ref:`type parameter lists `, parameter specifications can " "be declared with two asterisks (``**``)::" msgstr "" -#: ../../library/typing.rst:1854 +#: ../../library/typing.rst:2028 msgid "type IntFunc[**P] = Callable[P, int]" msgstr "type IntFunc[**P] = Callable[P, int]" -#: ../../library/typing.rst:1856 +#: ../../library/typing.rst:2030 msgid "" "For compatibility with Python 3.11 and earlier, ``ParamSpec`` objects can " "also be created as follows::" msgstr "" -#: ../../library/typing.rst:1859 +#: ../../library/typing.rst:2033 msgid "P = ParamSpec('P')" msgstr "P = ParamSpec('P')" -#: ../../library/typing.rst:1861 +#: ../../library/typing.rst:2035 msgid "" "Parameter specification variables exist primarily for the benefit of static " "type checkers. They are used to forward the parameter types of one callable " @@ -2998,7 +3220,7 @@ msgid "" "See :class:`Generic` for more information on generic types." msgstr "" -#: ../../library/typing.rst:1868 +#: ../../library/typing.rst:2042 msgid "" "For example, to add basic logging to a function, one can create a decorator " "``add_logging`` to log function calls. The parameter specification variable " @@ -3006,7 +3228,7 @@ msgid "" "new callable returned by it have inter-dependent type parameters::" msgstr "" -#: ../../library/typing.rst:1873 +#: ../../library/typing.rst:2047 msgid "" "from collections.abc import Callable\n" "import logging\n" @@ -3024,27 +3246,27 @@ msgid "" " return x + y" msgstr "" -#: ../../library/typing.rst:1888 +#: ../../library/typing.rst:2062 msgid "" "Without ``ParamSpec``, the simplest way to annotate this previously was to " "use a :class:`TypeVar` with bound ``Callable[..., Any]``. However this " "causes two problems:" msgstr "" -#: ../../library/typing.rst:1892 +#: ../../library/typing.rst:2066 msgid "" "The type checker can't type check the ``inner`` function because ``*args`` " "and ``**kwargs`` have to be typed :data:`Any`." msgstr "" -#: ../../library/typing.rst:1894 +#: ../../library/typing.rst:2068 msgid "" ":func:`~cast` may be required in the body of the ``add_logging`` decorator " "when returning the ``inner`` function, or the static type checker must be " "told to ignore the ``return inner``." msgstr "" -#: ../../library/typing.rst:1901 +#: ../../library/typing.rst:2075 msgid "" "Since ``ParamSpec`` captures both positional and keyword parameters, ``P." "args`` and ``P.kwargs`` can be used to split a ``ParamSpec`` into its " @@ -3057,11 +3279,25 @@ msgid "" "`ParamSpecKwargs`." msgstr "" -#: ../../library/typing.rst:1913 +#: ../../library/typing.rst:2087 msgid "The name of the parameter specification." msgstr "" -#: ../../library/typing.rst:1915 +#: ../../library/typing.rst:2091 +msgid "" +"The default value of the parameter specification, or :data:`typing." +"NoDefault` if it has no default." +msgstr "" + +#: ../../library/typing.rst:2098 +msgid "" +"Return whether or not the parameter specification has a default value. This " +"is equivalent to checking whether :attr:`__default__` is not the :data:" +"`typing.NoDefault` singleton, except that it does not force evaluation of " +"the :ref:`lazily evaluated ` default value." +msgstr "" + +#: ../../library/typing.rst:2105 msgid "" "Parameter specification variables created with ``covariant=True`` or " "``contravariant=True`` can be used to declare covariant or contravariant " @@ -3070,23 +3306,23 @@ msgid "" "decided." msgstr "" -#: ../../library/typing.rst:1925 +#: ../../library/typing.rst:2115 msgid "" "Parameter specifications can now be declared using the :ref:`type parameter " "` syntax introduced by :pep:`695`." msgstr "" -#: ../../library/typing.rst:1929 +#: ../../library/typing.rst:2123 msgid "" "Only parameter specification variables defined in global scope can be " "pickled." msgstr "" -#: ../../library/typing.rst:1935 +#: ../../library/typing.rst:2129 msgid ":data:`Concatenate`" msgstr ":data:`Concatenate`" -#: ../../library/typing.rst:1941 +#: ../../library/typing.rst:2135 msgid "" "Arguments and keyword arguments attributes of a :class:`ParamSpec`. The ``P." "args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``, and " @@ -3094,13 +3330,13 @@ msgid "" "runtime introspection and have no special meaning to static type checkers." msgstr "" -#: ../../library/typing.rst:1946 +#: ../../library/typing.rst:2140 msgid "" "Calling :func:`get_origin` on either of these objects will return the " "original ``ParamSpec``:" msgstr "" -#: ../../library/typing.rst:1949 +#: ../../library/typing.rst:2143 msgid "" ">>> from typing import ParamSpec, get_origin\n" ">>> P = ParamSpec(\"P\")\n" @@ -3116,11 +3352,11 @@ msgstr "" ">>> get_origin(P.kwargs) is P\n" "True" -#: ../../library/typing.rst:1963 +#: ../../library/typing.rst:2157 msgid "The type of type aliases created through the :keyword:`type` statement." msgstr "" -#: ../../library/typing.rst:1967 +#: ../../library/typing.rst:2161 msgid "" ">>> type Alias = int\n" ">>> type(Alias)\n" @@ -3130,11 +3366,11 @@ msgstr "" ">>> type(Alias)\n" "" -#: ../../library/typing.rst:1977 +#: ../../library/typing.rst:2171 msgid "The name of the type alias:" msgstr "" -#: ../../library/typing.rst:1979 +#: ../../library/typing.rst:2173 msgid "" ">>> type Alias = int\n" ">>> Alias.__name__\n" @@ -3144,11 +3380,11 @@ msgstr "" ">>> Alias.__name__\n" "'Alias'" -#: ../../library/typing.rst:1987 +#: ../../library/typing.rst:2181 msgid "The module in which the type alias was defined::" msgstr "" -#: ../../library/typing.rst:1989 +#: ../../library/typing.rst:2183 msgid "" ">>> type Alias = int\n" ">>> Alias.__module__\n" @@ -3158,13 +3394,13 @@ msgstr "" ">>> Alias.__module__\n" "'__main__'" -#: ../../library/typing.rst:1995 +#: ../../library/typing.rst:2189 msgid "" "The type parameters of the type alias, or an empty tuple if the alias is not " "generic:" msgstr "" -#: ../../library/typing.rst:1998 +#: ../../library/typing.rst:2192 msgid "" ">>> type ListOrSet[T] = list[T] | set[T]\n" ">>> ListOrSet.__type_params__\n" @@ -3180,14 +3416,14 @@ msgstr "" ">>> NotGeneric.__type_params__\n" "()" -#: ../../library/typing.rst:2009 +#: ../../library/typing.rst:2203 msgid "" "The type alias's value. This is :ref:`lazily evaluated `, " "so names used in the definition of the alias are not resolved until the " "``__value__`` attribute is accessed:" msgstr "" -#: ../../library/typing.rst:2013 +#: ../../library/typing.rst:2207 msgid "" ">>> type Mutually = Recursive\n" ">>> type Recursive = Mutually\n" @@ -3211,27 +3447,27 @@ msgstr "" ">>> Recursive.__value__\n" "Mutually" -#: ../../library/typing.rst:2027 +#: ../../library/typing.rst:2221 msgid "Other special directives" msgstr "" -#: ../../library/typing.rst:2029 +#: ../../library/typing.rst:2223 msgid "" "These functions and classes should not be used directly as annotations. " "Their intended purpose is to be building blocks for creating and declaring " "types." msgstr "" -#: ../../library/typing.rst:2035 +#: ../../library/typing.rst:2229 msgid "Typed version of :func:`collections.namedtuple`." msgstr "" -#: ../../library/typing.rst:2037 ../../library/typing.rst:2114 -#: ../../library/typing.rst:3083 +#: ../../library/typing.rst:2231 ../../library/typing.rst:2323 +#: ../../library/typing.rst:3364 msgid "Usage::" msgstr "" -#: ../../library/typing.rst:2039 +#: ../../library/typing.rst:2233 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3241,20 +3477,20 @@ msgstr "" " name: str\n" " id: int" -#: ../../library/typing.rst:2043 +#: ../../library/typing.rst:2237 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../library/typing.rst:2045 +#: ../../library/typing.rst:2239 msgid "Employee = collections.namedtuple('Employee', ['name', 'id'])" msgstr "Employee = collections.namedtuple('Employee', ['name', 'id'])" -#: ../../library/typing.rst:2047 +#: ../../library/typing.rst:2241 msgid "" "To give a field a default value, you can assign to it in the class body::" msgstr "" -#: ../../library/typing.rst:2049 +#: ../../library/typing.rst:2243 msgid "" "class Employee(NamedTuple):\n" " name: str\n" @@ -3270,12 +3506,12 @@ msgstr "" "employee = Employee('Guido')\n" "assert employee.id == 3" -#: ../../library/typing.rst:2056 +#: ../../library/typing.rst:2250 msgid "" "Fields with a default value must come after any fields without a default." msgstr "" -#: ../../library/typing.rst:2058 +#: ../../library/typing.rst:2252 msgid "" "The resulting class has an extra attribute ``__annotations__`` giving a dict " "that maps the field names to the field types. (The field names are in the " @@ -3284,11 +3520,11 @@ msgid "" "API.)" msgstr "" -#: ../../library/typing.rst:2064 +#: ../../library/typing.rst:2258 msgid "``NamedTuple`` subclasses can also have docstrings and methods::" msgstr "" -#: ../../library/typing.rst:2066 +#: ../../library/typing.rst:2260 msgid "" "class Employee(NamedTuple):\n" " \"\"\"Represents an employee.\"\"\"\n" @@ -3299,11 +3535,11 @@ msgid "" " return f''" msgstr "" -#: ../../library/typing.rst:2074 +#: ../../library/typing.rst:2268 msgid "``NamedTuple`` subclasses can be generic::" msgstr "" -#: ../../library/typing.rst:2076 +#: ../../library/typing.rst:2270 msgid "" "class Group[T](NamedTuple):\n" " key: T\n" @@ -3313,13 +3549,15 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2080 +#: ../../library/typing.rst:2274 msgid "Backward-compatible usage::" msgstr "" -#: ../../library/typing.rst:2082 +#: ../../library/typing.rst:2276 msgid "" -"# For creating a generic NamedTuple on Python 3.11 or lower\n" +"# For creating a generic NamedTuple on Python 3.11\n" +"T = TypeVar(\"T\")\n" +"\n" "class Group(NamedTuple, Generic[T]):\n" " key: T\n" " group: list[T]\n" @@ -3328,72 +3566,89 @@ msgid "" "Employee = NamedTuple('Employee', [('name', str), ('id', int)])" msgstr "" -#: ../../library/typing.rst:2090 +#: ../../library/typing.rst:2286 msgid "Added support for :pep:`526` variable annotation syntax." msgstr "" -#: ../../library/typing.rst:2093 +#: ../../library/typing.rst:2289 msgid "Added support for default values, methods, and docstrings." msgstr "" -#: ../../library/typing.rst:2096 +#: ../../library/typing.rst:2292 msgid "" "The ``_field_types`` and ``__annotations__`` attributes are now regular " "dictionaries instead of instances of ``OrderedDict``." msgstr "" -#: ../../library/typing.rst:2100 +#: ../../library/typing.rst:2296 msgid "" "Removed the ``_field_types`` attribute in favor of the more standard " "``__annotations__`` attribute which has the same information." msgstr "" -#: ../../library/typing.rst:2104 +#: ../../library/typing.rst:2300 msgid "Added support for generic namedtuples." msgstr "" -#: ../../library/typing.rst:2109 +#: ../../library/typing.rst:2303 +msgid "" +"The undocumented keyword argument syntax for creating NamedTuple classes " +"(``NT = NamedTuple(\"NT\", x=int)``) is deprecated, and will be disallowed " +"in 3.15. Use the class-based syntax or the functional syntax instead." +msgstr "" + +#: ../../library/typing.rst:2308 +msgid "" +"When using the functional syntax to create a NamedTuple class, failing to " +"pass a value to the 'fields' parameter (``NT = NamedTuple(\"NT\")``) is " +"deprecated. Passing ``None`` to the 'fields' parameter (``NT = " +"NamedTuple(\"NT\", None)``) is also deprecated. Both will be disallowed in " +"Python 3.15. To create a NamedTuple class with 0 fields, use ``class " +"NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", [])``." +msgstr "" + +#: ../../library/typing.rst:2318 msgid "Helper class to create low-overhead :ref:`distinct types `." msgstr "" -#: ../../library/typing.rst:2111 +#: ../../library/typing.rst:2320 msgid "" "A ``NewType`` is considered a distinct type by a typechecker. At runtime, " "however, calling a ``NewType`` returns its argument unchanged." msgstr "" -#: ../../library/typing.rst:2116 +#: ../../library/typing.rst:2325 msgid "" "UserId = NewType('UserId', int) # Declare the NewType \"UserId\"\n" "first_user = UserId(1) # \"UserId\" returns the argument unchanged at " "runtime" msgstr "" -#: ../../library/typing.rst:2121 +#: ../../library/typing.rst:2330 msgid "The module in which the new type is defined." msgstr "" -#: ../../library/typing.rst:2125 +#: ../../library/typing.rst:2334 msgid "The name of the new type." msgstr "" -#: ../../library/typing.rst:2129 +#: ../../library/typing.rst:2338 msgid "The type that the new type is based on." msgstr "" -#: ../../library/typing.rst:2133 +#: ../../library/typing.rst:2342 msgid "``NewType`` is now a class rather than a function." msgstr "" -#: ../../library/typing.rst:2138 +#: ../../library/typing.rst:2347 msgid "Base class for protocol classes." msgstr "" -#: ../../library/typing.rst:2140 +#: ../../library/typing.rst:2349 msgid "Protocol classes are defined like this::" msgstr "" -#: ../../library/typing.rst:2142 +#: ../../library/typing.rst:2351 msgid "" "class Proto(Protocol):\n" " def meth(self) -> int:\n" @@ -3403,13 +3658,13 @@ msgstr "" " def meth(self) -> int:\n" " ..." -#: ../../library/typing.rst:2146 +#: ../../library/typing.rst:2355 msgid "" "Such classes are primarily used with static type checkers that recognize " "structural subtyping (static duck-typing), for example::" msgstr "" -#: ../../library/typing.rst:2149 +#: ../../library/typing.rst:2358 msgid "" "class C:\n" " def meth(self) -> int:\n" @@ -3421,7 +3676,7 @@ msgid "" "func(C()) # Passes static type check" msgstr "" -#: ../../library/typing.rst:2158 +#: ../../library/typing.rst:2367 msgid "" "See :pep:`544` for more details. Protocol classes decorated with :func:" "`runtime_checkable` (described later) act as simple-minded runtime protocols " @@ -3429,11 +3684,11 @@ msgid "" "signatures." msgstr "" -#: ../../library/typing.rst:2163 +#: ../../library/typing.rst:2372 msgid "Protocol classes can be generic, for example::" msgstr "" -#: ../../library/typing.rst:2165 +#: ../../library/typing.rst:2374 msgid "" "class GenProto[T](Protocol):\n" " def meth(self) -> T:\n" @@ -3443,13 +3698,13 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2169 +#: ../../library/typing.rst:2378 msgid "" "In code that needs to be compatible with Python 3.11 or older, generic " "Protocols can be written as follows::" msgstr "" -#: ../../library/typing.rst:2172 +#: ../../library/typing.rst:2381 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -3463,11 +3718,11 @@ msgstr "" " def meth(self) -> T:\n" " ..." -#: ../../library/typing.rst:2182 +#: ../../library/typing.rst:2391 msgid "Mark a protocol class as a runtime protocol." msgstr "" -#: ../../library/typing.rst:2184 +#: ../../library/typing.rst:2393 msgid "" "Such a protocol can be used with :func:`isinstance` and :func:`issubclass`. " "This raises :exc:`TypeError` when applied to a non-protocol class. This " @@ -3476,7 +3731,7 @@ msgid "" "Iterable`. For example::" msgstr "" -#: ../../library/typing.rst:2189 +#: ../../library/typing.rst:2398 msgid "" "@runtime_checkable\n" "class Closable(Protocol):\n" @@ -3504,7 +3759,7 @@ msgstr "" "import threading\n" "assert isinstance(threading.Thread(name='Bob'), Named)" -#: ../../library/typing.rst:2204 +#: ../../library/typing.rst:2413 msgid "" ":func:`!runtime_checkable` will check only the presence of the required " "methods or attributes, not their type signatures or types. For example, :" @@ -3515,7 +3770,7 @@ msgid "" "(instantiate) :class:`ssl.SSLObject`." msgstr "" -#: ../../library/typing.rst:2215 +#: ../../library/typing.rst:2424 msgid "" "An :func:`isinstance` check against a runtime-checkable protocol can be " "surprisingly slow compared to an ``isinstance()`` check against a non-" @@ -3523,7 +3778,7 @@ msgid "" "calls for structural checks in performance-sensitive code." msgstr "" -#: ../../library/typing.rst:2223 +#: ../../library/typing.rst:2432 msgid "" "The internal implementation of :func:`isinstance` checks against runtime-" "checkable protocols now uses :func:`inspect.getattr_static` to look up " @@ -3533,7 +3788,7 @@ msgid "" "versa. Most users are unlikely to be affected by this change." msgstr "" -#: ../../library/typing.rst:2232 +#: ../../library/typing.rst:2441 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " @@ -3542,13 +3797,13 @@ msgid "" "`\"What's new in Python 3.12\" ` for more details." msgstr "" -#: ../../library/typing.rst:2243 +#: ../../library/typing.rst:2452 msgid "" "Special construct to add type hints to a dictionary. At runtime it is a " "plain :class:`dict`." msgstr "" -#: ../../library/typing.rst:2246 +#: ../../library/typing.rst:2455 msgid "" "``TypedDict`` declares a dictionary type that expects all of its instances " "to have a certain set of keys, where each key is associated with a value of " @@ -3556,7 +3811,7 @@ msgid "" "enforced by type checkers. Usage::" msgstr "" -#: ../../library/typing.rst:2252 +#: ../../library/typing.rst:2461 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3569,43 +3824,24 @@ msgid "" "assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')" msgstr "" -#: ../../library/typing.rst:2262 +#: ../../library/typing.rst:2471 msgid "" -"To allow using this feature with older versions of Python that do not " -"support :pep:`526`, ``TypedDict`` supports two additional equivalent " -"syntactic forms:" -msgstr "" - -#: ../../library/typing.rst:2266 -msgid "Using a literal :class:`dict` as the second argument::" +"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:2268 +#: ../../library/typing.rst:2474 msgid "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" msgstr "Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})" -#: ../../library/typing.rst:2270 -msgid "Using keyword arguments::" -msgstr "" - -#: ../../library/typing.rst:2272 -msgid "Point2D = TypedDict('Point2D', x=int, y=int, label=str)" -msgstr "Point2D = TypedDict('Point2D', x=int, y=int, label=str)" - -#: ../../library/typing.rst:2274 +#: ../../library/typing.rst:2476 msgid "" -"The keyword-argument syntax is deprecated in 3.11 and will be removed in " -"3.13. It may also be unsupported by static type checkers." +"This functional syntax allows defining keys which are not valid :ref:" +"`identifiers `, for example because they are keywords or " +"contain hyphens::" msgstr "" -#: ../../library/typing.rst:2278 -msgid "" -"The functional syntax should also be used when any of the keys are not " -"valid :ref:`identifiers `, for example because they are " -"keywords or contain hyphens. Example::" -msgstr "" - -#: ../../library/typing.rst:2282 +#: ../../library/typing.rst:2480 msgid "" "# raises SyntaxError\n" "class Point2D(TypedDict):\n" @@ -3616,13 +3852,13 @@ msgid "" "Point2D = TypedDict('Point2D', {'in': int, 'x-y': int})" msgstr "" -#: ../../library/typing.rst:2290 +#: ../../library/typing.rst:2488 msgid "" "By default, all keys must be present in a ``TypedDict``. It is possible to " "mark individual keys as non-required using :data:`NotRequired`::" msgstr "" -#: ../../library/typing.rst:2293 +#: ../../library/typing.rst:2491 msgid "" "class Point2D(TypedDict):\n" " x: int\n" @@ -3634,19 +3870,19 @@ msgid "" "NotRequired[str]})" msgstr "" -#: ../../library/typing.rst:2301 +#: ../../library/typing.rst:2499 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have the ``label`` key " "omitted." msgstr "" -#: ../../library/typing.rst:2304 +#: ../../library/typing.rst:2502 msgid "" "It is also possible to mark all keys as non-required by default by " "specifying a totality of ``False``::" msgstr "" -#: ../../library/typing.rst:2307 +#: ../../library/typing.rst:2505 msgid "" "class Point2D(TypedDict, total=False):\n" " x: int\n" @@ -3656,7 +3892,7 @@ msgid "" "Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)" msgstr "" -#: ../../library/typing.rst:2314 +#: ../../library/typing.rst:2512 msgid "" "This means that a ``Point2D`` ``TypedDict`` can have any of the keys " "omitted. A type checker is only expected to support a literal ``False`` or " @@ -3664,13 +3900,13 @@ msgid "" "and makes all items defined in the class body required." msgstr "" -#: ../../library/typing.rst:2319 +#: ../../library/typing.rst:2517 msgid "" "Individual keys of a ``total=False`` ``TypedDict`` can be marked as required " "using :data:`Required`::" msgstr "" -#: ../../library/typing.rst:2322 +#: ../../library/typing.rst:2520 msgid "" "class Point2D(TypedDict, total=False):\n" " x: Required[int]\n" @@ -3685,13 +3921,13 @@ msgid "" "}, total=False)" msgstr "" -#: ../../library/typing.rst:2334 +#: ../../library/typing.rst:2532 msgid "" "It is possible for a ``TypedDict`` type to inherit from one or more other " "``TypedDict`` types using the class-based syntax. Usage::" msgstr "" -#: ../../library/typing.rst:2338 +#: ../../library/typing.rst:2536 msgid "" "class Point3D(Point2D):\n" " z: int" @@ -3699,13 +3935,13 @@ msgstr "" "class Point3D(Point2D):\n" " z: int" -#: ../../library/typing.rst:2341 +#: ../../library/typing.rst:2539 msgid "" "``Point3D`` has three items: ``x``, ``y`` and ``z``. It is equivalent to " "this definition::" msgstr "" -#: ../../library/typing.rst:2344 +#: ../../library/typing.rst:2542 msgid "" "class Point3D(TypedDict):\n" " x: int\n" @@ -3717,13 +3953,13 @@ msgstr "" " y: int\n" " z: int" -#: ../../library/typing.rst:2349 +#: ../../library/typing.rst:2547 msgid "" "A ``TypedDict`` cannot inherit from a non-\\ ``TypedDict`` class, except " "for :class:`Generic`. For example::" msgstr "" -#: ../../library/typing.rst:2352 +#: ../../library/typing.rst:2550 msgid "" "class X(TypedDict):\n" " x: int\n" @@ -3738,11 +3974,11 @@ msgid "" "class XZ(X, Z): pass # raises TypeError" msgstr "" -#: ../../library/typing.rst:2364 +#: ../../library/typing.rst:2562 msgid "A ``TypedDict`` can be generic::" msgstr "" -#: ../../library/typing.rst:2366 +#: ../../library/typing.rst:2564 msgid "" "class Group[T](TypedDict):\n" " key: T\n" @@ -3752,13 +3988,13 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2370 +#: ../../library/typing.rst:2568 msgid "" "To create a generic ``TypedDict`` that is compatible with Python 3.11 or " "lower, inherit from :class:`Generic` explicitly:" msgstr "" -#: ../../library/typing.rst:2373 +#: ../../library/typing.rst:2571 msgid "" "T = TypeVar(\"T\")\n" "\n" @@ -3772,19 +4008,19 @@ msgstr "" " key: T\n" " group: list[T]" -#: ../../library/typing.rst:2381 +#: ../../library/typing.rst:2579 msgid "" "A ``TypedDict`` can be introspected via annotations dicts (see :ref:" "`annotations-howto` for more information on annotations best practices), :" "attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`." msgstr "" -#: ../../library/typing.rst:2387 +#: ../../library/typing.rst:2585 msgid "" "``Point2D.__total__`` gives the value of the ``total`` argument. Example:" msgstr "" -#: ../../library/typing.rst:2390 +#: ../../library/typing.rst:2588 msgid "" ">>> from typing import TypedDict\n" ">>> class Point2D(TypedDict): pass\n" @@ -3808,7 +4044,7 @@ msgstr "" ">>> Point3D.__total__\n" "True" -#: ../../library/typing.rst:2403 +#: ../../library/typing.rst:2601 msgid "" "This attribute reflects *only* the value of the ``total`` argument to the " "current ``TypedDict`` class, not whether the class is semantically total. " @@ -3819,21 +4055,21 @@ msgid "" "introspection." msgstr "" -#: ../../library/typing.rst:2416 +#: ../../library/typing.rst:2614 msgid "" "``Point2D.__required_keys__`` and ``Point2D.__optional_keys__`` return :" "class:`frozenset` objects containing required and non-required keys, " "respectively." msgstr "" -#: ../../library/typing.rst:2419 +#: ../../library/typing.rst:2617 msgid "" "Keys marked with :data:`Required` will always appear in " "``__required_keys__`` and keys marked with :data:`NotRequired` will always " "appear in ``__optional_keys__``." msgstr "" -#: ../../library/typing.rst:2422 +#: ../../library/typing.rst:2620 msgid "" "For backwards compatibility with Python 3.10 and below, it is also possible " "to use inheritance to declare both required and non-required keys in the " @@ -3842,7 +4078,7 @@ msgid "" "``TypedDict`` with a different value for ``total``:" msgstr "" -#: ../../library/typing.rst:2429 +#: ../../library/typing.rst:2627 msgid "" ">>> class Point2D(TypedDict, total=False):\n" "... x: int\n" @@ -3868,7 +4104,7 @@ msgstr "" ">>> Point3D.__optional_keys__ == frozenset({'x', 'y'})\n" "True" -#: ../../library/typing.rst:2447 +#: ../../library/typing.rst:2645 msgid "" "If ``from __future__ import annotations`` is used or if annotations are " "given as strings, annotations are not evaluated when the ``TypedDict`` is " @@ -3877,121 +4113,157 @@ msgid "" "attributes may be incorrect." msgstr "" -#: ../../library/typing.rst:2453 +#: ../../library/typing.rst:2651 +msgid "Support for :data:`ReadOnly` is reflected in the following attributes:" +msgstr "" + +#: ../../library/typing.rst:2655 +msgid "" +"A :class:`frozenset` containing the names of all read-only keys. Keys are " +"read-only if they carry the :data:`ReadOnly` qualifier." +msgstr "" + +#: ../../library/typing.rst:2662 +msgid "" +"A :class:`frozenset` containing the names of all mutable keys. Keys are " +"mutable if they do not carry the :data:`ReadOnly` qualifier." +msgstr "" + +#: ../../library/typing.rst:2667 msgid "" "See :pep:`589` for more examples and detailed rules of using ``TypedDict``." msgstr "" -#: ../../library/typing.rst:2457 +#: ../../library/typing.rst:2671 msgid "" "Added support for marking individual keys as :data:`Required` or :data:" "`NotRequired`. See :pep:`655`." msgstr "" -#: ../../library/typing.rst:2461 +#: ../../library/typing.rst:2675 msgid "Added support for generic ``TypedDict``\\ s." msgstr "" -#: ../../library/typing.rst:2465 +#: ../../library/typing.rst:2678 +msgid "" +"Removed support for the keyword-argument method of creating ``TypedDict``\\ " +"s." +msgstr "" + +#: ../../library/typing.rst:2681 +msgid "Support for the :data:`ReadOnly` qualifier was added." +msgstr "" + +#: ../../library/typing.rst:2684 +msgid "" +"When using the functional syntax to create a TypedDict class, failing to " +"pass a value to the 'fields' parameter (``TD = TypedDict(\"TD\")``) is " +"deprecated. Passing ``None`` to the 'fields' parameter (``TD = " +"TypedDict(\"TD\", None)``) is also deprecated. Both will be disallowed in " +"Python 3.15. To create a TypedDict class with 0 fields, use ``class " +"TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." +msgstr "" + +#: ../../library/typing.rst:2693 msgid "Protocols" msgstr "協定" -#: ../../library/typing.rst:2467 +#: ../../library/typing.rst:2695 msgid "" "The following protocols are provided by the typing module. All are decorated " "with :func:`@runtime_checkable `." msgstr "" -#: ../../library/typing.rst:2472 +#: ../../library/typing.rst:2700 msgid "" "An ABC with one abstract method ``__abs__`` that is covariant in its return " "type." msgstr "" -#: ../../library/typing.rst:2477 +#: ../../library/typing.rst:2705 msgid "An ABC with one abstract method ``__bytes__``." msgstr "一個有抽象方法 ``__bytes__`` 的 ABC。" -#: ../../library/typing.rst:2481 +#: ../../library/typing.rst:2709 msgid "An ABC with one abstract method ``__complex__``." msgstr "一個有抽象方法 ``__complex__`` 的 ABC。" -#: ../../library/typing.rst:2485 +#: ../../library/typing.rst:2713 msgid "An ABC with one abstract method ``__float__``." msgstr "一個有抽象方法 ``__float__`` 的 ABC。" -#: ../../library/typing.rst:2489 +#: ../../library/typing.rst:2717 msgid "An ABC with one abstract method ``__index__``." msgstr "一個有抽象方法 ``__index__`` 的 ABC。" -#: ../../library/typing.rst:2495 +#: ../../library/typing.rst:2723 msgid "An ABC with one abstract method ``__int__``." msgstr "一個有抽象方法 ``__int__`` 的 ABC。" -#: ../../library/typing.rst:2499 +#: ../../library/typing.rst:2727 msgid "" "An ABC with one abstract method ``__round__`` that is covariant in its " "return type." msgstr "" -#: ../../library/typing.rst:2503 +#: ../../library/typing.rst:2731 msgid "ABCs for working with IO" msgstr "" -#: ../../library/typing.rst:2509 +#: ../../library/typing.rst:2737 msgid "" "Generic type ``IO[AnyStr]`` and its subclasses ``TextIO(IO[str])`` and " "``BinaryIO(IO[bytes])`` represent the types of I/O streams such as returned " "by :func:`open`." msgstr "" -#: ../../library/typing.rst:2515 +#: ../../library/typing.rst:2743 msgid "Functions and decorators" msgstr "函式與裝飾器" -#: ../../library/typing.rst:2519 +#: ../../library/typing.rst:2747 msgid "Cast a value to a type." msgstr "" -#: ../../library/typing.rst:2521 +#: ../../library/typing.rst:2749 msgid "" "This returns the value unchanged. To the type checker this signals that the " "return value has the designated type, but at runtime we intentionally don't " "check anything (we want this to be as fast as possible)." msgstr "" -#: ../../library/typing.rst:2528 +#: ../../library/typing.rst:2756 msgid "" "Ask a static type checker to confirm that *val* has an inferred type of " "*typ*." msgstr "" -#: ../../library/typing.rst:2530 +#: ../../library/typing.rst:2758 msgid "" "At runtime this does nothing: it returns the first argument unchanged with " "no checks or side effects, no matter the actual type of the argument." msgstr "" -#: ../../library/typing.rst:2533 +#: ../../library/typing.rst:2761 msgid "" "When a static type checker encounters a call to ``assert_type()``, it emits " "an error if the value is not of the specified type::" msgstr "" -#: ../../library/typing.rst:2536 +#: ../../library/typing.rst:2764 msgid "" "def greet(name: str) -> None:\n" " assert_type(name, str) # OK, inferred type of `name` is `str`\n" " assert_type(name, int) # type checker error" msgstr "" -#: ../../library/typing.rst:2540 +#: ../../library/typing.rst:2768 msgid "" "This function is useful for ensuring the type checker's understanding of a " "script is in line with the developer's intentions::" msgstr "" -#: ../../library/typing.rst:2543 +#: ../../library/typing.rst:2771 msgid "" "def complex_function(arg: object):\n" " # Do some complex type-narrowing logic,\n" @@ -4001,16 +4273,16 @@ msgid "" " assert_type(arg, int)" msgstr "" -#: ../../library/typing.rst:2554 +#: ../../library/typing.rst:2782 msgid "" "Ask a static type checker to confirm that a line of code is unreachable." msgstr "" -#: ../../library/typing.rst:2556 +#: ../../library/typing.rst:2784 msgid "Example::" msgstr "舉例來說: ::" -#: ../../library/typing.rst:2558 +#: ../../library/typing.rst:2786 msgid "" "def int_or_str(arg: int | str) -> None:\n" " match arg:\n" @@ -4030,14 +4302,14 @@ msgstr "" " case _ as unreachable:\n" " assert_never(unreachable)" -#: ../../library/typing.rst:2567 +#: ../../library/typing.rst:2795 msgid "" "Here, the annotations allow the type checker to infer that the last case can " "never execute, because ``arg`` is either an :class:`int` or a :class:`str`, " "and both options are covered by earlier cases." msgstr "" -#: ../../library/typing.rst:2572 +#: ../../library/typing.rst:2800 msgid "" "If a type checker finds that a call to ``assert_never()`` is reachable, it " "will emit an error. For example, if the type annotation for ``arg`` was " @@ -4047,47 +4319,47 @@ msgid "" "passed in must be the bottom type, :data:`Never`, and nothing else." msgstr "" -#: ../../library/typing.rst:2580 +#: ../../library/typing.rst:2808 msgid "At runtime, this throws an exception when called." msgstr "" -#: ../../library/typing.rst:2583 +#: ../../library/typing.rst:2811 msgid "" "`Unreachable Code and Exhaustiveness Checking `__ has more information about " "exhaustiveness checking with static typing." msgstr "" -#: ../../library/typing.rst:2591 +#: ../../library/typing.rst:2819 msgid "Ask a static type checker to reveal the inferred type of an expression." msgstr "" -#: ../../library/typing.rst:2593 +#: ../../library/typing.rst:2821 msgid "" "When a static type checker encounters a call to this function, it emits a " "diagnostic with the inferred type of the argument. For example::" msgstr "" -#: ../../library/typing.rst:2596 +#: ../../library/typing.rst:2824 msgid "" "x: int = 1\n" "reveal_type(x) # Revealed type is \"builtins.int\"" msgstr "" -#: ../../library/typing.rst:2599 +#: ../../library/typing.rst:2827 msgid "" "This can be useful when you want to debug how your type checker handles a " "particular piece of code." msgstr "" -#: ../../library/typing.rst:2602 +#: ../../library/typing.rst:2830 msgid "" "At runtime, this function prints the runtime type of its argument to :data:" "`sys.stderr` and returns the argument unchanged (allowing the call to be " "used within an expression)::" msgstr "" -#: ../../library/typing.rst:2606 +#: ../../library/typing.rst:2834 msgid "" "x = reveal_type(1) # prints \"Runtime type is int\"\n" "print(x) # prints \"1\"" @@ -4095,13 +4367,13 @@ msgstr "" "x = reveal_type(1) # 印出 \"Runtime type is int\"\n" "print(x) # 印出 \"1\"" -#: ../../library/typing.rst:2609 +#: ../../library/typing.rst:2837 msgid "" "Note that the runtime type may be different from (more or less specific " "than) the type statically inferred by a type checker." msgstr "" -#: ../../library/typing.rst:2612 +#: ../../library/typing.rst:2840 msgid "" "Most type checkers support ``reveal_type()`` anywhere, even if the name is " "not imported from ``typing``. Importing the name from ``typing``, however, " @@ -4109,13 +4381,13 @@ msgid "" "clearly." msgstr "" -#: ../../library/typing.rst:2623 +#: ../../library/typing.rst:2851 msgid "" "Decorator to mark an object as providing :func:`dataclass `-like behavior." msgstr "" -#: ../../library/typing.rst:2626 +#: ../../library/typing.rst:2854 msgid "" "``dataclass_transform`` may be used to decorate a class, metaclass, or a " "function that is itself a decorator. The presence of " @@ -4124,11 +4396,11 @@ msgid "" "to :func:`@dataclasses.dataclass `." msgstr "" -#: ../../library/typing.rst:2633 +#: ../../library/typing.rst:2861 msgid "Example usage with a decorator function:" msgstr "" -#: ../../library/typing.rst:2635 +#: ../../library/typing.rst:2863 msgid "" "@dataclass_transform()\n" "def create_model[T](cls: type[T]) -> type[T]:\n" @@ -4150,11 +4422,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2647 +#: ../../library/typing.rst:2875 msgid "On a base class::" msgstr "" -#: ../../library/typing.rst:2649 +#: ../../library/typing.rst:2877 msgid "" "@dataclass_transform()\n" "class ModelBase: ...\n" @@ -4170,11 +4442,11 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2656 +#: ../../library/typing.rst:2884 msgid "On a metaclass::" msgstr "" -#: ../../library/typing.rst:2658 +#: ../../library/typing.rst:2886 msgid "" "@dataclass_transform()\n" "class ModelMeta(type): ...\n" @@ -4194,7 +4466,7 @@ msgstr "" " id: int\n" " name: str" -#: ../../library/typing.rst:2667 +#: ../../library/typing.rst:2895 msgid "" "The ``CustomerModel`` classes defined above will be treated by type checkers " "similarly to classes created with :func:`@dataclasses.dataclass None:\n" @@ -4400,24 +4672,24 @@ msgid "" " ... # actual implementation goes here" msgstr "" -#: ../../library/typing.rst:2795 +#: ../../library/typing.rst:3023 msgid "" "See :pep:`484` for more details and comparison with other typing semantics." msgstr "" -#: ../../library/typing.rst:2797 +#: ../../library/typing.rst:3025 msgid "" "Overloaded functions can now be introspected at runtime using :func:" "`get_overloads`." msgstr "" -#: ../../library/typing.rst:2804 +#: ../../library/typing.rst:3032 msgid "" "Return a sequence of :func:`@overload `-decorated definitions for " "*func*." msgstr "" -#: ../../library/typing.rst:2807 +#: ../../library/typing.rst:3035 msgid "" "*func* is the function object for the implementation of the overloaded " "function. For example, given the definition of ``process`` in the " @@ -4427,32 +4699,32 @@ msgid "" "returns an empty sequence." msgstr "" -#: ../../library/typing.rst:2814 +#: ../../library/typing.rst:3042 msgid "" "``get_overloads()`` can be used for introspecting an overloaded function at " "runtime." msgstr "" -#: ../../library/typing.rst:2822 +#: ../../library/typing.rst:3050 msgid "Clear all registered overloads in the internal registry." msgstr "" -#: ../../library/typing.rst:2824 +#: ../../library/typing.rst:3052 msgid "This can be used to reclaim the memory used by the registry." msgstr "" -#: ../../library/typing.rst:2831 +#: ../../library/typing.rst:3059 msgid "Decorator to indicate final methods and final classes." msgstr "" -#: ../../library/typing.rst:2833 +#: ../../library/typing.rst:3061 msgid "" "Decorating a method with ``@final`` indicates to a type checker that the " "method cannot be overridden in a subclass. Decorating a class with " "``@final`` indicates that it cannot be subclassed." msgstr "" -#: ../../library/typing.rst:2839 +#: ../../library/typing.rst:3067 msgid "" "class Base:\n" " @final\n" @@ -4469,7 +4741,7 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:2858 +#: ../../library/typing.rst:3086 msgid "" "The decorator will now attempt to set a ``__final__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, \"__final__\", " @@ -4479,11 +4751,11 @@ msgid "" "exception." msgstr "" -#: ../../library/typing.rst:2869 +#: ../../library/typing.rst:3097 msgid "Decorator to indicate that annotations are not type hints." msgstr "" -#: ../../library/typing.rst:2871 +#: ../../library/typing.rst:3099 msgid "" "This works as a class or function :term:`decorator`. With a class, it " "applies recursively to all methods and classes defined in that class (but " @@ -4491,34 +4763,40 @@ msgid "" "will ignore all annotations in a function or class with this decorator." msgstr "" -#: ../../library/typing.rst:2877 +#: ../../library/typing.rst:3105 msgid "``@no_type_check`` mutates the decorated object in place." msgstr "" -#: ../../library/typing.rst:2881 +#: ../../library/typing.rst:3109 msgid "Decorator to give another decorator the :func:`no_type_check` effect." msgstr "" -#: ../../library/typing.rst:2883 +#: ../../library/typing.rst:3111 msgid "" "This wraps the decorator with something that wraps the decorated function " "in :func:`no_type_check`." msgstr "" -#: ../../library/typing.rst:2889 +#: ../../library/typing.rst:3114 +msgid "" +"No type checker ever added support for ``@no_type_check_decorator``. It is " +"therefore deprecated, and will be removed in Python 3.15." +msgstr "" + +#: ../../library/typing.rst:3120 msgid "" "Decorator to indicate that a method in a subclass is intended to override a " "method or attribute in a superclass." msgstr "" -#: ../../library/typing.rst:2892 +#: ../../library/typing.rst:3123 msgid "" "Type checkers should emit an error if a method decorated with ``@override`` " "does not, in fact, override anything. This helps prevent bugs that may occur " "when a base class is changed without an equivalent change to a child class." msgstr "" -#: ../../library/typing.rst:2899 +#: ../../library/typing.rst:3130 msgid "" "class Base:\n" " def log_status(self) -> None:\n" @@ -4534,11 +4812,11 @@ msgid "" " ..." msgstr "" -#: ../../library/typing.rst:2914 +#: ../../library/typing.rst:3145 msgid "There is no runtime checking of this property." msgstr "" -#: ../../library/typing.rst:2916 +#: ../../library/typing.rst:3147 msgid "" "The decorator will attempt to set an ``__override__`` attribute to ``True`` " "on the decorated object. Thus, a check like ``if getattr(obj, " @@ -4548,22 +4826,22 @@ msgid "" "without raising an exception." msgstr "" -#: ../../library/typing.rst:2923 +#: ../../library/typing.rst:3154 msgid "See :pep:`698` for more details." msgstr "更多細節請見 :pep:`698`。" -#: ../../library/typing.rst:2930 +#: ../../library/typing.rst:3161 msgid "Decorator to mark a class or function as unavailable at runtime." msgstr "" -#: ../../library/typing.rst:2932 +#: ../../library/typing.rst:3163 msgid "" "This decorator is itself not available at runtime. It is mainly intended to " "mark classes that are defined in type stub files if an implementation " "returns an instance of a private class::" msgstr "" -#: ../../library/typing.rst:2936 +#: ../../library/typing.rst:3167 msgid "" "@type_check_only\n" "class Response: # private or not available at runtime\n" @@ -4573,29 +4851,29 @@ msgid "" "def fetch_response() -> Response: ..." msgstr "" -#: ../../library/typing.rst:2943 +#: ../../library/typing.rst:3174 msgid "" "Note that returning instances of private classes is not recommended. It is " "usually preferable to make such classes public." msgstr "" -#: ../../library/typing.rst:2947 +#: ../../library/typing.rst:3178 msgid "Introspection helpers" msgstr "" -#: ../../library/typing.rst:2951 +#: ../../library/typing.rst:3182 msgid "" "Return a dictionary containing type hints for a function, method, module or " "class object." msgstr "" -#: ../../library/typing.rst:2954 +#: ../../library/typing.rst:3185 msgid "" "This is often the same as ``obj.__annotations__``, but this function makes " "the following changes to the annotations dictionary:" msgstr "" -#: ../../library/typing.rst:2957 +#: ../../library/typing.rst:3188 msgid "" "Forward references encoded as string literals or :class:`ForwardRef` objects " "are handled by evaluating them in *globalns*, *localns*, and (where " @@ -4604,40 +4882,40 @@ msgid "" "inferred from *obj*." msgstr "" -#: ../../library/typing.rst:2962 +#: ../../library/typing.rst:3193 msgid "``None`` is replaced with :class:`types.NoneType`." msgstr "" -#: ../../library/typing.rst:2963 +#: ../../library/typing.rst:3194 msgid "" "If :func:`@no_type_check ` has been applied to *obj*, an " "empty dictionary is returned." msgstr "" -#: ../../library/typing.rst:2965 +#: ../../library/typing.rst:3196 msgid "" "If *obj* is a class ``C``, the function returns a dictionary that merges " "annotations from ``C``'s base classes with those on ``C`` directly. This is " -"done by traversing ``C.__mro__`` and iteratively combining " -"``__annotations__`` dictionaries. Annotations on classes appearing earlier " -"in the :term:`method resolution order` always take precedence over " +"done by traversing :attr:`C.__mro__ ` and iteratively " +"combining ``__annotations__`` dictionaries. Annotations on classes appearing " +"earlier in the :term:`method resolution order` always take precedence over " "annotations on classes appearing later in the method resolution order." msgstr "" -#: ../../library/typing.rst:2971 +#: ../../library/typing.rst:3203 msgid "" "The function recursively replaces all occurrences of ``Annotated[T, ...]`` " "with ``T``, unless *include_extras* is set to ``True`` (see :class:" "`Annotated` for more information)." msgstr "" -#: ../../library/typing.rst:2975 +#: ../../library/typing.rst:3207 msgid "" "See also :func:`inspect.get_annotations`, a lower-level function that " "returns annotations more directly." msgstr "" -#: ../../library/typing.rst:2980 +#: ../../library/typing.rst:3212 msgid "" "If any forward references in the annotations of *obj* are not resolvable or " "are not valid Python code, this function will raise an exception such as :" @@ -4646,7 +4924,7 @@ msgid "" "imported under :data:`if TYPE_CHECKING `." msgstr "" -#: ../../library/typing.rst:2986 +#: ../../library/typing.rst:3218 msgid "" "Added ``include_extras`` parameter as part of :pep:`593`. See the " "documentation on :data:`Annotated` for more information." @@ -4654,20 +4932,20 @@ msgstr "" "新增 ``include_extras`` 參數(如 :pep:`593` 中所述)。更多資訊請見 :data:" "`Annotated` 的文件。" -#: ../../library/typing.rst:2990 +#: ../../library/typing.rst:3222 msgid "" "Previously, ``Optional[t]`` was added for function and method annotations if " "a default value equal to ``None`` was set. Now the annotation is returned " "unchanged." msgstr "" -#: ../../library/typing.rst:2997 +#: ../../library/typing.rst:3229 msgid "" "Get the unsubscripted version of a type: for a typing object of the form " "``X[Y, Z, ...]`` return ``X``." msgstr "" -#: ../../library/typing.rst:3000 +#: ../../library/typing.rst:3232 msgid "" "If ``X`` is a typing-module alias for a builtin or :mod:`collections` class, " "it will be normalized to the original class. If ``X`` is an instance of :" @@ -4675,15 +4953,16 @@ msgid "" "class:`ParamSpec`. Return ``None`` for unsupported objects." msgstr "" -#: ../../library/typing.rst:3006 ../../library/typing.rst:3029 +#: ../../library/typing.rst:3238 ../../library/typing.rst:3262 msgid "Examples:" msgstr "舉例:" -#: ../../library/typing.rst:3008 +#: ../../library/typing.rst:3240 msgid "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" "assert get_origin(Union[int, str]) is Union\n" +"assert get_origin(Annotated[str, \"metadata\"]) is Annotated\n" "P = ParamSpec('P')\n" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" @@ -4691,17 +4970,18 @@ msgstr "" "assert get_origin(str) is None\n" "assert get_origin(Dict[str, int]) is dict\n" "assert get_origin(Union[int, str]) is Union\n" +"assert get_origin(Annotated[str, \"metadata\"]) is Annotated\n" "P = ParamSpec('P')\n" "assert get_origin(P.args) is P\n" "assert get_origin(P.kwargs) is P" -#: ../../library/typing.rst:3021 +#: ../../library/typing.rst:3254 msgid "" "Get type arguments with all substitutions performed: for a typing object of " "the form ``X[Y, Z, ...]`` return ``(Y, Z, ...)``." msgstr "" -#: ../../library/typing.rst:3024 +#: ../../library/typing.rst:3257 msgid "" "If ``X`` is a union or :class:`Literal` contained in another generic type, " "the order of ``(Y, Z, ...)`` may be different from the order of the original " @@ -4709,7 +4989,7 @@ msgid "" "objects." msgstr "" -#: ../../library/typing.rst:3031 +#: ../../library/typing.rst:3264 msgid "" "assert get_args(int) == ()\n" "assert get_args(Dict[int, str]) == (int, str)\n" @@ -4719,11 +4999,43 @@ msgstr "" "assert get_args(Dict[int, str]) == (int, str)\n" "assert get_args(Union[int, str]) == (int, str)" -#: ../../library/typing.rst:3041 +#: ../../library/typing.rst:3274 +msgid "Return the set of members defined in a :class:`Protocol`." +msgstr "" + +#: ../../library/typing.rst:3276 +msgid "" +">>> from typing import Protocol, get_protocol_members\n" +">>> class P(Protocol):\n" +"... def a(self) -> str: ...\n" +"... b: int\n" +">>> get_protocol_members(P) == frozenset({'a', 'b'})\n" +"True" +msgstr "" + +#: ../../library/typing.rst:3285 +msgid "Raise :exc:`TypeError` for arguments that are not Protocols." +msgstr "" + +#: ../../library/typing.rst:3291 +msgid "Determine if a type is a :class:`Protocol`." +msgstr "確定一個型別是否 :class:`Protocol`。" + +#: ../../library/typing.rst:3295 +msgid "" +"class P(Protocol):\n" +" def a(self) -> str: ...\n" +" b: int\n" +"\n" +"is_protocol(P) # => True\n" +"is_protocol(int) # => False" +msgstr "" + +#: ../../library/typing.rst:3306 msgid "Check if a type is a :class:`TypedDict`." msgstr "" -#: ../../library/typing.rst:3045 +#: ../../library/typing.rst:3310 msgid "" "class Film(TypedDict):\n" " title: str\n" @@ -4737,36 +5049,52 @@ msgid "" "assert not is_typeddict(TypedDict)" msgstr "" -#: ../../library/typing.rst:3062 +#: ../../library/typing.rst:3327 msgid "" "Class used for internal typing representation of string forward references." msgstr "" -#: ../../library/typing.rst:3064 +#: ../../library/typing.rst:3329 msgid "" "For example, ``List[\"SomeClass\"]`` is implicitly transformed into " "``List[ForwardRef(\"SomeClass\")]``. ``ForwardRef`` should not be " "instantiated by a user, but may be used by introspection tools." msgstr "" -#: ../../library/typing.rst:3069 +#: ../../library/typing.rst:3334 msgid "" ":pep:`585` generic types such as ``list[\"SomeClass\"]`` will not be " "implicitly transformed into ``list[ForwardRef(\"SomeClass\")]`` and thus " "will not automatically resolve to ``list[SomeClass]``." msgstr "" -#: ../../library/typing.rst:3076 +#: ../../library/typing.rst:3342 +msgid "" +"A sentinel object used to indicate that a type parameter has no default " +"value. For example:" +msgstr "" + +#: ../../library/typing.rst:3345 +msgid "" +">>> T = TypeVar(\"T\")\n" +">>> T.__default__ is typing.NoDefault\n" +"True\n" +">>> S = TypeVar(\"S\", default=None)\n" +">>> S.__default__ is None\n" +"True" +msgstr "" + +#: ../../library/typing.rst:3357 msgid "Constant" msgstr "常數" -#: ../../library/typing.rst:3080 +#: ../../library/typing.rst:3361 msgid "" "A special constant that is assumed to be ``True`` by 3rd party static type " "checkers. It is ``False`` at runtime." msgstr "" -#: ../../library/typing.rst:3085 +#: ../../library/typing.rst:3366 msgid "" "if TYPE_CHECKING:\n" " import expensive_mod\n" @@ -4780,7 +5108,7 @@ msgstr "" "def fun(arg: 'expensive_mod.SomeType') -> None:\n" " local_var: expensive_mod.AnotherType = other_fun()" -#: ../../library/typing.rst:3091 +#: ../../library/typing.rst:3372 msgid "" "The first type annotation must be enclosed in quotes, making it a \"forward " "reference\", to hide the ``expensive_mod`` reference from the interpreter " @@ -4788,7 +5116,7 @@ msgid "" "second annotation does not need to be enclosed in quotes." msgstr "" -#: ../../library/typing.rst:3098 +#: ../../library/typing.rst:3379 msgid "" "If ``from __future__ import annotations`` is used, annotations are not " "evaluated at function definition time. Instead, they are stored as strings " @@ -4796,11 +5124,11 @@ msgid "" "annotation (see :pep:`563`)." msgstr "" -#: ../../library/typing.rst:3110 +#: ../../library/typing.rst:3391 msgid "Deprecated aliases" msgstr "棄用的別名" -#: ../../library/typing.rst:3112 +#: ../../library/typing.rst:3393 msgid "" "This module defines several deprecated aliases to pre-existing standard " "library classes. These were originally included in the typing module in " @@ -4809,7 +5137,7 @@ msgid "" "existing classes were enhanced to support ``[]`` (see :pep:`585`)." msgstr "" -#: ../../library/typing.rst:3119 +#: ../../library/typing.rst:3400 msgid "" "The redundant types are deprecated as of Python 3.9. However, while the " "aliases may be removed at some point, removal of these aliases is not " @@ -4817,7 +5145,7 @@ msgid "" "the interpreter for these aliases." msgstr "" -#: ../../library/typing.rst:3124 +#: ../../library/typing.rst:3405 msgid "" "If at some point it is decided to remove these deprecated aliases, a " "deprecation warning will be issued by the interpreter for at least two " @@ -4825,38 +5153,38 @@ msgid "" "typing module without deprecation warnings until at least Python 3.14." msgstr "" -#: ../../library/typing.rst:3129 +#: ../../library/typing.rst:3410 msgid "" "Type checkers are encouraged to flag uses of the deprecated types if the " "program they are checking targets a minimum Python version of 3.9 or newer." msgstr "" -#: ../../library/typing.rst:3135 +#: ../../library/typing.rst:3416 msgid "Aliases to built-in types" msgstr "內建型別的別名" -#: ../../library/typing.rst:3139 +#: ../../library/typing.rst:3420 msgid "Deprecated alias to :class:`dict`." msgstr "棄用 :class:`dict` 的別名。" -#: ../../library/typing.rst:3141 +#: ../../library/typing.rst:3422 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Mapping` rather than to " "use :class:`dict` or :class:`!typing.Dict`." msgstr "" -#: ../../library/typing.rst:3145 +#: ../../library/typing.rst:3426 msgid "" ":class:`builtins.dict ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3151 +#: ../../library/typing.rst:3432 msgid "Deprecated alias to :class:`list`." msgstr "棄用 :class:`list` 的別名。" -#: ../../library/typing.rst:3153 +#: ../../library/typing.rst:3434 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`~collections.abc.Sequence` or :class:" @@ -4864,142 +5192,136 @@ msgid "" "typing.List`." msgstr "" -#: ../../library/typing.rst:3158 +#: ../../library/typing.rst:3439 msgid "" ":class:`builtins.list ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3164 +#: ../../library/typing.rst:3445 msgid "Deprecated alias to :class:`builtins.set `." msgstr "棄用 :class:`builtins.set ` 的別名。" -#: ../../library/typing.rst:3166 +#: ../../library/typing.rst:3447 msgid "" "Note that to annotate arguments, it is preferred to use an abstract " "collection type such as :class:`collections.abc.Set` rather than to use :" "class:`set` or :class:`typing.Set`." msgstr "" -#: ../../library/typing.rst:3170 +#: ../../library/typing.rst:3451 msgid "" ":class:`builtins.set ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3176 +#: ../../library/typing.rst:3457 msgid "Deprecated alias to :class:`builtins.frozenset `." msgstr "棄用 :class:`builtins.frozenset ` 的別名。" -#: ../../library/typing.rst:3178 +#: ../../library/typing.rst:3459 msgid "" ":class:`builtins.frozenset ` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3185 +#: ../../library/typing.rst:3466 msgid "Deprecated alias for :class:`tuple`." msgstr "棄用 :class:`tuple` 的別名。" -#: ../../library/typing.rst:3187 +#: ../../library/typing.rst:3468 msgid "" ":class:`tuple` and ``Tuple`` are special-cased in the type system; see :ref:" "`annotating-tuples` for more details." msgstr "" -#: ../../library/typing.rst:3190 +#: ../../library/typing.rst:3471 msgid "" ":class:`builtins.tuple ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3196 +#: ../../library/typing.rst:3477 msgid "Deprecated alias to :class:`type`." msgstr "棄用 :class:`type` 的別名。" -#: ../../library/typing.rst:3198 +#: ../../library/typing.rst:3479 msgid "" "See :ref:`type-of-class-objects` for details on using :class:`type` or " "``typing.Type`` in type annotations." msgstr "" -#: ../../library/typing.rst:3203 +#: ../../library/typing.rst:3484 msgid "" ":class:`builtins.type ` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3210 +#: ../../library/typing.rst:3491 msgid "Aliases to types in :mod:`collections`" msgstr ":mod:`collections` 中型別的別名" -#: ../../library/typing.rst:3214 +#: ../../library/typing.rst:3495 msgid "Deprecated alias to :class:`collections.defaultdict`." msgstr "棄用 :class:`collections.defaultdict` 的別名。" -#: ../../library/typing.rst:3218 +#: ../../library/typing.rst:3499 msgid "" ":class:`collections.defaultdict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3224 +#: ../../library/typing.rst:3505 msgid "Deprecated alias to :class:`collections.OrderedDict`." msgstr "棄用 :class:`collections.OrderedDict` 的別名。" -#: ../../library/typing.rst:3228 +#: ../../library/typing.rst:3509 msgid "" ":class:`collections.OrderedDict` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3234 +#: ../../library/typing.rst:3515 msgid "Deprecated alias to :class:`collections.ChainMap`." msgstr "棄用 :class:`collections.ChainMap` 的別名。" -#: ../../library/typing.rst:3238 +#: ../../library/typing.rst:3519 msgid "" ":class:`collections.ChainMap` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3244 +#: ../../library/typing.rst:3525 msgid "Deprecated alias to :class:`collections.Counter`." msgstr "棄用 :class:`collections.Counter` 的別名。" -#: ../../library/typing.rst:3248 +#: ../../library/typing.rst:3529 msgid "" ":class:`collections.Counter` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3254 +#: ../../library/typing.rst:3535 msgid "Deprecated alias to :class:`collections.deque`." msgstr "棄用 :class:`collections.deque` 的別名。" -#: ../../library/typing.rst:3258 +#: ../../library/typing.rst:3539 msgid "" ":class:`collections.deque` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3265 +#: ../../library/typing.rst:3546 msgid "Aliases to other concrete types" msgstr "" -#: ../../library/typing.rst:3267 -msgid "" -"The ``typing.io`` namespace is deprecated and will be removed. These types " -"should be directly imported from ``typing`` instead." -msgstr "" - -#: ../../library/typing.rst:3274 +#: ../../library/typing.rst:3551 msgid "" "Deprecated aliases corresponding to the return types from :func:`re.compile` " "and :func:`re.match`." msgstr "" -#: ../../library/typing.rst:3277 +#: ../../library/typing.rst:3554 msgid "" "These types (and the corresponding functions) are generic over :data:" "`AnyStr`. ``Pattern`` can be specialised as ``Pattern[str]`` or " @@ -5007,361 +5329,387 @@ msgid "" "``Match[bytes]``." msgstr "" -#: ../../library/typing.rst:3282 -msgid "" -"The ``typing.re`` namespace is deprecated and will be removed. These types " -"should be directly imported from ``typing`` instead." -msgstr "" - -#: ../../library/typing.rst:3286 +#: ../../library/typing.rst:3559 msgid "" "Classes ``Pattern`` and ``Match`` from :mod:`re` now support ``[]``. See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3292 +#: ../../library/typing.rst:3565 msgid "Deprecated alias for :class:`str`." msgstr "棄用 :class:`str` 的別名。" -#: ../../library/typing.rst:3294 +#: ../../library/typing.rst:3567 msgid "" "``Text`` is provided to supply a forward compatible path for Python 2 code: " "in Python 2, ``Text`` is an alias for ``unicode``." msgstr "" -#: ../../library/typing.rst:3298 +#: ../../library/typing.rst:3571 msgid "" "Use ``Text`` to indicate that a value must contain a unicode string in a " "manner that is compatible with both Python 2 and Python 3::" msgstr "" -#: ../../library/typing.rst:3301 +#: ../../library/typing.rst:3574 msgid "" "def add_unicode_checkmark(text: Text) -> Text:\n" " return text + u' \\u2713'" msgstr "" -#: ../../library/typing.rst:3306 +#: ../../library/typing.rst:3579 msgid "" "Python 2 is no longer supported, and most type checkers also no longer " "support type checking Python 2 code. Removal of the alias is not currently " "planned, but users are encouraged to use :class:`str` instead of ``Text``." msgstr "" -#: ../../library/typing.rst:3316 +#: ../../library/typing.rst:3589 msgid "Aliases to container ABCs in :mod:`collections.abc`" msgstr ":mod:`collections.abc` 中容器 ABC 的別名" -#: ../../library/typing.rst:3320 +#: ../../library/typing.rst:3593 msgid "Deprecated alias to :class:`collections.abc.Set`." msgstr "棄用 :class:`collections.abc.Set` 的別名。" -#: ../../library/typing.rst:3322 +#: ../../library/typing.rst:3595 msgid "" ":class:`collections.abc.Set` now supports subscripting (``[]``). See :pep:" "`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3328 +#: ../../library/typing.rst:3601 msgid "" "This type represents the types :class:`bytes`, :class:`bytearray`, and :" "class:`memoryview` of byte sequences." msgstr "" -#: ../../library/typing.rst:3331 +#: ../../library/typing.rst:3604 msgid "" "Prefer :class:`collections.abc.Buffer`, or a union like ``bytes | bytearray " "| memoryview``." msgstr "" -#: ../../library/typing.rst:3336 +#: ../../library/typing.rst:3609 msgid "Deprecated alias to :class:`collections.abc.Collection`." msgstr "棄用 :class:`collections.abc.Collection` 的別名。" -#: ../../library/typing.rst:3340 +#: ../../library/typing.rst:3613 msgid "" ":class:`collections.abc.Collection` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3346 +#: ../../library/typing.rst:3619 msgid "Deprecated alias to :class:`collections.abc.Container`." msgstr "棄用 :class:`collections.abc.Container` 的別名。" -#: ../../library/typing.rst:3348 +#: ../../library/typing.rst:3621 msgid "" ":class:`collections.abc.Container` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3354 +#: ../../library/typing.rst:3627 msgid "Deprecated alias to :class:`collections.abc.ItemsView`." msgstr "棄用 :class:`collections.abc.ItemsView` 的別名。" -#: ../../library/typing.rst:3356 +#: ../../library/typing.rst:3629 msgid "" ":class:`collections.abc.ItemsView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3362 +#: ../../library/typing.rst:3635 msgid "Deprecated alias to :class:`collections.abc.KeysView`." msgstr "棄用 :class:`collections.abc.KeysView` 的別名。" -#: ../../library/typing.rst:3364 +#: ../../library/typing.rst:3637 msgid "" ":class:`collections.abc.KeysView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3370 +#: ../../library/typing.rst:3643 msgid "Deprecated alias to :class:`collections.abc.Mapping`." msgstr "棄用 :class:`collections.abc.Mapping` 的別名。" -#: ../../library/typing.rst:3372 +#: ../../library/typing.rst:3645 msgid "" ":class:`collections.abc.Mapping` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3378 +#: ../../library/typing.rst:3651 msgid "Deprecated alias to :class:`collections.abc.MappingView`." msgstr "棄用 :class:`collections.abc.MappingView` 的別名。" -#: ../../library/typing.rst:3380 +#: ../../library/typing.rst:3653 msgid "" ":class:`collections.abc.MappingView` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3386 +#: ../../library/typing.rst:3659 msgid "Deprecated alias to :class:`collections.abc.MutableMapping`." msgstr "棄用 :class:`collections.abc.MutableMapping` 的別名。" -#: ../../library/typing.rst:3388 +#: ../../library/typing.rst:3661 msgid "" ":class:`collections.abc.MutableMapping` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3395 +#: ../../library/typing.rst:3668 msgid "Deprecated alias to :class:`collections.abc.MutableSequence`." msgstr "棄用 :class:`collections.abc.MutableSequence` 的別名。" -#: ../../library/typing.rst:3397 +#: ../../library/typing.rst:3670 msgid "" ":class:`collections.abc.MutableSequence` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3404 +#: ../../library/typing.rst:3677 msgid "Deprecated alias to :class:`collections.abc.MutableSet`." msgstr "棄用 :class:`collections.abc.MutableSet` 的別名。" -#: ../../library/typing.rst:3406 +#: ../../library/typing.rst:3679 msgid "" ":class:`collections.abc.MutableSet` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3412 +#: ../../library/typing.rst:3685 msgid "Deprecated alias to :class:`collections.abc.Sequence`." msgstr "棄用 :class:`collections.abc.Sequence` 的別名。" -#: ../../library/typing.rst:3414 +#: ../../library/typing.rst:3687 msgid "" ":class:`collections.abc.Sequence` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3420 +#: ../../library/typing.rst:3693 msgid "Deprecated alias to :class:`collections.abc.ValuesView`." msgstr "棄用 :class:`collections.abc.ValuesView` 的別名。" -#: ../../library/typing.rst:3422 +#: ../../library/typing.rst:3695 msgid "" ":class:`collections.abc.ValuesView` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3429 +#: ../../library/typing.rst:3702 msgid "Aliases to asynchronous ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3433 +#: ../../library/typing.rst:3706 msgid "Deprecated alias to :class:`collections.abc.Coroutine`." msgstr "棄用 :class:`collections.abc.Coroutine` 的別名。" -#: ../../library/typing.rst:3435 +#: ../../library/typing.rst:3708 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.Coroutine` and ``typing.Coroutine`` in type annotations." msgstr "" -#: ../../library/typing.rst:3441 +#: ../../library/typing.rst:3714 msgid "" ":class:`collections.abc.Coroutine` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3447 +#: ../../library/typing.rst:3720 msgid "Deprecated alias to :class:`collections.abc.AsyncGenerator`." msgstr "棄用 :class:`collections.abc.AsyncGenerator` 的別名。" -#: ../../library/typing.rst:3449 +#: ../../library/typing.rst:3722 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.AsyncGenerator` and ``typing.AsyncGenerator`` in type " "annotations." msgstr "" -#: ../../library/typing.rst:3455 +#: ../../library/typing.rst:3728 msgid "" ":class:`collections.abc.AsyncGenerator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3462 +#: ../../library/typing.rst:3733 +msgid "The ``SendType`` parameter now has a default." +msgstr "" + +#: ../../library/typing.rst:3738 msgid "Deprecated alias to :class:`collections.abc.AsyncIterable`." msgstr "棄用 :class:`collections.abc.AsyncIterable` 的別名。" -#: ../../library/typing.rst:3466 +#: ../../library/typing.rst:3742 msgid "" ":class:`collections.abc.AsyncIterable` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3472 +#: ../../library/typing.rst:3748 msgid "Deprecated alias to :class:`collections.abc.AsyncIterator`." msgstr "棄用 :class:`collections.abc.AsyncIterator` 的別名。" -#: ../../library/typing.rst:3476 +#: ../../library/typing.rst:3752 msgid "" ":class:`collections.abc.AsyncIterator` now supports subscripting (``[]``). " "See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3482 +#: ../../library/typing.rst:3758 msgid "Deprecated alias to :class:`collections.abc.Awaitable`." msgstr "棄用 :class:`collections.abc.Awaitable` 的別名。" -#: ../../library/typing.rst:3486 +#: ../../library/typing.rst:3762 msgid "" ":class:`collections.abc.Awaitable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3493 +#: ../../library/typing.rst:3769 msgid "Aliases to other ABCs in :mod:`collections.abc`" msgstr "" -#: ../../library/typing.rst:3497 +#: ../../library/typing.rst:3773 msgid "Deprecated alias to :class:`collections.abc.Iterable`." msgstr "棄用 :class:`collections.abc.Iterable` 的別名。" -#: ../../library/typing.rst:3499 +#: ../../library/typing.rst:3775 msgid "" ":class:`collections.abc.Iterable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3505 +#: ../../library/typing.rst:3781 msgid "Deprecated alias to :class:`collections.abc.Iterator`." msgstr "棄用 :class:`collections.abc.Iterator` 的別名。" -#: ../../library/typing.rst:3507 +#: ../../library/typing.rst:3783 msgid "" ":class:`collections.abc.Iterator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3513 +#: ../../library/typing.rst:3789 msgid "Deprecated alias to :class:`collections.abc.Callable`." msgstr "棄用 :class:`collections.abc.Callable` 的別名。" -#: ../../library/typing.rst:3515 +#: ../../library/typing.rst:3791 msgid "" "See :ref:`annotating-callables` for details on how to use :class:" "`collections.abc.Callable` and ``typing.Callable`` in type annotations." msgstr "" -#: ../../library/typing.rst:3518 +#: ../../library/typing.rst:3794 msgid "" ":class:`collections.abc.Callable` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3528 +#: ../../library/typing.rst:3804 msgid "Deprecated alias to :class:`collections.abc.Generator`." msgstr "棄用 :class:`collections.abc.Generator` 的別名。" -#: ../../library/typing.rst:3530 +#: ../../library/typing.rst:3806 msgid "" "See :ref:`annotating-generators-and-coroutines` for details on using :class:" "`collections.abc.Generator` and ``typing.Generator`` in type annotations." msgstr "" -#: ../../library/typing.rst:3534 +#: ../../library/typing.rst:3810 msgid "" ":class:`collections.abc.Generator` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3540 +#: ../../library/typing.rst:3814 +msgid "Default values for the send and return types were added." +msgstr "" + +#: ../../library/typing.rst:3819 msgid "Deprecated alias to :class:`collections.abc.Hashable`." msgstr "棄用 :class:`collections.abc.Hashable` 的別名。" -#: ../../library/typing.rst:3542 +#: ../../library/typing.rst:3821 msgid "Use :class:`collections.abc.Hashable` directly instead." msgstr "改為直接使用 :class:`collections.abc.Hashable`。" -#: ../../library/typing.rst:3547 +#: ../../library/typing.rst:3826 msgid "Deprecated alias to :class:`collections.abc.Reversible`." msgstr "棄用 :class:`collections.abc.Reversible` 的別名。" -#: ../../library/typing.rst:3549 +#: ../../library/typing.rst:3828 msgid "" ":class:`collections.abc.Reversible` now supports subscripting (``[]``). See :" "pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3555 +#: ../../library/typing.rst:3834 msgid "Deprecated alias to :class:`collections.abc.Sized`." msgstr "棄用 :class:`collections.abc.Sized` 的別名。" -#: ../../library/typing.rst:3557 +#: ../../library/typing.rst:3836 msgid "Use :class:`collections.abc.Sized` directly instead." msgstr "改為直接使用 :class:`collections.abc.Sized`。" -#: ../../library/typing.rst:3563 +#: ../../library/typing.rst:3842 msgid "Aliases to :mod:`contextlib` ABCs" msgstr ":mod:`contextlib` ABC 的別名" -#: ../../library/typing.rst:3567 +#: ../../library/typing.rst:3846 msgid "Deprecated alias to :class:`contextlib.AbstractContextManager`." msgstr "" -#: ../../library/typing.rst:3571 +#: ../../library/typing.rst:3848 +msgid "" +"The first type parameter, ``T_co``, represents the type returned by the :" +"meth:`~object.__enter__` method. The optional second type parameter, " +"``ExitT_co``, which defaults to ``bool | None``, represents the type " +"returned by the :meth:`~object.__exit__` method." +msgstr "" + +#: ../../library/typing.rst:3855 msgid "" ":class:`contextlib.AbstractContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3578 +#: ../../library/typing.rst:3860 +msgid "Added the optional second type parameter, ``ExitT_co``." +msgstr "" + +#: ../../library/typing.rst:3865 msgid "Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`." msgstr "" -#: ../../library/typing.rst:3582 +#: ../../library/typing.rst:3867 +msgid "" +"The first type parameter, ``T_co``, represents the type returned by the :" +"meth:`~object.__aenter__` method. The optional second type parameter, " +"``AExitT_co``, which defaults to ``bool | None``, represents the type " +"returned by the :meth:`~object.__aexit__` method." +msgstr "" + +#: ../../library/typing.rst:3874 msgid "" ":class:`contextlib.AbstractAsyncContextManager` now supports subscripting " "(``[]``). See :pep:`585` and :ref:`types-genericalias`." msgstr "" -#: ../../library/typing.rst:3588 +#: ../../library/typing.rst:3879 +msgid "Added the optional second type parameter, ``AExitT_co``." +msgstr "" + +#: ../../library/typing.rst:3883 msgid "Deprecation Timeline of Major Features" msgstr "" -#: ../../library/typing.rst:3590 +#: ../../library/typing.rst:3885 msgid "" "Certain features in ``typing`` are deprecated and may be removed in a future " "version of Python. The following table summarizes major deprecations for " @@ -5369,299 +5717,111 @@ msgid "" "listed." msgstr "" -#: ../../library/typing.rst:3597 +#: ../../library/typing.rst:3892 msgid "Feature" msgstr "" -#: ../../library/typing.rst:3598 +#: ../../library/typing.rst:3893 msgid "Deprecated in" msgstr "棄用於" -#: ../../library/typing.rst:3599 +#: ../../library/typing.rst:3894 msgid "Projected removal" msgstr "" -#: ../../library/typing.rst:3600 +#: ../../library/typing.rst:3895 msgid "PEP/issue" msgstr "" -#: ../../library/typing.rst:3601 -msgid "``typing.io`` and ``typing.re`` submodules" -msgstr "``typing.io`` 和 ``typing.re`` 子模組" - -#: ../../library/typing.rst:3602 -msgid "3.8" -msgstr "3.8" - -#: ../../library/typing.rst:3603 -msgid "3.13" -msgstr "3.13" - -#: ../../library/typing.rst:3604 -msgid ":issue:`38291`" -msgstr ":issue:`38291`" - -#: ../../library/typing.rst:3605 +#: ../../library/typing.rst:3896 msgid "``typing`` versions of standard collections" msgstr "" -#: ../../library/typing.rst:3606 ../../library/typing.rst:3610 +#: ../../library/typing.rst:3897 ../../library/typing.rst:3901 msgid "3.9" msgstr "3.9" -#: ../../library/typing.rst:3607 +#: ../../library/typing.rst:3898 msgid "Undecided (see :ref:`deprecated-aliases` for more information)" msgstr "" -#: ../../library/typing.rst:3608 +#: ../../library/typing.rst:3899 msgid ":pep:`585`" msgstr ":pep:`585`" -#: ../../library/typing.rst:3609 +#: ../../library/typing.rst:3900 msgid ":class:`typing.ByteString`" msgstr ":class:`typing.ByteString`" -#: ../../library/typing.rst:3611 +#: ../../library/typing.rst:3902 msgid "3.14" msgstr "3.14" -#: ../../library/typing.rst:3612 +#: ../../library/typing.rst:3903 msgid ":gh:`91896`" msgstr ":gh:`91896`" -#: ../../library/typing.rst:3613 +#: ../../library/typing.rst:3904 msgid ":data:`typing.Text`" msgstr ":data:`typing.Text`" -#: ../../library/typing.rst:3614 +#: ../../library/typing.rst:3905 msgid "3.11" msgstr "3.11" -#: ../../library/typing.rst:3615 ../../library/typing.rst:3619 -#: ../../library/typing.rst:3623 +#: ../../library/typing.rst:3906 ../../library/typing.rst:3910 +#: ../../library/typing.rst:3914 msgid "Undecided" msgstr "" -#: ../../library/typing.rst:3616 +#: ../../library/typing.rst:3907 msgid ":gh:`92332`" msgstr ":gh:`92332`" -#: ../../library/typing.rst:3617 +#: ../../library/typing.rst:3908 msgid ":class:`typing.Hashable` and :class:`typing.Sized`" msgstr ":class:`typing.Hashable` 和 :class:`typing.Sized`" -#: ../../library/typing.rst:3618 ../../library/typing.rst:3622 +#: ../../library/typing.rst:3909 ../../library/typing.rst:3913 msgid "3.12" -msgstr "" +msgstr "3.12" -#: ../../library/typing.rst:3620 +#: ../../library/typing.rst:3911 msgid ":gh:`94309`" msgstr ":gh:`94309`" -#: ../../library/typing.rst:3621 +#: ../../library/typing.rst:3912 msgid ":data:`typing.TypeAlias`" msgstr ":data:`typing.TypeAlias`" -#: ../../library/typing.rst:3624 +#: ../../library/typing.rst:3915 msgid ":pep:`695`" msgstr ":pep:`695`" -#~ msgid "" -#~ "On older Python versions, :data:`NoReturn` may be used to express the " -#~ "same concept. ``Never`` was added to make the intended meaning more " -#~ "explicit." -#~ msgstr "" -#~ "在舊的 Python 版本當中,:data:`NoReturn` 可以用來當作一樣的概念使用。新增 " -#~ "``Never`` 之後,則讓這個含義變得更為明確。" - -#~ msgid "" -#~ "``NoReturn`` can also be used as a `bottom type `_, a type that has no values. Starting in Python 3.11, " -#~ "the :data:`Never` type should be used for this concept instead. Type " -#~ "checkers should treat the two equivalently." -#~ msgstr "" -#~ "``NoReturn`` 可以用來作為一個\\ `底部型別 `_,一個沒有值的型別。從 Python 3.11 開始,型別 :data:`Never` " -#~ "應該改用這個概念。型別檢查器應該將這兩種型別視為相等的。" - -#~ msgid "" -#~ "This module provides runtime support for type hints. For the original " -#~ "specification of the typing system, see :pep:`484`. For a simplified " -#~ "introduction to type hints, see :pep:`483`." -#~ msgstr "" -#~ "這個模組提供可以支援型別提示的 runtime。關於加註型別系統的原有規格,請看 :" -#~ "pep:`484`。關於型別提示的簡易介紹,請看 :pep:`483`。" - -#~ msgid "" -#~ "The function below takes and returns a string and is annotated as " -#~ "follows::" -#~ msgstr "以下函式接受及回傳都是使用字串,且註解方式如下: ::" - -#~ msgid "" -#~ "In the function ``greeting``, the argument ``name`` is expected to be of " -#~ "type :class:`str` and the return type :class:`str`. Subtypes are accepted " -#~ "as arguments." -#~ msgstr "" -#~ "在函式 ``greeting`` 當中,引數 ``name`` 的型別應為 :class:`str` 且回傳的型" -#~ "別也是 :class:`str`。該引數也可以接受其子型別。" - -#~ msgid "" -#~ "For a summary of deprecated features and a deprecation timeline, please " -#~ "see `Deprecation Timeline of Major Features`_." -#~ msgstr "" -#~ "棄用功能及其棄用時間線的簡介,請看\\ `Deprecation Timeline of Major " -#~ "Features`_ \\。" - -#~ msgid "Relevant PEPs" -#~ msgstr "相關的 PEPs" - -#~ msgid "" -#~ "Since the initial introduction of type hints in :pep:`484` and :pep:" -#~ "`483`, a number of PEPs have modified and enhanced Python's framework for " -#~ "type annotations:" -#~ msgstr "" -#~ "自從 :pep:`484` 及 :pep:`483` 對於型別提示的基礎引入,多個 PEPs 針對型別註" -#~ "釋的 Python 框架進行修訂及加強:" - -#~ msgid ":pep:`526`: Syntax for Variable Annotations" -#~ msgstr ":pep:`526`:變數註釋的語法" - -#~ msgid "" -#~ "*Introducing* syntax for annotating variables outside of function " -#~ "definitions, and :data:`ClassVar`" -#~ msgstr "*引入*\\ 在定義函式之外的變數註釋語法,以及 :data:`ClassVar`" - -#~ msgid ":pep:`544`: Protocols: Structural subtyping (static duck typing)" -#~ msgstr "" -#~ ":pep:`544`: 協定:結構子型別 (Structural Subtyping) (靜態鴨子型別," -#~ "Static Duck Typing)" - -#~ msgid "" -#~ "*Introducing* :class:`Protocol` and the :func:" -#~ "`@runtime_checkable` decorator" -#~ msgstr "" -#~ "*引入* :class:`Protocol` 以及 :func:" -#~ "`@runtime_checkable` 裝飾器 (decorator)" - -#~ msgid ":pep:`585`: Type Hinting Generics In Standard Collections" -#~ msgstr "" -#~ ":pep:`585`:基礎彙集 (collection) 中的型別提示泛型 (Type Hinting Generics " -#~ "In Standard Collections)" - -#~ msgid "" -#~ "*Introducing* :class:`types.GenericAlias` and the ability to use standard " -#~ "library classes as :ref:`generic types`" -#~ msgstr "" -#~ "*引入* :class:`types.GenericAlias` 以及使用基礎函式庫類別 :ref:`generic " -#~ "types` 的能力" - -#~ msgid ":pep:`586`: Literal Types" -#~ msgstr ":pep:`586`:文字型別" - -#~ msgid "*Introducing* :data:`Literal`" -#~ msgstr "*引入* :data:`Literal`" - -#~ msgid "" -#~ ":pep:`589`: TypedDict: Type Hints for Dictionaries with a Fixed Set of " -#~ "Keys" -#~ msgstr ":pep:`589`:TypedDict:含有一組固定 (fixed) 鍵值的型別提示字典" - -#~ msgid "*Introducing* :class:`TypedDict`" -#~ msgstr "*引入* :class:`TypedDict`" - -#~ msgid ":pep:`591`: Adding a final qualifier to typing" -#~ msgstr ":pep:`591`:為型別新增一個最終限定符 (final qualifier)" - -#~ msgid "*Introducing* :data:`Final` and the :func:`@final` decorator" -#~ msgstr "*引入* :data:`Final` 以及 :func:`@final` 裝飾器" - -#~ msgid ":pep:`593`: Flexible function and variable annotations" -#~ msgstr ":pep:`593`:彈性函式及變數註釋" - -#~ msgid "*Introducing* :data:`Annotated`" -#~ msgstr "*引入* :data:`Annotated`" - -#~ msgid ":pep:`604`: Allow writing union types as ``X | Y``" -#~ msgstr ":pep:`604`:允許寫入聯集型別 (union type) 為 ``X | Y``" - -#~ msgid "" -#~ "*Introducing* :data:`types.UnionType` and the ability to use the binary-" -#~ "or operator ``|`` to signify a :ref:`union of types`" -#~ msgstr "" -#~ "*引入* :data:`types.UnionType` 以及使用 binary-or 運算子 ``|`` 以表示\\ :" -#~ "ref:`型別聯合 `\\ 的能力" - -#~ msgid ":pep:`612`: Parameter Specification Variables" -#~ msgstr ":pep:`612`:參數規格變數 (Parameter Specification Variable)" - -#~ msgid "*Introducing* :class:`ParamSpec` and :data:`Concatenate`" -#~ msgstr "*引入* :class:`ParamSpec` 及 :data:`Concatenate`" - -#~ msgid ":pep:`613`: Explicit Type Aliases" -#~ msgstr ":pep:`613`:顯式型別別名 (Explicit Type Alias)" - -#~ msgid "*Introducing* :data:`TypeAlias`" -#~ msgstr "*引入* :data:`TypeAlias`" - -#~ msgid ":pep:`646`: Variadic Generics" -#~ msgstr ":pep:`646`:可變參數泛型 (Variadic Generic)" - -#~ msgid "*Introducing* :data:`TypeVarTuple`" -#~ msgstr "*引入* :data:`TypeVarTuple`" - -#~ msgid ":pep:`647`: User-Defined Type Guards" -#~ msgstr ":pep:`647`:使用者定義的型別防護 (Type Guard)" - -#~ msgid "*Introducing* :data:`TypeGuard`" -#~ msgstr "*引入* :data:`TypeGuard`" - -#~ msgid "" -#~ ":pep:`655`: Marking individual TypedDict items as required or potentially " -#~ "missing" -#~ msgstr ":pep:`655`:標記個別的 TypedDict 物件為必需的或可能遺失的" - -#~ msgid "*Introducing* :data:`Required` and :data:`NotRequired`" -#~ msgstr "*引入* :data:`Required` 和 :data:`NotRequired`" - -#~ msgid ":pep:`673`: Self type" -#~ msgstr ":pep:`673`:Self 型別" - -#~ msgid "*Introducing* :data:`Self`" -#~ msgstr "*引入* :data:`Self`" - -#~ msgid ":pep:`675`: Arbitrary Literal String Type" -#~ msgstr ":pep:`675`:任意的文本字串型別 (Arbitrary Literal String Type)" - -#~ msgid "*Introducing* :data:`LiteralString`" -#~ msgstr "*引入* :data:`LiteralString`" - -#~ msgid ":pep:`681`: Data Class Transforms" -#~ msgstr ":pep:`681`:資料類別轉換" - -#~ msgid "" -#~ "*Introducing* the :func:`@dataclass_transform` " -#~ "decorator" -#~ msgstr "*引入* :func:`@dataclass_transform` 裝飾器" +#: ../../library/typing.rst:3916 +msgid ":func:`@typing.no_type_check_decorator `" +msgstr "" -#~ msgid ":pep:`692`: Using ``TypedDict`` for more precise ``**kwargs`` typing" -#~ msgstr ":pep:`692`:為更精準的 ``**kwargs`` 型別使用 ``TypedDict``" +#: ../../library/typing.rst:3917 ../../library/typing.rst:3921 +msgid "3.13" +msgstr "3.13" -#~ msgid "" -#~ "*Introducing* a new way of typing ``**kwargs`` with :data:`Unpack` and :" -#~ "data:`TypedDict`" -#~ msgstr "" -#~ "*引入* 型別 ``**kwargs`` 的新方式 :data:`Unpack` 以及 :data:`TypedDict`" +#: ../../library/typing.rst:3918 +msgid "3.15" +msgstr "3.15" -#~ msgid ":pep:`695`: Type Parameter Syntax" -#~ msgstr ":pep:`695`:型別參數語法" +#: ../../library/typing.rst:3919 +msgid ":gh:`106309`" +msgstr ":gh:`106309`" -#~ msgid "" -#~ "*Introducing* builtin syntax for creating generic functions, classes, and " -#~ "type aliases." -#~ msgstr "*引入*\\ 建立泛型函式、類別、型別別名的內建語法。" +#: ../../library/typing.rst:3920 +msgid ":data:`typing.AnyStr`" +msgstr ":data:`typing.AnyStr`" -#~ msgid ":pep:`698`: Adding an override decorator to typing" -#~ msgstr ":pep:`698`:為型別新增可覆寫的裝飾器" +#: ../../library/typing.rst:3922 +msgid "3.18" +msgstr "3.18" -#~ msgid "*Introducing* the :func:`@override` decorator" -#~ msgstr "*引入* :func:`@override` 裝飾器" +#: ../../library/typing.rst:3923 +msgid ":gh:`105578`" +msgstr ":gh:`105578`" diff --git a/library/undoc.po b/library/undoc.po deleted file mode 100644 index 6a66f5b73e..0000000000 --- a/library/undoc.po +++ /dev/null @@ -1,62 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: Python 3.10\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-14 13:34+0800\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: ../../library/undoc.rst:5 -msgid "Undocumented Modules" -msgstr "未紀錄於文件的模組" - -#: ../../library/undoc.rst:7 -msgid "" -"Here's a quick listing of modules that are currently undocumented, but that " -"should be documented. Feel free to contribute documentation for them! " -"(Send via email to docs@python.org.)" -msgstr "" - -#: ../../library/undoc.rst:11 -msgid "" -"The idea and original contents for this chapter were taken from a posting by " -"Fredrik Lundh; the specific contents of this chapter have been substantially " -"revised." -msgstr "" - -#: ../../library/undoc.rst:17 -msgid "Platform specific modules" -msgstr "" - -#: ../../library/undoc.rst:19 -msgid "" -"These modules are used to implement the :mod:`os.path` module, and are not " -"documented beyond this mention. There's little need to document these." -msgstr "" - -#: ../../library/undoc.rst:23 -msgid ":mod:`ntpath`" -msgstr ":mod:`ntpath`" - -#: ../../library/undoc.rst:23 -msgid "--- Implementation of :mod:`os.path` on Win32 and Win64 platforms." -msgstr "" - -#: ../../library/undoc.rst:25 -msgid ":mod:`posixpath`" -msgstr ":mod:`posixpath`" - -#: ../../library/undoc.rst:26 -msgid "--- Implementation of :mod:`os.path` on POSIX." -msgstr "" diff --git a/library/unicodedata.po b/library/unicodedata.po index 083fb902ed..2e2e5479be 100644 --- a/library/unicodedata.po +++ b/library/unicodedata.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-05-09 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -26,8 +26,8 @@ msgstr ":mod:`!unicodedata` --- Unicode 資料庫" msgid "" "This module provides access to the Unicode Character Database (UCD) which " "defines character properties for all Unicode characters. The data contained " -"in this database is compiled from the `UCD version 15.0.0 `_." +"in this database is compiled from the `UCD version 15.1.0 `_." msgstr "" #: ../../library/unicodedata.rst:23 @@ -188,11 +188,13 @@ msgid "Footnotes" msgstr "註解" #: ../../library/unicodedata.rst:178 -msgid "https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt" +#, fuzzy +msgid "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" msgstr "https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt" #: ../../library/unicodedata.rst:180 -msgid "https://www.unicode.org/Public/15.0.0/ucd/NamedSequences.txt" +#, fuzzy +msgid "https://www.unicode.org/Public/15.1.0/ucd/NamedSequences.txt" msgstr "https://www.unicode.org/Public/15.0.0/ucd/NamedSequences.txt" #: ../../library/unicodedata.rst:11 diff --git a/library/unittest.mock-examples.po b/library/unittest.mock-examples.po index 4ae1f6722f..1b709b5160 100644 --- a/library/unittest.mock-examples.po +++ b/library/unittest.mock-examples.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2024-05-06 08:22+0800\n" "Last-Translator: Liang-Bo Wang \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1154,7 +1154,7 @@ msgstr "" "如果你的 mock 只被呼叫一次,你可以使用 :meth:`~Mock.assert_called_once_with` " "方法,其也斷言 :attr:`~Mock.call_count` 是1。" -#: ../../library/unittest.mock-examples.rst:803 +#: ../../library/unittest.mock-examples.rst:804 msgid "" "Both ``assert_called_with`` and ``assert_called_once_with`` make assertions " "about the *most recent* call. If your mock is going to be called several " @@ -1165,7 +1165,7 @@ msgstr "" "呼叫做出斷言。如果你的 mock 將被多次呼叫,並且你想要對\\ *所有*\\ 這些呼叫進" "行斷言,你可以使用 :attr:`~Mock.call_args_list`:" -#: ../../library/unittest.mock-examples.rst:815 +#: ../../library/unittest.mock-examples.rst:816 msgid "" "The :data:`call` helper makes it easy to make assertions about these calls. " "You can build up a list of expected calls and compare it to " @@ -1176,11 +1176,11 @@ msgstr "" "將其與 ``call_args_list`` 進行比較。這看起來與 ``call_args_list`` 的 repr 非" "常相似:" -#: ../../library/unittest.mock-examples.rst:825 +#: ../../library/unittest.mock-examples.rst:826 msgid "Coping with mutable arguments" msgstr "應對可變引數" -#: ../../library/unittest.mock-examples.rst:827 +#: ../../library/unittest.mock-examples.rst:828 msgid "" "Another situation is rare, but can bite you, is when your mock is called " "with mutable arguments. ``call_args`` and ``call_args_list`` store " @@ -1192,13 +1192,13 @@ msgstr "" "``call_args`` 和 ``call_args_list`` 儲存對引數的\\ *參照*。如果引數被測試中的" "程式碼改變,那麼你將無法再對 mock 被呼叫時的值進行斷言。" -#: ../../library/unittest.mock-examples.rst:832 +#: ../../library/unittest.mock-examples.rst:833 msgid "" "Here's some example code that shows the problem. Imagine the following " "functions defined in 'mymodule'::" msgstr "這是一些秀出問題的程式碼範例。 想像 'mymodule' 中定義以下函式: ::" -#: ../../library/unittest.mock-examples.rst:835 +#: ../../library/unittest.mock-examples.rst:836 msgid "" "def frob(val):\n" " pass\n" @@ -1209,14 +1209,14 @@ msgid "" " val.clear()" msgstr "" -#: ../../library/unittest.mock-examples.rst:843 +#: ../../library/unittest.mock-examples.rst:844 msgid "" "When we try to test that ``grob`` calls ``frob`` with the correct argument " "look what happens::" msgstr "" "當我們嘗試測試 ``grob`` 使用正確的引數呼叫 ``frob`` 時,看看會發生什麼: ::" -#: ../../library/unittest.mock-examples.rst:846 +#: ../../library/unittest.mock-examples.rst:847 msgid "" ">>> with patch('mymodule.frob') as mock_frob:\n" "... val = {6}\n" @@ -1242,7 +1242,7 @@ msgstr "" "AssertionError: Expected: (({6},), {})\n" "Called with: ((set(),), {})" -#: ../../library/unittest.mock-examples.rst:858 +#: ../../library/unittest.mock-examples.rst:859 msgid "" "One possibility would be for mock to copy the arguments you pass in. This " "could then cause problems if you do assertions that rely on object identity " @@ -1251,7 +1251,7 @@ msgstr "" "一種可能是讓 mock 複製你傳入的引數。如果你進行的斷言依賴於物件識別性來確定相" "等性,這就可能導致問題。" -#: ../../library/unittest.mock-examples.rst:862 +#: ../../library/unittest.mock-examples.rst:863 msgid "" "Here's one solution that uses the :attr:`~Mock.side_effect` functionality. " "If you provide a ``side_effect`` function for a mock then ``side_effect`` " @@ -1267,7 +1267,7 @@ msgstr "" "* mock 來儲存引數,以便我們可以使用 mock 方法來執行斷言。同樣的,有一個輔助函" "式為我們設定了這些。: ::" -#: ../../library/unittest.mock-examples.rst:870 +#: ../../library/unittest.mock-examples.rst:871 msgid "" ">>> from copy import deepcopy\n" ">>> from unittest.mock import Mock, patch, DEFAULT\n" @@ -1311,7 +1311,7 @@ msgstr "" ">>> new_mock.call_args\n" "call({6})" -#: ../../library/unittest.mock-examples.rst:891 +#: ../../library/unittest.mock-examples.rst:892 msgid "" "``copy_call_args`` is called with the mock that will be called. It returns a " "new mock that we do the assertion on. The ``side_effect`` function makes a " @@ -1321,7 +1321,7 @@ msgstr "" "言的新的 mock。``side_effect`` 函式建立引數們的副本,並用該副本呼叫我們的 " "``new_mock``。" -#: ../../library/unittest.mock-examples.rst:897 +#: ../../library/unittest.mock-examples.rst:898 msgid "" "If your mock is only going to be used once there is an easier way of " "checking arguments at the point they are called. You can simply do the " @@ -1330,7 +1330,7 @@ msgstr "" "如果你的 mock 只會被使用一次,則有一種更簡單的方法可以在呼叫引數時檢查它們。" "你可以簡單地在 ``side_effect`` 函式內進行檢查。" -#: ../../library/unittest.mock-examples.rst:911 +#: ../../library/unittest.mock-examples.rst:912 msgid "" "An alternative approach is to create a subclass of :class:`Mock` or :class:" "`MagicMock` that copies (using :func:`copy.deepcopy`) the arguments. Here's " @@ -1339,7 +1339,7 @@ msgstr "" "另一種方法是建立 :class:`Mock` 或 :class:`MagicMock` 的子類別來複製(使用 :" "func:`copy.deepcopy`\\ )引數。這是一個實作的例子:" -#: ../../library/unittest.mock-examples.rst:935 +#: ../../library/unittest.mock-examples.rst:937 msgid "" "When you subclass ``Mock`` or ``MagicMock`` all dynamically created " "attributes, and the ``return_value`` will use your subclass automatically. " @@ -1350,11 +1350,11 @@ msgstr "" "``return_value`` 會自動使用你的子類別。這代表著 ``CopyingMock`` 的所有子代 " "(child) 也會具有 ``CopyingMock`` 型別。" -#: ../../library/unittest.mock-examples.rst:941 +#: ../../library/unittest.mock-examples.rst:943 msgid "Nesting Patches" msgstr "巢狀使用 Patch" -#: ../../library/unittest.mock-examples.rst:943 +#: ../../library/unittest.mock-examples.rst:945 msgid "" "Using patch as a context manager is nice, but if you do multiple patches you " "can end up with nested with statements indenting further and further to the " @@ -1363,7 +1363,7 @@ msgstr "" "將 patch 作為情境管理器使用很好,但是如果你使用複數個 patch,你最終可能會得到" "巢狀的 with 陳述式,並且越來越向右縮排: ::" -#: ../../library/unittest.mock-examples.rst:947 +#: ../../library/unittest.mock-examples.rst:949 msgid "" ">>> class MyTest(unittest.TestCase):\n" "...\n" @@ -1393,7 +1393,7 @@ msgstr "" ">>> MyTest('test_foo').test_foo()\n" ">>> assert mymodule.Foo is original" -#: ../../library/unittest.mock-examples.rst:961 +#: ../../library/unittest.mock-examples.rst:963 msgid "" "With unittest ``cleanup`` functions and the :ref:`start-and-stop` we can " "achieve the same effect without the nested indentation. A simple helper " @@ -1404,7 +1404,7 @@ msgstr "" "同的效果,而不會出現因巢狀導致的縮排。一個簡單的輔助方法 ``create_patch`` 會" "將 patch 放置到位並為我們回傳被建立的 mock: ::" -#: ../../library/unittest.mock-examples.rst:966 +#: ../../library/unittest.mock-examples.rst:968 msgid "" ">>> class MyTest(unittest.TestCase):\n" "...\n" @@ -1448,11 +1448,11 @@ msgstr "" ">>> MyTest('test_foo').run()\n" ">>> assert mymodule.Foo is original" -#: ../../library/unittest.mock-examples.rst:989 +#: ../../library/unittest.mock-examples.rst:991 msgid "Mocking a dictionary with MagicMock" msgstr "使用 MagicMock 來 mock 字典" -#: ../../library/unittest.mock-examples.rst:991 +#: ../../library/unittest.mock-examples.rst:993 msgid "" "You may want to mock a dictionary, or other container object, recording all " "access to it whilst having it still behave like a dictionary." @@ -1460,7 +1460,7 @@ msgstr "" "你可能會想要 mock 字典或其他容器物件,記錄對它的所有存取,同時讓它仍然像字典" "一樣運作。" -#: ../../library/unittest.mock-examples.rst:994 +#: ../../library/unittest.mock-examples.rst:996 msgid "" "We can do this with :class:`MagicMock`, which will behave like a dictionary, " "and using :data:`~Mock.side_effect` to delegate dictionary access to a real " @@ -1469,7 +1469,7 @@ msgstr "" "我們可以使用 :class:`MagicMock` 來做到這一點,它的行為會與字典一致,並使用 :" "data:`~Mock.side_effect` 將字典存取委託給我們控制下的真實底層字典。" -#: ../../library/unittest.mock-examples.rst:998 +#: ../../library/unittest.mock-examples.rst:1000 msgid "" "When the :meth:`~object.__getitem__` and :meth:`~object.__setitem__` methods " "of our ``MagicMock`` are called (normal dictionary access) then " @@ -1481,7 +1481,7 @@ msgstr "" "(key) 來呼叫 (在 ``__setitem__`` 的情況也會使用值 (value))。我們也可以控制" "回傳的內容。" -#: ../../library/unittest.mock-examples.rst:1003 +#: ../../library/unittest.mock-examples.rst:1005 msgid "" "After the ``MagicMock`` has been used we can use attributes like :data:" "`~Mock.call_args_list` to assert about how the dictionary was used:" @@ -1489,7 +1489,7 @@ msgstr "" "使用 ``MagicMock`` 後,我們可以使用諸如 :data:`~Mock.call_args_list` 之類的屬" "性來斷言字典被使用的方式:" -#: ../../library/unittest.mock-examples.rst:1019 +#: ../../library/unittest.mock-examples.rst:1021 msgid "" "An alternative to using ``MagicMock`` is to use ``Mock`` and *only* provide " "the magic methods you specifically want:" @@ -1497,7 +1497,7 @@ msgstr "" "不使用 ``MagicMock`` 的替代方案是使用 ``Mock`` 並且\\ *只*\\ 提供你特別想要的" "魔術方法:" -#: ../../library/unittest.mock-examples.rst:1026 +#: ../../library/unittest.mock-examples.rst:1028 msgid "" "A *third* option is to use ``MagicMock`` but passing in ``dict`` as the " "*spec* (or *spec_set*) argument so that the ``MagicMock`` created only has " @@ -1506,7 +1506,7 @@ msgstr "" "*第三個*\\ 選擇是使用 ``MagicMock``,但傳入 ``dict`` 作為 *spec* (或 " "*spec_set*\\ )引數,以使被建立的 ``MagicMock`` 僅具有字典可用的魔術方法:" -#: ../../library/unittest.mock-examples.rst:1034 +#: ../../library/unittest.mock-examples.rst:1036 msgid "" "With these side effect functions in place, the ``mock`` will behave like a " "normal dictionary but recording the access. It even raises a :exc:`KeyError` " @@ -1515,17 +1515,17 @@ msgstr "" "有了這些 side effect 函式,``mock`` 會像一般的字典一樣運作,但會記錄存取。如" "果你嘗試存取不存在的鍵,它甚至會引發一個 :exc:`KeyError`。" -#: ../../library/unittest.mock-examples.rst:1053 +#: ../../library/unittest.mock-examples.rst:1055 msgid "" "After it has been used you can make assertions about the access using the " "normal mock methods and attributes:" msgstr "在上述方式被使用後,你就可以使用普通的 mock 方法和屬性對存取進行斷言:" -#: ../../library/unittest.mock-examples.rst:1065 +#: ../../library/unittest.mock-examples.rst:1067 msgid "Mock subclasses and their attributes" msgstr "Mock 子類別及其屬性" -#: ../../library/unittest.mock-examples.rst:1067 +#: ../../library/unittest.mock-examples.rst:1069 msgid "" "There are various reasons why you might want to subclass :class:`Mock`. One " "reason might be to add helper methods. Here's a silly example:" @@ -1533,7 +1533,7 @@ msgstr "" "你會想子類別化 :class:`Mock` 的原因可能有很多種。其中之一是增加輔助方法。以下" "是一個有點笨的例子:" -#: ../../library/unittest.mock-examples.rst:1083 +#: ../../library/unittest.mock-examples.rst:1085 msgid "" "The standard behaviour for ``Mock`` instances is that attributes and the " "return value mocks are of the same type as the mock they are accessed on. " @@ -1547,7 +1547,7 @@ msgstr "" "``MagicMocks`` [#]_。因此,如果你要子類別化以新增輔助方法,那麼它們也可用於子" "類別實例的屬性 mock 和回傳值 mock。" -#: ../../library/unittest.mock-examples.rst:1099 +#: ../../library/unittest.mock-examples.rst:1101 msgid "" "Sometimes this is inconvenient. For example, `one user `_ is subclassing mock to created a `Twisted " @@ -1559,7 +1559,7 @@ msgstr "" "twisted.org/documents/11.0.0/api/twisted.python.components.html>`_。將其應用" "於屬性實際上會導致錯誤。" -#: ../../library/unittest.mock-examples.rst:1105 +#: ../../library/unittest.mock-examples.rst:1107 msgid "" "``Mock`` (in all its flavours) uses a method called ``_get_child_mock`` to " "create these \"sub-mocks\" for attributes and return values. You can prevent " @@ -1571,7 +1571,7 @@ msgstr "" "建立這些 \"子 mock\"。你可以透過置換此方法來防止你的子類別被用為屬性。其簽名" "是取用任意的關鍵字引數(``**kwargs``\\ ),然後將其傳遞給 mock 建構函式:" -#: ../../library/unittest.mock-examples.rst:1122 +#: ../../library/unittest.mock-examples.rst:1124 msgid "" "An exception to this rule are the non-callable mocks. Attributes use the " "callable variant because otherwise non-callable mocks couldn't have callable " @@ -1580,11 +1580,11 @@ msgstr "" "此規則的例外是非可呼叫物件的 mock。屬性使用可呼叫物件的變體,否則非可呼叫物件" "的 mock 無法具有可呼叫的方法。" -#: ../../library/unittest.mock-examples.rst:1128 +#: ../../library/unittest.mock-examples.rst:1130 msgid "Mocking imports with patch.dict" msgstr "使用 patch.dict 來 mock import" -#: ../../library/unittest.mock-examples.rst:1130 +#: ../../library/unittest.mock-examples.rst:1132 msgid "" "One situation where mocking can be hard is where you have a local import " "inside a function. These are harder to mock because they aren't using an " @@ -1593,7 +1593,7 @@ msgstr "" "可能會讓 mock 很困難的一種情況是在函式內部進行區域 import。這些狀況會更難進" "行 mock,因為它們沒有使用我們可以 patch out 的模組命名空間中的物件。" -#: ../../library/unittest.mock-examples.rst:1134 +#: ../../library/unittest.mock-examples.rst:1136 msgid "" "Generally local imports are to be avoided. They are sometimes done to " "prevent circular dependencies, for which there is *usually* a much better " @@ -1608,7 +1608,7 @@ msgstr "" "件的區域 import 更好的方式來解決(例如將模組儲存為類別或模組屬性,並且僅在第" "一次使用時進行 import)。" -#: ../../library/unittest.mock-examples.rst:1141 +#: ../../library/unittest.mock-examples.rst:1143 msgid "" "That aside there is a way to use ``mock`` to affect the results of an " "import. Importing fetches an *object* from the :data:`sys.modules` " @@ -1622,7 +1622,7 @@ msgstr "" "該物件不需要是一個模組。初次 import 模組會導致模組物件被放入 ``sys.modules`` " "中,因此通常當你 import 某些東西時,你會得到一個模組。但並非一定要如此。" -#: ../../library/unittest.mock-examples.rst:1148 +#: ../../library/unittest.mock-examples.rst:1150 msgid "" "This means you can use :func:`patch.dict` to *temporarily* put a mock in " "place in :data:`sys.modules`. Any imports whilst this patch is active will " @@ -1635,11 +1635,11 @@ msgstr "" "成時(被裝飾的函式結束、with 陳述式主體完成或 ``patcher.stop()`` 被呼叫),那" "麼之前在 ``sys.modules`` 中的任何內容都會被安全地復原。" -#: ../../library/unittest.mock-examples.rst:1154 +#: ../../library/unittest.mock-examples.rst:1156 msgid "Here's an example that mocks out the 'fooble' module." msgstr "下面是一個 mock out 'fooble' 模組的例子。" -#: ../../library/unittest.mock-examples.rst:1166 +#: ../../library/unittest.mock-examples.rst:1168 msgid "" "As you can see the ``import fooble`` succeeds, but on exit there is no " "'fooble' left in :data:`sys.modules`." @@ -1647,19 +1647,19 @@ msgstr "" "如你所見,``import fooble`` 成功了,但在離開之後,:data:`sys.modules` 中就沒" "有 'fooble' 了。" -#: ../../library/unittest.mock-examples.rst:1169 +#: ../../library/unittest.mock-examples.rst:1171 msgid "This also works for the ``from module import name`` form:" msgstr "這也適用於 ``from module import name`` 形式:" -#: ../../library/unittest.mock-examples.rst:1179 +#: ../../library/unittest.mock-examples.rst:1181 msgid "With slightly more work you can also mock package imports:" msgstr "透過稍微多一點的處理,你也可以 mock 套件的引入:" -#: ../../library/unittest.mock-examples.rst:1192 +#: ../../library/unittest.mock-examples.rst:1194 msgid "Tracking order of calls and less verbose call assertions" msgstr "追蹤呼叫順序與更簡潔的呼叫斷言" -#: ../../library/unittest.mock-examples.rst:1194 +#: ../../library/unittest.mock-examples.rst:1196 msgid "" "The :class:`Mock` class allows you to track the *order* of method calls on " "your mock objects through the :attr:`~Mock.method_calls` attribute. This " @@ -1670,7 +1670,7 @@ msgstr "" "上方法呼叫的\\ *順序*。這不會讓你可以追蹤不同的 mock 物件之間的呼叫順序,然而" "我們可以使用 :attr:`~Mock.mock_calls` 來達到相同的效果。" -#: ../../library/unittest.mock-examples.rst:1199 +#: ../../library/unittest.mock-examples.rst:1201 msgid "" "Because mocks track calls to child mocks in ``mock_calls``, and accessing an " "arbitrary attribute of a mock creates a child mock, we can create our " @@ -1681,7 +1681,7 @@ msgstr "" "會建立一個子 mock,所以我們可以從父 mock 建立不同的 mock。之後對這些子 mock " "的呼叫將依序全部記錄在父 mock 的 ``mock_calls`` 中:" -#: ../../library/unittest.mock-examples.rst:1216 +#: ../../library/unittest.mock-examples.rst:1218 msgid "" "We can then assert about the calls, including the order, by comparing with " "the ``mock_calls`` attribute on the manager mock:" @@ -1689,7 +1689,7 @@ msgstr "" "之後我們可以透過與管理器 (manager) mock 上的 ``mock_calls`` 屬性進行比較來斷" "言呼叫及其順序:" -#: ../../library/unittest.mock-examples.rst:1223 +#: ../../library/unittest.mock-examples.rst:1225 msgid "" "If ``patch`` is creating, and putting in place, your mocks then you can " "attach them to a manager mock using the :meth:`~Mock.attach_mock` method. " @@ -1699,7 +1699,7 @@ msgstr "" "attach_mock` 方法將它們附加到管理器 mock。附加之後,呼叫將被記錄在管理器的 " "``mock_calls`` 中。: ::" -#: ../../library/unittest.mock-examples.rst:1227 +#: ../../library/unittest.mock-examples.rst:1229 msgid "" ">>> manager = MagicMock()\n" ">>> with patch('mymodule.Class1') as MockClass1:\n" @@ -1731,7 +1731,7 @@ msgstr "" "call.MockClass2(),\n" "call.MockClass2().bar()]" -#: ../../library/unittest.mock-examples.rst:1242 +#: ../../library/unittest.mock-examples.rst:1244 msgid "" "If many calls have been made, but you're only interested in a particular " "sequence of them then an alternative is to use the :meth:`~Mock." @@ -1743,7 +1743,7 @@ msgstr "" "`~Mock.assert_has_calls` 方法。這需要一個呼叫串列(使用 :data:`call` 物件建" "構)。如果該呼叫序列位於 :attr:`~Mock.mock_calls` 中,則斷言成功。" -#: ../../library/unittest.mock-examples.rst:1256 +#: ../../library/unittest.mock-examples.rst:1258 msgid "" "Even though the chained call ``m.one().two().three()`` aren't the only calls " "that have been made to the mock, the assert still succeeds." @@ -1751,7 +1751,7 @@ msgstr "" "儘管鍊接呼叫 ``m.one().two().three()`` 並不是對 mock 進行的唯一呼叫,斷言仍會" "成功。" -#: ../../library/unittest.mock-examples.rst:1259 +#: ../../library/unittest.mock-examples.rst:1261 msgid "" "Sometimes a mock may have several calls made to it, and you are only " "interested in asserting about *some* of those calls. You may not even care " @@ -1762,11 +1762,11 @@ msgstr "" "你甚至可能不關心順序。在這種情況下,你可以將 ``any_order=True`` 傳遞給 " "``assert_has_calls``:" -#: ../../library/unittest.mock-examples.rst:1271 +#: ../../library/unittest.mock-examples.rst:1273 msgid "More complex argument matching" msgstr "更複雜的引數匹配" -#: ../../library/unittest.mock-examples.rst:1273 +#: ../../library/unittest.mock-examples.rst:1275 msgid "" "Using the same basic concept as :data:`ANY` we can implement matchers to do " "more complex assertions on objects used as arguments to mocks." @@ -1774,7 +1774,7 @@ msgstr "" "使用與 :data:`ANY` 相同的基本概念,我們可以實作匹配器 (matcher),對用來作為 " "mock 引數的物件進行更複雜的斷言。" -#: ../../library/unittest.mock-examples.rst:1276 +#: ../../library/unittest.mock-examples.rst:1278 msgid "" "Suppose we expect some object to be passed to a mock that by default " "compares equal based on object identity (which is the Python default for " @@ -1788,29 +1788,29 @@ msgstr "" "assert_called_with`,我們需要傳入完全相同的物件。如果我們只對該物件的某些屬性" "感興趣,那麼我們可以建立一個匹配器來為我們檢查這些屬性。" -#: ../../library/unittest.mock-examples.rst:1283 +#: ../../library/unittest.mock-examples.rst:1285 msgid "" "You can see in this example how a 'standard' call to ``assert_called_with`` " "isn't sufficient:" msgstr "" "你可以在這個範例中看到對 ``assert_called_with`` 的一個「標準」呼叫是不夠的:" -#: ../../library/unittest.mock-examples.rst:1298 +#: ../../library/unittest.mock-examples.rst:1301 msgid "" "A comparison function for our ``Foo`` class might look something like this:" msgstr "對我們的 ``Foo`` 類別的比較函式看起來可能會像這樣:" -#: ../../library/unittest.mock-examples.rst:1310 +#: ../../library/unittest.mock-examples.rst:1313 msgid "" "And a matcher object that can use comparison functions like this for its " "equality operation would look something like this:" msgstr "而可以使用像這樣的比較函式進行其相等性運算的匹配器物件會長得像這樣:" -#: ../../library/unittest.mock-examples.rst:1321 +#: ../../library/unittest.mock-examples.rst:1324 msgid "Putting all this together:" msgstr "把這些都放在一起:" -#: ../../library/unittest.mock-examples.rst:1326 +#: ../../library/unittest.mock-examples.rst:1329 msgid "" "The ``Matcher`` is instantiated with our compare function and the ``Foo`` " "object we want to compare against. In ``assert_called_with`` the ``Matcher`` " @@ -1825,7 +1825,7 @@ msgstr "" "``assert_called_with`` 會通過,如果它們不匹配,則會引發 :exc:" "`AssertionError`:" -#: ../../library/unittest.mock-examples.rst:1339 +#: ../../library/unittest.mock-examples.rst:1342 msgid "" "With a bit of tweaking you could have the comparison function raise the :exc:" "`AssertionError` directly and provide a more useful failure message." @@ -1833,7 +1833,7 @@ msgstr "" "透過一些調整,你可以讓比較函式直接引發 :exc:`AssertionError` 並提供更有用的失" "敗訊息。" -#: ../../library/unittest.mock-examples.rst:1342 +#: ../../library/unittest.mock-examples.rst:1345 msgid "" "As of version 1.5, the Python testing library `PyHamcrest `_ provides similar functionality, that may be " diff --git a/library/unittest.mock.po b/library/unittest.mock.po index 92c5b8dab9..c4159ff0b8 100644 --- a/library/unittest.mock.po +++ b/library/unittest.mock.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2024-02-19 21:27+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -246,7 +246,7 @@ msgstr "" msgid "The Mock Class" msgstr "Mock 類別" -#: ../../library/unittest.mock.rst:211 +#: ../../library/unittest.mock.rst:213 msgid "" ":class:`Mock` is a flexible mock object intended to replace the use of stubs " "and test doubles throughout your code. Mocks are callable and create " @@ -259,7 +259,7 @@ msgstr "" "的 mock [#]_。存取相同的屬性將永遠回傳相同的 mock。Mock 記錄了你如何使用它" "們,允許你判定你的程式碼對 mock 的行為。" -#: ../../library/unittest.mock.rst:217 +#: ../../library/unittest.mock.rst:219 msgid "" ":class:`MagicMock` is a subclass of :class:`Mock` with all the magic methods " "pre-created and ready to use. There are also non-callable variants, useful " @@ -270,7 +270,7 @@ msgstr "" "可供使用。也有不可呼叫的變體,在你 mock 無法呼叫的物件時很有用::class:" "`NonCallableMock` 和 :class:`NonCallableMagicMock`" -#: ../../library/unittest.mock.rst:222 +#: ../../library/unittest.mock.rst:224 msgid "" "The :func:`patch` decorators makes it easy to temporarily replace classes in " "a particular module with a :class:`Mock` object. By default :func:`patch` " @@ -281,7 +281,7 @@ msgstr "" "預設情況下,:func:`patch` 會為你建立一個 :class:`MagicMock`。你可以使用 :" "func:`patch` 的 *new_callable* 引數指定 :class:`Mock` 的替代類別。" -#: ../../library/unittest.mock.rst:230 +#: ../../library/unittest.mock.rst:232 msgid "" "Create a new :class:`Mock` object. :class:`Mock` takes several optional " "arguments that specify the behaviour of the Mock object:" @@ -289,7 +289,7 @@ msgstr "" "建立一個新的 :class:`Mock` 物件。:class:`Mock` 接受數個可選的引數來指定 Mock " "物件的行為:" -#: ../../library/unittest.mock.rst:233 +#: ../../library/unittest.mock.rst:235 msgid "" "*spec*: This can be either a list of strings or an existing object (a class " "or instance) that acts as the specification for the mock object. If you pass " @@ -302,17 +302,17 @@ msgstr "" "不支援的魔術屬性和方法)。存取不在此串列中的任何屬性都會引發 :exc:" "`AttributeError`。" -#: ../../library/unittest.mock.rst:239 +#: ../../library/unittest.mock.rst:241 msgid "" -"If *spec* is an object (rather than a list of strings) then :attr:`~instance." +"If *spec* is an object (rather than a list of strings) then :attr:`~object." "__class__` returns the class of the spec object. This allows mocks to pass :" "func:`isinstance` tests." msgstr "" -"如果 *spec* 是一個物件(而不是一個字串的串列),那麼 :attr:`~instance." +"如果 *spec* 是一個物件(而不是一個字串的串列),那麼 :attr:`~object." "__class__` 會回傳 spec 物件的類別。這允許 mocks 通過 :func:`isinstance` 測" "試。" -#: ../../library/unittest.mock.rst:243 +#: ../../library/unittest.mock.rst:245 msgid "" "*spec_set*: A stricter variant of *spec*. If used, attempting to *set* or " "get an attribute on the mock that isn't on the object passed as *spec_set* " @@ -322,7 +322,7 @@ msgstr "" "*set* 或取得不在傳遞給 *spec_set* 的物件上的屬性將會引發 :exc:" "`AttributeError`。" -#: ../../library/unittest.mock.rst:247 +#: ../../library/unittest.mock.rst:249 msgid "" "*side_effect*: A function to be called whenever the Mock is called. See the :" "attr:`~Mock.side_effect` attribute. Useful for raising exceptions or " @@ -334,7 +334,7 @@ msgstr "" "屬性,用於引發例外或動態變更回傳值。該函式使用與 mock 相同的引數呼叫,且除非" "它回傳 :data:`DEFAULT`,否則此函式的回傳值將用作回傳值。" -#: ../../library/unittest.mock.rst:253 +#: ../../library/unittest.mock.rst:255 msgid "" "Alternatively *side_effect* can be an exception class or instance. In this " "case the exception will be raised when the mock is called." @@ -342,7 +342,7 @@ msgstr "" "*side_effect* 也可以是一個例外的類別或實例。在這種情況下,當呼叫 mock 時,該" "例外將被引發。" -#: ../../library/unittest.mock.rst:256 +#: ../../library/unittest.mock.rst:258 msgid "" "If *side_effect* is an iterable then each call to the mock will return the " "next value from the iterable." @@ -350,11 +350,11 @@ msgstr "" "如果 *side_effect* 是一個可疊代物件,那麼對 mock 的每次呼叫將回傳可疊代物件中" "的下一個值。" -#: ../../library/unittest.mock.rst:259 +#: ../../library/unittest.mock.rst:261 msgid "A *side_effect* can be cleared by setting it to ``None``." msgstr "*side_effect* 可以通過將其設置為 ``None`` 來清除。" -#: ../../library/unittest.mock.rst:261 +#: ../../library/unittest.mock.rst:263 msgid "" "*return_value*: The value returned when the mock is called. By default this " "is a new Mock (created on first access). See the :attr:`return_value` " @@ -363,7 +363,7 @@ msgstr "" "*return_value*:當呼叫 mock 時回傳的值。預設情況下,這是一個新的 Mock(在首次" "存取時建立)。參見 :attr:`return_value` 屬性。" -#: ../../library/unittest.mock.rst:265 +#: ../../library/unittest.mock.rst:267 msgid "" "*unsafe*: By default, accessing any attribute whose name starts with " "*assert*, *assret*, *asert*, *aseert* or *assrt* will raise an :exc:" @@ -374,7 +374,7 @@ msgstr "" "*assrt* 開頭的屬性將引發 :exc:`AttributeError`。如果傳遞 ``unsafe=True``,將" "會允許存取這些屬性。" -#: ../../library/unittest.mock.rst:272 +#: ../../library/unittest.mock.rst:274 msgid "" "*wraps*: Item for the mock object to wrap. If *wraps* is not ``None`` then " "calling the Mock will pass the call through to the wrapped object (returning " @@ -388,7 +388,7 @@ msgstr "" "物件包裝了被包裝物件的對應屬性(因此嘗試存取不存在的屬性將引發 :exc:" "`AttributeError`\\ )。" -#: ../../library/unittest.mock.rst:279 +#: ../../library/unittest.mock.rst:281 msgid "" "If the mock has an explicit *return_value* set then calls are not passed to " "the wrapped object and the *return_value* is returned instead." @@ -396,7 +396,7 @@ msgstr "" "如果 mock 已經明確設定了 *return_value*,那麼呼叫並不會被傳遞到被包裝的物件," "而是回傳已設定好的 *return_value*。" -#: ../../library/unittest.mock.rst:282 +#: ../../library/unittest.mock.rst:284 msgid "" "*name*: If the mock has a name then it will be used in the repr of the mock. " "This can be useful for debugging. The name is propagated to child mocks." @@ -404,7 +404,7 @@ msgstr "" "*name*:如果 mock 有一個名稱,那麼它會被用於 mock 的 repr。這對於除錯很有用。" "此名稱將被傳播到子 mocks。" -#: ../../library/unittest.mock.rst:286 +#: ../../library/unittest.mock.rst:288 msgid "" "Mocks can also be called with arbitrary keyword arguments. These will be " "used to set attributes on the mock after it is created. See the :meth:" @@ -413,31 +413,31 @@ msgstr "" "Mocks 還可以使用任意的關鍵字引數進行呼叫。這些關鍵字引數將在建立 mock 之後用" "於設定 mock 的屬性。欲知更多,請參見 :meth:`configure_mock` 方法。" -#: ../../library/unittest.mock.rst:292 +#: ../../library/unittest.mock.rst:294 msgid "Assert that the mock was called at least once." msgstr "確認 mock 至少被呼叫一次。" -#: ../../library/unittest.mock.rst:303 +#: ../../library/unittest.mock.rst:305 msgid "Assert that the mock was called exactly once." msgstr "確認 mock 只被呼叫一次。" -#: ../../library/unittest.mock.rst:321 +#: ../../library/unittest.mock.rst:324 msgid "" "This method is a convenient way of asserting that the last call has been " "made in a particular way:" msgstr "這個方法是一個便利的方式,用來斷言最後一次呼叫是以特定方式進行的:" -#: ../../library/unittest.mock.rst:331 +#: ../../library/unittest.mock.rst:334 msgid "" "Assert that the mock was called exactly once and that call was with the " "specified arguments." msgstr "確認 mock 只被呼叫一次,且該次呼叫使用了指定的引數。" -#: ../../library/unittest.mock.rst:346 +#: ../../library/unittest.mock.rst:349 msgid "assert the mock has been called with the specified arguments." msgstr "斷言 mock 已經被使用指定的引數呼叫。" -#: ../../library/unittest.mock.rst:348 +#: ../../library/unittest.mock.rst:351 msgid "" "The assert passes if the mock has *ever* been called, unlike :meth:" "`assert_called_with` and :meth:`assert_called_once_with` that only pass if " @@ -448,7 +448,7 @@ msgstr "" "meth:`assert_called_once_with`,他們針對的是最近的一次的呼叫,而且對於 :meth:" "`assert_called_once_with`,最近一次的呼叫還必須也是唯一一次的呼叫。" -#: ../../library/unittest.mock.rst:361 +#: ../../library/unittest.mock.rst:364 msgid "" "assert the mock has been called with the specified calls. The :attr:" "`mock_calls` list is checked for the calls." @@ -456,7 +456,7 @@ msgstr "" "斷言 mock 已經使用指定的呼叫方式來呼叫。此斷言會檢查 :attr:`mock_calls` 串列" "中的呼叫。" -#: ../../library/unittest.mock.rst:364 +#: ../../library/unittest.mock.rst:367 msgid "" "If *any_order* is false then the calls must be sequential. There can be " "extra calls before or after the specified calls." @@ -464,7 +464,7 @@ msgstr "" "如果 *any_order* 為 false,那麼這些呼叫必須按照順序。在指定的呼叫之前或之後可" "以有額外的呼叫。" -#: ../../library/unittest.mock.rst:368 +#: ../../library/unittest.mock.rst:371 msgid "" "If *any_order* is true then the calls can be in any order, but they must all " "appear in :attr:`mock_calls`." @@ -472,19 +472,19 @@ msgstr "" "如果 *any_order* 為 true,那麼這些呼叫可以以任何順序出現,但它們必須全部出現" "在 :attr:`mock_calls` 中。" -#: ../../library/unittest.mock.rst:383 +#: ../../library/unittest.mock.rst:386 msgid "Assert the mock was never called." msgstr "斷言 mock 從未被呼叫。" -#: ../../library/unittest.mock.rst:398 +#: ../../library/unittest.mock.rst:402 msgid "The reset_mock method resets all the call attributes on a mock object:" msgstr "reset_mock 方法重置 mock 物件上的所有呼叫屬性:" -#: ../../library/unittest.mock.rst:408 +#: ../../library/unittest.mock.rst:412 msgid "Added two keyword-only arguments to the reset_mock function." msgstr "reset_mock 函式新增了兩個僅限關鍵字引數 (keyword-only arguments)。" -#: ../../library/unittest.mock.rst:411 +#: ../../library/unittest.mock.rst:415 msgid "" "This can be useful where you want to make a series of assertions that reuse " "the same object. Note that :meth:`reset_mock` *doesn't* clear the :attr:" @@ -500,11 +500,11 @@ msgstr "" "`side_effect`,則將相應的參數設置為 ``True``。Child mock 和回傳值 mock(如果" "有的話)也會被重置。" -#: ../../library/unittest.mock.rst:419 +#: ../../library/unittest.mock.rst:423 msgid "*return_value*, and *side_effect* are keyword-only arguments." msgstr "*return_value* 和 *side_effect* 是僅限關鍵字引數。" -#: ../../library/unittest.mock.rst:425 +#: ../../library/unittest.mock.rst:429 msgid "" "Add a spec to a mock. *spec* can either be an object or a list of strings. " "Only attributes on the *spec* can be fetched as attributes from the mock." @@ -512,11 +512,11 @@ msgstr "" "向 mock 增加一個規格 (spec)。*spec* 可以是一個物件或一個字串串列 (list of " "strings)。只有在 *spec* 上的屬性才能作為 mock 的屬性被取得。" -#: ../../library/unittest.mock.rst:429 +#: ../../library/unittest.mock.rst:433 msgid "If *spec_set* is true then only attributes on the spec can be set." msgstr "如果 *spec_set* 為 true,那麼只能設定在規格中的屬性。" -#: ../../library/unittest.mock.rst:434 +#: ../../library/unittest.mock.rst:438 msgid "" "Attach a mock as an attribute of this one, replacing its name and parent. " "Calls to the attached mock will be recorded in the :attr:`method_calls` and :" @@ -526,11 +526,11 @@ msgstr "" "mock 的呼叫將被記錄在這個 Mock 的 :attr:`method_calls` 和 :attr:`mock_calls` " "屬性中。" -#: ../../library/unittest.mock.rst:441 +#: ../../library/unittest.mock.rst:445 msgid "Set attributes on the mock through keyword arguments." msgstr "透過關鍵字引數在 mock 上設定屬性。" -#: ../../library/unittest.mock.rst:443 +#: ../../library/unittest.mock.rst:447 msgid "" "Attributes plus return values and side effects can be set on child mocks " "using standard dot notation and unpacking a dictionary in the method call:" @@ -538,18 +538,18 @@ msgstr "" "可以在使用 method(方法)呼叫時,使用標準點記法 (dot notation) 並將字典拆開," "為 child mock 設定屬性、回傳值和 side effects:" -#: ../../library/unittest.mock.rst:457 +#: ../../library/unittest.mock.rst:461 msgid "The same thing can be achieved in the constructor call to mocks:" msgstr "同樣的事情可以在 mock 的建構函式呼叫中實現:" -#: ../../library/unittest.mock.rst:470 +#: ../../library/unittest.mock.rst:474 msgid "" ":meth:`configure_mock` exists to make it easier to do configuration after " "the mock has been created." msgstr "" ":meth:`configure_mock` 的存在是為了在 mock 被建立後更容易進行組態設定。" -#: ../../library/unittest.mock.rst:476 +#: ../../library/unittest.mock.rst:480 msgid "" ":class:`Mock` objects limit the results of ``dir(some_mock)`` to useful " "results. For mocks with a *spec* this includes all the permitted attributes " @@ -558,13 +558,13 @@ msgstr "" ":class:`Mock` 物件限制了 ``dir(some_mock)`` 僅顯示有用的結果。對於具有 " "*spec* 的 mock,這包含所有被允許的 mock 屬性。" -#: ../../library/unittest.mock.rst:480 +#: ../../library/unittest.mock.rst:484 msgid "" "See :data:`FILTER_DIR` for what this filtering does, and how to switch it " "off." msgstr "請參閱 :data:`FILTER_DIR` 以了解這種過濾行為的作用,以及如何關閉它。" -#: ../../library/unittest.mock.rst:486 +#: ../../library/unittest.mock.rst:490 msgid "" "Create the child mocks for attributes and return value. By default child " "mocks will be the same type as the parent. Subclasses of Mock may want to " @@ -573,35 +573,35 @@ msgstr "" "建立為了得到屬性和回傳值的 child mock。預設情況下,child mock 將與其上代是相" "同的型別。Mock 的子類別可能會想要置換此行為,以自定義 child mock 的建立方式。" -#: ../../library/unittest.mock.rst:491 +#: ../../library/unittest.mock.rst:495 msgid "" "For non-callable mocks the callable variant will be used (rather than any " "custom subclass)." msgstr "對於不可呼叫的 mock,將使用可呼叫的變體,而不是任何的自定義子類別。" -#: ../../library/unittest.mock.rst:497 +#: ../../library/unittest.mock.rst:501 msgid "A boolean representing whether or not the mock object has been called:" msgstr "一個 boolean(布林),表述 mock 物件是否已經被呼叫:" -#: ../../library/unittest.mock.rst:508 +#: ../../library/unittest.mock.rst:512 msgid "An integer telling you how many times the mock object has been called:" msgstr "一個整數,告訴你 mock 物件被呼叫的次數:" -#: ../../library/unittest.mock.rst:520 +#: ../../library/unittest.mock.rst:524 msgid "Set this to configure the value returned by calling the mock:" msgstr "設定此值以配置呼叫 mock 時回傳的值:" -#: ../../library/unittest.mock.rst:527 +#: ../../library/unittest.mock.rst:531 msgid "" "The default return value is a mock object and you can configure it in the " "normal way:" msgstr "預設的回傳值是一個 mock 物件,你也可以按照正常的方式配置它:" -#: ../../library/unittest.mock.rst:536 +#: ../../library/unittest.mock.rst:540 msgid ":attr:`return_value` can also be set in the constructor:" msgstr ":attr:`return_value` 也可以在建構函式中設定:" -#: ../../library/unittest.mock.rst:547 +#: ../../library/unittest.mock.rst:551 msgid "" "This can either be a function to be called when the mock is called, an " "iterable or an exception (class or instance) to be raised." @@ -609,7 +609,7 @@ msgstr "" "這可以是一個在呼叫 mock 時要呼叫的函式、一個可疊代物件,或者要引發的例外(類" "別或實例)。" -#: ../../library/unittest.mock.rst:550 +#: ../../library/unittest.mock.rst:554 msgid "" "If you pass in a function it will be called with same arguments as the mock " "and unless the function returns the :data:`DEFAULT` singleton the call to " @@ -622,7 +622,7 @@ msgstr "" "式回傳 :data:`DEFAULT`,那麼 mock 將回傳其正常的回傳值(從 :attr:" "`return_value` 得到)。" -#: ../../library/unittest.mock.rst:556 +#: ../../library/unittest.mock.rst:560 msgid "" "If you pass in an iterable, it is used to retrieve an iterator which must " "yield a value on every call. This value can either be an exception instance " @@ -633,21 +633,21 @@ msgstr "" "產出 (yield) 一個值。這個值可以是要引發的例外實例,或者是對 mock 呼叫時要回傳" "的值(處理 :data:`DEFAULT` 的方式與函式的狀況相同)。" -#: ../../library/unittest.mock.rst:561 +#: ../../library/unittest.mock.rst:565 msgid "" "An example of a mock that raises an exception (to test exception handling of " "an API):" msgstr "以下是一個引發例外的 mock 的範例(用於測試 API 的例外處理):" -#: ../../library/unittest.mock.rst:571 +#: ../../library/unittest.mock.rst:575 msgid "Using :attr:`side_effect` to return a sequence of values:" msgstr "使用 :attr:`side_effect` 回傳一連串值的範例:" -#: ../../library/unittest.mock.rst:578 +#: ../../library/unittest.mock.rst:582 msgid "Using a callable:" msgstr "使用可被呼叫物件的範例:" -#: ../../library/unittest.mock.rst:588 +#: ../../library/unittest.mock.rst:592 msgid "" ":attr:`side_effect` can be set in the constructor. Here's an example that " "adds one to the value the mock is called with and returns it:" @@ -655,11 +655,11 @@ msgstr "" ":attr:`side_effect` 可以在建構函式中設定。以下是一個範例,它將 mock 被呼叫時" "給的值加一並回傳:" -#: ../../library/unittest.mock.rst:598 +#: ../../library/unittest.mock.rst:602 msgid "Setting :attr:`side_effect` to ``None`` clears it:" msgstr "將 :attr:`side_effect` 設定為 ``None`` 可以清除它:" -#: ../../library/unittest.mock.rst:612 +#: ../../library/unittest.mock.rst:616 msgid "" "This is either ``None`` (if the mock hasn't been called), or the arguments " "that the mock was last called with. This will be in the form of a tuple: the " @@ -673,7 +673,7 @@ msgstr "" "是 mock 被呼叫時傳遞的所有有序引數(或一個空元組)。第二個成員,其可以通過 " "``kwargs`` 屬性訪問,是所有關鍵字引數(或一個空字典)。" -#: ../../library/unittest.mock.rst:645 +#: ../../library/unittest.mock.rst:649 msgid "" ":attr:`call_args`, along with members of the lists :attr:`call_args_list`, :" "attr:`method_calls` and :attr:`mock_calls` are :data:`call` objects. These " @@ -685,11 +685,11 @@ msgstr "" "獲取各個引數並進行更複雜的斷言。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:651 +#: ../../library/unittest.mock.rst:655 msgid "Added ``args`` and ``kwargs`` properties." msgstr "新增 ``args`` 與 ``kwargs`` 特性。" -#: ../../library/unittest.mock.rst:657 +#: ../../library/unittest.mock.rst:661 msgid "" "This is a list of all the calls made to the mock object in sequence (so the " "length of the list is the number of times it has been called). Before any " @@ -701,7 +701,7 @@ msgstr "" "在任何呼叫發生之前,它會是一個空的串列。 :data:`call` 物件可用於方便地建構呼" "叫的串列,以便與 :attr:`call_args_list` 進行比較。" -#: ../../library/unittest.mock.rst:673 +#: ../../library/unittest.mock.rst:677 msgid "" "Members of :attr:`call_args_list` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -710,7 +710,7 @@ msgstr "" ":attr:`call_args_list` 的成員都是 :data:`call` 物件。這些物件可以被拆包為元" "組,以取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:680 +#: ../../library/unittest.mock.rst:684 msgid "" "As well as tracking calls to themselves, mocks also track calls to methods " "and attributes, and *their* methods and attributes:" @@ -718,7 +718,7 @@ msgstr "" "除了追蹤對自身的呼叫之外,mock 還會追蹤對方法和屬性的呼叫,以及\\ *它們(這些" "方法和屬性)*\\ 的方法和屬性:" -#: ../../library/unittest.mock.rst:691 +#: ../../library/unittest.mock.rst:695 msgid "" "Members of :attr:`method_calls` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -727,7 +727,7 @@ msgstr "" ":attr:`method_calls` 的成員都是 :data:`call` 物件。這些物件可以拆包為元組,以" "取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:698 +#: ../../library/unittest.mock.rst:702 msgid "" ":attr:`mock_calls` records *all* calls to the mock object, its methods, " "magic methods *and* return value mocks." @@ -735,7 +735,7 @@ msgstr "" ":attr:`mock_calls` 記錄了 *所有* 對 mock 物件的呼叫,包含其方法、魔術方法以及" "回傳值 mock。" -#: ../../library/unittest.mock.rst:716 +#: ../../library/unittest.mock.rst:720 msgid "" "Members of :attr:`mock_calls` are :data:`call` objects. These can be " "unpacked as tuples to get at the individual arguments. See :ref:`calls as " @@ -744,7 +744,7 @@ msgstr "" ":attr:`method_calls` 的成員都是 :data:`call` 物件。這些物件可以拆包為元組,以" "取得各個引數。參見 :ref:`calls as tuples `。" -#: ../../library/unittest.mock.rst:722 +#: ../../library/unittest.mock.rst:726 msgid "" "The way :attr:`mock_calls` are recorded means that where nested calls are " "made, the parameters of ancestor calls are not recorded and so will always " @@ -753,7 +753,7 @@ msgstr "" ":attr:`mock_calls` 記錄的方式意味著在進行巢狀呼叫時,上代 (ancestor) 呼叫的參" "數不會被記錄,因此在比較時它們將始終相等:" -#: ../../library/unittest.mock.rst:736 +#: ../../library/unittest.mock.rst:740 msgid "" "Normally the :attr:`__class__` attribute of an object will return its type. " "For a mock object with a :attr:`spec`, ``__class__`` returns the spec class " @@ -764,7 +764,7 @@ msgstr "" "的 mock 物件,``__class__`` 會回傳 spec 的類別。這允許 mock 物件通過對它們所" "替代或偽裝的物件進行的 :func:`isinstance` 測試:" -#: ../../library/unittest.mock.rst:745 +#: ../../library/unittest.mock.rst:749 msgid "" ":attr:`__class__` is assignable to, this allows a mock to pass an :func:" "`isinstance` check without forcing you to use a spec:" @@ -772,7 +772,7 @@ msgstr "" ":attr:`__class__` 可以被指定,這允許 mock 通過 :func:`isinstance` 檢查,而不" "需要強制使用 spec:" -#: ../../library/unittest.mock.rst:755 +#: ../../library/unittest.mock.rst:759 msgid "" "A non-callable version of :class:`Mock`. The constructor parameters have the " "same meaning of :class:`Mock`, with the exception of *return_value* and " @@ -781,7 +781,7 @@ msgstr "" ":class:`Mock` 的一個不可呼叫版本。建構函式參數的意義與 :class:`Mock` 相同,其" "例外為 *return_value* 和 *side_effect* 在不可呼叫的 mock 上無意義。" -#: ../../library/unittest.mock.rst:759 +#: ../../library/unittest.mock.rst:763 msgid "" "Mock objects that use a class or an instance as a :attr:`spec` or :attr:" "`spec_set` are able to pass :func:`isinstance` tests:" @@ -789,7 +789,7 @@ msgstr "" "使用類別或實例作為 :attr:`spec` 或 :attr:`spec_set` 的 mock 物件能夠通過 :" "func:`isinstance` 測試:" -#: ../../library/unittest.mock.rst:769 +#: ../../library/unittest.mock.rst:773 msgid "" "The :class:`Mock` classes have support for mocking magic methods. See :ref:" "`magic methods ` for the full details." @@ -797,7 +797,7 @@ msgstr "" ":class:`Mock` 類別支援 mock 魔術方法。細節請參考\\ :ref:`魔術方法 `。" -#: ../../library/unittest.mock.rst:772 +#: ../../library/unittest.mock.rst:776 msgid "" "The mock classes and the :func:`patch` decorators all take arbitrary keyword " "arguments for configuration. For the :func:`patch` decorators the keywords " @@ -808,7 +808,7 @@ msgstr "" "`patch` 裝飾器,這些關鍵字會傳遞給正在建立 mock 的建構函式。這些關鍵字引數用" "於配置 mock 的屬性:" -#: ../../library/unittest.mock.rst:783 +#: ../../library/unittest.mock.rst:787 msgid "" "The return value and side effect of child mocks can be set in the same way, " "using dotted notation. As you can't use dotted names directly in a call you " @@ -817,7 +817,7 @@ msgstr "" "Child mock 的回傳值和 side effect 可以使用使用點記法進行設置。由於你無法直接" "在呼叫中使用帶有點 (.) 的名稱,因此你必須建立一個字典並使用 ``**`` 解包:" -#: ../../library/unittest.mock.rst:798 +#: ../../library/unittest.mock.rst:802 msgid "" "A callable mock which was created with a *spec* (or a *spec_set*) will " "introspect the specification object's signature when matching calls to the " @@ -828,7 +828,7 @@ msgstr "" "將會內省 (introspect) 規格物件的簽名 (signature)。因此,它可以匹配實際呼叫的" "引數,無論它們是按位置傳遞還是按名稱傳遞: ::" -#: ../../library/unittest.mock.rst:803 +#: ../../library/unittest.mock.rst:807 msgid "" ">>> def f(a, b, c): pass\n" "...\n" @@ -846,7 +846,7 @@ msgstr "" ">>> mock.assert_called_with(1, 2, 3)\n" ">>> mock.assert_called_with(a=1, b=2, c=3)" -#: ../../library/unittest.mock.rst:811 +#: ../../library/unittest.mock.rst:815 msgid "" "This applies to :meth:`~Mock.assert_called_with`, :meth:`~Mock." "assert_called_once_with`, :meth:`~Mock.assert_has_calls` and :meth:`~Mock." @@ -858,13 +858,13 @@ msgstr "" "assert_any_call`。在使用 :ref:`auto-speccing` 時,它還適用於 mock 物件的方法" "呼叫。" -#: ../../library/unittest.mock.rst:816 +#: ../../library/unittest.mock.rst:820 msgid "Added signature introspection on specced and autospecced mock objects." msgstr "" "對於已經設置了規格(spec)和自動規格(autospec)的 mock 物件,新增簽名內省功" "能。" -#: ../../library/unittest.mock.rst:822 +#: ../../library/unittest.mock.rst:826 msgid "" "A mock intended to be used as a :class:`property`, or other :term:" "`descriptor`, on a class. :class:`PropertyMock` provides :meth:`~object." @@ -875,7 +875,7 @@ msgstr "" "class:`PropertyMock` 提供了 :meth:`~object.__get__` 和 :meth:`~object." "__set__` 方法,因此你可以在它被提取時指定回傳值。" -#: ../../library/unittest.mock.rst:827 +#: ../../library/unittest.mock.rst:831 msgid "" "Fetching a :class:`PropertyMock` instance from an object calls the mock, " "with no args. Setting it calls the mock with the value being set. ::" @@ -883,7 +883,7 @@ msgstr "" "從物件中提取 :class:`PropertyMock` 實例會不帶任何引數呼叫 mock。設定它則會用" "設定的值來呼叫 mock: ::" -#: ../../library/unittest.mock.rst:830 +#: ../../library/unittest.mock.rst:834 msgid "" ">>> class Foo:\n" "... @property\n" @@ -921,7 +921,7 @@ msgstr "" ">>> mock_foo.mock_calls\n" "[call(), call(6)]" -#: ../../library/unittest.mock.rst:848 +#: ../../library/unittest.mock.rst:852 msgid "" "Because of the way mock attributes are stored you can't directly attach a :" "class:`PropertyMock` to a mock object. Instead you can attach it to the mock " @@ -930,7 +930,7 @@ msgstr "" "由於 mock 屬性的儲存方式,你無法直接將 :class:`PropertyMock` 附加到 mock 物" "件。但是你可以將其附加到 mock 型別的物件: ::" -#: ../../library/unittest.mock.rst:852 +#: ../../library/unittest.mock.rst:856 msgid "" ">>> m = MagicMock()\n" ">>> p = PropertyMock(return_value=3)\n" @@ -946,14 +946,14 @@ msgstr "" "3\n" ">>> p.assert_called_once_with()" -#: ../../library/unittest.mock.rst:861 +#: ../../library/unittest.mock.rst:865 msgid "" "If an :exc:`AttributeError` is raised by :class:`PropertyMock`, it will be " "interpreted as a missing descriptor and :meth:`~object.__getattr__` will be " "called on the parent mock::" msgstr "" -#: ../../library/unittest.mock.rst:865 +#: ../../library/unittest.mock.rst:869 msgid "" ">>> m = MagicMock()\n" ">>> no_attribute = PropertyMock(side_effect=AttributeError)\n" @@ -967,11 +967,11 @@ msgstr "" ">>> m.my_property\n" "" -#: ../../library/unittest.mock.rst:871 +#: ../../library/unittest.mock.rst:875 msgid "See :meth:`~object.__getattr__` for details." msgstr "詳情請見 :meth:`~object.__getattr__`。" -#: ../../library/unittest.mock.rst:876 +#: ../../library/unittest.mock.rst:880 msgid "" "An asynchronous version of :class:`MagicMock`. The :class:`AsyncMock` object " "will behave so the object is recognized as an async function, and the result " @@ -980,7 +980,7 @@ msgstr "" ":class:`MagicMock` 的非同步版本。:class:`AsyncMock` 物件的表現將被視為非同步" "函式,並且呼叫的結果是一個可等待物件。" -#: ../../library/unittest.mock.rst:886 +#: ../../library/unittest.mock.rst:890 msgid "" "The result of ``mock()`` is an async function which will have the outcome of " "``side_effect`` or ``return_value`` after it has been awaited:" @@ -988,19 +988,19 @@ msgstr "" "``mock()`` 的結果是一個非同步函式,在它被等待後將具有 ``side_effect`` 或 " "``return_value`` 的結果:" -#: ../../library/unittest.mock.rst:889 +#: ../../library/unittest.mock.rst:893 msgid "" "if ``side_effect`` is a function, the async function will return the result " "of that function," msgstr "如果 ``side_effect`` 是一個函式,非同步函式將回傳該函式的結果," -#: ../../library/unittest.mock.rst:891 +#: ../../library/unittest.mock.rst:895 msgid "" "if ``side_effect`` is an exception, the async function will raise the " "exception," msgstr "如果 ``side_effect`` 是一個例外,則非同步函式將引發該例外," -#: ../../library/unittest.mock.rst:893 +#: ../../library/unittest.mock.rst:897 msgid "" "if ``side_effect`` is an iterable, the async function will return the next " "value of the iterable, however, if the sequence of result is exhausted, " @@ -1009,7 +1009,7 @@ msgstr "" "如果 ``side_effect`` 是一個可疊代物件,非同步函式將回傳可疊代物件的下一個值," "但如果結果序列耗盡,將立即引發 ``StopAsyncIteration``," -#: ../../library/unittest.mock.rst:896 +#: ../../library/unittest.mock.rst:900 msgid "" "if ``side_effect`` is not defined, the async function will return the value " "defined by ``return_value``, hence, by default, the async function returns a " @@ -1018,7 +1018,7 @@ msgstr "" "如果 ``side_effect`` 沒有被定義,非同步函式將回傳由 ``return_value`` 定義的" "值,因此在預設情況下,非同步函式回傳一個新的 :class:`AsyncMock` 物件。" -#: ../../library/unittest.mock.rst:901 +#: ../../library/unittest.mock.rst:905 msgid "" "Setting the *spec* of a :class:`Mock` or :class:`MagicMock` to an async " "function will result in a coroutine object being returned after calling." @@ -1026,7 +1026,7 @@ msgstr "" "將 :class:`Mock` 或 :class:`MagicMock` 的 *spec* 設定為非同步函式將導致在呼叫" "後回傳一個協程物件。" -#: ../../library/unittest.mock.rst:913 +#: ../../library/unittest.mock.rst:917 msgid "" "Setting the *spec* of a :class:`Mock`, :class:`MagicMock`, or :class:" "`AsyncMock` to a class with asynchronous and synchronous functions will " @@ -1041,7 +1041,7 @@ msgstr "" "`MagicMock`\\ )或 :class:`Mock`\\ (如果上代 mock 為 :class:`Mock`\\ )。所" "有非同步函式將被設定為 :class:`AsyncMock`。" -#: ../../library/unittest.mock.rst:941 +#: ../../library/unittest.mock.rst:945 msgid "" "Assert that the mock was awaited at least once. Note that this is separate " "from the object having been called, the ``await`` keyword must be used:" @@ -1049,25 +1049,25 @@ msgstr "" "斷言 mock 至少被等待過一次。請注意這與物件是否被呼叫是分開的,``await`` 關鍵" "字必須被使用:" -#: ../../library/unittest.mock.rst:960 +#: ../../library/unittest.mock.rst:964 msgid "Assert that the mock was awaited exactly once." msgstr "斷言 mock 正好被等待了一次。" -#: ../../library/unittest.mock.rst:976 +#: ../../library/unittest.mock.rst:980 msgid "Assert that the last await was with the specified arguments." msgstr "斷言最後一次等待使用了指定的引數。" -#: ../../library/unittest.mock.rst:993 +#: ../../library/unittest.mock.rst:997 msgid "" "Assert that the mock was awaited exactly once and with the specified " "arguments." msgstr "斷言 mock 只被等待了一次並使用了指定的引數。" -#: ../../library/unittest.mock.rst:1010 +#: ../../library/unittest.mock.rst:1014 msgid "Assert the mock has ever been awaited with the specified arguments." msgstr "斷言 mock 曾經被使用指定的引數等待過。" -#: ../../library/unittest.mock.rst:1026 +#: ../../library/unittest.mock.rst:1030 msgid "" "Assert the mock has been awaited with the specified calls. The :attr:" "`await_args_list` list is checked for the awaits." @@ -1075,7 +1075,7 @@ msgstr "" "斷言 mock 已被使用指定的呼叫進行等待。:attr:`await_args_list` 串列將被檢查以" "確認等待的內容。" -#: ../../library/unittest.mock.rst:1029 +#: ../../library/unittest.mock.rst:1033 msgid "" "If *any_order* is false then the awaits must be sequential. There can be " "extra calls before or after the specified awaits." @@ -1083,7 +1083,7 @@ msgstr "" "如果 *any_order* 為 false,則等待必須按照順序。指定的等待之前或之後可以有額外" "的呼叫。" -#: ../../library/unittest.mock.rst:1033 +#: ../../library/unittest.mock.rst:1037 msgid "" "If *any_order* is true then the awaits can be in any order, but they must " "all appear in :attr:`await_args_list`." @@ -1091,11 +1091,11 @@ msgstr "" "如果 *any_order* 為 true,則等待可以以任何順序出現,但它們必須全部出現在 :" "attr:`await_args_list` 中。" -#: ../../library/unittest.mock.rst:1053 +#: ../../library/unittest.mock.rst:1057 msgid "Assert that the mock was never awaited." msgstr "斷言 mock 從未被等待。" -#: ../../library/unittest.mock.rst:1060 +#: ../../library/unittest.mock.rst:1064 msgid "" "See :func:`Mock.reset_mock`. Also sets :attr:`await_count` to 0, :attr:" "`await_args` to None, and clears the :attr:`await_args_list`." @@ -1103,12 +1103,12 @@ msgstr "" "參見 :func:`Mock.reset_mock`。同時將 :attr:`await_count` 設定為 0,:attr:" "`await_args` 設定為 None,並清除 :attr:`await_args_list`。" -#: ../../library/unittest.mock.rst:1065 +#: ../../library/unittest.mock.rst:1069 msgid "" "An integer keeping track of how many times the mock object has been awaited." msgstr "一個整數,用來記錄 mock 物件已被等待的次數。" -#: ../../library/unittest.mock.rst:1080 +#: ../../library/unittest.mock.rst:1084 msgid "" "This is either ``None`` (if the mock hasn’t been awaited), or the arguments " "that the mock was last awaited with. Functions the same as :attr:`Mock." @@ -1117,7 +1117,7 @@ msgstr "" "這可能是 ``None``\\ (如果 mock 尚未被等待),或者是上次等待 mock 時使用的引" "數。與 :attr:`Mock.call_args` 的功能相同。" -#: ../../library/unittest.mock.rst:1098 +#: ../../library/unittest.mock.rst:1102 msgid "" "This is a list of all the awaits made to the mock object in sequence (so the " "length of the list is the number of times it has been awaited). Before any " @@ -1126,11 +1126,58 @@ msgstr "" "這是一個按照順序記錄 mock 物件所有等待的串列(因此串列的長度表示該物件已被等" "待的次數)。在進行任何等待之前,此串列為空。" -#: ../../library/unittest.mock.rst:1117 +#: ../../library/unittest.mock.rst:1122 +msgid "" +"A version of :class:`MagicMock` for multithreading tests. The :class:" +"`ThreadingMock` object provides extra methods to wait for a call to be " +"invoked, rather than assert on it immediately." +msgstr "" + +#: ../../library/unittest.mock.rst:1126 +msgid "" +"The default timeout is specified by the ``timeout`` argument, or if unset by " +"the :attr:`ThreadingMock.DEFAULT_TIMEOUT` attribute, which defaults to " +"blocking (``None``)." +msgstr "" + +#: ../../library/unittest.mock.rst:1129 +msgid "" +"You can configure the global default timeout by setting :attr:`ThreadingMock." +"DEFAULT_TIMEOUT`." +msgstr "" + +#: ../../library/unittest.mock.rst:1133 +msgid "Waits until the mock is called." +msgstr "等待直到 mock 被呼叫。" + +#: ../../library/unittest.mock.rst:1135 +msgid "" +"If a timeout was passed at the creation of the mock or if a timeout argument " +"is passed to this function, the function raises an :exc:`AssertionError` if " +"the call is not performed in time." +msgstr "" + +#: ../../library/unittest.mock.rst:1147 +msgid "Waits until the mock is called with the specified arguments." +msgstr "等到直到 mock 被以特定引數呼叫。" + +#: ../../library/unittest.mock.rst:1149 +msgid "" +"If a timeout was passed at the creation of the mock the function raises an :" +"exc:`AssertionError` if the call is not performed in time." +msgstr "" + +#: ../../library/unittest.mock.rst:1160 +msgid "" +"Global default timeout in seconds to create instances of :class:" +"`ThreadingMock`." +msgstr "" + +#: ../../library/unittest.mock.rst:1166 msgid "Calling" msgstr "呼叫" -#: ../../library/unittest.mock.rst:1119 +#: ../../library/unittest.mock.rst:1168 msgid "" "Mock objects are callable. The call will return the value set as the :attr:" "`~Mock.return_value` attribute. The default return value is a new Mock " @@ -1142,7 +1189,7 @@ msgstr "" "的回傳值是一個新的 Mock 物件;它會在第一次存取回傳值時(無論是顯式存取還是透" "過呼叫 Mock)被建立,但是這個回傳值會被儲存,之後每次都回傳同一個值。" -#: ../../library/unittest.mock.rst:1125 +#: ../../library/unittest.mock.rst:1174 msgid "" "Calls made to the object will be recorded in the attributes like :attr:" "`~Mock.call_args` and :attr:`~Mock.call_args_list`." @@ -1150,7 +1197,7 @@ msgstr "" "對物件的呼叫會被記錄在如 :attr:`~Mock.call_args` 和 :attr:`~Mock." "call_args_list` 等屬性中。" -#: ../../library/unittest.mock.rst:1128 +#: ../../library/unittest.mock.rst:1177 msgid "" "If :attr:`~Mock.side_effect` is set then it will be called after the call " "has been recorded, so if :attr:`side_effect` raises an exception the call is " @@ -1159,7 +1206,7 @@ msgstr "" "如果 :attr:`~Mock.side_effect` 被設定,那麼在呼叫被記錄後它才會被呼叫,所以如" "果 :attr:`side_effect` 引發例外,呼叫仍然會被記錄。" -#: ../../library/unittest.mock.rst:1132 +#: ../../library/unittest.mock.rst:1181 msgid "" "The simplest way to make a mock raise an exception when called is to make :" "attr:`~Mock.side_effect` an exception class or instance:" @@ -1167,7 +1214,7 @@ msgstr "" "呼叫 mock 時引發例外的最簡單方式是將 :attr:`~Mock.side_effect` 設定為例外類別" "或實例:" -#: ../../library/unittest.mock.rst:1150 +#: ../../library/unittest.mock.rst:1199 msgid "" "If :attr:`side_effect` is a function then whatever that function returns is " "what calls to the mock return. The :attr:`side_effect` function is called " @@ -1178,7 +1225,7 @@ msgstr "" "傳的值。:attr:`side_effect` 函式會使用與 mock 相同的引數被呼叫。這讓你可以根" "據輸入動態地變更呼叫的回傳值:" -#: ../../library/unittest.mock.rst:1166 +#: ../../library/unittest.mock.rst:1215 msgid "" "If you want the mock to still return the default return value (a new mock), " "or any set return value, then there are two ways of doing this. Either " @@ -1189,7 +1236,7 @@ msgstr "" "值,有兩種方法可以實現。從 :attr:`side_effect` 內部回傳 :attr:`mock." "return_value`,或回傳 :data:`DEFAULT`:" -#: ../../library/unittest.mock.rst:1185 +#: ../../library/unittest.mock.rst:1234 msgid "" "To remove a :attr:`side_effect`, and return to the default behaviour, set " "the :attr:`side_effect` to ``None``:" @@ -1197,7 +1244,7 @@ msgstr "" "要刪除 :attr:`side_effect`,並恢復預設行為,將 :attr:`side_effect` 設為 " "``None``:" -#: ../../library/unittest.mock.rst:1199 +#: ../../library/unittest.mock.rst:1248 msgid "" "The :attr:`side_effect` can also be any iterable object. Repeated calls to " "the mock will return values from the iterable (until the iterable is " @@ -1206,13 +1253,13 @@ msgstr "" ":attr:`side_effect` 也可以是任何可疊代的物件。對 mock 的重複呼叫將從可疊代物" "件中回傳值(直到疊代物件耗盡並引發 :exc:`StopIteration` 為止):" -#: ../../library/unittest.mock.rst:1215 +#: ../../library/unittest.mock.rst:1264 msgid "" "If any members of the iterable are exceptions they will be raised instead of " "returned::" msgstr "如果可疊代物件中的任何成員是例外,則它們將被引發而不是被回傳: ::" -#: ../../library/unittest.mock.rst:1218 +#: ../../library/unittest.mock.rst:1267 msgid "" ">>> iterable = (33, ValueError, 66)\n" ">>> m = MagicMock(side_effect=iterable)\n" @@ -1236,17 +1283,17 @@ msgstr "" ">>> m()\n" "66" -#: ../../library/unittest.mock.rst:1233 +#: ../../library/unittest.mock.rst:1282 msgid "Deleting Attributes" msgstr "刪除屬性" -#: ../../library/unittest.mock.rst:1235 +#: ../../library/unittest.mock.rst:1284 msgid "" "Mock objects create attributes on demand. This allows them to pretend to be " "objects of any type." msgstr "Mock 物件會在需要時建立屬性。這使得它們可以假裝成任何種類的物件。" -#: ../../library/unittest.mock.rst:1238 +#: ../../library/unittest.mock.rst:1287 msgid "" "You may want a mock object to return ``False`` to a :func:`hasattr` call, or " "raise an :exc:`AttributeError` when an attribute is fetched. You can do this " @@ -1257,7 +1304,7 @@ msgstr "" "提取時引發 :exc:`AttributeError`。你可以通過將物件提供為 mock 的 :attr:" "`spec` 來實現這一點,但這並不總是那麼好用。" -#: ../../library/unittest.mock.rst:1242 +#: ../../library/unittest.mock.rst:1291 msgid "" "You \"block\" attributes by deleting them. Once deleted, accessing an " "attribute will raise an :exc:`AttributeError`." @@ -1265,11 +1312,11 @@ msgstr "" "你可以通過刪除屬性來「阻擋」它們。一旦刪除,再次存取該屬性將會引發 :exc:" "`AttributeError`。" -#: ../../library/unittest.mock.rst:1259 +#: ../../library/unittest.mock.rst:1308 msgid "Mock names and the name attribute" msgstr "Mock 名稱與名稱屬性" -#: ../../library/unittest.mock.rst:1261 +#: ../../library/unittest.mock.rst:1310 msgid "" "Since \"name\" is an argument to the :class:`Mock` constructor, if you want " "your mock object to have a \"name\" attribute you can't just pass it in at " @@ -1280,7 +1327,7 @@ msgstr "" "擁有 \"name\" 屬性,你不能在建立時直接傳遞它。有兩種替代方法。其中一個選擇是" "使用 :meth:`~Mock.configure_mock`: ::" -#: ../../library/unittest.mock.rst:1266 +#: ../../library/unittest.mock.rst:1315 msgid "" ">>> mock = MagicMock()\n" ">>> mock.configure_mock(name='my_name')\n" @@ -1292,13 +1339,13 @@ msgstr "" ">>> mock.name\n" "'my_name'" -#: ../../library/unittest.mock.rst:1271 +#: ../../library/unittest.mock.rst:1320 msgid "" "A simpler option is to simply set the \"name\" attribute after mock " "creation::" msgstr "更簡單的方法是在 mock 建立後直接設定 \"name\" 屬性: ::" -#: ../../library/unittest.mock.rst:1273 +#: ../../library/unittest.mock.rst:1322 msgid "" ">>> mock = MagicMock()\n" ">>> mock.name = \"foo\"" @@ -1306,11 +1353,11 @@ msgstr "" ">>> mock = MagicMock()\n" ">>> mock.name = \"foo\"" -#: ../../library/unittest.mock.rst:1278 +#: ../../library/unittest.mock.rst:1327 msgid "Attaching Mocks as Attributes" msgstr "如同屬性一般附加 mock" -#: ../../library/unittest.mock.rst:1280 +#: ../../library/unittest.mock.rst:1329 msgid "" "When you attach a mock as an attribute of another mock (or as the return " "value) it becomes a \"child\" of that mock. Calls to the child are recorded " @@ -1326,7 +1373,7 @@ msgstr "" "mock 附加到記錄所有對子代的呼叫的上代並允許你對 mock 間的呼叫順序進行斷言非常" "有用:" -#: ../../library/unittest.mock.rst:1298 +#: ../../library/unittest.mock.rst:1347 msgid "" "The exception to this is if the mock has a name. This allows you to prevent " "the \"parenting\" if for some reason you don't want it to happen." @@ -1334,7 +1381,7 @@ msgstr "" "如果 mock 有 name 引數,則上述規則會有例外。這使你可以防止「親屬關係 " "(parenting)」的建立,假設因為某些原因你不希望這種狀況發生。" -#: ../../library/unittest.mock.rst:1309 +#: ../../library/unittest.mock.rst:1358 msgid "" "Mocks created for you by :func:`patch` are automatically given names. To " "attach mocks that have names to a parent you use the :meth:`~Mock." @@ -1343,7 +1390,7 @@ msgstr "" "由 :func:`patch` 為你建立的 mock 會自動被賦予名稱。若要將具有名稱的 mock 附加" "到上代,你可以使用 :meth:`~Mock.attach_mock` 方法: ::" -#: ../../library/unittest.mock.rst:1313 +#: ../../library/unittest.mock.rst:1362 msgid "" ">>> thing1 = object()\n" ">>> thing2 = object()\n" @@ -1371,7 +1418,7 @@ msgstr "" ">>> parent.mock_calls\n" "[call.child1('one'), call.child2('two')]" -#: ../../library/unittest.mock.rst:1327 +#: ../../library/unittest.mock.rst:1376 msgid "" "The only exceptions are magic methods and attributes (those that have " "leading and trailing double underscores). Mock doesn't create these but " @@ -1385,11 +1432,11 @@ msgstr "" "魔術方法卻獲得一個新的 Mock 物件時,會讓直譯器\\ *非常*\\ 困惑。如果你需要魔" "術方法的支援,請參閱\\ :ref:`魔術方法 `。" -#: ../../library/unittest.mock.rst:1336 +#: ../../library/unittest.mock.rst:1385 msgid "The patchers" msgstr "Patchers" -#: ../../library/unittest.mock.rst:1338 +#: ../../library/unittest.mock.rst:1387 msgid "" "The patch decorators are used for patching objects only within the scope of " "the function they decorate. They automatically handle the unpatching for " @@ -1400,17 +1447,17 @@ msgstr "" "patch 的中止,即使有異常被引發也是如此。所有這些函式也可以在 with 陳述式中使" "用,或者作為類別裝飾器使用。" -#: ../../library/unittest.mock.rst:1345 +#: ../../library/unittest.mock.rst:1394 msgid "patch" msgstr "patch" -#: ../../library/unittest.mock.rst:1349 +#: ../../library/unittest.mock.rst:1398 msgid "" "The key is to do the patching in the right namespace. See the section `where " "to patch`_." msgstr "關鍵是要在正確的命名空間進行 patch。請參閱 `where to patch`_ 一節。" -#: ../../library/unittest.mock.rst:1353 +#: ../../library/unittest.mock.rst:1402 msgid "" ":func:`patch` acts as a function decorator, class decorator or a context " "manager. Inside the body of the function or with statement, the *target* is " @@ -1421,7 +1468,7 @@ msgstr "" "內部,*目標*\\ 會被 patch 成一個\\ *新的*\\ 物件。當函式或 with 陳述式結束" "時,patch 就會被解除。" -#: ../../library/unittest.mock.rst:1358 +#: ../../library/unittest.mock.rst:1407 msgid "" "If *new* is omitted, then the target is replaced with an :class:`AsyncMock` " "if the patched object is an async function or a :class:`MagicMock` " @@ -1435,7 +1482,7 @@ msgstr "" "用且省略了 *new*,則所建立的 mock 會作為額外的引數傳遞給被裝飾的函式。如果 :" "func:`patch` 作為情境管理器使用,則所建立的 mock 將由情境管理器回傳。" -#: ../../library/unittest.mock.rst:1366 +#: ../../library/unittest.mock.rst:1415 msgid "" "*target* should be a string in the form ``'package.module.ClassName'``. The " "*target* is imported and the specified object replaced with the *new* " @@ -1448,7 +1495,7 @@ msgstr "" "`patch` 的環境中引入。target 在執行被裝飾的函式時被引入,而不是在裝飾器作用" "時 (decoration time)。" -#: ../../library/unittest.mock.rst:1372 +#: ../../library/unittest.mock.rst:1421 msgid "" "The *spec* and *spec_set* keyword arguments are passed to the :class:" "`MagicMock` if patch is creating one for you." @@ -1456,7 +1503,7 @@ msgstr "" "*spec* 和 *spec_set* 關鍵字引數會傳遞給 :class:`MagicMock`,如果 patch 正在為" "你建立一個。" -#: ../../library/unittest.mock.rst:1375 +#: ../../library/unittest.mock.rst:1424 msgid "" "In addition you can pass ``spec=True`` or ``spec_set=True``, which causes " "patch to pass in the object being mocked as the spec/spec_set object." @@ -1464,7 +1511,7 @@ msgstr "" "此外,你還可以傳遞 ``spec=True`` 或 ``spec_set=True``,這將導致 patch 將被 " "mock 的物件作為 spec/spec_set 物件傳遞。" -#: ../../library/unittest.mock.rst:1378 +#: ../../library/unittest.mock.rst:1427 msgid "" "*new_callable* allows you to specify a different class, or callable object, " "that will be called to create the *new* object. By default :class:" @@ -1474,7 +1521,7 @@ msgstr "" "*new* 物件。預設情況下,對於非同步函式使用 :class:`AsyncMock`,而對於其他情況" "則使用 :class:`MagicMock`。" -#: ../../library/unittest.mock.rst:1382 +#: ../../library/unittest.mock.rst:1431 msgid "" "A more powerful form of *spec* is *autospec*. If you set ``autospec=True`` " "then the mock will be created with a spec from the object being replaced. " @@ -1492,7 +1539,7 @@ msgstr "" "mock,它們的回傳值(即 'instance')將具有與類別相同的規格。請參閱 :func:" "`create_autospec` 函式和 :ref:`auto-speccing`。" -#: ../../library/unittest.mock.rst:1392 +#: ../../library/unittest.mock.rst:1441 msgid "" "Instead of ``autospec=True`` you can pass ``autospec=some_object`` to use an " "arbitrary object as the spec instead of the one being replaced." @@ -1500,7 +1547,7 @@ msgstr "" "你可以用 ``autospec=some_object`` 替代 ``autospec=True``,以使用任意物件作為" "規格,而不是被替換的物件。" -#: ../../library/unittest.mock.rst:1395 +#: ../../library/unittest.mock.rst:1444 msgid "" "By default :func:`patch` will fail to replace attributes that don't exist. " "If you pass in ``create=True``, and the attribute doesn't exist, patch will " @@ -1516,7 +1563,7 @@ msgstr "" "行環境建立的屬性的測試時非常有用。此功能預設為關閉,因為這可能會相當危險。開" "啟這個功能後,你可以對於實際上不存在的 API 撰寫會通過的測試!" -#: ../../library/unittest.mock.rst:1405 +#: ../../library/unittest.mock.rst:1454 msgid "" "If you are patching builtins in a module then you don't need to pass " "``create=True``, it will be added by default." @@ -1524,7 +1571,7 @@ msgstr "" "如果你正在 patch 模組中的內建函式,那麼你不需要傳遞 ``create=True``,它預設會" "被加入。" -#: ../../library/unittest.mock.rst:1409 +#: ../../library/unittest.mock.rst:1458 msgid "" "Patch can be used as a :class:`TestCase` class decorator. It works by " "decorating each test method in the class. This reduces the boilerplate code " @@ -1540,7 +1587,7 @@ msgstr "" "是 ``'test'``,這與 :mod:`unittest` 尋找測試的方式相匹配。你可以通過設定 " "``patch.TEST_PREFIX`` 來指定別的前綴。" -#: ../../library/unittest.mock.rst:1416 +#: ../../library/unittest.mock.rst:1465 msgid "" "Patch can be used as a context manager, with the with statement. Here the " "patching applies to the indented block after the with statement. If you use " @@ -1551,7 +1598,7 @@ msgstr "" "的縮排區塊。如果你使用 \"as\",則被 patch 的物件將被綁定到 \"as\" 後面的名" "稱;如果 :func:`patch` 正在為你建立一個 mock 物件,這會非常有用。" -#: ../../library/unittest.mock.rst:1421 +#: ../../library/unittest.mock.rst:1470 msgid "" ":func:`patch` takes arbitrary keyword arguments. These will be passed to :" "class:`AsyncMock` if the patched object is asynchronous, to :class:" @@ -1561,7 +1608,7 @@ msgstr "" "傳遞給 :class:`AsyncMock`,如果是同步的則會傳遞給 :class:`MagicMock`,或如果" "指定了 *new_callable*,則傳遞給它。" -#: ../../library/unittest.mock.rst:1425 +#: ../../library/unittest.mock.rst:1474 msgid "" "``patch.dict(...)``, ``patch.multiple(...)`` and ``patch.object(...)`` are " "available for alternate use-cases." @@ -1569,14 +1616,14 @@ msgstr "" "``patch.dict(...)``、``patch.multiple(...)`` 和 ``patch.object(...)`` 可用於" "其餘的使用情境。" -#: ../../library/unittest.mock.rst:1428 +#: ../../library/unittest.mock.rst:1477 msgid "" ":func:`patch` as function decorator, creating the mock for you and passing " "it into the decorated function::" msgstr "" ":func:`patch` 作為函式裝飾器,為你建立 mock 並將其傳遞給被裝飾的函式: ::" -#: ../../library/unittest.mock.rst:1431 +#: ../../library/unittest.mock.rst:1480 msgid "" ">>> @patch('__main__.SomeClass')\n" "... def function(normal_argument, mock_class):\n" @@ -1592,7 +1639,7 @@ msgstr "" ">>> function(None)\n" "True" -#: ../../library/unittest.mock.rst:1438 +#: ../../library/unittest.mock.rst:1487 msgid "" "Patching a class replaces the class with a :class:`MagicMock` *instance*. If " "the class is instantiated in the code under test then it will be the :attr:" @@ -1602,7 +1649,7 @@ msgstr "" "測試的程式碼中實例化,那麼它將是會被使用的 mock 的 :attr:`~Mock." "return_value`。" -#: ../../library/unittest.mock.rst:1442 +#: ../../library/unittest.mock.rst:1491 msgid "" "If the class is instantiated multiple times you could use :attr:`~Mock." "side_effect` to return a new mock each time. Alternatively you can set the " @@ -1611,7 +1658,7 @@ msgstr "" "如果該類別被實例化多次,你可以使用 :attr:`~Mock.side_effect` 來每次回傳一個新" "的 mock。 或者你可以將 *return_value* 設定成你想要的任何值。" -#: ../../library/unittest.mock.rst:1446 +#: ../../library/unittest.mock.rst:1495 msgid "" "To configure return values on methods of *instances* on the patched class " "you must do this on the :attr:`return_value`. For example::" @@ -1619,7 +1666,7 @@ msgstr "" "若要配置被 patch 的類別的\\ *實例*\\ 方法的回傳值,你必須在 :attr:" "`return_value` 上進行配置。 例如: ::" -#: ../../library/unittest.mock.rst:1449 +#: ../../library/unittest.mock.rst:1498 msgid "" ">>> class Class:\n" "... def method(self):\n" @@ -1643,7 +1690,7 @@ msgstr "" "... assert Class().method() == 'foo'\n" "..." -#: ../../library/unittest.mock.rst:1460 +#: ../../library/unittest.mock.rst:1509 msgid "" "If you use *spec* or *spec_set* and :func:`patch` is replacing a *class*, " "then the return value of the created mock will have the same spec. ::" @@ -1651,7 +1698,7 @@ msgstr "" "如果你使用 *spec* 或 *spec_set* 且 :func:`patch` 正在取代一個\\ *類別*,那麼" "被建立的 mock 的回傳值將具有相同的規格。: ::" -#: ../../library/unittest.mock.rst:1463 +#: ../../library/unittest.mock.rst:1512 msgid "" ">>> Original = Class\n" ">>> patcher = patch('__main__.Class', spec=True)\n" @@ -1667,7 +1714,7 @@ msgstr "" ">>> assert isinstance(instance, Original)\n" ">>> patcher.stop()" -#: ../../library/unittest.mock.rst:1470 +#: ../../library/unittest.mock.rst:1519 msgid "" "The *new_callable* argument is useful where you want to use an alternative " "class to the default :class:`MagicMock` for the created mock. For example, " @@ -1677,7 +1724,7 @@ msgstr "" "*new_callable* 引數非常有用。例如,如果你想要一個 :class:`NonCallableMock` 被" "使用: ::" -#: ../../library/unittest.mock.rst:1474 +#: ../../library/unittest.mock.rst:1523 msgid "" ">>> thing = object()\n" ">>> with patch('__main__.thing', new_callable=NonCallableMock) as " @@ -1699,13 +1746,13 @@ msgstr "" " ...\n" "TypeError: 'NonCallableMock' object is not callable" -#: ../../library/unittest.mock.rst:1483 +#: ../../library/unittest.mock.rst:1532 msgid "" "Another use case might be to replace an object with an :class:`io.StringIO` " "instance::" msgstr "另一個用法是用一個 :class:`io.StringIO` 實例替換一個物件: ::" -#: ../../library/unittest.mock.rst:1485 +#: ../../library/unittest.mock.rst:1534 msgid "" ">>> from io import StringIO\n" ">>> def foo():\n" @@ -1729,7 +1776,7 @@ msgstr "" "...\n" ">>> test()" -#: ../../library/unittest.mock.rst:1496 +#: ../../library/unittest.mock.rst:1545 msgid "" "When :func:`patch` is creating a mock for you, it is common that the first " "thing you need to do is to configure the mock. Some of that configuration " @@ -1740,7 +1787,7 @@ msgstr "" "一些配置可以在對 patch 的呼叫中完成。你傳遞到呼叫中的任何關鍵字都將用於在被建" "立的 mock 上設定屬性: ::" -#: ../../library/unittest.mock.rst:1501 +#: ../../library/unittest.mock.rst:1550 msgid "" ">>> patcher = patch('__main__.thing', first='one', second='two')\n" ">>> mock_thing = patcher.start()\n" @@ -1756,7 +1803,7 @@ msgstr "" ">>> mock_thing.second\n" "'two'" -#: ../../library/unittest.mock.rst:1508 +#: ../../library/unittest.mock.rst:1557 msgid "" "As well as attributes on the created mock attributes, like the :attr:`~Mock." "return_value` and :attr:`~Mock.side_effect`, of child mocks can also be " @@ -1769,7 +1816,7 @@ msgstr "" "數傳入,但是以它們作為鍵的字典仍然可以使用 ``**`` 擴充為一個 :func:`patch` 呼" "叫: ::" -#: ../../library/unittest.mock.rst:1514 +#: ../../library/unittest.mock.rst:1563 msgid "" ">>> config = {'method.return_value': 3, 'other.side_effect': KeyError}\n" ">>> patcher = patch('__main__.thing', **config)\n" @@ -1791,7 +1838,7 @@ msgstr "" " ...\n" "KeyError" -#: ../../library/unittest.mock.rst:1524 +#: ../../library/unittest.mock.rst:1573 msgid "" "By default, attempting to patch a function in a module (or a method or an " "attribute in a class) that does not exist will fail with :exc:" @@ -1800,7 +1847,7 @@ msgstr "" "預設情況下,嘗試 patch 模組中不存在的函式(或類別中的方法或屬性)將會失敗,並" "引發 :exc:`AttributeError`: ::" -#: ../../library/unittest.mock.rst:1527 +#: ../../library/unittest.mock.rst:1576 msgid "" ">>> @patch('sys.non_existing_attribute', 42)\n" "... def test():\n" @@ -1822,7 +1869,7 @@ msgstr "" "AttributeError: does not have the attribute " "'non_existing_attribute'" -#: ../../library/unittest.mock.rst:1536 +#: ../../library/unittest.mock.rst:1585 msgid "" "but adding ``create=True`` in the call to :func:`patch` will make the " "previous example work as expected::" @@ -1830,7 +1877,7 @@ msgstr "" "但是在對 :func:`patch` 的呼叫中增加 ``create=True`` 將使前面的範例按照預期運" "作: ::" -#: ../../library/unittest.mock.rst:1539 +#: ../../library/unittest.mock.rst:1588 msgid "" ">>> @patch('sys.non_existing_attribute', 42, create=True)\n" "... def test(mock_stdout):\n" @@ -1844,18 +1891,18 @@ msgstr "" "...\n" ">>> test()" -#: ../../library/unittest.mock.rst:1547 +#: ../../library/unittest.mock.rst:1596 msgid "" ":func:`patch` now returns an :class:`AsyncMock` if the target is an async " "function." msgstr "" "如果目標是一個非同步函式,:func:`patch` 現在會回傳一個 :class:`AsyncMock`。" -#: ../../library/unittest.mock.rst:1551 +#: ../../library/unittest.mock.rst:1600 msgid "patch.object" msgstr "patch.object" -#: ../../library/unittest.mock.rst:1555 +#: ../../library/unittest.mock.rst:1604 msgid "" "patch the named member (*attribute*) on an object (*target*) with a mock " "object." @@ -1863,7 +1910,7 @@ msgstr "" "使用一個 mock 物件 patch 一個物件(\\ *目標*\\ )上的命名成員(\\ *屬性" "*\\ )。" -#: ../../library/unittest.mock.rst:1558 +#: ../../library/unittest.mock.rst:1607 msgid "" ":func:`patch.object` can be used as a decorator, class decorator or a " "context manager. Arguments *new*, *spec*, *create*, *spec_set*, *autospec* " @@ -1876,7 +1923,7 @@ msgstr "" "`patch` 中的引數具有相同的意義。與 :func:`patch` 一樣,:func:`patch.object` " "接受任意關鍵字引數來配置它所建立的 mock 物件。" -#: ../../library/unittest.mock.rst:1564 +#: ../../library/unittest.mock.rst:1613 msgid "" "When used as a class decorator :func:`patch.object` honours ``patch." "TEST_PREFIX`` for choosing which methods to wrap." @@ -1884,7 +1931,7 @@ msgstr "" "當作為類別裝飾器使用時,:func:`patch.object` 會遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" -#: ../../library/unittest.mock.rst:1567 +#: ../../library/unittest.mock.rst:1616 msgid "" "You can either call :func:`patch.object` with three arguments or two " "arguments. The three argument form takes the object to be patched, the " @@ -1893,7 +1940,7 @@ msgstr "" "你可以使用三個引數或兩個引數來呼叫 :func:`patch.object`。三個引數的形式接受要" "被 patch 的物件、屬性名稱和要替換掉屬性的物件。" -#: ../../library/unittest.mock.rst:1571 +#: ../../library/unittest.mock.rst:1620 msgid "" "When calling with the two argument form you omit the replacement object, and " "a mock is created for you and passed in as an extra argument to the " @@ -1902,7 +1949,7 @@ msgstr "" "當使用兩個引數的形式呼叫時,你會省略要替換的物件,一個 mock 會為你建立並將其" "作為額外的引數傳遞給被裝飾的函式:" -#: ../../library/unittest.mock.rst:1582 +#: ../../library/unittest.mock.rst:1631 msgid "" "*spec*, *create* and the other arguments to :func:`patch.object` have the " "same meaning as they do for :func:`patch`." @@ -1910,17 +1957,17 @@ msgstr "" "*spec*、*create* 和 :func:`patch.object` 的其他引數與在 :func:`patch` 中的引" "數具有相同的意義。" -#: ../../library/unittest.mock.rst:1587 +#: ../../library/unittest.mock.rst:1636 msgid "patch.dict" msgstr "patch.dict" -#: ../../library/unittest.mock.rst:1591 +#: ../../library/unittest.mock.rst:1640 msgid "" "Patch a dictionary, or dictionary like object, and restore the dictionary to " "its original state after the test." msgstr "Patch 字典或類字典的物件,並在測試後將字典回復到其原本的狀態。" -#: ../../library/unittest.mock.rst:1594 +#: ../../library/unittest.mock.rst:1643 msgid "" "*in_dict* can be a dictionary or a mapping like container. If it is a " "mapping then it must at least support getting, setting and deleting items " @@ -1929,13 +1976,13 @@ msgstr "" "*in_dict* 可以是一個字典或一個類對映的容器。如果它是一個對映,那麼它至少必須" "支援獲取、設定、刪除項目以及對鍵的疊代。" -#: ../../library/unittest.mock.rst:1598 +#: ../../library/unittest.mock.rst:1647 msgid "" "*in_dict* can also be a string specifying the name of the dictionary, which " "will then be fetched by importing it." msgstr "*in_dict* 也可以是指定字典名稱的字串,然後透過 import 來取得該字典。" -#: ../../library/unittest.mock.rst:1601 +#: ../../library/unittest.mock.rst:1650 msgid "" "*values* can be a dictionary of values to set in the dictionary. *values* " "can also be an iterable of ``(key, value)`` pairs." @@ -1943,31 +1990,31 @@ msgstr "" "*values* 可以是要設定的值的字典。*values* 也可以是 ``(key, value)`` 對 " "(pairs) 的可疊代物件。" -#: ../../library/unittest.mock.rst:1604 +#: ../../library/unittest.mock.rst:1653 msgid "" "If *clear* is true then the dictionary will be cleared before the new values " "are set." msgstr "如果 *clear* 為 true,則在設定新值之前字典將被清除。" -#: ../../library/unittest.mock.rst:1607 +#: ../../library/unittest.mock.rst:1656 msgid "" ":func:`patch.dict` can also be called with arbitrary keyword arguments to " "set values in the dictionary." msgstr "也可以使用任意關鍵字引數呼叫 :func:`patch.dict` 以在字典中設定值。" -#: ../../library/unittest.mock.rst:1612 +#: ../../library/unittest.mock.rst:1661 msgid "" ":func:`patch.dict` now returns the patched dictionary when used as a context " "manager." msgstr ":func:`patch.dict` 現在在做為情境管理器使用時回傳被 patch 的字典。" -#: ../../library/unittest.mock.rst:1615 +#: ../../library/unittest.mock.rst:1664 msgid "" ":func:`patch.dict` can be used as a context manager, decorator or class " "decorator:" msgstr ":func:`patch.dict` 可以做為情境管理器、裝飾器或類別裝飾器使用:" -#: ../../library/unittest.mock.rst:1626 +#: ../../library/unittest.mock.rst:1675 msgid "" "When used as a class decorator :func:`patch.dict` honours ``patch." "TEST_PREFIX`` (default to ``'test'``) for choosing which methods to wrap:" @@ -1975,7 +2022,7 @@ msgstr "" "當作為類別裝飾器使用時,:func:`patch.dict` 會遵循 ``patch.TEST_PREFIX``\\ " "(預設為 ``'test'``\\ )來選擇要包裝的方法:" -#: ../../library/unittest.mock.rst:1637 +#: ../../library/unittest.mock.rst:1686 msgid "" "If you want to use a different prefix for your test, you can inform the " "patchers of the different prefix by setting ``patch.TEST_PREFIX``. For more " @@ -1985,7 +2032,7 @@ msgstr "" "patcher 使用不同的前綴。請參閱 :ref:`test-prefix` 以得知如何修改前綴的更多內" "容。" -#: ../../library/unittest.mock.rst:1641 +#: ../../library/unittest.mock.rst:1690 msgid "" ":func:`patch.dict` can be used to add members to a dictionary, or simply let " "a test change a dictionary, and ensure the dictionary is restored when the " @@ -1994,13 +2041,13 @@ msgstr "" ":func:`patch.dict` 可用於在字典中新增成員,或單純地讓測試更改字典,並確保在測" "試結束時將字典回復原狀。" -#: ../../library/unittest.mock.rst:1662 +#: ../../library/unittest.mock.rst:1711 msgid "" "Keywords can be used in the :func:`patch.dict` call to set values in the " "dictionary:" msgstr "可以在 :func:`patch.dict` 呼叫中使用關鍵字來設定字典中的值:" -#: ../../library/unittest.mock.rst:1672 +#: ../../library/unittest.mock.rst:1721 msgid "" ":func:`patch.dict` can be used with dictionary like objects that aren't " "actually dictionaries. At the very minimum they must support item getting, " @@ -2015,11 +2062,11 @@ msgstr "" "__delitem__` 以及 :meth:`~container.__iter__` 或 :meth:`~object." "__contains__`。" -#: ../../library/unittest.mock.rst:1702 +#: ../../library/unittest.mock.rst:1751 msgid "patch.multiple" msgstr "patch.multiple" -#: ../../library/unittest.mock.rst:1706 +#: ../../library/unittest.mock.rst:1755 msgid "" "Perform multiple patches in a single call. It takes the object to be patched " "(either as an object or a string to fetch the object by importing) and " @@ -2028,7 +2075,7 @@ msgstr "" "在一次呼叫中執行多個 patch。它接受被 patch 的物件(作為物件或透過 import 取得" "物件的字串)和 patch 的關鍵字引數: ::" -#: ../../library/unittest.mock.rst:1710 +#: ../../library/unittest.mock.rst:1759 msgid "" "with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" " ..." @@ -2036,7 +2083,7 @@ msgstr "" "with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'):\n" " ..." -#: ../../library/unittest.mock.rst:1713 +#: ../../library/unittest.mock.rst:1762 msgid "" "Use :data:`DEFAULT` as the value if you want :func:`patch.multiple` to " "create mocks for you. In this case the created mocks are passed into a " @@ -2047,7 +2094,7 @@ msgstr "" "值。在這種情況下,被建立的 mock 會透過關鍵字傳遞到被裝飾的函式中,並且當 :" "func:`patch.multiple` 作為情境管理器時會回傳字典。" -#: ../../library/unittest.mock.rst:1718 +#: ../../library/unittest.mock.rst:1767 msgid "" ":func:`patch.multiple` can be used as a decorator, class decorator or a " "context manager. The arguments *spec*, *spec_set*, *create*, *autospec* and " @@ -2059,7 +2106,7 @@ msgstr "" "`patch` 中的引數具有相同的意義。這些引數將應用於由 :func:`patch.multiple` 完" "成的\\ *所有* patch。" -#: ../../library/unittest.mock.rst:1723 +#: ../../library/unittest.mock.rst:1772 msgid "" "When used as a class decorator :func:`patch.multiple` honours ``patch." "TEST_PREFIX`` for choosing which methods to wrap." @@ -2067,7 +2114,7 @@ msgstr "" "當作為類別裝飾器使用時,:func:`patch.multiple` 遵循 ``patch.TEST_PREFIX`` 來" "選擇要包裝的方法。" -#: ../../library/unittest.mock.rst:1726 +#: ../../library/unittest.mock.rst:1775 msgid "" "If you want :func:`patch.multiple` to create mocks for you, then you can " "use :data:`DEFAULT` as the value. If you use :func:`patch.multiple` as a " @@ -2078,7 +2125,7 @@ msgstr "" "`DEFAULT` 作為值。如果你使用 :func:`patch.multiple` 作為裝飾器,那麼被建立的 " "mock 將透過關鍵字傳遞到被裝飾的函式中。: ::" -#: ../../library/unittest.mock.rst:1730 +#: ../../library/unittest.mock.rst:1779 msgid "" ">>> thing = object()\n" ">>> other = object()\n" @@ -2100,7 +2147,7 @@ msgstr "" "...\n" ">>> test_function()" -#: ../../library/unittest.mock.rst:1740 +#: ../../library/unittest.mock.rst:1789 msgid "" ":func:`patch.multiple` can be nested with other ``patch`` decorators, but " "put arguments passed by keyword *after* any of the standard arguments " @@ -2109,7 +2156,7 @@ msgstr "" ":func:`patch.multiple` 可以與其他 ``patch`` 裝飾器巢狀使用,但需要將透過關鍵" "字傳遞的引數放在 :func:`patch` 建立的任何標準引數\\ *之後*: ::" -#: ../../library/unittest.mock.rst:1743 +#: ../../library/unittest.mock.rst:1792 msgid "" ">>> @patch('sys.exit')\n" "... @patch.multiple('__main__', thing=DEFAULT, other=DEFAULT)\n" @@ -2129,7 +2176,7 @@ msgstr "" "...\n" ">>> test_function()" -#: ../../library/unittest.mock.rst:1752 +#: ../../library/unittest.mock.rst:1801 msgid "" "If :func:`patch.multiple` is used as a context manager, the value returned " "by the context manager is a dictionary where created mocks are keyed by " @@ -2138,7 +2185,7 @@ msgstr "" "如果 :func:`patch.multiple` 作為情境管理器使用,則情境管理器回傳的值是一個字" "典,其中被建立的 mock 會按名稱作為其鍵值: ::" -#: ../../library/unittest.mock.rst:1755 +#: ../../library/unittest.mock.rst:1804 msgid "" ">>> with patch.multiple('__main__', thing=DEFAULT, other=DEFAULT) as " "values:\n" @@ -2156,11 +2203,11 @@ msgstr "" "... assert values['other'] is other\n" "..." -#: ../../library/unittest.mock.rst:1766 +#: ../../library/unittest.mock.rst:1815 msgid "patch methods: start and stop" msgstr "patch 方法:啟動與停止" -#: ../../library/unittest.mock.rst:1768 +#: ../../library/unittest.mock.rst:1817 msgid "" "All the patchers have :meth:`start` and :meth:`stop` methods. These make it " "simpler to do patching in ``setUp`` methods or where you want to do multiple " @@ -2170,7 +2217,7 @@ msgstr "" "法中進行 patch 或在你想要在沒有巢狀使用裝飾器或 with 陳述式的情況下進行多個 " "patch 時變得更簡單。" -#: ../../library/unittest.mock.rst:1772 +#: ../../library/unittest.mock.rst:1821 msgid "" "To use them call :func:`patch`, :func:`patch.object` or :func:`patch.dict` " "as normal and keep a reference to the returned ``patcher`` object. You can " @@ -2181,7 +2228,7 @@ msgstr "" "`patch.dict` ,並保留對回傳的 ``patcher`` 物件的參照。之後你就可以呼叫 :meth:" "`start` 將 patch 準備就緒,並呼叫 :meth:`stop` 來取消 patch。" -#: ../../library/unittest.mock.rst:1776 +#: ../../library/unittest.mock.rst:1825 msgid "" "If you are using :func:`patch` to create a mock for you then it will be " "returned by the call to ``patcher.start``. ::" @@ -2189,7 +2236,7 @@ msgstr "" "如果你使用 :func:`patch` 為你建立 mock,那麼它將透過呼叫 ``patcher.start`` 回" "傳。: ::" -#: ../../library/unittest.mock.rst:1779 +#: ../../library/unittest.mock.rst:1828 msgid "" ">>> patcher = patch('package.module.ClassName')\n" ">>> from package import module\n" @@ -2211,7 +2258,7 @@ msgstr "" ">>> assert module.ClassName is original\n" ">>> assert module.ClassName is not new_mock" -#: ../../library/unittest.mock.rst:1790 +#: ../../library/unittest.mock.rst:1839 msgid "" "A typical use case for this might be for doing multiple patches in the " "``setUp`` method of a :class:`TestCase`::" @@ -2219,7 +2266,7 @@ msgstr "" "一個典型的用法是在一個 :class:`TestCase` 的 ``setUp`` 方法中執行多個 " "patch: ::" -#: ../../library/unittest.mock.rst:1793 +#: ../../library/unittest.mock.rst:1842 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2255,7 +2302,7 @@ msgstr "" "...\n" ">>> MyTest('test_something').run()" -#: ../../library/unittest.mock.rst:1812 +#: ../../library/unittest.mock.rst:1861 msgid "" "If you use this technique you must ensure that the patching is \"undone\" by " "calling ``stop``. This can be fiddlier than you might think, because if an " @@ -2266,7 +2313,7 @@ msgstr "" "你想像的還要複雜一點,因為如果有例外在 ``setUp`` 中被引發,則 ``tearDown`` 就" "不會被呼叫。:meth:`unittest.TestCase.addCleanup` 會讓這稍微簡單一點: ::" -#: ../../library/unittest.mock.rst:1817 +#: ../../library/unittest.mock.rst:1866 msgid "" ">>> class MyTest(unittest.TestCase):\n" "... def setUp(self):\n" @@ -2288,34 +2335,34 @@ msgstr "" "... assert package.module.Class is self.MockClass\n" "..." -#: ../../library/unittest.mock.rst:1827 +#: ../../library/unittest.mock.rst:1876 msgid "" "As an added bonus you no longer need to keep a reference to the ``patcher`` " "object." msgstr "作為額外的好處,你不再需要保留對 ``patcher`` 物件的參照。" -#: ../../library/unittest.mock.rst:1830 +#: ../../library/unittest.mock.rst:1879 msgid "" "It is also possible to stop all patches which have been started by using :" "func:`patch.stopall`." msgstr "也可以使用 :func:`patch.stopall` 來停止所有已啟動的 patch。" -#: ../../library/unittest.mock.rst:1835 +#: ../../library/unittest.mock.rst:1884 msgid "Stop all active patches. Only stops patches started with ``start``." msgstr "停止所有運作的 patch。只停止以 ``start`` 啟動的 patch。" -#: ../../library/unittest.mock.rst:1841 +#: ../../library/unittest.mock.rst:1890 msgid "patch builtins" msgstr "patch 內建函式" -#: ../../library/unittest.mock.rst:1842 +#: ../../library/unittest.mock.rst:1891 msgid "" "You can patch any builtins within a module. The following example patches " "builtin :func:`ord`::" msgstr "" "你可以 patch 模組內的任何內建函式。以下範例 patch 內建函式 :func:`ord`: ::" -#: ../../library/unittest.mock.rst:1845 +#: ../../library/unittest.mock.rst:1894 msgid "" ">>> @patch('__main__.ord')\n" "... def test(mock_ord):\n" @@ -2333,11 +2380,11 @@ msgstr "" ">>> test()\n" "101" -#: ../../library/unittest.mock.rst:1857 +#: ../../library/unittest.mock.rst:1906 msgid "TEST_PREFIX" msgstr "TEST_PREFIX" -#: ../../library/unittest.mock.rst:1859 +#: ../../library/unittest.mock.rst:1908 msgid "" "All of the patchers can be used as class decorators. When used in this way " "they wrap every test method on the class. The patchers recognise methods " @@ -2348,7 +2395,7 @@ msgstr "" "個測試方法。Patcher 將 ``'test'`` 開頭的方法認定為測試方法。這與 :class:" "`unittest.TestLoader` 預設尋找測試方法的方式相同。" -#: ../../library/unittest.mock.rst:1864 +#: ../../library/unittest.mock.rst:1913 msgid "" "It is possible that you want to use a different prefix for your tests. You " "can inform the patchers of the different prefix by setting ``patch." @@ -2357,7 +2404,7 @@ msgstr "" "你可能會想為你的測試使用不同的前綴。你可以透過設定 ``patch.TEST_PREFIX`` 來告" "知 patcher 使用不同的前綴: ::" -#: ../../library/unittest.mock.rst:1867 +#: ../../library/unittest.mock.rst:1916 msgid "" ">>> patch.TEST_PREFIX = 'foo'\n" ">>> value = 3\n" @@ -2395,21 +2442,21 @@ msgstr "" ">>> value\n" "3" -#: ../../library/unittest.mock.rst:1887 +#: ../../library/unittest.mock.rst:1936 msgid "Nesting Patch Decorators" msgstr "巢狀使用 Patch 裝飾器" -#: ../../library/unittest.mock.rst:1889 +#: ../../library/unittest.mock.rst:1938 msgid "" "If you want to perform multiple patches then you can simply stack up the " "decorators." msgstr "如果你想執行多個 patch,那麼你可以簡單地堆疊裝飾器。" -#: ../../library/unittest.mock.rst:1892 +#: ../../library/unittest.mock.rst:1941 msgid "You can stack up multiple patch decorators using this pattern:" msgstr "你可以使用這個模式來堆疊多個 patch 裝飾器:" -#: ../../library/unittest.mock.rst:1908 +#: ../../library/unittest.mock.rst:1957 msgid "" "Note that the decorators are applied from the bottom upwards. This is the " "standard way that Python applies decorators. The order of the created mocks " @@ -2418,11 +2465,11 @@ msgstr "" "請注意,裝飾器是從底部向上應用的。這是 Python 應用裝飾器的標準方式。被建立的 " "mock 傳遞到測試函式中的順序與此順序相同。" -#: ../../library/unittest.mock.rst:1916 +#: ../../library/unittest.mock.rst:1965 msgid "Where to patch" msgstr "該 patch 何處" -#: ../../library/unittest.mock.rst:1918 +#: ../../library/unittest.mock.rst:1967 msgid "" ":func:`patch` works by (temporarily) changing the object that a *name* " "points to with another one. There can be many names pointing to any " @@ -2433,7 +2480,7 @@ msgstr "" "有許多 name 指向任何單一物件,因此為了使 patch 起作用,你必須確保你 patch 了" "被測試系統使用的 name。" -#: ../../library/unittest.mock.rst:1923 +#: ../../library/unittest.mock.rst:1972 msgid "" "The basic principle is that you patch where an object is *looked up*, which " "is not necessarily the same place as where it is defined. A couple of " @@ -2442,12 +2489,12 @@ msgstr "" "基本原則是在物件\\ *被查找*\\ 的位置進行 patch,該位置不一定與其被定義的位置" "相同。幾個範例將有助於闡明這一點。" -#: ../../library/unittest.mock.rst:1927 +#: ../../library/unittest.mock.rst:1976 msgid "" "Imagine we have a project that we want to test with the following structure::" msgstr "想像一下,我們想要測試一個專案,其結構如下: ::" -#: ../../library/unittest.mock.rst:1929 +#: ../../library/unittest.mock.rst:1978 msgid "" "a.py\n" " -> Defines SomeClass\n" @@ -2457,7 +2504,7 @@ msgid "" " -> some_function instantiates SomeClass" msgstr "" -#: ../../library/unittest.mock.rst:1936 +#: ../../library/unittest.mock.rst:1985 msgid "" "Now we want to test ``some_function`` but we want to mock out ``SomeClass`` " "using :func:`patch`. The problem is that when we import module b, which we " @@ -2472,7 +2519,7 @@ msgstr "" "那麼它對我們的測試就不會有任何影響;模組 b 已經有了一個\\ *真實的*\\ " "``SomeClass`` 的參照 ,看起來我們的 patch 並沒有任何效果。" -#: ../../library/unittest.mock.rst:1943 +#: ../../library/unittest.mock.rst:1992 msgid "" "The key is to patch out ``SomeClass`` where it is used (or where it is " "looked up). In this case ``some_function`` will actually look up " @@ -2483,11 +2530,11 @@ msgstr "" "``some_function`` 實際上會在我們 import 它的模組 b 中查找 ``SomeClass``。這裡" "的 patch 應該長得像這樣: ::" -#: ../../library/unittest.mock.rst:1947 +#: ../../library/unittest.mock.rst:1996 msgid "@patch('b.SomeClass')" msgstr "@patch('b.SomeClass')" -#: ../../library/unittest.mock.rst:1949 +#: ../../library/unittest.mock.rst:1998 msgid "" "However, consider the alternative scenario where instead of ``from a import " "SomeClass`` module b does ``import a`` and ``some_function`` uses ``a." @@ -2500,15 +2547,15 @@ msgstr "" "形式都很常見。在這種情況下,我們想要 patch 的類別正在其模組中被查找,因此我們" "必須 patch ``a.SomeClass``: ::" -#: ../../library/unittest.mock.rst:1954 +#: ../../library/unittest.mock.rst:2003 msgid "@patch('a.SomeClass')" msgstr "@patch('a.SomeClass')" -#: ../../library/unittest.mock.rst:1958 +#: ../../library/unittest.mock.rst:2007 msgid "Patching Descriptors and Proxy Objects" msgstr "Patch 描述器與代理物件 (Proxy Objects)" -#: ../../library/unittest.mock.rst:1960 +#: ../../library/unittest.mock.rst:2009 msgid "" "Both patch_ and patch.object_ correctly patch and restore descriptors: class " "methods, static methods and properties. You should patch these on the " @@ -2523,15 +2570,15 @@ msgstr "" "web/20200603181648/http://www.voidspace.org.uk/python/weblog/ " "arch_d7_2010_12_04.shtml#e1198>`_。" -#: ../../library/unittest.mock.rst:1968 +#: ../../library/unittest.mock.rst:2017 msgid "MagicMock and magic method support" msgstr "MagicMock 以及魔術方法支援" -#: ../../library/unittest.mock.rst:1973 +#: ../../library/unittest.mock.rst:2022 msgid "Mocking Magic Methods" msgstr "Mock 魔術方法" -#: ../../library/unittest.mock.rst:1975 +#: ../../library/unittest.mock.rst:2024 msgid "" ":class:`Mock` supports mocking the Python protocol methods, also known as :" "term:`\"magic methods\" `. This allows mock objects to replace " @@ -2540,7 +2587,7 @@ msgstr "" ":class:`Mock` 支援 mock Python 協定方法,其也被稱作 :term:`\"魔術方法\" " "`。這允許 mock 物件替換容器或實作 Python 協定的其他物件。" -#: ../../library/unittest.mock.rst:1979 +#: ../../library/unittest.mock.rst:2028 msgid "" "Because magic methods are looked up differently from normal methods [#]_, " "this support has been specially implemented. This means that only specific " @@ -2551,7 +2598,7 @@ msgstr "" "代表著僅有特定的魔術方法被此方式支援。現在已支援清單中已經\\ *幾乎*\\ 包含了" "所有魔術方法。如果你需要 mock 任何魔術方法而其尚未被支援,請讓我們知道。" -#: ../../library/unittest.mock.rst:1984 +#: ../../library/unittest.mock.rst:2033 msgid "" "You mock magic methods by setting the method you are interested in to a " "function or a mock instance. If you are using a function then it *must* take " @@ -2560,13 +2607,13 @@ msgstr "" "你可以透過將你感興趣的方法設定為函式或 mock 實例來 mock 魔術方法。如果你使用" "函式,那麼它\\ *必須*\\ 將 ``self`` 作為第一個引數 [#]_。" -#: ../../library/unittest.mock.rst:2007 +#: ../../library/unittest.mock.rst:2056 msgid "" "One use case for this is for mocking objects used as context managers in a :" "keyword:`with` statement:" msgstr "一個用法是在 :keyword:`with` 陳述式中 mock 作為情境管理器使用的物件:" -#: ../../library/unittest.mock.rst:2019 +#: ../../library/unittest.mock.rst:2068 msgid "" "Calls to magic methods do not appear in :attr:`~Mock.method_calls`, but they " "are recorded in :attr:`~Mock.mock_calls`." @@ -2574,7 +2621,7 @@ msgstr "" "對魔術方法的呼叫並不會出現在 :attr:`~Mock.method_calls` 中,它們會被記錄在 :" "attr:`~Mock.mock_calls` 內。" -#: ../../library/unittest.mock.rst:2024 +#: ../../library/unittest.mock.rst:2073 msgid "" "If you use the *spec* keyword argument to create a mock then attempting to " "set a magic method that isn't in the spec will raise an :exc:" @@ -2583,23 +2630,23 @@ msgstr "" "如果你使用\\ *spec*\\ 關鍵字引數來建立一個 mock,則嘗試設定規格中未包含的魔術" "方法將引發一個 :exc:`AttributeError`。" -#: ../../library/unittest.mock.rst:2027 +#: ../../library/unittest.mock.rst:2076 msgid "The full list of supported magic methods is:" msgstr "已支援的魔術方法的完整列表是:" -#: ../../library/unittest.mock.rst:2029 +#: ../../library/unittest.mock.rst:2078 msgid "``__hash__``, ``__sizeof__``, ``__repr__`` and ``__str__``" msgstr "``__hash__``、``__sizeof__``、 ``__repr__`` 和 ``__str__``" -#: ../../library/unittest.mock.rst:2030 +#: ../../library/unittest.mock.rst:2079 msgid "``__dir__``, ``__format__`` and ``__subclasses__``" msgstr "``__dir__``、 ``__format__`` 和 ``__subclasses__``" -#: ../../library/unittest.mock.rst:2031 +#: ../../library/unittest.mock.rst:2080 msgid "``__round__``, ``__floor__``, ``__trunc__`` and ``__ceil__``" msgstr "``__round__``、``__floor__``、``__trunc__`` 和 ``__ceil__``" -#: ../../library/unittest.mock.rst:2032 +#: ../../library/unittest.mock.rst:2081 msgid "" "Comparisons: ``__lt__``, ``__gt__``, ``__le__``, ``__ge__``, ``__eq__`` and " "``__ne__``" @@ -2607,7 +2654,7 @@ msgstr "" "比較方法:``__lt__``、``__gt__``、``__le__``、``__ge__``、``__eq__`` 和 " "``__ne__``" -#: ../../library/unittest.mock.rst:2034 +#: ../../library/unittest.mock.rst:2083 msgid "" "Container methods: ``__getitem__``, ``__setitem__``, ``__delitem__``, " "``__contains__``, ``__len__``, ``__iter__``, ``__reversed__`` and " @@ -2617,18 +2664,18 @@ msgstr "" "``__contains__``、``__len__``、``__iter__``、``__reversed__`` 和 " "``__missing__``" -#: ../../library/unittest.mock.rst:2037 +#: ../../library/unittest.mock.rst:2086 msgid "" "Context manager: ``__enter__``, ``__exit__``, ``__aenter__`` and " "``__aexit__``" msgstr "" "情境管理器:``__enter__``、``__exit__``、``__aenter__`` 和 ``__aexit__``" -#: ../../library/unittest.mock.rst:2038 +#: ../../library/unittest.mock.rst:2087 msgid "Unary numeric methods: ``__neg__``, ``__pos__`` and ``__invert__``" msgstr "一元數值方法:``__neg__``、``__pos__`` 和 ``__invert__``" -#: ../../library/unittest.mock.rst:2039 +#: ../../library/unittest.mock.rst:2088 msgid "" "The numeric methods (including right hand and in-place variants): " "``__add__``, ``__sub__``, ``__mul__``, ``__matmul__``, ``__truediv__``, " @@ -2640,18 +2687,18 @@ msgstr "" "``__mod__``、``__divmod__``、``__lshift__``、``__rshift__``、``__and__``、" "``__xor__``、``__or__`` 和 ``__pow__``" -#: ../../library/unittest.mock.rst:2043 +#: ../../library/unittest.mock.rst:2092 msgid "" "Numeric conversion methods: ``__complex__``, ``__int__``, ``__float__`` and " "``__index__``" msgstr "" "數值轉換方法:``__complex__``、``__int__``、``__float__`` 和 ``__index__``" -#: ../../library/unittest.mock.rst:2045 +#: ../../library/unittest.mock.rst:2094 msgid "Descriptor methods: ``__get__``, ``__set__`` and ``__delete__``" msgstr "描述器方法:``__get__``、``__set__`` 和 ``__delete__``" -#: ../../library/unittest.mock.rst:2046 +#: ../../library/unittest.mock.rst:2095 msgid "" "Pickling: ``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, " "``__getnewargs__``, ``__getstate__`` and ``__setstate__``" @@ -2659,19 +2706,19 @@ msgstr "" "Pickling:``__reduce__``、``__reduce_ex__``、``__getinitargs__``、" "``__getnewargs__``、``__getstate__`` 和 ``__setstate__``" -#: ../../library/unittest.mock.rst:2048 +#: ../../library/unittest.mock.rst:2097 msgid "File system path representation: ``__fspath__``" msgstr "檔案系統路徑表示法:``__fspath__``" -#: ../../library/unittest.mock.rst:2049 +#: ../../library/unittest.mock.rst:2098 msgid "Asynchronous iteration methods: ``__aiter__`` and ``__anext__``" msgstr "非同步疊代方法:``__aiter__`` 和 ``__anext__``" -#: ../../library/unittest.mock.rst:2051 +#: ../../library/unittest.mock.rst:2100 msgid "Added support for :func:`os.PathLike.__fspath__`." msgstr "新增對於 :func:`os.PathLike.__fspath__` 的支援。" -#: ../../library/unittest.mock.rst:2054 +#: ../../library/unittest.mock.rst:2103 msgid "" "Added support for ``__aenter__``, ``__aexit__``, ``__aiter__`` and " "``__anext__``." @@ -2679,7 +2726,7 @@ msgstr "" "新增對於 ``__aenter__``、``__aexit__``、``__aiter__`` 和 ``__anext__`` 的支" "援。" -#: ../../library/unittest.mock.rst:2058 +#: ../../library/unittest.mock.rst:2107 msgid "" "The following methods exist but are *not* supported as they are either in " "use by mock, can't be set dynamically, or can cause problems:" @@ -2687,21 +2734,21 @@ msgstr "" "以下方法存在,但「不」被支援,因為它們在被 mock 使用時,會無法動態設定,或可" "能導致問題:" -#: ../../library/unittest.mock.rst:2061 +#: ../../library/unittest.mock.rst:2110 msgid "``__getattr__``, ``__setattr__``, ``__init__`` and ``__new__``" msgstr "``__getattr__``、``__setattr__``、``__init__`` 和 ``__new__``" -#: ../../library/unittest.mock.rst:2062 +#: ../../library/unittest.mock.rst:2111 msgid "" "``__prepare__``, ``__instancecheck__``, ``__subclasscheck__``, ``__del__``" msgstr "" "``__prepare__``、``__instancecheck__``、``__subclasscheck__``、``__del__``" -#: ../../library/unittest.mock.rst:2067 +#: ../../library/unittest.mock.rst:2116 msgid "Magic Mock" msgstr "Magic Mock" -#: ../../library/unittest.mock.rst:2069 +#: ../../library/unittest.mock.rst:2118 msgid "" "There are two ``MagicMock`` variants: :class:`MagicMock` and :class:" "`NonCallableMagicMock`." @@ -2709,7 +2756,7 @@ msgstr "" "``MagicMock`` 有兩個變體::class:`MagicMock` 和 :class:" "`NonCallableMagicMock`。" -#: ../../library/unittest.mock.rst:2074 +#: ../../library/unittest.mock.rst:2123 msgid "" "``MagicMock`` is a subclass of :class:`Mock` with default implementations of " "most of the :term:`magic methods `. You can use ``MagicMock`` " @@ -2718,11 +2765,11 @@ msgstr "" "``MagicMock`` 是 :class:`Mock` 的子類別,其預設具有大多數\\ :term:`魔術方法 " "`\\ 的實作。你可以使用 ``MagicMock``,而無需自行配置魔術方法。" -#: ../../library/unittest.mock.rst:2078 +#: ../../library/unittest.mock.rst:2127 msgid "The constructor parameters have the same meaning as for :class:`Mock`." msgstr "建構函式參數的意義與 :class:`Mock` 中的參數相同。" -#: ../../library/unittest.mock.rst:2080 +#: ../../library/unittest.mock.rst:2129 msgid "" "If you use the *spec* or *spec_set* arguments then *only* magic methods that " "exist in the spec will be created." @@ -2730,11 +2777,11 @@ msgstr "" "如果你使用 *spec* 或 *spec_set* 引數,那麼\\ *只有*\\ 規格中存在的魔術方法會" "被建立。" -#: ../../library/unittest.mock.rst:2086 +#: ../../library/unittest.mock.rst:2135 msgid "A non-callable version of :class:`MagicMock`." msgstr ":class:`MagicMock` 的不可呼叫版本。" -#: ../../library/unittest.mock.rst:2088 +#: ../../library/unittest.mock.rst:2137 msgid "" "The constructor parameters have the same meaning as for :class:`MagicMock`, " "with the exception of *return_value* and *side_effect* which have no meaning " @@ -2743,7 +2790,7 @@ msgstr "" "建構函式參數的意義與 :class:`MagicMock` 中的參數相同,但 *return_value* 和 " "*side_effect* 除外,它們對不可呼叫的 mock 來說沒有任何意義。" -#: ../../library/unittest.mock.rst:2092 +#: ../../library/unittest.mock.rst:2141 msgid "" "The magic methods are setup with :class:`MagicMock` objects, so you can " "configure them and use them in the usual way:" @@ -2751,7 +2798,7 @@ msgstr "" "魔術方法是使用 :class:`MagicMock` 物件設定的,因此你可以配置它們並以一般的方" "法來使用它們:" -#: ../../library/unittest.mock.rst:2102 +#: ../../library/unittest.mock.rst:2151 msgid "" "By default many of the protocol methods are required to return objects of a " "specific type. These methods are preconfigured with a default return value, " @@ -2763,83 +2810,83 @@ msgstr "" "值,因此如果你對回傳值不感興趣,則無需執行任何操作即可使用它們。如果你想更改" "預設值,你仍然可以手動\\ *設定*\\ 回傳值。" -#: ../../library/unittest.mock.rst:2108 +#: ../../library/unittest.mock.rst:2157 msgid "Methods and their defaults:" msgstr "方法及其預設值:" -#: ../../library/unittest.mock.rst:2110 +#: ../../library/unittest.mock.rst:2159 msgid "``__lt__``: :data:`NotImplemented`" msgstr "``__lt__``::data:`NotImplemented`" -#: ../../library/unittest.mock.rst:2111 +#: ../../library/unittest.mock.rst:2160 msgid "``__gt__``: :data:`!NotImplemented`" msgstr "``__gt__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2112 +#: ../../library/unittest.mock.rst:2161 msgid "``__le__``: :data:`!NotImplemented`" msgstr "``__le__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2113 +#: ../../library/unittest.mock.rst:2162 msgid "``__ge__``: :data:`!NotImplemented`" msgstr "``__ge__``::data:`!NotImplemented`" -#: ../../library/unittest.mock.rst:2114 +#: ../../library/unittest.mock.rst:2163 msgid "``__int__``: ``1``" msgstr "``__int__``:``1``" -#: ../../library/unittest.mock.rst:2115 +#: ../../library/unittest.mock.rst:2164 msgid "``__contains__``: ``False``" msgstr "``__contains__``:``False``" -#: ../../library/unittest.mock.rst:2116 +#: ../../library/unittest.mock.rst:2165 msgid "``__len__``: ``0``" msgstr "``__len__``:``0``" -#: ../../library/unittest.mock.rst:2117 +#: ../../library/unittest.mock.rst:2166 msgid "``__iter__``: ``iter([])``" msgstr "``__iter__``:``iter([])``" -#: ../../library/unittest.mock.rst:2118 +#: ../../library/unittest.mock.rst:2167 msgid "``__exit__``: ``False``" msgstr "``__exit__``:``False``" -#: ../../library/unittest.mock.rst:2119 +#: ../../library/unittest.mock.rst:2168 msgid "``__aexit__``: ``False``" msgstr "``__aexit__``:``False``" -#: ../../library/unittest.mock.rst:2120 +#: ../../library/unittest.mock.rst:2169 msgid "``__complex__``: ``1j``" msgstr "``__complex__``:``1j``" -#: ../../library/unittest.mock.rst:2121 +#: ../../library/unittest.mock.rst:2170 msgid "``__float__``: ``1.0``" msgstr "``__float__``:``1.0``" -#: ../../library/unittest.mock.rst:2122 +#: ../../library/unittest.mock.rst:2171 msgid "``__bool__``: ``True``" msgstr "``__bool__``:``True``" -#: ../../library/unittest.mock.rst:2123 +#: ../../library/unittest.mock.rst:2172 msgid "``__index__``: ``1``" msgstr "``__index__``:``1``" -#: ../../library/unittest.mock.rst:2124 +#: ../../library/unittest.mock.rst:2173 msgid "``__hash__``: default hash for the mock" msgstr "``__hash__``:mock 的預設雜湊" -#: ../../library/unittest.mock.rst:2125 +#: ../../library/unittest.mock.rst:2174 msgid "``__str__``: default str for the mock" msgstr "``__str__``:mock 的預設字串" -#: ../../library/unittest.mock.rst:2126 +#: ../../library/unittest.mock.rst:2175 msgid "``__sizeof__``: default sizeof for the mock" msgstr "``__sizeof__``:mock 的預設 sizeof" -#: ../../library/unittest.mock.rst:2128 +#: ../../library/unittest.mock.rst:2177 msgid "For example:" msgstr "舉例來說:" -#: ../../library/unittest.mock.rst:2140 +#: ../../library/unittest.mock.rst:2189 msgid "" "The two equality methods, :meth:`!__eq__` and :meth:`!__ne__`, are special. " "They do the default equality comparison on identity, using the :attr:`~Mock." @@ -2850,7 +2897,7 @@ msgstr "" "`~Mock.side_effect` 屬性對識別性 (identity) 進行預設的相等比較,除非你變更它" "們的回傳值以回傳其他內容: ::" -#: ../../library/unittest.mock.rst:2145 +#: ../../library/unittest.mock.rst:2194 msgid "" ">>> MagicMock() == 3\n" "False\n" @@ -2870,14 +2917,14 @@ msgstr "" ">>> mock == 3\n" "True" -#: ../../library/unittest.mock.rst:2154 +#: ../../library/unittest.mock.rst:2203 msgid "" "The return value of :meth:`MagicMock.__iter__` can be any iterable object " "and isn't required to be an iterator:" msgstr "" ":meth:`MagicMock.__iter__` 的回傳值可以是任何可疊代物件,且不需是一個疊代器:" -#: ../../library/unittest.mock.rst:2164 +#: ../../library/unittest.mock.rst:2213 msgid "" "If the return value *is* an iterator, then iterating over it once will " "consume it and subsequent iterations will result in an empty list:" @@ -2885,7 +2932,7 @@ msgstr "" "如果回傳值\\ *是*\\ 一個疊代器,那麼對其進行一次疊代將消耗它,並且後續疊代將" "產生一個空串列:" -#: ../../library/unittest.mock.rst:2173 +#: ../../library/unittest.mock.rst:2222 msgid "" "``MagicMock`` has all of the supported magic methods configured except for " "some of the obscure and obsolete ones. You can still set these up if you " @@ -2894,33 +2941,33 @@ msgstr "" "``MagicMock`` 配置了所有支援的魔術方法,除了一些少見和過時的方法。如果你想" "要,你仍然可以設定這些魔術方法。" -#: ../../library/unittest.mock.rst:2176 +#: ../../library/unittest.mock.rst:2225 msgid "" "Magic methods that are supported but not setup by default in ``MagicMock`` " "are:" msgstr "``MagicMock`` 中支援但預設未設置的魔術方法包含:" -#: ../../library/unittest.mock.rst:2178 +#: ../../library/unittest.mock.rst:2227 msgid "``__subclasses__``" msgstr "``__subclasses__``" -#: ../../library/unittest.mock.rst:2179 +#: ../../library/unittest.mock.rst:2228 msgid "``__dir__``" msgstr "``__dir__``" -#: ../../library/unittest.mock.rst:2180 +#: ../../library/unittest.mock.rst:2229 msgid "``__format__``" msgstr "``__format__``" -#: ../../library/unittest.mock.rst:2181 +#: ../../library/unittest.mock.rst:2230 msgid "``__get__``, ``__set__`` and ``__delete__``" msgstr "``__get__``、``__set__`` 和 ``__delete__``" -#: ../../library/unittest.mock.rst:2182 +#: ../../library/unittest.mock.rst:2231 msgid "``__reversed__`` and ``__missing__``" msgstr "``__reversed__`` 和 ``__missing__``" -#: ../../library/unittest.mock.rst:2183 +#: ../../library/unittest.mock.rst:2232 msgid "" "``__reduce__``, ``__reduce_ex__``, ``__getinitargs__``, ``__getnewargs__``, " "``__getstate__`` and ``__setstate__``" @@ -2928,11 +2975,11 @@ msgstr "" "``__reduce__``、``__reduce_ex__``、``__getinitargs__``、``__getnewargs__``、" "``__getstate__`` 和 ``__setstate__``" -#: ../../library/unittest.mock.rst:2185 +#: ../../library/unittest.mock.rst:2234 msgid "``__getformat__``" msgstr "``__getformat__``" -#: ../../library/unittest.mock.rst:2189 +#: ../../library/unittest.mock.rst:2238 msgid "" "Magic methods *should* be looked up on the class rather than the instance. " "Different versions of Python are inconsistent about applying this rule. The " @@ -2941,27 +2988,27 @@ msgstr "" "魔術方法\\ *應該*\\ 在類別而不是實例上被查找。不同版本的 Python 對於這條規則" "的適用並不一致。支援的協定方法應適用於所有支援的 Python 版本。" -#: ../../library/unittest.mock.rst:2193 +#: ../../library/unittest.mock.rst:2242 msgid "" "The function is basically hooked up to the class, but each ``Mock`` instance " "is kept isolated from the others." msgstr "該函式基本上與類別掛鉤,但每個 ``Mock`` 實例都與其他實例保持隔離。" -#: ../../library/unittest.mock.rst:2198 +#: ../../library/unittest.mock.rst:2247 msgid "Helpers" msgstr "輔助函式" -#: ../../library/unittest.mock.rst:2201 +#: ../../library/unittest.mock.rst:2250 msgid "sentinel" msgstr "sentinel(哨兵)" -#: ../../library/unittest.mock.rst:2205 +#: ../../library/unittest.mock.rst:2254 msgid "" "The ``sentinel`` object provides a convenient way of providing unique " "objects for your tests." msgstr "``哨兵``\\ 物件提供了一種為你的測試提供獨特物件的便利方式。" -#: ../../library/unittest.mock.rst:2208 +#: ../../library/unittest.mock.rst:2257 msgid "" "Attributes are created on demand when you access them by name. Accessing the " "same attribute will always return the same object. The objects returned have " @@ -2970,7 +3017,7 @@ msgstr "" "當你使用名稱存取屬性時,屬性會根據需要被建立。存取相同的屬性將始終回傳相同的" "物件。回傳的物件會具有合適的 repr,讓測試失敗的訊息是可閱讀的。" -#: ../../library/unittest.mock.rst:2212 +#: ../../library/unittest.mock.rst:2261 msgid "" "The ``sentinel`` attributes now preserve their identity when they are :mod:" "`copied ` or :mod:`pickled `." @@ -2978,7 +3025,7 @@ msgstr "" "``哨兵``\\ 屬性現在當被\\ :mod:`複製 `\\ 或\\ :mod:`序列化 `\\ " "時會保留其識別性。" -#: ../../library/unittest.mock.rst:2216 +#: ../../library/unittest.mock.rst:2265 msgid "" "Sometimes when testing you need to test that a specific object is passed as " "an argument to another method, or returned. It can be common to create named " @@ -2989,18 +3036,18 @@ msgstr "" "名的哨兵物件來測試這一點是常見的。:data:`sentinel` 提供了一種此類建立和測試物" "件識別性的便利方式。" -#: ../../library/unittest.mock.rst:2221 +#: ../../library/unittest.mock.rst:2270 msgid "" "In this example we monkey patch ``method`` to return ``sentinel." "some_object``:" msgstr "" "在這個例子中,我們 monkey patch ``method`` 以回傳 ``sentinel.some_object``:" -#: ../../library/unittest.mock.rst:2233 +#: ../../library/unittest.mock.rst:2282 msgid "DEFAULT" msgstr "DEFAULT" -#: ../../library/unittest.mock.rst:2238 +#: ../../library/unittest.mock.rst:2287 msgid "" "The :data:`DEFAULT` object is a pre-created sentinel (actually ``sentinel." "DEFAULT``). It can be used by :attr:`~Mock.side_effect` functions to " @@ -3010,11 +3057,11 @@ msgstr "" "DEFAULT``\\ )。它可以被 :attr:`~Mock.side_effect` 函式使用來表示正常的回傳值" "應該被使用。" -#: ../../library/unittest.mock.rst:2244 +#: ../../library/unittest.mock.rst:2293 msgid "call" msgstr "call" -#: ../../library/unittest.mock.rst:2248 +#: ../../library/unittest.mock.rst:2297 msgid "" ":func:`call` is a helper object for making simpler assertions, for comparing " "with :attr:`~Mock.call_args`, :attr:`~Mock.call_args_list`, :attr:`~Mock." @@ -3026,7 +3073,7 @@ msgstr "" "簡單的斷言的輔助物件。:func:`call` 也可以與 :meth:`~Mock.assert_has_calls` 一" "起使用。" -#: ../../library/unittest.mock.rst:2261 +#: ../../library/unittest.mock.rst:2310 msgid "" "For a call object that represents multiple calls, :meth:`call_list` returns " "a list of all the intermediate calls as well as the final call." @@ -3034,7 +3081,7 @@ msgstr "" "對於表示多個呼叫的 call 物件,:meth:`call_list` 回傳所有中間呼叫以及最終呼叫" "的串列。" -#: ../../library/unittest.mock.rst:2265 +#: ../../library/unittest.mock.rst:2314 msgid "" "``call_list`` is particularly useful for making assertions on \"chained " "calls\". A chained call is multiple calls on a single line of code. This " @@ -3045,13 +3092,13 @@ msgstr "" "在單行程式碼進行的多次呼叫。這會導致 mock 上的 :attr:`~Mock.mock_calls` 中出" "現多個項目。手動建構呼叫序列會相當單調乏味。" -#: ../../library/unittest.mock.rst:2270 +#: ../../library/unittest.mock.rst:2319 msgid "" ":meth:`~call.call_list` can construct the sequence of calls from the same " "chained call:" msgstr ":meth:`~call.call_list` 可以從同一個鍊接呼叫建構呼叫序列:" -#: ../../library/unittest.mock.rst:2287 +#: ../../library/unittest.mock.rst:2336 msgid "" "A ``call`` object is either a tuple of (positional args, keyword args) or " "(name, positional args, keyword args) depending on how it was constructed. " @@ -3065,7 +3112,7 @@ msgstr "" "趣,但是 :attr:`Mock.call_args`、:attr:`Mock.call_args_list` 和 :attr:`Mock." "mock_calls` 屬性中的 ``call`` 物件可以被內省以取得它們包含的各個引數。" -#: ../../library/unittest.mock.rst:2294 +#: ../../library/unittest.mock.rst:2343 msgid "" "The ``call`` objects in :attr:`Mock.call_args` and :attr:`Mock." "call_args_list` are two-tuples of (positional args, keyword args) whereas " @@ -3077,7 +3124,7 @@ msgstr "" "(位置引數, 關鍵字引數)的二元組,而 :attr:`Mock.mock_calls` 中的 ``call`` 物" "件以及你自己建立的 ``call`` 物件是(名稱, 位置引數, 關鍵字引數)的三元組。" -#: ../../library/unittest.mock.rst:2299 +#: ../../library/unittest.mock.rst:2348 msgid "" "You can use their \"tupleness\" to pull out the individual arguments for " "more complex introspection and assertions. The positional arguments are a " @@ -3087,11 +3134,11 @@ msgstr "" "你可以利用它們作為元組的特性來提取單個引數,以進行更複雜的內省和斷言。位置引" "數是一個元組(如果沒有位置引數則為空元組),關鍵字引數是一個字典:" -#: ../../library/unittest.mock.rst:2332 +#: ../../library/unittest.mock.rst:2381 msgid "create_autospec" msgstr "create_autospec" -#: ../../library/unittest.mock.rst:2336 +#: ../../library/unittest.mock.rst:2385 msgid "" "Create a mock object using another object as a spec. Attributes on the mock " "will use the corresponding attribute on the *spec* object as their spec." @@ -3099,13 +3146,13 @@ msgstr "" "使用另一個物件作為規格建立一個 mock 物件。Mock 上的屬性將使用 *spec* 物件上的" "對應屬性作為其規格。" -#: ../../library/unittest.mock.rst:2340 +#: ../../library/unittest.mock.rst:2389 msgid "" "Functions or methods being mocked will have their arguments checked to " "ensure that they are called with the correct signature." msgstr "被 mock 的函式或方法將檢查其引數,以確保他們被使用正確的簽名來呼叫。" -#: ../../library/unittest.mock.rst:2343 +#: ../../library/unittest.mock.rst:2392 msgid "" "If *spec_set* is ``True`` then attempting to set attributes that don't exist " "on the spec object will raise an :exc:`AttributeError`." @@ -3113,7 +3160,7 @@ msgstr "" "如果 *spec_set* 為 ``True``,則嘗試設定規格物件上不存在的屬性將引發 :exc:" "`AttributeError`。" -#: ../../library/unittest.mock.rst:2346 +#: ../../library/unittest.mock.rst:2395 msgid "" "If a class is used as a spec then the return value of the mock (the instance " "of the class) will have the same spec. You can use a class as the spec for " @@ -3124,7 +3171,7 @@ msgstr "" "可以透過傳遞 ``instance=True`` 來使用一個類別作為一個實例物件的規格。只有當 " "mock 的實例是可呼叫物件時,回傳的 mock 才會是可呼叫物件。" -#: ../../library/unittest.mock.rst:2351 +#: ../../library/unittest.mock.rst:2400 msgid "" ":func:`create_autospec` also takes arbitrary keyword arguments that are " "passed to the constructor of the created mock." @@ -3132,7 +3179,7 @@ msgstr "" ":func:`create_autospec` 也接受任意的關鍵字引數,這些引數會傳遞給已建立的 " "mock 的建構函式。" -#: ../../library/unittest.mock.rst:2354 +#: ../../library/unittest.mock.rst:2403 msgid "" "See :ref:`auto-speccing` for examples of how to use auto-speccing with :func:" "`create_autospec` and the *autospec* argument to :func:`patch`." @@ -3140,7 +3187,7 @@ msgstr "" "請參閱 :ref:`auto-speccing` 以得知如何以 :func:`create_autospec` 使用自動規格" "以及如何在 :func:`patch` 中使用 *autospec* 引數的範例。" -#: ../../library/unittest.mock.rst:2360 +#: ../../library/unittest.mock.rst:2409 msgid "" ":func:`create_autospec` now returns an :class:`AsyncMock` if the target is " "an async function." @@ -3148,11 +3195,11 @@ msgstr "" "如果目標是一個非同步函式,:func:`create_autospec` 現在會回傳一個 :class:" "`AsyncMock`。" -#: ../../library/unittest.mock.rst:2365 +#: ../../library/unittest.mock.rst:2414 msgid "ANY" msgstr "ANY" -#: ../../library/unittest.mock.rst:2369 +#: ../../library/unittest.mock.rst:2418 msgid "" "Sometimes you may need to make assertions about *some* of the arguments in a " "call to mock, but either not care about some of the arguments or want to " @@ -3162,7 +3209,7 @@ msgstr "" "有時你可能需要對 mock 的呼叫中的\\ *某些*\\ 引數進行斷言,但你不在意其他的某" "些引數,或想將它們單獨從 :attr:`~Mock.call_args` 中取出並進行更加複雜的斷言。" -#: ../../library/unittest.mock.rst:2374 +#: ../../library/unittest.mock.rst:2423 msgid "" "To ignore certain arguments you can pass in objects that compare equal to " "*everything*. Calls to :meth:`~Mock.assert_called_with` and :meth:`~Mock." @@ -3172,20 +3219,20 @@ msgstr "" "麼內容,對 :meth:`~Mock.assert_used_with` 和 :meth:`~Mock." "assert_used_once_with` 的呼叫都會成功。" -#: ../../library/unittest.mock.rst:2383 +#: ../../library/unittest.mock.rst:2432 msgid "" ":data:`ANY` can also be used in comparisons with call lists like :attr:" "`~Mock.mock_calls`:" msgstr "" ":data:`ANY` 也可以用來與呼叫串列進行比較,例如 :attr:`~Mock.mock_calls`:" -#: ../../library/unittest.mock.rst:2393 +#: ../../library/unittest.mock.rst:2442 msgid "" ":data:`ANY` is not limited to comparisons with call objects and so can also " "be used in test assertions::" msgstr ":data:`ANY` 不只能與呼叫物件比較,其也可以在測試斷言中使用: ::" -#: ../../library/unittest.mock.rst:2396 +#: ../../library/unittest.mock.rst:2445 msgid "" "class TestStringMethods(unittest.TestCase):\n" "\n" @@ -3199,11 +3246,11 @@ msgstr "" " s = 'hello world'\n" " self.assertEqual(s.split(), ['hello', ANY])" -#: ../../library/unittest.mock.rst:2404 +#: ../../library/unittest.mock.rst:2453 msgid "FILTER_DIR" msgstr "FILTER_DIR" -#: ../../library/unittest.mock.rst:2408 +#: ../../library/unittest.mock.rst:2457 msgid "" ":data:`FILTER_DIR` is a module level variable that controls the way mock " "objects respond to :func:`dir`. The default is ``True``, which uses the " @@ -3216,7 +3263,7 @@ msgstr "" "你不喜歡這個過濾方式,或由於診斷意圖而需要將其關閉,請設定 ``mock.FILTER_DIR " "= False``。" -#: ../../library/unittest.mock.rst:2414 +#: ../../library/unittest.mock.rst:2463 msgid "" "With filtering on, ``dir(some_mock)`` shows only useful attributes and will " "include any dynamically created attributes that wouldn't normally be shown. " @@ -3228,7 +3275,7 @@ msgstr "" "的任何動態建立的屬性。如果 mock 是使用 *spec*\\ (或 *autospec*\\ )來建立" "的,那麼源頭的所有屬性都會顯示,即使它們尚未被存取:" -#: ../../library/unittest.mock.rst:2420 +#: ../../library/unittest.mock.rst:2469 msgid "" ">>> dir(Mock())\n" "['assert_any_call',\n" @@ -3266,7 +3313,7 @@ msgstr "" " 'BaseHandler',\n" " ..." -#: ../../library/unittest.mock.rst:2441 +#: ../../library/unittest.mock.rst:2490 msgid "" "Many of the not-very-useful (private to :class:`Mock` rather than the thing " "being mocked) underscore and double underscore prefixed attributes have been " @@ -3278,7 +3325,7 @@ msgstr "" "雙底線前綴屬性已從在 :class:`Mock` 上呼叫 :func:`dir` 的結果中濾除。如果你不" "喜歡這種特性,可以透過設定模組級別開關 :data:`FILTER_DIR` 來將其關閉:" -#: ../../library/unittest.mock.rst:2447 +#: ../../library/unittest.mock.rst:2496 msgid "" ">>> from unittest import mock\n" ">>> mock.FILTER_DIR = False\n" @@ -3304,7 +3351,7 @@ msgstr "" " '__class__',\n" " ..." -#: ../../library/unittest.mock.rst:2462 +#: ../../library/unittest.mock.rst:2511 msgid "" "Alternatively you can just use ``vars(my_mock)`` (instance members) and " "``dir(type(my_mock))`` (type members) to bypass the filtering irrespective " @@ -3314,11 +3361,11 @@ msgstr "" "``dir(type(my_mock))``\\ (型別成員)來略過過濾,而不考慮 :const:`mock." "FILTER_DIR`。" -#: ../../library/unittest.mock.rst:2468 +#: ../../library/unittest.mock.rst:2517 msgid "mock_open" msgstr "mock_open" -#: ../../library/unittest.mock.rst:2472 +#: ../../library/unittest.mock.rst:2521 msgid "" "A helper function to create a mock to replace the use of :func:`open`. It " "works for :func:`open` called directly or used as a context manager." @@ -3326,7 +3373,7 @@ msgstr "" "用於建立取代 :func:`open` 用途的 mock 的輔助函式。它適用於直接呼叫或用作情境" "管理器的 :func:`open`。" -#: ../../library/unittest.mock.rst:2475 +#: ../../library/unittest.mock.rst:2524 msgid "" "The *mock* argument is the mock object to configure. If ``None`` (the " "default) then a :class:`MagicMock` will be created for you, with the API " @@ -3335,7 +3382,7 @@ msgstr "" "*mock* 引數是要配置的 mock 物件。如果其為 ``None``\\ (預設值),那麼就會為你" "建立一個 :class:`MagicMock`,其 API 限制在標準檔案處理上可用的方法或屬性。" -#: ../../library/unittest.mock.rst:2479 +#: ../../library/unittest.mock.rst:2528 msgid "" "*read_data* is a string for the :meth:`~io.IOBase.read`, :meth:`~io.IOBase." "readline`, and :meth:`~io.IOBase.readlines` methods of the file handle to " @@ -3355,7 +3402,7 @@ msgstr "" "org>`_ 上的其中一個記憶體內檔案系統 (in-memory filesystem) 套件可以提供用於測" "試的真實檔案系統。" -#: ../../library/unittest.mock.rst:2489 +#: ../../library/unittest.mock.rst:2538 msgid "" "Added :meth:`~io.IOBase.readline` and :meth:`~io.IOBase.readlines` support. " "The mock of :meth:`~io.IOBase.read` changed to consume *read_data* rather " @@ -3365,11 +3412,11 @@ msgstr "" "meth:`~io.IOBase.read` 的 mock 更改為消耗 *read_data* 而不是在每次呼叫時回傳" "它。" -#: ../../library/unittest.mock.rst:2494 +#: ../../library/unittest.mock.rst:2543 msgid "*read_data* is now reset on each call to the *mock*." msgstr "現在,每次呼叫 *mock* 時都會重置 *read_data*。" -#: ../../library/unittest.mock.rst:2497 +#: ../../library/unittest.mock.rst:2546 msgid "" "Added :meth:`~container.__iter__` to implementation so that iteration (such " "as in for loops) correctly consumes *read_data*." @@ -3377,7 +3424,7 @@ msgstr "" "新增 :meth:`~container.__iter__` 到實作中,以便使疊代(例如在 for 迴圈中)正" "確地消耗 *read_data*。" -#: ../../library/unittest.mock.rst:2501 +#: ../../library/unittest.mock.rst:2550 msgid "" "Using :func:`open` as a context manager is a great way to ensure your file " "handles are closed properly and is becoming common::" @@ -3385,7 +3432,7 @@ msgstr "" "使用 :func:`open` 作為情境管理器是確保檔案處理正確關閉的好方式,且這種方式正" "在變得普遍: ::" -#: ../../library/unittest.mock.rst:2504 +#: ../../library/unittest.mock.rst:2553 msgid "" "with open('/some/path', 'w') as f:\n" " f.write('something')" @@ -3393,7 +3440,7 @@ msgstr "" "with open('/some/path', 'w') as f:\n" " f.write('something')" -#: ../../library/unittest.mock.rst:2507 +#: ../../library/unittest.mock.rst:2556 msgid "" "The issue is that even if you mock out the call to :func:`open` it is the " "*returned object* that is used as a context manager (and has :meth:`~object." @@ -3403,7 +3450,7 @@ msgstr "" "回傳物件*\\ (且其 :meth:`~object.__enter__` 和 :meth:`~ object.__exit__` 已" "被呼叫)。" -#: ../../library/unittest.mock.rst:2511 +#: ../../library/unittest.mock.rst:2560 msgid "" "Mocking context managers with a :class:`MagicMock` is common enough and " "fiddly enough that a helper function is useful. ::" @@ -3411,7 +3458,7 @@ msgstr "" "使用 :class:`MagicMock` mock 情境管理器相當常見並且精細,因此輔助函式就非常有" "用: ::" -#: ../../library/unittest.mock.rst:2514 +#: ../../library/unittest.mock.rst:2563 msgid "" ">>> m = mock_open()\n" ">>> with patch('__main__.open', m):\n" @@ -3441,11 +3488,11 @@ msgstr "" ">>> handle = m()\n" ">>> handle.write.assert_called_once_with('some stuff')" -#: ../../library/unittest.mock.rst:2528 +#: ../../library/unittest.mock.rst:2577 msgid "And for reading files::" msgstr "以及讀取檔案: ::" -#: ../../library/unittest.mock.rst:2530 +#: ../../library/unittest.mock.rst:2579 msgid "" ">>> with patch('__main__.open', mock_open(read_data='bibble')) as m:\n" "... with open('foo') as h:\n" @@ -3461,11 +3508,11 @@ msgstr "" ">>> m.assert_called_once_with('foo')\n" ">>> assert result == 'bibble'" -#: ../../library/unittest.mock.rst:2541 +#: ../../library/unittest.mock.rst:2590 msgid "Autospeccing" msgstr "Autospeccing(自動規格)" -#: ../../library/unittest.mock.rst:2543 +#: ../../library/unittest.mock.rst:2592 msgid "" "Autospeccing is based on the existing :attr:`spec` feature of mock. It " "limits the api of mocks to the api of an original object (the spec), but it " @@ -3479,11 +3526,11 @@ msgstr "" "有與規格的屬性相同的 api。此外,被 mock 的函式/方法具有與原始的函式/方法相同" "的呼叫簽名,因此如果它們被不正確地呼叫,就會引發 :exc:`TypeError`。" -#: ../../library/unittest.mock.rst:2550 +#: ../../library/unittest.mock.rst:2599 msgid "Before I explain how auto-speccing works, here's why it is needed." msgstr "在解釋自動規格如何運作之前,我們先解釋為什麼需要它。" -#: ../../library/unittest.mock.rst:2552 +#: ../../library/unittest.mock.rst:2601 msgid "" ":class:`Mock` is a very powerful and flexible object, but it suffers from a " "flaw which is general to mocking. If you refactor some of your code, rename " @@ -3496,7 +3543,7 @@ msgstr "" "實物件的程式碼測試仍然會通過。這意味著即使你的程式碼壞了,但測試仍可以全部通" "過。" -#: ../../library/unittest.mock.rst:2560 +#: ../../library/unittest.mock.rst:2609 msgid "" "Before 3.5, tests with a typo in the word assert would silently pass when " "they should raise an error. You can still achieve this behavior by passing " @@ -3505,7 +3552,7 @@ msgstr "" "在 3.5 之前,當測試應該引發錯誤時,斷言單字中存在拼字錯誤的測驗會默默地通過。" "你仍可以透過將 ``unsafe=True`` 傳遞給 Mock 來實作此行為。" -#: ../../library/unittest.mock.rst:2563 +#: ../../library/unittest.mock.rst:2612 msgid "" "Note that this is another reason why you need integration tests as well as " "unit tests. Testing everything in isolation is all fine and dandy, but if " @@ -3515,7 +3562,7 @@ msgstr "" "謹記這是你需要有整合測試和單元測試的另一個原因。單獨測試所有內容都很好,但如" "果你不測試你的單元是如何「連接在一起」的,那麼測試還是有機會發現很多錯誤。" -#: ../../library/unittest.mock.rst:2568 +#: ../../library/unittest.mock.rst:2617 msgid "" ":mod:`mock` already provides a feature to help with this, called speccing. " "If you use a class or instance as the :attr:`spec` for a mock then you can " @@ -3525,13 +3572,13 @@ msgstr "" "類別或實例作為 mock 的 :attr:`spec`,那麼你在 mock 上只能存取真實類別中存在的" "屬性:" -#: ../../library/unittest.mock.rst:2579 +#: ../../library/unittest.mock.rst:2628 msgid "" "The spec only applies to the mock itself, so we still have the same issue " "with any methods on the mock:" msgstr "該規格僅適用於 mock 本身,因此在 mock 上的任何方法仍然有相同的問題:" -#: ../../library/unittest.mock.rst:2582 +#: ../../library/unittest.mock.rst:2631 msgid "" ">>> mock.has_data()\n" "\n" @@ -3541,7 +3588,7 @@ msgstr "" "\n" ">>> mock.has_data.assret_called_with() # 故意的錯字!" -#: ../../library/unittest.mock.rst:2588 +#: ../../library/unittest.mock.rst:2637 msgid "" "Auto-speccing solves this problem. You can either pass ``autospec=True`` to :" "func:`patch` / :func:`patch.object` or use the :func:`create_autospec` " @@ -3559,11 +3606,11 @@ msgstr "" "的),所以你可以將它與非常複雜或深度巢狀使用的物件(例如連續引用的模組)一起" "使用,而不會過於影響性能。" -#: ../../library/unittest.mock.rst:2597 +#: ../../library/unittest.mock.rst:2646 msgid "Here's an example of it in use::" msgstr "這是一個正在使用的例子: ::" -#: ../../library/unittest.mock.rst:2599 +#: ../../library/unittest.mock.rst:2648 msgid "" ">>> from urllib import request\n" ">>> patcher = patch('__main__.request', autospec=True)\n" @@ -3581,7 +3628,7 @@ msgstr "" ">>> mock_request.Request\n" "" -#: ../../library/unittest.mock.rst:2607 +#: ../../library/unittest.mock.rst:2656 msgid "" "You can see that :class:`request.Request` has a spec. :class:`request." "Request` takes two arguments in the constructor (one of which is *self*). " @@ -3591,7 +3638,7 @@ msgstr "" "構函式中接受兩個引數(其中之一是 *self*\\ )。如果我們錯誤地呼叫它,會發生以" "下情況: ::" -#: ../../library/unittest.mock.rst:2611 +#: ../../library/unittest.mock.rst:2660 msgid "" ">>> req = request.Request()\n" "Traceback (most recent call last):\n" @@ -3603,13 +3650,13 @@ msgstr "" " ...\n" "TypeError: () takes at least 2 arguments (1 given)" -#: ../../library/unittest.mock.rst:2616 +#: ../../library/unittest.mock.rst:2665 msgid "" "The spec also applies to instantiated classes (i.e. the return value of " "specced mocks)::" msgstr "此規格也適用於實例化的類別(即有規格的 mock 的回傳值): ::" -#: ../../library/unittest.mock.rst:2619 +#: ../../library/unittest.mock.rst:2668 msgid "" ">>> req = request.Request('foo')\n" ">>> req\n" @@ -3619,7 +3666,7 @@ msgstr "" ">>> req\n" "" -#: ../../library/unittest.mock.rst:2623 +#: ../../library/unittest.mock.rst:2672 msgid "" ":class:`Request` objects are not callable, so the return value of " "instantiating our mocked out :class:`request.Request` is a non-callable " @@ -3630,7 +3677,7 @@ msgstr "" "`request.Request` 的回傳值是不可呼叫的 mock。規格到位後,斷言中的任何拼字錯誤" "都會引發正確的錯誤: ::" -#: ../../library/unittest.mock.rst:2627 +#: ../../library/unittest.mock.rst:2676 msgid "" ">>> req.add_header('spam', 'eggs')\n" "\n" @@ -3648,7 +3695,7 @@ msgstr "" "AttributeError: Mock object has no attribute 'assret_called_with'\n" ">>> req.add_header.assert_called_with('spam', 'eggs')" -#: ../../library/unittest.mock.rst:2635 +#: ../../library/unittest.mock.rst:2684 msgid "" "In many cases you will just be able to add ``autospec=True`` to your " "existing :func:`patch` calls and then be protected against bugs due to typos " @@ -3657,7 +3704,7 @@ msgstr "" "在許多情況下,你只需要將 ``autospec=True`` 新增至現有的 :func:`patch` 呼叫" "中,然後就可以防止因拼字錯誤和 api 變更而導致的錯誤。" -#: ../../library/unittest.mock.rst:2639 +#: ../../library/unittest.mock.rst:2688 msgid "" "As well as using *autospec* through :func:`patch` there is a :func:" "`create_autospec` for creating autospecced mocks directly:" @@ -3665,7 +3712,7 @@ msgstr "" "除了透過 :func:`patch` 使用 *autospec* 之外,還有一個 :func:" "`create_autospec` 用於直接建立有自動規格的 mock:" -#: ../../library/unittest.mock.rst:2647 +#: ../../library/unittest.mock.rst:2696 msgid "" "This isn't without caveats and limitations however, which is why it is not " "the default behaviour. In order to know what attributes are available on the " @@ -3682,7 +3729,7 @@ msgstr "" "描述器,那麼你可能無法使用 autospec。換句話說,設計你的物件讓內省是安全的 " "[#]_ 會比較好。" -#: ../../library/unittest.mock.rst:2656 +#: ../../library/unittest.mock.rst:2705 msgid "" "A more serious problem is that it is common for instance attributes to be " "created in the :meth:`~object.__init__` method and not to exist on the class " @@ -3693,7 +3740,7 @@ msgstr "" "而其根本不存在於類別中。*autospec* 無法知道任何動態建立的屬性,並將 api 限制" "為可見的屬性。: ::" -#: ../../library/unittest.mock.rst:2661 +#: ../../library/unittest.mock.rst:2710 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3719,7 +3766,7 @@ msgstr "" " ...\n" "AttributeError: Mock object has no attribute 'a'" -#: ../../library/unittest.mock.rst:2673 +#: ../../library/unittest.mock.rst:2722 msgid "" "There are a few different ways of resolving this problem. The easiest, but " "not necessarily the least annoying, way is to simply set the required " @@ -3731,7 +3778,7 @@ msgstr "" "在 mock 上設定所需的屬性。因為雖然 *autospec* 不允許你取得規格中不存在的屬" "性,但是它不會阻止你設定它們: ::" -#: ../../library/unittest.mock.rst:2679 +#: ../../library/unittest.mock.rst:2728 msgid "" ">>> with patch('__main__.Something', autospec=True):\n" "... thing = Something()\n" @@ -3743,7 +3790,7 @@ msgstr "" "... thing.a = 33\n" "..." -#: ../../library/unittest.mock.rst:2684 +#: ../../library/unittest.mock.rst:2733 msgid "" "There is a more aggressive version of both *spec* and *autospec* that *does* " "prevent you setting non-existent attributes. This is useful if you want to " @@ -3754,7 +3801,7 @@ msgstr "" "屬性。如果你想確保你的程式碼僅能\\ *設定*\\ 有效的屬性,那麼這會很有用,但顯" "然它也順便阻止了這個特殊情況:" -#: ../../library/unittest.mock.rst:2697 +#: ../../library/unittest.mock.rst:2746 msgid "" "Probably the best way of solving the problem is to add class attributes as " "default values for instance members initialised in :meth:`~object.__init__`. " @@ -3766,7 +3813,7 @@ msgstr "" "的實例成員的預設值。請注意,如果你僅在 :meth:`!__init__` 中設定預設屬性,那麼" "透過類別屬性(當然在實例之間共用)提供它們也會更快。例如:" -#: ../../library/unittest.mock.rst:2703 +#: ../../library/unittest.mock.rst:2752 msgid "" "class Something:\n" " a = 33" @@ -3774,7 +3821,7 @@ msgstr "" "class Something:\n" " a = 33" -#: ../../library/unittest.mock.rst:2708 +#: ../../library/unittest.mock.rst:2757 msgid "" "This brings up another issue. It is relatively common to provide a default " "value of ``None`` for members that will later be an object of a different " @@ -3790,7 +3837,7 @@ msgstr "" "他型別的成員,因此自動規格不會對設定為 ``None`` 的成員使用規格。這些會只是普" "通的 mock(通常是 MagicMocks):" -#: ../../library/unittest.mock.rst:2723 +#: ../../library/unittest.mock.rst:2772 msgid "" "If modifying your production classes to add defaults isn't to your liking " "then there are more options. One of these is simply to use an instance as " @@ -3806,7 +3853,7 @@ msgstr "" "你使用替代物件作為規格。值得慶幸的是 :func:`patch` 支援這一點 - 你可以簡單地" "將替代物件作為 *autospec* 引數傳遞: ::" -#: ../../library/unittest.mock.rst:2731 +#: ../../library/unittest.mock.rst:2780 msgid "" ">>> class Something:\n" "... def __init__(self):\n" @@ -3832,7 +3879,7 @@ msgstr "" ">>> mock.a\n" "" -#: ../../library/unittest.mock.rst:2744 +#: ../../library/unittest.mock.rst:2793 msgid "" "This only applies to classes or already instantiated objects. Calling a " "mocked class to create a mock instance *does not* create a real instance. It " @@ -3841,11 +3888,11 @@ msgstr "" "這只適用於類別或已經實例化的物件。呼叫一個被 mock 的類別來建立一個 mock 實例" "\\ *不會*\\ 建立真的實例。它僅查找屬性及對 :func:`dir` 的呼叫。" -#: ../../library/unittest.mock.rst:2749 +#: ../../library/unittest.mock.rst:2798 msgid "Sealing mocks" msgstr "密封 mock" -#: ../../library/unittest.mock.rst:2758 +#: ../../library/unittest.mock.rst:2807 msgid "" "Seal will disable the automatic creation of mocks when accessing an " "attribute of the mock being sealed or any of its attributes that are already " @@ -3854,7 +3901,7 @@ msgstr "" "當存取被密封的 mock 的屬性或其任何已經遞迴 mock 的屬性時,seal 將停用 mock 的" "自動建立。" -#: ../../library/unittest.mock.rst:2761 +#: ../../library/unittest.mock.rst:2810 msgid "" "If a mock instance with a name or a spec is assigned to an attribute it " "won't be considered in the sealing chain. This allows one to prevent seal " @@ -3863,7 +3910,7 @@ msgstr "" "如果將具有名稱或規格的 mock 實例指派給屬性,則不會出現在密封鏈中。這表示可藉" "由固定 mock 物件的一部分來防止密封。: ::" -#: ../../library/unittest.mock.rst:2765 +#: ../../library/unittest.mock.rst:2814 msgid "" ">>> mock = Mock()\n" ">>> mock.submock.attribute1 = 2\n" @@ -3881,28 +3928,28 @@ msgstr "" ">>> mock.submock.attribute2 # This will raise AttributeError.\n" ">>> mock.not_submock.attribute2 # This won't raise." -#: ../../library/unittest.mock.rst:2777 +#: ../../library/unittest.mock.rst:2826 msgid "" "Order of precedence of :attr:`side_effect`, :attr:`return_value` and *wraps*" msgstr ":attr:`side_effect`、:attr:`return_value` 和 *wraps* 的優先順序" -#: ../../library/unittest.mock.rst:2779 +#: ../../library/unittest.mock.rst:2828 msgid "The order of their precedence is:" msgstr "它們的優先順序是:" -#: ../../library/unittest.mock.rst:2781 +#: ../../library/unittest.mock.rst:2830 msgid ":attr:`~Mock.side_effect`" msgstr ":attr:`~Mock.side_effect`" -#: ../../library/unittest.mock.rst:2782 +#: ../../library/unittest.mock.rst:2831 msgid ":attr:`~Mock.return_value`" msgstr ":attr:`~Mock.return_value`" -#: ../../library/unittest.mock.rst:2783 +#: ../../library/unittest.mock.rst:2832 msgid "*wraps*" msgstr "*wraps*" -#: ../../library/unittest.mock.rst:2785 +#: ../../library/unittest.mock.rst:2834 msgid "" "If all three are set, mock will return the value from :attr:`~Mock." "side_effect`, ignoring :attr:`~Mock.return_value` and the wrapped object " @@ -3914,7 +3961,7 @@ msgstr "" "略 :attr:`~Mock.return_value` 和被包裝物件。如果設定了任兩項,則優先順序較高" "的一項將回傳該值。無論先設定哪個順序,優先順序都保持不變。" -#: ../../library/unittest.mock.rst:2803 +#: ../../library/unittest.mock.rst:2852 msgid "" "As ``None`` is the default value of :attr:`~Mock.side_effect`, if you " "reassign its value back to ``None``, the order of precedence will be checked " @@ -3925,7 +3972,7 @@ msgstr "" "``None``,則會檢查 :attr:`~Mock.return_value` 和被包裝物件之間的優先順序,忽" "略 :attr:`~Mock.side_effect`。" -#: ../../library/unittest.mock.rst:2812 +#: ../../library/unittest.mock.rst:2861 msgid "" "If the value being returned by :attr:`~Mock.side_effect` is :data:`DEFAULT`, " "it is ignored and the order of precedence moves to the successor to obtain " @@ -3934,7 +3981,7 @@ msgstr "" "如果 :attr:`~Mock.side_effect` 回傳的值是 :data:`DEFAULT`,它將被忽略,並且優" "先順序被移動到後面一個以獲得要回傳的值。" -#: ../../library/unittest.mock.rst:2821 +#: ../../library/unittest.mock.rst:2870 msgid "" "When :class:`Mock` wraps an object, the default value of :attr:`~Mock." "return_value` will be :data:`DEFAULT`." @@ -3942,13 +3989,13 @@ msgstr "" "當 :class:`Mock` 包裝一個物件時,:attr:`~Mock.return_value` 的預設值將為 :" "data:`DEFAULT`。" -#: ../../library/unittest.mock.rst:2830 +#: ../../library/unittest.mock.rst:2879 msgid "" "The order of precedence will ignore this value and it will move to the last " "successor which is the wrapped object." msgstr "優先順序將忽略該值,並將移動到最後一個,即被包裝物件。" -#: ../../library/unittest.mock.rst:2833 +#: ../../library/unittest.mock.rst:2882 msgid "" "As the real call is being made to the wrapped object, creating an instance " "of this mock will return the real instance of the class. The positional " @@ -3957,7 +4004,7 @@ msgstr "" "當對被包裝物件進行真正的呼叫時,建立此 mock 的實例將回傳該類別的真實實例。必" "須傳遞被包裝物件所需的位置引數(如果存在)。" -#: ../../library/unittest.mock.rst:2851 +#: ../../library/unittest.mock.rst:2900 msgid "" "But if you assign ``None`` to it, this will not be ignored as it is an " "explicit assignment. So, the order of precedence will not move to the " @@ -3966,13 +4013,13 @@ msgstr "" "但如果你為其賦予 ``None`` 則不會被忽略,因為它是明確賦值。因此,優先順序不會" "移至被包裝物件。" -#: ../../library/unittest.mock.rst:2859 +#: ../../library/unittest.mock.rst:2908 msgid "" "Even if you set all three at once when initializing the mock, the order of " "precedence remains the same:" msgstr "即使你在初始化 mock 時同時設定所有三個,優先順序也保持不變:" -#: ../../library/unittest.mock.rst:2876 +#: ../../library/unittest.mock.rst:2925 msgid "" "If :attr:`~Mock.side_effect` is exhausted, the order of precedence will not " "cause a value to be obtained from the successors. Instead, ``StopIteration`` " diff --git a/library/unittest.po b/library/unittest.po index 391ec57ab9..bd134aa24b 100644 --- a/library/unittest.po +++ b/library/unittest.po @@ -7,9 +7,9 @@ # Jason , 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-10-16 06:03+0800\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -2376,6 +2376,12 @@ msgstr "" #: ../../library/unittest.rst:1576 msgid "" +"The *loop_factory* passed to :class:`asyncio.Runner`. Override in subclasses " +"with :class:`asyncio.EventLoop` to avoid using the asyncio policy system." +msgstr "" + +#: ../../library/unittest.rst:1584 +msgid "" "Method called to prepare the test fixture. This is called after :meth:" "`setUp`. This is called immediately before calling the test method; other " "than :exc:`AssertionError` or :exc:`SkipTest`, any exception raised by this " @@ -2383,7 +2389,7 @@ msgid "" "implementation does nothing." msgstr "" -#: ../../library/unittest.rst:1584 +#: ../../library/unittest.rst:1592 msgid "" "Method called immediately after the test method has been called and the " "result recorded. This is called before :meth:`tearDown`. This is called " @@ -2396,11 +2402,11 @@ msgid "" "the outcome of the test method. The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:1596 +#: ../../library/unittest.rst:1604 msgid "This method accepts a coroutine that can be used as a cleanup function." msgstr "" -#: ../../library/unittest.rst:1600 +#: ../../library/unittest.rst:1608 msgid "" "Enter the supplied :term:`asynchronous context manager`. If successful, " "also add its :meth:`~object.__aexit__` method as a cleanup function by :meth:" @@ -2408,7 +2414,7 @@ msgid "" "method." msgstr "" -#: ../../library/unittest.rst:1610 +#: ../../library/unittest.rst:1618 msgid "" "Sets up a new event loop to run the test, collecting the result into the :" "class:`TestResult` object passed as *result*. If *result* is omitted or " @@ -2418,11 +2424,11 @@ msgid "" "cancelled." msgstr "" -#: ../../library/unittest.rst:1618 +#: ../../library/unittest.rst:1626 msgid "An example illustrating the order::" msgstr "" -#: ../../library/unittest.rst:1620 +#: ../../library/unittest.rst:1628 msgid "" "from unittest import IsolatedAsyncioTestCase\n" "\n" @@ -2494,14 +2500,14 @@ msgstr "" "if __name__ == \"__main__\":\n" " unittest.main()" -#: ../../library/unittest.rst:1654 +#: ../../library/unittest.rst:1662 msgid "" "After running the test, ``events`` would contain ``[\"setUp\", " "\"asyncSetUp\", \"test_response\", \"asyncTearDown\", \"tearDown\", " "\"cleanup\"]``." msgstr "" -#: ../../library/unittest.rst:1659 +#: ../../library/unittest.rst:1667 msgid "" "This class implements the portion of the :class:`TestCase` interface which " "allows the test runner to drive the test, but does not provide the methods " @@ -2510,11 +2516,11 @@ msgid "" "`unittest`-based test framework." msgstr "" -#: ../../library/unittest.rst:1669 +#: ../../library/unittest.rst:1677 msgid "Grouping tests" msgstr "" -#: ../../library/unittest.rst:1673 +#: ../../library/unittest.rst:1681 msgid "" "This class represents an aggregation of individual test cases and test " "suites. The class presents the interface needed by the test runner to allow " @@ -2522,14 +2528,14 @@ msgid "" "is the same as iterating over the suite, running each test individually." msgstr "" -#: ../../library/unittest.rst:1678 +#: ../../library/unittest.rst:1686 msgid "" "If *tests* is given, it must be an iterable of individual test cases or " "other test suites that will be used to build the suite initially. Additional " "methods are provided to add test cases and suites to the collection later on." msgstr "" -#: ../../library/unittest.rst:1682 +#: ../../library/unittest.rst:1690 msgid "" ":class:`TestSuite` objects behave much like :class:`TestCase` objects, " "except they do not actually implement a test. Instead, they are used to " @@ -2538,47 +2544,47 @@ msgid "" "instances:" msgstr "" -#: ../../library/unittest.rst:1690 +#: ../../library/unittest.rst:1698 msgid "Add a :class:`TestCase` or :class:`TestSuite` to the suite." msgstr "" -#: ../../library/unittest.rst:1695 +#: ../../library/unittest.rst:1703 msgid "" "Add all the tests from an iterable of :class:`TestCase` and :class:" "`TestSuite` instances to this test suite." msgstr "" -#: ../../library/unittest.rst:1698 +#: ../../library/unittest.rst:1706 msgid "" "This is equivalent to iterating over *tests*, calling :meth:`addTest` for " "each element." msgstr "" -#: ../../library/unittest.rst:1701 +#: ../../library/unittest.rst:1709 msgid ":class:`TestSuite` shares the following methods with :class:`TestCase`:" msgstr "" -#: ../../library/unittest.rst:1706 +#: ../../library/unittest.rst:1714 msgid "" "Run the tests associated with this suite, collecting the result into the " "test result object passed as *result*. Note that unlike :meth:`TestCase." "run`, :meth:`TestSuite.run` requires the result object to be passed in." msgstr "" -#: ../../library/unittest.rst:1714 +#: ../../library/unittest.rst:1722 msgid "" "Run the tests associated with this suite without collecting the result. This " "allows exceptions raised by the test to be propagated to the caller and can " "be used to support running tests under a debugger." msgstr "" -#: ../../library/unittest.rst:1721 +#: ../../library/unittest.rst:1729 msgid "" "Return the number of tests represented by this test object, including all " "individual tests and sub-suites." msgstr "" -#: ../../library/unittest.rst:1727 +#: ../../library/unittest.rst:1735 msgid "" "Tests grouped by a :class:`TestSuite` are always accessed by iteration. " "Subclasses can lazily provide tests by overriding :meth:`!__iter__`. Note " @@ -2590,31 +2596,31 @@ msgid "" "overrides :meth:`TestSuite._removeTestAtIndex` to preserve test references." msgstr "" -#: ../../library/unittest.rst:1737 +#: ../../library/unittest.rst:1745 msgid "" "In earlier versions the :class:`TestSuite` accessed tests directly rather " "than through iteration, so overriding :meth:`!__iter__` wasn't sufficient " "for providing tests." msgstr "" -#: ../../library/unittest.rst:1742 +#: ../../library/unittest.rst:1750 msgid "" "In earlier versions the :class:`TestSuite` held references to each :class:" "`TestCase` after :meth:`TestSuite.run`. Subclasses can restore that behavior " "by overriding :meth:`TestSuite._removeTestAtIndex`." msgstr "" -#: ../../library/unittest.rst:1747 +#: ../../library/unittest.rst:1755 msgid "" "In the typical usage of a :class:`TestSuite` object, the :meth:`run` method " "is invoked by a :class:`TestRunner` rather than by the end-user test harness." msgstr "" -#: ../../library/unittest.rst:1752 +#: ../../library/unittest.rst:1760 msgid "Loading and running tests" msgstr "" -#: ../../library/unittest.rst:1756 +#: ../../library/unittest.rst:1764 msgid "" "The :class:`TestLoader` class is used to create test suites from classes and " "modules. Normally, there is no need to create an instance of this class; " @@ -2623,11 +2629,11 @@ msgid "" "customization of some configurable properties." msgstr "" -#: ../../library/unittest.rst:1762 +#: ../../library/unittest.rst:1770 msgid ":class:`TestLoader` objects have the following attributes:" msgstr "" -#: ../../library/unittest.rst:1767 +#: ../../library/unittest.rst:1775 msgid "" "A list of the non-fatal errors encountered while loading tests. Not reset by " "the loader at any point. Fatal errors are signalled by the relevant method " @@ -2635,17 +2641,17 @@ msgid "" "synthetic test that will raise the original error when run." msgstr "" -#: ../../library/unittest.rst:1776 +#: ../../library/unittest.rst:1784 msgid ":class:`TestLoader` objects have the following methods:" msgstr "" -#: ../../library/unittest.rst:1781 +#: ../../library/unittest.rst:1789 msgid "" "Return a suite of all test cases contained in the :class:`TestCase`\\ -" "derived :class:`testCaseClass`." msgstr "" -#: ../../library/unittest.rst:1784 +#: ../../library/unittest.rst:1792 msgid "" "A test case instance is created for each method named by :meth:" "`getTestCaseNames`. By default these are the method names beginning with " @@ -2654,14 +2660,14 @@ msgid "" "method instead." msgstr "" -#: ../../library/unittest.rst:1793 +#: ../../library/unittest.rst:1801 msgid "" "Return a suite of all test cases contained in the given module. This method " "searches *module* for classes derived from :class:`TestCase` and creates an " "instance of the class for each test method defined for the class." msgstr "" -#: ../../library/unittest.rst:1800 +#: ../../library/unittest.rst:1808 msgid "" "While using a hierarchy of :class:`TestCase`\\ -derived classes can be " "convenient in sharing fixtures and helper functions, defining test methods " @@ -2670,7 +2676,7 @@ msgid "" "fixtures are different and defined in subclasses." msgstr "" -#: ../../library/unittest.rst:1806 +#: ../../library/unittest.rst:1814 msgid "" "If a module provides a ``load_tests`` function it will be called to load the " "tests. This allows modules to customize test loading. This is the " @@ -2678,24 +2684,24 @@ msgid "" "argument to ``load_tests``." msgstr "" -#: ../../library/unittest.rst:1811 +#: ../../library/unittest.rst:1819 msgid "Support for ``load_tests`` added." msgstr "" -#: ../../library/unittest.rst:1814 +#: ../../library/unittest.rst:1822 msgid "Support for a keyword-only argument *pattern* has been added." msgstr "" -#: ../../library/unittest.rst:1817 +#: ../../library/unittest.rst:1825 msgid "" "The undocumented and unofficial *use_load_tests* parameter has been removed." msgstr "" -#: ../../library/unittest.rst:1824 +#: ../../library/unittest.rst:1832 msgid "Return a suite of all test cases given a string specifier." msgstr "" -#: ../../library/unittest.rst:1826 +#: ../../library/unittest.rst:1834 msgid "" "The specifier *name* is a \"dotted name\" that may resolve either to a " "module, a test case class, a test method within a test case class, a :class:" @@ -2706,7 +2712,7 @@ msgid "" "object\"." msgstr "" -#: ../../library/unittest.rst:1834 +#: ../../library/unittest.rst:1842 msgid "" "For example, if you have a module :mod:`SampleTests` containing a :class:" "`TestCase`\\ -derived class :class:`SampleTestCase` with three test methods " @@ -2719,31 +2725,31 @@ msgid "" "a side-effect." msgstr "" -#: ../../library/unittest.rst:1844 +#: ../../library/unittest.rst:1852 msgid "The method optionally resolves *name* relative to the given *module*." msgstr "" -#: ../../library/unittest.rst:1846 +#: ../../library/unittest.rst:1854 msgid "" "If an :exc:`ImportError` or :exc:`AttributeError` occurs while traversing " "*name* then a synthetic test that raises that error when run will be " "returned. These errors are included in the errors accumulated by self.errors." msgstr "" -#: ../../library/unittest.rst:1855 +#: ../../library/unittest.rst:1863 msgid "" "Similar to :meth:`loadTestsFromName`, but takes a sequence of names rather " "than a single name. The return value is a test suite which supports all the " "tests defined for each name." msgstr "" -#: ../../library/unittest.rst:1862 +#: ../../library/unittest.rst:1870 msgid "" "Return a sorted sequence of method names found within *testCaseClass*; this " "should be a subclass of :class:`TestCase`." msgstr "" -#: ../../library/unittest.rst:1868 +#: ../../library/unittest.rst:1876 msgid "" "Find all the test modules by recursing into subdirectories from the " "specified start directory, and return a TestSuite object containing them. " @@ -2752,14 +2758,14 @@ msgid "" "Python identifiers) will be loaded." msgstr "" -#: ../../library/unittest.rst:1874 +#: ../../library/unittest.rst:1882 msgid "" "All test modules must be importable from the top level of the project. If " "the start directory is not the top level directory then *top_level_dir* must " "be specified separately." msgstr "" -#: ../../library/unittest.rst:1878 +#: ../../library/unittest.rst:1886 msgid "" "If importing a module fails, for example due to a syntax error, then this " "will be recorded as a single error and discovery will continue. If the " @@ -2767,7 +2773,7 @@ msgid "" "as a skip instead of an error." msgstr "" -#: ../../library/unittest.rst:1883 +#: ../../library/unittest.rst:1891 msgid "" "If a package (a directory containing a file named :file:`__init__.py`) is " "found, the package will be checked for a ``load_tests`` function. If this " @@ -2777,103 +2783,103 @@ msgid "" "itself calls ``loader.discover``." msgstr "" -#: ../../library/unittest.rst:1891 +#: ../../library/unittest.rst:1899 msgid "" "If ``load_tests`` exists then discovery does *not* recurse into the package, " "``load_tests`` is responsible for loading all tests in the package." msgstr "" -#: ../../library/unittest.rst:1895 +#: ../../library/unittest.rst:1903 msgid "" "The pattern is deliberately not stored as a loader attribute so that " "packages can continue discovery themselves." msgstr "" -#: ../../library/unittest.rst:1898 +#: ../../library/unittest.rst:1906 msgid "" "*top_level_dir* is stored internally, and used as a default to any nested " "calls to ``discover()``. That is, if a package's ``load_tests`` calls " "``loader.discover()``, it does not need to pass this argument." msgstr "" -#: ../../library/unittest.rst:1902 +#: ../../library/unittest.rst:1910 msgid "*start_dir* can be a dotted module name as well as a directory." msgstr "" -#: ../../library/unittest.rst:1906 +#: ../../library/unittest.rst:1914 msgid "" "Modules that raise :exc:`SkipTest` on import are recorded as skips, not " "errors." msgstr "" -#: ../../library/unittest.rst:1910 +#: ../../library/unittest.rst:1918 msgid "*start_dir* can be a :term:`namespace packages `." msgstr "" -#: ../../library/unittest.rst:1913 +#: ../../library/unittest.rst:1921 msgid "" "Paths are sorted before being imported so that execution order is the same " "even if the underlying file system's ordering is not dependent on file name." msgstr "" -#: ../../library/unittest.rst:1918 +#: ../../library/unittest.rst:1926 msgid "" "Found packages are now checked for ``load_tests`` regardless of whether " "their path matches *pattern*, because it is impossible for a package name to " "match the default pattern." msgstr "" -#: ../../library/unittest.rst:1923 +#: ../../library/unittest.rst:1931 msgid "" "*start_dir* can not be a :term:`namespace packages `. It " "has been broken since Python 3.7 and Python 3.11 officially remove it." msgstr "" -#: ../../library/unittest.rst:1927 +#: ../../library/unittest.rst:1935 msgid "*top_level_dir* is only stored for the duration of *discover* call." msgstr "" -#: ../../library/unittest.rst:1931 +#: ../../library/unittest.rst:1939 msgid "" "The following attributes of a :class:`TestLoader` can be configured either " "by subclassing or assignment on an instance:" msgstr "" -#: ../../library/unittest.rst:1937 +#: ../../library/unittest.rst:1945 msgid "" "String giving the prefix of method names which will be interpreted as test " "methods. The default value is ``'test'``." msgstr "" -#: ../../library/unittest.rst:1940 +#: ../../library/unittest.rst:1948 msgid "" "This affects :meth:`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1946 +#: ../../library/unittest.rst:1954 msgid "" "Function to be used to compare method names when sorting them in :meth:" "`getTestCaseNames` and all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1952 +#: ../../library/unittest.rst:1960 msgid "" "Callable object that constructs a test suite from a list of tests. No " "methods on the resulting object are needed. The default value is the :class:" "`TestSuite` class." msgstr "" -#: ../../library/unittest.rst:1956 ../../library/unittest.rst:1969 +#: ../../library/unittest.rst:1964 ../../library/unittest.rst:1977 msgid "This affects all the ``loadTestsFrom*`` methods." msgstr "" -#: ../../library/unittest.rst:1960 +#: ../../library/unittest.rst:1968 msgid "" "List of Unix shell-style wildcard test name patterns that test methods have " "to match to be included in test suites (see ``-k`` option)." msgstr "" -#: ../../library/unittest.rst:1963 +#: ../../library/unittest.rst:1971 msgid "" "If this attribute is not ``None`` (the default), all test methods to be " "included in test suites must match one of the patterns in this list. Note " @@ -2882,13 +2888,13 @@ msgid "" "have to be converted using ``*`` wildcards." msgstr "" -#: ../../library/unittest.rst:1976 +#: ../../library/unittest.rst:1984 msgid "" "This class is used to compile information about which tests have succeeded " "and which have failed." msgstr "" -#: ../../library/unittest.rst:1979 +#: ../../library/unittest.rst:1987 msgid "" "A :class:`TestResult` object stores the results of a set of tests. The :" "class:`TestCase` and :class:`TestSuite` classes ensure that results are " @@ -2896,7 +2902,7 @@ msgid "" "outcome of tests." msgstr "" -#: ../../library/unittest.rst:1984 +#: ../../library/unittest.rst:1992 msgid "" "Testing frameworks built on top of :mod:`unittest` may want access to the :" "class:`TestResult` object generated by running a set of tests for reporting " @@ -2904,61 +2910,61 @@ msgid "" "`TestRunner.run` method for this purpose." msgstr "" -#: ../../library/unittest.rst:1989 +#: ../../library/unittest.rst:1997 msgid "" ":class:`TestResult` instances have the following attributes that will be of " "interest when inspecting the results of running a set of tests:" msgstr "" -#: ../../library/unittest.rst:1995 +#: ../../library/unittest.rst:2003 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test which raised an " "unexpected exception." msgstr "" -#: ../../library/unittest.rst:2001 +#: ../../library/unittest.rst:2009 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents a test where a failure " "was explicitly signalled using the :ref:`assert\\* methods `." msgstr "" -#: ../../library/unittest.rst:2007 +#: ../../library/unittest.rst:2015 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding the reason for skipping the test." msgstr "" -#: ../../library/unittest.rst:2014 +#: ../../library/unittest.rst:2022 msgid "" "A list containing 2-tuples of :class:`TestCase` instances and strings " "holding formatted tracebacks. Each tuple represents an expected failure or " "error of the test case." msgstr "" -#: ../../library/unittest.rst:2020 +#: ../../library/unittest.rst:2028 msgid "" "A list containing :class:`TestCase` instances that were marked as expected " "failures, but succeeded." msgstr "" -#: ../../library/unittest.rst:2025 +#: ../../library/unittest.rst:2033 msgid "" "A list containing 2-tuples of test case names and floats representing the " "elapsed time of each test which was run." msgstr "" -#: ../../library/unittest.rst:2032 +#: ../../library/unittest.rst:2040 msgid "" "Set to ``True`` when the execution of tests should stop by :meth:`stop`." msgstr "" -#: ../../library/unittest.rst:2036 +#: ../../library/unittest.rst:2044 msgid "The total number of tests run so far." msgstr "" -#: ../../library/unittest.rst:2040 +#: ../../library/unittest.rst:2048 msgid "" "If set to true, ``sys.stdout`` and ``sys.stderr`` will be buffered in " "between :meth:`startTest` and :meth:`stopTest` being called. Collected " @@ -2967,29 +2973,29 @@ msgid "" "error message." msgstr "" -#: ../../library/unittest.rst:2049 +#: ../../library/unittest.rst:2057 msgid "" "If set to true :meth:`stop` will be called on the first failure or error, " "halting the test run." msgstr "" -#: ../../library/unittest.rst:2056 +#: ../../library/unittest.rst:2064 msgid "If set to true then local variables will be shown in tracebacks." msgstr "" -#: ../../library/unittest.rst:2062 +#: ../../library/unittest.rst:2070 msgid "" "Return ``True`` if all tests run so far have passed, otherwise returns " "``False``." msgstr "" -#: ../../library/unittest.rst:2065 +#: ../../library/unittest.rst:2073 msgid "" "Returns ``False`` if there were any :attr:`unexpectedSuccesses` from tests " "marked with the :func:`expectedFailure` decorator." msgstr "" -#: ../../library/unittest.rst:2071 +#: ../../library/unittest.rst:2079 msgid "" "This method can be called to signal that the set of tests being run should " "be aborted by setting the :attr:`shouldStop` attribute to ``True``. :class:" @@ -2997,7 +3003,7 @@ msgid "" "additional tests." msgstr "" -#: ../../library/unittest.rst:2076 +#: ../../library/unittest.rst:2084 msgid "" "For example, this feature is used by the :class:`TextTestRunner` class to " "stop the test framework when the user signals an interrupt from the " @@ -3005,7 +3011,7 @@ msgid "" "implementations can use this in a similar manner." msgstr "" -#: ../../library/unittest.rst:2081 +#: ../../library/unittest.rst:2089 msgid "" "The following methods of the :class:`TestResult` class are used to maintain " "the internal data structures, and may be extended in subclasses to support " @@ -3013,141 +3019,141 @@ msgid "" "tools which support interactive reporting while tests are being run." msgstr "" -#: ../../library/unittest.rst:2089 +#: ../../library/unittest.rst:2097 msgid "Called when the test case *test* is about to be run." msgstr "" -#: ../../library/unittest.rst:2093 +#: ../../library/unittest.rst:2101 msgid "" "Called after the test case *test* has been executed, regardless of the " "outcome." msgstr "" -#: ../../library/unittest.rst:2098 +#: ../../library/unittest.rst:2106 msgid "Called once before any tests are executed." msgstr "" -#: ../../library/unittest.rst:2105 +#: ../../library/unittest.rst:2113 msgid "Called once after all tests are executed." msgstr "" -#: ../../library/unittest.rst:2112 +#: ../../library/unittest.rst:2120 msgid "" "Called when the test case *test* raises an unexpected exception. *err* is a " "tuple of the form returned by :func:`sys.exc_info`: ``(type, value, " "traceback)``." msgstr "" -#: ../../library/unittest.rst:2116 +#: ../../library/unittest.rst:2124 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`errors` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2123 +#: ../../library/unittest.rst:2131 msgid "" "Called when the test case *test* signals a failure. *err* is a tuple of the " "form returned by :func:`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: ../../library/unittest.rst:2126 +#: ../../library/unittest.rst:2134 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`failures` attribute, where *formatted_err* is a formatted " "traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2133 +#: ../../library/unittest.rst:2141 msgid "Called when the test case *test* succeeds." msgstr "" -#: ../../library/unittest.rst:2135 +#: ../../library/unittest.rst:2143 msgid "The default implementation does nothing." msgstr "" -#: ../../library/unittest.rst:2140 +#: ../../library/unittest.rst:2148 msgid "" "Called when the test case *test* is skipped. *reason* is the reason the " "test gave for skipping." msgstr "" -#: ../../library/unittest.rst:2143 +#: ../../library/unittest.rst:2151 msgid "" "The default implementation appends a tuple ``(test, reason)`` to the " "instance's :attr:`skipped` attribute." msgstr "" -#: ../../library/unittest.rst:2149 +#: ../../library/unittest.rst:2157 msgid "" "Called when the test case *test* fails or errors, but was marked with the :" "func:`expectedFailure` decorator." msgstr "" -#: ../../library/unittest.rst:2152 +#: ../../library/unittest.rst:2160 msgid "" "The default implementation appends a tuple ``(test, formatted_err)`` to the " "instance's :attr:`expectedFailures` attribute, where *formatted_err* is a " "formatted traceback derived from *err*." msgstr "" -#: ../../library/unittest.rst:2159 +#: ../../library/unittest.rst:2167 msgid "" "Called when the test case *test* was marked with the :func:`expectedFailure` " "decorator, but succeeded." msgstr "" -#: ../../library/unittest.rst:2162 +#: ../../library/unittest.rst:2170 msgid "" "The default implementation appends the test to the instance's :attr:" "`unexpectedSuccesses` attribute." msgstr "" -#: ../../library/unittest.rst:2168 +#: ../../library/unittest.rst:2176 msgid "" "Called when a subtest finishes. *test* is the test case corresponding to " "the test method. *subtest* is a custom :class:`TestCase` instance " "describing the subtest." msgstr "" -#: ../../library/unittest.rst:2172 +#: ../../library/unittest.rst:2180 msgid "" "If *outcome* is :const:`None`, the subtest succeeded. Otherwise, it failed " "with an exception where *outcome* is a tuple of the form returned by :func:" "`sys.exc_info`: ``(type, value, traceback)``." msgstr "" -#: ../../library/unittest.rst:2176 +#: ../../library/unittest.rst:2184 msgid "" "The default implementation does nothing when the outcome is a success, and " "records subtest failures as normal failures." msgstr "" -#: ../../library/unittest.rst:2183 +#: ../../library/unittest.rst:2191 msgid "" "Called when the test case finishes. *elapsed* is the time represented in " "seconds, and it includes the execution of cleanup functions." msgstr "" -#: ../../library/unittest.rst:2190 +#: ../../library/unittest.rst:2198 msgid "" "A concrete implementation of :class:`TestResult` used by the :class:" "`TextTestRunner`. Subclasses should accept ``**kwargs`` to ensure " "compatibility as the interface changes." msgstr "" -#: ../../library/unittest.rst:2196 +#: ../../library/unittest.rst:2204 msgid "Added the *durations* keyword parameter." msgstr "新增 *durations* 關鍵字參數。" -#: ../../library/unittest.rst:2201 +#: ../../library/unittest.rst:2209 msgid "" "Instance of the :class:`TestLoader` class intended to be shared. If no " "customization of the :class:`TestLoader` is needed, this instance can be " "used instead of repeatedly creating new instances." msgstr "" -#: ../../library/unittest.rst:2210 +#: ../../library/unittest.rst:2218 msgid "" "A basic test runner implementation that outputs results to a stream. If " "*stream* is ``None``, the default, :data:`sys.stderr` is used as the output " @@ -3158,7 +3164,7 @@ msgid "" "unittest." msgstr "" -#: ../../library/unittest.rst:2217 +#: ../../library/unittest.rst:2225 msgid "" "By default this runner shows :exc:`DeprecationWarning`, :exc:" "`PendingDeprecationWarning`, :exc:`ResourceWarning` and :exc:`ImportWarning` " @@ -3168,32 +3174,32 @@ msgid "" "``None``." msgstr "" -#: ../../library/unittest.rst:2225 +#: ../../library/unittest.rst:2233 msgid "Added the *warnings* parameter." msgstr "新增 *warnings* 參數。" -#: ../../library/unittest.rst:2228 +#: ../../library/unittest.rst:2236 msgid "" "The default stream is set to :data:`sys.stderr` at instantiation time rather " "than import time." msgstr "" -#: ../../library/unittest.rst:2232 +#: ../../library/unittest.rst:2240 msgid "Added the *tb_locals* parameter." msgstr "新增 *tb_locals* 參數。" -#: ../../library/unittest.rst:2235 +#: ../../library/unittest.rst:2243 msgid "Added the *durations* parameter." msgstr "新增 *durations* 參數。" -#: ../../library/unittest.rst:2240 +#: ../../library/unittest.rst:2248 msgid "" "This method returns the instance of ``TestResult`` used by :meth:`run`. It " "is not intended to be called directly, but can be overridden in subclasses " "to provide a custom ``TestResult``." msgstr "" -#: ../../library/unittest.rst:2244 +#: ../../library/unittest.rst:2252 msgid "" "``_makeResult()`` instantiates the class or callable passed in the " "``TextTestRunner`` constructor as the ``resultclass`` argument. It defaults " @@ -3201,11 +3207,11 @@ msgid "" "class is instantiated with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2249 +#: ../../library/unittest.rst:2257 msgid "stream, descriptions, verbosity" msgstr "" -#: ../../library/unittest.rst:2253 +#: ../../library/unittest.rst:2261 msgid "" "This method is the main public interface to the ``TextTestRunner``. This " "method takes a :class:`TestSuite` or :class:`TestCase` instance. A :class:" @@ -3213,7 +3219,7 @@ msgid "" "run and the results printed to stdout." msgstr "" -#: ../../library/unittest.rst:2264 +#: ../../library/unittest.rst:2272 msgid "" "A command-line program that loads a set of tests from *module* and runs " "them; this is primarily for making test modules conveniently executable. The " @@ -3221,7 +3227,7 @@ msgid "" "of a test script::" msgstr "" -#: ../../library/unittest.rst:2269 +#: ../../library/unittest.rst:2277 msgid "" "if __name__ == '__main__':\n" " unittest.main()" @@ -3229,13 +3235,13 @@ msgstr "" "if __name__ == '__main__':\n" " unittest.main()" -#: ../../library/unittest.rst:2272 +#: ../../library/unittest.rst:2280 msgid "" "You can run tests with more detailed information by passing in the verbosity " "argument::" msgstr "" -#: ../../library/unittest.rst:2275 +#: ../../library/unittest.rst:2283 msgid "" "if __name__ == '__main__':\n" " unittest.main(verbosity=2)" @@ -3243,7 +3249,7 @@ msgstr "" "if __name__ == '__main__':\n" " unittest.main(verbosity=2)" -#: ../../library/unittest.rst:2278 +#: ../../library/unittest.rst:2286 msgid "" "The *defaultTest* argument is either the name of a single test or an " "iterable of test names to run if no test names are specified via *argv*. If " @@ -3251,14 +3257,14 @@ msgid "" "tests found in *module* are run." msgstr "" -#: ../../library/unittest.rst:2283 +#: ../../library/unittest.rst:2291 msgid "" "The *argv* argument can be a list of options passed to the program, with the " "first element being the program name. If not specified or ``None``, the " "values of :data:`sys.argv` are used." msgstr "" -#: ../../library/unittest.rst:2287 +#: ../../library/unittest.rst:2295 msgid "" "The *testRunner* argument can either be a test runner class or an already " "created instance of it. By default ``main`` calls :func:`sys.exit` with an " @@ -3266,20 +3272,20 @@ msgid "" "code of 5 indicates that no tests were run or skipped." msgstr "" -#: ../../library/unittest.rst:2292 +#: ../../library/unittest.rst:2300 msgid "" "The *testLoader* argument has to be a :class:`TestLoader` instance, and " "defaults to :data:`defaultTestLoader`." msgstr "" -#: ../../library/unittest.rst:2295 +#: ../../library/unittest.rst:2303 msgid "" "``main`` supports being used from the interactive interpreter by passing in " "the argument ``exit=False``. This displays the result on standard output " "without calling :func:`sys.exit`::" msgstr "" -#: ../../library/unittest.rst:2299 +#: ../../library/unittest.rst:2307 msgid "" ">>> from unittest import main\n" ">>> main(module='test_module', exit=False)" @@ -3287,13 +3293,13 @@ msgstr "" ">>> from unittest import main\n" ">>> main(module='test_module', exit=False)" -#: ../../library/unittest.rst:2302 +#: ../../library/unittest.rst:2310 msgid "" "The *failfast*, *catchbreak* and *buffer* parameters have the same effect as " "the same-name `command-line options`_." msgstr "" -#: ../../library/unittest.rst:2305 +#: ../../library/unittest.rst:2313 msgid "" "The *warnings* argument specifies the :ref:`warning filter ` " "that should be used while running the tests. If it's not specified, it will " @@ -3302,60 +3308,60 @@ msgid "" "to ``'default'``." msgstr "" -#: ../../library/unittest.rst:2311 +#: ../../library/unittest.rst:2319 msgid "" "Calling ``main`` returns an object with the ``result`` attribute that " "contains the result of the tests run as a :class:`unittest.TestResult`." msgstr "" -#: ../../library/unittest.rst:2314 +#: ../../library/unittest.rst:2322 msgid "The *exit* parameter was added." msgstr "新增 *exit* 參數。" -#: ../../library/unittest.rst:2317 +#: ../../library/unittest.rst:2325 msgid "" "The *verbosity*, *failfast*, *catchbreak*, *buffer* and *warnings* " "parameters were added." msgstr "" -#: ../../library/unittest.rst:2321 +#: ../../library/unittest.rst:2329 msgid "" "The *defaultTest* parameter was changed to also accept an iterable of test " "names." msgstr "" -#: ../../library/unittest.rst:2329 +#: ../../library/unittest.rst:2337 msgid "load_tests Protocol" msgstr "" -#: ../../library/unittest.rst:2333 +#: ../../library/unittest.rst:2341 msgid "" "Modules or packages can customize how tests are loaded from them during " "normal test runs or test discovery by implementing a function called " "``load_tests``." msgstr "" -#: ../../library/unittest.rst:2336 +#: ../../library/unittest.rst:2344 msgid "" "If a test module defines ``load_tests`` it will be called by :meth:" "`TestLoader.loadTestsFromModule` with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2339 ../../library/unittest.rst:2371 +#: ../../library/unittest.rst:2347 ../../library/unittest.rst:2379 msgid "load_tests(loader, standard_tests, pattern)" msgstr "load_tests(loader, standard_tests, pattern)" -#: ../../library/unittest.rst:2341 +#: ../../library/unittest.rst:2349 msgid "" "where *pattern* is passed straight through from ``loadTestsFromModule``. It " "defaults to ``None``." msgstr "" -#: ../../library/unittest.rst:2344 +#: ../../library/unittest.rst:2352 msgid "It should return a :class:`TestSuite`." msgstr "" -#: ../../library/unittest.rst:2346 +#: ../../library/unittest.rst:2354 msgid "" "*loader* is the instance of :class:`TestLoader` doing the loading. " "*standard_tests* are the tests that would be loaded by default from the " @@ -3364,13 +3370,13 @@ msgid "" "packages as part of test discovery." msgstr "" -#: ../../library/unittest.rst:2352 +#: ../../library/unittest.rst:2360 msgid "" "A typical ``load_tests`` function that loads tests from a specific set of :" "class:`TestCase` classes may look like::" msgstr "" -#: ../../library/unittest.rst:2355 +#: ../../library/unittest.rst:2363 msgid "" "test_cases = (TestCase1, TestCase2, TestCase3)\n" "\n" @@ -3390,7 +3396,7 @@ msgstr "" " suite.addTests(tests)\n" " return suite" -#: ../../library/unittest.rst:2364 +#: ../../library/unittest.rst:2372 msgid "" "If discovery is started in a directory containing a package, either from the " "command line or by calling :meth:`TestLoader.discover`, then the package :" @@ -3400,21 +3406,21 @@ msgid "" "left up to ``load_tests`` which is called with the following arguments::" msgstr "" -#: ../../library/unittest.rst:2373 +#: ../../library/unittest.rst:2381 msgid "" "This should return a :class:`TestSuite` representing all the tests from the " "package. (``standard_tests`` will only contain tests collected from :file:" "`__init__.py`.)" msgstr "" -#: ../../library/unittest.rst:2377 +#: ../../library/unittest.rst:2385 msgid "" "Because the pattern is passed into ``load_tests`` the package is free to " "continue (and potentially modify) test discovery. A 'do nothing' " "``load_tests`` function for a test package would look like::" msgstr "" -#: ../../library/unittest.rst:2381 +#: ../../library/unittest.rst:2389 msgid "" "def load_tests(loader, standard_tests, pattern):\n" " # top level directory cached on loader instance\n" @@ -3424,17 +3430,17 @@ msgid "" " return standard_tests" msgstr "" -#: ../../library/unittest.rst:2388 +#: ../../library/unittest.rst:2396 msgid "" "Discovery no longer checks package names for matching *pattern* due to the " "impossibility of package names matching the default pattern." msgstr "" -#: ../../library/unittest.rst:2395 +#: ../../library/unittest.rst:2403 msgid "Class and Module Fixtures" msgstr "" -#: ../../library/unittest.rst:2397 +#: ../../library/unittest.rst:2405 msgid "" "Class and module level fixtures are implemented in :class:`TestSuite`. When " "the test suite encounters a test from a new class then :meth:`tearDownClass` " @@ -3442,27 +3448,27 @@ msgid "" "`setUpClass` from the new class." msgstr "" -#: ../../library/unittest.rst:2402 +#: ../../library/unittest.rst:2410 msgid "" "Similarly if a test is from a different module from the previous test then " "``tearDownModule`` from the previous module is run, followed by " "``setUpModule`` from the new module." msgstr "" -#: ../../library/unittest.rst:2406 +#: ../../library/unittest.rst:2414 msgid "" "After all the tests have run the final ``tearDownClass`` and " "``tearDownModule`` are run." msgstr "" -#: ../../library/unittest.rst:2409 +#: ../../library/unittest.rst:2417 msgid "" "Note that shared fixtures do not play well with [potential] features like " "test parallelization and they break test isolation. They should be used with " "care." msgstr "" -#: ../../library/unittest.rst:2412 +#: ../../library/unittest.rst:2420 msgid "" "The default ordering of tests created by the unittest test loaders is to " "group all tests from the same modules and classes together. This will lead " @@ -3472,14 +3478,14 @@ msgid "" "functions may be called multiple times in a single test run." msgstr "" -#: ../../library/unittest.rst:2419 +#: ../../library/unittest.rst:2427 msgid "" "Shared fixtures are not intended to work with suites with non-standard " "ordering. A ``BaseTestSuite`` still exists for frameworks that don't want to " "support shared fixtures." msgstr "" -#: ../../library/unittest.rst:2423 +#: ../../library/unittest.rst:2431 msgid "" "If there are any exceptions raised during one of the shared fixture " "functions the test is reported as an error. Because there is no " @@ -3489,15 +3495,15 @@ msgid "" "matter, but if you are a framework author it may be relevant." msgstr "" -#: ../../library/unittest.rst:2432 +#: ../../library/unittest.rst:2440 msgid "setUpClass and tearDownClass" msgstr "" -#: ../../library/unittest.rst:2434 +#: ../../library/unittest.rst:2442 msgid "These must be implemented as class methods::" msgstr "" -#: ../../library/unittest.rst:2436 +#: ../../library/unittest.rst:2444 msgid "" "import unittest\n" "\n" @@ -3521,14 +3527,14 @@ msgstr "" " def tearDownClass(cls):\n" " cls._connection.destroy()" -#: ../../library/unittest.rst:2447 +#: ../../library/unittest.rst:2455 msgid "" "If you want the ``setUpClass`` and ``tearDownClass`` on base classes called " "then you must call up to them yourself. The implementations in :class:" "`TestCase` are empty." msgstr "" -#: ../../library/unittest.rst:2451 +#: ../../library/unittest.rst:2459 msgid "" "If an exception is raised during a ``setUpClass`` then the tests in the " "class are not run and the ``tearDownClass`` is not run. Skipped classes will " @@ -3537,15 +3543,15 @@ msgid "" "instead of as an error." msgstr "" -#: ../../library/unittest.rst:2459 +#: ../../library/unittest.rst:2467 msgid "setUpModule and tearDownModule" msgstr "" -#: ../../library/unittest.rst:2461 +#: ../../library/unittest.rst:2469 msgid "These should be implemented as functions::" msgstr "" -#: ../../library/unittest.rst:2463 +#: ../../library/unittest.rst:2471 msgid "" "def setUpModule():\n" " createConnection()\n" @@ -3559,7 +3565,7 @@ msgstr "" "def tearDownModule():\n" " closeConnection()" -#: ../../library/unittest.rst:2469 +#: ../../library/unittest.rst:2477 msgid "" "If an exception is raised in a ``setUpModule`` then none of the tests in the " "module will be run and the ``tearDownModule`` will not be run. If the " @@ -3567,13 +3573,13 @@ msgid "" "having been skipped instead of as an error." msgstr "" -#: ../../library/unittest.rst:2474 +#: ../../library/unittest.rst:2482 msgid "" "To add cleanup code that must be run even in the case of an exception, use " "``addModuleCleanup``:" msgstr "" -#: ../../library/unittest.rst:2480 +#: ../../library/unittest.rst:2488 msgid "" "Add a function to be called after :func:`tearDownModule` to cleanup " "resources used during the test class. Functions will be called in reverse " @@ -3582,13 +3588,13 @@ msgid "" "`addModuleCleanup` when they are added." msgstr "" -#: ../../library/unittest.rst:2486 +#: ../../library/unittest.rst:2494 msgid "" "If :meth:`setUpModule` fails, meaning that :func:`tearDownModule` is not " "called, then any cleanup functions added will still be called." msgstr "" -#: ../../library/unittest.rst:2494 +#: ../../library/unittest.rst:2502 msgid "" "Enter the supplied :term:`context manager`. If successful, also add its :" "meth:`~object.__exit__` method as a cleanup function by :func:" @@ -3596,30 +3602,30 @@ msgid "" "method." msgstr "" -#: ../../library/unittest.rst:2504 +#: ../../library/unittest.rst:2512 msgid "" "This function is called unconditionally after :func:`tearDownModule`, or " "after :func:`setUpModule` if :func:`setUpModule` raises an exception." msgstr "" -#: ../../library/unittest.rst:2507 +#: ../../library/unittest.rst:2515 msgid "" "It is responsible for calling all the cleanup functions added by :func:" "`addModuleCleanup`. If you need cleanup functions to be called *prior* to :" "func:`tearDownModule` then you can call :func:`doModuleCleanups` yourself." msgstr "" -#: ../../library/unittest.rst:2512 +#: ../../library/unittest.rst:2520 msgid "" ":func:`doModuleCleanups` pops methods off the stack of cleanup functions one " "at a time, so it can be called at any time." msgstr "" -#: ../../library/unittest.rst:2519 +#: ../../library/unittest.rst:2527 msgid "Signal Handling" msgstr "" -#: ../../library/unittest.rst:2523 +#: ../../library/unittest.rst:2531 msgid "" "The :option:`-c/--catch ` command-line option to unittest, " "along with the ``catchbreak`` parameter to :func:`unittest.main`, provide " @@ -3629,7 +3635,7 @@ msgid "" "A second control-c will raise a :exc:`KeyboardInterrupt` in the usual way." msgstr "" -#: ../../library/unittest.rst:2530 +#: ../../library/unittest.rst:2538 msgid "" "The control-c handling signal handler attempts to remain compatible with " "code or tests that install their own :const:`signal.SIGINT` handler. If the " @@ -3641,48 +3647,48 @@ msgid "" "disabled the :func:`removeHandler` decorator can be used." msgstr "" -#: ../../library/unittest.rst:2539 +#: ../../library/unittest.rst:2547 msgid "" "There are a few utility functions for framework authors to enable control-c " "handling functionality within test frameworks." msgstr "" -#: ../../library/unittest.rst:2544 +#: ../../library/unittest.rst:2552 msgid "" "Install the control-c handler. When a :const:`signal.SIGINT` is received " "(usually in response to the user pressing control-c) all registered results " "have :meth:`~TestResult.stop` called." msgstr "" -#: ../../library/unittest.rst:2551 +#: ../../library/unittest.rst:2559 msgid "" "Register a :class:`TestResult` object for control-c handling. Registering a " "result stores a weak reference to it, so it doesn't prevent the result from " "being garbage collected." msgstr "" -#: ../../library/unittest.rst:2555 +#: ../../library/unittest.rst:2563 msgid "" "Registering a :class:`TestResult` object has no side-effects if control-c " "handling is not enabled, so test frameworks can unconditionally register all " "results they create independently of whether or not handling is enabled." msgstr "" -#: ../../library/unittest.rst:2562 +#: ../../library/unittest.rst:2570 msgid "" "Remove a registered result. Once a result has been removed then :meth:" "`~TestResult.stop` will no longer be called on that result object in " "response to a control-c." msgstr "" -#: ../../library/unittest.rst:2569 +#: ../../library/unittest.rst:2577 msgid "" "When called without arguments this function removes the control-c handler if " "it has been installed. This function can also be used as a test decorator to " "temporarily remove the handler while the test is being executed::" msgstr "" -#: ../../library/unittest.rst:2573 +#: ../../library/unittest.rst:2581 msgid "" "@unittest.removeHandler\n" "def test_signal_handling(self):\n" diff --git a/library/unix.po b/library/unix.po index b9fe32495a..be71ea3e66 100644 --- a/library/unix.po +++ b/library/unix.po @@ -5,7 +5,7 @@ # Matt Wang , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-02-15 18:42+0800\n" diff --git a/library/urllib.error.po b/library/urllib.error.po index 6b18c50684..550aa37d83 100644 --- a/library/urllib.error.po +++ b/library/urllib.error.po @@ -7,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-06-11 15:34+0800\n" diff --git a/library/urllib.parse.po b/library/urllib.parse.po index 24dc952196..d522fd40ff 100644 --- a/library/urllib.parse.po +++ b/library/urllib.parse.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:14+0000\n" "Last-Translator: Adrian Liaw \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -37,20 +37,29 @@ msgstr "" msgid "" "The module has been designed to match the internet RFC on Relative Uniform " "Resource Locators. It supports the following URL schemes: ``file``, ``ftp``, " -"``gopher``, ``hdl``, ``http``, ``https``, ``imap``, ``mailto``, ``mms``, " -"``news``, ``nntp``, ``prospero``, ``rsync``, ``rtsp``, ``rtsps``, ``rtspu``, " -"``sftp``, ``shttp``, ``sip``, ``sips``, ``snews``, ``svn``, ``svn+ssh``, " -"``telnet``, ``wais``, ``ws``, ``wss``." +"``gopher``, ``hdl``, ``http``, ``https``, ``imap``, ``itms-services``, " +"``mailto``, ``mms``, ``news``, ``nntp``, ``prospero``, ``rsync``, ``rtsp``, " +"``rtsps``, ``rtspu``, ``sftp``, ``shttp``, ``sip``, ``sips``, ``snews``, " +"``svn``, ``svn+ssh``, ``telnet``, ``wais``, ``ws``, ``wss``." msgstr "" -#: ../../library/urllib.parse.rst:30 +#: ../../library/urllib.parse.rst:32 +msgid "" +"The inclusion of the ``itms-services`` URL scheme can prevent an app from " +"passing Apple's App Store review process for the macOS and iOS App Stores. " +"Handling for the ``itms-services`` scheme is always removed on iOS; on " +"macOS, it *may* be removed if CPython has been built with the :option:`--" +"with-app-store-compliance` option." +msgstr "" + +#: ../../library/urllib.parse.rst:38 msgid "" "The :mod:`urllib.parse` module defines functions that fall into two broad " "categories: URL parsing and URL quoting. These are covered in detail in the " "following sections." msgstr "" -#: ../../library/urllib.parse.rst:34 +#: ../../library/urllib.parse.rst:42 msgid "" "This module's functions use the deprecated term ``netloc`` (or ``net_loc``), " "which was introduced in :rfc:`1808`. However, this term has been obsoleted " @@ -58,17 +67,17 @@ msgid "" "The use of ``netloc`` is continued for backward compatibility." msgstr "" -#: ../../library/urllib.parse.rst:40 +#: ../../library/urllib.parse.rst:48 msgid "URL Parsing" msgstr "" -#: ../../library/urllib.parse.rst:42 +#: ../../library/urllib.parse.rst:50 msgid "" "The URL parsing functions focus on splitting a URL string into its " "components, or on combining URL components into a URL string." msgstr "" -#: ../../library/urllib.parse.rst:47 +#: ../../library/urllib.parse.rst:55 msgid "" "Parse a URL into six components, returning a 6-item :term:`named tuple`. " "This corresponds to the general structure of a URL: ``scheme://netloc/path;" @@ -79,7 +88,7 @@ msgid "" "slash in the *path* component, which is retained if present. For example:" msgstr "" -#: ../../library/urllib.parse.rst:56 +#: ../../library/urllib.parse.rst:64 msgid "" ">>> from urllib.parse import urlparse\n" ">>> urlparse(\"scheme://netloc/path;parameters?query#fragment\")\n" @@ -125,14 +134,14 @@ msgstr "" ">>> o._replace(fragment=\"\").geturl()\n" "'http://docs.python.org:80/3/library/urllib.parse.html?highlight=params'" -#: ../../library/urllib.parse.rst:80 +#: ../../library/urllib.parse.rst:88 msgid "" "Following the syntax specifications in :rfc:`1808`, urlparse recognizes a " "netloc only if it is properly introduced by '//'. Otherwise the input is " "presumed to be a relative URL and thus to start with a path component." msgstr "" -#: ../../library/urllib.parse.rst:85 +#: ../../library/urllib.parse.rst:93 msgid "" ">>> from urllib.parse import urlparse\n" ">>> urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" @@ -158,7 +167,7 @@ msgstr "" "ParseResult(scheme='', netloc='', path='help/Python.html', params='',\n" " query='', fragment='')" -#: ../../library/urllib.parse.rst:99 +#: ../../library/urllib.parse.rst:107 msgid "" "The *scheme* argument gives the default addressing scheme, to be used only " "if the URL does not specify one. It should be the same type (text or bytes) " @@ -166,7 +175,7 @@ msgid "" "is automatically converted to ``b''`` if appropriate." msgstr "" -#: ../../library/urllib.parse.rst:104 +#: ../../library/urllib.parse.rst:112 msgid "" "If the *allow_fragments* argument is false, fragment identifiers are not " "recognized. Instead, they are parsed as part of the path, parameters or " @@ -174,174 +183,174 @@ msgid "" "return value." msgstr "" -#: ../../library/urllib.parse.rst:109 +#: ../../library/urllib.parse.rst:117 msgid "" "The return value is a :term:`named tuple`, which means that its items can be " "accessed by index or as named attributes, which are:" msgstr "" -#: ../../library/urllib.parse.rst:113 ../../library/urllib.parse.rst:302 -#: ../../library/urllib.parse.rst:415 +#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 +#: ../../library/urllib.parse.rst:423 msgid "Attribute" msgstr "屬性" -#: ../../library/urllib.parse.rst:113 ../../library/urllib.parse.rst:302 -#: ../../library/urllib.parse.rst:415 +#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 +#: ../../library/urllib.parse.rst:423 msgid "Index" msgstr "" -#: ../../library/urllib.parse.rst:113 ../../library/urllib.parse.rst:302 -#: ../../library/urllib.parse.rst:415 +#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 +#: ../../library/urllib.parse.rst:423 msgid "Value" msgstr "" -#: ../../library/urllib.parse.rst:113 ../../library/urllib.parse.rst:302 -#: ../../library/urllib.parse.rst:415 +#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 +#: ../../library/urllib.parse.rst:423 msgid "Value if not present" msgstr "" -#: ../../library/urllib.parse.rst:115 ../../library/urllib.parse.rst:304 +#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:312 msgid ":attr:`scheme`" msgstr ":attr:`scheme`" -#: ../../library/urllib.parse.rst:115 ../../library/urllib.parse.rst:304 -#: ../../library/urllib.parse.rst:417 +#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:312 +#: ../../library/urllib.parse.rst:425 msgid "0" msgstr "0" -#: ../../library/urllib.parse.rst:115 ../../library/urllib.parse.rst:304 +#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:312 msgid "URL scheme specifier" msgstr "" -#: ../../library/urllib.parse.rst:115 ../../library/urllib.parse.rst:304 +#: ../../library/urllib.parse.rst:123 ../../library/urllib.parse.rst:312 msgid "*scheme* parameter" msgstr "" -#: ../../library/urllib.parse.rst:117 ../../library/urllib.parse.rst:306 +#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:314 msgid ":attr:`netloc`" msgstr ":attr:`netloc`" -#: ../../library/urllib.parse.rst:117 ../../library/urllib.parse.rst:306 -#: ../../library/urllib.parse.rst:419 +#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:314 +#: ../../library/urllib.parse.rst:427 msgid "1" msgstr "1" -#: ../../library/urllib.parse.rst:117 ../../library/urllib.parse.rst:306 +#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:314 msgid "Network location part" msgstr "" -#: ../../library/urllib.parse.rst:117 ../../library/urllib.parse.rst:119 -#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:124 -#: ../../library/urllib.parse.rst:126 ../../library/urllib.parse.rst:306 -#: ../../library/urllib.parse.rst:308 ../../library/urllib.parse.rst:310 -#: ../../library/urllib.parse.rst:312 ../../library/urllib.parse.rst:417 -#: ../../library/urllib.parse.rst:419 +#: ../../library/urllib.parse.rst:125 ../../library/urllib.parse.rst:127 +#: ../../library/urllib.parse.rst:129 ../../library/urllib.parse.rst:132 +#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:314 +#: ../../library/urllib.parse.rst:316 ../../library/urllib.parse.rst:318 +#: ../../library/urllib.parse.rst:320 ../../library/urllib.parse.rst:425 +#: ../../library/urllib.parse.rst:427 msgid "empty string" msgstr "" -#: ../../library/urllib.parse.rst:119 ../../library/urllib.parse.rst:308 +#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:316 msgid ":attr:`path`" msgstr ":attr:`path`" -#: ../../library/urllib.parse.rst:119 ../../library/urllib.parse.rst:308 +#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:316 msgid "2" msgstr "2" -#: ../../library/urllib.parse.rst:119 ../../library/urllib.parse.rst:308 +#: ../../library/urllib.parse.rst:127 ../../library/urllib.parse.rst:316 msgid "Hierarchical path" msgstr "" -#: ../../library/urllib.parse.rst:121 +#: ../../library/urllib.parse.rst:129 msgid ":attr:`params`" msgstr ":attr:`params`" -#: ../../library/urllib.parse.rst:121 ../../library/urllib.parse.rst:310 +#: ../../library/urllib.parse.rst:129 ../../library/urllib.parse.rst:318 msgid "3" msgstr "3" -#: ../../library/urllib.parse.rst:121 +#: ../../library/urllib.parse.rst:129 msgid "Parameters for last path element" msgstr "" -#: ../../library/urllib.parse.rst:124 ../../library/urllib.parse.rst:310 +#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:318 msgid ":attr:`query`" msgstr ":attr:`query`" -#: ../../library/urllib.parse.rst:124 ../../library/urllib.parse.rst:312 +#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:320 msgid "4" msgstr "4" -#: ../../library/urllib.parse.rst:124 ../../library/urllib.parse.rst:310 +#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:318 msgid "Query component" msgstr "" -#: ../../library/urllib.parse.rst:126 ../../library/urllib.parse.rst:312 -#: ../../library/urllib.parse.rst:419 +#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:320 +#: ../../library/urllib.parse.rst:427 msgid ":attr:`fragment`" msgstr ":attr:`fragment`" -#: ../../library/urllib.parse.rst:126 +#: ../../library/urllib.parse.rst:134 msgid "5" msgstr "5" -#: ../../library/urllib.parse.rst:126 ../../library/urllib.parse.rst:312 -#: ../../library/urllib.parse.rst:419 +#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:320 +#: ../../library/urllib.parse.rst:427 msgid "Fragment identifier" msgstr "" -#: ../../library/urllib.parse.rst:128 ../../library/urllib.parse.rst:314 +#: ../../library/urllib.parse.rst:136 ../../library/urllib.parse.rst:322 msgid ":attr:`username`" msgstr ":attr:`username`" -#: ../../library/urllib.parse.rst:128 ../../library/urllib.parse.rst:314 +#: ../../library/urllib.parse.rst:136 ../../library/urllib.parse.rst:322 msgid "User name" msgstr "" -#: ../../library/urllib.parse.rst:128 ../../library/urllib.parse.rst:130 -#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:134 -#: ../../library/urllib.parse.rst:314 ../../library/urllib.parse.rst:316 -#: ../../library/urllib.parse.rst:318 ../../library/urllib.parse.rst:320 +#: ../../library/urllib.parse.rst:136 ../../library/urllib.parse.rst:138 +#: ../../library/urllib.parse.rst:140 ../../library/urllib.parse.rst:142 +#: ../../library/urllib.parse.rst:322 ../../library/urllib.parse.rst:324 +#: ../../library/urllib.parse.rst:326 ../../library/urllib.parse.rst:328 msgid ":const:`None`" msgstr ":const:`None`" -#: ../../library/urllib.parse.rst:130 ../../library/urllib.parse.rst:316 +#: ../../library/urllib.parse.rst:138 ../../library/urllib.parse.rst:324 msgid ":attr:`password`" msgstr ":attr:`password`" -#: ../../library/urllib.parse.rst:130 ../../library/urllib.parse.rst:316 +#: ../../library/urllib.parse.rst:138 ../../library/urllib.parse.rst:324 msgid "Password" msgstr "" -#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:318 +#: ../../library/urllib.parse.rst:140 ../../library/urllib.parse.rst:326 msgid ":attr:`hostname`" msgstr ":attr:`hostname`" -#: ../../library/urllib.parse.rst:132 ../../library/urllib.parse.rst:318 +#: ../../library/urllib.parse.rst:140 ../../library/urllib.parse.rst:326 msgid "Host name (lower case)" msgstr "" -#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:320 +#: ../../library/urllib.parse.rst:142 ../../library/urllib.parse.rst:328 msgid ":attr:`port`" msgstr ":attr:`port`" -#: ../../library/urllib.parse.rst:134 ../../library/urllib.parse.rst:320 +#: ../../library/urllib.parse.rst:142 ../../library/urllib.parse.rst:328 msgid "Port number as integer, if present" msgstr "" -#: ../../library/urllib.parse.rst:138 ../../library/urllib.parse.rst:324 +#: ../../library/urllib.parse.rst:146 ../../library/urllib.parse.rst:332 msgid "" "Reading the :attr:`port` attribute will raise a :exc:`ValueError` if an " "invalid port is specified in the URL. See section :ref:`urlparse-result-" "object` for more information on the result object." msgstr "" -#: ../../library/urllib.parse.rst:142 ../../library/urllib.parse.rst:328 +#: ../../library/urllib.parse.rst:150 ../../library/urllib.parse.rst:336 msgid "" "Unmatched square brackets in the :attr:`netloc` attribute will raise a :exc:" "`ValueError`." msgstr "" -#: ../../library/urllib.parse.rst:145 ../../library/urllib.parse.rst:331 +#: ../../library/urllib.parse.rst:153 ../../library/urllib.parse.rst:339 msgid "" "Characters in the :attr:`netloc` attribute that decompose under NFKC " "normalization (as used by the IDNA encoding) into any of ``/``, ``?``, " @@ -349,7 +358,7 @@ msgid "" "decomposed before parsing, no error will be raised." msgstr "" -#: ../../library/urllib.parse.rst:150 +#: ../../library/urllib.parse.rst:158 msgid "" "As is the case with all named tuples, the subclass has a few additional " "methods and attributes that are particularly useful. One such method is :" @@ -357,7 +366,7 @@ msgid "" "object replacing specified fields with new values." msgstr "" -#: ../../library/urllib.parse.rst:155 +#: ../../library/urllib.parse.rst:163 msgid "" ">>> from urllib.parse import urlparse\n" ">>> u = urlparse('//www.cwi.nl:80/%7Eguido/Python.html')\n" @@ -381,36 +390,36 @@ msgstr "" "html',\n" " params='', query='', fragment='')" -#: ../../library/urllib.parse.rst:169 +#: ../../library/urllib.parse.rst:177 msgid "" ":func:`urlparse` does not perform validation. See :ref:`URL parsing " "security ` for details." msgstr "" -#: ../../library/urllib.parse.rst:172 +#: ../../library/urllib.parse.rst:180 msgid "Added IPv6 URL parsing capabilities." msgstr "新增剖析 IPv6 URL 的能力。" -#: ../../library/urllib.parse.rst:175 +#: ../../library/urllib.parse.rst:183 msgid "" "The fragment is now parsed for all URL schemes (unless *allow_fragments* is " "false), in accordance with :rfc:`3986`. Previously, an allowlist of schemes " "that support fragments existed." msgstr "" -#: ../../library/urllib.parse.rst:180 ../../library/urllib.parse.rst:345 +#: ../../library/urllib.parse.rst:188 ../../library/urllib.parse.rst:353 msgid "" "Out-of-range port numbers now raise :exc:`ValueError`, instead of returning :" "const:`None`." msgstr "" -#: ../../library/urllib.parse.rst:184 ../../library/urllib.parse.rst:349 +#: ../../library/urllib.parse.rst:192 ../../library/urllib.parse.rst:357 msgid "" "Characters that affect netloc parsing under NFKC normalization will now " "raise :exc:`ValueError`." msgstr "" -#: ../../library/urllib.parse.rst:191 +#: ../../library/urllib.parse.rst:199 msgid "" "Parse a query string given as a string argument (data of type :mimetype:" "`application/x-www-form-urlencoded`). Data are returned as a dictionary. " @@ -418,7 +427,7 @@ msgid "" "lists of values for each name." msgstr "" -#: ../../library/urllib.parse.rst:196 ../../library/urllib.parse.rst:241 +#: ../../library/urllib.parse.rst:204 ../../library/urllib.parse.rst:249 msgid "" "The optional argument *keep_blank_values* is a flag indicating whether blank " "values in percent-encoded queries should be treated as blank strings. A true " @@ -427,48 +436,48 @@ msgid "" "treated as if they were not included." msgstr "" -#: ../../library/urllib.parse.rst:202 ../../library/urllib.parse.rst:247 +#: ../../library/urllib.parse.rst:210 ../../library/urllib.parse.rst:255 msgid "" "The optional argument *strict_parsing* is a flag indicating what to do with " "parsing errors. If false (the default), errors are silently ignored. If " "true, errors raise a :exc:`ValueError` exception." msgstr "" -#: ../../library/urllib.parse.rst:206 ../../library/urllib.parse.rst:251 +#: ../../library/urllib.parse.rst:214 ../../library/urllib.parse.rst:259 msgid "" "The optional *encoding* and *errors* parameters specify how to decode " "percent-encoded sequences into Unicode characters, as accepted by the :meth:" "`bytes.decode` method." msgstr "" -#: ../../library/urllib.parse.rst:210 ../../library/urllib.parse.rst:255 +#: ../../library/urllib.parse.rst:218 ../../library/urllib.parse.rst:263 msgid "" "The optional argument *max_num_fields* is the maximum number of fields to " "read. If set, then throws a :exc:`ValueError` if there are more than " "*max_num_fields* fields read." msgstr "" -#: ../../library/urllib.parse.rst:214 ../../library/urllib.parse.rst:259 +#: ../../library/urllib.parse.rst:222 ../../library/urllib.parse.rst:267 msgid "" "The optional argument *separator* is the symbol to use for separating the " "query arguments. It defaults to ``&``." msgstr "" -#: ../../library/urllib.parse.rst:217 +#: ../../library/urllib.parse.rst:225 msgid "" "Use the :func:`urllib.parse.urlencode` function (with the ``doseq`` " "parameter set to ``True``) to convert such dictionaries into query strings." msgstr "" -#: ../../library/urllib.parse.rst:222 ../../library/urllib.parse.rst:265 +#: ../../library/urllib.parse.rst:230 ../../library/urllib.parse.rst:273 msgid "Add *encoding* and *errors* parameters." msgstr "" -#: ../../library/urllib.parse.rst:225 ../../library/urllib.parse.rst:268 +#: ../../library/urllib.parse.rst:233 ../../library/urllib.parse.rst:276 msgid "Added *max_num_fields* parameter." msgstr "新增 *max_num_fields* 參數。" -#: ../../library/urllib.parse.rst:228 ../../library/urllib.parse.rst:271 +#: ../../library/urllib.parse.rst:236 ../../library/urllib.parse.rst:279 msgid "" "Added *separator* parameter with the default value of ``&``. Python versions " "earlier than Python 3.10 allowed using both ``;`` and ``&`` as query " @@ -476,20 +485,20 @@ msgid "" "key, with ``&`` as the default separator." msgstr "" -#: ../../library/urllib.parse.rst:237 +#: ../../library/urllib.parse.rst:245 msgid "" "Parse a query string given as a string argument (data of type :mimetype:" "`application/x-www-form-urlencoded`). Data are returned as a list of name, " "value pairs." msgstr "" -#: ../../library/urllib.parse.rst:262 +#: ../../library/urllib.parse.rst:270 msgid "" "Use the :func:`urllib.parse.urlencode` function to convert such lists of " "pairs into query strings." msgstr "" -#: ../../library/urllib.parse.rst:280 +#: ../../library/urllib.parse.rst:288 msgid "" "Construct a URL from a tuple as returned by ``urlparse()``. The *parts* " "argument can be any six-item iterable. This may result in a slightly " @@ -498,7 +507,7 @@ msgid "" "states that these are equivalent)." msgstr "" -#: ../../library/urllib.parse.rst:289 +#: ../../library/urllib.parse.rst:297 msgid "" "This is similar to :func:`urlparse`, but does not split the params from the " "URL. This should generally be used instead of :func:`urlparse` if the more " @@ -508,41 +517,41 @@ msgid "" "returns a 5-item :term:`named tuple`::" msgstr "" -#: ../../library/urllib.parse.rst:296 +#: ../../library/urllib.parse.rst:304 msgid "" "(addressing scheme, network location, path, query, fragment identifier)." msgstr "" "(addressing scheme, network location, path, query, fragment identifier)." -#: ../../library/urllib.parse.rst:298 ../../library/urllib.parse.rst:411 +#: ../../library/urllib.parse.rst:306 ../../library/urllib.parse.rst:419 msgid "" "The return value is a :term:`named tuple`, its items can be accessed by " "index or as named attributes:" msgstr "" -#: ../../library/urllib.parse.rst:336 +#: ../../library/urllib.parse.rst:344 msgid "" "Following some of the `WHATWG spec`_ that updates RFC 3986, leading C0 " "control and space characters are stripped from the URL. ``\\n``, ``\\r`` and " "tab ``\\t`` characters are removed from the URL at any position." msgstr "" -#: ../../library/urllib.parse.rst:342 +#: ../../library/urllib.parse.rst:350 msgid "" ":func:`urlsplit` does not perform validation. See :ref:`URL parsing " "security ` for details." msgstr "" -#: ../../library/urllib.parse.rst:353 +#: ../../library/urllib.parse.rst:361 msgid "ASCII newline and tab characters are stripped from the URL." msgstr "" -#: ../../library/urllib.parse.rst:356 +#: ../../library/urllib.parse.rst:364 msgid "" "Leading WHATWG C0 control and space characters are stripped from the URL." msgstr "" -#: ../../library/urllib.parse.rst:363 +#: ../../library/urllib.parse.rst:371 msgid "" "Combine the elements of a tuple as returned by :func:`urlsplit` into a " "complete URL as a string. The *parts* argument can be any five-item " @@ -551,7 +560,7 @@ msgid "" "a ? with an empty query; the RFC states that these are equivalent)." msgstr "" -#: ../../library/urllib.parse.rst:372 +#: ../../library/urllib.parse.rst:380 msgid "" "Construct a full (\"absolute\") URL by combining a \"base URL\" (*base*) " "with another URL (*url*). Informally, this uses components of the base URL, " @@ -559,20 +568,20 @@ msgid "" "path, to provide missing components in the relative URL. For example:" msgstr "" -#: ../../library/urllib.parse.rst:381 +#: ../../library/urllib.parse.rst:389 msgid "" "The *allow_fragments* argument has the same meaning and default as for :func:" "`urlparse`." msgstr "" -#: ../../library/urllib.parse.rst:386 +#: ../../library/urllib.parse.rst:394 msgid "" "If *url* is an absolute URL (that is, it starts with ``//`` or ``scheme://" "``), the *url*'s hostname and/or scheme will be present in the result. For " "example:" msgstr "" -#: ../../library/urllib.parse.rst:389 +#: ../../library/urllib.parse.rst:397 msgid "" ">>> urljoin('http://www.cwi.nl/%7Eguido/Python.html',\n" "... '//www.python.org/%7Eguido')\n" @@ -582,17 +591,17 @@ msgstr "" "... '//www.python.org/%7Eguido')\n" "'http://www.python.org/%7Eguido'" -#: ../../library/urllib.parse.rst:395 +#: ../../library/urllib.parse.rst:403 msgid "" "If you do not want that behavior, preprocess the *url* with :func:`urlsplit` " "and :func:`urlunsplit`, removing possible *scheme* and *netloc* parts." msgstr "" -#: ../../library/urllib.parse.rst:401 +#: ../../library/urllib.parse.rst:409 msgid "Behavior updated to match the semantics defined in :rfc:`3986`." msgstr "" -#: ../../library/urllib.parse.rst:406 +#: ../../library/urllib.parse.rst:414 msgid "" "If *url* contains a fragment identifier, return a modified version of *url* " "with no fragment identifier, and the fragment identifier as a separate " @@ -600,25 +609,25 @@ msgid "" "unmodified and an empty string." msgstr "" -#: ../../library/urllib.parse.rst:417 +#: ../../library/urllib.parse.rst:425 msgid ":attr:`url`" msgstr ":attr:`url`" -#: ../../library/urllib.parse.rst:417 +#: ../../library/urllib.parse.rst:425 msgid "URL with no fragment" msgstr "" -#: ../../library/urllib.parse.rst:422 +#: ../../library/urllib.parse.rst:430 msgid "" "See section :ref:`urlparse-result-object` for more information on the result " "object." msgstr "" -#: ../../library/urllib.parse.rst:425 +#: ../../library/urllib.parse.rst:433 msgid "Result is a structured object rather than a simple 2-tuple." msgstr "" -#: ../../library/urllib.parse.rst:430 +#: ../../library/urllib.parse.rst:438 msgid "" "Extract the url from a wrapped URL (that is, a string formatted as ````, ````, ``URL:scheme://host/path`` " @@ -626,11 +635,11 @@ msgid "" "without changes." msgstr "" -#: ../../library/urllib.parse.rst:438 +#: ../../library/urllib.parse.rst:446 msgid "URL parsing security" msgstr "" -#: ../../library/urllib.parse.rst:440 +#: ../../library/urllib.parse.rst:448 msgid "" "The :func:`urlsplit` and :func:`urlparse` APIs do not perform **validation** " "of inputs. They may not raise errors on inputs that other applications " @@ -639,14 +648,14 @@ msgid "" "rather than purity." msgstr "" -#: ../../library/urllib.parse.rst:446 +#: ../../library/urllib.parse.rst:454 msgid "" "Instead of raising an exception on unusual input, they may instead return " "some component parts as empty strings. Or components may contain more than " "perhaps they should." msgstr "" -#: ../../library/urllib.parse.rst:450 +#: ../../library/urllib.parse.rst:458 msgid "" "We recommend that users of these APIs where the values may be used anywhere " "with security implications code defensively. Do some verification within " @@ -655,7 +664,7 @@ msgid "" "that ``hostname``? etc." msgstr "" -#: ../../library/urllib.parse.rst:456 +#: ../../library/urllib.parse.rst:464 msgid "" "What constitutes a URL is not universally well defined. Different " "applications have different needs and desired constraints. For instance the " @@ -667,11 +676,11 @@ msgid "" "API behavior changes." msgstr "" -#: ../../library/urllib.parse.rst:467 +#: ../../library/urllib.parse.rst:475 msgid "Parsing ASCII Encoded Bytes" msgstr "" -#: ../../library/urllib.parse.rst:469 +#: ../../library/urllib.parse.rst:477 msgid "" "The URL parsing functions were originally designed to operate on character " "strings only. In practice, it is useful to be able to manipulate properly " @@ -680,14 +689,14 @@ msgid "" "`bytearray` objects in addition to :class:`str` objects." msgstr "" -#: ../../library/urllib.parse.rst:475 +#: ../../library/urllib.parse.rst:483 msgid "" "If :class:`str` data is passed in, the result will also contain only :class:" "`str` data. If :class:`bytes` or :class:`bytearray` data is passed in, the " "result will contain only :class:`bytes` data." msgstr "" -#: ../../library/urllib.parse.rst:479 +#: ../../library/urllib.parse.rst:487 msgid "" "Attempting to mix :class:`str` data with :class:`bytes` or :class:" "`bytearray` in a single function call will result in a :exc:`TypeError` " @@ -695,7 +704,7 @@ msgid "" "trigger :exc:`UnicodeDecodeError`." msgstr "" -#: ../../library/urllib.parse.rst:484 +#: ../../library/urllib.parse.rst:492 msgid "" "To support easier conversion of result objects between :class:`str` and :" "class:`bytes`, all return values from URL parsing functions provide either " @@ -708,14 +717,14 @@ msgid "" "`str` data (for :meth:`decode` methods)." msgstr "" -#: ../../library/urllib.parse.rst:495 +#: ../../library/urllib.parse.rst:503 msgid "" "Applications that need to operate on potentially improperly quoted URLs that " "may contain non-ASCII data will need to do their own decoding from bytes to " "characters before invoking the URL parsing methods." msgstr "" -#: ../../library/urllib.parse.rst:499 +#: ../../library/urllib.parse.rst:507 msgid "" "The behaviour described in this section applies only to the URL parsing " "functions. The URL quoting functions use their own rules when producing or " @@ -723,15 +732,15 @@ msgid "" "URL quoting functions." msgstr "" -#: ../../library/urllib.parse.rst:504 +#: ../../library/urllib.parse.rst:512 msgid "URL parsing functions now accept ASCII encoded byte sequences" msgstr "" -#: ../../library/urllib.parse.rst:511 +#: ../../library/urllib.parse.rst:519 msgid "Structured Parse Results" msgstr "" -#: ../../library/urllib.parse.rst:513 +#: ../../library/urllib.parse.rst:521 msgid "" "The result objects from the :func:`urlparse`, :func:`urlsplit` and :func:" "`urldefrag` functions are subclasses of the :class:`tuple` type. These " @@ -740,7 +749,7 @@ msgid "" "section, as well as an additional method:" msgstr "" -#: ../../library/urllib.parse.rst:521 +#: ../../library/urllib.parse.rst:529 msgid "" "Return the re-combined version of the original URL as a string. This may " "differ from the original URL in that the scheme may be normalized to lower " @@ -748,72 +757,72 @@ msgid "" "queries, and fragment identifiers will be removed." msgstr "" -#: ../../library/urllib.parse.rst:526 +#: ../../library/urllib.parse.rst:534 msgid "" "For :func:`urldefrag` results, only empty fragment identifiers will be " "removed. For :func:`urlsplit` and :func:`urlparse` results, all noted " "changes will be made to the URL returned by this method." msgstr "" -#: ../../library/urllib.parse.rst:530 +#: ../../library/urllib.parse.rst:538 msgid "" "The result of this method remains unchanged if passed back through the " "original parsing function:" msgstr "" -#: ../../library/urllib.parse.rst:543 +#: ../../library/urllib.parse.rst:551 msgid "" "The following classes provide the implementations of the structured parse " "results when operating on :class:`str` objects:" msgstr "" -#: ../../library/urllib.parse.rst:548 +#: ../../library/urllib.parse.rst:556 msgid "" "Concrete class for :func:`urldefrag` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`DefragResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:556 +#: ../../library/urllib.parse.rst:564 msgid "" "Concrete class for :func:`urlparse` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`ParseResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:562 +#: ../../library/urllib.parse.rst:570 msgid "" "Concrete class for :func:`urlsplit` results containing :class:`str` data. " "The :meth:`encode` method returns a :class:`SplitResultBytes` instance." msgstr "" -#: ../../library/urllib.parse.rst:567 +#: ../../library/urllib.parse.rst:575 msgid "" "The following classes provide the implementations of the parse results when " "operating on :class:`bytes` or :class:`bytearray` objects:" msgstr "" -#: ../../library/urllib.parse.rst:572 +#: ../../library/urllib.parse.rst:580 msgid "" "Concrete class for :func:`urldefrag` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`DefragResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:580 +#: ../../library/urllib.parse.rst:588 msgid "" "Concrete class for :func:`urlparse` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`ParseResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:588 +#: ../../library/urllib.parse.rst:596 msgid "" "Concrete class for :func:`urlsplit` results containing :class:`bytes` data. " "The :meth:`decode` method returns a :class:`SplitResult` instance." msgstr "" -#: ../../library/urllib.parse.rst:596 +#: ../../library/urllib.parse.rst:604 msgid "URL Quoting" msgstr "" -#: ../../library/urllib.parse.rst:598 +#: ../../library/urllib.parse.rst:606 msgid "" "The URL quoting functions focus on taking program data and making it safe " "for use as URL components by quoting special characters and appropriately " @@ -822,7 +831,7 @@ msgid "" "isn't already covered by the URL parsing functions above." msgstr "" -#: ../../library/urllib.parse.rst:606 +#: ../../library/urllib.parse.rst:614 msgid "" "Replace special characters in *string* using the :samp:`%{xx}` escape. " "Letters, digits, and the characters ``'_.-~'`` are never quoted. By default, " @@ -831,18 +840,18 @@ msgid "" "not be quoted --- its default value is ``'/'``." msgstr "" -#: ../../library/urllib.parse.rst:612 ../../library/urllib.parse.rst:658 -#: ../../library/urllib.parse.rst:687 +#: ../../library/urllib.parse.rst:620 ../../library/urllib.parse.rst:666 +#: ../../library/urllib.parse.rst:695 msgid "*string* may be either a :class:`str` or a :class:`bytes` object." msgstr "" -#: ../../library/urllib.parse.rst:614 +#: ../../library/urllib.parse.rst:622 msgid "" "Moved from :rfc:`2396` to :rfc:`3986` for quoting URL strings. \"~\" is now " "included in the set of unreserved characters." msgstr "" -#: ../../library/urllib.parse.rst:618 +#: ../../library/urllib.parse.rst:626 msgid "" "The optional *encoding* and *errors* parameters specify how to deal with non-" "ASCII characters, as accepted by the :meth:`str.encode` method. *encoding* " @@ -852,17 +861,17 @@ msgid "" "`TypeError` is raised." msgstr "" -#: ../../library/urllib.parse.rst:626 +#: ../../library/urllib.parse.rst:634 msgid "" "Note that ``quote(string, safe, encoding, errors)`` is equivalent to " "``quote_from_bytes(string.encode(encoding, errors), safe)``." msgstr "" -#: ../../library/urllib.parse.rst:629 +#: ../../library/urllib.parse.rst:637 msgid "Example: ``quote('/El Niño/')`` yields ``'/El%20Ni%C3%B1o/'``." msgstr "" -#: ../../library/urllib.parse.rst:634 +#: ../../library/urllib.parse.rst:642 msgid "" "Like :func:`quote`, but also replace spaces with plus signs, as required for " "quoting HTML form values when building up a query string to go into a URL. " @@ -870,21 +879,21 @@ msgid "" "*safe*. It also does not have *safe* default to ``'/'``." msgstr "" -#: ../../library/urllib.parse.rst:639 +#: ../../library/urllib.parse.rst:647 msgid "Example: ``quote_plus('/El Niño/')`` yields ``'%2FEl+Ni%C3%B1o%2F'``." msgstr "" -#: ../../library/urllib.parse.rst:644 +#: ../../library/urllib.parse.rst:652 msgid "" "Like :func:`quote`, but accepts a :class:`bytes` object rather than a :class:" "`str`, and does not perform string-to-bytes encoding." msgstr "" -#: ../../library/urllib.parse.rst:647 +#: ../../library/urllib.parse.rst:655 msgid "Example: ``quote_from_bytes(b'a&\\xef')`` yields ``'a%26%EF'``." msgstr "" -#: ../../library/urllib.parse.rst:653 +#: ../../library/urllib.parse.rst:661 msgid "" "Replace :samp:`%{xx}` escapes with their single-character equivalent. The " "optional *encoding* and *errors* parameters specify how to decode percent-" @@ -892,52 +901,52 @@ msgid "" "decode` method." msgstr "" -#: ../../library/urllib.parse.rst:660 +#: ../../library/urllib.parse.rst:668 msgid "" "*encoding* defaults to ``'utf-8'``. *errors* defaults to ``'replace'``, " "meaning invalid sequences are replaced by a placeholder character." msgstr "" -#: ../../library/urllib.parse.rst:664 +#: ../../library/urllib.parse.rst:672 msgid "Example: ``unquote('/El%20Ni%C3%B1o/')`` yields ``'/El Niño/'``." msgstr "" -#: ../../library/urllib.parse.rst:666 +#: ../../library/urllib.parse.rst:674 msgid "" "*string* parameter supports bytes and str objects (previously only str)." msgstr "" -#: ../../library/urllib.parse.rst:674 +#: ../../library/urllib.parse.rst:682 msgid "" "Like :func:`unquote`, but also replace plus signs with spaces, as required " "for unquoting HTML form values." msgstr "" -#: ../../library/urllib.parse.rst:677 +#: ../../library/urllib.parse.rst:685 msgid "*string* must be a :class:`str`." msgstr "" -#: ../../library/urllib.parse.rst:679 +#: ../../library/urllib.parse.rst:687 msgid "Example: ``unquote_plus('/El+Ni%C3%B1o/')`` yields ``'/El Niño/'``." msgstr "" -#: ../../library/urllib.parse.rst:684 +#: ../../library/urllib.parse.rst:692 msgid "" "Replace :samp:`%{xx}` escapes with their single-octet equivalent, and return " "a :class:`bytes` object." msgstr "" -#: ../../library/urllib.parse.rst:689 +#: ../../library/urllib.parse.rst:697 msgid "" "If it is a :class:`str`, unescaped non-ASCII characters in *string* are " "encoded into UTF-8 bytes." msgstr "" -#: ../../library/urllib.parse.rst:692 +#: ../../library/urllib.parse.rst:700 msgid "Example: ``unquote_to_bytes('a%26%EF')`` yields ``b'a&\\xef'``." msgstr "" -#: ../../library/urllib.parse.rst:698 +#: ../../library/urllib.parse.rst:706 msgid "" "Convert a mapping object or a sequence of two-element tuples, which may " "contain :class:`str` or :class:`bytes` objects, to a percent-encoded ASCII " @@ -946,7 +955,7 @@ msgid "" "be encoded to bytes, otherwise it would result in a :exc:`TypeError`." msgstr "" -#: ../../library/urllib.parse.rst:705 +#: ../../library/urllib.parse.rst:713 msgid "" "The resulting string is a series of ``key=value`` pairs separated by ``'&'`` " "characters, where both *key* and *value* are quoted using the *quote_via* " @@ -959,7 +968,7 @@ msgid "" "``quote`` and specify a value for *safe*." msgstr "" -#: ../../library/urllib.parse.rst:715 +#: ../../library/urllib.parse.rst:723 msgid "" "When a sequence of two-element tuples is used as the *query* argument, the " "first element of each tuple is a key and the second is a value. The value " @@ -970,49 +979,49 @@ msgid "" "order of parameter tuples in the sequence." msgstr "" -#: ../../library/urllib.parse.rst:723 +#: ../../library/urllib.parse.rst:731 msgid "" "The *safe*, *encoding*, and *errors* parameters are passed down to " "*quote_via* (the *encoding* and *errors* parameters are only passed when a " "query element is a :class:`str`)." msgstr "" -#: ../../library/urllib.parse.rst:727 +#: ../../library/urllib.parse.rst:735 msgid "" "To reverse this encoding process, :func:`parse_qs` and :func:`parse_qsl` are " "provided in this module to parse query strings into Python data structures." msgstr "" -#: ../../library/urllib.parse.rst:730 +#: ../../library/urllib.parse.rst:738 msgid "" "Refer to :ref:`urllib examples ` to find out how the :func:" "`urllib.parse.urlencode` method can be used for generating the query string " "of a URL or data for a POST request." msgstr "" -#: ../../library/urllib.parse.rst:734 +#: ../../library/urllib.parse.rst:742 msgid "*query* supports bytes and string objects." msgstr "" -#: ../../library/urllib.parse.rst:737 +#: ../../library/urllib.parse.rst:745 msgid "Added the *quote_via* parameter." msgstr "新增 *quote_via* 參數。" -#: ../../library/urllib.parse.rst:743 +#: ../../library/urllib.parse.rst:751 msgid "`WHATWG`_ - URL Living standard" msgstr "" -#: ../../library/urllib.parse.rst:744 +#: ../../library/urllib.parse.rst:752 msgid "" "Working Group for the URL Standard that defines URLs, domains, IP addresses, " "the application/x-www-form-urlencoded format, and their API." msgstr "" -#: ../../library/urllib.parse.rst:747 +#: ../../library/urllib.parse.rst:755 msgid ":rfc:`3986` - Uniform Resource Identifiers" msgstr "" -#: ../../library/urllib.parse.rst:748 +#: ../../library/urllib.parse.rst:756 msgid "" "This is the current standard (STD66). Any changes to urllib.parse module " "should conform to this. Certain deviations could be observed, which are " @@ -1020,49 +1029,49 @@ msgid "" "requirements as commonly observed in major browsers." msgstr "" -#: ../../library/urllib.parse.rst:753 +#: ../../library/urllib.parse.rst:761 msgid ":rfc:`2732` - Format for Literal IPv6 Addresses in URL's." msgstr "" -#: ../../library/urllib.parse.rst:754 +#: ../../library/urllib.parse.rst:762 msgid "This specifies the parsing requirements of IPv6 URLs." msgstr "" -#: ../../library/urllib.parse.rst:756 +#: ../../library/urllib.parse.rst:764 msgid ":rfc:`2396` - Uniform Resource Identifiers (URI): Generic Syntax" msgstr "" -#: ../../library/urllib.parse.rst:757 +#: ../../library/urllib.parse.rst:765 msgid "" "Document describing the generic syntactic requirements for both Uniform " "Resource Names (URNs) and Uniform Resource Locators (URLs)." msgstr "" -#: ../../library/urllib.parse.rst:760 +#: ../../library/urllib.parse.rst:768 msgid ":rfc:`2368` - The mailto URL scheme." msgstr "" -#: ../../library/urllib.parse.rst:761 +#: ../../library/urllib.parse.rst:769 msgid "Parsing requirements for mailto URL schemes." msgstr "" -#: ../../library/urllib.parse.rst:763 +#: ../../library/urllib.parse.rst:771 msgid ":rfc:`1808` - Relative Uniform Resource Locators" msgstr "" ":rfc:`1808` - 相對的統一資源定位器 (Relative Uniform Resource Locators)" -#: ../../library/urllib.parse.rst:764 +#: ../../library/urllib.parse.rst:772 msgid "" "This Request For Comments includes the rules for joining an absolute and a " "relative URL, including a fair number of \"Abnormal Examples\" which govern " "the treatment of border cases." msgstr "" -#: ../../library/urllib.parse.rst:768 +#: ../../library/urllib.parse.rst:776 msgid ":rfc:`1738` - Uniform Resource Locators (URL)" msgstr ":rfc:`1738` - 統一資源定位器 (URL, Uniform Resource Locators)" -#: ../../library/urllib.parse.rst:769 +#: ../../library/urllib.parse.rst:777 msgid "This specifies the formal syntax and semantics of absolute URLs." msgstr "" diff --git a/library/urllib.po b/library/urllib.po index 13e4e2714d..858dce4dac 100644 --- a/library/urllib.po +++ b/library/urllib.po @@ -8,7 +8,7 @@ # Phil Lin , 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-01-31 18:04+0800\n" diff --git a/library/urllib.request.po b/library/urllib.request.po index 2b623d0a97..5720f797b8 100644 --- a/library/urllib.request.po +++ b/library/urllib.request.po @@ -5,9 +5,9 @@ # Adrian Liaw , 2018 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-04-21 17:59+0800\n" "Last-Translator: Jordan Su \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -54,17 +54,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability `: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability `: not WASI." +msgstr ":ref:`適用 `:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/urllib.request.rst:34 msgid "The :mod:`urllib.request` module defines the following functions:" @@ -117,23 +116,6 @@ msgstr "" #: ../../library/urllib.request.rst:58 msgid "" -"The optional *cafile* and *capath* parameters specify a set of trusted CA " -"certificates for HTTPS requests. *cafile* should point to a single file " -"containing a bundle of CA certificates, whereas *capath* should point to a " -"directory of hashed certificate files. More information can be found in :" -"meth:`ssl.SSLContext.load_verify_locations`." -msgstr "" -"選擇性參數 *cafile* 與 *capath* 用來指定一組 HTTPS 請求中所需之受信任 CA 憑" -"證。*cafile* 的值應該指向內容包含一堆 CA 憑證的單一檔案,而 *capath* 則指向存" -"放一堆雜湊後的憑證檔案的目錄。欲瞭解更多的資訊請參見 :meth:`ssl.SSLContext." -"load_verify_locations`。" - -#: ../../library/urllib.request.rst:64 -msgid "The *cadefault* parameter is ignored." -msgstr "參數 *cadefault* 已被忽略。" - -#: ../../library/urllib.request.rst:66 -msgid "" "This function always returns an object which can work as a :term:`context " "manager` and has the properties *url*, *headers*, and *status*. See :class:" "`urllib.response.addinfourl` for more detail on these properties." @@ -142,7 +124,7 @@ msgstr "" "(property) *url*、*headers* 與 *status*。欲知更多這些特性細節請參見 :class:" "`urllib.response.addinfourl`。" -#: ../../library/urllib.request.rst:70 +#: ../../library/urllib.request.rst:62 msgid "" "For HTTP and HTTPS URLs, this function returns a :class:`http.client." "HTTPResponse` object slightly modified. In addition to the three new methods " @@ -157,7 +139,7 @@ msgstr "" "(reason phrase),而不是在 :class:`~http.client.HTTPResponse` 文件中提到的回" "應 headers。" -#: ../../library/urllib.request.rst:78 +#: ../../library/urllib.request.rst:70 msgid "" "For FTP, file, and data URLs and requests explicitly handled by legacy :" "class:`URLopener` and :class:`FancyURLopener` classes, this function returns " @@ -167,11 +149,11 @@ msgstr "" "class:`FancyURLopener` 所處理的請求,這個函式會回傳一個 :class:`urllib." "response.addinfourl` 物件。" -#: ../../library/urllib.request.rst:82 +#: ../../library/urllib.request.rst:74 msgid "Raises :exc:`~urllib.error.URLError` on protocol errors." msgstr "當遇到協定上的錯誤時會引發 :exc:`~urllib.error.URLError`。" -#: ../../library/urllib.request.rst:84 +#: ../../library/urllib.request.rst:76 msgid "" "Note that ``None`` may be returned if no handler handles the request (though " "the default installed global :class:`OpenerDirector` uses :class:" @@ -181,7 +163,7 @@ msgstr "" "別 :class:`OpenerDirector` 使用 :class:`UnknownHandler` 來確保這種情況不會發" "生)" -#: ../../library/urllib.request.rst:88 +#: ../../library/urllib.request.rst:80 msgid "" "In addition, if proxy settings are detected (for example, when a ``*_proxy`` " "environment variable like :envvar:`!http_proxy` is set), :class:" @@ -192,7 +174,7 @@ msgstr "" "http_proxy` 有被設置時),:class:`ProxyHandler` 會被預設使用以確保請求有透過" "代理服務來處理。" -#: ../../library/urllib.request.rst:93 +#: ../../library/urllib.request.rst:85 msgid "" "The legacy ``urllib.urlopen`` function from Python 2.6 and earlier has been " "discontinued; :func:`urllib.request.urlopen` corresponds to the old " @@ -205,7 +187,7 @@ msgstr "" "的處理,以往是透過傳遞 dictionary(字典)參數給 ``urllib.urlopen`` 來取得的," "現在則可以透過 :class:`ProxyHandler` 物件來取得。" -#: ../../library/urllib.request.rst:99 ../../library/urllib.request.rst:101 +#: ../../library/urllib.request.rst:91 ../../library/urllib.request.rst:93 msgid "" "The default opener raises an :ref:`auditing event ` ``urllib." "Request`` with arguments ``fullurl``, ``data``, ``headers``, ``method`` " @@ -214,11 +196,11 @@ msgstr "" "預設的 opener 會觸發一個 :ref:`auditing event ` ``urllib.Request`` " "與其從請求物件中所獲得的引數 ``fullurl``、``data``、``headers``、``method``。" -#: ../../library/urllib.request.rst:105 +#: ../../library/urllib.request.rst:97 msgid "*cafile* and *capath* were added." msgstr "新增 *cafile* 與 *capath*。" -#: ../../library/urllib.request.rst:108 +#: ../../library/urllib.request.rst:100 msgid "" "HTTPS virtual hosts are now supported if possible (that is, if :const:`ssl." "HAS_SNI` is true)." @@ -226,19 +208,19 @@ msgstr "" "HTTPS 虛擬主機 (virtual hosts) 現已支援,只要 :const:`ssl.HAS_SNI` 的值為 " "true。" -#: ../../library/urllib.request.rst:111 +#: ../../library/urllib.request.rst:103 msgid "*data* can be an iterable object." msgstr "*data* 可以是一個可疊代物件。" -#: ../../library/urllib.request.rst:113 +#: ../../library/urllib.request.rst:105 msgid "*cadefault* was added." msgstr "*cadefault* 被新增。" -#: ../../library/urllib.request.rst:116 +#: ../../library/urllib.request.rst:108 msgid "*context* was added." msgstr "*context* 被新增。" -#: ../../library/urllib.request.rst:119 +#: ../../library/urllib.request.rst:111 msgid "" "HTTPS connection now send an ALPN extension with protocol indicator " "``http/1.1`` when no *context* is given. Custom *context* should set ALPN " @@ -248,17 +230,13 @@ msgstr "" "``http/1.1`` 的 ALPN 擴充 (extension)。自訂的 *context* 應該利用 :meth:`~ssl." "SSLContext.set_alpn_protocols` 來自行設定 ALPN 協定。" -#: ../../library/urllib.request.rst:126 +#: ../../library/urllib.request.rst:116 msgid "" -"*cafile*, *capath* and *cadefault* are deprecated in favor of *context*. " -"Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let :func:`ssl." -"create_default_context` select the system's trusted CA certificates for you." +"Remove *cafile*, *capath* and *cadefault* parameters: use the *context* " +"parameter instead." msgstr "" -"*cafile*、*capath*、*cadefault* 已經被棄用並應改為使用 *context*。請改用 :" -"meth:`ssl.SSLContext.load_cert_chain`,或是讓 :func:`ssl." -"create_default_context` 選取系統中受信任的 CA 憑證。" -#: ../../library/urllib.request.rst:134 +#: ../../library/urllib.request.rst:123 msgid "" "Install an :class:`OpenerDirector` instance as the default global opener. " "Installing an opener is only necessary if you want urlopen to use that " @@ -272,7 +250,7 @@ msgstr "" "class 是否真的為 :class:`OpenerDirector`,而是任何具有正確介面的 class 都能適" "用。" -#: ../../library/urllib.request.rst:144 +#: ../../library/urllib.request.rst:133 msgid "" "Return an :class:`OpenerDirector` instance, which chains the handlers in the " "order given. *handler*\\s can be either instances of :class:`BaseHandler`, " @@ -294,7 +272,7 @@ msgstr "" "`HTTPDefaultErrorHandler`、:class:`HTTPRedirectHandler`、:class:" "`FTPHandler`、:class:`FileHandler`、:class:`HTTPErrorProcessor`。" -#: ../../library/urllib.request.rst:154 +#: ../../library/urllib.request.rst:143 msgid "" "If the Python installation has SSL support (i.e., if the :mod:`ssl` module " "can be imported), :class:`HTTPSHandler` will also be added." @@ -302,7 +280,7 @@ msgstr "" "如果 Python 安裝時已帶有 SSL 支援(如果 :mod:`ssl` module 能夠被 import)," "則 :class:`HTTPSHandler` 也在上述 class 之中。" -#: ../../library/urllib.request.rst:157 +#: ../../library/urllib.request.rst:146 msgid "" "A :class:`BaseHandler` subclass may also change its :attr:`handler_order` " "attribute to modify its position in the handlers list." @@ -310,7 +288,7 @@ msgstr "" "一個 :class:`BaseHandler` 的 subclass 可能透過改變其 :attr:`handler_order` 屬" "性來調整它在 handlers list 中的位置。" -#: ../../library/urllib.request.rst:163 +#: ../../library/urllib.request.rst:152 msgid "" "Convert the pathname *path* from the local syntax for a path to the form " "used in the path component of a URL. This does not produce a complete URL. " @@ -321,7 +299,7 @@ msgstr "" "component(路徑元件)格式。本函式並不會產生完整的 URL。回傳值將使用 :func:" "`~urllib.parse.quote` 函式先進行編碼過。" -#: ../../library/urllib.request.rst:170 +#: ../../library/urllib.request.rst:159 msgid "" "Convert the path component *path* from a percent-encoded URL to the local " "syntax for a path. This does not accept a complete URL. This function " @@ -331,7 +309,7 @@ msgstr "" "(local syntax)。本函式並不接受完整的 URL。本函式使用 :func:`~urllib.parse." "unquote` 來將 *path* 解碼。" -#: ../../library/urllib.request.rst:176 +#: ../../library/urllib.request.rst:165 msgid "" "This helper function returns a dictionary of scheme to proxy server URL " "mappings. It scans the environment for variables named ``_proxy``, " @@ -346,7 +324,7 @@ msgstr "" "Configuration) 或是 Windows 系統中的 Windows Systems Registry 尋找代理服務設" "定。如果大小寫的環境變數同時存在且值有不同,小寫的環境變數會被選用。" -#: ../../library/urllib.request.rst:186 +#: ../../library/urllib.request.rst:175 msgid "" "If the environment variable ``REQUEST_METHOD`` is set, which usually " "indicates your script is running in a CGI environment, the environment " @@ -363,19 +341,19 @@ msgstr "" "``ProxyHandler``,亦或是確認變數名稱是小寫的(或至少 ``_proxy`` 後綴是小寫" "的)。" -#: ../../library/urllib.request.rst:195 +#: ../../library/urllib.request.rst:184 msgid "The following classes are provided:" msgstr "提供了以下的 classes:" -#: ../../library/urllib.request.rst:199 +#: ../../library/urllib.request.rst:188 msgid "This class is an abstraction of a URL request." msgstr "這個 class 是一個 URL 請求的抽象 class。" -#: ../../library/urllib.request.rst:201 +#: ../../library/urllib.request.rst:190 msgid "*url* should be a string containing a valid, properly encoded URL." msgstr "*url* 是一個包含有效且適當編碼的 URL 字串。" -#: ../../library/urllib.request.rst:203 +#: ../../library/urllib.request.rst:192 msgid "" "*data* must be an object specifying additional data to send to the server, " "or ``None`` if no such data is needed. Currently HTTP requests are the only " @@ -396,7 +374,7 @@ msgstr "" "``Transfer-Encoding: chunked`` 則會被用來傳送檔案或是其它可疊代物件 " "(iterables)。" -#: ../../library/urllib.request.rst:213 +#: ../../library/urllib.request.rst:202 msgid "" "For an HTTP POST request method, *data* should be a buffer in the standard :" "mimetype:`application/x-www-form-urlencoded` format. The :func:`urllib." @@ -409,7 +387,7 @@ msgstr "" "個 mapping 或是 sequence(序列)的 2-tuples,並回傳一個對應格式的 ASCII 字" "串。在被作為 *data* 參數前它應該被編碼成位元組串。" -#: ../../library/urllib.request.rst:219 +#: ../../library/urllib.request.rst:208 msgid "" "*headers* should be a dictionary, and will be treated as if :meth:" "`add_header` was called with each key and value as arguments. This is often " @@ -430,7 +408,7 @@ msgstr "" "(在 Python 2.6 上)。所有 header 的鍵都會以 camel case(駝峰式大小寫)來傳" "送。" -#: ../../library/urllib.request.rst:230 +#: ../../library/urllib.request.rst:219 msgid "" "An appropriate ``Content-Type`` header should be included if the *data* " "argument is present. If this header has not been provided and *data* is not " @@ -441,14 +419,14 @@ msgstr "" "個 header 沒有被提供且 *data* 也不為 ``None`` 時,預設值 ``Content-Type: " "application/x-www-form-urlencoded`` 會被新增至請求中。" -#: ../../library/urllib.request.rst:235 +#: ../../library/urllib.request.rst:224 msgid "" "The next two arguments are only of interest for correct handling of third-" "party HTTP cookies:" msgstr "" "接下來的兩個引數的介紹提供給那些有興趣正確處理第三方 HTTP cookies 的使用者:" -#: ../../library/urllib.request.rst:238 +#: ../../library/urllib.request.rst:227 msgid "" "*origin_req_host* should be the request-host of the origin transaction, as " "defined by :rfc:`2965`. It defaults to ``http.cookiejar." @@ -462,7 +440,7 @@ msgstr "" "起的原始請求的主機名稱或是 IP 位址。例如當請求是要求一個 HTML 文件中的一個影" "像,則這個屬性應為請求包含影像頁面的請求主機。" -#: ../../library/urllib.request.rst:246 +#: ../../library/urllib.request.rst:235 msgid "" "*unverifiable* should indicate whether the request is unverifiable, as " "defined by :rfc:`2965`. It defaults to ``False``. An unverifiable request " @@ -475,7 +453,7 @@ msgstr "" "URL,例如一個對於 HTML 文件中的影像所做的請求,而使用者沒有機會去批准是否能自" "動擷取影像,則這個值應該為 true。" -#: ../../library/urllib.request.rst:253 +#: ../../library/urllib.request.rst:242 msgid "" "*method* should be a string that indicates the HTTP request method that will " "be used (e.g. ``'HEAD'``). If provided, its value is stored in the :attr:" @@ -490,7 +468,7 @@ msgstr "" "Subclasses 可以透過設置其 :attr:`~Request.method` 屬性來設定不一樣的預設請求" "方法。" -#: ../../library/urllib.request.rst:261 +#: ../../library/urllib.request.rst:250 msgid "" "The request will not work as expected if the data object is unable to " "deliver its content more than once (e.g. a file or an iterable that can " @@ -504,15 +482,15 @@ msgstr "" "新嘗試傳送,則該請求不會正常運作。*data* 會接在 headers 之後被送至 HTTP 伺服" "器。此函式庫沒有支援 100-continue expectation。" -#: ../../library/urllib.request.rst:268 +#: ../../library/urllib.request.rst:257 msgid ":attr:`Request.method` argument is added to the Request class." msgstr "新增 :attr:`Request.method` 引數到 Request class。" -#: ../../library/urllib.request.rst:271 +#: ../../library/urllib.request.rst:260 msgid "Default :attr:`Request.method` may be indicated at the class level." msgstr "能夠在 class 中設置預設的 :attr:`Request.method`。" -#: ../../library/urllib.request.rst:274 +#: ../../library/urllib.request.rst:263 msgid "" "Do not raise an error if the ``Content-Length`` has not been provided and " "*data* is neither ``None`` nor a bytes object. Fall back to use chunked " @@ -522,34 +500,34 @@ msgstr "" "串物件,則不會觸發錯誤,並 fall back(後備)使用分塊傳輸編碼 (chunked " "transfer encoding)。" -#: ../../library/urllib.request.rst:281 +#: ../../library/urllib.request.rst:270 msgid "" "The :class:`OpenerDirector` class opens URLs via :class:`BaseHandler`\\ s " "chained together. It manages the chaining of handlers, and recovery from " "errors." msgstr "" -#: ../../library/urllib.request.rst:287 +#: ../../library/urllib.request.rst:276 msgid "" "This is the base class for all registered handlers --- and handles only the " "simple mechanics of registration." msgstr "" -#: ../../library/urllib.request.rst:293 +#: ../../library/urllib.request.rst:282 msgid "" "A class which defines a default handler for HTTP error responses; all " "responses are turned into :exc:`~urllib.error.HTTPError` exceptions." msgstr "" -#: ../../library/urllib.request.rst:299 +#: ../../library/urllib.request.rst:288 msgid "A class to handle redirections." msgstr "" -#: ../../library/urllib.request.rst:304 +#: ../../library/urllib.request.rst:293 msgid "A class to handle HTTP Cookies." msgstr "" -#: ../../library/urllib.request.rst:309 +#: ../../library/urllib.request.rst:298 msgid "" "Cause requests to go through a proxy. If *proxies* is given, it must be a " "dictionary mapping protocol names to URLs of proxies. The default is to read " @@ -560,11 +538,11 @@ msgid "" "Configuration Framework." msgstr "" -#: ../../library/urllib.request.rst:317 +#: ../../library/urllib.request.rst:306 msgid "To disable autodetected proxy pass an empty dictionary." msgstr "" -#: ../../library/urllib.request.rst:319 +#: ../../library/urllib.request.rst:308 msgid "" "The :envvar:`no_proxy` environment variable can be used to specify hosts " "which shouldn't be reached via proxy; if set, it should be a comma-separated " @@ -572,24 +550,24 @@ msgid "" "``cern.ch,ncsa.uiuc.edu,some.host:8080``." msgstr "" -#: ../../library/urllib.request.rst:326 +#: ../../library/urllib.request.rst:315 msgid "" "``HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set; see " "the documentation on :func:`~urllib.request.getproxies`." msgstr "" -#: ../../library/urllib.request.rst:332 +#: ../../library/urllib.request.rst:321 msgid "Keep a database of ``(realm, uri) -> (user, password)`` mappings." msgstr "" -#: ../../library/urllib.request.rst:337 +#: ../../library/urllib.request.rst:326 msgid "" "Keep a database of ``(realm, uri) -> (user, password)`` mappings. A realm " "of ``None`` is considered a catch-all realm, which is searched if no other " "realm fits." msgstr "" -#: ../../library/urllib.request.rst:344 +#: ../../library/urllib.request.rst:333 msgid "" "A variant of :class:`HTTPPasswordMgrWithDefaultRealm` that also has a " "database of ``uri -> is_authenticated`` mappings. Can be used by a " @@ -597,7 +575,7 @@ msgid "" "immediately instead of waiting for a ``401`` response first." msgstr "" -#: ../../library/urllib.request.rst:354 +#: ../../library/urllib.request.rst:343 msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " @@ -616,11 +594,11 @@ msgid "" "will automatically include the authentication credentials." msgstr "" -#: ../../library/urllib.request.rst:371 +#: ../../library/urllib.request.rst:360 msgid "Added ``is_authenticated`` support." msgstr "新增 ``is_authenticated`` 的支援。" -#: ../../library/urllib.request.rst:377 +#: ../../library/urllib.request.rst:366 msgid "" "Handle authentication with the remote host. *password_mgr*, if given, should " "be something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -629,7 +607,7 @@ msgid "" "presented with a wrong Authentication scheme." msgstr "" -#: ../../library/urllib.request.rst:386 ../../library/urllib.request.rst:420 +#: ../../library/urllib.request.rst:375 ../../library/urllib.request.rst:409 msgid "" "Handle authentication with the proxy. *password_mgr*, if given, should be " "something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -637,7 +615,7 @@ msgid "" "be supported." msgstr "" -#: ../../library/urllib.request.rst:394 +#: ../../library/urllib.request.rst:383 msgid "" "This is a mixin class that helps with HTTP authentication, both to the " "remote host and to a proxy. *password_mgr*, if given, should be something " @@ -645,7 +623,7 @@ msgid "" "`http-password-mgr` for information on the interface that must be supported." msgstr "" -#: ../../library/urllib.request.rst:403 +#: ../../library/urllib.request.rst:392 msgid "" "Handle authentication with the remote host. *password_mgr*, if given, should " "be something that is compatible with :class:`HTTPPasswordMgr`; refer to " @@ -658,108 +636,108 @@ msgid "" "Digest or Basic." msgstr "" -#: ../../library/urllib.request.rst:413 +#: ../../library/urllib.request.rst:402 msgid "Raise :exc:`ValueError` on unsupported Authentication Scheme." msgstr "" -#: ../../library/urllib.request.rst:428 +#: ../../library/urllib.request.rst:417 msgid "A class to handle opening of HTTP URLs." msgstr "" -#: ../../library/urllib.request.rst:433 +#: ../../library/urllib.request.rst:422 msgid "" "A class to handle opening of HTTPS URLs. *context* and *check_hostname* " "have the same meaning as in :class:`http.client.HTTPSConnection`." msgstr "" -#: ../../library/urllib.request.rst:436 +#: ../../library/urllib.request.rst:425 msgid "*context* and *check_hostname* were added." msgstr "新增 *context* 與 *check_hostname*。" -#: ../../library/urllib.request.rst:442 +#: ../../library/urllib.request.rst:431 msgid "Open local files." msgstr "" -#: ../../library/urllib.request.rst:446 +#: ../../library/urllib.request.rst:435 msgid "Open data URLs." msgstr "" -#: ../../library/urllib.request.rst:452 +#: ../../library/urllib.request.rst:441 msgid "Open FTP URLs." msgstr "" -#: ../../library/urllib.request.rst:457 +#: ../../library/urllib.request.rst:446 msgid "" "Open FTP URLs, keeping a cache of open FTP connections to minimize delays." msgstr "" -#: ../../library/urllib.request.rst:462 +#: ../../library/urllib.request.rst:451 msgid "A catch-all class to handle unknown URLs." msgstr "" -#: ../../library/urllib.request.rst:467 ../../library/urllib.request.rst:1173 +#: ../../library/urllib.request.rst:456 ../../library/urllib.request.rst:1162 msgid "Process HTTP error responses." msgstr "" -#: ../../library/urllib.request.rst:473 +#: ../../library/urllib.request.rst:462 msgid "Request Objects" msgstr "" -#: ../../library/urllib.request.rst:475 +#: ../../library/urllib.request.rst:464 msgid "" "The following methods describe :class:`Request`'s public interface, and so " "all may be overridden in subclasses. It also defines several public " "attributes that can be used by clients to inspect the parsed request." msgstr "" -#: ../../library/urllib.request.rst:482 +#: ../../library/urllib.request.rst:471 msgid "The original URL passed to the constructor." msgstr "" -#: ../../library/urllib.request.rst:486 +#: ../../library/urllib.request.rst:475 msgid "" "Request.full_url is a property with setter, getter and a deleter. Getting :" "attr:`~Request.full_url` returns the original request URL with the fragment, " "if it was present." msgstr "" -#: ../../library/urllib.request.rst:492 +#: ../../library/urllib.request.rst:481 msgid "The URI scheme." msgstr "" -#: ../../library/urllib.request.rst:496 +#: ../../library/urllib.request.rst:485 msgid "" "The URI authority, typically a host, but may also contain a port separated " "by a colon." msgstr "" -#: ../../library/urllib.request.rst:501 +#: ../../library/urllib.request.rst:490 msgid "The original host for the request, without port." msgstr "" -#: ../../library/urllib.request.rst:505 +#: ../../library/urllib.request.rst:494 msgid "" "The URI path. If the :class:`Request` uses a proxy, then selector will be " "the full URL that is passed to the proxy." msgstr "" -#: ../../library/urllib.request.rst:510 +#: ../../library/urllib.request.rst:499 msgid "The entity body for the request, or ``None`` if not specified." msgstr "" -#: ../../library/urllib.request.rst:512 +#: ../../library/urllib.request.rst:501 msgid "" "Changing value of :attr:`Request.data` now deletes \"Content-Length\" header " "if it was previously set or calculated." msgstr "" -#: ../../library/urllib.request.rst:518 +#: ../../library/urllib.request.rst:507 msgid "" "boolean, indicates whether the request is unverifiable as defined by :rfc:" "`2965`." msgstr "" -#: ../../library/urllib.request.rst:523 +#: ../../library/urllib.request.rst:512 msgid "" "The HTTP request method to use. By default its value is :const:`None`, " "which means that :meth:`~Request.get_method` will do its normal computation " @@ -770,13 +748,13 @@ msgid "" "argument." msgstr "" -#: ../../library/urllib.request.rst:533 +#: ../../library/urllib.request.rst:522 msgid "" "A default value can now be set in subclasses; previously it could only be " "set via the constructor argument." msgstr "" -#: ../../library/urllib.request.rst:540 +#: ../../library/urllib.request.rst:529 msgid "" "Return a string indicating the HTTP request method. If :attr:`Request." "method` is not ``None``, return its value, otherwise return ``'GET'`` if :" @@ -784,11 +762,11 @@ msgid "" "meaningful for HTTP requests." msgstr "" -#: ../../library/urllib.request.rst:545 +#: ../../library/urllib.request.rst:534 msgid "get_method now looks at the value of :attr:`Request.method`." msgstr "" -#: ../../library/urllib.request.rst:551 +#: ../../library/urllib.request.rst:540 msgid "" "Add another header to the request. Headers are currently ignored by all " "handlers except HTTP handlers, where they are added to the list of headers " @@ -800,64 +778,64 @@ msgid "" "headers added using this method are also added to redirected requests." msgstr "" -#: ../../library/urllib.request.rst:563 +#: ../../library/urllib.request.rst:552 msgid "Add a header that will not be added to a redirected request." msgstr "" -#: ../../library/urllib.request.rst:568 +#: ../../library/urllib.request.rst:557 msgid "" "Return whether the instance has the named header (checks both regular and " "unredirected)." msgstr "" -#: ../../library/urllib.request.rst:574 +#: ../../library/urllib.request.rst:563 msgid "" "Remove named header from the request instance (both from regular and " "unredirected headers)." msgstr "" -#: ../../library/urllib.request.rst:582 +#: ../../library/urllib.request.rst:571 msgid "Return the URL given in the constructor." msgstr "" -#: ../../library/urllib.request.rst:586 +#: ../../library/urllib.request.rst:575 msgid "Returns :attr:`Request.full_url`" msgstr "" -#: ../../library/urllib.request.rst:591 +#: ../../library/urllib.request.rst:580 msgid "" "Prepare the request by connecting to a proxy server. The *host* and *type* " "will replace those of the instance, and the instance's selector will be the " "original URL given in the constructor." msgstr "" -#: ../../library/urllib.request.rst:598 +#: ../../library/urllib.request.rst:587 msgid "" "Return the value of the given header. If the header is not present, return " "the default value." msgstr "" -#: ../../library/urllib.request.rst:604 +#: ../../library/urllib.request.rst:593 msgid "" "Return a list of tuples (header_name, header_value) of the Request headers." msgstr "" -#: ../../library/urllib.request.rst:606 +#: ../../library/urllib.request.rst:595 msgid "" "The request methods add_data, has_data, get_data, get_type, get_host, " "get_selector, get_origin_req_host and is_unverifiable that were deprecated " "since 3.3 have been removed." msgstr "" -#: ../../library/urllib.request.rst:615 +#: ../../library/urllib.request.rst:604 msgid "OpenerDirector Objects" msgstr "OpenerDirector 物件" -#: ../../library/urllib.request.rst:617 +#: ../../library/urllib.request.rst:606 msgid ":class:`OpenerDirector` instances have the following methods:" msgstr "" -#: ../../library/urllib.request.rst:622 +#: ../../library/urllib.request.rst:611 msgid "" "*handler* should be an instance of :class:`BaseHandler`. The following " "methods are searched, and added to the possible chains (note that HTTP " @@ -868,53 +846,53 @@ msgid "" "`http_error_404` would handle HTTP 404 errors." msgstr "" -#: ../../library/urllib.request.rst:630 +#: ../../library/urllib.request.rst:619 msgid "" ":meth:`!_open` --- signal that the handler knows how to open " "*protocol* URLs." msgstr "" -#: ../../library/urllib.request.rst:633 +#: ../../library/urllib.request.rst:622 msgid "See |protocol_open|_ for more information." msgstr "更多資訊請見 |protocol_open|_。" -#: ../../library/urllib.request.rst:635 +#: ../../library/urllib.request.rst:624 msgid "" ":meth:`!http_error_\\` --- signal that the handler knows how to " "handle HTTP errors with HTTP error code *type*." msgstr "" -#: ../../library/urllib.request.rst:638 +#: ../../library/urllib.request.rst:627 msgid "See |http_error_nnn|_ for more information." msgstr "更多資訊請見 |http_error_nnn|_。" -#: ../../library/urllib.request.rst:640 +#: ../../library/urllib.request.rst:629 msgid "" ":meth:`!_error` --- signal that the handler knows how to handle " "errors from (non-\\ ``http``) *protocol*." msgstr "" -#: ../../library/urllib.request.rst:643 +#: ../../library/urllib.request.rst:632 msgid "" ":meth:`!_request` --- signal that the handler knows how to pre-" "process *protocol* requests." msgstr "" -#: ../../library/urllib.request.rst:646 +#: ../../library/urllib.request.rst:635 msgid "See |protocol_request|_ for more information." msgstr "更多資訊請見 |protocol_request|_。" -#: ../../library/urllib.request.rst:648 +#: ../../library/urllib.request.rst:637 msgid "" ":meth:`!_response` --- signal that the handler knows how to post-" "process *protocol* responses." msgstr "" -#: ../../library/urllib.request.rst:651 +#: ../../library/urllib.request.rst:640 msgid "See |protocol_response|_ for more information." msgstr "更多資訊請見 |protocol_response|_。" -#: ../../library/urllib.request.rst:660 +#: ../../library/urllib.request.rst:649 msgid "" "Open the given *url* (which can be a request object or a string), optionally " "passing the given *data*. Arguments, return values and exceptions raised are " @@ -926,7 +904,7 @@ msgid "" "HTTP, HTTPS and FTP connections." msgstr "" -#: ../../library/urllib.request.rst:672 +#: ../../library/urllib.request.rst:661 msgid "" "Handle an error of the given protocol. This will call the registered error " "handlers for the given protocol with the given arguments (which are protocol " @@ -935,28 +913,28 @@ msgid "" "http_error_\\` methods of the handler classes." msgstr "" -#: ../../library/urllib.request.rst:678 +#: ../../library/urllib.request.rst:667 msgid "" "Return values and exceptions raised are the same as those of :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:680 +#: ../../library/urllib.request.rst:669 msgid "OpenerDirector objects open URLs in three stages:" msgstr "" -#: ../../library/urllib.request.rst:682 +#: ../../library/urllib.request.rst:671 msgid "" "The order in which these methods are called within each stage is determined " "by sorting the handler instances." msgstr "" -#: ../../library/urllib.request.rst:685 +#: ../../library/urllib.request.rst:674 msgid "" "Every handler with a method named like :meth:`!_request` has that " "method called to pre-process the request." msgstr "" -#: ../../library/urllib.request.rst:688 +#: ../../library/urllib.request.rst:677 msgid "" "Handlers with a method named like :meth:`!_open` are called to " "handle the request. This stage ends when a handler either returns a non-\\ :" @@ -964,7 +942,7 @@ msgid "" "`~urllib.error.URLError`). Exceptions are allowed to propagate." msgstr "" -#: ../../library/urllib.request.rst:693 +#: ../../library/urllib.request.rst:682 msgid "" "In fact, the above algorithm is first tried for methods named :meth:" "`~BaseHandler.default_open`. If all such methods return :const:`None`, the " @@ -973,64 +951,64 @@ msgid "" "named :meth:`~BaseHandler.unknown_open`." msgstr "" -#: ../../library/urllib.request.rst:699 +#: ../../library/urllib.request.rst:688 msgid "" "Note that the implementation of these methods may involve calls of the " "parent :class:`OpenerDirector` instance's :meth:`~OpenerDirector.open` and :" "meth:`~OpenerDirector.error` methods." msgstr "" -#: ../../library/urllib.request.rst:703 +#: ../../library/urllib.request.rst:692 msgid "" "Every handler with a method named like :meth:`!_response` has that " "method called to post-process the response." msgstr "" -#: ../../library/urllib.request.rst:710 +#: ../../library/urllib.request.rst:699 msgid "BaseHandler Objects" msgstr "BaseHandler 物件" -#: ../../library/urllib.request.rst:712 +#: ../../library/urllib.request.rst:701 msgid "" ":class:`BaseHandler` objects provide a couple of methods that are directly " "useful, and others that are meant to be used by derived classes. These are " "intended for direct use:" msgstr "" -#: ../../library/urllib.request.rst:719 +#: ../../library/urllib.request.rst:708 msgid "Add a director as parent." msgstr "" -#: ../../library/urllib.request.rst:724 +#: ../../library/urllib.request.rst:713 msgid "Remove any parents." msgstr "" -#: ../../library/urllib.request.rst:726 +#: ../../library/urllib.request.rst:715 msgid "" "The following attribute and methods should only be used by classes derived " "from :class:`BaseHandler`." msgstr "" -#: ../../library/urllib.request.rst:731 +#: ../../library/urllib.request.rst:720 msgid "" "The convention has been adopted that subclasses defining :meth:`!" "_request` or :meth:`!_response` methods are named :class:" "`!\\*Processor`; all others are named :class:`!\\*Handler`." msgstr "" -#: ../../library/urllib.request.rst:738 +#: ../../library/urllib.request.rst:727 msgid "" "A valid :class:`OpenerDirector`, which can be used to open using a different " "protocol, or handle errors." msgstr "" -#: ../../library/urllib.request.rst:744 +#: ../../library/urllib.request.rst:733 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to catch all URLs." msgstr "" -#: ../../library/urllib.request.rst:747 +#: ../../library/urllib.request.rst:736 msgid "" "This method, if implemented, will be called by the parent :class:" "`OpenerDirector`. It should return a file-like object as described in the " @@ -1040,38 +1018,38 @@ msgid "" "`MemoryError` should not be mapped to :exc:`~urllib.error.URLError`)." msgstr "" -#: ../../library/urllib.request.rst:754 +#: ../../library/urllib.request.rst:743 msgid "This method will be called before any protocol-specific open method." msgstr "" -#: ../../library/urllib.request.rst:761 +#: ../../library/urllib.request.rst:750 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to handle URLs with the given protocol." msgstr "" -#: ../../library/urllib.request.rst:764 +#: ../../library/urllib.request.rst:753 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. Return values should be the same as for :meth:" "`~BaseHandler.default_open`." msgstr "" -#: ../../library/urllib.request.rst:770 +#: ../../library/urllib.request.rst:759 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to catch all URLs with no specific registered handler " "to open it." msgstr "" -#: ../../library/urllib.request.rst:774 +#: ../../library/urllib.request.rst:763 msgid "" "This method, if implemented, will be called by the :attr:`parent` :class:" "`OpenerDirector`. Return values should be the same as for :meth:" "`default_open`." msgstr "" -#: ../../library/urllib.request.rst:781 +#: ../../library/urllib.request.rst:770 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "override it if they intend to provide a catch-all for otherwise unhandled " @@ -1080,7 +1058,7 @@ msgid "" "other circumstances." msgstr "" -#: ../../library/urllib.request.rst:786 +#: ../../library/urllib.request.rst:775 msgid "" "*req* will be a :class:`Request` object, *fp* will be a file-like object " "with the HTTP error body, *code* will be the three-digit code of the error, " @@ -1088,49 +1066,49 @@ msgid "" "mapping object with the headers of the error." msgstr "" -#: ../../library/urllib.request.rst:791 +#: ../../library/urllib.request.rst:780 msgid "" "Return values and exceptions raised should be the same as those of :func:" "`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:798 +#: ../../library/urllib.request.rst:787 msgid "" "*nnn* should be a three-digit HTTP error code. This method is also not " "defined in :class:`BaseHandler`, but will be called, if it exists, on an " "instance of a subclass, when an HTTP error with code *nnn* occurs." msgstr "" -#: ../../library/urllib.request.rst:802 +#: ../../library/urllib.request.rst:791 msgid "Subclasses should override this method to handle specific HTTP errors." msgstr "" -#: ../../library/urllib.request.rst:804 +#: ../../library/urllib.request.rst:793 msgid "" "Arguments, return values and exceptions raised should be the same as for :" "meth:`~BaseHandler.http_error_default`." msgstr "" -#: ../../library/urllib.request.rst:812 +#: ../../library/urllib.request.rst:801 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to pre-process requests of the given protocol." msgstr "" -#: ../../library/urllib.request.rst:815 +#: ../../library/urllib.request.rst:804 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. *req* will be a :class:`Request` object. The return value " "should be a :class:`Request` object." msgstr "" -#: ../../library/urllib.request.rst:824 +#: ../../library/urllib.request.rst:813 msgid "" "This method is *not* defined in :class:`BaseHandler`, but subclasses should " "define it if they want to post-process responses of the given protocol." msgstr "" -#: ../../library/urllib.request.rst:827 +#: ../../library/urllib.request.rst:816 msgid "" "This method, if defined, will be called by the parent :class:" "`OpenerDirector`. *req* will be a :class:`Request` object. *response* will " @@ -1139,25 +1117,25 @@ msgid "" "return value of :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:837 +#: ../../library/urllib.request.rst:826 msgid "HTTPRedirectHandler Objects" msgstr "HTTPRedirectHandler 物件" -#: ../../library/urllib.request.rst:841 +#: ../../library/urllib.request.rst:830 msgid "" "Some HTTP redirections require action from this module's client code. If " "this is the case, :exc:`~urllib.error.HTTPError` is raised. See :rfc:`2616` " "for details of the precise meanings of the various redirection codes." msgstr "" -#: ../../library/urllib.request.rst:845 +#: ../../library/urllib.request.rst:834 msgid "" "An :exc:`~urllib.error.HTTPError` exception raised as a security " "consideration if the HTTPRedirectHandler is presented with a redirected URL " "which is not an HTTP, HTTPS or FTP URL." msgstr "" -#: ../../library/urllib.request.rst:852 +#: ../../library/urllib.request.rst:841 msgid "" "Return a :class:`Request` or ``None`` in response to a redirect. This is " "called by the default implementations of the :meth:`!http_error_30\\*` " @@ -1168,7 +1146,7 @@ msgid "" "URL, or return ``None`` if you can't but another handler might." msgstr "" -#: ../../library/urllib.request.rst:862 +#: ../../library/urllib.request.rst:851 msgid "" "The default implementation of this method does not strictly follow :rfc:" "`2616`, which says that 301 and 302 responses to ``POST`` requests must not " @@ -1177,54 +1155,54 @@ msgid "" "POST to a ``GET``, and the default implementation reproduces this behavior." msgstr "" -#: ../../library/urllib.request.rst:871 +#: ../../library/urllib.request.rst:860 msgid "" "Redirect to the ``Location:`` or ``URI:`` URL. This method is called by the " "parent :class:`OpenerDirector` when getting an HTTP 'moved permanently' " "response." msgstr "" -#: ../../library/urllib.request.rst:877 +#: ../../library/urllib.request.rst:866 msgid "" "The same as :meth:`http_error_301`, but called for the 'found' response." msgstr "" -#: ../../library/urllib.request.rst:882 +#: ../../library/urllib.request.rst:871 msgid "" "The same as :meth:`http_error_301`, but called for the 'see other' response." msgstr "" -#: ../../library/urllib.request.rst:887 +#: ../../library/urllib.request.rst:876 msgid "" "The same as :meth:`http_error_301`, but called for the 'temporary redirect' " "response. It does not allow changing the request method from ``POST`` to " "``GET``." msgstr "" -#: ../../library/urllib.request.rst:894 +#: ../../library/urllib.request.rst:883 msgid "" "The same as :meth:`http_error_301`, but called for the 'permanent redirect' " "response. It does not allow changing the request method from ``POST`` to " "``GET``." msgstr "" -#: ../../library/urllib.request.rst:904 +#: ../../library/urllib.request.rst:893 msgid "HTTPCookieProcessor Objects" msgstr "HTTPCookieProcessor 物件" -#: ../../library/urllib.request.rst:906 +#: ../../library/urllib.request.rst:895 msgid ":class:`HTTPCookieProcessor` instances have one attribute:" msgstr "" -#: ../../library/urllib.request.rst:910 +#: ../../library/urllib.request.rst:899 msgid "The :class:`http.cookiejar.CookieJar` in which cookies are stored." msgstr "" -#: ../../library/urllib.request.rst:916 +#: ../../library/urllib.request.rst:905 msgid "ProxyHandler Objects" msgstr "ProxyHandler 物件" -#: ../../library/urllib.request.rst:922 +#: ../../library/urllib.request.rst:911 msgid "" "The :class:`ProxyHandler` will have a method :meth:`!_open` for " "every *protocol* which has a proxy in the *proxies* dictionary given in the " @@ -1233,17 +1211,17 @@ msgid "" "actually execute the protocol." msgstr "" -#: ../../library/urllib.request.rst:932 +#: ../../library/urllib.request.rst:921 msgid "HTTPPasswordMgr Objects" msgstr "HTTPPasswordMgr 物件" -#: ../../library/urllib.request.rst:934 +#: ../../library/urllib.request.rst:923 msgid "" "These methods are available on :class:`HTTPPasswordMgr` and :class:" "`HTTPPasswordMgrWithDefaultRealm` objects." msgstr "" -#: ../../library/urllib.request.rst:940 +#: ../../library/urllib.request.rst:929 msgid "" "*uri* can be either a single URI, or a sequence of URIs. *realm*, *user* and " "*passwd* must be strings. This causes ``(user, passwd)`` to be used as " @@ -1251,30 +1229,30 @@ msgid "" "of the given URIs is given." msgstr "" -#: ../../library/urllib.request.rst:948 +#: ../../library/urllib.request.rst:937 msgid "" "Get user/password for given realm and URI, if any. This method will return " "``(None, None)`` if there is no matching user/password." msgstr "" -#: ../../library/urllib.request.rst:951 +#: ../../library/urllib.request.rst:940 msgid "" "For :class:`HTTPPasswordMgrWithDefaultRealm` objects, the realm ``None`` " "will be searched if the given *realm* has no matching user/password." msgstr "" -#: ../../library/urllib.request.rst:958 +#: ../../library/urllib.request.rst:947 msgid "HTTPPasswordMgrWithPriorAuth Objects" msgstr "HTTPPasswordMgrWithPriorAuth 物件" -#: ../../library/urllib.request.rst:960 +#: ../../library/urllib.request.rst:949 msgid "" "This password manager extends :class:`HTTPPasswordMgrWithDefaultRealm` to " "support tracking URIs for which authentication credentials should always be " "sent." msgstr "" -#: ../../library/urllib.request.rst:967 +#: ../../library/urllib.request.rst:956 msgid "" "*realm*, *uri*, *user*, *passwd* are as for :meth:`HTTPPasswordMgr." "add_password`. *is_authenticated* sets the initial value of the " @@ -1282,25 +1260,25 @@ msgid "" "*is_authenticated* is specified as ``True``, *realm* is ignored." msgstr "" -#: ../../library/urllib.request.rst:975 +#: ../../library/urllib.request.rst:964 msgid "Same as for :class:`HTTPPasswordMgrWithDefaultRealm` objects" msgstr "" -#: ../../library/urllib.request.rst:981 +#: ../../library/urllib.request.rst:970 msgid "" "Update the ``is_authenticated`` flag for the given *uri* or list of URIs." msgstr "" -#: ../../library/urllib.request.rst:987 +#: ../../library/urllib.request.rst:976 msgid "" "Returns the current state of the ``is_authenticated`` flag for the given URI." msgstr "" -#: ../../library/urllib.request.rst:994 +#: ../../library/urllib.request.rst:983 msgid "AbstractBasicAuthHandler Objects" msgstr "AbstractBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:999 +#: ../../library/urllib.request.rst:988 msgid "" "Handle an authentication request by getting a user/password pair, and re-" "trying the request. *authreq* should be the name of the header where the " @@ -1309,7 +1287,7 @@ msgid "" "`Request` object, and *headers* should be the error headers." msgstr "" -#: ../../library/urllib.request.rst:1005 +#: ../../library/urllib.request.rst:994 msgid "" "*host* is either an authority (e.g. ``\"python.org\"``) or a URL containing " "an authority component (e.g. ``\"http://python.org/\"``). In either case, " @@ -1317,24 +1295,24 @@ msgid "" "and ``\"python.org:80\"`` are fine, ``\"joe:password@python.org\"`` is not)." msgstr "" -#: ../../library/urllib.request.rst:1014 +#: ../../library/urllib.request.rst:1003 msgid "HTTPBasicAuthHandler Objects" msgstr "HTTPBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:1019 ../../library/urllib.request.rst:1030 -#: ../../library/urllib.request.rst:1055 ../../library/urllib.request.rst:1066 +#: ../../library/urllib.request.rst:1008 ../../library/urllib.request.rst:1019 +#: ../../library/urllib.request.rst:1044 ../../library/urllib.request.rst:1055 msgid "Retry the request with authentication information, if available." msgstr "" -#: ../../library/urllib.request.rst:1025 +#: ../../library/urllib.request.rst:1014 msgid "ProxyBasicAuthHandler Objects" msgstr "ProxyBasicAuthHandler 物件" -#: ../../library/urllib.request.rst:1036 +#: ../../library/urllib.request.rst:1025 msgid "AbstractDigestAuthHandler Objects" msgstr "AbstractDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1041 +#: ../../library/urllib.request.rst:1030 msgid "" "*authreq* should be the name of the header where the information about the " "realm is included in the request, *host* should be the host to authenticate " @@ -1342,55 +1320,55 @@ msgid "" "should be the error headers." msgstr "" -#: ../../library/urllib.request.rst:1050 +#: ../../library/urllib.request.rst:1039 msgid "HTTPDigestAuthHandler Objects" msgstr "HTTPDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1061 +#: ../../library/urllib.request.rst:1050 msgid "ProxyDigestAuthHandler Objects" msgstr "ProxyDigestAuthHandler 物件" -#: ../../library/urllib.request.rst:1072 +#: ../../library/urllib.request.rst:1061 msgid "HTTPHandler Objects" msgstr "HTTPHandler 物件" -#: ../../library/urllib.request.rst:1077 +#: ../../library/urllib.request.rst:1066 msgid "" "Send an HTTP request, which can be either GET or POST, depending on ``req." "has_data()``." msgstr "" -#: ../../library/urllib.request.rst:1084 +#: ../../library/urllib.request.rst:1073 msgid "HTTPSHandler Objects" msgstr "HTTPSHandler 物件" -#: ../../library/urllib.request.rst:1089 +#: ../../library/urllib.request.rst:1078 msgid "" "Send an HTTPS request, which can be either GET or POST, depending on ``req." "has_data()``." msgstr "" -#: ../../library/urllib.request.rst:1096 +#: ../../library/urllib.request.rst:1085 msgid "FileHandler Objects" msgstr "FileHandler 物件" -#: ../../library/urllib.request.rst:1101 +#: ../../library/urllib.request.rst:1090 msgid "" "Open the file locally, if there is no host name, or the host name is " "``'localhost'``." msgstr "" -#: ../../library/urllib.request.rst:1104 +#: ../../library/urllib.request.rst:1093 msgid "" "This method is applicable only for local hostnames. When a remote hostname " "is given, a :exc:`~urllib.error.URLError` is raised." msgstr "" -#: ../../library/urllib.request.rst:1112 +#: ../../library/urllib.request.rst:1101 msgid "DataHandler Objects" msgstr "DataHandler 物件" -#: ../../library/urllib.request.rst:1116 +#: ../../library/urllib.request.rst:1105 msgid "" "Read a data URL. This kind of URL contains the content encoded in the URL " "itself. The data URL syntax is specified in :rfc:`2397`. This implementation " @@ -1400,51 +1378,51 @@ msgid "" "implementation will raise a :exc:`ValueError` in that case." msgstr "" -#: ../../library/urllib.request.rst:1127 +#: ../../library/urllib.request.rst:1116 msgid "FTPHandler Objects" msgstr "FTPHandler 物件" -#: ../../library/urllib.request.rst:1132 +#: ../../library/urllib.request.rst:1121 msgid "" "Open the FTP file indicated by *req*. The login is always done with empty " "username and password." msgstr "" -#: ../../library/urllib.request.rst:1139 +#: ../../library/urllib.request.rst:1128 msgid "CacheFTPHandler Objects" msgstr "CacheFTPHandler 物件" -#: ../../library/urllib.request.rst:1141 +#: ../../library/urllib.request.rst:1130 msgid "" ":class:`CacheFTPHandler` objects are :class:`FTPHandler` objects with the " "following additional methods:" msgstr "" -#: ../../library/urllib.request.rst:1147 +#: ../../library/urllib.request.rst:1136 msgid "Set timeout of connections to *t* seconds." msgstr "" -#: ../../library/urllib.request.rst:1152 +#: ../../library/urllib.request.rst:1141 msgid "Set maximum number of cached connections to *m*." msgstr "" -#: ../../library/urllib.request.rst:1158 +#: ../../library/urllib.request.rst:1147 msgid "UnknownHandler Objects" msgstr "UnknownHandler 物件" -#: ../../library/urllib.request.rst:1163 +#: ../../library/urllib.request.rst:1152 msgid "Raise a :exc:`~urllib.error.URLError` exception." msgstr "" -#: ../../library/urllib.request.rst:1169 +#: ../../library/urllib.request.rst:1158 msgid "HTTPErrorProcessor Objects" msgstr "HTTPErrorProcessor 物件" -#: ../../library/urllib.request.rst:1175 +#: ../../library/urllib.request.rst:1164 msgid "For 200 error codes, the response object is returned immediately." msgstr "" -#: ../../library/urllib.request.rst:1177 +#: ../../library/urllib.request.rst:1166 msgid "" "For non-200 error codes, this simply passes the job on to the :meth:`!" "http_error_\\` handler methods, via :meth:`OpenerDirector.error`. " @@ -1452,31 +1430,31 @@ msgid "" "error.HTTPError` if no other handler handles the error." msgstr "" -#: ../../library/urllib.request.rst:1185 +#: ../../library/urllib.request.rst:1174 msgid "Process HTTPS error responses." msgstr "" -#: ../../library/urllib.request.rst:1187 +#: ../../library/urllib.request.rst:1176 msgid "The behavior is same as :meth:`http_response`." msgstr "" -#: ../../library/urllib.request.rst:1193 +#: ../../library/urllib.request.rst:1182 msgid "Examples" msgstr "範例" -#: ../../library/urllib.request.rst:1195 +#: ../../library/urllib.request.rst:1184 msgid "" "In addition to the examples below, more examples are given in :ref:`urllib-" "howto`." msgstr "" -#: ../../library/urllib.request.rst:1198 +#: ../../library/urllib.request.rst:1187 msgid "" "This example gets the python.org main page and displays the first 300 bytes " "of it. ::" msgstr "" -#: ../../library/urllib.request.rst:1201 +#: ../../library/urllib.request.rst:1190 msgid "" ">>> import urllib.request\n" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" @@ -1502,7 +1480,7 @@ msgstr "" ">\\n\n" "Python Programming '" -#: ../../library/urllib.request.rst:1211 +#: ../../library/urllib.request.rst:1200 msgid "" "Note that urlopen returns a bytes object. This is because there is no way " "for urlopen to automatically determine the encoding of the byte stream it " @@ -1511,20 +1489,20 @@ msgid "" "appropriate encoding." msgstr "" -#: ../../library/urllib.request.rst:1217 +#: ../../library/urllib.request.rst:1206 msgid "" "The following W3C document, https://www.w3.org/International/O-charset\\ , " "lists the various ways in which an (X)HTML or an XML document could have " "specified its encoding information." msgstr "" -#: ../../library/urllib.request.rst:1221 +#: ../../library/urllib.request.rst:1210 msgid "" "As the python.org website uses *utf-8* encoding as specified in its meta " "tag, we will use the same for decoding the bytes object. ::" msgstr "" -#: ../../library/urllib.request.rst:1224 +#: ../../library/urllib.request.rst:1213 msgid "" ">>> with urllib.request.urlopen('http://www.python.org/') as f:\n" "... print(f.read(100).decode('utf-8'))\n" @@ -1538,13 +1516,13 @@ msgstr "" "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" "\"http://www.w3.org/TR/xhtml1/DTD/xhtm" -#: ../../library/urllib.request.rst:1230 +#: ../../library/urllib.request.rst:1219 msgid "" "It is also possible to achieve the same result without using the :term:" "`context manager` approach. ::" msgstr "" -#: ../../library/urllib.request.rst:1233 +#: ../../library/urllib.request.rst:1222 msgid "" ">>> import urllib.request\n" ">>> f = urllib.request.urlopen('http://www.python.org/')\n" @@ -1558,14 +1536,14 @@ msgstr "" "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n" "\"http://www.w3.org/TR/xhtml1/DTD/xhtm" -#: ../../library/urllib.request.rst:1239 +#: ../../library/urllib.request.rst:1228 msgid "" "In the following example, we are sending a data-stream to the stdin of a CGI " "and reading the data it returns to us. Note that this example will only work " "when the Python installation supports SSL. ::" msgstr "" -#: ../../library/urllib.request.rst:1243 +#: ../../library/urllib.request.rst:1232 msgid "" ">>> import urllib.request\n" ">>> req = urllib.request.Request(url='https://localhost/cgi-bin/test.cgi',\n" @@ -1576,11 +1554,11 @@ msgid "" "Got Data: \"This data is passed to stdin of the CGI\"" msgstr "" -#: ../../library/urllib.request.rst:1251 +#: ../../library/urllib.request.rst:1240 msgid "The code for the sample CGI used in the above example is::" msgstr "" -#: ../../library/urllib.request.rst:1253 +#: ../../library/urllib.request.rst:1242 msgid "" "#!/usr/bin/env python\n" "import sys\n" @@ -1592,11 +1570,11 @@ msgstr "" "data = sys.stdin.read()\n" "print('Content-type: text/plain\\n\\nGot Data: \"%s\"' % data)" -#: ../../library/urllib.request.rst:1258 +#: ../../library/urllib.request.rst:1247 msgid "Here is an example of doing a ``PUT`` request using :class:`Request`::" msgstr "" -#: ../../library/urllib.request.rst:1260 +#: ../../library/urllib.request.rst:1249 msgid "" "import urllib.request\n" "DATA = b'some data'\n" @@ -1616,11 +1594,11 @@ msgstr "" "print(f.status)\n" "print(f.reason)" -#: ../../library/urllib.request.rst:1268 +#: ../../library/urllib.request.rst:1257 msgid "Use of Basic HTTP Authentication::" msgstr "" -#: ../../library/urllib.request.rst:1270 +#: ../../library/urllib.request.rst:1259 msgid "" "import urllib.request\n" "# Create an OpenerDirector with support for Basic HTTP Authentication...\n" @@ -1635,7 +1613,7 @@ msgid "" "urllib.request.urlopen('http://www.example.com/login.html')" msgstr "" -#: ../../library/urllib.request.rst:1282 +#: ../../library/urllib.request.rst:1271 msgid "" ":func:`build_opener` provides many handlers by default, including a :class:" "`ProxyHandler`. By default, :class:`ProxyHandler` uses the environment " @@ -1644,14 +1622,14 @@ msgid "" "read to obtain the HTTP proxy's URL." msgstr "" -#: ../../library/urllib.request.rst:1288 +#: ../../library/urllib.request.rst:1277 msgid "" "This example replaces the default :class:`ProxyHandler` with one that uses " "programmatically supplied proxy URLs, and adds proxy authorization support " "with :class:`ProxyBasicAuthHandler`. ::" msgstr "" -#: ../../library/urllib.request.rst:1292 +#: ../../library/urllib.request.rst:1281 msgid "" "proxy_handler = urllib.request.ProxyHandler({'http': 'http://www.example." "com:3128/'})\n" @@ -1671,15 +1649,15 @@ msgstr "" "# 這次我們直接使用它而不安裝 OpenerDirector:\n" "opener.open('http://www.example.com/login.html')" -#: ../../library/urllib.request.rst:1300 +#: ../../library/urllib.request.rst:1289 msgid "Adding HTTP headers:" msgstr "" -#: ../../library/urllib.request.rst:1302 +#: ../../library/urllib.request.rst:1291 msgid "Use the *headers* argument to the :class:`Request` constructor, or::" msgstr "" -#: ../../library/urllib.request.rst:1304 +#: ../../library/urllib.request.rst:1293 msgid "" "import urllib.request\n" "req = urllib.request.Request('http://www.example.com/')\n" @@ -1695,13 +1673,13 @@ msgstr "" "req.add_header('User-Agent', 'urllib-example/0.1 (Contact: . . .)')\n" "r = urllib.request.urlopen(req)" -#: ../../library/urllib.request.rst:1311 +#: ../../library/urllib.request.rst:1300 msgid "" ":class:`OpenerDirector` automatically adds a :mailheader:`User-Agent` header " "to every :class:`Request`. To change this::" msgstr "" -#: ../../library/urllib.request.rst:1314 +#: ../../library/urllib.request.rst:1303 msgid "" "import urllib.request\n" "opener = urllib.request.build_opener()\n" @@ -1713,20 +1691,20 @@ msgstr "" "opener.addheaders = [('User-agent', 'Mozilla/5.0')]\n" "opener.open('http://www.example.com/')" -#: ../../library/urllib.request.rst:1319 +#: ../../library/urllib.request.rst:1308 msgid "" "Also, remember that a few standard headers (:mailheader:`Content-Length`, :" "mailheader:`Content-Type` and :mailheader:`Host`) are added when the :class:" "`Request` is passed to :func:`urlopen` (or :meth:`OpenerDirector.open`)." msgstr "" -#: ../../library/urllib.request.rst:1326 +#: ../../library/urllib.request.rst:1315 msgid "" "Here is an example session that uses the ``GET`` method to retrieve a URL " "containing parameters::" msgstr "" -#: ../../library/urllib.request.rst:1329 +#: ../../library/urllib.request.rst:1318 msgid "" ">>> import urllib.request\n" ">>> import urllib.parse\n" @@ -1744,14 +1722,14 @@ msgstr "" "... print(f.read().decode('utf-8'))\n" "..." -#: ../../library/urllib.request.rst:1337 +#: ../../library/urllib.request.rst:1326 msgid "" "The following example uses the ``POST`` method instead. Note that params " "output from urlencode is encoded to bytes before it is sent to urlopen as " "data::" msgstr "" -#: ../../library/urllib.request.rst:1340 +#: ../../library/urllib.request.rst:1329 msgid "" ">>> import urllib.request\n" ">>> import urllib.parse\n" @@ -1771,13 +1749,13 @@ msgstr "" "... print(f.read().decode('utf-8'))\n" "..." -#: ../../library/urllib.request.rst:1348 +#: ../../library/urllib.request.rst:1337 msgid "" "The following example uses an explicitly specified HTTP proxy, overriding " "environment settings::" msgstr "" -#: ../../library/urllib.request.rst:1351 +#: ../../library/urllib.request.rst:1340 msgid "" ">>> import urllib.request\n" ">>> proxies = {'http': 'http://proxy.example.com:8080/'}\n" @@ -1793,13 +1771,13 @@ msgstr "" "... f.read().decode('utf-8')\n" "..." -#: ../../library/urllib.request.rst:1358 +#: ../../library/urllib.request.rst:1347 msgid "" "The following example uses no proxies at all, overriding environment " "settings::" msgstr "" -#: ../../library/urllib.request.rst:1360 +#: ../../library/urllib.request.rst:1349 msgid "" ">>> import urllib.request\n" ">>> opener = urllib.request.FancyURLopener({})\n" @@ -1813,18 +1791,18 @@ msgstr "" "... f.read().decode('utf-8')\n" "..." -#: ../../library/urllib.request.rst:1368 +#: ../../library/urllib.request.rst:1357 msgid "Legacy interface" msgstr "" -#: ../../library/urllib.request.rst:1370 +#: ../../library/urllib.request.rst:1359 msgid "" "The following functions and classes are ported from the Python 2 module " "``urllib`` (as opposed to ``urllib2``). They might become deprecated at " "some point in the future." msgstr "" -#: ../../library/urllib.request.rst:1376 +#: ../../library/urllib.request.rst:1365 msgid "" "Copy a network object denoted by a URL to a local file. If the URL points to " "a local file, the object will not be copied unless filename is supplied. " @@ -1834,7 +1812,7 @@ msgid "" "a remote object). Exceptions are the same as for :func:`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:1383 +#: ../../library/urllib.request.rst:1372 msgid "" "The second argument, if present, specifies the file location to copy to (if " "absent, the location will be a tempfile with a generated name). The third " @@ -1846,11 +1824,11 @@ msgid "" "file size in response to a retrieval request." msgstr "" -#: ../../library/urllib.request.rst:1392 +#: ../../library/urllib.request.rst:1381 msgid "The following example illustrates the most common usage scenario::" msgstr "" -#: ../../library/urllib.request.rst:1394 +#: ../../library/urllib.request.rst:1383 msgid "" ">>> import urllib.request\n" ">>> local_filename, headers = urllib.request.urlretrieve('http://python." @@ -1864,7 +1842,7 @@ msgstr "" ">>> html = open(local_filename)\n" ">>> html.close()" -#: ../../library/urllib.request.rst:1399 +#: ../../library/urllib.request.rst:1388 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " @@ -1873,7 +1851,7 @@ msgid "" "parse.urlencode` function." msgstr "" -#: ../../library/urllib.request.rst:1405 +#: ../../library/urllib.request.rst:1394 msgid "" ":func:`urlretrieve` will raise :exc:`~urllib.error.ContentTooShortError` " "when it detects that the amount of data available was less than the " @@ -1881,40 +1859,40 @@ msgid "" "This can occur, for example, when the download is interrupted." msgstr "" -#: ../../library/urllib.request.rst:1410 +#: ../../library/urllib.request.rst:1399 msgid "" "The *Content-Length* is treated as a lower bound: if there's more data to " "read, urlretrieve reads more data, but if less data is available, it raises " "the exception." msgstr "" -#: ../../library/urllib.request.rst:1414 +#: ../../library/urllib.request.rst:1403 msgid "" "You can still retrieve the downloaded data in this case, it is stored in " "the :attr:`!content` attribute of the exception instance." msgstr "" -#: ../../library/urllib.request.rst:1417 +#: ../../library/urllib.request.rst:1406 msgid "" "If no *Content-Length* header was supplied, urlretrieve can not check the " "size of the data it has downloaded, and just returns it. In this case you " "just have to assume that the download was successful." msgstr "" -#: ../../library/urllib.request.rst:1423 +#: ../../library/urllib.request.rst:1412 msgid "" "Cleans up temporary files that may have been left behind by previous calls " "to :func:`urlretrieve`." msgstr "" -#: ../../library/urllib.request.rst:1430 +#: ../../library/urllib.request.rst:1419 msgid "" "Base class for opening and reading URLs. Unless you need to support opening " "objects using schemes other than :file:`http:`, :file:`ftp:`, or :file:`file:" "`, you probably want to use :class:`FancyURLopener`." msgstr "" -#: ../../library/urllib.request.rst:1434 +#: ../../library/urllib.request.rst:1423 msgid "" "By default, the :class:`URLopener` class sends a :mailheader:`User-Agent` " "header of ``urllib/VVV``, where *VVV* is the :mod:`urllib` version number. " @@ -1924,7 +1902,7 @@ msgid "" "subclass definition." msgstr "" -#: ../../library/urllib.request.rst:1440 +#: ../../library/urllib.request.rst:1429 msgid "" "The optional *proxies* parameter should be a dictionary mapping scheme names " "to proxy URLs, where an empty dictionary turns proxies off completely. Its " @@ -1932,7 +1910,7 @@ msgid "" "be used if present, as discussed in the definition of :func:`urlopen`, above." msgstr "" -#: ../../library/urllib.request.rst:1445 +#: ../../library/urllib.request.rst:1434 msgid "" "Additional keyword parameters, collected in *x509*, may be used for " "authentication of the client when using the :file:`https:` scheme. The " @@ -1940,13 +1918,13 @@ msgid "" "certificate; both are needed to support client authentication." msgstr "" -#: ../../library/urllib.request.rst:1450 +#: ../../library/urllib.request.rst:1439 msgid "" ":class:`URLopener` objects will raise an :exc:`OSError` exception if the " "server returns an error code." msgstr "" -#: ../../library/urllib.request.rst:1455 +#: ../../library/urllib.request.rst:1444 msgid "" "Open *fullurl* using the appropriate protocol. This method sets up cache " "and proxy information, then calls the appropriate open method with its input " @@ -1955,15 +1933,15 @@ msgid "" "`urlopen`." msgstr "" -#: ../../library/urllib.request.rst:1461 +#: ../../library/urllib.request.rst:1450 msgid "This method always quotes *fullurl* using :func:`~urllib.parse.quote`." msgstr "" -#: ../../library/urllib.request.rst:1465 +#: ../../library/urllib.request.rst:1454 msgid "Overridable interface to open unknown URL types." msgstr "" -#: ../../library/urllib.request.rst:1470 +#: ../../library/urllib.request.rst:1459 msgid "" "Retrieves the contents of *url* and places it in *filename*. The return " "value is a tuple consisting of a local filename and either an :class:`email." @@ -1980,7 +1958,7 @@ msgid "" "*reporthook* is ignored for local URLs." msgstr "" -#: ../../library/urllib.request.rst:1483 +#: ../../library/urllib.request.rst:1472 msgid "" "If the *url* uses the :file:`http:` scheme identifier, the optional *data* " "argument may be given to specify a ``POST`` request (normally the request " @@ -1989,7 +1967,7 @@ msgid "" "urlencode` function." msgstr "" -#: ../../library/urllib.request.rst:1492 +#: ../../library/urllib.request.rst:1481 msgid "" "Variable that specifies the user agent of the opener object. To get :mod:" "`urllib` to tell servers that it is a particular user agent, set this in a " @@ -1997,7 +1975,7 @@ msgid "" "constructor." msgstr "" -#: ../../library/urllib.request.rst:1502 +#: ../../library/urllib.request.rst:1491 msgid "" ":class:`FancyURLopener` subclasses :class:`URLopener` providing default " "handling for the following HTTP response codes: 301, 302, 303, 307 and 401. " @@ -2008,14 +1986,14 @@ msgid "" "defaults to 10." msgstr "" -#: ../../library/urllib.request.rst:1509 +#: ../../library/urllib.request.rst:1498 msgid "" "For all other response codes, the method :meth:`~BaseHandler." "http_error_default` is called which you can override in subclasses to handle " "the error appropriately." msgstr "" -#: ../../library/urllib.request.rst:1514 +#: ../../library/urllib.request.rst:1503 msgid "" "According to the letter of :rfc:`2616`, 301 and 302 responses to POST " "requests must not be automatically redirected without confirmation by the " @@ -2024,13 +2002,13 @@ msgid "" "behaviour." msgstr "" -#: ../../library/urllib.request.rst:1519 +#: ../../library/urllib.request.rst:1508 msgid "" "The parameters to the constructor are the same as those for :class:" "`URLopener`." msgstr "" -#: ../../library/urllib.request.rst:1523 +#: ../../library/urllib.request.rst:1512 msgid "" "When performing basic authentication, a :class:`FancyURLopener` instance " "calls its :meth:`prompt_user_passwd` method. The default implementation " @@ -2039,59 +2017,59 @@ msgid "" "needed." msgstr "" -#: ../../library/urllib.request.rst:1528 +#: ../../library/urllib.request.rst:1517 msgid "" "The :class:`FancyURLopener` class offers one additional method that should " "be overloaded to provide the appropriate behavior:" msgstr "" -#: ../../library/urllib.request.rst:1533 +#: ../../library/urllib.request.rst:1522 msgid "" "Return information needed to authenticate the user at the given host in the " "specified security realm. The return value should be a tuple, ``(user, " "password)``, which can be used for basic authentication." msgstr "" -#: ../../library/urllib.request.rst:1537 +#: ../../library/urllib.request.rst:1526 msgid "" "The implementation prompts for this information on the terminal; an " "application should override this method to use an appropriate interaction " "model in the local environment." msgstr "" -#: ../../library/urllib.request.rst:1543 +#: ../../library/urllib.request.rst:1532 msgid ":mod:`urllib.request` Restrictions" msgstr "" -#: ../../library/urllib.request.rst:1549 +#: ../../library/urllib.request.rst:1538 msgid "" "Currently, only the following protocols are supported: HTTP (versions 0.9 " "and 1.0), FTP, local files, and data URLs." msgstr "" -#: ../../library/urllib.request.rst:1552 +#: ../../library/urllib.request.rst:1541 msgid "Added support for data URLs." msgstr "" -#: ../../library/urllib.request.rst:1554 +#: ../../library/urllib.request.rst:1543 msgid "" "The caching feature of :func:`urlretrieve` has been disabled until someone " "finds the time to hack proper processing of Expiration time headers." msgstr "" -#: ../../library/urllib.request.rst:1557 +#: ../../library/urllib.request.rst:1546 msgid "" "There should be a function to query whether a particular URL is in the cache." msgstr "" -#: ../../library/urllib.request.rst:1559 +#: ../../library/urllib.request.rst:1548 msgid "" "For backward compatibility, if a URL appears to point to a local file but " "the file can't be opened, the URL is re-interpreted using the FTP protocol. " "This can sometimes cause confusing error messages." msgstr "" -#: ../../library/urllib.request.rst:1563 +#: ../../library/urllib.request.rst:1552 msgid "" "The :func:`urlopen` and :func:`urlretrieve` functions can cause arbitrarily " "long delays while waiting for a network connection to be set up. This means " @@ -2099,7 +2077,7 @@ msgid "" "functions without using threads." msgstr "" -#: ../../library/urllib.request.rst:1572 +#: ../../library/urllib.request.rst:1561 msgid "" "The data returned by :func:`urlopen` or :func:`urlretrieve` is the raw data " "returned by the server. This may be binary data (such as an image), plain " @@ -2109,7 +2087,7 @@ msgid "" "module :mod:`html.parser` to parse it." msgstr "" -#: ../../library/urllib.request.rst:1581 +#: ../../library/urllib.request.rst:1570 msgid "" "The code handling the FTP protocol cannot differentiate between a file and a " "directory. This can lead to unexpected behavior when attempting to read a " @@ -2127,11 +2105,11 @@ msgid "" "meet your needs." msgstr "" -#: ../../library/urllib.request.rst:1598 +#: ../../library/urllib.request.rst:1587 msgid ":mod:`urllib.response` --- Response classes used by urllib" msgstr "" -#: ../../library/urllib.request.rst:1603 +#: ../../library/urllib.request.rst:1592 msgid "" "The :mod:`urllib.response` module defines functions and classes which define " "a minimal file-like interface, including ``read()`` and ``readline()``. " @@ -2140,50 +2118,75 @@ msgid "" "addinfourl` instance:" msgstr "" -#: ../../library/urllib.request.rst:1612 +#: ../../library/urllib.request.rst:1601 msgid "" "URL of the resource retrieved, commonly used to determine if a redirect was " "followed." msgstr "" -#: ../../library/urllib.request.rst:1616 +#: ../../library/urllib.request.rst:1605 msgid "" "Returns the headers of the response in the form of an :class:`~email.message." "EmailMessage` instance." msgstr "" -#: ../../library/urllib.request.rst:1622 +#: ../../library/urllib.request.rst:1611 msgid "Status code returned by server." msgstr "" -#: ../../library/urllib.request.rst:1626 +#: ../../library/urllib.request.rst:1615 msgid "Deprecated in favor of :attr:`~addinfourl.url`." msgstr "" -#: ../../library/urllib.request.rst:1631 +#: ../../library/urllib.request.rst:1620 msgid "Deprecated in favor of :attr:`~addinfourl.headers`." msgstr "" -#: ../../library/urllib.request.rst:1636 ../../library/urllib.request.rst:1641 +#: ../../library/urllib.request.rst:1625 ../../library/urllib.request.rst:1630 msgid "Deprecated in favor of :attr:`~addinfourl.status`." msgstr "" -#: ../../library/urllib.request.rst:1545 ../../library/urllib.request.rst:1568 +#: ../../library/urllib.request.rst:1534 ../../library/urllib.request.rst:1557 msgid "HTTP" msgstr "HTTP" -#: ../../library/urllib.request.rst:1545 ../../library/urllib.request.rst:1568 +#: ../../library/urllib.request.rst:1534 ../../library/urllib.request.rst:1557 msgid "protocol" msgstr "protocol(協定)" -#: ../../library/urllib.request.rst:1545 ../../library/urllib.request.rst:1579 +#: ../../library/urllib.request.rst:1534 ../../library/urllib.request.rst:1568 msgid "FTP" msgstr "FTP" -#: ../../library/urllib.request.rst:1568 +#: ../../library/urllib.request.rst:1557 msgid "HTML" msgstr "HTML" +#~ msgid "" +#~ "The optional *cafile* and *capath* parameters specify a set of trusted CA " +#~ "certificates for HTTPS requests. *cafile* should point to a single file " +#~ "containing a bundle of CA certificates, whereas *capath* should point to " +#~ "a directory of hashed certificate files. More information can be found " +#~ "in :meth:`ssl.SSLContext.load_verify_locations`." +#~ msgstr "" +#~ "選擇性參數 *cafile* 與 *capath* 用來指定一組 HTTPS 請求中所需之受信任 CA " +#~ "憑證。*cafile* 的值應該指向內容包含一堆 CA 憑證的單一檔案,而 *capath* 則" +#~ "指向存放一堆雜湊後的憑證檔案的目錄。欲瞭解更多的資訊請參見 :meth:`ssl." +#~ "SSLContext.load_verify_locations`。" + +#~ msgid "The *cadefault* parameter is ignored." +#~ msgstr "參數 *cadefault* 已被忽略。" + +#~ msgid "" +#~ "*cafile*, *capath* and *cadefault* are deprecated in favor of *context*. " +#~ "Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let :func:" +#~ "`ssl.create_default_context` select the system's trusted CA certificates " +#~ "for you." +#~ msgstr "" +#~ "*cafile*、*capath*、*cadefault* 已經被棄用並應改為使用 *context*。請改用 :" +#~ "meth:`ssl.SSLContext.load_cert_chain`,或是讓 :func:`ssl." +#~ "create_default_context` 選取系統中受信任的 CA 憑證。" + #, fuzzy #~ msgid "" #~ "The default opener raises an auditing event urllib.Request with arguments " diff --git a/library/urllib.robotparser.po b/library/urllib.robotparser.po index 209f618cbf..0d17e17856 100644 --- a/library/urllib.robotparser.po +++ b/library/urllib.robotparser.po @@ -6,7 +6,7 @@ # Phil Lin <linooohon@gmail.com>, 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-01-27 13:40+0800\n" diff --git a/library/uu.po b/library/uu.po deleted file mode 100644 index 55c9f76f32..0000000000 --- a/library/uu.po +++ /dev/null @@ -1,110 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-202# SOME DESCRIPTIVE TITLE., Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-07-20 00:03+0000\n" -"PO-Revision-Date: 2022-05-22 02:22+0800\n" -"Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 3.0.1\n" - -#: ../../library/uu.rst:2 -msgid ":mod:`uu` --- Encode and decode uuencode files" -msgstr ":mod:`xdrlib` --- uuencode 檔案的編碼與解碼" - -#: ../../library/uu.rst:10 -msgid "**Source code:** :source:`Lib/uu.py`" -msgstr "**原始碼:**\\ :source:`Lib/uu.py`" - -#: ../../library/uu.rst:12 -msgid "" -"The :mod:`uu` module is deprecated (see :pep:`PEP 594 <594#uu-and-the-uu-" -"encoding>` for details). :mod:`base64` is a modern alternative." -msgstr "" -":mod:`uu` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 <594#uu-and-the-uu-" -"encoding>`\\ )。:mod:`base64` 是個現時常用的替代方案。" - -#: ../../library/uu.rst:19 -msgid "" -"This module encodes and decodes files in uuencode format, allowing arbitrary " -"binary data to be transferred over ASCII-only connections. Wherever a file " -"argument is expected, the methods accept a file-like object. For backwards " -"compatibility, a string containing a pathname is also accepted, and the " -"corresponding file will be opened for reading and writing; the pathname " -"``'-'`` is understood to mean the standard input or output. However, this " -"interface is deprecated; it's better for the caller to open the file itself, " -"and be sure that, when required, the mode is ``'rb'`` or ``'wb'`` on Windows." -msgstr "" - -#: ../../library/uu.rst:32 -msgid "" -"This code was contributed by Lance Ellinghouse, and modified by Jack Jansen." -msgstr "" - -#: ../../library/uu.rst:34 -msgid "The :mod:`uu` module defines the following functions:" -msgstr "" - -#: ../../library/uu.rst:39 -msgid "" -"Uuencode file *in_file* into file *out_file*. The uuencoded file will have " -"the header specifying *name* and *mode* as the defaults for the results of " -"decoding the file. The default defaults are taken from *in_file*, or ``'-'`` " -"and ``0o666`` respectively. If *backtick* is true, zeros are represented by " -"``'`'`` instead of spaces." -msgstr "" - -#: ../../library/uu.rst:45 -msgid "Added the *backtick* parameter." -msgstr "新增 *backtick* 參數。" - -#: ../../library/uu.rst:51 -msgid "" -"This call decodes uuencoded file *in_file* placing the result on file " -"*out_file*. If *out_file* is a pathname, *mode* is used to set the " -"permission bits if the file must be created. Defaults for *out_file* and " -"*mode* are taken from the uuencode header. However, if the file specified " -"in the header already exists, a :exc:`uu.Error` is raised." -msgstr "" - -#: ../../library/uu.rst:57 -msgid "" -":func:`decode` may print a warning to standard error if the input was " -"produced by an incorrect uuencoder and Python could recover from that " -"error. Setting *quiet* to a true value silences this warning." -msgstr "" - -#: ../../library/uu.rst:64 -msgid "" -"Subclass of :exc:`Exception`, this can be raised by :func:`uu.decode` under " -"various situations, such as described above, but also including a badly " -"formatted header, or truncated input file." -msgstr "" - -#: ../../library/uu.rst:71 -msgid "Module :mod:`binascii`" -msgstr ":mod:`binascii` 模組" - -#: ../../library/uu.rst:72 -msgid "" -"Support module containing ASCII-to-binary and binary-to-ASCII conversions." -msgstr "" - -#: ../../library/uu.rst:28 -msgid "Jansen, Jack" -msgstr "Jansen, Jack" - -#: ../../library/uu.rst:28 -msgid "Ellinghouse, Lance" -msgstr "Ellinghouse, Lance" diff --git a/library/uuid.po b/library/uuid.po index 1f2ff6001f..e3274d2fbf 100644 --- a/library/uuid.po +++ b/library/uuid.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" diff --git a/library/venv.po b/library/venv.po index 0935137cd3..ab4f0f4050 100644 --- a/library/venv.po +++ b/library/venv.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-30 09:19+0000\n" "PO-Revision-Date: 2023-07-09 15:09+0800\n" "Last-Translator: Po-Chuan Chen <present90308@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -59,8 +59,8 @@ msgstr "" #: ../../library/venv.rst:40 msgid "" -"Contained in a directory, conventionally either named ``venv`` or ``.venv`` " -"in the project directory, or under a container directory for lots of virtual " +"Contained in a directory, conventionally named ``.venv`` or ``venv`` in the " +"project directory, or under a container directory for lots of virtual " "environments, such as ``~/.virtualenvs``." msgstr "" @@ -71,7 +71,7 @@ msgstr "" #: ../../library/venv.rst:46 msgid "" "Considered as disposable -- it should be simple to delete and recreate it " -"from scratch. You don't place any project code in the environment" +"from scratch. You don't place any project code in the environment." msgstr "" #: ../../library/venv.rst:49 @@ -91,95 +91,81 @@ msgid "" "environments/#create-and-use-virtual-environments>`__" msgstr "" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability <availability>`: not Emscripten, not WASI." -msgstr "" +#: ../../includes/wasm-mobile-notavail.rst:3 +msgid ":ref:`Availability <availability>`: not Android, not iOS, not WASI." +msgstr ":ref:`適用 <availability>`:非 Android、非 iOS、非 WASI。" -#: ../../includes/wasm-notavail.rst:5 +#: ../../includes/wasm-mobile-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module is not supported on :ref:`mobile platforms <mobile-" +"availability>` or :ref:`WebAssembly platforms <wasm-availability>`." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在\\ :ref:`行動平台 <mobile-availability>`\\ 或\\ :ref:`WebAssembly 平" +"台 <wasm-availability>`\\ 上不支援。" #: ../../library/venv.rst:62 msgid "Creating virtual environments" msgstr "建立虛擬環境" -#: ../../using/venv-create.inc:1 +#: ../../library/venv.rst:64 msgid "" -"Creation of :ref:`virtual environments <venv-def>` is done by executing the " -"command ``venv``::" -msgstr "建立\\ :ref:`虛擬環境 <venv-def>`\\ 的方法是透過執行指令 ``venv``:" +":ref:`Virtual environments <venv-def>` are created by executing the ``venv`` " +"module:" +msgstr ":ref:`虛擬環境 <venv-def>`\\ 是透過執行 ``venv`` 模組來建立:" -#: ../../using/venv-create.inc:4 +#: ../../library/venv.rst:67 msgid "python -m venv /path/to/new/virtual/environment" msgstr "python -m venv /path/to/new/virtual/environment" -#: ../../using/venv-create.inc:6 +#: ../../library/venv.rst:71 msgid "" -"Running this command creates the target directory (creating any parent " -"directories that don't exist already) and places a ``pyvenv.cfg`` file in it " -"with a ``home`` key pointing to the Python installation from which the " -"command was run (a common name for the target directory is ``.venv``). It " -"also creates a ``bin`` (or ``Scripts`` on Windows) subdirectory containing a " -"copy/symlink of the Python binary/binaries (as appropriate for the platform " -"or arguments used at environment creation time). It also creates an " -"(initially empty) ``lib/pythonX.Y/site-packages`` subdirectory (on Windows, " -"this is ``Lib\\site-packages``). If an existing directory is specified, it " -"will be re-used." +"This creates the target directory (including parent directories as needed) " +"and places a :file:`pyvenv.cfg` file in it with a ``home`` key pointing to " +"the Python installation from which the command was run. It also creates a :" +"file:`bin` (or :file:`Scripts` on Windows) subdirectory containing a copy or " +"symlink of the Python executable (as appropriate for the platform or " +"arguments used at environment creation time). It also creates a :file:`lib/" +"pythonX.Y/site-packages` subdirectory (on Windows, this is :file:`Lib\\site-" +"packages`). If an existing directory is specified, it will be re-used." msgstr "" "執行此命令會建立目標目錄(同時也會建立任何還不存在的父目錄)並在目錄中放置一" -"個名為 ``pyvenv.cfg`` 的檔案,其中包含一個指向執行該命令的 Python 安裝路徑的 " -"``home`` 鍵(目標目錄的常見名稱為 ``.venv``)。同時,它會建立一個 ``bin`` " -"(在 Windows 上為 ``Scripts``)子目錄,其中包含一個 Python 二進位檔案的副本/" -"符號連結(根據建立環境時使用的平台或引數而定)。此外,它還會建立一個(最初為" -"空的) ``lib/pythonX.Y/site-packages`` 子目錄(在 Windows 上為 ``Lib\\site-" -"packages``)。如果指定的目錄已存在,則將重新使用該目錄。" +"個名為 :file:`pyvenv.cfg` 的檔案,其中包含一個指向執行該命令的 Python 安裝路" +"徑的 ``home`` 鍵。它同時會建立一個 :file:`bin` (在 Windows 上為 :file:" +"`Scripts`)子目錄,其中包含一個 Python 二進位檔案的副本/符號連結(根據建立環" +"境時使用的平台或引數而定)。此外,它還會建立一個 :file:`lib/pythonX.Y/site-" +"packages` 子目錄(在 Windows 上為 :file:`Lib\\site-packages`)。如果指定的目" +"錄已存在,則將重新使用該目錄。" -#: ../../using/venv-create.inc:17 +#: ../../library/venv.rst:81 msgid "" "The use of ``venv`` is now recommended for creating virtual environments." msgstr "目前建議使用 ``venv`` 來建立虛擬環境。" -#: ../../using/venv-create.inc:20 +#: ../../library/venv.rst:84 msgid "" -"``pyvenv`` was the recommended tool for creating virtual environments for " -"Python 3.3 and 3.4, and is :ref:`deprecated in Python 3.6 <whatsnew36-venv>`." +":program:`pyvenv` was the recommended tool for creating virtual environments " +"for Python 3.3 and 3.4, and replaced in 3.5 by executing ``venv`` directly." msgstr "" -"``pyvenv`` 是在 Python 3.3 和 3.4 中建立虛擬環境的推薦工具,但在 Python 3.6 " -"中已被\\ :ref:`棄用 <whatsnew36-venv>`。" +":program:`pyvenv` 是在 Python 3.3 和 3.4 中建立虛擬環境的推薦工具,但在 " +"Python 3.5 中已被直接執行 ``venv`` 所取代。" -#: ../../using/venv-create.inc:27 -msgid "On Windows, invoke the ``venv`` command as follows::" +#: ../../library/venv.rst:90 +msgid "On Windows, invoke the ``venv`` command as follows:" msgstr "在 Windows 上,執行以下命令以使用 ``venv``:" -#: ../../using/venv-create.inc:29 -msgid "c:\\>Python35\\python -m venv c:\\path\\to\\myenv" -msgstr "c:\\>Python35\\python -m venv c:\\path\\to\\myenv" - -#: ../../using/venv-create.inc:31 -msgid "" -"Alternatively, if you configured the ``PATH`` and ``PATHEXT`` variables for " -"your :ref:`Python installation <using-on-windows>`::" -msgstr "" -"或者,如你已經為你的 :ref:`Python 安裝 <using-on-windows>`\\ 配置了 ``PATH`` " -"和 ``PATHEXT`` 變數,則可以執行以下命令:" - -#: ../../using/venv-create.inc:34 -msgid "c:\\>python -m venv c:\\path\\to\\myenv" -msgstr "c:\\>python -m venv c:\\path\\to\\myenv" +#: ../../library/venv.rst:92 +msgid "PS> python -m venv C:\\path\\to\\new\\virtual\\environment" +msgstr "PS> python -m venv C:\\path\\to\\new\\virtual\\environment" -#: ../../using/venv-create.inc:36 +#: ../../library/venv.rst:96 msgid "The command, if run with ``-h``, will show the available options::" msgstr "如果使用 ``-h`` 選項執行該命令,將會顯示可用的選項:" -#: ../../using/venv-create.inc:38 +#: ../../library/venv.rst:98 msgid "" "usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]\n" " [--upgrade] [--without-pip] [--prompt PROMPT] [--upgrade-deps]\n" +" [--without-scm-ignore-files]\n" " ENV_DIR [ENV_DIR ...]\n" "\n" "Creates virtual Python environments in one or more target directories.\n" @@ -187,35 +173,36 @@ msgid "" "positional arguments:\n" " ENV_DIR A directory to create the environment in.\n" "\n" -"optional arguments:\n" +"options:\n" " -h, --help show this help message and exit\n" " --system-site-packages\n" " Give the virtual environment access to the system\n" " site-packages dir.\n" -" --symlinks Try to use symlinks rather than copies, when " -"symlinks\n" -" are not the default for the platform.\n" +" --symlinks Try to use symlinks rather than copies, when\n" +" symlinks are not the default for the platform.\n" " --copies Try to use copies rather than symlinks, even when\n" " symlinks are the default for the platform.\n" -" --clear Delete the contents of the environment directory if " -"it\n" -" already exists, before environment creation.\n" -" --upgrade Upgrade the environment directory to use this " -"version\n" -" of Python, assuming Python has been upgraded in-" -"place.\n" +" --clear Delete the contents of the environment directory\n" +" if it already exists, before environment creation.\n" +" --upgrade Upgrade the environment directory to use this\n" +" version of Python, assuming Python has been\n" +" upgraded in-place.\n" " --without-pip Skips installing or upgrading pip in the virtual\n" " environment (pip is bootstrapped by default)\n" " --prompt PROMPT Provides an alternative prompt prefix for this\n" " environment.\n" -" --upgrade-deps Upgrade core dependencies (pip) to the\n" -" latest version in PyPI\n" +" --upgrade-deps Upgrade core dependencies (pip) to the latest\n" +" version in PyPI\n" +" --without-scm-ignore-files\n" +" Skips adding SCM ignore files to the environment\n" +" directory (Git is supported by default).\n" "\n" "Once an environment has been created, you may wish to activate it, e.g. by\n" "sourcing an activate script in its bin directory." msgstr "" "usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear]\n" " [--upgrade] [--without-pip] [--prompt PROMPT] [--upgrade-deps]\n" +" [--without-scm-ignore-files]\n" " ENV_DIR [ENV_DIR ...]\n" "\n" "Creates virtual Python environments in one or more target directories.\n" @@ -223,51 +210,40 @@ msgstr "" "positional arguments:\n" " ENV_DIR A directory to create the environment in.\n" "\n" -"optional arguments:\n" +"options:\n" " -h, --help show this help message and exit\n" " --system-site-packages\n" " Give the virtual environment access to the system\n" " site-packages dir.\n" -" --symlinks Try to use symlinks rather than copies, when " -"symlinks\n" -" are not the default for the platform.\n" +" --symlinks Try to use symlinks rather than copies, when\n" +" symlinks are not the default for the platform.\n" " --copies Try to use copies rather than symlinks, even when\n" " symlinks are the default for the platform.\n" -" --clear Delete the contents of the environment directory if " -"it\n" -" already exists, before environment creation.\n" -" --upgrade Upgrade the environment directory to use this " -"version\n" -" of Python, assuming Python has been upgraded in-" -"place.\n" +" --clear Delete the contents of the environment directory\n" +" if it already exists, before environment creation.\n" +" --upgrade Upgrade the environment directory to use this\n" +" version of Python, assuming Python has been\n" +" upgraded in-place.\n" " --without-pip Skips installing or upgrading pip in the virtual\n" " environment (pip is bootstrapped by default)\n" " --prompt PROMPT Provides an alternative prompt prefix for this\n" " environment.\n" -" --upgrade-deps Upgrade core dependencies (pip) to the\n" -" latest version in PyPI\n" +" --upgrade-deps Upgrade core dependencies (pip) to the latest\n" +" version in PyPI\n" +" --without-scm-ignore-files\n" +" Skips adding SCM ignore files to the environment\n" +" directory (Git is supported by default).\n" "\n" "Once an environment has been created, you may wish to activate it, e.g. by\n" "sourcing an activate script in its bin directory." -#: ../../library/venv.rst:313 ../../using/venv-create.inc:72 -msgid "``setuptools`` is no longer a core venv dependency." -msgstr "" - -#: ../../using/venv-create.inc:74 -msgid "" -"Add ``--upgrade-deps`` option to upgrade pip + setuptools to the latest on " -"PyPI" -msgstr "" -"新增 ``--upgrade-deps`` 選項以將 pip 和 setuptools 升級至 PyPI 上的最新版本" - -#: ../../using/venv-create.inc:77 +#: ../../library/venv.rst:136 msgid "" "Installs pip by default, added the ``--without-pip`` and ``--copies`` " -"options" -msgstr "預設情況下安裝 pip,並新增了 ``--without-pip`` 和 ``--copies`` 選項" +"options." +msgstr "預設會安裝 pip,並新增了 ``--without-pip`` 和 ``--copies`` 選項" -#: ../../using/venv-create.inc:81 +#: ../../library/venv.rst:140 msgid "" "In earlier versions, if the target directory already existed, an error was " "raised, unless the ``--clear`` or ``--upgrade`` option was provided." @@ -275,7 +251,26 @@ msgstr "" "在較早的版本中,如果目標目錄已存在,除非提供了 ``--clear`` 或 ``--upgrade`` " "選項,否則會引發錯誤。" -#: ../../using/venv-create.inc:86 +#: ../../library/venv.rst:144 +msgid "" +"Add ``--upgrade-deps`` option to upgrade pip + setuptools to the latest on " +"PyPI." +msgstr "" +"新增 ``--upgrade-deps`` 選項以將 pip 和 setuptools 升級至 PyPI 上的最新版本" + +#: ../../library/venv.rst:149 +msgid "``setuptools`` is no longer a core venv dependency." +msgstr "" + +#: ../../library/venv.rst:153 +msgid "Added the ``--without-scm-ignore-files`` option." +msgstr "新增 ``--without-scm-ignore-files`` 選項" + +#: ../../library/venv.rst:154 +msgid "``venv`` now creates a :file:`.gitignore` file for Git by default." +msgstr "" + +#: ../../library/venv.rst:158 msgid "" "While symlinks are supported on Windows, they are not recommended. Of " "particular note is that double-clicking ``python.exe`` in File Explorer will " @@ -284,7 +279,7 @@ msgstr "" "雖然在 Windows 上支援符號連結,但並不建議使用。特別需要注意的是,在檔案總管中" "按兩下 ``python.exe`` 會急切地解析符號連結並忽略虛擬環境。" -#: ../../using/venv-create.inc:91 +#: ../../library/venv.rst:163 msgid "" "On Microsoft Windows, it may be required to enable the ``Activate.ps1`` " "script by setting the execution policy for the user. You can do this by " @@ -293,12 +288,13 @@ msgstr "" "在 Microsoft Windows 上,可能需要通過設置使用者的執行策略來啟用 ``Activate." "ps1`` 腳本。你可以發出以下 PowerShell 命令來執行此操作:" -#: ../../using/venv-create.inc:95 +#: ../../library/venv.rst:167 msgid "" "PS C:\\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser" msgstr "" +"PS C:\\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser" -#: ../../using/venv-create.inc:97 +#: ../../library/venv.rst:171 msgid "" "See `About Execution Policies <https://go.microsoft.com/fwlink/?" "LinkID=135170>`_ for more information." @@ -306,17 +302,17 @@ msgstr "" "有關更多資訊,請參閱\\ `關於執行策略 <https://go.microsoft.com/fwlink/?" "LinkID=135170>`_。" -#: ../../using/venv-create.inc:101 +#: ../../library/venv.rst:175 msgid "" -"The created ``pyvenv.cfg`` file also includes the ``include-system-site-" +"The created :file:`pyvenv.cfg` file also includes the ``include-system-site-" "packages`` key, set to ``true`` if ``venv`` is run with the ``--system-site-" "packages`` option, ``false`` otherwise." msgstr "" -"被建立的 ``pyvenv.cfg`` 檔案還包括了 ``include-system-site-packages`` 的鍵," -"如果使用 ``venv`` 執行時帶有 ``--system-site-packages`` 選項,則設置為 " +"被建立的 :file:`pyvenv.cfg` 檔案還包括了 ``include-system-site-packages`` 的" +"鍵,如果使用 ``venv`` 執行時帶有 ``--system-site-packages`` 選項,則設置為 " "``true``,否則設置為 ``false``。" -#: ../../using/venv-create.inc:105 +#: ../../library/venv.rst:179 msgid "" "Unless the ``--without-pip`` option is given, :mod:`ensurepip` will be " "invoked to bootstrap ``pip`` into the virtual environment." @@ -324,7 +320,7 @@ msgstr "" "除非 ``--without-pip`` 選項被提供,否則將調用 :mod:`ensurepip` 來啟動 " "``pip`` 到虛擬環境中。" -#: ../../using/venv-create.inc:108 +#: ../../library/venv.rst:182 msgid "" "Multiple paths can be given to ``venv``, in which case an identical virtual " "environment will be created, according to the given options, at each " @@ -333,11 +329,11 @@ msgstr "" "可以向 ``venv`` 提供多個路徑,這樣每個提供的路徑都將根據給定的選項建立一個相" "同的虛擬環境。" -#: ../../library/venv.rst:69 +#: ../../library/venv.rst:189 msgid "How venvs work" msgstr "虛擬環境如何運作" -#: ../../library/venv.rst:71 +#: ../../library/venv.rst:191 msgid "" "When a Python interpreter is running from a virtual environment, :data:`sys." "prefix` and :data:`sys.exec_prefix` point to the directories of the virtual " @@ -351,7 +347,7 @@ msgstr "" "base_exec_prefix` 會指向建立虛擬環境的基礎 Python 的目錄。檢查 ``sys.prefix !" "= sys.base_prefix`` 就可以確定目前的直譯器是否跑在虛擬環境中。" -#: ../../library/venv.rst:80 +#: ../../library/venv.rst:200 msgid "" "A virtual environment may be \"activated\" using a script in its binary " "directory (``bin`` on POSIX; ``Scripts`` on Windows). This will prepend that " @@ -367,81 +363,81 @@ msgstr "" "用完整的路徑。啟動腳本的方式因平台而異(:samp:`{<venv>}` 需要替換成包含虛擬環" "境的目錄路徑)" -#: ../../library/venv.rst:90 +#: ../../library/venv.rst:210 msgid "Platform" msgstr "平台" -#: ../../library/venv.rst:90 +#: ../../library/venv.rst:210 msgid "Shell" msgstr "Shell" -#: ../../library/venv.rst:90 +#: ../../library/venv.rst:210 msgid "Command to activate virtual environment" msgstr "啟動虛擬環境的指令" -#: ../../library/venv.rst:92 +#: ../../library/venv.rst:212 msgid "POSIX" msgstr "POSIX" -#: ../../library/venv.rst:92 +#: ../../library/venv.rst:212 msgid "bash/zsh" msgstr "bash/zsh" -#: ../../library/venv.rst:92 +#: ../../library/venv.rst:212 msgid ":samp:`$ source {<venv>}/bin/activate`" msgstr ":samp:`$ source {<venv>}/bin/activate`" -#: ../../library/venv.rst:94 +#: ../../library/venv.rst:214 msgid "fish" msgstr "fish" -#: ../../library/venv.rst:94 +#: ../../library/venv.rst:214 msgid ":samp:`$ source {<venv>}/bin/activate.fish`" msgstr ":samp:`$ source {<venv>}/bin/activate.fish`" -#: ../../library/venv.rst:96 +#: ../../library/venv.rst:216 msgid "csh/tcsh" msgstr "csh/tcsh" -#: ../../library/venv.rst:96 +#: ../../library/venv.rst:216 msgid ":samp:`$ source {<venv>}/bin/activate.csh`" msgstr ":samp:`$ source {<venv>}/bin/activate.csh`" -#: ../../library/venv.rst:98 ../../library/venv.rst:102 +#: ../../library/venv.rst:218 ../../library/venv.rst:222 msgid "PowerShell" msgstr "PowerShell" -#: ../../library/venv.rst:98 +#: ../../library/venv.rst:218 msgid ":samp:`$ {<venv>}/bin/Activate.ps1`" msgstr ":samp:`$ {<venv>}/bin/Activate.ps1`" -#: ../../library/venv.rst:100 +#: ../../library/venv.rst:220 msgid "Windows" msgstr "Windows" -#: ../../library/venv.rst:100 +#: ../../library/venv.rst:220 msgid "cmd.exe" msgstr "cmd.exe" -#: ../../library/venv.rst:100 +#: ../../library/venv.rst:220 msgid ":samp:`C:\\\\> {<venv>}\\\\Scripts\\\\activate.bat`" msgstr ":samp:`C:\\\\> {<venv>}\\\\Scripts\\\\activate.bat`" -#: ../../library/venv.rst:102 +#: ../../library/venv.rst:222 msgid ":samp:`PS C:\\\\> {<venv>}\\\\Scripts\\\\Activate.ps1`" msgstr ":samp:`PS C:\\\\> {<venv>}\\\\Scripts\\\\Activate.ps1`" -#: ../../library/venv.rst:105 +#: ../../library/venv.rst:225 msgid ":program:`fish` and :program:`csh` activation scripts." msgstr ":program:`fish` 和 :program:`csh` 啟動腳本。" -#: ../../library/venv.rst:108 +#: ../../library/venv.rst:228 msgid "" "PowerShell activation scripts installed under POSIX for PowerShell Core " "support." msgstr "PowerShell 的啟動腳本安裝在 POSIX 上支援 PowerShell Core。" -#: ../../library/venv.rst:112 +#: ../../library/venv.rst:232 msgid "" "You don't specifically *need* to activate a virtual environment, as you can " "just specify the full path to that environment's Python interpreter when " @@ -452,25 +448,25 @@ msgstr "" "整路徑。此外,所有安裝在環境裡的腳本都應該都可以在未啟用虛擬環境的情況下運" "行。" -#: ../../library/venv.rst:118 +#: ../../library/venv.rst:238 msgid "" "In order to achieve this, scripts installed into virtual environments have a " -"\"shebang\" line which points to the environment's Python interpreter, i.e. :" -"samp:`#!/{<path-to-venv>}/bin/python`. This means that the script will run " -"with that interpreter regardless of the value of :envvar:`PATH`. On Windows, " +"\"shebang\" line which points to the environment's Python interpreter, :samp:" +"`#!/{<path-to-venv>}/bin/python`. This means that the script will run with " +"that interpreter regardless of the value of :envvar:`PATH`. On Windows, " "\"shebang\" line processing is supported if you have the :ref:`launcher` " "installed. Thus, double-clicking an installed script in a Windows Explorer " "window should run it with the correct interpreter without the environment " "needing to be activated or on the :envvar:`PATH`." msgstr "" "為了實現這一點,安裝在虛擬環境中的腳本會有一個 \"shebang\" 列,此列指向該環境" -"的 Python 直譯器,例如: :samp:`#!/{<path-to-venv>}/bin/python`。這代表無論 :" -"envvar:`PATH` 的值為何,該腳本都會在直譯器上運行。在 Windows 上,如果你安裝" -"了 :ref:`launcher`,則支援 \"shebang\" 列處理。因此,在 Windows 檔案總管" -"(Windows Explorer)中雙擊已安裝的腳本,應該可以在沒有啟用環境或將其加入 :" -"envvar:`PATH` 的情況下正確地運行。" +"的 Python 直譯器 :samp:`#!/{<path-to-venv>}/bin/python`。這代表無論 :envvar:" +"`PATH` 的值為何,該腳本都會在直譯器上運行。在 Windows 上,如果你安裝了 :ref:" +"`launcher`,則支援 \"shebang\" 列處理。因此,在 Windows 檔案總管(Windows " +"Explorer)中雙擊已安裝的腳本,應該可以在沒有啟用環境或將其加入 :envvar:" +"`PATH` 的情況下正確地運行。" -#: ../../library/venv.rst:127 +#: ../../library/venv.rst:247 msgid "" "When a virtual environment has been activated, the :envvar:`!VIRTUAL_ENV` " "environment variable is set to the path of the environment. Since explicitly " @@ -482,7 +478,7 @@ msgstr "" "於不需要明確啟用虛擬環境才能使用它。因此,無法依賴 :envvar:`!VIRTUAL_ENV` 來" "判斷是否正在使用虛擬環境。" -#: ../../library/venv.rst:133 +#: ../../library/venv.rst:253 msgid "" "Because scripts installed in environments should not expect the environment " "to be activated, their shebang lines contain the absolute paths to their " @@ -505,7 +501,7 @@ msgstr "" "位置重新建立它,並刪除舊位置的環境。如果你移動環境是因為移動了其父目錄,你應" "該在新位置重新建立環境。否則,安裝在該環境中的軟體可能無法正常運作。" -#: ../../library/venv.rst:147 +#: ../../library/venv.rst:267 msgid "" "You can deactivate a virtual environment by typing ``deactivate`` in your " "shell. The exact mechanism is platform-specific and is an internal " @@ -514,11 +510,11 @@ msgstr "" "你可以在 shell 輸入 ``deactivate`` 來關閉虛擬環境。具體的使用方式因平台而異," "是內部實作的細節(通常會使用腳本或是 shell 函式)" -#: ../../library/venv.rst:155 +#: ../../library/venv.rst:275 msgid "API" msgstr "API" -#: ../../library/venv.rst:159 +#: ../../library/venv.rst:279 msgid "" "The high-level method described above makes use of a simple API which " "provides mechanisms for third-party virtual environment creators to " @@ -528,95 +524,98 @@ msgstr "" "上述提到的高階 method(方法)透過簡單的 API 使用, 為第三方虛擬環境建立者提供" "可以依據他們需求來建立環境的客製化機制: :class:`EnvBuilder` class。" -#: ../../library/venv.rst:167 +#: ../../library/venv.rst:288 msgid "" "The :class:`EnvBuilder` class accepts the following keyword arguments on " "instantiation:" msgstr "進行實例化時,class :class:`EnvBuilder` 接受下列的關鍵字引數:" -#: ../../library/venv.rst:170 +#: ../../library/venv.rst:291 msgid "" -"``system_site_packages`` -- a Boolean value indicating that the system " -"Python site-packages should be available to the environment (defaults to " -"``False``)." +"*system_site_packages* -- a boolean value indicating that the system Python " +"site-packages should be available to the environment (defaults to ``False``)." msgstr "" -"``system_site_packages`` -- 為一個 Boolean (布林值),並表明系統的 Python " +"*system_site_packages* -- 為一個 boolean (布林值),並表明系統的 Python " "site-packages 是否可以在環境中可用(預設為 ``False`` )。" -#: ../../library/venv.rst:173 +#: ../../library/venv.rst:294 msgid "" -"``clear`` -- a Boolean value which, if true, will delete the contents of any " +"*clear* -- a boolean value which, if true, will delete the contents of any " "existing target directory, before creating the environment." msgstr "" -"``clear`` -- 為一個 Boolean,如果為 true,則在建立環境之前,刪除目標目錄內所" -"有存在的內容。" +"*clear* -- 為一個 boolean,如果為 true,則在建立環境之前,刪除目標目錄內所有" +"存在的內容。" -#: ../../library/venv.rst:176 +#: ../../library/venv.rst:297 msgid "" -"``symlinks`` -- a Boolean value indicating whether to attempt to symlink the " +"*symlinks* -- a boolean value indicating whether to attempt to symlink the " "Python binary rather than copying." msgstr "" -"``symlinks`` -- 為一個 Boolean,並表明是否嘗試與 Python 二進位檔案建立符號連" -"結而不是複製該檔案。" +"*symlinks* -- 為一個 boolean,並表明是否嘗試與 Python 二進位檔案建立符號連結" +"而不是複製該檔案。" -#: ../../library/venv.rst:179 +#: ../../library/venv.rst:300 msgid "" -"``upgrade`` -- a Boolean value which, if true, will upgrade an existing " +"*upgrade* -- a boolean value which, if true, will upgrade an existing " "environment with the running Python - for use when that Python has been " "upgraded in-place (defaults to ``False``)." msgstr "" -"``upgrade`` -- 為一個 Boolean,若為 true,則會在執行 Python 時為現有的環境進" -"行升級。目的是讓 Python 可以升級到位(預設為 ``False``)。" +"*upgrade* -- 為一個 boolean,若為 true,則會在執行 Python 時為現有的環境進行" +"升級。目的是讓 Python 可以升級到位(預設為 ``False``)。" -#: ../../library/venv.rst:183 +#: ../../library/venv.rst:304 msgid "" -"``with_pip`` -- a Boolean value which, if true, ensures pip is installed in " +"*with_pip* -- a boolean value which, if true, ensures pip is installed in " "the virtual environment. This uses :mod:`ensurepip` with the ``--default-" "pip`` option." msgstr "" -"``with_pip`` -- 為一個 Boolean,若為 true,則確保 pip 有安裝至虛擬環境之中。" -"當有 ``--default-pip`` 的選項時,會使用 :mod:`ensurepip`。" +"*with_pip* -- 為一個 boolean,若為 true,則確保 pip 有安裝至虛擬環境之中。當" +"有 ``--default-pip`` 的選項時,會使用 :mod:`ensurepip`。" -#: ../../library/venv.rst:187 +#: ../../library/venv.rst:308 msgid "" -"``prompt`` -- a String to be used after virtual environment is activated " +"*prompt* -- a string to be used after virtual environment is activated " "(defaults to ``None`` which means directory name of the environment would be " "used). If the special string ``\".\"`` is provided, the basename of the " "current directory is used as the prompt." msgstr "" -"``prompt`` -- 為一個 String(字串),該字串會在虛擬環境啟動時被使用。(預設" -"為 ``None``,代表該環境的目錄名稱會被使用)倘若出現特殊字串 ``\".\"`` ,則當" -"前目錄的 basename 會做為提示路徑使用。" +"*prompt* -- 為一個 String(字串),該字串會在虛擬環境啟動時被使用。(預設為 " +"``None``,代表該環境的目錄名稱會被使用)倘若出現特殊字串 ``\".\"`` ,則當前目" +"錄的 basename 會做為提示路徑使用。" -#: ../../library/venv.rst:192 -msgid "``upgrade_deps`` -- Update the base venv modules to the latest on PyPI" -msgstr "``upgrade_deps`` -- 更新基礎 venv 模組至 PyPI 的最新版本" +#: ../../library/venv.rst:313 +msgid "*upgrade_deps* -- Update the base venv modules to the latest on PyPI" +msgstr "*upgrade_deps* -- 更新基礎 venv 模組至 PyPI 的最新版本" -#: ../../library/venv.rst:194 ../../library/venv.rst:372 +#: ../../library/venv.rst:315 +msgid "" +"*scm_ignore_files* -- Create ignore files based for the specified source " +"control managers (SCM) in the iterable. Support is defined by having a " +"method named ``create_{scm}_ignore_file``. The only value supported by " +"default is ``\"git\"`` via :meth:`create_git_ignore_file`." +msgstr "" + +#: ../../library/venv.rst:321 msgid "Added the ``with_pip`` parameter" msgstr "新增 ``with_pip`` 參數" -#: ../../library/venv.rst:197 ../../library/venv.rst:375 +#: ../../library/venv.rst:324 msgid "Added the ``prompt`` parameter" msgstr "新增 ``prompt`` 參數" -#: ../../library/venv.rst:200 ../../library/venv.rst:378 +#: ../../library/venv.rst:327 msgid "Added the ``upgrade_deps`` parameter" msgstr "新增 ``upgrade_deps`` 參數" -#: ../../library/venv.rst:203 -msgid "" -"Creators of third-party virtual environment tools will be free to use the " -"provided :class:`EnvBuilder` class as a base class." -msgstr "" -"第三方虛擬環境工具的建立者可以自由地使用 :class:`EnvBuilder` class 作為 base " -"class(基底類別)使用." +#: ../../library/venv.rst:330 +msgid "Added the ``scm_ignore_files`` parameter" +msgstr "新增 ``scm_ignore_files`` 參數" -#: ../../library/venv.rst:206 -msgid "The returned env-builder is an object which has a method, ``create``:" -msgstr "回傳的 env-builder 為一個物件,且帶有一個 method ``create``:" +#: ../../library/venv.rst:333 +msgid ":class:`EnvBuilder` may be used as a base class." +msgstr "" -#: ../../library/venv.rst:210 +#: ../../library/venv.rst:337 msgid "" "Create a virtual environment by specifying the target directory (absolute or " "relative to the current directory) which is to contain the virtual " @@ -627,7 +626,7 @@ msgstr "" "目錄),也就是在該目錄中容納虛擬環境。``create`` method 將會在指定的目錄下建" "立環境,或是觸發適當的例外。" -#: ../../library/venv.rst:216 +#: ../../library/venv.rst:343 msgid "" "The ``create`` method of the :class:`EnvBuilder` class illustrates the hooks " "available for subclass customization::" @@ -635,7 +634,7 @@ msgstr "" ":class:`EnvBuilder` class 的 ``create`` method 會闡述可用的 Hooks 以客製化 " "subclass (子類別)::" -#: ../../library/venv.rst:219 +#: ../../library/venv.rst:346 msgid "" "def create(self, env_dir):\n" " \"\"\"\n" @@ -650,7 +649,7 @@ msgid "" " self.post_setup(context)" msgstr "" -#: ../../library/venv.rst:231 +#: ../../library/venv.rst:358 msgid "" "Each of the methods :meth:`ensure_directories`, :meth:" "`create_configuration`, :meth:`setup_python`, :meth:`setup_scripts` and :" @@ -659,7 +658,7 @@ msgstr "" "每個 methods :meth:`ensure_directories`、:meth:`create_configuration`、:meth:" "`setup_python`、:meth:`setup_scripts` 及 :meth:`post_setup` 都可以被覆寫。" -#: ../../library/venv.rst:237 +#: ../../library/venv.rst:364 msgid "" "Creates the environment directory and all necessary subdirectories that " "don't already exist, and returns a context object. This context object is " @@ -673,7 +672,7 @@ msgstr "" "class:`EnvBuilder` 已被建立且帶有 ``clear=True`` 的引數,該環境目錄下的內容將" "被清空,以及所有必要的子目錄將被重新建立。" -#: ../../library/venv.rst:244 +#: ../../library/venv.rst:371 msgid "" "The returned context object is a :class:`types.SimpleNamespace` with the " "following attributes:" @@ -681,81 +680,81 @@ msgstr "" "回傳的情境物件(context object)其型別會是 :class:`types.SimpleNamespace`,並" "包含以下屬性:" -#: ../../library/venv.rst:247 +#: ../../library/venv.rst:374 msgid "" "``env_dir`` - The location of the virtual environment. Used for " "``__VENV_DIR__`` in activation scripts (see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:250 +#: ../../library/venv.rst:377 msgid "" "``env_name`` - The name of the virtual environment. Used for " "``__VENV_NAME__`` in activation scripts (see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:253 +#: ../../library/venv.rst:380 msgid "" "``prompt`` - The prompt to be used by the activation scripts. Used for " "``__VENV_PROMPT__`` in activation scripts (see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:256 +#: ../../library/venv.rst:383 msgid "" "``executable`` - The underlying Python executable used by the virtual " "environment. This takes into account the case where a virtual environment is " "created from another virtual environment." msgstr "" -#: ../../library/venv.rst:260 +#: ../../library/venv.rst:387 msgid "``inc_path`` - The include path for the virtual environment." msgstr "" -#: ../../library/venv.rst:262 +#: ../../library/venv.rst:389 msgid "``lib_path`` - The purelib path for the virtual environment." msgstr "" -#: ../../library/venv.rst:264 +#: ../../library/venv.rst:391 msgid "``bin_path`` - The script path for the virtual environment." -msgstr "" +msgstr "``bin_path`` - 虛擬環境的腳本路徑。" -#: ../../library/venv.rst:266 +#: ../../library/venv.rst:393 msgid "" "``bin_name`` - The name of the script path relative to the virtual " "environment location. Used for ``__VENV_BIN_NAME__`` in activation scripts " "(see :meth:`install_scripts`)." msgstr "" -#: ../../library/venv.rst:270 +#: ../../library/venv.rst:397 msgid "" "``env_exe`` - The name of the Python interpreter in the virtual environment. " "Used for ``__VENV_PYTHON__`` in activation scripts (see :meth:" "`install_scripts`)." msgstr "" -#: ../../library/venv.rst:274 +#: ../../library/venv.rst:401 msgid "" "``env_exec_cmd`` - The name of the Python interpreter, taking into account " "filesystem redirections. This can be used to run Python in the virtual " "environment." msgstr "" -#: ../../library/venv.rst:279 +#: ../../library/venv.rst:406 msgid "" "The *venv* :ref:`sysconfig installation scheme <installation_paths>` is used " "to construct the paths of the created directories." msgstr "" -#: ../../library/venv.rst:284 +#: ../../library/venv.rst:411 msgid "" "The attribute ``lib_path`` was added to the context, and the context object " "was documented." msgstr "" -#: ../../library/venv.rst:290 +#: ../../library/venv.rst:417 msgid "Creates the ``pyvenv.cfg`` configuration file in the environment." -msgstr "" +msgstr "在環境中建立 ``pyvenv.cfg`` 設定檔。" -#: ../../library/venv.rst:294 +#: ../../library/venv.rst:421 msgid "" "Creates a copy or symlink to the Python executable in the environment. On " "POSIX systems, if a specific executable ``python3.x`` was used, symlinks to " @@ -763,114 +762,140 @@ msgid "" "unless files with those names already exist." msgstr "" -#: ../../library/venv.rst:301 +#: ../../library/venv.rst:428 msgid "" "Installs activation scripts appropriate to the platform into the virtual " "environment." msgstr "" -#: ../../library/venv.rst:306 +#: ../../library/venv.rst:433 msgid "" -"Upgrades the core venv dependency packages (currently ``pip``) in the " +"Upgrades the core venv dependency packages (currently :pypi:`pip`) in the " "environment. This is done by shelling out to the ``pip`` executable in the " "environment." msgstr "" -#: ../../library/venv.rst:317 +#: ../../library/venv.rst:440 +msgid ":pypi:`setuptools` is no longer a core venv dependency." +msgstr ":pypi:`setuptools` 不再是核心 venv 的依賴。" + +#: ../../library/venv.rst:444 msgid "" "A placeholder method which can be overridden in third party implementations " "to pre-install packages in the virtual environment or perform other post-" "creation steps." msgstr "" -#: ../../library/venv.rst:321 -msgid "" -"Windows now uses redirector scripts for ``python[w].exe`` instead of copying " -"the actual binaries. In 3.7.2 only :meth:`setup_python` does nothing unless " -"running from a build in the source tree." -msgstr "" - -#: ../../library/venv.rst:326 -msgid "" -"Windows copies the redirector scripts as part of :meth:`setup_python` " -"instead of :meth:`setup_scripts`. This was not the case in 3.7.2. When using " -"symlinks, the original executables will be linked." -msgstr "" - -#: ../../library/venv.rst:331 +#: ../../library/venv.rst:450 msgid "" -"In addition, :class:`EnvBuilder` provides this utility method that can be " -"called from :meth:`setup_scripts` or :meth:`post_setup` in subclasses to " -"assist in installing custom scripts into the virtual environment." +"This method can be called from :meth:`setup_scripts` or :meth:`post_setup` " +"in subclasses to assist in installing custom scripts into the virtual " +"environment." msgstr "" -#: ../../library/venv.rst:337 +#: ../../library/venv.rst:454 msgid "" "*path* is the path to a directory that should contain subdirectories " -"\"common\", \"posix\", \"nt\", each containing scripts destined for the bin " -"directory in the environment. The contents of \"common\" and the directory " -"corresponding to :data:`os.name` are copied after some text replacement of " -"placeholders:" +"``common``, ``posix``, ``nt``; each containing scripts destined for the " +"``bin`` directory in the environment. The contents of ``common`` and the " +"directory corresponding to :data:`os.name` are copied after some text " +"replacement of placeholders:" msgstr "" -#: ../../library/venv.rst:343 +#: ../../library/venv.rst:460 msgid "" "``__VENV_DIR__`` is replaced with the absolute path of the environment " "directory." msgstr "" -#: ../../library/venv.rst:346 +#: ../../library/venv.rst:463 msgid "" "``__VENV_NAME__`` is replaced with the environment name (final path segment " "of environment directory)." msgstr "" -#: ../../library/venv.rst:349 +#: ../../library/venv.rst:466 msgid "" "``__VENV_PROMPT__`` is replaced with the prompt (the environment name " "surrounded by parentheses and with a following space)" msgstr "" -#: ../../library/venv.rst:352 +#: ../../library/venv.rst:469 msgid "" "``__VENV_BIN_NAME__`` is replaced with the name of the bin directory (either " "``bin`` or ``Scripts``)." msgstr "" -#: ../../library/venv.rst:355 +#: ../../library/venv.rst:472 msgid "" "``__VENV_PYTHON__`` is replaced with the absolute path of the environment's " "executable." msgstr "" -#: ../../library/venv.rst:358 +#: ../../library/venv.rst:475 msgid "" "The directories are allowed to exist (for when an existing environment is " "being upgraded)." msgstr "" -#: ../../library/venv.rst:361 +#: ../../library/venv.rst:480 +msgid "" +"Creates a ``.gitignore`` file within the virtual environment that causes the " +"entire directory to be ignored by the Git source control manager." +msgstr "" + +#: ../../library/venv.rst:485 +msgid "" +"Windows now uses redirector scripts for ``python[w].exe`` instead of copying " +"the actual binaries. In 3.7.2 only :meth:`setup_python` does nothing unless " +"running from a build in the source tree." +msgstr "" + +#: ../../library/venv.rst:490 +msgid "" +"Windows copies the redirector scripts as part of :meth:`setup_python` " +"instead of :meth:`setup_scripts`. This was not the case in 3.7.2. When using " +"symlinks, the original executables will be linked." +msgstr "" + +#: ../../library/venv.rst:495 msgid "There is also a module-level convenience function:" msgstr "" -#: ../../library/venv.rst:367 +#: ../../library/venv.rst:501 msgid "" "Create an :class:`EnvBuilder` with the given keyword arguments, and call " "its :meth:`~EnvBuilder.create` method with the *env_dir* argument." msgstr "" -#: ../../library/venv.rst:382 +#: ../../library/venv.rst:506 +msgid "Added the *with_pip* parameter" +msgstr "新增 *with_pip* 參數" + +#: ../../library/venv.rst:509 +msgid "Added the *prompt* parameter" +msgstr "新增 *prompt* 參數" + +#: ../../library/venv.rst:512 +msgid "Added the *upgrade_deps* parameter" +msgstr "新增 *upgrade_deps* 參數" + +#: ../../library/venv.rst:515 +msgid "Added the *scm_ignore_files* parameter" +msgstr "新增 *scm_ignore_files* 參數" + +#: ../../library/venv.rst:519 msgid "An example of extending ``EnvBuilder``" -msgstr "" +msgstr "一個擴展 ``EnvBuilder`` 的範例" -#: ../../library/venv.rst:384 +#: ../../library/venv.rst:521 msgid "" "The following script shows how to extend :class:`EnvBuilder` by implementing " "a subclass which installs setuptools and pip into a created virtual " "environment::" msgstr "" -#: ../../library/venv.rst:387 +#: ../../library/venv.rst:524 msgid "" "import os\n" "import os.path\n" @@ -1086,7 +1111,7 @@ msgid "" " sys.exit(rc)" msgstr "" -#: ../../library/venv.rst:595 +#: ../../library/venv.rst:732 msgid "" "This script is also available for download `online <https://gist.github.com/" "vsajip/4673395>`_." diff --git a/library/warnings.po b/library/warnings.po index 5cf7ea7164..14bf51843b 100644 --- a/library/warnings.po +++ b/library/warnings.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 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-" @@ -822,11 +822,72 @@ msgid "" "options and calls to :func:`simplefilter`." msgstr "" -#: ../../library/warnings.rst:526 +#: ../../library/warnings.rst:527 +msgid "Decorator to indicate that a class, function or overload is deprecated." +msgstr "" + +#: ../../library/warnings.rst:529 +msgid "" +"When this decorator is applied to an object, deprecation warnings may be " +"emitted at runtime when the object is used. :term:`static type checkers " +"<static type checker>` will also generate a diagnostic on usage of the " +"deprecated object." +msgstr "" + +#: ../../library/warnings.rst:534 +msgid "Usage::" +msgstr "" + +#: ../../library/warnings.rst:536 +msgid "" +"from warnings import deprecated\n" +"from typing import overload\n" +"\n" +"@deprecated(\"Use B instead\")\n" +"class A:\n" +" pass\n" +"\n" +"@deprecated(\"Use g instead\")\n" +"def f():\n" +" pass\n" +"\n" +"@overload\n" +"@deprecated(\"int support is deprecated\")\n" +"def g(x: int) -> int: ...\n" +"@overload\n" +"def g(x: str) -> int: ..." +msgstr "" + +#: ../../library/warnings.rst:553 +msgid "" +"The warning specified by *category* will be emitted at runtime on use of " +"deprecated objects. For functions, that happens on calls; for classes, on " +"instantiation and on creation of subclasses. If the *category* is ``None``, " +"no warning is emitted at runtime. The *stacklevel* determines where the " +"warning is emitted. If it is ``1`` (the default), the warning is emitted at " +"the direct caller of the deprecated object; if it is higher, it is emitted " +"further up the stack. Static type checker behavior is not affected by the " +"*category* and *stacklevel* arguments." +msgstr "" + +#: ../../library/warnings.rst:564 +msgid "" +"The deprecation message passed to the decorator is saved in the " +"``__deprecated__`` attribute on the decorated object. If applied to an " +"overload, the decorator must be after the :func:`@overload <typing." +"overload>` decorator for the attribute to exist on the overload as returned " +"by :func:`typing.get_overloads`." +msgstr "" + +#: ../../library/warnings.rst:571 +msgid "See :pep:`702`." +msgstr "" + +#: ../../library/warnings.rst:576 msgid "Available Context Managers" msgstr "" -#: ../../library/warnings.rst:530 +#: ../../library/warnings.rst:580 msgid "" "A context manager that copies and, upon exit, restores the warnings filter " "and the :func:`showwarning` function. If the *record* argument is :const:" @@ -837,21 +898,27 @@ msgid "" "has attributes with the same names as the arguments to :func:`showwarning`." msgstr "" -#: ../../library/warnings.rst:539 +#: ../../library/warnings.rst:589 msgid "" "The *module* argument takes a module that will be used instead of the module " "returned when you import :mod:`warnings` whose filter will be protected. " "This argument exists primarily for testing the :mod:`warnings` module itself." msgstr "" -#: ../../library/warnings.rst:544 +#: ../../library/warnings.rst:594 msgid "" "If the *action* argument is not ``None``, the remaining arguments are passed " "to :func:`simplefilter` as if it were called immediately on entering the " "context." msgstr "" -#: ../../library/warnings.rst:550 +#: ../../library/warnings.rst:598 +msgid "" +"See :ref:`warning-filter` for the meaning of the *category* and *lineno* " +"parameters." +msgstr "" + +#: ../../library/warnings.rst:603 msgid "" "The :class:`catch_warnings` manager works by replacing and then later " "restoring the module's :func:`showwarning` function and internal list of " @@ -859,7 +926,7 @@ msgid "" "state and therefore is not thread-safe." msgstr "" -#: ../../library/warnings.rst:558 +#: ../../library/warnings.rst:611 msgid "Added the *action*, *category*, *lineno*, and *append* parameters." msgstr "新增 *action*、*category*、*lineno* 和 *append* 參數。" diff --git a/library/wave.po b/library/wave.po index c253f6a628..d2fee008a9 100644 --- a/library/wave.po +++ b/library/wave.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -105,7 +105,7 @@ msgstr "" ":func:`.open` 函式可以在 :keyword:`with` 陳述式中使用。當 :keyword:`!with` 區" "塊完成時,會呼叫 :meth:`Wave_read.close` 或是 :meth:`Wave_write.close` 方法。" -#: ../../library/wave.rst:52 ../../library/wave.rst:176 +#: ../../library/wave.rst:52 ../../library/wave.rst:184 msgid "Added support for unseekable files." msgstr "增加對不可搜尋 (unseekable) 檔案的支援。" @@ -181,20 +181,28 @@ msgid "Rewind the file pointer to the beginning of the audio stream." msgstr "重置檔案指標至音訊流的開頭。" #: ../../library/wave.rst:126 +#, fuzzy msgid "" -"The following two methods are defined for compatibility with the :mod:`aifc` " -"module, and don't do anything interesting." +"The following two methods are defined for compatibility with the old :mod:`!" +"aifc` module, and don't do anything interesting." msgstr "以下兩個方法是為了與 :mod:`aifc` 模組的保持相容性,並不執行任何操作。" #: ../../library/wave.rst:132 msgid "Returns ``None``." msgstr "回傳 ``None``。" -#: ../../library/wave.rst:137 +#: ../../library/wave.rst:134 ../../library/wave.rst:143 +#, fuzzy +msgid "" +"The method only existed for compatibility with the :mod:`!aifc` module which " +"has been removed in Python 3.13." +msgstr "以下兩個方法是為了與 :mod:`aifc` 模組的保持相容性,並不執行任何操作。" + +#: ../../library/wave.rst:141 msgid "Raise an error." msgstr "引發錯誤。" -#: ../../library/wave.rst:139 +#: ../../library/wave.rst:147 msgid "" "The following two methods define a term \"position\" which is compatible " "between them, and is otherwise implementation dependent." @@ -202,27 +210,27 @@ msgstr "" "以下兩個方法所定義的「位置」,在它們之間是相容的,但其他情況下則取決於具體實" "作方式。" -#: ../../library/wave.rst:145 +#: ../../library/wave.rst:153 msgid "Set the file pointer to the specified position." msgstr "將檔案指標設定為指定的位置。" -#: ../../library/wave.rst:150 +#: ../../library/wave.rst:158 msgid "Return current file pointer position." msgstr "回傳目前的檔案指標位置。" -#: ../../library/wave.rst:156 +#: ../../library/wave.rst:164 msgid "Wave_write Objects" msgstr "Wave_write 物件" -#: ../../library/wave.rst:160 +#: ../../library/wave.rst:168 msgid "Write a WAV file." msgstr "寫入一個 WAV 檔案。" -#: ../../library/wave.rst:162 +#: ../../library/wave.rst:170 msgid "Wave_write objects, as returned by :func:`.open`." msgstr "Wave_write 物件,由 :func:`.open` 回傳。" -#: ../../library/wave.rst:164 +#: ../../library/wave.rst:172 msgid "" "For seekable output streams, the ``wave`` header will automatically be " "updated to reflect the number of frames actually written. For unseekable " @@ -243,11 +251,11 @@ msgstr "" "次性寫入所有的幀資料。在後一種情況下,:meth:`writeframes` 方法將計算資料中的" "幀數量,並在寫入幀資料之前相應地設定 *nframes* 的值。" -#: ../../library/wave.rst:179 +#: ../../library/wave.rst:187 msgid "Wave_write objects have the following methods:" msgstr "Wave_write 物件具有以下方法:" -#: ../../library/wave.rst:183 +#: ../../library/wave.rst:191 msgid "" "Make sure *nframes* is correct, and close the file if it was opened by :mod:" "`wave`. This method is called upon object collection. It will raise an " @@ -258,23 +266,23 @@ msgstr "" "在物件回收時被呼叫。如果輸出串流不可搜尋且 *nframes* 不符合實際寫入的幀數,則" "會引發例外。" -#: ../../library/wave.rst:191 +#: ../../library/wave.rst:199 msgid "Set the number of channels." msgstr "設定音訊的通道數量。" -#: ../../library/wave.rst:196 +#: ../../library/wave.rst:204 msgid "Set the sample width to *n* bytes." msgstr "設定取樣寬度為 *n* 個位元組。" -#: ../../library/wave.rst:201 +#: ../../library/wave.rst:209 msgid "Set the frame rate to *n*." msgstr "設定取樣頻率為 *n*。" -#: ../../library/wave.rst:203 +#: ../../library/wave.rst:211 msgid "A non-integral input to this method is rounded to the nearest integer." msgstr "此方法的非整數輸入會被將四捨五入到最接近的整數。" -#: ../../library/wave.rst:210 +#: ../../library/wave.rst:218 msgid "" "Set the number of frames to *n*. This will be changed later if the number " "of frames actually written is different (this update attempt will raise an " @@ -283,13 +291,13 @@ msgstr "" "設定幀數為 *n*。如果實際寫入的幀數不同,則稍後將進行更改(如果輸出串流不可搜" "尋,則此嘗試將引發錯誤)。" -#: ../../library/wave.rst:217 +#: ../../library/wave.rst:225 msgid "" "Set the compression type and description. At the moment, only compression " "type ``NONE`` is supported, meaning no compression." msgstr "設定壓縮類型和描述。目前只支援壓縮類型為 ``NONE``,表示無壓縮。" -#: ../../library/wave.rst:223 +#: ../../library/wave.rst:231 msgid "" "The *tuple* should be ``(nchannels, sampwidth, framerate, nframes, comptype, " "compname)``, with values valid for the ``set*()`` methods. Sets all " @@ -298,7 +306,7 @@ msgstr "" "這個 *tuple* 應該是 ``(nchannels, sampwidth, framerate, nframes, comptype, " "compname)``,值需要是符合 ``set*()`` 方法的參數。設定所有參數。" -#: ../../library/wave.rst:230 +#: ../../library/wave.rst:238 msgid "" "Return current position in the file, with the same disclaimer for the :meth:" "`Wave_read.tell` and :meth:`Wave_read.setpos` methods." @@ -306,15 +314,15 @@ msgstr "" "回傳檔案中的指標位置,其指標位置含意與 :meth:`Wave_read.tell` 和 :meth:" "`Wave_read.setpos` 是一致的。" -#: ../../library/wave.rst:236 +#: ../../library/wave.rst:244 msgid "Write audio frames, without correcting *nframes*." msgstr "寫入音訊幀,不修正 *nframes*。" -#: ../../library/wave.rst:238 ../../library/wave.rst:249 +#: ../../library/wave.rst:246 ../../library/wave.rst:257 msgid "Any :term:`bytes-like object` is now accepted." msgstr "現在可接受任何 :term:`bytes-like object`。" -#: ../../library/wave.rst:244 +#: ../../library/wave.rst:252 msgid "" "Write audio frames and make sure *nframes* is correct. It will raise an " "error if the output stream is not seekable and the total number of frames " @@ -324,7 +332,7 @@ msgstr "" "寫入音訊幀並確保 *nframes* 正確。如果輸出串流不可搜尋,並且在寫入 *data* 後已" "寫入的總幀數與先前設定的 *nframes* 值不符,則會引發錯誤。" -#: ../../library/wave.rst:252 +#: ../../library/wave.rst:260 msgid "" "Note that it is invalid to set any parameters after calling :meth:" "`writeframes` or :meth:`writeframesraw`, and any attempt to do so will " diff --git a/library/weakref.po b/library/weakref.po index 385046692e..3325dd9142 100644 --- a/library/weakref.po +++ b/library/weakref.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2024-05-22 20:58+0800\n" diff --git a/library/webbrowser.po b/library/webbrowser.po index 4c9edc0779..0bed38a963 100644 --- a/library/webbrowser.po +++ b/library/webbrowser.po @@ -1,15 +1,16 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: +# Liang-Bo Wang <me@liang2.tw>, 2017 +# Matt Wang <mattwang44@gmail.com>, 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" -"PO-Revision-Date: 2017-09-22 18:27+0000\n" -"Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" "tw)\n" "Language: zh_TW\n" @@ -32,6 +33,8 @@ msgid "" "displaying web-based documents to users. Under most circumstances, simply " "calling the :func:`.open` function from this module will do the right thing." msgstr "" +":mod:`webbrowser` 模組提供了一個高階介面,允許向使用者顯示基於網頁的文件。在" +"大多數情況下,只需從此模組呼叫 :func:`.open` 函式即可完成正確的操作。" #: ../../library/webbrowser.rst:18 msgid "" @@ -40,6 +43,9 @@ msgid "" "display isn't available. If text-mode browsers are used, the calling " "process will block until the user exits the browser." msgstr "" +"在 Unix 下,X11 下首選圖形瀏覽器,但如果圖形瀏覽器不可用或 X11 顯示不可用,則" +"將使用文字模式瀏覽器。如果使用文字模式瀏覽器,則呼叫程序將會阻塞 (block),直" +"到使用者退出瀏覽器。" #: ../../library/webbrowser.rst:23 msgid "" @@ -50,6 +56,10 @@ msgid "" "with the argument URL substituted for ``%s``; if the part does not contain " "``%s``, it is simply interpreted as the name of the browser to launch. [1]_" msgstr "" +"如果環境變數 :envvar:`BROWSER` 存在,它會被直譯為以 :data:`os.pathsep` 分隔的瀏" +"覽器串列,以在平台預設值之前嘗試。當串列部分的值包含字串 ``%s`` 時,它會被直" +"譯為字面瀏覽器命令列,並使用引數 URL 替換 ``%s``;如果該部分不包含 ``%s``,則" +"它僅被直譯為要啟動的瀏覽器的名稱。 [1]_" #: ../../library/webbrowser.rst:30 msgid "" @@ -59,46 +69,68 @@ msgid "" "remote browsers are not available on Unix, the controlling process will " "launch a new browser and wait." msgstr "" +"對於非 Unix 平台,或當 Unix 上有可用的遠端瀏覽器時,控制行程不會等待使用者以" +"完成瀏覽器,而是允許遠端瀏覽器在顯示器上維護自己的視窗。如果遠端瀏覽器在 " +"Unix 上不可用,控制行程將啟動新的瀏覽器並等待。" #: ../../library/webbrowser.rst:36 msgid "" +"On iOS, the :envvar:`BROWSER` environment variable, as well as any arguments " +"controlling autoraise, browser preference, and new tab/window creation will " +"be ignored. Web pages will *always* be opened in the user's preferred " +"browser, in a new tab, with the browser being brought to the foreground. The " +"use of the :mod:`webbrowser` module on iOS requires the :mod:`ctypes` " +"module. If :mod:`ctypes` isn't available, calls to :func:`.open` will fail." +msgstr "" +"在 iOS 上,:envvar:`BROWSER` 環境變數以及控制自動引發 (autoraise)、瀏覽器設定" +"和新分頁/視窗建立的任何引數都將被忽略。網頁將\\ *始終*\\ 在使用者偏好的瀏覽器" +"中的新分頁中開啟,並將瀏覽器帶到前台。在 iOS 上使用 :mod:`webbrowser` 模組需" +"要 :mod:`ctypes` 模組。如果 :mod:`ctypes` 不可用,則呼叫 :func:`.open` 將會失" +"敗。" + +#: ../../library/webbrowser.rst:43 +msgid "" "The script :program:`webbrowser` can be used as a command-line interface for " "the module. It accepts a URL as the argument. It accepts the following " -"optional parameters: ``-n`` opens the URL in a new browser window, if " -"possible; ``-t`` opens the URL in a new browser page (\"tab\"). The options " -"are, naturally, mutually exclusive. Usage example::" +"optional parameters:" msgstr "" +"腳本 :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:48 +msgid "``-t``/``--new-tab`` opens the URL in a new browser page (\"tab\")." +msgstr "``-t``/``--new-tab`` 會在新的瀏覽器分頁 (\"tab\") 中開啟 URL。" -#: ../../library/webbrowser.rst:42 +#: ../../library/webbrowser.rst:50 +msgid "The options are, naturally, mutually exclusive. Usage example::" +msgstr "這些選項自然是相互排斥的。用法範例: ::" + +#: ../../library/webbrowser.rst:52 msgid "python -m webbrowser -t \"https://www.python.org\"" msgstr "python -m webbrowser -t \"https://www.python.org\"" -#: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability <availability>`: not Emscripten, not WASI." -msgstr "" - -#: ../../includes/wasm-notavail.rst:5 -msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." -msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +#: ../../library/webbrowser.rst:54 +msgid ":ref:`Availability <availability>`: not WASI, not Android." +msgstr ":ref:`可用性 <availability>`:非 WASI、非 Android。" -#: ../../library/webbrowser.rst:46 +#: ../../library/webbrowser.rst:56 msgid "The following exception is defined:" -msgstr "" +msgstr "以下例外有被定義於該模組:" -#: ../../library/webbrowser.rst:51 +#: ../../library/webbrowser.rst:61 msgid "Exception raised when a browser control error occurs." -msgstr "" +msgstr "當瀏覽器控制項發生錯誤時引發例外。" -#: ../../library/webbrowser.rst:53 +#: ../../library/webbrowser.rst:63 msgid "The following functions are defined:" -msgstr "" +msgstr "以下函式有被定義於該模組:" -#: ../../library/webbrowser.rst:58 +#: ../../library/webbrowser.rst:68 msgid "" "Display *url* using the default browser. If *new* is 0, the *url* is opened " "in the same browser window if possible. If *new* is 1, a new browser window " @@ -107,21 +139,27 @@ msgid "" "possible (note that under many window managers this will occur regardless of " "the setting of this variable)." msgstr "" +"使用預設瀏覽器顯示 *url*。如果 *new* 為 0,則盡可能在同一瀏覽器視窗中開啟 " +"*url*。如果 *new* 為 1,則盡可能開啟一個新的瀏覽器視窗。如果 *new* 為 2,則盡" +"可能開啟一個新的瀏覽器分頁 (\"tab\")。如果 *autoraise* 為 ``True``,則盡可能" +"提升視窗(請注意,無論此變數的設定如何,許多視窗管理器下都會發生這種情況)。" -#: ../../library/webbrowser.rst:65 ../../library/webbrowser.rst:79 -#: ../../library/webbrowser.rst:87 +#: ../../library/webbrowser.rst:75 ../../library/webbrowser.rst:89 +#: ../../library/webbrowser.rst:97 msgid "" "Returns ``True`` if a browser was successfully launched, ``False`` otherwise." -msgstr "" +msgstr "如果瀏覽器成功啟動則回傳 ``True``,否則回傳 ``False``。" -#: ../../library/webbrowser.rst:67 +#: ../../library/webbrowser.rst:77 msgid "" "Note that on some platforms, trying to open a filename using this function, " "may work and start the operating system's associated program. However, this " "is neither supported nor portable." msgstr "" +"請注意,在某些平台上,嘗試使用此函式開啟檔案名稱可能能夠運作並啟動作業系統的" +"關聯程式。然而這既不支援也不可移植。" -#: ../../library/webbrowser.rst:71 +#: ../../library/webbrowser.rst:81 msgid "" "Raises an :ref:`auditing event <auditing>` ``webbrowser.open`` with argument " "``url``." @@ -129,26 +167,31 @@ msgstr "" "引發一個附帶引數 ``url`` 的\\ :ref:`稽核事件 <auditing>` ``webbrowser." "open``。" -#: ../../library/webbrowser.rst:76 +#: ../../library/webbrowser.rst:86 msgid "" "Open *url* in a new window of the default browser, if possible, otherwise, " "open *url* in the only browser window." msgstr "" +"盡可能在預設瀏覽器的新視窗中開啟 *url*,否則在唯一的瀏覽器視窗中開啟 *url*。" -#: ../../library/webbrowser.rst:84 +#: ../../library/webbrowser.rst:94 msgid "" "Open *url* in a new page (\"tab\") of the default browser, if possible, " "otherwise equivalent to :func:`open_new`." msgstr "" +"盡可能在預設瀏覽器的新分頁 (\"tab\") 中開啟 *url*,否則相當於 :func:" +"`open_new`。" -#: ../../library/webbrowser.rst:92 +#: ../../library/webbrowser.rst:102 msgid "" "Return a controller object for the browser type *using*. If *using* is " "``None``, return a controller for a default browser appropriate to the " "caller's environment." msgstr "" +"回傳瀏覽器類型\\ *使用*(以引數 *using* 給定)的控制器物件。如果 *using* 為 ``None``,則回傳適合" +"呼叫者環境的預設瀏覽器控制器。" -#: ../../library/webbrowser.rst:99 +#: ../../library/webbrowser.rst:109 msgid "" "Register the browser type *name*. Once a browser type is registered, the :" "func:`get` function can return a controller for that browser type. If " @@ -156,8 +199,12 @@ msgid "" "without parameters to create an instance when needed. If *instance* is " "provided, *constructor* will never be called, and may be ``None``." msgstr "" +"註冊瀏覽器類型\\ *名稱*(以引數 *name* 給定)。一旦註冊了瀏覽器類型,:func:`get` 函式就可以回傳該瀏" +"覽器類型的控制器。如果沒有提供 *instance* 或為 ``None``,則會在需要時不帶參數" +"地呼叫 *constructor* 來建立實例。如果提供了 *instance*,*constructor* 將永遠" +"不會被呼叫,並且可能為 ``None``。" -#: ../../library/webbrowser.rst:105 +#: ../../library/webbrowser.rst:115 msgid "" "Setting *preferred* to ``True`` makes this browser a preferred result for a :" "func:`get` call with no argument. Otherwise, this entry point is only " @@ -165,218 +212,254 @@ msgid "" "func:`get` with a nonempty argument matching the name of a handler you " "declare." msgstr "" +"將 *preferred* 設為 ``True`` 會使該瀏覽器成為不帶引數的 :func:`get` 呼叫的偏" +"好結果。否則只有當你計劃設定 :envvar:`BROWSER` 變數或使用與你宣告的處理程序名" +"稱相符的非空引數呼叫 :func:`get` 時,此入口點才會有用。" -#: ../../library/webbrowser.rst:111 +#: ../../library/webbrowser.rst:121 msgid "*preferred* keyword-only parameter was added." -msgstr "" +msgstr "新增了 *preferred* 僅限關鍵字參數。" -#: ../../library/webbrowser.rst:114 +#: ../../library/webbrowser.rst:124 msgid "" "A number of browser types are predefined. This table gives the type names " "that may be passed to the :func:`get` function and the corresponding " "instantiations for the controller classes, all defined in this module." msgstr "" +"預先定義了多種瀏覽器類型。此表給出了可以傳遞給 :func:`get` 函式的類型名稱以及" +"控制器類別的相應實例化方式,這些都定義於此模組中。" -#: ../../library/webbrowser.rst:119 +#: ../../library/webbrowser.rst:129 msgid "Type Name" -msgstr "" +msgstr "類型名稱" -#: ../../library/webbrowser.rst:119 +#: ../../library/webbrowser.rst:129 msgid "Class Name" -msgstr "" +msgstr "類別名稱" -#: ../../library/webbrowser.rst:119 +#: ../../library/webbrowser.rst:129 msgid "Notes" msgstr "註解" -#: ../../library/webbrowser.rst:121 +#: ../../library/webbrowser.rst:131 msgid "``'mozilla'``" msgstr "``'mozilla'``" -#: ../../library/webbrowser.rst:121 ../../library/webbrowser.rst:123 -msgid ":class:`Mozilla('mozilla')`" -msgstr ":class:`Mozilla('mozilla')`" +#: ../../library/webbrowser.rst:131 ../../library/webbrowser.rst:133 +msgid "``Mozilla('mozilla')``" +msgstr "``Mozilla('mozilla')``" -#: ../../library/webbrowser.rst:123 +#: ../../library/webbrowser.rst:133 msgid "``'firefox'``" msgstr "``'firefox'``" -#: ../../library/webbrowser.rst:125 +#: ../../library/webbrowser.rst:135 msgid "``'epiphany'``" msgstr "``'epiphany'``" -#: ../../library/webbrowser.rst:125 -msgid ":class:`Epiphany('epiphany')`" -msgstr ":class:`Epiphany('epiphany')`" +#: ../../library/webbrowser.rst:135 +msgid "``Epiphany('epiphany')``" +msgstr "``Epiphany('epiphany')``" -#: ../../library/webbrowser.rst:127 +#: ../../library/webbrowser.rst:137 msgid "``'kfmclient'``" msgstr "``'kfmclient'``" -#: ../../library/webbrowser.rst:127 ../../library/webbrowser.rst:129 -#: ../../library/webbrowser.rst:131 -msgid ":class:`Konqueror()`" -msgstr ":class:`Konqueror()`" +#: ../../library/webbrowser.rst:137 ../../library/webbrowser.rst:139 +#: ../../library/webbrowser.rst:141 +msgid "``Konqueror()``" +msgstr "``Konqueror()``" -#: ../../library/webbrowser.rst:127 ../../library/webbrowser.rst:129 -#: ../../library/webbrowser.rst:131 +#: ../../library/webbrowser.rst:137 ../../library/webbrowser.rst:139 +#: ../../library/webbrowser.rst:141 msgid "\\(1)" msgstr "\\(1)" -#: ../../library/webbrowser.rst:129 +#: ../../library/webbrowser.rst:139 msgid "``'konqueror'``" msgstr "``'konqueror'``" -#: ../../library/webbrowser.rst:131 +#: ../../library/webbrowser.rst:141 msgid "``'kfm'``" msgstr "``'kfm'``" -#: ../../library/webbrowser.rst:133 +#: ../../library/webbrowser.rst:143 msgid "``'opera'``" msgstr "``'opera'``" -#: ../../library/webbrowser.rst:133 -msgid ":class:`Opera()`" -msgstr ":class:`Opera()`" +#: ../../library/webbrowser.rst:143 +msgid "``Opera()``" +msgstr "``Opera()``" -#: ../../library/webbrowser.rst:135 +#: ../../library/webbrowser.rst:145 msgid "``'links'``" msgstr "``'links'``" -#: ../../library/webbrowser.rst:135 -msgid ":class:`GenericBrowser('links')`" -msgstr ":class:`GenericBrowser('links')`" +#: ../../library/webbrowser.rst:145 +msgid "``GenericBrowser('links')``" +msgstr "``GenericBrowser('links')``" -#: ../../library/webbrowser.rst:137 +#: ../../library/webbrowser.rst:147 msgid "``'elinks'``" msgstr "``'elinks'``" -#: ../../library/webbrowser.rst:137 -msgid ":class:`Elinks('elinks')`" -msgstr ":class:`Elinks('elinks')`" +#: ../../library/webbrowser.rst:147 +msgid "``Elinks('elinks')``" +msgstr "``Elinks('elinks')``" -#: ../../library/webbrowser.rst:139 +#: ../../library/webbrowser.rst:149 msgid "``'lynx'``" msgstr "``'lynx'``" -#: ../../library/webbrowser.rst:139 -msgid ":class:`GenericBrowser('lynx')`" -msgstr ":class:`GenericBrowser('lynx')`" +#: ../../library/webbrowser.rst:149 +msgid "``GenericBrowser('lynx')``" +msgstr "``GenericBrowser('lynx')``" -#: ../../library/webbrowser.rst:141 +#: ../../library/webbrowser.rst:151 msgid "``'w3m'``" msgstr "``'w3m'``" -#: ../../library/webbrowser.rst:141 -msgid ":class:`GenericBrowser('w3m')`" -msgstr ":class:`GenericBrowser('w3m')`" +#: ../../library/webbrowser.rst:151 +msgid "``GenericBrowser('w3m')``" +msgstr "``GenericBrowser('w3m')``" -#: ../../library/webbrowser.rst:143 +#: ../../library/webbrowser.rst:153 msgid "``'windows-default'``" msgstr "``'windows-default'``" -#: ../../library/webbrowser.rst:143 -msgid ":class:`WindowsDefault`" -msgstr ":class:`WindowsDefault`" +#: ../../library/webbrowser.rst:153 +msgid "``WindowsDefault``" +msgstr "``WindowsDefault``" -#: ../../library/webbrowser.rst:143 +#: ../../library/webbrowser.rst:153 msgid "\\(2)" msgstr "\\(2)" -#: ../../library/webbrowser.rst:145 +#: ../../library/webbrowser.rst:155 msgid "``'macosx'``" msgstr "``'macosx'``" -#: ../../library/webbrowser.rst:145 -msgid ":class:`MacOSXOSAScript('default')`" -msgstr ":class:`MacOSXOSAScript('default')`" +#: ../../library/webbrowser.rst:155 +msgid "``MacOSXOSAScript('default')``" +msgstr "``MacOSXOSAScript('default')``" -#: ../../library/webbrowser.rst:145 ../../library/webbrowser.rst:147 +#: ../../library/webbrowser.rst:155 ../../library/webbrowser.rst:157 msgid "\\(3)" msgstr "\\(3)" -#: ../../library/webbrowser.rst:147 +#: ../../library/webbrowser.rst:157 msgid "``'safari'``" msgstr "``'safari'``" -#: ../../library/webbrowser.rst:147 -msgid ":class:`MacOSXOSAScript('safari')`" -msgstr ":class:`MacOSXOSAScript('safari')`" +#: ../../library/webbrowser.rst:157 +msgid "``MacOSXOSAScript('safari')``" +msgstr "``MacOSXOSAScript('safari')``" -#: ../../library/webbrowser.rst:149 +#: ../../library/webbrowser.rst:159 msgid "``'google-chrome'``" msgstr "``'google-chrome'``" -#: ../../library/webbrowser.rst:149 -msgid ":class:`Chrome('google-chrome')`" -msgstr ":class:`Chrome('google-chrome')`" +#: ../../library/webbrowser.rst:159 +msgid "``Chrome('google-chrome')``" +msgstr "``Chrome('google-chrome')``" -#: ../../library/webbrowser.rst:151 +#: ../../library/webbrowser.rst:161 msgid "``'chrome'``" msgstr "``'chrome'``" -#: ../../library/webbrowser.rst:151 -msgid ":class:`Chrome('chrome')`" -msgstr ":class:`Chrome('chrome')`" +#: ../../library/webbrowser.rst:161 +msgid "``Chrome('chrome')``" +msgstr "``Chrome('chrome')``" -#: ../../library/webbrowser.rst:153 +#: ../../library/webbrowser.rst:163 msgid "``'chromium'``" msgstr "``'chromium'``" -#: ../../library/webbrowser.rst:153 -msgid ":class:`Chromium('chromium')`" -msgstr ":class:`Chromium('chromium')`" +#: ../../library/webbrowser.rst:163 +msgid "``Chromium('chromium')``" +msgstr "``Chromium('chromium')``" -#: ../../library/webbrowser.rst:155 +#: ../../library/webbrowser.rst:165 msgid "``'chromium-browser'``" msgstr "``'chromium-browser'``" -#: ../../library/webbrowser.rst:155 -msgid ":class:`Chromium('chromium-browser')`" -msgstr ":class:`Chromium('chromium-browser')`" +#: ../../library/webbrowser.rst:165 +msgid "``Chromium('chromium-browser')``" +msgstr "``Chromium('chromium-browser')``" + +#: ../../library/webbrowser.rst:167 +msgid "``'iosbrowser'``" +msgstr "``'iosbrowser'``" + +#: ../../library/webbrowser.rst:167 +msgid "``IOSBrowser``" +msgstr "``IOSBrowser``" + +#: ../../library/webbrowser.rst:167 +msgid "\\(4)" +msgstr "\\(4)" -#: ../../library/webbrowser.rst:158 +#: ../../library/webbrowser.rst:170 msgid "Notes:" msgstr "註解:" -#: ../../library/webbrowser.rst:161 +#: ../../library/webbrowser.rst:173 msgid "" "\"Konqueror\" is the file manager for the KDE desktop environment for Unix, " "and only makes sense to use if KDE is running. Some way of reliably " -"detecting KDE would be nice; the :envvar:`KDEDIR` variable is not " +"detecting KDE would be nice; the :envvar:`!KDEDIR` variable is not " "sufficient. Note also that the name \"kfm\" is used even when using the :" "program:`konqueror` command with KDE 2 --- the implementation selects the " "best strategy for running Konqueror." msgstr "" +"\"Konqueror\" 是 Unix 的 KDE 桌面環境的檔案管理器,只有在 KDE 運作時才有意" +"義。最好能有某種可靠的 KDE 檢測方法;僅有 :envvar:`!KDEDIR` 變數是不夠的。另" +"請注意,即使在 KDE 2 中使用 :program:`konqueror` 命令時,也會使用 \"kfm\" 名" +"稱 --- 該實作會選擇執行 Konqueror 的最佳策略。" -#: ../../library/webbrowser.rst:168 +#: ../../library/webbrowser.rst:180 msgid "Only on Windows platforms." -msgstr "" +msgstr "僅在 Windows 平台上。" + +#: ../../library/webbrowser.rst:183 +msgid "Only on macOS." +msgstr "僅在 macOS 上。" -#: ../../library/webbrowser.rst:171 -msgid "Only on macOS platform." +#: ../../library/webbrowser.rst:186 +msgid "Only on iOS." +msgstr "僅在 iOS 上。" + +#: ../../library/webbrowser.rst:188 +msgid "" +"A new :class:`!MacOSXOSAScript` class has been added and is used on Mac " +"instead of the previous :class:`!MacOSX` class. This adds support for " +"opening browsers not currently set as the OS default." msgstr "" +"新增了 :class:`!MacOSXOSAScript` 類別並於 Mac 上使用,而非使用先前的 :class:" +"`!MacOSX` 類別。這增加了對開啟目前未設定為作業系統預設之瀏覽器的支援。" -#: ../../library/webbrowser.rst:173 +#: ../../library/webbrowser.rst:193 msgid "Support for Chrome/Chromium has been added." -msgstr "" +msgstr "新增了對 Chrome/Chromium 的支援。" -#: ../../library/webbrowser.rst:176 +#: ../../library/webbrowser.rst:196 msgid "" "Support for several obsolete browsers has been removed. Removed browsers " "include Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, and Firefox " "versions 35 and below." msgstr "" +"對多個過時瀏覽器的支援已被刪除。已刪除的瀏覽器包括 Grail、Mosaic、Netscape、" +"Galeon、Skipstone、Iceape 和 Firefox 35 及以下版本。" -#: ../../library/webbrowser.rst:181 -msgid ":class:`MacOSX` is deprecated, use :class:`MacOSXOSAScript` instead." -msgstr "" +#: ../../library/webbrowser.rst:201 +msgid "Support for iOS has been added." +msgstr "新增了對 iOS 的支援。" -#: ../../library/webbrowser.rst:184 +#: ../../library/webbrowser.rst:204 msgid "Here are some simple examples::" msgstr "以下是一些簡單範例: ::" -#: ../../library/webbrowser.rst:186 +#: ../../library/webbrowser.rst:206 msgid "" "url = 'https://docs.python.org/'\n" "\n" @@ -386,47 +469,62 @@ msgid "" "# Open URL in new window, raising the window if possible.\n" "webbrowser.open_new(url)" msgstr "" +"url = 'https://docs.python.org/'\n" +"\n" +"# 如果瀏覽器視窗已打開,則在新分頁中開啟 URL。\n" +"webbrowser.open_new_tab(url)\n" +"\n" +"# 在新視窗中開啟 URL,如果可能的話提升視窗。\n" +"webbrowser.open_new(url)" -#: ../../library/webbrowser.rst:198 +#: ../../library/webbrowser.rst:218 msgid "Browser Controller Objects" -msgstr "" +msgstr "瀏覽器控制器物件" -#: ../../library/webbrowser.rst:200 +#: ../../library/webbrowser.rst:220 msgid "" "Browser controllers provide these methods which parallel three of the module-" "level convenience functions:" -msgstr "" +msgstr "瀏覽器控制器提供了這些與三個模組層級便利函式相同的方法:" -#: ../../library/webbrowser.rst:206 +#: ../../library/webbrowser.rst:226 msgid "System-dependent name for the browser." -msgstr "" +msgstr "瀏覽器的系統相依名稱 (system-dependent name)。" -#: ../../library/webbrowser.rst:211 +#: ../../library/webbrowser.rst:231 msgid "" "Display *url* using the browser handled by this controller. If *new* is 1, a " "new browser window is opened if possible. If *new* is 2, a new browser page " "(\"tab\") is opened if possible." msgstr "" +"使用此控制器處理的瀏覽器顯示 *url*。如果 *new* 為 1,則盡可能開啟一個新的瀏覽" +"器視窗。如果 *new* 為 2,則盡可能開啟一個新的瀏覽器分頁 (\"tab\")。" -#: ../../library/webbrowser.rst:218 +#: ../../library/webbrowser.rst:238 msgid "" "Open *url* in a new window of the browser handled by this controller, if " "possible, otherwise, open *url* in the only browser window. Alias :func:" "`open_new`." msgstr "" +"盡可能在此控制器處理的瀏覽器的新視窗中開啟 *url*,否則在唯一的瀏覽器視窗中開" +"啟 *url*。別名為 :func:`open_new`。" -#: ../../library/webbrowser.rst:225 +#: ../../library/webbrowser.rst:245 msgid "" "Open *url* in a new page (\"tab\") of the browser handled by this " "controller, if possible, otherwise equivalent to :func:`open_new`." msgstr "" +"盡可能在此控制器處理的瀏覽器的新分頁 (\"tab\") 中開啟 *url*,否則相當於 :" +"func:`open_new`。" -#: ../../library/webbrowser.rst:230 +#: ../../library/webbrowser.rst:250 msgid "Footnotes" -msgstr "註解" +msgstr "註腳" -#: ../../library/webbrowser.rst:231 +#: ../../library/webbrowser.rst:251 msgid "" "Executables named here without a full path will be searched in the " "directories given in the :envvar:`PATH` environment variable." msgstr "" +"此處命名的無完整路徑可執行檔將在 :envvar:`PATH` 環境變數中給定的目錄中被搜" +"尋。" diff --git a/library/windows.po b/library/windows.po index 4b7ffa47a2..a77a8f584e 100644 --- a/library/windows.po +++ b/library/windows.po @@ -5,7 +5,7 @@ # Matt Wang <mattwang44@gmail.com>, 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2022-02-15 18:37+0800\n" diff --git a/library/winreg.po b/library/winreg.po index 2c8efc2b62..fa46e096f8 100644 --- a/library/winreg.po +++ b/library/winreg.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" diff --git a/library/winsound.po b/library/winsound.po index d165f66948..f51aa90496 100644 --- a/library/winsound.po +++ b/library/winsound.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" diff --git a/library/wsgiref.po b/library/wsgiref.po index 10a9cc8840..240292a6a8 100644 --- a/library/wsgiref.po +++ b/library/wsgiref.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2023-12-09 21:29+0800\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1312,7 +1312,7 @@ msgid "" " fn = os.path.join(path, environ[\"PATH_INFO\"][1:])\n" " if \".\" not in fn.split(os.path.sep)[-1]:\n" " fn = os.path.join(fn, \"index.html\")\n" -" mime_type = mimetypes.guess_type(fn)[0]\n" +" mime_type = mimetypes.guess_file_type(fn)[0]\n" "\n" " # Return 200 OK if file exists, otherwise 404 Not Found\n" " if os.path.exists(fn):\n" diff --git a/library/xdrlib.po b/library/xdrlib.po deleted file mode 100644 index d12417b3a1..0000000000 --- a/library/xdrlib.po +++ /dev/null @@ -1,347 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) 2001-2022, Python Software Foundation -# This file is distributed under the same license as the Python package. -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: Python 3.12\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" -"PO-Revision-Date: 2016-01-31 07:33+0000\n" -"Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" -"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" -"tw)\n" -"Language: zh_TW\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=1; plural=0;\n" - -#: ../../library/xdrlib.rst:2 -msgid ":mod:`xdrlib` --- Encode and decode XDR data" -msgstr ":mod:`xdrlib` --- XDR 資料的編碼與解碼" - -#: ../../library/xdrlib.rst:8 -msgid "**Source code:** :source:`Lib/xdrlib.py`" -msgstr "**原始碼:**\\ :source:`Lib/xdrlib.py`" - -#: ../../library/xdrlib.rst:14 -msgid "" -"The :mod:`xdrlib` module is deprecated (see :pep:`PEP 594 <594#xdrlib>` for " -"details)." -msgstr "" -":mod:`xdrlib` 模組 (module) 即將被棄用(詳見 :pep:`PEP 594 " -"<594#xdrlib>`\\ )。" - -#: ../../library/xdrlib.rst:20 -msgid "" -"The :mod:`xdrlib` module supports the External Data Representation Standard " -"as described in :rfc:`1014`, written by Sun Microsystems, Inc. June 1987. " -"It supports most of the data types described in the RFC." -msgstr "" - -#: ../../library/xdrlib.rst:24 -msgid "" -"The :mod:`xdrlib` module defines two classes, one for packing variables into " -"XDR representation, and another for unpacking from XDR representation. " -"There are also two exception classes." -msgstr "" - -#: ../../library/xdrlib.rst:31 -msgid "" -":class:`Packer` is the class for packing data into XDR representation. The :" -"class:`Packer` class is instantiated with no arguments." -msgstr "" - -#: ../../library/xdrlib.rst:37 -msgid "" -"``Unpacker`` is the complementary class which unpacks XDR data values from a " -"string buffer. The input buffer is given as *data*." -msgstr "" - -#: ../../library/xdrlib.rst:43 -msgid ":rfc:`1014` - XDR: External Data Representation Standard" -msgstr "" - -#: ../../library/xdrlib.rst:44 -msgid "" -"This RFC defined the encoding of data which was XDR at the time this module " -"was originally written. It has apparently been obsoleted by :rfc:`1832`." -msgstr "" - -#: ../../library/xdrlib.rst:47 -msgid ":rfc:`1832` - XDR: External Data Representation Standard" -msgstr "" - -#: ../../library/xdrlib.rst:48 -msgid "Newer RFC that provides a revised definition of XDR." -msgstr "" - -#: ../../library/xdrlib.rst:54 -msgid "Packer Objects" -msgstr "" - -#: ../../library/xdrlib.rst:56 -msgid ":class:`Packer` instances have the following methods:" -msgstr "" - -#: ../../library/xdrlib.rst:61 -msgid "Returns the current pack buffer as a string." -msgstr "" - -#: ../../library/xdrlib.rst:66 -msgid "Resets the pack buffer to the empty string." -msgstr "" - -#: ../../library/xdrlib.rst:68 -msgid "" -"In general, you can pack any of the most common XDR data types by calling " -"the appropriate ``pack_type()`` method. Each method takes a single " -"argument, the value to pack. The following simple data type packing methods " -"are supported: :meth:`pack_uint`, :meth:`pack_int`, :meth:`pack_enum`, :meth:" -"`pack_bool`, :meth:`pack_uhyper`, and :meth:`pack_hyper`." -msgstr "" - -#: ../../library/xdrlib.rst:77 -msgid "Packs the single-precision floating point number *value*." -msgstr "" - -#: ../../library/xdrlib.rst:82 -msgid "Packs the double-precision floating point number *value*." -msgstr "" - -#: ../../library/xdrlib.rst:84 -msgid "The following methods support packing strings, bytes, and opaque data:" -msgstr "" - -#: ../../library/xdrlib.rst:89 -msgid "" -"Packs a fixed length string, *s*. *n* is the length of the string but it is " -"*not* packed into the data buffer. The string is padded with null bytes if " -"necessary to guaranteed 4 byte alignment." -msgstr "" - -#: ../../library/xdrlib.rst:96 -msgid "" -"Packs a fixed length opaque data stream, similarly to :meth:`pack_fstring`." -msgstr "" - -#: ../../library/xdrlib.rst:101 -msgid "" -"Packs a variable length string, *s*. The length of the string is first " -"packed as an unsigned integer, then the string data is packed with :meth:" -"`pack_fstring`." -msgstr "" - -#: ../../library/xdrlib.rst:108 -msgid "" -"Packs a variable length opaque data string, similarly to :meth:`pack_string`." -msgstr "" - -#: ../../library/xdrlib.rst:113 -msgid "Packs a variable length byte stream, similarly to :meth:`pack_string`." -msgstr "" - -#: ../../library/xdrlib.rst:115 -msgid "The following methods support packing arrays and lists:" -msgstr "" - -#: ../../library/xdrlib.rst:120 -msgid "" -"Packs a *list* of homogeneous items. This method is useful for lists with " -"an indeterminate size; i.e. the size is not available until the entire list " -"has been walked. For each item in the list, an unsigned integer ``1`` is " -"packed first, followed by the data value from the list. *pack_item* is the " -"function that is called to pack the individual item. At the end of the " -"list, an unsigned integer ``0`` is packed." -msgstr "" - -#: ../../library/xdrlib.rst:127 -msgid "" -"For example, to pack a list of integers, the code might appear like this::" -msgstr "" - -#: ../../library/xdrlib.rst:129 -msgid "" -"import xdrlib\n" -"p = xdrlib.Packer()\n" -"p.pack_list([1, 2, 3], p.pack_int)" -msgstr "" -"import xdrlib\n" -"p = xdrlib.Packer()\n" -"p.pack_list([1, 2, 3], p.pack_int)" - -#: ../../library/xdrlib.rst:136 -msgid "" -"Packs a fixed length list (*array*) of homogeneous items. *n* is the length " -"of the list; it is *not* packed into the buffer, but a :exc:`ValueError` " -"exception is raised if ``len(array)`` is not equal to *n*. As above, " -"*pack_item* is the function used to pack each element." -msgstr "" - -#: ../../library/xdrlib.rst:144 -msgid "" -"Packs a variable length *list* of homogeneous items. First, the length of " -"the list is packed as an unsigned integer, then each element is packed as " -"in :meth:`pack_farray` above." -msgstr "" - -#: ../../library/xdrlib.rst:152 -msgid "Unpacker Objects" -msgstr "" - -#: ../../library/xdrlib.rst:154 -msgid "The :class:`Unpacker` class offers the following methods:" -msgstr "" - -#: ../../library/xdrlib.rst:159 -msgid "Resets the string buffer with the given *data*." -msgstr "" - -#: ../../library/xdrlib.rst:164 -msgid "Returns the current unpack position in the data buffer." -msgstr "" - -#: ../../library/xdrlib.rst:169 -msgid "" -"Sets the data buffer unpack position to *position*. You should be careful " -"about using :meth:`get_position` and :meth:`set_position`." -msgstr "" - -#: ../../library/xdrlib.rst:175 -msgid "Returns the current unpack data buffer as a string." -msgstr "" - -#: ../../library/xdrlib.rst:180 -msgid "" -"Indicates unpack completion. Raises an :exc:`Error` exception if all of the " -"data has not been unpacked." -msgstr "" - -#: ../../library/xdrlib.rst:183 -msgid "" -"In addition, every data type that can be packed with a :class:`Packer`, can " -"be unpacked with an :class:`Unpacker`. Unpacking methods are of the form " -"``unpack_type()``, and take no arguments. They return the unpacked object." -msgstr "" - -#: ../../library/xdrlib.rst:190 -msgid "Unpacks a single-precision floating point number." -msgstr "" - -#: ../../library/xdrlib.rst:195 -msgid "" -"Unpacks a double-precision floating point number, similarly to :meth:" -"`unpack_float`." -msgstr "" - -#: ../../library/xdrlib.rst:198 -msgid "" -"In addition, the following methods unpack strings, bytes, and opaque data:" -msgstr "" - -#: ../../library/xdrlib.rst:203 -msgid "" -"Unpacks and returns a fixed length string. *n* is the number of characters " -"expected. Padding with null bytes to guaranteed 4 byte alignment is assumed." -msgstr "" - -#: ../../library/xdrlib.rst:209 -msgid "" -"Unpacks and returns a fixed length opaque data stream, similarly to :meth:" -"`unpack_fstring`." -msgstr "" - -#: ../../library/xdrlib.rst:215 -msgid "" -"Unpacks and returns a variable length string. The length of the string is " -"first unpacked as an unsigned integer, then the string data is unpacked " -"with :meth:`unpack_fstring`." -msgstr "" - -#: ../../library/xdrlib.rst:222 -msgid "" -"Unpacks and returns a variable length opaque data string, similarly to :meth:" -"`unpack_string`." -msgstr "" - -#: ../../library/xdrlib.rst:228 -msgid "" -"Unpacks and returns a variable length byte stream, similarly to :meth:" -"`unpack_string`." -msgstr "" - -#: ../../library/xdrlib.rst:231 -msgid "The following methods support unpacking arrays and lists:" -msgstr "" - -#: ../../library/xdrlib.rst:236 -msgid "" -"Unpacks and returns a list of homogeneous items. The list is unpacked one " -"element at a time by first unpacking an unsigned integer flag. If the flag " -"is ``1``, then the item is unpacked and appended to the list. A flag of " -"``0`` indicates the end of the list. *unpack_item* is the function that is " -"called to unpack the items." -msgstr "" - -#: ../../library/xdrlib.rst:245 -msgid "" -"Unpacks and returns (as a list) a fixed length array of homogeneous items. " -"*n* is number of list elements to expect in the buffer. As above, " -"*unpack_item* is the function used to unpack each element." -msgstr "" - -#: ../../library/xdrlib.rst:252 -msgid "" -"Unpacks and returns a variable length *list* of homogeneous items. First, " -"the length of the list is unpacked as an unsigned integer, then each element " -"is unpacked as in :meth:`unpack_farray` above." -msgstr "" - -#: ../../library/xdrlib.rst:260 -msgid "Exceptions" -msgstr "例外" - -#: ../../library/xdrlib.rst:262 -msgid "Exceptions in this module are coded as class instances:" -msgstr "" - -#: ../../library/xdrlib.rst:267 -msgid "" -"The base exception class. :exc:`Error` has a single public attribute :attr:" -"`msg` containing the description of the error." -msgstr "" - -#: ../../library/xdrlib.rst:273 -msgid "" -"Class derived from :exc:`Error`. Contains no additional instance variables." -msgstr "" - -#: ../../library/xdrlib.rst:275 -msgid "Here is an example of how you would catch one of these exceptions::" -msgstr "" - -#: ../../library/xdrlib.rst:277 -msgid "" -"import xdrlib\n" -"p = xdrlib.Packer()\n" -"try:\n" -" p.pack_double(8.01)\n" -"except xdrlib.ConversionError as instance:\n" -" print('packing the double failed:', instance.msg)" -msgstr "" -"import xdrlib\n" -"p = xdrlib.Packer()\n" -"try:\n" -" p.pack_double(8.01)\n" -"except xdrlib.ConversionError as instance:\n" -" print('packing the double failed:', instance.msg)" - -#: ../../library/xdrlib.rst:10 -msgid "XDR" -msgstr "XDR" - -#: ../../library/xdrlib.rst:10 -msgid "External Data Representation" -msgstr "External Data Representation (外部資料表示)" diff --git a/library/xml.dom.minidom.po b/library/xml.dom.minidom.po index 74a2c571ac..edf87d6176 100644 --- a/library/xml.dom.minidom.po +++ b/library/xml.dom.minidom.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:15+0000\n" diff --git a/library/xml.dom.po b/library/xml.dom.po index b2f8e62c4d..650d019f11 100644 --- a/library/xml.dom.po +++ b/library/xml.dom.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xml.dom.pulldom.po b/library/xml.dom.pulldom.po index bc6feb6f8a..736f1f62c2 100644 --- a/library/xml.dom.pulldom.po +++ b/library/xml.dom.pulldom.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xml.etree.elementtree.po b/library/xml.etree.elementtree.po index a844301b14..b5a9518fc2 100644 --- a/library/xml.etree.elementtree.po +++ b/library/xml.etree.elementtree.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-21 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -670,7 +670,7 @@ msgid "" msgstr "" #: ../../library/xml.etree.elementtree.rst:383 -#: ../../library/xml.etree.elementtree.rst:777 +#: ../../library/xml.etree.elementtree.rst:782 msgid "Example" msgstr "範例" @@ -884,12 +884,12 @@ msgid "" msgstr "" #: ../../library/xml.etree.elementtree.rst:499 -#: ../../library/xml.etree.elementtree.rst:829 +#: ../../library/xml.etree.elementtree.rst:834 msgid "Reference" msgstr "" #: ../../library/xml.etree.elementtree.rst:504 -#: ../../library/xml.etree.elementtree.rst:834 +#: ../../library/xml.etree.elementtree.rst:839 msgid "Functions" msgstr "函式" @@ -1076,10 +1076,11 @@ msgid "" "the default :class:`TreeBuilder` as a target. Returns an :term:`iterator` " "providing ``(event, elem)`` pairs; it has a ``root`` attribute that " "references the root element of the resulting XML tree once *source* is fully " -"read." +"read. The iterator has the :meth:`!close` method that closes the internal " +"file object if *source* is a filename." msgstr "" -#: ../../library/xml.etree.elementtree.rst:634 +#: ../../library/xml.etree.elementtree.rst:636 msgid "" "Note that while :func:`iterparse` builds the tree incrementally, it issues " "blocking reads on *source* (or the file it names). As such, it's unsuitable " @@ -1087,7 +1088,7 @@ msgid "" "parsing, see :class:`XMLPullParser`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:641 +#: ../../library/xml.etree.elementtree.rst:643 msgid "" ":func:`iterparse` only guarantees that it has seen the \">\" character of a " "starting tag when it emits a \"start\" event, so the attributes are defined, " @@ -1096,21 +1097,25 @@ msgid "" "present." msgstr "" -#: ../../library/xml.etree.elementtree.rst:647 -#: ../../library/xml.etree.elementtree.rst:1517 +#: ../../library/xml.etree.elementtree.rst:649 +#: ../../library/xml.etree.elementtree.rst:1522 msgid "If you need a fully populated element, look for \"end\" events instead." msgstr "" -#: ../../library/xml.etree.elementtree.rst:649 +#: ../../library/xml.etree.elementtree.rst:651 msgid "The *parser* argument." msgstr "*parser* 引數。" -#: ../../library/xml.etree.elementtree.rst:652 -#: ../../library/xml.etree.elementtree.rst:1521 +#: ../../library/xml.etree.elementtree.rst:654 +#: ../../library/xml.etree.elementtree.rst:1526 msgid "The ``comment`` and ``pi`` events were added." msgstr "新增 *context* 與 *check_hostname* 事件。" -#: ../../library/xml.etree.elementtree.rst:658 +#: ../../library/xml.etree.elementtree.rst:657 +msgid "Added the :meth:`!close` method." +msgstr "" + +#: ../../library/xml.etree.elementtree.rst:663 msgid "" "Parses an XML section into an element tree. *source* is a filename or file " "object containing XML data. *parser* is an optional parser instance. If " @@ -1118,7 +1123,7 @@ msgid "" "class:`ElementTree` instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:666 +#: ../../library/xml.etree.elementtree.rst:671 msgid "" "PI element factory. This factory function creates a special element that " "will be serialized as an XML processing instruction. *target* is a string " @@ -1126,7 +1131,7 @@ msgid "" "given. Returns an element instance, representing a processing instruction." msgstr "" -#: ../../library/xml.etree.elementtree.rst:671 +#: ../../library/xml.etree.elementtree.rst:676 msgid "" "Note that :class:`XMLParser` skips over processing instructions in the input " "instead of creating PI objects for them. An :class:`ElementTree` will only " @@ -1134,7 +1139,7 @@ msgid "" "tree using one of the :class:`Element` methods." msgstr "" -#: ../../library/xml.etree.elementtree.rst:679 +#: ../../library/xml.etree.elementtree.rst:684 msgid "" "Registers a namespace prefix. The registry is global, and any existing " "mapping for either the given prefix or the namespace URI will be removed. " @@ -1143,13 +1148,13 @@ msgid "" "all possible." msgstr "" -#: ../../library/xml.etree.elementtree.rst:690 +#: ../../library/xml.etree.elementtree.rst:695 msgid "" "Subelement factory. This function creates an element instance, and appends " "it to an existing element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:693 +#: ../../library/xml.etree.elementtree.rst:698 msgid "" "The element name, attribute names, and attribute values can be either " "bytestrings or Unicode strings. *parent* is the parent element. *tag* is " @@ -1158,7 +1163,7 @@ msgid "" "arguments. Returns an element instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:704 +#: ../../library/xml.etree.elementtree.rst:709 msgid "" "Generates a string representation of an XML element, including all " "subelements. *element* is an :class:`Element` instance. *encoding* [1]_ is " @@ -1170,24 +1175,24 @@ msgid "" "Returns an (optionally) encoded string containing the XML data." msgstr "" -#: ../../library/xml.etree.elementtree.rst:713 -#: ../../library/xml.etree.elementtree.rst:740 -#: ../../library/xml.etree.elementtree.rst:1194 +#: ../../library/xml.etree.elementtree.rst:718 +#: ../../library/xml.etree.elementtree.rst:745 +#: ../../library/xml.etree.elementtree.rst:1199 msgid "Added the *short_empty_elements* parameter." msgstr "新增 *short_empty_elements* 參數。" -#: ../../library/xml.etree.elementtree.rst:716 -#: ../../library/xml.etree.elementtree.rst:743 +#: ../../library/xml.etree.elementtree.rst:721 +#: ../../library/xml.etree.elementtree.rst:748 msgid "Added the *xml_declaration* and *default_namespace* parameters." msgstr "新增 *xml_declaration* 與 *default_namespace* 參數。" -#: ../../library/xml.etree.elementtree.rst:719 +#: ../../library/xml.etree.elementtree.rst:724 msgid "" "The :func:`tostring` function now preserves the attribute order specified by " "the user." msgstr "" -#: ../../library/xml.etree.elementtree.rst:728 +#: ../../library/xml.etree.elementtree.rst:733 msgid "" "Generates a string representation of an XML element, including all " "subelements. *element* is an :class:`Element` instance. *encoding* [1]_ is " @@ -1201,13 +1206,13 @@ msgid "" "join(tostringlist(element)) == tostring(element)``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:746 +#: ../../library/xml.etree.elementtree.rst:751 msgid "" "The :func:`tostringlist` function now preserves the attribute order " "specified by the user." msgstr "" -#: ../../library/xml.etree.elementtree.rst:753 +#: ../../library/xml.etree.elementtree.rst:758 msgid "" "Parses an XML section from a string constant. This function can be used to " "embed \"XML literals\" in Python code. *text* is a string containing XML " @@ -1215,7 +1220,7 @@ msgid "" "class:`XMLParser` parser is used. Returns an :class:`Element` instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:761 +#: ../../library/xml.etree.elementtree.rst:766 msgid "" "Parses an XML section from a string constant, and also returns a dictionary " "which maps from element id:s to elements. *text* is a string containing XML " @@ -1224,11 +1229,11 @@ msgid "" "`Element` instance and a dictionary." msgstr "" -#: ../../library/xml.etree.elementtree.rst:771 +#: ../../library/xml.etree.elementtree.rst:776 msgid "XInclude support" msgstr "" -#: ../../library/xml.etree.elementtree.rst:773 +#: ../../library/xml.etree.elementtree.rst:778 msgid "" "This module provides limited support for `XInclude directives <https://www." "w3.org/TR/xinclude/>`_, via the :mod:`xml.etree.ElementInclude` helper " @@ -1236,7 +1241,7 @@ msgid "" "element trees, based on information in the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:779 +#: ../../library/xml.etree.elementtree.rst:784 msgid "" "Here's an example that demonstrates use of the XInclude module. To include " "an XML document in the current document, use the ``{http://www.w3.org/2001/" @@ -1244,7 +1249,7 @@ msgid "" "and use the **href** attribute to specify the document to include." msgstr "" -#: ../../library/xml.etree.elementtree.rst:781 +#: ../../library/xml.etree.elementtree.rst:786 msgid "" "<?xml version=\"1.0\"?>\n" "<document xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n" @@ -1256,20 +1261,20 @@ msgstr "" " <xi:include href=\"source.xml\" parse=\"xml\" />\n" "</document>" -#: ../../library/xml.etree.elementtree.rst:788 +#: ../../library/xml.etree.elementtree.rst:793 msgid "" "By default, the **href** attribute is treated as a file name. You can use " "custom loaders to override this behaviour. Also note that the standard " "helper does not support XPointer syntax." msgstr "" -#: ../../library/xml.etree.elementtree.rst:790 +#: ../../library/xml.etree.elementtree.rst:795 msgid "" "To process this file, load it as usual, and pass the root element to the :" "mod:`xml.etree.ElementTree` module:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:792 +#: ../../library/xml.etree.elementtree.rst:797 msgid "" "from xml.etree import ElementTree, ElementInclude\n" "\n" @@ -1285,14 +1290,14 @@ msgstr "" "\n" "ElementInclude.include(root)" -#: ../../library/xml.etree.elementtree.rst:801 +#: ../../library/xml.etree.elementtree.rst:806 msgid "" "The ElementInclude module replaces the ``{http://www.w3.org/2001/XInclude}" "include`` element with the root element from the **source.xml** document. " "The result might look something like this:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:803 +#: ../../library/xml.etree.elementtree.rst:808 msgid "" "<document xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n" " <para>This is a paragraph.</para>\n" @@ -1302,19 +1307,19 @@ msgstr "" " <para>This is a paragraph.</para>\n" "</document>" -#: ../../library/xml.etree.elementtree.rst:809 +#: ../../library/xml.etree.elementtree.rst:814 msgid "" "If the **parse** attribute is omitted, it defaults to \"xml\". The href " "attribute is required." msgstr "" -#: ../../library/xml.etree.elementtree.rst:811 +#: ../../library/xml.etree.elementtree.rst:816 msgid "" "To include a text document, use the ``{http://www.w3.org/2001/XInclude}" "include`` element, and set the **parse** attribute to \"text\":" msgstr "" -#: ../../library/xml.etree.elementtree.rst:813 +#: ../../library/xml.etree.elementtree.rst:818 msgid "" "<?xml version=\"1.0\"?>\n" "<document xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n" @@ -1326,11 +1331,11 @@ msgstr "" " Copyright (c) <xi:include href=\"year.txt\" parse=\"text\" />.\n" "</document>" -#: ../../library/xml.etree.elementtree.rst:820 +#: ../../library/xml.etree.elementtree.rst:825 msgid "The result might look something like:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:822 +#: ../../library/xml.etree.elementtree.rst:827 msgid "" "<document xmlns:xi=\"http://www.w3.org/2001/XInclude\">\n" " Copyright (c) 2003.\n" @@ -1340,7 +1345,7 @@ msgstr "" " Copyright (c) 2003.\n" "</document>" -#: ../../library/xml.etree.elementtree.rst:840 +#: ../../library/xml.etree.elementtree.rst:845 msgid "" "Default loader. This default loader reads an included resource from disk. " "*href* is a URL. *parse* is for parse mode either \"xml\" or \"text\". " @@ -1351,7 +1356,7 @@ msgid "" "``None`` or raise an exception." msgstr "" -#: ../../library/xml.etree.elementtree.rst:851 +#: ../../library/xml.etree.elementtree.rst:856 msgid "" "This function expands XInclude directives in-place in tree pointed by " "*elem*. *elem* is either the root :class:`~xml.etree.ElementTree.Element` or " @@ -1364,21 +1369,21 @@ msgid "" "malicious content explosion. Pass ``None`` to disable the limitation." msgstr "" -#: ../../library/xml.etree.elementtree.rst:861 +#: ../../library/xml.etree.elementtree.rst:866 msgid "Added the *base_url* and *max_depth* parameters." msgstr "新增 *base_url* 與 *max_depth* 參數。" -#: ../../library/xml.etree.elementtree.rst:868 +#: ../../library/xml.etree.elementtree.rst:873 msgid "Element Objects" msgstr "Element 物件" -#: ../../library/xml.etree.elementtree.rst:876 +#: ../../library/xml.etree.elementtree.rst:881 msgid "" "Element class. This class defines the Element interface, and provides a " "reference implementation of this interface." msgstr "" -#: ../../library/xml.etree.elementtree.rst:879 +#: ../../library/xml.etree.elementtree.rst:884 msgid "" "The element name, attribute names, and attribute values can be either " "bytestrings or Unicode strings. *tag* is the element name. *attrib* is an " @@ -1386,13 +1391,13 @@ msgid "" "additional attributes, given as keyword arguments." msgstr "" -#: ../../library/xml.etree.elementtree.rst:887 +#: ../../library/xml.etree.elementtree.rst:892 msgid "" "A string identifying what kind of data this element represents (the element " "type, in other words)." msgstr "" -#: ../../library/xml.etree.elementtree.rst:894 +#: ../../library/xml.etree.elementtree.rst:899 msgid "" "These attributes can be used to hold additional data associated with the " "element. Their values are usually strings but may be any application-" @@ -1403,11 +1408,11 @@ msgid "" "the XML data" msgstr "" -#: ../../library/xml.etree.elementtree.rst:902 +#: ../../library/xml.etree.elementtree.rst:907 msgid "<a><b>1<c>2<d/>3</c></b>4</a>" msgstr "<a><b>1<c>2<d/>3</c></b>4</a>" -#: ../../library/xml.etree.elementtree.rst:906 +#: ../../library/xml.etree.elementtree.rst:911 msgid "" "the *a* element has ``None`` for both *text* and *tail* attributes, the *b* " "element has *text* ``\"1\"`` and *tail* ``\"4\"``, the *c* element has " @@ -1415,17 +1420,17 @@ msgid "" "``None`` and *tail* ``\"3\"``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:911 +#: ../../library/xml.etree.elementtree.rst:916 msgid "" "To collect the inner text of an element, see :meth:`itertext`, for example " "``\"\".join(element.itertext())``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:914 +#: ../../library/xml.etree.elementtree.rst:919 msgid "Applications may store arbitrary objects in these attributes." msgstr "" -#: ../../library/xml.etree.elementtree.rst:919 +#: ../../library/xml.etree.elementtree.rst:924 msgid "" "A dictionary containing the element's attributes. Note that while the " "*attrib* value is always a real mutable Python dictionary, an ElementTree " @@ -1434,59 +1439,59 @@ msgid "" "implementations, use the dictionary methods below whenever possible." msgstr "" -#: ../../library/xml.etree.elementtree.rst:925 +#: ../../library/xml.etree.elementtree.rst:930 msgid "The following dictionary-like methods work on the element attributes." msgstr "" -#: ../../library/xml.etree.elementtree.rst:930 +#: ../../library/xml.etree.elementtree.rst:935 msgid "" "Resets an element. This function removes all subelements, clears all " "attributes, and sets the text and tail attributes to ``None``." msgstr "" -#: ../../library/xml.etree.elementtree.rst:936 +#: ../../library/xml.etree.elementtree.rst:941 msgid "Gets the element attribute named *key*." msgstr "" -#: ../../library/xml.etree.elementtree.rst:938 +#: ../../library/xml.etree.elementtree.rst:943 msgid "" "Returns the attribute value, or *default* if the attribute was not found." msgstr "" -#: ../../library/xml.etree.elementtree.rst:943 +#: ../../library/xml.etree.elementtree.rst:948 msgid "" "Returns the element attributes as a sequence of (name, value) pairs. The " "attributes are returned in an arbitrary order." msgstr "" -#: ../../library/xml.etree.elementtree.rst:949 +#: ../../library/xml.etree.elementtree.rst:954 msgid "" "Returns the elements attribute names as a list. The names are returned in " "an arbitrary order." msgstr "" -#: ../../library/xml.etree.elementtree.rst:955 +#: ../../library/xml.etree.elementtree.rst:960 msgid "Set the attribute *key* on the element to *value*." msgstr "" -#: ../../library/xml.etree.elementtree.rst:957 +#: ../../library/xml.etree.elementtree.rst:962 msgid "The following methods work on the element's children (subelements)." msgstr "" -#: ../../library/xml.etree.elementtree.rst:962 +#: ../../library/xml.etree.elementtree.rst:967 msgid "" "Adds the element *subelement* to the end of this element's internal list of " "subelements. Raises :exc:`TypeError` if *subelement* is not an :class:" "`Element`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:969 +#: ../../library/xml.etree.elementtree.rst:974 msgid "" "Appends *subelements* from an iterable of elements. Raises :exc:`TypeError` " "if a subelement is not an :class:`Element`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:977 +#: ../../library/xml.etree.elementtree.rst:982 msgid "" "Finds the first subelement matching *match*. *match* may be a tag name or " "a :ref:`path <elementtree-xpath>`. Returns an element instance or " @@ -1495,7 +1500,7 @@ msgid "" "expression into the given namespace." msgstr "" -#: ../../library/xml.etree.elementtree.rst:986 +#: ../../library/xml.etree.elementtree.rst:991 msgid "" "Finds all matching subelements, by tag name or :ref:`path <elementtree-" "xpath>`. Returns a list containing all matching elements in document " @@ -1504,7 +1509,7 @@ msgid "" "expression into the given namespace." msgstr "" -#: ../../library/xml.etree.elementtree.rst:995 +#: ../../library/xml.etree.elementtree.rst:1000 msgid "" "Finds text for the first subelement matching *match*. *match* may be a tag " "name or a :ref:`path <elementtree-xpath>`. Returns the text content of the " @@ -1515,13 +1520,13 @@ msgid "" "into the given namespace." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1006 +#: ../../library/xml.etree.elementtree.rst:1011 msgid "" "Inserts *subelement* at the given position in this element. Raises :exc:" "`TypeError` if *subelement* is not an :class:`Element`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1012 +#: ../../library/xml.etree.elementtree.rst:1017 msgid "" "Creates a tree :term:`iterator` with the current element as the root. The " "iterator iterates over this element and all elements below it, in document " @@ -1530,7 +1535,7 @@ msgid "" "structure is modified during iteration, the result is undefined." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1023 +#: ../../library/xml.etree.elementtree.rst:1028 msgid "" "Finds all matching subelements, by tag name or :ref:`path <elementtree-" "xpath>`. Returns an iterable yielding all matching elements in document " @@ -1538,33 +1543,33 @@ msgid "" "name." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1034 +#: ../../library/xml.etree.elementtree.rst:1039 msgid "" "Creates a text iterator. The iterator loops over this element and all " "subelements, in document order, and returns all inner text." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1042 +#: ../../library/xml.etree.elementtree.rst:1047 msgid "" "Creates a new element object of the same type as this element. Do not call " "this method, use the :func:`SubElement` factory function instead." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1048 +#: ../../library/xml.etree.elementtree.rst:1053 msgid "" "Removes *subelement* from the element. Unlike the find\\* methods this " "method compares elements based on the instance identity, not on tag value or " "contents." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1052 +#: ../../library/xml.etree.elementtree.rst:1057 msgid "" ":class:`Element` objects also support the following sequence type methods " "for working with subelements: :meth:`~object.__delitem__`, :meth:`~object." "__getitem__`, :meth:`~object.__setitem__`, :meth:`~object.__len__`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1057 +#: ../../library/xml.etree.elementtree.rst:1062 msgid "" "Caution: Elements with no subelements will test as ``False``. In a future " "release of Python, all elements will test as ``True`` regardless of whether " @@ -1572,7 +1577,7 @@ msgid "" "None`` tests.::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1062 +#: ../../library/xml.etree.elementtree.rst:1067 msgid "" "element = root.find('foo')\n" "\n" @@ -1583,11 +1588,11 @@ msgid "" " print(\"element not found\")" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1070 +#: ../../library/xml.etree.elementtree.rst:1075 msgid "Testing the truth value of an Element emits :exc:`DeprecationWarning`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1073 +#: ../../library/xml.etree.elementtree.rst:1078 msgid "" "Prior to Python 3.8, the serialisation order of the XML attributes of " "elements was artificially made predictable by sorting the attributes by " @@ -1596,7 +1601,7 @@ msgid "" "attributes were originally parsed or created by user code." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1079 +#: ../../library/xml.etree.elementtree.rst:1084 msgid "" "In general, user code should try not to depend on a specific ordering of " "attributes, given that the `XML Information Set <https://www.w3.org/TR/xml-" @@ -1607,7 +1612,7 @@ msgid "" "func:`canonicalize` function." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1087 +#: ../../library/xml.etree.elementtree.rst:1092 msgid "" "In cases where canonical output is not applicable but a specific attribute " "order is still desirable on output, code should aim for creating the " @@ -1617,7 +1622,7 @@ msgid "" "independently from the Element creation::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1094 +#: ../../library/xml.etree.elementtree.rst:1099 msgid "" "def reorder_attributes(root):\n" " for el in root.iter():\n" @@ -1629,58 +1634,58 @@ msgid "" " attrib.update(attribs)" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1107 +#: ../../library/xml.etree.elementtree.rst:1112 msgid "ElementTree Objects" msgstr "ElementTree 物件" -#: ../../library/xml.etree.elementtree.rst:1112 +#: ../../library/xml.etree.elementtree.rst:1117 msgid "" "ElementTree wrapper class. This class represents an entire element " "hierarchy, and adds some extra support for serialization to and from " "standard XML." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1116 +#: ../../library/xml.etree.elementtree.rst:1121 msgid "" "*element* is the root element. The tree is initialized with the contents of " "the XML *file* if given." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1122 +#: ../../library/xml.etree.elementtree.rst:1127 msgid "" "Replaces the root element for this tree. This discards the current contents " "of the tree, and replaces it with the given element. Use with care. " "*element* is an element instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1129 +#: ../../library/xml.etree.elementtree.rst:1134 msgid "Same as :meth:`Element.find`, starting at the root of the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1134 +#: ../../library/xml.etree.elementtree.rst:1139 msgid "Same as :meth:`Element.findall`, starting at the root of the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1139 +#: ../../library/xml.etree.elementtree.rst:1144 msgid "Same as :meth:`Element.findtext`, starting at the root of the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1144 +#: ../../library/xml.etree.elementtree.rst:1149 msgid "Returns the root element for this tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1149 +#: ../../library/xml.etree.elementtree.rst:1154 msgid "" "Creates and returns a tree iterator for the root element. The iterator " "loops over all elements in this tree, in section order. *tag* is the tag to " "look for (default is to return all elements)." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1156 +#: ../../library/xml.etree.elementtree.rst:1161 msgid "Same as :meth:`Element.iterfind`, starting at the root of the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1163 +#: ../../library/xml.etree.elementtree.rst:1168 msgid "" "Loads an external XML section into this element tree. *source* is a file " "name or :term:`file object`. *parser* is an optional parser instance. If " @@ -1688,7 +1693,7 @@ msgid "" "section root element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1173 +#: ../../library/xml.etree.elementtree.rst:1178 msgid "" "Writes the element tree to a file, as XML. *file* is a file name, or a :" "term:`file object` opened for writing. *encoding* [1]_ is the output " @@ -1703,7 +1708,7 @@ msgid "" "are emitted as a pair of start/end tags." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1187 +#: ../../library/xml.etree.elementtree.rst:1192 msgid "" "The output is either a string (:class:`str`) or binary (:class:`bytes`). " "This is controlled by the *encoding* argument. If *encoding* is " @@ -1713,17 +1718,17 @@ msgid "" "vice versa." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1197 +#: ../../library/xml.etree.elementtree.rst:1202 msgid "" "The :meth:`write` method now preserves the attribute order specified by the " "user." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1202 +#: ../../library/xml.etree.elementtree.rst:1207 msgid "This is the XML file that is going to be manipulated::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1204 +#: ../../library/xml.etree.elementtree.rst:1209 msgid "" "<html>\n" " <head>\n" @@ -1745,13 +1750,13 @@ msgstr "" " </body>\n" "</html>" -#: ../../library/xml.etree.elementtree.rst:1214 +#: ../../library/xml.etree.elementtree.rst:1219 msgid "" "Example of changing the attribute \"target\" of every link in first " "paragraph::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1216 +#: ../../library/xml.etree.elementtree.rst:1221 msgid "" ">>> from xml.etree.ElementTree import ElementTree\n" ">>> tree = ElementTree()\n" @@ -1769,11 +1774,11 @@ msgid "" ">>> tree.write(\"output.xhtml\")" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1234 +#: ../../library/xml.etree.elementtree.rst:1239 msgid "QName Objects" msgstr "QName 物件" -#: ../../library/xml.etree.elementtree.rst:1239 +#: ../../library/xml.etree.elementtree.rst:1244 msgid "" "QName wrapper. This can be used to wrap a QName attribute value, in order " "to get proper namespace handling on output. *text_or_uri* is a string " @@ -1783,11 +1788,11 @@ msgid "" "class:`QName` instances are opaque." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1251 +#: ../../library/xml.etree.elementtree.rst:1256 msgid "TreeBuilder Objects" msgstr "TreeBuilder 物件" -#: ../../library/xml.etree.elementtree.rst:1257 +#: ../../library/xml.etree.elementtree.rst:1262 msgid "" "Generic element structure builder. This builder converts a sequence of " "start, data, end, comment and pi method calls to a well-formed element " @@ -1795,14 +1800,14 @@ msgid "" "custom XML parser, or a parser for some other XML-like format." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1262 +#: ../../library/xml.etree.elementtree.rst:1267 msgid "" "*element_factory*, when given, must be a callable accepting two positional " "arguments: a tag and a dict of attributes. It is expected to return a new " "element instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1266 +#: ../../library/xml.etree.elementtree.rst:1271 msgid "" "The *comment_factory* and *pi_factory* functions, when given, should behave " "like the :func:`Comment` and :func:`ProcessingInstruction` functions to " @@ -1812,56 +1817,56 @@ msgid "" "element (but not outside of it)." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1275 +#: ../../library/xml.etree.elementtree.rst:1280 msgid "" "Flushes the builder buffers, and returns the toplevel document element. " "Returns an :class:`Element` instance." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1281 +#: ../../library/xml.etree.elementtree.rst:1286 msgid "" "Adds text to the current element. *data* is a string. This should be " "either a bytestring, or a Unicode string." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1287 +#: ../../library/xml.etree.elementtree.rst:1292 msgid "" "Closes the current element. *tag* is the element name. Returns the closed " "element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1293 +#: ../../library/xml.etree.elementtree.rst:1298 msgid "" "Opens a new element. *tag* is the element name. *attrs* is a dictionary " "containing element attributes. Returns the opened element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1299 +#: ../../library/xml.etree.elementtree.rst:1304 msgid "" "Creates a comment with the given *text*. If ``insert_comments`` is true, " "this will also add it to the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1307 +#: ../../library/xml.etree.elementtree.rst:1312 msgid "" "Creates a process instruction with the given *target* name and *text*. If " "``insert_pis`` is true, this will also add it to the tree." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1313 +#: ../../library/xml.etree.elementtree.rst:1318 msgid "" "In addition, a custom :class:`TreeBuilder` object can provide the following " "methods:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1318 +#: ../../library/xml.etree.elementtree.rst:1323 msgid "" "Handles a doctype declaration. *name* is the doctype name. *pubid* is the " "public identifier. *system* is the system identifier. This method does not " "exist on the default :class:`TreeBuilder` class." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1326 +#: ../../library/xml.etree.elementtree.rst:1331 msgid "" "Is called whenever the parser encounters a new namespace declaration, before " "the ``start()`` callback for the opening element that defines it. *prefix* " @@ -1869,14 +1874,14 @@ msgid "" "otherwise. *uri* is the namespace URI." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1335 +#: ../../library/xml.etree.elementtree.rst:1340 msgid "" "Is called after the ``end()`` callback of an element that declared a " "namespace prefix mapping, with the name of the *prefix* that went out of " "scope." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1347 +#: ../../library/xml.etree.elementtree.rst:1352 msgid "" "A `C14N 2.0 <https://www.w3.org/TR/xml-c14n2/>`_ writer. Arguments are the " "same as for the :func:`canonicalize` function. This class does not build a " @@ -1884,11 +1889,11 @@ msgid "" "using the *write* function." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1358 +#: ../../library/xml.etree.elementtree.rst:1363 msgid "XMLParser Objects" msgstr "XMLParser 物件" -#: ../../library/xml.etree.elementtree.rst:1363 +#: ../../library/xml.etree.elementtree.rst:1368 msgid "" "This class is the low-level building block of the module. It uses :mod:`xml." "parsers.expat` for efficient, event-based parsing of XML. It can be fed XML " @@ -1899,25 +1904,25 @@ msgid "" "XML file." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1371 +#: ../../library/xml.etree.elementtree.rst:1376 msgid "" "Parameters are now :ref:`keyword-only <keyword-only_parameter>`. The *html* " "argument is no longer supported." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1378 +#: ../../library/xml.etree.elementtree.rst:1383 msgid "" "Finishes feeding data to the parser. Returns the result of calling the " "``close()`` method of the *target* passed during construction; by default, " "this is the toplevel document element." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1385 +#: ../../library/xml.etree.elementtree.rst:1390 msgid "Feeds data to the parser. *data* is encoded data." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1390 -#: ../../library/xml.etree.elementtree.rst:1468 +#: ../../library/xml.etree.elementtree.rst:1395 +#: ../../library/xml.etree.elementtree.rst:1473 msgid "" "Triggers parsing of any previously fed unparsed data, which can be used to " "ensure more immediate feedback, in particular with Expat >=2.6.0. The " @@ -1927,15 +1932,15 @@ msgid "" "xmlparser.SetReparseDeferralEnabled` for details." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1397 -#: ../../library/xml.etree.elementtree.rst:1475 +#: ../../library/xml.etree.elementtree.rst:1402 +#: ../../library/xml.etree.elementtree.rst:1480 msgid "" "Note that :meth:`flush` has been backported to some prior releases of " "CPython as a security fix. Check for availability of :meth:`flush` using :" "func:`hasattr` if used in code running across a variety of Python versions." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1405 +#: ../../library/xml.etree.elementtree.rst:1410 msgid "" ":meth:`XMLParser.feed` calls *target*\\'s ``start(tag, attrs_dict)`` method " "for each opening tag, its ``end(tag)`` method for each closing tag, and data " @@ -1946,7 +1951,7 @@ msgid "" "of an XML file::" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1413 +#: ../../library/xml.etree.elementtree.rst:1418 msgid "" ">>> from xml.etree.ElementTree import XMLParser\n" ">>> class MaxDepth: # The target object of the parser\n" @@ -1981,11 +1986,11 @@ msgid "" "4" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1449 +#: ../../library/xml.etree.elementtree.rst:1454 msgid "XMLPullParser Objects" msgstr "XMLPullParser 物件" -#: ../../library/xml.etree.elementtree.rst:1453 +#: ../../library/xml.etree.elementtree.rst:1458 msgid "" "A pull parser suitable for non-blocking applications. Its input-side API is " "similar to that of :class:`XMLParser`, but instead of pushing calls to a " @@ -1997,11 +2002,11 @@ msgid "" "If *events* is omitted, only ``\"end\"`` events are reported." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1464 +#: ../../library/xml.etree.elementtree.rst:1469 msgid "Feed the given bytes data to the parser." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1484 +#: ../../library/xml.etree.elementtree.rst:1489 msgid "" "Signal the parser that the data stream is terminated. Unlike :meth:" "`XMLParser.close`, this method always returns :const:`None`. Any events not " @@ -2009,7 +2014,7 @@ msgid "" "`read_events`." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1491 +#: ../../library/xml.etree.elementtree.rst:1496 msgid "" "Return an iterator over the events which have been encountered in the data " "fed to the parser. The iterator yields ``(event, elem)`` pairs, where " @@ -2018,25 +2023,25 @@ msgid "" "follows." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1497 +#: ../../library/xml.etree.elementtree.rst:1502 msgid "``start``, ``end``: the current Element." msgstr "``start``、``end``:目前的 Element。" -#: ../../library/xml.etree.elementtree.rst:1498 +#: ../../library/xml.etree.elementtree.rst:1503 msgid "``comment``, ``pi``: the current comment / processing instruction" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1499 +#: ../../library/xml.etree.elementtree.rst:1504 msgid "" "``start-ns``: a tuple ``(prefix, uri)`` naming the declared namespace " "mapping." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1501 +#: ../../library/xml.etree.elementtree.rst:1506 msgid "``end-ns``: :const:`None` (this may change in a future version)" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1503 +#: ../../library/xml.etree.elementtree.rst:1508 msgid "" "Events provided in a previous call to :meth:`read_events` will not be " "yielded again. Events are consumed from the internal queue only when they " @@ -2045,7 +2050,7 @@ msgid "" "results." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1511 +#: ../../library/xml.etree.elementtree.rst:1516 msgid "" ":class:`XMLPullParser` only guarantees that it has seen the \">\" character " "of a starting tag when it emits a \"start\" event, so the attributes are " @@ -2054,11 +2059,11 @@ msgid "" "be present." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1526 +#: ../../library/xml.etree.elementtree.rst:1531 msgid "Exceptions" msgstr "例外" -#: ../../library/xml.etree.elementtree.rst:1530 +#: ../../library/xml.etree.elementtree.rst:1535 msgid "" "XML parse error, raised by the various parsing methods in this module when " "parsing fails. The string representation of an instance of this exception " @@ -2066,22 +2071,22 @@ msgid "" "following attributes available:" msgstr "" -#: ../../library/xml.etree.elementtree.rst:1537 +#: ../../library/xml.etree.elementtree.rst:1542 msgid "" "A numeric error code from the expat parser. See the documentation of :mod:" "`xml.parsers.expat` for the list of error codes and their meanings." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1542 +#: ../../library/xml.etree.elementtree.rst:1547 msgid "" "A tuple of *line*, *column* numbers, specifying where the error occurred." msgstr "" -#: ../../library/xml.etree.elementtree.rst:1545 +#: ../../library/xml.etree.elementtree.rst:1550 msgid "Footnotes" msgstr "註解" -#: ../../library/xml.etree.elementtree.rst:1546 +#: ../../library/xml.etree.elementtree.rst:1551 msgid "" "The encoding string included in XML output should conform to the appropriate " "standards. For example, \"UTF-8\" is valid, but \"UTF8\" is not. See " diff --git a/library/xml.po b/library/xml.po index 09721a17e1..d23f35acd4 100644 --- a/library/xml.po +++ b/library/xml.po @@ -6,7 +6,7 @@ # Matt Wang <mattwang44@gmail.com>, 2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-04-18 00:04+0000\n" "PO-Revision-Date: 2023-08-21 02:16+0000\n" diff --git a/library/xml.sax.handler.po b/library/xml.sax.handler.po index ca9c9cb7ba..fdc38671c3 100644 --- a/library/xml.sax.handler.po +++ b/library/xml.sax.handler.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2016-11-19 00:36+0000\n" diff --git a/library/xml.sax.po b/library/xml.sax.po index 4a89f1ed1d..2e824867ca 100644 --- a/library/xml.sax.po +++ b/library/xml.sax.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2016-11-19 00:36+0000\n" diff --git a/library/xml.sax.reader.po b/library/xml.sax.reader.po index 7f8fc189b2..7ec2580467 100644 --- a/library/xml.sax.reader.po +++ b/library/xml.sax.reader.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xml.sax.utils.po b/library/xml.sax.utils.po index 87dd0585ea..12044fcbee 100644 --- a/library/xml.sax.utils.po +++ b/library/xml.sax.utils.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/xmlrpc.client.po b/library/xmlrpc.client.po index 31112ab712..927aeeba24 100644 --- a/library/xmlrpc.client.po +++ b/library/xmlrpc.client.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -48,17 +48,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability <availability>`: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability <availability>`: not WASI." +msgstr ":ref:`適用 <availability>`:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/xmlrpc.client.rst:41 msgid "" diff --git a/library/xmlrpc.po b/library/xmlrpc.po index e744806400..15a6dc34eb 100644 --- a/library/xmlrpc.po +++ b/library/xmlrpc.po @@ -5,7 +5,7 @@ # Matt Wang <mattwang44@gamil.com>, 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 10:36+0000\n" "PO-Revision-Date: 2022-02-16 01:58+0800\n" diff --git a/library/xmlrpc.server.po b/library/xmlrpc.server.po index 44d4e5413d..7e1eba8c5a 100644 --- a/library/xmlrpc.server.po +++ b/library/xmlrpc.server.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -42,17 +42,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability <availability>`: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability <availability>`: not WASI." +msgstr ":ref:`適用 <availability>`:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/xmlrpc.server.rst:32 msgid "" diff --git a/library/zipapp.po b/library/zipapp.po index bdb7de3d4a..02fc69d0ea 100644 --- a/library/zipapp.po +++ b/library/zipapp.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" diff --git a/library/zipfile.po b/library/zipfile.po index 4133e1f7be..acfa9acf15 100644 --- a/library/zipfile.po +++ b/library/zipfile.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:16+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -91,40 +91,47 @@ msgid "" "ref:`zipinfo-objects`." msgstr "" -#: ../../library/zipfile.rst:84 +#: ../../library/zipfile.rst:82 +msgid "" +"A public :attr:`!compress_level` attribute has been added to expose the " +"formerly protected :attr:`!_compresslevel`. The older protected name " +"continues to work as a property for backwards compatibility." +msgstr "" + +#: ../../library/zipfile.rst:89 msgid "" "Returns ``True`` if *filename* is a valid ZIP file based on its magic " "number, otherwise returns ``False``. *filename* may be a file or file-like " "object too." msgstr "" -#: ../../library/zipfile.rst:87 +#: ../../library/zipfile.rst:92 msgid "Support for file and file-like objects." msgstr "" -#: ../../library/zipfile.rst:93 +#: ../../library/zipfile.rst:98 msgid "The numeric constant for an uncompressed archive member." msgstr "" -#: ../../library/zipfile.rst:98 +#: ../../library/zipfile.rst:103 msgid "" "The numeric constant for the usual ZIP compression method. This requires " "the :mod:`zlib` module." msgstr "" -#: ../../library/zipfile.rst:104 +#: ../../library/zipfile.rst:109 msgid "" "The numeric constant for the BZIP2 compression method. This requires the :" "mod:`bz2` module." msgstr "" -#: ../../library/zipfile.rst:111 +#: ../../library/zipfile.rst:116 msgid "" "The numeric constant for the LZMA compression method. This requires the :" "mod:`lzma` module." msgstr "" -#: ../../library/zipfile.rst:118 +#: ../../library/zipfile.rst:123 msgid "" "The ZIP file format specification has included support for bzip2 compression " "since 2001, and for LZMA compression since 2006. However, some tools " @@ -133,37 +140,37 @@ msgid "" "individual files." msgstr "" -#: ../../library/zipfile.rst:127 +#: ../../library/zipfile.rst:132 msgid "`PKZIP Application Note`_" msgstr "" -#: ../../library/zipfile.rst:128 +#: ../../library/zipfile.rst:133 msgid "" "Documentation on the ZIP file format by Phil Katz, the creator of the format " "and algorithms used." msgstr "" -#: ../../library/zipfile.rst:131 +#: ../../library/zipfile.rst:136 msgid "`Info-ZIP Home Page <https://infozip.sourceforge.net/>`_" msgstr "`Info-ZIP 首頁 <https://infozip.sourceforge.net/>`_" -#: ../../library/zipfile.rst:132 +#: ../../library/zipfile.rst:137 msgid "" "Information about the Info-ZIP project's ZIP archive programs and " "development libraries." msgstr "" -#: ../../library/zipfile.rst:139 +#: ../../library/zipfile.rst:144 msgid "ZipFile Objects" msgstr "ZipFile 物件" -#: ../../library/zipfile.rst:146 +#: ../../library/zipfile.rst:151 msgid "" "Open a ZIP file, where *file* can be a path to a file (a string), a file-" "like object or a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:149 +#: ../../library/zipfile.rst:154 msgid "" "The *mode* parameter should be ``'r'`` to read an existing file, ``'w'`` to " "truncate and write a new file, ``'a'`` to append to an existing file, or " @@ -177,7 +184,7 @@ msgid "" "``'r'`` or ``'a'``, the file should be seekable." msgstr "" -#: ../../library/zipfile.rst:161 +#: ../../library/zipfile.rst:166 msgid "" "*compression* is the ZIP compression method to use when writing the archive, " "and should be :const:`ZIP_STORED`, :const:`ZIP_DEFLATED`, :const:`ZIP_BZIP2` " @@ -188,7 +195,7 @@ msgid "" "is raised. The default is :const:`ZIP_STORED`." msgstr "" -#: ../../library/zipfile.rst:169 +#: ../../library/zipfile.rst:174 msgid "" "If *allowZip64* is ``True`` (the default) zipfile will create ZIP files that " "use the ZIP64 extensions when the zipfile is larger than 4 GiB. If it is " @@ -196,7 +203,7 @@ msgid "" "require ZIP64 extensions." msgstr "" -#: ../../library/zipfile.rst:174 +#: ../../library/zipfile.rst:179 msgid "" "The *compresslevel* parameter controls the compression level to use when " "writing files to the archive. When using :const:`ZIP_STORED` or :const:" @@ -206,7 +213,7 @@ msgid "" "accepted (see :class:`bz2 <bz2.BZ2File>` for more information)." msgstr "" -#: ../../library/zipfile.rst:182 ../../library/zipfile.rst:735 +#: ../../library/zipfile.rst:187 ../../library/zipfile.rst:760 msgid "" "The *strict_timestamps* argument, when set to ``False``, allows to zip files " "older than 1980-01-01 at the cost of setting the timestamp to 1980-01-01. " @@ -214,28 +221,28 @@ msgid "" "also set to the limit." msgstr "" -#: ../../library/zipfile.rst:188 +#: ../../library/zipfile.rst:193 msgid "" "When mode is ``'r'``, *metadata_encoding* may be set to the name of a codec, " "which will be used to decode metadata such as the names of members and ZIP " "comments." msgstr "" -#: ../../library/zipfile.rst:192 +#: ../../library/zipfile.rst:197 msgid "" "If the file is created with mode ``'w'``, ``'x'`` or ``'a'`` and then :meth:" "`closed <close>` without adding any files to the archive, the appropriate " "ZIP structures for an empty archive will be written to the file." msgstr "" -#: ../../library/zipfile.rst:196 +#: ../../library/zipfile.rst:201 msgid "" "ZipFile is also a context manager and therefore supports the :keyword:`with` " "statement. In the example, *myzip* is closed after the :keyword:`!with` " "statement's suite is finished---even if an exception occurs::" msgstr "" -#: ../../library/zipfile.rst:200 +#: ../../library/zipfile.rst:205 msgid "" "with ZipFile('spam.zip', 'w') as myzip:\n" " myzip.write('eggs.txt')" @@ -243,13 +250,13 @@ msgstr "" "with ZipFile('spam.zip', 'w') as myzip:\n" " myzip.write('eggs.txt')" -#: ../../library/zipfile.rst:205 +#: ../../library/zipfile.rst:210 msgid "" "*metadata_encoding* is an instance-wide setting for the ZipFile. It is not " "currently possible to set this on a per-member basis." msgstr "" -#: ../../library/zipfile.rst:208 +#: ../../library/zipfile.rst:213 msgid "" "This attribute is a workaround for legacy implementations which produce " "archives with names in the current locale encoding or code page (mostly on " @@ -259,73 +266,73 @@ msgid "" "is a Python-specific extension." msgstr "" -#: ../../library/zipfile.rst:216 +#: ../../library/zipfile.rst:221 msgid "Added the ability to use :class:`ZipFile` as a context manager." msgstr "新增 :class:`ZipFile` 作為情境管理器使用的能力。" -#: ../../library/zipfile.rst:219 +#: ../../library/zipfile.rst:224 msgid "Added support for :mod:`bzip2 <bz2>` and :mod:`lzma` compression." msgstr "新增對於 :mod:`bzip2 <bz2>` 和 :mod:`lzma` 壓縮的支援。" -#: ../../library/zipfile.rst:222 ../../library/zipfile.rst:648 +#: ../../library/zipfile.rst:227 ../../library/zipfile.rst:673 msgid "ZIP64 extensions are enabled by default." msgstr "" -#: ../../library/zipfile.rst:225 +#: ../../library/zipfile.rst:230 msgid "" "Added support for writing to unseekable streams. Added support for the " "``'x'`` mode." msgstr "" -#: ../../library/zipfile.rst:229 +#: ../../library/zipfile.rst:234 msgid "" "Previously, a plain :exc:`RuntimeError` was raised for unrecognized " "compression values." msgstr "" -#: ../../library/zipfile.rst:233 +#: ../../library/zipfile.rst:238 msgid "The *file* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:236 +#: ../../library/zipfile.rst:241 msgid "Add the *compresslevel* parameter." msgstr "" -#: ../../library/zipfile.rst:239 +#: ../../library/zipfile.rst:244 msgid "The *strict_timestamps* keyword-only parameter." msgstr "" -#: ../../library/zipfile.rst:242 +#: ../../library/zipfile.rst:247 msgid "" "Added support for specifying member name encoding for reading metadata in " "the zipfile's directory and file headers." msgstr "" -#: ../../library/zipfile.rst:249 +#: ../../library/zipfile.rst:254 msgid "" "Close the archive file. You must call :meth:`close` before exiting your " "program or essential records will not be written." msgstr "" -#: ../../library/zipfile.rst:255 +#: ../../library/zipfile.rst:260 msgid "" "Return a :class:`ZipInfo` object with information about the archive member " "*name*. Calling :meth:`getinfo` for a name not currently contained in the " "archive will raise a :exc:`KeyError`." msgstr "" -#: ../../library/zipfile.rst:262 +#: ../../library/zipfile.rst:267 msgid "" "Return a list containing a :class:`ZipInfo` object for each member of the " "archive. The objects are in the same order as their entries in the actual " "ZIP file on disk if an existing archive was opened." msgstr "" -#: ../../library/zipfile.rst:269 +#: ../../library/zipfile.rst:274 msgid "Return a list of archive members by name." msgstr "" -#: ../../library/zipfile.rst:274 +#: ../../library/zipfile.rst:279 msgid "" "Access a member of the archive as a binary file-like object. *name* can be " "either the name of a file within the archive or a :class:`ZipInfo` object. " @@ -334,13 +341,13 @@ msgid "" "class:`bytes` object." msgstr "" -#: ../../library/zipfile.rst:280 +#: ../../library/zipfile.rst:285 msgid "" ":meth:`~ZipFile.open` is also a context manager and therefore supports the :" "keyword:`with` statement::" msgstr "" -#: ../../library/zipfile.rst:283 +#: ../../library/zipfile.rst:288 msgid "" "with ZipFile('spam.zip') as myzip:\n" " with myzip.open('eggs.txt') as myfile:\n" @@ -350,7 +357,7 @@ msgstr "" " with myzip.open('eggs.txt') as myfile:\n" " print(myfile.read())" -#: ../../library/zipfile.rst:287 +#: ../../library/zipfile.rst:292 msgid "" "With *mode* ``'r'`` the file-like object (``ZipExtFile``) is read-only and " "provides the following methods: :meth:`~io.BufferedIOBase.read`, :meth:`~io." @@ -359,7 +366,7 @@ msgid "" "__next__`. These objects can operate independently of the ZipFile." msgstr "" -#: ../../library/zipfile.rst:294 +#: ../../library/zipfile.rst:299 msgid "" "With ``mode='w'``, a writable file handle is returned, which supports the :" "meth:`~io.BufferedIOBase.write` method. While a writable file handle is " @@ -367,7 +374,14 @@ msgid "" "exc:`ValueError`." msgstr "" -#: ../../library/zipfile.rst:299 +#: ../../library/zipfile.rst:304 +msgid "" +"In both cases the file-like object has also attributes :attr:`!name`, which " +"is equivalent to the name of a file within the archive, and :attr:`!mode`, " +"which is ``'rb'`` or ``'wb'`` depending on the input mode." +msgstr "" + +#: ../../library/zipfile.rst:308 msgid "" "When writing a file, if the file size is not known in advance but may exceed " "2 GiB, pass ``force_zip64=True`` to ensure that the header format is capable " @@ -376,32 +390,39 @@ msgid "" "as the *name* parameter." msgstr "" -#: ../../library/zipfile.rst:307 +#: ../../library/zipfile.rst:316 msgid "" "The :meth:`.open`, :meth:`read` and :meth:`extract` methods can take a " "filename or a :class:`ZipInfo` object. You will appreciate this when trying " "to read a ZIP file that contains members with duplicate names." msgstr "" -#: ../../library/zipfile.rst:311 +#: ../../library/zipfile.rst:320 msgid "" "Removed support of ``mode='U'``. Use :class:`io.TextIOWrapper` for reading " "compressed text files in :term:`universal newlines` mode." msgstr "" -#: ../../library/zipfile.rst:315 +#: ../../library/zipfile.rst:324 msgid "" ":meth:`ZipFile.open` can now be used to write files into the archive with " "the ``mode='w'`` option." msgstr "" -#: ../../library/zipfile.rst:319 +#: ../../library/zipfile.rst:328 msgid "" "Calling :meth:`.open` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:326 +#: ../../library/zipfile.rst:332 +msgid "" +"Added attributes :attr:`!name` and :attr:`!mode` for the writeable file-like " +"object. The value of the :attr:`!mode` attribute for the readable file-like " +"object was changed from ``'r'`` to ``'rb'``." +msgstr "" + +#: ../../library/zipfile.rst:341 msgid "" "Extract a member from the archive to the current working directory; *member* " "must be its full name or a :class:`ZipInfo` object. Its file information is " @@ -410,11 +431,11 @@ msgid "" "*pwd* is the password used for encrypted files as a :class:`bytes` object." msgstr "" -#: ../../library/zipfile.rst:332 +#: ../../library/zipfile.rst:347 msgid "Returns the normalized path created (a directory or new file)." msgstr "" -#: ../../library/zipfile.rst:336 +#: ../../library/zipfile.rst:351 msgid "" "If a member filename is an absolute path, a drive/UNC sharepoint and leading " "(back)slashes will be stripped, e.g.: ``///foo/bar`` becomes ``foo/bar`` on " @@ -425,17 +446,17 @@ msgid "" "(``_``)." msgstr "" -#: ../../library/zipfile.rst:344 +#: ../../library/zipfile.rst:359 msgid "" "Calling :meth:`extract` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:348 ../../library/zipfile.rst:371 +#: ../../library/zipfile.rst:363 ../../library/zipfile.rst:386 msgid "The *path* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:354 +#: ../../library/zipfile.rst:369 msgid "" "Extract all members from the archive to the current working directory. " "*path* specifies a different directory to extract to. *members* is optional " @@ -443,7 +464,7 @@ msgid "" "password used for encrypted files as a :class:`bytes` object." msgstr "" -#: ../../library/zipfile.rst:361 +#: ../../library/zipfile.rst:376 msgid "" "Never extract archives from untrusted sources without prior inspection. It " "is possible that files are created outside of *path*, e.g. members that have " @@ -451,23 +472,23 @@ msgid "" "\"``. This module attempts to prevent that. See :meth:`extract` note." msgstr "" -#: ../../library/zipfile.rst:367 +#: ../../library/zipfile.rst:382 msgid "" "Calling :meth:`extractall` on a closed ZipFile will raise a :exc:" "`ValueError`. Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:377 +#: ../../library/zipfile.rst:392 msgid "Print a table of contents for the archive to ``sys.stdout``." msgstr "" -#: ../../library/zipfile.rst:382 +#: ../../library/zipfile.rst:397 msgid "" "Set *pwd* (a :class:`bytes` object) as default password to extract encrypted " "files." msgstr "" -#: ../../library/zipfile.rst:387 +#: ../../library/zipfile.rst:402 msgid "" "Return the bytes of the file *name* in the archive. *name* is the name of " "the file in the archive, or a :class:`ZipInfo` object. The archive must be " @@ -480,25 +501,25 @@ msgid "" "compression module is not available." msgstr "" -#: ../../library/zipfile.rst:396 +#: ../../library/zipfile.rst:411 msgid "" "Calling :meth:`read` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:403 +#: ../../library/zipfile.rst:418 msgid "" "Read all the files in the archive and check their CRC's and file headers. " "Return the name of the first bad file, or else return ``None``." msgstr "" -#: ../../library/zipfile.rst:406 +#: ../../library/zipfile.rst:421 msgid "" "Calling :meth:`testzip` on a closed ZipFile will raise a :exc:`ValueError`. " "Previously, a :exc:`RuntimeError` was raised." msgstr "" -#: ../../library/zipfile.rst:414 +#: ../../library/zipfile.rst:429 msgid "" "Write the file named *filename* to the archive, giving it the archive name " "*arcname* (by default, this will be the same as *filename*, but without a " @@ -509,7 +530,7 @@ msgid "" "``'x'`` or ``'a'``." msgstr "" -#: ../../library/zipfile.rst:424 +#: ../../library/zipfile.rst:439 msgid "" "The ZIP file standard historically did not specify a metadata encoding, but " "strongly recommended CP437 (the original IBM PC encoding) for " @@ -519,33 +540,33 @@ msgid "" "in any encoding other than ASCII or UTF-8." msgstr "" -#: ../../library/zipfile.rst:433 +#: ../../library/zipfile.rst:448 msgid "" "Archive names should be relative to the archive root, that is, they should " "not start with a path separator." msgstr "" -#: ../../library/zipfile.rst:438 +#: ../../library/zipfile.rst:453 msgid "" "If ``arcname`` (or ``filename``, if ``arcname`` is not given) contains a " "null byte, the name of the file in the archive will be truncated at the null " "byte." msgstr "" -#: ../../library/zipfile.rst:443 +#: ../../library/zipfile.rst:458 msgid "" "A leading slash in the filename may lead to the archive being impossible to " "open in some zip programs on Windows systems." msgstr "" -#: ../../library/zipfile.rst:446 +#: ../../library/zipfile.rst:461 msgid "" "Calling :meth:`write` on a ZipFile created with mode ``'r'`` or a closed " "ZipFile will raise a :exc:`ValueError`. Previously, a :exc:`RuntimeError` " "was raised." msgstr "" -#: ../../library/zipfile.rst:455 +#: ../../library/zipfile.rst:470 msgid "" "Write a file into the archive. The contents is *data*, which may be either " "a :class:`str` or a :class:`bytes` instance; if it is a :class:`str`, it is " @@ -556,7 +577,7 @@ msgid "" "must be opened with mode ``'w'``, ``'x'`` or ``'a'``." msgstr "" -#: ../../library/zipfile.rst:463 +#: ../../library/zipfile.rst:478 msgid "" "If given, *compress_type* overrides the value given for the *compression* " "parameter to the constructor for the new entry, or in the *zinfo_or_arcname* " @@ -564,7 +585,7 @@ msgid "" "override the constructor if given." msgstr "" -#: ../../library/zipfile.rst:470 +#: ../../library/zipfile.rst:485 msgid "" "When passing a :class:`ZipInfo` instance as the *zinfo_or_arcname* " "parameter, the compression method used will be that specified in the " @@ -572,18 +593,18 @@ msgid "" "the :class:`ZipInfo` constructor sets this member to :const:`ZIP_STORED`." msgstr "" -#: ../../library/zipfile.rst:475 +#: ../../library/zipfile.rst:490 msgid "The *compress_type* argument." msgstr "*compress_type* 引數。" -#: ../../library/zipfile.rst:478 +#: ../../library/zipfile.rst:493 msgid "" "Calling :meth:`writestr` on a ZipFile created with mode ``'r'`` or a closed " "ZipFile will raise a :exc:`ValueError`. Previously, a :exc:`RuntimeError` " "was raised." msgstr "" -#: ../../library/zipfile.rst:485 +#: ../../library/zipfile.rst:500 msgid "" "Create a directory inside the archive. If *zinfo_or_directory* is a string, " "a directory is created inside the archive with the mode that is specified in " @@ -591,26 +612,26 @@ msgid "" "instance then the *mode* argument is ignored." msgstr "" -#: ../../library/zipfile.rst:490 +#: ../../library/zipfile.rst:505 msgid "The archive must be opened with mode ``'w'``, ``'x'`` or ``'a'``." msgstr "" -#: ../../library/zipfile.rst:495 +#: ../../library/zipfile.rst:510 msgid "The following data attributes are also available:" msgstr "" -#: ../../library/zipfile.rst:499 +#: ../../library/zipfile.rst:514 msgid "Name of the ZIP file." msgstr "" -#: ../../library/zipfile.rst:503 +#: ../../library/zipfile.rst:518 msgid "" "The level of debug output to use. This may be set from ``0`` (the default, " "no output) to ``3`` (the most output). Debugging information is written to " "``sys.stdout``." msgstr "" -#: ../../library/zipfile.rst:509 +#: ../../library/zipfile.rst:524 msgid "" "The comment associated with the ZIP file as a :class:`bytes` object. If " "assigning a comment to a :class:`ZipFile` instance created with mode " @@ -618,37 +639,37 @@ msgid "" "Comments longer than this will be truncated." msgstr "" -#: ../../library/zipfile.rst:519 +#: ../../library/zipfile.rst:534 msgid "Path Objects" msgstr "" -#: ../../library/zipfile.rst:523 +#: ../../library/zipfile.rst:538 msgid "" "Construct a Path object from a ``root`` zipfile (which may be a :class:" "`ZipFile` instance or ``file`` suitable for passing to the :class:`ZipFile` " "constructor)." msgstr "" -#: ../../library/zipfile.rst:527 +#: ../../library/zipfile.rst:542 msgid "" "``at`` specifies the location of this Path within the zipfile, e.g. 'dir/" "file.txt', 'dir/', or ''. Defaults to the empty string, indicating the root." msgstr "" -#: ../../library/zipfile.rst:531 +#: ../../library/zipfile.rst:546 msgid "" "Path objects expose the following features of :mod:`pathlib.Path` objects:" msgstr "" -#: ../../library/zipfile.rst:534 +#: ../../library/zipfile.rst:549 msgid "Path objects are traversable using the ``/`` operator or ``joinpath``." msgstr "" -#: ../../library/zipfile.rst:538 +#: ../../library/zipfile.rst:553 msgid "The final path component." msgstr "" -#: ../../library/zipfile.rst:542 +#: ../../library/zipfile.rst:557 msgid "" "Invoke :meth:`ZipFile.open` on the current path. Allows opening for read or " "write, text or binary through supported modes: 'r', 'w', 'rb', 'wb'. " @@ -657,12 +678,12 @@ msgid "" "``pwd`` parameter to :meth:`ZipFile.open`." msgstr "" -#: ../../library/zipfile.rst:551 +#: ../../library/zipfile.rst:566 msgid "" "Added support for text and binary modes for open. Default mode is now text." msgstr "" -#: ../../library/zipfile.rst:555 ../../library/zipfile.rst:606 +#: ../../library/zipfile.rst:570 ../../library/zipfile.rst:631 msgid "" "The ``encoding`` parameter can be supplied as a positional argument without " "causing a :exc:`TypeError`. As it could in 3.9. Code needing to be " @@ -670,124 +691,134 @@ msgid "" "TextIOWrapper` arguments, ``encoding`` included, as keywords." msgstr "" -#: ../../library/zipfile.rst:563 +#: ../../library/zipfile.rst:578 msgid "Enumerate the children of the current directory." msgstr "" -#: ../../library/zipfile.rst:567 +#: ../../library/zipfile.rst:582 msgid "Return ``True`` if the current context references a directory." msgstr "" -#: ../../library/zipfile.rst:571 +#: ../../library/zipfile.rst:586 msgid "Return ``True`` if the current context references a file." msgstr "" -#: ../../library/zipfile.rst:575 +#: ../../library/zipfile.rst:590 +msgid "Return ``True`` if the current context references a symbolic link." +msgstr "" + +#: ../../library/zipfile.rst:594 +msgid "Previously, ``is_symlink`` would unconditionally return ``False``." +msgstr "" + +#: ../../library/zipfile.rst:599 msgid "" "Return ``True`` if the current context references a file or directory in the " "zip file." msgstr "" -#: ../../library/zipfile.rst:580 -msgid "The file extension of the final component." +#: ../../library/zipfile.rst:604 +msgid "" +"The last dot-separated portion of the final component, if any. This is " +"commonly called the file extension." msgstr "" -#: ../../library/zipfile.rst:582 +#: ../../library/zipfile.rst:607 msgid "Added :data:`Path.suffix` property." msgstr "新增 :data:`Path.suffix` 特性。" -#: ../../library/zipfile.rst:587 +#: ../../library/zipfile.rst:612 msgid "The final path component, without its suffix." msgstr "" -#: ../../library/zipfile.rst:589 +#: ../../library/zipfile.rst:614 msgid "Added :data:`Path.stem` property." msgstr "新增 :data:`Path.stem` 特性。" -#: ../../library/zipfile.rst:594 -msgid "A list of the path’s file extensions." +#: ../../library/zipfile.rst:619 +msgid "A list of the path’s suffixes, commonly called file extensions." msgstr "" -#: ../../library/zipfile.rst:596 +#: ../../library/zipfile.rst:621 msgid "Added :data:`Path.suffixes` property." msgstr "新增 :data:`Path.suffixes` 特性。" -#: ../../library/zipfile.rst:601 +#: ../../library/zipfile.rst:626 msgid "" "Read the current file as unicode text. Positional and keyword arguments are " "passed through to :class:`io.TextIOWrapper` (except ``buffer``, which is " "implied by the context)." msgstr "" -#: ../../library/zipfile.rst:614 +#: ../../library/zipfile.rst:639 msgid "Read the current file as bytes." msgstr "" -#: ../../library/zipfile.rst:618 +#: ../../library/zipfile.rst:643 msgid "" "Return a new Path object with each of the *other* arguments joined. The " "following are equivalent::" msgstr "" -#: ../../library/zipfile.rst:621 +#: ../../library/zipfile.rst:646 msgid "" ">>> Path(...).joinpath('child').joinpath('grandchild')\n" ">>> Path(...).joinpath('child', 'grandchild')\n" ">>> Path(...) / 'child' / 'grandchild'" msgstr "" -#: ../../library/zipfile.rst:625 +#: ../../library/zipfile.rst:650 msgid "" "Prior to 3.10, ``joinpath`` was undocumented and accepted exactly one " "parameter." msgstr "" -#: ../../library/zipfile.rst:629 +#: ../../library/zipfile.rst:654 msgid "" "The :pypi:`zipp` project provides backports of the latest path object " "functionality to older Pythons. Use ``zipp.Path`` in place of ``zipfile." "Path`` for early access to changes." msgstr "" -#: ../../library/zipfile.rst:637 +#: ../../library/zipfile.rst:662 msgid "PyZipFile Objects" msgstr "PyZipFile 物件" -#: ../../library/zipfile.rst:639 +#: ../../library/zipfile.rst:664 msgid "" "The :class:`PyZipFile` constructor takes the same parameters as the :class:" "`ZipFile` constructor, and one additional parameter, *optimize*." msgstr "" -#: ../../library/zipfile.rst:645 +#: ../../library/zipfile.rst:670 msgid "Added the *optimize* parameter." msgstr "新增 *optimize* 參數。" -#: ../../library/zipfile.rst:651 +#: ../../library/zipfile.rst:676 msgid "" "Instances have one method in addition to those of :class:`ZipFile` objects:" msgstr "" -#: ../../library/zipfile.rst:655 +#: ../../library/zipfile.rst:680 msgid "" "Search for files :file:`\\*.py` and add the corresponding file to the " "archive." msgstr "" -#: ../../library/zipfile.rst:658 +#: ../../library/zipfile.rst:683 msgid "" "If the *optimize* parameter to :class:`PyZipFile` was not given or ``-1``, " "the corresponding file is a :file:`\\*.pyc` file, compiling if necessary." msgstr "" -#: ../../library/zipfile.rst:661 +#: ../../library/zipfile.rst:686 msgid "" "If the *optimize* parameter to :class:`PyZipFile` was ``0``, ``1`` or ``2``, " "only files with that optimization level (see :func:`compile`) are added to " "the archive, compiling if necessary." msgstr "" -#: ../../library/zipfile.rst:665 +#: ../../library/zipfile.rst:690 msgid "" "If *pathname* is a file, the filename must end with :file:`.py`, and just " "the (corresponding :file:`\\*.pyc`) file is added at the top level (no path " @@ -800,11 +831,11 @@ msgid "" "in sorted order." msgstr "" -#: ../../library/zipfile.rst:675 +#: ../../library/zipfile.rst:700 msgid "*basename* is intended for internal use only." msgstr "" -#: ../../library/zipfile.rst:677 +#: ../../library/zipfile.rst:702 msgid "" "*filterfunc*, if given, must be a function taking a single string argument. " "It will be passed each path (including each individual full file path) " @@ -815,7 +846,7 @@ msgid "" "exclude them::" msgstr "" -#: ../../library/zipfile.rst:685 +#: ../../library/zipfile.rst:710 msgid "" ">>> zf = PyZipFile('myprog.zip')\n" ">>> def notests(s):\n" @@ -831,11 +862,11 @@ msgstr "" "...\n" ">>> zf.writepy('myprog', filterfunc=notests)" -#: ../../library/zipfile.rst:692 +#: ../../library/zipfile.rst:717 msgid "The :meth:`writepy` method makes archives with file names like this::" msgstr "" -#: ../../library/zipfile.rst:695 +#: ../../library/zipfile.rst:720 msgid "" "string.pyc # Top level name\n" "test/__init__.pyc # Package directory\n" @@ -844,302 +875,302 @@ msgid "" "test/bogus/myfile.pyc # Submodule test.bogus.myfile" msgstr "" -#: ../../library/zipfile.rst:701 +#: ../../library/zipfile.rst:726 msgid "Added the *filterfunc* parameter." msgstr "新增 *filterfunc* 參數。" -#: ../../library/zipfile.rst:704 +#: ../../library/zipfile.rst:729 msgid "The *pathname* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:707 +#: ../../library/zipfile.rst:732 msgid "Recursion sorts directory entries." msgstr "" -#: ../../library/zipfile.rst:714 +#: ../../library/zipfile.rst:739 msgid "ZipInfo Objects" msgstr "ZipInfo 物件" -#: ../../library/zipfile.rst:716 +#: ../../library/zipfile.rst:741 msgid "" "Instances of the :class:`ZipInfo` class are returned by the :meth:`.getinfo` " "and :meth:`.infolist` methods of :class:`ZipFile` objects. Each object " "stores information about a single member of the ZIP archive." msgstr "" -#: ../../library/zipfile.rst:720 +#: ../../library/zipfile.rst:745 msgid "" "There is one classmethod to make a :class:`ZipInfo` instance for a " "filesystem file:" msgstr "" -#: ../../library/zipfile.rst:726 +#: ../../library/zipfile.rst:751 msgid "" "Construct a :class:`ZipInfo` instance for a file on the filesystem, in " "preparation for adding it to a zip file." msgstr "" -#: ../../library/zipfile.rst:729 +#: ../../library/zipfile.rst:754 msgid "*filename* should be the path to a file or directory on the filesystem." msgstr "" -#: ../../library/zipfile.rst:731 +#: ../../library/zipfile.rst:756 msgid "" "If *arcname* is specified, it is used as the name within the archive. If " "*arcname* is not specified, the name will be the same as *filename*, but " "with any drive letter and leading path separators removed." msgstr "" -#: ../../library/zipfile.rst:743 +#: ../../library/zipfile.rst:768 msgid "The *filename* parameter accepts a :term:`path-like object`." msgstr "" -#: ../../library/zipfile.rst:746 +#: ../../library/zipfile.rst:771 msgid "Added the *strict_timestamps* keyword-only parameter." msgstr "新增 *strict_timestamps* 僅限關鍵字參數。" -#: ../../library/zipfile.rst:750 +#: ../../library/zipfile.rst:775 msgid "Instances have the following methods and attributes:" msgstr "" -#: ../../library/zipfile.rst:754 +#: ../../library/zipfile.rst:779 msgid "Return ``True`` if this archive member is a directory." msgstr "" -#: ../../library/zipfile.rst:756 +#: ../../library/zipfile.rst:781 msgid "This uses the entry's name: directories should always end with ``/``." msgstr "" -#: ../../library/zipfile.rst:763 +#: ../../library/zipfile.rst:788 msgid "Name of the file in the archive." msgstr "" -#: ../../library/zipfile.rst:768 +#: ../../library/zipfile.rst:793 msgid "" "The time and date of the last modification to the archive member. This is a " "tuple of six values:" msgstr "" -#: ../../library/zipfile.rst:772 +#: ../../library/zipfile.rst:797 msgid "Index" msgstr "" -#: ../../library/zipfile.rst:772 +#: ../../library/zipfile.rst:797 msgid "Value" msgstr "" -#: ../../library/zipfile.rst:774 +#: ../../library/zipfile.rst:799 msgid "``0``" msgstr "``0``" -#: ../../library/zipfile.rst:774 +#: ../../library/zipfile.rst:799 msgid "Year (>= 1980)" msgstr "" -#: ../../library/zipfile.rst:776 +#: ../../library/zipfile.rst:801 msgid "``1``" msgstr "``1``" -#: ../../library/zipfile.rst:776 +#: ../../library/zipfile.rst:801 msgid "Month (one-based)" msgstr "" -#: ../../library/zipfile.rst:778 +#: ../../library/zipfile.rst:803 msgid "``2``" msgstr "``2``" -#: ../../library/zipfile.rst:778 +#: ../../library/zipfile.rst:803 msgid "Day of month (one-based)" msgstr "" -#: ../../library/zipfile.rst:780 +#: ../../library/zipfile.rst:805 msgid "``3``" msgstr "``3``" -#: ../../library/zipfile.rst:780 +#: ../../library/zipfile.rst:805 msgid "Hours (zero-based)" msgstr "" -#: ../../library/zipfile.rst:782 +#: ../../library/zipfile.rst:807 msgid "``4``" msgstr "``4``" -#: ../../library/zipfile.rst:782 +#: ../../library/zipfile.rst:807 msgid "Minutes (zero-based)" msgstr "" -#: ../../library/zipfile.rst:784 +#: ../../library/zipfile.rst:809 msgid "``5``" msgstr "``5``" -#: ../../library/zipfile.rst:784 +#: ../../library/zipfile.rst:809 msgid "Seconds (zero-based)" msgstr "" -#: ../../library/zipfile.rst:789 +#: ../../library/zipfile.rst:814 msgid "The ZIP file format does not support timestamps before 1980." msgstr "" -#: ../../library/zipfile.rst:794 +#: ../../library/zipfile.rst:819 msgid "Type of compression for the archive member." msgstr "" -#: ../../library/zipfile.rst:799 +#: ../../library/zipfile.rst:824 msgid "Comment for the individual archive member as a :class:`bytes` object." msgstr "" -#: ../../library/zipfile.rst:804 +#: ../../library/zipfile.rst:829 msgid "" "Expansion field data. The `PKZIP Application Note`_ contains some comments " "on the internal structure of the data contained in this :class:`bytes` " "object." msgstr "" -#: ../../library/zipfile.rst:811 +#: ../../library/zipfile.rst:836 msgid "System which created ZIP archive." msgstr "" -#: ../../library/zipfile.rst:816 +#: ../../library/zipfile.rst:841 msgid "PKZIP version which created ZIP archive." msgstr "" -#: ../../library/zipfile.rst:821 +#: ../../library/zipfile.rst:846 msgid "PKZIP version needed to extract archive." msgstr "" -#: ../../library/zipfile.rst:826 +#: ../../library/zipfile.rst:851 msgid "Must be zero." msgstr "" -#: ../../library/zipfile.rst:831 +#: ../../library/zipfile.rst:856 msgid "ZIP flag bits." msgstr "" -#: ../../library/zipfile.rst:836 +#: ../../library/zipfile.rst:861 msgid "Volume number of file header." msgstr "" -#: ../../library/zipfile.rst:841 +#: ../../library/zipfile.rst:866 msgid "Internal attributes." msgstr "" -#: ../../library/zipfile.rst:846 +#: ../../library/zipfile.rst:871 msgid "External file attributes." msgstr "" -#: ../../library/zipfile.rst:851 +#: ../../library/zipfile.rst:876 msgid "Byte offset to the file header." msgstr "" -#: ../../library/zipfile.rst:856 +#: ../../library/zipfile.rst:881 msgid "CRC-32 of the uncompressed file." msgstr "" -#: ../../library/zipfile.rst:861 +#: ../../library/zipfile.rst:886 msgid "Size of the compressed data." msgstr "" -#: ../../library/zipfile.rst:866 +#: ../../library/zipfile.rst:891 msgid "Size of the uncompressed file." msgstr "" -#: ../../library/zipfile.rst:873 +#: ../../library/zipfile.rst:898 msgid "Command-Line Interface" msgstr "" -#: ../../library/zipfile.rst:875 +#: ../../library/zipfile.rst:900 msgid "" "The :mod:`zipfile` module provides a simple command-line interface to " "interact with ZIP archives." msgstr "" -#: ../../library/zipfile.rst:878 +#: ../../library/zipfile.rst:903 msgid "" "If you want to create a new ZIP archive, specify its name after the :option:" "`-c` option and then list the filename(s) that should be included:" msgstr "" -#: ../../library/zipfile.rst:881 +#: ../../library/zipfile.rst:906 msgid "$ python -m zipfile -c monty.zip spam.txt eggs.txt" msgstr "$ python -m zipfile -c monty.zip spam.txt eggs.txt" -#: ../../library/zipfile.rst:885 +#: ../../library/zipfile.rst:910 msgid "Passing a directory is also acceptable:" msgstr "" -#: ../../library/zipfile.rst:887 +#: ../../library/zipfile.rst:912 msgid "$ python -m zipfile -c monty.zip life-of-brian_1979/" msgstr "$ python -m zipfile -c monty.zip life-of-brian_1979/" -#: ../../library/zipfile.rst:891 +#: ../../library/zipfile.rst:916 msgid "" "If you want to extract a ZIP archive into the specified directory, use the :" "option:`-e` option:" msgstr "" -#: ../../library/zipfile.rst:894 +#: ../../library/zipfile.rst:919 msgid "$ python -m zipfile -e monty.zip target-dir/" msgstr "$ python -m zipfile -e monty.zip target-dir/" -#: ../../library/zipfile.rst:898 +#: ../../library/zipfile.rst:923 msgid "For a list of the files in a ZIP archive, use the :option:`-l` option:" msgstr "" -#: ../../library/zipfile.rst:900 +#: ../../library/zipfile.rst:925 msgid "$ python -m zipfile -l monty.zip" msgstr "$ python -m zipfile -l monty.zip" -#: ../../library/zipfile.rst:906 +#: ../../library/zipfile.rst:931 msgid "Command-line options" msgstr "" -#: ../../library/zipfile.rst:911 +#: ../../library/zipfile.rst:936 msgid "List files in a zipfile." msgstr "" -#: ../../library/zipfile.rst:916 +#: ../../library/zipfile.rst:941 msgid "Create zipfile from source files." msgstr "" -#: ../../library/zipfile.rst:921 +#: ../../library/zipfile.rst:946 msgid "Extract zipfile into target directory." msgstr "" -#: ../../library/zipfile.rst:926 +#: ../../library/zipfile.rst:951 msgid "Test whether the zipfile is valid or not." msgstr "" -#: ../../library/zipfile.rst:930 +#: ../../library/zipfile.rst:955 msgid "" "Specify encoding of member names for :option:`-l`, :option:`-e` and :option:" "`-t`." msgstr "" -#: ../../library/zipfile.rst:937 +#: ../../library/zipfile.rst:962 msgid "Decompression pitfalls" msgstr "" -#: ../../library/zipfile.rst:939 +#: ../../library/zipfile.rst:964 msgid "" "The extraction in zipfile module might fail due to some pitfalls listed " "below." msgstr "" -#: ../../library/zipfile.rst:942 +#: ../../library/zipfile.rst:967 msgid "From file itself" msgstr "" -#: ../../library/zipfile.rst:944 +#: ../../library/zipfile.rst:969 msgid "" "Decompression may fail due to incorrect password / CRC checksum / ZIP format " "or unsupported compression method / decryption." msgstr "" -#: ../../library/zipfile.rst:948 +#: ../../library/zipfile.rst:973 msgid "File System limitations" msgstr "" -#: ../../library/zipfile.rst:950 +#: ../../library/zipfile.rst:975 msgid "" "Exceeding limitations on different file systems can cause decompression " "failed. Such as allowable characters in the directory entries, length of the " @@ -1147,33 +1178,33 @@ msgid "" "files, etc." msgstr "" -#: ../../library/zipfile.rst:957 +#: ../../library/zipfile.rst:982 msgid "Resources limitations" msgstr "" -#: ../../library/zipfile.rst:959 +#: ../../library/zipfile.rst:984 msgid "" "The lack of memory or disk volume would lead to decompression failed. For " "example, decompression bombs (aka `ZIP bomb`_) apply to zipfile library that " "can cause disk volume exhaustion." msgstr "" -#: ../../library/zipfile.rst:964 +#: ../../library/zipfile.rst:989 msgid "Interruption" msgstr "" -#: ../../library/zipfile.rst:966 +#: ../../library/zipfile.rst:991 msgid "" "Interruption during the decompression, such as pressing control-C or killing " "the decompression process may result in incomplete decompression of the " "archive." msgstr "" -#: ../../library/zipfile.rst:970 +#: ../../library/zipfile.rst:995 msgid "Default behaviors of extraction" msgstr "" -#: ../../library/zipfile.rst:972 +#: ../../library/zipfile.rst:997 msgid "" "Not knowing the default extraction behaviors can cause unexpected " "decompression results. For example, when extracting the same archive twice, " diff --git a/library/zipimport.po b/library/zipimport.po index 014ed2cc28..f338c8d147 100644 --- a/library/zipimport.po +++ b/library/zipimport.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -57,26 +57,30 @@ msgid "" msgstr "" #: ../../library/zipimport.rst:33 +msgid "ZIP64 is supported" +msgstr "" + +#: ../../library/zipimport.rst:36 msgid "Previously, ZIP archives with an archive comment were not supported." msgstr "" -#: ../../library/zipimport.rst:38 +#: ../../library/zipimport.rst:41 msgid "" "`PKZIP Application Note <https://pkware.cachefly.net/webdocs/casestudies/" "APPNOTE.TXT>`_" msgstr "" -#: ../../library/zipimport.rst:39 +#: ../../library/zipimport.rst:42 msgid "" "Documentation on the ZIP file format by Phil Katz, the creator of the format " "and algorithms used." msgstr "" -#: ../../library/zipimport.rst:42 +#: ../../library/zipimport.rst:45 msgid ":pep:`273` - Import Modules from Zip Archives" msgstr "" -#: ../../library/zipimport.rst:43 +#: ../../library/zipimport.rst:46 msgid "" "Written by James C. Ahlstrom, who also provided an implementation. Python " "2.3 follows the specification in :pep:`273`, but uses an implementation " @@ -84,34 +88,34 @@ msgid "" "`302`." msgstr "" -#: ../../library/zipimport.rst:47 +#: ../../library/zipimport.rst:50 msgid ":mod:`importlib` - The implementation of the import machinery" msgstr "" -#: ../../library/zipimport.rst:48 +#: ../../library/zipimport.rst:51 msgid "" "Package providing the relevant protocols for all importers to implement." msgstr "" -#: ../../library/zipimport.rst:52 +#: ../../library/zipimport.rst:55 msgid "This module defines an exception:" msgstr "" -#: ../../library/zipimport.rst:56 +#: ../../library/zipimport.rst:59 msgid "" "Exception raised by zipimporter objects. It's a subclass of :exc:" "`ImportError`, so it can be caught as :exc:`ImportError`, too." msgstr "" -#: ../../library/zipimport.rst:63 +#: ../../library/zipimport.rst:66 msgid "zipimporter Objects" msgstr "zipimporter 物件" -#: ../../library/zipimport.rst:65 +#: ../../library/zipimport.rst:68 msgid ":class:`zipimporter` is the class for importing ZIP files." msgstr "" -#: ../../library/zipimport.rst:69 +#: ../../library/zipimport.rst:72 msgid "" "Create a new zipimporter instance. *archivepath* must be a path to a ZIP " "file, or to a specific path within a ZIP file. For example, an " @@ -120,114 +124,114 @@ msgid "" "exists)." msgstr "" -#: ../../library/zipimport.rst:74 +#: ../../library/zipimport.rst:77 msgid "" ":exc:`ZipImportError` is raised if *archivepath* doesn't point to a valid " "ZIP archive." msgstr "" -#: ../../library/zipimport.rst:79 +#: ../../library/zipimport.rst:82 msgid "" "Methods ``find_loader()`` and ``find_module()``, deprecated in 3.10 are now " "removed. Use :meth:`find_spec` instead." msgstr "" -#: ../../library/zipimport.rst:84 +#: ../../library/zipimport.rst:87 msgid "" "Implementation of :meth:`importlib.abc.Loader.create_module` that returns :" "const:`None` to explicitly request the default semantics." msgstr "" -#: ../../library/zipimport.rst:92 +#: ../../library/zipimport.rst:95 msgid "Implementation of :meth:`importlib.abc.Loader.exec_module`." msgstr "" -#: ../../library/zipimport.rst:99 +#: ../../library/zipimport.rst:102 msgid "An implementation of :meth:`importlib.abc.PathEntryFinder.find_spec`." msgstr "" -#: ../../library/zipimport.rst:106 +#: ../../library/zipimport.rst:109 msgid "" "Return the code object for the specified module. Raise :exc:`ZipImportError` " "if the module couldn't be imported." msgstr "" -#: ../../library/zipimport.rst:112 +#: ../../library/zipimport.rst:115 msgid "" "Return the data associated with *pathname*. Raise :exc:`OSError` if the file " "wasn't found." msgstr "" -#: ../../library/zipimport.rst:115 +#: ../../library/zipimport.rst:118 msgid ":exc:`IOError` used to be raised, it is now an alias of :exc:`OSError`." msgstr "" -#: ../../library/zipimport.rst:121 +#: ../../library/zipimport.rst:124 msgid "" "Return the value ``__file__`` would be set to if the specified module was " "imported. Raise :exc:`ZipImportError` if the module couldn't be imported." msgstr "" -#: ../../library/zipimport.rst:130 +#: ../../library/zipimport.rst:133 msgid "" "Return the source code for the specified module. Raise :exc:`ZipImportError` " "if the module couldn't be found, return :const:`None` if the archive does " "contain the module, but has no source for it." msgstr "" -#: ../../library/zipimport.rst:138 +#: ../../library/zipimport.rst:141 msgid "" "Return ``True`` if the module specified by *fullname* is a package. Raise :" "exc:`ZipImportError` if the module couldn't be found." msgstr "" -#: ../../library/zipimport.rst:144 +#: ../../library/zipimport.rst:147 msgid "" "Load the module specified by *fullname*. *fullname* must be the fully " "qualified (dotted) module name. Returns the imported module on success, " "raises :exc:`ZipImportError` on failure." msgstr "" -#: ../../library/zipimport.rst:150 +#: ../../library/zipimport.rst:153 msgid "Use :meth:`exec_module` instead." msgstr "" -#: ../../library/zipimport.rst:155 +#: ../../library/zipimport.rst:158 msgid "" "Clear out the internal cache of information about files found within the ZIP " "archive." msgstr "" -#: ../../library/zipimport.rst:163 +#: ../../library/zipimport.rst:166 msgid "" "The file name of the importer's associated ZIP file, without a possible " "subpath." msgstr "" -#: ../../library/zipimport.rst:169 +#: ../../library/zipimport.rst:172 msgid "" "The subpath within the ZIP file where modules are searched. This is the " "empty string for zipimporter objects which point to the root of the ZIP file." msgstr "" -#: ../../library/zipimport.rst:173 +#: ../../library/zipimport.rst:176 msgid "" "The :attr:`archive` and :attr:`prefix` attributes, when combined with a " "slash, equal the original *archivepath* argument given to the :class:" "`zipimporter` constructor." msgstr "" -#: ../../library/zipimport.rst:181 +#: ../../library/zipimport.rst:184 msgid "Examples" msgstr "範例" -#: ../../library/zipimport.rst:183 +#: ../../library/zipimport.rst:186 msgid "" "Here is an example that imports a module from a ZIP archive - note that the :" "mod:`zipimport` module is not explicitly used." msgstr "" -#: ../../library/zipimport.rst:186 +#: ../../library/zipimport.rst:189 msgid "" "$ unzip -l example.zip\n" "Archive: example.zip\n" diff --git a/library/zlib.po b/library/zlib.po index 5ba7b2b7c1..d2c292664d 100644 --- a/library/zlib.po +++ b/library/zlib.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-05-09 00:03+0000\n" "PO-Revision-Date: 2022-12-28 20:58+0800\n" diff --git a/library/zoneinfo.po b/library/zoneinfo.po index c047aa4c67..0859e10f69 100644 --- a/library/zoneinfo.po +++ b/library/zoneinfo.po @@ -5,9 +5,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -55,17 +55,16 @@ msgid "" msgstr "" #: ../../includes/wasm-notavail.rst:3 -msgid ":ref:`Availability <availability>`: not Emscripten, not WASI." -msgstr "" +msgid ":ref:`Availability <availability>`: not WASI." +msgstr ":ref:`適用 <availability>`:非 WASI。" #: ../../includes/wasm-notavail.rst:5 msgid "" -"This module does not work or is not available on WebAssembly platforms " -"``wasm32-emscripten`` and ``wasm32-wasi``. See :ref:`wasm-availability` for " -"more information." +"This module does not work or is not available on WebAssembly. See :ref:`wasm-" +"availability` for more information." msgstr "" -"此模組在 WebAssembly 平台 ``wasm32-emscripten`` 和 ``wasm32-wasi`` 上無法作用" -"或無法使用。有關更多資訊,請參閱 :ref:`wasm-availability`。" +"此模組在 WebAssembly 平台上不起作用或無法使用。更多資訊請參閱 :ref:`wasm-" +"availability`。" #: ../../library/zoneinfo.rst:35 msgid "Using ``ZoneInfo``" diff --git a/license.po b/license.po index 71b188355c..de6467b90f 100644 --- a/license.po +++ b/license.po @@ -6,9 +6,9 @@ # Steven Hsu <hsuhaochun@gmail.com>, 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-06-27 09:40+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -264,6 +264,7 @@ msgid "PSF LICENSE AGREEMENT FOR PYTHON |release|" msgstr "用於 PYTHON |release| 的 PSF 授權合約" #: ../../license.rst:94 +#, fuzzy msgid "" "1. This LICENSE AGREEMENT is between the Python Software Foundation " "(\"PSF\"), and\n" @@ -282,7 +283,7 @@ msgid "" "derivative\n" " version, provided, however, that PSF's License Agreement and PSF's notice " "of\n" -" copyright, i.e., \"Copyright © 2001-2023 Python Software Foundation; All " +" copyright, i.e., \"Copyright © 2001-2024 Python Software Foundation; All " "Rights\n" " Reserved\" are retained in Python |release| alone or in any derivative " "version\n" @@ -1194,7 +1195,8 @@ msgid "UUencode and UUdecode functions" msgstr "UUencode 與 UUdecode 函式" #: ../../license.rst:479 -msgid "The :mod:`uu` module contains the following notice::" +#, fuzzy +msgid "The ``uu`` codec contains the following notice::" msgstr ":mod:`uu` 模組包含以下聲明: ::" #: ../../license.rst:481 @@ -1552,13 +1554,14 @@ msgid "OpenSSL" msgstr "OpenSSL" #: ../../license.rst:658 +#, fuzzy msgid "" -"The modules :mod:`hashlib`, :mod:`posix`, :mod:`ssl`, :mod:`crypt` use the " -"OpenSSL library for added performance if made available by the operating " -"system. Additionally, the Windows and macOS installers for Python may " -"include a copy of the OpenSSL libraries, so we include a copy of the OpenSSL " -"license here. For the OpenSSL 3.0 release, and later releases derived from " -"that, the Apache License v2 applies::" +"The modules :mod:`hashlib`, :mod:`posix` and :mod:`ssl` use the OpenSSL " +"library for added performance if made available by the operating system. " +"Additionally, the Windows and macOS installers for Python may include a copy " +"of the OpenSSL libraries, so we include a copy of the OpenSSL license here. " +"For the OpenSSL 3.0 release, and later releases derived from that, the " +"Apache License v2 applies::" msgstr "" "如果 OpenSSL 函式庫可被作業系統使用,則 :mod:`hashlib`、:mod:`posix`、:mod:" "`ssl`、:mod:`crypt` 模組會使用它來提升效能。此外,因為 Windows 和 macOS 的 " @@ -2321,62 +2324,70 @@ msgstr "" "(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n" "OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -#: ../../license.rst:1046 -msgid "Audioop" -msgstr "Audioop" - #: ../../license.rst:1048 -msgid "" -"The audioop module uses the code base in g771.c file of the SoX project. " -"https://sourceforge.net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz" -msgstr "" -"audioop 模組使用 SoX 專案的 g771.c 檔案中的程式碼。 https://sourceforge.net/" -"projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz" - -#: ../../license.rst:1051 -msgid "" -"This source code is a product of Sun Microsystems, Inc. and is provided for " -"unrestricted use. Users may copy or modify this source code without charge." -msgstr "" - -#: ../../license.rst:1055 -msgid "" -"SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING " -"THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR " -"PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE." -msgstr "" - -#: ../../license.rst:1059 -msgid "" -"Sun source code is provided with no support and without any obligation on " -"the part of Sun Microsystems, Inc. to assist in its use, correction, " -"modification or enhancement." +msgid "mimalloc" msgstr "" -#: ../../license.rst:1063 -msgid "" -"SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE " -"INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE OR " -"ANY PART THEREOF." -msgstr "" - -#: ../../license.rst:1067 -msgid "" -"In no event will Sun Microsystems, Inc. be liable for any lost revenue or " -"profits or other special, indirect and consequential damages, even if Sun " -"has been advised of the possibility of such damages." +#: ../../license.rst:1050 +msgid "MIT License::" msgstr "" -#: ../../license.rst:1071 +#: ../../license.rst:1052 +#, fuzzy msgid "" -"Sun Microsystems, Inc. 2550 Garcia Avenue Mountain View, California 94043" +"Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen\n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining a " +"copy\n" +"of this software and associated documentation files (the \"Software\"), to " +"deal\n" +"in the Software without restriction, including without limitation the " +"rights\n" +"to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n" +"copies of the Software, and to permit persons to whom the Software is\n" +"furnished to do so, subject to the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be included in " +"all\n" +"copies or substantial portions of the Software.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS " +"OR\n" +"IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n" +"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n" +"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n" +"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING " +"FROM,\n" +"OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN " +"THE\n" +"SOFTWARE." msgstr "" +"Copyright (c) 2001-2006 Twisted Matrix Laboratories.\n" +"\n" +"Permission is hereby granted, free of charge, to any person obtaining\n" +"a copy of this software and associated documentation files (the\n" +"\"Software\"), to deal in the Software without restriction, including\n" +"without limitation the rights to use, copy, modify, merge, publish,\n" +"distribute, sublicense, and/or sell copies of the Software, and to\n" +"permit persons to whom the Software is furnished to do so, subject to\n" +"the following conditions:\n" +"\n" +"The above copyright notice and this permission notice shall be\n" +"included in all copies or substantial portions of the Software.\n" +"\n" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" +"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n" +"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" +"OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" +"WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." -#: ../../license.rst:1077 +#: ../../license.rst:1074 msgid "asyncio" msgstr "asyncio" -#: ../../license.rst:1079 +#: ../../license.rst:1076 msgid "" "Parts of the :mod:`asyncio` module are incorporated from `uvloop 0.16 " "<https://github.com/MagicStack/uvloop/tree/v0.16.0>`_, which is distributed " @@ -2385,7 +2396,7 @@ msgstr "" ":mod:`asyncio` 模組的部分內容是從 `uvloop 0.16 <https://github.com/" "MagicStack/uvloop/tree/v0.16.0>`_ 中收錄過來,其基於 MIT 授權來發佈: ::" -#: ../../license.rst:1083 +#: ../../license.rst:1080 msgid "" "Copyright (c) 2015-2021 MagicStack Inc. http://magic.io\n" "\n" @@ -2428,3 +2439,76 @@ msgstr "" "LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" "OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" "WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." + +#: ../../license.rst:1103 +msgid "Global Unbounded Sequences (GUS)" +msgstr "" + +#: ../../license.rst:1105 +msgid "" +"The file :file:`Python/qsbr.c` is adapted from FreeBSD's \"Global Unbounded " +"Sequences\" safe memory reclamation scheme in `subr_smr.c <https://github." +"com/freebsd/freebsd-src/blob/main/sys/kern/subr_smr.c>`_. The file is " +"distributed under the 2-Clause BSD License::" +msgstr "" + +#: ../../license.rst:1110 +#, fuzzy +msgid "" +"Copyright (c) 2019,2020 Jeffrey Roberson <jeff@FreeBSD.org>\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice unmodified, this list of conditions, and the following\n" +" disclaimer.\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n" +"IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n" +"OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n" +"IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n" +"INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n" +"NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n" +"DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n" +"THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n" +"(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n" +"THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +msgstr "" +"Copyright (c) 2008-2020 Stefan Krah. All rights reserved.\n" +"\n" +"Redistribution and use in source and binary forms, with or without\n" +"modification, are permitted provided that the following conditions\n" +"are met:\n" +"\n" +"1. Redistributions of source code must retain the above copyright\n" +" notice, this list of conditions and the following disclaimer.\n" +"\n" +"2. Redistributions in binary form must reproduce the above copyright\n" +" notice, this list of conditions and the following disclaimer in the\n" +" documentation and/or other materials provided with the distribution.\n" +"\n" +"THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS \"AS IS\" AND\n" +"ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n" +"IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n" +"ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n" +"FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" +"DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n" +"OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n" +"HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" +"LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" +"OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n" +"SUCH DAMAGE." + +#~ msgid "Audioop" +#~ msgstr "Audioop" + +#~ msgid "" +#~ "The audioop module uses the code base in g771.c file of the SoX project. " +#~ "https://sourceforge.net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz" +#~ msgstr "" +#~ "audioop 模組使用 SoX 專案的 g771.c 檔案中的程式碼。 https://sourceforge." +#~ "net/projects/sox/files/sox/12.17.7/sox-12.17.7.tar.gz" diff --git a/reference/compound_stmts.po b/reference/compound_stmts.po index 18c53a33ea..db077dfd9a 100644 --- a/reference/compound_stmts.po +++ b/reference/compound_stmts.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 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-" @@ -610,8 +610,8 @@ msgid "" msgstr "" #: ../../reference/compound_stmts.rst:526 -#: ../../reference/compound_stmts.rst:1541 -#: ../../reference/compound_stmts.rst:1582 +#: ../../reference/compound_stmts.rst:1547 +#: ../../reference/compound_stmts.rst:1588 msgid "The following code::" msgstr "" @@ -625,7 +625,7 @@ msgstr "" #: ../../reference/compound_stmts.rst:531 #: ../../reference/compound_stmts.rst:556 -#: ../../reference/compound_stmts.rst:1587 +#: ../../reference/compound_stmts.rst:1593 msgid "is semantically equivalent to::" msgstr "" @@ -1543,7 +1543,7 @@ msgid ":class:`int`" msgstr ":class:`int`" #: ../../reference/compound_stmts.rst:1160 -#: ../../reference/compound_stmts.rst:1857 +#: ../../reference/compound_stmts.rst:1878 msgid ":class:`list`" msgstr ":class:`list`" @@ -1556,7 +1556,7 @@ msgid ":class:`str`" msgstr ":class:`str`" #: ../../reference/compound_stmts.rst:1163 -#: ../../reference/compound_stmts.rst:1860 +#: ../../reference/compound_stmts.rst:1881 msgid ":class:`tuple`" msgstr ":class:`tuple`" @@ -1606,7 +1606,7 @@ msgid "" "ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1227 +#: ../../reference/compound_stmts.rst:1228 msgid "" "A function definition is an executable statement. Its execution binds the " "function name in the current local namespace to a function object (a wrapper " @@ -1615,13 +1615,13 @@ msgid "" "used when the function is called." msgstr "" -#: ../../reference/compound_stmts.rst:1233 +#: ../../reference/compound_stmts.rst:1234 msgid "" "The function definition does not execute the function body; this gets " "executed only when the function is called. [#]_" msgstr "" -#: ../../reference/compound_stmts.rst:1239 +#: ../../reference/compound_stmts.rst:1240 msgid "" "A function definition may be wrapped by one or more :term:`decorator` " "expressions. Decorator expressions are evaluated when the function is " @@ -1632,7 +1632,7 @@ msgid "" "example, the following code ::" msgstr "" -#: ../../reference/compound_stmts.rst:1246 +#: ../../reference/compound_stmts.rst:1247 msgid "" "@f1(arg)\n" "@f2\n" @@ -1642,12 +1642,12 @@ msgstr "" "@f2\n" "def func(): pass" -#: ../../reference/compound_stmts.rst:1250 -#: ../../reference/compound_stmts.rst:1440 +#: ../../reference/compound_stmts.rst:1251 +#: ../../reference/compound_stmts.rst:1446 msgid "is roughly equivalent to ::" msgstr "大致等價於: ::" -#: ../../reference/compound_stmts.rst:1252 +#: ../../reference/compound_stmts.rst:1253 msgid "" "def func(): pass\n" "func = f1(arg)(f2(func))" @@ -1655,20 +1655,20 @@ msgstr "" "def func(): pass\n" "func = f1(arg)(f2(func))" -#: ../../reference/compound_stmts.rst:1255 +#: ../../reference/compound_stmts.rst:1256 msgid "" "except that the original function is not temporarily bound to the name " "``func``." msgstr "" -#: ../../reference/compound_stmts.rst:1257 +#: ../../reference/compound_stmts.rst:1258 msgid "" "Functions may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1262 +#: ../../reference/compound_stmts.rst:1263 msgid "" "A list of :ref:`type parameters <type-params>` may be given in square " "brackets between the function's name and the opening parenthesis for its " @@ -1678,12 +1678,12 @@ msgid "" "functions` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1269 -#: ../../reference/compound_stmts.rst:1459 +#: ../../reference/compound_stmts.rst:1270 +#: ../../reference/compound_stmts.rst:1465 msgid "Type parameter lists are new in Python 3.12." msgstr "" -#: ../../reference/compound_stmts.rst:1277 +#: ../../reference/compound_stmts.rst:1278 msgid "" "When one or more :term:`parameters <parameter>` have the form *parameter* " "``=`` *expression*, the function is said to have \"default parameter values." @@ -1694,7 +1694,7 @@ msgid "" "syntactic restriction that is not expressed by the grammar." msgstr "" -#: ../../reference/compound_stmts.rst:1285 +#: ../../reference/compound_stmts.rst:1286 msgid "" "**Default parameter values are evaluated from left to right when the " "function definition is executed.** This means that the expression is " @@ -1707,7 +1707,7 @@ msgid "" "the default, and explicitly test for it in the body of the function, e.g.::" msgstr "" -#: ../../reference/compound_stmts.rst:1295 +#: ../../reference/compound_stmts.rst:1296 msgid "" "def whats_on_the_telly(penguin=None):\n" " if penguin is None:\n" @@ -1716,7 +1716,7 @@ msgid "" " return penguin" msgstr "" -#: ../../reference/compound_stmts.rst:1306 +#: ../../reference/compound_stmts.rst:1307 msgid "" "Function call semantics are described in more detail in section :ref:" "`calls`. A function call always assigns values to all parameters mentioned " @@ -1732,31 +1732,39 @@ msgid "" "positional arguments." msgstr "" -#: ../../reference/compound_stmts.rst:1318 +#: ../../reference/compound_stmts.rst:1319 msgid "" "The ``/`` function parameter syntax may be used to indicate positional-only " "parameters. See :pep:`570` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1327 +#: ../../reference/compound_stmts.rst:1328 msgid "" "Parameters may have an :term:`annotation <function annotation>` of the form " "\"``: expression``\" following the parameter name. Any parameter may have " -"an annotation, even those of the form ``*identifier`` or ``**identifier``. " -"Functions may have \"return\" annotation of the form \"``-> expression``\" " -"after the parameter list. These annotations can be any valid Python " -"expression. The presence of annotations does not change the semantics of a " -"function. The annotation values are available as values of a dictionary " -"keyed by the parameters' names in the :attr:`__annotations__` attribute of " -"the function object. If the ``annotations`` import from :mod:`__future__` " -"is used, annotations are preserved as strings at runtime which enables " -"postponed evaluation. Otherwise, they are evaluated when the function " -"definition is executed. In this case annotations may be evaluated in a " -"different order than they appear in the source code." +"an annotation, even those of the form ``*identifier`` or ``**identifier``. " +"(As a special case, parameters of the form ``*identifier`` may have an " +"annotation \"``: *expression``\".) Functions may have \"return\" annotation " +"of the form \"``-> expression``\" after the parameter list. These " +"annotations can be any valid Python expression. The presence of annotations " +"does not change the semantics of a function. The annotation values are " +"available as values of a dictionary keyed by the parameters' names in the :" +"attr:`__annotations__` attribute of the function object. If the " +"``annotations`` import from :mod:`__future__` is used, annotations are " +"preserved as strings at runtime which enables postponed evaluation. " +"Otherwise, they are evaluated when the function definition is executed. In " +"this case annotations may be evaluated in a different order than they appear " +"in the source code." msgstr "" #: ../../reference/compound_stmts.rst:1342 msgid "" +"Parameters of the form \"``*identifier``\" may have an annotation \"``: " +"*expression``\". See :pep:`646`." +msgstr "" + +#: ../../reference/compound_stmts.rst:1348 +msgid "" "It is also possible to create anonymous functions (functions not bound to a " "name), for immediate use in expressions. This uses lambda expressions, " "described in section :ref:`lambda`. Note that the lambda expression is " @@ -1767,7 +1775,7 @@ msgid "" "execution of multiple statements and annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1350 +#: ../../reference/compound_stmts.rst:1356 msgid "" "**Programmer's note:** Functions are first-class objects. A \"``def``\" " "statement executed inside a function definition defines a local function " @@ -1776,61 +1784,61 @@ msgid "" "See section :ref:`naming` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1358 +#: ../../reference/compound_stmts.rst:1364 msgid ":pep:`3107` - Function Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1359 +#: ../../reference/compound_stmts.rst:1365 msgid "The original specification for function annotations." msgstr "" -#: ../../reference/compound_stmts.rst:1361 +#: ../../reference/compound_stmts.rst:1367 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/compound_stmts.rst:1362 +#: ../../reference/compound_stmts.rst:1368 msgid "Definition of a standard meaning for annotations: type hints." msgstr "" -#: ../../reference/compound_stmts.rst:1364 +#: ../../reference/compound_stmts.rst:1370 msgid ":pep:`526` - Syntax for Variable Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1365 +#: ../../reference/compound_stmts.rst:1371 msgid "" "Ability to type hint variable declarations, including class variables and " "instance variables." msgstr "" -#: ../../reference/compound_stmts.rst:1368 +#: ../../reference/compound_stmts.rst:1374 msgid ":pep:`563` - Postponed Evaluation of Annotations" msgstr "" -#: ../../reference/compound_stmts.rst:1369 +#: ../../reference/compound_stmts.rst:1375 msgid "" "Support for forward references within annotations by preserving annotations " "in a string form at runtime instead of eager evaluation." msgstr "" -#: ../../reference/compound_stmts.rst:1372 +#: ../../reference/compound_stmts.rst:1378 msgid ":pep:`318` - Decorators for Functions and Methods" msgstr "" -#: ../../reference/compound_stmts.rst:1373 +#: ../../reference/compound_stmts.rst:1379 msgid "" "Function and method decorators were introduced. Class decorators were " "introduced in :pep:`3129`." msgstr "" -#: ../../reference/compound_stmts.rst:1379 +#: ../../reference/compound_stmts.rst:1385 msgid "Class definitions" msgstr "類別定義" -#: ../../reference/compound_stmts.rst:1394 +#: ../../reference/compound_stmts.rst:1400 msgid "A class definition defines a class object (see section :ref:`types`):" msgstr "" -#: ../../reference/compound_stmts.rst:1401 +#: ../../reference/compound_stmts.rst:1407 msgid "" "A class definition is an executable statement. The inheritance list usually " "gives a list of base classes (see :ref:`metaclasses` for more advanced " @@ -1839,7 +1847,7 @@ msgid "" "default, from the base class :class:`object`; hence, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1407 +#: ../../reference/compound_stmts.rst:1413 msgid "" "class Foo:\n" " pass" @@ -1847,11 +1855,11 @@ msgstr "" "class Foo:\n" " pass" -#: ../../reference/compound_stmts.rst:1410 +#: ../../reference/compound_stmts.rst:1416 msgid "is equivalent to ::" msgstr "" -#: ../../reference/compound_stmts.rst:1412 +#: ../../reference/compound_stmts.rst:1418 msgid "" "class Foo(object):\n" " pass" @@ -1859,7 +1867,7 @@ msgstr "" "class Foo(object):\n" " pass" -#: ../../reference/compound_stmts.rst:1415 +#: ../../reference/compound_stmts.rst:1421 msgid "" "The class's suite is then executed in a new execution frame (see :ref:" "`naming`), using a newly created local namespace and the original global " @@ -1871,25 +1879,25 @@ msgid "" "original local namespace." msgstr "" -#: ../../reference/compound_stmts.rst:1424 +#: ../../reference/compound_stmts.rst:1430 msgid "" "The order in which attributes are defined in the class body is preserved in " -"the new class's ``__dict__``. Note that this is reliable only right after " -"the class is created and only for classes that were defined using the " -"definition syntax." +"the new class's :attr:`~type.__dict__`. Note that this is reliable only " +"right after the class is created and only for classes that were defined " +"using the definition syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1429 +#: ../../reference/compound_stmts.rst:1435 msgid "" "Class creation can be customized heavily using :ref:`metaclasses " "<metaclasses>`." msgstr "" -#: ../../reference/compound_stmts.rst:1434 +#: ../../reference/compound_stmts.rst:1440 msgid "Classes can also be decorated: just like when decorating functions, ::" msgstr "" -#: ../../reference/compound_stmts.rst:1436 +#: ../../reference/compound_stmts.rst:1442 msgid "" "@f1(arg)\n" "@f2\n" @@ -1899,7 +1907,7 @@ msgstr "" "@f2\n" "class Foo: pass" -#: ../../reference/compound_stmts.rst:1442 +#: ../../reference/compound_stmts.rst:1448 msgid "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" @@ -1907,29 +1915,29 @@ msgstr "" "class Foo: pass\n" "Foo = f1(arg)(f2(Foo))" -#: ../../reference/compound_stmts.rst:1445 +#: ../../reference/compound_stmts.rst:1451 msgid "" "The evaluation rules for the decorator expressions are the same as for " "function decorators. The result is then bound to the class name." msgstr "" -#: ../../reference/compound_stmts.rst:1448 +#: ../../reference/compound_stmts.rst:1454 msgid "" "Classes may be decorated with any valid :token:`~python-grammar:" "assignment_expression`. Previously, the grammar was much more restrictive; " "see :pep:`614` for details." msgstr "" -#: ../../reference/compound_stmts.rst:1453 +#: ../../reference/compound_stmts.rst:1459 msgid "" "A list of :ref:`type parameters <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 ``__type_params__`` attribute. See :ref:`generic-" -"classes` for more." +"retrieved from the class's :attr:`~type.__type_params__` attribute. See :ref:" +"`generic-classes` for more." msgstr "" -#: ../../reference/compound_stmts.rst:1462 +#: ../../reference/compound_stmts.rst:1468 msgid "" "**Programmer's note:** Variables defined in the class definition are class " "attributes; they are shared by instances. Instance attributes can be set in " @@ -1942,35 +1950,35 @@ msgid "" "implementation details." msgstr "" -#: ../../reference/compound_stmts.rst:1474 +#: ../../reference/compound_stmts.rst:1480 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/compound_stmts.rst:1475 +#: ../../reference/compound_stmts.rst:1481 msgid "" "The proposal that changed the declaration of metaclasses to the current " "syntax, and the semantics for how classes with metaclasses are constructed." msgstr "" -#: ../../reference/compound_stmts.rst:1479 +#: ../../reference/compound_stmts.rst:1485 msgid ":pep:`3129` - Class Decorators" msgstr ":pep:`3129` - 類別裝飾器" -#: ../../reference/compound_stmts.rst:1480 +#: ../../reference/compound_stmts.rst:1486 msgid "" "The proposal that added class decorators. Function and method decorators " "were introduced in :pep:`318`." msgstr "" -#: ../../reference/compound_stmts.rst:1487 +#: ../../reference/compound_stmts.rst:1493 msgid "Coroutines" msgstr "協程" -#: ../../reference/compound_stmts.rst:1495 +#: ../../reference/compound_stmts.rst:1501 msgid "Coroutine function definition" msgstr "協程函式定義" -#: ../../reference/compound_stmts.rst:1505 +#: ../../reference/compound_stmts.rst:1511 msgid "" "Execution of Python coroutines can be suspended and resumed at many points " "(see :term:`coroutine`). :keyword:`await` expressions, :keyword:`async for` " @@ -1978,23 +1986,23 @@ msgid "" "function." msgstr "" -#: ../../reference/compound_stmts.rst:1509 +#: ../../reference/compound_stmts.rst:1515 msgid "" "Functions defined with ``async def`` syntax are always coroutine functions, " "even if they do not contain ``await`` or ``async`` keywords." msgstr "" -#: ../../reference/compound_stmts.rst:1512 +#: ../../reference/compound_stmts.rst:1518 msgid "" "It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1515 +#: ../../reference/compound_stmts.rst:1521 msgid "An example of a coroutine function::" msgstr "一個協程函式範例: ::" -#: ../../reference/compound_stmts.rst:1517 +#: ../../reference/compound_stmts.rst:1523 msgid "" "async def func(param1, param2):\n" " do_stuff()\n" @@ -2004,30 +2012,30 @@ msgstr "" " do_stuff()\n" " await some_coroutine()" -#: ../../reference/compound_stmts.rst:1521 +#: ../../reference/compound_stmts.rst:1527 msgid "" "``await`` and ``async`` are now keywords; previously they were only treated " "as such inside the body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1529 +#: ../../reference/compound_stmts.rst:1535 msgid "The :keyword:`!async for` statement" msgstr ":keyword:`!async for` 陳述式" -#: ../../reference/compound_stmts.rst:1534 +#: ../../reference/compound_stmts.rst:1540 msgid "" "An :term:`asynchronous iterable` provides an ``__aiter__`` method that " "directly returns an :term:`asynchronous iterator`, which can call " "asynchronous code in its ``__anext__`` method." msgstr "" -#: ../../reference/compound_stmts.rst:1538 +#: ../../reference/compound_stmts.rst:1544 msgid "" "The ``async for`` statement allows convenient iteration over asynchronous " "iterables." msgstr "" -#: ../../reference/compound_stmts.rst:1543 +#: ../../reference/compound_stmts.rst:1549 msgid "" "async for TARGET in ITER:\n" " SUITE\n" @@ -2039,11 +2047,11 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1548 +#: ../../reference/compound_stmts.rst:1554 msgid "Is semantically equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1550 +#: ../../reference/compound_stmts.rst:1556 msgid "" "iter = (ITER)\n" "iter = type(iter).__aiter__(iter)\n" @@ -2073,28 +2081,28 @@ msgstr "" "else:\n" " SUITE2" -#: ../../reference/compound_stmts.rst:1564 +#: ../../reference/compound_stmts.rst:1570 msgid "" "See also :meth:`~object.__aiter__` and :meth:`~object.__anext__` for details." msgstr "更多細節請見 :meth:`~object.__aiter__` 與 :meth:`~object.__anext__`。" -#: ../../reference/compound_stmts.rst:1566 +#: ../../reference/compound_stmts.rst:1572 msgid "" "It is a :exc:`SyntaxError` to use an ``async for`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1574 +#: ../../reference/compound_stmts.rst:1580 msgid "The :keyword:`!async with` statement" msgstr ":keyword:`!async with` 陳述式" -#: ../../reference/compound_stmts.rst:1579 +#: ../../reference/compound_stmts.rst:1585 msgid "" "An :term:`asynchronous context manager` is a :term:`context manager` that is " "able to suspend execution in its *enter* and *exit* methods." msgstr "" -#: ../../reference/compound_stmts.rst:1584 +#: ../../reference/compound_stmts.rst:1590 msgid "" "async with EXPRESSION as TARGET:\n" " SUITE" @@ -2102,7 +2110,7 @@ msgstr "" "async with EXPRESSION as TARGET:\n" " SUITE" -#: ../../reference/compound_stmts.rst:1589 +#: ../../reference/compound_stmts.rst:1595 msgid "" "manager = (EXPRESSION)\n" "aenter = type(manager).__aenter__\n" @@ -2138,40 +2146,44 @@ msgstr "" " if not hit_except:\n" " await aexit(manager, None, None, None)" -#: ../../reference/compound_stmts.rst:1606 +#: ../../reference/compound_stmts.rst:1612 msgid "" "See also :meth:`~object.__aenter__` and :meth:`~object.__aexit__` for " "details." msgstr "更多細節請見 :meth:`~object.__aenter__` 與 :meth:`~object.__aexit__`。" -#: ../../reference/compound_stmts.rst:1608 +#: ../../reference/compound_stmts.rst:1614 msgid "" "It is a :exc:`SyntaxError` to use an ``async with`` statement outside the " "body of a coroutine function." msgstr "" -#: ../../reference/compound_stmts.rst:1613 +#: ../../reference/compound_stmts.rst:1619 msgid ":pep:`492` - Coroutines with async and await syntax" msgstr "" -#: ../../reference/compound_stmts.rst:1614 +#: ../../reference/compound_stmts.rst:1620 msgid "" "The proposal that made coroutines a proper standalone concept in Python, and " "added supporting syntax." msgstr "" -#: ../../reference/compound_stmts.rst:1620 +#: ../../reference/compound_stmts.rst:1626 msgid "Type parameter lists" msgstr "" -#: ../../reference/compound_stmts.rst:1634 +#: ../../reference/compound_stmts.rst:1630 +msgid "Support for default values was added (see :pep:`696`)." +msgstr "" + +#: ../../reference/compound_stmts.rst:1643 msgid "" ":ref:`Functions <def>` (including :ref:`coroutines <async def>`), :ref:" "`classes <class>` and :ref:`type aliases <type>` may contain a type " "parameter list::" msgstr "" -#: ../../reference/compound_stmts.rst:1638 +#: ../../reference/compound_stmts.rst:1647 msgid "" "def max[T](args: list[T]) -> T:\n" " ...\n" @@ -2203,7 +2215,7 @@ msgstr "" "\n" "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1653 +#: ../../reference/compound_stmts.rst:1662 msgid "" "Semantically, this indicates that the function, class, or type alias is " "generic over a type variable. This information is primarily used by static " @@ -2211,7 +2223,7 @@ msgid "" "generic counterparts." msgstr "" -#: ../../reference/compound_stmts.rst:1658 +#: ../../reference/compound_stmts.rst:1667 msgid "" "Type parameters are declared in square brackets (``[]``) immediately after " "the name of the function, class, or type alias. The type parameters are " @@ -2223,36 +2235,36 @@ msgid "" "wraps the creation of the generic object." msgstr "" -#: ../../reference/compound_stmts.rst:1667 +#: ../../reference/compound_stmts.rst:1676 msgid "" -"Generic functions, classes, and type aliases have a :attr:`!__type_params__` " -"attribute listing their type parameters." +"Generic functions, classes, and type aliases have a :attr:`~definition." +"__type_params__` attribute listing their type parameters." msgstr "" -#: ../../reference/compound_stmts.rst:1670 +#: ../../reference/compound_stmts.rst:1679 msgid "Type parameters come in three kinds:" msgstr "" -#: ../../reference/compound_stmts.rst:1672 +#: ../../reference/compound_stmts.rst:1681 msgid "" ":data:`typing.TypeVar`, introduced by a plain name (e.g., ``T``). " "Semantically, this represents a single type to a type checker." msgstr "" -#: ../../reference/compound_stmts.rst:1674 +#: ../../reference/compound_stmts.rst:1683 msgid "" ":data:`typing.TypeVarTuple`, introduced by a name prefixed with a single " "asterisk (e.g., ``*Ts``). Semantically, this stands for a tuple of any " "number of types." msgstr "" -#: ../../reference/compound_stmts.rst:1677 +#: ../../reference/compound_stmts.rst:1686 msgid "" ":data:`typing.ParamSpec`, introduced by a name prefixed with two asterisks " "(e.g., ``**P``). Semantically, this stands for the parameters of a callable." msgstr "" -#: ../../reference/compound_stmts.rst:1680 +#: ../../reference/compound_stmts.rst:1689 msgid "" ":data:`typing.TypeVar` declarations can define *bounds* and *constraints* " "with a colon (``:``) followed by an expression. A single expression after " @@ -2264,7 +2276,7 @@ msgid "" "variables can only take on one of the types in the list of constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1689 +#: ../../reference/compound_stmts.rst:1698 msgid "" "For :data:`!typing.TypeVar`\\ s declared using the type parameter list " "syntax, the bound and constraints are not evaluated when the generic object " @@ -2274,63 +2286,81 @@ msgid "" "<annotation-scopes>`." msgstr "" -#: ../../reference/compound_stmts.rst:1695 +#: ../../reference/compound_stmts.rst:1704 msgid "" ":data:`typing.TypeVarTuple`\\ s and :data:`typing.ParamSpec`\\ s cannot have " "bounds or constraints." msgstr "" -#: ../../reference/compound_stmts.rst:1698 +#: ../../reference/compound_stmts.rst:1707 +msgid "" +"All three flavors of type parameters can also have a *default value*, which " +"is used when the type parameter is not explicitly provided. This is added by " +"appending a single equals sign (``=``) followed by an expression. Like the " +"bounds and constraints of type variables, the default value is not evaluated " +"when the object is created, but only when the type parameter's " +"``__default__`` attribute is accessed. To this end, the default value is " +"evaluated in a separate :ref:`annotation scope <annotation-scopes>`. If no " +"default value is specified for a type parameter, the ``__default__`` " +"attribute is set to the special sentinel object :data:`typing.NoDefault`." +msgstr "" + +#: ../../reference/compound_stmts.rst:1717 msgid "" "The following example indicates the full set of allowed type parameter " "declarations::" msgstr "" -#: ../../reference/compound_stmts.rst:1700 +#: ../../reference/compound_stmts.rst:1719 msgid "" "def overly_generic[\n" " SimpleTypeVar,\n" +" TypeVarWithDefault = int,\n" " TypeVarWithBound: int,\n" " TypeVarWithConstraints: (str, bytes),\n" -" *SimpleTypeVarTuple,\n" -" **SimpleParamSpec,\n" +" *SimpleTypeVarTuple = (int, float),\n" +" **SimpleParamSpec = (str, bytearray),\n" "](\n" " a: SimpleTypeVar,\n" -" b: TypeVarWithBound,\n" -" c: Callable[SimpleParamSpec, TypeVarWithConstraints],\n" -" *d: SimpleTypeVarTuple,\n" +" b: TypeVarWithDefault,\n" +" c: TypeVarWithBound,\n" +" d: Callable[SimpleParamSpec, TypeVarWithConstraints],\n" +" *e: SimpleTypeVarTuple,\n" "): ..." msgstr "" "def overly_generic[\n" " SimpleTypeVar,\n" +" TypeVarWithDefault = int,\n" " TypeVarWithBound: int,\n" " TypeVarWithConstraints: (str, bytes),\n" -" *SimpleTypeVarTuple,\n" -" **SimpleParamSpec,\n" +" *SimpleTypeVarTuple = (int, float),\n" +" **SimpleParamSpec = (str, bytearray),\n" "](\n" " a: SimpleTypeVar,\n" -" b: TypeVarWithBound,\n" -" c: Callable[SimpleParamSpec, TypeVarWithConstraints],\n" -" *d: SimpleTypeVarTuple,\n" +" b: TypeVarWithDefault,\n" +" c: TypeVarWithBound,\n" +" d: Callable[SimpleParamSpec, TypeVarWithConstraints],\n" +" *e: SimpleTypeVarTuple,\n" +"): ..." -#: ../../reference/compound_stmts.rst:1716 +#: ../../reference/compound_stmts.rst:1737 msgid "Generic functions" msgstr "" -#: ../../reference/compound_stmts.rst:1718 +#: ../../reference/compound_stmts.rst:1739 msgid "Generic functions are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1720 +#: ../../reference/compound_stmts.rst:1741 msgid "def func[T](arg: T): ..." msgstr "def func[T](arg: T): ..." -#: ../../reference/compound_stmts.rst:1722 -#: ../../reference/compound_stmts.rst:1782 +#: ../../reference/compound_stmts.rst:1743 +#: ../../reference/compound_stmts.rst:1803 msgid "This syntax is equivalent to::" msgstr "語法大致等價於: ::" -#: ../../reference/compound_stmts.rst:1724 +#: ../../reference/compound_stmts.rst:1745 msgid "" "annotation-def TYPE_PARAMS_OF_func():\n" " T = typing.TypeVar(\"T\")\n" @@ -2346,7 +2376,7 @@ msgstr "" " return func\n" "func = TYPE_PARAMS_OF_func()" -#: ../../reference/compound_stmts.rst:1731 +#: ../../reference/compound_stmts.rst:1752 msgid "" "Here ``annotation-def`` indicates an :ref:`annotation scope <annotation-" "scopes>`, which is not actually bound to any name at runtime. (One other " @@ -2355,20 +2385,20 @@ msgid "" "data:`typing.TypeVar` directly.)" msgstr "" -#: ../../reference/compound_stmts.rst:1737 +#: ../../reference/compound_stmts.rst:1758 msgid "" "The annotations of generic functions are evaluated within the annotation " "scope used for declaring the type parameters, but the function's defaults " "and decorators are not." msgstr "" -#: ../../reference/compound_stmts.rst:1741 +#: ../../reference/compound_stmts.rst:1762 msgid "" "The following example illustrates the scoping rules for these cases, as well " "as for additional flavors of type parameters::" msgstr "" -#: ../../reference/compound_stmts.rst:1744 +#: ../../reference/compound_stmts.rst:1765 msgid "" "@decorator\n" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" @@ -2378,13 +2408,13 @@ msgstr "" "def func[T: int, *Ts, **P](*args: *Ts, arg: Callable[P, T] = some_default):\n" " ..." -#: ../../reference/compound_stmts.rst:1748 +#: ../../reference/compound_stmts.rst:1769 msgid "" "Except for the :ref:`lazy evaluation <lazy-evaluation>` of the :class:" "`~typing.TypeVar` bound, this is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1751 +#: ../../reference/compound_stmts.rst:1772 msgid "" "DEFAULT_OF_arg = some_default\n" "\n" @@ -2406,25 +2436,25 @@ msgid "" "func = decorator(TYPE_PARAMS_OF_func())" msgstr "" -#: ../../reference/compound_stmts.rst:1770 +#: ../../reference/compound_stmts.rst:1791 msgid "" "The capitalized names like ``DEFAULT_OF_arg`` are not actually bound at " "runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1776 +#: ../../reference/compound_stmts.rst:1797 msgid "Generic classes" msgstr "" -#: ../../reference/compound_stmts.rst:1778 +#: ../../reference/compound_stmts.rst:1799 msgid "Generic classes are declared as follows::" msgstr "" -#: ../../reference/compound_stmts.rst:1780 +#: ../../reference/compound_stmts.rst:1801 msgid "class Bag[T]: ..." msgstr "class Bag[T]: ..." -#: ../../reference/compound_stmts.rst:1784 +#: ../../reference/compound_stmts.rst:1805 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2442,14 +2472,14 @@ msgstr "" " return Bag\n" "Bag = TYPE_PARAMS_OF_Bag()" -#: ../../reference/compound_stmts.rst:1792 +#: ../../reference/compound_stmts.rst:1813 msgid "" "Here again ``annotation-def`` (not a real keyword) indicates an :ref:" "`annotation scope <annotation-scopes>`, and the name ``TYPE_PARAMS_OF_Bag`` " "is not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1796 +#: ../../reference/compound_stmts.rst:1817 msgid "" "Generic classes implicitly inherit from :data:`typing.Generic`. The base " "classes and keyword arguments of generic classes are evaluated within the " @@ -2457,7 +2487,7 @@ msgid "" "that scope. This is illustrated by this example::" msgstr "" -#: ../../reference/compound_stmts.rst:1802 +#: ../../reference/compound_stmts.rst:1823 msgid "" "@decorator\n" "class Bag(Base[T], arg=T): ..." @@ -2465,11 +2495,11 @@ msgstr "" "@decorator\n" "class Bag(Base[T], arg=T): ..." -#: ../../reference/compound_stmts.rst:1805 +#: ../../reference/compound_stmts.rst:1826 msgid "This is equivalent to::" msgstr "這等價於: ::" -#: ../../reference/compound_stmts.rst:1807 +#: ../../reference/compound_stmts.rst:1828 msgid "" "annotation-def TYPE_PARAMS_OF_Bag():\n" " T = typing.TypeVar(\"T\")\n" @@ -2487,27 +2517,27 @@ msgstr "" " return Bag\n" "Bag = decorator(TYPE_PARAMS_OF_Bag())" -#: ../../reference/compound_stmts.rst:1818 +#: ../../reference/compound_stmts.rst:1839 msgid "Generic type aliases" msgstr "" -#: ../../reference/compound_stmts.rst:1820 +#: ../../reference/compound_stmts.rst:1841 msgid "" "The :keyword:`type` statement can also be used to create a generic type " "alias::" msgstr "" -#: ../../reference/compound_stmts.rst:1822 +#: ../../reference/compound_stmts.rst:1843 msgid "type ListOrSet[T] = list[T] | set[T]" msgstr "type ListOrSet[T] = list[T] | set[T]" -#: ../../reference/compound_stmts.rst:1824 +#: ../../reference/compound_stmts.rst:1845 msgid "" "Except for the :ref:`lazy evaluation <lazy-evaluation>` of the value, this " "is equivalent to::" msgstr "" -#: ../../reference/compound_stmts.rst:1827 +#: ../../reference/compound_stmts.rst:1848 msgid "" "annotation-def TYPE_PARAMS_OF_ListOrSet():\n" " T = typing.TypeVar(\"T\")\n" @@ -2520,109 +2550,109 @@ msgid "" "ListOrSet = TYPE_PARAMS_OF_ListOrSet()" msgstr "" -#: ../../reference/compound_stmts.rst:1836 +#: ../../reference/compound_stmts.rst:1857 msgid "" "Here, ``annotation-def`` (not a real keyword) indicates an :ref:`annotation " "scope <annotation-scopes>`. The capitalized names like " "``TYPE_PARAMS_OF_ListOrSet`` are not actually bound at runtime." msgstr "" -#: ../../reference/compound_stmts.rst:1841 +#: ../../reference/compound_stmts.rst:1862 msgid "Footnotes" msgstr "註解" -#: ../../reference/compound_stmts.rst:1842 +#: ../../reference/compound_stmts.rst:1863 msgid "" "The exception is propagated to the invocation stack unless there is a :" "keyword:`finally` clause which happens to raise another exception. That new " "exception causes the old one to be lost." msgstr "" -#: ../../reference/compound_stmts.rst:1846 +#: ../../reference/compound_stmts.rst:1867 msgid "In pattern matching, a sequence is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1848 +#: ../../reference/compound_stmts.rst:1869 msgid "a class that inherits from :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1849 +#: ../../reference/compound_stmts.rst:1870 msgid "" "a Python class that has been registered as :class:`collections.abc.Sequence`" msgstr "" -#: ../../reference/compound_stmts.rst:1850 +#: ../../reference/compound_stmts.rst:1871 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_SEQUENCE` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1851 -#: ../../reference/compound_stmts.rst:1870 +#: ../../reference/compound_stmts.rst:1872 +#: ../../reference/compound_stmts.rst:1891 msgid "a class that inherits from any of the above" msgstr "" -#: ../../reference/compound_stmts.rst:1853 +#: ../../reference/compound_stmts.rst:1874 msgid "The following standard library classes are sequences:" msgstr "" -#: ../../reference/compound_stmts.rst:1855 +#: ../../reference/compound_stmts.rst:1876 msgid ":class:`array.array`" msgstr ":class:`array.array`" -#: ../../reference/compound_stmts.rst:1856 +#: ../../reference/compound_stmts.rst:1877 msgid ":class:`collections.deque`" msgstr ":class:`collections.deque`" -#: ../../reference/compound_stmts.rst:1858 +#: ../../reference/compound_stmts.rst:1879 msgid ":class:`memoryview`" msgstr ":class:`memoryview`" -#: ../../reference/compound_stmts.rst:1859 +#: ../../reference/compound_stmts.rst:1880 msgid ":class:`range`" msgstr ":class:`range`" -#: ../../reference/compound_stmts.rst:1862 +#: ../../reference/compound_stmts.rst:1883 msgid "" "Subject values of type ``str``, ``bytes``, and ``bytearray`` do not match " "sequence patterns." msgstr "" -#: ../../reference/compound_stmts.rst:1865 +#: ../../reference/compound_stmts.rst:1886 msgid "In pattern matching, a mapping is defined as one of the following:" msgstr "" -#: ../../reference/compound_stmts.rst:1867 +#: ../../reference/compound_stmts.rst:1888 msgid "a class that inherits from :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1868 +#: ../../reference/compound_stmts.rst:1889 msgid "" "a Python class that has been registered as :class:`collections.abc.Mapping`" msgstr "" -#: ../../reference/compound_stmts.rst:1869 +#: ../../reference/compound_stmts.rst:1890 msgid "" "a builtin class that has its (CPython) :c:macro:`Py_TPFLAGS_MAPPING` bit set" msgstr "" -#: ../../reference/compound_stmts.rst:1872 +#: ../../reference/compound_stmts.rst:1893 msgid "" "The standard library classes :class:`dict` and :class:`types." "MappingProxyType` are mappings." msgstr "" -#: ../../reference/compound_stmts.rst:1875 +#: ../../reference/compound_stmts.rst:1896 msgid "" "A string literal appearing as the first statement in the function body is " "transformed into the function's :attr:`~function.__doc__` attribute and " "therefore the function's :term:`docstring`." msgstr "" -#: ../../reference/compound_stmts.rst:1879 +#: ../../reference/compound_stmts.rst:1900 msgid "" "A string literal appearing as the first statement in the class body is " -"transformed into the namespace's ``__doc__`` item and therefore the class's :" -"term:`docstring`." +"transformed into the namespace's :attr:`~type.__doc__` item and therefore " +"the class's :term:`docstring`." msgstr "" #: ../../reference/compound_stmts.rst:7 @@ -2640,10 +2670,10 @@ msgstr "compound(複合)" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 -#: ../../reference/compound_stmts.rst:1491 -#: ../../reference/compound_stmts.rst:1525 -#: ../../reference/compound_stmts.rst:1570 +#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1497 +#: ../../reference/compound_stmts.rst:1531 +#: ../../reference/compound_stmts.rst:1576 msgid "statement" msgstr "statement(陳述式)" @@ -2691,7 +2721,7 @@ msgstr "if" #: ../../reference/compound_stmts.rst:408 #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 -#: ../../reference/compound_stmts.rst:1501 +#: ../../reference/compound_stmts.rst:1507 msgid "keyword" msgstr "keyword(關鍵字)" @@ -2705,8 +2735,8 @@ msgstr "elif" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1322 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1323 +#: ../../reference/compound_stmts.rst:1387 msgid ": (colon)" msgstr ": (冒號)" @@ -2716,7 +2746,7 @@ msgstr ": (冒號)" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:588 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "compound statement" msgstr "compound statement(複合陳述式)" @@ -2762,7 +2792,7 @@ msgstr "list(串列)" #: ../../reference/compound_stmts.rst:144 #: ../../reference/compound_stmts.rst:298 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "object" msgstr "object(物件)" @@ -2833,7 +2863,7 @@ msgstr "with statement(with 陳述式)" #: ../../reference/compound_stmts.rst:471 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid ", (comma)" msgstr ", (逗號)" @@ -2874,15 +2904,15 @@ msgid "AS pattern, OR pattern, capture pattern, wildcard pattern" msgstr "" #: ../../reference/compound_stmts.rst:1186 -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "parameter" msgstr "parameter(參數)" #: ../../reference/compound_stmts.rst:1186 #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1236 -#: ../../reference/compound_stmts.rst:1272 -#: ../../reference/compound_stmts.rst:1301 +#: ../../reference/compound_stmts.rst:1237 +#: ../../reference/compound_stmts.rst:1273 +#: ../../reference/compound_stmts.rst:1302 msgid "function definition" msgstr "function definition(函式定義)" @@ -2891,22 +2921,22 @@ msgid "def" msgstr "def" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1322 +#: ../../reference/compound_stmts.rst:1323 msgid "function" msgstr "function (函式)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "definition" msgstr "definition(定義)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "name" msgstr "name(名稱)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "binding" msgstr "binding(綁定)" @@ -2915,7 +2945,7 @@ msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" #: ../../reference/compound_stmts.rst:1195 -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "() (parentheses)" msgstr "() (圓括號)" @@ -2923,108 +2953,108 @@ msgstr "() (圓括號)" msgid "parameter list" msgstr "parameter list(參數列表)" -#: ../../reference/compound_stmts.rst:1236 -#: ../../reference/compound_stmts.rst:1431 +#: ../../reference/compound_stmts.rst:1237 +#: ../../reference/compound_stmts.rst:1437 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "default" msgstr "default(預設)" -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "value" msgstr "value(值)" -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "argument" msgstr "argument(引數)" -#: ../../reference/compound_stmts.rst:1272 +#: ../../reference/compound_stmts.rst:1273 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/compound_stmts.rst:1301 +#: ../../reference/compound_stmts.rst:1302 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/compound_stmts.rst:1301 +#: ../../reference/compound_stmts.rst:1302 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/compound_stmts.rst:1301 +#: ../../reference/compound_stmts.rst:1302 msgid "**" msgstr "**" -#: ../../reference/compound_stmts.rst:1322 +#: ../../reference/compound_stmts.rst:1323 msgid "annotations" msgstr "annotations(註釋)" -#: ../../reference/compound_stmts.rst:1322 +#: ../../reference/compound_stmts.rst:1323 msgid "->" msgstr "->" -#: ../../reference/compound_stmts.rst:1322 +#: ../../reference/compound_stmts.rst:1323 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../reference/compound_stmts.rst:1340 +#: ../../reference/compound_stmts.rst:1346 msgid "lambda" msgstr "lambda" -#: ../../reference/compound_stmts.rst:1340 +#: ../../reference/compound_stmts.rst:1346 msgid "expression" msgstr "expression(運算式)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "class" msgstr "class(類別)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "execution" msgstr "execution(執行)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "frame" msgstr "frame" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "inheritance" msgstr "inheritance(繼承)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "docstring" msgstr "docstring(說明字串)" -#: ../../reference/compound_stmts.rst:1381 -#: ../../reference/compound_stmts.rst:1431 +#: ../../reference/compound_stmts.rst:1387 +#: ../../reference/compound_stmts.rst:1437 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/compound_stmts.rst:1381 +#: ../../reference/compound_stmts.rst:1387 msgid "expression list" msgstr "expression list(表達式列表)" -#: ../../reference/compound_stmts.rst:1491 +#: ../../reference/compound_stmts.rst:1497 msgid "async def" msgstr "async def" -#: ../../reference/compound_stmts.rst:1501 +#: ../../reference/compound_stmts.rst:1507 msgid "async" msgstr "async" -#: ../../reference/compound_stmts.rst:1501 +#: ../../reference/compound_stmts.rst:1507 msgid "await" msgstr "await" -#: ../../reference/compound_stmts.rst:1525 +#: ../../reference/compound_stmts.rst:1531 msgid "async for" msgstr "async for" -#: ../../reference/compound_stmts.rst:1570 +#: ../../reference/compound_stmts.rst:1576 msgid "async with" msgstr "async with" -#: ../../reference/compound_stmts.rst:1624 +#: ../../reference/compound_stmts.rst:1633 msgid "type parameters" msgstr "type parameter(型別參數)" diff --git a/reference/datamodel.po b/reference/datamodel.po index 88092c9db3..4a7709654d 100644 --- a/reference/datamodel.po +++ b/reference/datamodel.po @@ -2,13 +2,15 @@ # This file is distributed under the same license as the Python package. # # Translators: +# Adrian Liaw <adrianliaw2000@gmail.com>, 2018 +# Kisaragi Hiu <mail@kisaragi-hiu.com>, 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" -"PO-Revision-Date: 2018-05-23 16:17+0000\n" -"Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" +"POT-Creation-Date: 2024-10-04 00:13+0000\n" +"PO-Revision-Date: 2024-09-24 19:03+0900\n" +"Last-Translator: Kisaragi Hiu <mail@kisaragi-hiu.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" "Language: zh_TW\n" @@ -16,6 +18,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Lokalize 24.08.1\n" #: ../../reference/datamodel.rst:6 msgid "Data model" @@ -23,7 +26,7 @@ msgstr "資料模型" #: ../../reference/datamodel.rst:12 msgid "Objects, values and types" -msgstr "" +msgstr "物件、數值和型別" #: ../../reference/datamodel.rst:18 msgid "" @@ -32,6 +35,9 @@ msgid "" "sense, and in conformance to Von Neumann's model of a \"stored program " "computer\", code is also represented by objects.)" msgstr "" +":dfn:`物件` 是 Python 為資料的抽象表示方式。一個 Python 程式當中的所有資料皆" +"由物件或物件之間的關係來呈現。(某種意義上,同時符合 Von Neumann 對於「儲存程" +"式型電腦」(\"stored program computer\") 的模型,程式碼也是以物件呈現的。)" #: ../../reference/datamodel.rst:35 msgid "" @@ -41,10 +47,14 @@ msgid "" "objects; the :func:`id` function returns an integer representing its " "identity." msgstr "" +"每個物件都有一個識別性、型別,和數值。物件的\\ *識別性*\\ 在物件建立後永遠不" +"會改變;你也可以把它想成是該物件在記憶體中的位址。:keyword:`is` 運算子會比較" +"兩個物件的識別性是否相同;:func:`id` 函式則會回傳代表一個該物件的識別性的整" +"數。" #: ../../reference/datamodel.rst:42 msgid "For CPython, ``id(x)`` is the memory address where ``x`` is stored." -msgstr "" +msgstr "在 CPython 當中,``id(x)`` 就是 ``x`` 所儲存在的記憶體位址。" #: ../../reference/datamodel.rst:44 msgid "" @@ -54,6 +64,10 @@ msgid "" "an object itself). Like its identity, an object's :dfn:`type` is also " "unchangeable. [#]_" msgstr "" +"一個物件的型別決定了該物件所支援的操作(例如「它有長度嗎?」),也同時定義該" +"型別的物件能夠擁有的數值。:func:`type` 函式會回傳一個物件的型別(而該型別本身" +"也是一個物件)。如同它的識別性,一個物件的型別 (:dfn:`type`) 也是不可變" +"的。\\ [#]_" #: ../../reference/datamodel.rst:50 msgid "" @@ -68,6 +82,13 @@ msgid "" "instance, numbers, strings and tuples are immutable, while dictionaries and " "lists are mutable." msgstr "" +"某些物件的\\ *數值*\\ 可被改變,這種物件稱作「可變的」(*mutable*);建立後數值" +"不能變更的物件則稱作「不可變的」(*immutable*)。(不可變的容器物件中如果包含對" +"於可變物件的參照,則後者的數值改變的時候前者的數值也會跟著一起改變;這種時候" +"該容器仍會被當成是不可變的,因為它包含的物件集合仍然無法變更。因此可變或不可" +"變嚴格說起並不等同於數值是否能被改變,它的定義有其他不明顯的細節。)一個物件" +"是否為可變取決於它的型別;舉例來說,數字、字串和 tuple 是不可變的,而字典與串" +"列則是可變的。" #: ../../reference/datamodel.rst:65 msgid "" @@ -77,6 +98,9 @@ msgid "" "implementation quality how garbage collection is implemented, as long as no " "objects are collected that are still reachable." msgstr "" +"物件永遠不會被明示的摧毀;但當它們變得不再能夠存取的時候可能會被作為垃圾回" +"收。每個實作都能延後垃圾回收或是乾脆忽略它 --- 垃圾回收如何進行完全取決於各個" +"實作,只要沒有被回收的物件仍是可達的。" #: ../../reference/datamodel.rst:73 msgid "" @@ -89,6 +113,11 @@ msgid "" "on immediate finalization of objects when they become unreachable (so you " "should always close files explicitly)." msgstr "" +"CPython 目前使用一種參照計數的方案,並提供可選的循環連結垃圾延遲偵測,這個方" +"案會在大部分物件變得不可存取時馬上回收它們,但不保證能夠回收包含循環參照的垃" +"圾。關於控制循環垃圾回收的資訊請見 :mod:`gc` 模組的說明文件。其他實作的行為不" +"會相同,CPython 也有可能改變,因此請不要仰賴物件在變得不可存取時能夠馬上被最" +"終化(亦即你應該總是明確關閉檔案)。" #: ../../reference/datamodel.rst:82 msgid "" @@ -97,6 +126,9 @@ msgid "" "catching an exception with a :keyword:`try`...\\ :keyword:`except` statement " "may keep objects alive." msgstr "" +"請注意,使用一個實作的追蹤或除錯工具可能會讓原本能夠回收的物件被維持存活。也" +"請注意,使用 :keyword:`try`...\\ :keyword:`except` 陳述式來抓捕例外也可能會讓" +"物件維持存活。" #: ../../reference/datamodel.rst:87 msgid "" @@ -109,6 +141,11 @@ msgid "" "`finally` statement and the :keyword:`with` statement provide convenient " "ways to do this." msgstr "" +"某些物件包含對於「外部」資源的參照,像是開啟的檔案或是視窗。基本上這些資源會" +"在物件被回收時釋放,但因為垃圾回收不保證會發生,這種物件也會提供明確釋放外部" +"資源的方式 --- 通常是 :meth:`!close` method。強烈建議各個程式明確關閉這種物" +"件。:keyword:`try`...\\ :keyword:`finally` 陳述式與 :keyword:`with` 陳述式提" +"供進行明確關閉的方便手段。" #: ../../reference/datamodel.rst:97 msgid "" @@ -121,6 +158,12 @@ msgid "" "implied. So, if an immutable container (like a tuple) contains a reference " "to a mutable object, its value changes if that mutable object is changed." msgstr "" +"某些物件包含對於其他物件的參照;這種物件被叫做「容器」。容器的範例有 tuple、" +"串列與字典。這些參照是容器的數值的一部分。通常當我們提到容器的數值的時候,我" +"們指的是其中包含的物件的數值,而不是它們的識別性;但當我們提到容器是否可變的" +"時候,我們指的是直接包含在其中的物件的識別性。因此,如果一個不可變的容器(像" +"一個 tuple)包含對於可變物件的參照,該可變物件被變更時該容器的數值也會跟著變" +"更。" #: ../../reference/datamodel.rst:106 msgid "" @@ -138,6 +181,15 @@ msgid "" "newly created empty lists. (Note that ``e = f = []`` assigns the *same* " "object to both *e* and *f*.)" msgstr "" +"型別幾乎影響物件行為的所有面向。就連物件識別性的重要性某種程度上也受型別影" +"響:對於不可變的型別,計算新數值的操作可能其實會回傳一個某個相同型別且相同數" +"值的現存物件的參照;對於可變型別這則不會發生。舉例來說,在進行 ``a = 1; b = " +"1`` 之後,*a* 和 *b* 可能會參照同一個物件,也可能不會,取決於所使用的實作。這" +"是因為 :class:`int` 是不可變的型別,因此 ``1`` 的參照可以重複利用。這個行為取" +"決於所使用的實作,因此不應該依賴它,但在進行物件識別性測試的時候還是需要注意" +"有這件事情。而在進行 ``c = []; d = []`` 之後,*c* 和 *d* 則保證會參照兩個不" +"同、獨特、且新建立的空白串列。(請注意,``e = f = []`` 則會將同一個物件同時指" +"派給 *e* 和 *f*。)" #: ../../reference/datamodel.rst:124 msgid "The standard type hierarchy" @@ -163,7 +215,7 @@ msgstr "" #: ../../reference/datamodel.rst:150 ../../reference/datamodel.rst:152 msgid "None" -msgstr "" +msgstr "None" #: ../../reference/datamodel.rst:154 msgid "" @@ -172,6 +224,9 @@ msgid "" "signify the absence of a value in many situations, e.g., it is returned from " "functions that don't explicitly return anything. Its truth value is false." msgstr "" +"這個型別只有一個數值。只有一個物件有這個數值。這個物件由內建名稱 ``None`` 存" +"取。它用來在許多情況下代表數值不存在,例如沒有明確回傳任何東西的函式就會回傳" +"這個物件。它的真值是 false。" #: ../../reference/datamodel.rst:161 ../../reference/datamodel.rst:163 msgid "NotImplemented" @@ -186,6 +241,10 @@ msgid "" "will then try the reflected operation, or some other fallback, depending on " "the operator.) It should not be evaluated in a boolean context." msgstr "" +"這個型別只有一個數值。只有一個物件有這個數值。這個物件由內建名稱 :data:" +"`NotImplemented` 存取。數字方法和 rich comparison 方法應該在沒有為所提供的運" +"算元實作該操作的時候回傳這個數值。(直譯器接下來則會依運算子嘗試反轉的操作或" +"是其他的後備方案。)它不應該在預期布林值的情境中被計算。" #: ../../reference/datamodel.rst:172 msgid "See :ref:`implementing-the-arithmetic-operations` for more details." @@ -197,10 +256,13 @@ msgid "" "it currently evaluates as true, it will emit a :exc:`DeprecationWarning`. It " "will raise a :exc:`TypeError` in a future version of Python." msgstr "" +"在預期布林值的情境中計算 :data:`NotImplemented` 的行為已棄用。雖然目前它會計" +"算為 true,它也會同時發出 :exc:`DeprecationWarning`。從某個未來 Python 版本開" +"始這將會引發 :exc:`TypeError`。" #: ../../reference/datamodel.rst:183 ../../reference/datamodel.rst:184 msgid "Ellipsis" -msgstr "" +msgstr "Ellipsis" #: ../../reference/datamodel.rst:188 msgid "" @@ -208,6 +270,8 @@ msgid "" "This object is accessed through the literal ``...`` or the built-in name " "``Ellipsis``. Its truth value is true." msgstr "" +"這個型別只有一個數值。只有一個物件有這個數值。這個物件由文本 ``...`` 或內建名" +"稱 ``Ellipsis`` 存取。它的真值是 true。" #: ../../reference/datamodel.rst:194 msgid ":class:`numbers.Number`" @@ -406,7 +470,7 @@ msgstr "" #: ../../reference/datamodel.rst:362 msgid "Tuples" -msgstr "" +msgstr "Tuple(元組)" #: ../../reference/datamodel.rst:368 msgid "" @@ -420,7 +484,7 @@ msgstr "" #: ../../reference/datamodel.rst:375 msgid "Bytes" -msgstr "" +msgstr "位元組" #: ../../reference/datamodel.rst:378 msgid "" @@ -433,7 +497,7 @@ msgstr "" #: ../../reference/datamodel.rst:386 msgid "Mutable sequences" -msgstr "" +msgstr "可變序列" #: ../../reference/datamodel.rst:395 msgid "" @@ -465,7 +529,7 @@ msgstr "" #: ../../reference/datamodel.rst:415 msgid "Byte Arrays" -msgstr "" +msgstr "位元組陣列" #: ../../reference/datamodel.rst:418 msgid "" @@ -477,7 +541,7 @@ msgstr "" #: ../../reference/datamodel.rst:425 msgid "Set types" -msgstr "" +msgstr "Set(集合)型別" #: ../../reference/datamodel.rst:431 msgid "" @@ -503,7 +567,7 @@ msgstr "" #: ../../reference/datamodel.rst:446 msgid "Sets" -msgstr "" +msgstr "Set(集合)" #: ../../reference/datamodel.rst:449 msgid "" @@ -514,7 +578,7 @@ msgstr "" #: ../../reference/datamodel.rst:454 msgid "Frozen sets" -msgstr "" +msgstr "Frozen set(凍結集合)" #: ../../reference/datamodel.rst:457 msgid "" @@ -525,7 +589,7 @@ msgstr "" #: ../../reference/datamodel.rst:464 msgid "Mappings" -msgstr "" +msgstr "對映" #: ../../reference/datamodel.rst:471 msgid "" @@ -585,7 +649,7 @@ msgstr "" #: ../../reference/datamodel.rst:517 msgid "Callable types" -msgstr "" +msgstr "可呼叫型別" #: ../../reference/datamodel.rst:525 msgid "" @@ -604,16 +668,18 @@ msgid "" "containing the same number of items as the function's formal parameter list." msgstr "" -#: ../../reference/datamodel.rst:545 ../../reference/datamodel.rst:1124 -#: ../../reference/datamodel.rst:1319 +#: ../../reference/datamodel.rst:545 ../../reference/datamodel.rst:1206 +#: ../../reference/datamodel.rst:1403 msgid "Special read-only attributes" msgstr "特殊唯讀屬性" #: ../../reference/datamodel.rst:555 ../../reference/datamodel.rst:589 +#: ../../reference/datamodel.rst:981 msgid "Attribute" msgstr "屬性" #: ../../reference/datamodel.rst:556 ../../reference/datamodel.rst:590 +#: ../../reference/datamodel.rst:982 msgid "Meaning" msgstr "含義" @@ -636,7 +702,7 @@ msgid "" "the value of the cell, as well as set the value." msgstr "" -#: ../../reference/datamodel.rst:571 ../../reference/datamodel.rst:1356 +#: ../../reference/datamodel.rst:571 ../../reference/datamodel.rst:1445 msgid "Special writable attributes" msgstr "特殊可寫屬性" @@ -645,49 +711,47 @@ msgid "Most of these attributes check the type of the assigned value:" msgstr "" #: ../../reference/datamodel.rst:593 -msgid "" -"The function's documentation string, or ``None`` if unavailable. Not " -"inherited by subclasses." -msgstr "" +msgid "The function's documentation string, or ``None`` if unavailable." +msgstr "函式的文件字串,若不可用則為 ``None``。" -#: ../../reference/datamodel.rst:597 +#: ../../reference/datamodel.rst:596 msgid "" "The function's name. See also: :attr:`__name__ attributes <definition." "__name__>`." msgstr "" -#: ../../reference/datamodel.rst:601 +#: ../../reference/datamodel.rst:600 msgid "" "The function's :term:`qualified name`. See also: :attr:`__qualname__ " "attributes <definition.__qualname__>`." msgstr "" -#: ../../reference/datamodel.rst:607 +#: ../../reference/datamodel.rst:606 msgid "" "The name of the module the function was defined in, or ``None`` if " "unavailable." msgstr "" -#: ../../reference/datamodel.rst:611 +#: ../../reference/datamodel.rst:610 msgid "" "A :class:`tuple` containing default :term:`parameter` values for those " "parameters that have defaults, or ``None`` if no parameters have a default " "value." msgstr "" -#: ../../reference/datamodel.rst:616 +#: ../../reference/datamodel.rst:615 msgid "" "The :ref:`code object <code-objects>` representing the compiled function " "body." msgstr "代表編譯函式主體的\\ :ref:`程式碼物件 <code-objects>`。" -#: ../../reference/datamodel.rst:620 +#: ../../reference/datamodel.rst:619 msgid "" "The namespace supporting arbitrary function attributes. See also: :attr:" "`__dict__ attributes <object.__dict__>`." msgstr "" -#: ../../reference/datamodel.rst:624 +#: ../../reference/datamodel.rst:623 msgid "" "A :class:`dictionary <dict>` containing annotations of :term:`parameters " "<parameter>`. The keys of the dictionary are the parameter names, and " @@ -695,88 +759,88 @@ msgid "" "`annotations-howto`." msgstr "" -#: ../../reference/datamodel.rst:631 +#: ../../reference/datamodel.rst:630 msgid "" "A :class:`dictionary <dict>` containing defaults for keyword-only :term:" "`parameters <parameter>`." msgstr "" -#: ../../reference/datamodel.rst:635 +#: ../../reference/datamodel.rst:634 msgid "" "A :class:`tuple` containing the :ref:`type parameters <type-params>` of a :" "ref:`generic function <generic-functions>`." msgstr "" -#: ../../reference/datamodel.rst:640 +#: ../../reference/datamodel.rst:639 msgid "" "Function objects also support getting and setting arbitrary attributes, " "which can be used, for example, to attach metadata to functions. Regular " "attribute dot-notation is used to get and set such attributes." msgstr "" -#: ../../reference/datamodel.rst:646 +#: ../../reference/datamodel.rst:645 msgid "" "CPython's current implementation only supports function attributes on user-" "defined functions. Function attributes on :ref:`built-in functions <builtin-" "functions>` may be supported in the future." msgstr "" -#: ../../reference/datamodel.rst:651 +#: ../../reference/datamodel.rst:650 msgid "" "Additional information about a function's definition can be retrieved from " "its :ref:`code object <code-objects>` (accessible via the :attr:`~function." "__code__` attribute)." msgstr "" -#: ../../reference/datamodel.rst:659 +#: ../../reference/datamodel.rst:658 msgid "Instance methods" msgstr "" -#: ../../reference/datamodel.rst:666 +#: ../../reference/datamodel.rst:665 msgid "" "An instance method object combines a class, a class instance and any " "callable object (normally a user-defined function)." msgstr "" -#: ../../reference/datamodel.rst:676 ../../reference/datamodel.rst:1447 +#: ../../reference/datamodel.rst:675 ../../reference/datamodel.rst:1541 msgid "Special read-only attributes:" msgstr "特殊唯讀屬性:" -#: ../../reference/datamodel.rst:681 +#: ../../reference/datamodel.rst:680 msgid "" "Refers to the class instance object to which the method is :ref:`bound " "<method-binding>`" msgstr "" -#: ../../reference/datamodel.rst:685 +#: ../../reference/datamodel.rst:684 msgid "Refers to the original :ref:`function object <user-defined-funcs>`" msgstr "" -#: ../../reference/datamodel.rst:688 +#: ../../reference/datamodel.rst:687 msgid "" "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 +#: ../../reference/datamodel.rst:693 msgid "" "The name of the method (same as :attr:`method.__func__.__name__ <function." "__name__>`)" msgstr "" -#: ../../reference/datamodel.rst:698 +#: ../../reference/datamodel.rst:697 msgid "" "The name of the module the method was defined in, or ``None`` if unavailable." msgstr "" -#: ../../reference/datamodel.rst:701 +#: ../../reference/datamodel.rst:700 msgid "" "Methods also support accessing (but not setting) the arbitrary function " "attributes on the underlying :ref:`function object <user-defined-funcs>`." msgstr "" -#: ../../reference/datamodel.rst:704 +#: ../../reference/datamodel.rst:703 msgid "" "User-defined method objects may be created when getting an attribute of a " "class (perhaps via an instance of that class), if that attribute is a user-" @@ -784,7 +848,7 @@ msgid "" "`classmethod` object." msgstr "" -#: ../../reference/datamodel.rst:711 +#: ../../reference/datamodel.rst:710 msgid "" "When an instance method object is created by retrieving a user-defined :ref:" "`function object <user-defined-funcs>` from a class via one of its " @@ -793,7 +857,7 @@ msgid "" "__func__` attribute is the original function object." msgstr "" -#: ../../reference/datamodel.rst:717 +#: ../../reference/datamodel.rst:716 msgid "" "When an instance method object is created by retrieving a :class:" "`classmethod` object from a class or instance, its :attr:`~method.__self__` " @@ -801,7 +865,7 @@ msgid "" "the function object underlying the class method." msgstr "" -#: ../../reference/datamodel.rst:722 +#: ../../reference/datamodel.rst:721 msgid "" "When an instance method object is called, the underlying function (:attr:" "`~method.__func__`) is called, inserting the class instance (:attr:`~method." @@ -811,7 +875,7 @@ msgid "" "f(x, 1)``." msgstr "" -#: ../../reference/datamodel.rst:729 +#: ../../reference/datamodel.rst:728 msgid "" "When an instance method object is derived from a :class:`classmethod` " "object, the \"class instance\" stored in :attr:`~method.__self__` will " @@ -820,18 +884,18 @@ msgid "" "function." msgstr "" -#: ../../reference/datamodel.rst:734 +#: ../../reference/datamodel.rst:733 msgid "" "It is important to note that user-defined functions which are attributes of " "a class instance are not converted to bound methods; this *only* happens " "when the function is an attribute of the class." msgstr "" -#: ../../reference/datamodel.rst:741 +#: ../../reference/datamodel.rst:740 msgid "Generator functions" -msgstr "" +msgstr "Generator(產生器)函式" -#: ../../reference/datamodel.rst:747 +#: ../../reference/datamodel.rst:746 msgid "" "A function or method which uses the :keyword:`yield` statement (see section :" "ref:`yield`) is called a :dfn:`generator function`. Such a function, when " @@ -844,11 +908,11 @@ msgid "" "values to be returned." msgstr "" -#: ../../reference/datamodel.rst:759 +#: ../../reference/datamodel.rst:758 msgid "Coroutine functions" -msgstr "" +msgstr "Coroutine(協程)函式" -#: ../../reference/datamodel.rst:764 +#: ../../reference/datamodel.rst:763 msgid "" "A function or method which is defined using :keyword:`async def` is called " "a :dfn:`coroutine function`. Such a function, when called, returns a :term:" @@ -857,11 +921,11 @@ msgid "" "ref:`coroutine-objects` section." msgstr "" -#: ../../reference/datamodel.rst:772 +#: ../../reference/datamodel.rst:771 msgid "Asynchronous generator functions" msgstr "" -#: ../../reference/datamodel.rst:778 +#: ../../reference/datamodel.rst:777 msgid "" "A function or method which is defined using :keyword:`async def` and which " "uses the :keyword:`yield` statement is called a :dfn:`asynchronous generator " @@ -870,7 +934,7 @@ msgid "" "execute the body of the function." msgstr "" -#: ../../reference/datamodel.rst:784 +#: ../../reference/datamodel.rst:783 msgid "" "Calling the asynchronous iterator's :meth:`aiterator.__anext__ <object." "__anext__>` method will return an :term:`awaitable` which when awaited will " @@ -881,19 +945,22 @@ msgid "" "yielded." msgstr "" -#: ../../reference/datamodel.rst:797 +#: ../../reference/datamodel.rst:796 msgid "Built-in functions" -msgstr "" +msgstr "內建函式" -#: ../../reference/datamodel.rst:804 +#: ../../reference/datamodel.rst:803 msgid "" "A built-in function object is a wrapper around a C function. Examples of " "built-in functions are :func:`len` and :func:`math.sin` (:mod:`math` is a " "standard built-in module). The number and type of the arguments are " "determined by the C function. Special read-only attributes:" msgstr "" +"一個內建函式物件是一個 C 函式的 wrapper。內建函式的範例有 :func:`len` 和 :" +"func:`math.sin`\\ (\\ :mod:`math` 是一個標準的內建模組)。內建函式的引數數量" +"與其型別由其包裝的 C 函式所決定。特殊唯讀屬性:" -#: ../../reference/datamodel.rst:809 +#: ../../reference/datamodel.rst:808 msgid "" ":attr:`!__doc__` is the function's documentation string, or ``None`` if " "unavailable. See :attr:`function.__doc__`." @@ -901,26 +968,26 @@ msgstr "" ":attr:`!__doc__` 是函式的文件字串,若不可用則為 ``None``。請見 :attr:" "`function.__doc__`。" -#: ../../reference/datamodel.rst:811 +#: ../../reference/datamodel.rst:810 msgid "" ":attr:`!__name__` is the function's name. See :attr:`function.__name__`." msgstr ":attr:`!__name__` 是函式的名稱。請見 :attr:`function.__name__`。" -#: ../../reference/datamodel.rst:812 +#: ../../reference/datamodel.rst:811 msgid ":attr:`!__self__` is set to ``None`` (but see the next item)." msgstr "" -#: ../../reference/datamodel.rst:813 +#: ../../reference/datamodel.rst:812 msgid "" ":attr:`!__module__` is the name of the module the function was defined in or " "``None`` if unavailable. See :attr:`function.__module__`." msgstr "" -#: ../../reference/datamodel.rst:821 +#: ../../reference/datamodel.rst:820 msgid "Built-in methods" msgstr "" -#: ../../reference/datamodel.rst:828 +#: ../../reference/datamodel.rst:827 msgid "" "This is really a different disguise of a built-in function, this time " "containing an object passed to the C function as an implicit extra " @@ -991,7 +1058,7 @@ msgstr ":attr:`__name__`" msgid "The module's name." msgstr "" -#: ../../reference/datamodel.rst:888 ../../reference/datamodel.rst:986 +#: ../../reference/datamodel.rst:888 msgid ":attr:`__doc__`" msgstr ":attr:`__doc__`" @@ -1012,7 +1079,7 @@ msgid "" "library, it's the pathname of the shared library file." msgstr "" -#: ../../reference/datamodel.rst:901 ../../reference/datamodel.rst:989 +#: ../../reference/datamodel.rst:901 msgid ":attr:`__annotations__`" msgstr ":attr:`__annotations__`" @@ -1037,11 +1104,11 @@ msgid "" "module around while using its dictionary directly." msgstr "" -#: ../../reference/datamodel.rst:921 +#: ../../reference/datamodel.rst:923 msgid "Custom classes" msgstr "" -#: ../../reference/datamodel.rst:923 +#: ../../reference/datamodel.rst:925 msgid "" "Custom class types are typically created by class definitions (see section :" "ref:`class`). A class has a namespace implemented by a dictionary object. " @@ -1056,7 +1123,7 @@ msgid "" "found at :ref:`python_2.3_mro`." msgstr "" -#: ../../reference/datamodel.rst:944 +#: ../../reference/datamodel.rst:946 msgid "" "When a class attribute reference (for class :class:`!C`, say) would yield a " "class method object, it is transformed into an instance method object whose :" @@ -1067,82 +1134,135 @@ msgid "" "contained in its :attr:`~object.__dict__`." msgstr "" -#: ../../reference/datamodel.rst:955 +#: ../../reference/datamodel.rst:957 msgid "" "Class attribute assignments update the class's dictionary, never the " "dictionary of a base class." msgstr "" -#: ../../reference/datamodel.rst:960 +#: ../../reference/datamodel.rst:962 msgid "" "A class object can be called (see above) to yield a class instance (see " "below)." msgstr "" -#: ../../reference/datamodel.rst:971 -msgid "Special attributes:" +#: ../../reference/datamodel.rst:965 ../../reference/datamodel.rst:1112 +msgid "Special attributes" +msgstr "特殊屬性" + +#: ../../reference/datamodel.rst:985 +msgid "" +"The class's name. See also: :attr:`__name__ attributes <definition." +"__name__>`." +msgstr "" + +#: ../../reference/datamodel.rst:989 +msgid "" +"The class's :term:`qualified name`. See also: :attr:`__qualname__ attributes " +"<definition.__qualname__>`." msgstr "" -#: ../../reference/datamodel.rst:973 -msgid ":attr:`~definition.__name__`" -msgstr ":attr:`~definition.__name__`" +#: ../../reference/datamodel.rst:993 +msgid "The name of the module in which the class was defined." +msgstr "" -#: ../../reference/datamodel.rst:974 -msgid "The class name." +#: ../../reference/datamodel.rst:996 +msgid "" +"A :class:`mapping proxy <types.MappingProxyType>` providing a read-only view " +"of the class's namespace. See also: :attr:`__dict__ attributes <object." +"__dict__>`." msgstr "" -#: ../../reference/datamodel.rst:976 -msgid ":attr:`__module__`" -msgstr ":attr:`__module__`" +#: ../../reference/datamodel.rst:1001 +msgid "" +"A :class:`tuple` containing the class's bases. In most cases, for a class " +"defined as ``class X(A, B, C)``, ``X.__bases__`` will be exactly equal to " +"``(A, B, C)``." +msgstr "" -#: ../../reference/datamodel.rst:977 -msgid "The name of the module in which the class was defined." +#: ../../reference/datamodel.rst:1006 +msgid "" +"The class's documentation string, or ``None`` if undefined. Not inherited by " +"subclasses." msgstr "" -#: ../../reference/datamodel.rst:979 -msgid ":attr:`~object.__dict__`" -msgstr ":attr:`~object.__dict__`" +#: ../../reference/datamodel.rst:1010 +msgid "" +"A dictionary containing :term:`variable annotations <variable annotation>` " +"collected during class body execution. For best practices on working with :" +"attr:`!__annotations__`, please see :ref:`annotations-howto`." +msgstr "" -#: ../../reference/datamodel.rst:980 -msgid "The dictionary containing the class's namespace." +#: ../../reference/datamodel.rst:1017 +msgid "" +"Accessing the :attr:`!__annotations__` attribute of a class object directly " +"may yield incorrect results in the presence of metaclasses. In addition, the " +"attribute may not exist for some classes. Use :func:`inspect." +"get_annotations` to retrieve class annotations safely." msgstr "" -#: ../../reference/datamodel.rst:982 -msgid ":attr:`~class.__bases__`" -msgstr ":attr:`~class.__bases__`" +#: ../../reference/datamodel.rst:1024 +msgid "" +"A :class:`tuple` containing the :ref:`type parameters <type-params>` of a :" +"ref:`generic class <generic-classes>`." +msgstr "" -#: ../../reference/datamodel.rst:983 +#: ../../reference/datamodel.rst:1030 msgid "" -"A tuple containing the base classes, in the order of their occurrence in the " -"base class list." +"A :class:`tuple` containing names of attributes of this class which are " +"assigned through ``self.X`` from any function in its body." msgstr "" -#: ../../reference/datamodel.rst:987 -msgid "The class's documentation string, or ``None`` if undefined." +#: ../../reference/datamodel.rst:1036 +msgid "" +"The line number of the first line of the class definition, including " +"decorators. Setting the :attr:`__module__` attribute removes the :attr:`!" +"__firstlineno__` item from the type's dictionary." msgstr "" -#: ../../reference/datamodel.rst:990 +#: ../../reference/datamodel.rst:1044 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`." +"The :class:`tuple` of classes that are considered when looking for base " +"classes during method resolution." msgstr "" -#: ../../reference/datamodel.rst:996 -msgid ":attr:`__type_params__`" -msgstr ":attr:`__type_params__`" +#: ../../reference/datamodel.rst:1049 +msgid "Special methods" +msgstr "特殊方法" + +#: ../../reference/datamodel.rst:1051 +msgid "" +"In addition to the special attributes described above, all Python classes " +"also have the following two methods available:" +msgstr "" + +#: ../../reference/datamodel.rst:1056 +msgid "" +"This method can be overridden by a metaclass to customize the method " +"resolution order for its instances. It is called at class instantiation, " +"and its result is stored in :attr:`~type.__mro__`." +msgstr "" -#: ../../reference/datamodel.rst:997 +#: ../../reference/datamodel.rst:1062 msgid "" -"A tuple containing the :ref:`type parameters <type-params>` of a :ref:" -"`generic class <generic-classes>`." +"Each class keeps a list of weak references to its immediate subclasses. This " +"method returns a list of all those references still alive. The list is in " +"definition order. Example:" msgstr "" -#: ../../reference/datamodel.rst:1002 +#: ../../reference/datamodel.rst:1066 +msgid "" +">>> class A: pass\n" +">>> class B(A): pass\n" +">>> A.__subclasses__()\n" +"[<class 'B'>]" +msgstr "" + +#: ../../reference/datamodel.rst:1074 msgid "Class instances" msgstr "" -#: ../../reference/datamodel.rst:1010 +#: ../../reference/datamodel.rst:1082 msgid "" "A class instance is created by calling a class object (see above). A class " "instance has a namespace implemented as a dictionary which is the first " @@ -1159,7 +1279,7 @@ msgid "" "__getattr__` method, that is called to satisfy the lookup." msgstr "" -#: ../../reference/datamodel.rst:1026 +#: ../../reference/datamodel.rst:1098 msgid "" "Attribute assignments and deletions update the instance's dictionary, never " "a class's dictionary. If the class has a :meth:`~object.__setattr__` or :" @@ -1167,23 +1287,28 @@ msgid "" "instance dictionary directly." msgstr "" -#: ../../reference/datamodel.rst:1036 +#: ../../reference/datamodel.rst:1108 msgid "" "Class instances can pretend to be numbers, sequences, or mappings if they " "have methods with certain special names. See section :ref:`specialnames`." msgstr "" -#: ../../reference/datamodel.rst:1043 +#: ../../reference/datamodel.rst:1120 +msgid "The class to which a class instance belongs." +msgstr "" + +#: ../../reference/datamodel.rst:1124 msgid "" -"Special attributes: :attr:`~object.__dict__` is the attribute dictionary; :" -"attr:`~instance.__class__` is the instance's class." +"A dictionary or other mapping object used to store an object's (writable) " +"attributes. Not all instances have a :attr:`!__dict__` attribute; see the " +"section on :ref:`slots` for more details." msgstr "" -#: ../../reference/datamodel.rst:1048 +#: ../../reference/datamodel.rst:1130 msgid "I/O objects (also known as file objects)" msgstr "" -#: ../../reference/datamodel.rst:1063 +#: ../../reference/datamodel.rst:1145 msgid "" "A :term:`file object` represents an open file. Various shortcuts are " "available to create file objects: the :func:`open` built-in function, and " @@ -1192,7 +1317,7 @@ msgid "" "methods provided by extension modules)." msgstr "" -#: ../../reference/datamodel.rst:1069 +#: ../../reference/datamodel.rst:1151 msgid "" "The objects ``sys.stdin``, ``sys.stdout`` and ``sys.stderr`` are initialized " "to file objects corresponding to the interpreter's standard input, output " @@ -1200,22 +1325,22 @@ msgid "" "interface defined by the :class:`io.TextIOBase` abstract class." msgstr "" -#: ../../reference/datamodel.rst:1077 +#: ../../reference/datamodel.rst:1159 msgid "Internal types" msgstr "" -#: ../../reference/datamodel.rst:1083 +#: ../../reference/datamodel.rst:1165 msgid "" "A few types used internally by the interpreter are exposed to the user. " "Their definitions may change with future versions of the interpreter, but " "they are mentioned here for completeness." msgstr "" -#: ../../reference/datamodel.rst:1091 +#: ../../reference/datamodel.rst:1173 msgid "Code objects" msgstr "" -#: ../../reference/datamodel.rst:1095 +#: ../../reference/datamodel.rst:1177 msgid "" "Code objects represent *byte-compiled* executable Python code, or :term:" "`bytecode`. The difference between a code object and a function object is " @@ -1227,103 +1352,103 @@ msgid "" "no references (directly or indirectly) to mutable objects." msgstr "" -#: ../../reference/datamodel.rst:1129 +#: ../../reference/datamodel.rst:1211 msgid "The function name" msgstr "函式名稱" -#: ../../reference/datamodel.rst:1132 +#: ../../reference/datamodel.rst:1214 msgid "The fully qualified function name" msgstr "" -#: ../../reference/datamodel.rst:1137 +#: ../../reference/datamodel.rst:1219 msgid "" "The total number of positional :term:`parameters <parameter>` (including " "positional-only parameters and parameters with default values) that the " "function has" msgstr "" -#: ../../reference/datamodel.rst:1142 +#: ../../reference/datamodel.rst:1224 msgid "" "The number of positional-only :term:`parameters <parameter>` (including " "arguments with default values) that the function has" msgstr "" -#: ../../reference/datamodel.rst:1146 +#: ../../reference/datamodel.rst:1228 msgid "" "The number of keyword-only :term:`parameters <parameter>` (including " "arguments with default values) that the function has" msgstr "" -#: ../../reference/datamodel.rst:1150 +#: ../../reference/datamodel.rst:1232 msgid "" "The number of :ref:`local variables <naming>` used by the function " "(including parameters)" msgstr "" -#: ../../reference/datamodel.rst:1154 +#: ../../reference/datamodel.rst:1236 msgid "" "A :class:`tuple` containing the names of the local variables in the function " "(starting with the parameter names)" msgstr "" -#: ../../reference/datamodel.rst:1158 +#: ../../reference/datamodel.rst:1240 msgid "" "A :class:`tuple` containing the names of :ref:`local variables <naming>` " "that are referenced by nested functions inside the function" msgstr "" -#: ../../reference/datamodel.rst:1162 +#: ../../reference/datamodel.rst:1244 msgid "A :class:`tuple` containing the names of free variables in the function" msgstr "" -#: ../../reference/datamodel.rst:1165 +#: ../../reference/datamodel.rst:1247 msgid "" "A string representing the sequence of :term:`bytecode` instructions in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1169 +#: ../../reference/datamodel.rst:1251 msgid "" "A :class:`tuple` containing the literals used by the :term:`bytecode` in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1173 +#: ../../reference/datamodel.rst:1255 msgid "" "A :class:`tuple` containing the names used by the :term:`bytecode` in the " "function" msgstr "" -#: ../../reference/datamodel.rst:1177 +#: ../../reference/datamodel.rst:1259 msgid "The name of the file from which the code was compiled" msgstr "" -#: ../../reference/datamodel.rst:1180 +#: ../../reference/datamodel.rst:1262 msgid "The line number of the first line of the function" msgstr "" -#: ../../reference/datamodel.rst:1183 +#: ../../reference/datamodel.rst:1265 msgid "" "A string encoding the mapping from :term:`bytecode` offsets to line numbers. " "For details, see the source code of the interpreter." msgstr "" -#: ../../reference/datamodel.rst:1186 +#: ../../reference/datamodel.rst:1268 msgid "" "This attribute of code objects is deprecated, and may be removed in Python " "3.14." msgstr "" -#: ../../reference/datamodel.rst:1191 +#: ../../reference/datamodel.rst:1273 msgid "The required stack size of the code object" msgstr "" -#: ../../reference/datamodel.rst:1194 +#: ../../reference/datamodel.rst:1276 msgid "" "An :class:`integer <int>` encoding a number of flags for the interpreter." msgstr "" -#: ../../reference/datamodel.rst:1199 +#: ../../reference/datamodel.rst:1281 msgid "" "The following flag bits are defined for :attr:`~codeobject.co_flags`: bit " "``0x04`` is set if the function uses the ``*arguments`` syntax to accept an " @@ -1334,7 +1459,7 @@ msgid "" "might be present." msgstr "" -#: ../../reference/datamodel.rst:1207 +#: ../../reference/datamodel.rst:1289 msgid "" "Future feature declarations (``from __future__ import division``) also use " "bits in :attr:`~codeobject.co_flags` to indicate whether a code object was " @@ -1343,29 +1468,29 @@ msgid "" "``0x1000`` were used in earlier versions of Python." msgstr "" -#: ../../reference/datamodel.rst:1213 +#: ../../reference/datamodel.rst:1295 msgid "" "Other bits in :attr:`~codeobject.co_flags` are reserved for internal use." msgstr "" -#: ../../reference/datamodel.rst:1217 +#: ../../reference/datamodel.rst:1299 msgid "" "If a code object represents a function, the first item in :attr:`~codeobject." "co_consts` is the documentation string of the function, or ``None`` if " "undefined." msgstr "" -#: ../../reference/datamodel.rst:1222 +#: ../../reference/datamodel.rst:1304 msgid "Methods on code objects" msgstr "用於程式碼物件的方法" -#: ../../reference/datamodel.rst:1226 +#: ../../reference/datamodel.rst:1308 msgid "" "Returns an iterable over the source code positions of each :term:`bytecode` " "instruction in the code object." msgstr "" -#: ../../reference/datamodel.rst:1229 +#: ../../reference/datamodel.rst:1311 msgid "" "The iterator returns :class:`tuple`\\s containing the ``(start_line, " "end_line, start_column, end_column)``. The *i-th* tuple corresponds to the " @@ -1373,37 +1498,37 @@ msgid "" "information is 0-indexed utf-8 byte offsets on the given source line." msgstr "" -#: ../../reference/datamodel.rst:1235 +#: ../../reference/datamodel.rst:1317 msgid "" "This positional information can be missing. A non-exhaustive lists of cases " "where this may happen:" msgstr "" -#: ../../reference/datamodel.rst:1238 +#: ../../reference/datamodel.rst:1320 msgid "Running the interpreter with :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1239 +#: ../../reference/datamodel.rst:1321 msgid "" "Loading a pyc file compiled while using :option:`-X` ``no_debug_ranges``." msgstr "" -#: ../../reference/datamodel.rst:1240 +#: ../../reference/datamodel.rst:1322 msgid "Position tuples corresponding to artificial instructions." msgstr "" -#: ../../reference/datamodel.rst:1241 +#: ../../reference/datamodel.rst:1323 msgid "" "Line and column numbers that can't be represented due to implementation " "specific limitations." msgstr "" -#: ../../reference/datamodel.rst:1244 +#: ../../reference/datamodel.rst:1326 msgid "" "When this occurs, some or all of the tuple elements can be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:1250 +#: ../../reference/datamodel.rst:1332 msgid "" "This feature requires storing column positions in code objects which may " "result in a small increase of disk usage of compiled Python files or " @@ -1413,95 +1538,100 @@ msgid "" "environment variable can be used." msgstr "" -#: ../../reference/datamodel.rst:1259 +#: ../../reference/datamodel.rst:1341 msgid "" "Returns an iterator that yields information about successive ranges of :term:" "`bytecode`\\s. Each item yielded is a ``(start, end, lineno)`` :class:" "`tuple`:" msgstr "" -#: ../../reference/datamodel.rst:1263 +#: ../../reference/datamodel.rst:1345 msgid "" "``start`` (an :class:`int`) represents the offset (inclusive) of the start " "of the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1265 +#: ../../reference/datamodel.rst:1347 msgid "" "``end`` (an :class:`int`) represents the offset (exclusive) of the end of " "the :term:`bytecode` range" msgstr "" -#: ../../reference/datamodel.rst:1267 +#: ../../reference/datamodel.rst:1349 msgid "" "``lineno`` is an :class:`int` representing the line number of the :term:" "`bytecode` range, or ``None`` if the bytecodes in the given range have no " "line number" msgstr "" -#: ../../reference/datamodel.rst:1271 +#: ../../reference/datamodel.rst:1353 msgid "The items yielded will have the following properties:" msgstr "" -#: ../../reference/datamodel.rst:1273 +#: ../../reference/datamodel.rst:1355 msgid "The first range yielded will have a ``start`` of 0." msgstr "" -#: ../../reference/datamodel.rst:1274 +#: ../../reference/datamodel.rst:1356 msgid "" "The ``(start, end)`` ranges will be non-decreasing and consecutive. That is, " "for any pair of :class:`tuple`\\s, the ``start`` of the second will be equal " "to the ``end`` of the first." msgstr "" -#: ../../reference/datamodel.rst:1277 +#: ../../reference/datamodel.rst:1359 msgid "No range will be backwards: ``end >= start`` for all triples." msgstr "" -#: ../../reference/datamodel.rst:1278 +#: ../../reference/datamodel.rst:1360 msgid "" "The last :class:`tuple` yielded will have ``end`` equal to the size of the :" "term:`bytecode`." msgstr "" -#: ../../reference/datamodel.rst:1281 +#: ../../reference/datamodel.rst:1363 msgid "" "Zero-width ranges, where ``start == end``, are allowed. Zero-width ranges " "are used for lines that are present in the source code, but have been " "eliminated by the :term:`bytecode` compiler." msgstr "" -#: ../../reference/datamodel.rst:1289 +#: ../../reference/datamodel.rst:1371 msgid ":pep:`626` - Precise line numbers for debugging and other tools." msgstr "" -#: ../../reference/datamodel.rst:1290 +#: ../../reference/datamodel.rst:1372 msgid "The PEP that introduced the :meth:`!co_lines` method." msgstr "" -#: ../../reference/datamodel.rst:1294 +#: ../../reference/datamodel.rst:1376 msgid "" "Return a copy of the code object with new values for the specified fields." msgstr "" -#: ../../reference/datamodel.rst:1302 +#: ../../reference/datamodel.rst:1378 +msgid "" +"Code objects are also supported by the generic function :func:`copy.replace`." +msgstr "" + +#: ../../reference/datamodel.rst:1386 msgid "Frame objects" msgstr "" -#: ../../reference/datamodel.rst:1306 +#: ../../reference/datamodel.rst:1390 msgid "" "Frame objects represent execution frames. They may occur in :ref:`traceback " "objects <traceback-objects>`, and are also passed to registered trace " "functions." msgstr "" -#: ../../reference/datamodel.rst:1324 +#: ../../reference/datamodel.rst:1408 msgid "" "Points to the previous stack frame (towards the caller), or ``None`` if this " "is the bottom stack frame" msgstr "" -#: ../../reference/datamodel.rst:1328 +#: ../../reference/datamodel.rst:1412 msgid "" "The :ref:`code object <code-objects>` being executed in this frame. " "Accessing this attribute raises an :ref:`auditing event <auditing>` ``object." @@ -1511,49 +1641,55 @@ msgstr "" "這個屬性會引發一個附帶引數 ``obj`` 與 ``\"f_code\"`` 的\\ :ref:`稽核事件 " "<auditing>` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1333 +#: ../../reference/datamodel.rst:1417 msgid "" -"The dictionary used by the frame to look up :ref:`local variables <naming>`" +"The mapping used by the frame to look up :ref:`local variables <naming>`. If " +"the frame refers to an :term:`optimized scope`, this may return a write-" +"through proxy object." +msgstr "" + +#: ../../reference/datamodel.rst:1422 +msgid "Return a proxy for optimized scopes." msgstr "" -#: ../../reference/datamodel.rst:1337 +#: ../../reference/datamodel.rst:1426 msgid "" "The dictionary used by the frame to look up :ref:`global variables <naming>`" msgstr "" -#: ../../reference/datamodel.rst:1341 +#: ../../reference/datamodel.rst:1430 msgid "" "The dictionary used by the frame to look up :ref:`built-in (intrinsic) names " "<naming>`" msgstr "" -#: ../../reference/datamodel.rst:1345 +#: ../../reference/datamodel.rst:1434 msgid "" "The \"precise instruction\" of the frame object (this is an index into the :" "term:`bytecode` string of the :ref:`code object <code-objects>`)" msgstr "" -#: ../../reference/datamodel.rst:1361 +#: ../../reference/datamodel.rst:1450 msgid "" "If not ``None``, this is a function called for various events during code " "execution (this is used by debuggers). Normally an event is triggered for " "each new source line (see :attr:`~frame.f_trace_lines`)." msgstr "" -#: ../../reference/datamodel.rst:1366 +#: ../../reference/datamodel.rst:1455 msgid "" "Set this attribute to :const:`False` to disable triggering a tracing event " "for each source line." msgstr "" -#: ../../reference/datamodel.rst:1370 +#: ../../reference/datamodel.rst:1459 msgid "" "Set this attribute to :const:`True` to allow per-opcode events to be " "requested. Note that this may lead to undefined interpreter behaviour if " "exceptions raised by the trace function escape to the function being traced." msgstr "" -#: ../../reference/datamodel.rst:1376 +#: ../../reference/datamodel.rst:1465 msgid "" "The current line number of the frame -- writing to this from within a trace " "function jumps to the given line (only for the bottom-most frame). A " @@ -1561,15 +1697,15 @@ msgid "" "this attribute." msgstr "" -#: ../../reference/datamodel.rst:1382 +#: ../../reference/datamodel.rst:1471 msgid "Frame object methods" msgstr "" -#: ../../reference/datamodel.rst:1384 +#: ../../reference/datamodel.rst:1473 msgid "Frame objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1388 +#: ../../reference/datamodel.rst:1477 msgid "" "This method clears all references to :ref:`local variables <naming>` held by " "the frame. Also, if the frame belonged to a :term:`generator`, the " @@ -1578,26 +1714,34 @@ msgid "" "and storing its :ref:`traceback <traceback-objects>` for later use)." msgstr "" -#: ../../reference/datamodel.rst:1394 -msgid ":exc:`RuntimeError` is raised if the frame is currently executing." +#: ../../reference/datamodel.rst:1483 +msgid "" +":exc:`RuntimeError` is raised if the frame is currently executing or " +"suspended." +msgstr "" + +#: ../../reference/datamodel.rst:1488 +msgid "" +"Attempting to clear a suspended frame raises :exc:`RuntimeError` (as has " +"always been the case for executing frames)." msgstr "" -#: ../../reference/datamodel.rst:1402 +#: ../../reference/datamodel.rst:1496 msgid "Traceback objects" msgstr "" -#: ../../reference/datamodel.rst:1415 +#: ../../reference/datamodel.rst:1509 msgid "" "Traceback objects represent the stack trace of an :ref:`exception <tut-" "errors>`. A traceback object is implicitly created when an exception occurs, " "and may also be explicitly created by calling :class:`types.TracebackType`." msgstr "" -#: ../../reference/datamodel.rst:1420 +#: ../../reference/datamodel.rst:1514 msgid "Traceback objects can now be explicitly instantiated from Python code." msgstr "" -#: ../../reference/datamodel.rst:1423 +#: ../../reference/datamodel.rst:1517 msgid "" "For implicitly created tracebacks, when the search for an exception handler " "unwinds the execution stack, at each unwound level a traceback object is " @@ -1608,7 +1752,7 @@ msgid "" "the caught exception." msgstr "" -#: ../../reference/datamodel.rst:1432 +#: ../../reference/datamodel.rst:1526 msgid "" "When the program contains no suitable handler, the stack trace is written " "(nicely formatted) to the standard error stream; if the interpreter is " @@ -1616,19 +1760,19 @@ msgid "" "last_traceback`." msgstr "" -#: ../../reference/datamodel.rst:1437 +#: ../../reference/datamodel.rst:1531 msgid "" "For explicitly created tracebacks, it is up to the creator of the traceback " "to determine how the :attr:`~traceback.tb_next` attributes should be linked " "to form a full stack trace." msgstr "" -#: ../../reference/datamodel.rst:1452 +#: ../../reference/datamodel.rst:1546 msgid "" "Points to the execution :ref:`frame <frame-objects>` of the current level." msgstr "" -#: ../../reference/datamodel.rst:1455 +#: ../../reference/datamodel.rst:1549 msgid "" "Accessing this attribute raises an :ref:`auditing event <auditing>` ``object." "__getattr__`` with arguments ``obj`` and ``\"tb_frame\"``." @@ -1636,15 +1780,15 @@ msgstr "" "存取此屬性會引發一個附帶引數 ``obj`` 與 ``\"tb_frame\"`` 的\\ :ref:`稽核事件 " "<auditing>` ``object.__getattr__``。" -#: ../../reference/datamodel.rst:1460 +#: ../../reference/datamodel.rst:1554 msgid "Gives the line number where the exception occurred" msgstr "" -#: ../../reference/datamodel.rst:1463 +#: ../../reference/datamodel.rst:1557 msgid "Indicates the \"precise instruction\"." msgstr "" -#: ../../reference/datamodel.rst:1465 +#: ../../reference/datamodel.rst:1559 msgid "" "The line number and last instruction in the traceback may differ from the " "line number of its :ref:`frame object <frame-objects>` if the exception " @@ -1652,39 +1796,39 @@ msgid "" "with a :keyword:`finally` clause." msgstr "" -#: ../../reference/datamodel.rst:1476 +#: ../../reference/datamodel.rst:1570 msgid "" "The special writable attribute :attr:`!tb_next` is the next level in the " "stack trace (towards the frame where the exception occurred), or ``None`` if " "there is no next level." msgstr "" -#: ../../reference/datamodel.rst:1480 +#: ../../reference/datamodel.rst:1574 msgid "This attribute is now writable" msgstr "" -#: ../../reference/datamodel.rst:1485 +#: ../../reference/datamodel.rst:1579 msgid "Slice objects" msgstr "" -#: ../../reference/datamodel.rst:1489 +#: ../../reference/datamodel.rst:1583 msgid "" "Slice objects are used to represent slices for :meth:`~object.__getitem__` " "methods. They are also created by the built-in :func:`slice` function." msgstr "" -#: ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1592 msgid "" "Special read-only attributes: :attr:`~slice.start` is the lower bound; :attr:" "`~slice.stop` is the upper bound; :attr:`~slice.step` is the step value; " "each is ``None`` if omitted. These attributes can have any type." msgstr "" -#: ../../reference/datamodel.rst:1502 +#: ../../reference/datamodel.rst:1596 msgid "Slice objects support one method:" msgstr "" -#: ../../reference/datamodel.rst:1506 +#: ../../reference/datamodel.rst:1600 msgid "" "This method takes a single integer argument *length* and computes " "information about the slice that the slice object would describe if applied " @@ -1694,11 +1838,11 @@ msgid "" "a manner consistent with regular slices." msgstr "" -#: ../../reference/datamodel.rst:1515 +#: ../../reference/datamodel.rst:1609 msgid "Static method objects" msgstr "" -#: ../../reference/datamodel.rst:1517 +#: ../../reference/datamodel.rst:1611 msgid "" "Static method objects provide a way of defeating the transformation of " "function objects to method objects described above. A static method object " @@ -1709,11 +1853,11 @@ msgid "" "method objects are created by the built-in :func:`staticmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1527 +#: ../../reference/datamodel.rst:1621 msgid "Class method objects" msgstr "" -#: ../../reference/datamodel.rst:1529 +#: ../../reference/datamodel.rst:1623 msgid "" "A class method object, like a static method object, is a wrapper around " "another object that alters the way in which that object is retrieved from " @@ -1723,11 +1867,11 @@ msgid "" "`classmethod` constructor." msgstr "" -#: ../../reference/datamodel.rst:1539 +#: ../../reference/datamodel.rst:1633 msgid "Special method names" msgstr "" -#: ../../reference/datamodel.rst:1545 +#: ../../reference/datamodel.rst:1639 msgid "" "A class can implement certain operations that are invoked by special syntax " "(such as arithmetic operations or subscripting and slicing) by defining " @@ -1741,7 +1885,7 @@ msgid "" "`TypeError`)." msgstr "" -#: ../../reference/datamodel.rst:1556 +#: ../../reference/datamodel.rst:1650 msgid "" "Setting a special method to ``None`` indicates that the corresponding " "operation is not available. For example, if a class sets :meth:`~object." @@ -1750,7 +1894,7 @@ msgid "" "`~object.__getitem__`). [#]_" msgstr "" -#: ../../reference/datamodel.rst:1562 +#: ../../reference/datamodel.rst:1656 msgid "" "When implementing a class that emulates any built-in type, it is important " "that the emulation only be implemented to the degree that it makes sense for " @@ -1760,11 +1904,11 @@ msgid "" "the W3C's Document Object Model.)" msgstr "" -#: ../../reference/datamodel.rst:1573 +#: ../../reference/datamodel.rst:1667 msgid "Basic customization" msgstr "" -#: ../../reference/datamodel.rst:1579 +#: ../../reference/datamodel.rst:1673 msgid "" "Called to create a new instance of class *cls*. :meth:`__new__` is a static " "method (special-cased so you need not declare it as such) that takes the " @@ -1774,7 +1918,7 @@ msgid "" "new object instance (usually an instance of *cls*)." msgstr "" -#: ../../reference/datamodel.rst:1586 +#: ../../reference/datamodel.rst:1680 msgid "" "Typical implementations create a new instance of the class by invoking the " "superclass's :meth:`__new__` method using ``super().__new__(cls[, ...])`` " @@ -1782,7 +1926,7 @@ msgid "" "necessary before returning it." msgstr "" -#: ../../reference/datamodel.rst:1591 +#: ../../reference/datamodel.rst:1685 msgid "" "If :meth:`__new__` is invoked during object construction and it returns an " "instance of *cls*, then the new instance’s :meth:`__init__` method will be " @@ -1791,13 +1935,13 @@ msgid "" "constructor." msgstr "" -#: ../../reference/datamodel.rst:1596 +#: ../../reference/datamodel.rst:1690 msgid "" "If :meth:`__new__` does not return an instance of *cls*, then the new " "instance's :meth:`__init__` method will not be invoked." msgstr "" -#: ../../reference/datamodel.rst:1599 +#: ../../reference/datamodel.rst:1693 msgid "" ":meth:`__new__` is intended mainly to allow subclasses of immutable types " "(like int, str, or tuple) to customize instance creation. It is also " @@ -1805,7 +1949,7 @@ msgid "" "creation." msgstr "" -#: ../../reference/datamodel.rst:1608 +#: ../../reference/datamodel.rst:1702 msgid "" "Called after the instance has been created (by :meth:`__new__`), but before " "it is returned to the caller. The arguments are those passed to the class " @@ -1815,7 +1959,7 @@ msgid "" "example: ``super().__init__([args...])``." msgstr "" -#: ../../reference/datamodel.rst:1615 +#: ../../reference/datamodel.rst:1709 msgid "" "Because :meth:`__new__` and :meth:`__init__` work together in constructing " "objects (:meth:`__new__` to create it, and :meth:`__init__` to customize " @@ -1823,7 +1967,7 @@ msgid "" "will cause a :exc:`TypeError` to be raised at runtime." msgstr "" -#: ../../reference/datamodel.rst:1628 +#: ../../reference/datamodel.rst:1722 msgid "" "Called when the instance is about to be destroyed. This is also called a " "finalizer or (improperly) a destructor. If a base class has a :meth:" @@ -1832,7 +1976,7 @@ msgid "" "instance." msgstr "" -#: ../../reference/datamodel.rst:1634 +#: ../../reference/datamodel.rst:1728 msgid "" "It is possible (though not recommended!) for the :meth:`__del__` method to " "postpone destruction of the instance by creating a new reference to it. " @@ -1842,7 +1986,7 @@ msgid "" "it once." msgstr "" -#: ../../reference/datamodel.rst:1641 +#: ../../reference/datamodel.rst:1735 msgid "" "It is not guaranteed that :meth:`__del__` methods are called for objects " "that still exist when the interpreter exits. :class:`weakref.finalize` " @@ -1850,14 +1994,14 @@ msgid "" "when an object is garbage collected." msgstr "" -#: ../../reference/datamodel.rst:1648 +#: ../../reference/datamodel.rst:1742 msgid "" "``del x`` doesn't directly call ``x.__del__()`` --- the former decrements " "the reference count for ``x`` by one, and the latter is only called when " "``x``'s reference count reaches zero." msgstr "" -#: ../../reference/datamodel.rst:1653 +#: ../../reference/datamodel.rst:1747 msgid "" "It is possible for a reference cycle to prevent the reference count of an " "object from going to zero. In this case, the cycle will be later detected " @@ -1868,18 +2012,18 @@ msgid "" "caught in the traceback." msgstr "" -#: ../../reference/datamodel.rst:1663 +#: ../../reference/datamodel.rst:1757 msgid "Documentation for the :mod:`gc` module." msgstr "" -#: ../../reference/datamodel.rst:1667 +#: ../../reference/datamodel.rst:1761 msgid "" "Due to the precarious circumstances under which :meth:`__del__` methods are " "invoked, exceptions that occur during their execution are ignored, and a " "warning is printed to ``sys.stderr`` instead. In particular:" msgstr "" -#: ../../reference/datamodel.rst:1671 +#: ../../reference/datamodel.rst:1765 msgid "" ":meth:`__del__` can be invoked when arbitrary code is being executed, " "including from any arbitrary thread. If :meth:`__del__` needs to take a " @@ -1888,7 +2032,7 @@ msgid "" "`__del__`." msgstr "" -#: ../../reference/datamodel.rst:1677 +#: ../../reference/datamodel.rst:1771 msgid "" ":meth:`__del__` can be executed during interpreter shutdown. As a " "consequence, the global variables it needs to access (including other " @@ -1899,7 +2043,7 @@ msgid "" "still available at the time when the :meth:`__del__` method is called." msgstr "" -#: ../../reference/datamodel.rst:1692 +#: ../../reference/datamodel.rst:1786 msgid "" "Called by the :func:`repr` built-in function to compute the \"official\" " "string representation of an object. If at all possible, this should look " @@ -1911,13 +2055,13 @@ msgid "" "an \"informal\" string representation of instances of that class is required." msgstr "" -#: ../../reference/datamodel.rst:1701 +#: ../../reference/datamodel.rst:1795 msgid "" "This is typically used for debugging, so it is important that the " "representation is information-rich and unambiguous." msgstr "" -#: ../../reference/datamodel.rst:1712 +#: ../../reference/datamodel.rst:1806 msgid "" "Called by :func:`str(object) <str>` and the built-in functions :func:" "`format` and :func:`print` to compute the \"informal\" or nicely printable " @@ -1925,26 +2069,26 @@ msgid "" "<textseq>` object." msgstr "" -#: ../../reference/datamodel.rst:1717 +#: ../../reference/datamodel.rst:1811 msgid "" "This method differs from :meth:`object.__repr__` in that there is no " "expectation that :meth:`__str__` return a valid Python expression: a more " "convenient or concise representation can be used." msgstr "" -#: ../../reference/datamodel.rst:1721 +#: ../../reference/datamodel.rst:1815 msgid "" "The default implementation defined by the built-in type :class:`object` " "calls :meth:`object.__repr__`." msgstr "" -#: ../../reference/datamodel.rst:1731 +#: ../../reference/datamodel.rst:1825 msgid "" "Called by :ref:`bytes <func-bytes>` to compute a byte-string representation " "of an object. This should return a :class:`bytes` object." msgstr "" -#: ../../reference/datamodel.rst:1742 +#: ../../reference/datamodel.rst:1836 msgid "" "Called by the :func:`format` built-in function, and by extension, evaluation " "of :ref:`formatted string literals <f-strings>` and the :meth:`str.format` " @@ -1956,28 +2100,28 @@ msgid "" "formatting option syntax." msgstr "" -#: ../../reference/datamodel.rst:1752 +#: ../../reference/datamodel.rst:1846 msgid "" "See :ref:`formatspec` for a description of the standard formatting syntax." msgstr "" -#: ../../reference/datamodel.rst:1754 +#: ../../reference/datamodel.rst:1848 msgid "The return value must be a string object." msgstr "" -#: ../../reference/datamodel.rst:1756 +#: ../../reference/datamodel.rst:1850 msgid "" "The __format__ method of ``object`` itself raises a :exc:`TypeError` if " "passed any non-empty string." msgstr "" -#: ../../reference/datamodel.rst:1760 +#: ../../reference/datamodel.rst:1854 msgid "" "``object.__format__(x, '')`` is now equivalent to ``str(x)`` rather than " "``format(str(x), '')``." msgstr "" -#: ../../reference/datamodel.rst:1776 +#: ../../reference/datamodel.rst:1870 msgid "" "These are the so-called \"rich comparison\" methods. The correspondence " "between operator symbols and method names is as follows: ``x<y`` calls ``x." @@ -1986,7 +2130,7 @@ msgid "" "calls ``x.__ge__(y)``." msgstr "" -#: ../../reference/datamodel.rst:1782 +#: ../../reference/datamodel.rst:1876 msgid "" "A rich comparison method may return the singleton :data:`NotImplemented` if " "it does not implement the operation for a given pair of arguments. By " @@ -1997,7 +2141,7 @@ msgid "" "result is true or false." msgstr "" -#: ../../reference/datamodel.rst:1789 +#: ../../reference/datamodel.rst:1883 msgid "" "By default, ``object`` implements :meth:`__eq__` by using ``is``, returning :" "data:`NotImplemented` in the case of a false comparison: ``True if x is y " @@ -2009,14 +2153,14 @@ msgid "" "operation, see :func:`functools.total_ordering`." msgstr "" -#: ../../reference/datamodel.rst:1798 +#: ../../reference/datamodel.rst:1892 msgid "" "See the paragraph on :meth:`__hash__` for some important notes on creating :" "term:`hashable` objects which support custom comparison operations and are " "usable as dictionary keys." msgstr "" -#: ../../reference/datamodel.rst:1802 +#: ../../reference/datamodel.rst:1896 msgid "" "There are no swapped-argument versions of these methods (to be used when the " "left argument does not support the operation but the right argument does); " @@ -2029,14 +2173,14 @@ msgid "" "Virtual subclassing is not considered." msgstr "" -#: ../../reference/datamodel.rst:1813 +#: ../../reference/datamodel.rst:1907 msgid "" "When no appropriate method returns any value other than :data:" "`NotImplemented`, the ``==`` and ``!=`` operators will fall back to ``is`` " "and ``is not``, respectively." msgstr "" -#: ../../reference/datamodel.rst:1822 +#: ../../reference/datamodel.rst:1916 msgid "" "Called by built-in function :func:`hash` and for operations on members of " "hashed collections including :class:`set`, :class:`frozenset`, and :class:" @@ -2047,7 +2191,7 @@ msgid "" "into a tuple and hashing the tuple. Example::" msgstr "" -#: ../../reference/datamodel.rst:1830 +#: ../../reference/datamodel.rst:1924 msgid "" "def __hash__(self):\n" " return hash((self.name, self.nick, self.color))" @@ -2055,7 +2199,7 @@ msgstr "" "def __hash__(self):\n" " return hash((self.name, self.nick, self.color))" -#: ../../reference/datamodel.rst:1835 +#: ../../reference/datamodel.rst:1929 msgid "" ":func:`hash` truncates the value returned from an object's custom :meth:" "`__hash__` method to the size of a :c:type:`Py_ssize_t`. This is typically " @@ -2065,7 +2209,7 @@ msgid "" "``python -c \"import sys; print(sys.hash_info.width)\"``." msgstr "" -#: ../../reference/datamodel.rst:1843 +#: ../../reference/datamodel.rst:1937 msgid "" "If a class does not define an :meth:`__eq__` method it should not define a :" "meth:`__hash__` operation either; if it defines :meth:`__eq__` but not :meth:" @@ -2077,7 +2221,7 @@ msgid "" "wrong hash bucket)." msgstr "" -#: ../../reference/datamodel.rst:1852 +#: ../../reference/datamodel.rst:1946 msgid "" "User-defined classes have :meth:`__eq__` and :meth:`__hash__` methods by " "default; with them, all objects compare unequal (except with themselves) and " @@ -2085,7 +2229,7 @@ msgid "" "both that ``x is y`` and ``hash(x) == hash(y)``." msgstr "" -#: ../../reference/datamodel.rst:1857 +#: ../../reference/datamodel.rst:1951 msgid "" "A class that overrides :meth:`__eq__` and does not define :meth:`__hash__` " "will have its :meth:`__hash__` implicitly set to ``None``. When the :meth:" @@ -2095,14 +2239,14 @@ msgid "" "checking ``isinstance(obj, collections.abc.Hashable)``." msgstr "" -#: ../../reference/datamodel.rst:1864 +#: ../../reference/datamodel.rst:1958 msgid "" "If a class that overrides :meth:`__eq__` needs to retain the implementation " "of :meth:`__hash__` from a parent class, the interpreter must be told this " "explicitly by setting ``__hash__ = <ParentClass>.__hash__``." msgstr "" -#: ../../reference/datamodel.rst:1868 +#: ../../reference/datamodel.rst:1962 msgid "" "If a class that does not override :meth:`__eq__` wishes to suppress hash " "support, it should include ``__hash__ = None`` in the class definition. A " @@ -2111,7 +2255,7 @@ msgid "" "``isinstance(obj, collections.abc.Hashable)`` call." msgstr "" -#: ../../reference/datamodel.rst:1877 +#: ../../reference/datamodel.rst:1971 msgid "" "By default, the :meth:`__hash__` values of str and bytes objects are " "\"salted\" with an unpredictable random value. Although they remain " @@ -2119,7 +2263,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../reference/datamodel.rst:1882 +#: ../../reference/datamodel.rst:1976 msgid "" "This is intended to provide protection against a denial-of-service caused by " "carefully chosen inputs that exploit the worst case performance of a dict " @@ -2127,22 +2271,22 @@ msgid "" "advisories/ocert-2011-003.html for details." msgstr "" -#: ../../reference/datamodel.rst:1887 +#: ../../reference/datamodel.rst:1981 msgid "" "Changing hash values affects the iteration order of sets. Python has never " "made guarantees about this ordering (and it typically varies between 32-bit " "and 64-bit builds)." msgstr "" -#: ../../reference/datamodel.rst:1891 +#: ../../reference/datamodel.rst:1985 msgid "See also :envvar:`PYTHONHASHSEED`." msgstr "另請參閱 :envvar:`PYTHONHASHSEED`。" -#: ../../reference/datamodel.rst:1893 +#: ../../reference/datamodel.rst:1987 msgid "Hash randomization is enabled by default." msgstr "" -#: ../../reference/datamodel.rst:1901 +#: ../../reference/datamodel.rst:1995 msgid "" "Called to implement truth value testing and the built-in operation " "``bool()``; should return ``False`` or ``True``. When this method is not " @@ -2151,18 +2295,18 @@ msgid "" "meth:`!__len__` nor :meth:`!__bool__`, all its instances are considered true." msgstr "" -#: ../../reference/datamodel.rst:1912 +#: ../../reference/datamodel.rst:2006 msgid "Customizing attribute access" msgstr "" -#: ../../reference/datamodel.rst:1914 +#: ../../reference/datamodel.rst:2008 msgid "" "The following methods can be defined to customize the meaning of attribute " "access (use of, assignment to, or deletion of ``x.name``) for class " "instances." msgstr "" -#: ../../reference/datamodel.rst:1922 +#: ../../reference/datamodel.rst:2016 msgid "" "Called when the default attribute access fails with an :exc:`AttributeError` " "(either :meth:`__getattribute__` raises an :exc:`AttributeError` because " @@ -2172,20 +2316,20 @@ msgid "" "attribute value or raise an :exc:`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:1929 +#: ../../reference/datamodel.rst:2023 msgid "" "Note that if the attribute is found through the normal mechanism, :meth:" "`__getattr__` is not called. (This is an intentional asymmetry between :" "meth:`__getattr__` and :meth:`__setattr__`.) This is done both for " "efficiency reasons and because otherwise :meth:`__getattr__` would have no " "way to access other attributes of the instance. Note that at least for " -"instance variables, you can fake total control by not inserting any values " +"instance variables, you can take total control by not inserting any values " "in the instance attribute dictionary (but instead inserting them in another " "object). See the :meth:`__getattribute__` method below for a way to " "actually get total control over attribute access." msgstr "" -#: ../../reference/datamodel.rst:1942 +#: ../../reference/datamodel.rst:2036 msgid "" "Called unconditionally to implement attribute accesses for instances of the " "class. If the class also defines :meth:`__getattr__`, the latter will not be " @@ -2197,64 +2341,64 @@ msgid "" "example, ``object.__getattribute__(self, name)``." msgstr "" -#: ../../reference/datamodel.rst:1953 +#: ../../reference/datamodel.rst:2047 msgid "" "This method may still be bypassed when looking up special methods as the " "result of implicit invocation via language syntax or :ref:`built-in " "functions <builtin-functions>`. See :ref:`special-lookup`." msgstr "" -#: ../../reference/datamodel.rst:1958 ../../reference/datamodel.rst:1960 +#: ../../reference/datamodel.rst:2052 ../../reference/datamodel.rst:2054 msgid "" "For certain sensitive attribute accesses, raises an :ref:`auditing event " "<auditing>` ``object.__getattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:1967 +#: ../../reference/datamodel.rst:2061 msgid "" "Called when an attribute assignment is attempted. This is called instead of " "the normal mechanism (i.e. store the value in the instance dictionary). " "*name* is the attribute name, *value* is the value to be assigned to it." msgstr "" -#: ../../reference/datamodel.rst:1971 +#: ../../reference/datamodel.rst:2065 msgid "" "If :meth:`__setattr__` wants to assign to an instance attribute, it should " "call the base class method with the same name, for example, ``object." "__setattr__(self, name, value)``." msgstr "" -#: ../../reference/datamodel.rst:1975 ../../reference/datamodel.rst:1977 +#: ../../reference/datamodel.rst:2069 ../../reference/datamodel.rst:2071 msgid "" "For certain sensitive attribute assignments, raises an :ref:`auditing event " "<auditing>` ``object.__setattr__`` with arguments ``obj``, ``name``, " "``value``." msgstr "" -#: ../../reference/datamodel.rst:1984 +#: ../../reference/datamodel.rst:2078 msgid "" "Like :meth:`__setattr__` but for attribute deletion instead of assignment. " "This should only be implemented if ``del obj.name`` is meaningful for the " "object." msgstr "" -#: ../../reference/datamodel.rst:1987 ../../reference/datamodel.rst:1989 +#: ../../reference/datamodel.rst:2081 ../../reference/datamodel.rst:2083 msgid "" "For certain sensitive attribute deletions, raises an :ref:`auditing event " "<auditing>` ``object.__delattr__`` with arguments ``obj`` and ``name``." msgstr "" -#: ../../reference/datamodel.rst:1996 +#: ../../reference/datamodel.rst:2090 msgid "" "Called when :func:`dir` is called on the object. An iterable must be " "returned. :func:`dir` converts the returned iterable to a list and sorts it." msgstr "" -#: ../../reference/datamodel.rst:2001 +#: ../../reference/datamodel.rst:2095 msgid "Customizing module attribute access" msgstr "" -#: ../../reference/datamodel.rst:2008 +#: ../../reference/datamodel.rst:2102 msgid "" "Special names ``__getattr__`` and ``__dir__`` can be also used to customize " "access to module attributes. The ``__getattr__`` function at the module " @@ -2266,21 +2410,21 @@ msgid "" "with the attribute name and the result is returned." msgstr "" -#: ../../reference/datamodel.rst:2017 +#: ../../reference/datamodel.rst:2111 msgid "" "The ``__dir__`` function should accept no arguments, and return an iterable " "of strings that represents the names accessible on module. If present, this " "function overrides the standard :func:`dir` search on a module." msgstr "" -#: ../../reference/datamodel.rst:2021 +#: ../../reference/datamodel.rst:2115 msgid "" "For a more fine grained customization of the module behavior (setting " "attributes, properties, etc.), one can set the ``__class__`` attribute of a " "module object to a subclass of :class:`types.ModuleType`. For example::" msgstr "" -#: ../../reference/datamodel.rst:2025 +#: ../../reference/datamodel.rst:2119 msgid "" "import sys\n" "from types import ModuleType\n" @@ -2308,7 +2452,7 @@ msgstr "" "\n" "sys.modules[__name__].__class__ = VerboseModule" -#: ../../reference/datamodel.rst:2039 +#: ../../reference/datamodel.rst:2133 msgid "" "Defining module ``__getattr__`` and setting module ``__class__`` only affect " "lookups made using the attribute access syntax -- directly accessing the " @@ -2316,27 +2460,27 @@ msgid "" "module's globals dictionary) is unaffected." msgstr "" -#: ../../reference/datamodel.rst:2044 +#: ../../reference/datamodel.rst:2138 msgid "``__class__`` module attribute is now writable." msgstr "" -#: ../../reference/datamodel.rst:2047 +#: ../../reference/datamodel.rst:2141 msgid "``__getattr__`` and ``__dir__`` module attributes." msgstr "" -#: ../../reference/datamodel.rst:2052 +#: ../../reference/datamodel.rst:2146 msgid ":pep:`562` - Module __getattr__ and __dir__" msgstr ":pep:`562` - 模組 __getattr__ 和 __dir__" -#: ../../reference/datamodel.rst:2053 +#: ../../reference/datamodel.rst:2147 msgid "Describes the ``__getattr__`` and ``__dir__`` functions on modules." msgstr "" -#: ../../reference/datamodel.rst:2059 +#: ../../reference/datamodel.rst:2153 msgid "Implementing Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2061 +#: ../../reference/datamodel.rst:2155 msgid "" "The following methods only apply when an instance of the class containing " "the method (a so-called *descriptor* class) appears in an *owner* class (the " @@ -2346,7 +2490,7 @@ msgid "" "the owner class' :attr:`~object.__dict__`." msgstr "" -#: ../../reference/datamodel.rst:2071 +#: ../../reference/datamodel.rst:2165 msgid "" "Called to get the attribute of the owner class (class attribute access) or " "of an instance of that class (instance attribute access). The optional " @@ -2355,13 +2499,13 @@ msgid "" "accessed through the *owner*." msgstr "" -#: ../../reference/datamodel.rst:2077 +#: ../../reference/datamodel.rst:2171 msgid "" "This method should return the computed attribute value or raise an :exc:" "`AttributeError` exception." msgstr "" -#: ../../reference/datamodel.rst:2080 +#: ../../reference/datamodel.rst:2174 msgid "" ":PEP:`252` specifies that :meth:`__get__` is callable with one or two " "arguments. Python's own built-in descriptors support this specification; " @@ -2371,31 +2515,31 @@ msgid "" "not." msgstr "" -#: ../../reference/datamodel.rst:2089 +#: ../../reference/datamodel.rst:2183 msgid "" "Called to set the attribute on an instance *instance* of the owner class to " "a new value, *value*." msgstr "" -#: ../../reference/datamodel.rst:2092 +#: ../../reference/datamodel.rst:2186 msgid "" "Note, adding :meth:`__set__` or :meth:`__delete__` changes the kind of " "descriptor to a \"data descriptor\". See :ref:`descriptor-invocation` for " "more details." msgstr "" -#: ../../reference/datamodel.rst:2098 +#: ../../reference/datamodel.rst:2192 msgid "" "Called to delete the attribute on an instance *instance* of the owner class." msgstr "" -#: ../../reference/datamodel.rst:2100 +#: ../../reference/datamodel.rst:2194 msgid "" "Instances of descriptors may also have the :attr:`!__objclass__` attribute " "present:" msgstr "" -#: ../../reference/datamodel.rst:2105 +#: ../../reference/datamodel.rst:2199 msgid "" "The attribute :attr:`!__objclass__` is interpreted by the :mod:`inspect` " "module as specifying the class where this object was defined (setting this " @@ -2406,11 +2550,11 @@ msgid "" "are implemented in C)." msgstr "" -#: ../../reference/datamodel.rst:2116 +#: ../../reference/datamodel.rst:2210 msgid "Invoking Descriptors" msgstr "" -#: ../../reference/datamodel.rst:2118 +#: ../../reference/datamodel.rst:2212 msgid "" "In general, a descriptor is an object attribute with \"binding behavior\", " "one whose attribute access has been overridden by methods in the descriptor " @@ -2419,7 +2563,7 @@ msgid "" "is said to be a descriptor." msgstr "" -#: ../../reference/datamodel.rst:2124 +#: ../../reference/datamodel.rst:2218 msgid "" "The default behavior for attribute access is to get, set, or delete the " "attribute from an object's dictionary. For instance, ``a.x`` has a lookup " @@ -2427,7 +2571,7 @@ msgid "" "continuing through the base classes of ``type(a)`` excluding metaclasses." msgstr "" -#: ../../reference/datamodel.rst:2129 +#: ../../reference/datamodel.rst:2223 msgid "" "However, if the looked-up value is an object defining one of the descriptor " "methods, then Python may override the default behavior and invoke the " @@ -2435,54 +2579,54 @@ msgid "" "depends on which descriptor methods were defined and how they were called." msgstr "" -#: ../../reference/datamodel.rst:2134 +#: ../../reference/datamodel.rst:2228 msgid "" "The starting point for descriptor invocation is a binding, ``a.x``. How the " "arguments are assembled depends on ``a``:" msgstr "" -#: ../../reference/datamodel.rst:2137 +#: ../../reference/datamodel.rst:2231 msgid "Direct Call" msgstr "" -#: ../../reference/datamodel.rst:2138 +#: ../../reference/datamodel.rst:2232 msgid "" "The simplest and least common call is when user code directly invokes a " "descriptor method: ``x.__get__(a)``." msgstr "" -#: ../../reference/datamodel.rst:2141 +#: ../../reference/datamodel.rst:2235 msgid "Instance Binding" msgstr "" -#: ../../reference/datamodel.rst:2142 +#: ../../reference/datamodel.rst:2236 msgid "" "If binding to an object instance, ``a.x`` is transformed into the call: " "``type(a).__dict__['x'].__get__(a, type(a))``." msgstr "" -#: ../../reference/datamodel.rst:2145 +#: ../../reference/datamodel.rst:2239 msgid "Class Binding" msgstr "" -#: ../../reference/datamodel.rst:2146 +#: ../../reference/datamodel.rst:2240 msgid "" "If binding to a class, ``A.x`` is transformed into the call: ``A." "__dict__['x'].__get__(None, A)``." msgstr "" -#: ../../reference/datamodel.rst:2149 +#: ../../reference/datamodel.rst:2243 msgid "Super Binding" msgstr "" -#: ../../reference/datamodel.rst:2150 +#: ../../reference/datamodel.rst:2244 msgid "" "A dotted lookup such as ``super(A, a).x`` searches ``a.__class__.__mro__`` " "for a base class ``B`` following ``A`` and then returns ``B.__dict__['x']." "__get__(a, A)``. If not a descriptor, ``x`` is returned unchanged." msgstr "" -#: ../../reference/datamodel.rst:2187 +#: ../../reference/datamodel.rst:2281 msgid "" "For instance bindings, the precedence of descriptor invocation depends on " "which descriptor methods are defined. A descriptor can define any " @@ -2500,7 +2644,7 @@ msgid "" "instances." msgstr "" -#: ../../reference/datamodel.rst:2202 +#: ../../reference/datamodel.rst:2296 msgid "" "Python methods (including those decorated with :func:`@staticmethod " "<staticmethod>` and :func:`@classmethod <classmethod>`) are implemented as " @@ -2509,30 +2653,30 @@ msgid "" "from other instances of the same class." msgstr "" -#: ../../reference/datamodel.rst:2208 +#: ../../reference/datamodel.rst:2302 msgid "" "The :func:`property` function is implemented as a data descriptor. " "Accordingly, instances cannot override the behavior of a property." msgstr "" -#: ../../reference/datamodel.rst:2215 +#: ../../reference/datamodel.rst:2309 msgid "__slots__" msgstr "__slots__" -#: ../../reference/datamodel.rst:2217 +#: ../../reference/datamodel.rst:2311 msgid "" "*__slots__* allow us to explicitly declare data members (like properties) " "and deny the creation of :attr:`~object.__dict__` and *__weakref__* (unless " "explicitly declared in *__slots__* or available in a parent.)" msgstr "" -#: ../../reference/datamodel.rst:2221 +#: ../../reference/datamodel.rst:2315 msgid "" "The space saved over using :attr:`~object.__dict__` can be significant. " "Attribute lookup speed can be significantly improved as well." msgstr "" -#: ../../reference/datamodel.rst:2226 +#: ../../reference/datamodel.rst:2320 msgid "" "This class variable can be assigned a string, iterable, or sequence of " "strings with variable names used by instances. *__slots__* reserves space " @@ -2540,18 +2684,18 @@ msgid "" "`~object.__dict__` and *__weakref__* for each instance." msgstr "" -#: ../../reference/datamodel.rst:2235 +#: ../../reference/datamodel.rst:2329 msgid "Notes on using *__slots__*:" msgstr "" -#: ../../reference/datamodel.rst:2237 +#: ../../reference/datamodel.rst:2331 msgid "" "When inheriting from a class without *__slots__*, the :attr:`~object." "__dict__` and *__weakref__* attribute of the instances will always be " "accessible." msgstr "" -#: ../../reference/datamodel.rst:2241 +#: ../../reference/datamodel.rst:2335 msgid "" "Without a :attr:`~object.__dict__` variable, instances cannot be assigned " "new variables not listed in the *__slots__* definition. Attempts to assign " @@ -2560,7 +2704,7 @@ msgid "" "sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2248 +#: ../../reference/datamodel.rst:2342 msgid "" "Without a *__weakref__* variable for each instance, classes defining " "*__slots__* do not support :mod:`weak references <weakref>` to its " @@ -2568,7 +2712,7 @@ msgid "" "to the sequence of strings in the *__slots__* declaration." msgstr "" -#: ../../reference/datamodel.rst:2254 +#: ../../reference/datamodel.rst:2348 msgid "" "*__slots__* are implemented at the class level by creating :ref:`descriptors " "<descriptors>` for each variable name. As a result, class attributes cannot " @@ -2576,16 +2720,16 @@ msgid "" "otherwise, the class attribute would overwrite the descriptor assignment." msgstr "" -#: ../../reference/datamodel.rst:2260 +#: ../../reference/datamodel.rst:2354 msgid "" "The action of a *__slots__* declaration is not limited to the class where it " "is defined. *__slots__* declared in parents are available in child classes. " -"However, child subclasses will get a :attr:`~object.__dict__` and " -"*__weakref__* unless they also define *__slots__* (which should only contain " -"names of any *additional* slots)." +"However, instances of a child subclass will get a :attr:`~object.__dict__` " +"and *__weakref__* unless the subclass also defines *__slots__* (which should " +"only contain names of any *additional* slots)." msgstr "" -#: ../../reference/datamodel.rst:2266 +#: ../../reference/datamodel.rst:2360 msgid "" "If a class defines a slot also defined in a base class, the instance " "variable defined by the base class slot is inaccessible (except by " @@ -2594,7 +2738,7 @@ msgid "" "prevent this." msgstr "" -#: ../../reference/datamodel.rst:2271 +#: ../../reference/datamodel.rst:2365 msgid "" ":exc:`TypeError` will be raised if nonempty *__slots__* are defined for a " "class derived from a :c:member:`\"variable-length\" built-in type " @@ -2602,11 +2746,11 @@ msgid "" "`tuple`." msgstr "" -#: ../../reference/datamodel.rst:2276 +#: ../../reference/datamodel.rst:2370 msgid "Any non-string :term:`iterable` may be assigned to *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2278 +#: ../../reference/datamodel.rst:2372 msgid "" "If a :class:`dictionary <dict>` is used to assign *__slots__*, the " "dictionary keys will be used as the slot names. The values of the dictionary " @@ -2614,13 +2758,13 @@ msgid "" "func:`inspect.getdoc` and displayed in the output of :func:`help`." msgstr "" -#: ../../reference/datamodel.rst:2283 +#: ../../reference/datamodel.rst:2377 msgid "" -":attr:`~instance.__class__` assignment works only if both classes have the " +":attr:`~object.__class__` assignment works only if both classes have the " "same *__slots__*." msgstr "" -#: ../../reference/datamodel.rst:2286 +#: ../../reference/datamodel.rst:2380 msgid "" ":ref:`Multiple inheritance <tut-multiple>` with multiple slotted parent " "classes can be used, but only one parent is allowed to have attributes " @@ -2628,18 +2772,18 @@ msgid "" "raise :exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:2292 +#: ../../reference/datamodel.rst:2386 msgid "" "If an :term:`iterator` is used for *__slots__* then a :term:`descriptor` is " "created for each of the iterator's values. However, the *__slots__* " "attribute will be an empty iterator." msgstr "" -#: ../../reference/datamodel.rst:2300 +#: ../../reference/datamodel.rst:2394 msgid "Customizing class creation" msgstr "" -#: ../../reference/datamodel.rst:2302 +#: ../../reference/datamodel.rst:2396 msgid "" "Whenever a class inherits from another class, :meth:`~object." "__init_subclass__` is called on the parent class. This way, it is possible " @@ -2649,14 +2793,14 @@ msgid "" "future subclasses of the class defining the method." msgstr "" -#: ../../reference/datamodel.rst:2311 +#: ../../reference/datamodel.rst:2405 msgid "" "This method is called whenever the containing class is subclassed. *cls* is " "then the new subclass. If defined as a normal instance method, this method " "is implicitly converted to a class method." msgstr "" -#: ../../reference/datamodel.rst:2315 +#: ../../reference/datamodel.rst:2409 msgid "" "Keyword arguments which are given to a new class are passed to the parent " "class's ``__init_subclass__``. For compatibility with other classes using " @@ -2664,7 +2808,7 @@ msgid "" "pass the others over to the base class, as in::" msgstr "" -#: ../../reference/datamodel.rst:2321 +#: ../../reference/datamodel.rst:2415 msgid "" "class Philosopher:\n" " def __init_subclass__(cls, /, default_name, **kwargs):\n" @@ -2682,13 +2826,13 @@ msgstr "" "class AustralianPhilosopher(Philosopher, default_name=\"Bruce\"):\n" " pass" -#: ../../reference/datamodel.rst:2329 +#: ../../reference/datamodel.rst:2423 msgid "" "The default implementation ``object.__init_subclass__`` does nothing, but " "raises an error if it is called with any arguments." msgstr "" -#: ../../reference/datamodel.rst:2334 +#: ../../reference/datamodel.rst:2428 msgid "" "The metaclass hint ``metaclass`` is consumed by the rest of the type " "machinery, and is never passed to ``__init_subclass__`` implementations. The " @@ -2696,19 +2840,19 @@ msgid "" "``type(cls)``." msgstr "" -#: ../../reference/datamodel.rst:2342 +#: ../../reference/datamodel.rst:2436 msgid "" "When a class is created, :meth:`type.__new__` scans the class variables and " "makes callbacks to those with a :meth:`~object.__set_name__` hook." msgstr "" -#: ../../reference/datamodel.rst:2347 +#: ../../reference/datamodel.rst:2441 msgid "" "Automatically called at the time the owning class *owner* is created. The " "object has been assigned to *name* in that class::" msgstr "" -#: ../../reference/datamodel.rst:2350 +#: ../../reference/datamodel.rst:2444 msgid "" "class A:\n" " x = C() # Automatically calls: x.__set_name__(A, 'x')" @@ -2716,14 +2860,14 @@ msgstr "" "class A:\n" " x = C() # 自動呼叫:x.__set_name__(A, 'x')" -#: ../../reference/datamodel.rst:2353 +#: ../../reference/datamodel.rst:2447 msgid "" "If the class variable is assigned after the class is created, :meth:" "`__set_name__` will not be called automatically. If needed, :meth:" "`__set_name__` can be called directly::" msgstr "" -#: ../../reference/datamodel.rst:2357 +#: ../../reference/datamodel.rst:2451 msgid "" "class A:\n" " pass\n" @@ -2733,22 +2877,22 @@ msgid "" "c.__set_name__(A, 'x') # Manually invoke the hook" msgstr "" -#: ../../reference/datamodel.rst:2364 +#: ../../reference/datamodel.rst:2458 msgid "See :ref:`class-object-creation` for more details." msgstr "更多細節請見 :ref:`class-object-creation`。" -#: ../../reference/datamodel.rst:2372 +#: ../../reference/datamodel.rst:2466 msgid "Metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2379 +#: ../../reference/datamodel.rst:2473 msgid "" "By default, classes are constructed using :func:`type`. The class body is " "executed in a new namespace and the class name is bound locally to the " "result of ``type(name, bases, namespace)``." msgstr "" -#: ../../reference/datamodel.rst:2383 +#: ../../reference/datamodel.rst:2477 msgid "" "The class creation process can be customized by passing the ``metaclass`` " "keyword argument in the class definition line, or by inheriting from an " @@ -2756,7 +2900,7 @@ msgid "" "both ``MyClass`` and ``MySubclass`` are instances of ``Meta``::" msgstr "" -#: ../../reference/datamodel.rst:2388 +#: ../../reference/datamodel.rst:2482 msgid "" "class Meta(type):\n" " pass\n" @@ -2776,41 +2920,41 @@ msgstr "" "class MySubclass(MyClass):\n" " pass" -#: ../../reference/datamodel.rst:2397 +#: ../../reference/datamodel.rst:2491 msgid "" "Any other keyword arguments that are specified in the class definition are " "passed through to all metaclass operations described below." msgstr "" -#: ../../reference/datamodel.rst:2400 +#: ../../reference/datamodel.rst:2494 msgid "When a class definition is executed, the following steps occur:" msgstr "" -#: ../../reference/datamodel.rst:2402 +#: ../../reference/datamodel.rst:2496 msgid "MRO entries are resolved;" msgstr "" -#: ../../reference/datamodel.rst:2403 +#: ../../reference/datamodel.rst:2497 msgid "the appropriate metaclass is determined;" msgstr "" -#: ../../reference/datamodel.rst:2404 +#: ../../reference/datamodel.rst:2498 msgid "the class namespace is prepared;" msgstr "" -#: ../../reference/datamodel.rst:2405 +#: ../../reference/datamodel.rst:2499 msgid "the class body is executed;" msgstr "" -#: ../../reference/datamodel.rst:2406 +#: ../../reference/datamodel.rst:2500 msgid "the class object is created." msgstr "" -#: ../../reference/datamodel.rst:2410 +#: ../../reference/datamodel.rst:2504 msgid "Resolving MRO entries" msgstr "" -#: ../../reference/datamodel.rst:2414 +#: ../../reference/datamodel.rst:2508 msgid "" "If a base that appears in a class definition is not an instance of :class:" "`type`, then an :meth:`!__mro_entries__` method is searched on the base. If " @@ -2822,59 +2966,59 @@ msgid "" "is ignored." msgstr "" -#: ../../reference/datamodel.rst:2425 +#: ../../reference/datamodel.rst:2519 msgid ":func:`types.resolve_bases`" msgstr ":func:`types.resolve_bases`" -#: ../../reference/datamodel.rst:2426 +#: ../../reference/datamodel.rst:2520 msgid "Dynamically resolve bases that are not instances of :class:`type`." msgstr "" -#: ../../reference/datamodel.rst:2428 +#: ../../reference/datamodel.rst:2522 msgid ":func:`types.get_original_bases`" msgstr ":func:`types.get_original_bases`" -#: ../../reference/datamodel.rst:2429 +#: ../../reference/datamodel.rst:2523 msgid "" "Retrieve a class's \"original bases\" prior to modifications by :meth:" "`~object.__mro_entries__`." msgstr "" -#: ../../reference/datamodel.rst:2432 +#: ../../reference/datamodel.rst:2526 msgid ":pep:`560`" msgstr ":pep:`560`" -#: ../../reference/datamodel.rst:2433 +#: ../../reference/datamodel.rst:2527 msgid "Core support for typing module and generic types." msgstr "" -#: ../../reference/datamodel.rst:2437 +#: ../../reference/datamodel.rst:2531 msgid "Determining the appropriate metaclass" msgstr "" -#: ../../reference/datamodel.rst:2441 +#: ../../reference/datamodel.rst:2535 msgid "" "The appropriate metaclass for a class definition is determined as follows:" msgstr "" -#: ../../reference/datamodel.rst:2443 +#: ../../reference/datamodel.rst:2537 msgid "" "if no bases and no explicit metaclass are given, then :func:`type` is used;" msgstr "" -#: ../../reference/datamodel.rst:2444 +#: ../../reference/datamodel.rst:2538 msgid "" "if an explicit metaclass is given and it is *not* an instance of :func:" "`type`, then it is used directly as the metaclass;" msgstr "" -#: ../../reference/datamodel.rst:2446 +#: ../../reference/datamodel.rst:2540 msgid "" "if an instance of :func:`type` is given as the explicit metaclass, or bases " "are defined, then the most derived metaclass is used." msgstr "" -#: ../../reference/datamodel.rst:2449 +#: ../../reference/datamodel.rst:2543 msgid "" "The most derived metaclass is selected from the explicitly specified " "metaclass (if any) and the metaclasses (i.e. ``type(cls)``) of all specified " @@ -2883,11 +3027,11 @@ msgid "" "that criterion, then the class definition will fail with ``TypeError``." msgstr "" -#: ../../reference/datamodel.rst:2459 +#: ../../reference/datamodel.rst:2553 msgid "Preparing the class namespace" msgstr "" -#: ../../reference/datamodel.rst:2464 +#: ../../reference/datamodel.rst:2558 msgid "" "Once the appropriate metaclass has been identified, then the class namespace " "is prepared. If the metaclass has a ``__prepare__`` attribute, it is called " @@ -2899,25 +3043,25 @@ msgid "" "copied into a new ``dict``." msgstr "" -#: ../../reference/datamodel.rst:2473 +#: ../../reference/datamodel.rst:2567 msgid "" "If the metaclass has no ``__prepare__`` attribute, then the class namespace " "is initialised as an empty ordered mapping." msgstr "" -#: ../../reference/datamodel.rst:2478 +#: ../../reference/datamodel.rst:2572 msgid ":pep:`3115` - Metaclasses in Python 3000" msgstr "" -#: ../../reference/datamodel.rst:2479 +#: ../../reference/datamodel.rst:2573 msgid "Introduced the ``__prepare__`` namespace hook" msgstr "" -#: ../../reference/datamodel.rst:2483 +#: ../../reference/datamodel.rst:2577 msgid "Executing the class body" msgstr "" -#: ../../reference/datamodel.rst:2488 +#: ../../reference/datamodel.rst:2582 msgid "" "The class body is executed (approximately) as ``exec(body, globals(), " "namespace)``. The key difference from a normal call to :func:`exec` is that " @@ -2926,7 +3070,7 @@ msgid "" "inside a function." msgstr "" -#: ../../reference/datamodel.rst:2494 +#: ../../reference/datamodel.rst:2588 msgid "" "However, even when the class definition occurs inside the function, methods " "defined inside the class still cannot see names defined at the class scope. " @@ -2935,11 +3079,11 @@ msgid "" "reference described in the next section." msgstr "" -#: ../../reference/datamodel.rst:2503 +#: ../../reference/datamodel.rst:2597 msgid "Creating the class object" msgstr "" -#: ../../reference/datamodel.rst:2510 +#: ../../reference/datamodel.rst:2604 msgid "" "Once the class namespace has been populated by executing the class body, the " "class object is created by calling ``metaclass(name, bases, namespace, " @@ -2947,7 +3091,7 @@ msgid "" "to ``__prepare__``)." msgstr "" -#: ../../reference/datamodel.rst:2515 +#: ../../reference/datamodel.rst:2609 msgid "" "This class object is the one that will be referenced by the zero-argument " "form of :func:`super`. ``__class__`` is an implicit closure reference " @@ -2958,7 +3102,7 @@ msgid "" "is identified based on the first argument passed to the method." msgstr "" -#: ../../reference/datamodel.rst:2525 +#: ../../reference/datamodel.rst:2619 msgid "" "In CPython 3.6 and later, the ``__class__`` cell is passed to the metaclass " "as a ``__classcell__`` entry in the class namespace. If present, this must " @@ -2967,59 +3111,59 @@ msgid "" "in Python 3.8." msgstr "" -#: ../../reference/datamodel.rst:2531 +#: ../../reference/datamodel.rst:2625 msgid "" "When using the default metaclass :class:`type`, or any metaclass that " "ultimately calls ``type.__new__``, the following additional customization " "steps are invoked after creating the class object:" msgstr "" -#: ../../reference/datamodel.rst:2535 +#: ../../reference/datamodel.rst:2629 msgid "" "The ``type.__new__`` method collects all of the attributes in the class " "namespace that define a :meth:`~object.__set_name__` method;" msgstr "" -#: ../../reference/datamodel.rst:2537 +#: ../../reference/datamodel.rst:2631 msgid "" "Those ``__set_name__`` methods are called with the class being defined and " "the assigned name of that particular attribute;" msgstr "" -#: ../../reference/datamodel.rst:2539 +#: ../../reference/datamodel.rst:2633 msgid "" "The :meth:`~object.__init_subclass__` hook is called on the immediate parent " "of the new class in its method resolution order." msgstr "" -#: ../../reference/datamodel.rst:2542 +#: ../../reference/datamodel.rst:2636 msgid "" "After the class object is created, it is passed to the class decorators " "included in the class definition (if any) and the resulting object is bound " "in the local namespace as the defined class." msgstr "" -#: ../../reference/datamodel.rst:2546 +#: ../../reference/datamodel.rst:2640 msgid "" "When a new class is created by ``type.__new__``, the object provided as the " "namespace parameter is copied to a new ordered mapping and the original " "object is discarded. The new copy is wrapped in a read-only proxy, which " -"becomes the :attr:`~object.__dict__` attribute of the class object." +"becomes the :attr:`~type.__dict__` attribute of the class object." msgstr "" -#: ../../reference/datamodel.rst:2553 +#: ../../reference/datamodel.rst:2647 msgid ":pep:`3135` - New super" msgstr "" -#: ../../reference/datamodel.rst:2554 +#: ../../reference/datamodel.rst:2648 msgid "Describes the implicit ``__class__`` closure reference" msgstr "" -#: ../../reference/datamodel.rst:2558 +#: ../../reference/datamodel.rst:2652 msgid "Uses for metaclasses" msgstr "" -#: ../../reference/datamodel.rst:2560 +#: ../../reference/datamodel.rst:2654 msgid "" "The potential uses for metaclasses are boundless. Some ideas that have been " "explored include enum, logging, interface checking, automatic delegation, " @@ -3027,17 +3171,17 @@ msgid "" "locking/synchronization." msgstr "" -#: ../../reference/datamodel.rst:2567 +#: ../../reference/datamodel.rst:2661 msgid "Customizing instance and subclass checks" msgstr "" -#: ../../reference/datamodel.rst:2569 +#: ../../reference/datamodel.rst:2663 msgid "" "The following methods are used to override the default behavior of the :func:" "`isinstance` and :func:`issubclass` built-in functions." msgstr "" -#: ../../reference/datamodel.rst:2572 +#: ../../reference/datamodel.rst:2666 msgid "" "In particular, the metaclass :class:`abc.ABCMeta` implements these methods " "in order to allow the addition of Abstract Base Classes (ABCs) as \"virtual " @@ -3045,21 +3189,21 @@ msgid "" "other ABCs." msgstr "" -#: ../../reference/datamodel.rst:2579 +#: ../../reference/datamodel.rst:2673 msgid "" "Return true if *instance* should be considered a (direct or indirect) " "instance of *class*. If defined, called to implement ``isinstance(instance, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2586 +#: ../../reference/datamodel.rst:2680 msgid "" "Return true if *subclass* should be considered a (direct or indirect) " "subclass of *class*. If defined, called to implement ``issubclass(subclass, " "class)``." msgstr "" -#: ../../reference/datamodel.rst:2591 +#: ../../reference/datamodel.rst:2685 msgid "" "Note that these methods are looked up on the type (metaclass) of a class. " "They cannot be defined as class methods in the actual class. This is " @@ -3067,24 +3211,24 @@ msgid "" "only in this case the instance is itself a class." msgstr "" -#: ../../reference/datamodel.rst:2598 +#: ../../reference/datamodel.rst:2692 msgid ":pep:`3119` - Introducing Abstract Base Classes" msgstr "" -#: ../../reference/datamodel.rst:2599 +#: ../../reference/datamodel.rst:2693 msgid "" "Includes the specification for customizing :func:`isinstance` and :func:" -"`issubclass` behavior through :meth:`~class.__instancecheck__` and :meth:" -"`~class.__subclasscheck__`, with motivation for this functionality in the " +"`issubclass` behavior through :meth:`~type.__instancecheck__` and :meth:" +"`~type.__subclasscheck__`, with motivation for this functionality in the " "context of adding Abstract Base Classes (see the :mod:`abc` module) to the " "language." msgstr "" -#: ../../reference/datamodel.rst:2607 +#: ../../reference/datamodel.rst:2701 msgid "Emulating generic types" msgstr "" -#: ../../reference/datamodel.rst:2609 +#: ../../reference/datamodel.rst:2703 msgid "" "When using :term:`type annotations<annotation>`, it is often useful to " "*parameterize* a :term:`generic type` using Python's square-brackets " @@ -3092,65 +3236,65 @@ msgid "" "a :class:`list` in which all the elements are of type :class:`int`." msgstr "" -#: ../../reference/datamodel.rst:2616 +#: ../../reference/datamodel.rst:2710 msgid ":pep:`484` - Type Hints" msgstr "" -#: ../../reference/datamodel.rst:2617 +#: ../../reference/datamodel.rst:2711 msgid "Introducing Python's framework for type annotations" msgstr "" -#: ../../reference/datamodel.rst:2619 +#: ../../reference/datamodel.rst:2713 msgid ":ref:`Generic Alias Types<types-genericalias>`" msgstr ":ref:`泛型別名型別 <types-genericalias>`" -#: ../../reference/datamodel.rst:2620 +#: ../../reference/datamodel.rst:2714 msgid "Documentation for objects representing parameterized generic classes" msgstr "" -#: ../../reference/datamodel.rst:2622 +#: ../../reference/datamodel.rst:2716 msgid "" ":ref:`Generics`, :ref:`user-defined generics<user-defined-generics>` and :" "class:`typing.Generic`" msgstr "" -#: ../../reference/datamodel.rst:2623 +#: ../../reference/datamodel.rst:2717 msgid "" "Documentation on how to implement generic classes that can be parameterized " "at runtime and understood by static type-checkers." msgstr "" -#: ../../reference/datamodel.rst:2626 +#: ../../reference/datamodel.rst:2720 msgid "" "A class can *generally* only be parameterized if it defines the special " "class method ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2631 +#: ../../reference/datamodel.rst:2725 msgid "" "Return an object representing the specialization of a generic class by type " "arguments found in *key*." msgstr "" -#: ../../reference/datamodel.rst:2634 +#: ../../reference/datamodel.rst:2728 msgid "" "When defined on a class, ``__class_getitem__()`` is automatically a class " "method. As such, there is no need for it to be decorated with :func:" "`@classmethod<classmethod>` when it is defined." msgstr "" -#: ../../reference/datamodel.rst:2640 +#: ../../reference/datamodel.rst:2734 msgid "The purpose of *__class_getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2642 +#: ../../reference/datamodel.rst:2736 msgid "" "The purpose of :meth:`~object.__class_getitem__` is to allow runtime " "parameterization of standard-library generic classes in order to more easily " "apply :term:`type hints<type hint>` to these classes." msgstr "" -#: ../../reference/datamodel.rst:2646 +#: ../../reference/datamodel.rst:2740 msgid "" "To implement custom generic classes that can be parameterized at runtime and " "understood by static type-checkers, users should either inherit from a " @@ -3159,7 +3303,7 @@ msgid "" "own implementation of ``__class_getitem__()``." msgstr "" -#: ../../reference/datamodel.rst:2652 +#: ../../reference/datamodel.rst:2746 msgid "" "Custom implementations of :meth:`~object.__class_getitem__` on classes " "defined outside of the standard library may not be understood by third-party " @@ -3167,11 +3311,11 @@ msgid "" "purposes other than type hinting is discouraged." msgstr "" -#: ../../reference/datamodel.rst:2662 +#: ../../reference/datamodel.rst:2756 msgid "*__class_getitem__* versus *__getitem__*" msgstr "" -#: ../../reference/datamodel.rst:2664 +#: ../../reference/datamodel.rst:2758 msgid "" "Usually, the :ref:`subscription<subscriptions>` of an object using square " "brackets will call the :meth:`~object.__getitem__` instance method defined " @@ -3181,14 +3325,14 @@ msgid "" "genericalias>` object if it is properly defined." msgstr "" -#: ../../reference/datamodel.rst:2671 +#: ../../reference/datamodel.rst:2765 msgid "" "Presented with the :term:`expression` ``obj[x]``, the Python interpreter " "follows something like the following process to decide whether :meth:" "`~object.__getitem__` or :meth:`~object.__class_getitem__` should be called::" msgstr "" -#: ../../reference/datamodel.rst:2676 +#: ../../reference/datamodel.rst:2770 msgid "" "from inspect import isclass\n" "\n" @@ -3214,7 +3358,7 @@ msgid "" " )" msgstr "" -#: ../../reference/datamodel.rst:2699 +#: ../../reference/datamodel.rst:2793 msgid "" "In Python, all classes are themselves instances of other classes. The class " "of a class is known as that class's :term:`metaclass`, and most classes have " @@ -3224,7 +3368,7 @@ msgid "" "__class_getitem__` being called::" msgstr "" -#: ../../reference/datamodel.rst:2706 +#: ../../reference/datamodel.rst:2800 msgid "" ">>> # list has class \"type\" as its metaclass, like most classes:\n" ">>> type(list)\n" @@ -3239,14 +3383,14 @@ msgid "" "<class 'types.GenericAlias'>" msgstr "" -#: ../../reference/datamodel.rst:2718 +#: ../../reference/datamodel.rst:2812 msgid "" "However, if a class has a custom metaclass that defines :meth:`~object." "__getitem__`, subscribing the class may result in different behaviour. An " "example of this can be found in the :mod:`enum` module::" msgstr "" -#: ../../reference/datamodel.rst:2722 +#: ../../reference/datamodel.rst:2816 msgid "" ">>> from enum import Enum\n" ">>> class Menu(Enum):\n" @@ -3266,33 +3410,33 @@ msgid "" "<enum 'Menu'>" msgstr "" -#: ../../reference/datamodel.rst:2741 +#: ../../reference/datamodel.rst:2835 msgid ":pep:`560` - Core Support for typing module and generic types" msgstr "" -#: ../../reference/datamodel.rst:2742 +#: ../../reference/datamodel.rst:2836 msgid "" "Introducing :meth:`~object.__class_getitem__`, and outlining when a :ref:" "`subscription<subscriptions>` results in ``__class_getitem__()`` being " "called instead of :meth:`~object.__getitem__`" msgstr "" -#: ../../reference/datamodel.rst:2750 +#: ../../reference/datamodel.rst:2844 msgid "Emulating callable objects" msgstr "" -#: ../../reference/datamodel.rst:2757 +#: ../../reference/datamodel.rst:2851 msgid "" "Called when the instance is \"called\" as a function; if this method is " "defined, ``x(arg1, arg2, ...)`` roughly translates to ``type(x).__call__(x, " "arg1, ...)``." msgstr "" -#: ../../reference/datamodel.rst:2764 +#: ../../reference/datamodel.rst:2858 msgid "Emulating container types" msgstr "" -#: ../../reference/datamodel.rst:2766 +#: ../../reference/datamodel.rst:2860 msgid "" "The following methods can be defined to implement container objects. " "Containers usually are :term:`sequences <sequence>` (such as :class:`lists " @@ -3328,7 +3472,7 @@ msgid "" "should iterate through the values." msgstr "" -#: ../../reference/datamodel.rst:2807 +#: ../../reference/datamodel.rst:2901 msgid "" "Called to implement the built-in function :func:`len`. Should return the " "length of the object, an integer ``>=`` 0. Also, an object that doesn't " @@ -3336,7 +3480,7 @@ msgid "" "returns zero is considered to be false in a Boolean context." msgstr "" -#: ../../reference/datamodel.rst:2814 +#: ../../reference/datamodel.rst:2908 msgid "" "In CPython, the length is required to be at most :data:`sys.maxsize`. If the " "length is larger than :data:`!sys.maxsize` some features (such as :func:" @@ -3345,7 +3489,7 @@ msgid "" "`~object.__bool__` method." msgstr "" -#: ../../reference/datamodel.rst:2823 +#: ../../reference/datamodel.rst:2917 msgid "" "Called to implement :func:`operator.length_hint`. Should return an estimated " "length for the object (which may be greater or less than the actual length). " @@ -3355,28 +3499,28 @@ msgid "" "never required for correctness." msgstr "" -#: ../../reference/datamodel.rst:2837 +#: ../../reference/datamodel.rst:2931 msgid "" "Slicing is done exclusively with the following three methods. A call like ::" msgstr "" -#: ../../reference/datamodel.rst:2839 +#: ../../reference/datamodel.rst:2933 msgid "a[1:2] = b" msgstr "a[1:2] = b" -#: ../../reference/datamodel.rst:2841 +#: ../../reference/datamodel.rst:2935 msgid "is translated to ::" msgstr "" -#: ../../reference/datamodel.rst:2843 +#: ../../reference/datamodel.rst:2937 msgid "a[slice(1, 2, None)] = b" msgstr "a[slice(1, 2, None)] = b" -#: ../../reference/datamodel.rst:2845 +#: ../../reference/datamodel.rst:2939 msgid "and so forth. Missing slice items are always filled in with ``None``." msgstr "" -#: ../../reference/datamodel.rst:2850 +#: ../../reference/datamodel.rst:2944 msgid "" "Called to implement evaluation of ``self[key]``. For :term:`sequence` types, " "the accepted keys should be integers. Optionally, they may support :class:" @@ -3388,20 +3532,20 @@ msgid "" "`KeyError` should be raised." msgstr "" -#: ../../reference/datamodel.rst:2862 +#: ../../reference/datamodel.rst:2956 msgid "" ":keyword:`for` loops expect that an :exc:`IndexError` will be raised for " "illegal indexes to allow proper detection of the end of the sequence." msgstr "" -#: ../../reference/datamodel.rst:2867 +#: ../../reference/datamodel.rst:2961 msgid "" "When :ref:`subscripting<subscriptions>` a *class*, the special class method :" "meth:`~object.__class_getitem__` may be called instead of ``__getitem__()``. " "See :ref:`classgetitem-versus-getitem` for more details." msgstr "" -#: ../../reference/datamodel.rst:2875 +#: ../../reference/datamodel.rst:2969 msgid "" "Called to implement assignment to ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3410,7 +3554,7 @@ msgid "" "for improper *key* values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2884 +#: ../../reference/datamodel.rst:2978 msgid "" "Called to implement deletion of ``self[key]``. Same note as for :meth:" "`__getitem__`. This should only be implemented for mappings if the objects " @@ -3419,13 +3563,13 @@ msgid "" "values as for the :meth:`__getitem__` method." msgstr "" -#: ../../reference/datamodel.rst:2893 +#: ../../reference/datamodel.rst:2987 msgid "" "Called by :class:`dict`\\ .\\ :meth:`__getitem__` to implement ``self[key]`` " "for dict subclasses when key is not in the dictionary." msgstr "" -#: ../../reference/datamodel.rst:2899 +#: ../../reference/datamodel.rst:2993 msgid "" "This method is called when an :term:`iterator` is required for a container. " "This method should return a new iterator object that can iterate over all " @@ -3433,14 +3577,14 @@ msgid "" "of the container." msgstr "" -#: ../../reference/datamodel.rst:2907 +#: ../../reference/datamodel.rst:3001 msgid "" "Called (if present) by the :func:`reversed` built-in to implement reverse " "iteration. It should return a new iterator object that iterates over all " "the objects in the container in reverse order." msgstr "" -#: ../../reference/datamodel.rst:2911 +#: ../../reference/datamodel.rst:3005 msgid "" "If the :meth:`__reversed__` method is not provided, the :func:`reversed` " "built-in will fall back to using the sequence protocol (:meth:`__len__` and :" @@ -3449,7 +3593,7 @@ msgid "" "more efficient than the one provided by :func:`reversed`." msgstr "" -#: ../../reference/datamodel.rst:2918 +#: ../../reference/datamodel.rst:3012 msgid "" "The membership test operators (:keyword:`in` and :keyword:`not in`) are " "normally implemented as an iteration through a container. However, container " @@ -3457,14 +3601,14 @@ msgid "" "implementation, which also does not require the object be iterable." msgstr "" -#: ../../reference/datamodel.rst:2925 +#: ../../reference/datamodel.rst:3019 msgid "" "Called to implement membership test operators. Should return true if *item* " "is in *self*, false otherwise. For mapping objects, this should consider " "the keys of the mapping rather than the values or the key-item pairs." msgstr "" -#: ../../reference/datamodel.rst:2929 +#: ../../reference/datamodel.rst:3023 msgid "" "For objects that don't define :meth:`__contains__`, the membership test " "first tries iteration via :meth:`__iter__`, then the old sequence iteration " @@ -3472,11 +3616,11 @@ msgid "" "reference <membership-test-details>`." msgstr "" -#: ../../reference/datamodel.rst:2938 +#: ../../reference/datamodel.rst:3032 msgid "Emulating numeric types" msgstr "" -#: ../../reference/datamodel.rst:2940 +#: ../../reference/datamodel.rst:3034 msgid "" "The following methods can be defined to emulate numeric objects. Methods " "corresponding to operations that are not supported by the particular kind of " @@ -3484,7 +3628,7 @@ msgid "" "should be left undefined." msgstr "" -#: ../../reference/datamodel.rst:2966 +#: ../../reference/datamodel.rst:3060 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3498,13 +3642,13 @@ msgid "" "function is to be supported." msgstr "" -#: ../../reference/datamodel.rst:2977 +#: ../../reference/datamodel.rst:3071 msgid "" "If one of those methods does not support the operation with the supplied " "arguments, it should return :data:`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3000 +#: ../../reference/datamodel.rst:3094 msgid "" "These methods are called to implement the binary arithmetic operations " "(``+``, ``-``, ``*``, ``@``, ``/``, ``//``, ``%``, :func:`divmod`, :func:" @@ -3517,13 +3661,13 @@ msgid "" "`NotImplemented`." msgstr "" -#: ../../reference/datamodel.rst:3012 +#: ../../reference/datamodel.rst:3106 msgid "" "Note that ternary :func:`pow` will not try calling :meth:`__rpow__` (the " "coercion rules would become too complicated)." msgstr "" -#: ../../reference/datamodel.rst:3017 +#: ../../reference/datamodel.rst:3111 msgid "" "If the right operand's type is a subclass of the left operand's type and " "that subclass provides a different implementation of the reflected method " @@ -3532,7 +3676,7 @@ msgid "" "ancestors' operations." msgstr "" -#: ../../reference/datamodel.rst:3038 +#: ../../reference/datamodel.rst:3132 msgid "" "These methods are called to implement the augmented arithmetic assignments " "(``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``, " @@ -3550,19 +3694,19 @@ msgid "" "data model." msgstr "" -#: ../../reference/datamodel.rst:3061 +#: ../../reference/datamodel.rst:3155 msgid "" "Called to implement the unary arithmetic operations (``-``, ``+``, :func:" "`abs` and ``~``)." msgstr "" -#: ../../reference/datamodel.rst:3074 +#: ../../reference/datamodel.rst:3168 msgid "" "Called to implement the built-in functions :func:`complex`, :func:`int` and :" "func:`float`. Should return a value of the appropriate type." msgstr "" -#: ../../reference/datamodel.rst:3081 +#: ../../reference/datamodel.rst:3175 msgid "" "Called to implement :func:`operator.index`, and whenever Python needs to " "losslessly convert the numeric object to an integer object (such as in " @@ -3571,14 +3715,14 @@ msgid "" "integer type. Must return an integer." msgstr "" -#: ../../reference/datamodel.rst:3087 +#: ../../reference/datamodel.rst:3181 msgid "" "If :meth:`__int__`, :meth:`__float__` and :meth:`__complex__` are not " "defined then corresponding built-in functions :func:`int`, :func:`float` " "and :func:`complex` fall back to :meth:`__index__`." msgstr "" -#: ../../reference/datamodel.rst:3099 +#: ../../reference/datamodel.rst:3193 msgid "" "Called to implement the built-in function :func:`round` and :mod:`math` " "functions :func:`~math.trunc`, :func:`~math.floor` and :func:`~math.ceil`. " @@ -3587,21 +3731,21 @@ msgid "" "(typically an :class:`int`)." msgstr "" -#: ../../reference/datamodel.rst:3105 +#: ../../reference/datamodel.rst:3199 msgid "" "The built-in function :func:`int` falls back to :meth:`__trunc__` if " "neither :meth:`__int__` nor :meth:`__index__` is defined." msgstr "" -#: ../../reference/datamodel.rst:3108 +#: ../../reference/datamodel.rst:3202 msgid "The delegation of :func:`int` to :meth:`__trunc__` is deprecated." msgstr "" -#: ../../reference/datamodel.rst:3115 +#: ../../reference/datamodel.rst:3209 msgid "With Statement Context Managers" -msgstr "" +msgstr "With 陳述式的情境管理器" -#: ../../reference/datamodel.rst:3117 +#: ../../reference/datamodel.rst:3211 msgid "" "A :dfn:`context manager` is an object that defines the runtime context to be " "established when executing a :keyword:`with` statement. The context manager " @@ -3611,32 +3755,32 @@ msgid "" "can also be used by directly invoking their methods." msgstr "" -#: ../../reference/datamodel.rst:3128 +#: ../../reference/datamodel.rst:3222 msgid "" "Typical uses of context managers include saving and restoring various kinds " "of global state, locking and unlocking resources, closing opened files, etc." msgstr "" -#: ../../reference/datamodel.rst:3131 +#: ../../reference/datamodel.rst:3225 msgid "" "For more information on context managers, see :ref:`typecontextmanager`." msgstr "" -#: ../../reference/datamodel.rst:3136 +#: ../../reference/datamodel.rst:3230 msgid "" "Enter the runtime context related to this object. The :keyword:`with` " "statement will bind this method's return value to the target(s) specified in " "the :keyword:`!as` clause of the statement, if any." msgstr "" -#: ../../reference/datamodel.rst:3143 +#: ../../reference/datamodel.rst:3237 msgid "" "Exit the runtime context related to this object. The parameters describe the " "exception that caused the context to be exited. If the context was exited " "without an exception, all three arguments will be :const:`None`." msgstr "" -#: ../../reference/datamodel.rst:3147 +#: ../../reference/datamodel.rst:3241 msgid "" "If an exception is supplied, and the method wishes to suppress the exception " "(i.e., prevent it from being propagated), it should return a true value. " @@ -3644,27 +3788,27 @@ msgid "" "method." msgstr "" -#: ../../reference/datamodel.rst:3151 +#: ../../reference/datamodel.rst:3245 msgid "" "Note that :meth:`~object.__exit__` methods should not reraise the passed-in " "exception; this is the caller's responsibility." msgstr "" -#: ../../reference/datamodel.rst:3157 +#: ../../reference/datamodel.rst:3251 msgid ":pep:`343` - The \"with\" statement" msgstr ":pep:`343` - \"with\" 陳述式" -#: ../../reference/datamodel.rst:3158 +#: ../../reference/datamodel.rst:3252 msgid "" "The specification, background, and examples for the Python :keyword:`with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3165 +#: ../../reference/datamodel.rst:3259 msgid "Customizing positional arguments in class pattern matching" msgstr "" -#: ../../reference/datamodel.rst:3167 +#: ../../reference/datamodel.rst:3261 msgid "" "When using a class name in a pattern, positional arguments in the pattern " "are not allowed by default, i.e. ``case MyClass(x, y)`` is typically invalid " @@ -3672,7 +3816,7 @@ msgid "" "pattern, the class needs to define a *__match_args__* attribute." msgstr "" -#: ../../reference/datamodel.rst:3174 +#: ../../reference/datamodel.rst:3268 msgid "" "This class variable can be assigned a tuple of strings. When this class is " "used in a class pattern with positional arguments, each positional argument " @@ -3681,7 +3825,7 @@ msgid "" "to setting it to ``()``." msgstr "" -#: ../../reference/datamodel.rst:3180 +#: ../../reference/datamodel.rst:3274 msgid "" "For example, if ``MyClass.__match_args__`` is ``(\"left\", \"center\", " "\"right\")`` that means that ``case MyClass(x, y)`` is equivalent to ``case " @@ -3691,19 +3835,19 @@ msgid "" "exc:`TypeError`." msgstr "" -#: ../../reference/datamodel.rst:3190 +#: ../../reference/datamodel.rst:3284 msgid ":pep:`634` - Structural Pattern Matching" msgstr "" -#: ../../reference/datamodel.rst:3191 +#: ../../reference/datamodel.rst:3285 msgid "The specification for the Python ``match`` statement." msgstr "" -#: ../../reference/datamodel.rst:3197 +#: ../../reference/datamodel.rst:3291 msgid "Emulating buffer types" msgstr "" -#: ../../reference/datamodel.rst:3199 +#: ../../reference/datamodel.rst:3293 msgid "" "The :ref:`buffer protocol <bufferobjects>` provides a way for Python objects " "to expose efficient access to a low-level memory array. This protocol is " @@ -3711,13 +3855,13 @@ msgid "" "and third-party libraries may define additional buffer types." msgstr "" -#: ../../reference/datamodel.rst:3204 +#: ../../reference/datamodel.rst:3298 msgid "" "While buffer types are usually implemented in C, it is also possible to " "implement the protocol in Python." msgstr "" -#: ../../reference/datamodel.rst:3209 +#: ../../reference/datamodel.rst:3303 msgid "" "Called when a buffer is requested from *self* (for example, by the :class:" "`memoryview` constructor). The *flags* argument is an integer representing " @@ -3727,7 +3871,7 @@ msgid "" "`memoryview` object." msgstr "" -#: ../../reference/datamodel.rst:3218 +#: ../../reference/datamodel.rst:3312 msgid "" "Called when a buffer is no longer needed. The *buffer* argument is a :class:" "`memoryview` object that was previously returned by :meth:`~object." @@ -3736,28 +3880,28 @@ msgid "" "to perform any cleanup are not required to implement this method." msgstr "" -#: ../../reference/datamodel.rst:3229 +#: ../../reference/datamodel.rst:3323 msgid ":pep:`688` - Making the buffer protocol accessible in Python" msgstr "" -#: ../../reference/datamodel.rst:3230 +#: ../../reference/datamodel.rst:3324 msgid "" "Introduces the Python ``__buffer__`` and ``__release_buffer__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3232 +#: ../../reference/datamodel.rst:3326 msgid ":class:`collections.abc.Buffer`" msgstr ":class:`collections.abc.Buffer`" -#: ../../reference/datamodel.rst:3233 +#: ../../reference/datamodel.rst:3327 msgid "ABC for buffer types." msgstr "" -#: ../../reference/datamodel.rst:3238 +#: ../../reference/datamodel.rst:3332 msgid "Special method lookup" msgstr "" -#: ../../reference/datamodel.rst:3240 +#: ../../reference/datamodel.rst:3334 msgid "" "For custom classes, implicit invocations of special methods are only " "guaranteed to work correctly if defined on an object's type, not in the " @@ -3765,7 +3909,7 @@ msgid "" "following code raises an exception::" msgstr "" -#: ../../reference/datamodel.rst:3245 +#: ../../reference/datamodel.rst:3339 msgid "" ">>> class C:\n" "... pass\n" @@ -3787,7 +3931,7 @@ msgstr "" " File \"<stdin>\", line 1, in <module>\n" "TypeError: object of type 'C' has no len()" -#: ../../reference/datamodel.rst:3255 +#: ../../reference/datamodel.rst:3349 msgid "" "The rationale behind this behaviour lies with a number of special methods " "such as :meth:`~object.__hash__` and :meth:`~object.__repr__` that are " @@ -3796,7 +3940,7 @@ msgid "" "invoked on the type object itself::" msgstr "" -#: ../../reference/datamodel.rst:3262 +#: ../../reference/datamodel.rst:3356 msgid "" ">>> 1 .__hash__() == hash(1)\n" "True\n" @@ -3812,14 +3956,14 @@ msgstr "" " File \"<stdin>\", line 1, in <module>\n" "TypeError: descriptor '__hash__' of 'int' object needs an argument" -#: ../../reference/datamodel.rst:3269 +#: ../../reference/datamodel.rst:3363 msgid "" "Incorrectly attempting to invoke an unbound method of a class in this way is " "sometimes referred to as 'metaclass confusion', and is avoided by bypassing " "the instance when looking up special methods::" msgstr "" -#: ../../reference/datamodel.rst:3273 +#: ../../reference/datamodel.rst:3367 msgid "" ">>> type(1).__hash__(1) == hash(1)\n" "True\n" @@ -3831,14 +3975,14 @@ msgstr "" ">>> type(int).__hash__(int) == hash(int)\n" "True" -#: ../../reference/datamodel.rst:3278 +#: ../../reference/datamodel.rst:3372 msgid "" "In addition to bypassing any instance attributes in the interest of " "correctness, implicit special method lookup generally also bypasses the :" "meth:`~object.__getattribute__` method even of the object's metaclass::" msgstr "" -#: ../../reference/datamodel.rst:3282 +#: ../../reference/datamodel.rst:3376 msgid "" ">>> class Meta(type):\n" "... def __getattribute__(*args):\n" @@ -3863,7 +4007,7 @@ msgid "" "10" msgstr "" -#: ../../reference/datamodel.rst:3304 +#: ../../reference/datamodel.rst:3398 msgid "" "Bypassing the :meth:`~object.__getattribute__` machinery in this fashion " "provides significant scope for speed optimisations within the interpreter, " @@ -3872,36 +4016,36 @@ msgid "" "consistently invoked by the interpreter)." msgstr "" -#: ../../reference/datamodel.rst:3315 +#: ../../reference/datamodel.rst:3409 msgid "Coroutines" msgstr "協程" -#: ../../reference/datamodel.rst:3319 +#: ../../reference/datamodel.rst:3413 msgid "Awaitable Objects" msgstr "" -#: ../../reference/datamodel.rst:3321 +#: ../../reference/datamodel.rst:3415 msgid "" "An :term:`awaitable` object generally implements an :meth:`~object." "__await__` method. :term:`Coroutine objects <coroutine>` returned from :" "keyword:`async def` functions are awaitable." msgstr "" -#: ../../reference/datamodel.rst:3327 +#: ../../reference/datamodel.rst:3421 msgid "" "The :term:`generator iterator` objects returned from generators decorated " "with :func:`types.coroutine` are also awaitable, but they do not implement :" "meth:`~object.__await__`." msgstr "" -#: ../../reference/datamodel.rst:3333 +#: ../../reference/datamodel.rst:3427 msgid "" "Must return an :term:`iterator`. Should be used to implement :term:" "`awaitable` objects. For instance, :class:`asyncio.Future` implements this " "method to be compatible with the :keyword:`await` expression." msgstr "" -#: ../../reference/datamodel.rst:3339 +#: ../../reference/datamodel.rst:3433 msgid "" "The language doesn't place any restriction on the type or value of the " "objects yielded by the iterator returned by ``__await__``, as this is " @@ -3909,15 +4053,15 @@ msgid "" "g. :mod:`asyncio`) that will be managing the :term:`awaitable` object." msgstr "" -#: ../../reference/datamodel.rst:3347 +#: ../../reference/datamodel.rst:3441 msgid ":pep:`492` for additional information about awaitable objects." msgstr "" -#: ../../reference/datamodel.rst:3353 +#: ../../reference/datamodel.rst:3447 msgid "Coroutine Objects" msgstr "" -#: ../../reference/datamodel.rst:3355 +#: ../../reference/datamodel.rst:3449 msgid "" ":term:`Coroutine objects <coroutine>` are :term:`awaitable` objects. A " "coroutine's execution can be controlled by calling :meth:`~object.__await__` " @@ -3928,18 +4072,18 @@ msgid "" "should not directly raise unhandled :exc:`StopIteration` exceptions." msgstr "" -#: ../../reference/datamodel.rst:3363 +#: ../../reference/datamodel.rst:3457 msgid "" "Coroutines also have the methods listed below, which are analogous to those " "of generators (see :ref:`generator-methods`). However, unlike generators, " "coroutines do not directly support iteration." msgstr "" -#: ../../reference/datamodel.rst:3367 +#: ../../reference/datamodel.rst:3461 msgid "It is a :exc:`RuntimeError` to await on a coroutine more than once." msgstr "" -#: ../../reference/datamodel.rst:3373 +#: ../../reference/datamodel.rst:3467 msgid "" "Starts or resumes execution of the coroutine. If *value* is ``None``, this " "is equivalent to advancing the iterator returned by :meth:`~object." @@ -3950,7 +4094,7 @@ msgid "" "value, described above." msgstr "" -#: ../../reference/datamodel.rst:3384 +#: ../../reference/datamodel.rst:3478 msgid "" "Raises the specified exception in the coroutine. This method delegates to " "the :meth:`~generator.throw` method of the iterator that caused the " @@ -3961,13 +4105,13 @@ msgid "" "not caught in the coroutine, it propagates back to the caller." msgstr "" -#: ../../reference/datamodel.rst:3395 +#: ../../reference/datamodel.rst:3489 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." msgstr "" -#: ../../reference/datamodel.rst:3400 +#: ../../reference/datamodel.rst:3494 msgid "" "Causes the coroutine to clean itself up and exit. If the coroutine is " "suspended, this method first delegates to the :meth:`~generator.close` " @@ -3977,42 +4121,42 @@ msgid "" "is marked as having finished executing, even if it was never started." msgstr "" -#: ../../reference/datamodel.rst:3408 +#: ../../reference/datamodel.rst:3502 msgid "" "Coroutine objects are automatically closed using the above process when they " "are about to be destroyed." msgstr "" -#: ../../reference/datamodel.rst:3414 +#: ../../reference/datamodel.rst:3508 msgid "Asynchronous Iterators" msgstr "" -#: ../../reference/datamodel.rst:3416 +#: ../../reference/datamodel.rst:3510 msgid "" "An *asynchronous iterator* can call asynchronous code in its ``__anext__`` " "method." msgstr "" -#: ../../reference/datamodel.rst:3419 +#: ../../reference/datamodel.rst:3513 msgid "" "Asynchronous iterators can be used in an :keyword:`async for` statement." msgstr "" -#: ../../reference/datamodel.rst:3423 +#: ../../reference/datamodel.rst:3517 msgid "Must return an *asynchronous iterator* object." msgstr "" -#: ../../reference/datamodel.rst:3427 +#: ../../reference/datamodel.rst:3521 msgid "" "Must return an *awaitable* resulting in a next value of the iterator. " "Should raise a :exc:`StopAsyncIteration` error when the iteration is over." msgstr "" -#: ../../reference/datamodel.rst:3430 +#: ../../reference/datamodel.rst:3524 msgid "An example of an asynchronous iterable object::" msgstr "" -#: ../../reference/datamodel.rst:3432 +#: ../../reference/datamodel.rst:3526 msgid "" "class Reader:\n" " async def readline(self):\n" @@ -4040,53 +4184,53 @@ msgstr "" " raise StopAsyncIteration\n" " return val" -#: ../../reference/datamodel.rst:3447 +#: ../../reference/datamodel.rst:3541 msgid "" "Prior to Python 3.7, :meth:`~object.__aiter__` could return an *awaitable* " "that would resolve to an :term:`asynchronous iterator <asynchronous " "iterator>`." msgstr "" -#: ../../reference/datamodel.rst:3452 +#: ../../reference/datamodel.rst:3546 msgid "" "Starting with Python 3.7, :meth:`~object.__aiter__` must return an " "asynchronous iterator object. Returning anything else will result in a :exc:" "`TypeError` error." msgstr "" -#: ../../reference/datamodel.rst:3460 +#: ../../reference/datamodel.rst:3554 msgid "Asynchronous Context Managers" msgstr "" -#: ../../reference/datamodel.rst:3462 +#: ../../reference/datamodel.rst:3556 msgid "" "An *asynchronous context manager* is a *context manager* that is able to " "suspend execution in its ``__aenter__`` and ``__aexit__`` methods." msgstr "" -#: ../../reference/datamodel.rst:3465 +#: ../../reference/datamodel.rst:3559 msgid "" "Asynchronous context managers can be used in an :keyword:`async with` " "statement." msgstr "" -#: ../../reference/datamodel.rst:3469 +#: ../../reference/datamodel.rst:3563 msgid "" "Semantically similar to :meth:`~object.__enter__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3474 +#: ../../reference/datamodel.rst:3568 msgid "" "Semantically similar to :meth:`~object.__exit__`, the only difference being " "that it must return an *awaitable*." msgstr "" -#: ../../reference/datamodel.rst:3477 +#: ../../reference/datamodel.rst:3571 msgid "An example of an asynchronous context manager class::" msgstr "" -#: ../../reference/datamodel.rst:3479 +#: ../../reference/datamodel.rst:3573 msgid "" "class AsyncContextManager:\n" " async def __aenter__(self):\n" @@ -4102,26 +4246,27 @@ msgstr "" " async def __aexit__(self, exc_type, exc, tb):\n" " await log('exiting context')" -#: ../../reference/datamodel.rst:3490 +#: ../../reference/datamodel.rst:3584 msgid "Footnotes" msgstr "註解" -#: ../../reference/datamodel.rst:3491 +#: ../../reference/datamodel.rst:3585 msgid "" "It *is* possible in some cases to change an object's type, under certain " "controlled conditions. It generally isn't a good idea though, since it can " "lead to some very strange behaviour if it is handled incorrectly." msgstr "" -#: ../../reference/datamodel.rst:3495 +#: ../../reference/datamodel.rst:3589 msgid "" "The :meth:`~object.__hash__`, :meth:`~object.__iter__`, :meth:`~object." -"__reversed__`, and :meth:`~object.__contains__` methods have special " -"handling for this; others will still raise a :exc:`TypeError`, but may do so " +"__reversed__`, :meth:`~object.__contains__`, :meth:`~object." +"__class_getitem__` and :meth:`~os.PathLike.__fspath__` methods have special " +"handling for this. Others will still raise a :exc:`TypeError`, but may do so " "by relying on the behavior that ``None`` is not callable." msgstr "" -#: ../../reference/datamodel.rst:3501 +#: ../../reference/datamodel.rst:3596 msgid "" "\"Does not support\" here means that the class has no such method, or the " "method returns :data:`NotImplemented`. Do not set the method to ``None`` if " @@ -4129,7 +4274,7 @@ msgid "" "instead have the opposite effect of explicitly *blocking* such fallback." msgstr "" -#: ../../reference/datamodel.rst:3507 +#: ../../reference/datamodel.rst:3602 msgid "" "For operands of the same type, it is assumed that if the non-reflected " "method -- such as :meth:`~object.__add__` -- fails then the overall " @@ -4146,13 +4291,13 @@ msgstr "" #: ../../reference/datamodel.rst:427 ../../reference/datamodel.rst:447 #: ../../reference/datamodel.rst:455 ../../reference/datamodel.rst:466 #: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:519 -#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:661 -#: ../../reference/datamodel.rst:799 ../../reference/datamodel.rst:823 -#: ../../reference/datamodel.rst:856 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:1004 ../../reference/datamodel.rst:1031 -#: ../../reference/datamodel.rst:1093 ../../reference/datamodel.rst:1197 -#: ../../reference/datamodel.rst:1304 ../../reference/datamodel.rst:1404 -#: ../../reference/datamodel.rst:1818 ../../reference/datamodel.rst:2833 +#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:660 +#: ../../reference/datamodel.rst:798 ../../reference/datamodel.rst:822 +#: ../../reference/datamodel.rst:856 ../../reference/datamodel.rst:937 +#: ../../reference/datamodel.rst:1076 ../../reference/datamodel.rst:1103 +#: ../../reference/datamodel.rst:1175 ../../reference/datamodel.rst:1279 +#: ../../reference/datamodel.rst:1388 ../../reference/datamodel.rst:1498 +#: ../../reference/datamodel.rst:1912 ../../reference/datamodel.rst:2927 msgid "object" msgstr "object(物件)" @@ -4162,14 +4307,14 @@ msgstr "data(資料)" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:296 #: ../../reference/datamodel.rst:343 ../../reference/datamodel.rst:427 -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:799 -#: ../../reference/datamodel.rst:1050 ../../reference/datamodel.rst:1487 -#: ../../reference/datamodel.rst:1729 ../../reference/datamodel.rst:1734 -#: ../../reference/datamodel.rst:1818 ../../reference/datamodel.rst:2374 -#: ../../reference/datamodel.rst:2803 ../../reference/datamodel.rst:2961 -#: ../../reference/datamodel.rst:2996 ../../reference/datamodel.rst:3010 -#: ../../reference/datamodel.rst:3059 ../../reference/datamodel.rst:3069 -#: ../../reference/datamodel.rst:3097 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:798 +#: ../../reference/datamodel.rst:1132 ../../reference/datamodel.rst:1581 +#: ../../reference/datamodel.rst:1823 ../../reference/datamodel.rst:1828 +#: ../../reference/datamodel.rst:1912 ../../reference/datamodel.rst:2468 +#: ../../reference/datamodel.rst:2897 ../../reference/datamodel.rst:3055 +#: ../../reference/datamodel.rst:3090 ../../reference/datamodel.rst:3104 +#: ../../reference/datamodel.rst:3153 ../../reference/datamodel.rst:3163 +#: ../../reference/datamodel.rst:3191 msgid "built-in function" msgstr "built-in function(內建函式)" @@ -4178,7 +4323,7 @@ msgid "id" msgstr "id" #: ../../reference/datamodel.rst:23 ../../reference/datamodel.rst:126 -#: ../../reference/datamodel.rst:2374 +#: ../../reference/datamodel.rst:2468 msgid "type" msgstr "type(型別)" @@ -4214,7 +4359,7 @@ msgstr "reference counting(參照計數)" msgid "unreachable object" msgstr "unreachable object(不可達物件)" -#: ../../reference/datamodel.rst:95 ../../reference/datamodel.rst:935 +#: ../../reference/datamodel.rst:95 ../../reference/datamodel.rst:937 msgid "container" msgstr "container(容器)" @@ -4229,23 +4374,23 @@ msgstr "extension(擴充)" #: ../../reference/datamodel.rst:126 ../../reference/datamodel.rst:400 #: ../../reference/datamodel.rst:401 ../../reference/datamodel.rst:502 #: ../../reference/datamodel.rst:856 ../../reference/datamodel.rst:876 -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1132 msgid "module" msgstr "module(模組)" #: ../../reference/datamodel.rst:126 ../../reference/datamodel.rst:265 -#: ../../reference/datamodel.rst:799 +#: ../../reference/datamodel.rst:798 msgid "C" msgstr "C" #: ../../reference/datamodel.rst:126 ../../reference/datamodel.rst:265 -#: ../../reference/datamodel.rst:799 +#: ../../reference/datamodel.rst:798 msgid "language" msgstr "language(語言)" -#: ../../reference/datamodel.rst:139 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:953 ../../reference/datamodel.rst:1004 -#: ../../reference/datamodel.rst:1024 +#: ../../reference/datamodel.rst:139 ../../reference/datamodel.rst:937 +#: ../../reference/datamodel.rst:955 ../../reference/datamodel.rst:1076 +#: ../../reference/datamodel.rst:1096 msgid "attribute" msgstr "attribute(屬性)" @@ -4265,7 +4410,7 @@ msgstr "..." msgid "ellipsis literal" msgstr "ellipsis literal(刪節號)" -#: ../../reference/datamodel.rst:196 ../../reference/datamodel.rst:1031 +#: ../../reference/datamodel.rst:196 ../../reference/datamodel.rst:1103 msgid "numeric" msgstr "numeric(數值)" @@ -4302,16 +4447,16 @@ msgstr "number(數字)" msgid "Java" msgstr "Java" -#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3069 +#: ../../reference/datamodel.rst:283 ../../reference/datamodel.rst:3163 msgid "complex" msgstr "complex(複數)" #: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:427 -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:2803 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:2897 msgid "len" msgstr "len" -#: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:1031 +#: ../../reference/datamodel.rst:296 ../../reference/datamodel.rst:1103 msgid "sequence" msgstr "sequence(序列)" @@ -4340,8 +4485,8 @@ msgstr "immutable sequence(不可變序列)" msgid "immutable" msgstr "immutable(不可變)" -#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1704 -#: ../../reference/datamodel.rst:1734 +#: ../../reference/datamodel.rst:339 ../../reference/datamodel.rst:1798 +#: ../../reference/datamodel.rst:1828 msgid "string" msgstr "string(字串)" @@ -4377,7 +4522,7 @@ msgstr "singleton(單例)" msgid "empty" msgstr "empty(空的)" -#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:1729 +#: ../../reference/datamodel.rst:376 ../../reference/datamodel.rst:1823 msgid "bytes" msgstr "bytes(位元組)" @@ -4393,14 +4538,14 @@ msgstr "mutable sequence(可變序列)" msgid "mutable" msgstr "mutable(可變的)" -#: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:953 -#: ../../reference/datamodel.rst:1024 +#: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:955 +#: ../../reference/datamodel.rst:1096 msgid "assignment" msgstr "assignment(賦值)" #: ../../reference/datamodel.rst:388 ../../reference/datamodel.rst:856 -#: ../../reference/datamodel.rst:1441 ../../reference/datamodel.rst:1623 -#: ../../reference/datamodel.rst:3124 +#: ../../reference/datamodel.rst:1535 ../../reference/datamodel.rst:1717 +#: ../../reference/datamodel.rst:3218 msgid "statement" msgstr "statement(陳述式)" @@ -4432,12 +4577,12 @@ msgstr "set(集合)" msgid "frozenset" msgstr "frozenset(凍結集合)" -#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:1031 +#: ../../reference/datamodel.rst:466 ../../reference/datamodel.rst:1103 msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:1818 +#: ../../reference/datamodel.rst:483 ../../reference/datamodel.rst:937 +#: ../../reference/datamodel.rst:1912 msgid "dictionary" msgstr "dictionary(字典)" @@ -4454,13 +4599,13 @@ msgid "callable" msgstr "callable(可呼叫物件)" #: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:534 -#: ../../reference/datamodel.rst:743 ../../reference/datamodel.rst:761 -#: ../../reference/datamodel.rst:774 ../../reference/datamodel.rst:799 +#: ../../reference/datamodel.rst:742 ../../reference/datamodel.rst:760 +#: ../../reference/datamodel.rst:773 ../../reference/datamodel.rst:798 msgid "function" msgstr "function (函式)" -#: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:935 -#: ../../reference/datamodel.rst:958 ../../reference/datamodel.rst:2755 +#: ../../reference/datamodel.rst:519 ../../reference/datamodel.rst:937 +#: ../../reference/datamodel.rst:960 ../../reference/datamodel.rst:2849 msgid "call" msgstr "call(呼叫)" @@ -4472,7 +4617,7 @@ msgstr "invocation(調用)" msgid "argument" msgstr "argument(引數)" -#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:661 +#: ../../reference/datamodel.rst:534 ../../reference/datamodel.rst:660 msgid "user-defined" msgstr "user-defined(使用者定義)" @@ -4532,59 +4677,59 @@ msgstr "__kwdefaults__ (函式屬性)" msgid "__type_params__ (function attribute)" msgstr "__type_params__ (函式屬性)" -#: ../../reference/datamodel.rst:661 ../../reference/datamodel.rst:823 +#: ../../reference/datamodel.rst:660 ../../reference/datamodel.rst:822 msgid "method" msgstr "method(方法)" -#: ../../reference/datamodel.rst:661 +#: ../../reference/datamodel.rst:660 msgid "user-defined method" msgstr "user-defined method(使用者定義方法)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__func__ (method attribute)" msgstr "__func__ (方法屬性)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__self__ (method attribute)" msgstr "__self__ (方法屬性)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__doc__ (method attribute)" msgstr "__doc__ (方法屬性)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__name__ (method attribute)" msgstr "__name__ (方法屬性)" -#: ../../reference/datamodel.rst:669 +#: ../../reference/datamodel.rst:668 msgid "__module__ (method attribute)" msgstr "__module__ (方法屬性)" -#: ../../reference/datamodel.rst:743 ../../reference/datamodel.rst:1197 +#: ../../reference/datamodel.rst:742 ../../reference/datamodel.rst:1279 msgid "generator" msgstr "generator(產生器)" -#: ../../reference/datamodel.rst:743 +#: ../../reference/datamodel.rst:742 msgid "iterator" msgstr "itorator(疊代器)" -#: ../../reference/datamodel.rst:761 ../../reference/datamodel.rst:3311 +#: ../../reference/datamodel.rst:760 ../../reference/datamodel.rst:3405 msgid "coroutine" msgstr "coroutine(協程)" -#: ../../reference/datamodel.rst:774 +#: ../../reference/datamodel.rst:773 msgid "asynchronous generator" msgstr "asynchronous generator(非同步產生器)" -#: ../../reference/datamodel.rst:774 +#: ../../reference/datamodel.rst:773 msgid "asynchronous iterator" msgstr "asynchronous iterator(非同步疊代器)" -#: ../../reference/datamodel.rst:823 +#: ../../reference/datamodel.rst:822 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/datamodel.rst:823 +#: ../../reference/datamodel.rst:822 msgid "built-in" msgstr "built-in(內建)" @@ -4612,479 +4757,508 @@ msgstr "__annotations__ (模組屬性)" msgid "__dict__ (module attribute)" msgstr "__dict__ (模組屬性)" -#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:953 -#: ../../reference/datamodel.rst:1004 ../../reference/datamodel.rst:1606 -#: ../../reference/datamodel.rst:2485 +#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:955 +#: ../../reference/datamodel.rst:1076 ../../reference/datamodel.rst:1700 +#: ../../reference/datamodel.rst:2579 msgid "class" msgstr "class(類別)" -#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:1004 -#: ../../reference/datamodel.rst:1024 +#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:1076 +#: ../../reference/datamodel.rst:1096 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:1004 -#: ../../reference/datamodel.rst:2755 +#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:1076 +#: ../../reference/datamodel.rst:2849 msgid "instance" msgstr "instance(實例)" -#: ../../reference/datamodel.rst:935 ../../reference/datamodel.rst:958 +#: ../../reference/datamodel.rst:937 ../../reference/datamodel.rst:960 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__name__ (class attribute)" msgstr "__name__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__module__ (class attribute)" msgstr "__module__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__dict__ (class attribute)" msgstr "__dict__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__bases__ (class attribute)" msgstr "__bases__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__doc__ (class attribute)" msgstr "__doc__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__annotations__ (class attribute)" msgstr "__annotations__ (類別屬性)" -#: ../../reference/datamodel.rst:962 +#: ../../reference/datamodel.rst:967 msgid "__type_params__ (class attribute)" msgstr "__type_params__ (類別屬性)" -#: ../../reference/datamodel.rst:1039 +#: ../../reference/datamodel.rst:967 +msgid "__static_attributes__ (class attribute)" +msgstr "__static_attributes__ (類別屬性)" + +#: ../../reference/datamodel.rst:967 +msgid "__firstlineno__ (class attribute)" +msgstr "__firstlineno__ (類別屬性)" + +#: ../../reference/datamodel.rst:1114 msgid "__dict__ (instance attribute)" msgstr "__dict__ (實例屬性)" -#: ../../reference/datamodel.rst:1039 +#: ../../reference/datamodel.rst:1114 msgid "__class__ (instance attribute)" msgstr "__class__ (實例屬性)" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1132 msgid "open" msgstr "open" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1132 msgid "io" msgstr "io" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1132 msgid "popen() (in module os)" msgstr "popen() (於 os 模組中)" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1132 msgid "makefile() (socket method)" msgstr "makefile() (socket 方法)" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1132 msgid "sys.stdin" msgstr "sys.stdin" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1132 msgid "sys.stdout" msgstr "sys.stdout" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1132 msgid "sys.stderr" msgstr "sys.stderr" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1132 msgid "stdio" msgstr "stdio" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1132 msgid "stdin (in module sys)" msgstr "stdin (sys 模組中)" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1132 msgid "stdout (in module sys)" msgstr "stdout (sys 模組中)" -#: ../../reference/datamodel.rst:1050 +#: ../../reference/datamodel.rst:1132 msgid "stderr (in module sys)" msgstr "stderr (sys 模組中)" -#: ../../reference/datamodel.rst:1079 +#: ../../reference/datamodel.rst:1161 msgid "internal type" msgstr "internal type(內部型別)" -#: ../../reference/datamodel.rst:1079 +#: ../../reference/datamodel.rst:1161 msgid "types, internal" msgstr "types(型別), internal(內部)" -#: ../../reference/datamodel.rst:1093 +#: ../../reference/datamodel.rst:1175 msgid "bytecode" msgstr "bytecode(位元組碼)" -#: ../../reference/datamodel.rst:1093 +#: ../../reference/datamodel.rst:1175 msgid "code" msgstr "code(程式碼)" -#: ../../reference/datamodel.rst:1093 +#: ../../reference/datamodel.rst:1175 msgid "code object" msgstr "code object(程式碼物件)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_argcount (code object attribute)" msgstr "co_argcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_posonlyargcount (code object attribute)" msgstr "co_posonlyargcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_kwonlyargcount (code object attribute)" msgstr "co_kwonlyargcount (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_code (code object attribute)" msgstr "co_code (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_consts (code object attribute)" msgstr "co_consts (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_filename (code object attribute)" msgstr "co_filename (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_firstlineno (code object attribute)" msgstr "co_firstlineno (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_flags (code object attribute)" msgstr "co_flags (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_lnotab (code object attribute)" msgstr "co_lnotab (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_name (code object attribute)" msgstr "co_name (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_names (code object attribute)" msgstr "co_names (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_nlocals (code object attribute)" msgstr "co_nlocals (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_stacksize (code object attribute)" msgstr "co_stacksize (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_varnames (code object attribute)" msgstr "co_varnames (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_cellvars (code object attribute)" msgstr "co_cellvars (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_freevars (code object attribute)" msgstr "co_freevars (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1104 +#: ../../reference/datamodel.rst:1186 msgid "co_qualname (code object attribute)" msgstr "co_qualname (程式碼物件屬性)" -#: ../../reference/datamodel.rst:1215 +#: ../../reference/datamodel.rst:1297 msgid "documentation string" msgstr "documentation string(文件字串)" -#: ../../reference/datamodel.rst:1304 +#: ../../reference/datamodel.rst:1388 msgid "frame" msgstr "frame" -#: ../../reference/datamodel.rst:1310 +#: ../../reference/datamodel.rst:1394 msgid "f_back (frame attribute)" msgstr "f_back (frame 屬性)" -#: ../../reference/datamodel.rst:1310 +#: ../../reference/datamodel.rst:1394 msgid "f_code (frame attribute)" msgstr "f_code (frame 屬性)" -#: ../../reference/datamodel.rst:1310 +#: ../../reference/datamodel.rst:1394 msgid "f_globals (frame attribute)" msgstr "f_globals (frame 屬性)" -#: ../../reference/datamodel.rst:1310 +#: ../../reference/datamodel.rst:1394 msgid "f_locals (frame attribute)" msgstr "f_locals (frame 屬性)" -#: ../../reference/datamodel.rst:1310 +#: ../../reference/datamodel.rst:1394 msgid "f_lasti (frame attribute)" msgstr "f_lasti (frame 屬性)" -#: ../../reference/datamodel.rst:1310 +#: ../../reference/datamodel.rst:1394 msgid "f_builtins (frame attribute)" msgstr "f_builtins (frame 屬性)" -#: ../../reference/datamodel.rst:1349 +#: ../../reference/datamodel.rst:1438 msgid "f_trace (frame attribute)" msgstr "f_trace (frame 屬性)" -#: ../../reference/datamodel.rst:1349 +#: ../../reference/datamodel.rst:1438 msgid "f_trace_lines (frame attribute)" msgstr "f_trace_lines (frame 屬性)" -#: ../../reference/datamodel.rst:1349 +#: ../../reference/datamodel.rst:1438 msgid "f_trace_opcodes (frame attribute)" msgstr "f_trace_opcodes (frame 屬性)" -#: ../../reference/datamodel.rst:1349 +#: ../../reference/datamodel.rst:1438 msgid "f_lineno (frame attribute)" msgstr "f_lineno (frame 屬性)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1498 msgid "traceback" msgstr "traceback" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1498 msgid "stack" msgstr "stack(堆疊)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1498 msgid "trace" msgstr "trace(追蹤)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1498 msgid "exception" msgstr "exception(例外)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1498 msgid "handler" msgstr "handler(處理器)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1498 msgid "execution" msgstr "execution(執行)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1498 msgid "exc_info (in module sys)" msgstr "exc_info (sys 模組中)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1498 msgid "last_traceback (in module sys)" msgstr "last_traceback (sys 模組中)" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1498 msgid "sys.exc_info" msgstr "sys.exc_info" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1498 msgid "sys.exception" msgstr "sys.exception" -#: ../../reference/datamodel.rst:1404 +#: ../../reference/datamodel.rst:1498 msgid "sys.last_traceback" msgstr "sys.last_traceback" -#: ../../reference/datamodel.rst:1441 +#: ../../reference/datamodel.rst:1535 msgid "tb_frame (traceback attribute)" msgstr "tb_frame (traceback 屬性)" -#: ../../reference/datamodel.rst:1441 +#: ../../reference/datamodel.rst:1535 msgid "tb_lineno (traceback attribute)" msgstr "tb_lineno (traceback 屬性)" -#: ../../reference/datamodel.rst:1441 +#: ../../reference/datamodel.rst:1535 msgid "tb_lasti (traceback attribute)" msgstr "tb_lasti (traceback 屬性)" -#: ../../reference/datamodel.rst:1441 +#: ../../reference/datamodel.rst:1535 msgid "try" msgstr "try" -#: ../../reference/datamodel.rst:1471 +#: ../../reference/datamodel.rst:1565 msgid "tb_next (traceback attribute)" msgstr "tb_next (traceback 屬性)" -#: ../../reference/datamodel.rst:1487 ../../reference/datamodel.rst:2833 +#: ../../reference/datamodel.rst:1581 ../../reference/datamodel.rst:2927 msgid "slice" msgstr "slice(切片)" -#: ../../reference/datamodel.rst:1493 +#: ../../reference/datamodel.rst:1587 msgid "start (slice object attribute)" msgstr "start (slice 物件屬性)" -#: ../../reference/datamodel.rst:1493 +#: ../../reference/datamodel.rst:1587 msgid "stop (slice object attribute)" msgstr "stop (slice 物件屬性)" -#: ../../reference/datamodel.rst:1493 +#: ../../reference/datamodel.rst:1587 msgid "step (slice object attribute)" msgstr "step (slice 物件屬性)" -#: ../../reference/datamodel.rst:1541 +#: ../../reference/datamodel.rst:1635 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/datamodel.rst:1541 +#: ../../reference/datamodel.rst:1635 msgid "overloading" msgstr "overloading(多載)" -#: ../../reference/datamodel.rst:1541 +#: ../../reference/datamodel.rst:1635 msgid "__getitem__() (mapping object method)" msgstr "__getitem__() (對映物件方法)" -#: ../../reference/datamodel.rst:1577 +#: ../../reference/datamodel.rst:1671 msgid "subclassing" msgstr "subclassing(子類別化)" -#: ../../reference/datamodel.rst:1577 +#: ../../reference/datamodel.rst:1671 msgid "immutable types" msgstr "immutable types(不可變型別)" -#: ../../reference/datamodel.rst:1606 +#: ../../reference/datamodel.rst:1700 msgid "constructor" msgstr "constructor(建構函式)" -#: ../../reference/datamodel.rst:1623 +#: ../../reference/datamodel.rst:1717 msgid "destructor" msgstr "destructor(解構函式)" -#: ../../reference/datamodel.rst:1623 +#: ../../reference/datamodel.rst:1717 msgid "finalizer" msgstr "finalizer(終結函式)" -#: ../../reference/datamodel.rst:1623 +#: ../../reference/datamodel.rst:1717 msgid "del" msgstr "del" -#: ../../reference/datamodel.rst:1687 +#: ../../reference/datamodel.rst:1781 msgid "repr() (built-in function)" msgstr "repr() (內建函式)" -#: ../../reference/datamodel.rst:1687 +#: ../../reference/datamodel.rst:1781 msgid "__repr__() (object method)" msgstr "__repr__() (物件方法)" -#: ../../reference/datamodel.rst:1704 +#: ../../reference/datamodel.rst:1798 msgid "__str__() (object method)" msgstr "__str__() (物件方法)" -#: ../../reference/datamodel.rst:1704 +#: ../../reference/datamodel.rst:1798 msgid "format() (built-in function)" msgstr "format() (內建函式)" -#: ../../reference/datamodel.rst:1704 +#: ../../reference/datamodel.rst:1798 msgid "print() (built-in function)" msgstr "print() (內建函式)" -#: ../../reference/datamodel.rst:1734 +#: ../../reference/datamodel.rst:1828 msgid "__format__() (object method)" msgstr "__format__() (物件方法)" -#: ../../reference/datamodel.rst:1734 +#: ../../reference/datamodel.rst:1828 msgid "conversion" msgstr "conversion" -#: ../../reference/datamodel.rst:1734 +#: ../../reference/datamodel.rst:1828 msgid "print" msgstr "print" -#: ../../reference/datamodel.rst:1773 +#: ../../reference/datamodel.rst:1867 msgid "comparisons" msgstr "comparison(比較)" -#: ../../reference/datamodel.rst:1818 +#: ../../reference/datamodel.rst:1912 msgid "hash" msgstr "hash(雜湊)" -#: ../../reference/datamodel.rst:1899 +#: ../../reference/datamodel.rst:1993 msgid "__len__() (mapping object method)" msgstr "__len__() (對映物件方法)" -#: ../../reference/datamodel.rst:2003 +#: ../../reference/datamodel.rst:2097 msgid "__getattr__ (module attribute)" msgstr "__getattr__ (模組屬性)" -#: ../../reference/datamodel.rst:2003 +#: ../../reference/datamodel.rst:2097 msgid "__dir__ (module attribute)" msgstr "__dir__ (模組屬性)" -#: ../../reference/datamodel.rst:2003 +#: ../../reference/datamodel.rst:2097 msgid "__class__ (module attribute)" msgstr "__class__ (模組屬性)" -#: ../../reference/datamodel.rst:2374 +#: ../../reference/datamodel.rst:2468 msgid "metaclass" msgstr "metaclass(元類別)" -#: ../../reference/datamodel.rst:2374 +#: ../../reference/datamodel.rst:2468 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/datamodel.rst:2374 +#: ../../reference/datamodel.rst:2468 msgid "class definition" msgstr "class definition(類別定義)" -#: ../../reference/datamodel.rst:2438 +#: ../../reference/datamodel.rst:2532 msgid "metaclass hint" msgstr "metaclass hint(元類別提示)" -#: ../../reference/datamodel.rst:2461 +#: ../../reference/datamodel.rst:2555 msgid "__prepare__ (metaclass method)" msgstr "__prepare__ (元類別方法)" -#: ../../reference/datamodel.rst:2485 +#: ../../reference/datamodel.rst:2579 msgid "body" msgstr "body" -#: ../../reference/datamodel.rst:2505 +#: ../../reference/datamodel.rst:2599 msgid "__class__ (method cell)" msgstr "__class__ (方法 cell)" -#: ../../reference/datamodel.rst:2505 +#: ../../reference/datamodel.rst:2599 msgid "__classcell__ (class namespace entry)" msgstr "__classcell__ (類別命名空間項目)" -#: ../../reference/datamodel.rst:2803 +#: ../../reference/datamodel.rst:2897 msgid "__bool__() (object method)" msgstr "__bool__() (物件方法)" -#: ../../reference/datamodel.rst:2961 ../../reference/datamodel.rst:2996 +#: ../../reference/datamodel.rst:3055 ../../reference/datamodel.rst:3090 msgid "divmod" msgstr "divmod" -#: ../../reference/datamodel.rst:2961 ../../reference/datamodel.rst:2996 -#: ../../reference/datamodel.rst:3010 +#: ../../reference/datamodel.rst:3055 ../../reference/datamodel.rst:3090 +#: ../../reference/datamodel.rst:3104 msgid "pow" msgstr "pow" -#: ../../reference/datamodel.rst:3059 +#: ../../reference/datamodel.rst:3153 msgid "abs" msgstr "abs" -#: ../../reference/datamodel.rst:3069 +#: ../../reference/datamodel.rst:3163 msgid "int" msgstr "int" -#: ../../reference/datamodel.rst:3069 +#: ../../reference/datamodel.rst:3163 msgid "float" msgstr "float" -#: ../../reference/datamodel.rst:3097 +#: ../../reference/datamodel.rst:3191 msgid "round" msgstr "round" -#: ../../reference/datamodel.rst:3124 +#: ../../reference/datamodel.rst:3218 msgid "with" msgstr "with" -#: ../../reference/datamodel.rst:3124 +#: ../../reference/datamodel.rst:3218 msgid "context manager" msgstr "context manager(情境管理器)" + +#~ msgid ":attr:`~definition.__name__`" +#~ msgstr ":attr:`~definition.__name__`" + +#~ msgid ":attr:`__module__`" +#~ msgstr ":attr:`__module__`" + +#~ msgid ":attr:`~object.__dict__`" +#~ msgstr ":attr:`~object.__dict__`" + +#~ msgid ":attr:`~class.__bases__`" +#~ msgstr ":attr:`~class.__bases__`" + +#~ msgid ":attr:`__type_params__`" +#~ msgstr ":attr:`__type_params__`" + +#~ msgid ":attr:`~class.__static_attributes__`" +#~ msgstr ":attr:`~class.__static_attributes__`" + +#~ msgid ":attr:`__firstlineno__`" +#~ msgstr ":attr:`__firstlineno__`" diff --git a/reference/executionmodel.po b/reference/executionmodel.po index ce819e1bf8..4dabdcd7f3 100644 --- a/reference/executionmodel.po +++ b/reference/executionmodel.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 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-" @@ -305,8 +305,8 @@ msgstr "" #: ../../reference/executionmodel.rst:208 msgid "" -"The bounds and constraints for type variables (:ref:`lazily evaluated <lazy-" -"evaluation>`)." +"The bounds, constraints, and default values for type parameters (:ref:" +"`lazily evaluated <lazy-evaluation>`)." msgstr "" #: ../../reference/executionmodel.rst:210 @@ -347,34 +347,40 @@ msgstr "" #: ../../reference/executionmodel.rst:227 msgid "" "While annotation scopes have an internal name, that name is not reflected in " -"the :term:`__qualname__ <qualified name>` of objects defined within the " -"scope. Instead, the :attr:`!__qualname__` of such objects is as if the " -"object were defined in the enclosing scope." +"the :term:`qualified name` of objects defined within the scope. Instead, " +"the :attr:`~definition.__qualname__` of such objects is as if the object " +"were defined in the enclosing scope." msgstr "" #: ../../reference/executionmodel.rst:232 msgid "Annotation scopes were introduced in Python 3.12 as part of :pep:`695`." msgstr "" -#: ../../reference/executionmodel.rst:238 +#: ../../reference/executionmodel.rst:235 +msgid "" +"Annotation scopes are also used for type parameter defaults, as introduced " +"by :pep:`696`." +msgstr "" + +#: ../../reference/executionmodel.rst:242 msgid "Lazy evaluation" msgstr "" -#: ../../reference/executionmodel.rst:240 +#: ../../reference/executionmodel.rst:244 msgid "" "The values of type aliases created through the :keyword:`type` statement are " -"*lazily evaluated*. The same applies to the bounds and constraints of type " -"variables created through the :ref:`type parameter syntax <type-params>`. " -"This means that they are not evaluated when the type alias or type variable " -"is created. Instead, they are only evaluated when doing so is necessary to " -"resolve an attribute access." +"*lazily evaluated*. The same applies to the bounds, constraints, and default " +"values of type variables created through the :ref:`type parameter syntax " +"<type-params>`. This means that they are not evaluated when the type alias " +"or type variable is created. Instead, they are only evaluated when doing so " +"is necessary to resolve an attribute access." msgstr "" -#: ../../reference/executionmodel.rst:247 +#: ../../reference/executionmodel.rst:251 msgid "Example:" msgstr "舉例來說:" -#: ../../reference/executionmodel.rst:249 +#: ../../reference/executionmodel.rst:253 msgid "" ">>> type Alias = 1/0\n" ">>> Alias.__value__\n" @@ -400,20 +406,20 @@ msgstr "" " ...\n" "ZeroDivisionError: division by zero" -#: ../../reference/executionmodel.rst:263 +#: ../../reference/executionmodel.rst:267 msgid "" "Here the exception is raised only when the ``__value__`` attribute of the " "type alias or the ``__bound__`` attribute of the type variable is accessed." msgstr "" -#: ../../reference/executionmodel.rst:267 +#: ../../reference/executionmodel.rst:271 msgid "" "This behavior is primarily useful for references to types that have not yet " "been defined when the type alias or type variable is created. For example, " "lazy evaluation enables creation of mutually recursive type aliases::" msgstr "" -#: ../../reference/executionmodel.rst:271 +#: ../../reference/executionmodel.rst:275 msgid "" "from typing import Literal\n" "\n" @@ -427,18 +433,18 @@ msgstr "" "type Parenthesized = tuple[Literal[\"(\"], Expr, Literal[\")\"]]\n" "type Expr = SimpleExpr | tuple[SimpleExpr, Literal[\"+\", \"-\"], Expr]" -#: ../../reference/executionmodel.rst:277 +#: ../../reference/executionmodel.rst:281 msgid "" "Lazily evaluated values are evaluated in :ref:`annotation scope <annotation-" "scopes>`, which means that names that appear inside the lazily evaluated " "value are looked up as if they were used in the immediately enclosing scope." msgstr "" -#: ../../reference/executionmodel.rst:286 +#: ../../reference/executionmodel.rst:290 msgid "Builtins and restricted execution" msgstr "" -#: ../../reference/executionmodel.rst:292 +#: ../../reference/executionmodel.rst:296 msgid "" "Users should not touch ``__builtins__``; it is strictly an implementation " "detail. Users wanting to override values in the builtins namespace should :" @@ -446,7 +452,7 @@ msgid "" "appropriately." msgstr "" -#: ../../reference/executionmodel.rst:297 +#: ../../reference/executionmodel.rst:301 msgid "" "The builtins namespace associated with the execution of a code block is " "actually found by looking up the name ``__builtins__`` in its global " @@ -457,17 +463,17 @@ msgid "" "`builtins` module itself." msgstr "" -#: ../../reference/executionmodel.rst:309 +#: ../../reference/executionmodel.rst:313 msgid "Interaction with dynamic features" msgstr "" -#: ../../reference/executionmodel.rst:311 +#: ../../reference/executionmodel.rst:315 msgid "" "Name resolution of free variables occurs at runtime, not at compile time. " "This means that the following code will print 42::" msgstr "" -#: ../../reference/executionmodel.rst:314 +#: ../../reference/executionmodel.rst:318 msgid "" "i = 10\n" "def f():\n" @@ -481,7 +487,7 @@ msgstr "" "i = 42\n" "f()" -#: ../../reference/executionmodel.rst:322 +#: ../../reference/executionmodel.rst:326 msgid "" "The :func:`eval` and :func:`exec` functions do not have access to the full " "environment for resolving names. Names may be resolved in the local and " @@ -492,11 +498,11 @@ msgid "" "for both." msgstr "" -#: ../../reference/executionmodel.rst:333 +#: ../../reference/executionmodel.rst:337 msgid "Exceptions" msgstr "例外" -#: ../../reference/executionmodel.rst:344 +#: ../../reference/executionmodel.rst:348 msgid "" "Exceptions are a means of breaking out of the normal flow of control of a " "code block in order to handle errors or other exceptional conditions. An " @@ -505,7 +511,7 @@ msgid "" "or indirectly invoked the code block where the error occurred." msgstr "" -#: ../../reference/executionmodel.rst:350 +#: ../../reference/executionmodel.rst:354 msgid "" "The Python interpreter raises an exception when it detects a run-time error " "(such as division by zero). A Python program can also explicitly raise an " @@ -516,7 +522,7 @@ msgid "" "exception occurred or not in the preceding code." msgstr "" -#: ../../reference/executionmodel.rst:360 +#: ../../reference/executionmodel.rst:364 msgid "" "Python uses the \"termination\" model of error handling: an exception " "handler can find out what happened and continue execution at an outer level, " @@ -524,7 +530,7 @@ msgid "" "(except by re-entering the offending piece of code from the top)." msgstr "" -#: ../../reference/executionmodel.rst:367 +#: ../../reference/executionmodel.rst:371 msgid "" "When an exception is not handled at all, the interpreter terminates " "execution of the program, or returns to its interactive main loop. In " @@ -532,7 +538,7 @@ msgid "" "`SystemExit`." msgstr "" -#: ../../reference/executionmodel.rst:371 +#: ../../reference/executionmodel.rst:375 msgid "" "Exceptions are identified by class instances. The :keyword:`except` clause " "is selected depending on the class of the instance: it must reference the " @@ -541,7 +547,7 @@ msgid "" "additional information about the exceptional condition." msgstr "" -#: ../../reference/executionmodel.rst:379 +#: ../../reference/executionmodel.rst:383 msgid "" "Exception messages are not part of the Python API. Their contents may " "change from one version of Python to the next without warning and should not " @@ -549,17 +555,17 @@ msgid "" "interpreter." msgstr "" -#: ../../reference/executionmodel.rst:383 +#: ../../reference/executionmodel.rst:387 msgid "" "See also the description of the :keyword:`try` statement in section :ref:" "`try` and :keyword:`raise` statement in section :ref:`raise`." msgstr "" -#: ../../reference/executionmodel.rst:388 +#: ../../reference/executionmodel.rst:392 msgid "Footnotes" msgstr "註解" -#: ../../reference/executionmodel.rst:389 +#: ../../reference/executionmodel.rst:393 msgid "" "This limitation occurs because the code that is executed by these operations " "is not available at the time the module is compiled." @@ -577,7 +583,7 @@ msgstr "code(程式碼)" msgid "block" msgstr "block" -#: ../../reference/executionmodel.rst:31 ../../reference/executionmodel.rst:288 +#: ../../reference/executionmodel.rst:31 ../../reference/executionmodel.rst:292 msgid "execution" msgstr "execution(執行)" @@ -637,38 +643,38 @@ msgstr "module(模組)" msgid "__main__" msgstr "__main__" -#: ../../reference/executionmodel.rst:288 +#: ../../reference/executionmodel.rst:292 msgid "restricted" msgstr "restricted(受限)" -#: ../../reference/executionmodel.rst:335 +#: ../../reference/executionmodel.rst:339 msgid "exception" msgstr "exception(例外)" -#: ../../reference/executionmodel.rst:337 +#: ../../reference/executionmodel.rst:341 msgid "raise an exception" msgstr "raise an exception(引發例外)" -#: ../../reference/executionmodel.rst:337 +#: ../../reference/executionmodel.rst:341 msgid "handle an exception" msgstr "handle an exception(處理例外)" -#: ../../reference/executionmodel.rst:337 +#: ../../reference/executionmodel.rst:341 msgid "exception handler" msgstr "exception handler(例外處理器)" -#: ../../reference/executionmodel.rst:337 +#: ../../reference/executionmodel.rst:341 msgid "errors" msgstr "errors(錯誤)" -#: ../../reference/executionmodel.rst:337 +#: ../../reference/executionmodel.rst:341 msgid "error handling" msgstr "error handling(錯誤處理)" -#: ../../reference/executionmodel.rst:358 +#: ../../reference/executionmodel.rst:362 msgid "termination model" msgstr "termination model(終止模型)" -#: ../../reference/executionmodel.rst:365 +#: ../../reference/executionmodel.rst:369 msgid "SystemExit (built-in exception)" msgstr "SystemExit(內建例外)" diff --git a/reference/expressions.po b/reference/expressions.po index 0b2d0e7ca2..959ecdaa17 100644 --- a/reference/expressions.po +++ b/reference/expressions.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-28 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-" @@ -138,8 +138,8 @@ msgstr "" #: ../../reference/expressions.rst:107 msgid "" -"The ``__name__`` attribute of nested functions, classes, and type aliases is " -"however not mangled." +"The :attr:`~definition.__name__` attribute of nested functions, classes, and " +"type aliases is however not mangled." msgstr "" #: ../../reference/expressions.rst:110 @@ -541,9 +541,9 @@ msgid "" "function. The execution starts when one of the generator's methods is " "called. At that time, the execution proceeds to the first yield expression, " "where it is suspended again, returning the value of :token:`~python-grammar:" -"expression_list` to the generator's caller, or ``None`` if :token:`~python-" -"grammar:expression_list` is omitted. By suspended, we mean that all local " -"state is retained, including the current bindings of local variables, the " +"yield_list` to the generator's caller, or ``None`` if :token:`~python-" +"grammar:yield_list` is omitted. By suspended, we mean that all local state " +"is retained, including the current bindings of local variables, the " "instruction pointer, the internal evaluation stack, and the state of any " "exception handling. When the execution is resumed by calling one of the " "generator's methods, the function can proceed exactly as if the yield " @@ -667,7 +667,7 @@ msgid "" "meth:`~generator.__next__` method, the current yield expression always " "evaluates to :const:`None`. The execution then continues to the next yield " "expression, where the generator is suspended again, and the value of the :" -"token:`~python-grammar:expression_list` is returned to :meth:`__next__`'s " +"token:`~python-grammar:yield_list` is returned to :meth:`__next__`'s " "caller. If the generator exits without yielding another value, a :exc:" "`StopIteration` exception is raised." msgstr "" @@ -715,7 +715,7 @@ msgid "" "*value* may be cleared." msgstr "" -#: ../../reference/expressions.rst:621 ../../reference/expressions.rst:795 +#: ../../reference/expressions.rst:621 ../../reference/expressions.rst:802 msgid "" "The second signature \\(type\\[, value\\[, traceback\\]\\]\\) is deprecated " "and may be removed in a future version of Python." @@ -724,25 +724,33 @@ msgstr "" #: ../../reference/expressions.rst:629 msgid "" "Raises a :exc:`GeneratorExit` at the point where the generator function was " -"paused. If the generator function then exits gracefully, is already closed, " -"or raises :exc:`GeneratorExit` (by not catching the exception), close " -"returns to its caller. If the generator yields a value, a :exc:" -"`RuntimeError` is raised. If the generator raises any other exception, it " -"is propagated to the caller. :meth:`close` does nothing if the generator " -"has already exited due to an exception or normal exit." +"paused. If the generator function catches the exception and returns a " +"value, this value is returned from :meth:`close`. If the generator function " +"is already closed, or raises :exc:`GeneratorExit` (by not catching the " +"exception), :meth:`close` returns :const:`None`. If the generator yields a " +"value, a :exc:`RuntimeError` is raised. If the generator raises any other " +"exception, it is propagated to the caller. If the generator has already " +"exited due to an exception or normal exit, :meth:`close` returns :const:" +"`None` and has no other effect." msgstr "" -#: ../../reference/expressions.rst:640 +#: ../../reference/expressions.rst:641 +msgid "" +"If a generator returns a value upon being closed, the value is returned by :" +"meth:`close`." +msgstr "" + +#: ../../reference/expressions.rst:647 msgid "Examples" msgstr "模組" -#: ../../reference/expressions.rst:642 +#: ../../reference/expressions.rst:649 msgid "" "Here is a simple example that demonstrates the behavior of generators and " "generator functions::" msgstr "" -#: ../../reference/expressions.rst:645 +#: ../../reference/expressions.rst:652 msgid "" ">>> def echo(value=None):\n" "... print(\"Execution starts when 'next()' is called for the first time." @@ -770,24 +778,24 @@ msgid "" "Don't forget to clean up when 'close()' is called." msgstr "" -#: ../../reference/expressions.rst:669 +#: ../../reference/expressions.rst:676 msgid "" "For examples using ``yield from``, see :ref:`pep-380` in \"What's New in " "Python.\"" msgstr "" -#: ../../reference/expressions.rst:675 +#: ../../reference/expressions.rst:682 msgid "Asynchronous generator functions" msgstr "" -#: ../../reference/expressions.rst:677 +#: ../../reference/expressions.rst:684 msgid "" "The presence of a yield expression in a function or method defined using :" "keyword:`async def` further defines the function as an :term:`asynchronous " "generator` function." msgstr "" -#: ../../reference/expressions.rst:681 +#: ../../reference/expressions.rst:688 msgid "" "When an asynchronous generator function is called, it returns an " "asynchronous iterator known as an asynchronous generator object. That object " @@ -797,26 +805,25 @@ msgid "" "keyword:`for` statement." msgstr "" -#: ../../reference/expressions.rst:688 +#: ../../reference/expressions.rst:695 msgid "" "Calling one of the asynchronous generator's methods returns an :term:" "`awaitable` object, and the execution starts when this object is awaited on. " "At that time, the execution proceeds to the first yield expression, where it " "is suspended again, returning the value of :token:`~python-grammar:" -"expression_list` to the awaiting coroutine. As with a generator, suspension " -"means that all local state is retained, including the current bindings of " -"local variables, the instruction pointer, the internal evaluation stack, and " -"the state of any exception handling. When the execution is resumed by " -"awaiting on the next object returned by the asynchronous generator's " -"methods, the function can proceed exactly as if the yield expression were " -"just another external call. The value of the yield expression after resuming " -"depends on the method which resumed the execution. If :meth:`~agen." -"__anext__` is used then the result is :const:`None`. Otherwise, if :meth:" -"`~agen.asend` is used, then the result will be the value passed in to that " -"method." +"yield_list` to the awaiting coroutine. As with a generator, suspension means " +"that all local state is retained, including the current bindings of local " +"variables, the instruction pointer, the internal evaluation stack, and the " +"state of any exception handling. When the execution is resumed by awaiting " +"on the next object returned by the asynchronous generator's methods, the " +"function can proceed exactly as if the yield expression were just another " +"external call. The value of the yield expression after resuming depends on " +"the method which resumed the execution. If :meth:`~agen.__anext__` is used " +"then the result is :const:`None`. Otherwise, if :meth:`~agen.asend` is used, " +"then the result will be the value passed in to that method." msgstr "" -#: ../../reference/expressions.rst:703 +#: ../../reference/expressions.rst:710 msgid "" "If an asynchronous generator happens to exit early by :keyword:`break`, the " "caller task being cancelled, or other exceptions, the generator's async " @@ -828,7 +835,7 @@ msgid "" "generator and ultimately detach it from the event loop." msgstr "" -#: ../../reference/expressions.rst:713 +#: ../../reference/expressions.rst:720 msgid "" "In an asynchronous generator function, yield expressions are allowed " "anywhere in a :keyword:`try` construct. However, if an asynchronous " @@ -842,7 +849,7 @@ msgid "" "finally` clauses to execute." msgstr "" -#: ../../reference/expressions.rst:724 +#: ../../reference/expressions.rst:731 msgid "" "To take care of finalization upon event loop termination, an event loop " "should define a *finalizer* function which takes an asynchronous generator-" @@ -855,30 +862,30 @@ msgid "" "asyncio/base_events.py`." msgstr "" -#: ../../reference/expressions.rst:733 +#: ../../reference/expressions.rst:740 msgid "" "The expression ``yield from <expr>`` is a syntax error when used in an " "asynchronous generator function." msgstr "" -#: ../../reference/expressions.rst:740 +#: ../../reference/expressions.rst:747 msgid "Asynchronous generator-iterator methods" msgstr "" -#: ../../reference/expressions.rst:742 +#: ../../reference/expressions.rst:749 msgid "" "This subsection describes the methods of an asynchronous generator iterator, " "which are used to control the execution of a generator function." msgstr "" -#: ../../reference/expressions.rst:750 +#: ../../reference/expressions.rst:757 msgid "" "Returns an awaitable which when run starts to execute the asynchronous " "generator or resumes it at the last executed yield expression. When an " "asynchronous generator function is resumed with an :meth:`~agen.__anext__` " "method, the current yield expression always evaluates to :const:`None` in " "the returned awaitable, which when run will continue to the next yield " -"expression. The value of the :token:`~python-grammar:expression_list` of the " +"expression. The value of the :token:`~python-grammar:yield_list` of the " "yield expression is the value of the :exc:`StopIteration` exception raised " "by the completing coroutine. If the asynchronous generator exits without " "yielding another value, the awaitable instead raises a :exc:" @@ -886,12 +893,12 @@ msgid "" "has completed." msgstr "" -#: ../../reference/expressions.rst:762 +#: ../../reference/expressions.rst:769 msgid "" "This method is normally called implicitly by a :keyword:`async for` loop." msgstr "" -#: ../../reference/expressions.rst:767 +#: ../../reference/expressions.rst:774 msgid "" "Returns an awaitable which when run resumes the execution of the " "asynchronous generator. As with the :meth:`~generator.send` method for a " @@ -906,7 +913,7 @@ msgid "" "receive the value." msgstr "" -#: ../../reference/expressions.rst:783 +#: ../../reference/expressions.rst:790 msgid "" "Returns an awaitable that raises an exception of type ``type`` at the point " "where the asynchronous generator was paused, and returns the next value " @@ -918,7 +925,7 @@ msgid "" "that exception propagates to the caller of the awaitable." msgstr "" -#: ../../reference/expressions.rst:803 +#: ../../reference/expressions.rst:810 msgid "" "Returns an awaitable that when run will throw a :exc:`GeneratorExit` into " "the asynchronous generator function at the point where it was paused. If the " @@ -934,25 +941,25 @@ msgid "" "will return an awaitable that does nothing." msgstr "" -#: ../../reference/expressions.rst:819 +#: ../../reference/expressions.rst:826 msgid "Primaries" msgstr "" -#: ../../reference/expressions.rst:823 +#: ../../reference/expressions.rst:830 msgid "" "Primaries represent the most tightly bound operations of the language. Their " "syntax is:" msgstr "" -#: ../../reference/expressions.rst:833 +#: ../../reference/expressions.rst:840 msgid "Attribute references" msgstr "" -#: ../../reference/expressions.rst:839 +#: ../../reference/expressions.rst:846 msgid "An attribute reference is a primary followed by a period and a name:" msgstr "" -#: ../../reference/expressions.rst:849 +#: ../../reference/expressions.rst:856 msgid "" "The primary must evaluate to an object of a type that supports attribute " "references, which most objects do. This object is then asked to produce the " @@ -961,7 +968,7 @@ msgid "" "reference may yield different objects." msgstr "" -#: ../../reference/expressions.rst:855 +#: ../../reference/expressions.rst:862 msgid "" "This production can be customized by overriding the :meth:`~object." "__getattribute__` method or the :meth:`~object.__getattr__` method. The :" @@ -969,17 +976,17 @@ msgid "" "or raises :exc:`AttributeError` if the attribute is not available." msgstr "" -#: ../../reference/expressions.rst:861 +#: ../../reference/expressions.rst:868 msgid "" "If an :exc:`AttributeError` is raised and the object has a :meth:`!" "__getattr__` method, that method is called as a fallback." msgstr "" -#: ../../reference/expressions.rst:867 +#: ../../reference/expressions.rst:874 msgid "Subscriptions" msgstr "" -#: ../../reference/expressions.rst:882 +#: ../../reference/expressions.rst:889 msgid "" "The subscription of an instance of a :ref:`container class <sequence-types>` " "will generally select an element from the container. The subscription of a :" @@ -987,13 +994,13 @@ msgid "" "`GenericAlias <types-genericalias>` object." msgstr "" -#: ../../reference/expressions.rst:890 +#: ../../reference/expressions.rst:897 msgid "" "When an object is subscripted, the interpreter will evaluate the primary and " "the expression list." msgstr "" -#: ../../reference/expressions.rst:893 +#: ../../reference/expressions.rst:900 msgid "" "The primary must evaluate to an object that supports subscription. An object " "may support subscription through defining one or both of :meth:`~object." @@ -1003,20 +1010,25 @@ msgid "" "called instead of ``__getitem__``, see :ref:`classgetitem-versus-getitem`." msgstr "" -#: ../../reference/expressions.rst:900 +#: ../../reference/expressions.rst:907 msgid "" -"If the expression list contains at least one comma, it will evaluate to a :" -"class:`tuple` containing the items of the expression list. Otherwise, the " +"If the expression list contains at least one comma, or if any of the " +"expressions are starred, the expression list will evaluate to a :class:" +"`tuple` containing the items of the expression list. Otherwise, the " "expression list will evaluate to the value of the list's sole member." msgstr "" -#: ../../reference/expressions.rst:904 +#: ../../reference/expressions.rst:912 +msgid "Expressions in an expression list may be starred. See :pep:`646`." +msgstr "" + +#: ../../reference/expressions.rst:915 msgid "" "For built-in objects, there are two types of objects that support " "subscription via :meth:`~object.__getitem__`:" msgstr "" -#: ../../reference/expressions.rst:907 +#: ../../reference/expressions.rst:918 msgid "" "Mappings. If the primary is a :term:`mapping`, the expression list must " "evaluate to an object whose value is one of the keys of the mapping, and the " @@ -1024,7 +1036,7 @@ msgid "" "An example of a builtin mapping class is the :class:`dict` class." msgstr "" -#: ../../reference/expressions.rst:911 +#: ../../reference/expressions.rst:922 msgid "" "Sequences. If the primary is a :term:`sequence`, the expression list must " "evaluate to an :class:`int` or a :class:`slice` (as discussed in the " @@ -1032,7 +1044,7 @@ msgid "" "`str`, :class:`list` and :class:`tuple` classes." msgstr "" -#: ../../reference/expressions.rst:916 +#: ../../reference/expressions.rst:927 msgid "" "The formal syntax makes no special provision for negative indices in :term:" "`sequences <sequence>`. However, built-in sequences all provide a :meth:" @@ -1046,25 +1058,25 @@ msgid "" "explicitly add that support." msgstr "" -#: ../../reference/expressions.rst:930 +#: ../../reference/expressions.rst:941 msgid "" "A :class:`string <str>` is a special kind of sequence whose items are " "*characters*. A character is not a separate data type but a string of " "exactly one character." msgstr "" -#: ../../reference/expressions.rst:938 +#: ../../reference/expressions.rst:949 msgid "Slicings" msgstr "" -#: ../../reference/expressions.rst:952 +#: ../../reference/expressions.rst:963 msgid "" "A slicing selects a range of items in a sequence object (e.g., a string, " "tuple or list). Slicings may be used as expressions or as targets in " "assignment or :keyword:`del` statements. The syntax for a slicing:" msgstr "" -#: ../../reference/expressions.rst:965 +#: ../../reference/expressions.rst:976 msgid "" "There is ambiguity in the formal syntax here: anything that looks like an " "expression list also looks like a slice list, so any subscription can be " @@ -1074,7 +1086,7 @@ msgid "" "the case if the slice list contains no proper slice)." msgstr "" -#: ../../reference/expressions.rst:977 +#: ../../reference/expressions.rst:988 msgid "" "The semantics for a slicing are as follows. The primary is indexed (using " "the same :meth:`~object.__getitem__` method as normal subscription) with a " @@ -1089,23 +1101,23 @@ msgid "" "missing expressions." msgstr "" -#: ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1012 msgid "Calls" msgstr "" -#: ../../reference/expressions.rst:1003 +#: ../../reference/expressions.rst:1014 msgid "" "A call calls a callable object (e.g., a :term:`function`) with a possibly " "empty series of :term:`arguments <argument>`:" msgstr "" -#: ../../reference/expressions.rst:1020 +#: ../../reference/expressions.rst:1031 msgid "" "An optional trailing comma may be present after the positional and keyword " "arguments but does not affect the semantics." msgstr "" -#: ../../reference/expressions.rst:1026 +#: ../../reference/expressions.rst:1037 msgid "" "The primary must evaluate to a callable object (user-defined functions, " "built-in functions, methods of built-in objects, class objects, methods of " @@ -1115,7 +1127,7 @@ msgid "" "formal :term:`parameter` lists." msgstr "" -#: ../../reference/expressions.rst:1034 +#: ../../reference/expressions.rst:1045 msgid "" "If keyword arguments are present, they are first converted to positional " "arguments, as follows. First, a list of unfilled slots is created for the " @@ -1136,7 +1148,7 @@ msgid "" "filled slots is used as the argument list for the call." msgstr "" -#: ../../reference/expressions.rst:1054 +#: ../../reference/expressions.rst:1065 msgid "" "An implementation may provide built-in functions whose positional parameters " "do not have names, even if they are 'named' for the purpose of " @@ -1145,7 +1157,7 @@ msgid "" "`PyArg_ParseTuple` to parse their arguments." msgstr "" -#: ../../reference/expressions.rst:1060 +#: ../../reference/expressions.rst:1071 msgid "" "If there are more positional arguments than there are formal parameter " "slots, a :exc:`TypeError` exception is raised, unless a formal parameter " @@ -1154,7 +1166,7 @@ msgid "" "empty tuple if there were no excess positional arguments)." msgstr "" -#: ../../reference/expressions.rst:1066 +#: ../../reference/expressions.rst:1077 msgid "" "If any keyword argument does not correspond to a formal parameter name, a :" "exc:`TypeError` exception is raised, unless a formal parameter using the " @@ -1164,7 +1176,7 @@ msgid "" "(new) empty dictionary if there were no excess keyword arguments." msgstr "" -#: ../../reference/expressions.rst:1077 +#: ../../reference/expressions.rst:1088 msgid "" "If the syntax ``*expression`` appears in the function call, ``expression`` " "must evaluate to an :term:`iterable`. Elements from these iterables are " @@ -1174,14 +1186,14 @@ msgid "" "*y1*, ..., *yM*, *x3*, *x4*." msgstr "" -#: ../../reference/expressions.rst:1084 +#: ../../reference/expressions.rst:1095 msgid "" "A consequence of this is that although the ``*expression`` syntax may appear " "*after* explicit keyword arguments, it is processed *before* the keyword " "arguments (and any ``**expression`` arguments -- see below). So::" msgstr "" -#: ../../reference/expressions.rst:1088 +#: ../../reference/expressions.rst:1099 msgid "" ">>> def f(a, b):\n" "... print(a, b)\n" @@ -1207,13 +1219,13 @@ msgstr "" ">>> f(1, *(2,))\n" "1 2" -#: ../../reference/expressions.rst:1100 +#: ../../reference/expressions.rst:1111 msgid "" "It is unusual for both keyword arguments and the ``*expression`` syntax to " "be used in the same call, so in practice this confusion does not often arise." msgstr "" -#: ../../reference/expressions.rst:1106 +#: ../../reference/expressions.rst:1117 msgid "" "If the syntax ``**expression`` appears in the function call, ``expression`` " "must evaluate to a :term:`mapping`, the contents of which are treated as " @@ -1222,7 +1234,7 @@ msgid "" "a :exc:`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1112 +#: ../../reference/expressions.rst:1123 msgid "" "When ``**expression`` is used, each key in this mapping must be a string. " "Each value from the mapping is assigned to the first formal parameter " @@ -1234,35 +1246,35 @@ msgid "" "is raised." msgstr "" -#: ../../reference/expressions.rst:1122 +#: ../../reference/expressions.rst:1133 msgid "" "Formal parameters using the syntax ``*identifier`` or ``**identifier`` " "cannot be used as positional argument slots or as keyword argument names." msgstr "" -#: ../../reference/expressions.rst:1125 +#: ../../reference/expressions.rst:1136 msgid "" "Function calls accept any number of ``*`` and ``**`` unpackings, positional " "arguments may follow iterable unpackings (``*``), and keyword arguments may " "follow dictionary unpackings (``**``). Originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1131 +#: ../../reference/expressions.rst:1142 msgid "" "A call always returns some value, possibly ``None``, unless it raises an " "exception. How this value is computed depends on the type of the callable " "object." msgstr "" -#: ../../reference/expressions.rst:1135 +#: ../../reference/expressions.rst:1146 msgid "If it is---" msgstr "" -#: ../../reference/expressions.rst:1137 +#: ../../reference/expressions.rst:1148 msgid "a user-defined function:" msgstr "" -#: ../../reference/expressions.rst:1144 +#: ../../reference/expressions.rst:1155 msgid "" "The code block for the function is executed, passing it the argument list. " "The first thing the code block will do is bind the formal parameters to the " @@ -1271,73 +1283,73 @@ msgid "" "value of the function call." msgstr "" -#: ../../reference/expressions.rst:1150 +#: ../../reference/expressions.rst:1161 msgid "a built-in function or method:" msgstr "" -#: ../../reference/expressions.rst:1161 +#: ../../reference/expressions.rst:1172 msgid "" "The result is up to the interpreter; see :ref:`built-in-funcs` for the " "descriptions of built-in functions and methods." msgstr "" -#: ../../reference/expressions.rst:1164 +#: ../../reference/expressions.rst:1175 msgid "a class object:" msgstr "" -#: ../../reference/expressions.rst:1169 +#: ../../reference/expressions.rst:1180 msgid "A new instance of that class is returned." msgstr "" -#: ../../reference/expressions.rst:1171 +#: ../../reference/expressions.rst:1182 msgid "a class instance method:" msgstr "" -#: ../../reference/expressions.rst:1177 +#: ../../reference/expressions.rst:1188 msgid "" "The corresponding user-defined function is called, with an argument list " "that is one longer than the argument list of the call: the instance becomes " "the first argument." msgstr "" -#: ../../reference/expressions.rst:1181 +#: ../../reference/expressions.rst:1192 msgid "a class instance:" msgstr "" -#: ../../reference/expressions.rst:1186 +#: ../../reference/expressions.rst:1197 msgid "" "The class must define a :meth:`~object.__call__` method; the effect is then " "the same as if that method was called." msgstr "" -#: ../../reference/expressions.rst:1194 ../../reference/expressions.rst:1987 +#: ../../reference/expressions.rst:1205 ../../reference/expressions.rst:2004 msgid "Await expression" msgstr "" -#: ../../reference/expressions.rst:1196 +#: ../../reference/expressions.rst:1207 msgid "" "Suspend the execution of :term:`coroutine` on an :term:`awaitable` object. " "Can only be used inside a :term:`coroutine function`." msgstr "" -#: ../../reference/expressions.rst:1208 +#: ../../reference/expressions.rst:1219 msgid "The power operator" msgstr "" -#: ../../reference/expressions.rst:1214 +#: ../../reference/expressions.rst:1225 msgid "" "The power operator binds more tightly than unary operators on its left; it " "binds less tightly than unary operators on its right. The syntax is:" msgstr "" -#: ../../reference/expressions.rst:1220 +#: ../../reference/expressions.rst:1231 msgid "" "Thus, in an unparenthesized sequence of power and unary operators, the " "operators are evaluated from right to left (this does not constrain the " "evaluation order for the operands): ``-1**2`` results in ``-1``." msgstr "" -#: ../../reference/expressions.rst:1224 +#: ../../reference/expressions.rst:1235 msgid "" "The power operator has the same semantics as the built-in :func:`pow` " "function, when called with two arguments: it yields its left argument raised " @@ -1345,7 +1357,7 @@ msgid "" "converted to a common type, and the result is of that type." msgstr "" -#: ../../reference/expressions.rst:1229 +#: ../../reference/expressions.rst:1240 msgid "" "For int operands, the result has the same type as the operands unless the " "second argument is negative; in that case, all arguments are converted to " @@ -1353,41 +1365,41 @@ msgid "" "``100``, but ``10**-2`` returns ``0.01``." msgstr "" -#: ../../reference/expressions.rst:1234 +#: ../../reference/expressions.rst:1245 msgid "" "Raising ``0.0`` to a negative power results in a :exc:`ZeroDivisionError`. " "Raising a negative number to a fractional power results in a :class:" "`complex` number. (In earlier versions it raised a :exc:`ValueError`.)" msgstr "" -#: ../../reference/expressions.rst:1238 +#: ../../reference/expressions.rst:1249 msgid "" "This operation can be customized using the special :meth:`~object.__pow__` " "and :meth:`~object.__rpow__` methods." msgstr "" -#: ../../reference/expressions.rst:1244 +#: ../../reference/expressions.rst:1255 msgid "Unary arithmetic and bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1250 +#: ../../reference/expressions.rst:1261 msgid "All unary arithmetic and bitwise operations have the same priority:" msgstr "" -#: ../../reference/expressions.rst:1261 +#: ../../reference/expressions.rst:1272 msgid "" "The unary ``-`` (minus) operator yields the negation of its numeric " "argument; the operation can be overridden with the :meth:`~object.__neg__` " "special method." msgstr "" -#: ../../reference/expressions.rst:1269 +#: ../../reference/expressions.rst:1280 msgid "" "The unary ``+`` (plus) operator yields its numeric argument unchanged; the " "operation can be overridden with the :meth:`~object.__pos__` special method." msgstr "" -#: ../../reference/expressions.rst:1276 +#: ../../reference/expressions.rst:1287 msgid "" "The unary ``~`` (invert) operator yields the bitwise inversion of its " "integer argument. The bitwise inversion of ``x`` is defined as ``-(x+1)``. " @@ -1395,17 +1407,17 @@ msgid "" "meth:`~object.__invert__` special method." msgstr "" -#: ../../reference/expressions.rst:1285 +#: ../../reference/expressions.rst:1296 msgid "" "In all three cases, if the argument does not have the proper type, a :exc:" "`TypeError` exception is raised." msgstr "" -#: ../../reference/expressions.rst:1292 +#: ../../reference/expressions.rst:1303 msgid "Binary arithmetic operations" msgstr "" -#: ../../reference/expressions.rst:1296 +#: ../../reference/expressions.rst:1307 msgid "" "The binary arithmetic operations have the conventional priority levels. " "Note that some of these operations also apply to certain non-numeric types. " @@ -1413,7 +1425,7 @@ msgid "" "multiplicative operators and one for additive operators:" msgstr "" -#: ../../reference/expressions.rst:1311 +#: ../../reference/expressions.rst:1322 msgid "" "The ``*`` (multiplication) operator yields the product of its arguments. " "The arguments must either both be numbers, or one argument must be an " @@ -1423,25 +1435,25 @@ msgid "" "an empty sequence." msgstr "" -#: ../../reference/expressions.rst:1317 +#: ../../reference/expressions.rst:1328 msgid "" "This operation can be customized using the special :meth:`~object.__mul__` " "and :meth:`~object.__rmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1324 +#: ../../reference/expressions.rst:1335 msgid "" "The ``@`` (at) operator is intended to be used for matrix multiplication. " "No builtin Python types implement this operator." msgstr "" -#: ../../reference/expressions.rst:1327 +#: ../../reference/expressions.rst:1338 msgid "" "This operation can be customized using the special :meth:`~object." "__matmul__` and :meth:`~object.__rmatmul__` methods." msgstr "" -#: ../../reference/expressions.rst:1338 +#: ../../reference/expressions.rst:1349 msgid "" "The ``/`` (division) and ``//`` (floor division) operators yield the " "quotient of their arguments. The numeric arguments are first converted to a " @@ -1451,7 +1463,7 @@ msgid "" "the :exc:`ZeroDivisionError` exception." msgstr "" -#: ../../reference/expressions.rst:1345 +#: ../../reference/expressions.rst:1356 msgid "" "The division operation can be customized using the special :meth:`~object." "__truediv__` and :meth:`~object.__rtruediv__` methods. The floor division " @@ -1459,7 +1471,7 @@ msgid "" "and :meth:`~object.__rfloordiv__` methods." msgstr "" -#: ../../reference/expressions.rst:1354 +#: ../../reference/expressions.rst:1365 msgid "" "The ``%`` (modulo) operator yields the remainder from the division of the " "first argument by the second. The numeric arguments are first converted to " @@ -1471,7 +1483,7 @@ msgid "" "absolute value of the second operand [#]_." msgstr "" -#: ../../reference/expressions.rst:1363 +#: ../../reference/expressions.rst:1374 msgid "" "The floor division and modulo operators are connected by the following " "identity: ``x == (x//y)*y + (x%y)``. Floor division and modulo are also " @@ -1479,7 +1491,7 @@ msgid "" "y, x%y)``. [#]_." msgstr "" -#: ../../reference/expressions.rst:1368 +#: ../../reference/expressions.rst:1379 msgid "" "In addition to performing the modulo operation on numbers, the ``%`` " "operator is also overloaded by string objects to perform old-style string " @@ -1488,20 +1500,20 @@ msgid "" "formatting`." msgstr "" -#: ../../reference/expressions.rst:1373 +#: ../../reference/expressions.rst:1384 msgid "" "The *modulo* operation can be customized using the special :meth:`~object." "__mod__` and :meth:`~object.__rmod__` methods." msgstr "" -#: ../../reference/expressions.rst:1376 +#: ../../reference/expressions.rst:1387 msgid "" "The floor division operator, the modulo operator, and the :func:`divmod` " "function are not defined for complex numbers. Instead, convert to a " "floating-point number using the :func:`abs` function if appropriate." msgstr "" -#: ../../reference/expressions.rst:1385 +#: ../../reference/expressions.rst:1396 msgid "" "The ``+`` (addition) operator yields the sum of its arguments. The " "arguments must either both be numbers or both be sequences of the same " @@ -1509,40 +1521,40 @@ msgid "" "then added together. In the latter case, the sequences are concatenated." msgstr "" -#: ../../reference/expressions.rst:1390 +#: ../../reference/expressions.rst:1401 msgid "" "This operation can be customized using the special :meth:`~object.__add__` " "and :meth:`~object.__radd__` methods." msgstr "" -#: ../../reference/expressions.rst:1398 +#: ../../reference/expressions.rst:1409 msgid "" "The ``-`` (subtraction) operator yields the difference of its arguments. " "The numeric arguments are first converted to a common type." msgstr "" -#: ../../reference/expressions.rst:1401 +#: ../../reference/expressions.rst:1412 msgid "" "This operation can be customized using the special :meth:`~object.__sub__` " "and :meth:`~object.__rsub__` methods." msgstr "" -#: ../../reference/expressions.rst:1408 +#: ../../reference/expressions.rst:1419 msgid "Shifting operations" msgstr "" -#: ../../reference/expressions.rst:1415 +#: ../../reference/expressions.rst:1426 msgid "" "The shifting operations have lower priority than the arithmetic operations:" msgstr "" -#: ../../reference/expressions.rst:1420 +#: ../../reference/expressions.rst:1431 msgid "" "These operators accept integers as arguments. They shift the first argument " "to the left or right by the number of bits given by the second argument." msgstr "" -#: ../../reference/expressions.rst:1423 +#: ../../reference/expressions.rst:1434 msgid "" "The left shift operation can be customized using the special :meth:`~object." "__lshift__` and :meth:`~object.__rlshift__` methods. The right shift " @@ -1550,46 +1562,46 @@ msgid "" "and :meth:`~object.__rrshift__` methods." msgstr "" -#: ../../reference/expressions.rst:1430 +#: ../../reference/expressions.rst:1441 msgid "" "A right shift by *n* bits is defined as floor division by ``pow(2,n)``. A " "left shift by *n* bits is defined as multiplication with ``pow(2,n)``." msgstr "" -#: ../../reference/expressions.rst:1437 +#: ../../reference/expressions.rst:1448 msgid "Binary bitwise operations" msgstr "" -#: ../../reference/expressions.rst:1441 +#: ../../reference/expressions.rst:1452 msgid "Each of the three bitwise operations has a different priority level:" msgstr "" -#: ../../reference/expressions.rst:1452 +#: ../../reference/expressions.rst:1463 msgid "" "The ``&`` operator yields the bitwise AND of its arguments, which must be " "integers or one of them must be a custom object overriding :meth:`~object." "__and__` or :meth:`~object.__rand__` special methods." msgstr "" -#: ../../reference/expressions.rst:1461 +#: ../../reference/expressions.rst:1472 msgid "" "The ``^`` operator yields the bitwise XOR (exclusive OR) of its arguments, " "which must be integers or one of them must be a custom object overriding :" "meth:`~object.__xor__` or :meth:`~object.__rxor__` special methods." msgstr "" -#: ../../reference/expressions.rst:1470 +#: ../../reference/expressions.rst:1481 msgid "" "The ``|`` operator yields the bitwise (inclusive) OR of its arguments, which " "must be integers or one of them must be a custom object overriding :meth:" "`~object.__or__` or :meth:`~object.__ror__` special methods." msgstr "" -#: ../../reference/expressions.rst:1478 +#: ../../reference/expressions.rst:1489 msgid "Comparisons" msgstr "" -#: ../../reference/expressions.rst:1490 +#: ../../reference/expressions.rst:1501 msgid "" "Unlike C, all comparison operations in Python have the same priority, which " "is lower than that of any arithmetic, shifting or bitwise operation. Also " @@ -1597,14 +1609,14 @@ msgid "" "conventional in mathematics:" msgstr "" -#: ../../reference/expressions.rst:1500 +#: ../../reference/expressions.rst:1511 msgid "" "Comparisons yield boolean values: ``True`` or ``False``. Custom :dfn:`rich " "comparison methods` may return non-boolean values. In this case Python will " "call :func:`bool` on such value in boolean contexts." msgstr "" -#: ../../reference/expressions.rst:1506 +#: ../../reference/expressions.rst:1517 msgid "" "Comparisons can be chained arbitrarily, e.g., ``x < y <= z`` is equivalent " "to ``x < y and y <= z``, except that ``y`` is evaluated only once (but in " @@ -1612,7 +1624,7 @@ msgid "" "false)." msgstr "" -#: ../../reference/expressions.rst:1510 +#: ../../reference/expressions.rst:1521 msgid "" "Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*, " "*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y opN " @@ -1620,24 +1632,24 @@ msgid "" "each expression is evaluated at most once." msgstr "" -#: ../../reference/expressions.rst:1515 +#: ../../reference/expressions.rst:1526 msgid "" "Note that ``a op1 b op2 c`` doesn't imply any kind of comparison between *a* " "and *c*, so that, e.g., ``x < y > z`` is perfectly legal (though perhaps not " "pretty)." msgstr "" -#: ../../reference/expressions.rst:1522 +#: ../../reference/expressions.rst:1533 msgid "Value comparisons" msgstr "" -#: ../../reference/expressions.rst:1524 +#: ../../reference/expressions.rst:1535 msgid "" "The operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare the " "values of two objects. The objects do not need to have the same type." msgstr "" -#: ../../reference/expressions.rst:1527 +#: ../../reference/expressions.rst:1538 msgid "" "Chapter :ref:`objects` states that objects have a value (in addition to type " "and identity). The value of an object is a rather abstract notion in " @@ -1649,7 +1661,7 @@ msgid "" "indirectly, by means of their comparison implementation." msgstr "" -#: ../../reference/expressions.rst:1536 +#: ../../reference/expressions.rst:1547 msgid "" "Because all types are (direct or indirect) subtypes of :class:`object`, they " "inherit the default comparison behavior from :class:`object`. Types can " @@ -1657,7 +1669,7 @@ msgid "" "methods` like :meth:`~object.__lt__`, described in :ref:`customization`." msgstr "" -#: ../../reference/expressions.rst:1542 +#: ../../reference/expressions.rst:1553 msgid "" "The default behavior for equality comparison (``==`` and ``!=``) is based on " "the identity of the objects. Hence, equality comparison of instances with " @@ -1667,14 +1679,14 @@ msgid "" "``x is y`` implies ``x == y``)." msgstr "" -#: ../../reference/expressions.rst:1549 +#: ../../reference/expressions.rst:1560 msgid "" "A default order comparison (``<``, ``>``, ``<=``, and ``>=``) is not " "provided; an attempt raises :exc:`TypeError`. A motivation for this default " "behavior is the lack of a similar invariant as for equality." msgstr "" -#: ../../reference/expressions.rst:1553 +#: ../../reference/expressions.rst:1564 msgid "" "The behavior of the default equality comparison, that instances with " "different identities are always unequal, may be in contrast to what types " @@ -1683,13 +1695,13 @@ msgid "" "in fact, a number of built-in types have done that." msgstr "" -#: ../../reference/expressions.rst:1559 +#: ../../reference/expressions.rst:1570 msgid "" "The following list describes the comparison behavior of the most important " "built-in types." msgstr "" -#: ../../reference/expressions.rst:1562 +#: ../../reference/expressions.rst:1573 msgid "" "Numbers of built-in numeric types (:ref:`typesnumeric`) and of the standard " "library types :class:`fractions.Fraction` and :class:`decimal.Decimal` can " @@ -1699,7 +1711,7 @@ msgid "" "of precision." msgstr "" -#: ../../reference/expressions.rst:1569 +#: ../../reference/expressions.rst:1580 msgid "" "The not-a-number values ``float('NaN')`` and ``decimal.Decimal('NaN')`` are " "special. Any ordered comparison of a number to a not-a-number value is " @@ -1709,32 +1721,32 @@ msgid "" "is compliant with IEEE 754." msgstr "" -#: ../../reference/expressions.rst:1576 +#: ../../reference/expressions.rst:1587 msgid "" "``None`` and :data:`NotImplemented` are singletons. :PEP:`8` advises that " "comparisons for singletons should always be done with ``is`` or ``is not``, " "never the equality operators." msgstr "" -#: ../../reference/expressions.rst:1580 +#: ../../reference/expressions.rst:1591 msgid "" "Binary sequences (instances of :class:`bytes` or :class:`bytearray`) can be " "compared within and across their types. They compare lexicographically " "using the numeric values of their elements." msgstr "" -#: ../../reference/expressions.rst:1584 +#: ../../reference/expressions.rst:1595 msgid "" "Strings (instances of :class:`str`) compare lexicographically using the " "numerical Unicode code points (the result of the built-in function :func:" "`ord`) of their characters. [#]_" msgstr "" -#: ../../reference/expressions.rst:1588 +#: ../../reference/expressions.rst:1599 msgid "Strings and binary sequences cannot be directly compared." msgstr "" -#: ../../reference/expressions.rst:1590 +#: ../../reference/expressions.rst:1601 msgid "" "Sequences (instances of :class:`tuple`, :class:`list`, or :class:`range`) " "can be compared only within each of their types, with the restriction that " @@ -1743,7 +1755,7 @@ msgid "" "raises :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1596 +#: ../../reference/expressions.rst:1607 msgid "" "Sequences compare lexicographically using comparison of corresponding " "elements. The built-in containers typically assume identical objects are " @@ -1751,19 +1763,19 @@ msgid "" "objects to improve performance and to maintain their internal invariants." msgstr "" -#: ../../reference/expressions.rst:1601 +#: ../../reference/expressions.rst:1612 msgid "" "Lexicographical comparison between built-in collections works as follows:" msgstr "" -#: ../../reference/expressions.rst:1603 +#: ../../reference/expressions.rst:1614 msgid "" "For two collections to compare equal, they must be of the same type, have " "the same length, and each pair of corresponding elements must compare equal " "(for example, ``[1,2] == (1,2)`` is false because the type is not the same)." msgstr "" -#: ../../reference/expressions.rst:1608 +#: ../../reference/expressions.rst:1619 msgid "" "Collections that support order comparison are ordered the same as their " "first unequal elements (for example, ``[1,2,x] <= [1,2,y]`` has the same " @@ -1772,25 +1784,25 @@ msgid "" "true)." msgstr "" -#: ../../reference/expressions.rst:1614 +#: ../../reference/expressions.rst:1625 msgid "" "Mappings (instances of :class:`dict`) compare equal if and only if they have " "equal ``(key, value)`` pairs. Equality comparison of the keys and values " "enforces reflexivity." msgstr "" -#: ../../reference/expressions.rst:1618 +#: ../../reference/expressions.rst:1629 msgid "" "Order comparisons (``<``, ``>``, ``<=``, and ``>=``) raise :exc:`TypeError`." msgstr "" -#: ../../reference/expressions.rst:1620 +#: ../../reference/expressions.rst:1631 msgid "" "Sets (instances of :class:`set` or :class:`frozenset`) can be compared " "within and across their types." msgstr "" -#: ../../reference/expressions.rst:1623 +#: ../../reference/expressions.rst:1634 msgid "" "They define order comparison operators to mean subset and superset tests. " "Those relations do not define total orderings (for example, the two sets " @@ -1801,110 +1813,110 @@ msgid "" "sets as inputs)." msgstr "" -#: ../../reference/expressions.rst:1631 +#: ../../reference/expressions.rst:1642 msgid "Comparison of sets enforces reflexivity of its elements." msgstr "" -#: ../../reference/expressions.rst:1633 +#: ../../reference/expressions.rst:1644 msgid "" "Most other built-in types have no comparison methods implemented, so they " "inherit the default comparison behavior." msgstr "" -#: ../../reference/expressions.rst:1636 +#: ../../reference/expressions.rst:1647 msgid "" "User-defined classes that customize their comparison behavior should follow " "some consistency rules, if possible:" msgstr "" -#: ../../reference/expressions.rst:1639 +#: ../../reference/expressions.rst:1650 msgid "" "Equality comparison should be reflexive. In other words, identical objects " "should compare equal:" msgstr "" -#: ../../reference/expressions.rst:1642 +#: ../../reference/expressions.rst:1653 msgid "``x is y`` implies ``x == y``" msgstr "" -#: ../../reference/expressions.rst:1644 +#: ../../reference/expressions.rst:1655 msgid "" "Comparison should be symmetric. In other words, the following expressions " "should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1647 +#: ../../reference/expressions.rst:1658 msgid "``x == y`` and ``y == x``" msgstr "``x == y`` 和 ``y == x``" -#: ../../reference/expressions.rst:1649 +#: ../../reference/expressions.rst:1660 msgid "``x != y`` and ``y != x``" msgstr "``x != y`` 和 ``y != x``" -#: ../../reference/expressions.rst:1651 +#: ../../reference/expressions.rst:1662 msgid "``x < y`` and ``y > x``" msgstr "``x < y`` 和 ``y > x``" -#: ../../reference/expressions.rst:1653 +#: ../../reference/expressions.rst:1664 msgid "``x <= y`` and ``y >= x``" msgstr "``x <= y`` 和 ``y >= x``" -#: ../../reference/expressions.rst:1655 +#: ../../reference/expressions.rst:1666 msgid "" "Comparison should be transitive. The following (non-exhaustive) examples " "illustrate that:" msgstr "" -#: ../../reference/expressions.rst:1658 +#: ../../reference/expressions.rst:1669 msgid "``x > y and y > z`` implies ``x > z``" msgstr "``x > y and y > z`` 暗示了 ``x > z``" -#: ../../reference/expressions.rst:1660 +#: ../../reference/expressions.rst:1671 msgid "``x < y and y <= z`` implies ``x < z``" msgstr "``x < y and y <= z`` 暗示了 ``x < z``" -#: ../../reference/expressions.rst:1662 +#: ../../reference/expressions.rst:1673 msgid "" "Inverse comparison should result in the boolean negation. In other words, " "the following expressions should have the same result:" msgstr "" -#: ../../reference/expressions.rst:1665 +#: ../../reference/expressions.rst:1676 msgid "``x == y`` and ``not x != y``" msgstr "``x == y`` 和 ``not x != y``" -#: ../../reference/expressions.rst:1667 +#: ../../reference/expressions.rst:1678 msgid "``x < y`` and ``not x >= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1669 +#: ../../reference/expressions.rst:1680 msgid "``x > y`` and ``not x <= y`` (for total ordering)" msgstr "" -#: ../../reference/expressions.rst:1671 +#: ../../reference/expressions.rst:1682 msgid "" "The last two expressions apply to totally ordered collections (e.g. to " "sequences, but not to sets or mappings). See also the :func:`~functools." "total_ordering` decorator." msgstr "" -#: ../../reference/expressions.rst:1675 +#: ../../reference/expressions.rst:1686 msgid "" "The :func:`hash` result should be consistent with equality. Objects that are " "equal should either have the same hash value, or be marked as unhashable." msgstr "" -#: ../../reference/expressions.rst:1679 +#: ../../reference/expressions.rst:1690 msgid "" "Python does not enforce these consistency rules. In fact, the not-a-number " "values are an example for not following these rules." msgstr "" -#: ../../reference/expressions.rst:1688 +#: ../../reference/expressions.rst:1699 msgid "Membership test operations" msgstr "" -#: ../../reference/expressions.rst:1690 +#: ../../reference/expressions.rst:1701 msgid "" "The operators :keyword:`in` and :keyword:`not in` test for membership. ``x " "in s`` evaluates to ``True`` if *x* is a member of *s*, and ``False`` " @@ -1915,7 +1927,7 @@ msgid "" "expression ``x in y`` is equivalent to ``any(x is e or x == e for e in y)``." msgstr "" -#: ../../reference/expressions.rst:1698 +#: ../../reference/expressions.rst:1709 msgid "" "For the string and bytes types, ``x in y`` is ``True`` if and only if *x* is " "a substring of *y*. An equivalent test is ``y.find(x) != -1``. Empty " @@ -1923,14 +1935,14 @@ msgid "" "``\"\" in \"abc\"`` will return ``True``." msgstr "" -#: ../../reference/expressions.rst:1703 +#: ../../reference/expressions.rst:1714 msgid "" "For user-defined classes which define the :meth:`~object.__contains__` " "method, ``x in y`` returns ``True`` if ``y.__contains__(x)`` returns a true " "value, and ``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1707 +#: ../../reference/expressions.rst:1718 msgid "" "For user-defined classes which do not define :meth:`~object.__contains__` " "but do define :meth:`~object.__iter__`, ``x in y`` is ``True`` if some value " @@ -1939,7 +1951,7 @@ msgid "" "it is as if :keyword:`in` raised that exception." msgstr "" -#: ../../reference/expressions.rst:1713 +#: ../../reference/expressions.rst:1724 msgid "" "Lastly, the old-style iteration protocol is tried: if a class defines :meth:" "`~object.__getitem__`, ``x in y`` is ``True`` if and only if there is a non-" @@ -1948,17 +1960,17 @@ msgid "" "exception is raised, it is as if :keyword:`in` raised that exception)." msgstr "" -#: ../../reference/expressions.rst:1725 +#: ../../reference/expressions.rst:1736 msgid "" "The operator :keyword:`not in` is defined to have the inverse truth value " "of :keyword:`in`." msgstr "" -#: ../../reference/expressions.rst:1738 +#: ../../reference/expressions.rst:1749 msgid "Identity comparisons" msgstr "" -#: ../../reference/expressions.rst:1740 +#: ../../reference/expressions.rst:1751 msgid "" "The operators :keyword:`is` and :keyword:`is not` test for an object's " "identity: ``x is y`` is true if and only if *x* and *y* are the same " @@ -1966,11 +1978,11 @@ msgid "" "``x is not y`` yields the inverse truth value. [#]_" msgstr "" -#: ../../reference/expressions.rst:1752 +#: ../../reference/expressions.rst:1763 msgid "Boolean operations" msgstr "" -#: ../../reference/expressions.rst:1763 +#: ../../reference/expressions.rst:1774 msgid "" "In the context of Boolean operations, and also when expressions are used by " "control flow statements, the following values are interpreted as false: " @@ -1981,25 +1993,25 @@ msgid "" "__bool__` method." msgstr "" -#: ../../reference/expressions.rst:1772 +#: ../../reference/expressions.rst:1783 msgid "" "The operator :keyword:`not` yields ``True`` if its argument is false, " "``False`` otherwise." msgstr "" -#: ../../reference/expressions.rst:1777 +#: ../../reference/expressions.rst:1788 msgid "" "The expression ``x and y`` first evaluates *x*; if *x* is false, its value " "is returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1782 +#: ../../reference/expressions.rst:1793 msgid "" "The expression ``x or y`` first evaluates *x*; if *x* is true, its value is " "returned; otherwise, *y* is evaluated and the resulting value is returned." msgstr "" -#: ../../reference/expressions.rst:1785 +#: ../../reference/expressions.rst:1796 msgid "" "Note that neither :keyword:`and` nor :keyword:`or` restrict the value and " "type they return to ``False`` and ``True``, but rather return the last " @@ -2010,11 +2022,11 @@ msgid "" "argument (for example, ``not 'foo'`` produces ``False`` rather than ``''``.)" msgstr "" -#: ../../reference/expressions.rst:1801 +#: ../../reference/expressions.rst:1813 msgid "Assignment expressions" msgstr "" -#: ../../reference/expressions.rst:1806 +#: ../../reference/expressions.rst:1818 msgid "" "An assignment expression (sometimes also called a \"named expression\" or " "\"walrus\") assigns an :token:`~python-grammar:expression` to an :token:" @@ -2022,11 +2034,11 @@ msgid "" "`~python-grammar:expression`." msgstr "" -#: ../../reference/expressions.rst:1811 +#: ../../reference/expressions.rst:1823 msgid "One common use case is when handling matched regular expressions:" msgstr "" -#: ../../reference/expressions.rst:1813 +#: ../../reference/expressions.rst:1825 msgid "" "if matching := pattern.search(data):\n" " do_something(matching)" @@ -2034,11 +2046,11 @@ msgstr "" "if matching := pattern.search(data):\n" " do_something(matching)" -#: ../../reference/expressions.rst:1818 +#: ../../reference/expressions.rst:1830 msgid "Or, when processing a file stream in chunks:" msgstr "" -#: ../../reference/expressions.rst:1820 +#: ../../reference/expressions.rst:1832 msgid "" "while chunk := file.read(9000):\n" " process(chunk)" @@ -2046,7 +2058,7 @@ msgstr "" "while chunk := file.read(9000):\n" " process(chunk)" -#: ../../reference/expressions.rst:1825 +#: ../../reference/expressions.rst:1837 msgid "" "Assignment expressions must be surrounded by parentheses when used as " "expression statements and when used as sub-expressions in slicing, " @@ -2056,36 +2068,36 @@ msgid "" "and ``while`` statements." msgstr "" -#: ../../reference/expressions.rst:1833 +#: ../../reference/expressions.rst:1845 msgid "See :pep:`572` for more details about assignment expressions." msgstr "" -#: ../../reference/expressions.rst:1840 +#: ../../reference/expressions.rst:1852 msgid "Conditional expressions" msgstr "" -#: ../../reference/expressions.rst:1852 +#: ../../reference/expressions.rst:1864 msgid "" "Conditional expressions (sometimes called a \"ternary operator\") have the " "lowest priority of all Python operations." msgstr "" -#: ../../reference/expressions.rst:1855 +#: ../../reference/expressions.rst:1867 msgid "" "The expression ``x if C else y`` first evaluates the condition, *C* rather " "than *x*. If *C* is true, *x* is evaluated and its value is returned; " "otherwise, *y* is evaluated and its value is returned." msgstr "" -#: ../../reference/expressions.rst:1859 +#: ../../reference/expressions.rst:1871 msgid "See :pep:`308` for more details about conditional expressions." msgstr "" -#: ../../reference/expressions.rst:1866 +#: ../../reference/expressions.rst:1878 msgid "Lambdas" msgstr "" -#: ../../reference/expressions.rst:1877 +#: ../../reference/expressions.rst:1889 msgid "" "Lambda expressions (sometimes called lambda forms) are used to create " "anonymous functions. The expression ``lambda parameters: expression`` yields " @@ -2093,7 +2105,7 @@ msgid "" "defined with:" msgstr "" -#: ../../reference/expressions.rst:1881 +#: ../../reference/expressions.rst:1893 msgid "" "def <lambda>(parameters):\n" " return expression" @@ -2101,25 +2113,25 @@ msgstr "" "def <lambda>(parameters):\n" " return expression" -#: ../../reference/expressions.rst:1886 +#: ../../reference/expressions.rst:1898 msgid "" "See section :ref:`function` for the syntax of parameter lists. Note that " "functions created with lambda expressions cannot contain statements or " "annotations." msgstr "" -#: ../../reference/expressions.rst:1894 +#: ../../reference/expressions.rst:1906 msgid "Expression lists" msgstr "" -#: ../../reference/expressions.rst:1908 +#: ../../reference/expressions.rst:1922 msgid "" "Except when part of a list or set display, an expression list containing at " "least one comma yields a tuple. The length of the tuple is the number of " "expressions in the list. The expressions are evaluated from left to right." msgstr "" -#: ../../reference/expressions.rst:1917 +#: ../../reference/expressions.rst:1931 msgid "" "An asterisk ``*`` denotes :dfn:`iterable unpacking`. Its operand must be " "an :term:`iterable`. The iterable is expanded into a sequence of items, " @@ -2127,12 +2139,16 @@ msgid "" "unpacking." msgstr "" -#: ../../reference/expressions.rst:1922 +#: ../../reference/expressions.rst:1936 msgid "" "Iterable unpacking in expression lists, originally proposed by :pep:`448`." msgstr "" -#: ../../reference/expressions.rst:1927 +#: ../../reference/expressions.rst:1939 +msgid "Any item in an expression list may be starred. See :pep:`646`." +msgstr "" + +#: ../../reference/expressions.rst:1944 msgid "" "A trailing comma is required only to create a one-item tuple, such as ``1," "``; it is optional in all other cases. A single expression without a " @@ -2141,24 +2157,24 @@ msgid "" "``()``.)" msgstr "" -#: ../../reference/expressions.rst:1938 +#: ../../reference/expressions.rst:1955 msgid "Evaluation order" msgstr "" -#: ../../reference/expressions.rst:1942 +#: ../../reference/expressions.rst:1959 msgid "" "Python evaluates expressions from left to right. Notice that while " "evaluating an assignment, the right-hand side is evaluated before the left-" "hand side." msgstr "" -#: ../../reference/expressions.rst:1945 +#: ../../reference/expressions.rst:1962 msgid "" "In the following lines, expressions will be evaluated in the arithmetic " "order of their suffixes::" msgstr "" -#: ../../reference/expressions.rst:1948 +#: ../../reference/expressions.rst:1965 msgid "" "expr1, expr2, expr3, expr4\n" "(expr1, expr2, expr3, expr4)\n" @@ -2174,11 +2190,11 @@ msgstr "" "expr1(expr2, expr3, *expr4, **expr5)\n" "expr3, expr4 = expr1, expr2" -#: ../../reference/expressions.rst:1959 +#: ../../reference/expressions.rst:1976 msgid "Operator precedence" msgstr "" -#: ../../reference/expressions.rst:1964 +#: ../../reference/expressions.rst:1981 msgid "" "The following table summarizes the operator precedence in Python, from " "highest precedence (most binding) to lowest precedence (least binding). " @@ -2188,176 +2204,176 @@ msgid "" "group from right to left)." msgstr "" -#: ../../reference/expressions.rst:1970 +#: ../../reference/expressions.rst:1987 msgid "" "Note that comparisons, membership tests, and identity tests, all have the " "same precedence and have a left-to-right chaining feature as described in " "the :ref:`comparisons` section." msgstr "" -#: ../../reference/expressions.rst:1976 +#: ../../reference/expressions.rst:1993 msgid "Operator" msgstr "" -#: ../../reference/expressions.rst:1976 +#: ../../reference/expressions.rst:1993 msgid "Description" msgstr "描述" -#: ../../reference/expressions.rst:1978 +#: ../../reference/expressions.rst:1995 msgid "``(expressions...)``," msgstr "``(expressions...)``," -#: ../../reference/expressions.rst:1980 +#: ../../reference/expressions.rst:1997 msgid "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" msgstr "``[expressions...]``, ``{key: value...}``, ``{expressions...}``" -#: ../../reference/expressions.rst:1978 +#: ../../reference/expressions.rst:1995 msgid "" "Binding or parenthesized expression, list display, dictionary display, set " "display" msgstr "" -#: ../../reference/expressions.rst:1984 +#: ../../reference/expressions.rst:2001 msgid "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" msgstr "``x[index]``, ``x[index:index]``, ``x(arguments...)``, ``x.attribute``" -#: ../../reference/expressions.rst:1984 +#: ../../reference/expressions.rst:2001 msgid "Subscription, slicing, call, attribute reference" msgstr "" -#: ../../reference/expressions.rst:1987 +#: ../../reference/expressions.rst:2004 msgid ":keyword:`await x <await>`" msgstr ":keyword:`await x <await>`" -#: ../../reference/expressions.rst:1989 +#: ../../reference/expressions.rst:2006 msgid "``**``" msgstr "``**``" -#: ../../reference/expressions.rst:1989 +#: ../../reference/expressions.rst:2006 msgid "Exponentiation [#]_" msgstr "" -#: ../../reference/expressions.rst:1991 +#: ../../reference/expressions.rst:2008 msgid "``+x``, ``-x``, ``~x``" msgstr "``+x``, ``-x``, ``~x``" -#: ../../reference/expressions.rst:1991 +#: ../../reference/expressions.rst:2008 msgid "Positive, negative, bitwise NOT" msgstr "" -#: ../../reference/expressions.rst:1993 +#: ../../reference/expressions.rst:2010 msgid "``*``, ``@``, ``/``, ``//``, ``%``" msgstr "``*``, ``@``, ``/``, ``//``, ``%``" -#: ../../reference/expressions.rst:1993 +#: ../../reference/expressions.rst:2010 msgid "" "Multiplication, matrix multiplication, division, floor division, remainder " "[#]_" msgstr "" -#: ../../reference/expressions.rst:1997 +#: ../../reference/expressions.rst:2014 msgid "``+``, ``-``" msgstr "``+``, ``-``" -#: ../../reference/expressions.rst:1997 +#: ../../reference/expressions.rst:2014 msgid "Addition and subtraction" msgstr "" -#: ../../reference/expressions.rst:1999 +#: ../../reference/expressions.rst:2016 msgid "``<<``, ``>>``" msgstr "``<<``, ``>>``" -#: ../../reference/expressions.rst:1999 +#: ../../reference/expressions.rst:2016 msgid "Shifts" msgstr "" -#: ../../reference/expressions.rst:2001 +#: ../../reference/expressions.rst:2018 msgid "``&``" msgstr "``&``" -#: ../../reference/expressions.rst:2001 +#: ../../reference/expressions.rst:2018 msgid "Bitwise AND" msgstr "" -#: ../../reference/expressions.rst:2003 +#: ../../reference/expressions.rst:2020 msgid "``^``" msgstr "``^``" -#: ../../reference/expressions.rst:2003 +#: ../../reference/expressions.rst:2020 msgid "Bitwise XOR" msgstr "" -#: ../../reference/expressions.rst:2005 +#: ../../reference/expressions.rst:2022 msgid "``|``" msgstr "``|``" -#: ../../reference/expressions.rst:2005 +#: ../../reference/expressions.rst:2022 msgid "Bitwise OR" msgstr "" -#: ../../reference/expressions.rst:2007 +#: ../../reference/expressions.rst:2024 msgid "" ":keyword:`in`, :keyword:`not in`, :keyword:`is`, :keyword:`is not`, ``<``, " "``<=``, ``>``, ``>=``, ``!=``, ``==``" msgstr "" -#: ../../reference/expressions.rst:2007 +#: ../../reference/expressions.rst:2024 msgid "Comparisons, including membership tests and identity tests" msgstr "" -#: ../../reference/expressions.rst:2011 +#: ../../reference/expressions.rst:2028 msgid ":keyword:`not x <not>`" msgstr ":keyword:`not x <not>`" -#: ../../reference/expressions.rst:2011 +#: ../../reference/expressions.rst:2028 msgid "Boolean NOT" msgstr "" -#: ../../reference/expressions.rst:2013 +#: ../../reference/expressions.rst:2030 msgid ":keyword:`and`" msgstr ":keyword:`and`" -#: ../../reference/expressions.rst:2013 +#: ../../reference/expressions.rst:2030 msgid "Boolean AND" msgstr "" -#: ../../reference/expressions.rst:2015 +#: ../../reference/expressions.rst:2032 msgid ":keyword:`or`" msgstr ":keyword:`or`" -#: ../../reference/expressions.rst:2015 +#: ../../reference/expressions.rst:2032 msgid "Boolean OR" msgstr "" -#: ../../reference/expressions.rst:2017 +#: ../../reference/expressions.rst:2034 msgid ":keyword:`if <if_expr>` -- :keyword:`!else`" msgstr ":keyword:`if <if_expr>` -- :keyword:`!else`" -#: ../../reference/expressions.rst:2017 +#: ../../reference/expressions.rst:2034 msgid "Conditional expression" msgstr "" -#: ../../reference/expressions.rst:2019 +#: ../../reference/expressions.rst:2036 msgid ":keyword:`lambda`" msgstr ":keyword:`lambda`" -#: ../../reference/expressions.rst:2019 +#: ../../reference/expressions.rst:2036 msgid "Lambda expression" msgstr "" -#: ../../reference/expressions.rst:2021 +#: ../../reference/expressions.rst:2038 msgid "``:=``" msgstr "``:=``" -#: ../../reference/expressions.rst:2021 +#: ../../reference/expressions.rst:2038 msgid "Assignment expression" msgstr "" -#: ../../reference/expressions.rst:2026 +#: ../../reference/expressions.rst:2043 msgid "Footnotes" msgstr "註解" -#: ../../reference/expressions.rst:2027 +#: ../../reference/expressions.rst:2044 msgid "" "While ``abs(x%y) < abs(y)`` is true mathematically, for floats it may not be " "true numerically due to roundoff. For example, and assuming a platform on " @@ -2369,7 +2385,7 @@ msgid "" "approach is more appropriate depends on the application." msgstr "" -#: ../../reference/expressions.rst:2036 +#: ../../reference/expressions.rst:2053 msgid "" "If x is very close to an exact integer multiple of y, it's possible for ``x//" "y`` to be one larger than ``(x-x%y)//y`` due to rounding. In such cases, " @@ -2377,7 +2393,7 @@ msgid "" "* y + x % y`` be very close to ``x``." msgstr "" -#: ../../reference/expressions.rst:2041 +#: ../../reference/expressions.rst:2058 msgid "" "The Unicode standard distinguishes between :dfn:`code points` (e.g. U+0041) " "and :dfn:`abstract characters` (e.g. \"LATIN CAPITAL LETTER A\"). While most " @@ -2391,7 +2407,7 @@ msgid "" "(COMBINING CEDILLA)." msgstr "" -#: ../../reference/expressions.rst:2052 +#: ../../reference/expressions.rst:2069 msgid "" "The comparison operators on strings compare at the level of Unicode code " "points. This may be counter-intuitive to humans. For example, ``\"\\u00C7\" " @@ -2399,13 +2415,13 @@ msgid "" "same abstract character \"LATIN CAPITAL LETTER C WITH CEDILLA\"." msgstr "" -#: ../../reference/expressions.rst:2057 +#: ../../reference/expressions.rst:2074 msgid "" "To compare strings at the level of abstract characters (that is, in a way " "intuitive to humans), use :func:`unicodedata.normalize`." msgstr "" -#: ../../reference/expressions.rst:2060 +#: ../../reference/expressions.rst:2077 msgid "" "Due to automatic garbage-collection, free lists, and the dynamic nature of " "descriptors, you may notice seemingly unusual behaviour in certain uses of " @@ -2413,22 +2429,22 @@ msgid "" "instance methods, or constants. Check their documentation for more info." msgstr "" -#: ../../reference/expressions.rst:2065 +#: ../../reference/expressions.rst:2082 msgid "" "The power operator ``**`` binds less tightly than an arithmetic or bitwise " "unary operator on its right, that is, ``2**-1`` is ``0.5``." msgstr "" -#: ../../reference/expressions.rst:2068 +#: ../../reference/expressions.rst:2085 msgid "" "The ``%`` operator is also used for string formatting; the same precedence " "applies." msgstr "" #: ../../reference/expressions.rst:8 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1754 -#: ../../reference/expressions.rst:1842 ../../reference/expressions.rst:1868 -#: ../../reference/expressions.rst:1896 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1765 +#: ../../reference/expressions.rst:1805 ../../reference/expressions.rst:1854 +#: ../../reference/expressions.rst:1880 ../../reference/expressions.rst:1908 msgid "expression" msgstr "" @@ -2436,8 +2452,8 @@ msgstr "" msgid "BNF" msgstr "BNF" -#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1246 -#: ../../reference/expressions.rst:1294 +#: ../../reference/expressions.rst:28 ../../reference/expressions.rst:1257 +#: ../../reference/expressions.rst:1305 msgid "arithmetic" msgstr "" @@ -2458,10 +2474,10 @@ msgid "identifier" msgstr "" #: ../../reference/expressions.rst:74 ../../reference/expressions.rst:569 -#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:746 -#: ../../reference/expressions.rst:798 ../../reference/expressions.rst:844 -#: ../../reference/expressions.rst:1283 ../../reference/expressions.rst:1332 -#: ../../reference/expressions.rst:1428 +#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:753 +#: ../../reference/expressions.rst:805 ../../reference/expressions.rst:851 +#: ../../reference/expressions.rst:1294 ../../reference/expressions.rst:1343 +#: ../../reference/expressions.rst:1439 msgid "exception" msgstr "" @@ -2500,12 +2516,12 @@ msgstr "type(型別)" #: ../../reference/expressions.rst:146 ../../reference/expressions.rst:275 #: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 #: ../../reference/expressions.rst:372 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:557 ../../reference/expressions.rst:736 -#: ../../reference/expressions.rst:844 ../../reference/expressions.rst:873 -#: ../../reference/expressions.rst:946 ../../reference/expressions.rst:990 -#: ../../reference/expressions.rst:1138 ../../reference/expressions.rst:1151 -#: ../../reference/expressions.rst:1165 ../../reference/expressions.rst:1172 -#: ../../reference/expressions.rst:1719 ../../reference/expressions.rst:1906 +#: ../../reference/expressions.rst:557 ../../reference/expressions.rst:743 +#: ../../reference/expressions.rst:851 ../../reference/expressions.rst:880 +#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1149 ../../reference/expressions.rst:1162 +#: ../../reference/expressions.rst:1176 ../../reference/expressions.rst:1183 +#: ../../reference/expressions.rst:1730 ../../reference/expressions.rst:1920 msgid "object" msgstr "object(物件)" @@ -2514,7 +2530,7 @@ msgid "parenthesized form" msgstr "" #: ../../reference/expressions.rst:162 ../../reference/expressions.rst:393 -#: ../../reference/expressions.rst:990 +#: ../../reference/expressions.rst:1001 msgid "() (parentheses)" msgstr "() (圓括號)" @@ -2526,19 +2542,19 @@ msgstr "" msgid "empty" msgstr "" -#: ../../reference/expressions.rst:175 ../../reference/expressions.rst:873 -#: ../../reference/expressions.rst:946 ../../reference/expressions.rst:1906 +#: ../../reference/expressions.rst:175 ../../reference/expressions.rst:880 +#: ../../reference/expressions.rst:957 ../../reference/expressions.rst:1920 msgid "tuple" msgstr "" -#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1925 +#: ../../reference/expressions.rst:181 ../../reference/expressions.rst:1942 msgid "comma" msgstr "" #: ../../reference/expressions.rst:181 ../../reference/expressions.rst:275 #: ../../reference/expressions.rst:301 ../../reference/expressions.rst:329 -#: ../../reference/expressions.rst:940 ../../reference/expressions.rst:990 -#: ../../reference/expressions.rst:1896 +#: ../../reference/expressions.rst:951 ../../reference/expressions.rst:1001 +#: ../../reference/expressions.rst:1908 msgid ", (comma)" msgstr ", (逗號)" @@ -2555,7 +2571,7 @@ msgstr "for" msgid "in comprehensions" msgstr "於 comprehensions(綜合運算)" -#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1842 +#: ../../reference/expressions.rst:206 ../../reference/expressions.rst:1854 msgid "if" msgstr "if" @@ -2563,13 +2579,13 @@ msgstr "if" msgid "async for" msgstr "async for" -#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1190 +#: ../../reference/expressions.rst:241 ../../reference/expressions.rst:1201 msgid "await" msgstr "await" -#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:844 -#: ../../reference/expressions.rst:873 ../../reference/expressions.rst:946 -#: ../../reference/expressions.rst:1896 +#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:851 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 +#: ../../reference/expressions.rst:1908 msgid "list" msgstr "list(串列)" @@ -2578,7 +2594,7 @@ msgstr "list(串列)" msgid "display" msgstr "" -#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:869 +#: ../../reference/expressions.rst:275 ../../reference/expressions.rst:876 msgid "[] (square brackets)" msgstr "[] (方括號)" @@ -2587,7 +2603,7 @@ msgid "list expression" msgstr "list expression(串列運算式)" #: ../../reference/expressions.rst:275 ../../reference/expressions.rst:301 -#: ../../reference/expressions.rst:1896 +#: ../../reference/expressions.rst:1908 msgid "expression list" msgstr "expression list(運算式串列)" @@ -2604,7 +2620,7 @@ msgid "set expression" msgstr "set expression(集合運算式)" #: ../../reference/expressions.rst:329 ../../reference/expressions.rst:355 -#: ../../reference/expressions.rst:873 +#: ../../reference/expressions.rst:880 msgid "dictionary" msgstr "dictionary(字典)" @@ -2624,8 +2640,8 @@ msgstr "key/value pair(鍵/值對)" msgid "dictionary expression" msgstr "dictionary expression(字典運算式)" -#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:940 -#: ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:329 ../../reference/expressions.rst:951 +#: ../../reference/expressions.rst:1880 msgid ": (colon)" msgstr ": (冒號)" @@ -2637,13 +2653,13 @@ msgstr "於字典運算式" msgid "in dictionary displays" msgstr "於字典顯示" -#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1073 -#: ../../reference/expressions.rst:1913 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1084 +#: ../../reference/expressions.rst:1927 msgid "unpacking" msgstr "unpacking(解包)" -#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1103 -#: ../../reference/expressions.rst:1210 +#: ../../reference/expressions.rst:355 ../../reference/expressions.rst:1114 +#: ../../reference/expressions.rst:1221 msgid "**" msgstr "**" @@ -2660,11 +2676,11 @@ msgstr "generator(產生器)" msgid "generator expression" msgstr "generator expression(產生器運算式)" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1190 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1201 msgid "keyword" msgstr "keyword(關鍵字)" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:637 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:644 msgid "yield" msgstr "yield" @@ -2672,8 +2688,8 @@ msgstr "yield" msgid "from" msgstr "from" -#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1138 -#: ../../reference/expressions.rst:1151 ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:448 ../../reference/expressions.rst:1149 +#: ../../reference/expressions.rst:1162 ../../reference/expressions.rst:1880 msgid "function" msgstr "function (函式)" @@ -2689,500 +2705,504 @@ msgstr "yield from expression(yield from 運算式)" msgid "StopIteration" msgstr "StopIteration" -#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:798 +#: ../../reference/expressions.rst:624 ../../reference/expressions.rst:805 msgid "GeneratorExit" msgstr "GeneratorExit" -#: ../../reference/expressions.rst:637 +#: ../../reference/expressions.rst:644 msgid "examples" msgstr "範例" -#: ../../reference/expressions.rst:736 +#: ../../reference/expressions.rst:743 msgid "asynchronous-generator" msgstr "asynchronous-generator(非同步產生器)" -#: ../../reference/expressions.rst:746 +#: ../../reference/expressions.rst:753 msgid "StopAsyncIteration" msgstr "StopAsyncIteration" -#: ../../reference/expressions.rst:821 +#: ../../reference/expressions.rst:828 msgid "primary" msgstr "primary(主要)" -#: ../../reference/expressions.rst:835 +#: ../../reference/expressions.rst:842 msgid "attribute" msgstr "attribute(屬性)" -#: ../../reference/expressions.rst:835 +#: ../../reference/expressions.rst:842 msgid "reference" msgstr "reference(參照)" -#: ../../reference/expressions.rst:835 +#: ../../reference/expressions.rst:842 msgid ". (dot)" msgstr ". (點)" -#: ../../reference/expressions.rst:835 +#: ../../reference/expressions.rst:842 msgid "attribute reference" msgstr "attribute reference(屬性參照)" -#: ../../reference/expressions.rst:844 +#: ../../reference/expressions.rst:851 msgid "AttributeError" msgstr "AttributeError" -#: ../../reference/expressions.rst:844 +#: ../../reference/expressions.rst:851 msgid "module" msgstr "module(模組)" -#: ../../reference/expressions.rst:869 +#: ../../reference/expressions.rst:876 msgid "subscription" msgstr "subscription(下標)" -#: ../../reference/expressions.rst:873 ../../reference/expressions.rst:946 -#: ../../reference/expressions.rst:1719 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:957 +#: ../../reference/expressions.rst:1730 msgid "sequence" msgstr "sequence(序列)" -#: ../../reference/expressions.rst:873 +#: ../../reference/expressions.rst:880 msgid "mapping" msgstr "mapping(對映)" -#: ../../reference/expressions.rst:873 ../../reference/expressions.rst:926 -#: ../../reference/expressions.rst:946 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:937 +#: ../../reference/expressions.rst:957 msgid "string" msgstr "string(字串)" -#: ../../reference/expressions.rst:873 ../../reference/expressions.rst:926 +#: ../../reference/expressions.rst:880 ../../reference/expressions.rst:937 msgid "item" msgstr "item(項目)" -#: ../../reference/expressions.rst:926 +#: ../../reference/expressions.rst:937 msgid "character" msgstr "character(字元)" -#: ../../reference/expressions.rst:940 +#: ../../reference/expressions.rst:951 msgid "slicing" msgstr "slicing(切片)" -#: ../../reference/expressions.rst:940 +#: ../../reference/expressions.rst:951 msgid "slice" msgstr "slice(切片)" -#: ../../reference/expressions.rst:972 +#: ../../reference/expressions.rst:983 msgid "start (slice object attribute)" msgstr "start(切片物件屬性)" -#: ../../reference/expressions.rst:972 +#: ../../reference/expressions.rst:983 msgid "stop (slice object attribute)" msgstr "stop(切片物件屬性)" -#: ../../reference/expressions.rst:972 +#: ../../reference/expressions.rst:983 msgid "step (slice object attribute)" msgstr "step(切片物件屬性)" -#: ../../reference/expressions.rst:990 +#: ../../reference/expressions.rst:1001 msgid "callable" msgstr "callable(可呼叫物件)" -#: ../../reference/expressions.rst:990 ../../reference/expressions.rst:1138 -#: ../../reference/expressions.rst:1151 ../../reference/expressions.rst:1165 -#: ../../reference/expressions.rst:1172 ../../reference/expressions.rst:1182 +#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1149 +#: ../../reference/expressions.rst:1162 ../../reference/expressions.rst:1176 +#: ../../reference/expressions.rst:1183 ../../reference/expressions.rst:1193 msgid "call" msgstr "call(呼叫)" -#: ../../reference/expressions.rst:990 +#: ../../reference/expressions.rst:1001 msgid "argument" msgstr "argument(引數)" -#: ../../reference/expressions.rst:990 ../../reference/expressions.rst:1023 +#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1034 msgid "call semantics" msgstr "call semantics(呼叫語意)" -#: ../../reference/expressions.rst:990 +#: ../../reference/expressions.rst:1001 msgid "argument list" msgstr "argument list(引數列表)" -#: ../../reference/expressions.rst:990 +#: ../../reference/expressions.rst:1001 msgid "= (equals)" msgstr "= (等於)" -#: ../../reference/expressions.rst:990 ../../reference/expressions.rst:1073 -#: ../../reference/expressions.rst:1103 +#: ../../reference/expressions.rst:1001 ../../reference/expressions.rst:1084 +#: ../../reference/expressions.rst:1114 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../reference/expressions.rst:1023 +#: ../../reference/expressions.rst:1034 msgid "parameter" msgstr "parameter(參數)" -#: ../../reference/expressions.rst:1073 ../../reference/expressions.rst:1307 -#: ../../reference/expressions.rst:1913 +#: ../../reference/expressions.rst:1084 ../../reference/expressions.rst:1318 +#: ../../reference/expressions.rst:1927 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../reference/expressions.rst:1138 +#: ../../reference/expressions.rst:1149 msgid "user-defined" msgstr "user-defined(使用者定義)" -#: ../../reference/expressions.rst:1138 +#: ../../reference/expressions.rst:1149 msgid "user-defined function" msgstr "user-defined function(使用者定義函式)" -#: ../../reference/expressions.rst:1151 +#: ../../reference/expressions.rst:1162 msgid "built-in function" msgstr "built-in function(內建函式)" -#: ../../reference/expressions.rst:1151 +#: ../../reference/expressions.rst:1162 msgid "method" msgstr "method(方法)" -#: ../../reference/expressions.rst:1151 +#: ../../reference/expressions.rst:1162 msgid "built-in method" msgstr "built-in method(內建方法)" -#: ../../reference/expressions.rst:1165 +#: ../../reference/expressions.rst:1176 msgid "class" msgstr "class(類別)" -#: ../../reference/expressions.rst:1165 +#: ../../reference/expressions.rst:1176 msgid "class object" msgstr "class object(類別物件)" -#: ../../reference/expressions.rst:1172 +#: ../../reference/expressions.rst:1183 msgid "class instance" msgstr "class instance(類別實例)" -#: ../../reference/expressions.rst:1172 ../../reference/expressions.rst:1182 +#: ../../reference/expressions.rst:1183 ../../reference/expressions.rst:1193 msgid "instance" msgstr "instance(實例)" -#: ../../reference/expressions.rst:1182 +#: ../../reference/expressions.rst:1193 msgid "__call__() (object method)" msgstr "__call__() (物件方法)" -#: ../../reference/expressions.rst:1210 +#: ../../reference/expressions.rst:1221 msgid "power" msgstr "power(次方)" -#: ../../reference/expressions.rst:1210 ../../reference/expressions.rst:1246 -#: ../../reference/expressions.rst:1294 ../../reference/expressions.rst:1410 -#: ../../reference/expressions.rst:1439 ../../reference/expressions.rst:1754 +#: ../../reference/expressions.rst:1221 ../../reference/expressions.rst:1257 +#: ../../reference/expressions.rst:1305 ../../reference/expressions.rst:1421 +#: ../../reference/expressions.rst:1450 ../../reference/expressions.rst:1765 msgid "operation" msgstr "operation(操作)" -#: ../../reference/expressions.rst:1210 ../../reference/expressions.rst:1255 -#: ../../reference/expressions.rst:1264 ../../reference/expressions.rst:1272 -#: ../../reference/expressions.rst:1307 ../../reference/expressions.rst:1320 -#: ../../reference/expressions.rst:1332 ../../reference/expressions.rst:1350 -#: ../../reference/expressions.rst:1380 ../../reference/expressions.rst:1393 -#: ../../reference/expressions.rst:1410 ../../reference/expressions.rst:1448 -#: ../../reference/expressions.rst:1456 ../../reference/expressions.rst:1465 -#: ../../reference/expressions.rst:1480 ../../reference/expressions.rst:1719 -#: ../../reference/expressions.rst:1728 ../../reference/expressions.rst:1770 -#: ../../reference/expressions.rst:1775 ../../reference/expressions.rst:1780 -#: ../../reference/expressions.rst:1842 ../../reference/expressions.rst:1961 +#: ../../reference/expressions.rst:1221 ../../reference/expressions.rst:1266 +#: ../../reference/expressions.rst:1275 ../../reference/expressions.rst:1283 +#: ../../reference/expressions.rst:1318 ../../reference/expressions.rst:1331 +#: ../../reference/expressions.rst:1343 ../../reference/expressions.rst:1361 +#: ../../reference/expressions.rst:1391 ../../reference/expressions.rst:1404 +#: ../../reference/expressions.rst:1421 ../../reference/expressions.rst:1459 +#: ../../reference/expressions.rst:1467 ../../reference/expressions.rst:1476 +#: ../../reference/expressions.rst:1491 ../../reference/expressions.rst:1730 +#: ../../reference/expressions.rst:1739 ../../reference/expressions.rst:1781 +#: ../../reference/expressions.rst:1786 ../../reference/expressions.rst:1791 +#: ../../reference/expressions.rst:1854 ../../reference/expressions.rst:1978 msgid "operator" msgstr "operator(運算子)" -#: ../../reference/expressions.rst:1246 +#: ../../reference/expressions.rst:1257 msgid "unary" msgstr "unary(一元)" -#: ../../reference/expressions.rst:1246 ../../reference/expressions.rst:1439 -#: ../../reference/expressions.rst:1448 ../../reference/expressions.rst:1456 -#: ../../reference/expressions.rst:1465 +#: ../../reference/expressions.rst:1257 ../../reference/expressions.rst:1450 +#: ../../reference/expressions.rst:1459 ../../reference/expressions.rst:1467 +#: ../../reference/expressions.rst:1476 msgid "bitwise" msgstr "bitwise(位元)" -#: ../../reference/expressions.rst:1255 +#: ../../reference/expressions.rst:1266 msgid "negation" msgstr "negation(否定)" -#: ../../reference/expressions.rst:1255 +#: ../../reference/expressions.rst:1266 msgid "minus" msgstr "minus(減)" -#: ../../reference/expressions.rst:1255 ../../reference/expressions.rst:1393 +#: ../../reference/expressions.rst:1266 ../../reference/expressions.rst:1404 msgid "- (minus)" msgstr "- (減號)" -#: ../../reference/expressions.rst:1255 ../../reference/expressions.rst:1264 +#: ../../reference/expressions.rst:1266 ../../reference/expressions.rst:1275 msgid "unary operator" msgstr "unary operator(一元運算子)" -#: ../../reference/expressions.rst:1264 +#: ../../reference/expressions.rst:1275 msgid "plus" msgstr "plus(加)" -#: ../../reference/expressions.rst:1264 ../../reference/expressions.rst:1380 +#: ../../reference/expressions.rst:1275 ../../reference/expressions.rst:1391 msgid "+ (plus)" msgstr "+ (加號)" -#: ../../reference/expressions.rst:1272 +#: ../../reference/expressions.rst:1283 msgid "inversion" msgstr "inversion(反轉)" -#: ../../reference/expressions.rst:1272 +#: ../../reference/expressions.rst:1283 msgid "~ (tilde)" msgstr "~ (波浪號)" -#: ../../reference/expressions.rst:1283 +#: ../../reference/expressions.rst:1294 msgid "TypeError" msgstr "TypeError" -#: ../../reference/expressions.rst:1294 ../../reference/expressions.rst:1439 +#: ../../reference/expressions.rst:1305 ../../reference/expressions.rst:1450 msgid "binary" msgstr "binary(二進位)" -#: ../../reference/expressions.rst:1307 +#: ../../reference/expressions.rst:1318 msgid "multiplication" msgstr "multiplication(乘)" -#: ../../reference/expressions.rst:1320 +#: ../../reference/expressions.rst:1331 msgid "matrix multiplication" msgstr "matrix multiplication(矩陣乘法)" -#: ../../reference/expressions.rst:1320 +#: ../../reference/expressions.rst:1331 msgid "@ (at)" msgstr "@ (在)" -#: ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1343 msgid "ZeroDivisionError" msgstr "ZeroDivisionError" -#: ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1343 msgid "division" msgstr "division(除)" -#: ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1343 msgid "/ (slash)" msgstr "/ (斜線)" -#: ../../reference/expressions.rst:1332 +#: ../../reference/expressions.rst:1343 msgid "//" msgstr "//" -#: ../../reference/expressions.rst:1350 +#: ../../reference/expressions.rst:1361 msgid "modulo" msgstr "modulo(餘數)" -#: ../../reference/expressions.rst:1350 +#: ../../reference/expressions.rst:1361 msgid "% (percent)" msgstr "% (百分號)" -#: ../../reference/expressions.rst:1380 +#: ../../reference/expressions.rst:1391 msgid "addition" msgstr "addition(加)" -#: ../../reference/expressions.rst:1380 ../../reference/expressions.rst:1393 +#: ../../reference/expressions.rst:1391 ../../reference/expressions.rst:1404 msgid "binary operator" msgstr "binary operator(二元運算子)" -#: ../../reference/expressions.rst:1393 +#: ../../reference/expressions.rst:1404 msgid "subtraction" msgstr "subtraction(減)" -#: ../../reference/expressions.rst:1410 +#: ../../reference/expressions.rst:1421 msgid "shifting" msgstr "shifting(移動)" -#: ../../reference/expressions.rst:1410 +#: ../../reference/expressions.rst:1421 msgid "<<" msgstr "<<" -#: ../../reference/expressions.rst:1410 +#: ../../reference/expressions.rst:1421 msgid ">>" msgstr ">>" -#: ../../reference/expressions.rst:1428 +#: ../../reference/expressions.rst:1439 msgid "ValueError" msgstr "ValueError" -#: ../../reference/expressions.rst:1448 ../../reference/expressions.rst:1775 +#: ../../reference/expressions.rst:1459 ../../reference/expressions.rst:1786 msgid "and" msgstr "and" -#: ../../reference/expressions.rst:1448 +#: ../../reference/expressions.rst:1459 msgid "& (ampersand)" msgstr "& (和號)" -#: ../../reference/expressions.rst:1456 +#: ../../reference/expressions.rst:1467 msgid "xor" msgstr "xor" -#: ../../reference/expressions.rst:1456 +#: ../../reference/expressions.rst:1467 msgid "exclusive" msgstr "exclusive(排外)" -#: ../../reference/expressions.rst:1456 ../../reference/expressions.rst:1465 -#: ../../reference/expressions.rst:1780 +#: ../../reference/expressions.rst:1467 ../../reference/expressions.rst:1476 +#: ../../reference/expressions.rst:1791 msgid "or" msgstr "or" -#: ../../reference/expressions.rst:1456 +#: ../../reference/expressions.rst:1467 msgid "^ (caret)" msgstr "^ (插入符號)" -#: ../../reference/expressions.rst:1465 +#: ../../reference/expressions.rst:1476 msgid "inclusive" msgstr "inclusive(包含)" -#: ../../reference/expressions.rst:1465 +#: ../../reference/expressions.rst:1476 msgid "| (vertical bar)" msgstr "| (垂直線)" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1491 msgid "comparison" msgstr "comparison(比較)" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1491 msgid "C" msgstr "C" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1491 msgid "language" msgstr "language(語言)" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1491 msgid "< (less)" msgstr "< (小於)" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1491 msgid "> (greater)" msgstr "> (大於)" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1491 msgid "<=" msgstr "<=" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1491 msgid ">=" msgstr ">=" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1491 msgid "==" msgstr "==" -#: ../../reference/expressions.rst:1480 +#: ../../reference/expressions.rst:1491 msgid "!=" msgstr "!=" -#: ../../reference/expressions.rst:1504 +#: ../../reference/expressions.rst:1515 msgid "chaining" msgstr "chaining(鏈接)" -#: ../../reference/expressions.rst:1504 +#: ../../reference/expressions.rst:1515 msgid "comparisons" msgstr "comparisons(比較)" -#: ../../reference/expressions.rst:1719 +#: ../../reference/expressions.rst:1730 msgid "in" msgstr "in" -#: ../../reference/expressions.rst:1719 +#: ../../reference/expressions.rst:1730 msgid "not in" msgstr "not in" -#: ../../reference/expressions.rst:1719 +#: ../../reference/expressions.rst:1730 msgid "membership" msgstr "membership(成員)" -#: ../../reference/expressions.rst:1719 ../../reference/expressions.rst:1728 +#: ../../reference/expressions.rst:1730 ../../reference/expressions.rst:1739 msgid "test" msgstr "test(測試)" -#: ../../reference/expressions.rst:1728 +#: ../../reference/expressions.rst:1739 msgid "is" msgstr "is" -#: ../../reference/expressions.rst:1728 +#: ../../reference/expressions.rst:1739 msgid "is not" msgstr "is not" -#: ../../reference/expressions.rst:1728 +#: ../../reference/expressions.rst:1739 msgid "identity" msgstr "identity" -#: ../../reference/expressions.rst:1754 +#: ../../reference/expressions.rst:1765 msgid "Conditional" msgstr "Conditional(條件式)" -#: ../../reference/expressions.rst:1754 +#: ../../reference/expressions.rst:1765 msgid "Boolean" msgstr "Boolean(布林)" -#: ../../reference/expressions.rst:1770 +#: ../../reference/expressions.rst:1781 msgid "not" msgstr "not" -#: ../../reference/expressions.rst:1794 +#: ../../reference/expressions.rst:1805 msgid ":= (colon equals)" msgstr ":= (冒號等於)" -#: ../../reference/expressions.rst:1794 +#: ../../reference/expressions.rst:1805 msgid "assignment expression" msgstr "assignment expression(賦值運算式)" -#: ../../reference/expressions.rst:1794 +#: ../../reference/expressions.rst:1805 msgid "walrus operator" msgstr "walrus operator(海象運算子)" -#: ../../reference/expressions.rst:1794 +#: ../../reference/expressions.rst:1805 msgid "named expression" msgstr "named expression(附名運算式)" -#: ../../reference/expressions.rst:1842 +#: ../../reference/expressions.rst:1805 +msgid "assignment" +msgstr "assignment(賦值)" + +#: ../../reference/expressions.rst:1854 msgid "conditional" msgstr "conditional(條件式)" -#: ../../reference/expressions.rst:1842 +#: ../../reference/expressions.rst:1854 msgid "ternary" msgstr "ternary(三元)" -#: ../../reference/expressions.rst:1842 +#: ../../reference/expressions.rst:1854 msgid "conditional expression" msgstr "conditional expression(條件運算式)" -#: ../../reference/expressions.rst:1842 +#: ../../reference/expressions.rst:1854 msgid "else" msgstr "else" -#: ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:1880 msgid "lambda" msgstr "lambda" -#: ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:1880 msgid "form" msgstr "form" -#: ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:1880 msgid "anonymous" msgstr "anonymous(匿名)" -#: ../../reference/expressions.rst:1868 +#: ../../reference/expressions.rst:1880 msgid "lambda expression" msgstr "lambda expression(lambda 運算式)" -#: ../../reference/expressions.rst:1913 +#: ../../reference/expressions.rst:1927 msgid "iterable" msgstr "iterable(可疊代)" -#: ../../reference/expressions.rst:1913 +#: ../../reference/expressions.rst:1927 msgid "in expression lists" msgstr "於 expression list(運算式串列)" -#: ../../reference/expressions.rst:1925 +#: ../../reference/expressions.rst:1942 msgid "trailing" msgstr "trailing" -#: ../../reference/expressions.rst:1940 +#: ../../reference/expressions.rst:1957 msgid "evaluation" msgstr "evaluation" -#: ../../reference/expressions.rst:1940 +#: ../../reference/expressions.rst:1957 msgid "order" msgstr "order(順序)" -#: ../../reference/expressions.rst:1961 +#: ../../reference/expressions.rst:1978 msgid "precedence" msgstr "precedence(優先順序)" diff --git a/reference/grammar.po b/reference/grammar.po index 4d05834640..14222d9038 100644 --- a/reference/grammar.po +++ b/reference/grammar.po @@ -6,9 +6,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" "Last-Translator: Leon H.\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -133,6 +133,9 @@ msgid "" "# Fail if e can be parsed, without consuming any input.\n" "# ~\n" "# Commit to the current alternative, even if it fails to parse.\n" +"# &&e\n" +"# Eager parse e. The parser will not backtrack and will immediately \n" +"# fail with SyntaxError if e cannot be parsed.\n" "#\n" "\n" "# STARTING RULES\n" @@ -189,11 +192,11 @@ msgid "" " | &'nonlocal' nonlocal_stmt\n" "\n" "compound_stmt[stmt_ty]:\n" -" | &('def' | '@' | ASYNC) function_def\n" +" | &('def' | '@' | 'async') function_def\n" " | &'if' if_stmt\n" " | &('class' | '@') class_def\n" -" | &('with' | ASYNC) with_stmt\n" -" | &('for' | ASYNC) for_stmt\n" +" | &('with' | 'async') with_stmt\n" +" | &('for' | 'async') for_stmt\n" " | &'try' try_stmt\n" " | &'while' while_stmt\n" " | match_stmt\n" @@ -351,14 +354,14 @@ msgid "" "\n" "function_def_raw[stmt_ty]:\n" " | invalid_def_raw\n" -" | 'def' n=NAME t=[type_params] &&'(' params=[params] ')' a=['->' " -"z=expression { z }] &&':' tc=[func_type_comment] b=block {\n" +" | 'def' n=NAME t=[type_params] '(' params=[params] ')' a=['->' " +"z=expression { z }] ':' tc=[func_type_comment] b=block {\n" " _PyAST_FunctionDef(n->v.Name.id,\n" " (params) ? params : CHECK(arguments_ty, " "_PyPegen_empty_arguments(p)),\n" " b, NULL, a, NEW_TYPE_COMMENT(p, tc), t, EXTRA) }\n" -" | ASYNC 'def' n=NAME t=[type_params] &&'(' params=[params] ')' a=['->' " -"z=expression { z }] &&':' tc=[func_type_comment] b=block {\n" +" | 'async' 'def' n=NAME t=[type_params] '(' params=[params] ')' a=['->' " +"z=expression { z }] ':' tc=[func_type_comment] b=block {\n" " CHECK_VERSION(\n" " stmt_ty,\n" " 5,\n" @@ -496,7 +499,7 @@ msgid "" " | 'for' t=star_targets 'in' ~ ex=star_expressions ':' tc=[TYPE_COMMENT] " "b=block el=[else_block] {\n" " _PyAST_For(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" -" | ASYNC 'for' t=star_targets 'in' ~ ex=star_expressions ':' " +" | 'async' 'for' t=star_targets 'in' ~ ex=star_expressions ':' " "tc=[TYPE_COMMENT] b=block el=[else_block] {\n" " CHECK_VERSION(stmt_ty, 5, \"Async for loops are\", " "_PyAST_AsyncFor(t, ex, b, el, NEW_TYPE_COMMENT(p, tc), EXTRA)) }\n" @@ -507,17 +510,17 @@ msgid "" "\n" "with_stmt[stmt_ty]:\n" " | invalid_with_stmt_indent\n" -" | 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' b=block " -"{\n" -" _PyAST_With(a, b, NULL, EXTRA) }\n" +" | 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' " +"tc=[TYPE_COMMENT] b=block {\n" +" _PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" " | 'with' a[asdl_withitem_seq*]=','.with_item+ ':' tc=[TYPE_COMMENT] " "b=block {\n" " _PyAST_With(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA) }\n" -" | ASYNC 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' " +" | 'async' 'with' '(' a[asdl_withitem_seq*]=','.with_item+ ','? ')' ':' " "b=block {\n" " CHECK_VERSION(stmt_ty, 5, \"Async with statements are\", " "_PyAST_AsyncWith(a, b, NULL, EXTRA)) }\n" -" | ASYNC 'with' a[asdl_withitem_seq*]=','.with_item+ ':' " +" | 'async' 'with' a[asdl_withitem_seq*]=','.with_item+ ':' " "tc=[TYPE_COMMENT] b=block {\n" " CHECK_VERSION(stmt_ty, 5, \"Async with statements are\", " "_PyAST_AsyncWith(a, b, NEW_TYPE_COMMENT(p, tc), EXTRA)) }\n" @@ -777,7 +780,9 @@ msgid "" "# Type parameter declaration\n" "# --------------------------\n" "\n" -"type_params[asdl_type_param_seq*]: '[' t=type_param_seq ']' {\n" +"type_params[asdl_type_param_seq*]: \n" +" | invalid_type_params\n" +" | '[' t=type_param_seq ']' {\n" " CHECK_VERSION(asdl_type_param_seq *, 12, \"Type parameter lists " "are\", t) }\n" "\n" @@ -785,22 +790,28 @@ msgid "" "type_param+ [','] { a }\n" "\n" "type_param[type_param_ty] (memo):\n" -" | a=NAME b=[type_param_bound] { _PyAST_TypeVar(a->v.Name.id, b, " -"EXTRA) }\n" +" | a=NAME b=[type_param_bound] c=[type_param_default] { _PyAST_TypeVar(a-" +">v.Name.id, b, c, EXTRA) }\n" " | '*' a=NAME colon=':' e=expression {\n" " RAISE_SYNTAX_ERROR_STARTING_FROM(colon, e->kind == Tuple_kind\n" " ? \"cannot use constraints with TypeVarTuple\"\n" " : \"cannot use bound with TypeVarTuple\")\n" " }\n" -" | '*' a=NAME { _PyAST_TypeVarTuple(a->v.Name.id, EXTRA) }\n" +" | '*' a=NAME b=[type_param_starred_default] { _PyAST_TypeVarTuple(a->v." +"Name.id, b, EXTRA) }\n" " | '**' a=NAME colon=':' e=expression {\n" " RAISE_SYNTAX_ERROR_STARTING_FROM(colon, e->kind == Tuple_kind\n" " ? \"cannot use constraints with ParamSpec\"\n" " : \"cannot use bound with ParamSpec\")\n" " }\n" -" | '**' a=NAME { _PyAST_ParamSpec(a->v.Name.id, EXTRA) }\n" +" | '**' a=NAME b=[type_param_default] { _PyAST_ParamSpec(a->v.Name.id, b, " +"EXTRA) }\n" "\n" "type_param_bound[expr_ty]: ':' e=expression { e }\n" +"type_param_default[expr_ty]: '=' e=expression {\n" +" CHECK_VERSION(expr_ty, 13, \"Type parameter defaults are\", e) }\n" +"type_param_starred_default[expr_ty]: '=' e=star_expression {\n" +" CHECK_VERSION(expr_ty, 13, \"Type parameter defaults are\", e) }\n" "\n" "# EXPRESSIONS\n" "# -----------\n" @@ -937,6 +948,7 @@ msgid "" "shift_expr[expr_ty]:\n" " | a=shift_expr '<<' b=sum { _PyAST_BinOp(a, LShift, b, EXTRA) }\n" " | a=shift_expr '>>' b=sum { _PyAST_BinOp(a, RShift, b, EXTRA) }\n" +" | invalid_arithmetic\n" " | sum\n" "\n" "# Arithmetic operators\n" @@ -954,6 +966,7 @@ msgid "" " | a=term '%' b=factor { _PyAST_BinOp(a, Mod, b, EXTRA) }\n" " | a=term '@' b=factor { CHECK_VERSION(expr_ty, 5, \"The '@' operator " "is\", _PyAST_BinOp(a, MatMult, b, EXTRA)) }\n" +" | invalid_factor\n" " | factor\n" "\n" "factor[expr_ty] (memo):\n" @@ -973,8 +986,8 @@ msgid "" "\"obj[something]\", \"obj(something)\", \"obj\" ...\n" "\n" "await_primary[expr_ty] (memo):\n" -" | AWAIT a=primary { CHECK_VERSION(expr_ty, 5, \"Await expressions are\", " -"_PyAST_Await(a, EXTRA)) }\n" +" | 'await' a=primary { CHECK_VERSION(expr_ty, 5, \"Await expressions " +"are\", _PyAST_Await(a, EXTRA)) }\n" " | primary\n" "\n" "primary[expr_ty]:\n" @@ -1095,9 +1108,8 @@ msgid "" " | fstring_replacement_field\n" " | t=FSTRING_MIDDLE { _PyPegen_constant_from_token(p, t) }\n" "fstring_replacement_field[expr_ty]:\n" -" | '{' a=(yield_expr | star_expressions) debug_expr='='? " -"conversion=[fstring_conversion] format=[fstring_full_format_spec] rbrace='}' " -"{\n" +" | '{' a=annotated_rhs debug_expr='='? conversion=[fstring_conversion] " +"format=[fstring_full_format_spec] rbrace='}' {\n" " _PyPegen_formatted_value(p, a, debug_expr, conversion, format, " "rbrace, EXTRA) }\n" " | invalid_replacement_field\n" @@ -1156,13 +1168,15 @@ msgid "" " | a[asdl_comprehension_seq*]=for_if_clause+ { a }\n" "\n" "for_if_clause[comprehension_ty]:\n" -" | ASYNC 'for' a=star_targets 'in' ~ b=disjunction " +" | 'async' 'for' a=star_targets 'in' ~ b=disjunction " "c[asdl_expr_seq*]=('if' z=disjunction { z })* {\n" " CHECK_VERSION(comprehension_ty, 6, \"Async comprehensions are\", " "_PyAST_comprehension(a, b, c, 1, p->arena)) }\n" " | 'for' a=star_targets 'in' ~ b=disjunction c[asdl_expr_seq*]=('if' " "z=disjunction { z })* {\n" " _PyAST_comprehension(a, b, c, 0, p->arena) }\n" +" | 'async'? 'for' (bitwise_or (',' bitwise_or)* [',']) !'in' {\n" +" RAISE_SYNTAX_ERROR(\"'in' expected after for-loop variables\") }\n" " | invalid_for_target\n" "\n" "listcomp[expr_ty]:\n" @@ -1454,7 +1468,7 @@ msgid "" " | (star_targets '=')* a=yield_expr '=' " "{ RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"assignment to yield expression not " "possible\") }\n" -" | a=star_expressions augassign (yield_expr | star_expressions) {\n" +" | a=star_expressions augassign annotated_rhs {\n" " RAISE_SYNTAX_ERROR_KNOWN_LOCATION(\n" " a,\n" " \"'%s' is an illegal expression for augmented assignment\",\n" @@ -1579,7 +1593,7 @@ msgid "" " RAISE_SYNTAX_ERROR_INVALID_TARGET(STAR_TARGETS, a) }\n" "\n" "invalid_for_target:\n" -" | ASYNC? 'for' a=star_expressions {\n" +" | 'async'? 'for' a=star_expressions {\n" " RAISE_SYNTAX_ERROR_INVALID_TARGET(FOR_TARGETS, a) }\n" "\n" "invalid_group:\n" @@ -1593,23 +1607,29 @@ msgid "" " | a='import' ','.dotted_name+ 'from' dotted_name {\n" " RAISE_SYNTAX_ERROR_STARTING_FROM(a, \"Did you mean to use 'from ... " "import ...' instead?\") }\n" +" | 'import' token=NEWLINE { \n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(token, \"Expected one or more names " +"after 'import'\") }\n" "\n" "invalid_import_from_targets:\n" " | import_from_as_names ',' NEWLINE {\n" " RAISE_SYNTAX_ERROR(\"trailing comma not allowed without surrounding " "parentheses\") }\n" +" | token=NEWLINE { \n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(token, \"Expected one or more names " +"after 'import'\") }\n" "\n" "invalid_with_stmt:\n" -" | [ASYNC] 'with' ','.(expression ['as' star_target])+ NEWLINE " +" | ['async'] 'with' ','.(expression ['as' star_target])+ NEWLINE " "{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" -" | [ASYNC] 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' " +" | ['async'] 'with' '(' ','.(expressions ['as' star_target])+ ','? ')' " "NEWLINE { RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" "invalid_with_stmt_indent:\n" -" | [ASYNC] a='with' ','.(expression ['as' star_target])+ ':' NEWLINE !" +" | ['async'] a='with' ','.(expression ['as' star_target])+ ':' NEWLINE !" "INDENT {\n" " RAISE_INDENTATION_ERROR(\"expected an indented block after 'with' " "statement on line %d\", a->lineno) }\n" -" | [ASYNC] a='with' '(' ','.(expressions ['as' star_target])+ ','? ')' " +" | ['async'] a='with' '(' ','.(expressions ['as' star_target])+ ','? ')' " "':' NEWLINE !INDENT {\n" " RAISE_INDENTATION_ERROR(\"expected an indented block after 'with' " "statement on line %d\", a->lineno) }\n" @@ -1700,17 +1720,19 @@ msgid "" " RAISE_INDENTATION_ERROR(\"expected an indented block after 'while' " "statement on line %d\", a->lineno) }\n" "invalid_for_stmt:\n" -" | [ASYNC] 'for' star_targets 'in' star_expressions NEWLINE " +" | ['async'] 'for' star_targets 'in' star_expressions NEWLINE " "{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" -" | [ASYNC] a='for' star_targets 'in' star_expressions ':' NEWLINE !INDENT " -"{\n" +" | ['async'] a='for' star_targets 'in' star_expressions ':' NEWLINE !" +"INDENT {\n" " RAISE_INDENTATION_ERROR(\"expected an indented block after 'for' " "statement on line %d\", a->lineno) }\n" "invalid_def_raw:\n" -" | [ASYNC] a='def' NAME [type_params] '(' [params] ')' ['->' expression] " -"':' NEWLINE !INDENT {\n" +" | ['async'] a='def' NAME [type_params] '(' [params] ')' ['->' " +"expression] ':' NEWLINE !INDENT {\n" " RAISE_INDENTATION_ERROR(\"expected an indented block after function " "definition on line %d\", a->lineno) }\n" +" | ['async'] 'def' NAME [type_params] &&'(' [params] ')' ['->' " +"expression] &&':' [func_type_comment] block\n" "invalid_class_def_raw:\n" " | 'class' NAME [type_params] ['(' [arguments] ')'] NEWLINE " "{ RAISE_SYNTAX_ERROR(\"expected ':'\") }\n" @@ -1747,24 +1769,22 @@ msgid "" "expression required before ':'\") }\n" " | '{' a='}' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, \"f-string: valid " "expression required before '}'\") }\n" -" | '{' !(yield_expr | star_expressions) " -"{ RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: expecting a valid expression " -"after '{'\")}\n" -" | '{' (yield_expr | star_expressions) !('=' | '!' | ':' | '}') {\n" +" | '{' !annotated_rhs { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: " +"expecting a valid expression after '{'\")}\n" +" | '{' annotated_rhs !('=' | '!' | ':' | '}') {\n" " PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" "string: expecting '=', or '!', or ':', or '}'\") }\n" -" | '{' (yield_expr | star_expressions) '=' !('!' | ':' | '}') {\n" +" | '{' annotated_rhs '=' !('!' | ':' | '}') {\n" " PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" "string: expecting '!', or ':', or '}'\") }\n" -" | '{' (yield_expr | star_expressions) '='? invalid_conversion_character\n" -" | '{' (yield_expr | star_expressions) '='? ['!' NAME] !(':' | '}') {\n" +" | '{' annotated_rhs '='? invalid_conversion_character\n" +" | '{' annotated_rhs '='? ['!' NAME] !(':' | '}') {\n" " PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" "string: expecting ':' or '}'\") }\n" -" | '{' (yield_expr | star_expressions) '='? ['!' NAME] ':' " -"fstring_format_spec* !'}' {\n" +" | '{' annotated_rhs '='? ['!' NAME] ':' fstring_format_spec* !'}' {\n" " PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" "string: expecting '}', or format specs\") }\n" -" | '{' (yield_expr | star_expressions) '='? ['!' NAME] !'}' {\n" +" | '{' annotated_rhs '='? ['!' NAME] !'}' {\n" " PyErr_Occurred() ? NULL : RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-" "string: expecting '}'\") }\n" "\n" @@ -1773,4 +1793,18 @@ msgid "" "missing conversion character\") }\n" " | '!' !NAME { RAISE_SYNTAX_ERROR_ON_NEXT_TOKEN(\"f-string: invalid " "conversion character\") }\n" +"\n" +"invalid_arithmetic:\n" +" | sum ('+'|'-'|'*'|'/'|'%'|'//'|'@') a='not' b=inversion " +"{ RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, b, \"'not' after an operator must be " +"parenthesized\") }\n" +"invalid_factor:\n" +" | ('+' | '-' | '~') a='not' b=factor { RAISE_SYNTAX_ERROR_KNOWN_RANGE(a, " +"b, \"'not' after an operator must be parenthesized\") }\n" +"\n" +"invalid_type_params:\n" +" | '[' token=']' {\n" +" RAISE_SYNTAX_ERROR_STARTING_FROM(\n" +" token, \n" +" \"Type parameter list cannot be empty\")}\n" msgstr "" diff --git a/reference/import.po b/reference/import.po index d2ff9eadab..5dd27d0187 100644 --- a/reference/import.po +++ b/reference/import.po @@ -4,10 +4,10 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" -"PO-Revision-Date: 2018-05-23 16:17+0000\n" +"PO-Revision-Date: 2024-10-07 21:14+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -16,6 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.5\n" #: ../../reference/import.rst:6 msgid "The import system" @@ -29,6 +30,10 @@ msgid "" "way. Functions such as :func:`importlib.import_module` and built-in :func:" "`__import__` can also be used to invoke the import machinery." msgstr "" +"一個 :term:`module` 中的 Python 程式碼透過 :term:`importing` 的過程來存取另一" +"個模組中的程式碼。:keyword:`import` 陳述式是調用 (invoke) 引入機制最常見的方" +"法,但這不是唯一的方法。函式如 :func:`importlib.import_module` 以及內建函式 :" +"func:`__import__` 也可以用來調用引入機制。" #: ../../reference/import.rst:16 msgid "" @@ -41,6 +46,11 @@ msgid "" "keyword:`!import` statement for the exact details of that name binding " "operation." msgstr "" +":keyword:`import` 陳述式結合了兩個操作:首先搜尋指定的模組,然後將搜尋結果繫" +"結到本地作用域中的一個名稱。:keyword:`!import` 陳述式的搜尋操作被定義為一個" +"對 :func:`__import__` 函式的呼叫,並帶有相應的引數。:func:`__import__` 的回傳" +"值用於執行 :keyword:`!import` 陳述式的名稱繫結操作。有關名稱繫結操作的詳細資" +"訊,請參見 :keyword:`!import` 陳述式。" #: ../../reference/import.rst:25 msgid "" @@ -50,6 +60,10 @@ msgid "" "(including :data:`sys.modules`), only the :keyword:`import` statement " "performs a name binding operation." msgstr "" +"直接呼叫 :func:`__import__` 只會執行模組搜尋操作,以及在找到時執行模組的建立" +"操作。雖然某些副作用可能會發生,例如引入父套件 (parent package),以及更新各種" +"快取(包括 :data:`sys.modules`),但只有 :keyword:`import` 陳述式會執行名稱繫" +"結操作。" #: ../../reference/import.rst:31 msgid "" @@ -58,6 +72,9 @@ msgid "" "system (such as :func:`importlib.import_module`) may choose to bypass :func:" "`__import__` and use their own solutions to implement import semantics." msgstr "" +"當執行 :keyword:`import` 陳述式時,會呼叫內建的 :func:`__import__` 函式。其他" +"調用引入系統的機制(如 :func:`importlib.import_module`)可以選擇略過 :func:" +"`__import__`,並使用它們自己的解決方案來實作引入語意。" #: ../../reference/import.rst:36 msgid "" @@ -68,6 +85,10 @@ msgid "" "machinery is invoked. These strategies can be modified and extended by " "using various hooks described in the sections below." msgstr "" +"當模組首次被引入時,Python 會搜尋該模組,若找到則會建立一個模組物件 " +"[#fnmo]_,並對其進行初始化。如果找不到指定的模組,則會引發 :exc:" +"`ModuleNotFoundError`。當引入機制被調用時,Python 會實作各種策略來搜尋指定的" +"模組。這些策略可以透過使用以下章節描述的各種 hook(掛鉤)來修改和擴展。" #: ../../reference/import.rst:43 msgid "" @@ -76,6 +97,9 @@ msgid "" "import system is exposed through :data:`sys.meta_path`. In addition, native " "namespace package support has been implemented (see :pep:`420`)." msgstr "" +"引入系統已被更新,以完全實作 :pep:`302` 的第二階段。不再有隱式引入機制——完整" +"的引入系統已透過 :data:`sys.meta_path` 公開。此外,原生命名空間套件支援(請參" +"閱 :pep:`420`)也已被實作。" #: ../../reference/import.rst:51 msgid ":mod:`importlib`" @@ -89,6 +113,9 @@ msgid "" "import machinery. Refer to the :mod:`importlib` library documentation for " "additional detail." msgstr "" +":mod:`importlib` 模組提供了豐富的 API 來與引入系統互動。例如,:func:" +"`importlib.import_module` 提供了一個比內建的 :func:`__import__` 更推薦且更簡" +"單的 API 來調用引入機制。更多詳細資訊請參閱 :mod:`importlib` 函式庫文件。" #: ../../reference/import.rst:62 msgid "Packages" @@ -101,6 +128,9 @@ msgid "" "else. To help organize modules and provide a naming hierarchy, Python has a " "concept of :term:`packages <package>`." msgstr "" +"Python 只有一種類型的模組物件,且所有模組,無論其是使用 Python、C 還是其他語" +"言實作,都是這種類型。為了幫助組織模組並提供命名階層,Python 導入了\\ :term:`" +"套件 <package>`\\ 的概念。" #: ../../reference/import.rst:72 msgid "" @@ -112,6 +142,10 @@ msgid "" "hierarchically, and packages may themselves contain subpackages, as well as " "regular modules." msgstr "" +"你可以將套件視為檔案系統中的目錄,模組則是目錄中的檔案,但不要過於字面地理解" +"這個比喻,因為套件和模組不一定來自檔案系統。為了方便解釋,我們將使用這個目錄" +"和檔案的比喻。就像檔案系統目錄一樣,套件是分層組織的,套件本身可以包含子套件" +"以及一般模組。" #: ../../reference/import.rst:80 msgid "" @@ -120,6 +154,8 @@ msgid "" "of module. Specifically, any module that contains a ``__path__`` attribute " "is considered a package." msgstr "" +"請記住,所有的套件都是模組,但並非所有模組都是套件。換句話說,套件只是一種特" +"殊的模組。具體來說,任何包含 ``__path__`` 屬性的模組都被視為套件。" #: ../../reference/import.rst:85 msgid "" @@ -129,10 +165,14 @@ msgid "" "subpackage called :mod:`email.mime` and a module within that subpackage " "called :mod:`email.mime.text`." msgstr "" +"所有模組都有一個名稱。子套件的名稱與其父套件名稱之間用一個點來分隔,類似於 " +"Python 的標準屬性存取語法。因此,你可能會有一個名為 :mod:`email` 的套件,該套" +"件又有一個名為 :mod:`email.mime` 的子套件,並且該子套件中有一個名為 :mod:" +"`email.mime.text` 的模組。" #: ../../reference/import.rst:93 msgid "Regular packages" -msgstr "" +msgstr "一般套件" #: ../../reference/import.rst:98 msgid "" @@ -146,12 +186,20 @@ msgid "" "same Python code that any other module can contain, and Python will add some " "additional attributes to the module when it is imported." msgstr "" +"Python 定義了兩種類型的套件,:term:`一般套件 <regular package>`\\ 和\\ :term:" +"`命名空間套件 <namespace package>`。一般套件是 Python 3.2 及更早版本中存在的" +"傳統套件。一般套件通常實作成一個包含 ``__init__.py`` 檔案的目錄。當引入一般套" +"件時,該 ``__init__.py`` 檔案會被隱式執行,其定義的物件會繫結到該套件的命名空" +"間中的名稱。``__init__.py`` 檔案可以包含與任何其他模組相同的 Python 程式碼," +"並且 Python 會在引入時為該模組增加一些額外的屬性。" #: ../../reference/import.rst:108 msgid "" "For example, the following file system layout defines a top level ``parent`` " "package with three subpackages::" msgstr "" +"例如,以下檔案系統布置定義了一個頂層的 ``parent`` 套件,該套件包含三個子套" +"件: ::" #: ../../reference/import.rst:111 msgid "" @@ -180,10 +228,13 @@ msgid "" "``parent.three`` will execute ``parent/two/__init__.py`` and ``parent/three/" "__init__.py`` respectively." msgstr "" +"引入 ``parent.one`` 將隱式執行 ``parent/__init__.py`` 和 ``parent/one/" +"__init__.py``。隨後引入 ``parent.two`` 或 ``parent.three`` 將分別執行 " +"``parent/two/__init__.py`` 和 ``parent/three/__init__.py``。" #: ../../reference/import.rst:127 msgid "Namespace packages" -msgstr "" +msgstr "命名空間套件" #: ../../reference/import.rst:133 msgid "" @@ -195,6 +246,10 @@ msgid "" "objects on the file system; they may be virtual modules that have no " "concrete representation." msgstr "" +"命名空間套件是由不同的\\ :term:`部分 <portion>` 組成的,每個部分都為父套件提" +"供一個子套件。這些部分可以位於檔案系統上的不同位置。部分可能也存在於壓縮檔案" +"中、網路上,或 Python 在引入時搜尋的任何其他地方。命名空間套件不一定直接對應" +"於檔案系統中的對象;它們可能是沒有具體表示的虛擬模組。" #: ../../reference/import.rst:141 msgid "" @@ -204,6 +259,9 @@ msgid "" "that package if the path of their parent package (or :data:`sys.path` for a " "top level package) changes." msgstr "" +"命名空間套件的 ``__path__`` 屬性不使用普通的串列。它們使用自定義的可疊代型" +"別,當父套件的路徑(或頂層套件的 :data:`sys.path`)發生變化時,會在下一次引入" +"嘗試時自動執行新一輪的套件部分搜尋。" #: ../../reference/import.rst:147 msgid "" @@ -214,14 +272,19 @@ msgid "" "create a namespace package for the top-level ``parent`` package whenever it " "or one of its subpackages is imported." msgstr "" +"在命名空間套件中,不存在 ``parent/__init__.py`` 檔案。實際上,在引入搜尋過程" +"中可能會找到多個 ``parent`` 目錄,每個目錄由不同的部分提供。因此,``parent/" +"one`` 可能與 ``parent/two`` 不會實際位於一起。在這種情況下,每當引入頂層 " +"``parent`` 套件或其子套件之一時,Python 會為頂層 ``parent`` 套件建立一個命名" +"空間套件。" #: ../../reference/import.rst:154 msgid "See also :pep:`420` for the namespace package specification." -msgstr "" +msgstr "有關命名空間套件的規範,請參見 :pep:`420`。" #: ../../reference/import.rst:158 msgid "Searching" -msgstr "" +msgstr "搜尋" #: ../../reference/import.rst:160 msgid "" @@ -232,6 +295,10 @@ msgid "" "parameters to the :func:`importlib.import_module` or :func:`__import__` " "functions." msgstr "" +"在開始搜尋之前,Python 需要被引入模組(或套件,但在本討論中,兩者的區別無關緊" +"要)的完整\\ :term:`限定名稱 (qualified name) <qualified name>`。此名稱可能來" +"自 :keyword:`import` 陳述式的各種引數,或來自 :func:`importlib." +"import_module` 或 :func:`__import__` 函式的參數。" #: ../../reference/import.rst:166 msgid "" @@ -241,10 +308,14 @@ msgid "" "baz``. If any of the intermediate imports fail, a :exc:`ModuleNotFoundError` " "is raised." msgstr "" +"此名稱將在引入搜尋的各個階段中使用,並且它可能是指向子模組的點分隔路徑,例如 " +"``foo.bar.baz``。在這種情況下,Python 會首先嘗試引入 ``foo``,然後是 ``foo." +"bar``,最後是 ``foo.bar.baz``。如果任何中間引入失敗,則會引發 :exc:" +"`ModuleNotFoundError`。" #: ../../reference/import.rst:173 msgid "The module cache" -msgstr "" +msgstr "模組快取" #: ../../reference/import.rst:178 msgid "" @@ -255,6 +326,10 @@ msgid "" "and ``foo.bar.baz``. Each key will have as its value the corresponding " "module object." msgstr "" +"在引入搜尋過程中首先檢查的地方是 :data:`sys.modules`。此對映用作所有先前引入" +"過的模組的快取,包括中間路徑。因此,如果 ``foo.bar.baz`` 之前已被引入,:data:" +"`sys.modules` 將包含 ``foo``、``foo.bar`` 和 ``foo.bar.baz`` 的條目。每個鍵的" +"值都是相應的模組物件。" #: ../../reference/import.rst:185 msgid "" @@ -264,6 +339,9 @@ msgid "" "`ModuleNotFoundError` is raised. If the module name is missing, Python will " "continue searching for the module." msgstr "" +"在引入過程中,會在 :data:`sys.modules` 中查找模組名稱,如果存在,則相關的值為" +"滿足此引入的模組,此引入過程即完成。然而,如果值是 ``None``,則會引發 :exc:" +"`ModuleNotFoundError`。如果模組名稱不存在,Python 會繼續搜尋該模組。" #: ../../reference/import.rst:191 msgid "" @@ -274,6 +352,10 @@ msgid "" "to ``None``, forcing the next import of the module to result in a :exc:" "`ModuleNotFoundError`." msgstr "" +":data:`sys.modules` 是可寫入的。刪除一個鍵可能不會銷毀相關聯的模組(因為其他" +"模組可能持有對它的參照),但會使指定的模組的快取條目失效,導致 Python 在下一" +"次引入該模組時重新搜尋。也可以將鍵賦值為 ``None``,這會強制下一次引入該模組時" +"引發 :exc:`ModuleNotFoundError`。" #: ../../reference/import.rst:198 msgid "" @@ -283,10 +365,14 @@ msgid "" "reload` will reuse the *same* module object, and simply reinitialise the " "module contents by rerunning the module's code." msgstr "" +"但請注意,如果你保留了對模組物件的參照,並在 :data:`sys.modules` 中使其快取條" +"目失效,然後重新引入指定的模組,這兩個模組物件將\\ *不會*\\ 相同。相比之下,:" +"func:`importlib.reload` 會重用\\ *相同的*\\ 模組物件,並透過重新執行模組的程" +"式碼來簡單地重新初始化模組內容。" #: ../../reference/import.rst:208 msgid "Finders and loaders" -msgstr "" +msgstr "尋檢器 (Finder) 與載入器 (Loader)" #: ../../reference/import.rst:215 msgid "" @@ -299,6 +385,11 @@ msgid "" "they return themselves when they find that they can load the requested " "module." msgstr "" +"如果在 :data:`sys.modules` 中找不到指定的模組,則會調用 Python 的引入協定來尋" +"找並載入該模組。這個協定由兩個概念性物件組成,:term:`尋檢器 <finder>` 和\\ :" +"term:`載入器 <loader>`。尋檢器的任務是使用其已知的策略來確定是否能找到命名模" +"組。實作這兩個介面的物件稱為\\ :term:`引入器 (importer) <importer>` ——當它們" +"發現可以載入所請求的模組時,會回傳它們自己。" #: ../../reference/import.rst:223 msgid "" @@ -309,12 +400,17 @@ msgid "" "system paths or zip files. It can also be extended to search for any " "locatable resource, such as those identified by URLs." msgstr "" +"Python 包含多個預設的尋檢器和引入器。第一個尋檢器知道如何定位內建模組,第二個" +"尋檢器知道如何定位凍結模組。第三個預設尋檢器會在 :term:`import path` 中搜尋模" +"組。:term:`import path` 是一個位置的列表,這些位置可能是檔案系統路徑或壓縮檔" +"案,也可以擴展以搜尋任何可定位的資源,例如由 URL 識別的資源。" #: ../../reference/import.rst:230 msgid "" "The import machinery is extensible, so new finders can be added to extend " "the range and scope of module searching." msgstr "" +"引入機制是可擴展的,因此可以增加新的尋檢器來擴展模組搜尋的範圍和作用域。" #: ../../reference/import.rst:233 msgid "" @@ -323,6 +419,9 @@ msgid "" "related information, which the import machinery then uses when loading the " "module." msgstr "" +"尋檢器實際上不會載入模組。如果它們能找到指定的模組,它們會回傳一個\\ :dfn:`模" +"組規格`,這是一個模組的引入相關資訊的封裝,引入機制會在載入模組時使用這些資" +"訊。" #: ../../reference/import.rst:237 msgid "" @@ -330,6 +429,8 @@ msgid "" "detail, including how you can create and register new ones to extend the " "import machinery." msgstr "" +"以下各節將更詳細地描述尋檢器和載入器的協定,包括如何建立和註冊新的尋檢器和載" +"入器來擴展引入機制。" #: ../../reference/import.rst:241 msgid "" @@ -337,10 +438,13 @@ msgid "" "directly, whereas now they return module specs which *contain* loaders. " "Loaders are still used during import but have fewer responsibilities." msgstr "" +"Python 在之前的版本中,尋檢器會直接回傳\\ :term:`載入器 <loader>`,而現在它們" +"回傳的是\\ *包含*\\ 載入器的模組規格。載入器仍在引入過程中使用,但其責任減少" +"了。" #: ../../reference/import.rst:247 msgid "Import hooks" -msgstr "" +msgstr "引入掛鉤 (Import hooks)" #: ../../reference/import.rst:257 msgid "" @@ -348,6 +452,8 @@ msgid "" "this are the *import hooks*. There are two types of import hooks: *meta " "hooks* and *import path hooks*." msgstr "" +"引入機制的設計是可擴展的;其主要機制是\\ *引入掛鉤*。引入掛鉤有兩種類型:*元" +"掛鉤 (meta hooks)* 和\\ *引入路徑掛鉤*。" #: ../../reference/import.rst:261 msgid "" @@ -357,6 +463,10 @@ msgid "" "modules, or even built-in modules. Meta hooks are registered by adding new " "finder objects to :data:`sys.meta_path`, as described below." msgstr "" +"元掛鉤會在引入處理的開始階段被呼叫,除了查找 :data:`sys.modules` 快取外,其他" +"引入處理還未發生時就會呼叫。這允許元掛鉤覆蓋 :data:`sys.path` 的處理、凍結模" +"組,甚至是內建模組。元掛鉤透過將新的尋檢器物件添加到 :data:`sys.meta_path` 中" +"來註冊,具體描述請參閱以下段落。" #: ../../reference/import.rst:267 msgid "" @@ -365,10 +475,13 @@ msgid "" "encountered. Import path hooks are registered by adding new callables to :" "data:`sys.path_hooks` as described below." msgstr "" +"引入路徑掛鉤被視為 :data:`sys.path`\\ (或 ``package.__path__``)處理過程的一" +"部分來呼叫,當遇到與其相關聯的路徑項目時就會被觸發。引入路徑掛鉤透過將新的可" +"呼叫對象增加到 :data:`sys.path_hooks` 中來註冊,具體描述請參閱以下段落。" #: ../../reference/import.rst:274 msgid "The meta path" -msgstr "" +msgstr "元路徑" #: ../../reference/import.rst:280 msgid "" @@ -381,6 +494,11 @@ msgid "" "finder can use any strategy it wants to determine whether it can handle the " "named module or not." msgstr "" +"當在 :data:`sys.modules` 中找不到命名模組時,Python 接下來會搜尋 :data:`sys." +"meta_path`,其中包含一個元路徑尋檢器物件串列。這些尋檢器會依次被查詢,看它們" +"是否知道如何處理命名模組。元路徑尋檢器必須實作一個名為 :meth:`~importlib.abc." +"MetaPathFinder.find_spec` 的方法,該方法接收三個引數:名稱、引入路徑和(可選" +"的)目標模組。元路徑尋檢器可以使用任何策略來確定它是否能處理命名模組。" #: ../../reference/import.rst:289 msgid "" @@ -390,6 +508,10 @@ msgid "" "returning a spec, then a :exc:`ModuleNotFoundError` is raised. Any other " "exceptions raised are simply propagated up, aborting the import process." msgstr "" +"如果元路徑尋檢器知道如何處理命名模組,它會回傳一個規格物件。如果它無法處理命" +"名模組,則回傳 ``None``。如果 :data:`sys.meta_path` 的處理到達串列的末尾仍未" +"回傳規格,則會引發 :exc:`ModuleNotFoundError`。任何其他引發的例外將直接向上傳" +"播,並中止引入過程。" #: ../../reference/import.rst:295 msgid "" @@ -404,6 +526,12 @@ msgid "" "existing module object that will be the target of loading later. The import " "system passes in a target module only during reload." msgstr "" +"元路徑尋檢器的 :meth:`~importlib.abc.MetaPathFinder.find_spec` 方法會以兩個或" +"三個引數來呼叫。第一個是被引入模組的完全限定名稱,例如 ``foo.bar.baz``。第二" +"個引數是用於模組搜尋的路徑條目。對於頂層模組,第二個引數是 ``None``,但對於子" +"模組或子套件,第二個引數是父套件的 ``__path__`` 屬性的值。如果無法存取相應的 " +"``__path__`` 屬性,將引發 :exc:`ModuleNotFoundError`。第三個引數是一個現有的" +"模組物件,該物件將成為後續載入的目標。引入系統只會在重新載入時傳入目標模組。" #: ../../reference/import.rst:306 msgid "" @@ -416,6 +544,12 @@ msgid "" "__path__, None)``. Once ``foo.bar`` has been imported, the final traversal " "will call ``mpf.find_spec(\"foo.bar.baz\", foo.bar.__path__, None)``." msgstr "" +"對於一個引入請求,元路徑可能會被遍歷多次。例如,假設參與的模組都沒有被快取," +"則引入 ``foo.bar.baz`` 將首先執行頂層引入,對每個元路徑尋檢器(``mpf``)呼叫 " +"``mpf.find_spec(\"foo\", None, None)``。當 ``foo`` 被引入後,將再次藉由遍歷元" +"路徑引入 ``foo.bar``,並呼叫 ``mpf.find_spec(\"foo.bar\", foo.__path__, " +"None)``。當 ``foo.bar`` 被引入後,最後一次遍歷會呼叫 ``mpf.find_spec(\"foo." +"bar.baz\", foo.bar.__path__, None)``。" #: ../../reference/import.rst:316 msgid "" @@ -423,6 +557,8 @@ msgid "" "always return ``None`` when anything other than ``None`` is passed as the " "second argument." msgstr "" +"一些元路徑尋檢器僅支援頂層引入。當第二個引數傳入 ``None`` 以外的值時,這些引" +"入器將始終回傳 ``None``。" #: ../../reference/import.rst:320 msgid "" @@ -431,6 +567,9 @@ msgid "" "modules, and one that knows how to import modules from an :term:`import " "path` (i.e. the :term:`path based finder`)." msgstr "" +"Python 的預設 :data:`sys.meta_path` 有三個元路徑尋檢器,一個知道如何引入內建" +"模組,一個知道如何引入凍結模組,還有一個知道如何從 :term:`import path` 引入模" +"組(即 :term:`path based finder`)。" #: ../../reference/import.rst:325 msgid "" @@ -440,18 +579,23 @@ msgid "" "if the finder does not implement :meth:`~importlib.abc.MetaPathFinder." "find_spec`." msgstr "" +"元路徑尋檢器的 :meth:`~importlib.abc.MetaPathFinder.find_spec` 方法取代了 :" +"meth:`!find_module`,後者現在已被棄用。雖然它將繼續正常工作,但引入機制僅在尋" +"檢器未實作 :meth:`~importlib.abc.MetaPathFinder.find_spec` 時才會嘗試使用它。" #: ../../reference/import.rst:332 msgid "" "Use of :meth:`!find_module` by the import system now raises :exc:" "`ImportWarning`." -msgstr "" +msgstr "引入系統現在使用 :meth:`!find_module` 時將引發 :exc:`ImportWarning`。" #: ../../reference/import.rst:336 msgid "" ":meth:`!find_module` has been removed. Use :meth:`~importlib.abc." "MetaPathFinder.find_spec` instead." msgstr "" +":meth:`!find_module` 已被移除。請改用 :meth:`~importlib.abc.MetaPathFinder." +"find_spec`。" #: ../../reference/import.rst:342 msgid "Loading" @@ -830,7 +974,13 @@ msgid "" "back to ``__package__``." msgstr "" -#: ../../reference/import.rst:602 +#: ../../reference/import.rst:599 +msgid "" +"``__package__`` will cease to be set or taken into consideration by the " +"import system or standard library." +msgstr "" + +#: ../../reference/import.rst:606 msgid "" "The ``__spec__`` attribute must be set to the module spec that was used when " "importing the module. Setting ``__spec__`` appropriately applies equally to :" @@ -839,18 +989,18 @@ msgid "" "cases <main_spec>`." msgstr "" -#: ../../reference/import.rst:608 +#: ../../reference/import.rst:612 msgid "" "When ``__spec__.parent`` is not set, ``__package__`` is used as a fallback." msgstr "" -#: ../../reference/import.rst:613 +#: ../../reference/import.rst:617 msgid "" "``__spec__.parent`` is used as a fallback when ``__package__`` is not " "defined." msgstr "" -#: ../../reference/import.rst:619 +#: ../../reference/import.rst:623 msgid "" "If the module is a package (either regular or namespace), the module " "object's ``__path__`` attribute must be set. The value must be iterable, " @@ -860,11 +1010,11 @@ msgid "" "rules>`." msgstr "" -#: ../../reference/import.rst:626 +#: ../../reference/import.rst:630 msgid "Non-package modules should not have a ``__path__`` attribute." msgstr "" -#: ../../reference/import.rst:631 +#: ../../reference/import.rst:635 msgid "" "``__file__`` is optional (if set, value must be a string). It indicates the " "pathname of the file from which the module was loaded (if loaded from a " @@ -875,7 +1025,7 @@ msgid "" "semantic meaning (e.g. a module loaded from a database)." msgstr "" -#: ../../reference/import.rst:640 +#: ../../reference/import.rst:644 msgid "" "If ``__file__`` is set then the ``__cached__`` attribute might also be set, " "which is the path to any compiled version of the code (e.g. byte-compiled " @@ -883,7 +1033,7 @@ msgid "" "simply point to where the compiled file would exist (see :pep:`3147`)." msgstr "" -#: ../../reference/import.rst:646 +#: ../../reference/import.rst:650 msgid "" "Note that ``__cached__`` may be set even if ``__file__`` is not set. " "However, that scenario is quite atypical. Ultimately, the loader is what " @@ -893,22 +1043,28 @@ msgid "" "be appropriate." msgstr "" -#: ../../reference/import.rst:653 +#: ../../reference/import.rst:657 msgid "" "It is **strongly** recommended that you rely on :attr:`__spec__` instead of " "``__cached__``." msgstr "" -#: ../../reference/import.rst:659 +#: ../../reference/import.rst:660 +msgid "" +"``__cached__`` will cease to be set or taken into consideration by the " +"import system or standard library." +msgstr "" + +#: ../../reference/import.rst:667 msgid "module.__path__" msgstr "module.__path__" -#: ../../reference/import.rst:661 +#: ../../reference/import.rst:669 msgid "" "By definition, if a module has a ``__path__`` attribute, it is a package." msgstr "" -#: ../../reference/import.rst:663 +#: ../../reference/import.rst:671 msgid "" "A package's ``__path__`` attribute is used during imports of its " "subpackages. Within the import machinery, it functions much the same as :" @@ -917,7 +1073,7 @@ msgid "" "than :data:`sys.path`." msgstr "" -#: ../../reference/import.rst:669 +#: ../../reference/import.rst:677 msgid "" "``__path__`` must be an iterable of strings, but it may be empty. The same " "rules used for :data:`sys.path` also apply to a package's ``__path__``, and :" @@ -925,7 +1081,7 @@ msgid "" "package's ``__path__``." msgstr "" -#: ../../reference/import.rst:674 +#: ../../reference/import.rst:682 msgid "" "A package's ``__init__.py`` file may set or alter the package's ``__path__`` " "attribute, and this was typically the way namespace packages were " @@ -935,18 +1091,18 @@ msgid "" "``__path__`` correctly for the namespace package." msgstr "" -#: ../../reference/import.rst:682 +#: ../../reference/import.rst:690 msgid "Module reprs" msgstr "" -#: ../../reference/import.rst:684 +#: ../../reference/import.rst:692 msgid "" "By default, all modules have a usable repr, however depending on the " "attributes set above, and in the module's spec, you can more explicitly " "control the repr of module objects." msgstr "" -#: ../../reference/import.rst:688 +#: ../../reference/import.rst:696 msgid "" "If the module has a spec (``__spec__``), the import machinery will try to " "generate a repr from it. If that fails or there is no spec, the import " @@ -956,45 +1112,45 @@ msgid "" "for whatever information is missing." msgstr "" -#: ../../reference/import.rst:695 +#: ../../reference/import.rst:703 msgid "Here are the exact rules used:" msgstr "" -#: ../../reference/import.rst:697 +#: ../../reference/import.rst:705 msgid "" "If the module has a ``__spec__`` attribute, the information in the spec is " "used to generate the repr. The \"name\", \"loader\", \"origin\", and " "\"has_location\" attributes are consulted." msgstr "" -#: ../../reference/import.rst:701 +#: ../../reference/import.rst:709 msgid "" "If the module has a ``__file__`` attribute, this is used as part of the " "module's repr." msgstr "" -#: ../../reference/import.rst:704 +#: ../../reference/import.rst:712 msgid "" "If the module has no ``__file__`` but does have a ``__loader__`` that is not " "``None``, then the loader's repr is used as part of the module's repr." msgstr "" -#: ../../reference/import.rst:707 +#: ../../reference/import.rst:715 msgid "Otherwise, just use the module's ``__name__`` in the repr." msgstr "" -#: ../../reference/import.rst:709 +#: ../../reference/import.rst:717 msgid "" "Use of :meth:`!module_repr`, having been deprecated since Python 3.4, was " "removed in Python 3.12 and is no longer called during the resolution of a " "module's repr." msgstr "" -#: ../../reference/import.rst:717 +#: ../../reference/import.rst:725 msgid "Cached bytecode invalidation" msgstr "" -#: ../../reference/import.rst:719 +#: ../../reference/import.rst:727 msgid "" "Before Python loads cached bytecode from a ``.pyc`` file, it checks whether " "the cache is up-to-date with the source ``.py`` file. By default, Python " @@ -1004,7 +1160,7 @@ msgid "" "source's metadata." msgstr "" -#: ../../reference/import.rst:726 +#: ../../reference/import.rst:734 msgid "" "Python also supports \"hash-based\" cache files, which store a hash of the " "source file's contents rather than its metadata. There are two variants of " @@ -1018,17 +1174,17 @@ msgid "" "option:`--check-hash-based-pycs` flag." msgstr "" -#: ../../reference/import.rst:737 +#: ../../reference/import.rst:745 msgid "" "Added hash-based ``.pyc`` files. Previously, Python only supported timestamp-" "based invalidation of bytecode caches." msgstr "" -#: ../../reference/import.rst:743 +#: ../../reference/import.rst:751 msgid "The Path Based Finder" msgstr "" -#: ../../reference/import.rst:748 +#: ../../reference/import.rst:756 msgid "" "As mentioned previously, Python comes with several default meta path " "finders. One of these, called the :term:`path based finder` (:class:" @@ -1037,14 +1193,14 @@ msgid "" "a location to search for modules." msgstr "" -#: ../../reference/import.rst:754 +#: ../../reference/import.rst:762 msgid "" "The path based finder itself doesn't know how to import anything. Instead, " "it traverses the individual path entries, associating each of them with a " "path entry finder that knows how to handle that particular kind of path." msgstr "" -#: ../../reference/import.rst:758 +#: ../../reference/import.rst:766 msgid "" "The default set of path entry finders implement all the semantics for " "finding modules on the file system, handling special file types such as " @@ -1055,14 +1211,14 @@ msgid "" "from zipfiles." msgstr "" -#: ../../reference/import.rst:765 +#: ../../reference/import.rst:773 msgid "" "Path entries need not be limited to file system locations. They can refer " "to URLs, database queries, or any other location that can be specified as a " "string." msgstr "" -#: ../../reference/import.rst:769 +#: ../../reference/import.rst:777 msgid "" "The path based finder provides additional hooks and protocols so that you " "can extend and customize the types of searchable path entries. For example, " @@ -1073,7 +1229,7 @@ msgid "" "from the web." msgstr "" -#: ../../reference/import.rst:777 +#: ../../reference/import.rst:785 msgid "" "A word of warning: this section and the previous both use the term *finder*, " "distinguishing between them by using the terms :term:`meta path finder` and :" @@ -1084,7 +1240,7 @@ msgid "" "process, as keyed off the :data:`sys.meta_path` traversal." msgstr "" -#: ../../reference/import.rst:785 +#: ../../reference/import.rst:793 msgid "" "By contrast, path entry finders are in a sense an implementation detail of " "the path based finder, and in fact, if the path based finder were to be " @@ -1092,11 +1248,11 @@ msgid "" "would be invoked." msgstr "" -#: ../../reference/import.rst:792 +#: ../../reference/import.rst:800 msgid "Path entry finders" msgstr "" -#: ../../reference/import.rst:800 +#: ../../reference/import.rst:808 msgid "" "The :term:`path based finder` is responsible for finding and loading Python " "modules and packages whose location is specified with a string :term:`path " @@ -1104,7 +1260,7 @@ msgid "" "not be limited to this." msgstr "" -#: ../../reference/import.rst:805 +#: ../../reference/import.rst:813 msgid "" "As a meta path finder, the :term:`path based finder` implements the :meth:" "`~importlib.abc.MetaPathFinder.find_spec` protocol previously described, " @@ -1112,7 +1268,7 @@ msgid "" "modules are found and loaded from the :term:`import path`." msgstr "" -#: ../../reference/import.rst:810 +#: ../../reference/import.rst:818 msgid "" "Three variables are used by the :term:`path based finder`, :data:`sys." "path`, :data:`sys.path_hooks` and :data:`sys.path_importer_cache`. The " @@ -1120,7 +1276,7 @@ msgid "" "additional ways that the import machinery can be customized." msgstr "" -#: ../../reference/import.rst:815 +#: ../../reference/import.rst:823 msgid "" ":data:`sys.path` contains a list of strings providing search locations for " "modules and packages. It is initialized from the :envvar:`PYTHONPATH` " @@ -1132,7 +1288,7 @@ msgid "" "other data types are ignored." msgstr "" -#: ../../reference/import.rst:824 +#: ../../reference/import.rst:832 msgid "" "The :term:`path based finder` is a :term:`meta path finder`, so the import " "machinery begins the :term:`import path` search by calling the path based " @@ -1144,7 +1300,7 @@ msgid "" "top level import and :data:`sys.path` is used." msgstr "" -#: ../../reference/import.rst:833 +#: ../../reference/import.rst:841 msgid "" "The path based finder iterates over every entry in the search path, and for " "each of these, looks for an appropriate :term:`path entry finder` (:class:" @@ -1160,7 +1316,7 @@ msgid "" "finder to perform the path entry search again." msgstr "" -#: ../../reference/import.rst:846 +#: ../../reference/import.rst:854 msgid "" "If the path entry is not present in the cache, the path based finder " "iterates over every callable in :data:`sys.path_hooks`. Each of the :term:" @@ -1176,7 +1332,7 @@ msgid "" "decode the argument, it should raise :exc:`ImportError`." msgstr "" -#: ../../reference/import.rst:860 +#: ../../reference/import.rst:868 msgid "" "If :data:`sys.path_hooks` iteration ends with no :term:`path entry finder` " "being returned, then the path based finder's :meth:`~importlib.machinery." @@ -1186,7 +1342,7 @@ msgid "" "could not find the module." msgstr "" -#: ../../reference/import.rst:867 +#: ../../reference/import.rst:875 msgid "" "If a :term:`path entry finder` *is* returned by one of the :term:`path entry " "hook` callables on :data:`sys.path_hooks`, then the following protocol is " @@ -1194,7 +1350,7 @@ msgid "" "the module." msgstr "" -#: ../../reference/import.rst:872 +#: ../../reference/import.rst:880 msgid "" "The current working directory -- denoted by an empty string -- is handled " "slightly differently from other entries on :data:`sys.path`. First, if the " @@ -1206,18 +1362,18 @@ msgid "" "and not the empty string." msgstr "" -#: ../../reference/import.rst:882 +#: ../../reference/import.rst:890 msgid "Path entry finder protocol" msgstr "" -#: ../../reference/import.rst:884 +#: ../../reference/import.rst:892 msgid "" "In order to support imports of modules and initialized packages and also to " "contribute portions to namespace packages, path entry finders must implement " "the :meth:`~importlib.abc.PathEntryFinder.find_spec` method." msgstr "" -#: ../../reference/import.rst:888 +#: ../../reference/import.rst:896 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` takes two arguments: the " "fully qualified name of the module being imported, and the (optional) target " @@ -1225,21 +1381,21 @@ msgid "" "spec will always have \"loader\" set (with one exception)." msgstr "" -#: ../../reference/import.rst:893 +#: ../../reference/import.rst:901 msgid "" "To indicate to the import machinery that the spec represents a namespace :" "term:`portion`, the path entry finder sets ``submodule_search_locations`` to " "a list containing the portion." msgstr "" -#: ../../reference/import.rst:897 +#: ../../reference/import.rst:905 msgid "" ":meth:`~importlib.abc.PathEntryFinder.find_spec` replaced :meth:`!" "find_loader` and :meth:`!find_module`, both of which are now deprecated, but " "will be used if ``find_spec()`` is not defined." msgstr "" -#: ../../reference/import.rst:903 +#: ../../reference/import.rst:911 msgid "" "Older path entry finders may implement one of these two deprecated methods " "instead of ``find_spec()``. The methods are still respected for the sake of " @@ -1247,14 +1403,14 @@ msgid "" "path entry finder, the legacy methods are ignored." msgstr "" -#: ../../reference/import.rst:908 +#: ../../reference/import.rst:916 msgid "" ":meth:`!find_loader` takes one argument, the fully qualified name of the " "module being imported. ``find_loader()`` returns a 2-tuple where the first " "item is the loader and the second item is a namespace :term:`portion`." msgstr "" -#: ../../reference/import.rst:913 +#: ../../reference/import.rst:921 msgid "" "For backwards compatibility with other implementations of the import " "protocol, many path entry finders also support the same, traditional " @@ -1264,7 +1420,7 @@ msgid "" "initial call to the path hook)." msgstr "" -#: ../../reference/import.rst:920 +#: ../../reference/import.rst:928 msgid "" "The ``find_module()`` method on path entry finders is deprecated, as it does " "not allow the path entry finder to contribute portions to namespace " @@ -1273,28 +1429,28 @@ msgid "" "preference to ``find_module()``." msgstr "" -#: ../../reference/import.rst:926 +#: ../../reference/import.rst:934 msgid "" "Calls to :meth:`!find_module` and :meth:`!find_loader` by the import system " "will raise :exc:`ImportWarning`." msgstr "" -#: ../../reference/import.rst:931 +#: ../../reference/import.rst:939 msgid "``find_module()`` and ``find_loader()`` have been removed." msgstr "" -#: ../../reference/import.rst:936 +#: ../../reference/import.rst:944 msgid "Replacing the standard import system" msgstr "" -#: ../../reference/import.rst:938 +#: ../../reference/import.rst:946 msgid "" "The most reliable mechanism for replacing the entire import system is to " "delete the default contents of :data:`sys.meta_path`, replacing them " "entirely with a custom meta path hook." msgstr "" -#: ../../reference/import.rst:942 +#: ../../reference/import.rst:950 msgid "" "If it is acceptable to only alter the behaviour of import statements without " "affecting other APIs that access the import system, then replacing the " @@ -1303,7 +1459,7 @@ msgid "" "statements within that module." msgstr "" -#: ../../reference/import.rst:948 +#: ../../reference/import.rst:956 msgid "" "To selectively prevent the import of some modules from a hook early on the " "meta path (rather than disabling the standard import system entirely), it is " @@ -1313,11 +1469,11 @@ msgid "" "exception terminates it immediately." msgstr "" -#: ../../reference/import.rst:958 +#: ../../reference/import.rst:966 msgid "Package Relative Imports" msgstr "" -#: ../../reference/import.rst:960 +#: ../../reference/import.rst:968 msgid "" "Relative imports use leading dots. A single leading dot indicates a relative " "import, starting with the current package. Two or more leading dots indicate " @@ -1325,7 +1481,7 @@ msgid "" "after the first. For example, given the following package layout::" msgstr "" -#: ../../reference/import.rst:965 +#: ../../reference/import.rst:973 msgid "" "package/\n" " __init__.py\n" @@ -1349,13 +1505,13 @@ msgstr "" " moduleZ.py\n" " moduleA.py" -#: ../../reference/import.rst:976 +#: ../../reference/import.rst:984 msgid "" "In either ``subpackage1/moduleX.py`` or ``subpackage1/__init__.py``, the " "following are valid relative imports::" msgstr "" -#: ../../reference/import.rst:979 +#: ../../reference/import.rst:987 msgid "" "from .moduleY import spam\n" "from .moduleY import spam as ham\n" @@ -1371,28 +1527,28 @@ msgstr "" "from ..subpackage2.moduleZ import eggs\n" "from ..moduleA import foo" -#: ../../reference/import.rst:986 +#: ../../reference/import.rst:994 msgid "" "Absolute imports may use either the ``import <>`` or ``from <> import <>`` " "syntax, but relative imports may only use the second form; the reason for " "this is that::" msgstr "" -#: ../../reference/import.rst:990 +#: ../../reference/import.rst:998 msgid "import XXX.YYY.ZZZ" msgstr "import XXX.YYY.ZZZ" -#: ../../reference/import.rst:992 +#: ../../reference/import.rst:1000 msgid "" "should expose ``XXX.YYY.ZZZ`` as a usable expression, but .moduleY is not a " "valid expression." msgstr "" -#: ../../reference/import.rst:999 +#: ../../reference/import.rst:1007 msgid "Special considerations for __main__" msgstr "" -#: ../../reference/import.rst:1001 +#: ../../reference/import.rst:1009 msgid "" "The :mod:`__main__` module is a special case relative to Python's import " "system. As noted :ref:`elsewhere <programs>`, the ``__main__`` module is " @@ -1403,17 +1559,17 @@ msgid "" "interpreter is invoked." msgstr "" -#: ../../reference/import.rst:1012 +#: ../../reference/import.rst:1020 msgid "__main__.__spec__" msgstr "__main__.__spec__" -#: ../../reference/import.rst:1014 +#: ../../reference/import.rst:1022 msgid "" "Depending on how :mod:`__main__` is initialized, ``__main__.__spec__`` gets " "set appropriately or to ``None``." msgstr "" -#: ../../reference/import.rst:1017 +#: ../../reference/import.rst:1025 msgid "" "When Python is started with the :option:`-m` option, ``__spec__`` is set to " "the module spec of the corresponding module or package. ``__spec__`` is also " @@ -1421,30 +1577,30 @@ msgid "" "directory, zipfile or other :data:`sys.path` entry." msgstr "" -#: ../../reference/import.rst:1022 +#: ../../reference/import.rst:1030 msgid "" "In :ref:`the remaining cases <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:1026 +#: ../../reference/import.rst:1034 msgid "interactive prompt" msgstr "" -#: ../../reference/import.rst:1027 +#: ../../reference/import.rst:1035 msgid ":option:`-c` option" msgstr ":option:`-c` 選項" -#: ../../reference/import.rst:1028 +#: ../../reference/import.rst:1036 msgid "running from stdin" msgstr "" -#: ../../reference/import.rst:1029 +#: ../../reference/import.rst:1037 msgid "running directly from a source or bytecode file" msgstr "" -#: ../../reference/import.rst:1031 +#: ../../reference/import.rst:1039 msgid "" "Note that ``__main__.__spec__`` is always ``None`` in the last case, *even " "if* the file could technically be imported directly as a module instead. Use " @@ -1452,7 +1608,7 @@ msgid "" "`__main__`." msgstr "" -#: ../../reference/import.rst:1036 +#: ../../reference/import.rst:1044 msgid "" "Note also that even when ``__main__`` corresponds with an importable module " "and ``__main__.__spec__`` is set accordingly, they're still considered " @@ -1461,11 +1617,11 @@ msgid "" "populate the ``__main__`` namespace, and not during normal import." msgstr "" -#: ../../reference/import.rst:1044 +#: ../../reference/import.rst:1052 msgid "References" msgstr "" -#: ../../reference/import.rst:1046 +#: ../../reference/import.rst:1054 msgid "" "The import machinery has evolved considerably since Python's early days. " "The original `specification for packages <https://www.python.org/doc/essays/" @@ -1473,37 +1629,37 @@ msgid "" "since the writing of that document." msgstr "" -#: ../../reference/import.rst:1051 +#: ../../reference/import.rst:1059 msgid "" "The original specification for :data:`sys.meta_path` was :pep:`302`, with " "subsequent extension in :pep:`420`." msgstr "" -#: ../../reference/import.rst:1054 +#: ../../reference/import.rst:1062 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:1058 +#: ../../reference/import.rst:1066 msgid "" ":pep:`366` describes the addition of the ``__package__`` attribute for " "explicit relative imports in main modules." msgstr "" -#: ../../reference/import.rst:1061 +#: ../../reference/import.rst:1069 msgid "" ":pep:`328` introduced absolute and explicit relative imports and initially " "proposed ``__name__`` for semantics :pep:`366` would eventually specify for " "``__package__``." msgstr "" -#: ../../reference/import.rst:1065 +#: ../../reference/import.rst:1073 msgid ":pep:`338` defines executing modules as scripts." msgstr "" -#: ../../reference/import.rst:1067 +#: ../../reference/import.rst:1075 msgid "" ":pep:`451` adds the encapsulation of per-module import state in spec " "objects. It also off-loads most of the boilerplate responsibilities of " @@ -1512,15 +1668,15 @@ msgid "" "finders and loaders." msgstr "" -#: ../../reference/import.rst:1074 +#: ../../reference/import.rst:1082 msgid "Footnotes" msgstr "註解" -#: ../../reference/import.rst:1075 +#: ../../reference/import.rst:1083 msgid "See :class:`types.ModuleType`." msgstr "參閱 :class:`types.ModuleType`。" -#: ../../reference/import.rst:1077 +#: ../../reference/import.rst:1085 msgid "" "The importlib implementation avoids using the return value directly. " "Instead, it gets the module object by looking the module name up in :data:" @@ -1602,22 +1758,22 @@ msgstr "sys.meta_path" msgid "find_spec" msgstr "find_spec" -#: ../../reference/import.rst:745 +#: ../../reference/import.rst:753 msgid "path based finder" msgstr "path based finder(基於路徑的搜尋器)" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:802 msgid "sys.path" msgstr "sys.path" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:802 msgid "sys.path_hooks" msgstr "sys.path_hooks" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:802 msgid "sys.path_importer_cache" msgstr "sys.path_importer_cache" -#: ../../reference/import.rst:794 +#: ../../reference/import.rst:802 msgid "PYTHONPATH" msgstr "PYTHONPATH" diff --git a/reference/index.po b/reference/index.po index 5f843e0bd9..9f265f75e9 100644 --- a/reference/index.po +++ b/reference/index.po @@ -6,7 +6,7 @@ # Steven Hsu <hsuhaochun@gmail.com>, 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-07-06 22:07+0800\n" diff --git a/reference/introduction.po b/reference/introduction.po index 39a65f1e47..41407dcc00 100644 --- a/reference/introduction.po +++ b/reference/introduction.po @@ -5,9 +5,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2017-09-22 18:27+0000\n" "Last-Translator: Liang-Bo Wang <me@liang2.tw>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" diff --git a/reference/lexical_analysis.po b/reference/lexical_analysis.po index f849a461eb..00ed2f6f6f 100644 --- a/reference/lexical_analysis.po +++ b/reference/lexical_analysis.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-07 03:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -430,7 +430,7 @@ msgstr "" #: ../../reference/lexical_analysis.rst:316 msgid "" "*Other_ID_Start* - explicit list of characters in `PropList.txt <https://www." -"unicode.org/Public/15.0.0/ucd/PropList.txt>`_ to support backwards " +"unicode.org/Public/15.1.0/ucd/PropList.txt>`_ to support backwards " "compatibility" msgstr "" @@ -447,7 +447,7 @@ msgstr "" #: ../../reference/lexical_analysis.rst:324 msgid "" "A non-normative HTML file listing all valid identifier characters for " -"Unicode 15.0.0 can be found at https://www.unicode.org/Public/15.0.0/ucd/" +"Unicode 15.1.0 can be found at https://www.unicode.org/Public/15.1.0/ucd/" "DerivedCoreProperties.txt" msgstr "" @@ -1387,7 +1387,8 @@ msgid "Footnotes" msgstr "註解" #: ../../reference/lexical_analysis.rst:1047 -msgid "https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt" +#, fuzzy +msgid "https://www.unicode.org/Public/15.1.0/ucd/NameAliases.txt" msgstr "https://www.unicode.org/Public/15.0.0/ucd/NameAliases.txt" #: ../../reference/lexical_analysis.rst:8 diff --git a/reference/simple_stmts.po b/reference/simple_stmts.po index 59b0e04ecf..b29815534b 100644 --- a/reference/simple_stmts.po +++ b/reference/simple_stmts.po @@ -4,7 +4,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2018-05-23 16:17+0000\n" diff --git a/reference/toplevel_components.po b/reference/toplevel_components.po index 83d92d67a5..11726a155b 100644 --- a/reference/toplevel_components.po +++ b/reference/toplevel_components.po @@ -7,7 +7,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-05-09 00:15+0000\n" "PO-Revision-Date: 2022-12-01 01:37+0800\n" diff --git a/sphinx.po b/sphinx.po index c3d4944366..f044d5a9c6 100644 --- a/sphinx.po +++ b/sphinx.po @@ -6,9 +6,9 @@ # Steven Hsu <hsuhaochun@gmail.com>, 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-17 00:03+0000\n" +"POT-Creation-Date: 2024-09-27 00:14+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-" @@ -37,15 +37,15 @@ msgstr "顯示原始碼" msgid "Download" msgstr "下載" -#: ../../tools/templates/download.html:14 -msgid "Download Python %(release)s Documentation" -msgstr "下載 Python %(release)s 說明文件" - #: ../../tools/templates/download.html:16 +msgid "Download Python %(dl_version)s Documentation" +msgstr "下載 Python %(dl_version)s 說明文件" + +#: ../../tools/templates/download.html:18 msgid "Last updated on: %(last_updated)s." msgstr "最後更新時間:%(last_updated)s。" -#: ../../tools/templates/download.html:18 +#: ../../tools/templates/download.html:20 msgid "" "To download an archive containing all the documents for this version of\n" "Python in one of various formats, follow one of links in this table." @@ -53,119 +53,119 @@ msgstr "" "要下載包含這個 Python 版本所有文件的歸檔,可以遵循這個表格中的其中一個連結," "以取得各種格式的文件。" -#: ../../tools/templates/download.html:23 +#: ../../tools/templates/download.html:25 msgid "Format" msgstr "格式" -#: ../../tools/templates/download.html:24 +#: ../../tools/templates/download.html:26 msgid "Packed as .zip" msgstr "打包成 .zip" -#: ../../tools/templates/download.html:25 +#: ../../tools/templates/download.html:27 msgid "Packed as .tar.bz2" msgstr "打包成 .tar.bz2" -#: ../../tools/templates/download.html:28 +#: ../../tools/templates/download.html:30 msgid "PDF" -msgstr "" +msgstr "PDF" -#: ../../tools/templates/download.html:29 +#: ../../tools/templates/download.html:31 msgid "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-a4.zip\">Download</a> (ca. " -"%(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.zip\">Download</a> " +"(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-a4.zip\">下載</a> (ca. " +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.zip\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:30 +#: ../../tools/templates/download.html:32 msgid "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-a4.tar.bz2\">Download</a> " -"(ca. %(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.tar.bz2\">Download</" +"a> (ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-a4.tar.bz2\">下載</a> (ca. " -"%(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-pdf-a4.tar.bz2\">下載</a> " +"(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:33 +#: ../../tools/templates/download.html:35 msgid "HTML" msgstr "HTML" -#: ../../tools/templates/download.html:34 +#: ../../tools/templates/download.html:36 msgid "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-html.zip\">Download</a> (ca. " -"%(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.zip\">Download</a> " +"(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-html.zip\">下載</a> (ca. " +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.zip\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:35 +#: ../../tools/templates/download.html:37 msgid "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-html.tar.bz2\">Download</a> " +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.tar.bz2\">Download</a> " "(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-html.tar.bz2\">下載</a> (ca. " -"%(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-html.tar.bz2\">下載</a> " +"(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:38 +#: ../../tools/templates/download.html:40 msgid "Plain text" msgstr "純文字" -#: ../../tools/templates/download.html:39 +#: ../../tools/templates/download.html:41 msgid "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-text.zip\">Download</a> (ca. " -"%(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.zip\">Download</a> " +"(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-text.zip\">下載</a> (ca. " +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.zip\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:40 +#: ../../tools/templates/download.html:42 msgid "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-text.tar.bz2\">Download</a> " +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.tar.bz2\">Download</a> " "(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-text.tar.bz2\">下載</a> (ca. " -"%(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-text.tar.bz2\">下載</a> " +"(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:43 +#: ../../tools/templates/download.html:45 msgid "Texinfo" msgstr "Texinfo" -#: ../../tools/templates/download.html:44 +#: ../../tools/templates/download.html:46 msgid "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-texinfo.zip\">Download</a> (ca. " -"%(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.zip\">Download</a> " +"(ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-texinfo.zip\">下載</a> (ca. " +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.zip\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:45 +#: ../../tools/templates/download.html:47 msgid "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-texinfo.tar.bz2\">Download</a> " -"(ca. %(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.tar.bz2\">Download</" +"a> (ca. %(download_size)s MiB)" msgstr "" -"<a href=\"%(dlbase)s/python-%(release)s-docs-texinfo.tar.bz2\">下載</a> (ca. " -"%(download_size)s MiB)" +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs-texinfo.tar.bz2\">下載</a> " +"(ca. %(download_size)s MiB)" -#: ../../tools/templates/download.html:48 +#: ../../tools/templates/download.html:50 msgid "EPUB" msgstr "EPUB" -#: ../../tools/templates/download.html:49 +#: ../../tools/templates/download.html:51 msgid "" -"<a href=\"%(dlbase)s/python-%(release)s-docs.epub\">Download</a> (ca. " +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">Download</a> (ca. " "%(download_size)s MiB)" msgstr "" -"<a href=\"%(dlbase)s/python-%(release)s-docs.epub\">下載</a> (ca. " +"<a href=\"%(dl_base)s/python-%(dl_version)s-docs.epub\">下載</a> (ca. " "%(download_size)s MiB)" -#: ../../tools/templates/download.html:54 +#: ../../tools/templates/download.html:56 msgid "These archives contain all the content in the documentation." msgstr "這些歸檔包含了說明文件中的所有內容。" -#: ../../tools/templates/download.html:57 +#: ../../tools/templates/download.html:59 msgid "Unpacking" msgstr "解壓縮" -#: ../../tools/templates/download.html:59 +#: ../../tools/templates/download.html:61 msgid "" "Unix users should download the .tar.bz2 archives; these are bzipped tar\n" "archives and can be handled in the usual way using tar and the bzip2\n" @@ -180,7 +180,7 @@ msgstr "" "net\">Info-ZIP</a> 解壓縮程式來處理 ZIP 歸檔。.tar.bz2 歸檔提供最佳壓縮率和最" "快的下載時間。" -#: ../../tools/templates/download.html:65 +#: ../../tools/templates/download.html:67 msgid "" "Windows users can use the ZIP archives since those are customary on that\n" "platform. These are created on Unix using the Info-ZIP zip program." @@ -188,11 +188,11 @@ msgstr "" "Windows 使用者可以使用 ZIP 歸檔,因為這在該平台上是常見的。這些是在 Unix 上使" "用 Info-ZIP zip 程式建立的。" -#: ../../tools/templates/download.html:69 +#: ../../tools/templates/download.html:71 msgid "Problems" msgstr "問題" -#: ../../tools/templates/download.html:71 +#: ../../tools/templates/download.html:73 msgid "" "If you have comments or suggestions for the Python documentation, please " "send\n" @@ -532,23 +532,3 @@ msgstr "" #: ../../tools/templates/layout.html:16 msgid "the current stable release" msgstr "當前的穩定發行版" - -#~ msgid "PDF (US-Letter paper size)" -#~ msgstr "PDF(美國信紙大小)" - -#~ msgid "" -#~ "<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-letter.zip\">Download</" -#~ "a> (ca. %(download_size)s MiB)" -#~ msgstr "" -#~ "<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-letter.zip\">下載</a> " -#~ "(ca. %(download_size)s MiB)" - -#~ msgid "" -#~ "<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-letter.tar." -#~ "bz2\">Download</a> (ca. %(download_size)s MiB)" -#~ msgstr "" -#~ "<a href=\"%(dlbase)s/python-%(release)s-docs-pdf-letter.tar.bz2\">下載</" -#~ "a> (ca. %(download_size)s MiB)" - -#~ msgid "PDF (A4 paper size)" -#~ msgstr "PDF(A4 紙張大小)" diff --git a/tutorial/appendix.po b/tutorial/appendix.po index a97d68dc37..703dc079b8 100644 --- a/tutorial/appendix.po +++ b/tutorial/appendix.po @@ -6,9 +6,9 @@ # Leon H., 2017 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-07-05 14:35+0800\n" "Last-Translator: meowmeowcat <meowmeowcat1211@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -28,11 +28,43 @@ msgstr "附錄" msgid "Interactive Mode" msgstr "互動模式" -#: ../../tutorial/appendix.rst:16 +#: ../../tutorial/appendix.rst:13 +msgid "" +"There are two variants of the interactive :term:`REPL`. The classic basic " +"interpreter is supported on all platforms with minimal line control " +"capabilities." +msgstr "" + +#: ../../tutorial/appendix.rst:17 +msgid "" +"On Windows, or Unix-like systems with :mod:`curses` support, a new " +"interactive shell is used by default. This one supports color, multiline " +"editing, history browsing, and paste mode. To disable color, see :ref:" +"`using-on-controlling-color` for details. Function keys provide some " +"additional functionality. :kbd:`F1` enters the interactive help browser :mod:" +"`pydoc`. :kbd:`F2` allows for browsing command-line history without output " +"nor the :term:`>>>` and :term:`...` prompts. :kbd:`F3` enters \"paste " +"mode\", which makes pasting larger blocks of code easier. Press :kbd:`F3` to " +"return to the regular prompt." +msgstr "" + +#: ../../tutorial/appendix.rst:28 +msgid "" +"When using the new interactive shell, exit the shell by typing :kbd:`exit` " +"or :kbd:`quit`. Adding call parentheses after those commands is not required." +msgstr "" + +#: ../../tutorial/appendix.rst:32 +msgid "" +"If the new interactive shell is not desired, it can be disabled via the :" +"envvar:`PYTHON_BASIC_REPL` environment variable." +msgstr "" + +#: ../../tutorial/appendix.rst:38 msgid "Error Handling" msgstr "錯誤處理" -#: ../../tutorial/appendix.rst:18 +#: ../../tutorial/appendix.rst:40 msgid "" "When an error occurs, the interpreter prints an error message and a stack " "trace. In interactive mode, it then returns to the primary prompt; when " @@ -51,7 +83,7 @@ msgstr "" "內部不一致和一些記憶體耗盡的情況。所有的錯誤訊息都被寫入標準錯誤輸出;被執行" "指令的正常輸出被寫入標準輸出。" -#: ../../tutorial/appendix.rst:28 +#: ../../tutorial/appendix.rst:50 msgid "" "Typing the interrupt character (usually :kbd:`Control-C` or :kbd:`Delete`) " "to the primary or secondary prompt cancels the input and returns to the " @@ -64,11 +96,11 @@ msgstr "" "會引發 :exc:`KeyboardInterrupt` 例外,但可以通過 :keyword:`try` 陳述式來處" "理。" -#: ../../tutorial/appendix.rst:38 +#: ../../tutorial/appendix.rst:60 msgid "Executable Python Scripts" msgstr "可執行的 Python 腳本" -#: ../../tutorial/appendix.rst:40 +#: ../../tutorial/appendix.rst:62 msgid "" "On BSD'ish Unix systems, Python scripts can be made directly executable, " "like shell scripts, by putting the line ::" @@ -76,11 +108,11 @@ msgstr "" "在類 BSD 的 Unix 系統上,Python 腳本可以直接執行,就像 shell 腳本一樣,通過放" "置以下這行: ::" -#: ../../tutorial/appendix.rst:43 +#: ../../tutorial/appendix.rst:65 msgid "#!/usr/bin/env python3" msgstr "#!/usr/bin/env python3" -#: ../../tutorial/appendix.rst:45 +#: ../../tutorial/appendix.rst:67 msgid "" "(assuming that the interpreter is on the user's :envvar:`PATH`) at the " "beginning of the script and giving the file an executable mode. The ``#!`` " @@ -94,17 +126,17 @@ msgstr "" "(``'\\n'``) 結尾,而不是 Windows (``'\\r\\n'``) 換行。 請注意,井號 ``'#'`` " "用於在 Python 中開始註解。" -#: ../../tutorial/appendix.rst:52 +#: ../../tutorial/appendix.rst:74 msgid "" "The script can be given an executable mode, or permission, using the :" "program:`chmod` command." msgstr "可以使用 :program:`chmod` 指令為腳本賦予可執行模式或權限。" -#: ../../tutorial/appendix.rst:55 +#: ../../tutorial/appendix.rst:77 msgid "$ chmod +x myscript.py" msgstr "$ chmod +x myscript.py" -#: ../../tutorial/appendix.rst:59 +#: ../../tutorial/appendix.rst:81 msgid "" "On Windows systems, there is no notion of an \"executable mode\". The " "Python installer automatically associates ``.py`` files with ``python.exe`` " @@ -116,11 +148,11 @@ msgstr "" "py`` 檔案與 ``python.exe`` 聯繫起來,這樣雙擊 Python 檔案就會作為腳本運行。副" "檔名也可以是 ``.pyw``,在這種情況下,通常會出現的控制台視窗會被隱藏。" -#: ../../tutorial/appendix.rst:69 +#: ../../tutorial/appendix.rst:91 msgid "The Interactive Startup File" msgstr "互動式啟動檔案" -#: ../../tutorial/appendix.rst:71 +#: ../../tutorial/appendix.rst:93 msgid "" "When you use Python interactively, it is frequently handy to have some " "standard commands executed every time the interpreter is started. You can " @@ -132,7 +164,7 @@ msgstr "" "可以通過設置一個名為 :envvar:`PYTHONSTARTUP` 的環境變數來實現,該變數是一個包" "含啟動指令的檔案名。它的功能類似 Unix shell 的 :file:`.profile` 。" -#: ../../tutorial/appendix.rst:77 +#: ../../tutorial/appendix.rst:99 msgid "" "This file is only read in interactive sessions, not when Python reads " "commands from a script, and not when :file:`/dev/tty` is given as the " @@ -148,7 +180,7 @@ msgstr "" "動模式中不加限定地使用。你也可以在這個檔案中改變 ``sys.ps1`` 和 ``sys.ps2`` " "等提示字元。" -#: ../../tutorial/appendix.rst:85 +#: ../../tutorial/appendix.rst:107 msgid "" "If you want to read an additional start-up file from the current directory, " "you can program this in the global start-up file using code like ``if os." @@ -161,7 +193,7 @@ msgstr "" "式碼設定這個行為。如果你想在一個腳本中使用啟動檔案,你必須在腳本中明確地這樣" "做: ::" -#: ../../tutorial/appendix.rst:91 +#: ../../tutorial/appendix.rst:113 msgid "" "import os\n" "filename = os.environ.get('PYTHONSTARTUP')\n" @@ -177,11 +209,11 @@ msgstr "" " startup_file = fobj.read()\n" " exec(startup_file)" -#: ../../tutorial/appendix.rst:102 +#: ../../tutorial/appendix.rst:124 msgid "The Customization Modules" msgstr "客製化模組" -#: ../../tutorial/appendix.rst:104 +#: ../../tutorial/appendix.rst:126 msgid "" "Python provides two hooks to let you customize it: :index:`sitecustomize` " "and :index:`usercustomize`. To see how it works, you need first to find the " @@ -192,7 +224,7 @@ msgstr "" "index:`usercustomize` 。要看它是如何運作的,你首先需要找到你的 site-packages " "的位置。啟動 Python 並運行這段程式碼: ::" -#: ../../tutorial/appendix.rst:108 +#: ../../tutorial/appendix.rst:130 msgid "" ">>> import site\n" ">>> site.getusersitepackages()\n" @@ -202,7 +234,7 @@ msgstr "" ">>> site.getusersitepackages()\n" "'/home/user/.local/lib/python3.x/site-packages'" -#: ../../tutorial/appendix.rst:112 +#: ../../tutorial/appendix.rst:134 msgid "" "Now you can create a file named :file:`usercustomize.py` in that directory " "and put anything you want in it. It will affect every invocation of Python, " @@ -213,7 +245,7 @@ msgstr "" "要的任何內容放入其中。它會影響 Python 的每次呼叫,除非它以 :option:`-s` 選項" "啟動以禁用自動 import 。" -#: ../../tutorial/appendix.rst:116 +#: ../../tutorial/appendix.rst:138 msgid "" ":index:`sitecustomize` works in the same way, but is typically created by an " "administrator of the computer in the global site-packages directory, and is " @@ -224,10 +256,10 @@ msgstr "" "packages 目錄下建立,並在 :index:`usercustomize` 之前 import 。更多細節請參" "閱 :mod:`site` 模組的文件。" -#: ../../tutorial/appendix.rst:123 +#: ../../tutorial/appendix.rst:145 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/appendix.rst:124 +#: ../../tutorial/appendix.rst:146 msgid "A problem with the GNU Readline package may prevent this." msgstr "GNU Readline 套件的一個問題可能會阻止這一點。" diff --git a/tutorial/appetite.po b/tutorial/appetite.po index 520d0ba0af..42d5ffb0b0 100644 --- a/tutorial/appetite.po +++ b/tutorial/appetite.po @@ -7,7 +7,7 @@ # Liang-Bo Wang <me@liang2.tw>, 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-24 00:11+0000\n" "PO-Revision-Date: 2021-10-03 17:39+0800\n" diff --git a/tutorial/classes.po b/tutorial/classes.po index d22456afc1..491479937b 100644 --- a/tutorial/classes.po +++ b/tutorial/classes.po @@ -6,9 +6,9 @@ # Steven Hsu <hsuhaochun@gmail.com>, 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2022-12-26 23:12+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -156,7 +156,7 @@ msgid "" "may both define a function ``maximize`` without confusion --- users of the " "modules must prefix it with the module name." msgstr "" -"*命名空間*\\ 是從名稱到物件的映射。大部分的命名空間現在都是以 Python 的 " +"*命名空間*\\ 是從名稱到物件的對映。大部分的命名空間現在都是以 Python 的 " "dictionary 被實作,但通常不會以任何方式被察覺(除了性能),且它可能會在未來改" "變。命名空間的例子有:內建名稱的集合(包含如 :func:`abs` 的函式,和內建的例外" "名稱);模組中的全域 (global) 名稱;和在函式調用中的區域 (local) 名稱。某種意" @@ -533,13 +533,13 @@ msgid "" "then ``MyClass.i`` and ``MyClass.f`` are valid attribute references, " "returning an integer and a function object, respectively. Class attributes " "can also be assigned to, so you can change the value of ``MyClass.i`` by " -"assignment. :attr:`!__doc__` is also a valid attribute, returning the " +"assignment. :attr:`~type.__doc__` is also a valid attribute, returning the " "docstring belonging to the class: ``\"A simple example class\"``." msgstr "" "那麼 ``MyClass.i`` 和 ``MyClass.f`` 都是有效的屬性參照,會分別回傳一個整數和" "一個函式物件。Class 屬性也可以被指派 (assign),所以你可以透過賦值改變 " -"``MyClass.i`` 的值。:attr:`!__doc__` 也是一個有效的屬性,會回傳屬於該 class " -"的說明字串 (docstring):``\"A simple example class\"``。" +"``MyClass.i`` 的值。:attr:`~type.__doc__` 也是一個有效的屬性,會回傳屬於該 " +"class 的說明字串 (docstring):``\"A simple example class\"``。" #: ../../tutorial/classes.rst:282 msgid "" @@ -828,6 +828,22 @@ msgid "" ">>> d.tricks # unexpectedly shared by all dogs\n" "['roll over', 'play dead']" msgstr "" +"class Dog:\n" +"\n" +" tricks = [] # 誤用類別變數\n" +"\n" +" def __init__(self, name):\n" +" self.name = name\n" +"\n" +" def add_trick(self, trick):\n" +" self.tricks.append(trick)\n" +"\n" +">>> d = Dog('Fido')\n" +">>> e = Dog('Buddy')\n" +">>> d.add_trick('roll over')\n" +">>> e.add_trick('play dead')\n" +">>> d.tricks # 出乎意料地被所有 dog 共享\n" +"['roll over', 'play dead']" #: ../../tutorial/classes.rst:445 msgid "Correct design of the class should use an instance variable instead::" @@ -853,6 +869,23 @@ msgid "" ">>> e.tricks\n" "['play dead']" msgstr "" +"class Dog:\n" +"\n" +" def __init__(self, name):\n" +" self.name = name\n" +" self.tricks = [] # 為每一個 dog 建立空 list\n" +"\n" +" def add_trick(self, trick):\n" +" self.tricks.append(trick)\n" +"\n" +">>> d = Dog('Fido')\n" +">>> e = Dog('Buddy')\n" +">>> d.add_trick('roll over')\n" +">>> e.add_trick('play dead')\n" +">>> d.tricks\n" +"['roll over']\n" +">>> e.tricks\n" +"['play dead']" #: ../../tutorial/classes.rst:469 msgid "Random Remarks" @@ -970,6 +1003,17 @@ msgid "" "\n" " h = g" msgstr "" +"# 在類別以外定義的函式\n" +"def f1(self, x, y):\n" +" return min(x, x+y)\n" +"\n" +"class C:\n" +" f = f1\n" +"\n" +" def g(self):\n" +" return 'hello world'\n" +"\n" +" h = g" #: ../../tutorial/classes.rst:530 msgid "" @@ -1702,15 +1746,15 @@ msgstr "註解" msgid "" "Except for one thing. Module objects have a secret read-only attribute " "called :attr:`~object.__dict__` which returns the dictionary used to " -"implement the module's namespace; the name :attr:`~object.__dict__` is an " -"attribute but not a global name. Obviously, using this violates the " -"abstraction of namespace implementation, and should be restricted to things " -"like post-mortem debuggers." +"implement the module's namespace; the name ``__dict__`` is an attribute but " +"not a global name. Obviously, using this violates the abstraction of " +"namespace implementation, and should be restricted to things like post-" +"mortem debuggers." msgstr "" "有一個例外。模組物件有一個秘密的唯讀屬性,稱為 :attr:`~object.__dict__`,它回" -"傳用於實作模組命名空間的 dictionary;:attr:`~object.__dict__` 這個名稱是一個" -"屬性但不是全域名稱。顯然,使用此屬性將違反命名空間實作的抽象化,而應該僅限用" -"於事後除錯器 (post-mortem debugger) 之類的東西。" +"傳用於實作模組命名空間的 dictionary;``__dict__`` 這個名稱是一個屬性但不是全" +"域名稱。顯然,使用此屬性將違反命名空間實作的抽象化,而應該僅限用於事後除錯器 " +"(post-mortem debugger) 之類的東西。" #: ../../tutorial/classes.rst:343 msgid "object" @@ -1727,18 +1771,3 @@ msgstr "name(名稱)" #: ../../tutorial/classes.rst:679 msgid "mangling" msgstr "mangling(修飾)" - -#~ msgid "" -#~ "The other kind of instance attribute reference is a *method*. A method is " -#~ "a function that \"belongs to\" an object. (In Python, the term method is " -#~ "not unique to class instances: other object types can have methods as " -#~ "well. For example, list objects have methods called append, insert, " -#~ "remove, sort, and so on. However, in the following discussion, we'll use " -#~ "the term method exclusively to mean methods of class instance objects, " -#~ "unless explicitly stated otherwise.)" -#~ msgstr "" -#~ "實例的另一種屬性參照是 *method*。Method 是一個「屬於」物件的函式。(在 " -#~ "Python 中,術語 method 並不是 class 實例所獨有的:其他物件型別也可以有 " -#~ "method。例如,list 物件具有稱為 append、insert、remove、sort 等 method。但" -#~ "是,在下面的討論中,我們將用術語 method 來專門表示 class 實例物件的 " -#~ "method,除非另有明確說明。)" diff --git a/tutorial/controlflow.po b/tutorial/controlflow.po index f4ec564dcb..c0a2f46f22 100644 --- a/tutorial/controlflow.po +++ b/tutorial/controlflow.po @@ -9,9 +9,9 @@ # Steven Hsu <hsuhaochun@gmail.com>, 2021-2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-28 00:13+0000\n" "PO-Revision-Date: 2022-07-24 14:52+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -293,56 +293,122 @@ msgstr "" "`tut-structures`\\ 章節中,我們會討論更多關於 :func:`list` 的細節。" #: ../../tutorial/controlflow.rst:164 -msgid "" -":keyword:`!break` and :keyword:`!continue` Statements, and :keyword:`!else` " -"Clauses on Loops" -msgstr "" -"迴圈內的 :keyword:`!break` 和 :keyword:`!continue` 陳述式及 :keyword:`!else` " -"子句" +msgid ":keyword:`!break` and :keyword:`!continue` Statements" +msgstr ":keyword:`!break` 和 :keyword:`!continue` 陳述式" #: ../../tutorial/controlflow.rst:166 msgid "" "The :keyword:`break` statement breaks out of the innermost enclosing :" -"keyword:`for` or :keyword:`while` loop." +"keyword:`for` or :keyword:`while` loop::" msgstr "" ":keyword:`break` 陳述式,終止包含它的最內部 :keyword:`for` 或 :keyword:" -"`while` 迴圈。" +"`while` 迴圈: ::" #: ../../tutorial/controlflow.rst:169 msgid "" -"A :keyword:`!for` or :keyword:`!while` loop can include an :keyword:`!else` " -"clause." +">>> for n in range(2, 10):\n" +"... for x in range(2, n):\n" +"... if n % x == 0:\n" +"... print(f\"{n} equals {x} * {n//x}\")\n" +"... break\n" +"...\n" +"4 equals 2 * 2\n" +"6 equals 2 * 3\n" +"8 equals 2 * 4\n" +"9 equals 3 * 3" msgstr "" -":keyword:`!for` 和 :keyword:`!while` 迴圈可帶有一個 :keyword:`!else` 子句" +">>> for n in range(2, 10):\n" +"... for x in range(2, n):\n" +"... if n % x == 0:\n" +"... print(f\"{n} equals {x} * {n//x}\")\n" +"... break\n" +"...\n" +"4 equals 2 * 2\n" +"6 equals 2 * 3\n" +"8 equals 2 * 4\n" +"9 equals 3 * 3" -#: ../../tutorial/controlflow.rst:171 +#: ../../tutorial/controlflow.rst:180 +msgid "" +"The :keyword:`continue` statement continues with the next iteration of the " +"loop::" +msgstr ":keyword:`continue` 陳述式讓所屬的迴圈繼續執行下個疊代: ::" + +#: ../../tutorial/controlflow.rst:183 +msgid "" +">>> for num in range(2, 10):\n" +"... if num % 2 == 0:\n" +"... print(f\"Found an even number {num}\")\n" +"... continue\n" +"... print(f\"Found an odd number {num}\")\n" +"...\n" +"Found an even number 2\n" +"Found an odd number 3\n" +"Found an even number 4\n" +"Found an odd number 5\n" +"Found an even number 6\n" +"Found an odd number 7\n" +"Found an even number 8\n" +"Found an odd number 9" +msgstr "" +">>> for num in range(2, 10):\n" +"... if num % 2 == 0:\n" +"... print(f\"Found an even number {num}\")\n" +"... continue\n" +"... print(f\"Found an odd number {num}\")\n" +"...\n" +"Found an even number 2\n" +"Found an odd number 3\n" +"Found an even number 4\n" +"Found an odd number 5\n" +"Found an even number 6\n" +"Found an odd number 7\n" +"Found an even number 8\n" +"Found an odd number 9" + +#: ../../tutorial/controlflow.rst:201 +msgid ":keyword:`!else` Clauses on Loops" +msgstr "迴圈的 :keyword:`!else` 子句" + +#: ../../tutorial/controlflow.rst:203 +msgid "" +"In a :keyword:`!for` or :keyword:`!while` loop the :keyword:`!break` " +"statement may be paired with an :keyword:`!else` clause. If the loop " +"finishes without executing the :keyword:`!break`, the :keyword:`!else` " +"clause executes." +msgstr "" + +#: ../../tutorial/controlflow.rst:207 msgid "" "In a :keyword:`for` loop, the :keyword:`!else` clause is executed after the " -"loop reaches its final iteration." +"loop finishes its final iteration, that is, if no break occurred." msgstr "" -"在 :keyword:`for` 迴圈中,:keyword:`!else` 子句會在迴圈到達最終的疊代後執行。" +"在 :keyword:`for` 迴圈中,:keyword:`!else` 子句會在迴圈完成最終的疊代後執行。" -#: ../../tutorial/controlflow.rst:174 +#: ../../tutorial/controlflow.rst:210 msgid "" "In a :keyword:`while` loop, it's executed after the loop's condition becomes " "false." msgstr "在 :keyword:`while` 迴圈中,它會在迴圈條件變為 false 後執行。" -#: ../../tutorial/controlflow.rst:176 +#: ../../tutorial/controlflow.rst:212 msgid "" "In either kind of loop, the :keyword:`!else` clause is **not** executed if " -"the loop was terminated by a :keyword:`break`." +"the loop was terminated by a :keyword:`break`. Of course, other ways of " +"ending the loop early, such as a :keyword:`return` or a raised exception, " +"will also skip execution of the :keyword:`else` clause." msgstr "" "在任何一種迴圈中,如果迴圈由 :keyword:`break` 終止,則不會執行 :keyword:`!" -"else` 子句。" +"else` 子句。當然其他提早結束迴圈的方式(例如 :keyword:`return` 或引發例外)也" +"會跳過 :keyword:`else` 子句的執行。" -#: ../../tutorial/controlflow.rst:179 +#: ../../tutorial/controlflow.rst:217 msgid "" "This is exemplified in the following :keyword:`!for` loop, which searches " "for prime numbers::" msgstr "下面的 :keyword:`!for` 迴圈對此進行了舉例說明,該迴圈用以搜索質數: ::" -#: ../../tutorial/controlflow.rst:182 +#: ../../tutorial/controlflow.rst:220 msgid "" ">>> for n in range(2, 10):\n" "... for x in range(2, n):\n" @@ -363,74 +429,43 @@ msgid "" "9 equals 3 * 3" msgstr "" -#: ../../tutorial/controlflow.rst:200 +#: ../../tutorial/controlflow.rst:238 msgid "" "(Yes, this is the correct code. Look closely: the ``else`` clause belongs " -"to the :keyword:`for` loop, **not** the :keyword:`if` statement.)" +"to the ``for`` loop, **not** the ``if`` statement.)" msgstr "" -"(沒錯,這是正確的程式碼。請看仔細:``else`` 子句屬於 :keyword:`for` 迴圈,**" -"並非** :keyword:`if` 陳述式。)" +"(沒錯,這是正確的程式碼。請看仔細:``else`` 子句屬於 ``for`` 迴圈,**並非** " +"``if`` 陳述式。)" -#: ../../tutorial/controlflow.rst:203 -msgid "" -"When used with a loop, the ``else`` clause has more in common with the " -"``else`` clause of a :keyword:`try` statement than it does with that of :" -"keyword:`if` statements: a :keyword:`try` statement's ``else`` clause runs " -"when no exception occurs, and a loop's ``else`` clause runs when no " -"``break`` occurs. For more on the :keyword:`!try` statement and exceptions, " -"see :ref:`tut-handling`." -msgstr "" -"當 ``else`` 子句用於迴圈時,相較於搭配 :keyword:`if` 陳述式使用,它的行為與 :" -"keyword:`try` 陳述式中的 ``else`` 子句更為相似::keyword:`try` 陳述式的 " -"``else`` 子句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有" -"任何 ``break`` 發生時執行。更多有關 :keyword:`!try` 陳述式和例外的介紹,見" -"\\ :ref:`tut-handling`。" - -#: ../../tutorial/controlflow.rst:210 +#: ../../tutorial/controlflow.rst:241 msgid "" -"The :keyword:`continue` statement, also borrowed from C, continues with the " -"next iteration of the loop::" +"One way to think of the else clause is to imagine it paired with the ``if`` " +"inside the loop. As the loop executes, it will run a sequence like if/if/if/" +"else. The ``if`` is inside the loop, encountered a number of times. If the " +"condition is ever true, a ``break`` will happen. If the condition is never " +"true, the ``else`` clause outside the loop will execute." msgstr "" -":keyword:`continue` 陳述式,亦承襲於 C 語言,讓所屬的迴圈繼續執行下個疊" -"代: ::" -#: ../../tutorial/controlflow.rst:213 +#: ../../tutorial/controlflow.rst:247 msgid "" -">>> for num in range(2, 10):\n" -"... if num % 2 == 0:\n" -"... print(\"Found an even number\", num)\n" -"... continue\n" -"... print(\"Found an odd number\", num)\n" -"...\n" -"Found an even number 2\n" -"Found an odd number 3\n" -"Found an even number 4\n" -"Found an odd number 5\n" -"Found an even number 6\n" -"Found an odd number 7\n" -"Found an even number 8\n" -"Found an odd number 9" -msgstr "" -">>> for num in range(2, 10):\n" -"... if num % 2 == 0:\n" -"... print(\"Found an even number\", num)\n" -"... continue\n" -"... print(\"Found an odd number\", num)\n" -"...\n" -"Found an even number 2\n" -"Found an odd number 3\n" -"Found an even number 4\n" -"Found an odd number 5\n" -"Found an even number 6\n" -"Found an odd number 7\n" -"Found an even number 8\n" -"Found an odd number 9" - -#: ../../tutorial/controlflow.rst:231 +"When used with a loop, the ``else`` clause has more in common with the " +"``else`` clause of a :keyword:`try` statement than it does with that of " +"``if`` statements: a ``try`` statement's ``else`` clause runs when no " +"exception occurs, and a loop's ``else`` clause runs when no ``break`` " +"occurs. For more on the ``try`` statement and exceptions, see :ref:`tut-" +"handling`." +msgstr "" +"當 ``else`` 子句用於迴圈時,相較於搭配 ``if`` 陳述式使用,它的行為與 :" +"keyword:`try` 陳述式中的 ``else`` 子句更為相似:``try`` 陳述式的 ``else`` 子" +"句在沒有發生例外 (exception) 時執行,而迴圈的 ``else`` 子句在沒有任何 " +"``break`` 發生時執行。更多有關 ``try`` 陳述式和例外的介紹,見\\ :ref:`tut-" +"handling`。" + +#: ../../tutorial/controlflow.rst:256 msgid ":keyword:`!pass` Statements" msgstr ":keyword:`!pass` 陳述式" -#: ../../tutorial/controlflow.rst:233 +#: ../../tutorial/controlflow.rst:258 msgid "" "The :keyword:`pass` statement does nothing. It can be used when a statement " "is required syntactically but the program requires no action. For example::" @@ -438,18 +473,18 @@ msgstr "" ":keyword:`pass` 陳述式不執行任何動作。它可用在語法上需要一個陳述式但程式不需" "要執行任何動作的時候。例如: ::" -#: ../../tutorial/controlflow.rst:236 +#: ../../tutorial/controlflow.rst:261 msgid "" ">>> while True:\n" "... pass # Busy-wait for keyboard interrupt (Ctrl+C)\n" "..." msgstr "" -#: ../../tutorial/controlflow.rst:240 +#: ../../tutorial/controlflow.rst:265 msgid "This is commonly used for creating minimal classes::" msgstr "這經常用於建立簡單的 class(類別): ::" -#: ../../tutorial/controlflow.rst:242 +#: ../../tutorial/controlflow.rst:267 msgid "" ">>> class MyEmptyClass:\n" "... pass\n" @@ -459,7 +494,7 @@ msgstr "" "... pass\n" "..." -#: ../../tutorial/controlflow.rst:246 +#: ../../tutorial/controlflow.rst:271 msgid "" "Another place :keyword:`pass` can be used is as a place-holder for a " "function or conditional body when you are working on new code, allowing you " @@ -469,18 +504,18 @@ msgstr "" ":keyword:`pass` 亦可作為一個函式或條件判斷主體的預留位置,在你撰寫新的程式碼" "時讓你保持在更抽象的思維層次。:keyword:`!pass` 會直接被忽略: ::" -#: ../../tutorial/controlflow.rst:250 +#: ../../tutorial/controlflow.rst:275 msgid "" ">>> def initlog(*args):\n" "... pass # Remember to implement this!\n" "..." msgstr "" -#: ../../tutorial/controlflow.rst:258 +#: ../../tutorial/controlflow.rst:283 msgid ":keyword:`!match` Statements" msgstr ":keyword:`!match` 陳述式" -#: ../../tutorial/controlflow.rst:260 +#: ../../tutorial/controlflow.rst:285 msgid "" "A :keyword:`match` statement takes an expression and compares its value to " "successive patterns given as one or more case blocks. This is superficially " @@ -496,14 +531,14 @@ msgstr "" "言中的模式匹配 (pattern matching) 更為相近。只有第一個匹配成功的模式會被執" "行,而它也可以將成分(序列元素或物件屬性)從值中提取到變數中。" -#: ../../tutorial/controlflow.rst:268 +#: ../../tutorial/controlflow.rst:293 msgid "" "The simplest form compares a subject value against one or more literals::" msgstr "" "最簡單的形式,是將一個主題值 (subject value) 與一個或多個字面值 (literal) 進" "行比較: ::" -#: ../../tutorial/controlflow.rst:270 +#: ../../tutorial/controlflow.rst:295 msgid "" "def http_error(status):\n" " match status:\n" @@ -527,7 +562,7 @@ msgstr "" " case _:\n" " return \"Something's wrong with the internet\"" -#: ../../tutorial/controlflow.rst:281 +#: ../../tutorial/controlflow.rst:306 msgid "" "Note the last block: the \"variable name\" ``_`` acts as a *wildcard* and " "never fails to match. If no case matches, none of the branches is executed." @@ -535,12 +570,12 @@ msgstr "" "請注意最後一段:「變數名稱」\\ ``_`` 是作為\\ *通用字元 (wildcard)*\\ 的角" "色,且永遠不會匹配失敗。如果沒有 case 匹配成功,則不會執行任何的分支。" -#: ../../tutorial/controlflow.rst:284 +#: ../../tutorial/controlflow.rst:309 msgid "" "You can combine several literals in a single pattern using ``|`` (\"or\")::" msgstr "你可以使用 ``|``\\ (「或」)來將多個字面值組合在單一模式中: ::" -#: ../../tutorial/controlflow.rst:286 +#: ../../tutorial/controlflow.rst:311 msgid "" "case 401 | 403 | 404:\n" " return \"Not allowed\"" @@ -548,14 +583,14 @@ msgstr "" "case 401 | 403 | 404:\n" " return \"Not allowed\"" -#: ../../tutorial/controlflow.rst:289 +#: ../../tutorial/controlflow.rst:314 msgid "" "Patterns can look like unpacking assignments, and can be used to bind " "variables::" msgstr "" "模式可以看起來像是拆解賦值 (unpacking assignment),且可以用來連結變數: ::" -#: ../../tutorial/controlflow.rst:292 +#: ../../tutorial/controlflow.rst:317 msgid "" "# point is an (x, y) tuple\n" "match point:\n" @@ -571,7 +606,7 @@ msgid "" " raise ValueError(\"Not a point\")" msgstr "" -#: ../../tutorial/controlflow.rst:305 +#: ../../tutorial/controlflow.rst:330 msgid "" "Study that one carefully! The first pattern has two literals, and can be " "thought of as an extension of the literal pattern shown above. But the next " @@ -585,7 +620,7 @@ msgstr "" "(bind)* 了來自主題 (``point``) 的一個值。第四個模式會擷取兩個值,這使得它在概" "念上類似於拆解賦值 ``(x, y) = point``。" -#: ../../tutorial/controlflow.rst:312 +#: ../../tutorial/controlflow.rst:337 msgid "" "If you are using classes to structure your data you can use the class name " "followed by an argument list resembling a constructor, but with the ability " @@ -594,7 +629,7 @@ msgstr "" "如果你要用 class 來結構化你的資料,你可以使用該 class 的名稱加上一個引數列" "表,類似一個建構式 (constructor),但它能夠將屬性擷取到變數中: ::" -#: ../../tutorial/controlflow.rst:316 +#: ../../tutorial/controlflow.rst:341 msgid "" "class Point:\n" " def __init__(self, x, y):\n" @@ -632,7 +667,7 @@ msgstr "" " case _:\n" " print(\"Not a point\")" -#: ../../tutorial/controlflow.rst:334 +#: ../../tutorial/controlflow.rst:359 msgid "" "You can use positional parameters with some builtin classes that provide an " "ordering for their attributes (e.g. dataclasses). You can also define a " @@ -646,7 +681,7 @@ msgstr "" "``__match_args__``,來定義模式中屬性們的特定位置。如果它被設定為 (\"x\", " "\"y\"),則以下的模式都是等價的(且都會將屬性 ``y`` 連結到變數 ``var``): ::" -#: ../../tutorial/controlflow.rst:340 +#: ../../tutorial/controlflow.rst:365 msgid "" "Point(1, var)\n" "Point(1, y=var)\n" @@ -658,7 +693,7 @@ msgstr "" "Point(x=1, y=var)\n" "Point(y=var, x=1)" -#: ../../tutorial/controlflow.rst:345 +#: ../../tutorial/controlflow.rst:370 msgid "" "A recommended way to read patterns is to look at them as an extended form of " "what you would put on the left of an assignment, to understand which " @@ -674,7 +709,7 @@ msgstr "" "的 ``x=`` 及 ``y=``)或 class 名稱(由它們後面的 \"(...)\" 被辨識,如上面的 " "``Point``)則永遠無法被賦值。" -#: ../../tutorial/controlflow.rst:352 +#: ../../tutorial/controlflow.rst:377 msgid "" "Patterns can be arbitrarily nested. For example, if we have a short list of " "Points, with ``__match_args__`` added, we could match it like this::" @@ -682,7 +717,7 @@ msgstr "" "模式可以任意地被巢套 (nested)。例如,如果我們有一個由某些點所組成的簡短 " "list,我們就可以像這樣加入 ``__match_args__`` 來對它進行匹配: ::" -#: ../../tutorial/controlflow.rst:355 +#: ../../tutorial/controlflow.rst:380 msgid "" "class Point:\n" " __match_args__ = ('x', 'y')\n" @@ -720,7 +755,7 @@ msgstr "" " case _:\n" " print(\"Something else\")" -#: ../../tutorial/controlflow.rst:373 +#: ../../tutorial/controlflow.rst:398 msgid "" "We can add an ``if`` clause to a pattern, known as a \"guard\". If the " "guard is false, ``match`` goes on to try the next case block. Note that " @@ -730,7 +765,7 @@ msgstr "" "則 ``match`` 會繼續嘗試下一個 case 區塊。請注意,值的擷取會發生在防護的評估之" "前: ::" -#: ../../tutorial/controlflow.rst:377 +#: ../../tutorial/controlflow.rst:402 msgid "" "match point:\n" " case Point(x, y) if x == y:\n" @@ -744,11 +779,11 @@ msgstr "" " case Point(x, y):\n" " print(f\"Not on the diagonal\")" -#: ../../tutorial/controlflow.rst:383 +#: ../../tutorial/controlflow.rst:408 msgid "Several other key features of this statement:" msgstr "此種陳述式的其他幾個重要特色:" -#: ../../tutorial/controlflow.rst:385 +#: ../../tutorial/controlflow.rst:410 msgid "" "Like unpacking assignments, tuple and list patterns have exactly the same " "meaning and actually match arbitrary sequences. An important exception is " @@ -757,7 +792,7 @@ msgstr "" "與拆解賦值的情況類似,tuple(元組)和 list 模式具有完全相同的意義,而且實際上" "可以匹配任意的序列。一個重要的例外,是它們不能匹配疊代器 (iterator) 或字串。" -#: ../../tutorial/controlflow.rst:389 +#: ../../tutorial/controlflow.rst:414 msgid "" "Sequence patterns support extended unpacking: ``[x, y, *rest]`` and ``(x, y, " "*rest)`` work similar to unpacking assignments. The name after ``*`` may " @@ -769,27 +804,27 @@ msgstr "" "``_``,所以 ``(x, y, *_)`` 會匹配一個至少兩項的序列,且不會連結那兩項以外的其" "餘項。" -#: ../../tutorial/controlflow.rst:394 +#: ../../tutorial/controlflow.rst:419 msgid "" "Mapping patterns: ``{\"bandwidth\": b, \"latency\": l}`` captures the " "``\"bandwidth\"`` and ``\"latency\"`` values from a dictionary. Unlike " "sequence patterns, extra keys are ignored. An unpacking like ``**rest`` is " "also supported. (But ``**_`` would be redundant, so it is not allowed.)" msgstr "" -"映射模式 (mapping pattern):``{\"bandwidth\": b, \"latency\": l}`` 能從一個 " +"對映模式 (mapping pattern):``{\"bandwidth\": b, \"latency\": l}`` 能從一個 " "dictionary(字典)中擷取 ``\"bandwidth\"`` 及 ``\"latency\"`` 的值。與序列模" "式不同,額外的鍵 (key) 會被忽略。一種像是 ``**rest`` 的拆解方式,也是可被支援" "的。(但 ``**_`` 則是多餘的做法,所以它並不被允許。)" -#: ../../tutorial/controlflow.rst:399 +#: ../../tutorial/controlflow.rst:424 msgid "Subpatterns may be captured using the ``as`` keyword::" msgstr "使用關鍵字 ``as`` 可以擷取子模式 (subpattern): ::" -#: ../../tutorial/controlflow.rst:401 +#: ../../tutorial/controlflow.rst:426 msgid "case (Point(x1, y1), Point(x2, y2) as p2): ..." msgstr "case (Point(x1, y1), Point(x2, y2) as p2): ..." -#: ../../tutorial/controlflow.rst:403 +#: ../../tutorial/controlflow.rst:428 msgid "" "will capture the second element of the input as ``p2`` (as long as the input " "is a sequence of two points)" @@ -797,7 +832,7 @@ msgstr "" "將會擷取輸入的第二個元素作為 ``p2``\\ (只要該輸入是一個由兩個點所組成的序" "列)。" -#: ../../tutorial/controlflow.rst:406 +#: ../../tutorial/controlflow.rst:431 msgid "" "Most literals are compared by equality, however the singletons ``True``, " "``False`` and ``None`` are compared by identity." @@ -805,7 +840,7 @@ msgstr "" "大部分的字面值是藉由相等性 (equality) 來比較,但是單例物件 (singleton) " "``True``、``False`` 和 ``None`` 是藉由標識值 (identity) 來比較。" -#: ../../tutorial/controlflow.rst:409 +#: ../../tutorial/controlflow.rst:434 msgid "" "Patterns may use named constants. These must be dotted names to prevent " "them from being interpreted as capture variable::" @@ -813,7 +848,7 @@ msgstr "" "模式可以使用附名常數 (named constant)。這些模式必須是點分隔名稱,以免它們被解" "釋為擷取變數: ::" -#: ../../tutorial/controlflow.rst:412 +#: ../../tutorial/controlflow.rst:437 msgid "" "from enum import Enum\n" "class Color(Enum):\n" @@ -847,24 +882,24 @@ msgstr "" " case Color.BLUE:\n" " print(\"I'm feeling the blues :(\")" -#: ../../tutorial/controlflow.rst:428 +#: ../../tutorial/controlflow.rst:453 msgid "" "For a more detailed explanation and additional examples, you can look into :" "pep:`636` which is written in a tutorial format." msgstr "" "關於更詳細的解釋和其他範例,你可以閱讀 :pep:`636`,它是以教學的格式編寫而成。" -#: ../../tutorial/controlflow.rst:434 +#: ../../tutorial/controlflow.rst:459 msgid "Defining Functions" msgstr "定義函式 (function)" -#: ../../tutorial/controlflow.rst:436 +#: ../../tutorial/controlflow.rst:461 msgid "" "We can create a function that writes the Fibonacci series to an arbitrary " "boundary::" msgstr "我們可以建立一個函式來產生費式數列到任何一個上界: ::" -#: ../../tutorial/controlflow.rst:439 +#: ../../tutorial/controlflow.rst:464 msgid "" ">>> def fib(n): # write Fibonacci series up to n\n" "... \"\"\"Print a Fibonacci series up to n.\"\"\"\n" @@ -879,7 +914,7 @@ msgid "" "0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597" msgstr "" -#: ../../tutorial/controlflow.rst:456 +#: ../../tutorial/controlflow.rst:481 msgid "" "The keyword :keyword:`def` introduces a function *definition*. It must be " "followed by the function name and the parenthesized list of formal " @@ -889,7 +924,7 @@ msgstr "" "關鍵字 :keyword:`def` 介紹一個函式的\\ *定義*。它之後必須連著該函式的名稱和置" "於括號之中的一串參數。自下一行起,所有縮排的陳述式成為該函式的主體。" -#: ../../tutorial/controlflow.rst:461 +#: ../../tutorial/controlflow.rst:486 msgid "" "The first statement of the function body can optionally be a string literal; " "this string literal is the function's documentation string, or :dfn:" @@ -905,7 +940,7 @@ msgstr "" "件,或讓使用者能以互動的方式在原始碼中瀏覽文件。在原始碼中加入 docstring 是個" "好慣例,應該養成這樣的習慣。" -#: ../../tutorial/controlflow.rst:468 +#: ../../tutorial/controlflow.rst:493 msgid "" "The *execution* of a function introduces a new symbol table used for the " "local variables of the function. More precisely, all variable assignments " @@ -926,7 +961,7 @@ msgstr "" "域變數是在 :keyword:`global` 陳述式中被定義,或外層函式變數在 :keyword:" "`nonlocal` 陳述式中被定義)。" -#: ../../tutorial/controlflow.rst:479 +#: ../../tutorial/controlflow.rst:504 msgid "" "The actual parameters (arguments) to a function call are introduced in the " "local symbol table of the called function when it is called; thus, arguments " @@ -940,7 +975,7 @@ msgstr "" "永遠是一個物件的\\ *參照 (reference)*,而不是該物件的值)。 [#]_ 當一個函式呼" "叫別的函式或遞迴呼叫它自己時,在被呼叫的函式中會建立一個新的區域符號表。" -#: ../../tutorial/controlflow.rst:486 +#: ../../tutorial/controlflow.rst:511 msgid "" "A function definition associates the function name with the function object " "in the current symbol table. The interpreter recognizes the object pointed " @@ -951,7 +986,7 @@ msgstr "" "直譯器辨識為使用者自定函式 (user-defined function)。該值可以被指定給別的變數" "名,使該變數名也可以被當作函式使用。這是常見的重新命名方式: ::" -#: ../../tutorial/controlflow.rst:491 +#: ../../tutorial/controlflow.rst:516 msgid "" ">>> fib\n" "<function fib at 10042ed0>\n" @@ -965,7 +1000,7 @@ msgstr "" ">>> f(100)\n" "0 1 1 2 3 5 8 13 21 34 55 89" -#: ../../tutorial/controlflow.rst:497 +#: ../../tutorial/controlflow.rst:522 msgid "" "Coming from other languages, you might object that ``fib`` is not a function " "but a procedure since it doesn't return a value. In fact, even functions " @@ -980,7 +1015,7 @@ msgstr "" "亦有一個固定的回傳值。這個值稱為 ``None``\\ (它是一個內建名稱)。在直譯器中" "單獨使用 ``None`` 時,通常不會被顯示。你可以使用 :func:`print` 來看到它: ::" -#: ../../tutorial/controlflow.rst:504 +#: ../../tutorial/controlflow.rst:529 msgid "" ">>> fib(0)\n" ">>> print(fib(0))\n" @@ -990,13 +1025,13 @@ msgstr "" ">>> print(fib(0))\n" "None" -#: ../../tutorial/controlflow.rst:508 +#: ../../tutorial/controlflow.rst:533 msgid "" "It is simple to write a function that returns a list of the numbers of the " "Fibonacci series, instead of printing it::" msgstr "如果要寫一個函式回傳費式數列的 list 而不是直接印出它,這也很容易: ::" -#: ../../tutorial/controlflow.rst:511 +#: ../../tutorial/controlflow.rst:536 msgid "" ">>> def fib2(n): # return Fibonacci series up to n\n" "... \"\"\"Return a list containing the Fibonacci series up to n.\"\"\"\n" @@ -1012,11 +1047,11 @@ msgid "" "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]" msgstr "" -#: ../../tutorial/controlflow.rst:524 +#: ../../tutorial/controlflow.rst:549 msgid "This example, as usual, demonstrates some new Python features:" msgstr "這個例子一樣示範了一些新的 Python 特性:" -#: ../../tutorial/controlflow.rst:526 +#: ../../tutorial/controlflow.rst:551 msgid "" "The :keyword:`return` statement returns with a value from a function. :" "keyword:`!return` without an expression argument returns ``None``. Falling " @@ -1026,7 +1061,7 @@ msgstr "" "不外加一個運算式作為引數時會回傳 ``None``。一個函式執行到結束也會回傳 " "``None``。" -#: ../../tutorial/controlflow.rst:530 +#: ../../tutorial/controlflow.rst:555 msgid "" "The statement ``result.append(a)`` calls a *method* of the list object " "``result``. A method is a function that 'belongs' to an object and is named " @@ -1049,22 +1084,22 @@ msgstr "" "義在 list 物件中;它會在該 list 的末端加入一個新的元素。這個例子等同於 " "``result = result + [a]``,但更有效率。" -#: ../../tutorial/controlflow.rst:545 +#: ../../tutorial/controlflow.rst:570 msgid "More on Defining Functions" msgstr "深入了解函式定義" -#: ../../tutorial/controlflow.rst:547 +#: ../../tutorial/controlflow.rst:572 msgid "" "It is also possible to define functions with a variable number of arguments. " "There are three forms, which can be combined." msgstr "" "定義函式時使用的引數 (argument) 數量是可變的。總共有三種可以組合使用的形式。" -#: ../../tutorial/controlflow.rst:554 +#: ../../tutorial/controlflow.rst:579 msgid "Default Argument Values" msgstr "預設引數值" -#: ../../tutorial/controlflow.rst:556 +#: ../../tutorial/controlflow.rst:581 msgid "" "The most useful form is to specify a default value for one or more " "arguments. This creates a function that can be called with fewer arguments " @@ -1073,7 +1108,7 @@ msgstr "" "為一個或多個引數指定預設值是很有用的方式。函式建立後,可以用比定義時更少的引" "數呼叫該函式。例如: ::" -#: ../../tutorial/controlflow.rst:560 +#: ../../tutorial/controlflow.rst:585 msgid "" "def ask_ok(prompt, retries=4, reminder='Please try again!'):\n" " while True:\n" @@ -1099,22 +1134,22 @@ msgstr "" " raise ValueError('invalid user response')\n" " print(reminder)" -#: ../../tutorial/controlflow.rst:572 +#: ../../tutorial/controlflow.rst:597 msgid "This function can be called in several ways:" msgstr "該函式可以用以下幾種方式被呼叫:" -#: ../../tutorial/controlflow.rst:574 +#: ../../tutorial/controlflow.rst:599 msgid "" "giving only the mandatory argument: ``ask_ok('Do you really want to quit?')``" msgstr "只給必要引數:``ask_ok('Do you really want to quit?')``" -#: ../../tutorial/controlflow.rst:576 +#: ../../tutorial/controlflow.rst:601 msgid "" "giving one of the optional arguments: ``ask_ok('OK to overwrite the file?', " "2)``" msgstr "給予一個選擇性引數:``ask_ok('OK to overwrite the file?', 2)``" -#: ../../tutorial/controlflow.rst:578 +#: ../../tutorial/controlflow.rst:603 msgid "" "or even giving all arguments: ``ask_ok('OK to overwrite the file?', 2, 'Come " "on, only yes or no!')``" @@ -1122,19 +1157,19 @@ msgstr "" "給予所有引數:``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or " "no!')``" -#: ../../tutorial/controlflow.rst:581 +#: ../../tutorial/controlflow.rst:606 msgid "" "This example also introduces the :keyword:`in` keyword. This tests whether " "or not a sequence contains a certain value." msgstr "此例也使用了關鍵字 :keyword:`in`,用於測試序列中是否包含某個特定值。" -#: ../../tutorial/controlflow.rst:584 +#: ../../tutorial/controlflow.rst:609 msgid "" "The default values are evaluated at the point of function definition in the " "*defining* scope, so that ::" msgstr "預設值是在函式定義當下,於\\ *定義時*\\ 的作用域中求值,所以: ::" -#: ../../tutorial/controlflow.rst:587 +#: ../../tutorial/controlflow.rst:612 msgid "" "i = 5\n" "\n" @@ -1152,11 +1187,11 @@ msgstr "" "i = 6\n" "f()" -#: ../../tutorial/controlflow.rst:595 +#: ../../tutorial/controlflow.rst:620 msgid "will print ``5``." msgstr "將會輸出 ``5``。" -#: ../../tutorial/controlflow.rst:597 +#: ../../tutorial/controlflow.rst:622 msgid "" "**Important warning:** The default value is evaluated only once. This makes " "a difference when the default is a mutable object such as a list, " @@ -1167,7 +1202,7 @@ msgstr "" "(字典)或許多類別實例時,會產生不同的結果。例如,以下函式於後續呼叫時會累積" "曾經傳遞的引數: ::" -#: ../../tutorial/controlflow.rst:602 +#: ../../tutorial/controlflow.rst:627 msgid "" "def f(a, L=[]):\n" " L.append(a)\n" @@ -1185,11 +1220,11 @@ msgstr "" "print(f(2))\n" "print(f(3))" -#: ../../tutorial/controlflow.rst:610 +#: ../../tutorial/controlflow.rst:635 msgid "This will print ::" msgstr "將會輸出: ::" -#: ../../tutorial/controlflow.rst:612 +#: ../../tutorial/controlflow.rst:637 msgid "" "[1]\n" "[1, 2]\n" @@ -1199,13 +1234,13 @@ msgstr "" "[1, 2]\n" "[1, 2, 3]" -#: ../../tutorial/controlflow.rst:616 +#: ../../tutorial/controlflow.rst:641 msgid "" "If you don't want the default to be shared between subsequent calls, you can " "write the function like this instead::" msgstr "如果不想在後續呼叫之間共用預設值,應以如下方式編寫函式:" -#: ../../tutorial/controlflow.rst:619 +#: ../../tutorial/controlflow.rst:644 msgid "" "def f(a, L=None):\n" " if L is None:\n" @@ -1219,11 +1254,11 @@ msgstr "" " L.append(a)\n" " return L" -#: ../../tutorial/controlflow.rst:629 +#: ../../tutorial/controlflow.rst:654 msgid "Keyword Arguments" msgstr "關鍵字引數" -#: ../../tutorial/controlflow.rst:631 +#: ../../tutorial/controlflow.rst:656 msgid "" "Functions can also be called using :term:`keyword arguments <keyword " "argument>` of the form ``kwarg=value``. For instance, the following " @@ -1232,7 +1267,7 @@ msgstr "" "函式也可以使用\\ :term:`關鍵字引數 <keyword argument>`,以 ``kwarg=value`` 的" "形式呼叫。舉例來說,以下函式: ::" -#: ../../tutorial/controlflow.rst:634 +#: ../../tutorial/controlflow.rst:659 msgid "" "def parrot(voltage, state='a stiff', action='voom', type='Norwegian Blue'):\n" " print(\"-- This parrot wouldn't\", action, end=' ')\n" @@ -1246,7 +1281,7 @@ msgstr "" " print(\"-- Lovely plumage, the\", type)\n" " print(\"-- It's\", state, \"!\")" -#: ../../tutorial/controlflow.rst:640 +#: ../../tutorial/controlflow.rst:665 msgid "" "accepts one required argument (``voltage``) and three optional arguments " "(``state``, ``action``, and ``type``). This function can be called in any " @@ -1255,7 +1290,7 @@ msgstr "" "接受一個必要引數 (``voltage``) 和三個選擇性引數 (``state``,``action``,和 " "``type``)。該函式可用下列任一方式呼叫: ::" -#: ../../tutorial/controlflow.rst:644 +#: ../../tutorial/controlflow.rst:669 msgid "" "parrot(1000) # 1 positional " "argument\n" @@ -1268,11 +1303,11 @@ msgid "" "keyword" msgstr "" -#: ../../tutorial/controlflow.rst:651 +#: ../../tutorial/controlflow.rst:676 msgid "but all the following calls would be invalid::" msgstr "但以下呼叫方式都無效: ::" -#: ../../tutorial/controlflow.rst:653 +#: ../../tutorial/controlflow.rst:678 msgid "" "parrot() # required argument missing\n" "parrot(voltage=5.0, 'dead') # non-keyword argument after a keyword " @@ -1281,7 +1316,7 @@ msgid "" "parrot(actor='John Cleese') # unknown keyword argument" msgstr "" -#: ../../tutorial/controlflow.rst:658 +#: ../../tutorial/controlflow.rst:683 msgid "" "In a function call, keyword arguments must follow positional arguments. All " "the keyword arguments passed must match one of the arguments accepted by the " @@ -1297,7 +1332,7 @@ msgstr "" "則也包括必要引數,(\\ ``parrot(voltage=1000)`` 也有效)。一個引數不可多次被" "賦值,下面就是一個因此限制而無效的例子: ::" -#: ../../tutorial/controlflow.rst:666 +#: ../../tutorial/controlflow.rst:691 msgid "" ">>> def function(a):\n" "... pass\n" @@ -1315,7 +1350,7 @@ msgstr "" " File \"<stdin>\", line 1, in <module>\n" "TypeError: function() got multiple values for argument 'a'" -#: ../../tutorial/controlflow.rst:674 +#: ../../tutorial/controlflow.rst:699 msgid "" "When a final formal parameter of the form ``**name`` is present, it receives " "a dictionary (see :ref:`typesmapping`) containing all keyword arguments " @@ -1331,7 +1366,7 @@ msgstr "" "個 :ref:`tuple <tut-tuples>`,該 tuple 包含一般參數以外的位置引數(\\ " "``*name`` 必須出現在 ``**name`` 前面)。例如,若我們定義這樣的函式: ::" -#: ../../tutorial/controlflow.rst:682 +#: ../../tutorial/controlflow.rst:707 msgid "" "def cheeseshop(kind, *arguments, **keywords):\n" " print(\"-- Do you have any\", kind, \"?\")\n" @@ -1351,11 +1386,11 @@ msgstr "" " for kw in keywords:\n" " print(kw, \":\", keywords[kw])" -#: ../../tutorial/controlflow.rst:691 +#: ../../tutorial/controlflow.rst:716 msgid "It could be called like this::" msgstr "它可以被如此呼叫: ::" -#: ../../tutorial/controlflow.rst:693 +#: ../../tutorial/controlflow.rst:718 msgid "" "cheeseshop(\"Limburger\", \"It's very runny, sir.\",\n" " \"It's really very, VERY runny, sir.\",\n" @@ -1369,11 +1404,11 @@ msgstr "" " client=\"John Cleese\",\n" " sketch=\"Cheese Shop Sketch\")" -#: ../../tutorial/controlflow.rst:699 +#: ../../tutorial/controlflow.rst:724 msgid "and of course it would print:" msgstr "輸出結果如下: ::" -#: ../../tutorial/controlflow.rst:701 +#: ../../tutorial/controlflow.rst:726 msgid "" "-- Do you have any Limburger ?\n" "-- I'm sorry, we're all out of Limburger\n" @@ -1393,17 +1428,17 @@ msgstr "" "client : John Cleese\n" "sketch : Cheese Shop Sketch" -#: ../../tutorial/controlflow.rst:712 +#: ../../tutorial/controlflow.rst:737 msgid "" "Note that the order in which the keyword arguments are printed is guaranteed " "to match the order in which they were provided in the function call." msgstr "注意,關鍵字引數的輸出順序與呼叫函式時被提供的順序必定一致。" -#: ../../tutorial/controlflow.rst:716 +#: ../../tutorial/controlflow.rst:741 msgid "Special parameters" msgstr "特殊參數" -#: ../../tutorial/controlflow.rst:718 +#: ../../tutorial/controlflow.rst:743 msgid "" "By default, arguments may be passed to a Python function either by position " "or explicitly by keyword. For readability and performance, it makes sense to " @@ -1415,11 +1450,11 @@ msgstr "" "及效能,限制引數的傳遞方式是合理的,如此,開發者只需查看函式定義,即可確定各" "項目是按位置,按位置或關鍵字,還是按關鍵字傳遞。" -#: ../../tutorial/controlflow.rst:724 +#: ../../tutorial/controlflow.rst:749 msgid "A function definition may look like:" msgstr "函式定義可能如以下樣式:" -#: ../../tutorial/controlflow.rst:726 +#: ../../tutorial/controlflow.rst:751 msgid "" "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):\n" " ----------- ---------- ----------\n" @@ -1435,7 +1470,7 @@ msgstr "" " | - Keyword only\n" " -- Positional only" -#: ../../tutorial/controlflow.rst:735 +#: ../../tutorial/controlflow.rst:760 msgid "" "where ``/`` and ``*`` are optional. If used, these symbols indicate the kind " "of parameter by how the arguments may be passed to the function: positional-" @@ -1446,22 +1481,22 @@ msgstr "" "類:僅限位置、位置或關鍵字、僅限關鍵字。關鍵字參數也稱為附名參數 (named " "parameters)。" -#: ../../tutorial/controlflow.rst:742 +#: ../../tutorial/controlflow.rst:767 msgid "Positional-or-Keyword Arguments" msgstr "位置或關鍵字引數 (Positional-or-Keyword Arguments)" -#: ../../tutorial/controlflow.rst:744 +#: ../../tutorial/controlflow.rst:769 msgid "" "If ``/`` and ``*`` are not present in the function definition, arguments may " "be passed to a function by position or by keyword." msgstr "" "若函式定義中未使用 ``/`` 和 ``*`` 時,引數可以按位置或關鍵字傳遞給函式。" -#: ../../tutorial/controlflow.rst:749 +#: ../../tutorial/controlflow.rst:774 msgid "Positional-Only Parameters" msgstr "僅限位置參數 (Positional-Only Parameters)" -#: ../../tutorial/controlflow.rst:751 +#: ../../tutorial/controlflow.rst:776 msgid "" "Looking at this in a bit more detail, it is possible to mark certain " "parameters as *positional-only*. If *positional-only*, the parameters' order " @@ -1476,17 +1511,17 @@ msgstr "" "``\\ (斜線)之前。``/`` 用於在邏輯上分開僅限位置參數與其餘參數。如果函式定義" "中沒有 ``/``,則表示沒有任何僅限位置參數。" -#: ../../tutorial/controlflow.rst:759 +#: ../../tutorial/controlflow.rst:784 msgid "" "Parameters following the ``/`` may be *positional-or-keyword* or *keyword-" "only*." msgstr "``/`` 後面的參數可以是\\ *位置或關鍵字*\\ 或\\ *僅限關鍵字*\\ 參數。" -#: ../../tutorial/controlflow.rst:763 +#: ../../tutorial/controlflow.rst:788 msgid "Keyword-Only Arguments" msgstr "僅限關鍵字引數 (Keyword-Only Arguments)" -#: ../../tutorial/controlflow.rst:765 +#: ../../tutorial/controlflow.rst:790 msgid "" "To mark parameters as *keyword-only*, indicating the parameters must be " "passed by keyword argument, place an ``*`` in the arguments list just before " @@ -1495,17 +1530,17 @@ msgstr "" "要把參數標記為\\ *僅限關鍵字*,表明參數必須以關鍵字引數傳遞,必須在引數列表中" "第一個\\ *僅限關鍵字*\\ 參數前放上 ``*``。" -#: ../../tutorial/controlflow.rst:771 +#: ../../tutorial/controlflow.rst:796 msgid "Function Examples" msgstr "函式範例" -#: ../../tutorial/controlflow.rst:773 +#: ../../tutorial/controlflow.rst:798 msgid "" "Consider the following example function definitions paying close attention " "to the markers ``/`` and ``*``::" msgstr "請看以下的函式定義範例,注意 ``/`` 和 ``*`` 記號: ::" -#: ../../tutorial/controlflow.rst:776 +#: ../../tutorial/controlflow.rst:801 msgid "" ">>> def standard_arg(arg):\n" "... print(arg)\n" @@ -1531,7 +1566,7 @@ msgstr "" ">>> def combined_example(pos_only, /, standard, *, kwd_only):\n" "... print(pos_only, standard, kwd_only)" -#: ../../tutorial/controlflow.rst:789 +#: ../../tutorial/controlflow.rst:814 msgid "" "The first function definition, ``standard_arg``, the most familiar form, " "places no restrictions on the calling convention and arguments may be passed " @@ -1540,7 +1575,7 @@ msgstr "" "第一個函式定義 ``standard_arg`` 是我們最熟悉的形式,對呼叫方式沒有任何限制," "可以按位置或關鍵字傳遞引數: ::" -#: ../../tutorial/controlflow.rst:793 +#: ../../tutorial/controlflow.rst:818 msgid "" ">>> standard_arg(2)\n" "2\n" @@ -1554,14 +1589,14 @@ msgstr "" ">>> standard_arg(arg=2)\n" "2" -#: ../../tutorial/controlflow.rst:799 +#: ../../tutorial/controlflow.rst:824 msgid "" "The second function ``pos_only_arg`` is restricted to only use positional " "parameters as there is a ``/`` in the function definition::" msgstr "" "第二個函式 ``pos_only_arg`` 的函式定義中有 ``/``,因此僅限使用位置參數: ::" -#: ../../tutorial/controlflow.rst:802 +#: ../../tutorial/controlflow.rst:827 msgid "" ">>> pos_only_arg(1)\n" "1\n" @@ -1581,14 +1616,14 @@ msgstr "" "TypeError: pos_only_arg() got some positional-only arguments passed as " "keyword arguments: 'arg'" -#: ../../tutorial/controlflow.rst:810 +#: ../../tutorial/controlflow.rst:835 msgid "" "The third function ``kwd_only_args`` only allows keyword arguments as " "indicated by a ``*`` in the function definition::" msgstr "" "第三個函式 ``kwd_only_args`` 的函式定義透過 ``*`` 表明僅限關鍵字引數: ::" -#: ../../tutorial/controlflow.rst:813 +#: ../../tutorial/controlflow.rst:838 msgid "" ">>> kwd_only_arg(3)\n" "Traceback (most recent call last):\n" @@ -1606,13 +1641,13 @@ msgstr "" ">>> kwd_only_arg(arg=3)\n" "3" -#: ../../tutorial/controlflow.rst:821 +#: ../../tutorial/controlflow.rst:846 msgid "" "And the last uses all three calling conventions in the same function " "definition::" msgstr "最後一個函式在同一個函式定義中,使用了全部三種呼叫方式: ::" -#: ../../tutorial/controlflow.rst:824 +#: ../../tutorial/controlflow.rst:849 msgid "" ">>> combined_example(1, 2, 3)\n" "Traceback (most recent call last):\n" @@ -1648,7 +1683,7 @@ msgstr "" "TypeError: combined_example() got some positional-only arguments passed as " "keyword arguments: 'pos_only'" -#: ../../tutorial/controlflow.rst:841 +#: ../../tutorial/controlflow.rst:866 msgid "" "Finally, consider this function definition which has a potential collision " "between the positional argument ``name`` and ``**kwds`` which has ``name`` " @@ -1657,7 +1692,7 @@ msgstr "" "最後,請看這個函式定義,如果 ``**kwds`` 內有 ``name`` 這個鍵,可能與位置引數 " "``name`` 產生潛在衝突: ::" -#: ../../tutorial/controlflow.rst:843 +#: ../../tutorial/controlflow.rst:868 msgid "" "def foo(name, **kwds):\n" " return 'name' in kwds" @@ -1665,7 +1700,7 @@ msgstr "" "def foo(name, **kwds):\n" " return 'name' in kwds" -#: ../../tutorial/controlflow.rst:846 +#: ../../tutorial/controlflow.rst:871 msgid "" "There is no possible call that will make it return ``True`` as the keyword " "``'name'`` will always bind to the first parameter. For example::" @@ -1673,7 +1708,7 @@ msgstr "" "呼叫該函式不可能回傳 ``True``,因為關鍵字 ``'name'`` 永遠是連結在第一個參數。" "例如: ::" -#: ../../tutorial/controlflow.rst:849 +#: ../../tutorial/controlflow.rst:874 msgid "" ">>> foo(1, **{'name': 2})\n" "Traceback (most recent call last):\n" @@ -1687,7 +1722,7 @@ msgstr "" "TypeError: foo() got multiple values for argument 'name'\n" ">>>" -#: ../../tutorial/controlflow.rst:855 +#: ../../tutorial/controlflow.rst:880 msgid "" "But using ``/`` (positional only arguments), it is possible since it allows " "``name`` as a positional argument and ``'name'`` as a key in the keyword " @@ -1696,7 +1731,7 @@ msgstr "" "使用 ``/``\\ (僅限位置引數)後,就可以了。函式定義會允許 ``name`` 當作位置引" "數,而 ``'name'`` 也可以當作關鍵字引數中的鍵: ::" -#: ../../tutorial/controlflow.rst:857 +#: ../../tutorial/controlflow.rst:882 msgid "" ">>> def foo(name, /, **kwds):\n" "... return 'name' in kwds\n" @@ -1710,31 +1745,31 @@ msgstr "" ">>> foo(1, **{'name': 2})\n" "True" -#: ../../tutorial/controlflow.rst:863 +#: ../../tutorial/controlflow.rst:888 msgid "" "In other words, the names of positional-only parameters can be used in " "``**kwds`` without ambiguity." msgstr "換句話說,僅限位置參數的名稱可以在 ``**kwds`` 中使用,而不產生歧義。" -#: ../../tutorial/controlflow.rst:868 +#: ../../tutorial/controlflow.rst:893 msgid "Recap" msgstr "回顧" -#: ../../tutorial/controlflow.rst:870 +#: ../../tutorial/controlflow.rst:895 msgid "" "The use case will determine which parameters to use in the function " "definition::" msgstr "此用例決定哪些參數可以用於函式定義: ::" -#: ../../tutorial/controlflow.rst:872 +#: ../../tutorial/controlflow.rst:897 msgid "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" msgstr "def f(pos1, pos2, /, pos_or_kwd, *, kwd1, kwd2):" -#: ../../tutorial/controlflow.rst:874 +#: ../../tutorial/controlflow.rst:899 msgid "As guidance:" msgstr "說明:" -#: ../../tutorial/controlflow.rst:876 +#: ../../tutorial/controlflow.rst:901 msgid "" "Use positional-only if you want the name of the parameters to not be " "available to the user. This is useful when parameter names have no real " @@ -1746,7 +1781,7 @@ msgstr "" "想控制引數在函式呼叫的排列順序,或同時使用位置參數和任意關鍵字時,這種方式很" "有用。" -#: ../../tutorial/controlflow.rst:881 +#: ../../tutorial/controlflow.rst:906 msgid "" "Use keyword-only when names have meaning and the function definition is more " "understandable by being explicit with names or you want to prevent users " @@ -1755,7 +1790,7 @@ msgstr "" "當參數名稱有意義,且明確的名稱可讓函式定義更易理解,或是你不希望使用者依賴引" "數被傳遞時的位置時,請使用僅限關鍵字。" -#: ../../tutorial/controlflow.rst:884 +#: ../../tutorial/controlflow.rst:909 msgid "" "For an API, use positional-only to prevent breaking API changes if the " "parameter's name is modified in the future." @@ -1763,11 +1798,11 @@ msgstr "" "對於應用程式介面 (API),使用僅限位置,以防止未來參數名稱被修改時造成 API 的中" "斷性變更。" -#: ../../tutorial/controlflow.rst:890 +#: ../../tutorial/controlflow.rst:915 msgid "Arbitrary Argument Lists" msgstr "任意引數列表 (Arbitrary Argument Lists)" -#: ../../tutorial/controlflow.rst:895 +#: ../../tutorial/controlflow.rst:920 msgid "" "Finally, the least frequently used option is to specify that a function can " "be called with an arbitrary number of arguments. These arguments will be " @@ -1778,7 +1813,7 @@ msgstr "" "數會被包裝進一個 tuple 中(詳見 :ref:`tut-tuples`\\ )。在可變數量的引數之" "前,可能有零個或多個普通引數: ::" -#: ../../tutorial/controlflow.rst:900 +#: ../../tutorial/controlflow.rst:925 msgid "" "def write_multiple_items(file, separator, *args):\n" " file.write(separator.join(args))" @@ -1786,7 +1821,7 @@ msgstr "" "def write_multiple_items(file, separator, *args):\n" " file.write(separator.join(args))" -#: ../../tutorial/controlflow.rst:904 +#: ../../tutorial/controlflow.rst:929 msgid "" "Normally, these *variadic* arguments will be last in the list of formal " "parameters, because they scoop up all remaining input arguments that are " @@ -1800,7 +1835,7 @@ msgstr "" "\n" "::" -#: ../../tutorial/controlflow.rst:910 +#: ../../tutorial/controlflow.rst:935 msgid "" ">>> def concat(*args, sep=\"/\"):\n" "... return sep.join(args)\n" @@ -1818,11 +1853,11 @@ msgstr "" ">>> concat(\"earth\", \"mars\", \"venus\", sep=\".\")\n" "'earth.mars.venus'" -#: ../../tutorial/controlflow.rst:921 +#: ../../tutorial/controlflow.rst:946 msgid "Unpacking Argument Lists" msgstr "拆解引數列表(Unpacking Argument Lists)" -#: ../../tutorial/controlflow.rst:923 +#: ../../tutorial/controlflow.rst:948 msgid "" "The reverse situation occurs when the arguments are already in a list or " "tuple but need to be unpacked for a function call requiring separate " @@ -1836,7 +1871,7 @@ msgstr "" "的 *start* 和 *stop* 引數。如果這些引數不是分開的,則要在呼叫函式時,用 " "``*`` 運算子把引數們從 list 或 tuple 中拆解出來: ::" -#: ../../tutorial/controlflow.rst:930 +#: ../../tutorial/controlflow.rst:955 msgid "" ">>> list(range(3, 6)) # normal call with separate arguments\n" "[3, 4, 5]\n" @@ -1846,13 +1881,13 @@ msgid "" "[3, 4, 5]" msgstr "" -#: ../../tutorial/controlflow.rst:939 +#: ../../tutorial/controlflow.rst:964 msgid "" "In the same fashion, dictionaries can deliver keyword arguments with the " "``**``\\ -operator::" msgstr "同樣地,dictionary(字典)可以用 ``**`` 運算子傳遞關鍵字引數: ::" -#: ../../tutorial/controlflow.rst:942 +#: ../../tutorial/controlflow.rst:967 msgid "" ">>> def parrot(voltage, state='a stiff', action='voom'):\n" "... print(\"-- This parrot wouldn't\", action, end=' ')\n" @@ -1876,11 +1911,11 @@ msgstr "" "-- This parrot wouldn't VOOM if you put four million volts through it. E's " "bleedin' demised !" -#: ../../tutorial/controlflow.rst:955 +#: ../../tutorial/controlflow.rst:980 msgid "Lambda Expressions" msgstr "Lambda 運算式" -#: ../../tutorial/controlflow.rst:957 +#: ../../tutorial/controlflow.rst:982 msgid "" "Small anonymous functions can be created with the :keyword:`lambda` keyword. " "This function returns the sum of its two arguments: ``lambda a, b: a+b``. " @@ -1895,7 +1930,7 @@ msgstr "" "能是單一運算式。在語義上,它就是一個普通函式定義的語法糖 (syntactic sugar)。" "與巢狀函式定義一樣,lambda 函式可以從包含它的作用域中引用變數: ::" -#: ../../tutorial/controlflow.rst:965 +#: ../../tutorial/controlflow.rst:990 msgid "" ">>> def make_incrementor(n):\n" "... return lambda x: x + n\n" @@ -1915,7 +1950,7 @@ msgstr "" ">>> f(1)\n" "43" -#: ../../tutorial/controlflow.rst:974 +#: ../../tutorial/controlflow.rst:999 msgid "" "The above example uses a lambda expression to return a function. Another " "use is to pass a small function as an argument::" @@ -1923,7 +1958,7 @@ msgstr "" "上面的例子用 lambda 運算式回傳了一個函式。另外的用法是傳遞一個小函式當作引" "數: ::" -#: ../../tutorial/controlflow.rst:977 +#: ../../tutorial/controlflow.rst:1002 msgid "" ">>> pairs = [(1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')]\n" ">>> pairs.sort(key=lambda pair: pair[1])\n" @@ -1935,17 +1970,17 @@ msgstr "" ">>> pairs\n" "[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]" -#: ../../tutorial/controlflow.rst:986 +#: ../../tutorial/controlflow.rst:1011 msgid "Documentation Strings" msgstr "說明文件字串 (Documentation Strings)" -#: ../../tutorial/controlflow.rst:993 +#: ../../tutorial/controlflow.rst:1018 msgid "" "Here are some conventions about the content and formatting of documentation " "strings." msgstr "以下是關於說明文件字串內容和格式的慣例。" -#: ../../tutorial/controlflow.rst:996 +#: ../../tutorial/controlflow.rst:1021 msgid "" "The first line should always be a short, concise summary of the object's " "purpose. For brevity, it should not explicitly state the object's name or " @@ -1957,7 +1992,7 @@ msgstr "" "的名稱或型別,因為有其他方法可以達到相同目的(除非該名稱剛好是一個描述函式運" "算的動詞)。這一行應以大寫字母開頭,以句號結尾。" -#: ../../tutorial/controlflow.rst:1002 +#: ../../tutorial/controlflow.rst:1027 msgid "" "If there are more lines in the documentation string, the second line should " "be blank, visually separating the summary from the rest of the description. " @@ -1967,7 +2002,7 @@ msgstr "" "文件字串為多行時,第二行應為空白行,在視覺上將摘要與其餘描述分開。後面幾行可" "包含一或多個段落,描述此物件的呼叫慣例、副作用等。" -#: ../../tutorial/controlflow.rst:1007 +#: ../../tutorial/controlflow.rst:1032 msgid "" "The Python parser does not strip indentation from multi-line string literals " "in Python, so tools that process documentation have to strip indentation if " @@ -1989,11 +2024,11 @@ msgstr "" "出現了,這些行的全部前導空白字元都應被去除。展開 tab 鍵後(通常為八個空格)," "應測試空白字元量是否等價。" -#: ../../tutorial/controlflow.rst:1019 +#: ../../tutorial/controlflow.rst:1044 msgid "Here is an example of a multi-line docstring::" msgstr "下面是多行說明字串的一個範例: ::" -#: ../../tutorial/controlflow.rst:1021 +#: ../../tutorial/controlflow.rst:1046 msgid "" ">>> def my_function():\n" "... \"\"\"Do nothing, but document it.\n" @@ -2008,11 +2043,11 @@ msgid "" " No, really, it doesn't do anything." msgstr "" -#: ../../tutorial/controlflow.rst:1037 +#: ../../tutorial/controlflow.rst:1062 msgid "Function Annotations" msgstr "函式註釋 (Function Annotations)" -#: ../../tutorial/controlflow.rst:1045 +#: ../../tutorial/controlflow.rst:1070 msgid "" ":ref:`Function annotations <function>` are completely optional metadata " "information about the types used by user-defined functions (see :pep:`3107` " @@ -2021,7 +2056,7 @@ msgstr "" ":ref:`函式註釋 <function>`\\ 是選擇性的元資料(metadata)資訊,描述使用者定義" "函式所使用的型別(更多資訊詳見 :pep:`3107` 和 :pep:`484`\\ )。" -#: ../../tutorial/controlflow.rst:1049 +#: ../../tutorial/controlflow.rst:1074 msgid "" ":term:`Annotations <function annotation>` are stored in the :attr:`!" "__annotations__` attribute of the function as a dictionary and have no " @@ -2039,7 +2074,7 @@ msgstr "" ">`` 文字接著一個運算式。以下範例註釋了一個必要引數、一個選擇性引數,以及回傳" "值: ::" -#: ../../tutorial/controlflow.rst:1058 +#: ../../tutorial/controlflow.rst:1083 msgid "" ">>> def f(ham: str, eggs: str = 'eggs') -> str:\n" "... print(\"Annotations:\", f.__annotations__)\n" @@ -2063,11 +2098,11 @@ msgstr "" "Arguments: spam eggs\n" "'spam and eggs'" -#: ../../tutorial/controlflow.rst:1071 +#: ../../tutorial/controlflow.rst:1096 msgid "Intermezzo: Coding Style" msgstr "間奏曲:程式碼風格 (Coding Style)" -#: ../../tutorial/controlflow.rst:1076 +#: ../../tutorial/controlflow.rst:1101 msgid "" "Now that you are about to write longer, more complex pieces of Python, it is " "a good time to talk about *coding style*. Most languages can be written (or " @@ -2080,7 +2115,7 @@ msgstr "" "式比其他的更具可讀性。能讓其他人輕鬆閱讀你的程式碼永遠是一個好主意,而使用優" "良的編碼樣式對此有極大的幫助。" -#: ../../tutorial/controlflow.rst:1082 +#: ../../tutorial/controlflow.rst:1107 msgid "" "For Python, :pep:`8` has emerged as the style guide that most projects " "adhere to; it promotes a very readable and eye-pleasing coding style. Every " @@ -2090,11 +2125,11 @@ msgstr "" "對於 Python,大多數的專案都遵循 :pep:`8` 的樣式指南;它推行的編碼樣式相當可讀" "且賞心悅目。每個 Python 開發者都應該花點時間研讀;這裡是該指南的核心重點:" -#: ../../tutorial/controlflow.rst:1087 +#: ../../tutorial/controlflow.rst:1112 msgid "Use 4-space indentation, and no tabs." msgstr "用 4 個空格縮排,不要用 tab 鍵。" -#: ../../tutorial/controlflow.rst:1089 +#: ../../tutorial/controlflow.rst:1114 msgid "" "4 spaces are a good compromise between small indentation (allows greater " "nesting depth) and large indentation (easier to read). Tabs introduce " @@ -2103,11 +2138,11 @@ msgstr "" "4 個空格是小縮排(容許更大的巢套深度)和大縮排(較易閱讀)之間的折衷方案。" "Tab 鍵會造成混亂,最好別用。" -#: ../../tutorial/controlflow.rst:1093 +#: ../../tutorial/controlflow.rst:1118 msgid "Wrap lines so that they don't exceed 79 characters." msgstr "換行,使一行不超過 79 個字元。" -#: ../../tutorial/controlflow.rst:1095 +#: ../../tutorial/controlflow.rst:1120 msgid "" "This helps users with small displays and makes it possible to have several " "code files side-by-side on larger displays." @@ -2115,21 +2150,21 @@ msgstr "" "換行能讓使用小顯示器的使用者方便閱讀,也可以在較大顯示器上並排陳列多個程式碼" "檔案。" -#: ../../tutorial/controlflow.rst:1098 +#: ../../tutorial/controlflow.rst:1123 msgid "" "Use blank lines to separate functions and classes, and larger blocks of code " "inside functions." msgstr "用空行分隔函式和 class(類別),及函式內較大塊的程式碼。" -#: ../../tutorial/controlflow.rst:1101 +#: ../../tutorial/controlflow.rst:1126 msgid "When possible, put comments on a line of their own." msgstr "如果可以,把註解放在單獨一行。" -#: ../../tutorial/controlflow.rst:1103 +#: ../../tutorial/controlflow.rst:1128 msgid "Use docstrings." msgstr "使用說明字串。" -#: ../../tutorial/controlflow.rst:1105 +#: ../../tutorial/controlflow.rst:1130 msgid "" "Use spaces around operators and after commas, but not directly inside " "bracketing constructs: ``a = f(1, 2) + g(3, 4)``." @@ -2137,7 +2172,7 @@ msgstr "" "運算子前後、逗號後要加空格,但不要直接放在括號內側:``a = f(1, 2) + g(3, " "4)``。" -#: ../../tutorial/controlflow.rst:1108 +#: ../../tutorial/controlflow.rst:1133 msgid "" "Name your classes and functions consistently; the convention is to use " "``UpperCamelCase`` for classes and ``lowercase_with_underscores`` for " @@ -2149,7 +2184,7 @@ msgstr "" "底線)。永遠用 ``self`` 作為 method 第一個引數的名稱(關於 class 和 method," "詳見 :ref:`tut-firstclasses`\\ )。" -#: ../../tutorial/controlflow.rst:1113 +#: ../../tutorial/controlflow.rst:1138 msgid "" "Don't use fancy encodings if your code is meant to be used in international " "environments. Python's default, UTF-8, or even plain ASCII work best in any " @@ -2158,7 +2193,7 @@ msgstr "" "若程式碼是為了用於國際環境時,不要用花俏的編碼。Python 預設的 UTF-8 或甚至普" "通的 ASCII,就可以勝任各種情況。" -#: ../../tutorial/controlflow.rst:1117 +#: ../../tutorial/controlflow.rst:1142 msgid "" "Likewise, don't use non-ASCII characters in identifiers if there is only the " "slightest chance people speaking a different language will read or maintain " @@ -2167,11 +2202,11 @@ msgstr "" "同樣地,若不同語言使用者閱讀或維護程式碼的可能性微乎其微,就不要在命名時使用" "非 ASCII 字元。" -#: ../../tutorial/controlflow.rst:1123 +#: ../../tutorial/controlflow.rst:1148 msgid "Footnotes" msgstr "註解" -#: ../../tutorial/controlflow.rst:1124 +#: ../../tutorial/controlflow.rst:1149 msgid "" "Actually, *call by object reference* would be a better description, since if " "a mutable object is passed, the caller will see any changes the callee makes " @@ -2189,54 +2224,60 @@ msgstr "statement(陳述式)" msgid "for" msgstr "for" -#: ../../tutorial/controlflow.rst:451 ../../tutorial/controlflow.rst:988 +#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 msgid "documentation strings" msgstr "ddocumentation strings(說明字串)" -#: ../../tutorial/controlflow.rst:451 ../../tutorial/controlflow.rst:988 +#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 msgid "docstrings" msgstr "docstrings(說明字串)" -#: ../../tutorial/controlflow.rst:451 ../../tutorial/controlflow.rst:988 +#: ../../tutorial/controlflow.rst:476 ../../tutorial/controlflow.rst:1013 msgid "strings, documentation" msgstr "strings(字串), documentation(說明文件)" -#: ../../tutorial/controlflow.rst:892 +#: ../../tutorial/controlflow.rst:917 msgid "* (asterisk)" msgstr "* (星號)" -#: ../../tutorial/controlflow.rst:892 ../../tutorial/controlflow.rst:936 +#: ../../tutorial/controlflow.rst:917 ../../tutorial/controlflow.rst:961 msgid "in function calls" msgstr "於函式呼叫中" -#: ../../tutorial/controlflow.rst:936 +#: ../../tutorial/controlflow.rst:961 msgid "**" msgstr "**" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid "function" msgstr "function(函式)" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid "annotations" msgstr "annotations(註釋)" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid "->" msgstr "->" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid "function annotations" msgstr "function annotations(函式註釋)" -#: ../../tutorial/controlflow.rst:1040 +#: ../../tutorial/controlflow.rst:1065 msgid ": (colon)" msgstr ": (冒號)" -#: ../../tutorial/controlflow.rst:1074 +#: ../../tutorial/controlflow.rst:1099 msgid "coding" msgstr "coding(程式編寫)" -#: ../../tutorial/controlflow.rst:1074 +#: ../../tutorial/controlflow.rst:1099 msgid "style" msgstr "style(風格)" + +#~ msgid "" +#~ "A :keyword:`!for` or :keyword:`!while` loop can include an :keyword:`!" +#~ "else` clause." +#~ msgstr "" +#~ ":keyword:`!for` 和 :keyword:`!while` 迴圈可帶有一個 :keyword:`!else` 子句" diff --git a/tutorial/datastructures.po b/tutorial/datastructures.po index 74a00983dc..27fcb13025 100644 --- a/tutorial/datastructures.po +++ b/tutorial/datastructures.po @@ -10,7 +10,7 @@ # Steven Hsu <hsuhaochun@gmail.com>, 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2024-01-22 21:43+0800\n" diff --git a/tutorial/errors.po b/tutorial/errors.po index 31349d7ea7..fd65d5efcd 100644 --- a/tutorial/errors.po +++ b/tutorial/errors.po @@ -7,9 +7,9 @@ # Matt Wang <mattwang44@gmail.com>, 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -99,30 +99,42 @@ msgid "" ">>> 10 * (1/0)\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 1, in <module>\n" +" 10 * (1/0)\n" +" ~^~\n" "ZeroDivisionError: division by zero\n" ">>> 4 + spam*3\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 1, in <module>\n" +" 4 + spam*3\n" +" ^^^^\n" "NameError: name 'spam' is not defined\n" ">>> '2' + 2\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 1, in <module>\n" +" '2' + 2\n" +" ~~~~^~~\n" "TypeError: can only concatenate str (not \"int\") to str" msgstr "" ">>> 10 * (1/0)\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 1, in <module>\n" +" 10 * (1/0)\n" +" ~^~\n" "ZeroDivisionError: division by zero\n" ">>> 4 + spam*3\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 1, in <module>\n" +" 4 + spam*3\n" +" ^^^^\n" "NameError: name 'spam' is not defined\n" ">>> '2' + 2\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 1, in <module>\n" +" '2' + 2\n" +" ~~~~^~~\n" "TypeError: can only concatenate str (not \"int\") to str" -#: ../../tutorial/errors.rst:58 +#: ../../tutorial/errors.rst:64 msgid "" "The last line of the error message indicates what happened. Exceptions come " "in different types, and the type is printed as part of the message: the " @@ -140,13 +152,13 @@ msgstr "" "需要遵守(雖然這是一個有用的慣例)。標準例外名稱是內建的識別字 (identifier)," "不是保留關鍵字 (reserved keyword)。" -#: ../../tutorial/errors.rst:66 +#: ../../tutorial/errors.rst:72 msgid "" "The rest of the line provides detail based on the type of exception and what " "caused it." msgstr "此行其餘部分,根據例外的類型及導致例外的原因,說明例外的細節。" -#: ../../tutorial/errors.rst:69 +#: ../../tutorial/errors.rst:75 msgid "" "The preceding part of the error message shows the context where the " "exception occurred, in the form of a stack traceback. In general it contains " @@ -157,16 +169,16 @@ msgstr "" "說,它含有一個列出源程式碼行 (source line) 的堆疊回溯;但它不會顯示從標準輸入" "中讀取的程式碼。" -#: ../../tutorial/errors.rst:74 +#: ../../tutorial/errors.rst:80 msgid "" ":ref:`bltin-exceptions` lists the built-in exceptions and their meanings." msgstr ":ref:`bltin-exceptions`\\ 章節列出內建的例外及它們的意義。" -#: ../../tutorial/errors.rst:80 +#: ../../tutorial/errors.rst:86 msgid "Handling Exceptions" msgstr "處理例外" -#: ../../tutorial/errors.rst:82 +#: ../../tutorial/errors.rst:88 msgid "" "It is possible to write programs that handle selected exceptions. Look at " "the following example, which asks the user for input until a valid integer " @@ -180,7 +192,7 @@ msgstr "" "令);請注意,由使用者產生的程式中斷會引發 :exc:`KeyboardInterrupt` 例外信" "號。 ::" -#: ../../tutorial/errors.rst:88 +#: ../../tutorial/errors.rst:94 msgid "" ">>> while True:\n" "... try:\n" @@ -198,11 +210,11 @@ msgstr "" "... print(\"Oops! That was no valid number. Try again...\")\n" "..." -#: ../../tutorial/errors.rst:96 +#: ../../tutorial/errors.rst:102 msgid "The :keyword:`try` statement works as follows." msgstr ":keyword:`try` 陳述式運作方式如下。" -#: ../../tutorial/errors.rst:98 +#: ../../tutorial/errors.rst:104 msgid "" "First, the *try clause* (the statement(s) between the :keyword:`try` and :" "keyword:`except` keywords) is executed." @@ -210,7 +222,7 @@ msgstr "" "首先,執行 *try 子句*\\ (\\ :keyword:`try` 和 :keyword:`except` 關鍵字之間的" "陳述式)。" -#: ../../tutorial/errors.rst:101 +#: ../../tutorial/errors.rst:107 msgid "" "If no exception occurs, the *except clause* is skipped and execution of the :" "keyword:`try` statement is finished." @@ -218,7 +230,7 @@ msgstr "" "如果沒有發生例外,則 *except 子句*\\ 會被跳過,:keyword:`try` 陳述式執行完" "畢。" -#: ../../tutorial/errors.rst:104 +#: ../../tutorial/errors.rst:110 msgid "" "If an exception occurs during execution of the :keyword:`try` clause, the " "rest of the clause is skipped. Then, if its type matches the exception " @@ -229,7 +241,7 @@ msgstr "" "例外的類型與 :keyword:`except` 關鍵字後面的例外名稱相符,則 *except 子句*\\ " "被執行,然後,繼續執行 try/except 區塊之後的程式碼。" -#: ../../tutorial/errors.rst:109 +#: ../../tutorial/errors.rst:115 msgid "" "If an exception occurs which does not match the exception named in the " "*except clause*, it is passed on to outer :keyword:`try` statements; if no " @@ -240,7 +252,7 @@ msgstr "" "`try` 陳述式;如果仍無法找到處理者,則它是一個\\ *未處理例外 (unhandled " "exception)*,執行將停止,並顯示錯誤訊息。" -#: ../../tutorial/errors.rst:113 +#: ../../tutorial/errors.rst:119 msgid "" "A :keyword:`try` statement may have more than one *except clause*, to " "specify handlers for different exceptions. At most one handler will be " @@ -254,7 +266,7 @@ msgstr "" "理同一 :keyword:`!try` 陳述式裡其他處理者內的例外。一個 *except 子句*\\ 可以" "用一組括號內的 tuple 列舉多個例外,例如: ::" -#: ../../tutorial/errors.rst:119 +#: ../../tutorial/errors.rst:125 msgid "" "... except (RuntimeError, TypeError, NameError):\n" "... pass" @@ -262,7 +274,7 @@ msgstr "" "... except (RuntimeError, TypeError, NameError):\n" "... pass" -#: ../../tutorial/errors.rst:122 +#: ../../tutorial/errors.rst:128 #, fuzzy msgid "" "A class in an :keyword:`except` clause matches exceptions which are " @@ -276,7 +288,7 @@ msgstr "" "derived class (衍生類別)的 *except 子句*\\ 並不能與 base class 相容。例如," "以下程式碼會依序印出 B、C、D: ::" -#: ../../tutorial/errors.rst:127 +#: ../../tutorial/errors.rst:133 msgid "" "class B(Exception):\n" " pass\n" @@ -316,7 +328,7 @@ msgstr "" " except B:\n" " print(\"B\")" -#: ../../tutorial/errors.rst:146 +#: ../../tutorial/errors.rst:152 msgid "" "Note that if the *except clauses* were reversed (with ``except B`` first), " "it would have printed B, B, B --- the first matching *except clause* is " @@ -325,7 +337,7 @@ msgstr "" "請注意,如果 *except 子句*\\ 的順序被反轉(把 ``except B`` 放到第一個),則會" "印出 B、B、B ­­——第一個符合的 *except 子句*\\ 會被觸發。" -#: ../../tutorial/errors.rst:149 +#: ../../tutorial/errors.rst:155 msgid "" "When an exception occurs, it may have associated values, also known as the " "exception's *arguments*. The presence and types of the arguments depend on " @@ -334,7 +346,7 @@ msgstr "" "當例外發生時,它可能有相關聯的值,也就是例外的\\ *引數*。引數的存在與否及它的" "類型,是取決於例外的類型。" -#: ../../tutorial/errors.rst:153 +#: ../../tutorial/errors.rst:159 msgid "" "The *except clause* may specify a variable after the exception name. The " "variable is bound to the exception instance which typically has an ``args`` " @@ -346,7 +358,7 @@ msgstr "" "(instance),其引數通常儲存在 ``args`` 屬性中。為了方便,內建例外型別定義了 :" "meth:`~object.__str__` 以印出所有引數而不需顯式地取用 ``.args``: ::" -#: ../../tutorial/errors.rst:159 +#: ../../tutorial/errors.rst:165 msgid "" ">>> try:\n" "... raise Exception('spam', 'eggs')\n" @@ -367,7 +379,7 @@ msgid "" "y = eggs" msgstr "" -#: ../../tutorial/errors.rst:176 +#: ../../tutorial/errors.rst:182 msgid "" "The exception's :meth:`~object.__str__` output is printed as the last part " "('detail') of the message for unhandled exceptions." @@ -375,7 +387,7 @@ msgstr "" "例外的 :meth:`~object.__str__` 輸出會被印在未處理例外訊息的最後一部分(「細" "節」)。" -#: ../../tutorial/errors.rst:179 +#: ../../tutorial/errors.rst:185 msgid "" ":exc:`BaseException` is the common base class of all exceptions. One of its " "subclasses, :exc:`Exception`, is the base class of all the non-fatal " @@ -391,7 +403,7 @@ msgstr "" "它們是用來指示程式應該終止。這些例外包括了由 :meth:`sys.exit` 所引發的 :exc:" "`SystemExit`,以及當使用者想要中斷程式時所引發的 :exc:`KeyboardInterrupt`。" -#: ../../tutorial/errors.rst:187 +#: ../../tutorial/errors.rst:193 msgid "" ":exc:`Exception` can be used as a wildcard that catches (almost) everything. " "However, it is good practice to be as specific as possible with the types of " @@ -402,7 +414,7 @@ msgstr "" "較好的做法是盡可能具體地說明我們打算處理的例外類型,並容許任何非預期例外的傳" "遞 (propagate)。" -#: ../../tutorial/errors.rst:192 +#: ../../tutorial/errors.rst:198 msgid "" "The most common pattern for handling :exc:`Exception` is to print or log the " "exception and then re-raise it (allowing a caller to handle the exception as " @@ -411,7 +423,7 @@ msgstr "" "處理 :exc:`Exception` 的最常見模式,是先將該例外印出或記錄,然後再重新引發它" "(也允許一個呼叫函式 (caller) 來處理該例外): ::" -#: ../../tutorial/errors.rst:196 +#: ../../tutorial/errors.rst:202 msgid "" "import sys\n" "\n" @@ -441,7 +453,7 @@ msgstr "" " print(f\"Unexpected {err=}, {type(err)=}\")\n" " raise" -#: ../../tutorial/errors.rst:210 +#: ../../tutorial/errors.rst:216 msgid "" "The :keyword:`try` ... :keyword:`except` statement has an optional *else " "clause*, which, when present, must follow all *except clauses*. It is " @@ -452,7 +464,7 @@ msgstr "" "時,該子句必須放在所有 *except 子句*\\ 之後。如果一段程式碼必須被執行,但 " "*try 子句*\\ 又沒有引發例外時,這個子句很有用。例如: ::" -#: ../../tutorial/errors.rst:215 +#: ../../tutorial/errors.rst:221 msgid "" "for arg in sys.argv[1:]:\n" " try:\n" @@ -472,7 +484,7 @@ msgstr "" " print(arg, 'has', len(f.readlines()), 'lines')\n" " f.close()" -#: ../../tutorial/errors.rst:224 +#: ../../tutorial/errors.rst:230 msgid "" "The use of the :keyword:`!else` clause is better than adding additional code " "to the :keyword:`try` clause because it avoids accidentally catching an " @@ -483,7 +495,7 @@ msgstr "" "這可以避免意外地捕獲不是由 :keyword:`!try` ... :keyword:`!except` 陳述式保護" "的程式碼所引發的例外。" -#: ../../tutorial/errors.rst:229 +#: ../../tutorial/errors.rst:235 msgid "" "Exception handlers do not handle only exceptions that occur immediately in " "the *try clause*, but also those that occur inside functions that are called " @@ -492,7 +504,7 @@ msgstr "" "例外的處理者不僅處理 *try 子句*\\ 內立即發生的例外,還處理 *try 子句*\\ 內" "(即使是間接地)呼叫的函式內部發生的例外。例如: ::" -#: ../../tutorial/errors.rst:233 +#: ../../tutorial/errors.rst:239 msgid "" ">>> def this_fails():\n" "... x = 1/0\n" @@ -514,29 +526,31 @@ msgstr "" "...\n" "Handling run-time error: division by zero" -#: ../../tutorial/errors.rst:247 +#: ../../tutorial/errors.rst:253 msgid "Raising Exceptions" msgstr "引發例外" -#: ../../tutorial/errors.rst:249 +#: ../../tutorial/errors.rst:255 msgid "" "The :keyword:`raise` statement allows the programmer to force a specified " "exception to occur. For example::" msgstr ":keyword:`raise` 陳述式可讓程式設計師強制引發指定的例外。例如: ::" -#: ../../tutorial/errors.rst:252 +#: ../../tutorial/errors.rst:258 msgid "" ">>> raise NameError('HiThere')\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 1, in <module>\n" +" raise NameError('HiThere')\n" "NameError: HiThere" msgstr "" ">>> raise NameError('HiThere')\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 1, in <module>\n" +" raise NameError('HiThere')\n" "NameError: HiThere" -#: ../../tutorial/errors.rst:257 +#: ../../tutorial/errors.rst:264 msgid "" "The sole argument to :keyword:`raise` indicates the exception to be raised. " "This must be either an exception instance or an exception class (a class " @@ -549,11 +563,11 @@ msgstr "" "的 subclass)。如果一個例外 class 被傳遞,它會不含引數地呼叫它的建構函式 " "(constructor) ,使它被自動建立實例 (implicitly instantiated): ::" -#: ../../tutorial/errors.rst:263 +#: ../../tutorial/errors.rst:270 msgid "raise ValueError # shorthand for 'raise ValueError()'" msgstr "raise ValueError # 'raise ValueError()' 的簡寫" -#: ../../tutorial/errors.rst:265 +#: ../../tutorial/errors.rst:272 msgid "" "If you need to determine whether an exception was raised but don't intend to " "handle it, a simpler form of the :keyword:`raise` statement allows you to re-" @@ -562,7 +576,7 @@ msgstr "" "如果你只想判斷是否引發了例外,但並不打算處理它,則可以使用簡單的 :keyword:" "`raise` 陳述式來重新引發該例外: ::" -#: ../../tutorial/errors.rst:269 +#: ../../tutorial/errors.rst:276 msgid "" ">>> try:\n" "... raise NameError('HiThere')\n" @@ -573,6 +587,7 @@ msgid "" "An exception flew by!\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 2, in <module>\n" +" raise NameError('HiThere')\n" "NameError: HiThere" msgstr "" ">>> try:\n" @@ -584,13 +599,14 @@ msgstr "" "An exception flew by!\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 2, in <module>\n" +" raise NameError('HiThere')\n" "NameError: HiThere" -#: ../../tutorial/errors.rst:284 +#: ../../tutorial/errors.rst:292 msgid "Exception Chaining" msgstr "例外鏈接 (Exception Chaining)" -#: ../../tutorial/errors.rst:286 +#: ../../tutorial/errors.rst:294 msgid "" "If an unhandled exception occurs inside an :keyword:`except` section, it " "will have the exception being handled attached to it and included in the " @@ -599,7 +615,7 @@ msgstr "" "如果在 :keyword:`except` 段落內部發生了一個未處理的例外,則它會讓這個將要被處" "理的例外附加在後,並將其包含在錯誤訊息中: ::" -#: ../../tutorial/errors.rst:290 +#: ../../tutorial/errors.rst:298 msgid "" ">>> try:\n" "... open(\"database.sqlite\")\n" @@ -608,12 +624,15 @@ msgid "" "...\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 2, in <module>\n" +" open(\"database.sqlite\")\n" +" ~~~~^^^^^^^^^^^^^^^^^^^\n" "FileNotFoundError: [Errno 2] No such file or directory: 'database.sqlite'\n" "\n" "During handling of the above exception, another exception occurred:\n" "\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 4, in <module>\n" +" raise RuntimeError(\"unable to handle error\")\n" "RuntimeError: unable to handle error" msgstr "" ">>> try:\n" @@ -623,15 +642,18 @@ msgstr "" "...\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 2, in <module>\n" +" open(\"database.sqlite\")\n" +" ~~~~^^^^^^^^^^^^^^^^^^^\n" "FileNotFoundError: [Errno 2] No such file or directory: 'database.sqlite'\n" "\n" "During handling of the above exception, another exception occurred:\n" "\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 4, in <module>\n" +" raise RuntimeError(\"unable to handle error\")\n" "RuntimeError: unable to handle error" -#: ../../tutorial/errors.rst:305 +#: ../../tutorial/errors.rst:316 msgid "" "To indicate that an exception is a direct consequence of another, the :" "keyword:`raise` statement allows an optional :keyword:`from<raise>` clause::" @@ -639,7 +661,7 @@ msgstr "" "為了表明一個例外是另一個例外直接造成的結果,:keyword:`raise` 陳述式容許一個選" "擇性的 :keyword:`from<raise>` 子句: ::" -#: ../../tutorial/errors.rst:308 +#: ../../tutorial/errors.rst:319 msgid "" "# exc must be exception instance or None.\n" "raise RuntimeError from exc" @@ -647,11 +669,11 @@ msgstr "" "# exc 必須是例外實例或 None。\n" "raise RuntimeError from exc" -#: ../../tutorial/errors.rst:311 +#: ../../tutorial/errors.rst:322 msgid "This can be useful when you are transforming exceptions. For example::" msgstr "要變換例外時,這種方式很有用。例如: ::" -#: ../../tutorial/errors.rst:313 +#: ../../tutorial/errors.rst:324 msgid "" ">>> def func():\n" "... raise ConnectionError\n" @@ -663,6 +685,8 @@ msgid "" "...\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 2, in <module>\n" +" func()\n" +" ~~~~^^\n" " File \"<stdin>\", line 2, in func\n" "ConnectionError\n" "\n" @@ -670,6 +694,7 @@ msgid "" "\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 4, in <module>\n" +" raise RuntimeError('Failed to open database') from exc\n" "RuntimeError: Failed to open database" msgstr "" ">>> def func():\n" @@ -682,6 +707,8 @@ msgstr "" "...\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 2, in <module>\n" +" func()\n" +" ~~~~^^\n" " File \"<stdin>\", line 2, in func\n" "ConnectionError\n" "\n" @@ -689,15 +716,16 @@ msgstr "" "\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 4, in <module>\n" +" raise RuntimeError('Failed to open database') from exc\n" "RuntimeError: Failed to open database" -#: ../../tutorial/errors.rst:332 +#: ../../tutorial/errors.rst:346 msgid "" "It also allows disabling automatic exception chaining using the ``from " "None`` idiom::" msgstr "它也容許使用慣用語 ``from None`` 來停用自動例外鏈接: ::" -#: ../../tutorial/errors.rst:335 +#: ../../tutorial/errors.rst:349 msgid "" ">>> try:\n" "... open('database.sqlite')\n" @@ -706,6 +734,7 @@ msgid "" "...\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 4, in <module>\n" +" raise RuntimeError from None\n" "RuntimeError" msgstr "" ">>> try:\n" @@ -715,18 +744,19 @@ msgstr "" "...\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 4, in <module>\n" +" raise RuntimeError from None\n" "RuntimeError" -#: ../../tutorial/errors.rst:344 +#: ../../tutorial/errors.rst:359 msgid "" "For more information about chaining mechanics, see :ref:`bltin-exceptions`." msgstr "更多關於鏈接機制的資訊,詳見\\ :ref:`bltin-exceptions`。" -#: ../../tutorial/errors.rst:350 +#: ../../tutorial/errors.rst:365 msgid "User-defined Exceptions" msgstr "使用者自定的例外" -#: ../../tutorial/errors.rst:352 +#: ../../tutorial/errors.rst:367 msgid "" "Programs may name their own exceptions by creating a new exception class " "(see :ref:`tut-classes` for more about Python classes). Exceptions should " @@ -737,7 +767,7 @@ msgstr "" "\\ :ref:`tut-classes`\\ )。不論是直接還是間接地,例外通常應該從 :exc:" "`Exception` class 衍生出來。" -#: ../../tutorial/errors.rst:356 +#: ../../tutorial/errors.rst:371 msgid "" "Exception classes can be defined which do anything any other class can do, " "but are usually kept simple, often only offering a number of attributes that " @@ -747,23 +777,23 @@ msgstr "" "例外 class 可被定義來做任何其他 class 能夠做的事,但通常會讓它維持簡單,只提" "供一些屬性,讓關於錯誤的資訊可被例外的處理者抽取出來。" -#: ../../tutorial/errors.rst:360 +#: ../../tutorial/errors.rst:375 msgid "" "Most exceptions are defined with names that end in \"Error\", similar to the " "naming of the standard exceptions." msgstr "大多數的例外定義,都會以「Error」作為名稱結尾,類似於標準例外的命名。" -#: ../../tutorial/errors.rst:363 +#: ../../tutorial/errors.rst:378 msgid "" "Many standard modules define their own exceptions to report errors that may " "occur in functions they define." msgstr "許多標準模組會定義它們自己的例外,以報告在其定義的函式中發生的錯誤。" -#: ../../tutorial/errors.rst:370 +#: ../../tutorial/errors.rst:385 msgid "Defining Clean-up Actions" msgstr "定義清理動作" -#: ../../tutorial/errors.rst:372 +#: ../../tutorial/errors.rst:387 msgid "" "The :keyword:`try` statement has another optional clause which is intended " "to define clean-up actions that must be executed under all circumstances. " @@ -772,7 +802,7 @@ msgstr "" ":keyword:`try` 陳述式有另一個選擇性子句,用於定義在所有情況下都必須被執行的清" "理動作。例如: ::" -#: ../../tutorial/errors.rst:376 +#: ../../tutorial/errors.rst:391 msgid "" ">>> try:\n" "... raise KeyboardInterrupt\n" @@ -782,6 +812,7 @@ msgid "" "Goodbye, world!\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 2, in <module>\n" +" raise KeyboardInterrupt\n" "KeyboardInterrupt" msgstr "" ">>> try:\n" @@ -792,9 +823,10 @@ msgstr "" "Goodbye, world!\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 2, in <module>\n" +" raise KeyboardInterrupt\n" "KeyboardInterrupt" -#: ../../tutorial/errors.rst:386 +#: ../../tutorial/errors.rst:402 msgid "" "If a :keyword:`finally` clause is present, the :keyword:`!finally` clause " "will execute as the last task before the :keyword:`try` statement completes. " @@ -807,7 +839,7 @@ msgstr "" "外,都會執行 :keyword:`!finally` 子句。以下幾點將探討例外發生時,比較複雜的情" "況:" -#: ../../tutorial/errors.rst:392 +#: ../../tutorial/errors.rst:408 msgid "" "If an exception occurs during execution of the :keyword:`!try` clause, the " "exception may be handled by an :keyword:`except` clause. If the exception is " @@ -818,7 +850,7 @@ msgstr "" "`except` 子句處理。如果該例外沒有被 :keyword:`!except` 子句處理,它會在 :" "keyword:`!finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:398 +#: ../../tutorial/errors.rst:414 msgid "" "An exception could occur during execution of an :keyword:`!except` or :" "keyword:`!else` clause. Again, the exception is re-raised after the :keyword:" @@ -827,7 +859,7 @@ msgstr "" "一個例外可能發生於 :keyword:`!except` 或 :keyword:`!else` 子句的執行過程。同" "樣地,該例外會在 :keyword:`!finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:402 +#: ../../tutorial/errors.rst:418 msgid "" "If the :keyword:`!finally` clause executes a :keyword:`break`, :keyword:" "`continue` or :keyword:`return` statement, exceptions are not re-raised." @@ -835,7 +867,7 @@ msgstr "" "如果 :keyword:`!finally` 子句執行 :keyword:`break`、:keyword:`continue` 或 :" "keyword:`return` 陳述式,則例外不會被重新引發。" -#: ../../tutorial/errors.rst:406 +#: ../../tutorial/errors.rst:422 msgid "" "If the :keyword:`!try` statement reaches a :keyword:`break`, :keyword:" "`continue` or :keyword:`return` statement, the :keyword:`!finally` clause " @@ -846,7 +878,7 @@ msgstr "" "keyword:`return` 陳述式,則 :keyword:`!finally` 子句會在執行 :keyword:`!" "break`、:keyword:`!continue` 或 :keyword:`!return` 陳述式之前先執行。" -#: ../../tutorial/errors.rst:412 +#: ../../tutorial/errors.rst:428 msgid "" "If a :keyword:`!finally` clause includes a :keyword:`!return` statement, the " "returned value will be the one from the :keyword:`!finally` clause's :" @@ -857,11 +889,11 @@ msgstr "" "自 :keyword:`!finally` 子句的 :keyword:`!return` 陳述式的回傳值,而不是來自 :" "keyword:`!try` 子句的 :keyword:`!return` 陳述式的回傳值。" -#: ../../tutorial/errors.rst:418 +#: ../../tutorial/errors.rst:434 msgid "For example::" msgstr "例如: ::" -#: ../../tutorial/errors.rst:420 +#: ../../tutorial/errors.rst:436 msgid "" ">>> def bool_return():\n" "... try:\n" @@ -881,11 +913,11 @@ msgstr "" ">>> bool_return()\n" "False" -#: ../../tutorial/errors.rst:429 +#: ../../tutorial/errors.rst:445 msgid "A more complicated example::" msgstr "另一個比較複雜的範例: ::" -#: ../../tutorial/errors.rst:431 +#: ../../tutorial/errors.rst:447 msgid "" ">>> def divide(x, y):\n" "... try:\n" @@ -907,7 +939,11 @@ msgid "" "executing finally clause\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 1, in <module>\n" +" divide(\"2\", \"0\")\n" +" ~~~~~~^^^^^^^^^^\n" " File \"<stdin>\", line 3, in divide\n" +" result = x / y\n" +" ~~^~~\n" "TypeError: unsupported operand type(s) for /: 'str' and 'str'" msgstr "" ">>> def divide(x, y):\n" @@ -930,10 +966,14 @@ msgstr "" "executing finally clause\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 1, in <module>\n" +" divide(\"2\", \"0\")\n" +" ~~~~~~^^^^^^^^^^\n" " File \"<stdin>\", line 3, in divide\n" +" result = x / y\n" +" ~~^~~\n" "TypeError: unsupported operand type(s) for /: 'str' and 'str'" -#: ../../tutorial/errors.rst:454 +#: ../../tutorial/errors.rst:474 msgid "" "As you can see, the :keyword:`finally` clause is executed in any event. " "The :exc:`TypeError` raised by dividing two strings is not handled by the :" @@ -944,7 +984,7 @@ msgstr "" "的 :exc:`TypeError` 沒有被 :keyword:`except` 子句處理,因此會在 :keyword:`!" "finally` 子句執行後被重新引發。" -#: ../../tutorial/errors.rst:459 +#: ../../tutorial/errors.rst:479 msgid "" "In real world applications, the :keyword:`finally` clause is useful for " "releasing external resources (such as files or network connections), " @@ -953,11 +993,11 @@ msgstr "" "在真實應用程式中,:keyword:`finally` 子句對於釋放外部資源(例如檔案或網路連" "線)很有用,無論該資源的使用是否成功。" -#: ../../tutorial/errors.rst:467 +#: ../../tutorial/errors.rst:487 msgid "Predefined Clean-up Actions" msgstr "預定義的清理動作" -#: ../../tutorial/errors.rst:469 +#: ../../tutorial/errors.rst:489 msgid "" "Some objects define standard clean-up actions to be undertaken when the " "object is no longer needed, regardless of whether or not the operation using " @@ -967,7 +1007,7 @@ msgstr "" "某些物件定義了在物件不再被需要時的標準清理動作,無論使用該物件的作業是成功或" "失敗。請看以下範例,它嘗試開啟一個檔案,並印出檔案內容至螢幕。 ::" -#: ../../tutorial/errors.rst:474 +#: ../../tutorial/errors.rst:494 msgid "" "for line in open(\"myfile.txt\"):\n" " print(line, end=\"\")" @@ -975,7 +1015,7 @@ msgstr "" "for line in open(\"myfile.txt\"):\n" " print(line, end=\"\")" -#: ../../tutorial/errors.rst:477 +#: ../../tutorial/errors.rst:497 msgid "" "The problem with this code is that it leaves the file open for an " "indeterminate amount of time after this part of the code has finished " @@ -989,7 +1029,7 @@ msgstr "" "keyword:`with` 陳述式讓物件(例如檔案)在被使用時,能保證它們總是及時、正確地" "被清理。 ::" -#: ../../tutorial/errors.rst:483 +#: ../../tutorial/errors.rst:503 msgid "" "with open(\"myfile.txt\") as f:\n" " for line in f:\n" @@ -999,7 +1039,7 @@ msgstr "" " for line in f:\n" " print(line, end=\"\")" -#: ../../tutorial/errors.rst:487 +#: ../../tutorial/errors.rst:507 msgid "" "After the statement is executed, the file *f* is always closed, even if a " "problem was encountered while processing the lines. Objects which, like " @@ -1009,11 +1049,11 @@ msgstr "" "陳述式執行完畢後,就算是在處理內容時遇到問題,檔案 *f* 總是會被關閉。和檔案一" "樣,提供預定義清理動作的物件會在說明文件中表明這一點。" -#: ../../tutorial/errors.rst:495 +#: ../../tutorial/errors.rst:515 msgid "Raising and Handling Multiple Unrelated Exceptions" msgstr "引發及處理多個無關的例外" -#: ../../tutorial/errors.rst:497 +#: ../../tutorial/errors.rst:517 msgid "" "There are situations where it is necessary to report several exceptions that " "have occurred. This is often the case in concurrency frameworks, when " @@ -1025,7 +1065,7 @@ msgstr "" "中經常會出現這種情況,當平行的 (parallel) 某些任務可能已經失效,但還有其他用" "例 (use case) 希望能繼續執行並收集多個例外,而不是只有引發第一個例外時。" -#: ../../tutorial/errors.rst:503 +#: ../../tutorial/errors.rst:523 msgid "" "The builtin :exc:`ExceptionGroup` wraps a list of exception instances so " "that they can be raised together. It is an exception itself, so it can be " @@ -1035,7 +1075,7 @@ msgstr "" "(串列),使得它們可以一起被引發。由於它本身就是一個例外,因此它也可以像任何" "其他例外一樣被捕獲。 ::" -#: ../../tutorial/errors.rst:507 +#: ../../tutorial/errors.rst:527 msgid "" ">>> def f():\n" "... excs = [OSError('error 1'), SystemError('error 2')]\n" @@ -1044,8 +1084,11 @@ msgid "" ">>> f()\n" " + Exception Group Traceback (most recent call last):\n" " | File \"<stdin>\", line 1, in <module>\n" +" | f()\n" +" | ~^^\n" " | File \"<stdin>\", line 3, in f\n" -" | ExceptionGroup: there were problems\n" +" | raise ExceptionGroup('there were problems', excs)\n" +" | ExceptionGroup: there were problems (2 sub-exceptions)\n" " +-+---------------- 1 ----------------\n" " | OSError: error 1\n" " +---------------- 2 ----------------\n" @@ -1066,8 +1109,11 @@ msgstr "" ">>> f()\n" " + Exception Group Traceback (most recent call last):\n" " | File \"<stdin>\", line 1, in <module>\n" +" | f()\n" +" | ~^^\n" " | File \"<stdin>\", line 3, in f\n" -" | ExceptionGroup: there were problems\n" +" | raise ExceptionGroup('there were problems', excs)\n" +" | ExceptionGroup: there were problems (2 sub-exceptions)\n" " +-+---------------- 1 ----------------\n" " | OSError: error 1\n" " +---------------- 2 ----------------\n" @@ -1081,7 +1127,7 @@ msgstr "" "caught <class 'ExceptionGroup'>: e\n" ">>>" -#: ../../tutorial/errors.rst:529 +#: ../../tutorial/errors.rst:552 msgid "" "By using ``except*`` instead of ``except``, we can selectively handle only " "the exceptions in the group that match a certain type. In the following " @@ -1094,7 +1140,7 @@ msgstr "" "``except*`` 子句分別從該群組中提取一個特定類型的例外,同時讓所有其他的例外都" "傳遞到其他子句,最後再被重新引發。 ::" -#: ../../tutorial/errors.rst:536 +#: ../../tutorial/errors.rst:559 msgid "" ">>> def f():\n" "... raise ExceptionGroup(\n" @@ -1123,10 +1169,15 @@ msgid "" "There were SystemErrors\n" " + Exception Group Traceback (most recent call last):\n" " | File \"<stdin>\", line 2, in <module>\n" +" | f()\n" +" | ~^^\n" " | File \"<stdin>\", line 2, in f\n" -" | ExceptionGroup: group1\n" +" | raise ExceptionGroup(\n" +" | ...<12 lines>...\n" +" | )\n" +" | ExceptionGroup: group1 (1 sub-exception)\n" " +-+---------------- 1 ----------------\n" -" | ExceptionGroup: group2\n" +" | ExceptionGroup: group2 (1 sub-exception)\n" " +-+---------------- 1 ----------------\n" " | RecursionError: 4\n" " +------------------------------------\n" @@ -1159,16 +1210,21 @@ msgstr "" "There were SystemErrors\n" " + Exception Group Traceback (most recent call last):\n" " | File \"<stdin>\", line 2, in <module>\n" +" | f()\n" +" | ~^^\n" " | File \"<stdin>\", line 2, in f\n" -" | ExceptionGroup: group1\n" +" | raise ExceptionGroup(\n" +" | ...<12 lines>...\n" +" | )\n" +" | ExceptionGroup: group1 (1 sub-exception)\n" " +-+---------------- 1 ----------------\n" -" | ExceptionGroup: group2\n" +" | ExceptionGroup: group2 (1 sub-exception)\n" " +-+---------------- 1 ----------------\n" " | RecursionError: 4\n" " +------------------------------------\n" ">>>" -#: ../../tutorial/errors.rst:572 +#: ../../tutorial/errors.rst:600 msgid "" "Note that the exceptions nested in an exception group must be instances, not " "types. This is because in practice the exceptions would typically be ones " @@ -1178,7 +1234,7 @@ msgstr "" "請注意,被巢套在例外群組中的例外必須是實例,而不是類型。這是因為在實務上,這" "些例外通常是已經被程式引發並捕獲的例外,類似以下的模式: ::" -#: ../../tutorial/errors.rst:577 +#: ../../tutorial/errors.rst:605 msgid "" ">>> excs = []\n" "... for test in tests:\n" @@ -1202,11 +1258,11 @@ msgstr "" "... raise ExceptionGroup(\"Test Failures\", excs)\n" "..." -#: ../../tutorial/errors.rst:592 +#: ../../tutorial/errors.rst:620 msgid "Enriching Exceptions with Notes" msgstr "用註解使例外更詳細" -#: ../../tutorial/errors.rst:594 +#: ../../tutorial/errors.rst:622 msgid "" "When an exception is created in order to be raised, it is usually " "initialized with information that describes the error that has occurred. " @@ -1222,7 +1278,7 @@ msgstr "" "的註解清單中。標準的回溯呈現會在例外之後列出所有的註解,並按照其被添加的順序" "來排列。 ::" -#: ../../tutorial/errors.rst:601 +#: ../../tutorial/errors.rst:629 msgid "" ">>> try:\n" "... raise TypeError('bad type')\n" @@ -1233,6 +1289,7 @@ msgid "" "...\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 2, in <module>\n" +" raise TypeError('bad type')\n" "TypeError: bad type\n" "Add some information\n" "Add some more information\n" @@ -1247,12 +1304,13 @@ msgstr "" "...\n" "Traceback (most recent call last):\n" " File \"<stdin>\", line 2, in <module>\n" +" raise TypeError('bad type')\n" "TypeError: bad type\n" "Add some information\n" "Add some more information\n" ">>>" -#: ../../tutorial/errors.rst:615 +#: ../../tutorial/errors.rst:644 msgid "" "For example, when collecting exceptions into an exception group, we may want " "to add context information for the individual errors. In the following each " @@ -1261,7 +1319,7 @@ msgstr "" "例如,在將例外收集到例外群組中時,我們可能希望為各個錯誤添加一些上下文的資" "訊。在以下範例中,群組中的每個例外都有一條註解,指示此錯誤是在何時發生。 ::" -#: ../../tutorial/errors.rst:619 +#: ../../tutorial/errors.rst:648 msgid "" ">>> def f():\n" "... raise OSError('operation failed')\n" @@ -1277,23 +1335,33 @@ msgid "" ">>> raise ExceptionGroup('We have some problems', excs)\n" " + Exception Group Traceback (most recent call last):\n" " | File \"<stdin>\", line 1, in <module>\n" +" | raise ExceptionGroup('We have some problems', excs)\n" " | ExceptionGroup: We have some problems (3 sub-exceptions)\n" " +-+---------------- 1 ----------------\n" " | Traceback (most recent call last):\n" " | File \"<stdin>\", line 3, in <module>\n" +" | f()\n" +" | ~^^\n" " | File \"<stdin>\", line 2, in f\n" +" | raise OSError('operation failed')\n" " | OSError: operation failed\n" " | Happened in Iteration 1\n" " +---------------- 2 ----------------\n" " | Traceback (most recent call last):\n" " | File \"<stdin>\", line 3, in <module>\n" +" | f()\n" +" | ~^^\n" " | File \"<stdin>\", line 2, in f\n" +" | raise OSError('operation failed')\n" " | OSError: operation failed\n" " | Happened in Iteration 2\n" " +---------------- 3 ----------------\n" " | Traceback (most recent call last):\n" " | File \"<stdin>\", line 3, in <module>\n" +" | f()\n" +" | ~^^\n" " | File \"<stdin>\", line 2, in f\n" +" | raise OSError('operation failed')\n" " | OSError: operation failed\n" " | Happened in Iteration 3\n" " +------------------------------------\n" @@ -1313,23 +1381,33 @@ msgstr "" ">>> raise ExceptionGroup('We have some problems', excs)\n" " + Exception Group Traceback (most recent call last):\n" " | File \"<stdin>\", line 1, in <module>\n" +" | raise ExceptionGroup('We have some problems', excs)\n" " | ExceptionGroup: We have some problems (3 sub-exceptions)\n" " +-+---------------- 1 ----------------\n" " | Traceback (most recent call last):\n" " | File \"<stdin>\", line 3, in <module>\n" +" | f()\n" +" | ~^^\n" " | File \"<stdin>\", line 2, in f\n" +" | raise OSError('operation failed')\n" " | OSError: operation failed\n" " | Happened in Iteration 1\n" " +---------------- 2 ----------------\n" " | Traceback (most recent call last):\n" " | File \"<stdin>\", line 3, in <module>\n" +" | f()\n" +" | ~^^\n" " | File \"<stdin>\", line 2, in f\n" +" | raise OSError('operation failed')\n" " | OSError: operation failed\n" " | Happened in Iteration 2\n" " +---------------- 3 ----------------\n" " | Traceback (most recent call last):\n" " | File \"<stdin>\", line 3, in <module>\n" +" | f()\n" +" | ~^^\n" " | File \"<stdin>\", line 2, in f\n" +" | raise OSError('operation failed')\n" " | OSError: operation failed\n" " | Happened in Iteration 3\n" " +------------------------------------\n" diff --git a/tutorial/floatingpoint.po b/tutorial/floatingpoint.po index 29a235e1b5..dc13c64d29 100644 --- a/tutorial/floatingpoint.po +++ b/tutorial/floatingpoint.po @@ -8,7 +8,7 @@ # Steven Hsu <hsuhaochun@gmail.com>, 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2023-06-22 14:43+0800\n" diff --git a/tutorial/index.po b/tutorial/index.po index 8dd27a3e5c..47eb0a648b 100644 --- a/tutorial/index.po +++ b/tutorial/index.po @@ -8,7 +8,7 @@ # woodrow-shen <woodrow.shen@gmail.com>, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-10-26 16:47+0000\n" "PO-Revision-Date: 2018-06-17 11:39+0000\n" diff --git a/tutorial/inputoutput.po b/tutorial/inputoutput.po index 7043a1f50b..3fbc7a6674 100644 --- a/tutorial/inputoutput.po +++ b/tutorial/inputoutput.po @@ -7,7 +7,7 @@ # Steven Hsu <hsuhaochun@gmail.com>, 2021-2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-10-05 10:26+0800\n" diff --git a/tutorial/interactive.po b/tutorial/interactive.po index f95e9e3326..c7d64f4e81 100644 --- a/tutorial/interactive.po +++ b/tutorial/interactive.po @@ -6,7 +6,7 @@ # Steven Hsu <hsuhaochun@gmail.com>, 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2023-07-29 10:36+0000\n" "PO-Revision-Date: 2021-06-28 20:45+0800\n" diff --git a/tutorial/interpreter.po b/tutorial/interpreter.po index 3c01c492de..24379ff4c5 100644 --- a/tutorial/interpreter.po +++ b/tutorial/interpreter.po @@ -6,9 +6,9 @@ # Liang-Bo Wang <me@liang2.tw>, 2015-2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-05-18 16:28+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -29,17 +29,19 @@ msgid "Invoking the Interpreter" msgstr "啟動直譯器" #: ../../tutorial/interpreter.rst:13 +#, fuzzy msgid "" -"The Python interpreter is usually installed as :file:`/usr/local/bin/" -"python3.12` on those machines where it is available; putting :file:`/usr/" -"local/bin` in your Unix shell's search path makes it possible to start it by " -"typing the command:" +"The Python interpreter is usually installed as |" +"usr_local_bin_python_x_dot_y_literal| on those machines where it is " +"available; putting :file:`/usr/local/bin` in your Unix shell's search path " +"makes it possible to start it by typing the command:" msgstr "" "Python 直譯器一般安裝在 :file:`/usr/local/bin/python3.12` 路徑下;將 :file:`/" "usr/local/bin` 加入Unix shell 的搜索路徑,輸入以下指令就可以啟動 Python:" #: ../../tutorial/interpreter.rst:17 -msgid "python3.12" +#, fuzzy +msgid "python3.13" msgstr "python3.12" #: ../../tutorial/interpreter.rst:21 @@ -54,12 +56,13 @@ msgstr "" "python` 是個很常見的另類存放路徑。)" #: ../../tutorial/interpreter.rst:26 +#, fuzzy msgid "" "On Windows machines where you have installed Python from the :ref:`Microsoft " -"Store <windows-store>`, the :file:`python3.12` command will be available. If " -"you have the :ref:`py.exe launcher <launcher>` installed, you can use the :" -"file:`py` command. See :ref:`setting-envvars` for other ways to launch " -"Python." +"Store <windows-store>`, the |python_x_dot_y_literal| command will be " +"available. If you have the :ref:`py.exe launcher <launcher>` installed, you " +"can use the :file:`py` command. See :ref:`setting-envvars` for other ways to " +"launch Python." msgstr "" "Windows 系統中,從 :ref:`Microsoft Store <windows-store>` 安裝 Python 後,就" "可以使用 :file:`python3.12` 命令了。如果安裝了 :ref:`py.exe launcher " @@ -189,9 +192,10 @@ msgstr "" "符: ::" #: ../../tutorial/interpreter.rst:98 +#, fuzzy msgid "" -"$ python3.12\n" -"Python 3.12 (default, April 4 2022, 09:25:04)\n" +"$ python3.13\n" +"Python 3.13 (default, April 4 2023, 09:25:04)\n" "[GCC 10.2.0] on linux\n" "Type \"help\", \"copyright\", \"credits\" or \"license\" for more " "information.\n" diff --git a/tutorial/introduction.po b/tutorial/introduction.po index 76a4aae9d1..436e18af6b 100644 --- a/tutorial/introduction.po +++ b/tutorial/introduction.po @@ -7,7 +7,7 @@ # Steven Hsu <hsuhaochun@gmail.com>, 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-10-16 03:20+0800\n" diff --git a/tutorial/modules.po b/tutorial/modules.po index 3255c53bbd..02d752fd55 100644 --- a/tutorial/modules.po +++ b/tutorial/modules.po @@ -8,7 +8,7 @@ # Phil Lin <linooohon@gmail.com>, 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-03 11:11+0800\n" "PO-Revision-Date: 2022-10-23 20:30+0800\n" diff --git a/tutorial/stdlib.po b/tutorial/stdlib.po index 2e2b32d7d9..ed03a48a61 100644 --- a/tutorial/stdlib.po +++ b/tutorial/stdlib.po @@ -12,9 +12,9 @@ # Phil Lin <linooohon@gmail.com>, 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-01-31 18:14+0800\n" "Last-Translator: Phil Lin <linooohon@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -44,7 +44,7 @@ msgstr ":mod:`os` 模組提供了數十個與作業系統溝通的函式: ::" msgid "" ">>> import os\n" ">>> os.getcwd() # Return the current working directory\n" -"'C:\\\\Python312'\n" +"'C:\\\\Python313'\n" ">>> os.chdir('/server/accesslogs') # Change current working directory\n" ">>> os.system('mkdir today') # Run the command mkdir in the system shell\n" "0" @@ -298,7 +298,7 @@ msgid "" "'apple'\n" ">>> random.sample(range(100), 10) # sampling without replacement\n" "[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]\n" -">>> random.random() # random float\n" +">>> random.random() # random float from the interval [0.0, 1.0)\n" "0.17970987693706186\n" ">>> random.randrange(6) # random integer chosen from range(6)\n" "4" diff --git a/tutorial/stdlib2.po b/tutorial/stdlib2.po index c44790758d..1b2f36d17e 100644 --- a/tutorial/stdlib2.po +++ b/tutorial/stdlib2.po @@ -7,9 +7,9 @@ # Steven Hsu <hsuhaochun@gmail.com>, 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2021-06-19 14:24+0800\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -537,7 +537,7 @@ msgid "" "Traceback (most recent call last):\n" " File \"<stdin>\", line 1, in <module>\n" " d['primary'] # entry was automatically removed\n" -" File \"C:/python312/lib/weakref.py\", line 46, in __getitem__\n" +" File \"C:/python313/lib/weakref.py\", line 46, in __getitem__\n" " o = self.data[key]()\n" "KeyError: 'primary'" msgstr "" diff --git a/tutorial/venv.po b/tutorial/venv.po index d925307f4a..408392a22a 100644 --- a/tutorial/venv.po +++ b/tutorial/venv.po @@ -5,7 +5,7 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2022-10-16 05:35+0800\n" diff --git a/tutorial/whatnow.po b/tutorial/whatnow.po index 4b5d65878b..d963db60c2 100644 --- a/tutorial/whatnow.po +++ b/tutorial/whatnow.po @@ -7,7 +7,7 @@ # meowmeowcat <meowmeowcat1211@gmail.com>, 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-10-15 20:43+0000\n" "PO-Revision-Date: 2022-10-16 05:37+0800\n" diff --git a/using/android.po b/using/android.po new file mode 100644 index 0000000000..dbb98acccb --- /dev/null +++ b/using/android.po @@ -0,0 +1,144 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../using/android.rst:5 +msgid "Using Python on Android" +msgstr "" + +#: ../../using/android.rst:7 +msgid "" +"Python on Android is unlike Python on desktop platforms. On a desktop " +"platform, Python is generally installed as a system resource that can be " +"used by any user of that computer. Users then interact with Python by " +"running a :program:`python` executable and entering commands at an " +"interactive prompt, or by running a Python script." +msgstr "" + +#: ../../using/android.rst:13 +msgid "" +"On Android, there is no concept of installing as a system resource. The only " +"unit of software distribution is an \"app\". There is also no console where " +"you could run a :program:`python` executable, or interact with a Python REPL." +msgstr "" + +#: ../../using/android.rst:17 +msgid "" +"As a result, the only way you can use Python on Android is in embedded mode " +"– that is, by writing a native Android application, embedding a Python " +"interpreter using ``libpython``, and invoking Python code using the :ref:" +"`Python embedding API <embedding>`. The full Python interpreter, the " +"standard library, and all your Python code is then packaged into your app " +"for its own private use." +msgstr "" + +#: ../../using/android.rst:23 +msgid "" +"The Python standard library has some notable omissions and restrictions on " +"Android. See the :ref:`API availability guide <mobile-availability>` for " +"details." +msgstr "" + +#: ../../using/android.rst:28 +msgid "Adding Python to an Android app" +msgstr "" + +#: ../../using/android.rst:30 +msgid "" +"These instructions are only needed if you're planning to compile Python for " +"Android yourself. Most users should *not* need to do this. Instead, use one " +"of the following tools, which will provide a much easier experience:" +msgstr "" + +#: ../../using/android.rst:34 +msgid "" +"`Briefcase <https://briefcase.readthedocs.io>`__, from the BeeWare project" +msgstr "" + +#: ../../using/android.rst:35 +msgid "`Buildozer <https://buildozer.readthedocs.io>`__, from the Kivy project" +msgstr "" + +#: ../../using/android.rst:36 +msgid "`Chaquopy <https://chaquo.com/chaquopy>`__" +msgstr "" + +#: ../../using/android.rst:37 +msgid "" +"`pyqtdeploy <https://www.riverbankcomputing.com/static/Docs/pyqtdeploy/>`__" +msgstr "" + +#: ../../using/android.rst:38 +msgid "`Termux <https://termux.dev/en/>`__" +msgstr "" + +#: ../../using/android.rst:40 +msgid "" +"If you're sure you want to do all of this manually, read on. You can use " +"the :source:`testbed app <Android/testbed>` as a guide; each step below " +"contains a link to the relevant file." +msgstr "" + +#: ../../using/android.rst:44 +msgid "" +"Build Python by following the instructions in :source:`Android/README.md`." +msgstr "" + +#: ../../using/android.rst:46 +msgid "" +"Add code to your :source:`build.gradle <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``:" +msgstr "" + +#: ../../using/android.rst:50 +msgid "In your JNI libraries:" +msgstr "" + +#: ../../using/android.rst:52 +msgid "``libpython*.*.so``" +msgstr "``libpython*.*.so``" + +#: ../../using/android.rst:53 +msgid "``lib*_python.so`` (external libraries such as OpenSSL)" +msgstr "" + +#: ../../using/android.rst:55 +msgid "In your assets:" +msgstr "" + +#: ../../using/android.rst:57 +msgid "``python*.*`` (the Python standard library)" +msgstr "" + +#: ../../using/android.rst:58 +msgid "``python*.*/site-packages`` (your own Python code)" +msgstr "" + +#: ../../using/android.rst:60 +msgid "" +"Add code to your app to :source:`extract the assets to the filesystem " +"<Android/testbed/app/src/main/java/org/python/testbed/MainActivity.kt>`." +msgstr "" + +#: ../../using/android.rst:63 +msgid "" +"Add code to your app to :source:`start Python in embedded mode <Android/" +"testbed/app/src/main/c/main_activity.c>`. This will need to be C code called " +"via JNI." +msgstr "" diff --git a/using/cmdline.po b/using/cmdline.po index cda8562f83..fdee4c513d 100644 --- a/using/cmdline.po +++ b/using/cmdline.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -73,40 +73,40 @@ msgid "" "When called with standard input connected to a tty device, it prompts for " "commands and executes them until an EOF (an end-of-file character, you can " "produce that with :kbd:`Ctrl-D` on UNIX or :kbd:`Ctrl-Z, Enter` on Windows) " -"is read." +"is read. For more on interactive mode, see :ref:`tut-interac`." msgstr "" -#: ../../using/cmdline.rst:45 +#: ../../using/cmdline.rst:46 msgid "" "When called with a file name argument or with a file as standard input, it " "reads and executes a script from that file." msgstr "" -#: ../../using/cmdline.rst:47 +#: ../../using/cmdline.rst:48 msgid "" "When called with a directory name argument, it reads and executes an " "appropriately named script from that directory." msgstr "" -#: ../../using/cmdline.rst:49 +#: ../../using/cmdline.rst:50 msgid "" "When called with ``-c command``, it executes the Python statement(s) given " "as *command*. Here *command* may contain multiple statements separated by " "newlines. Leading whitespace is significant in Python statements!" msgstr "" -#: ../../using/cmdline.rst:52 +#: ../../using/cmdline.rst:53 msgid "" "When called with ``-m module-name``, the given module is located on the " "Python module path and executed as a script." msgstr "" -#: ../../using/cmdline.rst:55 +#: ../../using/cmdline.rst:56 msgid "" "In non-interactive mode, the entire input is parsed before it is executed." msgstr "" -#: ../../using/cmdline.rst:57 +#: ../../using/cmdline.rst:58 msgid "" "An interface option terminates the list of options consumed by the " "interpreter, all consecutive arguments will end up in :data:`sys.argv` -- " @@ -114,14 +114,14 @@ msgid "" "reflecting the program's source." msgstr "" -#: ../../using/cmdline.rst:64 +#: ../../using/cmdline.rst:65 msgid "" "Execute the Python code in *command*. *command* can be one or more " "statements separated by newlines, with significant leading whitespace as in " "normal module code." msgstr "" -#: ../../using/cmdline.rst:68 +#: ../../using/cmdline.rst:69 msgid "" "If this option is given, the first element of :data:`sys.argv` will be ``\"-" "c\"`` and the current directory will be added to the start of :data:`sys." @@ -129,7 +129,7 @@ msgid "" "modules)." msgstr "" -#: ../../using/cmdline.rst:73 +#: ../../using/cmdline.rst:74 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_command`` with " "argument ``command``." @@ -137,13 +137,13 @@ msgstr "" "引發一個附帶引數 ``command`` 的\\ :ref:`稽核事件 <auditing>` ``cpython." "run_command``。" -#: ../../using/cmdline.rst:77 +#: ../../using/cmdline.rst:78 msgid "" "Search :data:`sys.path` for the named module and execute its contents as " "the :mod:`__main__` module." msgstr "" -#: ../../using/cmdline.rst:80 +#: ../../using/cmdline.rst:81 msgid "" "Since the argument is a *module* name, you must not give a file extension " "(``.py``). The module name should be a valid absolute Python module name, " @@ -151,7 +151,7 @@ msgid "" "use a name that includes a hyphen)." msgstr "" -#: ../../using/cmdline.rst:85 +#: ../../using/cmdline.rst:86 msgid "" "Package names (including namespace packages) are also permitted. When a " "package name is supplied instead of a normal module, the interpreter will " @@ -160,7 +160,7 @@ msgid "" "passed to the interpreter as the script argument." msgstr "" -#: ../../using/cmdline.rst:94 +#: ../../using/cmdline.rst:95 msgid "" "This option cannot be used with built-in modules and extension modules " "written in C, since they do not have Python module files. However, it can " @@ -168,7 +168,7 @@ msgid "" "not available." msgstr "" -#: ../../using/cmdline.rst:99 +#: ../../using/cmdline.rst:100 msgid "" "If this option is given, the first element of :data:`sys.argv` will be the " "full path to the module file (while the module file is being located, the " @@ -176,26 +176,26 @@ msgid "" "the current directory will be added to the start of :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:104 +#: ../../using/cmdline.rst:105 msgid "" ":option:`-I` option can be used to run the script in isolated mode where :" "data:`sys.path` contains neither the current directory nor the user's site-" "packages directory. All ``PYTHON*`` environment variables are ignored, too." msgstr "" -#: ../../using/cmdline.rst:109 +#: ../../using/cmdline.rst:110 msgid "" "Many standard library modules contain code that is invoked on their " "execution as a script. An example is the :mod:`timeit` module::" msgstr "" -#: ../../using/cmdline.rst:112 +#: ../../using/cmdline.rst:113 msgid "" "python -m timeit -s \"setup here\" \"benchmarked code here\"\n" "python -m timeit -h # for details" msgstr "" -#: ../../using/cmdline.rst:115 +#: ../../using/cmdline.rst:116 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_module`` with " "argument ``module-name``." @@ -203,47 +203,47 @@ msgstr "" "引發一個附帶引數 ``module-name`` 的\\ :ref:`稽核事件 <auditing>` ``cpython." "run_module``。" -#: ../../using/cmdline.rst:118 +#: ../../using/cmdline.rst:119 msgid ":func:`runpy.run_module`" msgstr ":func:`runpy.run_module`" -#: ../../using/cmdline.rst:119 ../../using/cmdline.rst:171 +#: ../../using/cmdline.rst:120 ../../using/cmdline.rst:172 msgid "Equivalent functionality directly available to Python code" msgstr "" -#: ../../using/cmdline.rst:121 +#: ../../using/cmdline.rst:122 msgid ":pep:`338` -- Executing modules as scripts" msgstr "" -#: ../../using/cmdline.rst:123 +#: ../../using/cmdline.rst:124 msgid "Supply the package name to run a ``__main__`` submodule." msgstr "" -#: ../../using/cmdline.rst:126 +#: ../../using/cmdline.rst:127 msgid "namespace packages are also supported" msgstr "" -#: ../../using/cmdline.rst:133 +#: ../../using/cmdline.rst:134 msgid "" "Read commands from standard input (:data:`sys.stdin`). If standard input is " "a terminal, :option:`-i` is implied." msgstr "" -#: ../../using/cmdline.rst:136 +#: ../../using/cmdline.rst:137 msgid "" "If this option is given, the first element of :data:`sys.argv` will be ``\"-" "\"`` and the current directory will be added to the start of :data:`sys." "path`." msgstr "" -#: ../../using/cmdline.rst:140 ../../using/cmdline.rst:723 +#: ../../using/cmdline.rst:141 ../../using/cmdline.rst:790 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_stdin`` with no " "arguments." msgstr "" "引發一個不附帶引數的\\ :ref:`稽核事件 <auditing>` ``cpython.run_stdin``。" -#: ../../using/cmdline.rst:146 +#: ../../using/cmdline.rst:147 msgid "" "Execute the Python code contained in *script*, which must be a filesystem " "path (absolute or relative) referring to either a Python file, a directory " @@ -251,34 +251,34 @@ msgid "" "file." msgstr "" -#: ../../using/cmdline.rst:151 +#: ../../using/cmdline.rst:152 msgid "" "If this option is given, the first element of :data:`sys.argv` will be the " "script name as given on the command line." msgstr "" -#: ../../using/cmdline.rst:154 +#: ../../using/cmdline.rst:155 msgid "" "If the script name refers directly to a Python file, the directory " "containing that file is added to the start of :data:`sys.path`, and the file " "is executed as the :mod:`__main__` module." msgstr "" -#: ../../using/cmdline.rst:158 +#: ../../using/cmdline.rst:159 msgid "" "If the script name refers to a directory or zipfile, the script name is " "added to the start of :data:`sys.path` and the ``__main__.py`` file in that " "location is executed as the :mod:`__main__` module." msgstr "" -#: ../../using/cmdline.rst:162 +#: ../../using/cmdline.rst:163 msgid "" ":option:`-I` option can be used to run the script in isolated mode where :" "data:`sys.path` contains neither the script's directory nor the user's site-" "packages directory. All ``PYTHON*`` environment variables are ignored, too." msgstr "" -#: ../../using/cmdline.rst:167 +#: ../../using/cmdline.rst:168 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_file`` with " "argument ``filename``." @@ -286,11 +286,11 @@ msgstr "" "引發一個附帶引數 ``filename`` 的\\ :ref:`稽核事件 <auditing>` ``cpython." "run_file``。" -#: ../../using/cmdline.rst:170 +#: ../../using/cmdline.rst:171 msgid ":func:`runpy.run_path`" msgstr ":func:`runpy.run_path`" -#: ../../using/cmdline.rst:174 +#: ../../using/cmdline.rst:175 msgid "" "If no interface option is given, :option:`-i` is implied, ``sys.argv[0]`` is " "an empty string (``\"\"``) and the current directory will be added to the " @@ -299,51 +299,51 @@ msgid "" "config`)." msgstr "" -#: ../../using/cmdline.rst:180 +#: ../../using/cmdline.rst:181 msgid ":ref:`tut-invoking`" msgstr ":ref:`tut-invoking`" -#: ../../using/cmdline.rst:182 +#: ../../using/cmdline.rst:183 msgid "Automatic enabling of tab-completion and history editing." msgstr "" -#: ../../using/cmdline.rst:189 +#: ../../using/cmdline.rst:190 msgid "Generic options" msgstr "" -#: ../../using/cmdline.rst:195 +#: ../../using/cmdline.rst:196 msgid "" "Print a short description of all command line options and corresponding " "environment variables and exit." msgstr "" -#: ../../using/cmdline.rst:200 +#: ../../using/cmdline.rst:201 msgid "" "Print a short description of Python-specific environment variables and exit." msgstr "" -#: ../../using/cmdline.rst:207 +#: ../../using/cmdline.rst:208 msgid "" "Print a description of implementation-specific :option:`-X` options and exit." msgstr "" -#: ../../using/cmdline.rst:214 +#: ../../using/cmdline.rst:215 msgid "Print complete usage information and exit." msgstr "印出完整使用資訊並離開。" -#: ../../using/cmdline.rst:221 +#: ../../using/cmdline.rst:222 msgid "Print the Python version number and exit. Example output could be:" msgstr "" -#: ../../using/cmdline.rst:223 +#: ../../using/cmdline.rst:224 msgid "Python 3.8.0b2+" msgstr "Python 3.8.0b2+" -#: ../../using/cmdline.rst:227 +#: ../../using/cmdline.rst:228 msgid "When given twice, print more information about the build, like:" msgstr "" -#: ../../using/cmdline.rst:229 +#: ../../using/cmdline.rst:230 msgid "" "Python 3.8.0b2+ (3.8:0c076caaa8, Apr 20 2019, 21:55:00)\n" "[GCC 6.2.0 20161005]" @@ -351,15 +351,15 @@ msgstr "" "Python 3.8.0b2+ (3.8:0c076caaa8, Apr 20 2019, 21:55:00)\n" "[GCC 6.2.0 20161005]" -#: ../../using/cmdline.rst:234 +#: ../../using/cmdline.rst:235 msgid "The ``-VV`` option." msgstr "``-VV`` 選項" -#: ../../using/cmdline.rst:241 +#: ../../using/cmdline.rst:242 msgid "Miscellaneous options" msgstr "" -#: ../../using/cmdline.rst:245 +#: ../../using/cmdline.rst:246 msgid "" "Issue a warning when converting :class:`bytes` or :class:`bytearray` to :" "class:`str` without specifying encoding or comparing :class:`!bytes` or :" @@ -367,17 +367,17 @@ msgid "" "Issue an error when the option is given twice (:option:`!-bb`)." msgstr "" -#: ../../using/cmdline.rst:250 +#: ../../using/cmdline.rst:251 msgid "Affects also comparisons of :class:`bytes` with :class:`int`." msgstr "" -#: ../../using/cmdline.rst:255 +#: ../../using/cmdline.rst:256 msgid "" "If given, Python won't try to write ``.pyc`` files on the import of source " "modules. See also :envvar:`PYTHONDONTWRITEBYTECODE`." msgstr "" -#: ../../using/cmdline.rst:261 +#: ../../using/cmdline.rst:262 msgid "" "Control the validation behavior of hash-based ``.pyc`` files. See :ref:`pyc-" "invalidation`. When set to ``default``, checked and unchecked hash-based " @@ -388,35 +388,35 @@ msgid "" "corresponding source files." msgstr "" -#: ../../using/cmdline.rst:269 +#: ../../using/cmdline.rst:270 msgid "" "The semantics of timestamp-based ``.pyc`` files are unaffected by this " "option." msgstr "" -#: ../../using/cmdline.rst:275 +#: ../../using/cmdline.rst:276 msgid "" "Turn on parser debugging output (for expert only). See also the :envvar:" "`PYTHONDEBUG` environment variable." msgstr "" -#: ../../using/cmdline.rst:278 +#: ../../using/cmdline.rst:279 msgid "" "This option requires a :ref:`debug build of Python <debug-build>`, otherwise " "it's ignored." msgstr "" -#: ../../using/cmdline.rst:284 +#: ../../using/cmdline.rst:285 msgid "" "Ignore all ``PYTHON*`` environment variables, e.g. :envvar:`PYTHONPATH` and :" "envvar:`PYTHONHOME`, that might be set." msgstr "" -#: ../../using/cmdline.rst:287 +#: ../../using/cmdline.rst:288 msgid "See also the :option:`-P` and :option:`-I` (isolated) options." msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" -#: ../../using/cmdline.rst:292 +#: ../../using/cmdline.rst:293 msgid "" "When a script is passed as first argument or the :option:`-c` option is " "used, enter interactive mode after executing the script or the command, even " @@ -424,19 +424,19 @@ msgid "" "`PYTHONSTARTUP` file is not read." msgstr "" -#: ../../using/cmdline.rst:297 +#: ../../using/cmdline.rst:298 msgid "" "This can be useful to inspect global variables or a stack trace when a " "script raises an exception. See also :envvar:`PYTHONINSPECT`." msgstr "" -#: ../../using/cmdline.rst:303 +#: ../../using/cmdline.rst:304 msgid "" "Run Python in isolated mode. This also implies :option:`-E`, :option:`-P` " "and :option:`-s` options." msgstr "" -#: ../../using/cmdline.rst:306 +#: ../../using/cmdline.rst:307 msgid "" "In isolated mode :data:`sys.path` contains neither the script's directory " "nor the user's site-packages directory. All ``PYTHON*`` environment " @@ -444,7 +444,7 @@ msgid "" "the user from injecting malicious code." msgstr "" -#: ../../using/cmdline.rst:316 +#: ../../using/cmdline.rst:317 msgid "" "Remove assert statements and any code conditional on the value of :const:" "`__debug__`. Augment the filename for compiled (:term:`bytecode`) files by " @@ -452,58 +452,58 @@ msgid "" "envvar:`PYTHONOPTIMIZE`." msgstr "" -#: ../../using/cmdline.rst:321 ../../using/cmdline.rst:331 +#: ../../using/cmdline.rst:322 ../../using/cmdline.rst:332 msgid "Modify ``.pyc`` filenames according to :pep:`488`." msgstr "根據 :pep:`488` 修改 ``.pyc`` 檔案名稱。" -#: ../../using/cmdline.rst:327 +#: ../../using/cmdline.rst:328 msgid "" "Do :option:`-O` and also discard docstrings. Augment the filename for " "compiled (:term:`bytecode`) files by adding ``.opt-2`` before the ``.pyc`` " "extension (see :pep:`488`)." msgstr "" -#: ../../using/cmdline.rst:337 +#: ../../using/cmdline.rst:338 msgid "Don't prepend a potentially unsafe path to :data:`sys.path`:" msgstr "" -#: ../../using/cmdline.rst:339 +#: ../../using/cmdline.rst:340 msgid "" "``python -m module`` command line: Don't prepend the current working " "directory." msgstr "" -#: ../../using/cmdline.rst:341 +#: ../../using/cmdline.rst:342 msgid "" "``python script.py`` command line: Don't prepend the script's directory. If " "it's a symbolic link, resolve symbolic links." msgstr "" -#: ../../using/cmdline.rst:343 +#: ../../using/cmdline.rst:344 msgid "" "``python -c code`` and ``python`` (REPL) command lines: Don't prepend an " "empty string, which means the current working directory." msgstr "" -#: ../../using/cmdline.rst:346 +#: ../../using/cmdline.rst:347 msgid "" "See also the :envvar:`PYTHONSAFEPATH` environment variable, and :option:`-E` " "and :option:`-I` (isolated) options." msgstr "" -#: ../../using/cmdline.rst:354 +#: ../../using/cmdline.rst:355 msgid "" "Don't display the copyright and version messages even in interactive mode." msgstr "" -#: ../../using/cmdline.rst:361 +#: ../../using/cmdline.rst:362 msgid "" "Turn on hash randomization. This option only has an effect if the :envvar:" "`PYTHONHASHSEED` environment variable is set to ``0``, since hash " "randomization is enabled by default." msgstr "" -#: ../../using/cmdline.rst:365 +#: ../../using/cmdline.rst:366 msgid "" "On previous versions of Python, this option turns on hash randomization, so " "that the :meth:`~object.__hash__` values of str and bytes objects are " @@ -512,7 +512,7 @@ msgid "" "between repeated invocations of Python." msgstr "" -#: ../../using/cmdline.rst:371 +#: ../../using/cmdline.rst:372 msgid "" "Hash randomization is intended to provide protection against a denial-of-" "service caused by carefully chosen inputs that exploit the worst case " @@ -520,32 +520,32 @@ msgid "" "http://ocert.org/advisories/ocert-2011-003.html for details." msgstr "" -#: ../../using/cmdline.rst:376 +#: ../../using/cmdline.rst:377 msgid "" ":envvar:`PYTHONHASHSEED` allows you to set a fixed value for the hash seed " "secret." msgstr "" -#: ../../using/cmdline.rst:381 +#: ../../using/cmdline.rst:382 msgid "The option is no longer ignored." msgstr "" -#: ../../using/cmdline.rst:387 +#: ../../using/cmdline.rst:388 msgid "" "Don't add the :data:`user site-packages directory <site.USER_SITE>` to :data:" "`sys.path`." msgstr "" -#: ../../using/cmdline.rst:390 +#: ../../using/cmdline.rst:391 msgid "See also :envvar:`PYTHONNOUSERSITE`." msgstr "另請參閱 :envvar:`PYTHONNOUSERSITE`。" -#: ../../using/cmdline.rst:394 ../../using/cmdline.rst:816 -#: ../../using/cmdline.rst:828 +#: ../../using/cmdline.rst:395 ../../using/cmdline.rst:887 +#: ../../using/cmdline.rst:899 msgid ":pep:`370` -- Per user site-packages directory" msgstr "" -#: ../../using/cmdline.rst:399 +#: ../../using/cmdline.rst:400 msgid "" "Disable the import of the module :mod:`site` and the site-dependent " "manipulations of :data:`sys.path` that it entails. Also disable these " @@ -553,21 +553,21 @@ msgid "" "main` if you want them to be triggered)." msgstr "" -#: ../../using/cmdline.rst:407 +#: ../../using/cmdline.rst:408 msgid "" "Force the stdout and stderr streams to be unbuffered. This option has no " "effect on the stdin stream." msgstr "" -#: ../../using/cmdline.rst:410 +#: ../../using/cmdline.rst:411 msgid "See also :envvar:`PYTHONUNBUFFERED`." msgstr "另請參閱 :envvar:`PYTHONUNBUFFERED`。" -#: ../../using/cmdline.rst:412 +#: ../../using/cmdline.rst:413 msgid "The text layer of the stdout and stderr streams now is unbuffered." msgstr "" -#: ../../using/cmdline.rst:418 +#: ../../using/cmdline.rst:419 msgid "" "Print a message each time a module is initialized, showing the place " "(filename or built-in module) from which it is loaded. When given twice (:" @@ -575,30 +575,30 @@ msgid "" "searching for a module. Also provides information on module cleanup at exit." msgstr "" -#: ../../using/cmdline.rst:423 +#: ../../using/cmdline.rst:424 msgid "" "The :mod:`site` module reports the site-specific paths and :file:`.pth` " "files being processed." msgstr "" -#: ../../using/cmdline.rst:427 +#: ../../using/cmdline.rst:428 msgid "See also :envvar:`PYTHONVERBOSE`." msgstr "另請參閱 :envvar:`PYTHONVERBOSE`。" -#: ../../using/cmdline.rst:433 +#: ../../using/cmdline.rst:434 msgid "" "Warning control. Python's warning machinery by default prints warning " "messages to :data:`sys.stderr`." msgstr "" -#: ../../using/cmdline.rst:436 ../../using/cmdline.rst:844 +#: ../../using/cmdline.rst:437 ../../using/cmdline.rst:915 msgid "" "The simplest settings apply a particular action unconditionally to all " "warnings emitted by a process (even those that are otherwise ignored by " "default)::" msgstr "" -#: ../../using/cmdline.rst:440 +#: ../../using/cmdline.rst:441 msgid "" "-Wdefault # Warn once per call location\n" "-Werror # Convert to exceptions\n" @@ -609,41 +609,41 @@ msgid "" "-Wignore # Never warn" msgstr "" -#: ../../using/cmdline.rst:448 +#: ../../using/cmdline.rst:449 msgid "" "The action names can be abbreviated as desired and the interpreter will " "resolve them to the appropriate action name. For example, ``-Wi`` is the " "same as ``-Wignore``." msgstr "" -#: ../../using/cmdline.rst:452 +#: ../../using/cmdline.rst:453 msgid "The full form of argument is::" msgstr "完整的引數形式為: ::" -#: ../../using/cmdline.rst:454 +#: ../../using/cmdline.rst:455 msgid "action:message:category:module:lineno" msgstr "action:message:category:module:lineno" -#: ../../using/cmdline.rst:456 +#: ../../using/cmdline.rst:457 msgid "" "Empty fields match all values; trailing empty fields may be omitted. For " "example ``-W ignore::DeprecationWarning`` ignores all DeprecationWarning " "warnings." msgstr "" -#: ../../using/cmdline.rst:460 +#: ../../using/cmdline.rst:461 msgid "" "The *action* field is as explained above but only applies to warnings that " "match the remaining fields." msgstr "" -#: ../../using/cmdline.rst:463 +#: ../../using/cmdline.rst:464 msgid "" "The *message* field must match the whole warning message; this match is case-" "insensitive." msgstr "" -#: ../../using/cmdline.rst:466 +#: ../../using/cmdline.rst:467 msgid "" "The *category* field matches the warning category (ex: " "``DeprecationWarning``). This must be a class name; the match test whether " @@ -651,19 +651,19 @@ msgid "" "warning category." msgstr "" -#: ../../using/cmdline.rst:471 +#: ../../using/cmdline.rst:472 msgid "" "The *module* field matches the (fully qualified) module name; this match is " "case-sensitive." msgstr "" -#: ../../using/cmdline.rst:474 +#: ../../using/cmdline.rst:475 msgid "" "The *lineno* field matches the line number, where zero matches all line " "numbers and is thus equivalent to an omitted line number." msgstr "" -#: ../../using/cmdline.rst:477 +#: ../../using/cmdline.rst:478 msgid "" "Multiple :option:`-W` options can be given; when a warning matches more than " "one option, the action for the last matching option is performed. Invalid :" @@ -671,7 +671,7 @@ msgid "" "invalid options when the first warning is issued)." msgstr "" -#: ../../using/cmdline.rst:482 +#: ../../using/cmdline.rst:483 msgid "" "Warnings can also be controlled using the :envvar:`PYTHONWARNINGS` " "environment variable and from within a Python program using the :mod:" @@ -679,31 +679,31 @@ msgid "" "can be used to use a regular expression on the warning message." msgstr "" -#: ../../using/cmdline.rst:487 ../../using/cmdline.rst:856 +#: ../../using/cmdline.rst:488 ../../using/cmdline.rst:927 msgid "" "See :ref:`warning-filter` and :ref:`describing-warning-filters` for more " "details." msgstr "" -#: ../../using/cmdline.rst:493 +#: ../../using/cmdline.rst:494 msgid "" "Skip the first line of the source, allowing use of non-Unix forms of ``#!" "cmd``. This is intended for a DOS specific hack only." msgstr "" -#: ../../using/cmdline.rst:499 +#: ../../using/cmdline.rst:500 msgid "" "Reserved for various implementation-specific options. CPython currently " "defines the following possible values:" msgstr "" -#: ../../using/cmdline.rst:502 +#: ../../using/cmdline.rst:503 msgid "" "``-X faulthandler`` to enable :mod:`faulthandler`. See also :envvar:" "`PYTHONFAULTHANDLER`." msgstr "" -#: ../../using/cmdline.rst:507 +#: ../../using/cmdline.rst:508 msgid "" "``-X showrefcount`` to output the total reference count and number of used " "memory blocks when the program finishes or after each statement in the " @@ -711,7 +711,7 @@ msgid "" "build>`." msgstr "" -#: ../../using/cmdline.rst:514 +#: ../../using/cmdline.rst:515 msgid "" "``-X tracemalloc`` to start tracing Python memory allocations using the :mod:" "`tracemalloc` module. By default, only the most recent frame is stored in a " @@ -720,14 +720,14 @@ msgid "" "envvar:`PYTHONTRACEMALLOC` for more information." msgstr "" -#: ../../using/cmdline.rst:523 +#: ../../using/cmdline.rst:524 msgid "" "``-X int_max_str_digits`` configures the :ref:`integer string conversion " "length limitation <int_max_str_digits>`. See also :envvar:" "`PYTHONINTMAXSTRDIGITS`." msgstr "" -#: ../../using/cmdline.rst:529 +#: ../../using/cmdline.rst:530 msgid "" "``-X importtime`` to show how long each import takes. It shows module name, " "cumulative time (including nested imports) and self time (excluding nested " @@ -736,35 +736,35 @@ msgid "" "asyncio'``. See also :envvar:`PYTHONPROFILEIMPORTTIME`." msgstr "" -#: ../../using/cmdline.rst:537 +#: ../../using/cmdline.rst:538 msgid "" "``-X dev``: enable :ref:`Python Development Mode <devmode>`, introducing " "additional runtime checks that are too expensive to be enabled by default. " "See also :envvar:`PYTHONDEVMODE`." msgstr "" -#: ../../using/cmdline.rst:543 +#: ../../using/cmdline.rst:544 msgid "" "``-X utf8`` enables the :ref:`Python UTF-8 Mode <utf8-mode>`. ``-X utf8=0`` " "explicitly disables :ref:`Python UTF-8 Mode <utf8-mode>` (even when it would " "otherwise activate automatically). See also :envvar:`PYTHONUTF8`." msgstr "" -#: ../../using/cmdline.rst:550 +#: ../../using/cmdline.rst:551 msgid "" "``-X pycache_prefix=PATH`` enables writing ``.pyc`` files to a parallel tree " "rooted at the given directory instead of to the code tree. See also :envvar:" "`PYTHONPYCACHEPREFIX`." msgstr "" -#: ../../using/cmdline.rst:556 +#: ../../using/cmdline.rst:557 msgid "" "``-X warn_default_encoding`` issues a :class:`EncodingWarning` when the " "locale-specific default encoding is used for opening files. See also :envvar:" "`PYTHONWARNDEFAULTENCODING`." msgstr "" -#: ../../using/cmdline.rst:562 +#: ../../using/cmdline.rst:563 msgid "" "``-X no_debug_ranges`` disables the inclusion of the tables mapping extra " "location information (end line, start column offset and end column offset) " @@ -774,18 +774,19 @@ msgid "" "envvar:`PYTHONNODEBUGRANGES`." msgstr "" -#: ../../using/cmdline.rst:571 +#: ../../using/cmdline.rst:572 msgid "" "``-X frozen_modules`` determines whether or not frozen modules are ignored " -"by the import machinery. A value of \"on\" means they get imported and " -"\"off\" means they are ignored. The default is \"on\" if this is an " +"by the import machinery. A value of ``on`` means they get imported and " +"``off`` means they are ignored. The default is ``on`` if this is an " "installed Python (the normal case). If it's under development (running from " -"the source tree) then the default is \"off\". Note that the " -"\"importlib_bootstrap\" and \"importlib_bootstrap_external\" frozen modules " -"are always used, even if this flag is set to \"off\"." +"the source tree) then the default is ``off``. Note that the :mod:`!" +"importlib_bootstrap` and :mod:`!importlib_bootstrap_external` frozen modules " +"are always used, even if this flag is set to ``off``. See also :envvar:" +"`PYTHON_FROZEN_MODULES`." msgstr "" -#: ../../using/cmdline.rst:581 +#: ../../using/cmdline.rst:583 msgid "" "``-X perf`` enables support for the Linux ``perf`` profiler. When this " "option is provided, the ``perf`` profiler will be able to report Python " @@ -794,33 +795,108 @@ msgid "" "also :envvar:`PYTHONPERFSUPPORT` and :ref:`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:589 +#: ../../using/cmdline.rst:591 +msgid "" +"``-X perf_jit`` enables support for the Linux ``perf`` profiler with DWARF " +"support. When this option is provided, the ``perf`` profiler will be able to " +"report Python calls using DWARF information. This option is only available " +"on some platforms and will do nothing if is not supported on the current " +"system. The default value is \"off\". See also :envvar:" +"`PYTHON_PERF_JIT_SUPPORT` and :ref:`perf_profiling`." +msgstr "" + +#: ../../using/cmdline.rst:600 +msgid "" +":samp:`-X cpu_count={n}` overrides :func:`os.cpu_count`, :func:`os." +"process_cpu_count`, and :func:`multiprocessing.cpu_count`. *n* must be " +"greater than or equal to 1. This option may be useful for users who need to " +"limit CPU resources of a container system. See also :envvar:" +"`PYTHON_CPU_COUNT`. If *n* is ``default``, nothing is overridden." +msgstr "" + +#: ../../using/cmdline.rst:609 +msgid "" +":samp:`-X presite={package.module}` specifies a module that should be " +"imported before the :mod:`site` module is executed and before the :mod:" +"`__main__` module exists. Therefore, the imported module isn't :mod:" +"`__main__`. This can be used to execute code early during Python " +"initialization. Python needs to be :ref:`built in debug mode <debug-build>` " +"for this option to exist. See also :envvar:`PYTHON_PRESITE`." +msgstr "" + +#: ../../using/cmdline.rst:618 +msgid "" +":samp:`-X gil={0,1}` forces the GIL to be disabled or enabled, respectively. " +"Setting to ``0`` is only available in builds configured with :option:`--" +"disable-gil`. See also :envvar:`PYTHON_GIL` and :ref:`whatsnew313-free-" +"threaded-cpython`." +msgstr "" + +#: ../../using/cmdline.rst:625 msgid "" "It also allows passing arbitrary values and retrieving them through the :" "data:`sys._xoptions` dictionary." msgstr "" -#: ../../using/cmdline.rst:594 +#: ../../using/cmdline.rst:630 msgid "Removed the ``-X showalloccount`` option." msgstr "移除 ``-X showalloccount`` 選項。" -#: ../../using/cmdline.rst:597 +#: ../../using/cmdline.rst:633 msgid "Removed the ``-X oldparser`` option." msgstr "移除 ``-X oldparser`` 選項。" -#: ../../using/cmdline.rst:602 +#: ../../using/cmdline.rst:639 +msgid "Controlling color" +msgstr "" + +#: ../../using/cmdline.rst:641 +msgid "" +"The Python interpreter is configured by default to use colors to highlight " +"output in certain situations such as when displaying tracebacks. This " +"behavior can be controlled by setting different environment variables." +msgstr "" + +#: ../../using/cmdline.rst:645 +msgid "" +"Setting the environment variable ``TERM`` to ``dumb`` will disable color." +msgstr "" + +#: ../../using/cmdline.rst:647 +msgid "" +"If the |FORCE_COLOR|_ environment variable is set, then color will be " +"enabled regardless of the value of TERM. This is useful on CI systems which " +"aren’t terminals but can still display ANSI escape sequences." +msgstr "" + +#: ../../using/cmdline.rst:651 +msgid "" +"If the |NO_COLOR|_ environment variable is set, Python will disable all " +"color in the output. This takes precedence over ``FORCE_COLOR``." +msgstr "" + +#: ../../using/cmdline.rst:654 +msgid "" +"All these environment variables are used also by other tools to control " +"color output. To control the color output only in the Python interpreter, " +"the :envvar:`PYTHON_COLORS` environment variable can be used. This variable " +"takes precedence over ``NO_COLOR``, which in turn takes precedence over " +"``FORCE_COLOR``." +msgstr "" + +#: ../../using/cmdline.rst:669 msgid "Options you shouldn't use" msgstr "你不該使用的選項" -#: ../../using/cmdline.rst:606 +#: ../../using/cmdline.rst:673 msgid "Reserved for use by Jython_." msgstr "" -#: ../../using/cmdline.rst:614 +#: ../../using/cmdline.rst:681 msgid "Environment variables" msgstr "環境變數" -#: ../../using/cmdline.rst:616 +#: ../../using/cmdline.rst:683 msgid "" "These environment variables influence Python's behavior, they are processed " "before the command-line switches other than -E or -I. It is customary that " @@ -828,7 +904,7 @@ msgid "" "conflict." msgstr "" -#: ../../using/cmdline.rst:623 +#: ../../using/cmdline.rst:690 msgid "" "Change the location of the standard Python libraries. By default, the " "libraries are searched in :file:`{prefix}/lib/python{version}` and :file:" @@ -837,14 +913,14 @@ msgid "" "file:`/usr/local`." msgstr "" -#: ../../using/cmdline.rst:629 +#: ../../using/cmdline.rst:696 msgid "" "When :envvar:`PYTHONHOME` is set to a single directory, its value replaces " "both :file:`{prefix}` and :file:`{exec_prefix}`. To specify different " "values for these, set :envvar:`PYTHONHOME` to :file:`{prefix}:{exec_prefix}`." msgstr "" -#: ../../using/cmdline.rst:636 +#: ../../using/cmdline.rst:703 msgid "" "Augment the default search path for module files. The format is the same as " "the shell's :envvar:`PATH`: one or more directory pathnames separated by :" @@ -852,21 +928,21 @@ msgid "" "existent directories are silently ignored." msgstr "" -#: ../../using/cmdline.rst:641 +#: ../../using/cmdline.rst:708 msgid "" "In addition to normal directories, individual :envvar:`PYTHONPATH` entries " "may refer to zipfiles containing pure Python modules (in either source or " "compiled form). Extension modules cannot be imported from zipfiles." msgstr "" -#: ../../using/cmdline.rst:645 +#: ../../using/cmdline.rst:712 msgid "" "The default search path is installation dependent, but generally begins " "with :file:`{prefix}/lib/python{version}` (see :envvar:`PYTHONHOME` above). " "It is *always* appended to :envvar:`PYTHONPATH`." msgstr "" -#: ../../using/cmdline.rst:649 +#: ../../using/cmdline.rst:716 msgid "" "An additional directory will be inserted in the search path in front of :" "envvar:`PYTHONPATH` as described above under :ref:`using-on-interface-" @@ -874,19 +950,19 @@ msgid "" "the variable :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:657 +#: ../../using/cmdline.rst:724 msgid "" "If this is set to a non-empty string, don't prepend a potentially unsafe " "path to :data:`sys.path`: see the :option:`-P` option for details." msgstr "" -#: ../../using/cmdline.rst:665 +#: ../../using/cmdline.rst:732 msgid "" "If this is set to a non-empty string, it overrides the :data:`sys." "platlibdir` value." msgstr "" -#: ../../using/cmdline.rst:673 +#: ../../using/cmdline.rst:740 msgid "" "If this is the name of a readable file, the Python commands in that file are " "executed before the first prompt is displayed in interactive mode. The file " @@ -897,7 +973,7 @@ msgid "" "file." msgstr "" -#: ../../using/cmdline.rst:680 ../../using/cmdline.rst:682 +#: ../../using/cmdline.rst:747 ../../using/cmdline.rst:749 msgid "" "Raises an :ref:`auditing event <auditing>` ``cpython.run_startup`` with the " "filename as the argument when called on startup." @@ -905,14 +981,14 @@ msgstr "" "引發一個附帶呼叫啟動時的檔案名稱為引數的\\ :ref:`稽核事件 <auditing>` " "``cpython.run_startup``。" -#: ../../using/cmdline.rst:688 +#: ../../using/cmdline.rst:755 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-O` option. If set to an integer, it is equivalent to specifying :" "option:`-O` multiple times." msgstr "" -#: ../../using/cmdline.rst:695 +#: ../../using/cmdline.rst:762 msgid "" "If this is set, it names a callable using dotted-path notation. The module " "containing the callable will be imported and then the callable will be run " @@ -923,62 +999,68 @@ msgid "" "breakpointhook` to do nothing but return immediately." msgstr "" -#: ../../using/cmdline.rst:707 +#: ../../using/cmdline.rst:774 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-d` option. If set to an integer, it is equivalent to specifying :" "option:`-d` multiple times." msgstr "" -#: ../../using/cmdline.rst:711 +#: ../../using/cmdline.rst:778 msgid "" "This environment variable requires a :ref:`debug build of Python <debug-" "build>`, otherwise it's ignored." msgstr "" -#: ../../using/cmdline.rst:717 +#: ../../using/cmdline.rst:784 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-i` option." msgstr "" -#: ../../using/cmdline.rst:720 +#: ../../using/cmdline.rst:787 msgid "" "This variable can also be modified by Python code using :data:`os.environ` " "to force inspect mode on program termination." msgstr "" -#: ../../using/cmdline.rst:725 +#: ../../using/cmdline.rst:792 msgid "(also 3.11.10, 3.10.15, 3.9.20, and 3.8.20) Emits audit events." msgstr "" -#: ../../using/cmdline.rst:731 +#: ../../using/cmdline.rst:795 +msgid "" +"Uses PyREPL if possible, in which case :envvar:`PYTHONSTARTUP` is also " +"executed. Emits audit events." +msgstr "" + +#: ../../using/cmdline.rst:802 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-u` option." msgstr "" -#: ../../using/cmdline.rst:737 +#: ../../using/cmdline.rst:808 msgid "" "If this is set to a non-empty string it is equivalent to specifying the :" "option:`-v` option. If set to an integer, it is equivalent to specifying :" "option:`-v` multiple times." msgstr "" -#: ../../using/cmdline.rst:744 +#: ../../using/cmdline.rst:815 msgid "" "If this is set, Python ignores case in :keyword:`import` statements. This " "only works on Windows and macOS." msgstr "" -#: ../../using/cmdline.rst:750 +#: ../../using/cmdline.rst:821 msgid "" "If this is set to a non-empty string, Python won't try to write ``.pyc`` " "files on the import of source modules. This is equivalent to specifying " "the :option:`-B` option." msgstr "" -#: ../../using/cmdline.rst:757 +#: ../../using/cmdline.rst:828 msgid "" "If this is set, Python will write ``.pyc`` files in a mirror directory tree " "at this path, instead of in ``__pycache__`` directories within the source " @@ -986,40 +1068,40 @@ msgid "" "``pycache_prefix=PATH`` option." msgstr "" -#: ../../using/cmdline.rst:767 +#: ../../using/cmdline.rst:838 msgid "" "If this variable is not set or set to ``random``, a random value is used to " "seed the hashes of str and bytes objects." msgstr "" -#: ../../using/cmdline.rst:770 +#: ../../using/cmdline.rst:841 msgid "" "If :envvar:`PYTHONHASHSEED` is set to an integer value, it is used as a " "fixed seed for generating the hash() of the types covered by the hash " "randomization." msgstr "" -#: ../../using/cmdline.rst:774 +#: ../../using/cmdline.rst:845 msgid "" "Its purpose is to allow repeatable hashing, such as for selftests for the " "interpreter itself, or to allow a cluster of python processes to share hash " "values." msgstr "" -#: ../../using/cmdline.rst:778 +#: ../../using/cmdline.rst:849 msgid "" "The integer must be a decimal number in the range [0,4294967295]. " "Specifying the value 0 will disable hash randomization." msgstr "" -#: ../../using/cmdline.rst:785 +#: ../../using/cmdline.rst:856 msgid "" "If this variable is set to an integer, it is used to configure the " "interpreter's global :ref:`integer string conversion length limitation " "<int_max_str_digits>`." msgstr "" -#: ../../using/cmdline.rst:793 +#: ../../using/cmdline.rst:864 msgid "" "If this is set before running the interpreter, it overrides the encoding " "used for stdin/stdout/stderr, in the syntax ``encodingname:errorhandler``. " @@ -1027,17 +1109,17 @@ msgid "" "have the same meaning as in :func:`str.encode`." msgstr "" -#: ../../using/cmdline.rst:798 +#: ../../using/cmdline.rst:869 msgid "" "For stderr, the ``:errorhandler`` part is ignored; the handler will always " "be ``'backslashreplace'``." msgstr "" -#: ../../using/cmdline.rst:801 +#: ../../using/cmdline.rst:872 msgid "The ``encodingname`` part is now optional." msgstr "" -#: ../../using/cmdline.rst:804 +#: ../../using/cmdline.rst:875 msgid "" "On Windows, the encoding specified by this variable is ignored for " "interactive console buffers unless :envvar:`PYTHONLEGACYWINDOWSSTDIO` is " @@ -1045,13 +1127,13 @@ msgid "" "not affected." msgstr "" -#: ../../using/cmdline.rst:811 +#: ../../using/cmdline.rst:882 msgid "" "If this is set, Python won't add the :data:`user site-packages directory " "<site.USER_SITE>` to :data:`sys.path`." msgstr "" -#: ../../using/cmdline.rst:821 +#: ../../using/cmdline.rst:892 msgid "" "Defines the :data:`user base directory <site.USER_BASE>`, which is used to " "compute the path of the :data:`user site-packages directory <site." @@ -1059,20 +1141,20 @@ msgid "" "``python -m pip install --user``." msgstr "" -#: ../../using/cmdline.rst:833 +#: ../../using/cmdline.rst:904 msgid "" "If this environment variable is set, ``sys.argv[0]`` will be set to its " "value instead of the value got through the C runtime. Only works on macOS." msgstr "" -#: ../../using/cmdline.rst:839 +#: ../../using/cmdline.rst:910 msgid "" "This is equivalent to the :option:`-W` option. If set to a comma separated " "string, it is equivalent to specifying :option:`-W` multiple times, with " "filters later in the list taking precedence over those earlier in the list." msgstr "" -#: ../../using/cmdline.rst:848 +#: ../../using/cmdline.rst:919 msgid "" "PYTHONWARNINGS=default # Warn once per call location\n" "PYTHONWARNINGS=error # Convert to exceptions\n" @@ -1083,7 +1165,7 @@ msgid "" "PYTHONWARNINGS=ignore # Never warn" msgstr "" -#: ../../using/cmdline.rst:862 +#: ../../using/cmdline.rst:933 msgid "" "If this environment variable is set to a non-empty string, :func:" "`faulthandler.enable` is called at startup: install a handler for :const:" @@ -1092,7 +1174,7 @@ msgid "" "traceback. This is equivalent to :option:`-X` ``faulthandler`` option." msgstr "" -#: ../../using/cmdline.rst:874 +#: ../../using/cmdline.rst:945 msgid "" "If this environment variable is set to a non-empty string, start tracing " "Python memory allocations using the :mod:`tracemalloc` module. The value of " @@ -1102,90 +1184,101 @@ msgid "" "is equivalent to setting the :option:`-X` ``tracemalloc`` option." msgstr "" -#: ../../using/cmdline.rst:887 +#: ../../using/cmdline.rst:958 msgid "" "If this environment variable is set to a non-empty string, Python will show " "how long each import takes. This is equivalent to setting the :option:`-X` " "``importtime`` option." msgstr "" -#: ../../using/cmdline.rst:896 +#: ../../using/cmdline.rst:967 msgid "" "If this environment variable is set to a non-empty string, enable the :ref:" "`debug mode <asyncio-debug-mode>` of the :mod:`asyncio` module." msgstr "" -#: ../../using/cmdline.rst:904 +#: ../../using/cmdline.rst:975 msgid "Set the Python memory allocators and/or install debug hooks." msgstr "" -#: ../../using/cmdline.rst:906 +#: ../../using/cmdline.rst:977 msgid "Set the family of memory allocators used by Python:" msgstr "" -#: ../../using/cmdline.rst:908 +#: ../../using/cmdline.rst:979 msgid "" "``default``: use the :ref:`default memory allocators <default-memory-" "allocators>`." msgstr "" -#: ../../using/cmdline.rst:910 +#: ../../using/cmdline.rst:981 msgid "" "``malloc``: use the :c:func:`malloc` function of the C library for all " "domains (:c:macro:`PYMEM_DOMAIN_RAW`, :c:macro:`PYMEM_DOMAIN_MEM`, :c:macro:" "`PYMEM_DOMAIN_OBJ`)." msgstr "" -#: ../../using/cmdline.rst:913 +#: ../../using/cmdline.rst:984 msgid "" "``pymalloc``: use the :ref:`pymalloc allocator <pymalloc>` for :c:macro:" "`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" "func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." msgstr "" -#: ../../using/cmdline.rst:917 +#: ../../using/cmdline.rst:987 +msgid "" +"``mimalloc``: use the :ref:`mimalloc allocator <mimalloc>` for :c:macro:" +"`PYMEM_DOMAIN_MEM` and :c:macro:`PYMEM_DOMAIN_OBJ` domains and use the :c:" +"func:`malloc` function for the :c:macro:`PYMEM_DOMAIN_RAW` domain." +msgstr "" + +#: ../../using/cmdline.rst:991 msgid "Install :ref:`debug hooks <pymem-debug-hooks>`:" msgstr "" -#: ../../using/cmdline.rst:919 +#: ../../using/cmdline.rst:993 msgid "" "``debug``: install debug hooks on top of the :ref:`default memory allocators " "<default-memory-allocators>`." msgstr "" -#: ../../using/cmdline.rst:921 +#: ../../using/cmdline.rst:995 msgid "``malloc_debug``: same as ``malloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:922 +#: ../../using/cmdline.rst:996 msgid "``pymalloc_debug``: same as ``pymalloc`` but also install debug hooks." msgstr "" -#: ../../using/cmdline.rst:926 +#: ../../using/cmdline.rst:997 +msgid "``mimalloc_debug``: same as ``mimalloc`` but also install debug hooks." +msgstr "" + +#: ../../using/cmdline.rst:1001 msgid "Added the ``\"default\"`` allocator." msgstr "" -#: ../../using/cmdline.rst:932 +#: ../../using/cmdline.rst:1007 msgid "" "If set to a non-empty string, Python will print statistics of the :ref:" "`pymalloc memory allocator <pymalloc>` every time a new pymalloc object " "arena is created, and on shutdown." msgstr "" -#: ../../using/cmdline.rst:936 +#: ../../using/cmdline.rst:1011 msgid "" "This variable is ignored if the :envvar:`PYTHONMALLOC` environment variable " "is used to force the :c:func:`malloc` allocator of the C library, or if " "Python is configured without ``pymalloc`` support." msgstr "" -#: ../../using/cmdline.rst:940 +#: ../../using/cmdline.rst:1015 msgid "" "This variable can now also be used on Python compiled in release mode. It " "now has no effect if set to an empty string." msgstr "" -#: ../../using/cmdline.rst:947 +#: ../../using/cmdline.rst:1022 msgid "" "If set to a non-empty string, the default :term:`filesystem encoding and " "error handler` mode will revert to their pre-3.6 values of 'mbcs' and " @@ -1193,41 +1286,41 @@ msgid "" "'surrogatepass' are used." msgstr "" -#: ../../using/cmdline.rst:952 +#: ../../using/cmdline.rst:1027 msgid "" "This may also be enabled at runtime with :func:`sys." "_enablelegacywindowsfsencoding`." msgstr "" -#: ../../using/cmdline.rst:955 ../../using/cmdline.rst:969 +#: ../../using/cmdline.rst:1030 ../../using/cmdline.rst:1044 msgid ":ref:`Availability <availability>`: Windows." msgstr ":ref:`適用 <availability>`:Windows。" -#: ../../using/cmdline.rst:957 +#: ../../using/cmdline.rst:1032 msgid "See :pep:`529` for more details." msgstr "更多細節請見 :pep:`529`。" -#: ../../using/cmdline.rst:962 +#: ../../using/cmdline.rst:1037 msgid "" "If set to a non-empty string, does not use the new console reader and " "writer. This means that Unicode characters will be encoded according to the " "active console code page, rather than using utf-8." msgstr "" -#: ../../using/cmdline.rst:966 +#: ../../using/cmdline.rst:1041 msgid "" "This variable is ignored if the standard streams are redirected (to files or " "pipes) rather than referring to console buffers." msgstr "" -#: ../../using/cmdline.rst:976 +#: ../../using/cmdline.rst:1051 msgid "" "If set to the value ``0``, causes the main Python command line application " "to skip coercing the legacy ASCII-based C and POSIX locales to a more " "capable UTF-8 based alternative." msgstr "" -#: ../../using/cmdline.rst:980 +#: ../../using/cmdline.rst:1055 msgid "" "If this variable is *not* set (or is set to a value other than ``0``), the " "``LC_ALL`` locale override environment variable is also not set, and the " @@ -1238,19 +1331,19 @@ msgid "" "runtime:" msgstr "" -#: ../../using/cmdline.rst:988 +#: ../../using/cmdline.rst:1063 msgid "``C.UTF-8``" msgstr "``C.UTF-8``" -#: ../../using/cmdline.rst:989 +#: ../../using/cmdline.rst:1064 msgid "``C.utf8``" msgstr "``C.utf8``" -#: ../../using/cmdline.rst:990 +#: ../../using/cmdline.rst:1065 msgid "``UTF-8``" msgstr "``UTF-8``" -#: ../../using/cmdline.rst:992 +#: ../../using/cmdline.rst:1067 msgid "" "If setting one of these locale categories succeeds, then the ``LC_CTYPE`` " "environment variable will also be set accordingly in the current process " @@ -1263,7 +1356,7 @@ msgid "" "(such as Python's own :func:`locale.getdefaultlocale`)." msgstr "" -#: ../../using/cmdline.rst:1002 +#: ../../using/cmdline.rst:1077 msgid "" "Configuring one of these locales (either explicitly or via the above " "implicit locale coercion) automatically enables the ``surrogateescape`` :ref:" @@ -1273,7 +1366,7 @@ msgid "" "envvar:`PYTHONIOENCODING` as usual." msgstr "" -#: ../../using/cmdline.rst:1009 +#: ../../using/cmdline.rst:1084 msgid "" "For debugging purposes, setting ``PYTHONCOERCECLOCALE=warn`` will cause " "Python to emit warning messages on ``stderr`` if either the locale coercion " @@ -1281,7 +1374,7 @@ msgid "" "active when the Python runtime is initialized." msgstr "" -#: ../../using/cmdline.rst:1014 +#: ../../using/cmdline.rst:1089 msgid "" "Also note that even when locale coercion is disabled, or when it fails to " "find a suitable target locale, :envvar:`PYTHONUTF8` will still activate by " @@ -1290,15 +1383,15 @@ msgid "" "system interfaces." msgstr "" -#: ../../using/cmdline.rst:1020 +#: ../../using/cmdline.rst:1095 msgid ":ref:`Availability <availability>`: Unix." msgstr ":ref:`適用 <availability>`:Unix。" -#: ../../using/cmdline.rst:1022 +#: ../../using/cmdline.rst:1097 msgid "See :pep:`538` for more details." msgstr "更多細節請見 :pep:`538`。" -#: ../../using/cmdline.rst:1028 +#: ../../using/cmdline.rst:1103 msgid "" "If this environment variable is set to a non-empty string, enable :ref:" "`Python Development Mode <devmode>`, introducing additional runtime checks " @@ -1306,31 +1399,31 @@ msgid "" "setting the :option:`-X` ``dev`` option." msgstr "" -#: ../../using/cmdline.rst:1037 +#: ../../using/cmdline.rst:1112 msgid "If set to ``1``, enable the :ref:`Python UTF-8 Mode <utf8-mode>`." msgstr "如果設為 ``1``,則啟用 :ref:`Python UTF-8 Mode <utf8-mode>`。" -#: ../../using/cmdline.rst:1039 +#: ../../using/cmdline.rst:1114 msgid "If set to ``0``, disable the :ref:`Python UTF-8 Mode <utf8-mode>`." msgstr "如果設為 ``0``,則停用 :ref:`Python UTF-8 Mode <utf8-mode>`。" -#: ../../using/cmdline.rst:1041 +#: ../../using/cmdline.rst:1116 msgid "" "Setting any other non-empty string causes an error during interpreter " "initialisation." msgstr "" -#: ../../using/cmdline.rst:1048 +#: ../../using/cmdline.rst:1123 msgid "" "If this environment variable is set to a non-empty string, issue a :class:" "`EncodingWarning` when the locale-specific default encoding is used." msgstr "" -#: ../../using/cmdline.rst:1051 +#: ../../using/cmdline.rst:1126 msgid "See :ref:`io-encoding-warning` for details." msgstr "細節請見 :ref:`io-encoding-warning`。" -#: ../../using/cmdline.rst:1057 +#: ../../using/cmdline.rst:1132 msgid "" "If this variable is set, it disables the inclusion of the tables mapping " "extra location information (end line, start column offset and end column " @@ -1339,39 +1432,142 @@ msgid "" "visual location indicators when the interpreter displays tracebacks." msgstr "" -#: ../../using/cmdline.rst:1067 +#: ../../using/cmdline.rst:1142 msgid "" "If this variable is set to a nonzero value, it enables support for the Linux " "``perf`` profiler so Python calls can be detected by it." msgstr "" -#: ../../using/cmdline.rst:1070 +#: ../../using/cmdline.rst:1145 ../../using/cmdline.rst:1158 msgid "If set to ``0``, disable Linux ``perf`` profiler support." msgstr "" -#: ../../using/cmdline.rst:1072 +#: ../../using/cmdline.rst:1147 msgid "" "See also the :option:`-X perf <-X>` command-line option and :ref:" "`perf_profiling`." msgstr "" -#: ../../using/cmdline.rst:1079 +#: ../../using/cmdline.rst:1154 +msgid "" +"If this variable is set to a nonzero value, it enables support for the Linux " +"``perf`` profiler so Python calls can be detected by it using DWARF " +"information." +msgstr "" + +#: ../../using/cmdline.rst:1160 +msgid "" +"See also the :option:`-X perf_jit <-X>` command-line option and :ref:" +"`perf_profiling`." +msgstr "" + +#: ../../using/cmdline.rst:1169 +msgid "" +"If this variable is set to a positive integer, it overrides the return " +"values of :func:`os.cpu_count` and :func:`os.process_cpu_count`." +msgstr "" + +#: ../../using/cmdline.rst:1172 +#, fuzzy +msgid "See also the :option:`-X cpu_count <-X>` command-line option." +msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" + +#: ../../using/cmdline.rst:1178 +msgid "" +"If this variable is set to ``on`` or ``off``, it determines whether or not " +"frozen modules are ignored by the import machinery. A value of ``on`` means " +"they get imported and ``off`` means they are ignored. The default is ``on`` " +"for non-debug builds (the normal case) and ``off`` for debug builds. Note " +"that the :mod:`!importlib_bootstrap` and :mod:`!" +"importlib_bootstrap_external` frozen modules are always used, even if this " +"flag is set to ``off``." +msgstr "" + +#: ../../using/cmdline.rst:1186 +#, fuzzy +msgid "See also the :option:`-X frozen_modules <-X>` command-line option." +msgstr "另請參閱 :option:`-P` 和 :option:`-I` (isolated) 選項。" + +#: ../../using/cmdline.rst:1192 +msgid "" +"If this variable is set to ``1``, the interpreter will colorize various " +"kinds of output. Setting it to ``0`` deactivates this behavior. See also :" +"ref:`using-on-controlling-color`." +msgstr "" + +#: ../../using/cmdline.rst:1200 +msgid "" +"If this variable is set to ``1``, the interpreter will not attempt to load " +"the Python-based :term:`REPL` that requires :mod:`curses` and :mod:" +"`readline`, and will instead use the traditional parser-based :term:`REPL`." +msgstr "" + +#: ../../using/cmdline.rst:1209 +msgid "" +"This environment variable can be used to set the location of a ``." +"python_history`` file (by default, it is ``.python_history`` in the user's " +"home directory)." +msgstr "" + +#: ../../using/cmdline.rst:1217 +msgid "" +"If this variable is set to ``1``, the global interpreter lock (GIL) will be " +"forced on. Setting it to ``0`` forces the GIL off (needs Python configured " +"with the :option:`--disable-gil` build option)." +msgstr "" + +#: ../../using/cmdline.rst:1221 +msgid "" +"See also the :option:`-X gil <-X>` command-line option, which takes " +"precedence over this variable, and :ref:`whatsnew313-free-threaded-cpython`." +msgstr "" + +#: ../../using/cmdline.rst:1227 msgid "Debug-mode variables" msgstr "除錯模式變數" -#: ../../using/cmdline.rst:1083 +#: ../../using/cmdline.rst:1231 msgid "" "If set, Python will dump objects and reference counts still alive after " "shutting down the interpreter." msgstr "" -#: ../../using/cmdline.rst:1086 ../../using/cmdline.rst:1093 +#: ../../using/cmdline.rst:1234 ../../using/cmdline.rst:1242 msgid "" -"Need Python configured with the :option:`--with-trace-refs` build option." +"Needs Python configured with the :option:`--with-trace-refs` build option." msgstr "" -#: ../../using/cmdline.rst:1090 +#: ../../using/cmdline.rst:1238 msgid "" "If set, Python will dump objects and reference counts still alive after " -"shutting down the interpreter into a file called *FILENAME*." +"shutting down the interpreter into a file under the path given as the value " +"to this environment variable." +msgstr "" + +#: ../../using/cmdline.rst:1248 +msgid "" +"If this variable is set to a module, that module will be imported early in " +"the interpreter lifecycle, before the :mod:`site` module is executed, and " +"before the :mod:`__main__` module is created. Therefore, the imported module " +"is not treated as :mod:`__main__`." +msgstr "" + +#: ../../using/cmdline.rst:1253 +msgid "This can be used to execute code early during Python initialization." +msgstr "" + +#: ../../using/cmdline.rst:1255 +msgid "" +"To import a submodule, use ``package.module`` as the value, like in an " +"import statement." +msgstr "" + +#: ../../using/cmdline.rst:1258 +msgid "" +"See also the :option:`-X presite <-X>` command-line option, which takes " +"precedence over this variable." +msgstr "" + +#: ../../using/cmdline.rst:1261 +msgid "Needs Python configured with the :option:`--with-pydebug` build option." msgstr "" diff --git a/using/configure.po b/using/configure.po index 7221de2974..1b0328f205 100644 --- a/using/configure.po +++ b/using/configure.po @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -27,7 +27,8 @@ msgid "Build Requirements" msgstr "建置需求" #: ../../using/configure.rst:10 -msgid "Features required to build CPython:" +#, fuzzy +msgid "Features and minimum versions required to build CPython:" msgstr "建置 CPython 所需的功能:" #: ../../using/configure.rst:12 @@ -38,65 +39,96 @@ msgid "" msgstr "" #: ../../using/configure.rst:17 +msgid "On Windows, Microsoft Visual Studio 2017 or later is required." +msgstr "在 Windows 上需要 Microsoft Visual Studio 2017 或更新版本。" + +#: ../../using/configure.rst:19 msgid "" "Support for `IEEE 754 <https://en.wikipedia.org/wiki/IEEE_754>`_ floating-" "point numbers and `floating-point Not-a-Number (NaN) <https://en.wikipedia." "org/wiki/NaN#Floating_point>`_." msgstr "" -#: ../../using/configure.rst:21 +#: ../../using/configure.rst:23 msgid "Support for threads." msgstr "thread 的支援。" -#: ../../using/configure.rst:23 -msgid "OpenSSL 1.1.1 or newer for the :mod:`ssl` and :mod:`hashlib` modules." +#: ../../using/configure.rst:25 +msgid "" +"OpenSSL 1.1.1 is the minimum version and OpenSSL 3.0.9 is the recommended " +"minimum version for the :mod:`ssl` and :mod:`hashlib` extension modules." msgstr "" -#: ../../using/configure.rst:25 -msgid "On Windows, Microsoft Visual Studio 2017 or later is required." -msgstr "在 Windows 上需要 Microsoft Visual Studio 2017 或更新版本。" +#: ../../using/configure.rst:28 +#, fuzzy +msgid "SQLite 3.15.2 for the :mod:`sqlite3` extension module." +msgstr "請見 :mod:`ssl` 模組。" -#: ../../using/configure.rst:27 -msgid "On Windows, Visual Studio 2015 or later is required." +#: ../../using/configure.rst:30 +msgid "Tcl/Tk 8.5.12 for the :mod:`tkinter` module." +msgstr "" + +#: ../../using/configure.rst:32 +msgid "" +"Autoconf 2.71 and aclocal 1.16.4 are required to regenerate the :file:" +"`configure` script." +msgstr "" + +#: ../../using/configure.rst:35 +#, fuzzy +msgid "Tcl/Tk version 8.3.1 is now required." +msgstr "OpenSSL 1.1.1 現在是必要的。" + +#: ../../using/configure.rst:38 +#, fuzzy +msgid "" +"On Windows, Visual Studio 2015 or later is now required. Tcl/Tk version 8.4 " +"is now required." msgstr "在 Windows 上需要 Visual Studio 2015 或更新版本。" -#: ../../using/configure.rst:30 +#: ../../using/configure.rst:42 msgid "" "Selected C99 features are now required, like ``<stdint.h>`` and ``static " "inline`` functions." msgstr "" -#: ../../using/configure.rst:34 +#: ../../using/configure.rst:46 msgid "Thread support and OpenSSL 1.0.2 are now required." msgstr "對執行緒與 OpenSSL 1.0.2 的支援現在是必要的。" -#: ../../using/configure.rst:37 -msgid "OpenSSL 1.1.1 is now required." +#: ../../using/configure.rst:49 +#, fuzzy +msgid "OpenSSL 1.1.1 is now required. Require SQLite 3.7.15." msgstr "OpenSSL 1.1.1 現在是必要的。" -#: ../../using/configure.rst:40 +#: ../../using/configure.rst:53 msgid "" "C11 compiler, IEEE 754 and NaN support are now required. On Windows, Visual " -"Studio 2017 or later is required." +"Studio 2017 or later is required. Tcl/Tk version 8.5.12 is now required for " +"the :mod:`tkinter` module." +msgstr "" + +#: ../../using/configure.rst:58 +msgid "Autoconf 2.71, aclocal 1.16.4 and SQLite 3.15.2 are now required." msgstr "" -#: ../../using/configure.rst:44 +#: ../../using/configure.rst:61 msgid "" "See also :pep:`7` \"Style Guide for C Code\" and :pep:`11` \"CPython " "platform support\"." msgstr "" -#: ../../using/configure.rst:49 +#: ../../using/configure.rst:66 msgid "Generated files" msgstr "產生的檔案" -#: ../../using/configure.rst:51 +#: ../../using/configure.rst:68 msgid "" "To reduce build dependencies, Python source code contains multiple generated " "files. Commands to regenerate all generated files::" msgstr "" -#: ../../using/configure.rst:54 +#: ../../using/configure.rst:71 msgid "" "make regen-all\n" "make regen-stdlib-module-names\n" @@ -108,17 +140,17 @@ msgstr "" "make regen-limited-abi\n" "make regen-configure" -#: ../../using/configure.rst:59 +#: ../../using/configure.rst:76 msgid "" "The ``Makefile.pre.in`` file documents generated files, their inputs, and " "tools used to regenerate them. Search for ``regen-*`` make targets." msgstr "" -#: ../../using/configure.rst:63 +#: ../../using/configure.rst:80 msgid "configure script" msgstr "設定腳本" -#: ../../using/configure.rst:65 +#: ../../using/configure.rst:82 msgid "" "The ``make regen-configure`` command regenerates the ``aclocal.m4`` file and " "the ``configure`` script using the ``Tools/build/regen-configure.sh`` shell " @@ -126,50 +158,50 @@ msgid "" "have a reproducible output." msgstr "" -#: ../../using/configure.rst:70 +#: ../../using/configure.rst:87 msgid "The container is optional, the following command can be run locally::" msgstr "" -#: ../../using/configure.rst:72 +#: ../../using/configure.rst:89 msgid "autoreconf -ivf -Werror" msgstr "autoreconf -ivf -Werror" -#: ../../using/configure.rst:74 +#: ../../using/configure.rst:91 msgid "" "The generated files can change depending on the exact ``autoconf-archive``, " "``aclocal`` and ``pkg-config`` versions." msgstr "" -#: ../../using/configure.rst:81 +#: ../../using/configure.rst:98 msgid "Configure Options" msgstr "設定選項" -#: ../../using/configure.rst:83 -msgid "List all ``./configure`` script options using::" +#: ../../using/configure.rst:100 +msgid "List all :file:`configure` script options using::" msgstr "" -#: ../../using/configure.rst:85 +#: ../../using/configure.rst:102 #, fuzzy msgid "./configure --help" msgstr "設定腳本" -#: ../../using/configure.rst:87 +#: ../../using/configure.rst:104 msgid "" "See also the :file:`Misc/SpecialBuilds.txt` in the Python source " "distribution." msgstr "請見 Python 原始碼發行版中的 :file:`Misc/SpecialBuilds.txt`。" -#: ../../using/configure.rst:90 +#: ../../using/configure.rst:107 msgid "General Options" msgstr "一般選項" -#: ../../using/configure.rst:94 +#: ../../using/configure.rst:111 msgid "" "Support loadable extensions in the :mod:`!_sqlite` extension module (default " "is no) of the :mod:`sqlite3` module." msgstr "" -#: ../../using/configure.rst:97 +#: ../../using/configure.rst:114 msgid "" "See the :meth:`sqlite3.Connection.enable_load_extension` method of the :mod:" "`sqlite3` module." @@ -177,33 +209,33 @@ msgstr "" "請見 :mod:`sqlite3` 模組的 :meth:`sqlite3.Connection.enable_load_extension` " "方法。" -#: ../../using/configure.rst:104 +#: ../../using/configure.rst:121 msgid "" "Disable IPv6 support (enabled by default if supported), see the :mod:" "`socket` module." msgstr "停用 IPv6 支援(如果支援的話預設是啟用的),請見 :mod:`socket` 模組。" -#: ../../using/configure.rst:109 +#: ../../using/configure.rst:126 msgid "Define the size in bits of Python :class:`int` digits: 15 or 30 bits." msgstr "" -#: ../../using/configure.rst:111 +#: ../../using/configure.rst:128 msgid "By default, the digit size is 30." msgstr "" -#: ../../using/configure.rst:113 +#: ../../using/configure.rst:130 msgid "Define the ``PYLONG_BITS_IN_DIGIT`` to ``15`` or ``30``." msgstr "將 ``PYLONG_BITS_IN_DIGIT`` 定義為 ``15`` 或 ``30``。" -#: ../../using/configure.rst:115 +#: ../../using/configure.rst:132 msgid "See :data:`sys.int_info.bits_per_digit <sys.int_info>`." msgstr "參閱 :data:`sys.int_info.bits_per_digit <sys.int_info>`。" -#: ../../using/configure.rst:119 +#: ../../using/configure.rst:136 msgid "Set the Python executable suffix to *SUFFIX*." msgstr "將 Python 執行檔的後綴設定為 *SUFFIX*。" -#: ../../using/configure.rst:121 +#: ../../using/configure.rst:138 msgid "" "The default suffix is ``.exe`` on Windows and macOS (``python.exe`` " "executable), ``.js`` on Emscripten node, ``.html`` on Emscripten browser, ``." @@ -214,20 +246,20 @@ msgstr "" "Emscripten node 上為 ``.js``、在 Emscripten 瀏覽器為 ``.html``、在 WASI 上為 " "``.wasm``,以及在其他平台為空字串(``python`` 執行檔)。" -#: ../../using/configure.rst:126 +#: ../../using/configure.rst:143 msgid "" "The default suffix on WASM platform is one of ``.js``, ``.html`` or ``." "wasm``." msgstr "在 WASM 平台上預設的後綴是 ``.js``、``.html`` 或 ``.wasm`` 中的一個。" -#: ../../using/configure.rst:132 +#: ../../using/configure.rst:149 msgid "" "Select the default time zone search path for :const:`zoneinfo.TZPATH`. See " "the :ref:`Compile-time configuration <zoneinfo_data_compile_time_config>` of " "the :mod:`zoneinfo` module." msgstr "" -#: ../../using/configure.rst:136 +#: ../../using/configure.rst:153 msgid "" "Default: ``/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/" "etc/zoneinfo``." @@ -235,76 +267,76 @@ msgstr "" "預設值:``/usr/share/zoneinfo:/usr/lib/zoneinfo:/usr/share/lib/zoneinfo:/etc/" "zoneinfo``。" -#: ../../using/configure.rst:138 +#: ../../using/configure.rst:155 msgid "See :data:`os.pathsep` path separator." msgstr "請見 :data:`os.pathsep` 路徑分隔符號。" -#: ../../using/configure.rst:144 +#: ../../using/configure.rst:161 msgid "" "Build the ``_decimal`` extension module using a thread-local context rather " "than a coroutine-local context (default), see the :mod:`decimal` module." msgstr "" -#: ../../using/configure.rst:147 +#: ../../using/configure.rst:164 msgid "See :const:`decimal.HAVE_CONTEXTVAR` and the :mod:`contextvars` module." msgstr "請見 :const:`decimal.HAVE_CONTEXTVAR` 與 :mod:`contextvars` 模組。" -#: ../../using/configure.rst:153 +#: ../../using/configure.rst:170 msgid "Override order to check db backends for the :mod:`dbm` module" msgstr "" -#: ../../using/configure.rst:155 +#: ../../using/configure.rst:172 msgid "" "A valid value is a colon (``:``) separated string with the backend names:" msgstr "" -#: ../../using/configure.rst:157 +#: ../../using/configure.rst:174 msgid "``ndbm``;" msgstr "``ndbm``;" -#: ../../using/configure.rst:158 +#: ../../using/configure.rst:175 msgid "``gdbm``;" msgstr "``gdbm``;" -#: ../../using/configure.rst:159 +#: ../../using/configure.rst:176 msgid "``bdb``." msgstr "``bdb``." -#: ../../using/configure.rst:163 +#: ../../using/configure.rst:180 msgid "Disable C locale coercion to a UTF-8 based locale (enabled by default)." msgstr "" -#: ../../using/configure.rst:165 +#: ../../using/configure.rst:182 msgid "Don't define the ``PY_COERCE_C_LOCALE`` macro." msgstr "不要定義 ``PY_COERCE_C_LOCALE`` 巨集。" -#: ../../using/configure.rst:167 +#: ../../using/configure.rst:184 msgid "See :envvar:`PYTHONCOERCECLOCALE` and the :pep:`538`." msgstr "請見 :envvar:`PYTHONCOERCECLOCALE` 與 :pep:`538`。" -#: ../../using/configure.rst:171 +#: ../../using/configure.rst:188 msgid "Disable all freelists except the empty tuple singleton." msgstr "" -#: ../../using/configure.rst:177 +#: ../../using/configure.rst:194 msgid "Python library directory name (default is ``lib``)." msgstr "Python 函式庫目錄名稱(預設為 ``lib`` )。" -#: ../../using/configure.rst:179 +#: ../../using/configure.rst:196 msgid "Fedora and SuSE use ``lib64`` on 64-bit platforms." msgstr "Fedora 和 SuSE 在 64 位元平台上使用 ``lib64``。" -#: ../../using/configure.rst:181 +#: ../../using/configure.rst:198 msgid "See :data:`sys.platlibdir`." msgstr "參閱 :data:`sys.platlibdir`。" -#: ../../using/configure.rst:187 +#: ../../using/configure.rst:204 msgid "" "Directory of wheel packages used by the :mod:`ensurepip` module (none by " "default)." msgstr "" -#: ../../using/configure.rst:190 +#: ../../using/configure.rst:207 msgid "" "Some Linux distribution packaging policies recommend against bundling " "dependencies. For example, Fedora installs wheel packages in the ``/usr/" @@ -312,110 +344,428 @@ msgid "" "_bundled` package." msgstr "" -#: ../../using/configure.rst:199 +#: ../../using/configure.rst:216 msgid "" "Whether configure should use :program:`pkg-config` to detect build " "dependencies." msgstr "" -#: ../../using/configure.rst:202 +#: ../../using/configure.rst:219 msgid "``check`` (default): :program:`pkg-config` is optional" msgstr "``check`` (預設)::program:`pkg-config` 是可選的" -#: ../../using/configure.rst:203 +#: ../../using/configure.rst:220 msgid "``yes``: :program:`pkg-config` is mandatory" msgstr "``yes``::program:`pkg-config` 是必要的" -#: ../../using/configure.rst:204 +#: ../../using/configure.rst:221 msgid "``no``: configure does not use :program:`pkg-config` even when present" msgstr "``no``:即使存在也不使用 :program:`pkg-config` 來配置" -#: ../../using/configure.rst:210 -msgid "Turn on internal statistics gathering." +#: ../../using/configure.rst:227 +msgid "Turn on internal Python performance statistics gathering." +msgstr "" + +#: ../../using/configure.rst:229 +msgid "" +"By default, statistics gathering is off. Use ``python3 -X pystats`` command " +"or set ``PYTHONSTATS=1`` environment variable to turn on statistics " +"gathering at Python startup." msgstr "" -#: ../../using/configure.rst:212 +#: ../../using/configure.rst:233 +msgid "" +"At Python exit, dump statistics if statistics gathering was on and not " +"cleared." +msgstr "" + +#: ../../using/configure.rst:236 ../../using/configure.rst:708 +msgid "Effects:" +msgstr "效果:" + +#: ../../using/configure.rst:238 +#, fuzzy +msgid "Add :option:`-X pystats <-X>` command line option." +msgstr "新增 :option:`-X showrefcount <-X>` 命令列選項。" + +#: ../../using/configure.rst:239 +#, fuzzy +msgid "Add :envvar:`!PYTHONSTATS` environment variable." +msgstr "新增 :envvar:`PYTHONDUMPREFS` 環境變數。" + +#: ../../using/configure.rst:240 +#, fuzzy +msgid "Define the ``Py_STATS`` macro." +msgstr "定義 ``Py_TRACE_REFS`` 巨集。" + +#: ../../using/configure.rst:241 +#, fuzzy +msgid "Add functions to the :mod:`sys` module:" +msgstr "請見 :mod:`ssl` 模組。" + +#: ../../using/configure.rst:243 +msgid ":func:`!sys._stats_on`: Turns on statistics gathering." +msgstr "" + +#: ../../using/configure.rst:244 +msgid ":func:`!sys._stats_off`: Turns off statistics gathering." +msgstr "" + +#: ../../using/configure.rst:245 +msgid ":func:`!sys._stats_clear`: Clears the statistics." +msgstr "" + +#: ../../using/configure.rst:246 +msgid "" +":func:`!sys._stats_dump`: Dump statistics to file, and clears the statistics." +msgstr "" + +#: ../../using/configure.rst:248 msgid "" "The statistics will be dumped to a arbitrary (probably unique) file in ``/" -"tmp/py_stats/``, or ``C:\\temp\\py_stats\\`` on Windows. If that directory " -"does not exist, results will be printed on stdout." +"tmp/py_stats/`` (Unix) or ``C:\\temp\\py_stats\\`` (Windows). If that " +"directory does not exist, results will be printed on stderr." msgstr "" -#: ../../using/configure.rst:216 +#: ../../using/configure.rst:252 msgid "Use ``Tools/scripts/summarize_stats.py`` to read the stats." msgstr "使用 ``Tools/scripts/summarize_stats.py`` 來讀取統計資料。" -#: ../../using/configure.rst:221 +#: ../../using/configure.rst:254 +msgid "Statistics:" +msgstr "" + +#: ../../using/configure.rst:256 +msgid "Opcode:" +msgstr "" + +#: ../../using/configure.rst:258 +msgid "Specialization: success, failure, hit, deferred, miss, deopt, failures;" +msgstr "" + +#: ../../using/configure.rst:259 +msgid "Execution count;" +msgstr "" + +#: ../../using/configure.rst:260 +msgid "Pair count." +msgstr "" + +#: ../../using/configure.rst:262 +msgid "Call:" +msgstr "" + +#: ../../using/configure.rst:264 +msgid "Inlined Python calls;" +msgstr "" + +#: ../../using/configure.rst:265 +msgid "PyEval calls;" +msgstr "" + +#: ../../using/configure.rst:266 +msgid "Frames pushed;" +msgstr "" + +#: ../../using/configure.rst:267 +msgid "Frame object created;" +msgstr "" + +#: ../../using/configure.rst:268 +msgid "" +"Eval calls: vector, generator, legacy, function VECTORCALL, build class, " +"slot, function \"ex\", API, method." +msgstr "" + +#: ../../using/configure.rst:271 +msgid "Object:" +msgstr "" + +#: ../../using/configure.rst:273 +msgid "incref and decref;" +msgstr "" + +#: ../../using/configure.rst:274 +msgid "interpreter incref and decref;" +msgstr "" + +#: ../../using/configure.rst:275 +msgid "allocations: all, 512 bytes, 4 kiB, big;" +msgstr "" + +#: ../../using/configure.rst:276 +msgid "free;" +msgstr "" + +#: ../../using/configure.rst:277 +msgid "to/from free lists;" +msgstr "" + +#: ../../using/configure.rst:278 +msgid "dictionary materialized/dematerialized;" +msgstr "" + +#: ../../using/configure.rst:279 +msgid "type cache;" +msgstr "" + +#: ../../using/configure.rst:280 +#, fuzzy +msgid "optimization attempts;" +msgstr "最佳化旗標。" + +#: ../../using/configure.rst:281 +msgid "optimization traces created/executed;" +msgstr "" + +#: ../../using/configure.rst:282 +msgid "uops executed." +msgstr "" + +#: ../../using/configure.rst:284 +msgid "Garbage collector:" +msgstr "" + +#: ../../using/configure.rst:286 +msgid "Garbage collections;" +msgstr "" + +#: ../../using/configure.rst:287 +msgid "Objects visited;" +msgstr "" + +#: ../../using/configure.rst:288 +msgid "Objects collected." +msgstr "" + +#: ../../using/configure.rst:296 +msgid "" +"Enables **experimental** support for running Python without the :term:" +"`global interpreter lock` (GIL): free threading build." +msgstr "" + +#: ../../using/configure.rst:299 +msgid "" +"Defines the ``Py_GIL_DISABLED`` macro and adds ``\"t\"`` to :data:`sys." +"abiflags`." +msgstr "" + +#: ../../using/configure.rst:302 +msgid "See :ref:`whatsnew313-free-threaded-cpython` for more detail." +msgstr "" + +#: ../../using/configure.rst:308 +msgid "Path to ``pkg-config`` utility." +msgstr "" + +#: ../../using/configure.rst:313 +#, fuzzy +msgid "``pkg-config`` options." +msgstr "設定選項" + +#: ../../using/configure.rst:317 +#, fuzzy +msgid "C compiler options" +msgstr "C 編譯器指令。" + +#: ../../using/configure.rst:321 ../../using/configure.rst:1228 +msgid "C compiler command." +msgstr "C 編譯器指令。" + +#: ../../using/configure.rst:325 ../../using/configure.rst:1240 +msgid "C compiler flags." +msgstr "C 編譯器旗標。" + +#: ../../using/configure.rst:329 +#, fuzzy +msgid "C preprocessor command." +msgstr "C 編譯器指令。" + +#: ../../using/configure.rst:333 +msgid "C preprocessor flags, e.g. :samp:`-I{include_dir}`." +msgstr "" + +#: ../../using/configure.rst:337 ../../using/configure.rst:779 +msgid "Linker options" +msgstr "" + +#: ../../using/configure.rst:341 +msgid "Linker flags, e.g. :samp:`-L{library_directory}`." +msgstr "" + +#: ../../using/configure.rst:345 +msgid "Libraries to pass to the linker, e.g. :samp:`-l{library}`." +msgstr "" + +#: ../../using/configure.rst:349 +msgid "Name for machine-dependent library files." +msgstr "" + +#: ../../using/configure.rst:353 +msgid "Options for third-party dependencies" +msgstr "" + +#: ../../using/configure.rst:360 +msgid "" +"C compiler and linker flags to link Python to ``libbz2``, used by :mod:`bz2` " +"module, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:366 +msgid "" +"C compiler and linker flags for ``libncurses`` or ``libncursesw``, used by :" +"mod:`curses` module, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:372 +msgid "C compiler and linker flags for ``gdbm``." +msgstr "" + +#: ../../using/configure.rst:377 +msgid "" +"C compiler and linker flags for ``libb2`` (:ref:`BLAKE2 <hashlib-blake2>`), " +"used by :mod:`hashlib` module, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:383 +msgid "" +"C compiler and linker flags for ``libedit``, used by :mod:`readline` module, " +"overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:389 +msgid "" +"C compiler and linker flags for ``libffi``, used by :mod:`ctypes` module, " +"overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:395 +msgid "" +"C compiler and linker flags for ``libmpdec``, used by :mod:`decimal` module, " +"overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:400 +msgid "" +"These environment variables have no effect unless :option:`--with-system-" +"libmpdec` is specified." +msgstr "" + +#: ../../using/configure.rst:406 +msgid "" +"C compiler and linker flags for ``liblzma``, used by :mod:`lzma` module, " +"overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:412 +msgid "" +"C compiler and linker flags for ``libreadline``, used by :mod:`readline` " +"module, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:418 +msgid "" +"C compiler and linker flags for ``libsqlite3``, used by :mod:`sqlite3` " +"module, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:424 +msgid "" +"C compiler and linker flags for ``libuuid``, used by :mod:`uuid` module, " +"overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:430 +msgid "C compiler and linker flags for PANEL, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:432 +msgid "" +"C compiler and linker flags for ``libpanel`` or ``libpanelw``, used by :mod:" +"`curses.panel` module, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:438 +msgid "C compiler and linker flags for TCLTK, overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:443 +msgid "" +"C compiler and linker flags for ``libzlib``, used by :mod:`gzip` module, " +"overriding ``pkg-config``." +msgstr "" + +#: ../../using/configure.rst:448 msgid "WebAssembly Options" msgstr "WebAssembly 選項" -#: ../../using/configure.rst:225 +#: ../../using/configure.rst:452 msgid "Set build flavor for ``wasm32-emscripten``." msgstr "" -#: ../../using/configure.rst:227 +#: ../../using/configure.rst:454 msgid "``browser`` (default): preload minimal stdlib, default MEMFS." msgstr "" -#: ../../using/configure.rst:228 +#: ../../using/configure.rst:455 msgid "``node``: NODERAWFS and pthread support." msgstr "``node``:對 NODERAWFS 和 pthread 支援。" -#: ../../using/configure.rst:234 +#: ../../using/configure.rst:461 msgid "Turn on dynamic linking support for WASM." msgstr "" -#: ../../using/configure.rst:236 +#: ../../using/configure.rst:463 msgid "" "Dynamic linking enables ``dlopen``. File size of the executable increases " "due to limited dead code elimination and additional features." msgstr "" -#: ../../using/configure.rst:243 +#: ../../using/configure.rst:470 msgid "Turn on pthreads support for WASM." msgstr "" -#: ../../using/configure.rst:249 +#: ../../using/configure.rst:476 msgid "Install Options" msgstr "安裝選項" -#: ../../using/configure.rst:253 +#: ../../using/configure.rst:480 msgid "" "Install architecture-independent files in PREFIX. On Unix, it defaults to :" "file:`/usr/local`." msgstr "" -#: ../../using/configure.rst:256 +#: ../../using/configure.rst:483 msgid "This value can be retrieved at runtime using :data:`sys.prefix`." msgstr "這個值可以在 runtime 使用 :data:`sys.prefix` 取得。" -#: ../../using/configure.rst:258 +#: ../../using/configure.rst:485 msgid "" "As an example, one can use ``--prefix=\"$HOME/.local/\"`` to install a " "Python in its home directory." msgstr "" -#: ../../using/configure.rst:263 +#: ../../using/configure.rst:490 msgid "" "Install architecture-dependent files in EPREFIX, defaults to :option:`--" "prefix`." msgstr "" -#: ../../using/configure.rst:265 +#: ../../using/configure.rst:492 msgid "This value can be retrieved at runtime using :data:`sys.exec_prefix`." msgstr "這個值可以在 runtime 使用 :data:`sys.exec_prefix` 取得" -#: ../../using/configure.rst:269 +#: ../../using/configure.rst:496 msgid "" "Don't build nor install test modules, like the :mod:`test` package or the :" "mod:`!_testcapi` extension module (built and installed by default)." msgstr "" -#: ../../using/configure.rst:276 +#: ../../using/configure.rst:503 msgid "Select the :mod:`ensurepip` command run on Python installation:" msgstr "選擇在 Python 安裝時執行的 :mod:`ensurepip` 命令:" -#: ../../using/configure.rst:278 +#: ../../using/configure.rst:505 msgid "" "``upgrade`` (default): run ``python -m ensurepip --altinstall --upgrade`` " "command." @@ -423,45 +773,45 @@ msgstr "" "``upgrade`` (預設):執行 ``python -m ensurepip --altinstall --upgrade`` 命" "令。" -#: ../../using/configure.rst:280 +#: ../../using/configure.rst:507 msgid "``install``: run ``python -m ensurepip --altinstall`` command;" msgstr "``install``:執行 ``python -m ensurepip --altinstall`` 命令;" -#: ../../using/configure.rst:281 +#: ../../using/configure.rst:508 msgid "``no``: don't run ensurepip;" msgstr "``no``:不要執行 ensurepip;" -#: ../../using/configure.rst:287 +#: ../../using/configure.rst:514 msgid "Performance options" msgstr "" -#: ../../using/configure.rst:289 +#: ../../using/configure.rst:516 msgid "" "Configuring Python using ``--enable-optimizations --with-lto`` (PGO + LTO) " "is recommended for best performance. The experimental ``--enable-bolt`` flag " "can also be used to improve performance." msgstr "" -#: ../../using/configure.rst:295 +#: ../../using/configure.rst:522 msgid "" "Enable Profile Guided Optimization (PGO) using :envvar:`PROFILE_TASK` " "(disabled by default)." msgstr "" -#: ../../using/configure.rst:298 +#: ../../using/configure.rst:525 msgid "" "The C compiler Clang requires ``llvm-profdata`` program for PGO. On macOS, " "GCC also requires it: GCC is just an alias to Clang on macOS." msgstr "" -#: ../../using/configure.rst:301 +#: ../../using/configure.rst:528 msgid "" "Disable also semantic interposition in libpython if ``--enable-shared`` and " "GCC is used: add ``-fno-semantic-interposition`` to the compiler and linker " "flags." msgstr "" -#: ../../using/configure.rst:307 +#: ../../using/configure.rst:534 msgid "" "During the build, you may encounter compiler warnings about profile data not " "being available for some source files. These warnings are harmless, as only " @@ -470,54 +820,58 @@ msgid "" "profile-instr-unprofiled`` to :envvar:`CFLAGS`." msgstr "" -#: ../../using/configure.rst:316 +#: ../../using/configure.rst:543 msgid "Use ``-fno-semantic-interposition`` on GCC." msgstr "在 GCC 上使用 ``-fno-semantic-interposition``。" -#: ../../using/configure.rst:321 +#: ../../using/configure.rst:548 msgid "" "Environment variable used in the Makefile: Python command line arguments for " "the PGO generation task." msgstr "" -#: ../../using/configure.rst:324 +#: ../../using/configure.rst:551 msgid "Default: ``-m test --pgo --timeout=$(TESTTIMEOUT)``." msgstr "預設值:``-m test --pgo --timeout=$(TESTTIMEOUT)``。" -#: ../../using/configure.rst:330 +#: ../../using/configure.rst:555 +msgid "Task failure is no longer ignored silently." +msgstr "" + +#: ../../using/configure.rst:560 msgid "Enable Link Time Optimization (LTO) in any build (disabled by default)." msgstr "" -#: ../../using/configure.rst:332 +#: ../../using/configure.rst:562 msgid "" "The C compiler Clang requires ``llvm-ar`` for LTO (``ar`` on macOS), as well " "as an LTO-aware linker (``ld.gold`` or ``lld``)." msgstr "" -#: ../../using/configure.rst:337 +#: ../../using/configure.rst:567 msgid "To use ThinLTO feature, use ``--with-lto=thin`` on Clang." msgstr "" -#: ../../using/configure.rst:340 +#: ../../using/configure.rst:570 msgid "" "Use ThinLTO as the default optimization policy on Clang if the compiler " "accepts the flag." msgstr "" -#: ../../using/configure.rst:345 +#: ../../using/configure.rst:575 msgid "" "Enable usage of the `BOLT post-link binary optimizer <https://github.com/" "llvm/llvm-project/tree/main/bolt>`_ (disabled by default)." msgstr "" -#: ../../using/configure.rst:349 +#: ../../using/configure.rst:579 msgid "" "BOLT is part of the LLVM project but is not always included in their binary " "distributions. This flag requires that ``llvm-bolt`` and ``merge-fdata`` are " "available." msgstr "" -#: ../../using/configure.rst:353 +#: ../../using/configure.rst:583 msgid "" "BOLT is still a fairly new project so this flag should be considered " "experimental for now. Because this tool operates on machine code its success " @@ -528,7 +882,7 @@ msgid "" "encouraged." msgstr "" -#: ../../using/configure.rst:361 +#: ../../using/configure.rst:591 msgid "" "The :envvar:`!BOLT_INSTRUMENT_FLAGS` and :envvar:`!BOLT_APPLY_FLAGS` :" "program:`configure` variables can be defined to override the default set of " @@ -536,101 +890,116 @@ msgid "" "binaries, respectively." msgstr "" -#: ../../using/configure.rst:370 +#: ../../using/configure.rst:600 +msgid "" +"Arguments to ``llvm-bolt`` when creating a `BOLT optimized binary <https://" +"github.com/facebookarchive/BOLT>`_." +msgstr "" + +#: ../../using/configure.rst:607 +msgid "Arguments to ``llvm-bolt`` when instrumenting binaries." +msgstr "" + +#: ../../using/configure.rst:613 msgid "" "Enable computed gotos in evaluation loop (enabled by default on supported " "compilers)." msgstr "" -#: ../../using/configure.rst:375 +#: ../../using/configure.rst:618 msgid "" -"Disable the specialized Python memory allocator :ref:`pymalloc <pymalloc>` " -"(enabled by default)." +"Disable the fast :ref:`mimalloc <mimalloc>` allocator (enabled by default)." msgstr "" -#: ../../using/configure.rst:378 +#: ../../using/configure.rst:621 ../../using/configure.rst:628 msgid "See also :envvar:`PYTHONMALLOC` environment variable." msgstr "另請參閱 :envvar:`PYTHONMALLOC` 環境變數。" -#: ../../using/configure.rst:382 +#: ../../using/configure.rst:625 +msgid "" +"Disable the specialized Python memory allocator :ref:`pymalloc <pymalloc>` " +"(enabled by default)." +msgstr "" + +#: ../../using/configure.rst:632 msgid "" "Disable static documentation strings to reduce the memory footprint (enabled " "by default). Documentation strings defined in Python are not affected." msgstr "" -#: ../../using/configure.rst:385 +#: ../../using/configure.rst:635 msgid "Don't define the ``WITH_DOC_STRINGS`` macro." msgstr "不要定義 ``WITH_DOC_STRINGS`` 巨集。" -#: ../../using/configure.rst:387 +#: ../../using/configure.rst:637 msgid "See the ``PyDoc_STRVAR()`` macro." msgstr "請見 ``PyDoc_STRVAR()`` 巨集。" -#: ../../using/configure.rst:391 +#: ../../using/configure.rst:641 msgid "Enable C-level code profiling with ``gprof`` (disabled by default)." msgstr "" -#: ../../using/configure.rst:395 +#: ../../using/configure.rst:645 msgid "" "Add ``-fstrict-overflow`` to the C compiler flags (by default we add ``-fno-" "strict-overflow`` instead)." msgstr "" -#: ../../using/configure.rst:402 +#: ../../using/configure.rst:652 msgid "Python Debug Build" msgstr "" -#: ../../using/configure.rst:404 +#: ../../using/configure.rst:654 msgid "" "A debug build is Python built with the :option:`--with-pydebug` configure " "option." msgstr "" -#: ../../using/configure.rst:407 +#: ../../using/configure.rst:657 msgid "Effects of a debug build:" msgstr "" -#: ../../using/configure.rst:409 +#: ../../using/configure.rst:659 msgid "" "Display all warnings by default: the list of default warning filters is " "empty in the :mod:`warnings` module." msgstr "" -#: ../../using/configure.rst:411 +#: ../../using/configure.rst:661 msgid "Add ``d`` to :data:`sys.abiflags`." msgstr "新增 ``d`` 到 :data:`sys.abiflags`。" -#: ../../using/configure.rst:412 +#: ../../using/configure.rst:662 msgid "Add :func:`!sys.gettotalrefcount` function." msgstr "新增 :func:`!sys.gettotalrefcount` 函式。" -#: ../../using/configure.rst:413 +#: ../../using/configure.rst:663 msgid "Add :option:`-X showrefcount <-X>` command line option." msgstr "新增 :option:`-X showrefcount <-X>` 命令列選項。" -#: ../../using/configure.rst:414 +#: ../../using/configure.rst:664 msgid "" "Add :option:`-d` command line option and :envvar:`PYTHONDEBUG` environment " "variable to debug the parser." msgstr "" -#: ../../using/configure.rst:416 +#: ../../using/configure.rst:666 msgid "" "Add support for the ``__lltrace__`` variable: enable low-level tracing in " "the bytecode evaluation loop if the variable is defined." msgstr "" -#: ../../using/configure.rst:418 +#: ../../using/configure.rst:668 msgid "" "Install :ref:`debug hooks on memory allocators <default-memory-allocators>` " "to detect buffer overflow and other memory errors." msgstr "" -#: ../../using/configure.rst:420 +#: ../../using/configure.rst:670 msgid "Define ``Py_DEBUG`` and ``Py_REF_DEBUG`` macros." msgstr "定義 ``Py_DEBUG`` 和 ``Py_REF_DEBUG`` 巨集。" -#: ../../using/configure.rst:421 +#: ../../using/configure.rst:671 msgid "" "Add runtime checks: code surrounded by ``#ifdef Py_DEBUG`` and ``#endif``. " "Enable ``assert(...)`` and ``_PyObject_ASSERT(...)`` assertions: don't set " @@ -638,366 +1007,420 @@ msgid "" "option). Main runtime checks:" msgstr "" -#: ../../using/configure.rst:426 +#: ../../using/configure.rst:676 msgid "Add sanity checks on the function arguments." msgstr "" -#: ../../using/configure.rst:427 +#: ../../using/configure.rst:677 msgid "" "Unicode and int objects are created with their memory filled with a pattern " "to detect usage of uninitialized objects." msgstr "" -#: ../../using/configure.rst:429 +#: ../../using/configure.rst:679 msgid "" "Ensure that functions which can clear or replace the current exception are " "not called with an exception raised." msgstr "" -#: ../../using/configure.rst:431 +#: ../../using/configure.rst:681 msgid "Check that deallocator functions don't change the current exception." msgstr "" -#: ../../using/configure.rst:432 +#: ../../using/configure.rst:682 msgid "" "The garbage collector (:func:`gc.collect` function) runs some basic checks " "on objects consistency." msgstr "" -#: ../../using/configure.rst:434 +#: ../../using/configure.rst:684 msgid "" "The :c:macro:`!Py_SAFE_DOWNCAST()` macro checks for integer underflow and " "overflow when downcasting from wide types to narrow types." msgstr "" -#: ../../using/configure.rst:437 +#: ../../using/configure.rst:687 msgid "" "See also the :ref:`Python Development Mode <devmode>` and the :option:`--" "with-trace-refs` configure option." msgstr "" -#: ../../using/configure.rst:440 +#: ../../using/configure.rst:690 msgid "" "Release builds and debug builds are now ABI compatible: defining the " "``Py_DEBUG`` macro no longer implies the ``Py_TRACE_REFS`` macro (see the :" -"option:`--with-trace-refs` option), which introduces the only ABI " -"incompatibility." +"option:`--with-trace-refs` option)." msgstr "" -#: ../../using/configure.rst:448 +#: ../../using/configure.rst:697 msgid "Debug options" msgstr "" -#: ../../using/configure.rst:452 +#: ../../using/configure.rst:701 msgid "" ":ref:`Build Python in debug mode <debug-build>`: define the ``Py_DEBUG`` " "macro (disabled by default)." msgstr "" -#: ../../using/configure.rst:457 +#: ../../using/configure.rst:706 msgid "Enable tracing references for debugging purpose (disabled by default)." msgstr "" -#: ../../using/configure.rst:459 -msgid "Effects:" -msgstr "效果:" - -#: ../../using/configure.rst:461 +#: ../../using/configure.rst:710 msgid "Define the ``Py_TRACE_REFS`` macro." msgstr "定義 ``Py_TRACE_REFS`` 巨集。" -#: ../../using/configure.rst:462 +#: ../../using/configure.rst:711 msgid "Add :func:`!sys.getobjects` function." msgstr "新增 :func:`!sys.getobjects` 函式。" -#: ../../using/configure.rst:463 +#: ../../using/configure.rst:712 msgid "Add :envvar:`PYTHONDUMPREFS` environment variable." msgstr "新增 :envvar:`PYTHONDUMPREFS` 環境變數。" -#: ../../using/configure.rst:465 +#: ../../using/configure.rst:714 msgid "" -"This build is not ABI compatible with release build (default build) or debug " -"build (``Py_DEBUG`` and ``Py_REF_DEBUG`` macros)." +"The :envvar:`PYTHONDUMPREFS` environment variable can be used to dump " +"objects and reference counts still alive at Python exit." msgstr "" -#: ../../using/configure.rst:472 +#: ../../using/configure.rst:717 +msgid ":ref:`Statically allocated objects <static-types>` are not traced." +msgstr "" + +#: ../../using/configure.rst:721 +msgid "" +"This build is now ABI compatible with release build and :ref:`debug build " +"<debug-build>`." +msgstr "" + +#: ../../using/configure.rst:727 msgid "" "Build with C assertions enabled (default is no): ``assert(...);`` and " "``_PyObject_ASSERT(...);``." msgstr "" -#: ../../using/configure.rst:475 +#: ../../using/configure.rst:730 msgid "" "If set, the ``NDEBUG`` macro is not defined in the :envvar:`OPT` compiler " "variable." msgstr "" -#: ../../using/configure.rst:478 +#: ../../using/configure.rst:733 msgid "" "See also the :option:`--with-pydebug` option (:ref:`debug build <debug-" "build>`) which also enables assertions." msgstr "" -#: ../../using/configure.rst:485 +#: ../../using/configure.rst:740 msgid "Enable Valgrind support (default is no)." msgstr "啟用 Valgrind 支援(預設不啟用)。" -#: ../../using/configure.rst:489 +#: ../../using/configure.rst:744 msgid "Enable DTrace support (default is no)." msgstr "啟用 DTrace 支援(預設不啟用)。" -#: ../../using/configure.rst:491 +#: ../../using/configure.rst:746 msgid "" "See :ref:`Instrumenting CPython with DTrace and SystemTap <instrumentation>`." msgstr "" -#: ../../using/configure.rst:498 +#: ../../using/configure.rst:753 msgid "" "Enable AddressSanitizer memory error detector, ``asan`` (default is no)." msgstr "" -#: ../../using/configure.rst:504 +#: ../../using/configure.rst:759 msgid "" "Enable MemorySanitizer allocation error detector, ``msan`` (default is no)." msgstr "" -#: ../../using/configure.rst:510 +#: ../../using/configure.rst:765 msgid "" "Enable UndefinedBehaviorSanitizer undefined behaviour detector, ``ubsan`` " "(default is no)." msgstr "" -#: ../../using/configure.rst:517 -msgid "Linker options" -msgstr "" +#: ../../using/configure.rst:772 +#, fuzzy +msgid "Enable ThreadSanitizer data race detector, ``tsan`` (default is no)." +msgstr "啟用 DTrace 支援(預設不啟用)。" -#: ../../using/configure.rst:521 +#: ../../using/configure.rst:783 msgid "Enable building a shared Python library: ``libpython`` (default is no)." msgstr "" -#: ../../using/configure.rst:525 +#: ../../using/configure.rst:787 msgid "" "Do not build ``libpythonMAJOR.MINOR.a`` and do not install ``python.o`` " "(built and enabled by default)." msgstr "" -#: ../../using/configure.rst:532 +#: ../../using/configure.rst:794 msgid "Libraries options" msgstr "函式庫選項" -#: ../../using/configure.rst:536 +#: ../../using/configure.rst:798 msgid "Link against additional libraries (default is no)." msgstr "" -#: ../../using/configure.rst:540 +#: ../../using/configure.rst:802 msgid "" "Build the :mod:`!pyexpat` module using an installed ``expat`` library " "(default is no)." msgstr "" -#: ../../using/configure.rst:545 +#: ../../using/configure.rst:807 msgid "" -"Build the ``_decimal`` extension module using an installed ``mpdec`` " -"library, see the :mod:`decimal` module (default is no)." +"Build the ``_decimal`` extension module using an installed ``mpdecimal`` " +"library, see the :mod:`decimal` module (default is yes)." msgstr "" -#: ../../using/configure.rst:552 -msgid "Use ``editline`` library for backend of the :mod:`readline` module." +#: ../../using/configure.rst:812 +msgid "Default to using the installed ``mpdecimal`` library." msgstr "" -#: ../../using/configure.rst:554 -msgid "Define the ``WITH_EDITLINE`` macro." -msgstr "定義 ``WITH_EDITLINE`` 巨集。" +#: ../../using/configure.rst:815 +msgid "" +"A copy of the ``mpdecimal`` library sources will no longer be distributed " +"with Python 3.15." +msgstr "" -#: ../../using/configure.rst:560 +#: ../../using/configure.rst:819 +msgid ":option:`LIBMPDEC_CFLAGS` and :option:`LIBMPDEC_LIBS`." +msgstr "" + +#: ../../using/configure.rst:823 +msgid "Designate a backend library for the :mod:`readline` module." +msgstr "" + +#: ../../using/configure.rst:825 +msgid "readline: Use readline as the backend." +msgstr "" + +#: ../../using/configure.rst:826 +msgid "editline: Use editline as the backend." +msgstr "" + +#: ../../using/configure.rst:832 msgid "Don't build the :mod:`readline` module (built by default)." msgstr "" -#: ../../using/configure.rst:562 +#: ../../using/configure.rst:834 msgid "Don't define the ``HAVE_LIBREADLINE`` macro." msgstr "不要定義 ``HAVE_LIBREADLINE`` 巨集。" -#: ../../using/configure.rst:568 +#: ../../using/configure.rst:840 msgid "" "Override ``libm`` math library to *STRING* (default is system-dependent)." msgstr "" -#: ../../using/configure.rst:572 +#: ../../using/configure.rst:844 msgid "Override ``libc`` C library to *STRING* (default is system-dependent)." msgstr "" -#: ../../using/configure.rst:576 +#: ../../using/configure.rst:848 msgid "Root of the OpenSSL directory." msgstr "" -#: ../../using/configure.rst:582 +#: ../../using/configure.rst:854 msgid "Set runtime library directory (rpath) for OpenSSL libraries:" msgstr "" -#: ../../using/configure.rst:584 +#: ../../using/configure.rst:856 msgid "``no`` (default): don't set rpath;" msgstr "" -#: ../../using/configure.rst:585 +#: ../../using/configure.rst:857 msgid "" "``auto``: auto-detect rpath from :option:`--with-openssl` and ``pkg-config``;" msgstr "" -#: ../../using/configure.rst:587 +#: ../../using/configure.rst:859 msgid "*DIR*: set an explicit rpath." msgstr "" -#: ../../using/configure.rst:593 +#: ../../using/configure.rst:865 msgid "Security Options" msgstr "" -#: ../../using/configure.rst:597 +#: ../../using/configure.rst:869 msgid "Select hash algorithm for use in ``Python/pyhash.c``:" msgstr "" -#: ../../using/configure.rst:599 +#: ../../using/configure.rst:871 msgid "``siphash13`` (default);" msgstr "" -#: ../../using/configure.rst:600 +#: ../../using/configure.rst:872 msgid "``siphash24``;" msgstr "``siphash24``;" -#: ../../using/configure.rst:601 +#: ../../using/configure.rst:873 msgid "``fnv``." msgstr "``fnv``。" -#: ../../using/configure.rst:605 +#: ../../using/configure.rst:877 msgid "``siphash13`` is added and it is the new default." msgstr "" -#: ../../using/configure.rst:610 +#: ../../using/configure.rst:882 msgid "Built-in hash modules:" msgstr "內建雜湊模組:" -#: ../../using/configure.rst:612 +#: ../../using/configure.rst:884 msgid "``md5``;" msgstr "``md5``;" -#: ../../using/configure.rst:613 +#: ../../using/configure.rst:885 msgid "``sha1``;" msgstr "``sha1``;" -#: ../../using/configure.rst:614 +#: ../../using/configure.rst:886 msgid "``sha256``;" msgstr "``sha256``;" -#: ../../using/configure.rst:615 +#: ../../using/configure.rst:887 msgid "``sha512``;" msgstr "``sha512``;" -#: ../../using/configure.rst:616 +#: ../../using/configure.rst:888 msgid "``sha3`` (with shake);" msgstr "" -#: ../../using/configure.rst:617 +#: ../../using/configure.rst:889 msgid "``blake2``." msgstr "``blake2``。" -#: ../../using/configure.rst:623 +#: ../../using/configure.rst:895 msgid "Override the OpenSSL default cipher suites string:" msgstr "" -#: ../../using/configure.rst:625 +#: ../../using/configure.rst:897 msgid "``python`` (default): use Python's preferred selection;" msgstr "" -#: ../../using/configure.rst:626 +#: ../../using/configure.rst:898 msgid "``openssl``: leave OpenSSL's defaults untouched;" msgstr "" -#: ../../using/configure.rst:627 +#: ../../using/configure.rst:899 msgid "*STRING*: use a custom string" msgstr "" -#: ../../using/configure.rst:629 +#: ../../using/configure.rst:901 msgid "See the :mod:`ssl` module." msgstr "請見 :mod:`ssl` 模組。" -#: ../../using/configure.rst:635 +#: ../../using/configure.rst:907 msgid "" "The settings ``python`` and *STRING* also set TLS 1.2 as minimum protocol " "version." msgstr "" -#: ../../using/configure.rst:639 +#: ../../using/configure.rst:911 msgid "macOS Options" msgstr "macOS 選項" -#: ../../using/configure.rst:641 -msgid "See ``Mac/README.rst``." +#: ../../using/configure.rst:913 +#, fuzzy +msgid "See :source:`Mac/README.rst`." msgstr "參閱 ``Mac/README.rst``。" -#: ../../using/configure.rst:646 +#: ../../using/configure.rst:918 msgid "" "Create a universal binary build. *SDKDIR* specifies which macOS SDK should " "be used to perform the build (default is no)." msgstr "" -#: ../../using/configure.rst:652 +#: ../../using/configure.rst:924 msgid "" "Create a Python.framework rather than a traditional Unix install. Optional " "*INSTALLDIR* specifies the installation path (default is no)." msgstr "" -#: ../../using/configure.rst:657 +#: ../../using/configure.rst:929 msgid "" "Specify the kind of universal binary that should be created. This option is " "only valid when :option:`--enable-universalsdk` is set." msgstr "" -#: ../../using/configure.rst:660 +#: ../../using/configure.rst:932 msgid "Options:" msgstr "選項:" -#: ../../using/configure.rst:662 +#: ../../using/configure.rst:934 msgid "``universal2``;" msgstr "``universal2``;" -#: ../../using/configure.rst:663 +#: ../../using/configure.rst:935 msgid "``32-bit``;" msgstr "``32-bit``;" -#: ../../using/configure.rst:664 +#: ../../using/configure.rst:936 msgid "``64-bit``;" msgstr "``64-bit``;" -#: ../../using/configure.rst:665 +#: ../../using/configure.rst:937 msgid "``3-way``;" msgstr "``3-way``;" -#: ../../using/configure.rst:666 +#: ../../using/configure.rst:938 msgid "``intel``;" msgstr "``intel``;" -#: ../../using/configure.rst:667 +#: ../../using/configure.rst:939 msgid "``intel-32``;" msgstr "``intel-32``;" -#: ../../using/configure.rst:668 +#: ../../using/configure.rst:940 msgid "``intel-64``;" msgstr "``intel-64``;" -#: ../../using/configure.rst:669 +#: ../../using/configure.rst:941 msgid "``all``." msgstr "``all``。" -#: ../../using/configure.rst:673 +#: ../../using/configure.rst:945 msgid "" "Specify the name for the python framework on macOS only valid when :option:" "`--enable-framework` is set (default: ``Python``)." msgstr "" -#: ../../using/configure.rst:678 +#: ../../using/configure.rst:951 +msgid "" +"The Python standard library contains strings that are known to trigger " +"automated inspection tool errors when submitted for distribution by the " +"macOS and iOS App Stores. If enabled, this option will apply the list of " +"patches that are known to correct app store compliance. A custom patch file " +"can also be specified. This option is disabled by default." +msgstr "" + +#: ../../using/configure.rst:960 +#, fuzzy +msgid "iOS Options" +msgstr "macOS 選項" + +#: ../../using/configure.rst:962 +#, fuzzy +msgid "See :source:`iOS/README.rst`." +msgstr "參閱 ``Mac/README.rst``。" + +#: ../../using/configure.rst:966 +msgid "" +"Create a Python.framework. Unlike macOS, the *INSTALLDIR* argument " +"specifying the installation path is mandatory." +msgstr "" + +#: ../../using/configure.rst:971 +msgid "Specify the name for the framework (default: ``Python``)." +msgstr "" + +#: ../../using/configure.rst:975 msgid "Cross Compiling Options" msgstr "" -#: ../../using/configure.rst:680 +#: ../../using/configure.rst:977 msgid "" "Cross compiling, also known as cross building, can be used to build Python " "for another CPU architecture or platform. Cross compiling requires a Python " @@ -1005,28 +1428,28 @@ msgid "" "match the version of the cross compiled host Python." msgstr "" -#: ../../using/configure.rst:687 +#: ../../using/configure.rst:984 msgid "" "configure for building on BUILD, usually guessed by :program:`config.guess`." msgstr "" -#: ../../using/configure.rst:691 +#: ../../using/configure.rst:988 msgid "cross-compile to build programs to run on HOST (target platform)" msgstr "" -#: ../../using/configure.rst:695 +#: ../../using/configure.rst:992 msgid "path to build ``python`` binary for cross compiling" msgstr "" -#: ../../using/configure.rst:701 +#: ../../using/configure.rst:998 msgid "An environment variable that points to a file with configure overrides." msgstr "" -#: ../../using/configure.rst:703 +#: ../../using/configure.rst:1000 msgid "Example *config.site* file:" msgstr "" -#: ../../using/configure.rst:705 +#: ../../using/configure.rst:1002 msgid "" "# config.site-aarch64\n" "ac_cv_buggy_getaddrinfo=no\n" @@ -1038,11 +1461,15 @@ msgstr "" "ac_cv_file__dev_ptmx=yes\n" "ac_cv_file__dev_ptc=no" -#: ../../using/configure.rst:713 +#: ../../using/configure.rst:1011 +msgid "Program to run CPython for the host platform for cross-compilation." +msgstr "" + +#: ../../using/configure.rst:1016 msgid "Cross compiling example::" msgstr "" -#: ../../using/configure.rst:715 +#: ../../using/configure.rst:1018 msgid "" "CONFIG_SITE=config.site-aarch64 ../configure \\\n" " --build=x86_64-pc-linux-gnu \\\n" @@ -1054,117 +1481,207 @@ msgstr "" " --host=aarch64-unknown-linux-gnu \\\n" " --with-build-python=../x86_64/python" -#: ../../using/configure.rst:722 +#: ../../using/configure.rst:1025 msgid "Python Build System" msgstr "" -#: ../../using/configure.rst:725 +#: ../../using/configure.rst:1028 msgid "Main files of the build system" msgstr "" -#: ../../using/configure.rst:727 +#: ../../using/configure.rst:1030 msgid ":file:`configure.ac` => :file:`configure`;" msgstr ":file:`configure.ac` => :file:`configure`\\ ;" -#: ../../using/configure.rst:728 +#: ../../using/configure.rst:1031 msgid "" ":file:`Makefile.pre.in` => :file:`Makefile` (created by :file:`configure`);" msgstr "" -#: ../../using/configure.rst:729 +#: ../../using/configure.rst:1032 msgid ":file:`pyconfig.h` (created by :file:`configure`);" msgstr ":file:`pyconfig.h` (created by :file:`configure`)\\ ;" -#: ../../using/configure.rst:730 +#: ../../using/configure.rst:1033 msgid "" ":file:`Modules/Setup`: C extensions built by the Makefile using :file:" "`Module/makesetup` shell script;" msgstr "" -#: ../../using/configure.rst:734 +#: ../../using/configure.rst:1037 msgid "Main build steps" msgstr "主要建置步驟" -#: ../../using/configure.rst:736 +#: ../../using/configure.rst:1039 msgid "C files (``.c``) are built as object files (``.o``)." msgstr "" -#: ../../using/configure.rst:737 +#: ../../using/configure.rst:1040 msgid "A static ``libpython`` library (``.a``) is created from objects files." msgstr "" -#: ../../using/configure.rst:738 +#: ../../using/configure.rst:1041 msgid "" "``python.o`` and the static ``libpython`` library are linked into the final " "``python`` program." msgstr "" -#: ../../using/configure.rst:740 +#: ../../using/configure.rst:1043 msgid "C extensions are built by the Makefile (see :file:`Modules/Setup`)." msgstr "" -#: ../../using/configure.rst:743 +#: ../../using/configure.rst:1046 msgid "Main Makefile targets" msgstr "主要 Makefile 目標" -#: ../../using/configure.rst:745 -msgid "``make``: Build Python with the standard library." +#: ../../using/configure.rst:1049 +msgid "make" msgstr "" -#: ../../using/configure.rst:746 +#: ../../using/configure.rst:1051 +msgid "" +"For the most part, when rebuilding after editing some code or refreshing " +"your checkout from upstream, all you need to do is execute ``make``, which " +"(per Make's semantics) builds the default target, the first one defined in " +"the Makefile. By tradition (including in the CPython project) this is " +"usually the ``all`` target. The ``configure`` script expands an ``autoconf`` " +"variable, ``@DEF_MAKE_ALL_RULE@`` to describe precisely which targets ``make " +"all`` will build. The three choices are:" +msgstr "" + +#: ../../using/configure.rst:1060 +msgid "``profile-opt`` (configured with ``--enable-optimizations``)" +msgstr "" + +#: ../../using/configure.rst:1061 +msgid "``build_wasm`` (configured with ``--with-emscripten-target``)" +msgstr "" + +#: ../../using/configure.rst:1062 msgid "" -"``make platform:``: build the ``python`` program, but don't build the " -"standard library extension modules." +"``build_all`` (configured without explicitly using either of the others)" msgstr "" -#: ../../using/configure.rst:748 +#: ../../using/configure.rst:1064 msgid "" -"``make profile-opt``: build Python using Profile Guided Optimization (PGO). " -"You can use the configure :option:`--enable-optimizations` option to make " -"this the default target of the ``make`` command (``make all`` or just " -"``make``)." +"Depending on the most recent source file changes, Make will rebuild any " +"targets (object files and executables) deemed out-of-date, including running " +"``configure`` again if necessary. Source/target dependencies are many and " +"maintained manually however, so Make sometimes doesn't have all the " +"information necessary to correctly detect all targets which need to be " +"rebuilt. Depending on which targets aren't rebuilt, you might experience a " +"number of problems. If you have build or test problems which you can't " +"otherwise explain, ``make clean && make`` should work around most dependency " +"problems, at the expense of longer build times." msgstr "" -#: ../../using/configure.rst:752 +#: ../../using/configure.rst:1077 +msgid "make platform" +msgstr "" + +#: ../../using/configure.rst:1079 msgid "" -"``make buildbottest``: Build Python and run the Python test suite, the same " -"way than buildbots test Python. Set ``TESTTIMEOUT`` variable (in seconds) to " -"change the test timeout (1200 by default: 20 minutes)." +"Build the ``python`` program, but don't build the standard library extension " +"modules. This generates a file named ``platform`` which contains a single " +"line describing the details of the build platform, e.g., ``macosx-14.3-" +"arm64-3.12`` or ``linux-x86_64-3.13``." msgstr "" -#: ../../using/configure.rst:755 -msgid "``make install``: Build and install Python." +#: ../../using/configure.rst:1086 +msgid "make profile-opt" msgstr "" -#: ../../using/configure.rst:756 +#: ../../using/configure.rst:1088 msgid "" -"``make regen-all``: Regenerate (almost) all generated files; ``make regen-" -"stdlib-module-names`` and ``autoconf`` must be run separately for the " -"remaining generated files." +"Build Python using profile-guided optimization (PGO). You can use the " +"configure :option:`--enable-optimizations` option to make this the default " +"target of the ``make`` command (``make all`` or just ``make``)." msgstr "" -#: ../../using/configure.rst:759 -msgid "``make clean``: Remove built files." +#: ../../using/configure.rst:1096 +msgid "make clean" +msgstr "" + +#: ../../using/configure.rst:1098 +msgid "Remove built files." +msgstr "" + +#: ../../using/configure.rst:1102 +msgid "make distclean" +msgstr "" + +#: ../../using/configure.rst:1104 +msgid "" +"In addition to the work done by ``make clean``, remove files created by the " +"configure script. ``configure`` will have to be run before building again. " +"[#]_" msgstr "" -#: ../../using/configure.rst:760 +#: ../../using/configure.rst:1110 +msgid "make install" +msgstr "" + +#: ../../using/configure.rst:1112 +msgid "Build the ``all`` target and install Python." +msgstr "" + +#: ../../using/configure.rst:1116 +msgid "make test" +msgstr "" + +#: ../../using/configure.rst:1118 msgid "" -"``make distclean``: Same than ``make clean``, but remove also files created " -"by the configure script." +"Build the ``all`` target and run the Python test suite with the ``--fast-" +"ci`` option. Variables:" +msgstr "" + +#: ../../using/configure.rst:1121 +msgid "``TESTOPTS``: additional regrtest command-line options." msgstr "" -#: ../../using/configure.rst:764 +#: ../../using/configure.rst:1122 +msgid "``TESTPYTHONOPTS``: additional Python command-line options." +msgstr "" + +#: ../../using/configure.rst:1123 +msgid "``TESTTIMEOUT``: timeout in seconds (default: 10 minutes)." +msgstr "" + +#: ../../using/configure.rst:1127 +#, fuzzy +msgid "make buildbottest" +msgstr "主要建置步驟" + +#: ../../using/configure.rst:1129 +msgid "" +"This is similar to ``make test``, but uses the ``--slow-ci`` option and " +"default timeout of 20 minutes, instead of ``--fast-ci`` option." +msgstr "" + +#: ../../using/configure.rst:1134 +msgid "make regen-all" +msgstr "" + +#: ../../using/configure.rst:1136 +msgid "" +"Regenerate (almost) all generated files. These include (but are not limited " +"to) bytecode cases, and parser generator file. ``make regen-stdlib-module-" +"names`` and ``autoconf`` must be run separately for the remaining `generated " +"files <#generated-files>`_." +msgstr "" + +#: ../../using/configure.rst:1143 msgid "C extensions" msgstr "C 擴充模組" -#: ../../using/configure.rst:766 +#: ../../using/configure.rst:1145 msgid "" "Some C extensions are built as built-in modules, like the ``sys`` module. " "They are built with the ``Py_BUILD_CORE_BUILTIN`` macro defined. Built-in " "modules have no ``__file__`` attribute:" msgstr "" -#: ../../using/configure.rst:770 +#: ../../using/configure.rst:1149 msgid "" ">>> import sys\n" ">>> sys\n" @@ -1175,14 +1692,14 @@ msgid "" "AttributeError: module 'sys' has no attribute '__file__'" msgstr "" -#: ../../using/configure.rst:780 +#: ../../using/configure.rst:1159 msgid "" "Other C extensions are built as dynamic libraries, like the ``_asyncio`` " "module. They are built with the ``Py_BUILD_CORE_MODULE`` macro defined. " "Example on Linux x86-64:" msgstr "" -#: ../../using/configure.rst:784 +#: ../../using/configure.rst:1163 msgid "" ">>> import _asyncio\n" ">>> _asyncio\n" @@ -1198,7 +1715,7 @@ msgstr "" ">>> _asyncio.__file__\n" "'/usr/lib64/python3.9/lib-dynload/_asyncio.cpython-39-x86_64-linux-gnu.so'" -#: ../../using/configure.rst:792 +#: ../../using/configure.rst:1171 msgid "" ":file:`Modules/Setup` is used to generate Makefile targets to build C " "extensions. At the beginning of the files, C extensions are built as built-" @@ -1206,303 +1723,312 @@ msgid "" "dynamic libraries." msgstr "" -#: ../../using/configure.rst:796 +#: ../../using/configure.rst:1175 msgid "" "The :c:macro:`!PyAPI_FUNC()`, :c:macro:`!PyAPI_DATA()` and :c:macro:" "`PyMODINIT_FUNC` macros of :file:`Include/exports.h` are defined differently " "depending if the ``Py_BUILD_CORE_MODULE`` macro is defined:" msgstr "" -#: ../../using/configure.rst:800 +#: ../../using/configure.rst:1179 msgid "Use ``Py_EXPORTED_SYMBOL`` if the ``Py_BUILD_CORE_MODULE`` is defined" msgstr "如果定義了 ``Py_BUILD_CORE_MODULE``,則使用 ``Py_EXPORTED_SYMBOL``" -#: ../../using/configure.rst:801 +#: ../../using/configure.rst:1180 msgid "Use ``Py_IMPORTED_SYMBOL`` otherwise." msgstr "否則使用 ``Py_IMPORTED_SYMBOL``。" -#: ../../using/configure.rst:803 +#: ../../using/configure.rst:1182 msgid "" "If the ``Py_BUILD_CORE_BUILTIN`` macro is used by mistake on a C extension " "built as a shared library, its :samp:`PyInit_{xxx}()` function is not " "exported, causing an :exc:`ImportError` on import." msgstr "" -#: ../../using/configure.rst:809 +#: ../../using/configure.rst:1188 msgid "Compiler and linker flags" msgstr "" -#: ../../using/configure.rst:811 +#: ../../using/configure.rst:1190 msgid "" "Options set by the ``./configure`` script and environment variables and used " "by ``Makefile``." msgstr "" -#: ../../using/configure.rst:815 +#: ../../using/configure.rst:1194 msgid "Preprocessor flags" msgstr "" -#: ../../using/configure.rst:819 +#: ../../using/configure.rst:1198 msgid "" "Value of :envvar:`CPPFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:825 +#: ../../using/configure.rst:1204 msgid "" "(Objective) C/C++ preprocessor flags, e.g. :samp:`-I{include_dir}` if you " "have headers in a nonstandard directory *include_dir*." msgstr "" -#: ../../using/configure.rst:828 ../../using/configure.rst:1018 +#: ../../using/configure.rst:1207 ../../using/configure.rst:1397 msgid "" "Both :envvar:`CPPFLAGS` and :envvar:`LDFLAGS` need to contain the shell's " "value to be able to build extension modules using the directories specified " "in the environment variables." msgstr "" -#: ../../using/configure.rst:838 +#: ../../using/configure.rst:1217 msgid "" "Extra preprocessor flags added for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:840 +#: ../../using/configure.rst:1219 msgid "" "Default: ``$(BASECPPFLAGS) -I. -I$(srcdir)/Include $(CONFIGURE_CPPFLAGS) " "$(CPPFLAGS)``." msgstr "" -#: ../../using/configure.rst:845 +#: ../../using/configure.rst:1224 msgid "Compiler flags" msgstr "編譯器旗標" -#: ../../using/configure.rst:849 -msgid "C compiler command." -msgstr "C 編譯器指令。" - -#: ../../using/configure.rst:851 +#: ../../using/configure.rst:1230 msgid "Example: ``gcc -pthread``." msgstr "" -#: ../../using/configure.rst:855 +#: ../../using/configure.rst:1234 msgid "C++ compiler command." msgstr "C++ 編譯器指令。" -#: ../../using/configure.rst:857 +#: ../../using/configure.rst:1236 msgid "Example: ``g++ -pthread``." msgstr "範例:``g++ -pthread``。" -#: ../../using/configure.rst:861 -msgid "C compiler flags." -msgstr "C 編譯器旗標。" - -#: ../../using/configure.rst:865 +#: ../../using/configure.rst:1244 msgid "" ":envvar:`CFLAGS_NODIST` is used for building the interpreter and stdlib C " "extensions. Use it when a compiler flag should *not* be part of :envvar:" "`CFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: ../../using/configure.rst:869 +#: ../../using/configure.rst:1248 msgid "In particular, :envvar:`CFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:871 +#: ../../using/configure.rst:1250 msgid "" "the compiler flag ``-I`` (for setting the search path for include files). " "The ``-I`` flags are processed from left to right, and any flags in :envvar:" "`CFLAGS` would take precedence over user- and package-supplied ``-I`` flags." msgstr "" -#: ../../using/configure.rst:876 +#: ../../using/configure.rst:1255 msgid "" "hardening flags such as ``-Werror`` because distributions cannot control " "whether packages installed by users conform to such heightened standards." msgstr "" -#: ../../using/configure.rst:884 +#: ../../using/configure.rst:1263 msgid "" "Options passed to the :mod:`compileall` command line when building PYC files " "in ``make install``. Default: ``-j0``." msgstr "" -#: ../../using/configure.rst:891 +#: ../../using/configure.rst:1270 msgid "Extra C compiler flags." msgstr "額外的 C 編譯器旗標。" -#: ../../using/configure.rst:895 +#: ../../using/configure.rst:1274 msgid "" "Value of :envvar:`CFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:902 +#: ../../using/configure.rst:1281 msgid "" "Value of :envvar:`CFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:909 +#: ../../using/configure.rst:1288 msgid "Base compiler flags." msgstr "基本編譯器旗標。" -#: ../../using/configure.rst:913 +#: ../../using/configure.rst:1292 msgid "Optimization flags." msgstr "最佳化旗標。" -#: ../../using/configure.rst:917 +#: ../../using/configure.rst:1296 msgid "Strict or non-strict aliasing flags used to compile ``Python/dtoa.c``." msgstr "" -#: ../../using/configure.rst:923 +#: ../../using/configure.rst:1302 msgid "Compiler flags used to build a shared library." msgstr "" -#: ../../using/configure.rst:925 +#: ../../using/configure.rst:1304 msgid "For example, ``-fPIC`` is used on Linux and on BSD." msgstr "例如說 ``-fPIC`` 被使用於 Linux 與 BSD 上。" -#: ../../using/configure.rst:929 +#: ../../using/configure.rst:1308 msgid "Extra C flags added for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:931 +#: ../../using/configure.rst:1310 msgid "" "Default: ``$(CCSHARED)`` when :option:`--enable-shared` is used, or an empty " "string otherwise." msgstr "" -#: ../../using/configure.rst:936 +#: ../../using/configure.rst:1315 msgid "" "Default: ``$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) " "$(EXTRA_CFLAGS)``." msgstr "" -#: ../../using/configure.rst:940 +#: ../../using/configure.rst:1319 msgid "" "Default: ``$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST) -I$(srcdir)/Include/" "internal``." msgstr "" -#: ../../using/configure.rst:946 +#: ../../using/configure.rst:1325 msgid "C flags used for building the interpreter object files." msgstr "" -#: ../../using/configure.rst:948 +#: ../../using/configure.rst:1327 msgid "" "Default: ``$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) " "$(CFLAGSFORSHARED)``." msgstr "" -#: ../../using/configure.rst:954 +#: ../../using/configure.rst:1333 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE``." msgstr "" -#: ../../using/configure.rst:960 +#: ../../using/configure.rst:1339 msgid "" "Compiler flags to build a standard library extension module as a built-in " "module, like the :mod:`posix` module." msgstr "" -#: ../../using/configure.rst:963 +#: ../../using/configure.rst:1342 msgid "Default: ``$(PY_STDMODULE_CFLAGS) -DPy_BUILD_CORE_BUILTIN``." msgstr "" -#: ../../using/configure.rst:969 +#: ../../using/configure.rst:1348 msgid "Purify command. Purify is a memory debugger program." msgstr "" -#: ../../using/configure.rst:971 +#: ../../using/configure.rst:1350 msgid "Default: empty string (not used)." msgstr "" -#: ../../using/configure.rst:975 +#: ../../using/configure.rst:1354 msgid "Linker flags" msgstr "" -#: ../../using/configure.rst:979 +#: ../../using/configure.rst:1358 msgid "" "Linker command used to build programs like ``python`` and ``_testembed``." msgstr "" -#: ../../using/configure.rst:981 +#: ../../using/configure.rst:1360 msgid "Default: ``$(PURIFY) $(CC)``." msgstr "" -#: ../../using/configure.rst:985 +#: ../../using/configure.rst:1364 msgid "" "Value of :envvar:`LDFLAGS` variable passed to the ``./configure`` script." msgstr "" -#: ../../using/configure.rst:987 +#: ../../using/configure.rst:1366 msgid "" "Avoid assigning :envvar:`CFLAGS`, :envvar:`LDFLAGS`, etc. so users can use " "them on the command line to append to these values without stomping the pre-" "set values." msgstr "" -#: ../../using/configure.rst:995 +#: ../../using/configure.rst:1374 msgid "" ":envvar:`LDFLAGS_NODIST` is used in the same manner as :envvar:" "`CFLAGS_NODIST`. Use it when a linker flag should *not* be part of :envvar:" "`LDFLAGS` once Python is installed (:gh:`65320`)." msgstr "" -#: ../../using/configure.rst:999 +#: ../../using/configure.rst:1378 msgid "In particular, :envvar:`LDFLAGS` should not contain:" msgstr "" -#: ../../using/configure.rst:1001 +#: ../../using/configure.rst:1380 msgid "" "the compiler flag ``-L`` (for setting the search path for libraries). The ``-" "L`` flags are processed from left to right, and any flags in :envvar:" "`LDFLAGS` would take precedence over user- and package-supplied ``-L`` flags." msgstr "" -#: ../../using/configure.rst:1008 +#: ../../using/configure.rst:1387 msgid "" "Value of :envvar:`LDFLAGS_NODIST` variable passed to the ``./configure`` " "script." msgstr "" -#: ../../using/configure.rst:1015 +#: ../../using/configure.rst:1394 msgid "" "Linker flags, e.g. :samp:`-L{lib_dir}` if you have libraries in a " "nonstandard directory *lib_dir*." msgstr "" -#: ../../using/configure.rst:1024 +#: ../../using/configure.rst:1403 msgid "" "Linker flags to pass libraries to the linker when linking the Python " "executable." msgstr "" -#: ../../using/configure.rst:1027 +#: ../../using/configure.rst:1406 msgid "Example: ``-lrt``." msgstr "範例:``-lrt``。" -#: ../../using/configure.rst:1031 +#: ../../using/configure.rst:1410 msgid "Command to build a shared library." msgstr "" -#: ../../using/configure.rst:1033 +#: ../../using/configure.rst:1412 msgid "Default: ``@LDSHARED@ $(PY_LDFLAGS)``." msgstr "預設值:``@LDSHARED@ $(PY_LDFLAGS)``。" -#: ../../using/configure.rst:1037 +#: ../../using/configure.rst:1416 msgid "Command to build ``libpython`` shared library." msgstr "" -#: ../../using/configure.rst:1039 +#: ../../using/configure.rst:1418 msgid "Default: ``@BLDSHARED@ $(PY_CORE_LDFLAGS)``." msgstr "預設值:``@BLDSHARED@ $(PY_CORE_LDFLAGS)``。" -#: ../../using/configure.rst:1043 +#: ../../using/configure.rst:1422 msgid "Default: ``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``." msgstr "預設值:``$(CONFIGURE_LDFLAGS) $(LDFLAGS)``。" -#: ../../using/configure.rst:1047 +#: ../../using/configure.rst:1426 msgid "Default: ``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``." msgstr "預設值:``$(CONFIGURE_LDFLAGS_NODIST) $(LDFLAGS_NODIST)``。" -#: ../../using/configure.rst:1053 +#: ../../using/configure.rst:1432 msgid "Linker flags used for building the interpreter object files." msgstr "" + +#: ../../using/configure.rst:1438 +msgid "Footnotes" +msgstr "" + +#: ../../using/configure.rst:1439 +msgid "" +"``git clean -fdx`` is an even more extreme way to \"clean\" your checkout. " +"It removes all files not known to Git. When bug hunting using ``git " +"bisect``, this is `recommended between probes <https://github.com/python/" +"cpython/issues/114505#issuecomment-1907021718>`_ to guarantee a completely " +"clean build. **Use with care**, as it will delete all files not checked into " +"Git, including your new, uncommitted work." +msgstr "" + +#~ msgid "Define the ``WITH_EDITLINE`` macro." +#~ msgstr "定義 ``WITH_EDITLINE`` 巨集。" diff --git a/using/editors.po b/using/editors.po index 81a486b644..d066d58ae3 100644 --- a/using/editors.po +++ b/using/editors.po @@ -6,7 +6,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-09-13 00:11+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/using/index.po b/using/index.po index 85a426479f..f702f15a0e 100644 --- a/using/index.po +++ b/using/index.po @@ -6,7 +6,7 @@ # Steven Hsu <hsuhaochun@gmail.com>, 2021 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2021-07-06 22:21+0800\n" diff --git a/using/ios.po b/using/ios.po new file mode 100644 index 0000000000..f2c2df9111 --- /dev/null +++ b/using/ios.po @@ -0,0 +1,565 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../using/ios.rst:5 +msgid "Using Python on iOS" +msgstr "" + +#: ../../using/ios.rst:0 +msgid "Authors" +msgstr "" + +#: ../../using/ios.rst:8 +msgid "Russell Keith-Magee (2024-03)" +msgstr "" + +#: ../../using/ios.rst:10 +msgid "" +"Python on iOS is unlike Python on desktop platforms. On a desktop platform, " +"Python is generally installed as a system resource that can be used by any " +"user of that computer. Users then interact with Python by running a :program:" +"`python` executable and entering commands at an interactive prompt, or by " +"running a Python script." +msgstr "" + +#: ../../using/ios.rst:16 +msgid "" +"On iOS, there is no concept of installing as a system resource. The only " +"unit of software distribution is an \"app\". There is also no console where " +"you could run a :program:`python` executable, or interact with a Python REPL." +msgstr "" + +#: ../../using/ios.rst:20 +msgid "" +"As a result, the only way you can use Python on iOS is in embedded mode - " +"that is, by writing a native iOS application, and embedding a Python " +"interpreter using ``libPython``, and invoking Python code using the :ref:" +"`Python embedding API <embedding>`. The full Python interpreter, the " +"standard library, and all your Python code is then packaged as a standalone " +"bundle that can be distributed via the iOS App Store." +msgstr "" + +#: ../../using/ios.rst:27 +msgid "" +"If you're looking to experiment for the first time with writing an iOS app " +"in Python, projects such as `BeeWare <https://beeware.org>`__ and `Kivy " +"<https://kivy.org>`__ will provide a much more approachable user experience. " +"These projects manage the complexities associated with getting an iOS " +"project running, so you only need to deal with the Python code itself." +msgstr "" + +#: ../../using/ios.rst:34 +msgid "Python at runtime on iOS" +msgstr "" + +#: ../../using/ios.rst:37 +msgid "iOS version compatibility" +msgstr "" + +#: ../../using/ios.rst:39 +msgid "" +"The minimum supported iOS version is specified at compile time, using the :" +"option:`--host` option to ``configure``. By default, when compiled for iOS, " +"Python will be compiled with a minimum supported iOS version of 13.0. To use " +"a different minimum iOS version, provide the version number as part of the :" +"option:`!--host` argument - for example, ``--host=arm64-apple-ios15.4-" +"simulator`` would compile an ARM64 simulator build with a deployment target " +"of 15.4." +msgstr "" + +#: ../../using/ios.rst:48 +msgid "Platform identification" +msgstr "" + +#: ../../using/ios.rst:50 +msgid "" +"When executing on iOS, ``sys.platform`` will report as ``ios``. This value " +"will be returned on an iPhone or iPad, regardless of whether the app is " +"running on the simulator or a physical device." +msgstr "" + +#: ../../using/ios.rst:54 +msgid "" +"Information about the specific runtime environment, including the iOS " +"version, device model, and whether the device is a simulator, can be " +"obtained using :func:`platform.ios_ver`. :func:`platform.system` will report " +"``iOS`` or ``iPadOS``, depending on the device." +msgstr "" + +#: ../../using/ios.rst:59 +msgid "" +":func:`os.uname` reports kernel-level details; it will report a name of " +"``Darwin``." +msgstr "" + +#: ../../using/ios.rst:63 +msgid "Standard library availability" +msgstr "" + +#: ../../using/ios.rst:65 +msgid "" +"The Python standard library has some notable omissions and restrictions on " +"iOS. See the :ref:`API availability guide for iOS <mobile-availability>` for " +"details." +msgstr "" + +#: ../../using/ios.rst:70 +msgid "Binary extension modules" +msgstr "" + +#: ../../using/ios.rst:72 +msgid "" +"One notable difference about iOS as a platform is that App Store " +"distribution imposes hard requirements on the packaging of an application. " +"One of these requirements governs how binary extension modules are " +"distributed." +msgstr "" + +#: ../../using/ios.rst:76 +msgid "" +"The iOS App Store requires that *all* binary modules in an iOS app must be " +"dynamic libraries, contained in a framework with appropriate metadata, " +"stored in the ``Frameworks`` folder of the packaged app. There can be only a " +"single binary per framework, and there can be no executable binary material " +"outside the ``Frameworks`` folder." +msgstr "" + +#: ../../using/ios.rst:82 +msgid "" +"This conflicts with the usual Python approach for distributing binaries, " +"which allows a binary extension module to be loaded from any location on " +"``sys.path``. To ensure compliance with App Store policies, an iOS project " +"must post-process any Python packages, converting ``.so`` binary modules " +"into individual standalone frameworks with appropriate metadata and signing. " +"For details on how to perform this post-processing, see the guide for :ref:" +"`adding Python to your project <adding-ios>`." +msgstr "" + +#: ../../using/ios.rst:90 +msgid "" +"To help Python discover binaries in their new location, the original ``.so`` " +"file on ``sys.path`` is replaced with a ``.fwork`` file. This file is a text " +"file containing the location of the framework binary, relative to the app " +"bundle. To allow the framework to resolve back to the original location, the " +"framework must contain a ``.origin`` file that contains the location of the " +"``.fwork`` file, relative to the app bundle." +msgstr "" + +#: ../../using/ios.rst:97 +msgid "" +"For example, consider the case of an import ``from foo.bar import _whiz``, " +"where ``_whiz`` is implemented with the binary module ``sources/foo/bar/" +"_whiz.abi3.so``, with ``sources`` being the location registered on ``sys." +"path``, relative to the application bundle. This module *must* be " +"distributed as ``Frameworks/foo.bar._whiz.framework/foo.bar._whiz`` " +"(creating the framework name from the full import path of the module), with " +"an ``Info.plist`` file in the ``.framework`` directory identifying the " +"binary as a framework. The ``foo.bar._whiz`` module would be represented in " +"the original location with a ``sources/foo/bar/_whiz.abi3.fwork`` marker " +"file, containing the path ``Frameworks/foo.bar._whiz/foo.bar._whiz``. The " +"framework would also contain ``Frameworks/foo.bar._whiz.framework/foo.bar." +"_whiz.origin``, containing the path to the ``.fwork`` file." +msgstr "" + +#: ../../using/ios.rst:110 +msgid "" +"When running on iOS, the Python interpreter will install an :class:" +"`~importlib.machinery.AppleFrameworkLoader` that is able to read and import " +"``.fwork`` files. Once imported, the ``__file__`` attribute of the binary " +"module will report as the location of the ``.fwork`` file. However, the :" +"class:`~importlib.machinery.ModuleSpec` for the loaded module will report " +"the ``origin`` as the location of the binary in the framework folder." +msgstr "" + +#: ../../using/ios.rst:118 +msgid "Compiler stub binaries" +msgstr "" + +#: ../../using/ios.rst:120 +msgid "" +"Xcode doesn't expose explicit compilers for iOS; instead, it uses an " +"``xcrun`` script that resolves to a full compiler path (e.g., ``xcrun --sdk " +"iphoneos clang`` to get the ``clang`` for an iPhone device). However, using " +"this script poses two problems:" +msgstr "" + +#: ../../using/ios.rst:125 +msgid "" +"The output of ``xcrun`` includes paths that are machine specific, resulting " +"in a sysconfig module that cannot be shared between users; and" +msgstr "" + +#: ../../using/ios.rst:128 +msgid "" +"It results in ``CC``/``CPP``/``LD``/``AR`` definitions that include spaces. " +"There is a lot of C ecosystem tooling that assumes that you can split a " +"command line at the first space to get the path to the compiler executable; " +"this isn't the case when using ``xcrun``." +msgstr "" + +#: ../../using/ios.rst:133 +msgid "" +"To avoid these problems, Python provided stubs for these tools. These stubs " +"are shell script wrappers around the underingly ``xcrun`` tools, distributed " +"in a ``bin`` folder distributed alongside the compiled iOS framework. These " +"scripts are relocatable, and will always resolve to the appropriate local " +"system paths. By including these scripts in the bin folder that accompanies " +"a framework, the contents of the ``sysconfig`` module becomes useful for end-" +"users to compile their own modules. When compiling third-party Python " +"modules for iOS, you should ensure these stub binaries are on your path." +msgstr "" + +#: ../../using/ios.rst:143 +msgid "Installing Python on iOS" +msgstr "" + +#: ../../using/ios.rst:146 +msgid "Tools for building iOS apps" +msgstr "" + +#: ../../using/ios.rst:148 +msgid "" +"Building for iOS requires the use of Apple's Xcode tooling. It is strongly " +"recommended that you use the most recent stable release of Xcode. This will " +"require the use of the most (or second-most) recently released macOS " +"version, as Apple does not maintain Xcode for older macOS versions. The " +"Xcode Command Line Tools are not sufficient for iOS development; you need a " +"*full* Xcode install." +msgstr "" + +#: ../../using/ios.rst:155 +msgid "" +"If you want to run your code on the iOS simulator, you'll also need to " +"install an iOS Simulator Platform. You should be prompted to select an iOS " +"Simulator Platform when you first run Xcode. Alternatively, you can add an " +"iOS Simulator Platform by selecting from the Platforms tab of the Xcode " +"Settings panel." +msgstr "" + +#: ../../using/ios.rst:163 +msgid "Adding Python to an iOS project" +msgstr "" + +#: ../../using/ios.rst:165 +msgid "" +"Python can be added to any iOS project, using either Swift or Objective C. " +"The following examples will use Objective C; if you are using Swift, you may " +"find a library like `PythonKit <https://github.com/pvieito/PythonKit>`__ to " +"be helpful." +msgstr "" + +#: ../../using/ios.rst:170 +msgid "To add Python to an iOS Xcode project:" +msgstr "" + +#: ../../using/ios.rst:172 +msgid "" +"Build or obtain a Python ``XCFramework``. See the instructions in :source:" +"`iOS/README.rst` (in the CPython source distribution) for details on how to " +"build a Python ``XCFramework``. At a minimum, you will need a build that " +"supports ``arm64-apple-ios``, plus one of either ``arm64-apple-ios-" +"simulator`` or ``x86_64-apple-ios-simulator``." +msgstr "" + +#: ../../using/ios.rst:178 +msgid "" +"Drag the ``XCframework`` into your iOS project. In the following " +"instructions, we'll assume you've dropped the ``XCframework`` into the root " +"of your project; however, you can use any other location that you want by " +"adjusting paths as needed." +msgstr "" + +#: ../../using/ios.rst:183 +msgid "" +"Drag the ``iOS/Resources/dylib-Info-template.plist`` file into your project, " +"and ensure it is associated with the app target." +msgstr "" + +#: ../../using/ios.rst:186 +msgid "" +"Add your application code as a folder in your Xcode project. In the " +"following instructions, we'll assume that your user code is in a folder " +"named ``app`` in the root of your project; you can use any other location by " +"adjusting paths as needed. Ensure that this folder is associated with your " +"app target." +msgstr "" + +#: ../../using/ios.rst:192 +msgid "" +"Select the app target by selecting the root node of your Xcode project, then " +"the target name in the sidebar that appears." +msgstr "" + +#: ../../using/ios.rst:195 +msgid "" +"In the \"General\" settings, under \"Frameworks, Libraries and Embedded " +"Content\", add ``Python.xcframework``, with \"Embed & Sign\" selected." +msgstr "" + +#: ../../using/ios.rst:198 +msgid "In the \"Build Settings\" tab, modify the following:" +msgstr "" + +#: ../../using/ios.rst:200 +msgid "Build Options" +msgstr "" + +#: ../../using/ios.rst:202 +msgid "User Script Sandboxing: No" +msgstr "" + +#: ../../using/ios.rst:203 +msgid "Enable Testability: Yes" +msgstr "" + +#: ../../using/ios.rst:205 +msgid "Search Paths" +msgstr "" + +#: ../../using/ios.rst:207 +msgid "Framework Search Paths: ``$(PROJECT_DIR)``" +msgstr "" + +#: ../../using/ios.rst:208 +msgid "" +"Header Search Paths: ``\"$(BUILT_PRODUCTS_DIR)/Python.framework/Headers\"``" +msgstr "" + +#: ../../using/ios.rst:210 +msgid "Apple Clang - Warnings - All languages" +msgstr "" + +#: ../../using/ios.rst:212 +msgid "Quoted Include In Framework Header: No" +msgstr "" + +#: ../../using/ios.rst:214 +msgid "" +"Add a build step that copies the Python standard library into your app. In " +"the \"Build Phases\" tab, add a new \"Run Script\" build step *before* the " +"\"Embed Frameworks\" step, but *after* the \"Copy Bundle Resources\" step. " +"Name the step \"Install Target Specific Python Standard Library\", disable " +"the \"Based on dependency analysis\" checkbox, and set the script content to:" +msgstr "" + +#: ../../using/ios.rst:220 +msgid "" +"set -e\n" +"\n" +"mkdir -p \"$CODESIGNING_FOLDER_PATH/python/lib\"\n" +"if [ \"$EFFECTIVE_PLATFORM_NAME\" = \"-iphonesimulator\" ]; then\n" +" echo \"Installing Python modules for iOS Simulator\"\n" +" rsync -au --delete \"$PROJECT_DIR/Python.xcframework/ios-arm64_x86_64-" +"simulator/lib/\" \"$CODESIGNING_FOLDER_PATH/python/lib/\"\n" +"else\n" +" echo \"Installing Python modules for iOS Device\"\n" +" rsync -au --delete \"$PROJECT_DIR/Python.xcframework/ios-arm64/lib/\" " +"\"$CODESIGNING_FOLDER_PATH/python/lib/\"\n" +"fi" +msgstr "" + +#: ../../using/ios.rst:233 +msgid "" +"Note that the name of the simulator \"slice\" in the XCframework may be " +"different, depending the CPU architectures your ``XCFramework`` supports." +msgstr "" + +#: ../../using/ios.rst:236 +msgid "" +"Add a second build step that processes the binary extension modules in the " +"standard library into \"Framework\" format. Add a \"Run Script\" build step " +"*directly after* the one you added in step 8, named \"Prepare Python Binary " +"Modules\". It should also have \"Based on dependency analysis\" unchecked, " +"with the following script content:" +msgstr "" + +#: ../../using/ios.rst:242 +msgid "" +"set -e\n" +"\n" +"install_dylib () {\n" +" INSTALL_BASE=$1\n" +" FULL_EXT=$2\n" +"\n" +" # The name of the extension file\n" +" EXT=$(basename \"$FULL_EXT\")\n" +" # The location of the extension file, relative to the bundle\n" +" RELATIVE_EXT=${FULL_EXT#$CODESIGNING_FOLDER_PATH/}\n" +" # The path to the extension file, relative to the install base\n" +" PYTHON_EXT=${RELATIVE_EXT/$INSTALL_BASE/}\n" +" # The full dotted name of the extension module, constructed from the " +"file path.\n" +" FULL_MODULE_NAME=$(echo $PYTHON_EXT | cut -d \".\" -f 1 | tr \"/\" \"." +"\");\n" +" # A bundle identifier; not actually used, but required by Xcode " +"framework packaging\n" +" FRAMEWORK_BUNDLE_ID=$(echo $PRODUCT_BUNDLE_IDENTIFIER.$FULL_MODULE_NAME " +"| tr \"_\" \"-\")\n" +" # The name of the framework folder.\n" +" FRAMEWORK_FOLDER=\"Frameworks/$FULL_MODULE_NAME.framework\"\n" +"\n" +" # If the framework folder doesn't exist, create it.\n" +" if [ ! -d \"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER\" ]; then\n" +" echo \"Creating framework for $RELATIVE_EXT\"\n" +" mkdir -p \"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER\"\n" +" cp \"$CODESIGNING_FOLDER_PATH/dylib-Info-template.plist\" " +"\"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/Info.plist\"\n" +" plutil -replace CFBundleExecutable -string \"$FULL_MODULE_NAME\" " +"\"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/Info.plist\"\n" +" plutil -replace CFBundleIdentifier -string \"$FRAMEWORK_BUNDLE_ID\" " +"\"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/Info.plist\"\n" +" fi\n" +"\n" +" echo \"Installing binary for $FRAMEWORK_FOLDER/$FULL_MODULE_NAME\"\n" +" mv \"$FULL_EXT\" \"$CODESIGNING_FOLDER_PATH/$FRAMEWORK_FOLDER/" +"$FULL_MODULE_NAME\"\n" +" # Create a placeholder .fwork file where the .so was\n" +" echo \"$FRAMEWORK_FOLDER/$FULL_MODULE_NAME\" > ${FULL_EXT%.so}.fwork\n" +" # Create a back reference to the .so file location in the framework\n" +" echo \"${RELATIVE_EXT%.so}.fwork\" > \"$CODESIGNING_FOLDER_PATH/" +"$FRAMEWORK_FOLDER/$FULL_MODULE_NAME.origin\"\n" +" }\n" +"\n" +" PYTHON_VER=$(ls -1 \"$CODESIGNING_FOLDER_PATH/python/lib\")\n" +" echo \"Install Python $PYTHON_VER standard library extension modules...\"\n" +" find \"$CODESIGNING_FOLDER_PATH/python/lib/$PYTHON_VER/lib-dynload\" -name " +"\"*.so\" | while read FULL_EXT; do\n" +" install_dylib python/lib/$PYTHON_VER/lib-dynload/ \"$FULL_EXT\"\n" +" done\n" +"\n" +" # Clean up dylib template\n" +" rm -f \"$CODESIGNING_FOLDER_PATH/dylib-Info-template.plist\"\n" +"\n" +" echo \"Signing frameworks as $EXPANDED_CODE_SIGN_IDENTITY_NAME " +"($EXPANDED_CODE_SIGN_IDENTITY)...\"\n" +" find \"$CODESIGNING_FOLDER_PATH/Frameworks\" -name \"*.framework\" -exec /" +"usr/bin/codesign --force --sign \"$EXPANDED_CODE_SIGN_IDENTITY\" " +"${OTHER_CODE_SIGN_FLAGS:-} -o runtime --timestamp=none --preserve-" +"metadata=identifier,entitlements,flags --generate-entitlement-der \"{}\" \\;" +msgstr "" + +#: ../../using/ios.rst:292 +msgid "" +"Add Objective C code to initialize and use a Python interpreter in embedded " +"mode. You should ensure that:" +msgstr "" + +#: ../../using/ios.rst:295 +msgid ":c:member:`UTF-8 mode <PyPreConfig.utf8_mode>` is *enabled*;" +msgstr "" + +#: ../../using/ios.rst:296 +msgid ":c:member:`Buffered stdio <PyConfig.buffered_stdio>` is *disabled*;" +msgstr "" + +#: ../../using/ios.rst:297 +msgid ":c:member:`Writing bytecode <PyConfig.write_bytecode>` is *disabled*;" +msgstr "" + +#: ../../using/ios.rst:298 +msgid "" +":c:member:`Signal handlers <PyConfig.install_signal_handlers>` are *enabled*;" +msgstr "" + +#: ../../using/ios.rst:299 +msgid "" +"``PYTHONHOME`` for the interpreter is configured to point at the ``python`` " +"subfolder of your app's bundle; and" +msgstr "" + +#: ../../using/ios.rst:301 +msgid "The ``PYTHONPATH`` for the interpreter includes:" +msgstr "" + +#: ../../using/ios.rst:303 +msgid "the ``python/lib/python3.X`` subfolder of your app's bundle," +msgstr "" + +#: ../../using/ios.rst:304 +msgid "" +"the ``python/lib/python3.X/lib-dynload`` subfolder of your app's bundle, and" +msgstr "" + +#: ../../using/ios.rst:305 +msgid "the ``app`` subfolder of your app's bundle" +msgstr "" + +#: ../../using/ios.rst:307 +msgid "" +"Your app's bundle location can be determined using ``[[NSBundle mainBundle] " +"resourcePath]``." +msgstr "" + +#: ../../using/ios.rst:310 +msgid "" +"Steps 8, 9 and 10 of these instructions assume that you have a single folder " +"of pure Python application code, named ``app``. If you have third-party " +"binary modules in your app, some additional steps will be required:" +msgstr "" + +#: ../../using/ios.rst:314 +msgid "" +"You need to ensure that any folders containing third-party binaries are " +"either associated with the app target, or copied in as part of step 8. Step " +"8 should also purge any binaries that are not appropriate for the platform a " +"specific build is targeting (i.e., delete any device binaries if you're " +"building an app targeting the simulator)." +msgstr "" + +#: ../../using/ios.rst:320 +msgid "" +"Any folders that contain third-party binaries must be processed into " +"framework form by step 9. The invocation of ``install_dylib`` that processes " +"the ``lib-dynload`` folder can be copied and adapted for this purpose." +msgstr "" + +#: ../../using/ios.rst:324 +msgid "" +"If you're using a separate folder for third-party packages, ensure that " +"folder is included as part of the ``PYTHONPATH`` configuration in step 10." +msgstr "" + +#: ../../using/ios.rst:328 +msgid "App Store Compliance" +msgstr "" + +#: ../../using/ios.rst:330 +msgid "" +"The only mechanism for distributing apps to third-party iOS devices is to " +"submit the app to the iOS App Store; apps submitted for distribution must " +"pass Apple's app review process. This process includes a set of automated " +"validation rules that inspect the submitted application bundle for " +"problematic code." +msgstr "" + +#: ../../using/ios.rst:335 +msgid "" +"The Python standard library contains some code that is known to violate " +"these automated rules. While these violations appear to be false positives, " +"Apple's review rules cannot be challenged; so, it is necessary to modify the " +"Python standard library for an app to pass App Store review." +msgstr "" + +#: ../../using/ios.rst:340 +msgid "" +"The Python source tree contains :source:`a patch file <Mac/Resources/app-" +"store-compliance.patch>` that will remove all code that is known to cause " +"issues with the App Store review process. This patch is applied " +"automatically when building for iOS." +msgstr "" diff --git a/using/mac.po b/using/mac.po index 1b95fa62ab..79ab0b1827 100644 --- a/using/mac.po +++ b/using/mac.po @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2022, Python Software Foundation +# Copyright (C) 2001-2024, Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: @@ -8,9 +8,9 @@ # Matt Wang <mattwang44@gmail.com>, 2022, 2024 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-30 09:19+0000\n" "PO-Revision-Date: 2022-08-31 22:26+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -23,361 +23,709 @@ msgstr "" "X-Generator: Poedit 3.1.1\n" #: ../../using/mac.rst:6 -msgid "Using Python on a Mac" -msgstr "在 Mac 系統使用 Python" +msgid "Using Python on macOS" +msgstr "於 macOS 使用 Python" -#: ../../using/mac.rst:0 -msgid "Author" -msgstr "作者" +#: ../../using/mac.rst:11 +msgid "" +"This document aims to give an overview of macOS-specific behavior you should " +"know about to get started with Python on Mac computers. Python on a Mac " +"running macOS is very similar to Python on other Unix-derived platforms, but " +"there are some differences in installation and some features." +msgstr "" -#: ../../using/mac.rst:8 -msgid "Bob Savage <bobsavage@mac.com>" -msgstr "Bob Savage <bobsavage@mac.com>" +#: ../../using/mac.rst:16 +msgid "" +"There are various ways to obtain and install Python for macOS. Pre-built " +"versions of the most recent versions of Python are available from a number " +"of distributors. Much of this document describes use of the Pythons provided " +"by the CPython release team for download from the `python.org website " +"<https://www.python.org/downloads/>`_. See :ref:`alternative_bundles` for " +"some other options." +msgstr "" -#: ../../using/mac.rst:11 +#: ../../using/mac.rst:34 +msgid "Using Python for macOS from ``python.org``" +msgstr "" + +#: ../../using/mac.rst:37 +msgid "Installation steps" +msgstr "安裝步驟" + +#: ../../using/mac.rst:39 +msgid "" +"For `current Python versions <https://www.python.org/downloads/>`_ (other " +"than those in ``security`` status), the release team produces a **Python for " +"macOS** installer package for each new release. A list of available " +"installers is available `here <https://www.python.org/downloads/macos/>`_. " +"We recommend using the most recent supported Python version where possible. " +"Current installers provide a `universal2 binary <https://en.wikipedia.org/" +"wiki/Universal_binary>`_ build of Python which runs natively on all Macs " +"(Apple Silicon and Intel) that are supported by a wide range of macOS " +"versions, currently typically from at least **macOS 10.13 High Sierra** on." +msgstr "" + +#: ../../using/mac.rst:51 msgid "" -"Python on a Mac running macOS is in principle very similar to Python on any " -"other Unix platform, but there are a number of additional features such as " -"the integrated development environment (IDE) and the Package Manager that " -"are worth pointing out." +"The downloaded file is a standard macOS installer package file (``.pkg``). " +"File integrity information (checksum, size, sigstore signature, etc) for " +"each file is included on the release download page. Installer packages and " +"their contents are signed and notarized with ``Python Software Foundation`` " +"Apple Developer ID certificates to meet `macOS Gatekeeper requirements " +"<https://support.apple.com/en-us/102445>`_." msgstr "" -"Python 在 Mac 的 macOS 上執行和在其他 Unix 平台上執行的原理非常相似,但值得一" -"提的是在 macOS 上有其他額外的功能,例如整合開發環境 (IDE) 與套件管理。" -#: ../../using/mac.rst:21 -msgid "Getting and Installing Python" -msgstr "取得和安裝 Python" +#: ../../using/mac.rst:57 +msgid "" +"For a default installation, double-click on the downloaded installer package " +"file. This should launch the standard macOS Installer app and display the " +"first of several installer windows steps." +msgstr "" -#: ../../using/mac.rst:23 +#: ../../using/mac.rst:63 msgid "" -"macOS used to come with Python 2.7 pre-installed between versions 10.8 and " -"`12.3 <https://developer.apple.com/documentation/macos-release-notes/" -"macos-12_3-release-notes#Python>`_. You are invited to install the most " -"recent version of Python 3 from the `Python website <https://www.python.org/" -"downloads/macos/>`__. A current \"universal2 binary\" build of Python, which " -"runs natively on the Mac's new Apple Silicon and legacy Intel processors, is " -"available there." +"Clicking on the **Continue** button brings up the **Read Me** for this " +"installer. Besides other important information, the **Read Me** documents " +"which Python version is going to be installed and on what versions of macOS " +"it is supported. You may need to scroll through to read the whole file. By " +"default, this **Read Me** will also be installed in |" +"usemac_applications_folder_version| and available to read anytime." msgstr "" -"macOS 自 10.8 版本開始至 `12.3 版本 <https://developer.apple.com/" -"documentation/macos-release-notes/macos-12_3-release-notes#Python>`_\\ 之間預" -"設安裝 Python 2.7。你也可以到 `Python 網站 <https://www.python.org/downloads/" -"macos/>`__\\ 安裝最新的 Python 3 版本。你可以找到建立在\"通用二進位 " -"(universal2 binary)\" 上的 Python 建置版本,它能夠原生地運行在 Mac 新的 " -"Apple Silicon CPU 與過去的 Intel CPU 上。" -#: ../../using/mac.rst:30 -msgid "What you get after installing is a number of things:" -msgstr "在安裝後你必須要做幾件事:" +#: ../../using/mac.rst:71 +msgid "" +"Clicking on **Continue** proceeds to display the license for Python and for " +"other included software. You will then need to **Agree** to the license " +"terms before proceeding to the next step. This license file will also be " +"installed and available to be read later." +msgstr "" -#: ../../using/mac.rst:32 +#: ../../using/mac.rst:78 msgid "" -"A |python_version_literal| folder in your :file:`Applications` folder. In " -"here you find IDLE, the development environment that is a standard part of " -"official Python distributions; and :program:`Python Launcher`, which handles " -"double-clicking Python scripts from the Finder." +"After the license terms are accepted, the next step is the **Installation " +"Type** display. For most uses, the standard set of installation operations " +"is appropriate." msgstr "" -"會有一個 |python_version_literal| 資料夾在你的 :file:`Applications` 資料夾" -"中。在這裡你可以找到 IDLE,它是作為官方 Python 發行版標準組成的開發環境;以" -"及 :program:`Python Launcher`,它負責處理在 Finder 中雙擊 Python 腳本的操作。" -#: ../../using/mac.rst:37 +#: ../../using/mac.rst:83 +msgid "" +"By pressing the **Customize** button, you can choose to omit or select " +"certain package components of the installer. Click on each package name to " +"see a description of what it installs. To also install support for the " +"optional experimental free-threaded feature, see :ref:`install-freethreaded-" +"macos`." +msgstr "" + +#: ../../using/mac.rst:91 +msgid "" +"In either case, clicking **Install** will begin the install process by " +"asking permission to install new software. A macOS user name with " +"``Administrator`` privilege is needed as the installed Python will be " +"available to all users of the Mac." +msgstr "" + +#: ../../using/mac.rst:95 +msgid "When the installation is complete, the **Summary** window will appear." +msgstr "" + +#: ../../using/mac.rst:99 +msgid "" +"Double-click on the :command:`Install Certificates.command` icon or file in " +"the |usemac_applications_folder_version| window to complete the installation." +msgstr "" + +#: ../../using/mac.rst:105 +msgid "" +"This will open a temporary :program:`Terminal` shell window that will use " +"the new Python to download and install SSL root certificates for its use." +msgstr "" + +#: ../../using/mac.rst:111 +msgid "" +"If ``Successfully installed certifi`` and ``update complete`` appears in the " +"terminal window, the installation is complete. Close this terminal window " +"and the installer window." +msgstr "" + +#: ../../using/mac.rst:115 +msgid "A default install will include:" +msgstr "預設安裝會包含:" + +#: ../../using/mac.rst:117 +msgid "" +"A |usemac_applications_folder_name| folder in your :file:`Applications` " +"folder. In here you find :program:`IDLE`, the development environment that " +"is a standard part of official Python distributions; and :program:`Python " +"Launcher`, which handles double-clicking Python scripts from the macOS " +"`Finder <https://support.apple.com/en-us/HT201732>`_." +msgstr "" +"會有一個 |usemac_applications_folder_name| 資料夾在你的 :file:`Applications` " +"資料夾中。在這裡你可以找到 :program:`IDLE`,它是作為官方 Python 發行版標準組" +"成的開發環境;以及 :program:`Python Launcher`,它負責處理在 `Finder <https://" +"support.apple.com/en-us/HT201732>`_ 中雙擊 Python 腳本的操作。" + +#: ../../using/mac.rst:122 msgid "" "A framework :file:`/Library/Frameworks/Python.framework`, which includes the " "Python executable and libraries. The installer adds this location to your " -"shell path. To uninstall Python, you can remove these three things. A " -"symlink to the Python executable is placed in :file:`/usr/local/bin/`." +"shell path. To uninstall Python, you can remove these three things. Symlinks " +"to the Python executable are placed in :file:`/usr/local/bin/`." msgstr "" ":file:`/Library/Frameworks/Python.framework` 框架,包括 Python 可執行檔案 " "(executable) 和函式庫 (library)。安裝程式將此位置新增到 shell 路徑。要解除安" -"裝 Python ,你可以移除這三個專案。Python 可執行檔案的符號連結 (symlink) 則放" +"裝 Python ,你可以移除這三個東西。Python 可執行檔案的符號連結 (symlink) 則放" "在 :file:`/usr/local/bin/` 中。" -#: ../../using/mac.rst:44 +#: ../../using/mac.rst:129 msgid "" -"On macOS 10.8-12.3, the Apple-provided build of Python is installed in :file:" -"`/System/Library/Frameworks/Python.framework` and :file:`/usr/bin/python`, " -"respectively. You should never modify or delete these, as they are Apple-" -"controlled and are used by Apple- or third-party software. Remember that if " -"you choose to install a newer Python version from python.org, you will have " -"two different but functional Python installations on your computer, so it " -"will be important that your paths and usages are consistent with what you " -"want to do." +"Recent versions of macOS include a :command:`python3` command in :file:`/usr/" +"bin/python3` that links to a usually older and incomplete version of Python " +"provided by and for use by the Apple development tools, :program:`Xcode` or " +"the :program:`Command Line Tools for Xcode`. You should never modify or " +"attempt to delete this installation, as it is Apple-controlled and is used " +"by Apple-provided or third-party software. If you choose to install a newer " +"Python version from ``python.org``, you will have two different but " +"functional Python installations on your computer that can co-exist. The " +"default installer options should ensure that its :command:`python3` will be " +"used instead of the system :command:`python3`." msgstr "" -"在 macOS 10.8-12.3,Apple 提供的 Python 建置版本分別安裝在 :file:`/System/" -"Library/Frameworks/Python.framework` 和 :file:`/usr/bin/python` 中。你不應該" -"去修改或刪除這些內容,因為它們由 Apple 控制並且被 Apple 或第三方軟體使用。請" -"記住,如果你選擇從 python.org 安裝較新的 Python 版本,那麼你的計算機上將安裝" -"兩個不同但都可運作的 Python,因此你的路徑和用法與你想要執行的操作一致非常重" -"要。" -#: ../../using/mac.rst:52 +#: ../../using/mac.rst:140 +msgid "How to run a Python script" +msgstr "如何執行 Python 腳本" + +#: ../../using/mac.rst:142 msgid "" -"IDLE includes a Help menu that allows you to access Python documentation. If " -"you are completely new to Python you should start reading the tutorial " -"introduction in that document." +"There are two ways to invoke the Python interpreter. If you are familiar " +"with using a Unix shell in a terminal window, you can invoke |" +"usemac_python_x_dot_y_literal| or ``python3`` optionally followed by one or " +"more command line options (described in :ref:`using-on-general`). The Python " +"tutorial also has a useful section on :ref:`using Python interactively from " +"a shell <tut-interac>`." msgstr "" -"IDLE 包含一個幫助 (Help) 選單,讓你可以參閱 Python 文件。如果你是 Python 的新" -"手,你應該開始閱讀該文件中的教學介紹。" -#: ../../using/mac.rst:56 +#: ../../using/mac.rst:149 msgid "" -"If you are familiar with Python on other Unix platforms you should read the " -"section on running Python scripts from the Unix shell." +"You can also invoke the interpreter through an integrated development " +"environment. :ref:`idle` is a basic editor and interpreter environment which " +"is included with the standard distribution of Python. :program:`IDLE` " +"includes a Help menu that allows you to access Python documentation. If you " +"are completely new to Python, you can read the tutorial introduction in that " +"document." msgstr "" -"如果你熟悉其他 Unix 平臺上的 Python,那麼你應該閱讀有關從 Unix shell 執行 " -"Python 腳本的部分。" - -#: ../../using/mac.rst:61 -msgid "How to run a Python script" -msgstr "如何執行 Python 腳本" -#: ../../using/mac.rst:63 +#: ../../using/mac.rst:157 msgid "" -"Your best way to get started with Python on macOS is through the IDLE " -"integrated development environment; see section :ref:`ide` and use the Help " -"menu when the IDE is running." +"There are many other editors and IDEs available, see :ref:`editors` for more " +"information." msgstr "" -"在 macOS 上開始使用 Python 的最佳方法是透過 IDLE 整合開發環境;參見 :ref:" -"`ide` 部分,並在 IDE 執行時使用幫助選單。" -#: ../../using/mac.rst:67 +#: ../../using/mac.rst:160 msgid "" -"If you want to run Python scripts from the Terminal window command line or " -"from the Finder you first need an editor to create your script. macOS comes " -"with a number of standard Unix command line editors, :program:`vim` :program:" -"`nano` among them. If you want a more Mac-like editor, :program:`BBEdit` " -"from Bare Bones Software (see https://www.barebones.com/products/bbedit/" -"index.html) are good choices, as is :program:`TextMate` (see https://" -"macromates.com). Other editors include :program:`MacVim` (https://macvim." -"org) and :program:`Aquamacs` (https://aquamacs.org)." +"To run a Python script file from the terminal window, you can invoke the " +"interpreter with the name of the script file:" msgstr "" -"如果要從終端機視窗命令列或 Finder 執行 Python 腳本,首先需要一個編輯器來建立" -"腳本。macOS 附帶了許多標準的 Unix 命令列編輯器,如 :program:`vim` 和 :" -"program:`nano`。如果你想要一個更 Mac 化的編輯器,那麼來自 Bare Bones " -"Software 的 :program:`BBEdit`\\ (參見 http://www.barebones.com/products/" -"bbedit/index.html) 是不錯的選擇,:program:`TextMate` (參見 https://" -"macromates.com/)也是個選擇。其他編輯器包括 :program:`MacVim` (https://" -"macvim.org) 和 :program:`Aquamacs` (https://aquamacs.org/)。" -#: ../../using/mac.rst:77 -msgid "" -"To run your script from the Terminal window you must make sure that :file:`/" -"usr/local/bin` is in your shell search path." +#: ../../using/mac.rst:163 +msgid "|usemac_python_x_dot_y_literal| ``myscript.py``" msgstr "" -"要從終端機視窗執行腳本,你必須確保 :file:`/usr/local/bin` 位於 shell 搜尋路徑" -"中。" -#: ../../using/mac.rst:80 -msgid "To run your script from the Finder you have two options:" -msgstr "從 Finder 執行你的腳本時,你有兩個選項:" +#: ../../using/mac.rst:165 +msgid "To run your script from the Finder, you can either:" +msgstr "從 Finder 執行你的腳本時,你可以:" -#: ../../using/mac.rst:82 +#: ../../using/mac.rst:167 msgid "Drag it to :program:`Python Launcher`." msgstr "把它拖曳到 :program:`Python Launcher`" -#: ../../using/mac.rst:84 +#: ../../using/mac.rst:169 msgid "" "Select :program:`Python Launcher` as the default application to open your " -"script (or any ``.py`` script) through the finder Info window and double-" +"script (or any ``.py`` script) through the Finder Info window and double-" "click it. :program:`Python Launcher` has various preferences to control how " "your script is launched. Option-dragging allows you to change these for one " -"invocation, or use its Preferences menu to change things globally." +"invocation, or use its ``Preferences`` menu to change things globally." msgstr "" -"透過 finder Info 視窗選擇 :program:`Python Launcher` 作為開啟腳本(或任何 ``." +"透過 Finder Info 視窗選擇 :program:`Python Launcher` 作為開啟腳本(或任何 ``." "py`` 腳本)的預設應用程式,然後雙擊腳本。:program:`Python Launcher` 有各種用" -"來控制腳本啟動方式的選項。拖曳選項可以讓你一次更改多個選項,或使用其偏好設定" -"選單以全域性地更改內容。" - -#: ../../using/mac.rst:94 -msgid "Running scripts with a GUI" -msgstr "透過 GUI 執行腳本" +"來控制腳本啟動方式的選項。拖曳選項可以讓你一次更改多個選項,或使用其 " +"``Preferences`` 選單以全域性地更改內容。" -#: ../../using/mac.rst:96 +#: ../../using/mac.rst:175 msgid "" -"With older versions of Python, there is one macOS quirk that you need to be " -"aware of: programs that talk to the Aqua window manager (in other words, " -"anything that has a GUI) need to be run in a special way. Use :program:" -"`pythonw` instead of :program:`python` to start such scripts." +"Be aware that running the script directly from the macOS Finder might " +"produce different results than when running from a terminal window as the " +"script will not be run in the usual shell environment including any setting " +"of environment variables in shell profiles. And, as with any other script or " +"program, be certain of what you are about to run." msgstr "" -"對於舊版本的 Python,你需要注意一個 macOS 的怪異之處:與 Aqua 視窗管理器溝通" -"的程式(換而言之,任何具有 GUI(圖形化使用者介面)的程式)需要以特殊方式執" -"行。使用 :program:`pythonw` 而不是 :program:`python` 來啟動這樣的腳本。" -#: ../../using/mac.rst:101 +#: ../../using/mac.rst:185 +msgid "Alternative Distributions" +msgstr "" + +#: ../../using/mac.rst:187 msgid "" -"With Python 3.9, you can use either :program:`python` or :program:`pythonw`." -msgstr "Python 3.9 上,你可以使用 :program:`python` 或者 :program:`pythonw`。" +"Besides the standard ``python.org`` for macOS installer, there are third-" +"party distributions for macOS that may include additional functionality. " +"Some popular distributions and their key features:" +msgstr "" -#: ../../using/mac.rst:105 -msgid "Configuration" -msgstr "設定" +#: ../../using/mac.rst:191 +msgid "`ActivePython <https://www.activestate.com/products/python/>`_" +msgstr "`ActivePython <https://www.activestate.com/products/python/>`_" -#: ../../using/mac.rst:107 +#: ../../using/mac.rst:192 +msgid "Installer with multi-platform compatibility, documentation" +msgstr "" + +#: ../../using/mac.rst:194 +msgid "`Anaconda <https://www.anaconda.com/download/>`_" +msgstr "`Anaconda <https://www.anaconda.com/download/>`_" + +#: ../../using/mac.rst:195 msgid "" -"Python on macOS honors all standard Unix environment variables such as :" -"envvar:`PYTHONPATH`, but setting these variables for programs started from " -"the Finder is non-standard as the Finder does not read your :file:`.profile` " -"or :file:`.cshrc` at startup. You need to create a file :file:`~/.MacOSX/" -"environment.plist`. See Apple's `Technical Q&A QA1067 <https://developer." -"apple.com/library/archive/qa/qa1067/_index.html>`__ for details." +"Popular scientific modules (such as numpy, scipy, and pandas) and the " +"``conda`` package manager." msgstr "" -"macOS 上的 Python 遵循所有標準的 Unix 環境變數,例如 :envvar:`PYTHONPATH`,但" -"是為 Finder 啟動的程式設定這些變數並非是標準做法,因為 Finder 在啟動時不會讀" -"取你的 :file:`.profile` 或 :file:`.cshrc`。你需要建立一個檔案 :file:`~/." -"MacOSX/environment.plist`。相關資訊請參閱 Apple 的\\ `技術問答集 QA1067 " -"<https://developer.apple.com/library/archive/qa/qa1067/_index.html>`__。" -#: ../../using/mac.rst:115 +#: ../../using/mac.rst:198 +msgid "`Homebrew <https://brew.sh>`_" +msgstr "`Homebrew <https://brew.sh>`_" + +#: ../../using/mac.rst:199 msgid "" -"For more information on installation Python packages, see section :ref:`mac-" -"package-manager`." -msgstr "更多關於安裝 Python 套件的資訊,參閱 :ref:`mac-package-manager` 部分。" +"Package manager for macOS including multiple versions of Python and many " +"third-party Python-based packages (including numpy, scipy, and pandas)." +msgstr "" -#: ../../using/mac.rst:122 -msgid "The IDE" -msgstr "整合化開發工具 (IDE)" +#: ../../using/mac.rst:202 +msgid "`MacPorts <https://www.macports.org>`_" +msgstr "`MacPorts <https://www.macports.org>`_" -#: ../../using/mac.rst:124 +#: ../../using/mac.rst:203 msgid "" -"Python ships with the standard IDLE development environment. A good " -"introduction to using IDLE can be found at https://www.hashcollision.org/hkn/" -"python/idle_intro/index.html." +"Another package manager for macOS including multiple versions of Python and " +"many third-party Python-based packages. May include pre-built versions of " +"Python and many packages for older versions of macOS." msgstr "" -"Python 附帶標準的 IDLE 開發環境。有關使用 IDLE 的詳細介紹,請見 https://www." -"hashcollision.org/hkn/python/idle_intro/index.html。" -#: ../../using/mac.rst:132 +#: ../../using/mac.rst:207 +msgid "" +"Note that distributions might not include the latest versions of Python or " +"other libraries, and are not maintained or supported by the core Python team." +msgstr "" + +#: ../../using/mac.rst:213 msgid "Installing Additional Python Packages" msgstr "安裝額外的 Python 套件" -#: ../../using/mac.rst:134 -msgid "This section has moved to the `Python Packaging User Guide`_." -msgstr "這個章節已經被移動到 `Python Packaging User Guide`_。" +#: ../../using/mac.rst:215 +msgid "Refer to the `Python Packaging User Guide`_ for more information." +msgstr "更多資訊請見 `Python Packaging User Guide`_。" -#: ../../using/mac.rst:142 +#: ../../using/mac.rst:225 msgid "GUI Programming" msgstr "開發 GUI 程式" -#: ../../using/mac.rst:144 +#: ../../using/mac.rst:227 msgid "" "There are several options for building GUI applications on the Mac with " "Python." msgstr "於 Mac 上使用 Python 來建立 GUI 應用程式有許多選項。" -#: ../../using/mac.rst:146 +#: ../../using/mac.rst:229 msgid "" -"*PyObjC* is a Python binding to Apple's Objective-C/Cocoa framework, which " -"is the foundation of most modern Mac development. Information on PyObjC is " -"available from :pypi:`pyobjc`." +"The standard Python GUI toolkit is :mod:`tkinter`, based on the cross-" +"platform Tk toolkit (https://www.tcl.tk). A macOS-native version of Tk is " +"included with the installer." msgstr "" -"*PyObjC* 是一個 Apple Objective-C/Cocoa 框架的 Python 繫結 (binding),這是大" -"多數現代 Mac 開發的基礎。有關 PyObjC 的資訊,請見 :pypi:`pyobjc`。" +"標準的 Python GUI 工具套件是基於跨平臺 Tk 工具套件 (https://www.tcl.tk) 的 :" +"mod:`tkinter`。macOS 原生版本的 Tk 有包含於安裝程式中。" -#: ../../using/mac.rst:150 +#: ../../using/mac.rst:233 msgid "" -"The standard Python GUI toolkit is :mod:`tkinter`, based on the cross-" -"platform Tk toolkit (https://www.tcl.tk). An Aqua-native version of Tk is " -"bundled with macOS by Apple, and the latest version can be downloaded and " -"installed from https://www.activestate.com; it can also be built from source." +"*PyObjC* is a Python binding to Apple's Objective-C/Cocoa framework. " +"Information on PyObjC is available from :pypi:`pyobjc`." msgstr "" -"標準的 Python GUI 工具套件是 :mod:`tkinter`,基於跨平臺的 Tk 工具套件 " -"(https://www.tcl.tk)。Apple 的 macOS 包含了 Aqua 原生版本的 Tk,最新版本可以" -"從 https://www.activestate.com 下載和安裝;它也可以從原始碼開始建置。" +"*PyObjC* 是一個 Apple Objective-C/Cocoa 框架的 Python 繫結 (binding)。有關 " +"PyObjC 的資訊請見 :pypi:`pyobjc`。" -#: ../../using/mac.rst:155 -msgid "A number of alternative macOS GUI toolkits are available:" -msgstr "有許多替代 macOS GUI 工具套件可用:" +#: ../../using/mac.rst:236 +msgid "A number of alternative macOS GUI toolkits are available including:" +msgstr "有許多替代 macOS GUI 工具套件可用,包含:" -#: ../../using/mac.rst:157 +#: ../../using/mac.rst:238 msgid "" -"`PySide <https://www.qt.io/qt-for-python>`__: Official Python bindings to " -"the `Qt GUI toolkit <https://www.qt.io>`__." +"`PySide <https://www.qt.io/qt-for-python>`_: Official Python bindings to the " +"`Qt GUI toolkit <https://wiki.qt.io/Qt_for_Python>`_." msgstr "" -"`PySide <https://www.qt.io/qt-for-python>`__:`Qt GUI 工具包 <https://www.qt." -"io>`__\\ 的官方 Python 繫結。" +"`PySide <https://www.qt.io/qt-for-python>`_:`Qt GUI 工具包 <https://wiki.qt." +"io/Qt_for_Python>`_\\ 的官方 Python 繫結。" -#: ../../using/mac.rst:160 +#: ../../using/mac.rst:241 msgid "" -"`PyQt <https://riverbankcomputing.com/software/pyqt/intro>`__: Alternative " -"Python bindings to Qt." +"`PyQt <https://riverbankcomputing.com/software/pyqt/>`_: Alternative Python " +"bindings to Qt." msgstr "" -"`PyQt <https://riverbankcomputing.com/software/pyqt/intro>`__:Qt 的替代 " -"Python 繫結。" +"`PyQt <https://riverbankcomputing.com/software/pyqt/>`_:Qt 的替代 Python 繫" +"結。" -#: ../../using/mac.rst:163 +#: ../../using/mac.rst:244 msgid "" -"`Kivy <https://kivy.org>`__: A cross-platform GUI toolkit that supports " +"`Kivy <https://kivy.org>`_: A cross-platform GUI toolkit that supports " "desktop and mobile platforms." msgstr "" -"`Kivy <https://kivy.org>`__:一個支援桌面和行動平臺的跨平臺 GUI 工具包。" +"`Kivy <https://kivy.org>`_:一個支援桌面和行動平臺的跨平臺 GUI 工具包。" -#: ../../using/mac.rst:166 +#: ../../using/mac.rst:247 msgid "" -"`Toga <https://toga.readthedocs.io>`__: Part of the `BeeWare Project " -"<https://beeware.org>`__; supports desktop, mobile, web and console apps." +"`Toga <https://toga.readthedocs.io>`_: Part of the `BeeWare Project <https://" +"beeware.org>`_; supports desktop, mobile, web and console apps." msgstr "" -"`Toga <https://toga.readthedocs.io>`__:`BeeWare 專案 <https://beeware." -"org>`__\\ 的一部分;支援桌面、行動、網頁和控制台應用程式。" +"`Toga <https://toga.readthedocs.io>`_:`BeeWare 專案 <https://beeware." +"org>`_\\ 的一部分;支援桌面、行動、網頁和控制台應用程式。" -#: ../../using/mac.rst:169 +#: ../../using/mac.rst:250 msgid "" -"`wxPython <https://www.wxpython.org>`__: A cross-platform toolkit that " -"supports desktop operating systems." +"`wxPython <https://wxpython.org>`_: A cross-platform toolkit that supports " +"desktop operating systems." msgstr "" -"`wxPython <https://www.wxpython.org>`__:一個支援桌面作業系統的跨平臺工具包。" +"`wxPython <https://wxpython.org>`_:一個支援桌面作業系統的跨平臺工具包。" -#: ../../using/mac.rst:175 +#: ../../using/mac.rst:255 +msgid "Advanced Topics" +msgstr "進階主題" + +#: ../../using/mac.rst:260 +msgid "Installing Free-threaded Binaries" +msgstr "" + +#: ../../using/mac.rst:262 +msgid "(Experimental)" +msgstr "" + +#: ../../using/mac.rst:266 +msgid "" +"Everything described in this section is considered experimental, and should " +"be expected to change in future releases." +msgstr "" + +#: ../../using/mac.rst:269 +msgid "" +"The ``python.org`` :ref:`Python for macOS <getting-and-installing-" +"macpython>` installer package can optionally install an additional build of " +"Python |usemac_x_dot_y| that supports :pep:`703`, the experimental free-" +"threading feature (running with the :term:`global interpreter lock` " +"disabled). Check the release page on ``python.org`` for possible updated " +"information." +msgstr "" + +#: ../../using/mac.rst:275 +msgid "" +"Because this feature is still considered experimental, the support for it is " +"not installed by default. It is packaged as a separate install option, " +"available by clicking the **Customize** button on the **Installation Type** " +"step of the installer as described above." +msgstr "" + +#: ../../using/mac.rst:282 +msgid "" +"If the box next to the **Free-threaded Python** package name is checked, a " +"separate :file:`PythonT.framework` will also be installed alongside the " +"normal :file:`Python.framework` in :file:`/Library/Frameworks`. This " +"configuration allows a free-threaded Python |usemac_x_dot_y| build to co-" +"exist on your system with a traditional (GIL only) Python |usemac_x_dot_y| " +"build with minimal risk while installing or testing. This installation " +"layout is itself experimental and is subject to change in future releases." +msgstr "" + +#: ../../using/mac.rst:290 +msgid "Known cautions and limitations:" +msgstr "" + +#: ../../using/mac.rst:292 +msgid "" +"The **UNIX command-line tools** package, which is selected by default, will " +"install links in :file:`/usr/local/bin` for |" +"usemac_python_x_dot_y_t_literal|, the free-threaded interpreter, and |" +"usemac_python_x_dot_y_t_literal_config|, a configuration utility which may " +"be useful for package builders. Since :file:`/usr/local/bin` is typically " +"included in your shell ``PATH``, in most cases no changes to your ``PATH`` " +"environment variables should be needed to use |" +"usemac_python_x_dot_y_t_literal|." +msgstr "" + +#: ../../using/mac.rst:300 +msgid "" +"For this release, the **Shell profile updater** package and the :file:" +"`Update Shell Profile.command` in |usemac_applications_folder_version| do " +"not support the free-threaded package." +msgstr "" + +#: ../../using/mac.rst:304 +msgid "" +"The free-threaded build and the traditional build have separate search paths " +"and separate :file:`site-packages` directories so, by default, if you need a " +"package available in both builds, it may need to be installed in both. The " +"free-threaded package will install a separate instance of :program:`pip` for " +"use with |usemac_python_x_dot_y_t_literal|." +msgstr "" + +#: ../../using/mac.rst:310 +msgid "To install a package using :command:`pip` without a :command:`venv`:" +msgstr "" + +#: ../../using/mac.rst:312 +msgid "|usemac_python_x_dot_y_t_literal| ``-m pip install <package_name>``" +msgstr "|usemac_python_x_dot_y_t_literal| ``-m pip install <package_name>``" + +#: ../../using/mac.rst:314 +msgid "" +"When working with multiple Python environments, it is usually safest and " +"easiest to :ref:`create and use virtual environments <tut-venv>`. This can " +"avoid possible command name conflicts and confusion about which Python is in " +"use:" +msgstr "" + +#: ../../using/mac.rst:318 +msgid "|usemac_python_x_dot_y_t_literal| ``-m venv <venv_name>``" +msgstr "|usemac_python_x_dot_y_t_literal| ``-m venv <venv_name>``" + +#: ../../using/mac.rst:320 +msgid "then :command:`activate`." +msgstr "然後 :command:`activate`。" + +#: ../../using/mac.rst:322 +msgid "To run a free-threaded version of IDLE:" +msgstr "執行 free-threaded(自由執行緒)版本的 IDLE:" + +#: ../../using/mac.rst:324 +msgid "|usemac_python_x_dot_y_t_literal| ``-m idlelib``" +msgstr "|usemac_python_x_dot_y_t_literal| ``-m idlelib``" + +#: ../../using/mac.rst:326 +msgid "" +"The interpreters in both builds respond to the same :ref:`PYTHON environment " +"variables <using-on-envvars>` which may have unexpected results, for " +"example, if you have ``PYTHONPATH`` set in a shell profile. If necessary, " +"there are :ref:`command line options <using-on-interface-options>` like ``-" +"E`` to ignore these environment variables." +msgstr "" + +#: ../../using/mac.rst:333 +msgid "" +"The free-threaded build links to the third-party shared libraries, such as " +"``OpenSSL`` and ``Tk``, installed in the traditional framework. This means " +"that both builds also share one set of trust certificates as installed by " +"the :command:`Install Certificates.command` script, thus it only needs to be " +"run once." +msgstr "" + +#: ../../using/mac.rst:339 +msgid "" +"If you cannot depend on the link in ``/usr/local/bin`` pointing to the " +"``python.org`` free-threaded |usemac_python_x_dot_y_t_literal| (for example, " +"if you want to install your own version there or some other distribution " +"does), you can explicitly set your shell ``PATH`` environment variable to " +"include the ``PythonT`` framework ``bin`` directory:" +msgstr "" + +#: ../../using/mac.rst:345 +msgid "" +"export PATH=\"/Library/Frameworks/PythonT.framework/Versions/3.13/bin\":" +"\"$PATH\"" +msgstr "" +"export PATH=\"/Library/Frameworks/PythonT.framework/Versions/3.13/bin\":" +"\"$PATH\"" + +#: ../../using/mac.rst:349 +msgid "" +"The traditional framework installation by default does something similar, " +"except for :file:`Python.framework`. Be aware that having both framework " +"``bin`` directories in ``PATH`` can lead to confusion if there are duplicate " +"names like ``python3.13`` in both; which one is actually used depends on the " +"order they appear in ``PATH``. The ``which python3.x`` or ``which python3." +"xt`` commands can show which path is being used. Using virtual environments " +"can help avoid such ambiguities. Another option might be to create a shell :" +"command:`alias` to the desired interpreter, like:" +msgstr "" + +#: ../../using/mac.rst:358 +msgid "" +"alias py3.13=\"/Library/Frameworks/Python.framework/Versions/3.13/bin/" +"python3.13\"\n" +"alias py3.13t=\"/Library/Frameworks/PythonT.framework/Versions/3.13/bin/" +"python3.13t\"" +msgstr "" +"alias py3.13=\"/Library/Frameworks/Python.framework/Versions/3.13/bin/" +"python3.13\"\n" +"alias py3.13t=\"/Library/Frameworks/PythonT.framework/Versions/3.13/bin/" +"python3.13t\"" + +#: ../../using/mac.rst:364 +msgid "Installing using the command line" +msgstr "使用命令列安裝" + +#: ../../using/mac.rst:366 +msgid "" +"If you want to use automation to install the ``python.org`` installer " +"package (rather than by using the familiar macOS :program:`Installer` GUI " +"app), the macOS command line :command:`installer` utility lets you select " +"non-default options, too. If you are not familiar with :command:`installer`, " +"it can be somewhat cryptic (see :command:`man installer` for more " +"information). As an example, the following shell snippet shows one way to do " +"it, using the ``3.13.0b2`` release and selecting the free-threaded " +"interpreter option:" +msgstr "" + +#: ../../using/mac.rst:375 +msgid "" +"RELEASE=\"python-3.13.0b2-macos11.pkg\"\n" +"\n" +"# download installer pkg\n" +"curl -O https://www.python.org/ftp/python/3.13.0/${RELEASE}\n" +"\n" +"# create installer choicechanges to customize the install:\n" +"# enable the PythonTFramework-3.13 package\n" +"# while accepting the other defaults (install all other packages)\n" +"cat > ./choicechanges.plist <<EOF\n" +"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +"<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple." +"com/DTDs/PropertyList-1.0.dtd\">\n" +"<plist version=\"1.0\">\n" +"<array>\n" +" <dict>\n" +" <key>attributeSetting</key>\n" +" <integer>1</integer>\n" +" <key>choiceAttribute</key>\n" +" <string>selected</string>\n" +" <key>choiceIdentifier</key>\n" +" <string>org.python.Python.PythonTFramework-3.13</string>\n" +" </dict>\n" +"</array>\n" +"</plist>\n" +"EOF\n" +"\n" +"sudo installer -pkg ./${RELEASE} -applyChoiceChangesXML ./choicechanges." +"plist -target /" +msgstr "" + +#: ../../using/mac.rst:405 +msgid "" +"You can then test that both installer builds are now available with " +"something like:" +msgstr "" + +#: ../../using/mac.rst:407 +msgid "" +"$ # test that the free-threaded interpreter was installed if the Unix " +"Command Tools package was enabled\n" +"$ /usr/local/bin/python3.13t -VV\n" +"Python 3.13.0b2 experimental free-threading build (v3.13.0b2:3a83b172af, " +"Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]\n" +"$ # and the traditional interpreter\n" +"$ /usr/local/bin/python3.13 -VV\n" +"Python 3.13.0b2 (v3.13.0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 " +"(clang-1500.3.9.4)]\n" +"$ # test that they are also available without the prefix if /usr/local/bin " +"is on $PATH\n" +"$ python3.13t -VV\n" +"Python 3.13.0b2 experimental free-threading build (v3.13.0b2:3a83b172af, " +"Jun 5 2024, 12:57:31) [Clang 15.0.0 (clang-1500.3.9.4)]\n" +"$ python3.13 -VV\n" +"Python 3.13.0b2 (v3.13.0b2:3a83b172af, Jun 5 2024, 12:50:24) [Clang 15.0.0 " +"(clang-1500.3.9.4)]" +msgstr "" + +#: ../../using/mac.rst:423 +msgid "" +"Current ``python.org`` installers only install to fixed locations like :file:" +"`/Library/Frameworks/`, :file:`/Applications`, and :file:`/usr/local/bin`. " +"You cannot use the :command:`installer` ``-domain`` option to install to " +"other locations." +msgstr "" + +#: ../../using/mac.rst:431 msgid "Distributing Python Applications" msgstr "發行 Python 應用程式" -#: ../../using/mac.rst:177 +#: ../../using/mac.rst:433 msgid "" "A range of tools exist for converting your Python code into a standalone " "distributable application:" msgstr "" -#: ../../using/mac.rst:180 +#: ../../using/mac.rst:436 msgid "" ":pypi:`py2app`: Supports creating macOS ``.app`` bundles from a Python " "project." msgstr ":pypi:`py2app`:支援從 Python 專案打包成 macOS ``.app``。" -#: ../../using/mac.rst:183 +#: ../../using/mac.rst:439 msgid "" -"`Briefcase <https://briefcase.readthedocs.io>`__: Part of the `BeeWare " -"Project <https://beeware.org>`__; a cross-platform packaging tool that " +"`Briefcase <https://briefcase.readthedocs.io>`_: Part of the `BeeWare " +"Project <https://beeware.org>`_; a cross-platform packaging tool that " "supports creation of ``.app`` bundles on macOS, as well as managing signing " "and notarization." msgstr "" +"`Briefcase <https://briefcase.readthedocs.io>`_:`BeeWare 專案 <https://" +"beeware.org>`__\\ 的一部分;支援建立 macOS ``.app`` 的跨平台打包工具,亦為管" +"理簽署和驗證 (notarization) 的工具。" -#: ../../using/mac.rst:188 +#: ../../using/mac.rst:444 msgid "" -"`PyInstaller <https://pyinstaller.org/>`__: A cross-platform packaging tool " +"`PyInstaller <https://pyinstaller.org/>`_: A cross-platform packaging tool " "that creates a single file or folder as a distributable artifact." msgstr "" -"`PyInstaller <https://pyinstaller.org/>`__:一個跨平臺打包工具,可以將單一檔" -"案或資料夾打包成可分發的檔案。" +"`PyInstaller <https://pyinstaller.org/>`_:一個跨平臺打包工具,可以將單一檔案" +"或資料夾打包成可分發的檔案。" -#: ../../using/mac.rst:192 -msgid "Other Resources" -msgstr "其他資源" +#: ../../using/mac.rst:448 +msgid "App Store Compliance" +msgstr "" -#: ../../using/mac.rst:194 +#: ../../using/mac.rst:450 msgid "" -"The Pythonmac-SIG mailing list is an excellent support resource for Python " -"users and developers on the Mac:" +"Apps submitted for distribution through the macOS App Store must pass " +"Apple's app review process. This process includes a set of automated " +"validation rules that inspect the submitted application bundle for " +"problematic code." msgstr "" -"Pythonmac-SIG 郵件清單對於 Mac 上的 Python 使用者和開發者是一個極佳的支援資" -"源:" -#: ../../using/mac.rst:197 -msgid "https://www.python.org/community/sigs/current/pythonmac-sig/" -msgstr "https://www.python.org/community/sigs/current/pythonmac-sig/" +#: ../../using/mac.rst:454 +msgid "" +"The Python standard library contains some code that is known to violate " +"these automated rules. While these violations appear to be false positives, " +"Apple's review rules cannot be challenged. Therefore, it is necessary to " +"modify the Python standard library for an app to pass App Store review." +msgstr "" -#: ../../using/mac.rst:199 -msgid "Another useful resource is the MacPython wiki:" -msgstr "另一個好用資源是 MacPython wiki:" +#: ../../using/mac.rst:459 +msgid "" +"The Python source tree contains :source:`a patch file <Mac/Resources/app-" +"store-compliance.patch>` that will remove all code that is known to cause " +"issues with the App Store review process. This patch is applied " +"automatically when CPython is configured with the :option:`--with-app-store-" +"compliance` option." +msgstr "" + +#: ../../using/mac.rst:465 +msgid "" +"This patch is not normally required to use CPython on a Mac; nor is it " +"required if you are distributing an app *outside* the macOS App Store. It is " +"*only* required if you are using the macOS App Store as a distribution " +"channel." +msgstr "" -#: ../../using/mac.rst:201 -msgid "https://wiki.python.org/moin/MacPython" -msgstr "https://wiki.python.org/moin/MacPython" +#: ../../using/mac.rst:470 +msgid "Other Resources" +msgstr "其他資源" + +#: ../../using/mac.rst:472 +msgid "" +"The `python.org Help page <https://www.python.org/about/help/>`_ has links " +"to many useful resources. The `Pythonmac-SIG mailing list <https://www." +"python.org/community/sigs/current/pythonmac-sig/>`_ is another support " +"resource specifically for Python users and developers on the Mac." +msgstr "" diff --git a/using/unix.po b/using/unix.po index c779d1f25a..ebbda0b865 100644 --- a/using/unix.po +++ b/using/unix.po @@ -5,7 +5,7 @@ # Matt Wang <mattwang44@gmail.com>, 2022-2023 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-09-01 22:24+0800\n" "PO-Revision-Date: 2023-03-27 12:40+0800\n" diff --git a/using/windows.po b/using/windows.po index a4ef897ace..a61e7c9881 100644 --- a/using/windows.po +++ b/using/windows.po @@ -6,9 +6,9 @@ # Liang-Bo Wang <me@liang2.tw>, 2015 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -235,12 +235,12 @@ msgid "" msgstr "" #: ../../using/windows.rst:133 ../../using/windows.rst:153 -#: ../../using/windows.rst:1082 +#: ../../using/windows.rst:1150 msgid "Name" msgstr "名稱" #: ../../using/windows.rst:133 ../../using/windows.rst:153 -#: ../../using/windows.rst:1082 +#: ../../using/windows.rst:1150 msgid "Description" msgstr "描述" @@ -682,30 +682,87 @@ msgid "" "`launcher`, which has its own entry in Programs and Features." msgstr "" -#: ../../using/windows.rst:314 +#: ../../using/windows.rst:313 +msgid "Installing Free-threaded Binaries" +msgstr "" + +#: ../../using/windows.rst:315 ../../using/windows.rst:501 +msgid "(Experimental)" +msgstr "" + +#: ../../using/windows.rst:319 ../../using/windows.rst:505 +msgid "" +"Everything described in this section is considered experimental, and should " +"be expected to change in future releases." +msgstr "" + +#: ../../using/windows.rst:322 +msgid "" +"To install pre-built binaries with free-threading enabled (see :pep:`703`), " +"you should select \"Customize installation\". The second page of options " +"includes the \"Download free-threaded binaries\" checkbox." +msgstr "" + +#: ../../using/windows.rst:328 +msgid "" +"Selecting this option will download and install additional binaries to the " +"same location as the main Python install. The main executable is called " +"``python3.13t.exe``, and other binaries either receive a ``t`` suffix or a " +"full ABI suffix. Python source files and bundled third-party dependencies " +"are shared with the main install." +msgstr "" + +#: ../../using/windows.rst:334 +msgid "" +"The free-threaded version is registered as a regular Python install with the " +"tag ``3.13t`` (with a ``-32`` or ``-arm64`` suffix as normal for those " +"platforms). This allows tools to discover it, and for the :ref:`launcher` to " +"support ``py.exe -3.13t``. Note that the launcher will interpret ``py.exe " +"-3`` (or a ``python3`` shebang) as \"the latest 3.x install\", which will " +"prefer the free-threaded binaries over the regular ones, while ``py.exe " +"-3.13`` will not. If you use the short style of option, you may prefer to " +"not install the free-threaded binaries at this time." +msgstr "" + +#: ../../using/windows.rst:343 +msgid "" +"To specify the install option at the command line, use " +"``Include_freethreaded=1``. See :ref:`install-layout-option` for " +"instructions on pre-emptively downloading the additional binaries for " +"offline install. The options to include debug symbols and binaries also " +"apply to the free-threaded builds." +msgstr "" + +#: ../../using/windows.rst:349 +msgid "" +"Free-threaded binaries are also available :ref:`on nuget.org <windows-" +"nuget>`." +msgstr "" + +#: ../../using/windows.rst:354 msgid "The Microsoft Store package" msgstr "" -#: ../../using/windows.rst:318 +#: ../../using/windows.rst:358 msgid "" "The Microsoft Store package is an easily installable Python interpreter that " "is intended mainly for interactive use, for example, by students." msgstr "" -#: ../../using/windows.rst:321 +#: ../../using/windows.rst:361 msgid "" "To install the package, ensure you have the latest Windows 10 updates and " "search the Microsoft Store app for \"Python |version|\". Ensure that the app " "you select is published by the Python Software Foundation, and install it." msgstr "" -#: ../../using/windows.rst:326 +#: ../../using/windows.rst:366 msgid "" "Python will always be available for free on the Microsoft Store. If you are " "asked to pay for it, you have not selected the correct package." msgstr "" -#: ../../using/windows.rst:329 +#: ../../using/windows.rst:369 msgid "" "After installation, Python may be launched by finding it in Start. " "Alternatively, it will be available from any Command Prompt or PowerShell " @@ -713,7 +770,7 @@ msgid "" "``pip`` or ``idle``. IDLE can also be found in Start." msgstr "" -#: ../../using/windows.rst:334 +#: ../../using/windows.rst:374 msgid "" "All three commands are also available with version number suffixes, for " "example, as ``python3.exe`` and ``python3.x.exe`` as well as ``python.exe`` " @@ -724,13 +781,13 @@ msgid "" "of ``python`` is selected." msgstr "" -#: ../../using/windows.rst:342 +#: ../../using/windows.rst:382 msgid "" "Virtual environments can be created with ``python -m venv`` and activated " "and used as normal." msgstr "" -#: ../../using/windows.rst:345 +#: ../../using/windows.rst:385 msgid "" "If you have installed another version of Python and added it to your " "``PATH`` variable, it will be available as ``python.exe`` rather than the " @@ -738,13 +795,13 @@ msgid "" "exe`` or ``python3.x.exe``." msgstr "" -#: ../../using/windows.rst:350 +#: ../../using/windows.rst:390 msgid "" "The ``py.exe`` launcher will detect this Python installation, but will " "prefer installations from the traditional installer." msgstr "" -#: ../../using/windows.rst:353 +#: ../../using/windows.rst:393 msgid "" "To remove Python, open Settings and use Apps and Features, or else find " "Python in Start and right-click to select Uninstall. Uninstalling will " @@ -752,15 +809,15 @@ msgid "" "but will not remove any virtual environments" msgstr "" -#: ../../using/windows.rst:359 +#: ../../using/windows.rst:399 msgid "Known issues" msgstr "" -#: ../../using/windows.rst:362 +#: ../../using/windows.rst:402 msgid "Redirection of local data, registry, and temporary paths" msgstr "" -#: ../../using/windows.rst:364 +#: ../../using/windows.rst:404 msgid "" "Because of restrictions on Microsoft Store apps, Python scripts may not have " "full write access to shared locations such as :envvar:`TEMP` and the " @@ -768,7 +825,7 @@ msgid "" "modify the shared locations, you will need to install the full installer." msgstr "" -#: ../../using/windows.rst:369 +#: ../../using/windows.rst:409 msgid "" "At runtime, Python will use a private copy of well-known Windows folders and " "the registry. For example, if the environment variable :envvar:`%APPDATA%` " @@ -779,7 +836,7 @@ msgid "" "\\`." msgstr "" -#: ../../using/windows.rst:374 +#: ../../using/windows.rst:414 msgid "" "When reading files, Windows will return the file from the private folder, or " "if that does not exist, the real Windows directory. For example reading :" @@ -788,13 +845,13 @@ msgid "" "\\WindowsApps\\\\package_name\\\\VFS\\\\SystemX86`." msgstr "" -#: ../../using/windows.rst:378 +#: ../../using/windows.rst:418 msgid "" "You can find the real path of any existing file using :func:`os.path." "realpath`:" msgstr "" -#: ../../using/windows.rst:380 +#: ../../using/windows.rst:420 msgid "" ">>> import os\n" ">>> test_file = 'C:\\\\Users\\\\example\\\\AppData\\\\Local\\\\test.txt'\n" @@ -810,30 +867,30 @@ msgstr "" "\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\\\LocalCache\\\\Local\\" "\\test.txt'" -#: ../../using/windows.rst:387 +#: ../../using/windows.rst:427 msgid "When writing to the Windows Registry, the following behaviors exist:" msgstr "" -#: ../../using/windows.rst:389 +#: ../../using/windows.rst:429 msgid "" "Reading from ``HKLM\\\\Software`` is allowed and results are merged with " "the :file:`registry.dat` file in the package." msgstr "" -#: ../../using/windows.rst:390 +#: ../../using/windows.rst:430 msgid "" "Writing to ``HKLM\\\\Software`` is not allowed if the corresponding key/" "value exists, i.e. modifying existing keys." msgstr "" -#: ../../using/windows.rst:391 +#: ../../using/windows.rst:431 msgid "" "Writing to ``HKLM\\\\Software`` is allowed as long as a corresponding key/" "value does not exist in the package and the user has the correct access " "permissions." msgstr "" -#: ../../using/windows.rst:394 +#: ../../using/windows.rst:434 msgid "" "For more detail on the technical basis for these limitations, please consult " "Microsoft's documentation on packaged full-trust apps, currently available " @@ -842,11 +899,11 @@ msgid "" "behind-the-scenes>`_" msgstr "" -#: ../../using/windows.rst:403 +#: ../../using/windows.rst:443 msgid "The nuget.org packages" msgstr "nuget.org 套件" -#: ../../using/windows.rst:407 +#: ../../using/windows.rst:447 msgid "" "The nuget.org package is a reduced size Python environment intended for use " "on continuous integration and build systems that do not have a system-wide " @@ -854,14 +911,14 @@ msgid "" "works perfectly fine for packages containing build-time tools." msgstr "" -#: ../../using/windows.rst:412 +#: ../../using/windows.rst:452 msgid "" "Visit `nuget.org <https://www.nuget.org/>`_ for the most up-to-date " "information on using nuget. What follows is a summary that is sufficient for " "Python developers." msgstr "" -#: ../../using/windows.rst:416 +#: ../../using/windows.rst:456 msgid "" "The ``nuget.exe`` command line tool may be downloaded directly from " "``https://aka.ms/nugetclidl``, for example, using curl or PowerShell. With " @@ -869,7 +926,7 @@ msgid "" "installed using::" msgstr "" -#: ../../using/windows.rst:421 +#: ../../using/windows.rst:461 msgid "" "nuget.exe install python -ExcludeVersion -OutputDirectory .\n" "nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory ." @@ -877,7 +934,7 @@ msgstr "" "nuget.exe install python -ExcludeVersion -OutputDirectory .\n" "nuget.exe install pythonx86 -ExcludeVersion -OutputDirectory ." -#: ../../using/windows.rst:424 +#: ../../using/windows.rst:464 msgid "" "To select a particular version, add a ``-Version 3.x.y``. The output " "directory may be changed from ``.``, and the package will be installed into " @@ -887,7 +944,7 @@ msgid "" "directory that contains the Python installation:" msgstr "" -#: ../../using/windows.rst:431 +#: ../../using/windows.rst:471 msgid "" "# Without -ExcludeVersion\n" "> .\\python.3.5.2\\tools\\python.exe -V\n" @@ -905,7 +962,7 @@ msgstr "" "> .\\python\\tools\\python.exe -V\n" "Python 3.5.2" -#: ../../using/windows.rst:441 +#: ../../using/windows.rst:481 msgid "" "In general, nuget packages are not upgradeable, and newer versions should be " "installed side-by-side and referenced using the full path. Alternatively, " @@ -913,7 +970,7 @@ msgid "" "will do this automatically if they do not preserve files between builds." msgstr "" -#: ../../using/windows.rst:446 +#: ../../using/windows.rst:486 msgid "" "Alongside the ``tools`` directory is a ``build\\native`` directory. This " "contains a MSBuild properties file ``python.props`` that can be used in a C+" @@ -921,26 +978,42 @@ msgid "" "automatically use the headers and import libraries in your build." msgstr "" -#: ../../using/windows.rst:451 +#: ../../using/windows.rst:491 msgid "" "The package information pages on nuget.org are `www.nuget.org/packages/" -"python <https://www.nuget.org/packages/python>`_ for the 64-bit version and " +"python <https://www.nuget.org/packages/python>`_ for the 64-bit version, " "`www.nuget.org/packages/pythonx86 <https://www.nuget.org/packages/" -"pythonx86>`_ for the 32-bit version." +"pythonx86>`_ for the 32-bit version, and `www.nuget.org/packages/pythonarm64 " +"<https://www.nuget.org/packages/pythonarm64>`_ for the ARM64 version" msgstr "" -#: ../../using/windows.rst:460 +#: ../../using/windows.rst:499 +msgid "Free-threaded packages" +msgstr "" + +#: ../../using/windows.rst:508 +msgid "" +"Packages containing free-threaded binaries are named `python-freethreaded " +"<https://www.nuget.org/packages/python-freethreaded>`_ for the 64-bit " +"version, `pythonx86-freethreaded <https://www.nuget.org/packages/pythonx86-" +"freethreaded>`_ for the 32-bit version, and `pythonarm64-freethreaded " +"<https://www.nuget.org/packages/pythonarm64-freethreaded>`_ for the ARM64 " +"version. These packages contain both the ``python3.13t.exe`` and ``python." +"exe`` entry points, both of which run free threaded." +msgstr "" + +#: ../../using/windows.rst:520 msgid "The embeddable package" msgstr "" -#: ../../using/windows.rst:464 +#: ../../using/windows.rst:524 msgid "" "The embedded distribution is a ZIP file containing a minimal Python " "environment. It is intended for acting as part of another application, " "rather than being directly accessed by end-users." msgstr "" -#: ../../using/windows.rst:468 +#: ../../using/windows.rst:528 msgid "" "When extracted, the embedded distribution is (almost) fully isolated from " "the user's system, including environment variables, system registry " @@ -951,7 +1024,7 @@ msgid "" "documentation are not included." msgstr "" -#: ../../using/windows.rst:477 +#: ../../using/windows.rst:537 msgid "" "The embedded distribution does not include the `Microsoft C Runtime <https://" "docs.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist#visual-" @@ -961,7 +1034,7 @@ msgid "" "and can be detected by finding ``ucrtbase.dll`` in the system directory." msgstr "" -#: ../../using/windows.rst:484 +#: ../../using/windows.rst:544 msgid "" "Third-party packages should be installed by the application installer " "alongside the embedded distribution. Using pip to manage dependencies as for " @@ -972,16 +1045,16 @@ msgid "" "compatibility with newer versions before providing updates to users." msgstr "" -#: ../../using/windows.rst:492 +#: ../../using/windows.rst:552 msgid "" "The two recommended use cases for this distribution are described below." msgstr "" -#: ../../using/windows.rst:495 +#: ../../using/windows.rst:555 msgid "Python Application" msgstr "" -#: ../../using/windows.rst:497 +#: ../../using/windows.rst:557 msgid "" "An application written in Python does not necessarily require users to be " "aware of that fact. The embedded distribution may be used in this case to " @@ -990,7 +1063,7 @@ msgid "" "there are two options." msgstr "" -#: ../../using/windows.rst:503 +#: ../../using/windows.rst:563 msgid "" "Using a specialized executable as a launcher requires some coding, but " "provides the most transparent experience for users. With a customized " @@ -1001,7 +1074,7 @@ msgid "" "line." msgstr "" -#: ../../using/windows.rst:510 +#: ../../using/windows.rst:570 msgid "" "The simpler approach is to provide a batch file or generated shortcut that " "directly calls the ``python.exe`` or ``pythonw.exe`` with the required " @@ -1010,7 +1083,7 @@ msgid "" "from other running Python processes or file associations." msgstr "" -#: ../../using/windows.rst:516 +#: ../../using/windows.rst:576 msgid "" "With the latter approach, packages should be installed as directories " "alongside the Python executable to ensure they are available on the path. " @@ -1019,11 +1092,11 @@ msgid "" "application." msgstr "" -#: ../../using/windows.rst:522 +#: ../../using/windows.rst:582 msgid "Embedding Python" msgstr "嵌入 Python" -#: ../../using/windows.rst:524 +#: ../../using/windows.rst:584 msgid "" "Applications written in native code often require some form of scripting " "language, and the embedded Python distribution can be used for this purpose. " @@ -1034,7 +1107,7 @@ msgid "" "interpreter." msgstr "" -#: ../../using/windows.rst:531 +#: ../../using/windows.rst:591 msgid "" "As with the application use, packages can be installed to any location as " "there is an opportunity to specify search paths before initializing the " @@ -1042,46 +1115,46 @@ msgid "" "the embedded distribution and a regular installation." msgstr "" -#: ../../using/windows.rst:538 +#: ../../using/windows.rst:598 msgid "Alternative bundles" msgstr "" -#: ../../using/windows.rst:540 +#: ../../using/windows.rst:600 msgid "" "Besides the standard CPython distribution, there are modified packages " "including additional functionality. The following is a list of popular " "versions and their key features:" msgstr "" -#: ../../using/windows.rst:544 +#: ../../using/windows.rst:604 msgid "`ActivePython <https://www.activestate.com/products/python/>`_" msgstr "`ActivePython <https://www.activestate.com/products/python/>`_" -#: ../../using/windows.rst:545 +#: ../../using/windows.rst:605 msgid "Installer with multi-platform compatibility, documentation, PyWin32" msgstr "" -#: ../../using/windows.rst:547 +#: ../../using/windows.rst:607 msgid "`Anaconda <https://www.anaconda.com/download/>`_" msgstr "`Anaconda <https://www.anaconda.com/download/>`_" -#: ../../using/windows.rst:548 +#: ../../using/windows.rst:608 msgid "" "Popular scientific modules (such as numpy, scipy and pandas) and the " "``conda`` package manager." msgstr "" -#: ../../using/windows.rst:551 +#: ../../using/windows.rst:611 msgid "" "`Enthought Deployment Manager <https://assets.enthought.com/downloads/edm/>`_" msgstr "" "`Enthought Deployment Manager <https://assets.enthought.com/downloads/edm/>`_" -#: ../../using/windows.rst:552 +#: ../../using/windows.rst:612 msgid "\"The Next Generation Python Environment and Package Manager\"." msgstr "" -#: ../../using/windows.rst:554 +#: ../../using/windows.rst:614 msgid "" "Previously Enthought provided Canopy, but it `reached end of life in 2016 " "<https://support.enthought.com/hc/en-us/articles/360038600051-Canopy-GUI-end-" @@ -1089,27 +1162,27 @@ msgid "" "Code>`_." msgstr "" -#: ../../using/windows.rst:557 +#: ../../using/windows.rst:617 msgid "`WinPython <https://winpython.github.io/>`_" msgstr "`WinPython <https://winpython.github.io/>`_" -#: ../../using/windows.rst:558 +#: ../../using/windows.rst:618 msgid "" "Windows-specific distribution with prebuilt scientific packages and tools " "for building packages." msgstr "" -#: ../../using/windows.rst:561 +#: ../../using/windows.rst:621 msgid "" "Note that these packages may not include the latest versions of Python or " "other libraries, and are not maintained or supported by the core Python team." msgstr "" -#: ../../using/windows.rst:567 +#: ../../using/windows.rst:627 msgid "Configuring Python" msgstr "設定 Python" -#: ../../using/windows.rst:569 +#: ../../using/windows.rst:629 msgid "" "To run Python conveniently from a command prompt, you might consider " "changing some default environment variables in Windows. While the installer " @@ -1118,23 +1191,23 @@ msgid "" "use multiple versions of Python, consider using the :ref:`launcher`." msgstr "" -#: ../../using/windows.rst:579 +#: ../../using/windows.rst:639 msgid "Excursus: Setting environment variables" msgstr "" -#: ../../using/windows.rst:581 +#: ../../using/windows.rst:641 msgid "" "Windows allows environment variables to be configured permanently at both " "the User level and the System level, or temporarily in a command prompt." msgstr "" -#: ../../using/windows.rst:584 +#: ../../using/windows.rst:644 msgid "" "To temporarily set environment variables, open Command Prompt and use the :" "command:`set` command:" msgstr "" -#: ../../using/windows.rst:587 +#: ../../using/windows.rst:647 msgid "" "C:\\>set PATH=C:\\Program Files\\Python 3.9;%PATH%\n" "C:\\>set PYTHONPATH=%PYTHONPATH%;C:\\My_python_lib\n" @@ -1144,13 +1217,13 @@ msgstr "" "C:\\>set PYTHONPATH=%PYTHONPATH%;C:\\My_python_lib\n" "C:\\>python" -#: ../../using/windows.rst:593 +#: ../../using/windows.rst:653 msgid "" "These changes will apply to any further commands executed in that console, " "and will be inherited by any applications started from the console." msgstr "" -#: ../../using/windows.rst:596 +#: ../../using/windows.rst:656 msgid "" "Including the variable name within percent signs will expand to the existing " "value, allowing you to add your new value at either the start or the end. " @@ -1159,7 +1232,7 @@ msgid "" "launched." msgstr "" -#: ../../using/windows.rst:602 +#: ../../using/windows.rst:662 msgid "" "To permanently modify the default environment variables, click Start and " "search for 'edit environment variables', or open System properties, :" @@ -1169,20 +1242,20 @@ msgid "" "your machine (i.e. Administrator rights)." msgstr "" -#: ../../using/windows.rst:611 +#: ../../using/windows.rst:671 msgid "" "Windows will concatenate User variables *after* System variables, which may " "cause unexpected results when modifying :envvar:`PATH`." msgstr "" -#: ../../using/windows.rst:614 +#: ../../using/windows.rst:674 msgid "" "The :envvar:`PYTHONPATH` variable is used by all versions of Python, so you " "should not permanently configure it unless the listed paths only include " "code that is compatible with all of your installed Python versions." msgstr "" -#: ../../using/windows.rst:621 +#: ../../using/windows.rst:681 msgid "" "https://docs.microsoft.com/en-us/windows/win32/procthread/environment-" "variables" @@ -1190,11 +1263,11 @@ msgstr "" "https://docs.microsoft.com/en-us/windows/win32/procthread/environment-" "variables" -#: ../../using/windows.rst:622 +#: ../../using/windows.rst:682 msgid "Overview of environment variables on Windows" msgstr "Windows 上的環境變數概要" -#: ../../using/windows.rst:624 +#: ../../using/windows.rst:684 msgid "" "https://docs.microsoft.com/en-us/windows-server/administration/windows-" "commands/set_1" @@ -1202,11 +1275,11 @@ msgstr "" "https://docs.microsoft.com/en-us/windows-server/administration/windows-" "commands/set_1" -#: ../../using/windows.rst:625 +#: ../../using/windows.rst:685 msgid "The ``set`` command, for temporarily modifying environment variables" msgstr "" -#: ../../using/windows.rst:627 +#: ../../using/windows.rst:687 msgid "" "https://docs.microsoft.com/en-us/windows-server/administration/windows-" "commands/setx" @@ -1214,22 +1287,22 @@ msgstr "" "https://docs.microsoft.com/en-us/windows-server/administration/windows-" "commands/setx" -#: ../../using/windows.rst:628 +#: ../../using/windows.rst:688 msgid "The ``setx`` command, for permanently modifying environment variables" msgstr "" -#: ../../using/windows.rst:634 +#: ../../using/windows.rst:694 msgid "Finding the Python executable" msgstr "" -#: ../../using/windows.rst:638 +#: ../../using/windows.rst:698 msgid "" "Besides using the automatically created start menu entry for the Python " "interpreter, you might want to start Python in the command prompt. The " "installer has an option to set that up for you." msgstr "" -#: ../../using/windows.rst:642 +#: ../../using/windows.rst:702 msgid "" "On the first page of the installer, an option labelled \"Add Python to " "PATH\" may be selected to have the installer add the install location into " @@ -1240,7 +1313,7 @@ msgid "" "documentation." msgstr "" -#: ../../using/windows.rst:649 +#: ../../using/windows.rst:709 msgid "" "If you don't enable this option at install time, you can always re-run the " "installer, select Modify, and enable it. Alternatively, you can manually " @@ -1251,28 +1324,28 @@ msgid "" "entries already existed)::" msgstr "" -#: ../../using/windows.rst:657 +#: ../../using/windows.rst:717 msgid "C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\Program Files\\Python 3.9" msgstr "C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\Program Files\\Python 3.9" -#: ../../using/windows.rst:662 +#: ../../using/windows.rst:722 msgid "UTF-8 mode" msgstr "UTF-8 模式" -#: ../../using/windows.rst:666 +#: ../../using/windows.rst:726 msgid "" "Windows still uses legacy encodings for the system encoding (the ANSI Code " "Page). Python uses it for the default encoding of text files (e.g. :func:" "`locale.getencoding`)." msgstr "" -#: ../../using/windows.rst:670 +#: ../../using/windows.rst:730 msgid "" "This may cause issues because UTF-8 is widely used on the internet and most " "Unix systems, including WSL (Windows Subsystem for Linux)." msgstr "" -#: ../../using/windows.rst:673 +#: ../../using/windows.rst:733 msgid "" "You can use the :ref:`Python UTF-8 Mode <utf8-mode>` to change the default " "text encoding to UTF-8. You can enable the :ref:`Python UTF-8 Mode <utf8-" @@ -1281,13 +1354,13 @@ msgid "" "and :ref:`setting-envvars` for how to modify environment variables." msgstr "" -#: ../../using/windows.rst:679 +#: ../../using/windows.rst:739 msgid "" "When the :ref:`Python UTF-8 Mode <utf8-mode>` is enabled, you can still use " "the system encoding (the ANSI Code Page) via the \"mbcs\" codec." msgstr "" -#: ../../using/windows.rst:682 +#: ../../using/windows.rst:742 msgid "" "Note that adding ``PYTHONUTF8=1`` to the default environment variables will " "affect all Python 3.7+ applications on your system. If you have any Python " @@ -1296,27 +1369,27 @@ msgid "" "utf8`` command line option." msgstr "" -#: ../../using/windows.rst:689 +#: ../../using/windows.rst:749 msgid "" "Even when UTF-8 mode is disabled, Python uses UTF-8 by default on Windows " "for:" msgstr "" -#: ../../using/windows.rst:692 +#: ../../using/windows.rst:752 msgid "Console I/O including standard I/O (see :pep:`528` for details)." msgstr "" -#: ../../using/windows.rst:693 +#: ../../using/windows.rst:753 msgid "" "The :term:`filesystem encoding <filesystem encoding and error handler>` " "(see :pep:`529` for details)." msgstr "" -#: ../../using/windows.rst:700 +#: ../../using/windows.rst:760 msgid "Python Launcher for Windows" msgstr "" -#: ../../using/windows.rst:704 +#: ../../using/windows.rst:764 msgid "" "The Python launcher for Windows is a utility which aids in locating and " "executing of different Python versions. It allows scripts (or the command-" @@ -1324,7 +1397,7 @@ msgid "" "locate and execute that version." msgstr "" -#: ../../using/windows.rst:709 +#: ../../using/windows.rst:769 msgid "" "Unlike the :envvar:`PATH` variable, the launcher will correctly select the " "most appropriate version of Python. It will prefer per-user installations " @@ -1332,19 +1405,19 @@ msgid "" "most recently installed version." msgstr "" -#: ../../using/windows.rst:714 +#: ../../using/windows.rst:774 msgid "The launcher was originally specified in :pep:`397`." msgstr "" -#: ../../using/windows.rst:717 +#: ../../using/windows.rst:777 msgid "Getting started" msgstr "開始" -#: ../../using/windows.rst:720 +#: ../../using/windows.rst:780 msgid "From the command-line" msgstr "" -#: ../../using/windows.rst:724 +#: ../../using/windows.rst:784 msgid "" "System-wide installations of Python 3.3 and later will put the launcher on " "your :envvar:`PATH`. The launcher is compatible with all available versions " @@ -1352,62 +1425,62 @@ msgid "" "the launcher is available, execute the following command in Command Prompt::" msgstr "" -#: ../../using/windows.rst:729 +#: ../../using/windows.rst:789 msgid "py" msgstr "py" -#: ../../using/windows.rst:731 +#: ../../using/windows.rst:791 msgid "" "You should find that the latest version of Python you have installed is " "started - it can be exited as normal, and any additional command-line " "arguments specified will be sent directly to Python." msgstr "" -#: ../../using/windows.rst:735 +#: ../../using/windows.rst:795 msgid "" "If you have multiple versions of Python installed (e.g., 3.7 and |version|) " "you will have noticed that Python |version| was started - to launch Python " "3.7, try the command::" msgstr "" -#: ../../using/windows.rst:739 +#: ../../using/windows.rst:799 msgid "py -3.7" msgstr "py -3.7" -#: ../../using/windows.rst:741 +#: ../../using/windows.rst:801 msgid "" "If you want the latest version of Python 2 you have installed, try the " "command::" msgstr "" -#: ../../using/windows.rst:744 +#: ../../using/windows.rst:804 msgid "py -2" msgstr "py -2" -#: ../../using/windows.rst:746 +#: ../../using/windows.rst:806 msgid "" "If you see the following error, you do not have the launcher installed::" msgstr "" -#: ../../using/windows.rst:748 +#: ../../using/windows.rst:808 msgid "" "'py' is not recognized as an internal or external command,\n" "operable program or batch file." msgstr "" -#: ../../using/windows.rst:751 +#: ../../using/windows.rst:811 msgid "The command::" msgstr "指令: ::" -#: ../../using/windows.rst:753 +#: ../../using/windows.rst:813 msgid "py --list" msgstr "py --list" -#: ../../using/windows.rst:755 +#: ../../using/windows.rst:815 msgid "displays the currently installed version(s) of Python." msgstr "" -#: ../../using/windows.rst:757 +#: ../../using/windows.rst:817 msgid "" "The ``-x.y`` argument is the short form of the ``-V:Company/Tag`` argument, " "which allows selecting a specific Python runtime, including those that may " @@ -1416,14 +1489,14 @@ msgid "" "available runtimes using the ``-V:`` format." msgstr "" -#: ../../using/windows.rst:763 +#: ../../using/windows.rst:823 msgid "" "When using the ``-V:`` argument, specifying the Company will limit selection " "to runtimes from that provider, while specifying only the Tag will select " "from all providers. Note that omitting the slash implies a tag::" msgstr "" -#: ../../using/windows.rst:767 +#: ../../using/windows.rst:827 msgid "" "# Select any '3.*' tagged runtime\n" "py -V:3\n" @@ -1435,14 +1508,14 @@ msgid "" "py -V:PythonCore/3" msgstr "" -#: ../../using/windows.rst:776 +#: ../../using/windows.rst:836 msgid "" "The short form of the argument (``-3``) only ever selects from core Python " "releases, and not other distributions. However, the longer form (``-V:3``) " "will select from any." msgstr "" -#: ../../using/windows.rst:780 +#: ../../using/windows.rst:840 msgid "" "The Company is matched on the full string, case-insenitive. The Tag is " "matched oneither the full string, or a prefix, provided the next character " @@ -1451,11 +1524,11 @@ msgid "" "``3.1``), but are compared using text (``-V:3.01`` does not match ``3.1``)." msgstr "" -#: ../../using/windows.rst:788 +#: ../../using/windows.rst:848 msgid "Virtual environments" msgstr "虛擬環境(Virtual environment)" -#: ../../using/windows.rst:792 +#: ../../using/windows.rst:852 msgid "" "If the launcher is run with no explicit Python version specification, and a " "virtual environment (created with the standard library :mod:`venv` module or " @@ -1465,17 +1538,17 @@ msgid "" "specify the global Python version." msgstr "" -#: ../../using/windows.rst:800 +#: ../../using/windows.rst:860 msgid "From a script" msgstr "" -#: ../../using/windows.rst:802 +#: ../../using/windows.rst:862 msgid "" "Let's create a test Python script - create a file called ``hello.py`` with " "the following contents" msgstr "" -#: ../../using/windows.rst:805 +#: ../../using/windows.rst:865 msgid "" "#! python\n" "import sys\n" @@ -1485,25 +1558,25 @@ msgstr "" "import sys\n" "sys.stdout.write(\"hello from Python %s\\n\" % (sys.version,))" -#: ../../using/windows.rst:811 +#: ../../using/windows.rst:871 msgid "From the directory in which hello.py lives, execute the command::" msgstr "" -#: ../../using/windows.rst:813 +#: ../../using/windows.rst:873 msgid "py hello.py" msgstr "py hello.py" -#: ../../using/windows.rst:815 +#: ../../using/windows.rst:875 msgid "" "You should notice the version number of your latest Python 2.x installation " "is printed. Now try changing the first line to be:" msgstr "" -#: ../../using/windows.rst:818 +#: ../../using/windows.rst:878 msgid "#! python3" msgstr "#! python3" -#: ../../using/windows.rst:822 +#: ../../using/windows.rst:882 msgid "" "Re-executing the command should now print the latest Python 3.x information. " "As with the above command-line examples, you can specify a more explicit " @@ -1512,7 +1585,7 @@ msgid "" "information printed." msgstr "" -#: ../../using/windows.rst:828 +#: ../../using/windows.rst:888 msgid "" "Note that unlike interactive use, a bare \"python\" will use the latest " "version of Python 2.x that you have installed. This is for backward " @@ -1520,11 +1593,11 @@ msgid "" "typically refers to Python 2." msgstr "" -#: ../../using/windows.rst:834 +#: ../../using/windows.rst:894 msgid "From file associations" msgstr "從檔案關聯" -#: ../../using/windows.rst:836 +#: ../../using/windows.rst:896 msgid "" "The launcher should have been associated with Python files (i.e. ``.py``, ``." "pyw``, ``.pyc`` files) when it was installed. This means that when you " @@ -1533,17 +1606,17 @@ msgid "" "have the script specify the version which should be used." msgstr "" -#: ../../using/windows.rst:842 +#: ../../using/windows.rst:902 msgid "" "The key benefit of this is that a single launcher can support multiple " "Python versions at the same time depending on the contents of the first line." msgstr "" -#: ../../using/windows.rst:846 +#: ../../using/windows.rst:906 msgid "Shebang Lines" msgstr "" -#: ../../using/windows.rst:848 +#: ../../using/windows.rst:908 msgid "" "If the first line of a script file starts with ``#!``, it is known as a " "\"shebang\" line. Linux and other Unix like operating systems have native " @@ -1553,70 +1626,80 @@ msgid "" "demonstrate their use." msgstr "" -#: ../../using/windows.rst:855 +#: ../../using/windows.rst:915 msgid "" "To allow shebang lines in Python scripts to be portable between Unix and " "Windows, this launcher supports a number of 'virtual' commands to specify " "which interpreter to use. The supported virtual commands are:" msgstr "" -#: ../../using/windows.rst:859 +#: ../../using/windows.rst:919 msgid "``/usr/bin/env``" msgstr "``/usr/bin/env``" -#: ../../using/windows.rst:860 +#: ../../using/windows.rst:920 msgid "``/usr/bin/python``" msgstr "``/usr/bin/python``" -#: ../../using/windows.rst:861 +#: ../../using/windows.rst:921 msgid "``/usr/local/bin/python``" msgstr "``/usr/local/bin/python``" -#: ../../using/windows.rst:862 +#: ../../using/windows.rst:922 msgid "``python``" msgstr "``python``" -#: ../../using/windows.rst:864 +#: ../../using/windows.rst:924 msgid "For example, if the first line of your script starts with" msgstr "" -#: ../../using/windows.rst:866 +#: ../../using/windows.rst:926 msgid "#! /usr/bin/python" msgstr "#! /usr/bin/python" -#: ../../using/windows.rst:870 +#: ../../using/windows.rst:930 msgid "" -"The default Python will be located and used. As many Python scripts written " -"to work on Unix will already have this line, you should find these scripts " -"can be used by the launcher without modification. If you are writing a new " -"script on Windows which you hope will be useful on Unix, you should use one " -"of the shebang lines starting with ``/usr``." +"The default Python or an active virtual environment will be located and " +"used. As many Python scripts written to work on Unix will already have this " +"line, you should find these scripts can be used by the launcher without " +"modification. If you are writing a new script on Windows which you hope will " +"be useful on Unix, you should use one of the shebang lines starting with ``/" +"usr``." msgstr "" -#: ../../using/windows.rst:876 +#: ../../using/windows.rst:936 msgid "" "Any of the above virtual commands can be suffixed with an explicit version " "(either just the major version, or the major and minor version). Furthermore " "the 32-bit version can be requested by adding \"-32\" after the minor " "version. I.e. ``/usr/bin/python3.7-32`` will request usage of the 32-bit " -"python 3.7." +"Python 3.7. If a virtual environment is active, the version will be ignored " +"and the environment will be used." msgstr "" -#: ../../using/windows.rst:884 +#: ../../using/windows.rst:945 msgid "" "Beginning with python launcher 3.7 it is possible to request 64-bit version " "by the \"-64\" suffix. Furthermore it is possible to specify a major and " "architecture without minor (i.e. ``/usr/bin/python3-64``)." msgstr "" -#: ../../using/windows.rst:890 +#: ../../using/windows.rst:951 msgid "" "The \"-64\" suffix is deprecated, and now implies \"any architecture that is " "not provably i386/32-bit\". To request a specific environment, use the new :" "samp:`-V:{TAG}` argument with the complete tag." msgstr "" -#: ../../using/windows.rst:894 +#: ../../using/windows.rst:957 +msgid "" +"Virtual commands referencing ``python`` now prefer an active virtual " +"environment rather than searching :envvar:`PATH`. This handles cases where " +"the shebang specifies ``/usr/bin/env python3`` but :file:`python3.exe` is " +"not present in the active environment." +msgstr "" + +#: ../../using/windows.rst:962 msgid "" "The ``/usr/bin/env`` form of shebang line has one further special property. " "Before looking for installed Python interpreters, this form will search the " @@ -1630,7 +1713,7 @@ msgid "" "of :envvar:`PATH`." msgstr "" -#: ../../using/windows.rst:905 +#: ../../using/windows.rst:973 msgid "" "Shebang lines that do not match any of these patterns are looked up in the " "``[commands]`` section of the launcher's :ref:`.INI file <launcher-ini>`. " @@ -1641,7 +1724,7 @@ msgid "" "part of the filename)." msgstr "" -#: ../../using/windows.rst:913 +#: ../../using/windows.rst:981 msgid "" "[commands]\n" "/bin/xpython=C:\\Program Files\\XPython\\python.exe" @@ -1649,7 +1732,7 @@ msgstr "" "[commands]\n" "/bin/xpython=C:\\Program Files\\XPython\\python.exe" -#: ../../using/windows.rst:918 +#: ../../using/windows.rst:986 msgid "" "Any commands not found in the .INI file are treated as **Windows** " "executable paths that are absolute or relative to the directory containing " @@ -1660,33 +1743,33 @@ msgid "" "will be appended." msgstr "" -#: ../../using/windows.rst:927 +#: ../../using/windows.rst:995 msgid "Arguments in shebang lines" msgstr "" -#: ../../using/windows.rst:929 +#: ../../using/windows.rst:997 msgid "" "The shebang lines can also specify additional options to be passed to the " "Python interpreter. For example, if you have a shebang line:" msgstr "" -#: ../../using/windows.rst:932 +#: ../../using/windows.rst:1000 msgid "#! /usr/bin/python -v" msgstr "#! /usr/bin/python -v" -#: ../../using/windows.rst:936 +#: ../../using/windows.rst:1004 msgid "Then Python will be started with the ``-v`` option" msgstr "" -#: ../../using/windows.rst:939 +#: ../../using/windows.rst:1007 msgid "Customization" msgstr "" -#: ../../using/windows.rst:944 +#: ../../using/windows.rst:1012 msgid "Customization via INI files" msgstr "" -#: ../../using/windows.rst:946 +#: ../../using/windows.rst:1014 msgid "" "Two .ini files will be searched by the launcher - ``py.ini`` in the current " "user's application data directory (``%LOCALAPPDATA%`` or ``$env:" @@ -1695,7 +1778,7 @@ msgid "" "e. py.exe) and for the 'windows' version (i.e. pyw.exe)." msgstr "" -#: ../../using/windows.rst:952 +#: ../../using/windows.rst:1020 msgid "" "Customization specified in the \"application directory\" will have " "precedence over the one next to the executable, so a user, who may not have " @@ -1703,11 +1786,11 @@ msgid "" "that global .ini file." msgstr "" -#: ../../using/windows.rst:957 +#: ../../using/windows.rst:1025 msgid "Customizing default Python versions" msgstr "" -#: ../../using/windows.rst:959 +#: ../../using/windows.rst:1027 msgid "" "In some cases, a version qualifier can be included in a command to dictate " "which version of Python will be used by the command. A version qualifier " @@ -1717,13 +1800,13 @@ msgid "" "\"-32\" or \"-64\"." msgstr "" -#: ../../using/windows.rst:965 +#: ../../using/windows.rst:1033 msgid "" "For example, a shebang line of ``#!python`` has no version qualifier, while " "``#!python3`` has a version qualifier which specifies only a major version." msgstr "" -#: ../../using/windows.rst:968 +#: ../../using/windows.rst:1036 msgid "" "If no version qualifiers are found in a command, the environment variable :" "envvar:`PY_PYTHON` can be set to specify the default version qualifier. If " @@ -1733,7 +1816,7 @@ msgid "" "launcher included with Python 3.7 or newer.)" msgstr "" -#: ../../using/windows.rst:975 +#: ../../using/windows.rst:1043 msgid "" "If no minor version qualifiers are found, the environment variable " "``PY_PYTHON{major}`` (where ``{major}`` is the current major version " @@ -1744,7 +1827,7 @@ msgid "" "version in that family." msgstr "" -#: ../../using/windows.rst:983 +#: ../../using/windows.rst:1051 msgid "" "On 64-bit Windows with both 32-bit and 64-bit implementations of the same " "(major.minor) Python version installed, the 64-bit version will always be " @@ -1758,30 +1841,30 @@ msgid "" "suffix can be used on a version specifier to change this behaviour." msgstr "" -#: ../../using/windows.rst:994 +#: ../../using/windows.rst:1062 msgid "Examples:" msgstr "範例:" -#: ../../using/windows.rst:996 +#: ../../using/windows.rst:1064 msgid "" "If no relevant options are set, the commands ``python`` and ``python2`` will " "use the latest Python 2.x version installed and the command ``python3`` will " "use the latest Python 3.x installed." msgstr "" -#: ../../using/windows.rst:1000 +#: ../../using/windows.rst:1068 msgid "" "The command ``python3.7`` will not consult any options at all as the " "versions are fully specified." msgstr "" -#: ../../using/windows.rst:1003 +#: ../../using/windows.rst:1071 msgid "" "If ``PY_PYTHON=3``, the commands ``python`` and ``python3`` will both use " "the latest installed Python 3 version." msgstr "" -#: ../../using/windows.rst:1006 +#: ../../using/windows.rst:1074 msgid "" "If ``PY_PYTHON=3.7-32``, the command ``python`` will use the 32-bit " "implementation of 3.7 whereas the command ``python3`` will use the latest " @@ -1789,13 +1872,13 @@ msgid "" "specified.)" msgstr "" -#: ../../using/windows.rst:1011 +#: ../../using/windows.rst:1079 msgid "" "If ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7``, the commands ``python`` and " "``python3`` will both use specifically 3.7" msgstr "" -#: ../../using/windows.rst:1014 +#: ../../using/windows.rst:1082 msgid "" "In addition to environment variables, the same settings can be configured in " "the .INI file used by the launcher. The section in the INI file is called " @@ -1805,15 +1888,15 @@ msgid "" "will override things specified in the INI file." msgstr "" -#: ../../using/windows.rst:1021 +#: ../../using/windows.rst:1089 msgid "For example:" msgstr "舉例來說:" -#: ../../using/windows.rst:1023 +#: ../../using/windows.rst:1091 msgid "Setting ``PY_PYTHON=3.7`` is equivalent to the INI file containing:" msgstr "" -#: ../../using/windows.rst:1025 +#: ../../using/windows.rst:1093 msgid "" "[defaults]\n" "python=3.7" @@ -1821,13 +1904,13 @@ msgstr "" "[defaults]\n" "python=3.7" -#: ../../using/windows.rst:1030 +#: ../../using/windows.rst:1098 msgid "" "Setting ``PY_PYTHON=3`` and ``PY_PYTHON3=3.7`` is equivalent to the INI file " "containing:" msgstr "" -#: ../../using/windows.rst:1033 +#: ../../using/windows.rst:1101 msgid "" "[defaults]\n" "python=3\n" @@ -1837,11 +1920,11 @@ msgstr "" "python=3\n" "python3=3.7" -#: ../../using/windows.rst:1040 +#: ../../using/windows.rst:1108 msgid "Diagnostics" msgstr "" -#: ../../using/windows.rst:1042 +#: ../../using/windows.rst:1110 msgid "" "If an environment variable :envvar:`PYLAUNCHER_DEBUG` is set (to any value), " "the launcher will print diagnostic information to stderr (i.e. to the " @@ -1851,11 +1934,11 @@ msgid "" "the target Python. It is primarily intended for testing and debugging." msgstr "" -#: ../../using/windows.rst:1050 +#: ../../using/windows.rst:1118 msgid "Dry Run" msgstr "" -#: ../../using/windows.rst:1052 +#: ../../using/windows.rst:1120 msgid "" "If an environment variable :envvar:`PYLAUNCHER_DRYRUN` is set (to any " "value), the launcher will output the command it would have run, but will not " @@ -1865,11 +1948,11 @@ msgid "" "correctly in the console." msgstr "" -#: ../../using/windows.rst:1060 +#: ../../using/windows.rst:1128 msgid "Install on demand" msgstr "安裝隨選" -#: ../../using/windows.rst:1062 +#: ../../using/windows.rst:1130 msgid "" "If an environment variable :envvar:`PYLAUNCHER_ALLOW_INSTALL` is set (to any " "value), and the requested Python version is not installed but is available " @@ -1878,7 +1961,7 @@ msgid "" "again." msgstr "" -#: ../../using/windows.rst:1067 +#: ../../using/windows.rst:1135 msgid "" "An additional :envvar:`PYLAUNCHER_ALWAYS_INSTALL` variable causes the " "launcher to always try to install Python, even if it is detected. This is " @@ -1886,137 +1969,137 @@ msgid "" "`PYLAUNCHER_DRYRUN`)." msgstr "" -#: ../../using/windows.rst:1072 +#: ../../using/windows.rst:1140 msgid "Return codes" msgstr "" -#: ../../using/windows.rst:1074 +#: ../../using/windows.rst:1142 msgid "" "The following exit codes may be returned by the Python launcher. " "Unfortunately, there is no way to distinguish these from the exit code of " "Python itself." msgstr "" -#: ../../using/windows.rst:1077 +#: ../../using/windows.rst:1145 msgid "" "The names of codes are as used in the sources, and are only for reference. " "There is no way to access or resolve them apart from reading this page. " "Entries are listed in alphabetical order of names." msgstr "" -#: ../../using/windows.rst:1082 +#: ../../using/windows.rst:1150 msgid "Value" msgstr "" -#: ../../using/windows.rst:1084 +#: ../../using/windows.rst:1152 msgid "RC_BAD_VENV_CFG" msgstr "RC_BAD_VENV_CFG" -#: ../../using/windows.rst:1084 +#: ../../using/windows.rst:1152 msgid "107" msgstr "107" -#: ../../using/windows.rst:1084 +#: ../../using/windows.rst:1152 msgid "A :file:`pyvenv.cfg` was found but is corrupt." msgstr "" -#: ../../using/windows.rst:1086 +#: ../../using/windows.rst:1154 msgid "RC_CREATE_PROCESS" msgstr "RC_CREATE_PROCESS" -#: ../../using/windows.rst:1086 +#: ../../using/windows.rst:1154 msgid "101" msgstr "101" -#: ../../using/windows.rst:1086 +#: ../../using/windows.rst:1154 msgid "Failed to launch Python." msgstr "" -#: ../../using/windows.rst:1088 +#: ../../using/windows.rst:1156 msgid "RC_INSTALLING" msgstr "RC_INSTALLING" -#: ../../using/windows.rst:1088 +#: ../../using/windows.rst:1156 msgid "111" msgstr "111" -#: ../../using/windows.rst:1088 +#: ../../using/windows.rst:1156 msgid "" "An install was started, but the command will need to be re-run after it " "completes." msgstr "" -#: ../../using/windows.rst:1091 +#: ../../using/windows.rst:1159 msgid "RC_INTERNAL_ERROR" msgstr "RC_INTERNAL_ERROR" -#: ../../using/windows.rst:1091 +#: ../../using/windows.rst:1159 msgid "109" msgstr "109" -#: ../../using/windows.rst:1091 +#: ../../using/windows.rst:1159 msgid "Unexpected error. Please report a bug." msgstr "" -#: ../../using/windows.rst:1093 +#: ../../using/windows.rst:1161 msgid "RC_NO_COMMANDLINE" msgstr "RC_NO_COMMANDLINE" -#: ../../using/windows.rst:1093 +#: ../../using/windows.rst:1161 msgid "108" msgstr "108" -#: ../../using/windows.rst:1093 +#: ../../using/windows.rst:1161 msgid "Unable to obtain command line from the operating system." msgstr "" -#: ../../using/windows.rst:1096 +#: ../../using/windows.rst:1164 msgid "RC_NO_PYTHON" msgstr "RC_NO_PYTHON" -#: ../../using/windows.rst:1096 +#: ../../using/windows.rst:1164 msgid "103" msgstr "103" -#: ../../using/windows.rst:1096 +#: ../../using/windows.rst:1164 msgid "Unable to locate the requested version." msgstr "" -#: ../../using/windows.rst:1098 +#: ../../using/windows.rst:1166 msgid "RC_NO_VENV_CFG" msgstr "RC_NO_VENV_CFG" -#: ../../using/windows.rst:1098 +#: ../../using/windows.rst:1166 msgid "106" msgstr "106" -#: ../../using/windows.rst:1098 +#: ../../using/windows.rst:1166 msgid "A :file:`pyvenv.cfg` was required but not found." msgstr "" -#: ../../using/windows.rst:1106 +#: ../../using/windows.rst:1174 msgid "Finding modules" msgstr "找尋模組" -#: ../../using/windows.rst:1108 +#: ../../using/windows.rst:1176 msgid "" "These notes supplement the description at :ref:`sys-path-init` with detailed " "Windows notes." msgstr "" -#: ../../using/windows.rst:1111 +#: ../../using/windows.rst:1179 msgid "" "When no ``._pth`` file is found, this is how :data:`sys.path` is populated " "on Windows:" msgstr "" -#: ../../using/windows.rst:1114 +#: ../../using/windows.rst:1182 msgid "" "An empty entry is added at the start, which corresponds to the current " "directory." msgstr "" -#: ../../using/windows.rst:1117 +#: ../../using/windows.rst:1185 msgid "" "If the environment variable :envvar:`PYTHONPATH` exists, as described in :" "ref:`using-on-envvars`, its entries are added next. Note that on Windows, " @@ -2024,7 +2107,7 @@ msgid "" "from the colon used in drive identifiers (``C:\\`` etc.)." msgstr "" -#: ../../using/windows.rst:1122 +#: ../../using/windows.rst:1190 msgid "" "Additional \"application paths\" can be added in the registry as subkeys of :" "samp:`\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\{version}\\\\PythonPath` under " @@ -2034,7 +2117,7 @@ msgid "" "installers only use HKLM, so HKCU is typically empty.)" msgstr "" -#: ../../using/windows.rst:1129 +#: ../../using/windows.rst:1197 msgid "" "If the environment variable :envvar:`PYTHONHOME` is set, it is assumed as " "\"Python Home\". Otherwise, the path of the main Python executable is used " @@ -2045,31 +2128,31 @@ msgid "" "PythonPath stored in the registry." msgstr "" -#: ../../using/windows.rst:1137 +#: ../../using/windows.rst:1205 msgid "" "If the Python Home cannot be located, no :envvar:`PYTHONPATH` is specified " "in the environment, and no registry entries can be found, a default path " "with relative entries is used (e.g. ``.\\Lib;.\\plat-win``, etc)." msgstr "" -#: ../../using/windows.rst:1141 +#: ../../using/windows.rst:1209 msgid "" "If a ``pyvenv.cfg`` file is found alongside the main executable or in the " "directory one level above the executable, the following variations apply:" msgstr "" -#: ../../using/windows.rst:1144 +#: ../../using/windows.rst:1212 msgid "" "If ``home`` is an absolute path and :envvar:`PYTHONHOME` is not set, this " "path is used instead of the path to the main executable when deducing the " "home location." msgstr "" -#: ../../using/windows.rst:1148 +#: ../../using/windows.rst:1216 msgid "The end result of all this is:" msgstr "最終這所有的結果為:" -#: ../../using/windows.rst:1150 +#: ../../using/windows.rst:1218 msgid "" "When running :file:`python.exe`, or any other .exe in the main Python " "directory (either an installed version, or directly from the PCbuild " @@ -2077,7 +2160,7 @@ msgid "" "ignored. Other \"application paths\" in the registry are always read." msgstr "" -#: ../../using/windows.rst:1155 +#: ../../using/windows.rst:1223 msgid "" "When Python is hosted in another .exe (different directory, embedded via " "COM, etc), the \"Python Home\" will not be deduced, so the core path from " @@ -2085,20 +2168,20 @@ msgid "" "always read." msgstr "" -#: ../../using/windows.rst:1159 +#: ../../using/windows.rst:1227 msgid "" "If Python can't find its home and there are no registry value (frozen .exe, " "some very strange installation setup) you get a path with some default, but " "relative, paths." msgstr "" -#: ../../using/windows.rst:1163 +#: ../../using/windows.rst:1231 msgid "" "For those who want to bundle Python into their application or distribution, " "the following advice will prevent conflicts with other installations:" msgstr "" -#: ../../using/windows.rst:1166 +#: ../../using/windows.rst:1234 msgid "" "Include a ``._pth`` file alongside your executable containing the " "directories to include. This will ignore paths listed in the registry and " @@ -2106,20 +2189,20 @@ msgid "" "listed." msgstr "" -#: ../../using/windows.rst:1171 +#: ../../using/windows.rst:1239 msgid "" "If you are loading :file:`python3.dll` or :file:`python37.dll` in your own " -"executable, explicitly call :c:func:`Py_SetPath` or (at least) :c:func:" -"`Py_SetProgramName` before :c:func:`Py_Initialize`." +"executable, explicitly set :c:member:`PyConfig.module_search_paths` before :" +"c:func:`Py_InitializeFromConfig`." msgstr "" -#: ../../using/windows.rst:1175 +#: ../../using/windows.rst:1243 msgid "" "Clear and/or overwrite :envvar:`PYTHONPATH` and set :envvar:`PYTHONHOME` " "before launching :file:`python.exe` from your application." msgstr "" -#: ../../using/windows.rst:1178 +#: ../../using/windows.rst:1246 msgid "" "If you cannot use the previous suggestions (for example, you are a " "distribution that allows people to run :file:`python.exe` directly), ensure " @@ -2128,7 +2211,7 @@ msgid "" "correctly named ZIP file will be detected instead.)" msgstr "" -#: ../../using/windows.rst:1184 +#: ../../using/windows.rst:1252 msgid "" "These will ensure that the files in a system-wide installation will not take " "precedence over the copy of the standard library bundled with your " @@ -2138,19 +2221,19 @@ msgid "" "packages." msgstr "" -#: ../../using/windows.rst:1192 +#: ../../using/windows.rst:1260 msgid "" "Add ``._pth`` file support and removes ``applocal`` option from ``pyvenv." "cfg``." msgstr "" -#: ../../using/windows.rst:1197 +#: ../../using/windows.rst:1265 msgid "" "Add :file:`python{XX}.zip` as a potential landmark when directly adjacent to " "the executable." msgstr "" -#: ../../using/windows.rst:1202 +#: ../../using/windows.rst:1270 msgid "" "Modules specified in the registry under ``Modules`` (not ``PythonPath``) may " "be imported by :class:`importlib.machinery.WindowsRegistryFinder`. This " @@ -2158,87 +2241,87 @@ msgid "" "explicitly added to :data:`sys.meta_path` in the future." msgstr "" -#: ../../using/windows.rst:1208 +#: ../../using/windows.rst:1276 msgid "Additional modules" msgstr "額外的模組" -#: ../../using/windows.rst:1210 +#: ../../using/windows.rst:1278 msgid "" "Even though Python aims to be portable among all platforms, there are " "features that are unique to Windows. A couple of modules, both in the " "standard library and external, and snippets exist to use these features." msgstr "" -#: ../../using/windows.rst:1214 +#: ../../using/windows.rst:1282 msgid "" "The Windows-specific standard modules are documented in :ref:`mswin-specific-" "services`." msgstr "" -#: ../../using/windows.rst:1218 +#: ../../using/windows.rst:1286 msgid "PyWin32" msgstr "PyWin32" -#: ../../using/windows.rst:1220 +#: ../../using/windows.rst:1288 msgid "" "The :pypi:`PyWin32` module by Mark Hammond is a collection of modules for " "advanced Windows-specific support. This includes utilities for:" msgstr "" -#: ../../using/windows.rst:1224 +#: ../../using/windows.rst:1292 msgid "" "`Component Object Model <https://docs.microsoft.com/en-us/windows/win32/com/" "component-object-model--com--portal>`_ (COM)" msgstr "" -#: ../../using/windows.rst:1227 +#: ../../using/windows.rst:1295 msgid "Win32 API calls" msgstr "Win32 API 呼叫" -#: ../../using/windows.rst:1228 +#: ../../using/windows.rst:1296 msgid "Registry" msgstr "登錄檔(Registry)" -#: ../../using/windows.rst:1229 +#: ../../using/windows.rst:1297 msgid "Event log" msgstr "事件日誌(Event log)" -#: ../../using/windows.rst:1230 +#: ../../using/windows.rst:1298 msgid "" "`Microsoft Foundation Classes <https://docs.microsoft.com/en-us/cpp/mfc/mfc-" "desktop-applications>`_ (MFC) user interfaces" msgstr "" -#: ../../using/windows.rst:1234 +#: ../../using/windows.rst:1302 msgid "" "`PythonWin <https://web.archive.org/web/20060524042422/ https://www.python." "org/windows/pythonwin/>`_ is a sample MFC application shipped with PyWin32. " "It is an embeddable IDE with a built-in debugger." msgstr "" -#: ../../using/windows.rst:1240 +#: ../../using/windows.rst:1308 msgid "" "`Win32 How Do I...? <https://timgolden.me.uk/python/win32_how_do_i.html>`_" msgstr "" "`Win32 How Do I...? <https://timgolden.me.uk/python/win32_how_do_i.html>`_" -#: ../../using/windows.rst:1241 +#: ../../using/windows.rst:1309 msgid "by Tim Golden" msgstr "由 Tim Golden 所著" -#: ../../using/windows.rst:1243 +#: ../../using/windows.rst:1311 msgid "`Python and COM <https://www.boddie.org.uk/python/COM.html>`_" msgstr "`Python and COM <https://www.boddie.org.uk/python/COM.html>`_" -#: ../../using/windows.rst:1244 +#: ../../using/windows.rst:1312 msgid "by David and Paul Boddie" msgstr "由 David 與 Paul Boddie 所著" -#: ../../using/windows.rst:1248 +#: ../../using/windows.rst:1316 msgid "cx_Freeze" msgstr "cx_Freeze" -#: ../../using/windows.rst:1250 +#: ../../using/windows.rst:1318 msgid "" "`cx_Freeze <https://cx-freeze.readthedocs.io/en/latest/>`_ wraps Python " "scripts into executable Windows programs (:file:`{*}.exe` files). When you " @@ -2246,11 +2329,11 @@ msgid "" "users to install Python." msgstr "" -#: ../../using/windows.rst:1257 +#: ../../using/windows.rst:1325 msgid "Compiling Python on Windows" msgstr "編譯 Python 在 Windows" -#: ../../using/windows.rst:1259 +#: ../../using/windows.rst:1327 msgid "" "If you want to compile CPython yourself, first thing you should do is get " "the `source <https://www.python.org/downloads/source/>`_. You can download " @@ -2258,48 +2341,48 @@ msgid "" "devguide.python.org/setup/#get-the-source-code>`_." msgstr "" -#: ../../using/windows.rst:1264 +#: ../../using/windows.rst:1332 msgid "" "The source tree contains a build solution and project files for Microsoft " "Visual Studio, which is the compiler used to build the official Python " "releases. These files are in the :file:`PCbuild` directory." msgstr "" -#: ../../using/windows.rst:1268 +#: ../../using/windows.rst:1336 msgid "" "Check :file:`PCbuild/readme.txt` for general information on the build " "process." msgstr "" -#: ../../using/windows.rst:1270 +#: ../../using/windows.rst:1338 msgid "For extension modules, consult :ref:`building-on-windows`." msgstr "" -#: ../../using/windows.rst:1274 +#: ../../using/windows.rst:1342 msgid "Other Platforms" msgstr "其他平台" -#: ../../using/windows.rst:1276 +#: ../../using/windows.rst:1344 msgid "" "With ongoing development of Python, some platforms that used to be supported " "earlier are no longer supported (due to the lack of users or developers). " "Check :pep:`11` for details on all unsupported platforms." msgstr "" -#: ../../using/windows.rst:1280 +#: ../../using/windows.rst:1348 msgid "" "`Windows CE <https://pythonce.sourceforge.net/>`_ is `no longer supported " "<https://github.com/python/cpython/issues/71542>`__ since Python 3 (if it " "ever was)." msgstr "" -#: ../../using/windows.rst:1283 +#: ../../using/windows.rst:1351 msgid "" "The `Cygwin <https://cygwin.com/>`_ installer offers to install the `Python " "interpreter <https://cygwin.com/packages/summary/python3.html>`__ as well" msgstr "" -#: ../../using/windows.rst:1287 +#: ../../using/windows.rst:1355 msgid "" "See `Python for Windows <https://www.python.org/downloads/windows/>`_ for " "detailed information about platforms with pre-compiled installers." diff --git a/whatsnew/2.0.po b/whatsnew/2.0.po index 55883349f0..a8df302c59 100644 --- a/whatsnew/2.0.po +++ b/whatsnew/2.0.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1494,10 +1494,10 @@ msgstr "模組變更" msgid "" "Lots of improvements and bugfixes were made to Python's extensive standard " "library; some of the affected modules include :mod:`readline`, :mod:" -"`ConfigParser <configparser>`, :mod:`cgi`, :mod:`calendar`, :mod:`posix`, :" -"mod:`readline`, :mod:`!xmllib`, :mod:`aifc`, :mod:`chunk` :mod:`wave`, :mod:" -"`random`, :mod:`shelve`, and :mod:`nntplib`. Consult the CVS logs for the " -"exact patch-by-patch details." +"`ConfigParser <configparser>`, :mod:`!cgi`, :mod:`calendar`, :mod:`posix`, :" +"mod:`readline`, :mod:`!xmllib`, :mod:`!aifc`, :mod:`!chunk`, :mod:`wave`, :" +"mod:`random`, :mod:`shelve`, and :mod:`!nntplib`. Consult the CVS logs for " +"the exact patch-by-patch details." msgstr "" #: ../../whatsnew/2.0.rst:1037 diff --git a/whatsnew/2.1.po b/whatsnew/2.1.po index 3816f61629..72d4b9a90d 100644 --- a/whatsnew/2.1.po +++ b/whatsnew/2.1.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -705,9 +705,9 @@ msgstr "" #: ../../whatsnew/2.1.rst:445 msgid "" "The dictionary containing attributes can be accessed as the function's :attr:" -"`~object.__dict__`. Unlike the :attr:`~object.__dict__` attribute of class " +"`~function.__dict__`. Unlike the :attr:`~type.__dict__` attribute of class " "instances, in functions you can actually assign a new dictionary to :attr:" -"`~object.__dict__`, though the new value is restricted to a regular Python " +"`~function.__dict__`, though the new value is restricted to a regular Python " "dictionary; you *can't* be tricky and set it to a :class:`!UserDict` " "instance, or any other random object that behaves like a mapping." msgstr "" diff --git a/whatsnew/2.2.po b/whatsnew/2.2.po index 2c65027bdb..440d72550b 100644 --- a/whatsnew/2.2.po +++ b/whatsnew/2.2.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -266,8 +266,8 @@ msgid ":attr:`~definition.__name__` is the attribute's name." msgstr ":attr:`~definition.__name__` 是屬性的名稱。" #: ../../whatsnew/2.2.rst:174 -msgid ":attr:`!__doc__` is the attribute's docstring." -msgstr ":attr:`!__doc__` 是屬性的文件字串 (docstring)。" +msgid ":attr:`~definition.__doc__` is the attribute's docstring." +msgstr ":attr:`~definition.__doc__` 是屬性的文件字串 (docstring)。" #: ../../whatsnew/2.2.rst:176 msgid "" @@ -298,17 +298,17 @@ msgstr "" #: ../../whatsnew/2.2.rst:189 msgid "" -"For methods, :meth:`!descriptor.__get__` returns a temporary object that's " -"callable, and wraps up the instance and the method to be called on it. This " -"is also why static methods and class methods are now possible; they have " -"descriptors that wrap up just the method, or the method and the class. As a " -"brief explanation of these new kinds of methods, static methods aren't " -"passed the instance, and therefore resemble regular functions. Class " -"methods are passed the class of the object, but not the object itself. " -"Static and class methods are defined like this::" +"For methods, :meth:`descriptor.__get__ <object.__get__>` returns a temporary " +"object that's callable, and wraps up the instance and the method to be " +"called on it. This is also why static methods and class methods are now " +"possible; they have descriptors that wrap up just the method, or the method " +"and the class. As a brief explanation of these new kinds of methods, static " +"methods aren't passed the instance, and therefore resemble regular " +"functions. Class methods are passed the class of the object, but not the " +"object itself. Static and class methods are defined like this::" msgstr "" -#: ../../whatsnew/2.2.rst:198 +#: ../../whatsnew/2.2.rst:199 msgid "" "class C(object):\n" " def f(arg1, arg2):\n" @@ -319,8 +319,16 @@ msgid "" " ...\n" " g = classmethod(g)" msgstr "" +"class C(object):\n" +" def f(arg1, arg2):\n" +" ...\n" +" f = staticmethod(f)\n" +"\n" +" def g(cls, arg1, arg2):\n" +" ...\n" +" g = classmethod(g)" -#: ../../whatsnew/2.2.rst:207 +#: ../../whatsnew/2.2.rst:208 msgid "" "The :func:`staticmethod` function takes the function :func:`!f`, and returns " "it wrapped up in a descriptor so it can be stored in the class object. You " @@ -329,7 +337,7 @@ msgid "" "has been defined yet; that's been left for future versions of Python." msgstr "" -#: ../../whatsnew/2.2.rst:213 +#: ../../whatsnew/2.2.rst:214 msgid "" "More new features, such as slots and properties, are also implemented as new " "kinds of descriptors, and it's not difficult to write a descriptor class " @@ -339,7 +347,7 @@ msgid "" "defined like this::" msgstr "" -#: ../../whatsnew/2.2.rst:220 +#: ../../whatsnew/2.2.rst:221 msgid "" "from eiffel import eiffelmethod\n" "\n" @@ -357,7 +365,7 @@ msgid "" " f = eiffelmethod(f, pre_f, post_f)" msgstr "" -#: ../../whatsnew/2.2.rst:235 +#: ../../whatsnew/2.2.rst:236 msgid "" "Note that a person using the new :func:`!eiffelmethod` doesn't have to " "understand anything about descriptors. This is why I think the new features " @@ -367,18 +375,18 @@ msgid "" "resulting libraries and ignore the implementation details." msgstr "" -#: ../../whatsnew/2.2.rst:244 +#: ../../whatsnew/2.2.rst:245 msgid "Multiple Inheritance: The Diamond Rule" msgstr "" -#: ../../whatsnew/2.2.rst:246 +#: ../../whatsnew/2.2.rst:247 msgid "" "Multiple inheritance has also been made more useful through changing the " "rules under which names are resolved. Consider this set of classes (diagram " "taken from :pep:`253` by Guido van Rossum)::" msgstr "" -#: ../../whatsnew/2.2.rst:250 +#: ../../whatsnew/2.2.rst:251 msgid "" " class A:\n" " ^ ^ def save(self): ...\n" @@ -394,8 +402,21 @@ msgid "" " \\ /\n" " class D" msgstr "" +" class A:\n" +" ^ ^ def save(self): ...\n" +" / \\\n" +" / \\\n" +" / \\\n" +" / \\\n" +"class B class C:\n" +" ^ ^ def save(self): ...\n" +" \\ /\n" +" \\ /\n" +" \\ /\n" +" \\ /\n" +" class D" -#: ../../whatsnew/2.2.rst:264 +#: ../../whatsnew/2.2.rst:265 msgid "" "The lookup rule for classic classes is simple but not very smart; the base " "classes are searched depth-first, going from left to right. A reference to :" @@ -406,7 +427,7 @@ msgid "" "not calling it will result in that state never getting saved." msgstr "" -#: ../../whatsnew/2.2.rst:272 +#: ../../whatsnew/2.2.rst:273 msgid "" "New-style classes follow a different algorithm that's a bit more complicated " "to explain, but does the right thing in this situation. (Note that Python " @@ -415,7 +436,7 @@ msgid "" "graphs.)" msgstr "" -#: ../../whatsnew/2.2.rst:277 +#: ../../whatsnew/2.2.rst:278 msgid "" "List all the base classes, following the classic lookup rule and include a " "class multiple times if it's visited repeatedly. In the above example, the " @@ -423,7 +444,7 @@ msgid "" "C`, :class:`!A`]." msgstr "" -#: ../../whatsnew/2.2.rst:282 +#: ../../whatsnew/2.2.rst:283 msgid "" "Scan the list for duplicated classes. If any are found, remove all but one " "occurrence, leaving the *last* one in the list. In the above example, the " @@ -431,7 +452,7 @@ msgid "" "dropping duplicates." msgstr "" -#: ../../whatsnew/2.2.rst:287 +#: ../../whatsnew/2.2.rst:288 msgid "" "Following this rule, referring to :meth:`!D.save` will return :meth:`!C." "save`, which is the behaviour we're after. This lookup rule is the same as " @@ -444,7 +465,7 @@ msgid "" "like this::" msgstr "" -#: ../../whatsnew/2.2.rst:296 +#: ../../whatsnew/2.2.rst:297 msgid "" "class D (B,C):\n" " def save (self):\n" @@ -454,18 +475,18 @@ msgid "" " ..." msgstr "" -#: ../../whatsnew/2.2.rst:303 +#: ../../whatsnew/2.2.rst:304 msgid "" ":func:`super` can also return unbound superclass objects when called as " "``super(class)`` or ``super(class1, class2)``, but this probably won't often " "be useful." msgstr "" -#: ../../whatsnew/2.2.rst:309 +#: ../../whatsnew/2.2.rst:310 msgid "Attribute Access" msgstr "" -#: ../../whatsnew/2.2.rst:311 +#: ../../whatsnew/2.2.rst:312 msgid "" "A fair number of sophisticated Python classes define hooks for attribute " "access using :meth:`~object.__getattr__`; most commonly this is done for " @@ -474,7 +495,7 @@ msgid "" "get_parent``. Python 2.2 adds some new ways of controlling attribute access." msgstr "" -#: ../../whatsnew/2.2.rst:317 +#: ../../whatsnew/2.2.rst:318 msgid "" "First, ``__getattr__(attr_name)`` is still supported by new-style classes, " "and nothing about it has changed. As before, it will be called when an " @@ -482,7 +503,7 @@ msgid "" "found in the instance's dictionary." msgstr "" -#: ../../whatsnew/2.2.rst:322 +#: ../../whatsnew/2.2.rst:323 msgid "" "New-style classes also support a new method, " "``__getattribute__(attr_name)``. The difference between the two methods is " @@ -491,7 +512,7 @@ msgid "" "called if ``foo`` isn't found in the instance's dictionary." msgstr "" -#: ../../whatsnew/2.2.rst:328 +#: ../../whatsnew/2.2.rst:329 msgid "" "However, Python 2.2's support for :dfn:`properties` will often be a simpler " "way to trap attribute references. Writing a :meth:`!__getattr__` method is " @@ -504,7 +525,7 @@ msgid "" "in a sizable performance loss." msgstr "" -#: ../../whatsnew/2.2.rst:337 +#: ../../whatsnew/2.2.rst:338 msgid "" ":class:`property` is a new built-in type that packages up three functions " "that get, set, or delete an attribute, and a docstring. For example, if you " @@ -512,7 +533,7 @@ msgid "" "you could write::" msgstr "" -#: ../../whatsnew/2.2.rst:342 +#: ../../whatsnew/2.2.rst:343 msgid "" "class C(object):\n" " def get_size (self):\n" @@ -530,7 +551,7 @@ msgid "" " \"Storage size of this instance\")" msgstr "" -#: ../../whatsnew/2.2.rst:357 +#: ../../whatsnew/2.2.rst:358 msgid "" "That is certainly clearer and easier to write than a pair of :meth:`!" "__getattr__`/:meth:`!__setattr__` methods that check for the :attr:`!size` " @@ -540,7 +561,7 @@ msgid "" "references to other attributes run at their usual speed." msgstr "" -#: ../../whatsnew/2.2.rst:364 +#: ../../whatsnew/2.2.rst:365 msgid "" "Finally, it's possible to constrain the list of attributes that can be " "referenced on an object using the new :attr:`~object.__slots__` class " @@ -551,7 +572,7 @@ msgid "" "names. An example will make this clear::" msgstr "" -#: ../../whatsnew/2.2.rst:371 +#: ../../whatsnew/2.2.rst:372 msgid "" ">>> class C(object):\n" "... __slots__ = ('template', 'name')\n" @@ -568,17 +589,17 @@ msgid "" "AttributeError: 'C' object has no attribute 'newattr'" msgstr "" -#: ../../whatsnew/2.2.rst:385 +#: ../../whatsnew/2.2.rst:386 msgid "" "Note how you get an :exc:`AttributeError` on the attempt to assign to an " "attribute not listed in :attr:`~object.__slots__`." msgstr "" -#: ../../whatsnew/2.2.rst:392 +#: ../../whatsnew/2.2.rst:393 msgid "Related Links" msgstr "相關連結" -#: ../../whatsnew/2.2.rst:394 +#: ../../whatsnew/2.2.rst:395 msgid "" "This section has just been a quick overview of the new features, giving " "enough of an explanation to start you programming, but many details have " @@ -586,7 +607,7 @@ msgid "" "picture?" msgstr "" -#: ../../whatsnew/2.2.rst:398 +#: ../../whatsnew/2.2.rst:399 msgid "" "The :ref:`descriptorhowto` is a lengthy tutorial introduction to the " "descriptor features, written by Guido van Rossum. If my description has " @@ -594,7 +615,7 @@ msgid "" "more detail about the new features while still remaining quite easy to read." msgstr "" -#: ../../whatsnew/2.2.rst:403 +#: ../../whatsnew/2.2.rst:404 msgid "" "Next, there are two relevant PEPs, :pep:`252` and :pep:`253`. :pep:`252` is " "titled \"Making Types Look More Like Classes\", and covers the descriptor " @@ -606,7 +627,7 @@ msgid "" "substantial assistance from the rest of the Zope Corp. team." msgstr "" -#: ../../whatsnew/2.2.rst:412 +#: ../../whatsnew/2.2.rst:413 msgid "" "Finally, there's the ultimate authority: the source code. Most of the " "machinery for the type handling is in :file:`Objects/typeobject.c`, but you " @@ -614,31 +635,31 @@ msgid "" "including posting a question to python-list or python-dev." msgstr "" -#: ../../whatsnew/2.2.rst:421 +#: ../../whatsnew/2.2.rst:422 msgid "PEP 234: Iterators" msgstr "PEP 234:疊代器" -#: ../../whatsnew/2.2.rst:423 +#: ../../whatsnew/2.2.rst:424 msgid "" "Another significant addition to 2.2 is an iteration interface at both the C " "and Python levels. Objects can define how they can be looped over by " "callers." msgstr "" -#: ../../whatsnew/2.2.rst:426 +#: ../../whatsnew/2.2.rst:427 msgid "" "In Python versions up to 2.1, the usual way to make ``for item in obj`` work " "is to define a :meth:`~object.__getitem__` method that looks something like " "this::" msgstr "" -#: ../../whatsnew/2.2.rst:429 +#: ../../whatsnew/2.2.rst:430 msgid "" "def __getitem__(self, index):\n" " return <next item>" msgstr "" -#: ../../whatsnew/2.2.rst:432 +#: ../../whatsnew/2.2.rst:433 msgid "" ":meth:`~object.__getitem__` is more properly used to define an indexing " "operation on an object so that you can write ``obj[5]`` to retrieve the " @@ -652,7 +673,7 @@ msgid "" "really should." msgstr "" -#: ../../whatsnew/2.2.rst:442 +#: ../../whatsnew/2.2.rst:443 msgid "" "In Python 2.2, iteration can be implemented separately, and :meth:`~object." "__getitem__` methods can be limited to classes that really do support random " @@ -663,7 +684,7 @@ msgid "" "until it returns *sentinel* to signal that the iterator is done." msgstr "" -#: ../../whatsnew/2.2.rst:450 +#: ../../whatsnew/2.2.rst:451 msgid "" "Python classes can define an :meth:`!__iter__` method, which should create " "and return a new iterator for the object; if the object is its own iterator, " @@ -674,7 +695,7 @@ msgid "" "`~PyTypeObject.tp_iternext` function." msgstr "" -#: ../../whatsnew/2.2.rst:457 +#: ../../whatsnew/2.2.rst:458 msgid "" "So, after all this, what do iterators actually do? They have one required " "method, :meth:`next`, which takes no arguments and returns the next value. " @@ -682,7 +703,7 @@ msgid "" "raise the :exc:`StopIteration` exception. ::" msgstr "" -#: ../../whatsnew/2.2.rst:462 +#: ../../whatsnew/2.2.rst:463 msgid "" ">>> L = [1,2,3]\n" ">>> i = iter(L)\n" @@ -701,7 +722,7 @@ msgid "" ">>>" msgstr "" -#: ../../whatsnew/2.2.rst:478 +#: ../../whatsnew/2.2.rst:479 msgid "" "In 2.2, Python's :keyword:`for` statement no longer expects a sequence; it " "expects something for which :func:`iter` will return an iterator. For " @@ -713,7 +734,7 @@ msgid "" "this::" msgstr "" -#: ../../whatsnew/2.2.rst:486 +#: ../../whatsnew/2.2.rst:487 msgid "" ">>> L = [1,2,3]\n" ">>> i = iter(L)\n" @@ -722,14 +743,14 @@ msgid "" "(1, 2, 3)" msgstr "" -#: ../../whatsnew/2.2.rst:492 +#: ../../whatsnew/2.2.rst:493 msgid "" "Iterator support has been added to some of Python's basic types. Calling :" "func:`iter` on a dictionary will return an iterator which loops over its " "keys::" msgstr "" -#: ../../whatsnew/2.2.rst:495 +#: ../../whatsnew/2.2.rst:496 msgid "" ">>> m = {'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6,\n" "... 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}\n" @@ -749,7 +770,7 @@ msgid "" "Oct 10" msgstr "" -#: ../../whatsnew/2.2.rst:512 +#: ../../whatsnew/2.2.rst:513 msgid "" "That's just the default behaviour. If you want to iterate over keys, " "values, or key/value pairs, you can explicitly call the :meth:`!iterkeys`, :" @@ -758,21 +779,21 @@ msgid "" "dictionaries, so ``key in dict`` is now equivalent to ``dict.has_key(key)``." msgstr "" -#: ../../whatsnew/2.2.rst:518 +#: ../../whatsnew/2.2.rst:519 msgid "" "Files also provide an iterator, which calls the :meth:`readline` method " "until there are no more lines in the file. This means you can now read each " "line of a file using code like this::" msgstr "" -#: ../../whatsnew/2.2.rst:522 +#: ../../whatsnew/2.2.rst:523 msgid "" "for line in file:\n" " # do something for each line\n" " ..." msgstr "" -#: ../../whatsnew/2.2.rst:526 +#: ../../whatsnew/2.2.rst:527 msgid "" "Note that you can only go forward in an iterator; there's no way to get the " "previous element, reset the iterator, or make a copy of it. An iterator " @@ -780,11 +801,11 @@ msgid "" "only requires a :meth:`next` method." msgstr "" -#: ../../whatsnew/2.2.rst:534 +#: ../../whatsnew/2.2.rst:535 msgid ":pep:`234` - Iterators" msgstr ":pep:`234` - 疊代器" -#: ../../whatsnew/2.2.rst:535 +#: ../../whatsnew/2.2.rst:536 msgid "" "Written by Ka-Ping Yee and GvR; implemented by the Python Labs crew, mostly " "by GvR and Tim Peters." @@ -792,17 +813,17 @@ msgstr "" "由 Ka-Ping Yee 和 GvR 撰寫;由 Python Labs 團隊實作,主要為 GvR 和 Tim " "Peters 所貢獻。" -#: ../../whatsnew/2.2.rst:542 +#: ../../whatsnew/2.2.rst:543 msgid "PEP 255: Simple Generators" msgstr "" -#: ../../whatsnew/2.2.rst:544 +#: ../../whatsnew/2.2.rst:545 msgid "" "Generators are another new feature, one that interacts with the introduction " "of iterators." msgstr "" -#: ../../whatsnew/2.2.rst:547 +#: ../../whatsnew/2.2.rst:548 msgid "" "You're doubtless familiar with how function calls work in Python or C. When " "you call a function, it gets a private namespace where its local variables " @@ -815,18 +836,18 @@ msgid "" "functions." msgstr "" -#: ../../whatsnew/2.2.rst:556 +#: ../../whatsnew/2.2.rst:557 msgid "Here's the simplest example of a generator function::" msgstr "" -#: ../../whatsnew/2.2.rst:558 +#: ../../whatsnew/2.2.rst:559 msgid "" "def generate_ints(N):\n" " for i in range(N):\n" " yield i" msgstr "" -#: ../../whatsnew/2.2.rst:562 +#: ../../whatsnew/2.2.rst:563 msgid "" "A new keyword, :keyword:`yield`, was introduced for generators. Any " "function containing a :keyword:`!yield` statement is a generator function; " @@ -837,7 +858,7 @@ msgid "" "Python 2.3 this statement will become unnecessary." msgstr "" -#: ../../whatsnew/2.2.rst:570 +#: ../../whatsnew/2.2.rst:571 msgid "" "When you call a generator function, it doesn't return a single value; " "instead it returns a generator object that supports the iterator protocol. " @@ -853,11 +874,11 @@ msgid "" "explanation of the interaction between :keyword:`!yield` and exceptions.)" msgstr "" -#: ../../whatsnew/2.2.rst:583 +#: ../../whatsnew/2.2.rst:584 msgid "Here's a sample usage of the :func:`!generate_ints` generator::" msgstr "" -#: ../../whatsnew/2.2.rst:585 +#: ../../whatsnew/2.2.rst:586 msgid "" ">>> gen = generate_ints(3)\n" ">>> gen\n" @@ -875,13 +896,13 @@ msgid "" "StopIteration" msgstr "" -#: ../../whatsnew/2.2.rst:600 +#: ../../whatsnew/2.2.rst:601 msgid "" "You could equally write ``for i in generate_ints(5)``, or ``a,b,c = " "generate_ints(3)``." msgstr "" -#: ../../whatsnew/2.2.rst:603 +#: ../../whatsnew/2.2.rst:604 msgid "" "Inside a generator function, the :keyword:`return` statement can only be " "used without a value, and signals the end of the procession of values; " @@ -892,7 +913,7 @@ msgid "" "flow of execution fall off the bottom of the function." msgstr "" -#: ../../whatsnew/2.2.rst:611 +#: ../../whatsnew/2.2.rst:612 msgid "" "You could achieve the effect of generators manually by writing your own " "class and storing all the local variables of the generator as instance " @@ -905,7 +926,7 @@ msgid "" "recursively. ::" msgstr "" -#: ../../whatsnew/2.2.rst:620 +#: ../../whatsnew/2.2.rst:621 msgid "" "# A recursive generator that generates Tree leaves in in-order.\n" "def inorder(t):\n" @@ -917,7 +938,7 @@ msgid "" " yield x" msgstr "" -#: ../../whatsnew/2.2.rst:629 +#: ../../whatsnew/2.2.rst:630 msgid "" "Two other examples in :file:`Lib/test/test_generators.py` produce solutions " "for the N-Queens problem (placing $N$ queens on an $NxN$ chess board so that " @@ -926,7 +947,7 @@ msgid "" "twice)." msgstr "" -#: ../../whatsnew/2.2.rst:634 +#: ../../whatsnew/2.2.rst:635 msgid "" "The idea of generators comes from other programming languages, especially " "Icon (https://www2.cs.arizona.edu/icon/), where the idea of generators is " @@ -936,13 +957,13 @@ msgid "" "of what this looks like::" msgstr "" -#: ../../whatsnew/2.2.rst:641 +#: ../../whatsnew/2.2.rst:642 msgid "" "sentence := \"Store it in the neighboring harbor\"\n" "if (i := find(\"or\", sentence)) > 5 then write(i)" msgstr "" -#: ../../whatsnew/2.2.rst:644 +#: ../../whatsnew/2.2.rst:645 msgid "" "In Icon the :func:`!find` function returns the indexes at which the " "substring \"or\" is found: 3, 23, 33. In the :keyword:`if` statement, ``i`` " @@ -952,7 +973,7 @@ msgid "" "screen." msgstr "" -#: ../../whatsnew/2.2.rst:650 +#: ../../whatsnew/2.2.rst:651 msgid "" "Python doesn't go nearly as far as Icon in adopting generators as a central " "concept. Generators are considered a new part of the core Python language, " @@ -963,22 +984,22 @@ msgid "" "other functions or stored in a data structure." msgstr "" -#: ../../whatsnew/2.2.rst:661 +#: ../../whatsnew/2.2.rst:662 msgid ":pep:`255` - Simple Generators" msgstr "" -#: ../../whatsnew/2.2.rst:662 +#: ../../whatsnew/2.2.rst:663 msgid "" "Written by Neil Schemenauer, Tim Peters, Magnus Lie Hetland. Implemented " "mostly by Neil Schemenauer and Tim Peters, with other fixes from the Python " "Labs crew." msgstr "" -#: ../../whatsnew/2.2.rst:669 +#: ../../whatsnew/2.2.rst:670 msgid "PEP 237: Unifying Long Integers and Integers" msgstr "" -#: ../../whatsnew/2.2.rst:671 +#: ../../whatsnew/2.2.rst:672 msgid "" "In recent versions, the distinction between regular integers, which are 32-" "bit values on most machines, and long integers, which can be of arbitrary " @@ -991,7 +1012,7 @@ msgid "" "exception with the message 'slice index must be int'." msgstr "" -#: ../../whatsnew/2.2.rst:681 +#: ../../whatsnew/2.2.rst:682 msgid "" "Python 2.2 will shift values from short to long integers as required. The " "'L' suffix is no longer needed to indicate a long integer literal, as now " @@ -1002,7 +1023,7 @@ msgid "" "result. For example::" msgstr "" -#: ../../whatsnew/2.2.rst:689 +#: ../../whatsnew/2.2.rst:690 msgid "" ">>> 1234567890123\n" "1234567890123L\n" @@ -1010,28 +1031,28 @@ msgid "" "18446744073709551616L" msgstr "" -#: ../../whatsnew/2.2.rst:694 +#: ../../whatsnew/2.2.rst:695 msgid "" "In most cases, integers and long integers will now be treated identically. " "You can still distinguish them with the :func:`type` built-in function, but " "that's rarely needed." msgstr "" -#: ../../whatsnew/2.2.rst:701 +#: ../../whatsnew/2.2.rst:702 msgid ":pep:`237` - Unifying Long Integers and Integers" msgstr "" -#: ../../whatsnew/2.2.rst:702 +#: ../../whatsnew/2.2.rst:703 msgid "" "Written by Moshe Zadka and Guido van Rossum. Implemented mostly by Guido " "van Rossum." msgstr "" -#: ../../whatsnew/2.2.rst:709 +#: ../../whatsnew/2.2.rst:710 msgid "PEP 238: Changing the Division Operator" msgstr "" -#: ../../whatsnew/2.2.rst:711 +#: ../../whatsnew/2.2.rst:712 msgid "" "The most controversial change in Python 2.2 heralds the start of an effort " "to fix an old design flaw that's been in Python from the beginning. " @@ -1044,7 +1065,7 @@ msgid "" "difficult to determine the possible types of the operands." msgstr "" -#: ../../whatsnew/2.2.rst:721 +#: ../../whatsnew/2.2.rst:722 msgid "" "(The controversy is over whether this is *really* a design flaw, and whether " "it's worth breaking existing code to fix this. It's caused endless " @@ -1054,14 +1075,14 @@ msgid "" "Read :pep:`238` for a summary of arguments and counter-arguments.)" msgstr "" -#: ../../whatsnew/2.2.rst:728 +#: ../../whatsnew/2.2.rst:729 msgid "" "Because this change might break code, it's being introduced very gradually. " "Python 2.2 begins the transition, but the switch won't be complete until " "Python 3.0." msgstr "" -#: ../../whatsnew/2.2.rst:732 +#: ../../whatsnew/2.2.rst:733 msgid "" "First, I'll borrow some terminology from :pep:`238`. \"True division\" is " "the division that most non-programmers are familiar with: 3/2 is 1.5, 1/4 is " @@ -1073,11 +1094,11 @@ msgid "" "the operands is a floating-point number." msgstr "" -#: ../../whatsnew/2.2.rst:740 +#: ../../whatsnew/2.2.rst:741 msgid "Here are the changes 2.2 introduces:" msgstr "" -#: ../../whatsnew/2.2.rst:742 +#: ../../whatsnew/2.2.rst:743 msgid "" "A new operator, ``//``, is the floor division operator. (Yes, we know it " "looks like C++'s comment symbol.) ``//`` *always* performs floor division " @@ -1085,13 +1106,13 @@ msgid "" "``1.0 // 2.0`` is also 0.0." msgstr "" -#: ../../whatsnew/2.2.rst:747 +#: ../../whatsnew/2.2.rst:748 msgid "" "``//`` is always available in Python 2.2; you don't need to enable it using " "a ``__future__`` statement." msgstr "" -#: ../../whatsnew/2.2.rst:750 +#: ../../whatsnew/2.2.rst:751 msgid "" "By including a ``from __future__ import division`` in a module, the ``/`` " "operator will be changed to return the result of true division, so ``1/2`` " @@ -1099,7 +1120,7 @@ msgid "" "division. The default meaning of ``/`` will not change until Python 3.0." msgstr "" -#: ../../whatsnew/2.2.rst:755 +#: ../../whatsnew/2.2.rst:756 msgid "" "Classes can define methods called :meth:`~object.__truediv__` and :meth:" "`~object.__floordiv__` to overload the two division operators. At the C " @@ -1107,7 +1128,7 @@ msgid "" "extension types can define the two operators." msgstr "" -#: ../../whatsnew/2.2.rst:760 +#: ../../whatsnew/2.2.rst:761 msgid "" "Python 2.2 supports some command-line arguments for testing whether code " "will work with the changed division semantics. Running python with :option:" @@ -1117,21 +1138,21 @@ msgid "" "without a warning; the warning will be turned on by default in Python 2.3." msgstr "" -#: ../../whatsnew/2.2.rst:770 +#: ../../whatsnew/2.2.rst:771 msgid ":pep:`238` - Changing the Division Operator" msgstr "" -#: ../../whatsnew/2.2.rst:771 +#: ../../whatsnew/2.2.rst:772 msgid "" "Written by Moshe Zadka and Guido van Rossum. Implemented by Guido van " "Rossum.." msgstr "" -#: ../../whatsnew/2.2.rst:777 +#: ../../whatsnew/2.2.rst:778 msgid "Unicode Changes" msgstr "Unicode 變更" -#: ../../whatsnew/2.2.rst:779 +#: ../../whatsnew/2.2.rst:780 msgid "" "Python's Unicode support has been enhanced a bit in 2.2. Unicode strings " "are usually stored as UCS-2, as 16-bit unsigned integers. Python 2.2 can " @@ -1141,7 +1162,7 @@ msgid "" "completely disable Unicode support.)" msgstr "" -#: ../../whatsnew/2.2.rst:786 +#: ../../whatsnew/2.2.rst:787 msgid "" "When built to use UCS-4 (a \"wide Python\"), the interpreter can natively " "handle Unicode characters from U+000000 to U+110000, so the range of legal " @@ -1152,7 +1173,7 @@ msgid "" "characters\"; consult it for further details." msgstr "" -#: ../../whatsnew/2.2.rst:794 +#: ../../whatsnew/2.2.rst:795 msgid "" "Another change is simpler to explain. Since their introduction, Unicode " "strings have supported an :meth:`!encode` method to convert the string to a " @@ -1163,14 +1184,14 @@ msgid "" "codec." msgstr "" -#: ../../whatsnew/2.2.rst:801 +#: ../../whatsnew/2.2.rst:802 msgid "" "Using this new feature, codecs have been added for tasks not directly " "related to Unicode. For example, codecs have been added for uu-encoding, " "MIME's base64 encoding, and compression with the :mod:`zlib` module::" msgstr "" -#: ../../whatsnew/2.2.rst:805 +#: ../../whatsnew/2.2.rst:806 msgid "" ">>> s = \"\"\"Here is a lengthy piece of redundant, overly verbose,\n" "... and repetitive text.\n" @@ -1191,32 +1212,32 @@ msgid "" "'furrfu'" msgstr "" -#: ../../whatsnew/2.2.rst:822 +#: ../../whatsnew/2.2.rst:823 msgid "" "To convert a class instance to Unicode, a :meth:`!__unicode__` method can be " "defined by a class, analogous to :meth:`!__str__`." msgstr "" -#: ../../whatsnew/2.2.rst:825 +#: ../../whatsnew/2.2.rst:826 msgid "" ":meth:`!encode`, :meth:`!decode`, and :meth:`!__unicode__` were implemented " "by Marc-André Lemburg. The changes to support using UCS-4 internally were " "implemented by Fredrik Lundh and Martin von Löwis." msgstr "" -#: ../../whatsnew/2.2.rst:832 +#: ../../whatsnew/2.2.rst:833 msgid ":pep:`261` - Support for 'wide' Unicode characters" msgstr ":pep:`261` - 支援 'wide' Unicode 字元" -#: ../../whatsnew/2.2.rst:833 +#: ../../whatsnew/2.2.rst:834 msgid "Written by Paul Prescod." msgstr "由 Paul Prescod 撰寫。" -#: ../../whatsnew/2.2.rst:839 +#: ../../whatsnew/2.2.rst:840 msgid "PEP 227: Nested Scopes" msgstr "" -#: ../../whatsnew/2.2.rst:841 +#: ../../whatsnew/2.2.rst:842 msgid "" "In Python 2.1, statically nested scopes were added as an optional feature, " "to be enabled by a ``from __future__ import nested_scopes`` directive. In " @@ -1226,7 +1247,7 @@ msgid "" "2.1 came out, you can skip the rest of this section." msgstr "" -#: ../../whatsnew/2.2.rst:848 +#: ../../whatsnew/2.2.rst:849 msgid "" "The largest change introduced in Python 2.1, and made complete in 2.2, is to " "Python's scoping rules. In Python 2.0, at any given time there are at most " @@ -1236,7 +1257,7 @@ msgid "" "definition doesn't work::" msgstr "" -#: ../../whatsnew/2.2.rst:855 +#: ../../whatsnew/2.2.rst:856 msgid "" "def f():\n" " ...\n" @@ -1246,7 +1267,7 @@ msgid "" " ..." msgstr "" -#: ../../whatsnew/2.2.rst:862 +#: ../../whatsnew/2.2.rst:863 msgid "" "The function :func:`!g` will always raise a :exc:`NameError` exception, " "because the binding of the name ``g`` isn't in either its local namespace or " @@ -1258,7 +1279,7 @@ msgid "" "arguments. ::" msgstr "" -#: ../../whatsnew/2.2.rst:870 +#: ../../whatsnew/2.2.rst:871 msgid "" "def find(self, name):\n" " \"Return list of any entries equal to 'name'\"\n" @@ -1267,13 +1288,13 @@ msgid "" " return L" msgstr "" -#: ../../whatsnew/2.2.rst:876 +#: ../../whatsnew/2.2.rst:877 msgid "" "The readability of Python code written in a strongly functional style " "suffers greatly as a result." msgstr "" -#: ../../whatsnew/2.2.rst:879 +#: ../../whatsnew/2.2.rst:880 msgid "" "The most significant change to Python 2.2 is that static scoping has been " "added to the language to fix this problem. As a first effect, the " @@ -1285,7 +1306,7 @@ msgid "" "rules, and a dissection of the implementation, can be found in the PEP." msgstr "" -#: ../../whatsnew/2.2.rst:888 +#: ../../whatsnew/2.2.rst:889 msgid "" "This change may cause some compatibility problems for code where the same " "variable name is used both at the module level and as a local variable " @@ -1294,7 +1315,7 @@ msgid "" "read in the first place." msgstr "" -#: ../../whatsnew/2.2.rst:894 +#: ../../whatsnew/2.2.rst:895 msgid "" "One side effect of the change is that the ``from module import *`` and " "``exec`` statements have been made illegal inside a function scope under " @@ -1310,11 +1331,11 @@ msgid "" "the compiler will flag this by raising a :exc:`SyntaxError` exception." msgstr "" -#: ../../whatsnew/2.2.rst:907 +#: ../../whatsnew/2.2.rst:908 msgid "To make the preceding explanation a bit clearer, here's an example::" msgstr "" -#: ../../whatsnew/2.2.rst:909 +#: ../../whatsnew/2.2.rst:910 msgid "" "x = 1\n" "def f():\n" @@ -1324,33 +1345,33 @@ msgid "" " return x" msgstr "" -#: ../../whatsnew/2.2.rst:916 +#: ../../whatsnew/2.2.rst:917 msgid "" "Line 4 containing the ``exec`` statement is a syntax error, since ``exec`` " "would define a new local variable named ``x`` whose value should be accessed " "by :func:`!g`." msgstr "" -#: ../../whatsnew/2.2.rst:920 +#: ../../whatsnew/2.2.rst:921 msgid "" "This shouldn't be much of a limitation, since ``exec`` is rarely used in " "most Python code (and when it is used, it's often a sign of a poor design " "anyway)." msgstr "" -#: ../../whatsnew/2.2.rst:927 +#: ../../whatsnew/2.2.rst:928 msgid ":pep:`227` - Statically Nested Scopes" msgstr "" -#: ../../whatsnew/2.2.rst:928 +#: ../../whatsnew/2.2.rst:929 msgid "Written and implemented by Jeremy Hylton." msgstr "" -#: ../../whatsnew/2.2.rst:934 +#: ../../whatsnew/2.2.rst:935 msgid "New and Improved Modules" msgstr "" -#: ../../whatsnew/2.2.rst:936 +#: ../../whatsnew/2.2.rst:937 msgid "" "The :mod:`xmlrpclib <xmlrpc.client>` module was contributed to the standard " "library by Fredrik Lundh, providing support for writing XML-RPC clients. " @@ -1360,7 +1381,7 @@ msgid "" "channel::" msgstr "" -#: ../../whatsnew/2.2.rst:942 +#: ../../whatsnew/2.2.rst:943 msgid "" "import xmlrpclib\n" "s = xmlrpclib.Server(\n" @@ -1380,20 +1401,20 @@ msgid "" "# 'title': 'html2fo 0.3 (Default)'}, ... ]" msgstr "" -#: ../../whatsnew/2.2.rst:959 +#: ../../whatsnew/2.2.rst:960 msgid "" "The :mod:`SimpleXMLRPCServer <xmlrpc.server>` module makes it easy to create " "straightforward XML-RPC servers. See http://xmlrpc.scripting.com/ for more " "information about XML-RPC." msgstr "" -#: ../../whatsnew/2.2.rst:962 +#: ../../whatsnew/2.2.rst:963 msgid "" "The new :mod:`hmac` module implements the HMAC algorithm described by :rfc:" "`2104`. (Contributed by Gerhard Häring.)" msgstr "" -#: ../../whatsnew/2.2.rst:965 +#: ../../whatsnew/2.2.rst:966 msgid "" "Several functions that originally returned lengthy tuples now return pseudo-" "sequences that still behave like tuples but also have mnemonic attributes " @@ -1404,7 +1425,7 @@ msgid "" "`time` module." msgstr "" -#: ../../whatsnew/2.2.rst:972 +#: ../../whatsnew/2.2.rst:973 msgid "" "For example, to obtain a file's size using the old tuples, you'd end up " "writing something like ``file_size = os.stat(filename)[stat.ST_SIZE]``, but " @@ -1412,25 +1433,25 @@ msgid "" "st_size``." msgstr "" -#: ../../whatsnew/2.2.rst:976 +#: ../../whatsnew/2.2.rst:977 msgid "The original patch for this feature was contributed by Nick Mathewson." msgstr "" -#: ../../whatsnew/2.2.rst:978 +#: ../../whatsnew/2.2.rst:979 msgid "" "The Python profiler has been extensively reworked and various errors in its " "output have been corrected. (Contributed by Fred L. Drake, Jr. and Tim " "Peters.)" msgstr "" -#: ../../whatsnew/2.2.rst:981 +#: ../../whatsnew/2.2.rst:982 msgid "" "The :mod:`socket` module can be compiled to support IPv6; specify the :" "option:`!--enable-ipv6` option to Python's configure script. (Contributed " "by Jun-ichiro \"itojun\" Hagino.)" msgstr "" -#: ../../whatsnew/2.2.rst:985 +#: ../../whatsnew/2.2.rst:986 msgid "" "Two new format characters were added to the :mod:`struct` module for 64-bit " "integers on platforms that support the C :c:expr:`long long` type. ``q`` is " @@ -1438,7 +1459,7 @@ msgid "" "returned in Python's long integer type. (Contributed by Tim Peters.)" msgstr "" -#: ../../whatsnew/2.2.rst:990 +#: ../../whatsnew/2.2.rst:991 msgid "" "In the interpreter's interactive mode, there's a new built-in function :func:" "`help` that uses the :mod:`pydoc` module introduced in Python 2.1 to provide " @@ -1449,7 +1470,7 @@ msgid "" "`pydoc` module.)" msgstr "" -#: ../../whatsnew/2.2.rst:998 +#: ../../whatsnew/2.2.rst:999 msgid "" "Various bugfixes and performance improvements have been made to the SRE " "engine underlying the :mod:`re` module. For example, the :func:`re.sub` " @@ -1460,7 +1481,7 @@ msgid "" "Fredrik Lundh. The BIGCHARSET patch was contributed by Martin von Löwis.)" msgstr "" -#: ../../whatsnew/2.2.rst:1006 +#: ../../whatsnew/2.2.rst:1007 msgid "" "The :mod:`smtplib` module now supports :rfc:`2487`, \"Secure SMTP over " "TLS\", so it's now possible to encrypt the SMTP traffic between a Python " @@ -1468,7 +1489,7 @@ msgid "" "also supports SMTP authentication. (Contributed by Gerhard Häring.)" msgstr "" -#: ../../whatsnew/2.2.rst:1011 +#: ../../whatsnew/2.2.rst:1012 msgid "" "The :mod:`imaplib` module, maintained by Piers Lauder, has support for " "several new extensions: the NAMESPACE extension defined in :rfc:`2342`, " @@ -1476,7 +1497,7 @@ msgid "" "Pelletier.)" msgstr "" -#: ../../whatsnew/2.2.rst:1015 +#: ../../whatsnew/2.2.rst:1016 msgid "" "The :mod:`!rfc822` module's parsing of email addresses is now compliant " "with :rfc:`2822`, an update to :rfc:`822`. (The module's name is *not* " @@ -1485,7 +1506,7 @@ msgid "" "Barry Warsaw, and arising out of his work on Mailman.)" msgstr "" -#: ../../whatsnew/2.2.rst:1021 +#: ../../whatsnew/2.2.rst:1022 msgid "" "The :mod:`difflib` module now contains a new :class:`!Differ` class for " "producing human-readable lists of changes (a \"delta\") between two " @@ -1496,7 +1517,7 @@ msgid "" "the generatorization.)" msgstr "" -#: ../../whatsnew/2.2.rst:1028 +#: ../../whatsnew/2.2.rst:1029 msgid "" "New constants :const:`!ascii_letters`, :const:`!ascii_lowercase`, and :const:" "`!ascii_uppercase` were added to the :mod:`string` module. There were " @@ -1508,25 +1529,25 @@ msgid "" "person; fixed by Fred L. Drake, Jr.)" msgstr "" -#: ../../whatsnew/2.2.rst:1037 +#: ../../whatsnew/2.2.rst:1038 msgid "" "The :mod:`mimetypes` module now makes it easier to use alternative MIME-type " "databases by the addition of a :class:`~mimetypes.MimeTypes` class, which " "takes a list of filenames to be parsed. (Contributed by Fred L. Drake, Jr.)" msgstr "" -#: ../../whatsnew/2.2.rst:1041 +#: ../../whatsnew/2.2.rst:1042 msgid "" "A :class:`~threading.Timer` class was added to the :mod:`threading` module " "that allows scheduling an activity to happen at some future time. " "(Contributed by Itamar Shtull-Trauring.)" msgstr "" -#: ../../whatsnew/2.2.rst:1049 +#: ../../whatsnew/2.2.rst:1050 msgid "Interpreter Changes and Fixes" msgstr "直譯器的變更與修正" -#: ../../whatsnew/2.2.rst:1051 +#: ../../whatsnew/2.2.rst:1052 msgid "" "Some of the changes only affect people who deal with the Python interpreter " "at the C level because they're writing Python extension modules, embedding " @@ -1535,7 +1556,7 @@ msgid "" "much." msgstr "" -#: ../../whatsnew/2.2.rst:1056 +#: ../../whatsnew/2.2.rst:1057 msgid "" "Profiling and tracing functions can now be implemented in C, which can " "operate at much higher speeds than Python-based functions and should reduce " @@ -1547,7 +1568,7 @@ msgid "" "(Contributed by Fred L. Drake, Jr.)" msgstr "" -#: ../../whatsnew/2.2.rst:1065 +#: ../../whatsnew/2.2.rst:1066 msgid "" "Another low-level API, primarily of interest to implementers of Python " "debuggers and development tools, was added. :c:func:" @@ -1558,7 +1579,7 @@ msgid "" "David Beazley.)" msgstr "" -#: ../../whatsnew/2.2.rst:1072 +#: ../../whatsnew/2.2.rst:1073 msgid "" "The C-level interface to the garbage collector has been changed to make it " "easier to write extension types that support garbage collection and to debug " @@ -1569,41 +1590,41 @@ msgid "" "priority." msgstr "" -#: ../../whatsnew/2.2.rst:1079 +#: ../../whatsnew/2.2.rst:1080 msgid "" "To upgrade an extension module to the new API, perform the following steps:" msgstr "" -#: ../../whatsnew/2.2.rst:1081 +#: ../../whatsnew/2.2.rst:1082 msgid "Rename :c:macro:`!Py_TPFLAGS_GC` to :c:macro:`Py_TPFLAGS_HAVE_GC`." msgstr "" "將 :c:macro:`!Py_TPFLAGS_GC` 重新命名為 :c:macro:`Py_TPFLAGS_HAVE_GC`。" -#: ../../whatsnew/2.2.rst:1083 +#: ../../whatsnew/2.2.rst:1084 msgid "" "Use :c:func:`PyObject_GC_New` or :c:func:`PyObject_GC_NewVar` to allocate" msgstr "" -#: ../../whatsnew/2.2.rst:1084 +#: ../../whatsnew/2.2.rst:1085 msgid "objects, and :c:func:`PyObject_GC_Del` to deallocate them." msgstr "" -#: ../../whatsnew/2.2.rst:1086 +#: ../../whatsnew/2.2.rst:1087 msgid "" "Rename :c:func:`!PyObject_GC_Init` to :c:func:`PyObject_GC_Track` and :c:" "func:`!PyObject_GC_Fini` to :c:func:`PyObject_GC_UnTrack`." msgstr "" -#: ../../whatsnew/2.2.rst:1089 +#: ../../whatsnew/2.2.rst:1090 msgid "Remove :c:macro:`!PyGC_HEAD_SIZE` from object size calculations." msgstr "" -#: ../../whatsnew/2.2.rst:1091 +#: ../../whatsnew/2.2.rst:1092 msgid "" "Remove calls to :c:func:`!PyObject_AS_GC` and :c:func:`!PyObject_FROM_GC`." msgstr "" -#: ../../whatsnew/2.2.rst:1093 +#: ../../whatsnew/2.2.rst:1094 msgid "" "A new ``et`` format sequence was added to :c:func:`PyArg_ParseTuple`; ``et`` " "takes both a parameter and an encoding name, and converts the parameter to " @@ -1615,7 +1636,7 @@ msgid "" "and used for the MBCS support on Windows described in the following section.)" msgstr "" -#: ../../whatsnew/2.2.rst:1102 +#: ../../whatsnew/2.2.rst:1103 msgid "" "A different argument parsing function, :c:func:`PyArg_UnpackTuple`, has been " "added that's simpler and presumably faster. Instead of specifying a format " @@ -1624,7 +1645,7 @@ msgid "" "be filled in with argument values." msgstr "" -#: ../../whatsnew/2.2.rst:1108 +#: ../../whatsnew/2.2.rst:1109 msgid "" "Two new flags :c:macro:`METH_NOARGS` and :c:macro:`METH_O` are available in " "method definition tables to simplify implementation of methods with no " @@ -1634,7 +1655,7 @@ msgid "" "methods is now officially deprecated." msgstr "" -#: ../../whatsnew/2.2.rst:1114 +#: ../../whatsnew/2.2.rst:1115 msgid "" "Two new wrapper functions, :c:func:`PyOS_snprintf` and :c:func:" "`PyOS_vsnprintf` were added to provide cross-platform implementations for " @@ -1644,7 +1665,7 @@ msgid "" "protect against buffer overruns. (Contributed by M.-A. Lemburg.)" msgstr "" -#: ../../whatsnew/2.2.rst:1121 +#: ../../whatsnew/2.2.rst:1122 msgid "" "The :c:func:`_PyTuple_Resize` function has lost an unused parameter, so now " "it takes 2 parameters instead of 3. The third argument was never used, and " @@ -1652,11 +1673,11 @@ msgid "" "2.2." msgstr "" -#: ../../whatsnew/2.2.rst:1129 +#: ../../whatsnew/2.2.rst:1130 msgid "Other Changes and Fixes" msgstr "其他改動與修正" -#: ../../whatsnew/2.2.rst:1131 +#: ../../whatsnew/2.2.rst:1132 msgid "" "As usual there were a bunch of other improvements and bugfixes scattered " "throughout the source tree. A search through the CVS change logs finds " @@ -1665,18 +1686,18 @@ msgid "" "and fixed 82 bugs. These figures are likely to be underestimates." msgstr "" -#: ../../whatsnew/2.2.rst:1137 +#: ../../whatsnew/2.2.rst:1138 msgid "Some of the more notable changes are:" msgstr "一些較顯著的變更為:" -#: ../../whatsnew/2.2.rst:1139 +#: ../../whatsnew/2.2.rst:1140 msgid "" "The code for the MacOS port for Python, maintained by Jack Jansen, is now " "kept in the main Python CVS tree, and many changes have been made to support " "MacOS X." msgstr "" -#: ../../whatsnew/2.2.rst:1142 +#: ../../whatsnew/2.2.rst:1143 msgid "" "The most significant change is the ability to build Python as a framework, " "enabled by supplying the :option:`!--enable-framework` option to the " @@ -1690,7 +1711,7 @@ msgid "" "OSA scripting language and much more.\"" msgstr "" -#: ../../whatsnew/2.2.rst:1153 +#: ../../whatsnew/2.2.rst:1154 msgid "" "Most of the MacPython toolbox modules, which interface to MacOS APIs such as " "windowing, QuickTime, scripting, etc. have been ported to OS X, but they've " @@ -1698,14 +1719,14 @@ msgid "" "with these modules can uncomment them manually." msgstr "" -#: ../../whatsnew/2.2.rst:1176 +#: ../../whatsnew/2.2.rst:1177 msgid "" "Keyword arguments passed to built-in functions that don't take them now " "cause a :exc:`TypeError` exception to be raised, with the message " "\"*function* takes no keyword arguments\"." msgstr "" -#: ../../whatsnew/2.2.rst:1180 +#: ../../whatsnew/2.2.rst:1181 msgid "" "Weak references, added in Python 2.1 as an extension module, are now part of " "the core because they're used in the implementation of new-style classes. " @@ -1713,14 +1734,14 @@ msgid "" "`weakref` module to become a built-in exception." msgstr "" -#: ../../whatsnew/2.2.rst:1185 +#: ../../whatsnew/2.2.rst:1186 msgid "" "A new script, :file:`Tools/scripts/cleanfuture.py` by Tim Peters, " "automatically removes obsolete ``__future__`` statements from Python source " "code." msgstr "" -#: ../../whatsnew/2.2.rst:1189 +#: ../../whatsnew/2.2.rst:1190 msgid "" "An additional *flags* argument has been added to the built-in function :func:" "`compile`, so the behaviour of ``__future__`` statements can now be " @@ -1729,7 +1750,7 @@ msgid "" "(Contributed by Michael Hudson.)" msgstr "" -#: ../../whatsnew/2.2.rst:1195 +#: ../../whatsnew/2.2.rst:1196 msgid "" "The new license introduced with Python 1.6 wasn't GPL-compatible. This is " "fixed by some minor textual changes to the 2.2 license, so it's now legal to " @@ -1739,7 +1760,7 @@ msgid "" "to the Python 2.0.1 and 2.1.1 releases." msgstr "" -#: ../../whatsnew/2.2.rst:1202 +#: ../../whatsnew/2.2.rst:1203 msgid "" "When presented with a Unicode filename on Windows, Python will now convert " "it to an MBCS encoded string, as used by the Microsoft file APIs. As MBCS " @@ -1750,18 +1771,18 @@ msgid "" "Unix support was added by Martin von Löwis.)" msgstr "" -#: ../../whatsnew/2.2.rst:1210 +#: ../../whatsnew/2.2.rst:1211 msgid "" "Large file support is now enabled on Windows. (Contributed by Tim Peters.)" msgstr "" -#: ../../whatsnew/2.2.rst:1212 +#: ../../whatsnew/2.2.rst:1213 msgid "" "The :file:`Tools/scripts/ftpmirror.py` script now parses a :file:`.netrc` " "file, if you have one. (Contributed by Mike Romberg.)" msgstr "" -#: ../../whatsnew/2.2.rst:1215 +#: ../../whatsnew/2.2.rst:1216 msgid "" "Some features of the object returned by the :func:`!xrange` function are now " "deprecated, and trigger warnings when they're accessed; they'll disappear in " @@ -1774,7 +1795,7 @@ msgid "" "been deprecated." msgstr "" -#: ../../whatsnew/2.2.rst:1224 +#: ../../whatsnew/2.2.rst:1225 msgid "" "There were a bunch of patches to the dictionary implementation, mostly to " "fix potential core dumps if a dictionary contains objects that sneakily " @@ -1784,14 +1805,14 @@ msgid "" "case, and round and round it went." msgstr "" -#: ../../whatsnew/2.2.rst:1231 +#: ../../whatsnew/2.2.rst:1232 msgid "" "On Windows, Python can now be compiled with Borland C thanks to a number of " "patches contributed by Stephen Hansen, though the result isn't fully " "functional yet. (But this *is* progress...)" msgstr "" -#: ../../whatsnew/2.2.rst:1235 +#: ../../whatsnew/2.2.rst:1236 msgid "" "Another Windows enhancement: Wise Solutions generously offered PythonLabs " "use of their InstallerMaster 8.1 system. Earlier PythonLabs Windows " @@ -1799,7 +1820,7 @@ msgid "" "up by Tim Peters.)" msgstr "" -#: ../../whatsnew/2.2.rst:1239 +#: ../../whatsnew/2.2.rst:1240 msgid "" "Files ending in ``.pyw`` can now be imported on Windows. ``.pyw`` is a " "Windows-only thing, used to indicate that a script needs to be run using " @@ -1809,7 +1830,7 @@ msgid "" "Bolen.)" msgstr "" -#: ../../whatsnew/2.2.rst:1245 +#: ../../whatsnew/2.2.rst:1246 msgid "" "On platforms where Python uses the C :c:func:`dlopen` function to load " "extension modules, it's now possible to set the flags used by :c:func:" @@ -1817,7 +1838,7 @@ msgid "" "functions. (Contributed by Bram Stolk.)" msgstr "" -#: ../../whatsnew/2.2.rst:1250 +#: ../../whatsnew/2.2.rst:1251 msgid "" "The :func:`pow` built-in function no longer supports 3 arguments when " "floating-point numbers are supplied. ``pow(x, y, z)`` returns ``(x**y) % " @@ -1826,11 +1847,11 @@ msgid "" "``pow(2.0, 8.0, 7.0)`` will now raise a :exc:`TypeError` exception." msgstr "" -#: ../../whatsnew/2.2.rst:1260 +#: ../../whatsnew/2.2.rst:1261 msgid "Acknowledgements" msgstr "致謝" -#: ../../whatsnew/2.2.rst:1262 +#: ../../whatsnew/2.2.rst:1263 msgid "" "The author would like to thank the following people for offering " "suggestions, corrections and assistance with various drafts of this article: " diff --git a/whatsnew/2.3.po b/whatsnew/2.3.po index 6a73cca3a9..3173149b94 100644 --- a/whatsnew/2.3.po +++ b/whatsnew/2.3.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-05-23 16:19+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -874,9 +874,9 @@ msgstr "" msgid "" "When encoding a Unicode string into a byte string, unencodable characters " "may be encountered. So far, Python has allowed specifying the error " -"processing as either \"strict\" (raising :exc:`UnicodeError`), \"ignore\" " -"(skipping the character), or \"replace\" (using a question mark in the " -"output string), with \"strict\" being the default behavior. It may be " +"processing as either \"strict\" (raising :exc:`UnicodeError`), " +"\"ignore\" (skipping the character), or \"replace\" (using a question mark " +"in the output string), with \"strict\" being the default behavior. It may be " "desirable to specify alternative processing of such errors, such as " "inserting an XML character reference or HTML entity reference into the " "converted string." @@ -1663,11 +1663,11 @@ msgstr "" #: ../../whatsnew/2.3.rst:1115 msgid "" "One of the noted incompatibilities between old- and new-style classes has " -"been removed: you can now assign to the :attr:`~definition.__name__` and :" -"attr:`~class.__bases__` attributes of new-style classes. There are some " -"restrictions on what can be assigned to :attr:`~class.__bases__` along the " -"lines of those relating to assigning to an instance's :attr:`~instance." -"__class__` attribute." +"been removed: you can now assign to the :attr:`~type.__name__` and :attr:" +"`~type.__bases__` attributes of new-style classes. There are some " +"restrictions on what can be assigned to :attr:`!__bases__` along the lines " +"of those relating to assigning to an instance's :attr:`~object.__class__` " +"attribute." msgstr "" #: ../../whatsnew/2.3.rst:1125 @@ -2099,7 +2099,7 @@ msgstr "" #: ../../whatsnew/2.3.rst:1394 msgid "" "The old and never-documented :mod:`!linuxaudiodev` module has been " -"deprecated, and a new version named :mod:`ossaudiodev` has been added. The " +"deprecated, and a new version named :mod:`!ossaudiodev` has been added. The " "module was renamed because the OSS sound drivers can be used on platforms " "other than Linux, and the interface has also been tidied and brought up to " "date in various ways. (Contributed by Greg Ward and Nicholas FitzRoy-Dale.)" @@ -2892,8 +2892,8 @@ msgstr "" #: ../../whatsnew/2.3.rst:1927 msgid "" "If you dynamically allocate type objects in your extension, you should be " -"aware of a change in the rules relating to the :attr:`!__module__` and :attr:" -"`~definition.__name__` attributes. In summary, you will want to ensure the " +"aware of a change in the rules relating to the :attr:`~type.__module__` and :" +"attr:`~type.__name__` attributes. In summary, you will want to ensure the " "type's dictionary contains a ``'__module__'`` key; making the module name " "the part of the type name leading up to the final period will no longer have " "the desired effect. For more detail, read the API reference documentation " diff --git a/whatsnew/2.4.po b/whatsnew/2.4.po index 9d7402235f..7c50822863 100644 --- a/whatsnew/2.4.po +++ b/whatsnew/2.4.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -1818,7 +1818,7 @@ msgstr "" #: ../../whatsnew/2.4.rst:1195 msgid "" -"The :mod:`nntplib` module's :class:`NNTP` class gained :meth:`description` " +"The :mod:`!nntplib` module's :class:`NNTP` class gained :meth:`description` " "and :meth:`descriptions` methods to retrieve newsgroup descriptions for a " "single group or for a range of groups. (Contributed by Jürgen A. Erhard.)" msgstr "" diff --git a/whatsnew/2.5.po b/whatsnew/2.5.po index 0b4e4b0f12..e426c7db93 100644 --- a/whatsnew/2.5.po +++ b/whatsnew/2.5.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1905,7 +1905,7 @@ msgstr "" #: ../../whatsnew/2.5.rst:1225 msgid "" -"The :mod:`audioop` module now supports the a-LAW encoding, and the code for " +"The :mod:`!audioop` module now supports the a-LAW encoding, and the code for " "u-LAW encoding has been improved. (Contributed by Lars Immisch.)" msgstr "" @@ -2218,16 +2218,16 @@ msgstr "" #: ../../whatsnew/2.5.rst:1425 msgid "" -"New module: the :mod:`msilib` module allows creating Microsoft Installer :" +"New module: the :mod:`!msilib` module allows creating Microsoft Installer :" "file:`.msi` files and CAB files. Some support for reading the :file:`.msi` " "database is also included. (Contributed by Martin von Löwis.)" msgstr "" #: ../../whatsnew/2.5.rst:1429 msgid "" -"The :mod:`nis` module now supports accessing domains other than the system " -"default domain by supplying a *domain* argument to the :func:`nis.match` " -"and :func:`nis.maps` functions. (Contributed by Ben Bell.)" +"The :mod:`!nis` module now supports accessing domains other than the system " +"default domain by supplying a *domain* argument to the :func:`!nis.match` " +"and :func:`!nis.maps` functions. (Contributed by Ben Bell.)" msgstr "" #: ../../whatsnew/2.5.rst:1433 @@ -2398,7 +2398,7 @@ msgstr "" #: ../../whatsnew/2.5.rst:1545 msgid "" -"New module: the :mod:`spwd` module provides functions for accessing the " +"New module: the :mod:`!spwd` module provides functions for accessing the " "shadow password database on systems that support shadow passwords." msgstr "" diff --git a/whatsnew/2.6.po b/whatsnew/2.6.po index c67c96b179..de308f3fc6 100644 --- a/whatsnew/2.6.po +++ b/whatsnew/2.6.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -124,7 +124,7 @@ msgid "" "that will be removed in Python 3.0. You can run code with this switch to " "see how much work will be necessary to port code to 3.0. The value of this " "switch is available to Python code as the boolean variable :data:`sys." -"py3kwarning`, and to C extension code as :c:data:`Py_Py3kWarningFlag`." +"py3kwarning`, and to C extension code as :c:data:`!Py_Py3kWarningFlag`." msgstr "" #: ../../whatsnew/2.6.rst:126 @@ -2572,7 +2572,7 @@ msgstr "" #: ../../whatsnew/2.6.rst:1803 msgid "" -"The :mod:`cgi` module will now read variables from the query string of an " +"The :mod:`!cgi` module will now read variables from the query string of an " "HTTP POST request. This makes it possible to use form actions with URLs " "that include query strings such as \"/cgi-bin/add.py?category=1\". " "(Contributed by Alexandre Fiori and Nubis; :issue:`1817`.)" @@ -2581,8 +2581,8 @@ msgstr "" #: ../../whatsnew/2.6.rst:1809 msgid "" "The :func:`parse_qs` and :func:`parse_qsl` functions have been relocated " -"from the :mod:`cgi` module to the :mod:`urlparse <urllib.parse>` module. The " -"versions still available in the :mod:`!cgi` module will trigger :exc:" +"from the :mod:`!cgi` module to the :mod:`urlparse <urllib.parse>` module. " +"The versions still available in the :mod:`!cgi` module will trigger :exc:" "`PendingDeprecationWarning` messages in 2.6 (:issue:`600362`)." msgstr "" @@ -3531,9 +3531,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:2462 msgid "" -"An optional ``timeout`` parameter was added to the :class:`telnetlib.Telnet` " -"class constructor, specifying a timeout measured in seconds. (Added by " -"Facundo Batista.)" +"An optional ``timeout`` parameter was added to the :class:`!telnetlib." +"Telnet` class constructor, specifying a timeout measured in seconds. (Added " +"by Facundo Batista.)" msgstr "" #: ../../whatsnew/2.6.rst:2466 @@ -4475,10 +4475,9 @@ msgstr "" #: ../../whatsnew/2.6.rst:3159 msgid "" -"The :mod:`msilib` module's :class:`!Record` object gained :meth:`~msilib." -"Record.GetInteger` and :meth:`~msilib.Record.GetString` methods that return " -"field values as an integer or a string. (Contributed by Floris Bruynooghe; :" -"issue:`2125`.)" +"The :mod:`!msilib` module's :class:`!Record` object gained :meth:`!" +"GetInteger` and :meth:`!GetString` methods that return field values as an " +"integer or a string. (Contributed by Floris Bruynooghe; :issue:`2125`.)" msgstr "" #: ../../whatsnew/2.6.rst:3167 diff --git a/whatsnew/2.7.po b/whatsnew/2.7.po index aea3c54582..8eaa5f46cd 100644 --- a/whatsnew/2.7.po +++ b/whatsnew/2.7.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -1973,8 +1973,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:1434 msgid "" -"The :mod:`nntplib` module now supports IPv6 addresses. (Contributed by Derek " -"Morr; :issue:`1664`.)" +"The :mod:`!nntplib` module now supports IPv6 addresses. (Contributed by " +"Derek Morr; :issue:`1664`.)" msgstr "" #: ../../whatsnew/2.7.rst:1437 @@ -3017,7 +3017,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:2162 msgid "" -"New function: :c:func:`PySys_SetArgvEx` sets the value of ``sys.argv`` and " +"New function: :c:func:`!PySys_SetArgvEx` sets the value of ``sys.argv`` and " "can optionally update ``sys.path`` to include the directory containing the " "script named by ``sys.argv[0]`` depending on the value of an *updatepath* " "parameter." @@ -3026,7 +3026,7 @@ msgstr "" #: ../../whatsnew/2.7.rst:2167 msgid "" "This function was added to close a security hole for applications that embed " -"Python. The old function, :c:func:`PySys_SetArgv`, would always update " +"Python. The old function, :c:func:`!PySys_SetArgv`, would always update " "``sys.path``, and sometimes it would add the current directory. This meant " "that, if you ran an application embedding Python in a directory controlled " "by someone else, attackers could put a Trojan-horse module in the directory " @@ -3037,8 +3037,8 @@ msgstr "" #: ../../whatsnew/2.7.rst:2175 msgid "" "If you maintain a C/C++ application that embeds Python, check whether you're " -"calling :c:func:`PySys_SetArgv` and carefully consider whether the " -"application should be using :c:func:`PySys_SetArgvEx` with *updatepath* set " +"calling :c:func:`!PySys_SetArgv` and carefully consider whether the " +"application should be using :c:func:`!PySys_SetArgvEx` with *updatepath* set " "to false." msgstr "" @@ -3479,11 +3479,11 @@ msgstr "" #: ../../whatsnew/2.7.rst:2551 msgid "" -"The :c:func:`PySys_SetArgvEx` function was added, letting applications close " -"a security hole when the existing :c:func:`PySys_SetArgv` function was " -"used. Check whether you're calling :c:func:`PySys_SetArgv` and carefully " -"consider whether the application should be using :c:func:`PySys_SetArgvEx` " -"with *updatepath* set to false." +"The :c:func:`!PySys_SetArgvEx` function was added, letting applications " +"close a security hole when the existing :c:func:`!PySys_SetArgv` function " +"was used. Check whether you're calling :c:func:`!PySys_SetArgv` and " +"carefully consider whether the application should be using :c:func:`!" +"PySys_SetArgvEx` with *updatepath* set to false." msgstr "" #: ../../whatsnew/2.7.rst:2564 diff --git a/whatsnew/3.0.po b/whatsnew/3.0.po index 20529c8163..3c93e678fd 100644 --- a/whatsnew/3.0.po +++ b/whatsnew/3.0.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -1366,9 +1366,8 @@ msgstr "" #: ../../whatsnew/3.0.rst:915 msgid "" "Run the ``2to3`` source-to-source translator over your source code tree. " -"(See :ref:`2to3-reference` for more on this tool.) Run the result of the " -"translation under Python 3.0. Manually fix up any remaining issues, fixing " -"problems until all tests pass again." +"Run the result of the translation under Python 3.0. Manually fix up any " +"remaining issues, fixing problems until all tests pass again." msgstr "" #: ../../whatsnew/3.0.rst:920 diff --git a/whatsnew/3.1.po b/whatsnew/3.1.po index 0413b313f6..df59f43bf2 100644 --- a/whatsnew/3.1.po +++ b/whatsnew/3.1.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2018-05-23 16:20+0000\n" "Last-Translator: Adrian Liaw <adrianliaw2000@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -34,6 +34,8 @@ msgid "" "This article explains the new features in Python 3.1, compared to 3.0. " "Python 3.1 was released on June 27, 2009." msgstr "" +"本文介紹了 Python 3.1 與 3.0 相比的新功能。Python 3.1 已於 2009 年 6 月 27 日" +"發布。" #: ../../whatsnew/3.1.rst:54 msgid "PEP 372: Ordered Dictionaries" @@ -665,7 +667,7 @@ msgid "(Contributed by Ross Light; :issue:`4285`.)" msgstr "(由 Ross Light 貢獻;:issue:`4285`。)" #: ../../whatsnew/3.1.rst:406 -msgid "The :mod:`nntplib` and :mod:`imaplib` modules now support IPv6." +msgid "The :mod:`!nntplib` and :mod:`imaplib` modules now support IPv6." msgstr "" #: ../../whatsnew/3.1.rst:408 @@ -912,7 +914,7 @@ msgstr "(由 Larry Hastings 貢獻;:issue:`5630`。)" #: ../../whatsnew/3.1.rst:548 msgid "Porting to Python 3.1" -msgstr "" +msgstr "移植至 Python 3.1" #: ../../whatsnew/3.1.rst:550 msgid "" diff --git a/whatsnew/3.10.po b/whatsnew/3.10.po index 1ecb0935a0..ee2fe63fc7 100644 --- a/whatsnew/3.10.po +++ b/whatsnew/3.10.po @@ -4,9 +4,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-06-26 03:02+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,12 +35,12 @@ msgid "" "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>`。" +"本文介紹了 Python 3.10 與 3.9 相比多了哪些新功能。Python 3.10 已於 2021 年 " +"10 月 4 日發布。有關完整詳細資訊,請參閱 :ref:`changelog <changelog>`。" #: ../../whatsnew/3.10.rst:52 msgid "Summary -- Release highlights" -msgstr "摘要 -- 發布重點" +msgstr "發布重點摘要" #: ../../whatsnew/3.10.rst:60 msgid "New syntax features:" @@ -127,7 +127,7 @@ msgstr ":pep:`597`,新增可選的 EncodingWarning" #: ../../whatsnew/3.10.rst:92 ../../whatsnew/3.10.rst:2053 msgid "New Features" -msgstr "新功能" +msgstr "新增功能" #: ../../whatsnew/3.10.rst:97 msgid "Parenthesized context managers" @@ -2879,13 +2879,14 @@ msgid "urllib.parse" msgstr "urllib.parse" #: ../../whatsnew/3.10.rst:1510 +#, fuzzy msgid "" "Python versions earlier than Python 3.10 allowed using both ``;`` and ``&`` " "as query parameter separators in :func:`urllib.parse.parse_qs` and :func:" "`urllib.parse.parse_qsl`. Due to security concerns, and to conform with " "newer W3C recommendations, this has been changed to allow only a single " -"separator key, with ``&`` as the default. This change also affects :func:" -"`cgi.parse` and :func:`cgi.parse_multipart` as they use the affected " +"separator key, with ``&`` as the default. This change also affects :func:`!" +"cgi.parse` and :func:`!cgi.parse_multipart` as they use the affected " "functions internally. For more details, please see their respective " "documentation. (Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin " "in :issue:`42967`.)" diff --git a/whatsnew/3.11.po b/whatsnew/3.11.po index 17357fa657..0d18eb3a67 100644 --- a/whatsnew/3.11.po +++ b/whatsnew/3.11.po @@ -5,9 +5,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2023-05-28 18:21+0800\n" "Last-Translator: Matt Wang <mattwang44@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -36,7 +36,7 @@ msgid "" "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 年 " +"此文章解釋了 Python 3.11 和 3.10 相比多了哪些新功能。Python 3.11 於 2022 年 " "10 月 24 日發布。完整細節請見 :ref:`changelog`。" #: ../../whatsnew/3.11.rst:55 @@ -63,7 +63,7 @@ msgstr ":ref:`whatsnew311-pep654`" #: ../../whatsnew/3.11.rst:70 msgid "New built-in features:" -msgstr "新增內建特性:" +msgstr "新的內建功能:" #: ../../whatsnew/3.11.rst:72 msgid ":ref:`whatsnew311-pep678`" @@ -149,7 +149,7 @@ msgstr ":pep:`670`::ref:`轉換為靜態行內函式的巨集 <whatsnew311-pep #: ../../whatsnew/3.11.rst:108 ../../whatsnew/3.11.rst:2211 msgid "New Features" -msgstr "新增特性" +msgstr "新增功能" #: ../../whatsnew/3.11.rst:113 msgid "PEP 657: Fine-grained error locations in tracebacks" @@ -1433,7 +1433,7 @@ msgid "" "`88024`.)" msgstr "" "新增 :func:`~logging.getLevelNamesMapping` 以回傳一個日誌級別名稱(例如 " -"``'CRITICAL'``)指到對應的 :ref:`levels` 數值(例如,預設為 ``50``)的映射。" +"``'CRITICAL'``)指到對應的 :ref:`levels` 數值(例如,預設為 ``50``)的對映。" "(由 Andrei Kulakovin 於 :gh:`88024` 中貢獻。)" #: ../../whatsnew/3.11.rst:867 @@ -3188,80 +3188,80 @@ msgid "" msgstr ":pep:`594` 引領下列模組的棄用,並排訂於 Python 3.13 移除:" #: ../../whatsnew/3.11.rst:1752 -msgid ":mod:`aifc`" -msgstr ":mod:`aifc`" +msgid ":mod:`!aifc`" +msgstr ":mod:`!aifc`" #: ../../whatsnew/3.11.rst:1752 -msgid ":mod:`chunk`" -msgstr ":mod:`chunk`" +msgid ":mod:`!chunk`" +msgstr ":mod:`!chunk`" #: ../../whatsnew/3.11.rst:1752 -msgid ":mod:`msilib`" -msgstr ":mod:`msilib`" +msgid ":mod:`!msilib`" +msgstr ":mod:`!msilib`" #: ../../whatsnew/3.11.rst:1752 -msgid ":mod:`pipes`" -msgstr ":mod:`pipes`" +msgid ":mod:`!pipes`" +msgstr ":mod:`!pipes`" #: ../../whatsnew/3.11.rst:1752 -msgid ":mod:`telnetlib`" -msgstr ":mod:`telnetlib`" +msgid ":mod:`!telnetlib`" +msgstr ":mod:`!telnetlib`" #: ../../whatsnew/3.11.rst:1754 -msgid ":mod:`audioop`" -msgstr ":mod:`audioop`" +msgid ":mod:`!audioop`" +msgstr ":mod:`!audioop`" #: ../../whatsnew/3.11.rst:1754 -msgid ":mod:`crypt`" -msgstr ":mod:`crypt`" +msgid ":mod:`!crypt`" +msgstr ":mod:`!crypt`" #: ../../whatsnew/3.11.rst:1754 -msgid ":mod:`nis`" -msgstr ":mod:`nis`" +msgid ":mod:`!nis`" +msgstr ":mod:`!nis`" #: ../../whatsnew/3.11.rst:1754 -msgid ":mod:`sndhdr`" -msgstr ":mod:`sndhdr`" +msgid ":mod:`!sndhdr`" +msgstr ":mod:`!sndhdr`" #: ../../whatsnew/3.11.rst:1754 -msgid ":mod:`uu`" -msgstr ":mod:`uu`" +msgid ":mod:`!uu`" +msgstr ":mod:`!uu`" #: ../../whatsnew/3.11.rst:1756 -msgid ":mod:`cgi`" -msgstr ":mod:`cgi`" +msgid ":mod:`!cgi`" +msgstr ":mod:`!cgi`" #: ../../whatsnew/3.11.rst:1756 -msgid ":mod:`imghdr`" -msgstr ":mod:`imghdr`" +msgid ":mod:`!imghdr`" +msgstr ":mod:`!imghdr`" #: ../../whatsnew/3.11.rst:1756 -msgid ":mod:`nntplib`" -msgstr ":mod:`nntplib`" +msgid ":mod:`!nntplib`" +msgstr ":mod:`!nntplib`" #: ../../whatsnew/3.11.rst:1756 -msgid ":mod:`spwd`" -msgstr ":mod:`spwd`" +msgid ":mod:`!spwd`" +msgstr ":mod:`!spwd`" #: ../../whatsnew/3.11.rst:1756 -msgid ":mod:`xdrlib`" -msgstr ":mod:`xdrlib`" +msgid ":mod:`!xdrlib`" +msgstr ":mod:`!xdrlib`" #: ../../whatsnew/3.11.rst:1758 -msgid ":mod:`cgitb`" -msgstr ":mod:`cgitb`" +msgid ":mod:`!cgitb`" +msgstr ":mod:`!cgitb`" #: ../../whatsnew/3.11.rst:1758 -msgid ":mod:`mailcap`" -msgstr ":mod:`mailcap`" +msgid ":mod:`!mailcap`" +msgstr ":mod:`!mailcap`" #: ../../whatsnew/3.11.rst:1758 -msgid ":mod:`ossaudiodev`" -msgstr ":mod:`ossaudiodev`" +msgid ":mod:`!ossaudiodev`" +msgstr ":mod:`!ossaudiodev`" #: ../../whatsnew/3.11.rst:1758 -msgid ":mod:`sunau`" -msgstr ":mod:`sunau`" +msgid ":mod:`!sunau`" +msgstr ":mod:`!sunau`" #: ../../whatsnew/3.11.rst:1761 msgid "" @@ -3283,11 +3283,11 @@ msgstr "" "除。(由 Hugo van Kemenade 於 :issue:`47022` 中貢獻。)" #: ../../whatsnew/3.11.rst:1769 +#, fuzzy msgid "" -"The :mod:`lib2to3` package and :ref:`2to3 <2to3-reference>` tool are now " -"deprecated and may not be able to parse Python 3.10 or newer. See :pep:" -"`617`, introducing the new PEG parser, for details. (Contributed by Victor " -"Stinner in :issue:`40360`.)" +"The :mod:`!lib2to3` package and ``2to3`` tool are now deprecated and may not " +"be able to parse Python 3.10 or newer. See :pep:`617`, introducing the new " +"PEG parser, for details. (Contributed by Victor Stinner in :issue:`40360`.)" msgstr "" ":mod:`lib2to3` 套件和 :ref:`2to3 <2to3-reference>` 工具現已棄用,可能無法剖" "析 Python 3.10 或更新版本。有關詳細資訊請參閱 :pep:`617`,它引入了新的 PEG 剖" @@ -3359,32 +3359,32 @@ msgstr "" "案:" #: ../../whatsnew/3.11.rst:1806 -msgid ":func:`importlib.resources.contents`" -msgstr ":func:`importlib.resources.contents`" +msgid ":func:`!importlib.resources.contents`" +msgstr ":func:`!importlib.resources.contents`" #: ../../whatsnew/3.11.rst:1807 -msgid ":func:`importlib.resources.is_resource`" -msgstr ":func:`importlib.resources.is_resource`" +msgid ":func:`!importlib.resources.is_resource`" +msgstr ":func:`!importlib.resources.is_resource`" #: ../../whatsnew/3.11.rst:1808 -msgid ":func:`importlib.resources.open_binary`" -msgstr ":func:`importlib.resources.open_binary`" +msgid ":func:`!importlib.resources.open_binary`" +msgstr ":func:`!importlib.resources.open_binary`" #: ../../whatsnew/3.11.rst:1809 -msgid ":func:`importlib.resources.open_text`" -msgstr ":func:`importlib.resources.open_text`" +msgid ":func:`!importlib.resources.open_text`" +msgstr ":func:`!importlib.resources.open_text`" #: ../../whatsnew/3.11.rst:1810 -msgid ":func:`importlib.resources.read_binary`" -msgstr ":func:`importlib.resources.read_binary`" +msgid ":func:`!importlib.resources.read_binary`" +msgstr ":func:`!importlib.resources.read_binary`" #: ../../whatsnew/3.11.rst:1811 -msgid ":func:`importlib.resources.read_text`" -msgstr ":func:`importlib.resources.read_text`" +msgid ":func:`!importlib.resources.read_text`" +msgstr ":func:`!importlib.resources.read_text`" #: ../../whatsnew/3.11.rst:1812 -msgid ":func:`importlib.resources.path`" -msgstr ":func:`importlib.resources.path`" +msgid ":func:`!importlib.resources.path`" +msgstr ":func:`!importlib.resources.path`" #: ../../whatsnew/3.11.rst:1814 msgid "" @@ -3399,9 +3399,10 @@ msgstr "" "於 :gh:`90817` 中所貢獻。)" #: ../../whatsnew/3.11.rst:1820 +#, fuzzy msgid "" -"The :func:`locale.resetlocale` function is deprecated and will be removed in " -"Python 3.13. Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. " +"The :func:`!locale.resetlocale` function is deprecated and will be removed " +"in Python 3.13. Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. " "(Contributed by Victor Stinner in :gh:`90817`.)" msgstr "" ":func:`locale.resetlocale` 函式已棄用並將於 Python 3.13 中移除,請改用 " @@ -3438,8 +3439,9 @@ msgstr "" "`92728` 中貢獻。)" #: ../../whatsnew/3.11.rst:1838 +#, fuzzy msgid "" -":func:`turtle.settiltangle` has been deprecated since Python 3.1; it now " +":func:`!turtle.settiltangle` has been deprecated since Python 3.1; it now " "emits a deprecation warning and will be removed in Python 3.13. Use :func:" "`turtle.tiltangle` instead (it was earlier incorrectly marked as deprecated, " "and its docstring is now corrected). (Contributed by Hugo van Kemenade in :" diff --git a/whatsnew/3.12.po b/whatsnew/3.12.po index 955e445748..227841ae3a 100644 --- a/whatsnew/3.12.po +++ b/whatsnew/3.12.po @@ -4,9 +4,9 @@ # msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-28 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-" @@ -34,8 +34,8 @@ msgid "" "Python 3.12 was released on October 2, 2023. For full details, see the :ref:" "`changelog <changelog>`." msgstr "" -"本文介紹了 Python 3.12 與 3.11 相比的新功能。 Python 3.12 於 2023 年 10 月 2 " -"日發布。完整詳請請見 :ref:`changelog <changelog>`。" +"本文介紹了 Python 3.12 與 3.11 相比多了哪些新功能。 Python 3.12 於 2023 年 " +"10 月 2 日發布。完整詳請請見 :ref:`changelog <changelog>`。" #: ../../whatsnew/3.12.rst:54 msgid ":pep:`693` -- Python 3.12 Release Schedule" @@ -129,7 +129,7 @@ msgstr "" #: ../../whatsnew/3.12.rst:111 msgid "Significant improvements in the standard library:" -msgstr "" +msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.12.rst:113 msgid "The :class:`pathlib.Path` class now supports subclassing" @@ -265,9 +265,9 @@ msgstr "" "`unittest.TestCase` 的\\ `方法別名 <unittest-TestCase-removed-aliases_>`_\\ " "已被刪除。" -#: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1836 +#: ../../whatsnew/3.12.rst:176 ../../whatsnew/3.12.rst:1825 msgid "New Features" -msgstr "新增特性" +msgstr "新增功能" #: ../../whatsnew/3.12.rst:181 msgid "PEP 695: Type Parameter Syntax" @@ -979,8 +979,8 @@ msgstr "csv" #: ../../whatsnew/3.12.rst:691 msgid "" "Add :const:`csv.QUOTE_NOTNULL` and :const:`csv.QUOTE_STRINGS` flags to " -"provide finer grained control of ``None`` and empty strings by :class:`csv." -"writer` objects." +"provide finer grained control of ``None`` and empty strings by :class:`~csv." +"reader` and :class:`~csv.writer` objects." msgstr "" #: ../../whatsnew/3.12.rst:696 @@ -1121,36 +1121,27 @@ msgid "" "`99726`.)" msgstr "" -#: ../../whatsnew/3.12.rst:781 -msgid "" -"As of 3.12.4, :func:`os.mkdir` and :func:`os.makedirs` on Windows now " -"support passing a *mode* value of ``0o700`` to apply access control to the " -"new directory. This implicitly affects :func:`tempfile.mkdtemp` and is a " -"mitigation for :cve:`2024-4030`. Other values for *mode* continue to be " -"ignored. (Contributed by Steve Dower in :gh:`118486`.)" -msgstr "" - -#: ../../whatsnew/3.12.rst:789 +#: ../../whatsnew/3.12.rst:782 msgid "os.path" msgstr "os.path" -#: ../../whatsnew/3.12.rst:791 +#: ../../whatsnew/3.12.rst:784 msgid "" "Add :func:`os.path.isjunction` to check if a given path is a junction. " "(Contributed by Charles Machalow in :gh:`99547`.)" msgstr "" -#: ../../whatsnew/3.12.rst:794 +#: ../../whatsnew/3.12.rst:787 msgid "" "Add :func:`os.path.splitroot` to split a path into a triad ``(drive, root, " "tail)``. (Contributed by Barney Gale in :gh:`101000`.)" msgstr "" -#: ../../whatsnew/3.12.rst:798 +#: ../../whatsnew/3.12.rst:791 msgid "pathlib" msgstr "pathlib" -#: ../../whatsnew/3.12.rst:800 +#: ../../whatsnew/3.12.rst:793 msgid "" "Add support for subclassing :class:`pathlib.PurePath` and :class:`pathlib." "Path`, plus their Posix- and Windows-specific variants. Subclasses may " @@ -1158,14 +1149,14 @@ msgid "" "information between path instances." msgstr "" -#: ../../whatsnew/3.12.rst:805 +#: ../../whatsnew/3.12.rst:798 msgid "" "Add :meth:`pathlib.Path.walk` for walking the directory trees and generating " "all file or directory names within them, similar to :func:`os.walk`. " "(Contributed by Stanislav Zmiev in :gh:`90385`.)" msgstr "" -#: ../../whatsnew/3.12.rst:809 +#: ../../whatsnew/3.12.rst:802 msgid "" "Add *walk_up* optional parameter to :meth:`pathlib.PurePath.relative_to` to " "allow the insertion of ``..`` entries in the result; this behavior is more " @@ -1173,13 +1164,13 @@ msgid "" "gh:`84538`.)" msgstr "" -#: ../../whatsnew/3.12.rst:814 +#: ../../whatsnew/3.12.rst:807 msgid "" "Add :meth:`pathlib.Path.is_junction` as a proxy to :func:`os.path." "isjunction`. (Contributed by Charles Machalow in :gh:`99547`.)" msgstr "" -#: ../../whatsnew/3.12.rst:817 +#: ../../whatsnew/3.12.rst:810 msgid "" "Add *case_sensitive* optional parameter to :meth:`pathlib.Path.glob`, :meth:" "`pathlib.Path.rglob` and :meth:`pathlib.PurePath.match` for matching the " @@ -1187,22 +1178,22 @@ msgid "" "process." msgstr "" -#: ../../whatsnew/3.12.rst:822 +#: ../../whatsnew/3.12.rst:815 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.12.rst:824 +#: ../../whatsnew/3.12.rst:817 msgid "" "Add convenience variables to hold values temporarily for debug session and " "provide quick access to values like the current frame or the return value. " "(Contributed by Tian Gao in :gh:`103693`.)" msgstr "" -#: ../../whatsnew/3.12.rst:830 +#: ../../whatsnew/3.12.rst:823 msgid "random" msgstr "random" -#: ../../whatsnew/3.12.rst:832 +#: ../../whatsnew/3.12.rst:825 msgid "" "Add :func:`random.binomialvariate`. (Contributed by Raymond Hettinger in :gh:" "`81620`.)" @@ -1210,7 +1201,7 @@ msgstr "" "新增 :func:`random.binomialvariate`。(由 Raymond Hettinger 於 :gh:`81620` 中" "貢獻。)" -#: ../../whatsnew/3.12.rst:835 +#: ../../whatsnew/3.12.rst:828 msgid "" "Add a default of ``lambd=1.0`` to :func:`random.expovariate`. (Contributed " "by Raymond Hettinger in :gh:`100234`.)" @@ -1218,11 +1209,11 @@ msgstr "" "將預設值 ``lambd=1.0`` 加入至 :func:`random.expovariate` 中。(由 Raymond " "Hettinger 在 :gh:`100234` 中貢獻。)" -#: ../../whatsnew/3.12.rst:839 +#: ../../whatsnew/3.12.rst:832 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.12.rst:841 +#: ../../whatsnew/3.12.rst:834 msgid "" ":func:`shutil.make_archive` now passes the *root_dir* argument to custom " "archivers which support it. In this case it no longer temporarily changes " @@ -1230,7 +1221,7 @@ msgid "" "archiving. (Contributed by Serhiy Storchaka in :gh:`74696`.)" msgstr "" -#: ../../whatsnew/3.12.rst:847 +#: ../../whatsnew/3.12.rst:840 msgid "" ":func:`shutil.rmtree` now accepts a new argument *onexc* which is an error " "handler like *onerror* but which expects an exception instance rather than a " @@ -1238,14 +1229,14 @@ msgid "" "Katriel in :gh:`102828`.)" msgstr "" -#: ../../whatsnew/3.12.rst:852 +#: ../../whatsnew/3.12.rst:845 msgid "" ":func:`shutil.which` now consults the *PATHEXT* environment variable to find " "matches within *PATH* on Windows even when the given *cmd* includes a " "directory component. (Contributed by Charles Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:857 +#: ../../whatsnew/3.12.rst:850 msgid "" ":func:`shutil.which` will call ``NeedCurrentDirectoryForExePathW`` when " "querying for executables on Windows to determine if the current working " @@ -1253,18 +1244,18 @@ msgid "" "Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:862 +#: ../../whatsnew/3.12.rst:855 msgid "" ":func:`shutil.which` will return a path matching the *cmd* with a component " "from ``PATHEXT`` prior to a direct match elsewhere in the search path on " "Windows. (Contributed by Charles Machalow in :gh:`103179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:868 ../../whatsnew/3.12.rst:1540 +#: ../../whatsnew/3.12.rst:861 ../../whatsnew/3.12.rst:1529 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.12.rst:870 +#: ../../whatsnew/3.12.rst:863 msgid "" "Add a :ref:`command-line interface <sqlite3-cli>`. (Contributed by Erlend E. " "Aasland in :gh:`77617`.)" @@ -1272,7 +1263,7 @@ msgstr "" "新增\\ :ref:`命令列介面 <sqlite3-cli>`。(由 Erlend E. Aasland 於 :gh:" "`77617` 中貢獻。)" -#: ../../whatsnew/3.12.rst:873 +#: ../../whatsnew/3.12.rst:866 msgid "" "Add the :attr:`sqlite3.Connection.autocommit` attribute to :class:`sqlite3." "Connection` and the *autocommit* parameter to :func:`sqlite3.connect` to " @@ -1280,43 +1271,43 @@ msgid "" "control-autocommit>`. (Contributed by Erlend E. Aasland in :gh:`83638`.)" msgstr "" -#: ../../whatsnew/3.12.rst:880 +#: ../../whatsnew/3.12.rst:873 msgid "" "Add *entrypoint* keyword-only parameter to :meth:`sqlite3.Connection." "load_extension`, for overriding the SQLite extension entry point. " "(Contributed by Erlend E. Aasland in :gh:`103015`.)" msgstr "" -#: ../../whatsnew/3.12.rst:885 +#: ../../whatsnew/3.12.rst:878 msgid "" "Add :meth:`sqlite3.Connection.getconfig` and :meth:`sqlite3.Connection." "setconfig` to :class:`sqlite3.Connection` to make configuration changes to a " "database connection. (Contributed by Erlend E. Aasland in :gh:`103489`.)" msgstr "" -#: ../../whatsnew/3.12.rst:891 +#: ../../whatsnew/3.12.rst:884 msgid "statistics" msgstr "statistics" -#: ../../whatsnew/3.12.rst:893 +#: ../../whatsnew/3.12.rst:886 msgid "" "Extend :func:`statistics.correlation` to include as a ``ranked`` method for " "computing the Spearman correlation of ranked data. (Contributed by Raymond " "Hettinger in :gh:`95861`.)" msgstr "" -#: ../../whatsnew/3.12.rst:898 +#: ../../whatsnew/3.12.rst:891 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.12.rst:900 +#: ../../whatsnew/3.12.rst:893 msgid "" "Add the :mod:`sys.monitoring` namespace to expose the new :ref:`PEP 669 " "<whatsnew312-pep669>` monitoring API. (Contributed by Mark Shannon in :gh:" "`103082`.)" msgstr "" -#: ../../whatsnew/3.12.rst:904 +#: ../../whatsnew/3.12.rst:897 msgid "" "Add :func:`sys.activate_stack_trampoline` and :func:`sys." "deactivate_stack_trampoline` for activating and deactivating stack profiler " @@ -1326,7 +1317,7 @@ msgid "" "Shannon in :gh:`96123`.)" msgstr "" -#: ../../whatsnew/3.12.rst:913 +#: ../../whatsnew/3.12.rst:906 msgid "" "Add :data:`sys.last_exc` which holds the last unhandled exception that was " "raised (for post-mortem debugging use cases). Deprecate the three fields " @@ -1335,14 +1326,14 @@ msgid "" "Katriel in :gh:`102778`.)" msgstr "" -#: ../../whatsnew/3.12.rst:919 ../../whatsnew/3.12.rst:1735 +#: ../../whatsnew/3.12.rst:912 ../../whatsnew/3.12.rst:1724 msgid "" ":func:`sys._current_exceptions` now returns a mapping from thread-id to an " "exception instance, rather than to a ``(typ, exc, tb)`` tuple. (Contributed " "by Irit Katriel in :gh:`103176`.)" msgstr "" -#: ../../whatsnew/3.12.rst:923 +#: ../../whatsnew/3.12.rst:916 msgid "" ":func:`sys.setrecursionlimit` and :func:`sys.getrecursionlimit`. The " "recursion limit now applies only to Python code. Builtin functions do not " @@ -1350,11 +1341,11 @@ msgid "" "prevents recursion from causing a virtual machine crash." msgstr "" -#: ../../whatsnew/3.12.rst:929 +#: ../../whatsnew/3.12.rst:922 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.12.rst:931 +#: ../../whatsnew/3.12.rst:924 msgid "" "The :class:`tempfile.NamedTemporaryFile` function has a new optional " "parameter *delete_on_close* (Contributed by Evgeny Zorin in :gh:`58451`.)" @@ -1362,7 +1353,7 @@ msgstr "" ":class:`tempfile.NamedTemporaryFile` 函式新增了一個選擇性參數 " "*delete_on_close* (由 Evgeny Zorin 於 :gh:`58451` 中貢獻。)" -#: ../../whatsnew/3.12.rst:933 +#: ../../whatsnew/3.12.rst:926 msgid "" ":func:`tempfile.mkdtemp` now always returns an absolute path, even if the " "argument provided to the *dir* parameter is a relative path." @@ -1370,19 +1361,11 @@ msgstr "" ":func:`tempfile.mkdtemp` 現在總是會傳回絕對路徑,即使提供給 *dir* 參數的引數" "是相對路徑。" -#: ../../whatsnew/3.12.rst:935 -msgid "" -"As of 3.12.4 on Windows, the default mode ``0o700`` used by :func:`tempfile." -"mkdtemp` now limits access to the new directory due to changes to :func:`os." -"mkdir`. This is a mitigation for :cve:`2024-4030`. (Contributed by Steve " -"Dower in :gh:`118486`.)" -msgstr "" - -#: ../../whatsnew/3.12.rst:941 +#: ../../whatsnew/3.12.rst:930 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.12.rst:943 +#: ../../whatsnew/3.12.rst:932 msgid "" "Add :func:`threading.settrace_all_threads` and :func:`threading." "setprofile_all_threads` that allow to set tracing and profiling functions in " @@ -1390,11 +1373,11 @@ msgid "" "Galindo in :gh:`93503`.)" msgstr "" -#: ../../whatsnew/3.12.rst:949 +#: ../../whatsnew/3.12.rst:938 msgid "tkinter" msgstr "tkinter" -#: ../../whatsnew/3.12.rst:951 +#: ../../whatsnew/3.12.rst:940 msgid "" "``tkinter.Canvas.coords()`` now flattens its arguments. It now accepts not " "only coordinates as separate arguments (``x1, y1, x2, y2, ...``) and a " @@ -1404,11 +1387,11 @@ msgid "" "in :gh:`94473`.)" msgstr "" -#: ../../whatsnew/3.12.rst:960 +#: ../../whatsnew/3.12.rst:949 msgid "tokenize" msgstr "tokenize" -#: ../../whatsnew/3.12.rst:962 +#: ../../whatsnew/3.12.rst:951 msgid "" "The :mod:`tokenize` module includes the changes introduced in :pep:`701`. " "(Contributed by Marta Gómez Macías and Pablo Galindo in :gh:`102856`.) See :" @@ -1416,22 +1399,22 @@ msgid "" "to the :mod:`tokenize` module." msgstr "" -#: ../../whatsnew/3.12.rst:968 +#: ../../whatsnew/3.12.rst:957 msgid "types" msgstr "types" -#: ../../whatsnew/3.12.rst:970 +#: ../../whatsnew/3.12.rst:959 msgid "" "Add :func:`types.get_original_bases` to allow for further introspection of :" "ref:`user-defined-generics` when subclassed. (Contributed by James Hilton-" "Balfe and Alex Waygood in :gh:`101827`.)" msgstr "" -#: ../../whatsnew/3.12.rst:977 +#: ../../whatsnew/3.12.rst:966 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.12.rst:979 +#: ../../whatsnew/3.12.rst:968 msgid "" ":func:`isinstance` checks against :func:`runtime-checkable protocols <typing." "runtime_checkable>` now use :func:`inspect.getattr_static` rather than :func:" @@ -1444,7 +1427,7 @@ msgid "" "affected by this change. (Contributed by Alex Waygood in :gh:`102433`.)" msgstr "" -#: ../../whatsnew/3.12.rst:990 +#: ../../whatsnew/3.12.rst:979 msgid "" "The members of a runtime-checkable protocol are now considered \"frozen\" at " "runtime as soon as the class has been created. Monkey-patching attributes " @@ -1452,7 +1435,7 @@ msgid "" "on :func:`isinstance` checks comparing objects to the protocol. For example::" msgstr "" -#: ../../whatsnew/3.12.rst:995 +#: ../../whatsnew/3.12.rst:984 msgid "" ">>> from typing import Protocol, runtime_checkable\n" ">>> @runtime_checkable\n" @@ -1473,13 +1456,13 @@ msgid "" "True" msgstr "" -#: ../../whatsnew/3.12.rst:1012 +#: ../../whatsnew/3.12.rst:1001 msgid "" "This change was made in order to speed up ``isinstance()`` checks against " "runtime-checkable protocols." msgstr "" -#: ../../whatsnew/3.12.rst:1015 +#: ../../whatsnew/3.12.rst:1004 msgid "" "The performance profile of :func:`isinstance` checks against :func:`runtime-" "checkable protocols <typing.runtime_checkable>` has changed significantly. " @@ -1490,14 +1473,14 @@ msgid "" "`74690` and :gh:`103193`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1023 +#: ../../whatsnew/3.12.rst:1012 msgid "" "All :data:`typing.TypedDict` and :data:`typing.NamedTuple` classes now have " "the ``__orig_bases__`` attribute. (Contributed by Adrian Garcia Badaracco " "in :gh:`103699`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1027 +#: ../../whatsnew/3.12.rst:1016 msgid "" "Add ``frozen_default`` parameter to :func:`typing.dataclass_transform`. " "(Contributed by Erik De Bonte in :gh:`99957`.)" @@ -1505,26 +1488,26 @@ msgstr "" "新增 ``frozen_default`` 參數至 :func:`typing.dataclass_transform`。(由 Erik " "De Bonte 於 :gh:`99957` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1031 +#: ../../whatsnew/3.12.rst:1020 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.12.rst:1033 +#: ../../whatsnew/3.12.rst:1022 msgid "" "The Unicode database has been updated to version 15.0.0. (Contributed by " "Benjamin Peterson in :gh:`96734`)." msgstr "" -#: ../../whatsnew/3.12.rst:1037 ../../whatsnew/3.12.rst:1580 +#: ../../whatsnew/3.12.rst:1026 ../../whatsnew/3.12.rst:1569 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.12.rst:1039 +#: ../../whatsnew/3.12.rst:1028 msgid "" "Add a ``--durations`` command line option, showing the N slowest test cases::" msgstr "新增 ``--durations`` 命令列選項,顯示 N 個最慢的測試案例:" -#: ../../whatsnew/3.12.rst:1041 +#: ../../whatsnew/3.12.rst:1030 msgid "" "python3 -m unittest --durations=3 lib.tests.test_threading\n" ".....\n" @@ -1554,15 +1537,15 @@ msgstr "" "\n" "OK (skipped=3)" -#: ../../whatsnew/3.12.rst:1055 +#: ../../whatsnew/3.12.rst:1044 msgid "(Contributed by Giampaolo Rodola in :gh:`48330`)" msgstr "(由 Giampaolo Rodola 於 :gh:`48330` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1058 +#: ../../whatsnew/3.12.rst:1047 msgid "uuid" msgstr "uuid" -#: ../../whatsnew/3.12.rst:1060 +#: ../../whatsnew/3.12.rst:1049 msgid "" "Add a :ref:`command-line interface <uuid-cli>`. (Contributed by Adam Chhina " "in :gh:`88597`.)" @@ -1570,25 +1553,25 @@ msgstr "" "新增一個\\ :ref:`命令列介面 <uuid-cli>`。(由 Adam Chhina 於 :gh:`88597` 中貢" "獻。)" -#: ../../whatsnew/3.12.rst:1065 +#: ../../whatsnew/3.12.rst:1054 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.12.rst:1067 +#: ../../whatsnew/3.12.rst:1056 msgid "" "Remove ``wstr`` and ``wstr_length`` members from Unicode objects. It reduces " "object size by 8 or 16 bytes on 64bit platform. (:pep:`623`) (Contributed by " "Inada Naoki in :gh:`92536`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1071 +#: ../../whatsnew/3.12.rst:1060 msgid "" "Add experimental support for using the BOLT binary optimizer in the build " "process, which improves performance by 1-5%. (Contributed by Kevin " "Modzelewski in :gh:`90536` and tuned by Donghee Na in :gh:`101525`)" msgstr "" -#: ../../whatsnew/3.12.rst:1075 +#: ../../whatsnew/3.12.rst:1064 msgid "" "Speed up the regular expression substitution (functions :func:`re.sub` and :" "func:`re.subn` and corresponding :class:`!re.Pattern` methods) for " @@ -1596,13 +1579,13 @@ msgid "" "by Serhiy Storchaka in :gh:`91524`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1080 +#: ../../whatsnew/3.12.rst:1069 msgid "" "Speed up :class:`asyncio.Task` creation by deferring expensive string " "formatting. (Contributed by Itamar Oren in :gh:`103793`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1083 +#: ../../whatsnew/3.12.rst:1072 msgid "" "The :func:`tokenize.tokenize` and :func:`tokenize.generate_tokens` functions " "are up to 64% faster as a side effect of the changes required to cover :pep:" @@ -1610,18 +1593,18 @@ msgid "" "Pablo Galindo in :gh:`102856`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1088 +#: ../../whatsnew/3.12.rst:1077 msgid "" "Speed up :func:`super` method calls and attribute loads via the new :opcode:" "`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and Vladimir " "Matveev in :gh:`103497`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1094 +#: ../../whatsnew/3.12.rst:1083 msgid "CPython bytecode changes" msgstr "CPython 位元組碼變更" -#: ../../whatsnew/3.12.rst:1096 +#: ../../whatsnew/3.12.rst:1085 msgid "" "Remove the :opcode:`!LOAD_METHOD` instruction. It has been merged into :" "opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the old :opcode:" @@ -1629,62 +1612,62 @@ msgid "" "by Ken Jin in :gh:`93429`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1101 +#: ../../whatsnew/3.12.rst:1090 msgid "" "Remove the :opcode:`!JUMP_IF_FALSE_OR_POP` and :opcode:`!" "JUMP_IF_TRUE_OR_POP` instructions. (Contributed by Irit Katriel in :gh:" "`102859`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1104 +#: ../../whatsnew/3.12.rst:1093 msgid "" "Remove the :opcode:`!PRECALL` instruction. (Contributed by Mark Shannon in :" "gh:`92925`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1107 +#: ../../whatsnew/3.12.rst:1096 msgid "" "Add the :opcode:`BINARY_SLICE` and :opcode:`STORE_SLICE` instructions. " "(Contributed by Mark Shannon in :gh:`94163`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1110 +#: ../../whatsnew/3.12.rst:1099 msgid "" "Add the :opcode:`CALL_INTRINSIC_1` instructions. (Contributed by Mark " "Shannon in :gh:`99005`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1113 +#: ../../whatsnew/3.12.rst:1102 msgid "" "Add the :opcode:`CALL_INTRINSIC_2` instruction. (Contributed by Irit Katriel " "in :gh:`101799`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1116 +#: ../../whatsnew/3.12.rst:1105 msgid "" "Add the :opcode:`CLEANUP_THROW` instruction. (Contributed by Brandt Bucher " "in :gh:`90997`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1119 +#: ../../whatsnew/3.12.rst:1108 msgid "" "Add the :opcode:`!END_SEND` instruction. (Contributed by Mark Shannon in :gh:" "`103082`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1122 +#: ../../whatsnew/3.12.rst:1111 msgid "" "Add the :opcode:`LOAD_FAST_AND_CLEAR` instruction as part of the " "implementation of :pep:`709`. (Contributed by Carl Meyer in :gh:`101441`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1125 +#: ../../whatsnew/3.12.rst:1114 msgid "" "Add the :opcode:`LOAD_FAST_CHECK` instruction. (Contributed by Dennis " "Sweeney in :gh:`93143`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1128 +#: ../../whatsnew/3.12.rst:1117 msgid "" "Add the :opcode:`LOAD_FROM_DICT_OR_DEREF`, :opcode:" "`LOAD_FROM_DICT_OR_GLOBALS`, and :opcode:`LOAD_LOCALS` opcodes as part of " @@ -1693,41 +1676,41 @@ msgid "" "`LOAD_FROM_DICT_OR_DEREF`. (Contributed by Jelle Zijlstra in :gh:`103764`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1134 +#: ../../whatsnew/3.12.rst:1123 msgid "" "Add the :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer " "and Vladimir Matveev in :gh:`103497`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1137 +#: ../../whatsnew/3.12.rst:1126 msgid "" "Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang in :" "gh:`101632`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1140 +#: ../../whatsnew/3.12.rst:1129 msgid "Demos and Tools" msgstr "" -#: ../../whatsnew/3.12.rst:1142 +#: ../../whatsnew/3.12.rst:1131 msgid "" "Remove the ``Tools/demo/`` directory which contained old demo scripts. A " "copy can be found in the `old-demos project <https://github.com/gvanrossum/" "old-demos>`_. (Contributed by Victor Stinner in :gh:`97681`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1147 +#: ../../whatsnew/3.12.rst:1136 msgid "" "Remove outdated example scripts of the ``Tools/scripts/`` directory. A copy " "can be found in the `old-demos project <https://github.com/gvanrossum/old-" "demos>`_. (Contributed by Victor Stinner in :gh:`97669`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1154 ../../whatsnew/3.12.rst:2138 +#: ../../whatsnew/3.12.rst:1143 ../../whatsnew/3.12.rst:2127 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.12.rst:1156 +#: ../../whatsnew/3.12.rst:1145 #: ../../deprecations/pending-removal-in-3.14.rst:4 msgid "" ":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" @@ -1738,7 +1721,7 @@ msgstr "" "*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " "於 :gh:`92248` 貢獻。)" -#: ../../whatsnew/3.12.rst:1161 +#: ../../whatsnew/3.12.rst:1150 msgid "" ":mod:`ast`: The following :mod:`ast` features have been deprecated in " "documentation since Python 3.8, now cause a :exc:`DeprecationWarning` to be " @@ -1746,32 +1729,32 @@ msgid "" "Python 3.14:" msgstr "" -#: ../../whatsnew/3.12.rst:1165 +#: ../../whatsnew/3.12.rst:1154 #: ../../deprecations/pending-removal-in-3.14.rst:13 msgid ":class:`!ast.Num`" msgstr ":class:`!ast.Num`" -#: ../../whatsnew/3.12.rst:1166 +#: ../../whatsnew/3.12.rst:1155 #: ../../deprecations/pending-removal-in-3.14.rst:14 msgid ":class:`!ast.Str`" msgstr ":class:`!ast.Str`" -#: ../../whatsnew/3.12.rst:1167 +#: ../../whatsnew/3.12.rst:1156 #: ../../deprecations/pending-removal-in-3.14.rst:15 msgid ":class:`!ast.Bytes`" msgstr ":class:`!ast.Bytes`" -#: ../../whatsnew/3.12.rst:1168 +#: ../../whatsnew/3.12.rst:1157 #: ../../deprecations/pending-removal-in-3.14.rst:16 msgid ":class:`!ast.NameConstant`" msgstr ":class:`!ast.NameConstant`" -#: ../../whatsnew/3.12.rst:1169 +#: ../../whatsnew/3.12.rst:1158 #: ../../deprecations/pending-removal-in-3.14.rst:17 msgid ":class:`!ast.Ellipsis`" msgstr ":class:`!ast.Ellipsis`" -#: ../../whatsnew/3.12.rst:1171 +#: ../../whatsnew/3.12.rst:1160 #: ../../deprecations/pending-removal-in-3.14.rst:19 msgid "" "Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" @@ -1779,12 +1762,12 @@ msgid "" msgstr "" "請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" -#: ../../whatsnew/3.12.rst:1174 +#: ../../whatsnew/3.12.rst:1163 #: ../../deprecations/pending-removal-in-3.14.rst:22 msgid ":mod:`asyncio`:" msgstr ":mod:`asyncio`:" -#: ../../whatsnew/3.12.rst:1176 +#: ../../whatsnew/3.12.rst:1165 msgid "" "The child watcher classes :class:`asyncio.MultiLoopChildWatcher`, :class:" "`asyncio.FastChildWatcher`, :class:`asyncio.AbstractChildWatcher` and :class:" @@ -1792,7 +1775,7 @@ msgid "" "3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1182 +#: ../../whatsnew/3.12.rst:1171 #: ../../deprecations/pending-removal-in-3.14.rst:30 msgid "" ":func:`asyncio.set_child_watcher`, :func:`asyncio.get_child_watcher`, :meth:" @@ -1805,7 +1788,7 @@ msgstr "" "AbstractEventLoopPolicy.get_child_watcher` 已被棄用並將在 Python 3.14 中移" "除。(由 Kumar Aditya 於 :gh:`94597` 貢獻。)" -#: ../../whatsnew/3.12.rst:1188 +#: ../../whatsnew/3.12.rst:1177 #: ../../deprecations/pending-removal-in-3.14.rst:36 msgid "" "The :meth:`~asyncio.get_event_loop` method of the default event loop policy " @@ -1817,7 +1800,7 @@ msgstr "" "件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " "和 Guido van Rossum 於 :gh:`100160` 貢獻。)" -#: ../../whatsnew/3.12.rst:1193 +#: ../../whatsnew/3.12.rst:1182 #: ../../deprecations/pending-removal-in-future.rst:41 msgid "" ":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " @@ -1828,7 +1811,7 @@ msgstr "" "被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " "Roshan 於 :gh:`103636` 貢獻。)" -#: ../../whatsnew/3.12.rst:1197 +#: ../../whatsnew/3.12.rst:1186 msgid "" ":mod:`collections.abc`: Deprecated :class:`collections.abc.ByteString`. " "Prefer :class:`Sequence` or :class:`collections.abc.Buffer`. For use in " @@ -1836,7 +1819,7 @@ msgid "" "abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1202 +#: ../../whatsnew/3.12.rst:1191 msgid "" ":mod:`datetime`: :class:`datetime.datetime`'s :meth:`~datetime.datetime." "utcnow` and :meth:`~datetime.datetime.utcfromtimestamp` are deprecated and " @@ -1846,7 +1829,7 @@ msgid "" "set to :const:`datetime.UTC`. (Contributed by Paul Ganssle in :gh:`103857`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1210 +#: ../../whatsnew/3.12.rst:1199 msgid "" ":mod:`email`: Deprecate the *isdst* parameter in :func:`email.utils." "localtime`. (Contributed by Alan Williams in :gh:`72346`.)" @@ -1854,48 +1837,48 @@ msgstr "" ":mod:`email`:棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " "Alan Williams 於 :gh:`72346` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1213 +#: ../../whatsnew/3.12.rst:1202 msgid "" ":mod:`importlib.abc`: Deprecated the following classes, scheduled for " "removal in Python 3.14:" msgstr ":mod:`importlib.abc`:棄用下列類別,預定於 Python 3.14 中移除:" -#: ../../whatsnew/3.12.rst:1216 -#: ../../deprecations/pending-removal-in-3.14.rst:55 +#: ../../whatsnew/3.12.rst:1205 +#: ../../deprecations/pending-removal-in-3.14.rst:52 msgid ":class:`!importlib.abc.ResourceReader`" msgstr ":class:`!importlib.abc.ResourceReader`" -#: ../../whatsnew/3.12.rst:1217 -#: ../../deprecations/pending-removal-in-3.14.rst:56 +#: ../../whatsnew/3.12.rst:1206 +#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":class:`!importlib.abc.Traversable`" msgstr ":class:`!importlib.abc.Traversable`" -#: ../../whatsnew/3.12.rst:1218 -#: ../../deprecations/pending-removal-in-3.14.rst:57 +#: ../../whatsnew/3.12.rst:1207 +#: ../../deprecations/pending-removal-in-3.14.rst:54 msgid ":class:`!importlib.abc.TraversableResources`" msgstr ":class:`!importlib.abc.TraversableResources`" -#: ../../whatsnew/3.12.rst:1220 -#: ../../deprecations/pending-removal-in-3.14.rst:59 +#: ../../whatsnew/3.12.rst:1209 +#: ../../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:1222 -#: ../../deprecations/pending-removal-in-3.14.rst:61 +#: ../../whatsnew/3.12.rst:1211 +#: ../../deprecations/pending-removal-in-3.14.rst:58 msgid ":class:`importlib.resources.abc.Traversable`" msgstr ":class:`importlib.resources.abc.Traversable`" -#: ../../whatsnew/3.12.rst:1223 -#: ../../deprecations/pending-removal-in-3.14.rst:62 +#: ../../whatsnew/3.12.rst:1212 +#: ../../deprecations/pending-removal-in-3.14.rst:59 msgid ":class:`importlib.resources.abc.TraversableResources`" msgstr ":class:`importlib.resources.abc.TraversableResources`" -#: ../../whatsnew/3.12.rst:1225 -#: ../../deprecations/pending-removal-in-3.14.rst:64 +#: ../../whatsnew/3.12.rst:1214 +#: ../../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:1227 +#: ../../whatsnew/3.12.rst:1216 msgid "" ":mod:`itertools`: Deprecate the support for copy, deepcopy, and pickle " "operations, which is undocumented, inefficient, historically buggy, and " @@ -1904,7 +1887,7 @@ msgid "" "`101588`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1233 +#: ../../whatsnew/3.12.rst:1222 msgid "" ":mod:`multiprocessing`: In Python 3.14, the default :mod:`multiprocessing` " "start method will change to a safer one on Linux, BSDs, and other non-macOS " @@ -1916,14 +1899,14 @@ msgid "" "methods <multiprocessing-start-methods>`." msgstr "" -#: ../../whatsnew/3.12.rst:1243 +#: ../../whatsnew/3.12.rst:1232 msgid "" ":mod:`pkgutil`: :func:`pkgutil.find_loader` and :func:`pkgutil.get_loader` " "are deprecated and will be removed in Python 3.14; use :func:`importlib.util." "find_spec` instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1248 +#: ../../whatsnew/3.12.rst:1237 msgid "" ":mod:`pty`: The module has two undocumented ``master_open()`` and " "``slave_open()`` functions that have been deprecated since Python 2 but only " @@ -1931,11 +1914,11 @@ msgid "" "(Contributed by Soumendra Ganguly and Gregory P. Smith in :gh:`85984`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1253 +#: ../../whatsnew/3.12.rst:1242 msgid ":mod:`os`:" msgstr ":mod:`os`:" -#: ../../whatsnew/3.12.rst:1255 +#: ../../whatsnew/3.12.rst:1244 msgid "" "The ``st_ctime`` fields return by :func:`os.stat` and :func:`os.lstat` on " "Windows are deprecated. In a future release, they will contain the last " @@ -1944,7 +1927,7 @@ msgid "" "``st_birthtime`` field. (Contributed by Steve Dower in :gh:`99726`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1261 +#: ../../whatsnew/3.12.rst:1250 msgid "" "On POSIX platforms, :func:`os.fork` can now raise a :exc:" "`DeprecationWarning` when it can detect being called from a multithreaded " @@ -1958,14 +1941,14 @@ msgid "" "platform compatibility problem to developers." msgstr "" -#: ../../whatsnew/3.12.rst:1271 +#: ../../whatsnew/3.12.rst:1260 msgid "" "When this warning appears due to usage of :mod:`multiprocessing` or :mod:" "`concurrent.futures` the fix is to use a different :mod:`multiprocessing` " "start method such as ``\"spawn\"`` or ``\"forkserver\"``." msgstr "" -#: ../../whatsnew/3.12.rst:1275 +#: ../../whatsnew/3.12.rst:1264 msgid "" ":mod:`shutil`: The *onerror* argument of :func:`shutil.rmtree` is " "deprecated; use *onexc* instead. (Contributed by Irit Katriel in :gh:" @@ -1974,19 +1957,19 @@ msgstr "" ":mod:`shutil`::func:`shutil.rmtree` 的 *onerror* 引數已被棄用,請改用 " "*onexc*。(由 Irit Katriel 於 :gh:`102828` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1278 -#: ../../deprecations/pending-removal-in-3.14.rst:94 +#: ../../whatsnew/3.12.rst:1267 +#: ../../deprecations/pending-removal-in-3.14.rst:91 msgid ":mod:`sqlite3`:" msgstr ":mod:`sqlite3`:" -#: ../../whatsnew/3.12.rst:1280 +#: ../../whatsnew/3.12.rst:1269 msgid "" ":ref:`default adapters and converters <sqlite3-default-converters>` are now " "deprecated. Instead, use the :ref:`sqlite3-adapter-converter-recipes` and " "tailor them to your needs. (Contributed by Erlend E. Aasland in :gh:`90016`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1286 +#: ../../whatsnew/3.12.rst:1275 msgid "" "In :meth:`~sqlite3.Cursor.execute`, :exc:`DeprecationWarning` is now emitted " "when :ref:`named placeholders <sqlite3-placeholders>` are used together with " @@ -1996,39 +1979,40 @@ msgid "" "Erlend E. Aasland in :gh:`101698`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1293 +#: ../../whatsnew/3.12.rst:1282 msgid "" ":mod:`sys`: The :data:`sys.last_type`, :data:`sys.last_value` and :data:`sys." "last_traceback` fields are deprecated. Use :data:`sys.last_exc` instead. " "(Contributed by Irit Katriel in :gh:`102778`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1297 +#: ../../whatsnew/3.12.rst:1286 msgid "" ":mod:`tarfile`: Extracting tar archives without specifying *filter* is " "deprecated until Python 3.14, when ``'data'`` filter will become the " "default. See :ref:`tarfile-extraction-filter` for details." msgstr "" -#: ../../whatsnew/3.12.rst:1301 +#: ../../whatsnew/3.12.rst:1290 +#: ../../deprecations/pending-removal-in-3.15.rst:53 msgid ":mod:`typing`:" msgstr ":mod:`typing`:" -#: ../../whatsnew/3.12.rst:1303 +#: ../../whatsnew/3.12.rst:1292 msgid "" ":class:`typing.Hashable` and :class:`typing.Sized`, aliases for :class:" "`collections.abc.Hashable` and :class:`collections.abc.Sized` respectively, " "are deprecated. (:gh:`94309`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1307 +#: ../../whatsnew/3.12.rst:1296 msgid "" ":class:`typing.ByteString`, deprecated since Python 3.9, now causes a :exc:" "`DeprecationWarning` to be emitted when it is used. (Contributed by Alex " "Waygood in :gh:`91896`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1311 +#: ../../whatsnew/3.12.rst:1300 msgid "" ":mod:`xml.etree.ElementTree`: The module now emits :exc:`DeprecationWarning` " "when testing the truth value of an :class:`xml.etree.ElementTree.Element`. " @@ -2036,7 +2020,7 @@ msgid "" "implementation emitted nothing. (Contributed by Jacob Walls in :gh:`83122`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1317 +#: ../../whatsnew/3.12.rst:1306 msgid "" "The 3-arg signatures (type, value, traceback) of :meth:`coroutine throw() " "<coroutine.throw>`, :meth:`generator throw() <generator.throw>` and :meth:" @@ -2045,21 +2029,21 @@ msgid "" "instead. (Contributed by Ofey Chan in :gh:`89874`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1323 +#: ../../whatsnew/3.12.rst:1312 msgid "" ":exc:`DeprecationWarning` is now raised when ``__package__`` on a module " "differs from ``__spec__.parent`` (previously it was :exc:`ImportWarning`). " "(Contributed by Brett Cannon in :gh:`65961`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1328 +#: ../../whatsnew/3.12.rst:1317 msgid "" "Setting ``__package__`` or ``__cached__`` on a module is deprecated, and " "will cease to be set or taken into consideration by the import system in " "Python 3.14. (Contributed by Brett Cannon in :gh:`65961`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1332 +#: ../../whatsnew/3.12.rst:1321 msgid "" "The bitwise inversion operator (``~``) on bool is deprecated. It will throw " "an error in Python 3.16. Use ``not`` for logical negation of bools instead. " @@ -2068,7 +2052,7 @@ msgid "" "Tim Hoffmann in :gh:`103487`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1338 +#: ../../whatsnew/3.12.rst:1327 msgid "" "Accessing :attr:`~codeobject.co_lnotab` on code objects was deprecated in " "Python 3.10 via :pep:`626`, but it only got a proper :exc:" @@ -2085,80 +2069,80 @@ msgid "Modules (see :pep:`594`):" msgstr "模組(請見 :pep:`594`):" #: ../../deprecations/pending-removal-in-3.13.rst:6 -msgid ":mod:`aifc`" -msgstr ":mod:`aifc`" +msgid ":mod:`!aifc`" +msgstr ":mod:`!aifc`" #: ../../deprecations/pending-removal-in-3.13.rst:7 -msgid ":mod:`audioop`" -msgstr ":mod:`audioop`" +msgid ":mod:`!audioop`" +msgstr ":mod:`!audioop`" #: ../../deprecations/pending-removal-in-3.13.rst:8 -msgid ":mod:`cgi`" -msgstr ":mod:`cgi`" +msgid ":mod:`!cgi`" +msgstr ":mod:`!cgi`" #: ../../deprecations/pending-removal-in-3.13.rst:9 -msgid ":mod:`cgitb`" -msgstr ":mod:`cgitb`" +msgid ":mod:`!cgitb`" +msgstr ":mod:`!cgitb`" #: ../../deprecations/pending-removal-in-3.13.rst:10 -msgid ":mod:`chunk`" -msgstr ":mod:`chunk`" +msgid ":mod:`!chunk`" +msgstr ":mod:`!chunk`" #: ../../deprecations/pending-removal-in-3.13.rst:11 -msgid ":mod:`crypt`" -msgstr ":mod:`crypt`" +msgid ":mod:`!crypt`" +msgstr ":mod:`!crypt`" #: ../../deprecations/pending-removal-in-3.13.rst:12 -msgid ":mod:`imghdr`" -msgstr ":mod:`imghdr`" +msgid ":mod:`!imghdr`" +msgstr ":mod:`!imghdr`" #: ../../deprecations/pending-removal-in-3.13.rst:13 -msgid ":mod:`mailcap`" -msgstr ":mod:`mailcap`" +msgid ":mod:`!mailcap`" +msgstr ":mod:`!mailcap`" #: ../../deprecations/pending-removal-in-3.13.rst:14 -msgid ":mod:`msilib`" -msgstr ":mod:`msilib`" +msgid ":mod:`!msilib`" +msgstr ":mod:`!msilib`" #: ../../deprecations/pending-removal-in-3.13.rst:15 -msgid ":mod:`nis`" -msgstr ":mod:`nis`" +msgid ":mod:`!nis`" +msgstr ":mod:`!nis`" #: ../../deprecations/pending-removal-in-3.13.rst:16 -msgid ":mod:`nntplib`" -msgstr ":mod:`nntplib`" +msgid ":mod:`!nntplib`" +msgstr ":mod:`!nntplib`" #: ../../deprecations/pending-removal-in-3.13.rst:17 -msgid ":mod:`ossaudiodev`" -msgstr ":mod:`ossaudiodev`" +msgid ":mod:`!ossaudiodev`" +msgstr ":mod:`!ossaudiodev`" #: ../../deprecations/pending-removal-in-3.13.rst:18 -msgid ":mod:`pipes`" -msgstr ":mod:`pipes`" +msgid ":mod:`!pipes`" +msgstr ":mod:`!pipes`" #: ../../deprecations/pending-removal-in-3.13.rst:19 -msgid ":mod:`sndhdr`" -msgstr ":mod:`sndhdr`" +msgid ":mod:`!sndhdr`" +msgstr ":mod:`!sndhdr`" #: ../../deprecations/pending-removal-in-3.13.rst:20 -msgid ":mod:`spwd`" -msgstr ":mod:`spwd`" +msgid ":mod:`!spwd`" +msgstr ":mod:`!spwd`" #: ../../deprecations/pending-removal-in-3.13.rst:21 -msgid ":mod:`sunau`" -msgstr ":mod:`sunau`" +msgid ":mod:`!sunau`" +msgstr ":mod:`!sunau`" #: ../../deprecations/pending-removal-in-3.13.rst:22 -msgid ":mod:`telnetlib`" -msgstr ":mod:`telnetlib`" +msgid ":mod:`!telnetlib`" +msgstr ":mod:`!telnetlib`" #: ../../deprecations/pending-removal-in-3.13.rst:23 -msgid ":mod:`uu`" -msgstr ":mod:`uu`" +msgid ":mod:`!uu`" +msgstr ":mod:`!uu`" #: ../../deprecations/pending-removal-in-3.13.rst:24 -msgid ":mod:`xdrlib`" -msgstr ":mod:`xdrlib`" +msgid ":mod:`!xdrlib`" +msgstr ":mod:`!xdrlib`" #: ../../deprecations/pending-removal-in-3.13.rst:26 msgid "Other modules:" @@ -2297,18 +2281,10 @@ msgstr "" "Alan Williams 於 :gh:`72346` 貢獻。)" #: ../../deprecations/pending-removal-in-3.14.rst:50 -msgid "" -":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " -"taken into consideration by the import system (:gh:`97879`)." -msgstr "" -":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " -"系統考慮。 (:gh:`97879`)" - -#: ../../deprecations/pending-removal-in-3.14.rst:53 msgid ":mod:`importlib.abc` deprecated classes:" msgstr ":mod:`importlib.abc` 的已棄用類別:" -#: ../../deprecations/pending-removal-in-3.14.rst:66 +#: ../../deprecations/pending-removal-in-3.14.rst:63 msgid "" ":mod:`itertools` had undocumented, inefficient, historically buggy, and " "inconsistent support for copy, deepcopy, and pickle operations. This will be " @@ -2319,7 +2295,7 @@ msgstr "" "deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " "(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:72 +#: ../../deprecations/pending-removal-in-3.14.rst:69 msgid "" ":mod:`multiprocessing`: The default start method will change to a safer one " "on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " @@ -2336,7 +2312,7 @@ msgstr "" "API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" "`multiprocessing-start-methods`。" -#: ../../deprecations/pending-removal-in-3.14.rst:80 +#: ../../deprecations/pending-removal-in-3.14.rst:77 msgid "" ":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." "PurePath.relative_to`: passing additional arguments is deprecated." @@ -2344,7 +2320,7 @@ msgstr "" ":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" "`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" -#: ../../deprecations/pending-removal-in-3.14.rst:84 +#: ../../deprecations/pending-removal-in-3.14.rst:81 msgid "" ":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " "now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " @@ -2354,23 +2330,23 @@ msgstr "" "現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." "find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:89 +#: ../../deprecations/pending-removal-in-3.14.rst:86 msgid ":mod:`pty`:" msgstr ":mod:`pty`:" -#: ../../deprecations/pending-removal-in-3.14.rst:91 +#: ../../deprecations/pending-removal-in-3.14.rst:88 msgid "``master_open()``: use :func:`pty.openpty`." msgstr "``master_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:92 +#: ../../deprecations/pending-removal-in-3.14.rst:89 msgid "``slave_open()``: use :func:`pty.openpty`." msgstr "``slave_open()``:請用 :func:`pty.openpty`。" -#: ../../deprecations/pending-removal-in-3.14.rst:96 +#: ../../deprecations/pending-removal-in-3.14.rst:93 msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" -#: ../../deprecations/pending-removal-in-3.14.rst:98 +#: ../../deprecations/pending-removal-in-3.14.rst:95 msgid "" ":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" "ref:`named placeholders <sqlite3-placeholders>` are used and *parameters* is " @@ -2380,7 +2356,7 @@ msgstr "" "使用 :ref:`named placeholders <sqlite3-placeholders>` 且 *parameters* 是序列" "而不是 :class:`dict`。" -#: ../../deprecations/pending-removal-in-3.14.rst:102 +#: ../../deprecations/pending-removal-in-3.14.rst:99 msgid "" "date and datetime adapter, date and timestamp converter: see the :mod:" "`sqlite3` documentation for suggested replacement recipes." @@ -2388,7 +2364,7 @@ msgstr "" "date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" "參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" -#: ../../deprecations/pending-removal-in-3.14.rst:105 +#: ../../deprecations/pending-removal-in-3.14.rst:102 msgid "" ":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " "deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " @@ -2400,7 +2376,7 @@ msgstr "" "exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" "`101866` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.14.rst:112 +#: ../../deprecations/pending-removal-in-3.14.rst:109 msgid "" ":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " "causes a :exc:`DeprecationWarning` to be emitted when it is used." @@ -2408,7 +2384,7 @@ msgstr "" ":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" "使用時會發出 :exc:`DeprecationWarning`。" -#: ../../deprecations/pending-removal-in-3.14.rst:115 +#: ../../deprecations/pending-removal-in-3.14.rst:112 msgid "" ":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " "intended to be a public API. (Contributed by Gregory P. Smith in :gh:" @@ -2423,143 +2399,223 @@ msgid "Pending Removal in Python 3.15" msgstr "Python 3.15 中待移除的項目" #: ../../deprecations/pending-removal-in-3.15.rst:4 +msgid ":mod:`ctypes`:" +msgstr ":mod:`ctypes`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:6 msgid "" -":class:`http.server.CGIHTTPRequestHandler` will be removed along with its " -"related ``--cgi`` flag to ``python -m http.server``. It was obsolete and " -"rarely used. No direct replacement exists. *Anything* is better than CGI " -"to interface a web server with a request handler." +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." msgstr "" -":class:`http.server.CGIHTTPRequestHandler` 將會被移除,連同其相關的 ``--" -"cgi`` 旗標到 ``python -m http.server``。它已經過時且很少被使用。沒有直接的替" -"代方案。*任何東西*\\ 都比 CGI 更好的來介接一個帶有請求處理器的網頁伺服器。" +"自 Python 3.13 起,未記錄的 :func:`!ctypes.SetPointerType` 函式已被棄用。" #: ../../deprecations/pending-removal-in-3.15.rst:9 +msgid ":mod:`http.server`:" +msgstr ":mod:`http.server`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:11 msgid "" -":class:`locale`: :func:`locale.getdefaultlocale` was deprecated in Python " -"3.11 and originally planned for removal in Python 3.13 (:gh:`90817`), but " -"removal has been postponed to Python 3.15. Use :func:`locale.setlocale`, :" -"func:`locale.getencoding` and :func:`locale.getlocale` instead. (Contributed " -"by Hugo van Kemenade in :gh:`111187`.)" +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." msgstr "" -":class:`locale`::func:`locale.getdefaultlocale` 已在 Python 3.11 中被棄用," -"原本計劃在 Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :" -"func:`locale.setlocale`、:func:`locale.getencoding` 和 :func:`locale." -"getlocale`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" +"過時且很少使用的 :class:`~http.server.CGIHTTPRequestHandler` 自 Python 3.13 " +"起已被棄用。不存在直接的替代。*任何東西*\\ 都比 CGI 更好地將 Web 伺服器與請求" +"處理程序介接起來。" -#: ../../deprecations/pending-removal-in-3.15.rst:16 +#: ../../deprecations/pending-removal-in-3.15.rst:17 msgid "" -":mod:`pathlib`: :meth:`pathlib.PurePath.is_reserved` is deprecated and " -"scheduled for removal in Python 3.15. From Python 3.13 onwards, use ``os." -"path.isreserved`` to detect reserved paths on Windows." +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." msgstr "" -":mod:`pathlib`::meth:`pathlib.PurePath.is_reserved` 已被棄用並計劃在 Python " -"3.15 中移除。從 Python 3.13 開始,請用 ``os.path.isreserved`` 來偵測 Windows " -"上的保留路徑。" +"自 Python 3.13 起,:program:`python -m http.server` 命令列介面的 :option:`!--" +"cgi` 旗標已被棄用。" -#: ../../deprecations/pending-removal-in-3.15.rst:21 +#: ../../deprecations/pending-removal-in-3.15.rst:20 msgid "" -":mod:`platform`: :func:`~platform.java_ver` is deprecated and will be " -"removed in 3.15. It was largely untested, had a confusing API, and was only " -"useful for Jython support. (Contributed by Nikita Sobolev in :gh:`116349`.)" +":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " +"taken into consideration by the import system (:gh:`97879`)." msgstr "" -":mod:`platform`::func:`~platform.java_ver` 已被棄用並將在 3.15 中移除。它幾" -"乎沒有被測試過,API 令人困惑並且只對 Jython 支援有用。 (由 Nikita Sobolev " -"於 :gh:`116349` 貢獻。)" +":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " +"系統考慮。 (:gh:`97879`)" -#: ../../deprecations/pending-removal-in-3.15.rst:27 +#: ../../deprecations/pending-removal-in-3.15.rst:23 +msgid ":class:`locale`:" +msgstr ":class:`locale`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:25 msgid "" -":mod:`threading`: Passing any arguments to :func:`threading.RLock` is now " -"deprecated. C version allows any numbers of args and kwargs, but they are " -"just ignored. Python version does not allow any arguments. All arguments " -"will be removed from :func:`threading.RLock` in Python 3.15. (Contributed by " -"Nikita Sobolev in :gh:`102029`.)" +"The :func:`~locale.getdefaultlocale` function has been deprecated since " +"Python 3.11. Its removal was originally planned for Python 3.13 (:gh:" +"`90817`), but has been postponed to Python 3.15. Use :func:`~locale." +"getlocale`, :func:`~locale.setlocale`, and :func:`~locale.getencoding` " +"instead. (Contributed by Hugo van Kemenade in :gh:`111187`.)" msgstr "" -":mod:`threading`:對 :func:`threading.RLock` 傳遞任何引數現在已被棄用。C 版本" -"允許任意數量的引數和關鍵字引數,但它們會被忽略。Python 版本不允許任何引數。所" -"有引數將在 Python 3.15 中從 :func:`threading.RLock` 中移除。 (由 Nikita " -"Sobolev 於 :gh:`102029` 貢獻。)" +":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" -#: ../../deprecations/pending-removal-in-3.15.rst:34 -msgid ":class:`typing.NamedTuple`:" -msgstr ":class:`typing.NamedTuple`:" +#: ../../deprecations/pending-removal-in-3.15.rst:33 +msgid ":mod:`pathlib`:" +msgstr ":mod:`pathlib`:" -#: ../../deprecations/pending-removal-in-3.15.rst:36 +#: ../../deprecations/pending-removal-in-3.15.rst:35 msgid "" -"The undocumented keyword argument syntax for creating :class:`!NamedTuple` " -"classes (``NT = NamedTuple(\"NT\", x=int)``) is deprecated, and will be " -"disallowed in 3.15. Use the class-based syntax or the functional syntax " -"instead." +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." msgstr "" -"用於建立 :class:`!NamedTuple` 類別的未以文件記錄之關鍵字引數語法 (``NT = " -"NamedTuple(\"NT\", x=int)``) 已棄用,並將在 3.15 中被禁止。請改用基於類別的語" -"法或函式語法 (functional syntax)。" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" -#: ../../deprecations/pending-removal-in-3.15.rst:40 +#: ../../deprecations/pending-removal-in-3.15.rst:39 +msgid ":mod:`platform`:" +msgstr ":mod:`platform`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:41 msgid "" -"When using the functional syntax to create a :class:`!NamedTuple` class, " -"failing to pass a value to the *fields* parameter (``NT = " -"NamedTuple(\"NT\")``) is deprecated. Passing ``None`` to the *fields* " -"parameter (``NT = NamedTuple(\"NT\", None)``) is also deprecated. Both will " -"be disallowed in Python 3.15. To create a :class:`!NamedTuple` class with 0 " -"fields, use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", " -"[])``." +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." msgstr "" -"當使用函式語法來建立 :class:`!NamedTuple` 類別時,沒將值傳遞給 *fields* 參數" -"的方式 (``NT = NamedTuple(\"NT\")``) 已被棄用,將 ``None`` 傳遞給 *fields* 參" -"數(``NT = NamedTuple(\"NT\", None)``)也已被棄用。這兩者將在 Python 3.15 中" -"會被禁止。要建立一個沒有欄位的 :class:`!NamedTuple` 類別,請使用 ``class " -"NT(NamedTuple): pass`` 或 ``NT = NamedTuple(\"NT\", [])``。" +"自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" +"援有用,具有令人困惑的 API,基本上未經測試。" + +#: ../../deprecations/pending-removal-in-3.15.rst:45 +msgid ":mod:`threading`:" +msgstr ":mod:`threading`:" #: ../../deprecations/pending-removal-in-3.15.rst:47 msgid "" -":class:`typing.TypedDict`: When using the functional syntax to create a :" -"class:`!TypedDict` class, failing to pass a value to the *fields* parameter " -"(``TD = TypedDict(\"TD\")``) is deprecated. Passing ``None`` to the *fields* " -"parameter (``TD = TypedDict(\"TD\", None)``) is also deprecated. Both will " -"be disallowed in Python 3.15. To create a :class:`!TypedDict` class with 0 " -"fields, use ``class TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``." +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." +msgstr "" +":func:`~threading.RLock` 在 Python 3.15 中將不接受任何引數。自 Python 3.14 " +"起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" +"任意數量的位置或關鍵字引數,並忽略每個引數。" + +#: ../../deprecations/pending-removal-in-3.15.rst:55 +msgid "" +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." msgstr "" -":class:`typing.TypedDict`:當使用函式語法來建立 :class:`!TypedDict` 類別時," -"沒將值傳遞給 *fields* 參數的方式(``TD = TypedDict(\"TD\")``)已被棄用,將 " -"``None`` 傳遞給 *fields* 參數(``TD = TypedDict(\"TD\", None)``)也已被棄用。" -"這兩者將在 Python 3.15 中會被禁止。要建立一個沒有欄位的 :class:`!TypedDict` " -"類別,請使用 ``class TD(TypedDict): pass`` 或 ``TD = TypedDict(\"TD\", " -"{})``。" +"用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " +"(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" +"用基於類別的語法或函式語法 (functional syntax)。" -#: ../../deprecations/pending-removal-in-3.15.rst:54 +#: ../../deprecations/pending-removal-in-3.15.rst:61 msgid "" -":mod:`wave`: Deprecate the ``getmark()``, ``setmark()`` and ``getmarkers()`` " -"methods of the :class:`wave.Wave_read` and :class:`wave.Wave_write` classes. " -"They will be removed in Python 3.15. (Contributed by Victor Stinner in :gh:" -"`105096`.)" +"The :func:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." msgstr "" -":mod:`wave`:已棄用 :class:`wave.Wave_read` 和 :class:`wave.Wave_write` 類別" -"的 ``getmark()``、``setmark()`` 和 ``getmarkers()`` 方法。它們將在 Python " -"3.15 中被移除。 (由 Victor Stinner 於 :gh:`105096` 貢獻。)" +"自 Python 3.13 起,:func:`typing.no_type_check_decorator` 裝飾器函式已被棄" +"用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" +"援。" + +#: ../../deprecations/pending-removal-in-3.15.rst:66 +msgid ":mod:`wave`:" +msgstr ":mod:`wave`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:68 +msgid "" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." +msgstr "" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" #: ../../deprecations/pending-removal-in-3.16.rst:2 msgid "Pending Removal in Python 3.16" msgstr "Python 3.16 中待移除的項目" #: ../../deprecations/pending-removal-in-3.16.rst:4 +#: ../../deprecations/pending-removal-in-future.rst:12 +msgid ":mod:`builtins`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" + +#: ../../deprecations/pending-removal-in-3.16.rst:13 +msgid ":mod:`array`:" +msgstr ":mod:`array`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:15 msgid "" -":mod:`array`: :class:`array.array` ``'u'`` type (:c:type:`wchar_t`): use the " -"``'w'`` type instead (``Py_UCS4``)." +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." msgstr "" -":mod:`array`::class:`array.array` ``'u'`` 型別 (:c:type:`wchar_t`):請改用 " -"``'w'`` 型別 (``Py_UCS4``)。" +"自 Python 3.3 起,``'u'`` 格式碼 (:c:type:`wchar_t`) 在文件中已被棄用,自 " +"Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " +"來取代 Unicode 字元。" -#: ../../deprecations/pending-removal-in-3.16.rst:8 -msgid ":mod:`builtins`: ``~bool``, bitwise inversion on bool." -msgstr ":mod:`builtins`:``~bool``,對 bool 進行位元反轉。" +#: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid ":mod:`shutil`:" +msgstr ":mod:`shutil`:" -#: ../../deprecations/pending-removal-in-3.16.rst:11 +#: ../../deprecations/pending-removal-in-3.16.rst:23 msgid "" -":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " -"lack of interest. (Contributed by Bénédikt Tran in :gh:`119698`.)" +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." msgstr "" -":mod:`symtable`:由於並沒有太多關注,已棄用 :meth:`symtable.Class." -"get_methods`。 (由 Bénédikt Tran 於 :gh:`119698` 貢獻。)" +"自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" +"未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" + +#: ../../deprecations/pending-removal-in-3.16.rst:28 +msgid ":mod:`symtable`:" +msgstr ":mod:`symtable`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:30 +msgid "" +"The :meth:`Class.get_methods <symtable.Class.get_methods>` method has been " +"deprecated since Python 3.14." +msgstr "" +"自 Python 3.14 起,:meth:`Class.get_methods <symtable.Class.get_methods>` 方" +"法已被棄用。" + +#: ../../deprecations/pending-removal-in-3.16.rst:33 +msgid ":mod:`sys`:" +msgstr ":mod:`sys`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:35 +msgid "" +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." +msgstr "" +"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" +"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" + +#: ../../deprecations/pending-removal-in-3.16.rst:39 +msgid ":mod:`tarfile`:" +msgstr ":mod:`tarfile`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:41 +msgid "" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." +msgstr "" +"自 Python 3.13 起,未以文件記錄和未被使用的 :attr:`!TarFile.tarfile` 屬性已被" +"棄用。" #: ../../deprecations/c-api-pending-removal-in-future.rst:2 #: ../../deprecations/pending-removal-in-future.rst:2 @@ -2582,10 +2638,6 @@ msgstr ":mod:`argparse`:已棄用巢狀引數群組和巢狀互斥群組。" msgid ":mod:`array`'s ``'u'`` format code (:gh:`57281`)" msgstr ":mod:`array` 的 ``'u'`` 格式碼 (:gh:`57281`)" -#: ../../deprecations/pending-removal-in-future.rst:12 -msgid ":mod:`builtins`:" -msgstr ":mod:`builtins`:" - #: ../../deprecations/pending-removal-in-future.rst:14 msgid "``bool(NotImplemented)``." msgstr "``bool(NotImplemented)``。" @@ -2719,17 +2771,23 @@ msgstr "回傳值上的隱式 ``None``。" #: ../../deprecations/pending-removal-in-future.rst:69 msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:72 +msgid "" ":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " "BytesIO and binary mode instead." msgstr "" ":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" -#: ../../deprecations/pending-removal-in-future.rst:72 +#: ../../deprecations/pending-removal-in-future.rst:75 msgid "" ":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" -#: ../../deprecations/pending-removal-in-future.rst:74 +#: ../../deprecations/pending-removal-in-future.rst:77 msgid "" ":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " "deprecated, use an exception instance." @@ -2737,7 +2795,7 @@ msgstr "" ":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" "實例。" -#: ../../deprecations/pending-removal-in-future.rst:77 +#: ../../deprecations/pending-removal-in-future.rst:80 msgid "" ":mod:`re`: More strict rules are now applied for numerical group references " "and group names in regular expressions. Only sequence of ASCII digits is " @@ -2749,12 +2807,12 @@ msgstr "" "有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" "包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" -#: ../../deprecations/pending-removal-in-future.rst:84 +#: ../../deprecations/pending-removal-in-future.rst:87 msgid "" ":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" -#: ../../deprecations/pending-removal-in-future.rst:86 +#: ../../deprecations/pending-removal-in-future.rst:89 msgid "" ":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " "Python 3.12; use the *onexc* parameter instead." @@ -2762,15 +2820,15 @@ msgstr "" ":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" "棄用;請改用 *onexc* 參數。" -#: ../../deprecations/pending-removal-in-future.rst:89 +#: ../../deprecations/pending-removal-in-future.rst:92 msgid ":mod:`ssl` options and protocols:" msgstr ":mod:`ssl` 選項和協定:" -#: ../../deprecations/pending-removal-in-future.rst:91 +#: ../../deprecations/pending-removal-in-future.rst:94 msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:92 +#: ../../deprecations/pending-removal-in-future.rst:95 msgid "" ":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" "`!selected_npn_protocol` are deprecated: use ALPN instead." @@ -2778,58 +2836,58 @@ msgstr "" ":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" "`!selected_npn_protocol` 已被棄用:請改用 ALPN。" -#: ../../deprecations/pending-removal-in-future.rst:95 +#: ../../deprecations/pending-removal-in-future.rst:98 msgid "``ssl.OP_NO_SSL*`` options" msgstr "``ssl.OP_NO_SSL*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:96 +#: ../../deprecations/pending-removal-in-future.rst:99 msgid "``ssl.OP_NO_TLS*`` options" msgstr "``ssl.OP_NO_TLS*`` 選項" -#: ../../deprecations/pending-removal-in-future.rst:97 +#: ../../deprecations/pending-removal-in-future.rst:100 msgid "``ssl.PROTOCOL_SSLv3``" msgstr "``ssl.PROTOCOL_SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:98 +#: ../../deprecations/pending-removal-in-future.rst:101 msgid "``ssl.PROTOCOL_TLS``" msgstr "``ssl.PROTOCOL_TLS``" -#: ../../deprecations/pending-removal-in-future.rst:99 +#: ../../deprecations/pending-removal-in-future.rst:102 msgid "``ssl.PROTOCOL_TLSv1``" msgstr "``ssl.PROTOCOL_TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:100 +#: ../../deprecations/pending-removal-in-future.rst:103 msgid "``ssl.PROTOCOL_TLSv1_1``" msgstr "``ssl.PROTOCOL_TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:101 +#: ../../deprecations/pending-removal-in-future.rst:104 msgid "``ssl.PROTOCOL_TLSv1_2``" msgstr "``ssl.PROTOCOL_TLSv1_2``" -#: ../../deprecations/pending-removal-in-future.rst:102 +#: ../../deprecations/pending-removal-in-future.rst:105 msgid "``ssl.TLSVersion.SSLv3``" msgstr "``ssl.TLSVersion.SSLv3``" -#: ../../deprecations/pending-removal-in-future.rst:103 +#: ../../deprecations/pending-removal-in-future.rst:106 msgid "``ssl.TLSVersion.TLSv1``" msgstr "``ssl.TLSVersion.TLSv1``" -#: ../../deprecations/pending-removal-in-future.rst:104 +#: ../../deprecations/pending-removal-in-future.rst:107 msgid "``ssl.TLSVersion.TLSv1_1``" msgstr "``ssl.TLSVersion.TLSv1_1``" -#: ../../deprecations/pending-removal-in-future.rst:106 +#: ../../deprecations/pending-removal-in-future.rst:109 msgid "" ":func:`sysconfig.is_python_build` *check_home* parameter is deprecated and " "ignored." msgstr "" ":func:`sysconfig.is_python_build` 的 *check_home* 參數已被棄用並被忽略。" -#: ../../deprecations/pending-removal-in-future.rst:109 +#: ../../deprecations/pending-removal-in-future.rst:112 msgid ":mod:`threading` methods:" msgstr ":mod:`threading` 方法:" -#: ../../deprecations/pending-removal-in-future.rst:111 +#: ../../deprecations/pending-removal-in-future.rst:114 msgid "" ":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." "notify_all`." @@ -2837,11 +2895,11 @@ msgstr "" ":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." "notify_all`。" -#: ../../deprecations/pending-removal-in-future.rst:112 +#: ../../deprecations/pending-removal-in-future.rst:115 msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" -#: ../../deprecations/pending-removal-in-future.rst:113 +#: ../../deprecations/pending-removal-in-future.rst:116 msgid "" ":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" "attr:`threading.Thread.daemon` attribute." @@ -2849,7 +2907,7 @@ msgstr "" ":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" "用 :attr:`threading.Thread.daemon` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:115 +#: ../../deprecations/pending-removal-in-future.rst:118 msgid "" ":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" "attr:`threading.Thread.name` attribute." @@ -2857,20 +2915,20 @@ msgstr "" ":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" "attr:`threading.Thread.name` 屬性。" -#: ../../deprecations/pending-removal-in-future.rst:117 +#: ../../deprecations/pending-removal-in-future.rst:120 msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." msgstr "" ":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" -#: ../../deprecations/pending-removal-in-future.rst:118 +#: ../../deprecations/pending-removal-in-future.rst:121 msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" -#: ../../deprecations/pending-removal-in-future.rst:120 +#: ../../deprecations/pending-removal-in-future.rst:123 msgid ":class:`typing.Text` (:gh:`92332`)." msgstr ":class:`typing.Text` (:gh:`92332`)。" -#: ../../deprecations/pending-removal-in-future.rst:122 +#: ../../deprecations/pending-removal-in-future.rst:125 msgid "" ":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " "value that is not ``None`` from a test case." @@ -2878,58 +2936,58 @@ msgstr "" ":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" "被棄用。" -#: ../../deprecations/pending-removal-in-future.rst:125 +#: ../../deprecations/pending-removal-in-future.rst:128 msgid "" ":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " "instead" msgstr "" ":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" -#: ../../deprecations/pending-removal-in-future.rst:127 +#: ../../deprecations/pending-removal-in-future.rst:130 msgid "``splitattr()``" msgstr "``splitattr()``" -#: ../../deprecations/pending-removal-in-future.rst:128 +#: ../../deprecations/pending-removal-in-future.rst:131 msgid "``splithost()``" msgstr "``splithost()``" -#: ../../deprecations/pending-removal-in-future.rst:129 +#: ../../deprecations/pending-removal-in-future.rst:132 msgid "``splitnport()``" msgstr "``splitnport()``" -#: ../../deprecations/pending-removal-in-future.rst:130 +#: ../../deprecations/pending-removal-in-future.rst:133 msgid "``splitpasswd()``" msgstr "``splitpasswd()``" -#: ../../deprecations/pending-removal-in-future.rst:131 +#: ../../deprecations/pending-removal-in-future.rst:134 msgid "``splitport()``" msgstr "``splitport()``" -#: ../../deprecations/pending-removal-in-future.rst:132 +#: ../../deprecations/pending-removal-in-future.rst:135 msgid "``splitquery()``" msgstr "``splitquery()``" -#: ../../deprecations/pending-removal-in-future.rst:133 +#: ../../deprecations/pending-removal-in-future.rst:136 msgid "``splittag()``" msgstr "``splittag()``" -#: ../../deprecations/pending-removal-in-future.rst:134 +#: ../../deprecations/pending-removal-in-future.rst:137 msgid "``splittype()``" msgstr "``splittype()``" -#: ../../deprecations/pending-removal-in-future.rst:135 +#: ../../deprecations/pending-removal-in-future.rst:138 msgid "``splituser()``" msgstr "``splituser()``" -#: ../../deprecations/pending-removal-in-future.rst:136 +#: ../../deprecations/pending-removal-in-future.rst:139 msgid "``splitvalue()``" msgstr "``splitvalue()``" -#: ../../deprecations/pending-removal-in-future.rst:137 +#: ../../deprecations/pending-removal-in-future.rst:140 msgid "``to_bytes()``" msgstr "``to_bytes()``" -#: ../../deprecations/pending-removal-in-future.rst:139 +#: ../../deprecations/pending-removal-in-future.rst:142 msgid "" ":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" "`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " @@ -2939,13 +2997,13 @@ msgstr "" "class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" "`~urllib.request.urlopen` 函式和方法。" -#: ../../deprecations/pending-removal-in-future.rst:143 +#: ../../deprecations/pending-removal-in-future.rst:146 msgid "" ":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " "writes." msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" -#: ../../deprecations/pending-removal-in-future.rst:146 +#: ../../deprecations/pending-removal-in-future.rst:149 msgid "" ":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." "etree.ElementTree.Element` is deprecated. In a future release it will always " @@ -2956,7 +3014,7 @@ msgstr "" "Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " "``len(elem)`` 或 ``elem is not None`` 測試。" -#: ../../deprecations/pending-removal-in-future.rst:151 +#: ../../deprecations/pending-removal-in-future.rst:154 msgid "" ":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" "`~zipimport.zipimporter.exec_module` instead." @@ -2964,32 +3022,32 @@ msgstr "" ":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." "zipimporter.exec_module`。" -#: ../../whatsnew/3.12.rst:1355 ../../whatsnew/3.12.rst:2233 +#: ../../whatsnew/3.12.rst:1344 ../../whatsnew/3.12.rst:2222 msgid "Removed" msgstr "已移除" -#: ../../whatsnew/3.12.rst:1358 +#: ../../whatsnew/3.12.rst:1347 msgid "asynchat and asyncore" msgstr "asynchat 和 asyncore" -#: ../../whatsnew/3.12.rst:1360 +#: ../../whatsnew/3.12.rst:1349 msgid "" "These two modules have been removed according to the schedule in :pep:`594`, " "having been deprecated in Python 3.6. Use :mod:`asyncio` instead. " "(Contributed by Nikita Sobolev in :gh:`96580`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1367 +#: ../../whatsnew/3.12.rst:1356 msgid "configparser" msgstr "configparser" -#: ../../whatsnew/3.12.rst:1369 +#: ../../whatsnew/3.12.rst:1358 msgid "" "Several names deprecated in the :mod:`configparser` way back in 3.2 have " "been removed per :gh:`89336`:" msgstr "" -#: ../../whatsnew/3.12.rst:1372 +#: ../../whatsnew/3.12.rst:1361 msgid "" ":class:`configparser.ParsingError` no longer has a ``filename`` attribute or " "argument. Use the ``source`` attribute and argument instead." @@ -2997,23 +3055,23 @@ msgstr "" ":class:`configparser.ParsingError` 不再具有 ``filename`` 屬性或引數。請改用 " "``source`` 屬性和引數。" -#: ../../whatsnew/3.12.rst:1374 +#: ../../whatsnew/3.12.rst:1363 msgid "" ":mod:`configparser` no longer has a ``SafeConfigParser`` class. Use the " "shorter :class:`~configparser.ConfigParser` name instead." msgstr "" -#: ../../whatsnew/3.12.rst:1376 +#: ../../whatsnew/3.12.rst:1365 msgid "" ":class:`configparser.ConfigParser` no longer has a ``readfp`` method. Use :" "meth:`~configparser.ConfigParser.read_file` instead." msgstr "" -#: ../../whatsnew/3.12.rst:1380 +#: ../../whatsnew/3.12.rst:1369 msgid "distutils" msgstr "distutils" -#: ../../whatsnew/3.12.rst:1382 +#: ../../whatsnew/3.12.rst:1371 msgid "" "Remove the :py:mod:`!distutils` package. It was deprecated in Python 3.10 " "by :pep:`632` \"Deprecate distutils module\". For projects still using " @@ -3022,17 +3080,17 @@ msgid "" "Victor Stinner in :gh:`92584`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1389 +#: ../../whatsnew/3.12.rst:1378 msgid "ensurepip" msgstr "ensurepip" -#: ../../whatsnew/3.12.rst:1391 +#: ../../whatsnew/3.12.rst:1380 msgid "" "Remove the bundled setuptools wheel from :mod:`ensurepip`, and stop " "installing setuptools in environments created by :mod:`venv`." msgstr "" -#: ../../whatsnew/3.12.rst:1394 +#: ../../whatsnew/3.12.rst:1383 msgid "" "``pip (>= 22.1)`` does not require setuptools to be installed in the " "environment. ``setuptools``-based (and ``distutils``-based) packages can " @@ -3040,7 +3098,7 @@ msgid "" "the build environment it uses for building a package." msgstr "" -#: ../../whatsnew/3.12.rst:1400 +#: ../../whatsnew/3.12.rst:1389 msgid "" "``easy_install``, ``pkg_resources``, ``setuptools`` and ``distutils`` are no " "longer provided by default in environments created with ``venv`` or " @@ -3050,25 +3108,25 @@ msgid "" "(typically, using pip)." msgstr "" -#: ../../whatsnew/3.12.rst:1407 +#: ../../whatsnew/3.12.rst:1396 msgid "(Contributed by Pradyun Gedam in :gh:`95299`.)" msgstr "(由 Pradyun Gedam 於 :gh:`95299` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1410 +#: ../../whatsnew/3.12.rst:1399 msgid "enum" msgstr "enum" -#: ../../whatsnew/3.12.rst:1412 +#: ../../whatsnew/3.12.rst:1401 msgid "" "Remove :mod:`enum`'s ``EnumMeta.__getattr__``, which is no longer needed for " "enum attribute access. (Contributed by Ethan Furman in :gh:`95083`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1417 +#: ../../whatsnew/3.12.rst:1406 msgid "ftplib" msgstr "ftplib" -#: ../../whatsnew/3.12.rst:1419 +#: ../../whatsnew/3.12.rst:1408 msgid "" "Remove :mod:`ftplib`'s ``FTP_TLS.ssl_version`` class attribute: use the " "*context* parameter instead. (Contributed by Victor Stinner in :gh:`94172`.)" @@ -3076,11 +3134,11 @@ msgstr "" "移除 :mod:`ftplib` 的 ``FTP_TLS.ssl_version`` 類別屬性:請改用 *context* 參" "數。(由 Victor Stinner 於 :gh:`94172` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1424 +#: ../../whatsnew/3.12.rst:1413 msgid "gzip" msgstr "gzip" -#: ../../whatsnew/3.12.rst:1426 +#: ../../whatsnew/3.12.rst:1415 msgid "" "Remove the ``filename`` attribute of :mod:`gzip`'s :class:`gzip.GzipFile`, " "deprecated since Python 2.6, use the :attr:`~gzip.GzipFile.name` attribute " @@ -3089,11 +3147,11 @@ msgid "" "`94196`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1433 +#: ../../whatsnew/3.12.rst:1422 msgid "hashlib" msgstr "hashlib" -#: ../../whatsnew/3.12.rst:1435 +#: ../../whatsnew/3.12.rst:1424 msgid "" "Remove the pure Python implementation of :mod:`hashlib`'s :func:`hashlib." "pbkdf2_hmac`, deprecated in Python 3.10. Python 3.10 and newer requires " @@ -3102,17 +3160,17 @@ msgid "" "Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1442 ../../whatsnew/3.12.rst:1469 +#: ../../whatsnew/3.12.rst:1431 ../../whatsnew/3.12.rst:1458 msgid "importlib" msgstr "importlib" -#: ../../whatsnew/3.12.rst:1444 +#: ../../whatsnew/3.12.rst:1433 msgid "" "Many previously deprecated cleanups in :mod:`importlib` have now been " "completed:" msgstr "現已完成清理 :mod:`importlib` 中許多過去已經棄用的東西:" -#: ../../whatsnew/3.12.rst:1447 +#: ../../whatsnew/3.12.rst:1436 msgid "" "References to, and support for :meth:`!module_repr` has been removed. " "(Contributed by Barry Warsaw in :gh:`97850`.)" @@ -3120,134 +3178,134 @@ msgstr "" "對 :meth:`!module_repr` 的參照和支援已刪除。(由 Barry Warsaw 在 :gh:`97850` " "中貢獻。)" -#: ../../whatsnew/3.12.rst:1450 +#: ../../whatsnew/3.12.rst:1439 msgid "" "``importlib.util.set_package``, ``importlib.util.set_loader`` and " "``importlib.util.module_for_loader`` have all been removed. (Contributed by " "Brett Cannon and Nikita Sobolev in :gh:`65961` and :gh:`97850`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1454 +#: ../../whatsnew/3.12.rst:1443 msgid "" "Support for ``find_loader()`` and ``find_module()`` APIs have been removed. " "(Contributed by Barry Warsaw in :gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1457 +#: ../../whatsnew/3.12.rst:1446 msgid "" "``importlib.abc.Finder``, ``pkgutil.ImpImporter``, and ``pkgutil.ImpLoader`` " "have been removed. (Contributed by Barry Warsaw in :gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1461 ../../whatsnew/3.12.rst:1469 +#: ../../whatsnew/3.12.rst:1450 ../../whatsnew/3.12.rst:1458 msgid "imp" msgstr "imp" -#: ../../whatsnew/3.12.rst:1463 +#: ../../whatsnew/3.12.rst:1452 msgid "" "The :mod:`!imp` module has been removed. (Contributed by Barry Warsaw in :" "gh:`98040`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1466 +#: ../../whatsnew/3.12.rst:1455 msgid "To migrate, consult the following correspondence table:" msgstr "" -#: ../../whatsnew/3.12.rst:1471 +#: ../../whatsnew/3.12.rst:1460 msgid "``imp.NullImporter``" msgstr "``imp.NullImporter``" -#: ../../whatsnew/3.12.rst:1471 +#: ../../whatsnew/3.12.rst:1460 msgid "Insert ``None`` into ``sys.path_importer_cache``" msgstr "將 ``None`` 插入 ``sys.path_importer_cache``" -#: ../../whatsnew/3.12.rst:1472 +#: ../../whatsnew/3.12.rst:1461 msgid "``imp.cache_from_source()``" msgstr "``imp.cache_from_source()``" -#: ../../whatsnew/3.12.rst:1472 +#: ../../whatsnew/3.12.rst:1461 msgid ":func:`importlib.util.cache_from_source`" msgstr ":func:`importlib.util.cache_from_source`" -#: ../../whatsnew/3.12.rst:1473 +#: ../../whatsnew/3.12.rst:1462 msgid "``imp.find_module()``" msgstr "``imp.find_module()``" -#: ../../whatsnew/3.12.rst:1473 +#: ../../whatsnew/3.12.rst:1462 msgid ":func:`importlib.util.find_spec`" msgstr ":func:`importlib.util.find_spec`" -#: ../../whatsnew/3.12.rst:1474 +#: ../../whatsnew/3.12.rst:1463 msgid "``imp.get_magic()``" msgstr "``imp.get_magic()``" -#: ../../whatsnew/3.12.rst:1474 +#: ../../whatsnew/3.12.rst:1463 msgid ":attr:`importlib.util.MAGIC_NUMBER`" msgstr ":attr:`importlib.util.MAGIC_NUMBER`" -#: ../../whatsnew/3.12.rst:1475 +#: ../../whatsnew/3.12.rst:1464 msgid "``imp.get_suffixes()``" msgstr "``imp.get_suffixes()``" -#: ../../whatsnew/3.12.rst:1475 +#: ../../whatsnew/3.12.rst:1464 msgid "" ":attr:`importlib.machinery.SOURCE_SUFFIXES`, :attr:`importlib.machinery." "EXTENSION_SUFFIXES`, and :attr:`importlib.machinery.BYTECODE_SUFFIXES`" msgstr "" -#: ../../whatsnew/3.12.rst:1476 +#: ../../whatsnew/3.12.rst:1465 msgid "``imp.get_tag()``" msgstr "``imp.get_tag()``" -#: ../../whatsnew/3.12.rst:1476 +#: ../../whatsnew/3.12.rst:1465 msgid ":attr:`sys.implementation.cache_tag <sys.implementation>`" msgstr ":attr:`sys.implementation.cache_tag <sys.implementation>`" -#: ../../whatsnew/3.12.rst:1477 +#: ../../whatsnew/3.12.rst:1466 msgid "``imp.load_module()``" msgstr "``imp.load_module()``" -#: ../../whatsnew/3.12.rst:1477 +#: ../../whatsnew/3.12.rst:1466 msgid ":func:`importlib.import_module`" msgstr ":func:`importlib.import_module`" -#: ../../whatsnew/3.12.rst:1478 +#: ../../whatsnew/3.12.rst:1467 msgid "``imp.new_module(name)``" msgstr "``imp.new_module(name)``" -#: ../../whatsnew/3.12.rst:1478 +#: ../../whatsnew/3.12.rst:1467 msgid "``types.ModuleType(name)``" msgstr "``types.ModuleType(name)``" -#: ../../whatsnew/3.12.rst:1479 +#: ../../whatsnew/3.12.rst:1468 msgid "``imp.reload()``" msgstr "``imp.reload()``" -#: ../../whatsnew/3.12.rst:1479 +#: ../../whatsnew/3.12.rst:1468 msgid ":func:`importlib.reload`" msgstr ":func:`importlib.reload`" -#: ../../whatsnew/3.12.rst:1480 +#: ../../whatsnew/3.12.rst:1469 msgid "``imp.source_from_cache()``" msgstr "``imp.source_from_cache()``" -#: ../../whatsnew/3.12.rst:1480 +#: ../../whatsnew/3.12.rst:1469 msgid ":func:`importlib.util.source_from_cache`" msgstr ":func:`importlib.util.source_from_cache`" -#: ../../whatsnew/3.12.rst:1481 +#: ../../whatsnew/3.12.rst:1470 msgid "``imp.load_source()``" msgstr "``imp.load_source()``" -#: ../../whatsnew/3.12.rst:1481 +#: ../../whatsnew/3.12.rst:1470 msgid "*See below*" msgstr "*見下文*" -#: ../../whatsnew/3.12.rst:1484 +#: ../../whatsnew/3.12.rst:1473 msgid "Replace ``imp.load_source()`` with::" msgstr "用以下取代 ``imp.load_source()``: ::" -#: ../../whatsnew/3.12.rst:1486 +#: ../../whatsnew/3.12.rst:1475 msgid "" "import importlib.util\n" "import importlib.machinery\n" @@ -3264,37 +3322,37 @@ msgid "" " return module" msgstr "" -#: ../../whatsnew/3.12.rst:1499 +#: ../../whatsnew/3.12.rst:1488 msgid "Remove :mod:`!imp` functions and attributes with no replacements:" msgstr "移除 :mod:`!imp` 函式和屬性、沒有替代方案:" -#: ../../whatsnew/3.12.rst:1501 +#: ../../whatsnew/3.12.rst:1490 msgid "Undocumented functions:" msgstr "未以文件記錄的函式:" -#: ../../whatsnew/3.12.rst:1503 +#: ../../whatsnew/3.12.rst:1492 msgid "``imp.init_builtin()``" msgstr "``imp.init_builtin()``" -#: ../../whatsnew/3.12.rst:1504 +#: ../../whatsnew/3.12.rst:1493 msgid "``imp.load_compiled()``" msgstr "``imp.load_compiled()``" -#: ../../whatsnew/3.12.rst:1505 +#: ../../whatsnew/3.12.rst:1494 msgid "``imp.load_dynamic()``" msgstr "``imp.load_dynamic()``" -#: ../../whatsnew/3.12.rst:1506 +#: ../../whatsnew/3.12.rst:1495 msgid "``imp.load_package()``" msgstr "``imp.load_package()``" -#: ../../whatsnew/3.12.rst:1508 +#: ../../whatsnew/3.12.rst:1497 msgid "" "``imp.lock_held()``, ``imp.acquire_lock()``, ``imp.release_lock()``: the " "locking scheme has changed in Python 3.3 to per-module locks." msgstr "" -#: ../../whatsnew/3.12.rst:1510 +#: ../../whatsnew/3.12.rst:1499 msgid "" "``imp.find_module()`` constants: ``SEARCH_ERROR``, ``PY_SOURCE``, " "``PY_COMPILED``, ``C_EXTENSION``, ``PY_RESOURCE``, ``PKG_DIRECTORY``, " @@ -3304,11 +3362,11 @@ msgstr "" "``PY_COMPILED``、``C_EXTENSION``、``PY_RESOURCE``、``PKG_DIRECTORY``、" "``C_BUILTIN``、``PY_FROZEN``、``PY_CODERESOURCE``、``IMP_HOOK``。" -#: ../../whatsnew/3.12.rst:1515 +#: ../../whatsnew/3.12.rst:1504 msgid "io" msgstr "io" -#: ../../whatsnew/3.12.rst:1517 +#: ../../whatsnew/3.12.rst:1506 msgid "" "Remove :mod:`io`'s ``io.OpenWrapper`` and ``_pyio.OpenWrapper``, deprecated " "in Python 3.10: just use :func:`open` instead. The :func:`open` (:func:`io." @@ -3317,22 +3375,22 @@ msgid "" "`94169`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1524 +#: ../../whatsnew/3.12.rst:1513 msgid "locale" msgstr "locale" -#: ../../whatsnew/3.12.rst:1526 +#: ../../whatsnew/3.12.rst:1515 msgid "" "Remove :mod:`locale`'s :func:`!locale.format` function, deprecated in Python " "3.7: use :func:`locale.format_string` instead. (Contributed by Victor " "Stinner in :gh:`94226`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1531 +#: ../../whatsnew/3.12.rst:1520 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.12.rst:1533 +#: ../../whatsnew/3.12.rst:1522 msgid "" "The ``smtpd`` module has been removed according to the schedule in :pep:" "`594`, having been deprecated in Python 3.4.7 and 3.5.4. Use the :pypi:" @@ -3340,27 +3398,27 @@ msgid "" "(Contributed by Oleg Iarygin in :gh:`93243`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1542 +#: ../../whatsnew/3.12.rst:1531 msgid "" "The following undocumented :mod:`sqlite3` features, deprecated in Python " "3.10, are now removed:" msgstr "" -#: ../../whatsnew/3.12.rst:1545 +#: ../../whatsnew/3.12.rst:1534 msgid "``sqlite3.enable_shared_cache()``" msgstr "``sqlite3.enable_shared_cache()``" -#: ../../whatsnew/3.12.rst:1546 +#: ../../whatsnew/3.12.rst:1535 msgid "``sqlite3.OptimizedUnicode``" msgstr "``sqlite3.OptimizedUnicode``" -#: ../../whatsnew/3.12.rst:1548 +#: ../../whatsnew/3.12.rst:1537 msgid "" "If a shared cache must be used, open the database in URI mode using the " "``cache=shared`` query parameter." msgstr "" -#: ../../whatsnew/3.12.rst:1551 +#: ../../whatsnew/3.12.rst:1540 msgid "" "The ``sqlite3.OptimizedUnicode`` text factory has been an alias for :class:" "`str` since Python 3.3. Code that previously set the text factory to " @@ -3368,22 +3426,22 @@ msgid "" "default value which is also ``str``." msgstr "" -#: ../../whatsnew/3.12.rst:1556 +#: ../../whatsnew/3.12.rst:1545 msgid "(Contributed by Erlend E. Aasland in :gh:`92548`.)" msgstr "(由 Erlend E. Aasland 於 :gh:`92548` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1559 +#: ../../whatsnew/3.12.rst:1548 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.12.rst:1561 +#: ../../whatsnew/3.12.rst:1550 msgid "" "Remove :mod:`ssl`'s :func:`!ssl.RAND_pseudo_bytes` function, deprecated in " "Python 3.6: use :func:`os.urandom` or :func:`ssl.RAND_bytes` instead. " "(Contributed by Victor Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1565 +#: ../../whatsnew/3.12.rst:1554 msgid "" "Remove the :func:`!ssl.match_hostname` function. It was deprecated in Python " "3.7. OpenSSL performs hostname matching since Python 3.7, Python no longer " @@ -3391,7 +3449,7 @@ msgid "" "Stinner in :gh:`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1571 +#: ../../whatsnew/3.12.rst:1560 msgid "" "Remove the :func:`!ssl.wrap_socket` function, deprecated in Python 3.7: " "instead, create a :class:`ssl.SSLContext` object and call its :class:`ssl." @@ -3402,189 +3460,189 @@ msgid "" "`94199`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1582 +#: ../../whatsnew/3.12.rst:1571 msgid "Remove many long-deprecated :mod:`unittest` features:" msgstr "移除許多 :mod:`unittest` 中被棄用已久的功能:" -#: ../../whatsnew/3.12.rst:1586 +#: ../../whatsnew/3.12.rst:1575 msgid "A number of :class:`~unittest.TestCase` method aliases:" msgstr "許多 :class:`~unittest.TestCase` 方法別名:" -#: ../../whatsnew/3.12.rst:1589 +#: ../../whatsnew/3.12.rst:1578 msgid "Deprecated alias" msgstr "已棄用的別名" -#: ../../whatsnew/3.12.rst:1589 +#: ../../whatsnew/3.12.rst:1578 msgid "Method Name" msgstr "方法名稱" -#: ../../whatsnew/3.12.rst:1589 +#: ../../whatsnew/3.12.rst:1578 msgid "Deprecated in" msgstr "已棄用於" -#: ../../whatsnew/3.12.rst:1591 +#: ../../whatsnew/3.12.rst:1580 msgid "``failUnless``" msgstr "``failUnless``" -#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1598 +#: ../../whatsnew/3.12.rst:1580 ../../whatsnew/3.12.rst:1587 msgid ":meth:`.assertTrue`" msgstr ":meth:`.assertTrue`" -#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1592 -#: ../../whatsnew/3.12.rst:1593 ../../whatsnew/3.12.rst:1594 -#: ../../whatsnew/3.12.rst:1595 ../../whatsnew/3.12.rst:1596 -#: ../../whatsnew/3.12.rst:1597 +#: ../../whatsnew/3.12.rst:1580 ../../whatsnew/3.12.rst:1581 +#: ../../whatsnew/3.12.rst:1582 ../../whatsnew/3.12.rst:1583 +#: ../../whatsnew/3.12.rst:1584 ../../whatsnew/3.12.rst:1585 +#: ../../whatsnew/3.12.rst:1586 msgid "3.1" msgstr "3.1" -#: ../../whatsnew/3.12.rst:1592 +#: ../../whatsnew/3.12.rst:1581 msgid "``failIf``" msgstr "``failIf``" -#: ../../whatsnew/3.12.rst:1592 +#: ../../whatsnew/3.12.rst:1581 msgid ":meth:`.assertFalse`" msgstr ":meth:`.assertFalse`" -#: ../../whatsnew/3.12.rst:1593 +#: ../../whatsnew/3.12.rst:1582 msgid "``failUnlessEqual``" msgstr "``failUnlessEqual``" -#: ../../whatsnew/3.12.rst:1593 ../../whatsnew/3.12.rst:1599 +#: ../../whatsnew/3.12.rst:1582 ../../whatsnew/3.12.rst:1588 msgid ":meth:`.assertEqual`" msgstr ":meth:`.assertEqual`" -#: ../../whatsnew/3.12.rst:1594 +#: ../../whatsnew/3.12.rst:1583 msgid "``failIfEqual``" msgstr "``failIfEqual``" -#: ../../whatsnew/3.12.rst:1594 ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1583 ../../whatsnew/3.12.rst:1589 msgid ":meth:`.assertNotEqual`" msgstr ":meth:`.assertNotEqual`" -#: ../../whatsnew/3.12.rst:1595 +#: ../../whatsnew/3.12.rst:1584 msgid "``failUnlessAlmostEqual``" msgstr "``failUnlessAlmostEqual``" -#: ../../whatsnew/3.12.rst:1595 ../../whatsnew/3.12.rst:1601 +#: ../../whatsnew/3.12.rst:1584 ../../whatsnew/3.12.rst:1590 msgid ":meth:`.assertAlmostEqual`" msgstr ":meth:`.assertAlmostEqual`" -#: ../../whatsnew/3.12.rst:1596 +#: ../../whatsnew/3.12.rst:1585 msgid "``failIfAlmostEqual``" msgstr "``failIfAlmostEqual``" -#: ../../whatsnew/3.12.rst:1596 ../../whatsnew/3.12.rst:1602 +#: ../../whatsnew/3.12.rst:1585 ../../whatsnew/3.12.rst:1591 msgid ":meth:`.assertNotAlmostEqual`" msgstr ":meth:`.assertNotAlmostEqual`" -#: ../../whatsnew/3.12.rst:1597 +#: ../../whatsnew/3.12.rst:1586 msgid "``failUnlessRaises``" msgstr "``failUnlessRaises``" -#: ../../whatsnew/3.12.rst:1597 +#: ../../whatsnew/3.12.rst:1586 msgid ":meth:`.assertRaises`" msgstr ":meth:`.assertRaises`" -#: ../../whatsnew/3.12.rst:1598 +#: ../../whatsnew/3.12.rst:1587 msgid "``assert_``" msgstr "``assert_``" -#: ../../whatsnew/3.12.rst:1598 ../../whatsnew/3.12.rst:1599 -#: ../../whatsnew/3.12.rst:1600 ../../whatsnew/3.12.rst:1601 -#: ../../whatsnew/3.12.rst:1602 ../../whatsnew/3.12.rst:1603 -#: ../../whatsnew/3.12.rst:1604 +#: ../../whatsnew/3.12.rst:1587 ../../whatsnew/3.12.rst:1588 +#: ../../whatsnew/3.12.rst:1589 ../../whatsnew/3.12.rst:1590 +#: ../../whatsnew/3.12.rst:1591 ../../whatsnew/3.12.rst:1592 +#: ../../whatsnew/3.12.rst:1593 msgid "3.2" msgstr "3.2" -#: ../../whatsnew/3.12.rst:1599 +#: ../../whatsnew/3.12.rst:1588 msgid "``assertEquals``" msgstr "``assertEquals``" -#: ../../whatsnew/3.12.rst:1600 +#: ../../whatsnew/3.12.rst:1589 msgid "``assertNotEquals``" msgstr "``assertNotEquals``" -#: ../../whatsnew/3.12.rst:1601 +#: ../../whatsnew/3.12.rst:1590 msgid "``assertAlmostEquals``" msgstr "``assertAlmostEquals``" -#: ../../whatsnew/3.12.rst:1602 +#: ../../whatsnew/3.12.rst:1591 msgid "``assertNotAlmostEquals``" msgstr "``assertNotAlmostEquals``" -#: ../../whatsnew/3.12.rst:1603 +#: ../../whatsnew/3.12.rst:1592 msgid "``assertRegexpMatches``" msgstr "``assertRegexpMatches``" -#: ../../whatsnew/3.12.rst:1603 +#: ../../whatsnew/3.12.rst:1592 msgid ":meth:`.assertRegex`" msgstr ":meth:`.assertRegex`" -#: ../../whatsnew/3.12.rst:1604 +#: ../../whatsnew/3.12.rst:1593 msgid "``assertRaisesRegexp``" msgstr "``assertRaisesRegexp``" -#: ../../whatsnew/3.12.rst:1604 +#: ../../whatsnew/3.12.rst:1593 msgid ":meth:`.assertRaisesRegex`" msgstr ":meth:`.assertRaisesRegex`" -#: ../../whatsnew/3.12.rst:1605 +#: ../../whatsnew/3.12.rst:1594 msgid "``assertNotRegexpMatches``" msgstr "``assertNotRegexpMatches``" -#: ../../whatsnew/3.12.rst:1605 +#: ../../whatsnew/3.12.rst:1594 msgid ":meth:`.assertNotRegex`" msgstr ":meth:`.assertNotRegex`" -#: ../../whatsnew/3.12.rst:1605 +#: ../../whatsnew/3.12.rst:1594 msgid "3.5" msgstr "3.5" -#: ../../whatsnew/3.12.rst:1608 +#: ../../whatsnew/3.12.rst:1597 msgid "" "You can use https://github.com/isidentical/teyit to automatically modernise " "your unit tests." msgstr "" -#: ../../whatsnew/3.12.rst:1611 +#: ../../whatsnew/3.12.rst:1600 msgid "" "Undocumented and broken :class:`~unittest.TestCase` method " "``assertDictContainsSubset`` (deprecated in Python 3.2)." msgstr "" -#: ../../whatsnew/3.12.rst:1614 +#: ../../whatsnew/3.12.rst:1603 msgid "" "Undocumented :meth:`TestLoader.loadTestsFromModule <unittest.TestLoader." "loadTestsFromModule>` parameter *use_load_tests* (deprecated and ignored " "since Python 3.5)." msgstr "" -#: ../../whatsnew/3.12.rst:1618 +#: ../../whatsnew/3.12.rst:1607 msgid "" "An alias of the :class:`~unittest.TextTestResult` class: ``_TextTestResult`` " "(deprecated in Python 3.2)." msgstr "" -#: ../../whatsnew/3.12.rst:1621 +#: ../../whatsnew/3.12.rst:1610 msgid "(Contributed by Serhiy Storchaka in :gh:`89325`.)" msgstr "(由 Serhiy Storchaka 於 :gh:`89325` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1624 +#: ../../whatsnew/3.12.rst:1613 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.12.rst:1626 +#: ../../whatsnew/3.12.rst:1615 msgid "" "Remove support for obsolete browsers from :mod:`webbrowser`. The removed " "browsers include: Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, " "Firebird, and Firefox versions 35 and below (:gh:`102871`)." msgstr "" -#: ../../whatsnew/3.12.rst:1631 +#: ../../whatsnew/3.12.rst:1620 msgid "xml.etree.ElementTree" msgstr "xml.etree.ElementTree" -#: ../../whatsnew/3.12.rst:1633 +#: ../../whatsnew/3.12.rst:1622 msgid "" "Remove the ``ElementTree.Element.copy()`` method of the pure Python " "implementation, deprecated in Python 3.10, use the :func:`copy.copy` " @@ -3593,22 +3651,22 @@ msgid "" "Stinner in :gh:`94383`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1640 +#: ../../whatsnew/3.12.rst:1629 msgid "zipimport" msgstr "zipimport" -#: ../../whatsnew/3.12.rst:1642 +#: ../../whatsnew/3.12.rst:1631 msgid "" "Remove :mod:`zipimport`'s ``find_loader()`` and ``find_module()`` methods, " "deprecated in Python 3.10: use the ``find_spec()`` method instead. See :pep:" "`451` for the rationale. (Contributed by Victor Stinner in :gh:`94379`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1648 +#: ../../whatsnew/3.12.rst:1637 msgid "Others" msgstr "其他" -#: ../../whatsnew/3.12.rst:1650 +#: ../../whatsnew/3.12.rst:1639 msgid "" "Remove the ``suspicious`` rule from the documentation :file:`Makefile` and :" "file:`Doc/tools/rstlint.py`, both in favor of `sphinx-lint <https://github." @@ -3616,7 +3674,7 @@ msgid "" "`98179`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1655 +#: ../../whatsnew/3.12.rst:1644 msgid "" "Remove the *keyfile* and *certfile* parameters from the :mod:`ftplib`, :mod:" "`imaplib`, :mod:`poplib` and :mod:`smtplib` modules, and the *key_file*, " @@ -3626,7 +3684,7 @@ msgid "" "in :gh:`94172`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1663 +#: ../../whatsnew/3.12.rst:1652 msgid "" "Remove ``Jython`` compatibility hacks from several stdlib modules and tests. " "(Contributed by Nikita Sobolev in :gh:`99482`.)" @@ -3634,7 +3692,7 @@ msgstr "" "移除數個標準函式庫模組與測試中的 ``Jython`` 相容性修補程式。(由 Nikita " "Sobolev 於 :gh:`99482` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1666 +#: ../../whatsnew/3.12.rst:1655 msgid "" "Remove ``_use_broken_old_ctypes_structure_semantics_`` flag from :mod:" "`ctypes` module. (Contributed by Nikita Sobolev in :gh:`99285`.)" @@ -3642,21 +3700,21 @@ msgstr "" "移除 :mod:`ctypes` 模組中的 ``_use_broken_old_ctypes_structure_semantics_`` " "旗標。(由 Nikita Sobolev 於 :gh:`99285` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1674 ../../whatsnew/3.12.rst:1998 +#: ../../whatsnew/3.12.rst:1663 ../../whatsnew/3.12.rst:1987 msgid "Porting to Python 3.12" -msgstr "" +msgstr "移植至 Python 3.12" -#: ../../whatsnew/3.12.rst:1676 +#: ../../whatsnew/3.12.rst:1665 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.12.rst:1680 +#: ../../whatsnew/3.12.rst:1669 msgid "Changes in the Python API" msgstr "Python API 的變更" -#: ../../whatsnew/3.12.rst:1682 +#: ../../whatsnew/3.12.rst:1671 msgid "" "More strict rules are now applied for numerical group references and group " "names in regular expressions. Only sequence of ASCII digits is now accepted " @@ -3665,7 +3723,7 @@ msgid "" "(Contributed by Serhiy Storchaka in :gh:`91760`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1689 +#: ../../whatsnew/3.12.rst:1678 msgid "" "Remove ``randrange()`` functionality deprecated since Python 3.10. " "Formerly, ``randrange(10.0)`` losslessly converted to ``randrange(10)``. " @@ -3677,7 +3735,7 @@ msgid "" "`86388`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1697 +#: ../../whatsnew/3.12.rst:1686 msgid "" ":class:`argparse.ArgumentParser` changed encoding and error handler for " "reading arguments from file (e.g. ``fromfile_prefix_chars`` option) from " @@ -3687,21 +3745,21 @@ msgid "" "on Windows." msgstr "" -#: ../../whatsnew/3.12.rst:1703 +#: ../../whatsnew/3.12.rst:1692 msgid "" "Remove the ``asyncore``-based ``smtpd`` module deprecated in Python 3.4.7 " "and 3.5.4. A recommended replacement is the :mod:`asyncio`-based :pypi:" "`aiosmtpd` PyPI module." msgstr "" -#: ../../whatsnew/3.12.rst:1707 +#: ../../whatsnew/3.12.rst:1696 msgid "" ":func:`shlex.split`: Passing ``None`` for *s* argument now raises an " "exception, rather than reading :data:`sys.stdin`. The feature was deprecated " "in Python 3.9. (Contributed by Victor Stinner in :gh:`94352`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1712 +#: ../../whatsnew/3.12.rst:1701 msgid "" "The :mod:`os` module no longer accepts bytes-like paths, like :class:" "`bytearray` and :class:`memoryview` types: only the exact :class:`bytes` " @@ -3709,7 +3767,7 @@ msgid "" "`98393`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1717 +#: ../../whatsnew/3.12.rst:1706 msgid "" ":func:`syslog.openlog` and :func:`syslog.closelog` now fail if used in " "subinterpreters. :func:`syslog.syslog` may still be used in subinterpreters, " @@ -3721,7 +3779,7 @@ msgid "" "(Contributed by Donghee Na in :gh:`99127`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1726 +#: ../../whatsnew/3.12.rst:1715 msgid "" "The undocumented locking behavior of :func:`~functools.cached_property` is " "removed, because it locked across all instances of the class, leading to " @@ -3733,14 +3791,14 @@ msgid "" "property getter function or around multi-threaded access points." msgstr "" -#: ../../whatsnew/3.12.rst:1739 +#: ../../whatsnew/3.12.rst:1728 msgid "" "When extracting tar files using :mod:`tarfile` or :func:`shutil." "unpack_archive`, pass the *filter* argument to limit features that may be " "surprising or dangerous. See :ref:`tarfile-extraction-filter` for details." msgstr "" -#: ../../whatsnew/3.12.rst:1744 +#: ../../whatsnew/3.12.rst:1733 msgid "" "The output of the :func:`tokenize.tokenize` and :func:`tokenize." "generate_tokens` functions is now changed due to the changes introduced in :" @@ -3752,15 +3810,15 @@ msgid "" "``f\"start {1+1} end\"`` the old version of the tokenizer emitted::" msgstr "" -#: ../../whatsnew/3.12.rst:1753 +#: ../../whatsnew/3.12.rst:1742 msgid "1,0-1,18: STRING 'f\"start {1+1} end\"'" msgstr "1,0-1,18: STRING 'f\"start {1+1} end\"'" -#: ../../whatsnew/3.12.rst:1755 +#: ../../whatsnew/3.12.rst:1744 msgid "while the new version emits::" msgstr "" -#: ../../whatsnew/3.12.rst:1757 +#: ../../whatsnew/3.12.rst:1746 msgid "" "1,0-1,2: FSTRING_START 'f\"'\n" "1,2-1,8: FSTRING_MIDDLE 'start '\n" @@ -3782,54 +3840,54 @@ msgstr "" "1,13-1,17: FSTRING_MIDDLE ' end'\n" "1,17-1,18: FSTRING_END '\"'" -#: ../../whatsnew/3.12.rst:1767 +#: ../../whatsnew/3.12.rst:1756 msgid "" "Additionally, there may be some minor behavioral changes as a consequence of " "the changes required to support :pep:`701`. Some of these changes include:" msgstr "" -#: ../../whatsnew/3.12.rst:1770 +#: ../../whatsnew/3.12.rst:1759 msgid "" "The ``type`` attribute of the tokens emitted when tokenizing some invalid " "Python characters such as ``!`` has changed from ``ERRORTOKEN`` to ``OP``." msgstr "" -#: ../../whatsnew/3.12.rst:1773 +#: ../../whatsnew/3.12.rst:1762 msgid "" "Incomplete single-line strings now also raise :exc:`tokenize.TokenError` as " "incomplete multiline strings do." msgstr "" -#: ../../whatsnew/3.12.rst:1776 +#: ../../whatsnew/3.12.rst:1765 msgid "" "Some incomplete or invalid Python code now raises :exc:`tokenize.TokenError` " "instead of returning arbitrary ``ERRORTOKEN`` tokens when tokenizing it." msgstr "" -#: ../../whatsnew/3.12.rst:1779 +#: ../../whatsnew/3.12.rst:1768 msgid "" "Mixing tabs and spaces as indentation in the same file is not supported " "anymore and will raise a :exc:`TabError`." msgstr "" -#: ../../whatsnew/3.12.rst:1782 +#: ../../whatsnew/3.12.rst:1771 msgid "" "The :mod:`threading` module now expects the :mod:`!_thread` module to have " "an ``_is_main_interpreter`` attribute. It is a function with no arguments " "that returns ``True`` if the current interpreter is the main interpreter." msgstr "" -#: ../../whatsnew/3.12.rst:1787 +#: ../../whatsnew/3.12.rst:1776 msgid "" "Any library or application that provides a custom ``_thread`` module should " "provide ``_is_main_interpreter()``. (See :gh:`112826`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1792 +#: ../../whatsnew/3.12.rst:1781 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.12.rst:1794 +#: ../../whatsnew/3.12.rst:1783 msgid "" "Python no longer uses :file:`setup.py` to build shared C extension modules. " "Build parameters like headers and libraries are detected in ``configure`` " @@ -3838,21 +3896,21 @@ msgid "" "in :gh:`93939`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1800 +#: ../../whatsnew/3.12.rst:1789 msgid "" "``va_start()`` with two parameters, like ``va_start(args, format),`` is now " "required to build Python. ``va_start()`` is no longer called with a single " "parameter. (Contributed by Kumar Aditya in :gh:`93207`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1805 +#: ../../whatsnew/3.12.rst:1794 msgid "" "CPython now uses the ThinLTO option as the default link time optimization " "policy if the Clang compiler accepts the flag. (Contributed by Donghee Na " "in :gh:`89536`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1809 +#: ../../whatsnew/3.12.rst:1798 msgid "" "Add ``COMPILEALL_OPTS`` variable in :file:`Makefile` to override :mod:" "`compileall` options (default: ``-j0``) in ``make install``. Also merged the " @@ -3861,46 +3919,46 @@ msgid "" "`99289`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1815 +#: ../../whatsnew/3.12.rst:1804 msgid "Add platform triplets for 64-bit LoongArch:" msgstr "" -#: ../../whatsnew/3.12.rst:1817 +#: ../../whatsnew/3.12.rst:1806 msgid "loongarch64-linux-gnusf" msgstr "loongarch64-linux-gnusf" -#: ../../whatsnew/3.12.rst:1818 +#: ../../whatsnew/3.12.rst:1807 msgid "loongarch64-linux-gnuf32" msgstr "loongarch64-linux-gnuf32" -#: ../../whatsnew/3.12.rst:1819 +#: ../../whatsnew/3.12.rst:1808 msgid "loongarch64-linux-gnu" msgstr "loongarch64-linux-gnu" -#: ../../whatsnew/3.12.rst:1821 +#: ../../whatsnew/3.12.rst:1810 msgid "(Contributed by Zhang Na in :gh:`90656`.)" msgstr "(由 Zhang Na 於 :gh:`90656` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1823 +#: ../../whatsnew/3.12.rst:1812 msgid "``PYTHON_FOR_REGEN`` now require Python 3.10 or newer." msgstr "" -#: ../../whatsnew/3.12.rst:1825 +#: ../../whatsnew/3.12.rst:1814 msgid "" "Autoconf 2.71 and aclocal 1.16.4 is now required to regenerate :file:`!" "configure`. (Contributed by Christian Heimes in :gh:`89886`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1829 +#: ../../whatsnew/3.12.rst:1818 msgid "" "Windows builds and macOS installers from python.org now use OpenSSL 3.0." msgstr "" -#: ../../whatsnew/3.12.rst:1833 +#: ../../whatsnew/3.12.rst:1822 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.12.rst:1840 +#: ../../whatsnew/3.12.rst:1829 msgid "" ":pep:`697`: Introduce the :ref:`Unstable C API tier <unstable-c-api>`, " "intended for low-level tools like debuggers and JIT compilers. This API may " @@ -3908,15 +3966,15 @@ msgid "" "contents are marked by the ``PyUnstable_`` prefix in names." msgstr "" -#: ../../whatsnew/3.12.rst:1846 +#: ../../whatsnew/3.12.rst:1835 msgid "Code object constructors:" msgstr "程式碼物件建構函式:" -#: ../../whatsnew/3.12.rst:1848 +#: ../../whatsnew/3.12.rst:1837 msgid "``PyUnstable_Code_New()`` (renamed from ``PyCode_New``)" msgstr "``PyUnstable_Code_New()``\\ (自 ``PyCode_New`` 重新命名)" -#: ../../whatsnew/3.12.rst:1849 +#: ../../whatsnew/3.12.rst:1838 msgid "" "``PyUnstable_Code_NewWithPosOnlyArgs()`` (renamed from " "``PyCode_NewWithPosOnlyArgs``)" @@ -3924,11 +3982,11 @@ msgstr "" "``PyUnstable_Code_NewWithPosOnlyArgs()``\\ (自 " "``PyCode_NewWithPosOnlyArgs`` 重新命名)" -#: ../../whatsnew/3.12.rst:1851 +#: ../../whatsnew/3.12.rst:1840 msgid "Extra storage for code objects (:pep:`523`):" msgstr "程式碼物件的額外儲存 (:pep:`523`):" -#: ../../whatsnew/3.12.rst:1853 +#: ../../whatsnew/3.12.rst:1842 msgid "" "``PyUnstable_Eval_RequestCodeExtraIndex()`` (renamed from " "``_PyEval_RequestCodeExtraIndex``)" @@ -3936,31 +3994,31 @@ msgstr "" "``PyUnstable_Eval_RequestCodeExtraIndex()``\\ (自 " "``_PyEval_RequestCodeExtraIndex`` 重新命名)" -#: ../../whatsnew/3.12.rst:1854 +#: ../../whatsnew/3.12.rst:1843 msgid "``PyUnstable_Code_GetExtra()`` (renamed from ``_PyCode_GetExtra``)" msgstr "``PyUnstable_Code_GetExtra()``\\ (自 ``_PyCode_GetExtra`` 重新命名)" -#: ../../whatsnew/3.12.rst:1855 +#: ../../whatsnew/3.12.rst:1844 msgid "``PyUnstable_Code_SetExtra()`` (renamed from ``_PyCode_SetExtra``)" msgstr "``PyUnstable_Code_SetExtra()``\\ (自 ``_PyCode_SetExtra`` 重新命名)" -#: ../../whatsnew/3.12.rst:1857 +#: ../../whatsnew/3.12.rst:1846 msgid "" "The original names will continue to be available until the respective API " "changes." msgstr "原始名稱將可繼續使用,直到相應的 API 發生變更。" -#: ../../whatsnew/3.12.rst:1860 +#: ../../whatsnew/3.12.rst:1849 msgid "(Contributed by Petr Viktorin in :gh:`101101`.)" msgstr "(由 Petr Viktorin 於 :gh:`101101` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1862 +#: ../../whatsnew/3.12.rst:1851 msgid "" ":pep:`697`: Add an API for extending types whose instance memory layout is " "opaque:" msgstr "" -#: ../../whatsnew/3.12.rst:1865 +#: ../../whatsnew/3.12.rst:1854 msgid "" ":c:member:`PyType_Spec.basicsize` can be zero or negative to specify " "inheriting or extending the base class size." @@ -3968,30 +4026,30 @@ msgstr "" ":c:member:`PyType_Spec.basicsize` 可以為零或負數來指定繼承或擴充基底類別大" "小。" -#: ../../whatsnew/3.12.rst:1867 +#: ../../whatsnew/3.12.rst:1856 msgid "" ":c:func:`PyObject_GetTypeData` and :c:func:`PyType_GetTypeDataSize` added to " "allow access to subclass-specific instance data." msgstr "" -#: ../../whatsnew/3.12.rst:1869 +#: ../../whatsnew/3.12.rst:1858 msgid "" ":c:macro:`Py_TPFLAGS_ITEMS_AT_END` and :c:func:`PyObject_GetItemData` added " "to allow safely extending certain variable-sized types, including :c:var:" "`PyType_Type`." msgstr "" -#: ../../whatsnew/3.12.rst:1872 +#: ../../whatsnew/3.12.rst:1861 msgid "" ":c:macro:`Py_RELATIVE_OFFSET` added to allow defining :c:type:`members " "<PyMemberDef>` in terms of a subclass-specific struct." msgstr "" -#: ../../whatsnew/3.12.rst:1875 +#: ../../whatsnew/3.12.rst:1864 msgid "(Contributed by Petr Viktorin in :gh:`103509`.)" msgstr "(由 Petr Viktorin 於 :gh:`103509` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1877 +#: ../../whatsnew/3.12.rst:1866 msgid "" "Add the new :ref:`limited C API <limited-c-api>` function :c:func:" "`PyType_FromMetaclass`, which generalizes the existing :c:func:" @@ -3999,29 +4057,29 @@ msgid "" "(Contributed by Wenzel Jakob in :gh:`93012`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1882 +#: ../../whatsnew/3.12.rst:1871 msgid "" "API for creating objects that can be called using :ref:`the vectorcall " "protocol <vectorcall>` was added to the :ref:`Limited API <stable>`:" msgstr "" -#: ../../whatsnew/3.12.rst:1886 +#: ../../whatsnew/3.12.rst:1875 msgid ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" msgstr ":c:macro:`Py_TPFLAGS_HAVE_VECTORCALL`" -#: ../../whatsnew/3.12.rst:1887 +#: ../../whatsnew/3.12.rst:1876 msgid ":c:func:`PyVectorcall_NARGS`" msgstr ":c:func:`PyVectorcall_NARGS`" -#: ../../whatsnew/3.12.rst:1888 +#: ../../whatsnew/3.12.rst:1877 msgid ":c:func:`PyVectorcall_Call`" msgstr ":c:func:`PyVectorcall_Call`" -#: ../../whatsnew/3.12.rst:1889 +#: ../../whatsnew/3.12.rst:1878 msgid ":c:type:`vectorcallfunc`" msgstr ":c:type:`vectorcallfunc`" -#: ../../whatsnew/3.12.rst:1891 +#: ../../whatsnew/3.12.rst:1880 msgid "" "The :c:macro:`Py_TPFLAGS_HAVE_VECTORCALL` flag is now removed from a class " "when the class's :py:meth:`~object.__call__` method is reassigned. This " @@ -4032,40 +4090,40 @@ msgid "" "`93274`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1899 +#: ../../whatsnew/3.12.rst:1888 msgid "" "The :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` flags have been added. This allows extensions " -"classes to support object ``__dict__`` and weakrefs with less bookkeeping, " -"using less memory and with faster access." +"classes to support object :attr:`~object.__dict__` and weakrefs with less " +"bookkeeping, using less memory and with faster access." msgstr "" -#: ../../whatsnew/3.12.rst:1904 +#: ../../whatsnew/3.12.rst:1893 msgid "" "API for performing calls using :ref:`the vectorcall protocol <vectorcall>` " "was added to the :ref:`Limited API <stable>`:" msgstr "" -#: ../../whatsnew/3.12.rst:1908 +#: ../../whatsnew/3.12.rst:1897 msgid ":c:func:`PyObject_Vectorcall`" msgstr ":c:func:`PyObject_Vectorcall`" -#: ../../whatsnew/3.12.rst:1909 +#: ../../whatsnew/3.12.rst:1898 msgid ":c:func:`PyObject_VectorcallMethod`" msgstr ":c:func:`PyObject_VectorcallMethod`" -#: ../../whatsnew/3.12.rst:1910 +#: ../../whatsnew/3.12.rst:1899 msgid ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" msgstr ":c:macro:`PY_VECTORCALL_ARGUMENTS_OFFSET`" -#: ../../whatsnew/3.12.rst:1912 +#: ../../whatsnew/3.12.rst:1901 msgid "" "This means that both the incoming and outgoing ends of the vector call " "protocol are now available in the :ref:`Limited API <stable>`. (Contributed " "by Wenzel Jakob in :gh:`98586`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1916 +#: ../../whatsnew/3.12.rst:1905 msgid "" "Add two new public functions, :c:func:`PyEval_SetProfileAllThreads` and :c:" "func:`PyEval_SetTraceAllThreads`, that allow to set tracing and profiling " @@ -4073,14 +4131,14 @@ msgid "" "(Contributed by Pablo Galindo in :gh:`93503`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1922 +#: ../../whatsnew/3.12.rst:1911 msgid "" "Add new function :c:func:`PyFunction_SetVectorcall` to the C API which sets " "the vectorcall field of a given :c:type:`PyFunctionObject`. (Contributed by " "Andrew Frost in :gh:`92257`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1926 +#: ../../whatsnew/3.12.rst:1915 msgid "" "The C API now permits registering callbacks via :c:func:" "`PyDict_AddWatcher`, :c:func:`PyDict_Watch` and related APIs to be called " @@ -4089,28 +4147,28 @@ msgid "" "`91052`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1932 +#: ../../whatsnew/3.12.rst:1921 msgid "" "Add :c:func:`PyType_AddWatcher` and :c:func:`PyType_Watch` API to register " "callbacks to receive notification on changes to a type. (Contributed by Carl " "Meyer in :gh:`91051`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1936 +#: ../../whatsnew/3.12.rst:1925 msgid "" "Add :c:func:`PyCode_AddWatcher` and :c:func:`PyCode_ClearWatcher` APIs to " "register callbacks to receive notification on creation and destruction of " "code objects. (Contributed by Itamar Oren in :gh:`91054`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1941 +#: ../../whatsnew/3.12.rst:1930 msgid "" "Add :c:func:`PyFrame_GetVar` and :c:func:`PyFrame_GetVarString` functions to " "get a frame variable by its name. (Contributed by Victor Stinner in :gh:" "`91248`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1945 +#: ../../whatsnew/3.12.rst:1934 msgid "" "Add :c:func:`PyErr_GetRaisedException` and :c:func:" "`PyErr_SetRaisedException` for saving and restoring the current exception. " @@ -4120,14 +4178,14 @@ msgid "" "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1953 +#: ../../whatsnew/3.12.rst:1942 msgid "" "Add ``_PyErr_ChainExceptions1``, which takes an exception instance, to " "replace the legacy-API ``_PyErr_ChainExceptions``, which is now deprecated. " "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1957 +#: ../../whatsnew/3.12.rst:1946 msgid "" "Add :c:func:`PyException_GetArgs` and :c:func:`PyException_SetArgs` as " "convenience functions for retrieving and modifying the :attr:`~BaseException." @@ -4135,71 +4193,71 @@ msgid "" "in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1962 +#: ../../whatsnew/3.12.rst:1951 msgid "" "Add :c:func:`PyErr_DisplayException`, which takes an exception instance, to " "replace the legacy-api :c:func:`!PyErr_Display`. (Contributed by Irit " "Katriel in :gh:`102755`)." msgstr "" -#: ../../whatsnew/3.12.rst:1968 +#: ../../whatsnew/3.12.rst:1957 msgid "" ":pep:`683`: Introduce *Immortal Objects*, which allows objects to bypass " "reference counts, and related changes to the C-API:" msgstr "" -#: ../../whatsnew/3.12.rst:1971 +#: ../../whatsnew/3.12.rst:1960 msgid "``_Py_IMMORTAL_REFCNT``: The reference count that defines an object" msgstr "``_Py_IMMORTAL_REFCNT``:定義物件的參照計數" -#: ../../whatsnew/3.12.rst:1972 +#: ../../whatsnew/3.12.rst:1961 msgid "as immortal." msgstr "" -#: ../../whatsnew/3.12.rst:1973 +#: ../../whatsnew/3.12.rst:1962 msgid "" "``_Py_IsImmortal`` Checks if an object has the immortal reference count." msgstr "" -#: ../../whatsnew/3.12.rst:1974 +#: ../../whatsnew/3.12.rst:1963 msgid "``PyObject_HEAD_INIT`` This will now initialize reference count to" msgstr "``PyObject_HEAD_INIT`` 這現在將初始化參照計數" -#: ../../whatsnew/3.12.rst:1975 +#: ../../whatsnew/3.12.rst:1964 msgid "``_Py_IMMORTAL_REFCNT`` when used with ``Py_BUILD_CORE``." msgstr "``_Py_IMMORTAL_REFCNT``\\ (與 ``Py_BUILD_CORE`` 一起使用時)。" -#: ../../whatsnew/3.12.rst:1976 +#: ../../whatsnew/3.12.rst:1965 msgid "``SSTATE_INTERNED_IMMORTAL`` An identifier for interned unicode objects" msgstr "" -#: ../../whatsnew/3.12.rst:1977 +#: ../../whatsnew/3.12.rst:1966 msgid "that are immortal." msgstr "" -#: ../../whatsnew/3.12.rst:1978 +#: ../../whatsnew/3.12.rst:1967 msgid "``SSTATE_INTERNED_IMMORTAL_STATIC`` An identifier for interned unicode" msgstr "" -#: ../../whatsnew/3.12.rst:1979 +#: ../../whatsnew/3.12.rst:1968 msgid "objects that are immortal and static" msgstr "" -#: ../../whatsnew/3.12.rst:1980 +#: ../../whatsnew/3.12.rst:1969 msgid "``sys.getunicodeinternedsize`` This returns the total number of unicode" msgstr "" -#: ../../whatsnew/3.12.rst:1981 +#: ../../whatsnew/3.12.rst:1970 msgid "" "objects that have been interned. This is now needed for :file:`refleak.py` " "to correctly track reference counts and allocated blocks" msgstr "" -#: ../../whatsnew/3.12.rst:1984 +#: ../../whatsnew/3.12.rst:1973 msgid "(Contributed by Eddie Elizondo in :gh:`84436`.)" msgstr "(由 Eddie Elizondo 於 :gh:`84436` 中貢獻。)" -#: ../../whatsnew/3.12.rst:1986 +#: ../../whatsnew/3.12.rst:1975 msgid "" ":pep:`684`: Add the new :c:func:`Py_NewInterpreterFromConfig` function and :" "c:type:`PyInterpreterConfig`, which may be used to create sub-interpreters " @@ -4207,27 +4265,27 @@ msgid "" "(Contributed by Eric Snow in :gh:`104110`.)" msgstr "" -#: ../../whatsnew/3.12.rst:1992 +#: ../../whatsnew/3.12.rst:1981 msgid "" "In the limited C API version 3.12, :c:func:`Py_INCREF` and :c:func:" "`Py_DECREF` functions are now implemented as opaque function calls to hide " "implementation details. (Contributed by Victor Stinner in :gh:`105387`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2000 +#: ../../whatsnew/3.12.rst:1989 msgid "" "Legacy Unicode APIs based on ``Py_UNICODE*`` representation has been " "removed. Please migrate to APIs based on UTF-8 or ``wchar_t*``." msgstr "" -#: ../../whatsnew/3.12.rst:2003 +#: ../../whatsnew/3.12.rst:1992 msgid "" "Argument parsing functions like :c:func:`PyArg_ParseTuple` doesn't support " "``Py_UNICODE*`` based format (e.g. ``u``, ``Z``) anymore. Please migrate to " "other formats for Unicode like ``s``, ``z``, ``es``, and ``U``." msgstr "" -#: ../../whatsnew/3.12.rst:2007 +#: ../../whatsnew/3.12.rst:1996 msgid "" "``tp_weaklist`` for all static builtin types is always ``NULL``. This is an " "internal-only field on ``PyTypeObject`` but we're pointing out the change in " @@ -4236,7 +4294,7 @@ msgid "" "necessary, the (internal-only) ``_PyObject_GET_WEAKREFS_LISTPTR()`` macro." msgstr "" -#: ../../whatsnew/3.12.rst:2014 +#: ../../whatsnew/3.12.rst:2003 msgid "" "This internal-only :c:member:`PyTypeObject.tp_subclasses` may now not be a " "valid object pointer. Its type was changed to :c:expr:`void *` to reflect " @@ -4244,13 +4302,13 @@ msgid "" "only field directly." msgstr "" -#: ../../whatsnew/3.12.rst:2019 +#: ../../whatsnew/3.12.rst:2008 msgid "" -"To get a list of subclasses, call the Python method :py:meth:`~class." +"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:2023 +#: ../../whatsnew/3.12.rst:2012 msgid "" "Add support of more formatting options (left aligning, octals, uppercase " "hexadecimals, :c:type:`intmax_t`, :c:type:`ptrdiff_t`, :c:type:`wchar_t` C " @@ -4259,7 +4317,7 @@ msgid "" "`98836`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2029 +#: ../../whatsnew/3.12.rst:2018 msgid "" "An unrecognized format character in :c:func:`PyUnicode_FromFormat` and :c:" "func:`PyUnicode_FromFormatV` now sets a :exc:`SystemError`. In previous " @@ -4268,27 +4326,27 @@ msgid "" "Storchaka in :gh:`95781`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2035 +#: ../../whatsnew/3.12.rst:2024 msgid "" "Fix wrong sign placement in :c:func:`PyUnicode_FromFormat` and :c:func:" "`PyUnicode_FromFormatV`. (Contributed by Philip Georgi in :gh:`95504`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2039 +#: ../../whatsnew/3.12.rst:2028 msgid "" -"Extension classes wanting to add a ``__dict__`` or weak reference slot " -"should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" +"Extension classes wanting to add a :attr:`~object.__dict__` or weak " +"reference slot should use :c:macro:`Py_TPFLAGS_MANAGED_DICT` and :c:macro:" "`Py_TPFLAGS_MANAGED_WEAKREF` instead of ``tp_dictoffset`` and " "``tp_weaklistoffset``, respectively. The use of ``tp_dictoffset`` and " "``tp_weaklistoffset`` is still supported, but does not fully support " "multiple inheritance (:gh:`95589`), and performance may be worse. Classes " -"declaring :c:macro:`Py_TPFLAGS_MANAGED_DICT` should call :c:func:`!" +"declaring :c:macro:`Py_TPFLAGS_MANAGED_DICT` must call :c:func:`!" "_PyObject_VisitManagedDict` and :c:func:`!_PyObject_ClearManagedDict` to " "traverse and clear their instance's dictionaries. To clear weakrefs, call :c:" "func:`PyObject_ClearWeakRefs`, as before." msgstr "" -#: ../../whatsnew/3.12.rst:2051 +#: ../../whatsnew/3.12.rst:2040 msgid "" "The :c:func:`PyUnicode_FSDecoder` function no longer accepts bytes-like " "paths, like :class:`bytearray` and :class:`memoryview` types: only the " @@ -4296,7 +4354,7 @@ msgid "" "Victor Stinner in :gh:`98393`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2056 +#: ../../whatsnew/3.12.rst:2045 msgid "" "The :c:macro:`Py_CLEAR`, :c:macro:`Py_SETREF` and :c:macro:`Py_XSETREF` " "macros now only evaluate their arguments once. If an argument has side " @@ -4304,7 +4362,7 @@ msgid "" "Stinner in :gh:`98724`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2061 +#: ../../whatsnew/3.12.rst:2050 msgid "" "The interpreter's error indicator is now always normalized. This means that :" "c:func:`PyErr_SetObject`, :c:func:`PyErr_SetString` and the other functions " @@ -4312,7 +4370,7 @@ msgid "" "(Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2066 +#: ../../whatsnew/3.12.rst:2055 msgid "" "``_Py_RefTotal`` is no longer authoritative and only kept around for ABI " "compatibility. Note that it is an internal global and only available on " @@ -4320,25 +4378,25 @@ msgid "" "``_Py_GetGlobalRefTotal()``." msgstr "" -#: ../../whatsnew/3.12.rst:2071 +#: ../../whatsnew/3.12.rst:2060 msgid "" "The following functions now select an appropriate metaclass for the newly " "created type:" msgstr "" -#: ../../whatsnew/3.12.rst:2074 +#: ../../whatsnew/3.12.rst:2063 msgid ":c:func:`PyType_FromSpec`" msgstr ":c:func:`PyType_FromSpec`" -#: ../../whatsnew/3.12.rst:2075 +#: ../../whatsnew/3.12.rst:2064 msgid ":c:func:`PyType_FromSpecWithBases`" msgstr ":c:func:`PyType_FromSpecWithBases`" -#: ../../whatsnew/3.12.rst:2076 +#: ../../whatsnew/3.12.rst:2065 msgid ":c:func:`PyType_FromModuleAndSpec`" msgstr ":c:func:`PyType_FromModuleAndSpec`" -#: ../../whatsnew/3.12.rst:2078 +#: ../../whatsnew/3.12.rst:2067 msgid "" "Creating classes whose metaclass overrides :c:member:`~PyTypeObject.tp_new` " "is deprecated, and in Python 3.14+ it will be disallowed. Note that these " @@ -4346,14 +4404,14 @@ msgid "" "initialization." msgstr "" -#: ../../whatsnew/3.12.rst:2083 +#: ../../whatsnew/3.12.rst:2072 msgid "" "Note that :c:func:`PyType_FromMetaclass` (added in Python 3.12) already " "disallows creating classes whose metaclass overrides ``tp_new`` (:meth:" "`~object.__new__` in Python)." msgstr "" -#: ../../whatsnew/3.12.rst:2087 +#: ../../whatsnew/3.12.rst:2076 msgid "" "Since ``tp_new`` overrides almost everything ``PyType_From*`` functions do, " "the two are incompatible with each other. The existing behavior -- ignoring " @@ -4362,17 +4420,17 @@ msgid "" "general workaround. One of the following may work for you:" msgstr "" -#: ../../whatsnew/3.12.rst:2094 +#: ../../whatsnew/3.12.rst:2083 msgid "If you control the metaclass, avoid using ``tp_new`` in it:" msgstr "" -#: ../../whatsnew/3.12.rst:2096 +#: ../../whatsnew/3.12.rst:2085 msgid "" "If initialization can be skipped, it can be done in :c:member:`~PyTypeObject." "tp_init` instead." msgstr "" -#: ../../whatsnew/3.12.rst:2098 +#: ../../whatsnew/3.12.rst:2087 msgid "" "If the metaclass doesn't need to be instantiated from Python, set its " "``tp_new`` to ``NULL`` using the :c:macro:" @@ -4380,20 +4438,20 @@ msgid "" "``PyType_From*`` functions." msgstr "" -#: ../../whatsnew/3.12.rst:2103 +#: ../../whatsnew/3.12.rst:2092 msgid "" "Avoid ``PyType_From*`` functions: if you don't need C-specific features " "(slots or setting the instance size), create types by :ref:`calling <call>` " "the metaclass." msgstr "" -#: ../../whatsnew/3.12.rst:2107 +#: ../../whatsnew/3.12.rst:2096 msgid "" "If you *know* the ``tp_new`` can be skipped safely, filter the deprecation " "warning out using :func:`warnings.catch_warnings` from Python." msgstr "" -#: ../../whatsnew/3.12.rst:2110 +#: ../../whatsnew/3.12.rst:2099 msgid "" ":c:var:`PyOS_InputHook` and :c:var:`PyOS_ReadlineFunctionPointer` are no " "longer called in :ref:`subinterpreters <sub-interpreter-support>`. This is " @@ -4401,14 +4459,14 @@ msgid "" "callbacks have no way of recovering extension module state)." msgstr "" -#: ../../whatsnew/3.12.rst:2115 +#: ../../whatsnew/3.12.rst:2104 msgid "" "This also avoids situations where extensions may find themselves running in " "a subinterpreter that they don't support (or haven't yet been loaded in). " "See :gh:`104668` for more info." msgstr "" -#: ../../whatsnew/3.12.rst:2119 +#: ../../whatsnew/3.12.rst:2108 msgid "" ":c:struct:`PyLongObject` has had its internals changed for better " "performance. Although the internals of :c:struct:`PyLongObject` are private, " @@ -4419,15 +4477,15 @@ msgid "" "a single machine word:" msgstr "" -#: ../../whatsnew/3.12.rst:2127 +#: ../../whatsnew/3.12.rst:2116 msgid ":c:func:`PyUnstable_Long_IsCompact`" msgstr ":c:func:`PyUnstable_Long_IsCompact`" -#: ../../whatsnew/3.12.rst:2128 +#: ../../whatsnew/3.12.rst:2117 msgid ":c:func:`PyUnstable_Long_CompactValue`" msgstr ":c:func:`PyUnstable_Long_CompactValue`" -#: ../../whatsnew/3.12.rst:2130 +#: ../../whatsnew/3.12.rst:2119 msgid "" "Custom allocators, set via :c:func:`PyMem_SetAllocator`, are now required to " "be thread-safe, regardless of memory domain. Allocators that don't have " @@ -4436,7 +4494,7 @@ msgid "" "create a new GitHub issue and CC ``@ericsnowcurrently``." msgstr "" -#: ../../whatsnew/3.12.rst:2140 +#: ../../whatsnew/3.12.rst:2129 msgid "" "In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:" "`PyDictObject` is deprecated for extension modules. Accessing this field " @@ -4445,76 +4503,76 @@ msgid "" "PEP by Ken Jin.)" msgstr "" -#: ../../whatsnew/3.12.rst:2145 +#: ../../whatsnew/3.12.rst:2134 msgid "Deprecate global configuration variable:" msgstr "棄用全域配置變數:" -#: ../../whatsnew/3.12.rst:2147 +#: ../../whatsnew/3.12.rst:2136 msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug`" msgstr ":c:var:`Py_DebugFlag`: 請改用 :c:member:`PyConfig.parser_debug`" -#: ../../whatsnew/3.12.rst:2148 +#: ../../whatsnew/3.12.rst:2137 msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose`" msgstr ":c:var:`Py_VerboseFlag`: 請改用 :c:member:`PyConfig.verbose`" -#: ../../whatsnew/3.12.rst:2149 +#: ../../whatsnew/3.12.rst:2138 msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet`" msgstr ":c:var:`Py_QuietFlag`: 請改用 :c:member:`PyConfig.quiet`" -#: ../../whatsnew/3.12.rst:2150 +#: ../../whatsnew/3.12.rst:2139 msgid ":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive`" msgstr ":c:var:`Py_InteractiveFlag`: 請改用 :c:member:`PyConfig.interactive`" -#: ../../whatsnew/3.12.rst:2151 +#: ../../whatsnew/3.12.rst:2140 msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect`" msgstr ":c:var:`Py_InspectFlag`: 請改用 :c:member:`PyConfig.inspect`" -#: ../../whatsnew/3.12.rst:2152 +#: ../../whatsnew/3.12.rst:2141 msgid ":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level`" msgstr "" ":c:var:`Py_OptimizeFlag`: 請改用 :c:member:`PyConfig.optimization_level`" -#: ../../whatsnew/3.12.rst:2153 +#: ../../whatsnew/3.12.rst:2142 msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import`" msgstr ":c:var:`Py_NoSiteFlag`: 請改用 :c:member:`PyConfig.site_import`" -#: ../../whatsnew/3.12.rst:2154 +#: ../../whatsnew/3.12.rst:2143 msgid ":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning`" msgstr "" ":c:var:`Py_BytesWarningFlag`: 請改用 :c:member:`PyConfig.bytes_warning`" -#: ../../whatsnew/3.12.rst:2155 +#: ../../whatsnew/3.12.rst:2144 msgid ":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings`" msgstr "" ":c:var:`Py_FrozenFlag`: 請改用 :c:member:`PyConfig.pathconfig_warnings`" -#: ../../whatsnew/3.12.rst:2156 +#: ../../whatsnew/3.12.rst:2145 msgid "" ":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`" msgstr "" ":c:var:`Py_IgnoreEnvironmentFlag`: 請改用 :c:member:`PyConfig." "use_environment`" -#: ../../whatsnew/3.12.rst:2157 +#: ../../whatsnew/3.12.rst:2146 msgid "" ":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode`" msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`: 請改用 :c:member:`PyConfig.write_bytecode`" -#: ../../whatsnew/3.12.rst:2158 +#: ../../whatsnew/3.12.rst:2147 msgid "" ":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`" msgstr "" ":c:var:`Py_NoUserSiteDirectory`: 請改用 :c:member:`PyConfig." "user_site_directory`" -#: ../../whatsnew/3.12.rst:2159 +#: ../../whatsnew/3.12.rst:2148 msgid "" ":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio`" msgstr "" ":c:var:`Py_UnbufferedStdioFlag`: 請改用 :c:member:`PyConfig.buffered_stdio`" -#: ../../whatsnew/3.12.rst:2160 +#: ../../whatsnew/3.12.rst:2149 msgid "" ":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed`" @@ -4522,11 +4580,11 @@ msgstr "" ":c:var:`Py_HashRandomizationFlag`: 請改用 :c:member:`PyConfig.use_hash_seed` " "和 :c:member:`PyConfig.hash_seed`" -#: ../../whatsnew/3.12.rst:2162 +#: ../../whatsnew/3.12.rst:2151 msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated`" msgstr ":c:var:`Py_IsolatedFlag`: 請改用 :c:member:`PyConfig.isolated`" -#: ../../whatsnew/3.12.rst:2163 +#: ../../whatsnew/3.12.rst:2152 msgid "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." "legacy_windows_fs_encoding`" @@ -4534,7 +4592,7 @@ msgstr "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`: 請改用 :c:member:`PyPreConfig." "legacy_windows_fs_encoding`" -#: ../../whatsnew/3.12.rst:2164 +#: ../../whatsnew/3.12.rst:2153 msgid "" ":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." "legacy_windows_stdio`" @@ -4542,7 +4600,7 @@ msgstr "" ":c:var:`Py_LegacyWindowsStdioFlag`: 請改用 :c:member:`PyConfig." "legacy_windows_stdio`" -#: ../../whatsnew/3.12.rst:2165 +#: ../../whatsnew/3.12.rst:2154 msgid "" ":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." "filesystem_encoding`" @@ -4550,7 +4608,7 @@ msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." "filesystem_encoding`" -#: ../../whatsnew/3.12.rst:2166 +#: ../../whatsnew/3.12.rst:2155 msgid "" ":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." "filesystem_encoding`" @@ -4558,7 +4616,7 @@ msgstr "" ":c:var:`!Py_HasFileSystemDefaultEncoding`: 請改用 :c:member:`PyConfig." "filesystem_encoding`" -#: ../../whatsnew/3.12.rst:2167 +#: ../../whatsnew/3.12.rst:2156 msgid "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." "filesystem_errors`" @@ -4566,7 +4624,7 @@ msgstr "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`: 請改用 :c:member:`PyConfig." "filesystem_errors`" -#: ../../whatsnew/3.12.rst:2168 +#: ../../whatsnew/3.12.rst:2157 msgid "" ":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:" "`Py_PreInitialize`)" @@ -4574,7 +4632,7 @@ msgstr "" ":c:var:`!Py_UTF8Mode`: 請改用 :c:member:`PyPreConfig.utf8_mode`\\ (參見 :c:" "func:`Py_PreInitialize`)" -#: ../../whatsnew/3.12.rst:2170 +#: ../../whatsnew/3.12.rst:2159 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" "`PyConfig` instead. (Contributed by Victor Stinner in :gh:`77782`.)" @@ -4582,25 +4640,25 @@ msgstr "" ":c:func:`Py_InitializeFromConfig` API 應改為與 :c:type:`PyConfig` 一起使用。" "(由 Victor Stinner 於 :gh:`77782` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2174 +#: ../../whatsnew/3.12.rst:2163 msgid "" "Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable " "bases is deprecated and will be disabled in Python 3.14. (:gh:`95388`)" msgstr "" -#: ../../whatsnew/3.12.rst:2177 +#: ../../whatsnew/3.12.rst:2166 msgid "" "The :file:`structmember.h` header is deprecated, though it continues to be " "available and there are no plans to remove it." msgstr ":file:`structmember.h` 標頭已棄用,但仍可使用,且還沒有移除它的計畫。" -#: ../../whatsnew/3.12.rst:2180 +#: ../../whatsnew/3.12.rst:2169 msgid "" "Its contents are now available just by including :file:`Python.h`, with a " "``Py`` prefix added if it was missing:" msgstr "" -#: ../../whatsnew/3.12.rst:2183 +#: ../../whatsnew/3.12.rst:2172 msgid "" ":c:struct:`PyMemberDef`, :c:func:`PyMember_GetOne` and :c:func:" "`PyMember_SetOne`" @@ -4608,13 +4666,13 @@ msgstr "" ":c:struct:`PyMemberDef`、:c:func:`PyMember_GetOne` 和 :c:func:" "`PyMember_SetOne`" -#: ../../whatsnew/3.12.rst:2185 +#: ../../whatsnew/3.12.rst:2174 msgid "" "Type macros like :c:macro:`Py_T_INT`, :c:macro:`Py_T_DOUBLE`, etc. " "(previously ``T_INT``, ``T_DOUBLE``, etc.)" msgstr "" -#: ../../whatsnew/3.12.rst:2187 +#: ../../whatsnew/3.12.rst:2176 msgid "" "The flags :c:macro:`Py_READONLY` (previously ``READONLY``) and :c:macro:" "`Py_AUDIT_READ` (previously all uppercase)" @@ -4622,23 +4680,23 @@ msgstr "" ":c:macro:`Py_READONLY`\\ (先前為 ``READONLY``)和 :c:macro:" "`Py_AUDIT_READ`\\ (先前全大寫)旗標" -#: ../../whatsnew/3.12.rst:2190 +#: ../../whatsnew/3.12.rst:2179 msgid "Several items are not exposed from :file:`Python.h`:" msgstr "數個項目不再從 :file:`Python.h` 中公開:" -#: ../../whatsnew/3.12.rst:2192 +#: ../../whatsnew/3.12.rst:2181 msgid ":c:macro:`T_OBJECT` (use :c:macro:`Py_T_OBJECT_EX`)" msgstr ":c:macro:`T_OBJECT`\\ (請改用 :c:macro:`Py_T_OBJECT_EX`)" -#: ../../whatsnew/3.12.rst:2193 +#: ../../whatsnew/3.12.rst:2182 msgid ":c:macro:`T_NONE` (previously undocumented, and pretty quirky)" msgstr ":c:macro:`T_NONE`\\ (先前未記錄於文件上,且相當古怪)" -#: ../../whatsnew/3.12.rst:2194 +#: ../../whatsnew/3.12.rst:2183 msgid "The macro ``WRITE_RESTRICTED`` which does nothing." msgstr "不做任何事的巨集 ``WRITE_RESTRICTED``。" -#: ../../whatsnew/3.12.rst:2195 +#: ../../whatsnew/3.12.rst:2184 msgid "" "The macros ``RESTRICTED`` and ``READ_RESTRICTED``, equivalents of :c:macro:" "`Py_AUDIT_READ`." @@ -4646,33 +4704,33 @@ msgstr "" "``RESTRICTED`` 和 ``READ_RESTRICTED`` 這兩個巨集,相當於 :c:macro:" "`Py_AUDIT_READ`。" -#: ../../whatsnew/3.12.rst:2197 +#: ../../whatsnew/3.12.rst:2186 msgid "" "In some configurations, ``<stddef.h>`` is not included from :file:`Python." "h`. It should be included manually when using ``offsetof()``." msgstr "" -#: ../../whatsnew/3.12.rst:2200 +#: ../../whatsnew/3.12.rst:2189 msgid "" "The deprecated header continues to provide its original contents under the " "original names. Your old code can stay unchanged, unless the extra include " "and non-namespaced macros bother you greatly." msgstr "" -#: ../../whatsnew/3.12.rst:2205 +#: ../../whatsnew/3.12.rst:2194 msgid "" "(Contributed in :gh:`47146` by Petr Viktorin, based on earlier work by " "Alexander Belopolsky and Matthias Braun.)" msgstr "" -#: ../../whatsnew/3.12.rst:2208 +#: ../../whatsnew/3.12.rst:2197 msgid "" ":c:func:`PyErr_Fetch` and :c:func:`PyErr_Restore` are deprecated. Use :c:" "func:`PyErr_GetRaisedException` and :c:func:`PyErr_SetRaisedException` " "instead. (Contributed by Mark Shannon in :gh:`101578`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2213 +#: ../../whatsnew/3.12.rst:2202 msgid "" ":c:func:`!PyErr_Display` is deprecated. Use :c:func:`PyErr_DisplayException` " "instead. (Contributed by Irit Katriel in :gh:`102755`)." @@ -4680,7 +4738,7 @@ msgstr "" ":c:func:`!PyErr_Display` 已棄用,請改用 :c:func:`PyErr_DisplayException`。" "(由 Irit Katriel 於 :gh:`102755` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2216 +#: ../../whatsnew/3.12.rst:2205 msgid "" "``_PyErr_ChainExceptions`` is deprecated. Use ``_PyErr_ChainExceptions1`` " "instead. (Contributed by Irit Katriel in :gh:`102192`.)" @@ -4688,7 +4746,7 @@ msgstr "" "``_PyErr_ChainExceptions`` 已棄用,請改用 ``_PyErr_ChainExceptions1``。(由 " "Irit Katriel 於 :gh:`102192` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2219 +#: ../../whatsnew/3.12.rst:2208 msgid "" "Using :c:func:`PyType_FromSpec`, :c:func:`PyType_FromSpecWithBases` or :c:" "func:`PyType_FromModuleAndSpec` to create a class whose metaclass overrides :" @@ -4717,164 +4775,167 @@ msgid "" msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:12 -msgid "``PySys_SetArgvEx()``: set :c:member:`PyConfig.argv` instead." -msgstr "``PySys_SetArgvEx()``:請改以 :c:member:`PyConfig.argv` 設定。" - -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:13 -msgid "``PySys_SetArgv()``: set :c:member:`PyConfig.argv` instead." -msgstr "``PySys_SetArgv()``:請改以 :c:member:`PyConfig.argv` 設定。" +msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" #: ../../deprecations/c-api-pending-removal-in-3.14.rst:14 -msgid "``Py_SetProgramName()``: set :c:member:`PyConfig.program_name` instead." +msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:16 +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." msgstr "" -"``Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設定。" +":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設" +"定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:15 -msgid "``Py_SetPythonHome()``: set :c:member:`PyConfig.home` instead." -msgstr "``Py_SetPythonHome()``:請改以 :c:member:`PyConfig.home` 設定。" +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:18 +msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:17 -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:45 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 msgid "" "The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" "`PyConfig` instead." msgstr "" ":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:20 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 msgid "Global configuration variables:" msgstr "全域設定變數:" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:22 -msgid ":c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 +msgid ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` instead." msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:23 -msgid ":c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 +msgid ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` instead." msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 -msgid ":c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +msgid ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` instead." msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:25 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 msgid "" -":c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive` instead." +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` instead." msgstr ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 -msgid ":c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +msgid ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` instead." msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:27 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:36 msgid "" -":c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level` " +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " "instead." msgstr "" ":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 -msgid ":c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +msgid ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` instead." msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:29 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 msgid "" -":c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning` instead." +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` instead." msgstr "" ":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 msgid "" -":c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings` instead." +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` instead." msgstr "" ":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:31 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:44 msgid "" -":c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment` " +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " "instead." msgstr "" ":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." "use_environment`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 msgid "" -":c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode` " +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " "instead." msgstr "" ":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." "write_bytecode`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:33 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 msgid "" -":c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig." +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." "user_site_directory` instead." msgstr "" ":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." "user_site_directory`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 msgid "" -":c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio` " +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " "instead." msgstr "" ":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:35 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:52 msgid "" -":c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed` " +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " "and :c:member:`PyConfig.hash_seed` instead." msgstr "" ":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " "和 :c:member:`PyConfig.hash_seed`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:37 -msgid ":c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated` instead." +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:55 +msgid ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` instead." msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 msgid "" -":c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig." +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." "legacy_windows_fs_encoding` instead." msgstr "" ":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." "legacy_windows_fs_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:39 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 msgid "" -":c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig." +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." "legacy_windows_stdio` instead." msgstr "" ":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." "legacy_windows_stdio`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 msgid "" -":c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig." +":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." "filesystem_encoding` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." "filesystem_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:41 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 msgid "" -":c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig." +":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." "filesystem_encoding` instead." msgstr "" ":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." "filesystem_encoding`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 msgid "" -":c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig." +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." "filesystem_errors` instead." msgstr "" ":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." "filesystem_errors`。" -#: ../../deprecations/c-api-pending-removal-in-3.14.rst:43 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 msgid "" -":c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` instead. (see :" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" "c:func:`Py_PreInitialize`)" msgstr "" ":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" @@ -4886,64 +4947,63 @@ msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 msgid "" -":c:func:`PyImport_ImportModuleNoBlock`: use :c:func:`PyImport_ImportModule` " -"instead." +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." msgstr "" ":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" "`PyImport_ImportModule`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:6 -msgid "" -":c:func:`PyWeakref_GET_OBJECT`: use :c:func:`!PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GET_OBJECT`:請改用 :c:func:`!PyWeakref_GetRef`。" - #: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 -msgid ":c:func:`PyWeakref_GetObject`: use :c:func:`!PyWeakref_GetRef` instead." -msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`!PyWeakref_GetRef`。" - -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:8 -msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." -msgstr ":c:type:`!Py_UNICODE_WIDE` type:請改用 :c:type:`wchar_t`。" +msgid "" +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead." +msgstr "" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。" #: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 -msgid ":c:type:`Py_UNICODE` type: use :c:type:`wchar_t` instead." -msgstr ":c:type:`Py_UNICODE` type:請改用 :c:type:`wchar_t`。" +msgid "" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." +msgstr "" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:10 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 msgid "Python initialization functions:" msgstr "Python 初始化函式:" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:12 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 msgid "" -":c:func:`PySys_ResetWarnOptions`: clear :data:`sys.warnoptions` and :data:`!" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" "warnings.filters` instead." msgstr "" ":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" "data:`!warnings.filters`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:14 -msgid ":c:func:`Py_GetExecPrefix`: get :data:`sys.exec_prefix` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 +msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 -msgid ":c:func:`Py_GetPath`: get :data:`sys.path` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:16 -msgid ":c:func:`Py_GetPrefix`: get :data:`sys.prefix` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 -msgid ":c:func:`Py_GetProgramFullPath`: get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 +msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:18 -msgid ":c:func:`Py_GetProgramName`: get :data:`sys.executable` instead." +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 +msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" -#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:25 msgid "" -":c:func:`Py_GetPythonHome`: get :c:member:`PyConfig.home` or the :envvar:" +":c:func:`Py_GetPythonHome`: Get :c:member:`PyConfig.home` or the :envvar:" "`PYTHONHOME` environment variable instead." msgstr "" ":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" @@ -4956,84 +5016,85 @@ msgid "" msgstr "下列 API 已被棄用並將會被移除,不過目前尚未訂定移除日期。" #: ../../deprecations/c-api-pending-removal-in-future.rst:7 -msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: unneeded since Python 3.8." +msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." msgstr ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`:自 Python 3.8 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-future.rst:8 -msgid ":c:func:`PyErr_Fetch`: use :c:func:`PyErr_GetRaisedException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." msgstr ":c:func:`PyErr_Fetch`:請改用 :c:func:`PyErr_GetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +#: ../../deprecations/c-api-pending-removal-in-future.rst:11 msgid "" -":c:func:`PyErr_NormalizeException`: use :c:func:`PyErr_GetRaisedException` " +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " "instead." msgstr "" ":c:func:`PyErr_NormalizeException`:請改用 :c:func:" "`PyErr_GetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:10 +#: ../../deprecations/c-api-pending-removal-in-future.rst:13 msgid "" -":c:func:`PyErr_Restore`: use :c:func:`PyErr_SetRaisedException` instead." +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." msgstr ":c:func:`PyErr_Restore`:請改用 :c:func:`PyErr_SetRaisedException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:11 +#: ../../deprecations/c-api-pending-removal-in-future.rst:15 msgid "" -":c:func:`PyModule_GetFilename`: use :c:func:`PyModule_GetFilenameObject` " +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " "instead." msgstr "" ":c:func:`PyModule_GetFilename`:請改用 :c:func:`PyModule_GetFilenameObject`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:12 -msgid ":c:func:`PyOS_AfterFork`: use :c:func:`PyOS_AfterFork_Child` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:13 +#: ../../deprecations/c-api-pending-removal-in-future.rst:19 msgid "" -":c:func:`PySlice_GetIndicesEx`: use :c:func:`PySlice_Unpack` and :c:func:" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" "`PySlice_AdjustIndices` instead." msgstr "" ":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" "`PySlice_AdjustIndices`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:14 +#: ../../deprecations/c-api-pending-removal-in-future.rst:21 msgid "" -":c:func:`!PyUnicode_AsDecodedObject`: use :c:func:`PyCodec_Decode` instead." +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." msgstr "" ":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:15 +#: ../../deprecations/c-api-pending-removal-in-future.rst:23 msgid "" -":c:func:`!PyUnicode_AsDecodedUnicode`: use :c:func:`PyCodec_Decode` instead." +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead." msgstr "" ":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:16 +#: ../../deprecations/c-api-pending-removal-in-future.rst:25 msgid "" -":c:func:`!PyUnicode_AsEncodedObject`: use :c:func:`PyCodec_Encode` instead." +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." msgstr "" ":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +#: ../../deprecations/c-api-pending-removal-in-future.rst:27 msgid "" -":c:func:`!PyUnicode_AsEncodedUnicode`: use :c:func:`PyCodec_Encode` instead." +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead." msgstr "" ":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:18 -msgid ":c:func:`PyUnicode_READY`: unneeded since Python 3.12" +#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" msgstr ":c:func:`PyUnicode_READY`:自 Python 3.12 起不再需要" -#: ../../deprecations/c-api-pending-removal-in-future.rst:19 -msgid ":c:func:`!PyErr_Display`: use :c:func:`PyErr_DisplayException` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:31 +msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." msgstr ":c:func:`!PyErr_Display`:請改用 :c:func:`PyErr_DisplayException`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:20 +#: ../../deprecations/c-api-pending-removal-in-future.rst:33 msgid "" -":c:func:`!_PyErr_ChainExceptions`: use ``_PyErr_ChainExceptions1`` instead." +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " +"instead." msgstr "" ":c:func:`!_PyErr_ChainExceptions`:請改用 ``_PyErr_ChainExceptions1``。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:21 +#: ../../deprecations/c-api-pending-removal-in-future.rst:35 msgid "" ":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " "instead." @@ -5041,92 +5102,92 @@ msgstr "" ":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" "`PyObject_Hash`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:23 +#: ../../deprecations/c-api-pending-removal-in-future.rst:37 msgid ":c:member:`!PyDictObject.ma_version_tag` member." msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:24 +#: ../../deprecations/c-api-pending-removal-in-future.rst:38 msgid "Thread Local Storage (TLS) API:" msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" -#: ../../deprecations/c-api-pending-removal-in-future.rst:26 +#: ../../deprecations/c-api-pending-removal-in-future.rst:40 msgid "" -":c:func:`PyThread_create_key`: use :c:func:`PyThread_tss_alloc` instead." +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." msgstr ":c:func:`PyThread_create_key`:請改用 :c:func:`PyThread_tss_alloc`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:27 -msgid ":c:func:`PyThread_delete_key`: use :c:func:`PyThread_tss_free` instead." +#: ../../deprecations/c-api-pending-removal-in-future.rst:42 +msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." msgstr ":c:func:`PyThread_delete_key`:請改用 :c:func:`PyThread_tss_free`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:28 +#: ../../deprecations/c-api-pending-removal-in-future.rst:44 msgid "" -":c:func:`PyThread_set_key_value`: use :c:func:`PyThread_tss_set` instead." +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." msgstr ":c:func:`PyThread_set_key_value`:請改用 :c:func:`PyThread_tss_set`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +#: ../../deprecations/c-api-pending-removal-in-future.rst:46 msgid "" -":c:func:`PyThread_get_key_value`: use :c:func:`PyThread_tss_get` instead." +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." msgstr ":c:func:`PyThread_get_key_value`:請改用 :c:func:`PyThread_tss_get`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:30 +#: ../../deprecations/c-api-pending-removal-in-future.rst:48 msgid "" -":c:func:`PyThread_delete_key_value`: use :c:func:`PyThread_tss_delete` " +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " "instead." msgstr "" ":c:func:`PyThread_delete_key_value`:請改用 :c:func:`PyThread_tss_delete`。" -#: ../../deprecations/c-api-pending-removal-in-future.rst:31 -msgid ":c:func:`PyThread_ReInitTLS`: unneeded since Python 3.7." +#: ../../deprecations/c-api-pending-removal-in-future.rst:50 +msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" -#: ../../whatsnew/3.12.rst:2235 +#: ../../whatsnew/3.12.rst:2224 msgid "" "Remove the :file:`token.h` header file. There was never any public tokenizer " "C API. The :file:`token.h` header file was only designed to be used by " "Python internals. (Contributed by Victor Stinner in :gh:`92651`.)" msgstr "" -#: ../../whatsnew/3.12.rst:2240 +#: ../../whatsnew/3.12.rst:2229 msgid "Legacy Unicode APIs have been removed. See :pep:`623` for detail." msgstr "" -#: ../../whatsnew/3.12.rst:2242 +#: ../../whatsnew/3.12.rst:2231 msgid ":c:macro:`!PyUnicode_WCHAR_KIND`" msgstr ":c:macro:`!PyUnicode_WCHAR_KIND`" -#: ../../whatsnew/3.12.rst:2243 +#: ../../whatsnew/3.12.rst:2232 msgid ":c:func:`!PyUnicode_AS_UNICODE`" msgstr ":c:func:`!PyUnicode_AS_UNICODE`" -#: ../../whatsnew/3.12.rst:2244 +#: ../../whatsnew/3.12.rst:2233 msgid ":c:func:`!PyUnicode_AsUnicode`" msgstr ":c:func:`!PyUnicode_AsUnicode`" -#: ../../whatsnew/3.12.rst:2245 +#: ../../whatsnew/3.12.rst:2234 msgid ":c:func:`!PyUnicode_AsUnicodeAndSize`" msgstr ":c:func:`!PyUnicode_AsUnicodeAndSize`" -#: ../../whatsnew/3.12.rst:2246 +#: ../../whatsnew/3.12.rst:2235 msgid ":c:func:`!PyUnicode_AS_DATA`" msgstr ":c:func:`!PyUnicode_AS_DATA`" -#: ../../whatsnew/3.12.rst:2247 +#: ../../whatsnew/3.12.rst:2236 msgid ":c:func:`!PyUnicode_FromUnicode`" msgstr ":c:func:`!PyUnicode_FromUnicode`" -#: ../../whatsnew/3.12.rst:2248 +#: ../../whatsnew/3.12.rst:2237 msgid ":c:func:`!PyUnicode_GET_SIZE`" msgstr ":c:func:`!PyUnicode_GET_SIZE`" -#: ../../whatsnew/3.12.rst:2249 +#: ../../whatsnew/3.12.rst:2238 msgid ":c:func:`!PyUnicode_GetSize`" msgstr ":c:func:`!PyUnicode_GetSize`" -#: ../../whatsnew/3.12.rst:2250 +#: ../../whatsnew/3.12.rst:2239 msgid ":c:func:`!PyUnicode_GET_DATA_SIZE`" msgstr ":c:func:`!PyUnicode_GET_DATA_SIZE`" -#: ../../whatsnew/3.12.rst:2252 +#: ../../whatsnew/3.12.rst:2241 msgid "" "Remove the ``PyUnicode_InternImmortal()`` function macro. (Contributed by " "Victor Stinner in :gh:`85858`.)" @@ -5134,56 +5195,104 @@ msgstr "" "移除 ``PyUnicode_InternImmortal()`` 函式巨集。(由 Victor Stinner 於 :gh:" "`85858` 中貢獻。)" -#: ../../whatsnew/3.12.rst:2256 -msgid "Notable changes in 3.12.4" -msgstr "3.12.4 中的顯著變更" - -#: ../../whatsnew/3.12.rst:2259 -msgid "ipaddress" -msgstr "ipaddress" - -#: ../../whatsnew/3.12.rst:2261 -msgid "" -"Fixed ``is_global`` and ``is_private`` behavior in ``IPv4Address``, " -"``IPv6Address``, ``IPv4Network`` and ``IPv6Network``." -msgstr "" -"修正 ``IPv4Address``、``IPv6Address``、``IPv4Network`` 和 ``IPv6Network`` 中" -"的 ``is_global`` 和 ``is_private`` 行為。" - -#: ../../whatsnew/3.12.rst:2266 -msgid "Notable changes in 3.12.5" -msgstr "3.12.5 中的顯著變更" - -#: ../../whatsnew/3.12.rst:2269 ../../whatsnew/3.12.rst:2286 -msgid "email" -msgstr "email" - -#: ../../whatsnew/3.12.rst:2272 -msgid "Headers with embedded newlines are now quoted on output." -msgstr "" - -#: ../../whatsnew/3.12.rst:2274 -msgid "" -"The :mod:`~email.generator` will now refuse to serialize (write) headers " -"that are improperly folded or delimited, such that they would be parsed as " -"multiple headers or joined with adjacent data. If you need to turn this " -"safety feature off, set :attr:`~email.policy.Policy." -"verify_generated_headers`. (Contributed by Bas Bloemsaat and Petr Viktorin " -"in :gh:`121650`.)" -msgstr "" - -#: ../../whatsnew/3.12.rst:2283 -msgid "Notable changes in 3.12.6" -msgstr "3.12.6 中的顯著變更" - -#: ../../whatsnew/3.12.rst:2288 -msgid "" -":func:`email.utils.getaddresses` and :func:`email.utils.parseaddr` now " -"return ``('', '')`` 2-tuples in more situations where invalid email " -"addresses are encountered, instead of potentially inaccurate values. An " -"optional *strict* parameter was added to these two functions: use " -"``strict=False`` to get the old behavior, accepting malformed inputs. " -"``getattr(email.utils, 'supports_strict_parsing', False)`` can be used to " -"check if the *strict* paramater is available. (Contributed by Thomas Dwyer " -"and Victor Stinner for :gh:`102988` to improve the CVE-2023-27043 fix.)" -msgstr "" +#~ msgid "" +#~ ":mod:`platform`: :func:`~platform.java_ver` is deprecated and will be " +#~ "removed in 3.15. It was largely untested, had a confusing API, and was " +#~ "only useful for Jython support. (Contributed by Nikita Sobolev in :gh:" +#~ "`116349`.)" +#~ msgstr "" +#~ ":mod:`platform`::func:`~platform.java_ver` 已被棄用並將在 3.15 中移除。它" +#~ "幾乎沒有被測試過,API 令人困惑並且只對 Jython 支援有用。 (由 Nikita " +#~ "Sobolev 於 :gh:`116349` 貢獻。)" + +#~ msgid "" +#~ ":mod:`threading`: Passing any arguments to :func:`threading.RLock` is now " +#~ "deprecated. C version allows any numbers of args and kwargs, but they are " +#~ "just ignored. Python version does not allow any arguments. All arguments " +#~ "will be removed from :func:`threading.RLock` in Python 3.15. (Contributed " +#~ "by Nikita Sobolev in :gh:`102029`.)" +#~ msgstr "" +#~ ":mod:`threading`:對 :func:`threading.RLock` 傳遞任何引數現在已被棄用。C " +#~ "版本允許任意數量的引數和關鍵字引數,但它們會被忽略。Python 版本不允許任何" +#~ "引數。所有引數將在 Python 3.15 中從 :func:`threading.RLock` 中移除。 (由 " +#~ "Nikita Sobolev 於 :gh:`102029` 貢獻。)" + +#~ msgid ":class:`typing.NamedTuple`:" +#~ msgstr ":class:`typing.NamedTuple`:" + +#~ msgid "" +#~ "When using the functional syntax to create a :class:`!NamedTuple` class, " +#~ "failing to pass a value to the *fields* parameter (``NT = " +#~ "NamedTuple(\"NT\")``) is deprecated. Passing ``None`` to the *fields* " +#~ "parameter (``NT = NamedTuple(\"NT\", None)``) is also deprecated. Both " +#~ "will be disallowed in Python 3.15. To create a :class:`!NamedTuple` class " +#~ "with 0 fields, use ``class NT(NamedTuple): pass`` or ``NT = " +#~ "NamedTuple(\"NT\", [])``." +#~ msgstr "" +#~ "當使用函式語法來建立 :class:`!NamedTuple` 類別時,沒將值傳遞給 *fields* 參" +#~ "數的方式 (``NT = NamedTuple(\"NT\")``) 已被棄用,將 ``None`` 傳遞給 " +#~ "*fields* 參數(``NT = NamedTuple(\"NT\", None)``)也已被棄用。這兩者將在 " +#~ "Python 3.15 中會被禁止。要建立一個沒有欄位的 :class:`!NamedTuple` 類別,請" +#~ "使用 ``class NT(NamedTuple): pass`` 或 ``NT = NamedTuple(\"NT\", [])``。" + +#~ msgid "" +#~ ":class:`typing.TypedDict`: When using the functional syntax to create a :" +#~ "class:`!TypedDict` class, failing to pass a value to the *fields* " +#~ "parameter (``TD = TypedDict(\"TD\")``) is deprecated. Passing ``None`` to " +#~ "the *fields* parameter (``TD = TypedDict(\"TD\", None)``) is also " +#~ "deprecated. Both will be disallowed in Python 3.15. To create a :class:`!" +#~ "TypedDict` class with 0 fields, use ``class TD(TypedDict): pass`` or ``TD " +#~ "= TypedDict(\"TD\", {})``." +#~ msgstr "" +#~ ":class:`typing.TypedDict`:當使用函式語法來建立 :class:`!TypedDict` 類別" +#~ "時,沒將值傳遞給 *fields* 參數的方式(``TD = TypedDict(\"TD\")``)已被棄" +#~ "用,將 ``None`` 傳遞給 *fields* 參數(``TD = TypedDict(\"TD\", None)``)也" +#~ "已被棄用。這兩者將在 Python 3.15 中會被禁止。要建立一個沒有欄位的 :class:" +#~ "`!TypedDict` 類別,請使用 ``class TD(TypedDict): pass`` 或 ``TD = " +#~ "TypedDict(\"TD\", {})``。" + +#~ msgid "" +#~ ":mod:`array`: :class:`array.array` ``'u'`` type (:c:type:`wchar_t`): use " +#~ "the ``'w'`` type instead (``Py_UCS4``)." +#~ msgstr "" +#~ ":mod:`array`::class:`array.array` ``'u'`` 型別 (:c:type:`wchar_t`):請改" +#~ "用 ``'w'`` 型別 (``Py_UCS4``)。" + +#~ msgid ":mod:`builtins`: ``~bool``, bitwise inversion on bool." +#~ msgstr ":mod:`builtins`:``~bool``,對 bool 進行位元反轉。" + +#~ msgid "" +#~ ":mod:`symtable`: Deprecate :meth:`symtable.Class.get_methods` due to the " +#~ "lack of interest. (Contributed by Bénédikt Tran in :gh:`119698`.)" +#~ msgstr "" +#~ ":mod:`symtable`:由於並沒有太多關注,已棄用 :meth:`symtable.Class." +#~ "get_methods`。 (由 Bénédikt Tran 於 :gh:`119698` 貢獻。)" + +#~ msgid "" +#~ ":c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef` instead." +#~ msgstr ":c:func:`PyWeakref_GetObject`:請改用 :c:func:`PyWeakref_GetRef`。" + +#~ msgid ":c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t` instead." +#~ msgstr ":c:type:`!Py_UNICODE_WIDE` type:請改用 :c:type:`wchar_t`。" + +#~ msgid "Notable changes in 3.12.4" +#~ msgstr "3.12.4 中的顯著變更" + +#~ msgid "ipaddress" +#~ msgstr "ipaddress" + +#~ msgid "" +#~ "Fixed ``is_global`` and ``is_private`` behavior in ``IPv4Address``, " +#~ "``IPv6Address``, ``IPv4Network`` and ``IPv6Network``." +#~ msgstr "" +#~ "修正 ``IPv4Address``、``IPv6Address``、``IPv4Network`` 和 ``IPv6Network`` " +#~ "中的 ``is_global`` 和 ``is_private`` 行為。" + +#~ msgid "Notable changes in 3.12.5" +#~ msgstr "3.12.5 中的顯著變更" + +#~ msgid "email" +#~ msgstr "email" + +#~ msgid "Notable changes in 3.12.6" +#~ msgstr "3.12.6 中的顯著變更" diff --git a/whatsnew/3.13.po b/whatsnew/3.13.po new file mode 100644 index 0000000000..48215f745d --- /dev/null +++ b/whatsnew/3.13.po @@ -0,0 +1,5309 @@ +# Copyright (C) 2001-2024, Python Software Foundation +# This file is distributed under the same license as the Python package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Python 3.13\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-05 00:13+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" +"tw)\n" +"Language: zh_TW\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../../whatsnew/3.13.rst:4 +msgid "What's New In Python 3.13" +msgstr "Python 3.13 有什麼新功能" + +#: ../../whatsnew/3.13.rst:0 +msgid "Editors" +msgstr "編輯者" + +#: ../../whatsnew/3.13.rst:6 +msgid "Adam Turner and Thomas Wouters" +msgstr "Adam Turner 和 Thomas Wouters" + +#: ../../whatsnew/3.13.rst:48 +msgid "" +"This article explains the new features in Python 3.13, compared to 3.12. " +"Python 3.13 will be released on October 7, 2024. For full details, see the :" +"ref:`changelog <changelog>`." +msgstr "" +"本文介紹了 Python 3.13 與 3.12 相比多了哪些新功能。Python 3.13 將於 2024 年 " +"10 月 7 日發布。完整詳請請見 :ref:`changelog <changelog>`。" + +#: ../../whatsnew/3.13.rst:54 +msgid ":pep:`719` -- Python 3.13 Release Schedule" +msgstr ":pep:`719` -- Python 3.13 發佈時程" + +#: ../../whatsnew/3.13.rst:58 +msgid "Summary -- Release Highlights" +msgstr "發布重點摘要" + +#: ../../whatsnew/3.13.rst:63 +msgid "" +"Python 3.13 will be the latest stable release of the Python programming " +"language, with a mix of changes to the language, the implementation and the " +"standard library. The biggest changes include a new `interactive interpreter " +"<whatsnew313-better-interactive-interpreter_>`_, experimental support for " +"running in a `free-threaded mode <whatsnew313-free-threaded-cpython_>`_ (:" +"pep:`703`), and a `Just-In-Time compiler <whatsnew313-jit-compiler_>`_ (:pep:" +"`744`)." +msgstr "" + +#: ../../whatsnew/3.13.rst:72 +msgid "" +"Error messages continue to improve, with tracebacks now highlighted in color " +"by default. The :func:`locals` builtin now has :ref:`defined semantics " +"<whatsnew313-locals-semantics>` for changing the returned mapping, and type " +"parameters now support default values." +msgstr "" + +#: ../../whatsnew/3.13.rst:77 +msgid "" +"The library changes contain removal of deprecated APIs and modules, as well " +"as the usual improvements in user-friendliness and correctness. Several " +"legacy standard library modules have now `been removed <whatsnew313-" +"pep594_>`_ following their deprecation in Python 3.11 (:pep:`594`)." +msgstr "" + +#: ../../whatsnew/3.13.rst:82 +msgid "" +"This article doesn't attempt to provide a complete specification of all new " +"features, but instead gives a convenient overview. For full details refer to " +"the documentation, such as the :ref:`Library Reference <library-index>` and :" +"ref:`Language Reference <reference-index>`. To understand the complete " +"implementation and design rationale for a change, refer to the PEP for a " +"particular new feature; but note that PEPs usually are not kept up-to-date " +"once a feature has been fully implemented. See `Porting to Python 3.13`_ for " +"guidance on upgrading from earlier versions of Python." +msgstr "" + +#: ../../whatsnew/3.13.rst:98 +msgid "Interpreter improvements:" +msgstr "直譯器改進:" + +#: ../../whatsnew/3.13.rst:100 +msgid "" +"A greatly improved :ref:`interactive interpreter <whatsnew313-better-" +"interactive-interpreter>` and :ref:`improved error messages <whatsnew313-" +"improved-error-messages>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:103 +msgid "" +":pep:`667`: The :func:`locals` builtin now has :ref:`defined semantics " +"<whatsnew313-locals-semantics>` when mutating the returned mapping. Python " +"debuggers and similar tools may now more reliably update local variables in " +"optimized scopes even during concurrent code execution." +msgstr "" + +#: ../../whatsnew/3.13.rst:108 +msgid "" +":pep:`703`: CPython 3.13 has experimental support for running with the :term:" +"`global interpreter lock` disabled. See :ref:`Free-threaded CPython " +"<whatsnew313-free-threaded-cpython>` for more details." +msgstr "" + +#: ../../whatsnew/3.13.rst:111 +msgid "" +":pep:`744`: A basic :ref:`JIT compiler <whatsnew313-jit-compiler>` was " +"added. It is currently disabled by default (though we may turn it on later). " +"Performance improvements are modest -- we expect to improve this over the " +"next few releases." +msgstr "" + +#: ../../whatsnew/3.13.rst:115 +msgid "" +"Color support in the new :ref:`interactive interpreter <whatsnew313-better-" +"interactive-interpreter>`, as well as in :ref:`tracebacks <whatsnew313-" +"improved-error-messages>` and :ref:`doctest <whatsnew313-doctest>` output. " +"This can be disabled through the :envvar:`PYTHON_COLORS` and |NO_COLOR|_ " +"environment variables." +msgstr "" + +#: ../../whatsnew/3.13.rst:122 +msgid "Python data model improvements:" +msgstr "Python 資料模型改進:" + +#: ../../whatsnew/3.13.rst:124 +msgid "" +":attr:`~type.__static_attributes__` stores the names of attributes accessed " +"through ``self.X`` in any function in a class body." +msgstr "" + +#: ../../whatsnew/3.13.rst:126 +msgid "" +":attr:`~type.__firstlineno__` records the first line number of a class " +"definition." +msgstr "" + +#: ../../whatsnew/3.13.rst:129 +msgid "Significant improvements in the standard library:" +msgstr "標準函式庫中的顯著改進" + +#: ../../whatsnew/3.13.rst:131 +msgid "" +"Add a new :exc:`PythonFinalizationError` exception, raised when an operation " +"is blocked during :term:`finalization <interpreter shutdown>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:133 +msgid "" +"The :mod:`argparse` module now supports deprecating command-line options, " +"positional arguments, and subcommands." +msgstr "" + +#: ../../whatsnew/3.13.rst:135 +msgid "" +"The new functions :func:`base64.z85encode` and :func:`base64.z85decode` " +"support encoding and decoding `Z85 data`_." +msgstr "" + +#: ../../whatsnew/3.13.rst:137 +msgid "" +"The :mod:`copy` module now has a :func:`copy.replace` function, with support " +"for many builtin types and any class defining the :func:`~object." +"__replace__` method." +msgstr "" + +#: ../../whatsnew/3.13.rst:140 +msgid "" +"The new :mod:`dbm.sqlite3` module is now the default :mod:`dbm` backend." +msgstr "新的 :mod:`dbm.sqlite3` 模組現在是預設的 :mod:`dbm` 後端。" + +#: ../../whatsnew/3.13.rst:141 +msgid "" +"The :mod:`os` module has a :ref:`suite of new functions <os-timerfd>` for " +"working with Linux's timer notification file descriptors." +msgstr "" + +#: ../../whatsnew/3.13.rst:143 +msgid "" +"The :mod:`random` module now has a :ref:`command-line interface <random-" +"cli>`." +msgstr "現在 :mod:`random` 模組有一個\\ :ref:`命令列介面 <random-cli>`。" + +#: ../../whatsnew/3.13.rst:145 +msgid "Security improvements:" +msgstr "安全性改進:" + +#: ../../whatsnew/3.13.rst:147 +msgid "" +":func:`ssl.create_default_context` sets :data:`ssl." +"VERIFY_X509_PARTIAL_CHAIN` and :data:`ssl.VERIFY_X509_STRICT` as default " +"flags." +msgstr "" + +#: ../../whatsnew/3.13.rst:150 +msgid "C API improvements:" +msgstr "C API 改進:" + +#: ../../whatsnew/3.13.rst:152 +msgid "" +"The :c:data:`Py_mod_gil` slot is now used to indicate that an extension " +"module supports running with the :term:`GIL` disabled." +msgstr "" + +#: ../../whatsnew/3.13.rst:154 +msgid "" +"The :doc:`PyTime C API </c-api/time>` has been added, providing access to " +"system clocks." +msgstr "" + +#: ../../whatsnew/3.13.rst:156 +msgid "" +":c:type:`PyMutex` is a new lightweight mutex that occupies a single byte." +msgstr "" + +#: ../../whatsnew/3.13.rst:157 +msgid "" +"There is a new :ref:`suite of functions <c-api-monitoring>` for generating :" +"pep:`669` monitoring events in the C API." +msgstr "" + +#: ../../whatsnew/3.13.rst:160 +msgid "New typing features:" +msgstr "新增型別特性:" + +#: ../../whatsnew/3.13.rst:162 +msgid "" +":pep:`696`: Type parameters (:data:`typing.TypeVar`, :data:`typing." +"ParamSpec`, and :data:`typing.TypeVarTuple`) now support defaults." +msgstr "" + +#: ../../whatsnew/3.13.rst:164 +msgid "" +":pep:`702`: The new :func:`warnings.deprecated` decorator adds support for " +"marking deprecations in the type system and at runtime." +msgstr "" + +#: ../../whatsnew/3.13.rst:166 +msgid "" +":pep:`705`: :data:`typing.ReadOnly` can be used to mark an item of a :class:" +"`typing.TypedDict` as read-only for type checkers." +msgstr "" + +#: ../../whatsnew/3.13.rst:168 +msgid "" +":pep:`742`: :data:`typing.TypeIs` provides more intuitive type narrowing " +"behavior, as an alternative to :data:`typing.TypeGuard`." +msgstr "" + +#: ../../whatsnew/3.13.rst:171 +msgid "Platform support:" +msgstr "平台支援:" + +#: ../../whatsnew/3.13.rst:173 +msgid "" +":pep:`730`: Apple's iOS is now an :ref:`officially supported platform " +"<whatsnew313-platform-support>`, at :pep:`tier 3 <11#tier-3>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:175 +msgid "" +":pep:`738`: Android is now an :ref:`officially supported platform " +"<whatsnew313-platform-support>`, at :pep:`tier 3 <11#tier-3>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:177 +msgid "" +"``wasm32-wasi`` is now supported as a :pep:`tier 2 <11#tier-2>` platform." +msgstr "``wasm32-wasi`` 現在作為 :pep:`tier 2 <11#tier-2>` 平台支援。" + +#: ../../whatsnew/3.13.rst:178 +msgid "``wasm32-emscripten`` is no longer an officially supported platform." +msgstr "``wasm32-emscripten`` 不再是官方支援的平台。" + +#: ../../whatsnew/3.13.rst:180 +msgid "Important removals:" +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`." +msgstr "" +":ref:`PEP 594 <whatsnew313-pep594>`: 剩下的 19 個 \"dead batteries\" (遺留標" +"準函式庫模組)以字標準函式庫中移除::mod:`!aifc`、:mod:`!audioop`、:mod:`!" +"cgi`、:mod:`!cgitb`、:mod:`!chunk`、:mod:`!crypt`、:mod:`!imghdr`、:mod:`!" +"mailcap`、:mod:`!msilib`、:mod:`!nis`、:mod:`!nntplib`、:mod:`!" +"ossaudiodev`、:mod:`!pipes`、:mod:`!sndhdr`、:mod:`!spwd`、:mod:`!sunau`、:" +"mod:`!telnetlib`、:mod:`!uu` 和 :mod:`!xdrlib`." + +#: ../../whatsnew/3.13.rst:188 +msgid "" +"Remove the :program:`2to3` tool and :mod:`!lib2to3` module (deprecated in " +"Python 3.11)." +msgstr "" + +#: ../../whatsnew/3.13.rst:190 +msgid "Remove the :mod:`!tkinter.tix` module (deprecated in Python 3.6)." +msgstr "移除 :mod:`!tkinter.tix` 模組(在 Python 3.6 中已棄用)。" + +#: ../../whatsnew/3.13.rst:191 +msgid "Remove the :func:`!locale.resetlocale` function." +msgstr "移除 :func:`!locale.resetlocale` 函式。" + +#: ../../whatsnew/3.13.rst:192 +msgid "Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces." +msgstr "移除 :mod:`!typing.io` 和 :mod:`!typing.re` 命名空間。" + +#: ../../whatsnew/3.13.rst:193 +msgid "Remove chained :class:`classmethod` descriptors." +msgstr "" + +#: ../../whatsnew/3.13.rst:195 +msgid "Release schedule changes:" +msgstr "" + +#: ../../whatsnew/3.13.rst:197 +msgid "" +":pep:`602` (\"Annual Release Cycle for Python\") has been updated to extend " +"the full support ('bugfix') period for new releases to two years. This " +"updated policy means that:" +msgstr "" + +#: ../../whatsnew/3.13.rst:201 +msgid "" +"Python 3.9--3.12 have one and a half years of full support, followed by " +"three and a half years of security fixes." +msgstr "" + +#: ../../whatsnew/3.13.rst:203 +msgid "" +"Python 3.13 and later have two years of full support, followed by three " +"years of security fixes." +msgstr "" + +#: ../../whatsnew/3.13.rst:208 ../../whatsnew/3.13.rst:1964 +msgid "New Features" +msgstr "新增功能" + +#: ../../whatsnew/3.13.rst:214 +msgid "A better interactive interpreter" +msgstr "" + +#: ../../whatsnew/3.13.rst:216 +msgid "" +"Python now uses a new :term:`interactive` shell by default, based on code " +"from the `PyPy project`_. When the user starts the :term:`REPL` from an " +"interactive terminal, the following new features are now supported:" +msgstr "" + +#: ../../whatsnew/3.13.rst:221 +msgid "Multiline editing with history preservation." +msgstr "" + +#: ../../whatsnew/3.13.rst:222 +msgid "" +"Direct support for REPL-specific commands like :kbd:`help`, :kbd:`exit`, " +"and :kbd:`quit`, without the need to call them as functions." +msgstr "" + +#: ../../whatsnew/3.13.rst:224 +msgid "" +"Prompts and tracebacks with :ref:`color enabled by default <using-on-" +"controlling-color>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:226 +msgid "" +"Interactive help browsing using :kbd:`F1` with a separate command history." +msgstr "" + +#: ../../whatsnew/3.13.rst:228 +msgid "" +"History browsing using :kbd:`F2` that skips output as well as the :term:" +"`>>>` and :term:`...` prompts." +msgstr "" + +#: ../../whatsnew/3.13.rst:230 +msgid "" +"\"Paste mode\" with :kbd:`F3` that makes pasting larger blocks of code " +"easier (press :kbd:`F3` again to return to the regular prompt)." +msgstr "" + +#: ../../whatsnew/3.13.rst:233 +msgid "" +"To disable the new interactive shell, set the :envvar:`PYTHON_BASIC_REPL` " +"environment variable. For more on interactive mode, see :ref:`tut-interac`." +msgstr "" + +#: ../../whatsnew/3.13.rst:237 +msgid "" +"(Contributed by Pablo Galindo Salgado, Łukasz Langa, and Lysandros Nikolaou " +"in :gh:`111201` based on code from the PyPy project. Windows support " +"contributed by Dino Viehland and Anthony Shaw.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:247 +msgid "Improved error messages" +msgstr "" + +#: ../../whatsnew/3.13.rst:249 +msgid "" +"The interpreter now uses color by default when displaying tracebacks in the " +"terminal. This feature :ref:`can be controlled <using-on-controlling-color>` " +"via the new :envvar:`PYTHON_COLORS` environment variable as well as the " +"canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment variables. (Contributed " +"by Pablo Galindo Salgado in :gh:`112730`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:264 +msgid "" +"A common mistake is to write a script with the same name as a standard " +"library module. When this results in errors, we now display a more helpful " +"error message:" +msgstr "" + +#: ../../whatsnew/3.13.rst:268 +msgid "" +"$ python random.py\n" +"Traceback (most recent call last):\n" +" File \"/home/me/random.py\", line 1, in <module>\n" +" import random\n" +" File \"/home/me/random.py\", line 3, in <module>\n" +" print(random.randint(5))\n" +" ^^^^^^^^^^^^^^\n" +"AttributeError: module 'random' has no attribute 'randint' (consider " +"renaming '/home/me/random.py' since it has the same name as the standard " +"library module named 'random' and the import system gives it precedence)" +msgstr "" +"$ python random.py\n" +"Traceback (most recent call last):\n" +" File \"/home/me/random.py\", line 1, in <module>\n" +" import random\n" +" File \"/home/me/random.py\", line 3, in <module>\n" +" print(random.randint(5))\n" +" ^^^^^^^^^^^^^^\n" +"AttributeError: module 'random' has no attribute 'randint' (consider " +"renaming '/home/me/random.py' since it has the same name as the standard " +"library module named 'random' and the import system gives it precedence)" + +#: ../../whatsnew/3.13.rst:279 +msgid "" +"Similarly, if a script has the same name as a third-party module that it " +"attempts to import and this results in errors, we also display a more " +"helpful error message:" +msgstr "" + +#: ../../whatsnew/3.13.rst:283 +msgid "" +"$ python numpy.py\n" +"Traceback (most recent call last):\n" +" File \"/home/me/numpy.py\", line 1, in <module>\n" +" import numpy as np\n" +" File \"/home/me/numpy.py\", line 3, in <module>\n" +" np.array([1, 2, 3])\n" +" ^^^^^^^^\n" +"AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/" +"home/me/numpy.py' if it has the same name as a third-party module you " +"intended to import)" +msgstr "" +"$ python numpy.py\n" +"Traceback (most recent call last):\n" +" File \"/home/me/numpy.py\", line 1, in <module>\n" +" import numpy as np\n" +" File \"/home/me/numpy.py\", line 3, in <module>\n" +" np.array([1, 2, 3])\n" +" ^^^^^^^^\n" +"AttributeError: module 'numpy' has no attribute 'array' (consider renaming '/" +"home/me/numpy.py' if it has the same name as a third-party module you " +"intended to import)" + +#: ../../whatsnew/3.13.rst:294 +msgid "(Contributed by Shantanu Jain in :gh:`95754`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:296 +msgid "" +"The error message now tries to suggest the correct keyword argument when an " +"incorrect keyword argument is passed to a function." +msgstr "" + +#: ../../whatsnew/3.13.rst:299 +msgid "" +">>> \"Better error messages!\".split(max_split=1)\n" +"Traceback (most recent call last):\n" +" File \"<python-input-0>\", line 1, in <module>\n" +" \"Better error messages!\".split(max_split=1)\n" +" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^\n" +"TypeError: split() got an unexpected keyword argument 'max_split'. Did you " +"mean 'maxsplit'?" +msgstr "" +">>> \"Better error messages!\".split(max_split=1)\n" +"Traceback (most recent call last):\n" +" File \"<python-input-0>\", line 1, in <module>\n" +" \"Better error messages!\".split(max_split=1)\n" +" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^\n" +"TypeError: split() got an unexpected keyword argument 'max_split'. Did you " +"mean 'maxsplit'?" + +#: ../../whatsnew/3.13.rst:308 +msgid "" +"(Contributed by Pablo Galindo Salgado and Shantanu Jain in :gh:`107944`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:314 +msgid "Free-threaded CPython" +msgstr "" + +#: ../../whatsnew/3.13.rst:316 +msgid "" +"CPython now has experimental support for running in a free-threaded mode, " +"with the :term:`global interpreter lock` (GIL) disabled. This is an " +"experimental feature and therefore is not enabled by default. The free-" +"threaded mode requires a different executable, usually called " +"``python3.13t`` or ``python3.13t.exe``. Pre-built binaries marked as *free-" +"threaded* can be installed as part of the official :ref:`Windows <install-" +"freethreaded-windows>` and :ref:`macOS <install-freethreaded-macos>` " +"installers, or CPython can be built from source with the :option:`--disable-" +"gil` option." +msgstr "" + +#: ../../whatsnew/3.13.rst:326 +msgid "" +"Free-threaded execution allows for full utilization of the available " +"processing power by running threads in parallel on available CPU cores. " +"While not all software will benefit from this automatically, programs " +"designed with threading in mind will run faster on multi-core hardware. " +"**The free-threaded mode is experimental** and work is ongoing to improve " +"it: expect some bugs and a substantial single-threaded performance hit. Free-" +"threaded builds of CPython support optionally running with the GIL enabled " +"at runtime using the environment variable :envvar:`PYTHON_GIL` or the " +"command-line option :option:`-X gil=1`." +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 " +"build\". The new :func:`!sys._is_gil_enabled` function can be used to check " +"whether the GIL is actually disabled in the running process." +msgstr "" + +#: ../../whatsnew/3.13.rst:341 +msgid "" +"C-API extension modules need to be built specifically for the free-threaded " +"build. Extensions that support running with the :term:`GIL` disabled should " +"use the :c:data:`Py_mod_gil` slot. Extensions using single-phase init should " +"use :c:func:`PyUnstable_Module_SetGIL` to indicate whether they support " +"running with the GIL disabled. Importing C extensions that don't use these " +"mechanisms will cause the GIL to be enabled, unless the GIL was explicitly " +"disabled with the :envvar:`PYTHON_GIL` environment variable or the :option:`-" +"X gil=0` option. pip 24.1 or newer is required to install packages with C " +"extensions in the free-threaded build." +msgstr "" + +#: ../../whatsnew/3.13.rst:352 +msgid "" +"This work was made possible thanks to many individuals and organizations, " +"including the large community of contributors to Python and third-party " +"projects to test and enable free-threading support. Notable contributors " +"include: Sam Gross, Ken Jin, Donghee Na, Itamar Oren, Matt Page, Brett " +"Simmers, Dino Viehland, Carl Meyer, Nathan Goldbaum, Ralf Gommers, Lysandros " +"Nikolaou, and many others. Many of these contributors are employed by Meta, " +"which has provided significant engineering resources to support this project." +msgstr "" + +#: ../../whatsnew/3.13.rst:364 +msgid "" +":pep:`703` \"Making the Global Interpreter Lock Optional in CPython\" " +"contains rationale and information surrounding this work." +msgstr "" + +#: ../../whatsnew/3.13.rst:367 +msgid "" +"`Porting Extension Modules to Support Free-Threading <https://py-free-" +"threading.github.io/porting/>`_: A community-maintained porting guide for " +"extension authors." +msgstr "" + +#: ../../whatsnew/3.13.rst:375 +msgid "An experimental just-in-time (JIT) compiler" +msgstr "" + +#: ../../whatsnew/3.13.rst:377 +msgid "" +"When CPython is configured and built using the :option:`!--enable-" +"experimental-jit` option, a just-in-time (JIT) compiler is added which may " +"speed up some Python programs. On Windows, use ``PCbuild/build.bat --" +"experimental-jit`` to enable the JIT or ``--experimental-jit-interpreter`` " +"to enable the Tier 2 interpreter. Build requirements and further supporting " +"information `are contained at`__ :file:`Tools/jit/README.md`." +msgstr "" + +#: ../../whatsnew/3.13.rst:387 +msgid "" +"The :option:`!--enable-experimental-jit` option takes these (optional) " +"values, defaulting to ``yes`` if :option:`!--enable-experimental-jit` is " +"present without the optional value." +msgstr "" + +#: ../../whatsnew/3.13.rst:391 +msgid "``no``: Disable the entire Tier 2 and JIT pipeline." +msgstr "" + +#: ../../whatsnew/3.13.rst:392 +msgid "" +"``yes``: Enable the JIT. To disable the JIT at runtime, pass the environment " +"variable ``PYTHON_JIT=0``." +msgstr "" + +#: ../../whatsnew/3.13.rst:394 +msgid "" +"``yes-off``: Build the JIT but disable it by default. To enable the JIT at " +"runtime, pass the environment variable ``PYTHON_JIT=1``." +msgstr "" + +#: ../../whatsnew/3.13.rst:396 +msgid "" +"``interpreter``: Enable the Tier 2 interpreter but disable the JIT. The " +"interpreter can be disabled by running with ``PYTHON_JIT=0``." +msgstr "" + +#: ../../whatsnew/3.13.rst:399 +msgid "The internal architecture is roughly as follows:" +msgstr "" + +#: ../../whatsnew/3.13.rst:401 +msgid "" +"We start with specialized *Tier 1 bytecode*. See :ref:`What's new in 3.11 " +"<whatsnew311-pep659>` for details." +msgstr "" + +#: ../../whatsnew/3.13.rst:403 +msgid "" +"When the Tier 1 bytecode gets hot enough, it gets translated to a new purely " +"internal intermediate representation (IR), called the *Tier 2 IR*, and " +"sometimes referred to as micro-ops (\"uops\")." +msgstr "" + +#: ../../whatsnew/3.13.rst:406 +msgid "" +"The Tier 2 IR uses the same stack-based virtual machine as Tier 1, but the " +"instruction format is better suited to translation to machine code." +msgstr "" + +#: ../../whatsnew/3.13.rst:408 +msgid "" +"We have several optimization passes for Tier 2 IR, which are applied before " +"it is interpreted or translated to machine code." +msgstr "" + +#: ../../whatsnew/3.13.rst:410 +msgid "" +"There is a Tier 2 interpreter, but it is mostly intended for debugging the " +"earlier stages of the optimization pipeline. The Tier 2 interpreter can be " +"enabled by configuring Python with ``--enable-experimental-jit=interpreter``." +msgstr "" + +#: ../../whatsnew/3.13.rst:414 +msgid "" +"When the JIT is enabled, the optimized Tier 2 IR is translated to machine " +"code, which is then executed." +msgstr "" + +#: ../../whatsnew/3.13.rst:416 +msgid "" +"The machine code translation process uses a technique called *copy-and-" +"patch*. It has no runtime dependencies, but there is a new build-time " +"dependency on LLVM." +msgstr "" + +#: ../../whatsnew/3.13.rst:420 +msgid ":pep:`744`" +msgstr ":pep:`744`" + +#: ../../whatsnew/3.13.rst:422 +msgid "" +"(JIT by Brandt Bucher, inspired by a paper by Haoran Xu and Fredrik " +"Kjolstad. Tier 2 IR by Mark Shannon and Guido van Rossum. Tier 2 optimizer " +"by Ken Jin.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:430 +msgid "Defined mutation semantics for :py:func:`locals`" +msgstr "" + +#: ../../whatsnew/3.13.rst:432 +msgid "" +"Historically, the expected result of mutating the return value of :func:" +"`locals` has been left to individual Python implementations to define. " +"Starting from Python 3.13, :pep:`667` standardises the historical behavior " +"of CPython for most code execution scopes, but changes :term:`optimized " +"scopes <optimized scope>` (functions, generators, coroutines, " +"comprehensions, and generator expressions) to explicitly return independent " +"snapshots of the currently assigned local variables, including locally " +"referenced nonlocal variables captured in closures." +msgstr "" + +#: ../../whatsnew/3.13.rst:441 +msgid "" +"This change to the semantics of :func:`locals` in optimized scopes also " +"affects the default behavior of code execution functions that implicitly " +"target :func:`!locals` if no explicit namespace is provided (such as :func:" +"`exec` and :func:`eval`). In previous versions, whether or not changes could " +"be accessed by calling :func:`!locals` after calling the code execution " +"function was implementation-dependent. In CPython specifically, such code " +"would typically appear to work as desired, but could sometimes fail in " +"optimized scopes based on other code (including debuggers and code execution " +"tracing tools) potentially resetting the shared snapshot in that scope. Now, " +"the code will always run against an independent snapshot of the local " +"variables in optimized scopes, and hence the changes will never be visible " +"in subsequent calls to :func:`!locals`. To access the changes made in these " +"cases, an explicit namespace reference must now be passed to the relevant " +"function. Alternatively, it may make sense to update affected code to use a " +"higher level code execution API that returns the resulting code execution " +"namespace (e.g. :func:`runpy.run_path` when executing Python files from " +"disk)." +msgstr "" + +#: ../../whatsnew/3.13.rst:460 +msgid "" +"To ensure debuggers and similar tools can reliably update local variables in " +"scopes affected by this change, :attr:`FrameType.f_locals <frame.f_locals>` " +"now returns a write-through proxy to the frame's local and locally " +"referenced nonlocal variables in these scopes, rather than returning an " +"inconsistently updated shared ``dict`` instance with undefined runtime " +"semantics." +msgstr "" + +#: ../../whatsnew/3.13.rst:466 +msgid "" +"See :pep:`667` for more details, including related C API changes and " +"deprecations. Porting notes are also provided below for the affected :ref:" +"`Python APIs <pep667-porting-notes-py>` and :ref:`C APIs <pep667-porting-" +"notes-c>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:471 +msgid "" +"(PEP and implementation contributed by Mark Shannon and Tian Gao in :gh:" +"`74929`. Documentation updates provided by Guido van Rossum and Alyssa " +"Coghlan.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:479 +msgid "Support for mobile platforms" +msgstr "" + +#: ../../whatsnew/3.13.rst:481 +msgid "" +":pep:`730`: iOS is now a :pep:`11` supported platform, with the ``arm64-" +"apple-ios`` and ``arm64-apple-ios-simulator`` targets at tier 3 (iPhone and " +"iPad devices released after 2013 and the Xcode iOS simulator running on " +"Apple silicon hardware, respectively). ``x86_64-apple-ios-simulator`` (the " +"Xcode iOS simulator running on older ``x86_64`` hardware) is not a tier 3 " +"supported platform, but will have best-effort support. (PEP written and " +"implementation contributed by Russell Keith-Magee in :gh:`114099`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:491 +msgid "" +":pep:`738`: Android is now a :pep:`11` supported platform, with the " +"``aarch64-linux-android`` and ``x86_64-linux-android`` targets at tier 3. " +"The 32-bit targets ``arm-linux-androideabi`` and ``i686-linux-android`` are " +"not tier 3 supported platforms, but will have best-effort support. (PEP " +"written and implementation contributed by Malcolm Smith in :gh:`116622`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:498 +msgid ":pep:`730`, :pep:`738`" +msgstr ":pep:`730`、:pep:`738`" + +#: ../../whatsnew/3.13.rst:502 +msgid "Other Language Changes" +msgstr "其他語言更動" + +#: ../../whatsnew/3.13.rst:504 +msgid "" +"The compiler now strips common leading whitespace from every line in a " +"docstring. This reduces the size of the :term:`bytecode cache <bytecode>` " +"(such as ``.pyc`` files), with reductions in file size of around 5%, for " +"example in :mod:`!sqlalchemy.orm.session` from SQLAlchemy 2.0. This change " +"affects tools that use docstrings, such as :mod:`doctest`." +msgstr "" + +#: ../../whatsnew/3.13.rst:511 +msgid "" +">>> def spam():\n" +"... \"\"\"\n" +"... This is a docstring with\n" +"... leading whitespace.\n" +"...\n" +"... It even has multiple paragraphs!\n" +"... \"\"\"\n" +"...\n" +">>> spam.__doc__\n" +"'\\nThis is a docstring with\\n leading whitespace.\\n\\nIt even has " +"multiple paragraphs!\\n'" +msgstr "" + +#: ../../whatsnew/3.13.rst:524 +msgid "(Contributed by Inada Naoki in :gh:`81283`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:526 +msgid "" +":ref:`Annotation scopes <annotation-scopes>` within class scopes can now " +"contain lambdas and comprehensions. Comprehensions that are located within " +"class scopes are not inlined into their parent scope." +msgstr "" + +#: ../../whatsnew/3.13.rst:531 +msgid "" +"class C[T]:\n" +" type Alias = lambda: T" +msgstr "" +"class C[T]:\n" +" type Alias = lambda: T" + +#: ../../whatsnew/3.13.rst:536 +msgid "(Contributed by Jelle Zijlstra in :gh:`109118` and :gh:`118160`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:538 +msgid "" +":ref:`Future statements <future>` are no longer triggered by relative " +"imports of the :mod:`__future__` module, meaning that statements of the form " +"``from .__future__ import ...`` are now simply standard relative imports, " +"with no special features activated. (Contributed by Jeremiah Gabriel Pascual " +"in :gh:`118216`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:544 +msgid "" +":keyword:`global` declarations are now permitted in :keyword:`except` blocks " +"when that global is used in the :keyword:`else` block. Previously this " +"raised an erroneous :exc:`SyntaxError`. (Contributed by Irit Katriel in :gh:" +"`111123`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:549 +msgid "" +"Add :envvar:`PYTHON_FROZEN_MODULES`, a new environment variable that " +"determines whether frozen modules are ignored by the import machinery, " +"equivalent to the :option:`-X frozen_modules <-X>` command-line option. " +"(Contributed by Yilei Yang in :gh:`111374`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:554 +msgid "" +"Add :ref:`support for the perf profiler <perf_profiling>` working without " +"`frame pointers <https://en.wikipedia.org/wiki/Call_stack>`_ through the new " +"environment variable :envvar:`PYTHON_PERF_JIT_SUPPORT` and command-line " +"option :option:`-X perf_jit <-X>`. (Contributed by Pablo Galindo in :gh:" +"`118518`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:560 +msgid "" +"The location of a :file:`.python_history` file can be changed via the new :" +"envvar:`PYTHON_HISTORY` environment variable. (Contributed by Levi Sabah, " +"Zackery Spytz and Hugo van Kemenade in :gh:`73965`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:565 +msgid "" +"Classes have a new :attr:`~type.__static_attributes__` attribute. This is " +"populated by the compiler with a tuple of the class's attribute names which " +"are assigned through ``self.<name>`` from any function in its body. " +"(Contributed by Irit Katriel in :gh:`115775`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:570 +msgid "" +"The compiler now creates a :attr:`!__firstlineno__` attribute on classes " +"with the line number of the first line of the class definition. (Contributed " +"by Serhiy Storchaka in :gh:`118465`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:574 +msgid "" +"The :func:`exec` and :func:`eval` builtins now accept the *globals* and " +"*locals* arguments as keywords. (Contributed by Raphael Gaschignard in :gh:" +"`105879`)" +msgstr "" + +#: ../../whatsnew/3.13.rst:578 +msgid "" +"The :func:`compile` builtin now accepts a new flag, ``ast." +"PyCF_OPTIMIZED_AST``, which is similar to ``ast.PyCF_ONLY_AST`` except that " +"the returned AST is optimized according to the value of the *optimize* " +"argument. (Contributed by Irit Katriel in :gh:`108113`)." +msgstr "" + +#: ../../whatsnew/3.13.rst:584 +msgid "" +"Add a :attr:`~property.__name__` attribute on :class:`property` objects. " +"(Contributed by Eugene Toder in :gh:`101860`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:587 +msgid "" +"Add :exc:`PythonFinalizationError`, a new exception derived from :exc:" +"`RuntimeError` and used to signal when operations are blocked during :term:" +"`finalization <interpreter shutdown>`. The following callables now raise :" +"exc:`!PythonFinalizationError`, instead of :exc:`RuntimeError`:" +msgstr "" + +#: ../../whatsnew/3.13.rst:593 +msgid ":func:`_thread.start_new_thread`" +msgstr ":func:`_thread.start_new_thread`" + +#: ../../whatsnew/3.13.rst:594 +msgid ":func:`os.fork`" +msgstr ":func:`os.fork`" + +#: ../../whatsnew/3.13.rst:595 +msgid ":func:`os.forkpty`" +msgstr ":func:`os.forkpty`" + +#: ../../whatsnew/3.13.rst:596 +msgid ":class:`subprocess.Popen`" +msgstr ":class:`subprocess.Popen`" + +#: ../../whatsnew/3.13.rst:598 +msgid "(Contributed by Victor Stinner in :gh:`114570`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:600 +msgid "" +"Allow the *count* argument of :meth:`str.replace` to be a keyword. " +"(Contributed by Hugo van Kemenade in :gh:`106487`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:603 +msgid "" +"Many functions now emit a warning if a boolean value is passed as a file " +"descriptor argument. This can help catch some errors earlier. (Contributed " +"by Serhiy Storchaka in :gh:`82626`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:608 +msgid "" +"Added :attr:`!name` and :attr:`!mode` attributes for compressed and archived " +"file-like objects in the :mod:`bz2`, :mod:`lzma`, :mod:`tarfile`, and :mod:" +"`zipfile` modules. (Contributed by Serhiy Storchaka in :gh:`115961`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:615 +msgid "New Modules" +msgstr "新增模組" + +#: ../../whatsnew/3.13.rst:617 +msgid "" +":mod:`dbm.sqlite3`: An SQLite backend for :mod:`dbm`. (Contributed by " +"Raymond Hettinger and Erlend E. Aasland in :gh:`100414`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:622 +msgid "Improved Modules" +msgstr "改進的模組" + +#: ../../whatsnew/3.13.rst:626 +msgid "argparse" +msgstr "argparse" + +#: ../../whatsnew/3.13.rst:628 +msgid "" +"Add the *deprecated* parameter to the :meth:`~argparse.ArgumentParser." +"add_argument` and :meth:`!add_parser` methods, to enable deprecating command-" +"line options, positional arguments, and subcommands. (Contributed by Serhiy " +"Storchaka in :gh:`83648`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:636 +msgid "array" +msgstr "array" + +#: ../../whatsnew/3.13.rst:638 +msgid "" +"Add the ``'w'`` type code (``Py_UCS4``) for Unicode characters. It should be " +"used instead of the deprecated ``'u'`` type code. (Contributed by Inada " +"Naoki in :gh:`80480`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:642 +msgid "" +"Register :class:`array.array` as a :class:`~collections.abc.MutableSequence` " +"by implementing the :meth:`~array.array.clear` method. (Contributed by Mike " +"Zimin in :gh:`114894`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:648 +msgid "ast" +msgstr "ast" + +#: ../../whatsnew/3.13.rst:650 +msgid "" +"The constructors of node types in the :mod:`ast` module are now stricter in " +"the arguments they accept, with more intuitive behavior when arguments are " +"omitted." +msgstr "" + +#: ../../whatsnew/3.13.rst:654 +msgid "" +"If an optional field on an AST node is not included as an argument when " +"constructing an instance, the field will now be set to ``None``. Similarly, " +"if a list field is omitted, that field will now be set to an empty list, and " +"if an :class:`!expr_context` field is omitted, it defaults to :class:`Load() " +"<ast.Load>`. (Previously, in all cases, the attribute would be missing on " +"the newly constructed AST node instance.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:662 +msgid "" +"In all other cases, where a required argument is omitted, the node " +"constructor will emit a :exc:`DeprecationWarning`. This will raise an " +"exception in Python 3.15. Similarly, passing a keyword argument to the " +"constructor that does not map to a field on the AST node is now deprecated, " +"and will raise an exception in Python 3.15." +msgstr "" + +#: ../../whatsnew/3.13.rst:669 +msgid "" +"These changes do not apply to user-defined subclasses of :class:`ast.AST` " +"unless the class opts in to the new behavior by defining the :attr:`.AST." +"_field_types` mapping." +msgstr "" + +#: ../../whatsnew/3.13.rst:673 +msgid "" +"(Contributed by Jelle Zijlstra in :gh:`105858`, :gh:`117486`, and :gh:" +"`118851`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:675 +msgid "" +":func:`ast.parse` now accepts an optional argument *optimize* which is " +"passed on to :func:`compile`. This makes it possible to obtain an optimized " +"AST. (Contributed by Irit Katriel in :gh:`108113`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:682 +msgid "asyncio" +msgstr "asyncio" + +#: ../../whatsnew/3.13.rst:684 +msgid "" +":func:`asyncio.as_completed` now returns an object that is both an :term:" +"`asynchronous iterator` and a plain :term:`iterator` of :term:`awaitables " +"<awaitable>`. The awaitables yielded by asynchronous iteration include " +"original task or future objects that were passed in, making it easier to " +"associate results with the tasks being completed. (Contributed by Justin " +"Arthur in :gh:`77714`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:692 +msgid "" +":meth:`asyncio.loop.create_unix_server` will now automatically remove the " +"Unix socket when the server is closed. (Contributed by Pierre Ossman in :gh:" +"`111246`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:696 +msgid "" +":meth:`.DatagramTransport.sendto` will now send zero-length datagrams if " +"called with an empty bytes object. The transport flow control also now " +"accounts for the datagram header when calculating the buffer size. " +"(Contributed by Jamie Phan in :gh:`115199`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:702 +msgid "" +"Add :meth:`Queue.shutdown <asyncio.Queue.shutdown>` and :exc:`~asyncio." +"QueueShutDown` to manage queue termination. (Contributed by Laurie Opperman " +"and Yves Duprat in :gh:`104228`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:706 +msgid "" +"Add the :meth:`.Server.close_clients` and :meth:`.Server.abort_clients` " +"methods, which more forcefully close an asyncio server. (Contributed by " +"Pierre Ossman in :gh:`113538`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:710 +msgid "" +"Accept a tuple of separators in :meth:`.StreamReader.readuntil`, stopping " +"when any one of them is encountered. (Contributed by Bruce Merry in :gh:" +"`81322`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:714 +msgid "" +"Improve the behavior of :class:`~asyncio.TaskGroup` when an external " +"cancellation collides with an internal cancellation. For example, when two " +"task groups are nested and both experience an exception in a child task " +"simultaneously, it was possible that the outer task group would hang, " +"because its internal cancellation was swallowed by the inner task group." +msgstr "" + +#: ../../whatsnew/3.13.rst:721 +msgid "" +"In the case where a task group is cancelled externally and also must raise " +"an :exc:`ExceptionGroup`, it will now call the parent task's :meth:`~asyncio." +"Task.cancel` method. This ensures that a :exc:`~asyncio.CancelledError` will " +"be raised at the next :keyword:`await`, so the cancellation is not lost." +msgstr "" + +#: ../../whatsnew/3.13.rst:727 +msgid "" +"An added benefit of these changes is that task groups now preserve the " +"cancellation count (:meth:`~asyncio.Task.cancelling`)." +msgstr "" + +#: ../../whatsnew/3.13.rst:730 +msgid "" +"In order to handle some corner cases, :meth:`~asyncio.Task.uncancel` may now " +"reset the undocumented ``_must_cancel`` flag when the cancellation count " +"reaches zero." +msgstr "" + +#: ../../whatsnew/3.13.rst:734 +msgid "(Inspired by an issue reported by Arthur Tacca in :gh:`116720`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:736 +msgid "" +"When :meth:`.TaskGroup.create_task` is called on an inactive :class:" +"`~asyncio.TaskGroup`, the given coroutine will be closed (which prevents a :" +"exc:`RuntimeWarning` about the given coroutine being never awaited). " +"(Contributed by Arthur Tacca and Jason Zhang in :gh:`115957`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:744 +msgid "base64" +msgstr "base64" + +#: ../../whatsnew/3.13.rst:746 +msgid "" +"Add :func:`~base64.z85encode` and :func:`~base64.z85decode` functions for " +"encoding :class:`bytes` as `Z85 data`_ and decoding Z85-encoded data to :" +"class:`!bytes`. (Contributed by Matan Perelman in :gh:`75299`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:755 +msgid "compileall" +msgstr "compileall" + +#: ../../whatsnew/3.13.rst:757 ../../whatsnew/3.13.rst:765 +#: ../../whatsnew/3.13.rst:1013 +msgid "" +"The default number of worker threads and processes is now selected using :" +"func:`os.process_cpu_count` instead of :func:`os.cpu_count`. (Contributed by " +"Victor Stinner in :gh:`109649`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:763 +msgid "concurrent.futures" +msgstr "concurrent.futures" + +#: ../../whatsnew/3.13.rst:771 ../../whatsnew/3.13.rst:1608 +msgid "configparser" +msgstr "configparser" + +#: ../../whatsnew/3.13.rst:773 +msgid "" +":class:`~configparser.ConfigParser` now has support for unnamed sections, " +"which allows for top-level key-value pairs. This can be enabled with the new " +"*allow_unnamed_section* parameter. (Contributed by Pedro Sousa Lacerda in :" +"gh:`66449`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:780 +msgid "copy" +msgstr "copy" + +#: ../../whatsnew/3.13.rst:782 +msgid "" +"The new :func:`~copy.replace` function and the :meth:`replace protocol " +"<object.__replace__>` make creating modified copies of objects much simpler. " +"This is especially useful when working with immutable objects. The following " +"types support the :func:`~copy.replace` function and implement the replace " +"protocol:" +msgstr "" + +#: ../../whatsnew/3.13.rst:788 +msgid ":func:`collections.namedtuple`" +msgstr ":func:`collections.namedtuple`" + +#: ../../whatsnew/3.13.rst:789 +msgid ":class:`dataclasses.dataclass`" +msgstr ":class:`dataclasses.dataclass`" + +#: ../../whatsnew/3.13.rst:790 +msgid "" +":class:`datetime.datetime`, :class:`datetime.date`, :class:`datetime.time`" +msgstr "" +":class:`datetime.datetime`、:class:`datetime.date`、:class:`datetime.time`" + +#: ../../whatsnew/3.13.rst:791 +msgid ":class:`inspect.Signature`, :class:`inspect.Parameter`" +msgstr ":class:`inspect.Signature`、:class:`inspect.Parameter`" + +#: ../../whatsnew/3.13.rst:792 +msgid ":class:`types.SimpleNamespace`" +msgstr ":class:`types.SimpleNamespace`" + +#: ../../whatsnew/3.13.rst:793 +msgid ":ref:`code objects <code-objects>`" +msgstr ":ref:`程式碼物件 <code-objects>`" + +#: ../../whatsnew/3.13.rst:795 +msgid "" +"Any user-defined class can also support :func:`copy.replace` by defining " +"the :meth:`~object.__replace__` method. (Contributed by Serhiy Storchaka in :" +"gh:`108751`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:801 +msgid "ctypes" +msgstr "ctypes" + +#: ../../whatsnew/3.13.rst:803 +msgid "" +"As a consequence of necessary internal refactoring, initialization of " +"internal metaclasses now happens in ``__init__`` rather than in ``__new__``. " +"This affects projects that subclass these internal metaclasses to provide " +"custom initialization. Generally:" +msgstr "" + +#: ../../whatsnew/3.13.rst:809 +msgid "" +"Custom logic that was done in ``__new__`` after calling ``super().__new__`` " +"should be moved to ``__init__``." +msgstr "" + +#: ../../whatsnew/3.13.rst:811 +msgid "" +"To create a class, call the metaclass, not only the metaclass's ``__new__`` " +"method." +msgstr "" + +#: ../../whatsnew/3.13.rst:814 +msgid "" +"See :gh:`124520` for discussion and links to changes in some affected " +"projects." +msgstr "" + +#: ../../whatsnew/3.13.rst:819 +msgid "dbm" +msgstr "dbm" + +#: ../../whatsnew/3.13.rst:821 +msgid "" +"Add :mod:`dbm.sqlite3`, a new module which implements an SQLite backend, and " +"make it the default :mod:`!dbm` backend. (Contributed by Raymond Hettinger " +"and Erlend E. Aasland in :gh:`100414`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:825 +msgid "" +"Allow removing all items from the database through the new :meth:`.gdbm." +"clear` and :meth:`.ndbm.clear` methods. (Contributed by Donghee Na in :gh:" +"`107122`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:831 +msgid "dis" +msgstr "dis" + +#: ../../whatsnew/3.13.rst:833 +msgid "" +"Change the output of :mod:`dis` module functions to show logical labels for " +"jump targets and exception handlers, rather than offsets. The offsets can be " +"added with the new :option:`-O <dis --show-offsets>` command-line option or " +"the *show_offsets* argument. (Contributed by Irit Katriel in :gh:`112137`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:840 +msgid "" +":meth:`~dis.get_instructions` no longer represents cache entries as separate " +"instructions. Instead, it returns them as part of the :class:`~dis." +"Instruction`, in the new *cache_info* field. The *show_caches* argument to :" +"meth:`~dis.get_instructions` is deprecated and no longer has any effect. " +"(Contributed by Irit Katriel in :gh:`112962`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:852 +msgid "doctest" +msgstr "doctest" + +#: ../../whatsnew/3.13.rst:854 +msgid "" +":mod:`doctest` output is now colored by default. This can be controlled via " +"the new :envvar:`PYTHON_COLORS` environment variable as well as the " +"canonical |NO_COLOR|_ and |FORCE_COLOR|_ environment variables. See also :" +"ref:`using-on-controlling-color`. (Contributed by Hugo van Kemenade in :gh:" +"`117225`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:861 +msgid "" +"The :meth:`.DocTestRunner.run` method now counts the number of skipped " +"tests. Add the :attr:`.DocTestRunner.skips` and :attr:`.TestResults.skipped` " +"attributes. (Contributed by Victor Stinner in :gh:`108794`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:867 +msgid "email" +msgstr "email" + +#: ../../whatsnew/3.13.rst:869 +msgid "" +"Headers with embedded newlines are now quoted on output. The :mod:`~email." +"generator` will now refuse to serialize (write) headers that are improperly " +"folded or delimited, such that they would be parsed as multiple headers or " +"joined with adjacent data. If you need to turn this safety feature off, set :" +"attr:`~email.policy.Policy.verify_generated_headers`. (Contributed by Bas " +"Bloemsaat and Petr Viktorin in :gh:`121650`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:877 +msgid "" +":func:`~email.utils.getaddresses` and :func:`~email.utils.parseaddr` now " +"return ``('', '')`` pairs in more situations where invalid email addresses " +"are encountered instead of potentially inaccurate values. The two functions " +"have a new optional *strict* parameter (default ``True``). To get the old " +"behavior (accepting malformed input), use ``strict=False``. ``getattr(email." +"utils, 'supports_strict_parsing', False)`` can be used to check if the " +"*strict* parameter is available. (Contributed by Thomas Dwyer and Victor " +"Stinner for :gh:`102988` to improve the :cve:`2023-27043` fix.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:889 +msgid "fractions" +msgstr "fractions" + +#: ../../whatsnew/3.13.rst:891 +msgid "" +":class:`~fractions.Fraction` objects now support the standard :ref:`format " +"specification mini-language <formatspec>` rules for fill, alignment, sign " +"handling, minimum width, and grouping. (Contributed by Mark Dickinson in :gh:" +"`111320`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:898 +msgid "glob" +msgstr "glob" + +#: ../../whatsnew/3.13.rst:900 +msgid "" +"Add :func:`~glob.translate`, a function to convert a path specification with " +"shell-style wildcards to a regular expression. (Contributed by Barney Gale " +"in :gh:`72904`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:906 +msgid "importlib" +msgstr "importlib" + +#: ../../whatsnew/3.13.rst:908 +msgid "" +"The following functions in :mod:`importlib.resources` now allow accessing a " +"directory (or tree) of resources, using multiple positional arguments (the " +"*encoding* and *errors* arguments in the text-reading functions are now " +"keyword-only):" +msgstr "" + +#: ../../whatsnew/3.13.rst:913 +msgid ":func:`~importlib.resources.is_resource`" +msgstr ":func:`~importlib.resources.is_resource`" + +#: ../../whatsnew/3.13.rst:914 +msgid ":func:`~importlib.resources.open_binary`" +msgstr ":func:`~importlib.resources.open_binary`" + +#: ../../whatsnew/3.13.rst:915 +msgid ":func:`~importlib.resources.open_text`" +msgstr ":func:`~importlib.resources.open_text`" + +#: ../../whatsnew/3.13.rst:916 +msgid ":func:`~importlib.resources.path`" +msgstr ":func:`~importlib.resources.path`" + +#: ../../whatsnew/3.13.rst:917 +msgid ":func:`~importlib.resources.read_binary`" +msgstr ":func:`~importlib.resources.read_binary`" + +#: ../../whatsnew/3.13.rst:918 +msgid ":func:`~importlib.resources.read_text`" +msgstr ":func:`~importlib.resources.read_text`" + +#: ../../whatsnew/3.13.rst:920 +msgid "" +"These functions are no longer deprecated and are not scheduled for removal. " +"(Contributed by Petr Viktorin in :gh:`106532`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:923 +msgid "" +":func:`~importlib.resources.contents` remains deprecated in favor of the " +"fully-featured :class:`~importlib.resources.abc.Traversable` API. However, " +"there is now no plan to remove it. (Contributed by Petr Viktorin in :gh:" +"`106532`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:930 +msgid "io" +msgstr "io" + +#: ../../whatsnew/3.13.rst:932 +msgid "" +"The :class:`~io.IOBase` finalizer now logs any errors raised by the :meth:" +"`~io.IOBase.close` method with :data:`sys.unraisablehook`. Previously, " +"errors were ignored silently by default, and only logged in :ref:`Python " +"Development Mode <devmode>` or when using a :ref:`Python debug build <debug-" +"build>`. (Contributed by Victor Stinner in :gh:`62948`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:941 +msgid "ipaddress" +msgstr "ipaddress" + +#: ../../whatsnew/3.13.rst:943 +msgid "" +"Add the :attr:`.IPv4Address.ipv6_mapped` property, which returns the IPv4-" +"mapped IPv6 address. (Contributed by Charles Machalow in :gh:`109466`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:947 +msgid "" +"Fix ``is_global`` and ``is_private`` behavior in :class:`~ipaddress." +"IPv4Address`, :class:`~ipaddress.IPv6Address`, :class:`~ipaddress." +"IPv4Network`, and :class:`~ipaddress.IPv6Network`. (Contributed by Jakub " +"Stasiak in :gh:`113171`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:954 +msgid "itertools" +msgstr "itertools" + +#: ../../whatsnew/3.13.rst:956 +msgid "" +":func:`~itertools.batched` has a new *strict* parameter, which raises a :exc:" +"`ValueError` if the final batch is shorter than the specified batch size. " +"(Contributed by Raymond Hettinger in :gh:`113202`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:963 +msgid "marshal" +msgstr "marshal" + +#: ../../whatsnew/3.13.rst:965 +msgid "" +"Add the *allow_code* parameter in module functions. Passing " +"``allow_code=False`` prevents serialization and de-serialization of code " +"objects which are incompatible between Python versions. (Contributed by " +"Serhiy Storchaka in :gh:`113626`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:972 +msgid "math" +msgstr "math" + +#: ../../whatsnew/3.13.rst:974 +msgid "" +"The new function :func:`~math.fma` performs fused multiply-add operations. " +"This computes ``x * y + z`` with only a single round, and so avoids any " +"intermediate loss of precision. It wraps the ``fma()`` function provided by " +"C99, and follows the specification of the IEEE 754 \"fusedMultiplyAdd\" " +"operation for special cases. (Contributed by Mark Dickinson and Victor " +"Stinner in :gh:`73468`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:984 +msgid "mimetypes" +msgstr "mimetypes" + +#: ../../whatsnew/3.13.rst:986 +msgid "" +"Add the :func:`~mimetypes.guess_file_type` function to guess a MIME type " +"from a filesystem path. Using paths with :func:`~mimetypes.guess_type` is " +"now :term:`soft deprecated`. (Contributed by Serhiy Storchaka in :gh:" +"`66543`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:993 +msgid "mmap" +msgstr "mmap" + +#: ../../whatsnew/3.13.rst:995 +msgid "" +":class:`~mmap.mmap` is now protected from crashing on Windows when the " +"mapped memory is inaccessible due to file system errors or access " +"violations. (Contributed by Jannis Weigend in :gh:`118209`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:999 +msgid "" +":class:`~mmap.mmap` has a new :meth:`~mmap.mmap.seekable` method that can be " +"used when a seekable file-like object is required. The :meth:`~mmap.mmap." +"seek` method now returns the new absolute position. (Contributed by Donghee " +"Na and Sylvie Liberman in :gh:`111835`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1004 +msgid "" +"The new UNIX-only *trackfd* parameter for :class:`~mmap.mmap` controls file " +"descriptor duplication; if false, the file descriptor specified by *fileno* " +"will not be duplicated. (Contributed by Zackery Spytz and Petr Viktorin in :" +"gh:`78502`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1011 +msgid "multiprocessing" +msgstr "multiprocessing" + +#: ../../whatsnew/3.13.rst:1019 +msgid "os" +msgstr "os" + +#: ../../whatsnew/3.13.rst:1021 +msgid "" +"Add :func:`~os.process_cpu_count` function to get the number of logical CPU " +"cores usable by the calling thread of the current process. (Contributed by " +"Victor Stinner in :gh:`109649`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1025 +msgid "" +":func:`~os.cpu_count` and :func:`~os.process_cpu_count` can be overridden " +"through the new environment variable :envvar:`PYTHON_CPU_COUNT` or the new " +"command-line option :option:`-X cpu_count <-X>`. This option is useful for " +"users who need to limit CPU resources of a container system without having " +"to modify application code or the container itself. (Contributed by Donghee " +"Na in :gh:`109595`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1033 +msgid "" +"Add a :ref:`low level interface <os-timerfd>` to Linux's :manpage:`timer " +"file descriptors <timerfd_create(2)>` via :func:`~os.timerfd_create`, :func:" +"`~os.timerfd_settime`, :func:`~os.timerfd_settime_ns`, :func:`~os." +"timerfd_gettime`, :func:`~os.timerfd_gettime_ns`, :const:`~os." +"TFD_NONBLOCK`, :const:`~os.TFD_CLOEXEC`, :const:`~os.TFD_TIMER_ABSTIME`, " +"and :const:`~os.TFD_TIMER_CANCEL_ON_SET` (Contributed by Masaru Tsuchiyama " +"in :gh:`108277`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1042 +msgid "" +":func:`~os.lchmod` and the *follow_symlinks* argument of :func:`~os.chmod` " +"are both now available on Windows. Note that the default value of " +"*follow_symlinks* in :func:`!lchmod` is ``False`` on Windows. (Contributed " +"by Serhiy Storchaka in :gh:`59616`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1048 +msgid "" +":func:`~os.fchmod` and support for file descriptors in :func:`~os.chmod` are " +"both now available on Windows. (Contributed by Serhiy Storchaka in :gh:" +"`113191`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1052 +msgid "" +"On Windows, :func:`~os.mkdir` and :func:`~os.makedirs` now support passing a " +"*mode* value of ``0o700`` to apply access control to the new directory. This " +"implicitly affects :func:`tempfile.mkdtemp` and is a mitigation for :cve:" +"`2024-4030`. Other values for *mode* continue to be ignored. (Contributed by " +"Steve Dower in :gh:`118486`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1059 +msgid "" +":func:`~os.posix_spawn` now accepts ``None`` for the *env* argument, which " +"makes the newly spawned process use the current process environment. " +"(Contributed by Jakub Kulik in :gh:`113119`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1063 +msgid "" +":func:`~os.posix_spawn` can now use the :attr:`~os.POSIX_SPAWN_CLOSEFROM` " +"attribute in the *file_actions* parameter on platforms that support :c:func:" +"`!posix_spawn_file_actions_addclosefrom_np`. (Contributed by Jakub Kulik in :" +"gh:`113117`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1070 +msgid "os.path" +msgstr "os.path" + +#: ../../whatsnew/3.13.rst:1072 +msgid "" +"Add :func:`~os.path.isreserved` to check if a path is reserved on the " +"current system. This function is only available on Windows. (Contributed by " +"Barney Gale in :gh:`88569`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1077 +msgid "" +"On Windows, :func:`~os.path.isabs` no longer considers paths starting with " +"exactly one slash (``\\`` or ``/``) to be absolute. (Contributed by Barney " +"Gale and Jon Foster in :gh:`44626`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1081 +msgid "" +":func:`~os.path.realpath` now resolves MS-DOS style file names even if the " +"file is not accessible. (Contributed by Moonsik Park in :gh:`82367`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1087 ../../whatsnew/3.13.rst:1648 +msgid "pathlib" +msgstr "pathlib" + +#: ../../whatsnew/3.13.rst:1089 +msgid "" +"Add :exc:`~pathlib.UnsupportedOperation`, which is raised instead of :exc:" +"`NotImplementedError` when a path operation isn't supported. (Contributed by " +"Barney Gale in :gh:`89812`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1093 +msgid "" +"Add a new constructor for creating :class:`~pathlib.Path` objects from " +"'file' URIs (``file:///``), :meth:`.Path.from_uri`. (Contributed by Barney " +"Gale in :gh:`107465`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1097 +msgid "" +"Add :meth:`.PurePath.full_match` for matching paths with shell-style " +"wildcards, including the recursive wildcard \"``**``\". (Contributed by " +"Barney Gale in :gh:`73435`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1101 +msgid "" +"Add the :attr:`.PurePath.parser` class attribute to store the implementation " +"of :mod:`os.path` used for low-level path parsing and joining. This will be " +"either :mod:`!posixpath` or :mod:`!ntpath`." +msgstr "" + +#: ../../whatsnew/3.13.rst:1106 +msgid "" +"Add *recurse_symlinks* keyword-only argument to :meth:`.Path.glob` and :meth:" +"`~pathlib.Path.rglob`. (Contributed by Barney Gale in :gh:`77609`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1110 +msgid "" +":meth:`.Path.glob` and :meth:`~pathlib.Path.rglob` now return files and " +"directories when given a pattern that ends with \"``**``\". Previously, only " +"directories were returned. (Contributed by Barney Gale in :gh:`70303`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1115 +msgid "" +"Add the *follow_symlinks* keyword-only argument to :meth:`Path.is_file " +"<pathlib.Path.is_file>`, :meth:`Path.is_dir <pathlib.Path.is_dir>`, :meth:`." +"Path.owner`, and :meth:`.Path.group`. (Contributed by Barney Gale in :gh:" +"`105793` and Kamil Turek in :gh:`107962`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1123 +msgid "pdb" +msgstr "pdb" + +#: ../../whatsnew/3.13.rst:1125 +msgid "" +":func:`breakpoint` and :func:`~pdb.set_trace` now enter the debugger " +"immediately rather than on the next line of code to be executed. This change " +"prevents the debugger from breaking outside of the context when :func:`!" +"breakpoint` is positioned at the end of the context. (Contributed by Tian " +"Gao in :gh:`118579`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1131 +msgid "" +"``sys.path[0]`` is no longer replaced by the directory of the script being " +"debugged when :attr:`sys.flags.safe_path` is set. (Contributed by Tian Gao " +"and Christian Walther in :gh:`111762`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1135 +msgid "" +":mod:`zipapp` is now supported as a debugging target. (Contributed by Tian " +"Gao in :gh:`118501`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1138 +msgid "" +"Add ability to move between chained exceptions during post-mortem debugging " +"in :func:`~pdb.pm` using the new :pdbcmd:`exceptions [exc_number] " +"<exceptions>` command for Pdb. (Contributed by Matthias Bussonnier in :gh:" +"`106676`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1143 +msgid "" +"Expressions and statements whose prefix is a pdb command are now correctly " +"identified and executed. (Contributed by Tian Gao in :gh:`108464`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1149 +msgid "queue" +msgstr "queue" + +#: ../../whatsnew/3.13.rst:1151 +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:1157 +msgid "random" +msgstr "random" + +#: ../../whatsnew/3.13.rst:1159 +msgid "" +"Add a :ref:`command-line interface <random-cli>`. (Contributed by Hugo van " +"Kemenade in :gh:`118131`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1164 ../../whatsnew/3.13.rst:1656 +msgid "re" +msgstr "re" + +#: ../../whatsnew/3.13.rst:1166 +msgid "" +"Rename :exc:`!re.error` to :exc:`~re.PatternError` for improved clarity. :" +"exc:`!re.error` is kept for backward compatibility." +msgstr "" + +#: ../../whatsnew/3.13.rst:1171 +msgid "shutil" +msgstr "shutil" + +#: ../../whatsnew/3.13.rst:1173 +msgid "" +"Support the *dir_fd* and *follow_symlinks* keyword arguments in :func:" +"`~shutil.chown`. (Contributed by Berker Peksag and Tahia K in :gh:`62308`)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1179 +msgid "site" +msgstr "site" + +#: ../../whatsnew/3.13.rst:1181 +msgid "" +":file:`.pth` files are now decoded using UTF-8 first, and then with the :" +"term:`locale encoding` if UTF-8 decoding fails. (Contributed by Inada Naoki " +"in :gh:`117802`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1187 +msgid "sqlite3" +msgstr "sqlite3" + +#: ../../whatsnew/3.13.rst:1189 +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:1193 +msgid "" +"Add the *filter* keyword-only parameter to :meth:`.Connection.iterdump` for " +"filtering database objects to dump. (Contributed by Mariusz Felisiak in :gh:" +"`91602`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1199 +msgid "ssl" +msgstr "ssl" + +#: ../../whatsnew/3.13.rst:1201 +msgid "" +"The :func:`~ssl.create_default_context` API now includes :data:`~ssl." +"VERIFY_X509_PARTIAL_CHAIN` and :data:`~ssl.VERIFY_X509_STRICT` in its " +"default flags." +msgstr "" + +#: ../../whatsnew/3.13.rst:1207 +msgid "" +":data:`~ssl.VERIFY_X509_STRICT` may reject pre-:rfc:`5280` or malformed " +"certificates that the underlying OpenSSL implementation might otherwise " +"accept. Whilst disabling this is not recommended, you can do so using:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1212 +msgid "" +"import ssl\n" +"\n" +"ctx = ssl.create_default_context()\n" +"ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" +msgstr "" +"import ssl\n" +"\n" +"ctx = ssl.create_default_context()\n" +"ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT" + +#: ../../whatsnew/3.13.rst:1219 +msgid "(Contributed by William Woodruff in :gh:`112389`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1223 +msgid "statistics" +msgstr "statistics" + +#: ../../whatsnew/3.13.rst:1225 +msgid "" +"Add :func:`~statistics.kde` for kernel density estimation. This makes it " +"possible to estimate a continuous probability density function from a fixed " +"number of discrete samples. (Contributed by Raymond Hettinger in :gh:" +"`115863`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1230 +msgid "" +"Add :func:`~statistics.kde_random` for sampling from an estimated " +"probability density function created by :func:`~statistics.kde`. " +"(Contributed by Raymond Hettinger in :gh:`115863`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1238 +msgid "subprocess" +msgstr "subprocess" + +#: ../../whatsnew/3.13.rst:1240 +msgid "" +"The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " +"in more situations." +msgstr "" + +#: ../../whatsnew/3.13.rst:1243 +msgid "" +"Notably, when *close_fds* is ``True`` (the default), :func:`~os.posix_spawn` " +"will be used when the C library provides :c:func:`!" +"posix_spawn_file_actions_addclosefrom_np`, which includes recent versions of " +"Linux, FreeBSD, and Solaris. On Linux, this should perform similarly to the " +"existing Linux :c:func:`!vfork` based code." +msgstr "" + +#: ../../whatsnew/3.13.rst:1250 +msgid "" +"A private control knob :attr:`!subprocess._USE_POSIX_SPAWN` can be set to " +"``False`` if you need to force :mod:`subprocess` to never use :func:`~os." +"posix_spawn`. Please report your reason and platform details in the :ref:" +"`issue tracker <using-the-tracker>` if you set this so that we can improve " +"our API selection logic for everyone. (Contributed by Jakub Kulik in :gh:" +"`113117`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1260 +msgid "sys" +msgstr "sys" + +#: ../../whatsnew/3.13.rst:1262 +msgid "" +"Add the :func:`~sys._is_interned` function to test if a string was interned. " +"This function is not guaranteed to exist in all implementations of Python. " +"(Contributed by Serhiy Storchaka in :gh:`78573`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1268 +msgid "tempfile" +msgstr "tempfile" + +#: ../../whatsnew/3.13.rst:1270 +msgid "" +"On Windows, the default mode ``0o700`` used by :func:`tempfile.mkdtemp` now " +"limits access to the new directory due to changes to :func:`os.mkdir`. This " +"is a mitigation for :cve:`2024-4030`. (Contributed by Steve Dower in :gh:" +"`118486`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1277 +msgid "time" +msgstr "time" + +#: ../../whatsnew/3.13.rst:1279 +msgid "" +"On Windows, :func:`~time.monotonic` now uses the " +"``QueryPerformanceCounter()`` clock for a resolution of 1 microsecond, " +"instead of the ``GetTickCount64()`` clock which has a resolution of 15.6 " +"milliseconds. (Contributed by Victor Stinner in :gh:`88494`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1285 +msgid "" +"On Windows, :func:`~time.time` now uses the " +"``GetSystemTimePreciseAsFileTime()`` clock for a resolution of 1 " +"microsecond, instead of the ``GetSystemTimeAsFileTime()`` clock which has a " +"resolution of 15.6 milliseconds. (Contributed by Victor Stinner in :gh:" +"`63207`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1293 +msgid "tkinter" +msgstr "tkinter" + +#: ../../whatsnew/3.13.rst:1295 +msgid "" +"Add :mod:`tkinter` widget methods: :meth:`!tk_busy_hold`, :meth:`!" +"tk_busy_configure`, :meth:`!tk_busy_cget`, :meth:`!tk_busy_forget`, :meth:`!" +"tk_busy_current`, and :meth:`!tk_busy_status`. (Contributed by Miguel, " +"klappnase and Serhiy Storchaka in :gh:`72684`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1301 +msgid "" +"The :mod:`tkinter` widget method :meth:`!wm_attributes` now accepts the " +"attribute name without the minus prefix to get window attributes, for " +"example ``w.wm_attributes('alpha')`` and allows specifying attributes and " +"values to set as keyword arguments, for example ``w." +"wm_attributes(alpha=0.5)``. (Contributed by Serhiy Storchaka in :gh:`43457`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1308 +msgid "" +":meth:`!wm_attributes` can now return attributes as a :class:`dict`, by " +"using the new optional keyword-only parameter *return_python_dict*. " +"(Contributed by Serhiy Storchaka in :gh:`43457`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1312 +msgid "" +":meth:`!Text.count` can now return a simple :class:`int` when the new " +"optional keyword-only parameter *return_ints* is used. Otherwise, the single " +"count is returned as a 1-tuple or ``None``. (Contributed by Serhiy Storchaka " +"in :gh:`97928`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1317 +msgid "" +"Support the \"vsapi\" element type in the :meth:`~tkinter.ttk.Style." +"element_create` method of :class:`tkinter.ttk.Style`. (Contributed by Serhiy " +"Storchaka in :gh:`68166`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1322 +msgid "" +"Add the :meth:`!after_info` method for Tkinter widgets. (Contributed by " +"Cheryl Sabella in :gh:`77020`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1325 +msgid "" +"Add a new :meth:`!copy_replace` method to :class:`!PhotoImage` to copy a " +"region from one image to another, possibly with pixel zooming, subsampling, " +"or both. (Contributed by Serhiy Storchaka in :gh:`118225`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1330 +msgid "" +"Add *from_coords* parameter to the :class:`!PhotoImage` methods :meth:`!" +"copy`, :meth:`!zoom` and :meth:`!subsample`. Add *zoom* and *subsample* " +"parameters to the :class:`!PhotoImage` method :meth:`!copy`. (Contributed by " +"Serhiy Storchaka in :gh:`118225`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1336 +msgid "" +"Add the :class:`!PhotoImage` methods :meth:`!read` to read an image from a " +"file and :meth:`!data` to get the image data. Add *background* and " +"*grayscale* parameters to the :meth:`!write` method. (Contributed by Serhiy " +"Storchaka in :gh:`118271`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1344 +msgid "traceback" +msgstr "traceback" + +#: ../../whatsnew/3.13.rst:1346 +msgid "" +"Add the :attr:`~traceback.TracebackException.exc_type_str` attribute to :" +"class:`~traceback.TracebackException`, which holds a string display of the " +"*exc_type*. Deprecate the :attr:`~traceback.TracebackException.exc_type` " +"attribute, which holds the type object itself. Add parameter *save_exc_type* " +"(default ``True``) to indicate whether ``exc_type`` should be saved. " +"(Contributed by Irit Katriel in :gh:`112332`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1355 +msgid "" +"Add a new *show_group* keyword-only parameter to :meth:`.TracebackException." +"format_exception_only` to (recursively) format the nested exceptions of a :" +"exc:`BaseExceptionGroup` instance. (Contributed by Irit Katriel in :gh:" +"`105292`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1362 +msgid "types" +msgstr "types" + +#: ../../whatsnew/3.13.rst:1364 +msgid "" +":class:`~types.SimpleNamespace` can now take a single positional argument to " +"initialise the namespace's arguments. This argument must either be a mapping " +"or an iterable of key-value pairs. (Contributed by Serhiy Storchaka in :gh:" +"`108191`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1371 ../../whatsnew/3.13.rst:1681 +msgid "typing" +msgstr "typing" + +#: ../../whatsnew/3.13.rst:1373 +msgid "" +":pep:`705`: Add :data:`~typing.ReadOnly`, a special typing construct to mark " +"a :class:`~typing.TypedDict` item as read-only for type checkers." +msgstr "" + +#: ../../whatsnew/3.13.rst:1376 +msgid "" +":pep:`742`: Add :data:`~typing.TypeIs`, a typing construct that can be used " +"to instruct a type checker how to narrow a type." +msgstr "" + +#: ../../whatsnew/3.13.rst:1379 +msgid "" +"Add :data:`~typing.NoDefault`, a sentinel object used to represent the " +"defaults of some parameters in the :mod:`typing` module. (Contributed by " +"Jelle Zijlstra in :gh:`116126`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1383 +msgid "" +"Add :func:`~typing.get_protocol_members` to return the set of members " +"defining a :class:`typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:" +"`104873`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1387 +msgid "" +"Add :func:`~typing.is_protocol` to check whether a class is a :class:" +"`~typing.Protocol`. (Contributed by Jelle Zijlstra in :gh:`104873`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1391 +msgid "" +":data:`~typing.ClassVar` can now be nested in :data:`~typing.Final`, and " +"vice versa. (Contributed by Mehdi Drissi in :gh:`89547`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1397 +msgid "unicodedata" +msgstr "unicodedata" + +#: ../../whatsnew/3.13.rst:1399 +msgid "" +"Update the Unicode database to `version 15.1.0`__. (Contributed by James " +"Gerity in :gh:`109559`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1406 +msgid "venv" +msgstr "venv" + +#: ../../whatsnew/3.13.rst:1408 +msgid "" +"Add support for creating source control management (SCM) ignore files in a " +"virtual environment's directory. By default, Git is supported. This is " +"implemented as opt-in via the API, which can be extended to support other " +"SCMs (:class:`~venv.EnvBuilder` and :func:`~venv.create`), and opt-out via " +"the CLI, using :option:`!--without-scm-ignore-files`. (Contributed by Brett " +"Cannon in :gh:`108125`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1419 +msgid "warnings" +msgstr "warnings" + +#: ../../whatsnew/3.13.rst:1421 +msgid "" +":pep:`702`: The new :func:`warnings.deprecated` decorator provides a way to " +"communicate deprecations to a :term:`static type checker` and to warn on " +"usage of deprecated classes and functions. A :exc:`DeprecationWarning` may " +"also be emitted when a decorated function or class is used at runtime. " +"(Contributed by Jelle Zijlstra in :gh:`104003`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1430 +msgid "xml" +msgstr "xml" + +#: ../../whatsnew/3.13.rst:1432 +msgid "" +"Allow controlling Expat >=2.6.0 reparse deferral (:cve:`2023-52425`) by " +"adding five new methods:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1435 +msgid ":meth:`xml.etree.ElementTree.XMLParser.flush`" +msgstr ":meth:`xml.etree.ElementTree.XMLParser.flush`" + +#: ../../whatsnew/3.13.rst:1436 +msgid ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" +msgstr ":meth:`xml.etree.ElementTree.XMLPullParser.flush`" + +#: ../../whatsnew/3.13.rst:1437 +msgid ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" +msgstr ":meth:`xml.parsers.expat.xmlparser.GetReparseDeferralEnabled`" + +#: ../../whatsnew/3.13.rst:1438 +msgid ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" +msgstr ":meth:`xml.parsers.expat.xmlparser.SetReparseDeferralEnabled`" + +#: ../../whatsnew/3.13.rst:1439 +msgid ":meth:`!xml.sax.expatreader.ExpatParser.flush`" +msgstr ":meth:`!xml.sax.expatreader.ExpatParser.flush`" + +#: ../../whatsnew/3.13.rst:1441 +msgid "(Contributed by Sebastian Pipping in :gh:`115623`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1443 +msgid "" +"Add the :meth:`!close` method for the iterator returned by :func:`~xml.etree." +"ElementTree.iterparse` for explicit cleanup. (Contributed by Serhiy " +"Storchaka in :gh:`69893`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1449 +msgid "zipimport" +msgstr "zipimport" + +#: ../../whatsnew/3.13.rst:1451 +msgid "" +"Add support for ZIP64_ format files. Everybody loves huge data, right? " +"(Contributed by Tim Hatch in :gh:`94146`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1459 +msgid "Optimizations" +msgstr "最佳化" + +#: ../../whatsnew/3.13.rst:1461 +msgid "" +"Several standard library modules have had their import times significantly " +"improved. For example, the import time of the :mod:`typing` module has been " +"reduced by around a third by removing dependencies on :mod:`re` and :mod:" +"`contextlib`. Other modules to enjoy import-time speedups include :mod:" +"`email.utils`, :mod:`enum`, :mod:`functools`, :mod:`importlib.metadata`, " +"and :mod:`threading`. (Contributed by Alex Waygood, Shantanu Jain, Adam " +"Turner, Daniel Hollas, and others in :gh:`109653`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1472 +msgid "" +":func:`textwrap.indent` is now around 30% faster than before for large " +"input. (Contributed by Inada Naoki in :gh:`107369`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1475 +msgid "" +"The :mod:`subprocess` module now uses the :func:`~os.posix_spawn` function " +"in more situations, including when *close_fds* is ``True`` (the default) on " +"many modern platforms. This should provide a notable performance increase " +"when launching processes on FreeBSD and Solaris. See the :ref:`subprocess " +"<whatsnew313-subprocess>` section above for details. (Contributed by Jakub " +"Kulik in :gh:`113117`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1485 +msgid "Removed Modules And APIs" +msgstr "" + +#: ../../whatsnew/3.13.rst:1491 +msgid "PEP 594: Remove \"dead batteries\" from the standard library" +msgstr "" + +#: ../../whatsnew/3.13.rst:1493 +msgid "" +":pep:`594` proposed removing 19 modules from the standard library, " +"colloquially referred to as 'dead batteries' due to their historic, " +"obsolete, or insecure status. All of the following modules were deprecated " +"in Python 3.11, and are now removed:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1499 +msgid ":mod:`!aifc`" +msgstr ":mod:`!aifc`" + +#: ../../whatsnew/3.13.rst:1500 +msgid ":mod:`!audioop`" +msgstr ":mod:`!audioop`" + +#: ../../whatsnew/3.13.rst:1501 +msgid ":mod:`!chunk`" +msgstr ":mod:`!chunk`" + +#: ../../whatsnew/3.13.rst:1502 +msgid ":mod:`!cgi` and :mod:`!cgitb`" +msgstr ":mod:`!cgi` 和 :mod:`!cgitb`" + +#: ../../whatsnew/3.13.rst:1504 +msgid "" +":class:`!cgi.FieldStorage` can typically be replaced with :func:`urllib." +"parse.parse_qsl` for ``GET`` and ``HEAD`` requests, and the :mod:`email." +"message` module or the :pypi:`multipart` library for ``POST`` and ``PUT`` " +"requests." +msgstr "" + +#: ../../whatsnew/3.13.rst:1509 +msgid "" +":func:`!cgi.parse` can be replaced by calling :func:`urllib.parse.parse_qs` " +"directly on the desired query string, unless the input is ``multipart/form-" +"data``, which should be replaced as described below for :func:`!cgi." +"parse_multipart`." +msgstr "" + +#: ../../whatsnew/3.13.rst:1514 +msgid "" +":func:`!cgi.parse_header` can be replaced with the functionality in the :mod:" +"`email` package, which implements the same MIME RFCs. For example, with :" +"class:`email.message.EmailMessage`:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1518 +msgid "" +"from email.message import EmailMessage\n" +"\n" +"msg = EmailMessage()\n" +"msg['content-type'] = 'application/json; charset=\"utf8\"'\n" +"main, params = msg.get_content_type(), msg['content-type'].params" +msgstr "" + +#: ../../whatsnew/3.13.rst:1526 +msgid "" +":func:`!cgi.parse_multipart` can be replaced with the functionality in the :" +"mod:`email` package, which implements the same MIME RFCs, or with the :pypi:" +"`multipart` library. For example, the :class:`email.message.EmailMessage` " +"and :class:`email.message.Message` classes." +msgstr "" + +#: ../../whatsnew/3.13.rst:1532 +msgid "" +":mod:`!crypt` and the private :mod:`!_crypt` extension. The :mod:`hashlib` " +"module may be an appropriate replacement when simply hashing a value is " +"required. Otherwise, various third-party libraries on PyPI are available:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1537 +msgid "" +":pypi:`bcrypt`: Modern password hashing for your software and your servers." +msgstr "" + +#: ../../whatsnew/3.13.rst:1539 +msgid "" +":pypi:`passlib`: Comprehensive password hashing framework supporting over 30 " +"schemes." +msgstr "" + +#: ../../whatsnew/3.13.rst:1541 +msgid ":pypi:`argon2-cffi`: The secure Argon2 password hashing algorithm." +msgstr "" + +#: ../../whatsnew/3.13.rst:1543 +msgid "" +":pypi:`legacycrypt`: :mod:`ctypes` wrapper to the POSIX crypt library call " +"and associated functionality." +msgstr "" + +#: ../../whatsnew/3.13.rst:1546 +msgid "" +":pypi:`crypt_r`: Fork of the :mod:`!crypt` module, wrapper to the :manpage:" +"`crypt_r(3)` library call and associated functionality." +msgstr "" + +#: ../../whatsnew/3.13.rst:1551 +msgid "" +":mod:`!imghdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" +"magic` libraries should be used as replacements. For example, the :func:`!" +"puremagic.what` function can be used to replace the :func:`!imghdr.what` " +"function for all file formats that were supported by :mod:`!imghdr`." +msgstr "" + +#: ../../whatsnew/3.13.rst:1557 +msgid ":mod:`!mailcap`: Use the :mod:`mimetypes` module instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:1559 +msgid ":mod:`!msilib`" +msgstr ":mod:`!msilib`" + +#: ../../whatsnew/3.13.rst:1560 +msgid ":mod:`!nis`" +msgstr ":mod:`!nis`" + +#: ../../whatsnew/3.13.rst:1561 +msgid ":mod:`!nntplib`: Use the :pypi:`pynntp` library from PyPI instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:1563 +msgid "" +":mod:`!ossaudiodev`: For audio playback, use the :pypi:`pygame` library from " +"PyPI instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:1565 +msgid ":mod:`!pipes`: Use the :mod:`subprocess` module instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:1567 +msgid "" +":mod:`!sndhdr`: The :pypi:`filetype`, :pypi:`puremagic`, or :pypi:`python-" +"magic` libraries should be used as replacements." +msgstr "" + +#: ../../whatsnew/3.13.rst:1570 +msgid ":mod:`!spwd`: Use the :pypi:`python-pam` library from PyPI instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:1572 +msgid ":mod:`!sunau`" +msgstr ":mod:`!sunau`" + +#: ../../whatsnew/3.13.rst:1573 +msgid "" +":mod:`!telnetlib`, Use the :pypi:`telnetlib3` or :pypi:`Exscript` libraries " +"from PyPI instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:1575 +msgid "" +":mod:`!uu`: Use the :mod:`base64` module instead, as a modern alternative." +msgstr "" + +#: ../../whatsnew/3.13.rst:1577 +msgid ":mod:`!xdrlib`" +msgstr ":mod:`!xdrlib`" + +#: ../../whatsnew/3.13.rst:1579 +msgid "" +"(Contributed by Victor Stinner and Zachary Ware in :gh:`104773` and :gh:" +"`104780`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1583 +msgid "2to3" +msgstr "2to3" + +#: ../../whatsnew/3.13.rst:1585 +msgid "" +"Remove the :program:`2to3` program and the :mod:`!lib2to3` module, " +"previously deprecated in Python 3.11. (Contributed by Victor Stinner in :gh:" +"`104780`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1591 +msgid "builtins" +msgstr "builtins" + +#: ../../whatsnew/3.13.rst:1593 +msgid "" +"Remove support for chained :class:`classmethod` descriptors (introduced in :" +"gh:`63272`). These can no longer be used to wrap other descriptors, such as :" +"class:`property`. The core design of this feature was flawed and led to " +"several problems. To \"pass-through\" a :class:`classmethod`, consider using " +"the :attr:`!__wrapped__` attribute that was added in Python 3.10. " +"(Contributed by Raymond Hettinger in :gh:`89519`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1602 +msgid "" +"Raise a :exc:`RuntimeError` when calling :meth:`frame.clear` on a suspended " +"frame (as has always been the case for an executing frame). (Contributed by " +"Irit Katriel in :gh:`79932`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1610 +msgid "" +"Remove the undocumented :class:`!LegacyInterpolation` class, deprecated in " +"the docstring since Python 3.2, and at runtime since Python 3.11. " +"(Contributed by Hugo van Kemenade in :gh:`104886`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1617 +msgid "importlib.metadata" +msgstr "importlib.metadata" + +#: ../../whatsnew/3.13.rst:1619 +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:1625 +msgid "locale" +msgstr "locale" + +#: ../../whatsnew/3.13.rst:1627 +msgid "" +"Remove the :func:`!locale.resetlocale` function, deprecated in Python 3.11. " +"Use ``locale.setlocale(locale.LC_ALL, \"\")`` instead. (Contributed by " +"Victor Stinner in :gh:`104783`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1633 +msgid "opcode" +msgstr "opcode" + +#: ../../whatsnew/3.13.rst:1635 +msgid "" +"Move :attr:`!opcode.ENABLE_SPECIALIZATION` to :attr:`!_opcode." +"ENABLE_SPECIALIZATION`. This field was added in 3.12, it was never " +"documented, and is not intended for external use. (Contributed by Irit " +"Katriel in :gh:`105481`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1640 +msgid "" +"Remove :func:`!opcode.is_pseudo`, :attr:`!opcode.MIN_PSEUDO_OPCODE`, and :" +"attr:`!opcode.MAX_PSEUDO_OPCODE`, which were added in Python 3.12, but were " +"neither documented nor exposed through :mod:`dis`, and were not intended to " +"be used externally. (Contributed by Irit Katriel in :gh:`105481`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1650 +msgid "" +"Remove the ability to use :class:`~pathlib.Path` objects as context " +"managers. This functionality was deprecated and has had no effect since " +"Python 3.9. (Contributed by Barney Gale in :gh:`83863`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1658 +msgid "" +"Remove the undocumented, deprecated, and broken :func:`!re.template` " +"function and :attr:`!re.TEMPLATE` / :attr:`!re.T` flag. (Contributed by " +"Serhiy Storchaka and Nikita Sobolev in :gh:`105687`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1664 +msgid "tkinter.tix" +msgstr "tkinter.tix" + +#: ../../whatsnew/3.13.rst:1666 +msgid "" +"Remove the :mod:`!tkinter.tix` module, deprecated in Python 3.6. The third-" +"party Tix library which the module wrapped is unmaintained. (Contributed by " +"Zachary Ware in :gh:`75552`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1672 +msgid "turtle" +msgstr "turtle" + +#: ../../whatsnew/3.13.rst:1674 +msgid "" +"Remove the :meth:`!RawTurtle.settiltangle` method, deprecated in the " +"documentation since Python 3.1 and at runtime since Python 3.11. " +"(Contributed by Hugo van Kemenade in :gh:`104876`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1683 +msgid "" +"Remove the :mod:`!typing.io` and :mod:`!typing.re` namespaces, deprecated " +"since Python 3.8. The items in those namespaces can be imported directly " +"from the :mod:`typing` module. (Contributed by Sebastian Rittau in :gh:" +"`92871`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1689 +msgid "" +"Remove the keyword-argument method of creating :class:`~typing.TypedDict` " +"types, deprecated in Python 3.11. (Contributed by Tomas Roun in :gh:" +"`104786`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1695 +msgid "unittest" +msgstr "unittest" + +#: ../../whatsnew/3.13.rst:1697 +msgid "" +"Remove the following :mod:`unittest` functions, deprecated in Python 3.11:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1699 +msgid ":func:`!unittest.findTestCases`" +msgstr ":func:`!unittest.findTestCases`" + +#: ../../whatsnew/3.13.rst:1700 +msgid ":func:`!unittest.makeSuite`" +msgstr ":func:`!unittest.makeSuite`" + +#: ../../whatsnew/3.13.rst:1701 +msgid ":func:`!unittest.getTestCaseNames`" +msgstr ":func:`!unittest.getTestCaseNames`" + +#: ../../whatsnew/3.13.rst:1703 +msgid "Use :class:`~unittest.TestLoader` methods instead:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1705 +msgid ":meth:`~unittest.TestLoader.loadTestsFromModule`" +msgstr ":meth:`~unittest.TestLoader.loadTestsFromModule`" + +#: ../../whatsnew/3.13.rst:1706 +msgid ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" +msgstr ":meth:`~unittest.TestLoader.loadTestsFromTestCase`" + +#: ../../whatsnew/3.13.rst:1707 +msgid ":meth:`~unittest.TestLoader.getTestCaseNames`" +msgstr ":meth:`~unittest.TestLoader.getTestCaseNames`" + +#: ../../whatsnew/3.13.rst:1709 +msgid "(Contributed by Hugo van Kemenade in :gh:`104835`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1711 +msgid "" +"Remove the untested and undocumented :meth:`!TestProgram.usageExit` method, " +"deprecated in Python 3.11. (Contributed by Hugo van Kemenade in :gh:" +"`104992`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1717 +msgid "urllib" +msgstr "urllib" + +#: ../../whatsnew/3.13.rst:1719 +msgid "" +"Remove the *cafile*, *capath*, and *cadefault* parameters of the :func:" +"`urllib.request.urlopen` function, deprecated in Python 3.6. Use the " +"*context* parameter instead with an :class:`~ssl.SSLContext` instance. The :" +"meth:`ssl.SSLContext.load_cert_chain` function can be used to load specific " +"certificates, or let :func:`ssl.create_default_context` select the operating " +"system's trusted certificate authority (CA) certificates. (Contributed by " +"Victor Stinner in :gh:`105382`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1730 +msgid "webbrowser" +msgstr "webbrowser" + +#: ../../whatsnew/3.13.rst:1732 +msgid "" +"Remove the untested and undocumented :class:`!MacOSX` class, deprecated in " +"Python 3.11. Use the :class:`!MacOSXOSAScript` class (introduced in Python " +"3.2) instead. (Contributed by Hugo van Kemenade in :gh:`104804`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1737 +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:1744 +msgid "New Deprecations" +msgstr "" + +#: ../../whatsnew/3.13.rst:1746 +msgid ":ref:`User-defined functions <user-defined-funcs>`:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1748 +msgid "" +"Deprecate assignment to a function's :attr:`~function.__code__` attribute, " +"where the new code object's type does not match the function's type. The " +"different types are: plain function, generator, async generator, and " +"coroutine. (Contributed by Irit Katriel in :gh:`81137`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1754 +#: ../../deprecations/pending-removal-in-3.16.rst:13 +msgid ":mod:`array`:" +msgstr ":mod:`array`:" + +#: ../../whatsnew/3.13.rst:1756 +msgid "" +"Deprecate the ``'u'`` format code (:c:type:`wchar_t`) at runtime. This " +"format code has been deprecated in documentation since Python 3.3, and will " +"be removed in Python 3.16. Use the ``'w'`` format code (:c:type:`Py_UCS4`) " +"for Unicode characters instead. (Contributed by Hugo van Kemenade in :gh:" +"`80480`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1763 +#: ../../deprecations/pending-removal-in-3.15.rst:4 +msgid ":mod:`ctypes`:" +msgstr ":mod:`ctypes`:" + +#: ../../whatsnew/3.13.rst:1765 +msgid "" +"Deprecate the undocumented :func:`!SetPointerType` function, to be removed " +"in Python 3.15. (Contributed by Victor Stinner in :gh:`105733`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1769 +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:1773 +msgid ":mod:`decimal`:" +msgstr ":mod:`decimal`:" + +#: ../../whatsnew/3.13.rst:1775 +msgid "" +"Deprecate the non-standard and undocumented :class:`~decimal.Decimal` format " +"specifier ``'N'``, which is only supported in the :mod:`!decimal` module's C " +"implementation. (Contributed by Serhiy Storchaka in :gh:`89902`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1780 +msgid ":mod:`dis`:" +msgstr ":mod:`dis`:" + +#: ../../whatsnew/3.13.rst:1782 +msgid "" +"Deprecate the :attr:`!HAVE_ARGUMENT` separator. Check membership in :data:" +"`~dis.hasarg` instead. (Contributed by Irit Katriel in :gh:`109319`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1786 +msgid ":mod:`getopt` and :mod:`optparse`:" +msgstr ":mod:`getopt` 和 :mod:`optparse`:" + +#: ../../whatsnew/3.13.rst:1788 +msgid "" +"Both modules are now :term:`soft deprecated`, with :mod:`argparse` preferred " +"for new projects. This is a new soft-deprecation for the :mod:`!getopt` " +"module, whereas the :mod:`!optparse` module was already *de facto* soft " +"deprecated. (Contributed by Victor Stinner in :gh:`106535`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1794 +msgid ":mod:`gettext`:" +msgstr ":mod:`gettext`:" + +#: ../../whatsnew/3.13.rst:1796 +msgid "" +"Deprecate non-integer numbers as arguments to functions and methods that " +"consider plural forms in the :mod:`!gettext` module, even if no translation " +"was found. (Contributed by Serhiy Storchaka in :gh:`88434`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1801 +msgid ":mod:`glob`:" +msgstr ":mod:`glob`:" + +#: ../../whatsnew/3.13.rst:1803 +msgid "" +"Deprecate the undocumented :func:`!glob0` and :func:`!glob1` functions. Use :" +"func:`~glob.glob` and pass a :term:`path-like object` specifying the root " +"directory to the *root_dir* parameter instead. (Contributed by Barney Gale " +"in :gh:`117337`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1808 +#: ../../deprecations/pending-removal-in-3.15.rst:9 +msgid ":mod:`http.server`:" +msgstr ":mod:`http.server`:" + +#: ../../whatsnew/3.13.rst:1810 +msgid "" +"Deprecate :class:`~http.server.CGIHTTPRequestHandler`, to be removed in " +"Python 3.15. Process-based CGI HTTP servers have been out of favor for a " +"very long time. This code was outdated, unmaintained, and rarely used. It " +"has a high potential for both security and functionality bugs. (Contributed " +"by Gregory P. Smith in :gh:`109096`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1817 +msgid "" +"Deprecate the :option:`!--cgi` flag to the :program:`python -m http.server` " +"command-line interface, to be removed in Python 3.15. (Contributed by " +"Gregory P. Smith in :gh:`109096`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1822 +msgid ":mod:`mimetypes`:" +msgstr ":mod:`mimetypes`:" + +#: ../../whatsnew/3.13.rst:1824 +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:1829 +msgid ":mod:`re`:" +msgstr ":mod:`re`:" + +#: ../../whatsnew/3.13.rst:1831 +msgid "" +"Deprecate passing the optional *maxsplit*, *count*, or *flags* arguments as " +"positional arguments to the module-level :func:`~re.split`, :func:`~re.sub`, " +"and :func:`~re.subn` functions. These parameters will become :ref:`keyword-" +"only <keyword-only_parameter>` in a future version of Python. (Contributed " +"by Serhiy Storchaka in :gh:`56166`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1838 +#: ../../deprecations/pending-removal-in-3.15.rst:33 +msgid ":mod:`pathlib`:" +msgstr ":mod:`pathlib`:" + +#: ../../whatsnew/3.13.rst:1840 +msgid "" +"Deprecate :meth:`.PurePath.is_reserved`, to be removed in Python 3.15. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows. (Contributed " +"by Barney Gale in :gh:`88569`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1845 +#: ../../deprecations/pending-removal-in-3.15.rst:39 +msgid ":mod:`platform`:" +msgstr ":mod:`platform`:" + +#: ../../whatsnew/3.13.rst:1847 +msgid "" +"Deprecate :func:`~platform.java_ver`, to be removed in Python 3.15. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested. (Contributed by Nikita Sobolev in :gh:`116349`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1853 +msgid ":mod:`pydoc`:" +msgstr ":mod:`pydoc`:" + +#: ../../whatsnew/3.13.rst:1855 +msgid "" +"Deprecate the undocumented :func:`!ispackage` function. (Contributed by " +"Zackery Spytz in :gh:`64020`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1858 +#: ../../deprecations/pending-removal-in-3.14.rst:91 +msgid ":mod:`sqlite3`:" +msgstr ":mod:`sqlite3`:" + +#: ../../whatsnew/3.13.rst:1860 +msgid "" +"Deprecate passing more than one positional argument to the :func:`~sqlite3." +"connect` function and the :class:`~sqlite3.Connection` constructor. The " +"remaining parameters will become keyword-only in Python 3.15. (Contributed " +"by Erlend E. Aasland in :gh:`107948`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1866 +msgid "" +"Deprecate passing name, number of arguments, and the callable as keyword " +"arguments for :meth:`.Connection.create_function` and :meth:`.Connection." +"create_aggregate` These parameters will become positional-only in Python " +"3.15. (Contributed by Erlend E. Aasland in :gh:`108278`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1872 +msgid "" +"Deprecate passing the callback callable by keyword for the :meth:`~sqlite3." +"Connection.set_authorizer`, :meth:`~sqlite3.Connection." +"set_progress_handler`, and :meth:`~sqlite3.Connection.set_trace_callback` :" +"class:`~sqlite3.Connection` methods. The callback callables will become " +"positional-only in Python 3.15. (Contributed by Erlend E. Aasland in :gh:" +"`108278`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1880 +#: ../../deprecations/pending-removal-in-3.16.rst:33 +msgid ":mod:`sys`:" +msgstr ":mod:`sys`:" + +#: ../../whatsnew/3.13.rst:1882 +msgid "" +"Deprecate the :func:`~sys._enablelegacywindowsfsencoding` function, to be " +"removed in Python 3.16. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead. (Contributed by Inada Naoki in :gh:`73427`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1887 +#: ../../deprecations/pending-removal-in-3.16.rst:39 +msgid ":mod:`tarfile`:" +msgstr ":mod:`tarfile`:" + +#: ../../whatsnew/3.13.rst:1889 +msgid "" +"Deprecate the undocumented and unused :attr:`!TarFile.tarfile` attribute, to " +"be removed in Python 3.16. (Contributed in :gh:`115256`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1893 +msgid ":mod:`traceback`:" +msgstr ":mod:`traceback`:" + +#: ../../whatsnew/3.13.rst:1895 +msgid "" +"Deprecate the :attr:`.TracebackException.exc_type` attribute. Use :attr:`." +"TracebackException.exc_type_str` instead. (Contributed by Irit Katriel in :" +"gh:`112332`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1899 +#: ../../deprecations/pending-removal-in-3.15.rst:53 +msgid ":mod:`typing`:" +msgstr ":mod:`typing`:" + +#: ../../whatsnew/3.13.rst:1901 +msgid "" +"Deprecate the undocumented keyword argument syntax for creating :class:" +"`~typing.NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, " +"y=int)``), to be removed in Python 3.15. Use the class-based syntax or the " +"functional syntax instead. (Contributed by Alex Waygood in :gh:`105566`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1908 +msgid "" +"Deprecate omitting the *fields* parameter when creating a :class:`~typing." +"NamedTuple` or :class:`typing.TypedDict` class, and deprecate passing " +"``None`` to the *fields* parameter of both types. Python 3.15 will require a " +"valid sequence for the *fields* parameter. To create a NamedTuple class with " +"zero fields, use ``class NT(NamedTuple): pass`` or ``NT = NamedTuple(\"NT\", " +"())``. To create a TypedDict class with zero fields, use ``class " +"TD(TypedDict): pass`` or ``TD = TypedDict(\"TD\", {})``. (Contributed by " +"Alex Waygood in :gh:`105566` and :gh:`105570`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1918 +msgid "" +"Deprecate the :func:`typing.no_type_check_decorator` decorator function, to " +"be removed in in Python 3.15. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker. (Contributed by Alex " +"Waygood in :gh:`106309`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1924 +msgid "" +"Deprecate :data:`typing.AnyStr`. In Python 3.16, it will be removed from " +"``typing.__all__``, and a :exc:`DeprecationWarning` will be emitted at " +"runtime when it is imported or accessed. It will be removed entirely in " +"Python 3.18. Use the new :ref:`type parameter syntax <type-params>` instead. " +"(Contributed by Michael The in :gh:`107116`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1932 +#: ../../deprecations/pending-removal-in-3.15.rst:66 +msgid ":mod:`wave`:" +msgstr ":mod:`wave`:" + +#: ../../whatsnew/3.13.rst:1934 +msgid "" +"Deprecate the :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:" +"`~wave.Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :" +"class:`~wave.Wave_write` classes, to be removed in Python 3.15. (Contributed " +"by Victor Stinner in :gh:`105096`.)" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:2 +#: ../../deprecations/pending-removal-in-3.14.rst:2 +msgid "Pending Removal in Python 3.14" +msgstr "Python 3.14 中待移除的項目" + +#: ../../deprecations/pending-removal-in-3.14.rst:4 +msgid "" +":mod:`argparse`: The *type*, *choices*, and *metavar* parameters of :class:`!" +"argparse.BooleanOptionalAction` are deprecated and will be removed in 3.14. " +"(Contributed by Nikita Sobolev in :gh:`92248`.)" +msgstr "" +":mod:`argparse`::class:`!argparse.BooleanOptionalAction` 的 *type*、" +"*choices* 和 *metavar* 參數已被棄用,將在 3.14 中移除。 (由 Nikita Sobolev " +"於 :gh:`92248` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.14.rst:9 +msgid "" +":mod:`ast`: The following features have been deprecated in documentation " +"since Python 3.8, now cause a :exc:`DeprecationWarning` to be emitted at " +"runtime when they are accessed or used, and will be removed in Python 3.14:" +msgstr "" +":mod:`ast`:自 Python 3.8 起,下列功能已在文件中被棄用,現在在存取或使用時會" +"於 runtime 發出 :exc:`DeprecationWarning`,並將在 Python 3.14 中移除:" + +#: ../../deprecations/pending-removal-in-3.14.rst:13 +msgid ":class:`!ast.Num`" +msgstr ":class:`!ast.Num`" + +#: ../../deprecations/pending-removal-in-3.14.rst:14 +msgid ":class:`!ast.Str`" +msgstr ":class:`!ast.Str`" + +#: ../../deprecations/pending-removal-in-3.14.rst:15 +msgid ":class:`!ast.Bytes`" +msgstr ":class:`!ast.Bytes`" + +#: ../../deprecations/pending-removal-in-3.14.rst:16 +msgid ":class:`!ast.NameConstant`" +msgstr ":class:`!ast.NameConstant`" + +#: ../../deprecations/pending-removal-in-3.14.rst:17 +msgid ":class:`!ast.Ellipsis`" +msgstr ":class:`!ast.Ellipsis`" + +#: ../../deprecations/pending-removal-in-3.14.rst:19 +msgid "" +"Use :class:`ast.Constant` instead. (Contributed by Serhiy Storchaka in :gh:" +"`90953`.)" +msgstr "" +"請改用 :class:`ast.Constant`。(由 Serhiy Storchaka 於 :gh:`90953` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.14.rst:22 +msgid ":mod:`asyncio`:" +msgstr ":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 " +"Python 3.14. (Contributed by Kumar Aditya in :gh:`94597`.)" +msgstr "" +"已棄用並將在 Python 3.14 中移除的 child watcher 類別::class:`~asyncio." +"MultiLoopChildWatcher`、:class:`~asyncio.FastChildWatcher`、:class:`~asyncio." +"AbstractChildWatcher` 和 :class:`~asyncio.SafeChildWatcher`。 (由 Kumar " +"Aditya 於 :gh:`94597` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.14.rst:30 +msgid "" +":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` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.14.rst:36 +msgid "" +"The :meth:`~asyncio.get_event_loop` method of the default event loop policy " +"now emits a :exc:`DeprecationWarning` if there is no current event loop set " +"and it decides to create one. (Contributed by Serhiy Storchaka and Guido van " +"Rossum in :gh:`100160`.)" +msgstr "" +"預設事件迴圈策略的 :meth:`~asyncio.get_event_loop` 方法現在會在沒有設定目前事" +"件迴圈且決定建立一個時發出 :exc:`DeprecationWarning`。 (由 Serhiy Storchaka " +"和 Guido van Rossum 於 :gh:`100160` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.14.rst:41 +msgid "" +":mod:`collections.abc`: Deprecated :class:`~collections.abc.ByteString`. " +"Prefer :class:`!Sequence` or :class:`~collections.abc.Buffer`. For use in " +"typing, prefer a union, like ``bytes | bytearray``, or :class:`collections." +"abc.Buffer`. (Contributed by Shantanu Jain in :gh:`91896`.)" +msgstr "" +":mod:`collections.abc`:已棄用 :class:`~collections.abc.ByteString`。請改用 :" +"class:`!Sequence` 或 :class:`~collections.abc.Buffer`。在 typing 中使用時,請" +"改用聯集,如 ``bytes | bytearray``,或 :class:`collections.abc.Buffer`。(由 " +"Shantanu Jain 於 :gh:`91896` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.14.rst:47 +msgid "" +":mod:`email`: Deprecated the *isdst* parameter in :func:`email.utils." +"localtime`. (Contributed by Alan Williams in :gh:`72346`.)" +msgstr "" +":mod:`email`:已棄用 :func:`email.utils.localtime` 中的 *isdst* 參數。(由 " +"Alan Williams 於 :gh:`72346` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.14.rst:50 +msgid ":mod:`importlib.abc` deprecated classes:" +msgstr ":mod:`importlib.abc` 的已棄用類別:" + +#: ../../deprecations/pending-removal-in-3.14.rst:52 +msgid ":class:`!importlib.abc.ResourceReader`" +msgstr ":class:`!importlib.abc.ResourceReader`" + +#: ../../deprecations/pending-removal-in-3.14.rst:53 +msgid ":class:`!importlib.abc.Traversable`" +msgstr ":class:`!importlib.abc.Traversable`" + +#: ../../deprecations/pending-removal-in-3.14.rst:54 +msgid ":class:`!importlib.abc.TraversableResources`" +msgstr ":class:`!importlib.abc.TraversableResources`" + +#: ../../deprecations/pending-removal-in-3.14.rst:56 +msgid "Use :mod:`importlib.resources.abc` classes instead:" +msgstr "請改用 :mod:`importlib.resources.abc` 類別:" + +#: ../../deprecations/pending-removal-in-3.14.rst:58 +msgid ":class:`importlib.resources.abc.Traversable`" +msgstr ":class:`importlib.resources.abc.Traversable`" + +#: ../../deprecations/pending-removal-in-3.14.rst:59 +msgid ":class:`importlib.resources.abc.TraversableResources`" +msgstr ":class:`importlib.resources.abc.TraversableResources`" + +#: ../../deprecations/pending-removal-in-3.14.rst:61 +msgid "(Contributed by Jason R. Coombs and Hugo van Kemenade in :gh:`93963`.)" +msgstr "(由 Jason R. Coombs 和 Hugo van Kemenade 貢獻於 :gh:`93963`。)" + +#: ../../deprecations/pending-removal-in-3.14.rst:63 +msgid "" +":mod:`itertools` had undocumented, inefficient, historically buggy, and " +"inconsistent support for copy, deepcopy, and pickle operations. This will be " +"removed in 3.14 for a significant reduction in code volume and maintenance " +"burden. (Contributed by Raymond Hettinger in :gh:`101588`.)" +msgstr "" +":mod:`itertools` 有不以文件記錄、效率低下、過去常有 bug 且不一致的 copy、" +"deepcopy 和 pickle 操作支援。將在 3.14 中移除以大幅減少程式碼量和維護負擔。 " +"(由 Raymond Hettinger 於 :gh:`101588` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.14.rst:69 +msgid "" +":mod:`multiprocessing`: The default start method will change to a safer one " +"on Linux, BSDs, and other non-macOS POSIX platforms where ``'fork'`` is " +"currently the default (:gh:`84559`). Adding a runtime warning about this was " +"deemed too disruptive as the majority of code is not expected to care. Use " +"the :func:`~multiprocessing.get_context` or :func:`~multiprocessing." +"set_start_method` APIs to explicitly specify when your code *requires* " +"``'fork'``. See :ref:`multiprocessing-start-methods`." +msgstr "" +":mod:`multiprocessing`:預設的啟動方法將在 Linux、BSD 和其他非 macOS POSIX 平" +"台上更改為更安全的 方法,目前 ``'fork'`` 是預設值 (:gh:`84559`)。對此增加一" +"個 runtime 警告被認為太過擾人,因為 大多數程式碼不會在意。請使用 :func:" +"`~multiprocessing.get_context` 或 :func:`~multiprocessing.set_start_method` " +"API 來明確指定你的程式碼何時\\ *需要* ``'fork'``。請參閱 :ref:" +"`multiprocessing-start-methods`。" + +#: ../../deprecations/pending-removal-in-3.14.rst:77 +msgid "" +":mod:`pathlib`: :meth:`~pathlib.PurePath.is_relative_to` and :meth:`~pathlib." +"PurePath.relative_to`: passing additional arguments is deprecated." +msgstr "" +":mod:`pathlib`:已棄用 :meth:`~pathlib.PurePath.is_relative_to` 和 :meth:" +"`~pathlib.PurePath.relative_to`:額外引數的傳遞已被棄用。" + +#: ../../deprecations/pending-removal-in-3.14.rst:81 +msgid "" +":mod:`pkgutil`: :func:`~pkgutil.find_loader` and :func:`~pkgutil.get_loader` " +"now raise :exc:`DeprecationWarning`; use :func:`importlib.util.find_spec` " +"instead. (Contributed by Nikita Sobolev in :gh:`97850`.)" +msgstr "" +":mod:`pkgutil`::func:`~pkgutil.find_loader` 和 :func:`~pkgutil.get_loader` " +"現在會引發 :exc:`DeprecationWarning`;請改用 :func:`importlib.util." +"find_spec`。 (由 Nikita Sobolev 於 :gh:`97850` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.14.rst:86 +msgid ":mod:`pty`:" +msgstr ":mod:`pty`:" + +#: ../../deprecations/pending-removal-in-3.14.rst:88 +msgid "``master_open()``: use :func:`pty.openpty`." +msgstr "``master_open()``:請用 :func:`pty.openpty`。" + +#: ../../deprecations/pending-removal-in-3.14.rst:89 +msgid "``slave_open()``: use :func:`pty.openpty`." +msgstr "``slave_open()``:請用 :func:`pty.openpty`。" + +#: ../../deprecations/pending-removal-in-3.14.rst:93 +msgid ":data:`~sqlite3.version` and :data:`~sqlite3.version_info`." +msgstr ":data:`~sqlite3.version` 和 :data:`~sqlite3.version_info`。" + +#: ../../deprecations/pending-removal-in-3.14.rst:95 +msgid "" +":meth:`~sqlite3.Cursor.execute` and :meth:`~sqlite3.Cursor.executemany` if :" +"ref:`named placeholders <sqlite3-placeholders>` are used and *parameters* is " +"a sequence instead of a :class:`dict`." +msgstr "" +":meth:`~sqlite3.Cursor.execute` 和 :meth:`~sqlite3.Cursor.executemany`,如果" +"使用 :ref:`named placeholders <sqlite3-placeholders>` 且 *parameters* 是序列" +"而不是 :class:`dict`。" + +#: ../../deprecations/pending-removal-in-3.14.rst:99 +msgid "" +"date and datetime adapter, date and timestamp converter: see the :mod:" +"`sqlite3` documentation for suggested replacement recipes." +msgstr "" +"date 和 datetime 的適配器 (adapter)、date 和 timestamp 轉換器 (converter):請" +"參閱 :mod:`sqlite3` 文件以獲得建議的替代方案。" + +#: ../../deprecations/pending-removal-in-3.14.rst:102 +msgid "" +":class:`types.CodeType`: Accessing :attr:`~codeobject.co_lnotab` was " +"deprecated in :pep:`626` since 3.10 and was planned to be removed in 3.12, " +"but it only got a proper :exc:`DeprecationWarning` in 3.12. May be removed " +"in 3.14. (Contributed by Nikita Sobolev in :gh:`101866`.)" +msgstr "" +":class:`types.CodeType`:自 3.10 起,存取 :attr:`~codeobject.co_lnotab` 已" +"在 :pep:`626` 中被棄用,並計劃在 3.12 中移除,但只在 3.12 中於適當時發出 :" +"exc:`DeprecationWarning`。可能在 3.14 中移除。(由 Nikita Sobolev 於 :gh:" +"`101866` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.14.rst:109 +msgid "" +":mod:`typing`: :class:`~typing.ByteString`, deprecated since Python 3.9, now " +"causes a :exc:`DeprecationWarning` to be emitted when it is used." +msgstr "" +":mod:`typing`:自 Python 3.9 起已被棄用的 :class:`~typing.ByteString` 現在在" +"使用時會發出 :exc:`DeprecationWarning`。" + +#: ../../deprecations/pending-removal-in-3.14.rst:112 +msgid "" +":mod:`urllib`: :class:`!urllib.parse.Quoter` is deprecated: it was not " +"intended to be a public API. (Contributed by Gregory P. Smith in :gh:" +"`88168`.)" +msgstr "" +":mod:`urllib`::class:`!urllib.parse.Quoter` 已被棄用:它並非預期的公開 API。" +"(由 Gregory P. Smith 於 :gh:`88168` 貢獻。)" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:2 +#: ../../deprecations/pending-removal-in-3.15.rst:2 +msgid "Pending Removal in Python 3.15" +msgstr "Python 3.15 中待移除的項目" + +#: ../../deprecations/pending-removal-in-3.15.rst:6 +msgid "" +"The undocumented :func:`!ctypes.SetPointerType` function has been deprecated " +"since Python 3.13." +msgstr "" +"自 Python 3.13 起,未記錄的 :func:`!ctypes.SetPointerType` 函式已被棄用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:11 +msgid "" +"The obsolete and rarely used :class:`~http.server.CGIHTTPRequestHandler` has " +"been deprecated since Python 3.13. No direct replacement exists. *Anything* " +"is better than CGI to interface a web server with a request handler." +msgstr "" +"過時且很少使用的 :class:`~http.server.CGIHTTPRequestHandler` 自 Python 3.13 " +"起已被棄用。不存在直接的替代。*任何東西*\\ 都比 CGI 更好地將 Web 伺服器與請求" +"處理程序介接起來。" + +#: ../../deprecations/pending-removal-in-3.15.rst:17 +msgid "" +"The :option:`!--cgi` flag to the :program:`python -m http.server` command-" +"line interface has been deprecated since Python 3.13." +msgstr "" +"自 Python 3.13 起,:program:`python -m http.server` 命令列介面的 :option:`!--" +"cgi` 旗標已被棄用。" + +#: ../../deprecations/pending-removal-in-3.15.rst:20 +msgid "" +":mod:`importlib`: ``__package__`` and ``__cached__`` will cease to be set or " +"taken into consideration by the import system (:gh:`97879`)." +msgstr "" +":mod:`importlib`:``__package__`` 和 ``__cached__`` 將不再被設定或被 import " +"系統考慮。 (:gh:`97879`)" + +#: ../../deprecations/pending-removal-in-3.15.rst:23 +msgid ":class:`locale`:" +msgstr ":class:`locale`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:25 +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`.)" +msgstr "" +":func:`~locale.getdefaultlocale` 已在 Python 3.11 中被棄用,原本計劃在 " +"Python 3.13 中移除 (:gh:`90817`),但被延後至 Python 3.15。請改用 :func:" +"`~locale.getlocale`、:func:`~locale.setlocale` 和 :func:`~locale." +"getencoding`。 (由 Hugo van Kemenade 於 :gh:`111187` 貢獻。)" + +#: ../../deprecations/pending-removal-in-3.15.rst:35 +msgid "" +":meth:`.PurePath.is_reserved` has been deprecated since Python 3.13. Use :" +"func:`os.path.isreserved` to detect reserved paths on Windows." +msgstr "" +":meth:`.PurePath.is_reserved` 已自 Python 3.13 被棄用。請用 :func:`os.path." +"isreserved` 來偵測 Windows 上的保留路徑。" + +#: ../../deprecations/pending-removal-in-3.15.rst:41 +msgid "" +":func:`~platform.java_ver` has been deprecated since Python 3.13. This " +"function is only useful for Jython support, has a confusing API, and is " +"largely untested." +msgstr "" +"自 Python 3.13 起,:func:`~platform.java_ver` 已被棄用。此函式僅對 Jython 支" +"援有用,具有令人困惑的 API,基本上未經測試。" + +#: ../../deprecations/pending-removal-in-3.15.rst:45 +msgid ":mod:`threading`:" +msgstr ":mod:`threading`:" + +#: ../../deprecations/pending-removal-in-3.15.rst:47 +msgid "" +":func:`~threading.RLock` will take no arguments in Python 3.15. Passing any " +"arguments has been deprecated since Python 3.14, as the Python version does " +"not permit any arguments, but the C version allows any number of positional " +"or keyword arguments, ignoring every argument." +msgstr "" +":func:`~threading.RLock` 在 Python 3.15 中將不接受任何引數。自 Python 3.14 " +"起,傳遞任何引數的用法已被棄用,因為 Python 版本不允許任何引數,但 C 版本允許" +"任意數量的位置或關鍵字引數,並忽略每個引數。" + +#: ../../deprecations/pending-removal-in-3.15.rst:55 +msgid "" +"The undocumented keyword argument syntax for creating :class:`~typing." +"NamedTuple` classes (e.g. ``Point = NamedTuple(\"Point\", x=int, y=int)``) " +"has been deprecated since Python 3.13. Use the class-based syntax or the " +"functional syntax instead." +msgstr "" +"用於建立 :class:`~typing.NamedTuple` 類別的未以文件記錄之關鍵字引數語法 " +"(``Point = NamedTuple(\"Point\", x=int, y=int)``) 已自 Python 3.13 棄用。請改" +"用基於類別的語法或函式語法 (functional syntax)。" + +#: ../../deprecations/pending-removal-in-3.15.rst:61 +msgid "" +"The :func:`typing.no_type_check_decorator` decorator function has been " +"deprecated since Python 3.13. After eight years in the :mod:`typing` module, " +"it has yet to be supported by any major type checker." +msgstr "" +"自 Python 3.13 起,:func:`typing.no_type_check_decorator` 裝飾器函式已被棄" +"用。在 :mod:`typing` 模組中使用了八年之後,它尚未得到任何主要型別檢查器的支" +"援。" + +#: ../../deprecations/pending-removal-in-3.15.rst:68 +msgid "" +"The :meth:`~wave.Wave_read.getmark`, :meth:`!setmark`, and :meth:`~wave." +"Wave_read.getmarkers` methods of the :class:`~wave.Wave_read` and :class:" +"`~wave.Wave_write` classes have been deprecated since Python 3.13." +msgstr "" +"已棄用 :class:`~wave.Wave_read` 和 :class:`~wave.Wave_write` 類別的 :meth:" +"`~wave.Wave_read.getmark`、:meth:`!setmark` 和 :meth:`~wave.Wave_read." +"getmarkers` 方法自 Python 3.13 被棄用。" + +#: ../../deprecations/pending-removal-in-3.16.rst:2 +msgid "Pending Removal in Python 3.16" +msgstr "Python 3.16 中待移除的項目" + +#: ../../deprecations/pending-removal-in-3.16.rst:4 +#: ../../deprecations/pending-removal-in-future.rst:12 +msgid ":mod:`builtins`:" +msgstr ":mod:`builtins`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:6 +msgid "" +"Bitwise inversion on boolean types, ``~True`` or ``~False`` has been " +"deprecated since Python 3.12, as it produces surprising and unintuitive " +"results (``-2`` and ``-1``). Use ``not x`` instead for the logical negation " +"of a Boolean. In the rare case that you need the bitwise inversion of the " +"underlying integer, convert to ``int`` explicitly (``~int(x)``)." +msgstr "" +"自 Python 3.12 起,布林型別的位元反轉 ``~True`` 或 ``~False`` 已被棄用,因為" +"它會產生不預期且不直觀的結果(``-2`` 和 ``-1``)。使用 ``not x`` 代替布林值的" +"邏輯否定。在極少數情況下,你需要對底層的整數進行位元反轉,請明確轉換為 " +"``~int(x)`` (``~int(x)``)。" + +#: ../../deprecations/pending-removal-in-3.16.rst:15 +msgid "" +"The ``'u'`` format code (:c:type:`wchar_t`) has been deprecated in " +"documentation since Python 3.3 and at runtime since Python 3.13. Use the " +"``'w'`` format code (:c:type:`Py_UCS4`) for Unicode characters instead." +msgstr "" +"自 Python 3.3 起,``'u'`` 格式碼 (:c:type:`wchar_t`) 在文件中已被棄用,自 " +"Python 3.13 起在 runtime 已被棄用。請使用 ``'w'`` 格式碼 (:c:type:`Py_UCS4`) " +"來取代 Unicode 字元。" + +#: ../../deprecations/pending-removal-in-3.16.rst:21 +msgid ":mod:`shutil`:" +msgstr ":mod:`shutil`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:23 +msgid "" +"The :class:`!ExecError` exception has been deprecated since Python 3.14. It " +"has not been used by any function in :mod:`!shutil` since Python 3.4, and is " +"now an alias of :exc:`RuntimeError`." +msgstr "" +"自 Python 3.14 起,:class:`!ExecError` 例外已被棄用。自 Python 3.4 以來,它尚" +"未被 :mod:`!shutil` 中的任何函式使用,現在是 :exc:`RuntimeError` 的別名。" + +#: ../../deprecations/pending-removal-in-3.16.rst:28 +msgid ":mod:`symtable`:" +msgstr ":mod:`symtable`:" + +#: ../../deprecations/pending-removal-in-3.16.rst:30 +msgid "" +"The :meth:`Class.get_methods <symtable.Class.get_methods>` method has been " +"deprecated since Python 3.14." +msgstr "" +"自 Python 3.14 起,:meth:`Class.get_methods <symtable.Class.get_methods>` 方" +"法已被棄用。" + +#: ../../deprecations/pending-removal-in-3.16.rst:35 +msgid "" +"The :func:`~sys._enablelegacywindowsfsencoding` function has been deprecated " +"since Python 3.13. Use the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` " +"environment variable instead." +msgstr "" +"自 Python 3.13 起,:func:`~sys._enablelegacywindowsfsencoding` 函式已被棄用。" +"請改用 :envvar:`PYTHONLEGACYWINDOWSFSENCODING` 環境變數。" + +#: ../../deprecations/pending-removal-in-3.16.rst:41 +msgid "" +"The undocumented and unused :attr:`!TarFile.tarfile` attribute has been " +"deprecated since Python 3.13." +msgstr "" +"自 Python 3.13 起,未以文件記錄和未被使用的 :attr:`!TarFile.tarfile` 屬性已被" +"棄用。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:2 +#: ../../deprecations/pending-removal-in-future.rst:2 +msgid "Pending Removal in Future Versions" +msgstr "未來版本中的待移除項目" + +#: ../../deprecations/pending-removal-in-future.rst:4 +msgid "" +"The following APIs will be removed in the future, although there is " +"currently no date scheduled for their removal." +msgstr "以下 API 將在未來被移除,雖然目前尚未安排移除日期。" + +#: ../../deprecations/pending-removal-in-future.rst:7 +msgid "" +":mod:`argparse`: Nesting argument groups and nesting mutually exclusive " +"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 +msgid "``bool(NotImplemented)``." +msgstr "``bool(NotImplemented)``。" + +#: ../../deprecations/pending-removal-in-future.rst:15 +msgid "" +"Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)`` signature " +"is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead, the single " +"argument signature." +msgstr "" +"產生器:``throw(type, exc, tb)`` 和 ``athrow(type, exc, tb)`` 簽名已被棄用:" +"請改用 ``throw(exc)`` 和 ``athrow(exc)``,為單引數簽名。" + +#: ../../deprecations/pending-removal-in-future.rst:18 +msgid "" +"Currently Python accepts numeric literals immediately followed by keywords, " +"for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and " +"ambiguous expressions like ``[0x1for x in y]`` (which can be interpreted as " +"``[0x1 for x in y]`` or ``[0x1f or x in y]``). A syntax warning is raised " +"if the numeric literal is immediately followed by one of keywords :keyword:" +"`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :" +"keyword:`is` and :keyword:`or`. In a future release it will be changed to a " +"syntax error. (:gh:`87999`)" +msgstr "" +"目前 Python 接受數值字面值後面立即接關鍵字,例如 ``0in x``、``1or x``、``0if " +"1else 2``。它讓表達式模糊且容易混淆,如 ``[0x1for x in y]``\\ (可以解釋為 " +"``[0x1 for x in y]`` 或 ``[0x1f or x in y]``)。如果數值字面值後立即接 :" +"keyword:`and`、:keyword:`else`、:keyword:`for`、:keyword:`if`、:keyword:" +"`in`、:keyword:`is` 和 :keyword:`or` 之一的關鍵字,則會引發語法警告。在未來版" +"本中,它將被更改為語法錯誤。(:gh:`87999`)" + +#: ../../deprecations/pending-removal-in-future.rst:26 +msgid "" +"Support for ``__index__()`` and ``__int__()`` method returning non-int type: " +"these methods will be required to return an instance of a strict subclass " +"of :class:`int`." +msgstr "" +"``__index__()`` 和 ``__int__()`` 方法回傳非 int 型別的支援:這些方法將需要回" +"傳 :class:`int` 的嚴格子類別實例。" + +#: ../../deprecations/pending-removal-in-future.rst:29 +msgid "" +"Support for ``__float__()`` method returning a strict subclass of :class:" +"`float`: these methods will be required to return an instance of :class:" +"`float`." +msgstr "" +"回傳 :class:`float` 嚴格子類別 ``__float__()`` 方法的支援:這些方法將需要回" +"傳 :class:`float` 的實例。" + +#: ../../deprecations/pending-removal-in-future.rst:32 +msgid "" +"Support for ``__complex__()`` method returning a strict subclass of :class:" +"`complex`: these methods will be required to return an instance of :class:" +"`complex`." +msgstr "" +"回傳 :class:`complex` 嚴格子類別 ``__complex__()`` 方法的支援:這些方法將需要" +"回傳 :class:`complex` 的實例。" + +#: ../../deprecations/pending-removal-in-future.rst:35 +msgid "Delegation of ``int()`` to ``__trunc__()`` method." +msgstr "將 ``int()`` 委派給 ``__trunc__()`` 方法。" + +#: ../../deprecations/pending-removal-in-future.rst:36 +msgid "" +"Passing a complex number as the *real* or *imag* argument in the :func:" +"`complex` constructor is now deprecated; it should only be passed as a " +"single positional argument. (Contributed by Serhiy Storchaka in :gh:" +"`109218`.)" +msgstr "" +"在 :func:`complex` 建構子中將複數作為 *real* 或 *imag* 引數傳遞現在已被棄用;" +"它應該只作為單個位置引數傳遞。 (由 Serhiy Storchaka 於 :gh:`109218` 貢獻。)" + +#: ../../deprecations/pending-removal-in-future.rst:41 +msgid "" +":mod:`calendar`: ``calendar.January`` and ``calendar.February`` constants " +"are deprecated and replaced by :data:`calendar.JANUARY` and :data:`calendar." +"FEBRUARY`. (Contributed by Prince Roshan in :gh:`103636`.)" +msgstr "" +":mod:`calendar`:``calendar.January`` 和 ``calendar.February`` 常數已被棄用並" +"被 :data:`calendar.JANUARY` 和 :data:`calendar.FEBRUARY` 取代。 (由 Prince " +"Roshan 於 :gh:`103636` 貢獻。)" + +#: ../../deprecations/pending-removal-in-future.rst:46 +msgid "" +":attr:`codeobject.co_lnotab`: use the :meth:`codeobject.co_lines` method " +"instead." +msgstr "" +":attr:`codeobject.co_lnotab`:請改用 :meth:`codeobject.co_lines` 方法。" + +#: ../../deprecations/pending-removal-in-future.rst:49 +msgid ":mod:`datetime`:" +msgstr ":mod:`datetime`:" + +#: ../../deprecations/pending-removal-in-future.rst:51 +msgid "" +":meth:`~datetime.datetime.utcnow`: use ``datetime.datetime.now(tz=datetime." +"UTC)``." +msgstr "" +":meth:`~datetime.datetime.utcnow`:請改用 ``datetime.datetime." +"now(tz=datetime.UTC)``。" + +#: ../../deprecations/pending-removal-in-future.rst:53 +msgid "" +":meth:`~datetime.datetime.utcfromtimestamp`: use ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``." +msgstr "" +":meth:`~datetime.datetime.utcfromtimestamp`:請改用 ``datetime.datetime." +"fromtimestamp(timestamp, tz=datetime.UTC)``。" + +#: ../../deprecations/pending-removal-in-future.rst:56 +msgid ":mod:`gettext`: Plural value must be an integer." +msgstr ":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." +msgstr "" +":func:`~importlib.util.cache_from_source` *debug_override* 參數已被棄用:請改" +"用 *optimization* 參數。" + +#: ../../deprecations/pending-removal-in-future.rst:64 +msgid ":mod:`importlib.metadata`:" +msgstr ":mod:`importlib.metadata`:" + +#: ../../deprecations/pending-removal-in-future.rst:66 +msgid "``EntryPoints`` tuple interface." +msgstr "``EntryPoints`` 元組介面。" + +#: ../../deprecations/pending-removal-in-future.rst:67 +msgid "Implicit ``None`` on return values." +msgstr "回傳值上的隱式 ``None``。" + +#: ../../deprecations/pending-removal-in-future.rst:69 +msgid "" +":mod:`logging`: the ``warn()`` method has been deprecated since Python 3.3, " +"use :meth:`~logging.warning` instead." +msgstr "" + +#: ../../deprecations/pending-removal-in-future.rst:72 +msgid "" +":mod:`mailbox`: Use of StringIO input and text mode is deprecated, use " +"BytesIO and binary mode instead." +msgstr "" +":mod:`mailbox`:已棄用 StringIO 輸入和文本模式,請改用 BytesIO 和二進位模式。" + +#: ../../deprecations/pending-removal-in-future.rst:75 +msgid "" +":mod:`os`: Calling :func:`os.register_at_fork` in multi-threaded process." +msgstr ":mod:`os`:在多執行緒行程中呼叫 :func:`os.register_at_fork`。" + +#: ../../deprecations/pending-removal-in-future.rst:77 +msgid "" +":class:`!pydoc.ErrorDuringImport`: A tuple value for *exc_info* parameter is " +"deprecated, use an exception instance." +msgstr "" +":class:`!pydoc.ErrorDuringImport`:*exc_info* 參數的元組值已被棄用,請用例外" +"實例。" + +#: ../../deprecations/pending-removal-in-future.rst:80 +msgid "" +":mod:`re`: More strict rules are now applied for numerical group references " +"and group names in regular expressions. Only sequence of ASCII digits is " +"now accepted as a numerical reference. The group name in bytes patterns and " +"replacement strings can now only contain ASCII letters and digits and " +"underscore. (Contributed by Serhiy Storchaka in :gh:`91760`.)" +msgstr "" +":mod:`re`:現在對正規表示式中的數值群組參照和群組名稱用了更嚴格的規則。現在只" +"有 ASCII 數碼序列被接受作為數值參照。位元組模式和替換字串中的群組名稱現在只能" +"包含 ASCII 字母、數碼和底線。(由 Serhiy Storchaka 於 :gh:`91760` 貢獻。)" + +#: ../../deprecations/pending-removal-in-future.rst:87 +msgid "" +":mod:`!sre_compile`, :mod:`!sre_constants` and :mod:`!sre_parse` modules." +msgstr ":mod:`!sre_compile`、:mod:`!sre_constants` 和 :mod:`!sre_parse` 模組。" + +#: ../../deprecations/pending-removal-in-future.rst:89 +msgid "" +":mod:`shutil`: :func:`~shutil.rmtree`'s *onerror* parameter is deprecated in " +"Python 3.12; use the *onexc* parameter instead." +msgstr "" +":mod:`shutil`::func:`~shutil.rmtree` 的 *onerror* 參數在 Python 3.12 中已被" +"棄用;請改用 *onexc* 參數。" + +#: ../../deprecations/pending-removal-in-future.rst:92 +msgid ":mod:`ssl` options and protocols:" +msgstr ":mod:`ssl` 選項和協定:" + +#: ../../deprecations/pending-removal-in-future.rst:94 +msgid ":class:`ssl.SSLContext` without protocol argument is deprecated." +msgstr "不帶協定引數的 :class:`ssl.SSLContext` 已被棄用。" + +#: ../../deprecations/pending-removal-in-future.rst:95 +msgid "" +":class:`ssl.SSLContext`: :meth:`~ssl.SSLContext.set_npn_protocols` and :meth:" +"`!selected_npn_protocol` are deprecated: use ALPN instead." +msgstr "" +":class:`ssl.SSLContext`::meth:`~ssl.SSLContext.set_npn_protocols` 和 :meth:" +"`!selected_npn_protocol` 已被棄用:請改用 ALPN。" + +#: ../../deprecations/pending-removal-in-future.rst:98 +msgid "``ssl.OP_NO_SSL*`` options" +msgstr "``ssl.OP_NO_SSL*`` 選項" + +#: ../../deprecations/pending-removal-in-future.rst:99 +msgid "``ssl.OP_NO_TLS*`` options" +msgstr "``ssl.OP_NO_TLS*`` 選項" + +#: ../../deprecations/pending-removal-in-future.rst:100 +msgid "``ssl.PROTOCOL_SSLv3``" +msgstr "``ssl.PROTOCOL_SSLv3``" + +#: ../../deprecations/pending-removal-in-future.rst:101 +msgid "``ssl.PROTOCOL_TLS``" +msgstr "``ssl.PROTOCOL_TLS``" + +#: ../../deprecations/pending-removal-in-future.rst:102 +msgid "``ssl.PROTOCOL_TLSv1``" +msgstr "``ssl.PROTOCOL_TLSv1``" + +#: ../../deprecations/pending-removal-in-future.rst:103 +msgid "``ssl.PROTOCOL_TLSv1_1``" +msgstr "``ssl.PROTOCOL_TLSv1_1``" + +#: ../../deprecations/pending-removal-in-future.rst:104 +msgid "``ssl.PROTOCOL_TLSv1_2``" +msgstr "``ssl.PROTOCOL_TLSv1_2``" + +#: ../../deprecations/pending-removal-in-future.rst:105 +msgid "``ssl.TLSVersion.SSLv3``" +msgstr "``ssl.TLSVersion.SSLv3``" + +#: ../../deprecations/pending-removal-in-future.rst:106 +msgid "``ssl.TLSVersion.TLSv1``" +msgstr "``ssl.TLSVersion.TLSv1``" + +#: ../../deprecations/pending-removal-in-future.rst:107 +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 +msgid ":mod:`threading` methods:" +msgstr ":mod:`threading` 方法:" + +#: ../../deprecations/pending-removal-in-future.rst:114 +msgid "" +":meth:`!threading.Condition.notifyAll`: use :meth:`~threading.Condition." +"notify_all`." +msgstr "" +":meth:`!threading.Condition.notifyAll`:請用 :meth:`~threading.Condition." +"notify_all`。" + +#: ../../deprecations/pending-removal-in-future.rst:115 +msgid ":meth:`!threading.Event.isSet`: use :meth:`~threading.Event.is_set`." +msgstr ":meth:`!threading.Event.isSet`:請用 :meth:`~threading.Event.is_set`。" + +#: ../../deprecations/pending-removal-in-future.rst:116 +msgid "" +":meth:`!threading.Thread.isDaemon`, :meth:`threading.Thread.setDaemon`: use :" +"attr:`threading.Thread.daemon` attribute." +msgstr "" +":meth:`!threading.Thread.isDaemon`、:meth:`threading.Thread.setDaemon`:請" +"用 :attr:`threading.Thread.daemon` 屬性。" + +#: ../../deprecations/pending-removal-in-future.rst:118 +msgid "" +":meth:`!threading.Thread.getName`, :meth:`threading.Thread.setName`: use :" +"attr:`threading.Thread.name` attribute." +msgstr "" +":meth:`!threading.Thread.getName`、:meth:`threading.Thread.setName`:請用 :" +"attr:`threading.Thread.name` 屬性。" + +#: ../../deprecations/pending-removal-in-future.rst:120 +msgid ":meth:`!threading.currentThread`: use :meth:`threading.current_thread`." +msgstr "" +":meth:`!threading.currentThread`:請用 :meth:`threading.current_thread`。" + +#: ../../deprecations/pending-removal-in-future.rst:121 +msgid ":meth:`!threading.activeCount`: use :meth:`threading.active_count`." +msgstr ":meth:`!threading.activeCount`:請用 :meth:`threading.active_count`。" + +#: ../../deprecations/pending-removal-in-future.rst:123 +msgid ":class:`typing.Text` (:gh:`92332`)." +msgstr ":class:`typing.Text` (:gh:`92332`)。" + +#: ../../deprecations/pending-removal-in-future.rst:125 +msgid "" +":class:`unittest.IsolatedAsyncioTestCase`: it is deprecated to return a " +"value that is not ``None`` from a test case." +msgstr "" +":class:`unittest.IsolatedAsyncioTestCase`:從測試案例中回傳非 ``None`` 的值已" +"被棄用。" + +#: ../../deprecations/pending-removal-in-future.rst:128 +msgid "" +":mod:`urllib.parse` deprecated functions: :func:`~urllib.parse.urlparse` " +"instead" +msgstr "" +":mod:`urllib.parse` 已棄用函式:請改用 :func:`~urllib.parse.urlparse`。" + +#: ../../deprecations/pending-removal-in-future.rst:130 +msgid "``splitattr()``" +msgstr "``splitattr()``" + +#: ../../deprecations/pending-removal-in-future.rst:131 +msgid "``splithost()``" +msgstr "``splithost()``" + +#: ../../deprecations/pending-removal-in-future.rst:132 +msgid "``splitnport()``" +msgstr "``splitnport()``" + +#: ../../deprecations/pending-removal-in-future.rst:133 +msgid "``splitpasswd()``" +msgstr "``splitpasswd()``" + +#: ../../deprecations/pending-removal-in-future.rst:134 +msgid "``splitport()``" +msgstr "``splitport()``" + +#: ../../deprecations/pending-removal-in-future.rst:135 +msgid "``splitquery()``" +msgstr "``splitquery()``" + +#: ../../deprecations/pending-removal-in-future.rst:136 +msgid "``splittag()``" +msgstr "``splittag()``" + +#: ../../deprecations/pending-removal-in-future.rst:137 +msgid "``splittype()``" +msgstr "``splittype()``" + +#: ../../deprecations/pending-removal-in-future.rst:138 +msgid "``splituser()``" +msgstr "``splituser()``" + +#: ../../deprecations/pending-removal-in-future.rst:139 +msgid "``splitvalue()``" +msgstr "``splitvalue()``" + +#: ../../deprecations/pending-removal-in-future.rst:140 +msgid "``to_bytes()``" +msgstr "``to_bytes()``" + +#: ../../deprecations/pending-removal-in-future.rst:142 +msgid "" +":mod:`urllib.request`: :class:`~urllib.request.URLopener` and :class:" +"`~urllib.request.FancyURLopener` style of invoking requests is deprecated. " +"Use newer :func:`~urllib.request.urlopen` functions and methods." +msgstr "" +":mod:`urllib.request`:呼叫請求的 :class:`~urllib.request.URLopener` 和 :" +"class:`~urllib.request.FancyURLopener` 風格已被棄用。請改用更新的 :func:" +"`~urllib.request.urlopen` 函式和方法。" + +#: ../../deprecations/pending-removal-in-future.rst:146 +msgid "" +":mod:`wsgiref`: ``SimpleHandler.stdout.write()`` should not do partial " +"writes." +msgstr ":mod:`wsgiref`:``SimpleHandler.stdout.write()`` 不應該進行部分寫入。" + +#: ../../deprecations/pending-removal-in-future.rst:149 +msgid "" +":mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`~xml." +"etree.ElementTree.Element` is deprecated. In a future release it will always " +"return ``True``. Prefer explicit ``len(elem)`` or ``elem is not None`` tests " +"instead." +msgstr "" +":mod:`xml.etree.ElementTree`:已棄用對 :class:`~xml.etree.ElementTree." +"Element` 的真值測試。在未來版本中,它將始終回傳 ``True``。請改用明確的 " +"``len(elem)`` 或 ``elem is not None`` 測試。" + +#: ../../deprecations/pending-removal-in-future.rst:154 +msgid "" +":meth:`zipimport.zipimporter.load_module` is deprecated: use :meth:" +"`~zipimport.zipimporter.exec_module` instead." +msgstr "" +":meth:`zipimport.zipimporter.load_module` 已被棄用:請改用 :meth:`~zipimport." +"zipimporter.exec_module`。" + +#: ../../whatsnew/3.13.rst:1951 +msgid "CPython Bytecode Changes" +msgstr "" + +#: ../../whatsnew/3.13.rst:1953 +msgid "" +"The oparg of :opcode:`YIELD_VALUE` is now ``1`` if the yield is part of a " +"yield-from or await, and ``0`` otherwise. The oparg of :opcode:`RESUME` was " +"changed to add a bit indicating if the except-depth is 1, which is needed to " +"optimize closing of generators. (Contributed by Irit Katriel in :gh:" +"`111354`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1961 +msgid "C API Changes" +msgstr "C API 變更" + +#: ../../whatsnew/3.13.rst:1966 +msgid "" +"Add the :ref:`PyMonitoring C API <c-api-monitoring>` for generating :pep:" +"`669` monitoring events:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1969 +msgid ":c:type:`PyMonitoringState`" +msgstr ":c:type:`PyMonitoringState`" + +#: ../../whatsnew/3.13.rst:1970 +msgid ":c:func:`PyMonitoring_FirePyStartEvent`" +msgstr ":c:func:`PyMonitoring_FirePyStartEvent`" + +#: ../../whatsnew/3.13.rst:1971 +msgid ":c:func:`PyMonitoring_FirePyResumeEvent`" +msgstr ":c:func:`PyMonitoring_FirePyResumeEvent`" + +#: ../../whatsnew/3.13.rst:1972 +msgid ":c:func:`PyMonitoring_FirePyReturnEvent`" +msgstr ":c:func:`PyMonitoring_FirePyReturnEvent`" + +#: ../../whatsnew/3.13.rst:1973 +msgid ":c:func:`PyMonitoring_FirePyYieldEvent`" +msgstr ":c:func:`PyMonitoring_FirePyYieldEvent`" + +#: ../../whatsnew/3.13.rst:1974 +msgid ":c:func:`PyMonitoring_FireCallEvent`" +msgstr ":c:func:`PyMonitoring_FireCallEvent`" + +#: ../../whatsnew/3.13.rst:1975 +msgid ":c:func:`PyMonitoring_FireLineEvent`" +msgstr ":c:func:`PyMonitoring_FireLineEvent`" + +#: ../../whatsnew/3.13.rst:1976 +msgid ":c:func:`PyMonitoring_FireJumpEvent`" +msgstr ":c:func:`PyMonitoring_FireJumpEvent`" + +#: ../../whatsnew/3.13.rst:1977 +msgid ":c:func:`PyMonitoring_FireBranchEvent`" +msgstr ":c:func:`PyMonitoring_FireBranchEvent`" + +#: ../../whatsnew/3.13.rst:1978 +msgid ":c:func:`PyMonitoring_FireCReturnEvent`" +msgstr ":c:func:`PyMonitoring_FireCReturnEvent`" + +#: ../../whatsnew/3.13.rst:1979 +msgid ":c:func:`PyMonitoring_FirePyThrowEvent`" +msgstr ":c:func:`PyMonitoring_FirePyThrowEvent`" + +#: ../../whatsnew/3.13.rst:1980 +msgid ":c:func:`PyMonitoring_FireRaiseEvent`" +msgstr ":c:func:`PyMonitoring_FireRaiseEvent`" + +#: ../../whatsnew/3.13.rst:1981 +msgid ":c:func:`PyMonitoring_FireCRaiseEvent`" +msgstr ":c:func:`PyMonitoring_FireCRaiseEvent`" + +#: ../../whatsnew/3.13.rst:1982 +msgid ":c:func:`PyMonitoring_FireReraiseEvent`" +msgstr ":c:func:`PyMonitoring_FireReraiseEvent`" + +#: ../../whatsnew/3.13.rst:1983 +msgid ":c:func:`PyMonitoring_FireExceptionHandledEvent`" +msgstr ":c:func:`PyMonitoring_FireExceptionHandledEvent`" + +#: ../../whatsnew/3.13.rst:1984 +msgid ":c:func:`PyMonitoring_FirePyUnwindEvent`" +msgstr ":c:func:`PyMonitoring_FirePyUnwindEvent`" + +#: ../../whatsnew/3.13.rst:1985 +msgid ":c:func:`PyMonitoring_FireStopIterationEvent`" +msgstr ":c:func:`PyMonitoring_FireStopIterationEvent`" + +#: ../../whatsnew/3.13.rst:1986 +msgid ":c:func:`PyMonitoring_EnterScope`" +msgstr ":c:func:`PyMonitoring_EnterScope`" + +#: ../../whatsnew/3.13.rst:1987 +msgid ":c:func:`PyMonitoring_ExitScope`" +msgstr ":c:func:`PyMonitoring_ExitScope`" + +#: ../../whatsnew/3.13.rst:1989 +msgid "(Contributed by Irit Katriel in :gh:`111997`)." +msgstr "" + +#: ../../whatsnew/3.13.rst:1991 +msgid "" +"Add :c:type:`PyMutex`, a lightweight mutex that occupies a single byte, and " +"the new :c:func:`PyMutex_Lock` and :c:func:`PyMutex_Unlock` functions. :c:" +"func:`!PyMutex_Lock` will release the :term:`GIL` (if currently held) if the " +"operation needs to block. (Contributed by Sam Gross in :gh:`108724`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:1997 +msgid "" +"Add the :ref:`PyTime C API <c-api-time>` to provide access to system clocks:" +msgstr "" + +#: ../../whatsnew/3.13.rst:1999 +msgid ":c:type:`PyTime_t`." +msgstr ":c:type:`PyTime_t`。" + +#: ../../whatsnew/3.13.rst:2000 +msgid ":c:var:`PyTime_MIN` and :c:var:`PyTime_MAX`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2001 +msgid ":c:func:`PyTime_AsSecondsDouble`." +msgstr ":c:func:`PyTime_AsSecondsDouble`。" + +#: ../../whatsnew/3.13.rst:2002 +msgid ":c:func:`PyTime_Monotonic`." +msgstr ":c:func:`PyTime_Monotonic`。" + +#: ../../whatsnew/3.13.rst:2003 +msgid ":c:func:`PyTime_MonotonicRaw`." +msgstr ":c:func:`PyTime_MonotonicRaw`。" + +#: ../../whatsnew/3.13.rst:2004 +msgid ":c:func:`PyTime_PerfCounter`." +msgstr ":c:func:`PyTime_PerfCounter`。" + +#: ../../whatsnew/3.13.rst:2005 +msgid ":c:func:`PyTime_PerfCounterRaw`." +msgstr ":c:func:`PyTime_PerfCounterRaw`。" + +#: ../../whatsnew/3.13.rst:2006 +msgid ":c:func:`PyTime_Time`." +msgstr ":c:func:`PyTime_Time`。" + +#: ../../whatsnew/3.13.rst:2007 +msgid ":c:func:`PyTime_TimeRaw`." +msgstr ":c:func:`PyTime_TimeRaw`。" + +#: ../../whatsnew/3.13.rst:2009 +msgid "(Contributed by Victor Stinner and Petr Viktorin in :gh:`110850`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2011 +msgid "" +"Add the :c:func:`PyDict_ContainsString` function with the same behavior as :" +"c:func:`PyDict_Contains`, but *key* is specified as a :c:expr:`const char*` " +"UTF-8 encoded bytes string, rather than a :c:expr:`PyObject*`. (Contributed " +"by Victor Stinner in :gh:`108314`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2017 +msgid "" +"Add the :c:func:`PyDict_GetItemRef` and :c:func:`PyDict_GetItemStringRef` " +"functions, which behave similarly to :c:func:`PyDict_GetItemWithError`, but " +"return a :term:`strong reference` instead of a :term:`borrowed reference`. " +"Moreover, these functions return ``-1`` on error, removing the need to " +"check :c:func:`!PyErr_Occurred`. (Contributed by Victor Stinner in :gh:" +"`106004`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2025 +msgid "" +"Add the :c:func:`PyDict_SetDefaultRef` function, which behaves similarly to :" +"c:func:`PyDict_SetDefault`, but returns a :term:`strong reference` instead " +"of a :term:`borrowed reference`. This function returns ``-1`` on error, " +"``0`` on insertion, and ``1`` if the key was already present in the " +"dictionary. (Contributed by Sam Gross in :gh:`112066`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2033 +msgid "" +"Add the :c:func:`PyDict_Pop` and :c:func:`PyDict_PopString` functions to " +"remove a key from a dictionary and optionally return the removed value. This " +"is similar to :meth:`dict.pop`, though there is no default value, and :exc:" +"`KeyError` is not raised for missing keys. (Contributed by Stefan Behnel and " +"Victor Stinner in :gh:`111262`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2040 +msgid "" +"Add the :c:func:`PyMapping_GetOptionalItem` and :c:func:" +"`PyMapping_GetOptionalItemString` functions as alternatives to :c:func:" +"`PyObject_GetItem` and :c:func:`PyMapping_GetItemString` respectively. The " +"new functions do not raise :exc:`KeyError` if the requested key is missing " +"from the mapping. These variants are more convenient and faster if a missing " +"key should not be treated as a failure. (Contributed by Serhiy Storchaka in :" +"gh:`106307`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2050 +msgid "" +"Add the :c:func:`PyObject_GetOptionalAttr` and :c:func:" +"`PyObject_GetOptionalAttrString` functions as alternatives to :c:func:" +"`PyObject_GetAttr` and :c:func:`PyObject_GetAttrString` respectively. The " +"new functions do not raise :exc:`AttributeError` if the requested attribute " +"is not found on the object. These variants are more convenient and faster if " +"the missing attribute should not be treated as a failure. (Contributed by " +"Serhiy Storchaka in :gh:`106521`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2060 +msgid "" +"Add the :c:func:`PyErr_FormatUnraisable` function as an extension to :c:func:" +"`PyErr_WriteUnraisable` that allows customizing the warning message. " +"(Contributed by Serhiy Storchaka in :gh:`108082`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2065 +msgid "" +"Add new functions that return a :term:`strong reference` instead of a :term:" +"`borrowed reference` for frame locals, globals, and builtins, as part of :" +"ref:`PEP 667 <whatsnew313-locals-semantics>`:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2069 +msgid ":c:func:`PyEval_GetFrameBuiltins` replaces :c:func:`PyEval_GetBuiltins`" +msgstr "" + +#: ../../whatsnew/3.13.rst:2070 +msgid ":c:func:`PyEval_GetFrameGlobals` replaces :c:func:`PyEval_GetGlobals`" +msgstr "" + +#: ../../whatsnew/3.13.rst:2071 +msgid ":c:func:`PyEval_GetFrameLocals` replaces :c:func:`PyEval_GetLocals`" +msgstr "" + +#: ../../whatsnew/3.13.rst:2073 +msgid "(Contributed by Mark Shannon and Tian Gao in :gh:`74929`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2075 +msgid "" +"Add the :c:func:`Py_GetConstant` and :c:func:`Py_GetConstantBorrowed` " +"functions to get :term:`strong <strong reference>` or :term:`borrowed " +"<borrowed reference>` references to constants. For example, " +"``Py_GetConstant(Py_CONSTANT_ZERO)`` returns a strong reference to the " +"constant zero. (Contributed by Victor Stinner in :gh:`115754`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2082 +msgid "" +"Add the :c:func:`PyImport_AddModuleRef` function as a replacement for :c:" +"func:`PyImport_AddModule` that returns a :term:`strong reference` instead of " +"a :term:`borrowed reference`. (Contributed by Victor Stinner in :gh:" +"`105922`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2087 +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:2092 +msgid "" +"Add the :c:func:`PyList_GetItemRef` function as a replacement for :c:func:" +"`PyList_GetItem` that returns a :term:`strong reference` instead of a :term:" +"`borrowed reference`. (Contributed by Sam Gross in :gh:`114329`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2097 +msgid "" +"Add the :c:func:`PyList_Extend` and :c:func:`PyList_Clear` functions, " +"mirroring the Python :meth:`!list.extend` and :meth:`!list.clear` methods. " +"(Contributed by Victor Stinner in :gh:`111138`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2101 +msgid "" +"Add the :c:func:`PyLong_AsInt` function. It behaves similarly to :c:func:" +"`PyLong_AsLong`, but stores the result in a C :c:expr:`int` instead of a C :" +"c:expr:`long`. (Contributed by Victor Stinner in :gh:`108014`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2106 +msgid "" +"Add the :c:func:`PyLong_AsNativeBytes`, :c:func:`PyLong_FromNativeBytes`, " +"and :c:func:`PyLong_FromUnsignedNativeBytes` functions to simplify " +"converting between native integer types and Python :class:`int` objects. " +"(Contributed by Steve Dower in :gh:`111140`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2112 +msgid "" +"Add :c:func:`PyModule_Add` function, which is similar to :c:func:" +"`PyModule_AddObjectRef` and :c:func:`PyModule_AddObject`, but always steals " +"a reference to the value. (Contributed by Serhiy Storchaka in :gh:`86493`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2117 +msgid "" +"Add the :c:func:`PyObject_GenericHash` function that implements the default " +"hashing function of a Python object. (Contributed by Serhiy Storchaka in :gh:" +"`113024`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2121 +msgid "" +"Add the :c:func:`Py_HashPointer` function to hash a raw pointer. " +"(Contributed by Victor Stinner in :gh:`111545`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2124 +msgid "" +"Add the :c:func:`PyObject_VisitManagedDict` and :c:func:" +"`PyObject_ClearManagedDict` functions. which must be called by the traverse " +"and clear functions of a type using the :c:macro:`Py_TPFLAGS_MANAGED_DICT` " +"flag. The `pythoncapi-compat project`_ can be used to use these functions " +"with Python 3.11 and 3.12. (Contributed by Victor Stinner in :gh:`107073`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2132 +msgid "" +"Add the :c:func:`PyRefTracer_SetTracer` and :c:func:`PyRefTracer_GetTracer` " +"functions, which enable tracking object creation and destruction in the same " +"way that the :mod:`tracemalloc` module does. (Contributed by Pablo Galindo " +"in :gh:`93502`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2138 +msgid "" +"Add the :c:func:`PySys_AuditTuple` function as an alternative to :c:func:" +"`PySys_Audit` that takes event arguments as a Python :class:`tuple` object. " +"(Contributed by Victor Stinner in :gh:`85283`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2143 +msgid "" +"Add the :c:func:`PyThreadState_GetUnchecked()` function as an alternative " +"to :c:func:`PyThreadState_Get()` that doesn't kill the process with a fatal " +"error if it is ``NULL``. The caller is responsible for checking if the " +"result is ``NULL``. (Contributed by Victor Stinner in :gh:`108867`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2149 +msgid "" +"Add the :c:func:`PyType_GetFullyQualifiedName` function to get the type's " +"fully qualified name. The module name is prepended if :attr:`type." +"__module__` is a string and is not equal to either ``'builtins'`` or " +"``'__main__'``. (Contributed by Victor Stinner in :gh:`111696`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2155 +msgid "" +"Add the :c:func:`PyType_GetModuleName` function to get the type's module " +"name. This is equivalent to getting the :attr:`type.__module__` attribute. " +"(Contributed by Eric Snow and Victor Stinner in :gh:`111696`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2160 +msgid "" +"Add the :c:func:`PyUnicode_EqualToUTF8AndSize` and :c:func:" +"`PyUnicode_EqualToUTF8` functions to compare a Unicode object with a :c:expr:" +"`const char*` UTF-8 encoded string and ``1`` if they are equal or ``0`` " +"otherwise. These functions do not raise exceptions. (Contributed by Serhiy " +"Storchaka in :gh:`110289`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2167 +msgid "" +"Add the :c:func:`PyWeakref_GetRef` function as an alternative to :c:func:" +"`PyWeakref_GetObject` that returns a :term:`strong reference` or ``NULL`` if " +"the referent is no longer live. (Contributed by Victor Stinner in :gh:" +"`105927`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2173 +msgid "Add fixed variants of functions which silently ignore errors:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2175 +msgid "" +":c:func:`PyObject_HasAttrWithError` replaces :c:func:`PyObject_HasAttr`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2176 +msgid "" +":c:func:`PyObject_HasAttrStringWithError` replaces :c:func:" +"`PyObject_HasAttrString`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2178 +msgid "" +":c:func:`PyMapping_HasKeyWithError` replaces :c:func:`PyMapping_HasKey`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2179 +msgid "" +":c:func:`PyMapping_HasKeyStringWithError` replaces :c:func:" +"`PyMapping_HasKeyString`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2182 +msgid "" +"The new functions return ``-1`` for errors and the standard ``1`` for true " +"and ``0`` for false." +msgstr "" + +#: ../../whatsnew/3.13.rst:2185 +msgid "(Contributed by Serhiy Storchaka in :gh:`108511`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2189 +msgid "Changed C APIs" +msgstr "" + +#: ../../whatsnew/3.13.rst:2191 +msgid "" +"The *keywords* parameter of :c:func:`PyArg_ParseTupleAndKeywords` and :c:" +"func:`PyArg_VaParseTupleAndKeywords` now has type :c:expr:`char * const *` " +"in C and :c:expr:`const char * const *` in C++, instead of :c:expr:`char " +"**`. In C++, this makes these functions compatible with arguments of type :c:" +"expr:`const char * const *`, :c:expr:`const char **`, or :c:expr:`char * " +"const *` without an explicit type cast. In C, the functions only support " +"arguments of type :c:expr:`char * const *`. This can be overridden with the :" +"c:macro:`PY_CXX_CONST` macro. (Contributed by Serhiy Storchaka in :gh:" +"`65210`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2203 +msgid "" +":c:func:`PyArg_ParseTupleAndKeywords` now supports non-ASCII keyword " +"parameter names. (Contributed by Serhiy Storchaka in :gh:`110815`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2207 +msgid "" +"The :c:func:`!PyCode_GetFirstFree` function is now unstable API and is now " +"named :c:func:`PyUnstable_Code_GetFirstFree`. (Contributed by Bogdan " +"Romanyuk in :gh:`115781`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2211 +msgid "" +"The :c:func:`PyDict_GetItem`, :c:func:`PyDict_GetItemString`, :c:func:" +"`PyMapping_HasKey`, :c:func:`PyMapping_HasKeyString`, :c:func:" +"`PyObject_HasAttr`, :c:func:`PyObject_HasAttrString`, and :c:func:" +"`PySys_GetObject` functions, each of which clears all errors which occurred " +"when calling them now reports these errors using :func:`sys.unraisablehook`. " +"You may replace them with other functions as recommended in the " +"documentation. (Contributed by Serhiy Storchaka in :gh:`106672`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2220 +msgid "" +"Add support for the ``%T``, ``%#T``, ``%N`` and ``%#N`` formats to :c:func:" +"`PyUnicode_FromFormat`:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2223 +msgid "``%T``: Get the fully qualified name of an object type" +msgstr "" + +#: ../../whatsnew/3.13.rst:2224 +msgid "``%#T``: As above, but use a colon as the separator" +msgstr "" + +#: ../../whatsnew/3.13.rst:2225 +msgid "``%N``: Get the fully qualified name of a type" +msgstr "" + +#: ../../whatsnew/3.13.rst:2226 +msgid "``%#N``: As above, but use a colon as the separator" +msgstr "" + +#: ../../whatsnew/3.13.rst:2228 +msgid "" +"See :pep:`737` for more information. (Contributed by Victor Stinner in :gh:" +"`111696`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2231 +msgid "" +"You no longer have to define the ``PY_SSIZE_T_CLEAN`` macro before " +"including :file:`Python.h` when using ``#`` formats in :ref:`format codes " +"<arg-parsing-string-and-buffers>`. APIs accepting the format codes always " +"use ``Py_ssize_t`` for ``#`` formats. (Contributed by Inada Naoki in :gh:" +"`104922`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2237 +msgid "" +"If Python is built in :ref:`debug mode <debug-build>` or :option:`with " +"assertions <--with-assertions>`, :c:func:`PyTuple_SET_ITEM` and :c:func:" +"`PyList_SET_ITEM` now check the index argument with an assertion. " +"(Contributed by Victor Stinner in :gh:`106168`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2245 +msgid "Limited C API Changes" +msgstr "" + +#: ../../whatsnew/3.13.rst:2247 +msgid "The following functions are now included in the Limited C API:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2249 +msgid ":c:func:`PyMem_RawMalloc`" +msgstr ":c:func:`PyMem_RawMalloc`" + +#: ../../whatsnew/3.13.rst:2250 +msgid ":c:func:`PyMem_RawCalloc`" +msgstr ":c:func:`PyMem_RawCalloc`" + +#: ../../whatsnew/3.13.rst:2251 +msgid ":c:func:`PyMem_RawRealloc`" +msgstr ":c:func:`PyMem_RawRealloc`" + +#: ../../whatsnew/3.13.rst:2252 +msgid ":c:func:`PyMem_RawFree`" +msgstr ":c:func:`PyMem_RawFree`" + +#: ../../whatsnew/3.13.rst:2253 +msgid ":c:func:`PySys_Audit`" +msgstr ":c:func:`PySys_Audit`" + +#: ../../whatsnew/3.13.rst:2254 +msgid ":c:func:`PySys_AuditTuple`" +msgstr ":c:func:`PySys_AuditTuple`" + +#: ../../whatsnew/3.13.rst:2255 +msgid ":c:func:`PyType_GetModuleByDef`" +msgstr ":c:func:`PyType_GetModuleByDef`" + +#: ../../whatsnew/3.13.rst:2257 +msgid "" +"(Contributed by Victor Stinner in :gh:`85283`, :gh:`85283`, and :gh:" +"`116936`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2259 +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:2265 +msgid "Removed C APIs" +msgstr "" + +#: ../../whatsnew/3.13.rst:2267 +msgid "" +"Remove several functions, macros, variables, etc with names prefixed by " +"``_Py`` or ``_PY`` (which are considered private). If your project is " +"affected by one of these removals and you believe that the removed API " +"should remain available, please :ref:`open a new issue <using-the-tracker>` " +"to request a public C API and add ``cc: @vstinner`` to the issue to notify " +"Victor Stinner. (Contributed by Victor Stinner in :gh:`106320`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2275 +msgid "" +"Remove old buffer protocols deprecated in Python 3.0. Use :ref:" +"`bufferobjects` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2278 +msgid "" +":c:func:`!PyObject_CheckReadBuffer`: Use :c:func:`PyObject_CheckBuffer` to " +"test whether the object supports the buffer protocol. Note that :c:func:" +"`PyObject_CheckBuffer` doesn't guarantee that :c:func:`PyObject_GetBuffer` " +"will succeed. To test if the object is actually readable, see the next " +"example of :c:func:`PyObject_GetBuffer`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2286 +msgid "" +":c:func:`!PyObject_AsCharBuffer`, :c:func:`!PyObject_AsReadBuffer`: Use :c:" +"func:`PyObject_GetBuffer` and :c:func:`PyBuffer_Release` instead:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2289 +msgid "" +"Py_buffer view;\n" +"if (PyObject_GetBuffer(obj, &view, PyBUF_SIMPLE) < 0) {\n" +" return NULL;\n" +"}\n" +"// Use `view.buf` and `view.len` to read from the buffer.\n" +"// You may need to cast buf as `(const char*)view.buf`.\n" +"PyBuffer_Release(&view);" +msgstr "" + +#: ../../whatsnew/3.13.rst:2299 +msgid "" +":c:func:`!PyObject_AsWriteBuffer`: Use :c:func:`PyObject_GetBuffer` and :c:" +"func:`PyBuffer_Release` instead:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2302 +msgid "" +"Py_buffer view;\n" +"if (PyObject_GetBuffer(obj, &view, PyBUF_WRITABLE) < 0) {\n" +" return NULL;\n" +"}\n" +"// Use `view.buf` and `view.len` to write to the buffer.\n" +"PyBuffer_Release(&view);" +msgstr "" + +#: ../../whatsnew/3.13.rst:2311 +msgid "(Contributed by Inada Naoki in :gh:`85275`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2313 +msgid "Remove various functions deprecated in Python 3.9:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2315 +msgid "" +":c:func:`!PyEval_CallObject`, :c:func:`!PyEval_CallObjectWithKeywords`: Use :" +"c:func:`PyObject_CallNoArgs` or :c:func:`PyObject_Call` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2320 +msgid "" +"In :c:func:`PyObject_Call`, positional arguments must be a :class:`tuple` " +"and must not be ``NULL``, and keyword arguments must be a :class:`dict` or " +"``NULL``, whereas the removed functions checked argument types and accepted " +"``NULL`` positional and keyword arguments. To replace " +"``PyEval_CallObjectWithKeywords(func, NULL, kwargs)`` with :c:func:" +"`PyObject_Call`, pass an empty tuple as positional arguments using :c:func:" +"`PyTuple_New(0) <PyTuple_New>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2330 +msgid "" +":c:func:`!PyEval_CallFunction`: Use :c:func:`PyObject_CallFunction` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2332 +msgid "" +":c:func:`!PyEval_CallMethod`: Use :c:func:`PyObject_CallMethod` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2334 +msgid ":c:func:`!PyCFunction_Call`: Use :c:func:`PyObject_Call` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2337 +msgid "(Contributed by Victor Stinner in :gh:`105107`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2339 +msgid "" +"Remove the following old functions to configure the Python initialization, " +"deprecated in Python 3.11:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2342 +msgid "" +":c:func:`!PySys_AddWarnOptionUnicode`: Use :c:member:`PyConfig.warnoptions` " +"instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2344 +msgid "" +":c:func:`!PySys_AddWarnOption`: Use :c:member:`PyConfig.warnoptions` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2346 +msgid ":c:func:`!PySys_AddXOption`: Use :c:member:`PyConfig.xoptions` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2348 +msgid "" +":c:func:`!PySys_HasWarnOptions`: Use :c:member:`PyConfig.xoptions` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2350 +msgid "" +":c:func:`!PySys_SetPath`: Set :c:member:`PyConfig.module_search_paths` " +"instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2352 +msgid "" +":c:func:`!Py_SetPath`: Set :c:member:`PyConfig.module_search_paths` instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2354 +msgid "" +":c:func:`!Py_SetStandardStreamEncoding`: Set :c:member:`PyConfig." +"stdio_encoding` instead, and set also maybe :c:member:`PyConfig." +"legacy_windows_stdio` (on Windows)." +msgstr "" + +#: ../../whatsnew/3.13.rst:2357 +msgid "" +":c:func:`!_Py_SetProgramFullPath`: Set :c:member:`PyConfig.executable` " +"instead." +msgstr "" + +#: ../../whatsnew/3.13.rst:2360 +msgid "" +"Use the new :c:type:`PyConfig` API of the :ref:`Python Initialization " +"Configuration <init-config>` instead (:pep:`587`), added to Python 3.8. " +"(Contributed by Victor Stinner in :gh:`105145`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2364 +msgid "" +"Remove :c:func:`!PyEval_AcquireLock` and :c:func:`!PyEval_ReleaseLock` " +"functions, deprecated in Python 3.2. They didn't update the current thread " +"state. They can be replaced with:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2369 +msgid ":c:func:`PyEval_SaveThread` and :c:func:`PyEval_RestoreThread`;" +msgstr ":c:func:`PyEval_SaveThread` 和 :c:func:`PyEval_RestoreThread`;" + +#: ../../whatsnew/3.13.rst:2370 +msgid "" +"low-level :c:func:`PyEval_AcquireThread` and :c:func:`PyEval_RestoreThread`;" +msgstr "" + +#: ../../whatsnew/3.13.rst:2371 +msgid "or :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2373 +msgid "(Contributed by Victor Stinner in :gh:`105182`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2375 +msgid "" +"Remove the :c:func:`!PyEval_ThreadsInitialized` function, deprecated in " +"Python 3.9. Since Python 3.7, :c:func:`!Py_Initialize` always creates the " +"GIL: calling :c:func:`!PyEval_InitThreads` does nothing and :c:func:`!" +"PyEval_ThreadsInitialized` always returns non-zero. (Contributed by Victor " +"Stinner in :gh:`105182`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2382 +msgid "" +"Remove the :c:func:`!_PyInterpreterState_Get` alias to :c:func:" +"`PyInterpreterState_Get()` which was kept for backward compatibility with " +"Python 3.8. The `pythoncapi-compat project`_ can be used to get :c:func:" +"`PyInterpreterState_Get()` on Python 3.8 and older. (Contributed by Victor " +"Stinner in :gh:`106320`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2389 +msgid "" +"Remove the private :c:func:`!_PyObject_FastCall` function: use :c:func:`!" +"PyObject_Vectorcall` which is available since Python 3.8 (:pep:`590`). " +"(Contributed by Victor Stinner in :gh:`106023`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2394 +msgid "" +"Remove the ``cpython/pytime.h`` header file, which only contained private " +"functions. (Contributed by Victor Stinner in :gh:`106316`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2398 +msgid "" +"Remove the undocumented ``PY_TIMEOUT_MAX`` constant from the limited C API. " +"(Contributed by Victor Stinner in :gh:`110014`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2401 +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 "" + +#: ../../whatsnew/3.13.rst:2408 +msgid "Deprecated C APIs" +msgstr "器用的 C API" + +#: ../../whatsnew/3.13.rst:2410 +msgid "Deprecate old Python initialization functions:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2412 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:13 +msgid "" +":c:func:`PySys_ResetWarnOptions`: Clear :data:`sys.warnoptions` and :data:`!" +"warnings.filters` instead." +msgstr "" +":c:func:`PySys_ResetWarnOptions`:請改為清除 :data:`sys.warnoptions` 和 :" +"data:`!warnings.filters`。" + +#: ../../whatsnew/3.13.rst:2414 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:15 +msgid ":c:func:`Py_GetExecPrefix`: Get :data:`sys.exec_prefix` instead." +msgstr ":c:func:`Py_GetExecPrefix`:請改用 :data:`sys.exec_prefix`。" + +#: ../../whatsnew/3.13.rst:2416 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:17 +msgid ":c:func:`Py_GetPath`: Get :data:`sys.path` instead." +msgstr ":c:func:`Py_GetPath`:請改用 :data:`sys.path`。" + +#: ../../whatsnew/3.13.rst:2418 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:19 +msgid ":c:func:`Py_GetPrefix`: Get :data:`sys.prefix` instead." +msgstr ":c:func:`Py_GetPrefix`:請改用 :data:`sys.prefix`。" + +#: ../../whatsnew/3.13.rst:2420 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:21 +msgid ":c:func:`Py_GetProgramFullPath`: Get :data:`sys.executable` instead." +msgstr ":c:func:`Py_GetProgramFullPath`:請改用 :data:`sys.executable`。" + +#: ../../whatsnew/3.13.rst:2422 +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:23 +msgid ":c:func:`Py_GetProgramName`: Get :data:`sys.executable` instead." +msgstr ":c:func:`Py_GetProgramName`:請改用 :data:`sys.executable`。" + +#: ../../whatsnew/3.13.rst:2424 +#: ../../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." +msgstr "" +":c:func:`Py_GetPythonHome`:請改用 :c:member:`PyConfig.home` 或 :envvar:" +"`PYTHONHOME` 環境變數。" + +#: ../../whatsnew/3.13.rst:2428 +msgid "(Contributed by Victor Stinner in :gh:`105145`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2430 +msgid "" +":term:`Soft deprecate <soft deprecated>` the :c:func:`PyEval_GetBuiltins`, :" +"c:func:`PyEval_GetGlobals`, and :c:func:`PyEval_GetLocals` functions, which " +"return a :term:`borrowed reference`. (Soft deprecated as part of :pep:`667`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2436 +msgid "" +"Deprecate the :c:func:`PyImport_ImportModuleNoBlock` function, which is just " +"an alias to :c:func:`PyImport_ImportModule` since Python 3.3. (Contributed " +"by Victor Stinner in :gh:`105396`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2440 +msgid "" +":term:`Soft deprecate <soft deprecated>` the :c:func:`PyModule_AddObject` " +"function. It should be replaced with :c:func:`PyModule_Add` or :c:func:" +"`PyModule_AddObjectRef`. (Contributed by Serhiy Storchaka in :gh:`86493`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2446 +msgid "" +"Deprecate the old ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` types and the :c:" +"macro:`!Py_UNICODE_WIDE` define. Use the :c:type:`wchar_t` type directly " +"instead. Since Python 3.3, ``Py_UNICODE`` and ``PY_UNICODE_TYPE`` are just " +"aliases to :c:type:`!wchar_t`. (Contributed by Victor Stinner in :gh:" +"`105156`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2453 +msgid "" +"Deprecate the :c:func:`PyWeakref_GetObject` and :c:func:" +"`PyWeakref_GET_OBJECT` functions, which return a :term:`borrowed reference`. " +"Replace them with the new :c:func:`PyWeakref_GetRef` function, which returns " +"a :term:`strong reference`. The `pythoncapi-compat project`_ can be used to " +"get :c:func:`PyWeakref_GetRef` on Python 3.12 and older. (Contributed by " +"Victor Stinner in :gh:`105927`.)" +msgstr "" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:4 +msgid "" +"The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules " +"(:pep:`699`; :gh:`101193`)." +msgstr "" +":c:type:`PyDictObject` 中的 ``ma_version_tag`` 欄位,用於擴充模組 (:pep:" +"`699`;:gh:`101193`)。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:7 +msgid "" +"Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable " +"bases (:gh:`95388`)." +msgstr "" +"使用可變基底建立\\ :c:data:`不可變型別 <Py_TPFLAGS_IMMUTABLETYPE>` (:gh:" +"`95388`)。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:10 +msgid "" +"Functions to configure Python's initialization, deprecated in Python 3.11:" +msgstr "設定 Python 初始化的函式,Python 3.11 中已被棄用:" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:12 +msgid ":c:func:`!PySys_SetArgvEx()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgvEx()`:請改以 :c:member:`PyConfig.argv` 設定。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:14 +msgid ":c:func:`!PySys_SetArgv()`: Set :c:member:`PyConfig.argv` instead." +msgstr ":c:func:`!PySys_SetArgv()`:請改以 :c:member:`PyConfig.argv` 設定。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:16 +msgid "" +":c:func:`!Py_SetProgramName()`: Set :c:member:`PyConfig.program_name` " +"instead." +msgstr "" +":c:func:`!Py_SetProgramName()``:請改以 :c:member:`PyConfig.program_name` 設" +"定。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:18 +msgid ":c:func:`!Py_SetPythonHome()`: Set :c:member:`PyConfig.home` instead." +msgstr ":c:func:`!Py_SetPythonHome()`:請改以 :c:member:`PyConfig.home` 設定。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:21 +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:71 +msgid "" +"The :c:func:`Py_InitializeFromConfig` API should be used with :c:type:" +"`PyConfig` instead." +msgstr "" +":c:func:`Py_InitializeFromConfig` API 應該與 :c:type:`PyConfig` 一起使用。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:24 +msgid "Global configuration variables:" +msgstr "全域設定變數:" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:26 +msgid ":c:var:`Py_DebugFlag`: Use :c:member:`PyConfig.parser_debug` instead." +msgstr ":c:var:`Py_DebugFlag`:請改用 :c:member:`PyConfig.parser_debug`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:28 +msgid ":c:var:`Py_VerboseFlag`: Use :c:member:`PyConfig.verbose` instead." +msgstr ":c:var:`Py_VerboseFlag`:請改用 :c:member:`PyConfig.verbose`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:30 +msgid ":c:var:`Py_QuietFlag`: Use :c:member:`PyConfig.quiet` instead." +msgstr ":c:var:`Py_QuietFlag`:請改用 :c:member:`PyConfig.quiet`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:32 +msgid "" +":c:var:`Py_InteractiveFlag`: Use :c:member:`PyConfig.interactive` instead." +msgstr ":c:var:`Py_InteractiveFlag`:請改用 :c:member:`PyConfig.interactive`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:34 +msgid ":c:var:`Py_InspectFlag`: Use :c:member:`PyConfig.inspect` instead." +msgstr ":c:var:`Py_InspectFlag`:請改用 :c:member:`PyConfig.inspect`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:36 +msgid "" +":c:var:`Py_OptimizeFlag`: Use :c:member:`PyConfig.optimization_level` " +"instead." +msgstr "" +":c:var:`Py_OptimizeFlag`:請改用 :c:member:`PyConfig.optimization_level`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:38 +msgid ":c:var:`Py_NoSiteFlag`: Use :c:member:`PyConfig.site_import` instead." +msgstr ":c:var:`Py_NoSiteFlag`:請改用 :c:member:`PyConfig.site_import`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:40 +msgid "" +":c:var:`Py_BytesWarningFlag`: Use :c:member:`PyConfig.bytes_warning` instead." +msgstr "" +":c:var:`Py_BytesWarningFlag`:請改用 :c:member:`PyConfig.bytes_warning`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:42 +msgid "" +":c:var:`Py_FrozenFlag`: Use :c:member:`PyConfig.pathconfig_warnings` instead." +msgstr "" +":c:var:`Py_FrozenFlag`:請改用 :c:member:`PyConfig.pathconfig_warnings`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:44 +msgid "" +":c:var:`Py_IgnoreEnvironmentFlag`: Use :c:member:`PyConfig.use_environment` " +"instead." +msgstr "" +":c:var:`Py_IgnoreEnvironmentFlag`:請改用 :c:member:`PyConfig." +"use_environment`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:46 +msgid "" +":c:var:`Py_DontWriteBytecodeFlag`: Use :c:member:`PyConfig.write_bytecode` " +"instead." +msgstr "" +":c:var:`Py_DontWriteBytecodeFlag`:請改用 :c:member:`PyConfig." +"write_bytecode`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:48 +msgid "" +":c:var:`Py_NoUserSiteDirectory`: Use :c:member:`PyConfig." +"user_site_directory` instead." +msgstr "" +":c:var:`Py_NoUserSiteDirectory`:請改用 :c:member:`PyConfig." +"user_site_directory`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:50 +msgid "" +":c:var:`Py_UnbufferedStdioFlag`: Use :c:member:`PyConfig.buffered_stdio` " +"instead." +msgstr "" +":c:var:`Py_UnbufferedStdioFlag`:請改用 :c:member:`PyConfig.buffered_stdio`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:52 +msgid "" +":c:var:`Py_HashRandomizationFlag`: Use :c:member:`PyConfig.use_hash_seed` " +"and :c:member:`PyConfig.hash_seed` instead." +msgstr "" +":c:var:`Py_HashRandomizationFlag`:請改用 :c:member:`PyConfig.use_hash_seed` " +"和 :c:member:`PyConfig.hash_seed`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:55 +msgid ":c:var:`Py_IsolatedFlag`: Use :c:member:`PyConfig.isolated` instead." +msgstr ":c:var:`Py_IsolatedFlag`:請改用 :c:member:`PyConfig.isolated`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:57 +msgid "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`: Use :c:member:`PyPreConfig." +"legacy_windows_fs_encoding` instead." +msgstr "" +":c:var:`Py_LegacyWindowsFSEncodingFlag`:請改用 :c:member:`PyPreConfig." +"legacy_windows_fs_encoding`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:59 +msgid "" +":c:var:`Py_LegacyWindowsStdioFlag`: Use :c:member:`PyConfig." +"legacy_windows_stdio` instead." +msgstr "" +":c:var:`Py_LegacyWindowsStdioFlag`:請改用 :c:member:`PyConfig." +"legacy_windows_stdio`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:61 +msgid "" +":c:var:`!Py_FileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` instead." +msgstr "" +":c:var:`!Py_FileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:63 +msgid "" +":c:var:`!Py_HasFileSystemDefaultEncoding`: Use :c:member:`PyConfig." +"filesystem_encoding` instead." +msgstr "" +":c:var:`!Py_HasFileSystemDefaultEncoding`:請改用 :c:member:`PyConfig." +"filesystem_encoding`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:65 +msgid "" +":c:var:`!Py_FileSystemDefaultEncodeErrors`: Use :c:member:`PyConfig." +"filesystem_errors` instead." +msgstr "" +":c:var:`!Py_FileSystemDefaultEncodeErrors`:請改用 :c:member:`PyConfig." +"filesystem_errors`。" + +#: ../../deprecations/c-api-pending-removal-in-3.14.rst:67 +msgid "" +":c:var:`!Py_UTF8Mode`: Use :c:member:`PyPreConfig.utf8_mode` instead. (see :" +"c:func:`Py_PreInitialize`)" +msgstr "" +":c:var:`!Py_UTF8Mode`:請改用 :c:member:`PyPreConfig.utf8_mode`。(請見 :c:" +"func:`Py_PreInitialize`)" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:4 +msgid "The bundled copy of ``libmpdecimal``." +msgstr "``libmpdecimal`` 的打包副本 (bundled copy)。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:5 +msgid "" +"The :c:func:`PyImport_ImportModuleNoBlock`: Use :c:func:" +"`PyImport_ImportModule` instead." +msgstr "" +":c:func:`PyImport_ImportModuleNoBlock`:請改用 :c:func:" +"`PyImport_ImportModule`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:7 +msgid "" +":c:func:`PyWeakref_GetObject` and :c:func:`PyWeakref_GET_OBJECT`: Use :c:" +"func:`PyWeakref_GetRef` instead." +msgstr "" +":c:func:`PyWeakref_GetObject` 和 :c:func:`PyWeakref_GET_OBJECT`:請改用 :c:" +"func:`PyWeakref_GetRef`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:9 +msgid "" +":c:type:`Py_UNICODE` type and the :c:macro:`!Py_UNICODE_WIDE` macro: Use :c:" +"type:`wchar_t` instead." +msgstr "" +":c:type:`Py_UNICODE` 型別與 :c:macro:`!Py_UNICODE_WIDE` 巨集:請改用 :c:type:" +"`wchar_t`。" + +#: ../../deprecations/c-api-pending-removal-in-3.15.rst:11 +msgid "Python initialization functions:" +msgstr "Python 初始化函式:" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:4 +msgid "" +"The following APIs are deprecated and will be removed, although there is " +"currently no date scheduled for their removal." +msgstr "下列 API 已被棄用並將會被移除,不過目前尚未訂定移除日期。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:7 +msgid ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: Unneeded since Python 3.8." +msgstr ":c:macro:`Py_TPFLAGS_HAVE_FINALIZE`:自 Python 3.8 起不再需要" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:9 +msgid ":c:func:`PyErr_Fetch`: Use :c:func:`PyErr_GetRaisedException` instead." +msgstr ":c:func:`PyErr_Fetch`:請改用 :c:func:`PyErr_GetRaisedException`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:11 +msgid "" +":c:func:`PyErr_NormalizeException`: Use :c:func:`PyErr_GetRaisedException` " +"instead." +msgstr "" +":c:func:`PyErr_NormalizeException`:請改用 :c:func:" +"`PyErr_GetRaisedException`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:13 +msgid "" +":c:func:`PyErr_Restore`: Use :c:func:`PyErr_SetRaisedException` instead." +msgstr ":c:func:`PyErr_Restore`:請改用 :c:func:`PyErr_SetRaisedException`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:15 +msgid "" +":c:func:`PyModule_GetFilename`: Use :c:func:`PyModule_GetFilenameObject` " +"instead." +msgstr "" +":c:func:`PyModule_GetFilename`:請改用 :c:func:`PyModule_GetFilenameObject`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:17 +msgid ":c:func:`PyOS_AfterFork`: Use :c:func:`PyOS_AfterFork_Child` instead." +msgstr ":c:func:`PyOS_AfterFork`:請改用 :c:func:`PyOS_AfterFork_Child`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:19 +msgid "" +":c:func:`PySlice_GetIndicesEx`: Use :c:func:`PySlice_Unpack` and :c:func:" +"`PySlice_AdjustIndices` instead." +msgstr "" +":c:func:`PySlice_GetIndicesEx`:請改用 :c:func:`PySlice_Unpack` 和 :c:func:" +"`PySlice_AdjustIndices`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:21 +msgid "" +":c:func:`!PyUnicode_AsDecodedObject`: Use :c:func:`PyCodec_Decode` instead." +msgstr "" +":c:func:`!PyUnicode_AsDecodedObject`:請改用 :c:func:`PyCodec_Decode`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:23 +msgid "" +":c:func:`!PyUnicode_AsDecodedUnicode`: Use :c:func:`PyCodec_Decode` instead." +msgstr "" +":c:func:`!PyUnicode_AsDecodedUnicode`:請改用 :c:func:`PyCodec_Decode`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:25 +msgid "" +":c:func:`!PyUnicode_AsEncodedObject`: Use :c:func:`PyCodec_Encode` instead." +msgstr "" +":c:func:`!PyUnicode_AsEncodedObject`:請改用 :c:func:`PyCodec_Encode`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:27 +msgid "" +":c:func:`!PyUnicode_AsEncodedUnicode`: Use :c:func:`PyCodec_Encode` instead." +msgstr "" +":c:func:`!PyUnicode_AsEncodedUnicode`:請改用 :c:func:`PyCodec_Encode`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:29 +msgid ":c:func:`PyUnicode_READY`: Unneeded since Python 3.12" +msgstr ":c:func:`PyUnicode_READY`:自 Python 3.12 起不再需要" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:31 +msgid ":c:func:`!PyErr_Display`: Use :c:func:`PyErr_DisplayException` instead." +msgstr ":c:func:`!PyErr_Display`:請改用 :c:func:`PyErr_DisplayException`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:33 +msgid "" +":c:func:`!_PyErr_ChainExceptions`: Use :c:func:`!_PyErr_ChainExceptions1` " +"instead." +msgstr "" +":c:func:`!_PyErr_ChainExceptions`:請改用 ``_PyErr_ChainExceptions1``。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:35 +msgid "" +":c:member:`!PyBytesObject.ob_shash` member: call :c:func:`PyObject_Hash` " +"instead." +msgstr "" +":c:member:`!PyBytesObject.ob_shash` 成員:請改為呼叫 :c:func:" +"`PyObject_Hash`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:37 +msgid ":c:member:`!PyDictObject.ma_version_tag` member." +msgstr ":c:member:`!PyDictObject.ma_version_tag` 成員。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:38 +msgid "Thread Local Storage (TLS) API:" +msgstr "執行緒局部儲存 (Thread Local Storage, TLS) API:" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:40 +msgid "" +":c:func:`PyThread_create_key`: Use :c:func:`PyThread_tss_alloc` instead." +msgstr ":c:func:`PyThread_create_key`:請改用 :c:func:`PyThread_tss_alloc`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:42 +msgid ":c:func:`PyThread_delete_key`: Use :c:func:`PyThread_tss_free` instead." +msgstr ":c:func:`PyThread_delete_key`:請改用 :c:func:`PyThread_tss_free`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:44 +msgid "" +":c:func:`PyThread_set_key_value`: Use :c:func:`PyThread_tss_set` instead." +msgstr ":c:func:`PyThread_set_key_value`:請改用 :c:func:`PyThread_tss_set`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:46 +msgid "" +":c:func:`PyThread_get_key_value`: Use :c:func:`PyThread_tss_get` instead." +msgstr ":c:func:`PyThread_get_key_value`:請改用 :c:func:`PyThread_tss_get`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:48 +msgid "" +":c:func:`PyThread_delete_key_value`: Use :c:func:`PyThread_tss_delete` " +"instead." +msgstr "" +":c:func:`PyThread_delete_key_value`:請改用 :c:func:`PyThread_tss_delete`。" + +#: ../../deprecations/c-api-pending-removal-in-future.rst:50 +msgid ":c:func:`PyThread_ReInitTLS`: Unneeded since Python 3.7." +msgstr ":c:func:`PyThread_ReInitTLS`:自 Python 3.7 起不再需要。" + +#: ../../whatsnew/3.13.rst:2473 +msgid "Build Changes" +msgstr "建置變更" + +#: ../../whatsnew/3.13.rst:2475 +msgid "" +"``arm64-apple-ios`` and ``arm64-apple-ios-simulator`` are both now :pep:`11` " +"tier 3 platforms. (:ref:`PEP 730 <whatsnew313-platform-support>` written and " +"implementation contributed by Russell Keith-Magee in :gh:`114099`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2480 +msgid "" +"``aarch64-linux-android`` and ``x86_64-linux-android`` are both now :pep:" +"`11` tier 3 platforms. (:ref:`PEP 738 <whatsnew313-platform-support>` " +"written and implementation contributed by Malcolm Smith in :gh:`116622`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2485 +msgid "" +"``wasm32-wasi`` is now a :pep:`11` tier 2 platform. (Contributed by Brett " +"Cannon in :gh:`115192`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2488 +msgid "" +"``wasm32-emscripten`` is no longer a :pep:`11` supported platform. " +"(Contributed by Brett Cannon in :gh:`115192`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2491 +msgid "" +"Building CPython now requires a compiler with support for the C11 atomic " +"library, GCC built-in atomic functions, or MSVC interlocked intrinsics." +msgstr "" + +#: ../../whatsnew/3.13.rst:2494 +msgid "" +"Autoconf 2.71 and aclocal 1.16.4 are now required to regenerate the :file:" +"`configure` script. (Contributed by Christian Heimes in :gh:`89886`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2498 +msgid "" +"SQLite 3.15.2 or newer is required to build the :mod:`sqlite3` extension " +"module. (Contributed by Erlend Aasland in :gh:`105875`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2502 +msgid "" +"CPython now bundles the `mimalloc library`_ by default. It is licensed under " +"the MIT license; see :ref:`mimalloc license <mimalloc-license>`. The bundled " +"mimalloc has custom changes, see :gh:`113141` for details. (Contributed by " +"Dino Viehland in :gh:`109914`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2510 +msgid "" +"The :file:`configure` option :option:`--with-system-libmpdec` now defaults " +"to ``yes``. The bundled copy of ``libmpdecimal`` will be removed in Python " +"3.15." +msgstr "" + +#: ../../whatsnew/3.13.rst:2514 +msgid "" +"Python built with :file:`configure` :option:`--with-trace-refs` (tracing " +"references) is now ABI compatible with the Python release build and :ref:" +"`debug build <debug-build>`. (Contributed by Victor Stinner in :gh:`108634`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2519 +msgid "" +"On POSIX systems, the pkg-config (``.pc``) filenames now include the ABI " +"flags. For example, the free-threaded build generates ``python-3.13t.pc`` " +"and the debug build generates ``python-3.13d.pc``." +msgstr "" + +#: ../../whatsnew/3.13.rst:2523 +msgid "" +"The ``errno``, ``fcntl``, ``grp``, ``md5``, ``pwd``, ``resource``, " +"``termios``, ``winsound``, ``_ctypes_test``, ``_multiprocessing." +"posixshmem``, ``_scproxy``, ``_stat``, ``_statistics``, ``_testconsole``, " +"``_testimportmultiple`` and ``_uuid`` C extensions are now built with the :" +"ref:`limited C API <limited-c-api>`. (Contributed by Victor Stinner in :gh:" +"`85283`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2532 +msgid "Porting to Python 3.13" +msgstr "移植至 Python 3.13" + +#: ../../whatsnew/3.13.rst:2534 +msgid "" +"This section lists previously described changes and other bugfixes that may " +"require changes to your code." +msgstr "" + +#: ../../whatsnew/3.13.rst:2538 +msgid "Changes in the Python API" +msgstr "Python API 的變更" + +#: ../../whatsnew/3.13.rst:2542 +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:2545 +msgid "" +"Calling :func:`locals` in an :term:`optimized scope` now produces an " +"independent snapshot on each call, and hence no longer implicitly updates " +"previously returned references. Obtaining the legacy CPython behavior now " +"requires explicit calls to update the initially returned dictionary with the " +"results of subsequent calls to :func:`!locals`. Code execution functions " +"that implicitly target :func:`!locals` (such as ``exec`` and ``eval``) must " +"be passed an explicit namespace to access their results in an optimized " +"scope. (Changed as part of :pep:`667`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2554 +msgid "" +"Calling :func:`locals` from a comprehension at module or class scope " +"(including via ``exec`` or ``eval``) once more behaves as if the " +"comprehension were running as an independent nested function (i.e. the local " +"variables from the containing scope are not included). In Python 3.12, this " +"had changed to include the local variables from the containing scope when " +"implementing :pep:`709`. (Changed as part of :pep:`667`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2561 +msgid "" +"Accessing :attr:`FrameType.f_locals <frame.f_locals>` in an :term:`optimized " +"scope` now returns a write-through proxy rather than a snapshot that gets " +"updated at ill-specified times. If a snapshot is desired, it must be created " +"explicitly with ``dict`` or the proxy's ``.copy()`` method. (Changed as part " +"of :pep:`667`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2567 +msgid "" +":class:`functools.partial` now emits a :exc:`FutureWarning` when used as a " +"method. The behavior will change in future Python versions. Wrap it in :func:" +"`staticmethod` if you want to preserve the old behavior. (Contributed by " +"Serhiy Storchaka in :gh:`121027`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2573 +msgid "" +"An :exc:`OSError` is now raised by :func:`getpass.getuser` for any failure " +"to retrieve a username, instead of :exc:`ImportError` on non-Unix platforms " +"or :exc:`KeyError` on Unix platforms where the password database is empty." +msgstr "" + +#: ../../whatsnew/3.13.rst:2578 +msgid "" +"The value of the :attr:`!mode` attribute of :class:`gzip.GzipFile` is now a " +"string (``'rb'`` or ``'wb'``) instead of an integer (``1`` or ``2``). The " +"value of the :attr:`!mode` attribute of the readable file-like object " +"returned by :meth:`zipfile.ZipFile.open` is now ``'rb'`` instead of ``'r'``. " +"(Contributed by Serhiy Storchaka in :gh:`115961`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2584 +msgid "" +":class:`mailbox.Maildir` now ignores files with a leading dot (``.``). " +"(Contributed by Zackery Spytz in :gh:`65559`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2587 +msgid "" +":meth:`pathlib.Path.glob` and :meth:`~pathlib.Path.rglob` now return both " +"files and directories if a pattern that ends with \"``**``\" is given, " +"rather than directories only. Add a trailing slash to keep the previous " +"behavior and only match directories." +msgstr "" + +#: ../../whatsnew/3.13.rst:2592 +msgid "" +"The :mod:`threading` module now expects the :mod:`!_thread` module to have " +"an :func:`!_is_main_interpreter` function. This function takes no arguments " +"and returns ``True`` if the current interpreter is the main interpreter." +msgstr "" + +#: ../../whatsnew/3.13.rst:2597 +msgid "" +"Any library or application that provides a custom :mod:`!_thread` module " +"must provide :func:`!_is_main_interpreter`, just like the module's other " +"\"private\" attributes. (:gh:`112826`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2604 +msgid "Changes in the C API" +msgstr "C API 中的改動" + +#: ../../whatsnew/3.13.rst:2606 +msgid "" +"``Python.h`` no longer includes the ``<ieeefp.h>`` standard header. It was " +"included for the :c:func:`!finite` function which is now provided by the " +"``<math.h>`` header. It should now be included explicitly if needed. Remove " +"also the ``HAVE_IEEEFP_H`` macro. (Contributed by Victor Stinner in :gh:" +"`108765`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2612 +msgid "" +"``Python.h`` no longer includes these standard header files: ``<time.h>``, " +"``<sys/select.h>`` and ``<sys/time.h>``. If needed, they should now be " +"included explicitly. For example, ``<time.h>`` provides the :c:func:`!clock` " +"and :c:func:`!gmtime` functions, ``<sys/select.h>`` provides the :c:func:`!" +"select` function, and ``<sys/time.h>`` provides the :c:func:`!futimes`, :c:" +"func:`!gettimeofday` and :c:func:`!setitimer` functions. (Contributed by " +"Victor Stinner in :gh:`108765`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2620 +msgid "" +"On Windows, ``Python.h`` no longer includes the ``<stddef.h>`` standard " +"header file. If needed, it should now be included explicitly. For example, " +"it provides :c:func:`!offsetof` function, and ``size_t`` and ``ptrdiff_t`` " +"types. Including ``<stddef.h>`` explicitly was already needed by all other " +"platforms, the ``HAVE_STDDEF_H`` macro is only defined on Windows. " +"(Contributed by Victor Stinner in :gh:`108765`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2627 +msgid "" +"If the :c:macro:`Py_LIMITED_API` macro is defined, :c:macro:`!" +"Py_BUILD_CORE`, :c:macro:`!Py_BUILD_CORE_BUILTIN` and :c:macro:`!" +"Py_BUILD_CORE_MODULE` macros are now undefined by ``<Python.h>``. " +"(Contributed by Victor Stinner in :gh:`85283`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2632 +msgid "" +"The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and " +"``Py_TRASHCAN_SAFE_END`` were removed. They should be replaced by the new " +"macros ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``." +msgstr "" + +#: ../../whatsnew/3.13.rst:2636 +msgid "A ``tp_dealloc`` function that has the old macros, such as::" +msgstr "" + +#: ../../whatsnew/3.13.rst:2638 +msgid "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_SAFE_BEGIN(p);\n" +" ...\n" +" Py_TRASHCAN_SAFE_END\n" +"}" +msgstr "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_SAFE_BEGIN(p);\n" +" ...\n" +" Py_TRASHCAN_SAFE_END\n" +"}" + +#: ../../whatsnew/3.13.rst:2647 +msgid "should migrate to the new macros as follows::" +msgstr "" + +#: ../../whatsnew/3.13.rst:2649 +msgid "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_BEGIN(p, mytype_dealloc)\n" +" ...\n" +" Py_TRASHCAN_END\n" +"}" +msgstr "" +"static void\n" +"mytype_dealloc(mytype *p)\n" +"{\n" +" PyObject_GC_UnTrack(p);\n" +" Py_TRASHCAN_BEGIN(p, mytype_dealloc)\n" +" ...\n" +" Py_TRASHCAN_END\n" +"}" + +#: ../../whatsnew/3.13.rst:2658 +msgid "" +"Note that ``Py_TRASHCAN_BEGIN`` has a second argument which should be the " +"deallocation function it is in. The new macros were added in Python 3.8 and " +"the old macros were deprecated in Python 3.11. (Contributed by Irit Katriel " +"in :gh:`105111`.)" +msgstr "" + +#: ../../whatsnew/3.13.rst:2665 +msgid "" +":ref:`PEP 667 <whatsnew313-locals-semantics>` introduces several changes to " +"frame-related functions:" +msgstr "" + +#: ../../whatsnew/3.13.rst:2668 +msgid "" +"The effects of mutating the dictionary returned from :c:func:" +"`PyEval_GetLocals` in an :term:`optimized scope` have changed. New dict " +"entries added this way will now *only* be visible to subsequent :c:func:" +"`PyEval_GetLocals` calls in that frame, as :c:func:`PyFrame_GetLocals`, :" +"func:`locals`, and :attr:`FrameType.f_locals <frame.f_locals>` no longer " +"access the same underlying cached dictionary. Changes made to entries for " +"actual variable names and names added via the write-through proxy interfaces " +"will be overwritten on subsequent calls to :c:func:`PyEval_GetLocals` in " +"that frame. The recommended code update depends on how the function was " +"being used, so refer to the deprecation notice on the function for details." +msgstr "" + +#: ../../whatsnew/3.13.rst:2681 +msgid "" +"Calling :c:func:`PyFrame_GetLocals` in an :term:`optimized scope` now " +"returns a write-through proxy rather than a snapshot that gets updated at " +"ill-specified times. If a snapshot is desired, it must be created explicitly " +"(e.g. with :c:func:`PyDict_Copy`), or by calling the new :c:func:" +"`PyEval_GetFrameLocals` API." +msgstr "" + +#: ../../whatsnew/3.13.rst:2688 +msgid "" +":c:func:`!PyFrame_FastToLocals` and :c:func:`!PyFrame_FastToLocalsWithError` " +"no longer have any effect. Calling these functions has been redundant since " +"Python 3.11, when :c:func:`PyFrame_GetLocals` was first introduced." +msgstr "" + +#: ../../whatsnew/3.13.rst:2693 +msgid "" +":c:func:`!PyFrame_LocalsToFast` no longer has any effect. Calling this " +"function is redundant now that :c:func:`PyFrame_GetLocals` returns a write-" +"through proxy for :term:`optimized scopes <optimized scope>`." +msgstr "" + +#: ../../whatsnew/3.13.rst:2698 +msgid "Regression Test Changes" +msgstr "" + +#: ../../whatsnew/3.13.rst:2700 +msgid "" +"Python built with :file:`configure` :option:`--with-pydebug` now supports a :" +"option:`-X presite=package.module <-X>` command-line option. If used, it " +"specifies a module that should be imported early in the lifecycle of the " +"interpreter, before ``site.py`` is executed. (Contributed by Łukasz Langa " +"in :gh:`110769`.)" +msgstr "" diff --git a/whatsnew/3.2.po b/whatsnew/3.2.po index ca1a3a0fc5..a451e0c31c 100644 --- a/whatsnew/3.2.po +++ b/whatsnew/3.2.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -40,7 +40,7 @@ msgstr "" #: ../../whatsnew/3.2.rst:60 msgid ":pep:`392` - Python 3.2 Release Schedule" -msgstr "" +msgstr ":pep:`392` - Python 3.2 發佈時程" #: ../../whatsnew/3.2.rst:64 msgid "PEP 384: Defining a Stable ABI" @@ -1001,7 +1001,7 @@ msgstr "" #: ../../whatsnew/3.2.rst:664 msgid "" "The biggest news for Python 3.2 is that the :mod:`email` package, :mod:" -"`mailbox` module, and :mod:`nntplib` modules now work correctly with the " +"`mailbox` module, and :mod:`!nntplib` modules now work correctly with the " "bytes/text model in Python 3. For the first time, there is correct handling " "of messages with mixed encodings." msgstr "" @@ -2585,7 +2585,7 @@ msgstr "nntp" #: ../../whatsnew/3.2.rst:1680 msgid "" -"The :mod:`nntplib` module has a revamped implementation with better bytes " +"The :mod:`!nntplib` module has a revamped implementation with better bytes " "and text semantics as well as more practical APIs. These improvements break " "compatibility with the nntplib version in Python 3.1, which was partly " "dysfunctional in itself." @@ -2593,8 +2593,8 @@ msgstr "" #: ../../whatsnew/3.2.rst:1685 msgid "" -"Support for secure connections through both implicit (using :class:`nntplib." -"NNTP_SSL`) and explicit (using :meth:`nntplib.NNTP.starttls`) TLS has also " +"Support for secure connections through both implicit (using :class:`!nntplib." +"NNTP_SSL`) and explicit (using :meth:`!nntplib.NNTP.starttls`) TLS has also " "been added." msgstr "" @@ -4251,7 +4251,7 @@ msgstr "" #: ../../whatsnew/3.2.rst:2611 msgid "Porting to Python 3.2" -msgstr "" +msgstr "移植至 Python 3.2" #: ../../whatsnew/3.2.rst:2613 msgid "" @@ -4311,7 +4311,7 @@ msgstr "" #: ../../whatsnew/3.2.rst:2647 msgid "" -"The :mod:`nntplib` module was reworked extensively, meaning that its APIs " +"The :mod:`!nntplib` module was reworked extensively, meaning that its APIs " "are often incompatible with the 3.1 APIs." msgstr "" diff --git a/whatsnew/3.3.po b/whatsnew/3.3.po index 70e66733d1..bd3546dee4 100644 --- a/whatsnew/3.3.po +++ b/whatsnew/3.3.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 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-" @@ -27,14 +27,17 @@ msgid "" "Python 3.3 was released on September 29, 2012. For full details, see the " "`changelog <https://docs.python.org/3.3/whatsnew/changelog.html>`_." msgstr "" +"本文介紹了 Python 3.3 與 3.2 相比多了哪些新功能。Python 3.1 已於 2012 年 9 " +"月 29 日發布。完整詳情請見 `changelog <https://docs.python.org/3.3/whatsnew/" +"changelog.html>`_。" #: ../../whatsnew/3.3.rst:51 msgid ":pep:`398` - Python 3.3 Release Schedule" -msgstr ":pep:`398` - Python 3.3 發佈時間表" +msgstr ":pep:`398` - Python 3.3 發佈時程" #: ../../whatsnew/3.3.rst:55 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.3.rst:60 msgid "New syntax features:" @@ -216,7 +219,7 @@ msgid "" "dimensional NumPy-style arrays is explained." msgstr "" -#: ../../whatsnew/3.3.rst:161 ../../whatsnew/3.3.rst:1123 +#: ../../whatsnew/3.3.rst:161 ../../whatsnew/3.3.rst:1125 msgid "Features" msgstr "功能" @@ -253,7 +256,7 @@ msgid "" "now possible to reverse a memoryview in *O*\\ (1) by using a negative step." msgstr "" -#: ../../whatsnew/3.3.rst:180 ../../whatsnew/3.3.rst:1133 +#: ../../whatsnew/3.3.rst:180 ../../whatsnew/3.3.rst:1135 msgid "API changes" msgstr "API 變更" @@ -872,19 +875,19 @@ msgstr "" #: ../../whatsnew/3.3.rst:552 msgid "" -"Functions and class objects have a new ``__qualname__`` attribute " -"representing the \"path\" from the module top-level to their definition. " -"For global functions and classes, this is the same as ``__name__``. For " -"other functions and classes, it provides better information about where they " -"were actually defined, and how they might be accessible from the global " -"scope." +"Functions and class objects have a new :attr:`~definition.__qualname__` " +"attribute representing the \"path\" from the module top-level to their " +"definition. For global functions and classes, this is the same as :attr:" +"`~definition.__name__`. For other functions and classes, it provides better " +"information about where they were actually defined, and how they might be " +"accessible from the global scope." msgstr "" -#: ../../whatsnew/3.3.rst:558 +#: ../../whatsnew/3.3.rst:560 msgid "Example with (non-bound) methods::" msgstr "" -#: ../../whatsnew/3.3.rst:560 +#: ../../whatsnew/3.3.rst:562 msgid "" ">>> class C:\n" "... def meth(self):\n" @@ -904,11 +907,11 @@ msgstr "" ">>> C.meth.__qualname__\n" "'C.meth'" -#: ../../whatsnew/3.3.rst:569 +#: ../../whatsnew/3.3.rst:571 msgid "Example with nested classes::" msgstr "巢狀類別範例: ::" -#: ../../whatsnew/3.3.rst:571 +#: ../../whatsnew/3.3.rst:573 msgid "" ">>> class C:\n" "... class D:\n" @@ -938,11 +941,11 @@ msgstr "" ">>> C.D.meth.__qualname__\n" "'C.D.meth'" -#: ../../whatsnew/3.3.rst:585 +#: ../../whatsnew/3.3.rst:587 msgid "Example with nested functions::" msgstr "巢狀函式範例: ::" -#: ../../whatsnew/3.3.rst:587 +#: ../../whatsnew/3.3.rst:589 msgid "" ">>> def outer():\n" "... def inner():\n" @@ -964,13 +967,13 @@ msgstr "" ">>> outer().__qualname__\n" "'outer.<locals>.inner'" -#: ../../whatsnew/3.3.rst:597 +#: ../../whatsnew/3.3.rst:599 msgid "" "The string representation of those objects is also changed to include the " "new, more precise information::" msgstr "" -#: ../../whatsnew/3.3.rst:600 +#: ../../whatsnew/3.3.rst:602 msgid "" ">>> str(C.D)\n" "\"<class '__main__.C.D'>\"\n" @@ -982,19 +985,19 @@ msgstr "" ">>> str(C.D.meth)\n" "'<function C.D.meth at 0x7f46b9fe31e0>'" -#: ../../whatsnew/3.3.rst:607 +#: ../../whatsnew/3.3.rst:609 msgid ":pep:`3155` - Qualified name for classes and functions" msgstr "" -#: ../../whatsnew/3.3.rst:608 +#: ../../whatsnew/3.3.rst:610 msgid "PEP written and implemented by Antoine Pitrou." msgstr "由 Antoine Pitrou 撰寫 PEP 與實作。" -#: ../../whatsnew/3.3.rst:614 +#: ../../whatsnew/3.3.rst:616 msgid "PEP 412: Key-Sharing Dictionary" msgstr "" -#: ../../whatsnew/3.3.rst:616 +#: ../../whatsnew/3.3.rst:618 msgid "" "Dictionaries used for the storage of objects' attributes are now able to " "share part of their internal storage between each other (namely, the part " @@ -1002,19 +1005,19 @@ msgid "" "consumption of programs creating many instances of non-builtin types." msgstr "" -#: ../../whatsnew/3.3.rst:623 +#: ../../whatsnew/3.3.rst:625 msgid ":pep:`412` - Key-Sharing Dictionary" msgstr ":pep:`412` - 密鑰共享字典" -#: ../../whatsnew/3.3.rst:624 +#: ../../whatsnew/3.3.rst:626 msgid "PEP written and implemented by Mark Shannon." msgstr "由 Mark Shannon 撰寫 PEP 與實作。" -#: ../../whatsnew/3.3.rst:628 +#: ../../whatsnew/3.3.rst:630 msgid "PEP 362: Function Signature Object" msgstr "PEP 362:函式簽名物件" -#: ../../whatsnew/3.3.rst:630 +#: ../../whatsnew/3.3.rst:632 msgid "" "A new function :func:`inspect.signature` makes introspection of python " "callables easy and straightforward. A broad range of callables is " @@ -1026,11 +1029,11 @@ msgid "" "code that validates or amends calling signatures or arguments." msgstr "" -#: ../../whatsnew/3.3.rst:641 +#: ../../whatsnew/3.3.rst:643 msgid ":pep:`362`: - Function Signature Object" msgstr ":pep:`362`: - 函式簽名物件" -#: ../../whatsnew/3.3.rst:642 +#: ../../whatsnew/3.3.rst:644 msgid "" "PEP written by Brett Cannon, Yury Selivanov, Larry Hastings, Jiwon Seo; " "implemented by Yury Selivanov." @@ -1038,11 +1041,11 @@ msgstr "" "PEP 由 Brett Cannon、Yury Selivanov、Larry Hastings、Jiwon Seo 撰寫;由 Yury " "Selivanov 實作。" -#: ../../whatsnew/3.3.rst:647 +#: ../../whatsnew/3.3.rst:649 msgid "PEP 421: Adding sys.implementation" msgstr "PEP 421:新增 sys.implementation" -#: ../../whatsnew/3.3.rst:649 +#: ../../whatsnew/3.3.rst:651 msgid "" "A new attribute on the :mod:`sys` module exposes details specific to the " "implementation of the currently running interpreter. The initial set of " @@ -1050,7 +1053,7 @@ msgid "" "``hexversion``, and ``cache_tag``." msgstr "" -#: ../../whatsnew/3.3.rst:654 +#: ../../whatsnew/3.3.rst:656 msgid "" "The intention of ``sys.implementation`` is to consolidate into one namespace " "the implementation-specific data used by the standard library. This allows " @@ -1060,7 +1063,7 @@ msgid "" "ratio will shift in order to make the standard library more portable." msgstr "" -#: ../../whatsnew/3.3.rst:661 +#: ../../whatsnew/3.3.rst:663 msgid "" "One example of improved standard library portability is ``cache_tag``. As " "of Python 3.3, ``sys.implementation.cache_tag`` is used by :mod:`importlib` " @@ -1069,11 +1072,11 @@ msgid "" "control the caching behavior for modules." msgstr "" -#: ../../whatsnew/3.3.rst:668 +#: ../../whatsnew/3.3.rst:670 msgid "SimpleNamespace" msgstr "SimpleNamespace" -#: ../../whatsnew/3.3.rst:670 +#: ../../whatsnew/3.3.rst:672 msgid "" "The implementation of ``sys.implementation`` also introduces a new type to " "Python: :class:`types.SimpleNamespace`. In contrast to a mapping-based " @@ -1083,19 +1086,19 @@ msgid "" "through normal attribute access." msgstr "" -#: ../../whatsnew/3.3.rst:679 +#: ../../whatsnew/3.3.rst:681 msgid ":pep:`421` - Adding sys.implementation" msgstr ":pep:`421` - 新增 sys.implementation" -#: ../../whatsnew/3.3.rst:680 +#: ../../whatsnew/3.3.rst:682 msgid "PEP written and implemented by Eric Snow." msgstr "由 Eric Snow 撰寫 PEP 與實作。" -#: ../../whatsnew/3.3.rst:686 +#: ../../whatsnew/3.3.rst:688 msgid "Using importlib as the Implementation of Import" msgstr "使用 importlib 作為 import 的實作" -#: ../../whatsnew/3.3.rst:687 +#: ../../whatsnew/3.3.rst:689 msgid "" ":issue:`2377` - Replace __import__ w/ importlib.__import__ :issue:`13959` - " "Re-implement parts of :mod:`!imp` in pure Python :issue:`14605` - Make " @@ -1103,7 +1106,7 @@ msgid "" "and __package__" msgstr "" -#: ../../whatsnew/3.3.rst:692 +#: ../../whatsnew/3.3.rst:694 msgid "" "The :func:`__import__` function is now powered by :func:`importlib." "__import__`. This work leads to the completion of \"phase 2\" of :pep:`302`. " @@ -1115,7 +1118,7 @@ msgid "" "import, allowing for future growth to occur." msgstr "" -#: ../../whatsnew/3.3.rst:701 +#: ../../whatsnew/3.3.rst:703 msgid "" "For the common user, there should be no visible change in semantics. For " "those whose code currently manipulates import or calls import " @@ -1123,18 +1126,18 @@ msgid "" "covered in the `Porting Python code`_ section of this document." msgstr "" -#: ../../whatsnew/3.3.rst:707 +#: ../../whatsnew/3.3.rst:709 msgid "New APIs" msgstr "新 API" -#: ../../whatsnew/3.3.rst:708 +#: ../../whatsnew/3.3.rst:710 msgid "" "One of the large benefits of this work is the exposure of what goes into " "making the import statement work. That means the various importers that were " "once implicit are now fully exposed as part of the :mod:`importlib` package." msgstr "" -#: ../../whatsnew/3.3.rst:712 +#: ../../whatsnew/3.3.rst:714 msgid "" "The abstract base classes defined in :mod:`importlib.abc` have been expanded " "to properly delineate between :term:`meta path finders <meta path finder>` " @@ -1145,14 +1148,14 @@ msgid "" "requirements." msgstr "" -#: ../../whatsnew/3.3.rst:720 +#: ../../whatsnew/3.3.rst:722 msgid "" "In terms of finders, :class:`importlib.machinery.FileFinder` exposes the " "mechanism used to search for source and bytecode files of a module. " "Previously this class was an implicit member of :data:`sys.path_hooks`." msgstr "" -#: ../../whatsnew/3.3.rst:724 +#: ../../whatsnew/3.3.rst:726 msgid "" "For loaders, the new abstract base class :class:`importlib.abc.FileLoader` " "helps write a loader that uses the file system as the storage mechanism for " @@ -1162,7 +1165,7 @@ msgid "" "ExtensionFileLoader`) are now available for direct use." msgstr "" -#: ../../whatsnew/3.3.rst:732 +#: ../../whatsnew/3.3.rst:734 msgid "" ":exc:`ImportError` now has ``name`` and ``path`` attributes which are set " "when there is relevant data to provide. The message for failed imports will " @@ -1170,24 +1173,24 @@ msgid "" "the module's name." msgstr "" -#: ../../whatsnew/3.3.rst:737 +#: ../../whatsnew/3.3.rst:739 msgid "" "The :func:`importlib.invalidate_caches` function will now call the method " "with the same name on all finders cached in :data:`sys.path_importer_cache` " "to help clean up any stored state as necessary." msgstr "" -#: ../../whatsnew/3.3.rst:742 +#: ../../whatsnew/3.3.rst:744 msgid "Visible Changes" msgstr "明顯的變更" -#: ../../whatsnew/3.3.rst:744 +#: ../../whatsnew/3.3.rst:746 msgid "" "For potential required changes to code, see the `Porting Python code`_ " "section." msgstr "" -#: ../../whatsnew/3.3.rst:747 +#: ../../whatsnew/3.3.rst:749 msgid "" "Beyond the expanse of what :mod:`importlib` now exposes, there are other " "visible changes to import. The biggest is that :data:`sys.meta_path` and :" @@ -1198,7 +1201,7 @@ msgid "" "fit one's needs." msgstr "" -#: ../../whatsnew/3.3.rst:754 +#: ../../whatsnew/3.3.rst:756 msgid "" "Another change is that all modules have a ``__loader__`` attribute, storing " "the loader used to create the module. :pep:`302` has been updated to make " @@ -1208,14 +1211,14 @@ msgid "" "load." msgstr "" -#: ../../whatsnew/3.3.rst:760 +#: ../../whatsnew/3.3.rst:762 msgid "" "Loaders are also now expected to set the ``__package__`` attribute from :pep:" "`366`. Once again, import itself is already setting this on all loaders " "from :mod:`importlib` and import itself is setting the attribute post-load." msgstr "" -#: ../../whatsnew/3.3.rst:764 +#: ../../whatsnew/3.3.rst:766 msgid "" "``None`` is now inserted into :data:`sys.path_importer_cache` when no finder " "can be found on :data:`sys.path_hooks`. Since :class:`!imp.NullImporter` is " @@ -1223,66 +1226,66 @@ msgid "" "upon to always be available to use as a value representing no finder found." msgstr "" -#: ../../whatsnew/3.3.rst:769 +#: ../../whatsnew/3.3.rst:771 msgid "" "All other changes relate to semantic changes which should be taken into " "consideration when updating code for Python 3.3, and thus should be read " "about in the `Porting Python code`_ section of this document." msgstr "" -#: ../../whatsnew/3.3.rst:773 +#: ../../whatsnew/3.3.rst:775 msgid "(Implementation by Brett Cannon)" msgstr "(由 Brett Cannon 實作)" -#: ../../whatsnew/3.3.rst:777 +#: ../../whatsnew/3.3.rst:779 msgid "Other Language Changes" msgstr "其他語言更動" -#: ../../whatsnew/3.3.rst:779 +#: ../../whatsnew/3.3.rst:781 msgid "Some smaller changes made to the core Python language are:" msgstr "對核心 Python 語言所做的一些較小的更改包括:" -#: ../../whatsnew/3.3.rst:781 +#: ../../whatsnew/3.3.rst:783 msgid "" "Added support for Unicode name aliases and named sequences. Both :func:" "`unicodedata.lookup` and ``'\\N{...}'`` now resolve name aliases, and :func:" "`unicodedata.lookup` resolves named sequences too." msgstr "" -#: ../../whatsnew/3.3.rst:785 +#: ../../whatsnew/3.3.rst:787 msgid "(Contributed by Ezio Melotti in :issue:`12753`.)" msgstr "(由 Ezio Melotti 在 :issue:`12753` 中貢獻。)" -#: ../../whatsnew/3.3.rst:787 +#: ../../whatsnew/3.3.rst:789 msgid "Unicode database updated to UCD version 6.1.0" msgstr "Unicode 資料庫更新至 UCD 版本 6.1.0" -#: ../../whatsnew/3.3.rst:789 +#: ../../whatsnew/3.3.rst:791 msgid "" "Equality comparisons on :func:`range` objects now return a result reflecting " "the equality of the underlying sequences generated by those range objects. (:" "issue:`13201`)" msgstr "" -#: ../../whatsnew/3.3.rst:793 +#: ../../whatsnew/3.3.rst:795 msgid "" "The ``count()``, ``find()``, ``rfind()``, ``index()`` and ``rindex()`` " "methods of :class:`bytes` and :class:`bytearray` objects now accept an " "integer between 0 and 255 as their first argument." msgstr "" -#: ../../whatsnew/3.3.rst:797 +#: ../../whatsnew/3.3.rst:799 msgid "(Contributed by Petri Lehtinen in :issue:`12170`.)" msgstr "(由 Petri Lehtinen 在 :issue:`12170` 中貢獻。)" -#: ../../whatsnew/3.3.rst:799 +#: ../../whatsnew/3.3.rst:801 msgid "" "The ``rjust()``, ``ljust()``, and ``center()`` methods of :class:`bytes` " "and :class:`bytearray` now accept a :class:`bytearray` for the ``fill`` " "argument. (Contributed by Petri Lehtinen in :issue:`12380`.)" msgstr "" -#: ../../whatsnew/3.3.rst:803 +#: ../../whatsnew/3.3.rst:805 msgid "" "New methods have been added to :class:`list` and :class:`bytearray`: " "``copy()`` and ``clear()`` (:issue:`10516`). Consequently, :class:" @@ -1290,40 +1293,40 @@ msgid "" "abc.MutableSequence.clear` method (:issue:`11388`)." msgstr "" -#: ../../whatsnew/3.3.rst:808 +#: ../../whatsnew/3.3.rst:810 msgid "" "Raw bytes literals can now be written ``rb\"...\"`` as well as ``br\"...\"``." msgstr "" -#: ../../whatsnew/3.3.rst:810 +#: ../../whatsnew/3.3.rst:812 msgid "(Contributed by Antoine Pitrou in :issue:`13748`.)" msgstr "(由 Antoine Pitrou 在 :issue:`13748` 中貢獻。)" -#: ../../whatsnew/3.3.rst:812 +#: ../../whatsnew/3.3.rst:814 msgid "" ":meth:`dict.setdefault` now does only one lookup for the given key, making " "it atomic when used with built-in types." msgstr "" -#: ../../whatsnew/3.3.rst:815 +#: ../../whatsnew/3.3.rst:817 msgid "(Contributed by Filip Gruszczyński in :issue:`13521`.)" msgstr "(由 Filip Gruszczyński 在 :issue:`13521` 中貢獻。)" -#: ../../whatsnew/3.3.rst:817 +#: ../../whatsnew/3.3.rst:819 msgid "" "The error messages produced when a function call does not match the function " "signature have been significantly improved." msgstr "" -#: ../../whatsnew/3.3.rst:820 +#: ../../whatsnew/3.3.rst:822 msgid "(Contributed by Benjamin Peterson.)" msgstr "(由 Benjamin Peterson 貢獻。)" -#: ../../whatsnew/3.3.rst:824 +#: ../../whatsnew/3.3.rst:826 msgid "A Finer-Grained Import Lock" msgstr "" -#: ../../whatsnew/3.3.rst:826 +#: ../../whatsnew/3.3.rst:828 msgid "" "Previous versions of CPython have always relied on a global import lock. " "This led to unexpected annoyances, such as deadlocks when importing a module " @@ -1332,7 +1335,7 @@ msgid "" "`PyImport_ImportModuleNoBlock` C API function." msgstr "" -#: ../../whatsnew/3.3.rst:832 +#: ../../whatsnew/3.3.rst:834 msgid "" "In Python 3.3, importing a module takes a per-module lock. This correctly " "serializes importation of a given module from multiple threads (preventing " @@ -1340,15 +1343,15 @@ msgid "" "aforementioned annoyances." msgstr "" -#: ../../whatsnew/3.3.rst:837 +#: ../../whatsnew/3.3.rst:839 msgid "(Contributed by Antoine Pitrou in :issue:`9260`.)" msgstr "(由 Antoine Pitrou 在 :issue:`9260` 中貢獻。)" -#: ../../whatsnew/3.3.rst:841 +#: ../../whatsnew/3.3.rst:843 msgid "Builtin functions and types" msgstr "內建函式和型別" -#: ../../whatsnew/3.3.rst:843 +#: ../../whatsnew/3.3.rst:845 msgid "" ":func:`open` gets a new *opener* parameter: the underlying file descriptor " "for the file object is then obtained by calling *opener* with (*file*, " @@ -1357,26 +1360,26 @@ msgid "" "the file already exists." msgstr "" -#: ../../whatsnew/3.3.rst:848 +#: ../../whatsnew/3.3.rst:850 msgid "" ":func:`print`: added the *flush* keyword argument. If the *flush* keyword " "argument is true, the stream is forcibly flushed." msgstr "" -#: ../../whatsnew/3.3.rst:850 +#: ../../whatsnew/3.3.rst:852 msgid "" ":func:`hash`: hash randomization is enabled by default, see :meth:`object." "__hash__` and :envvar:`PYTHONHASHSEED`." msgstr "" -#: ../../whatsnew/3.3.rst:852 +#: ../../whatsnew/3.3.rst:854 msgid "" "The :class:`str` type gets a new :meth:`~str.casefold` method: return a " "casefolded copy of the string, casefolded strings may be used for caseless " "matching. For example, ``'ß'.casefold()`` returns ``'ss'``." msgstr "" -#: ../../whatsnew/3.3.rst:855 +#: ../../whatsnew/3.3.rst:857 msgid "" "The sequence documentation has been substantially rewritten to better " "explain the binary/text sequence distinction and to provide specific " @@ -1384,15 +1387,15 @@ msgid "" "`4966`)." msgstr "" -#: ../../whatsnew/3.3.rst:862 +#: ../../whatsnew/3.3.rst:864 msgid "New Modules" msgstr "新模組" -#: ../../whatsnew/3.3.rst:865 +#: ../../whatsnew/3.3.rst:867 msgid "faulthandler" msgstr "faulthandler" -#: ../../whatsnew/3.3.rst:867 +#: ../../whatsnew/3.3.rst:869 msgid "" "This new debug module :mod:`faulthandler` contains functions to dump Python " "tracebacks explicitly, on a fault (a crash like a segmentation fault), after " @@ -1403,11 +1406,11 @@ msgid "" "by using :option:`-X` ``faulthandler`` command line option." msgstr "" -#: ../../whatsnew/3.3.rst:875 +#: ../../whatsnew/3.3.rst:877 msgid "Example of a segmentation fault on Linux:" msgstr "" -#: ../../whatsnew/3.3.rst:877 +#: ../../whatsnew/3.3.rst:879 msgid "" "$ python -q -X faulthandler\n" ">>> import ctypes\n" @@ -1431,45 +1434,45 @@ msgstr "" " File \"<stdin>\", line 1 in <module>\n" "Segmentation fault" -#: ../../whatsnew/3.3.rst:891 +#: ../../whatsnew/3.3.rst:893 msgid "ipaddress" msgstr "ipaddress" -#: ../../whatsnew/3.3.rst:893 +#: ../../whatsnew/3.3.rst:895 msgid "" "The new :mod:`ipaddress` module provides tools for creating and manipulating " "objects representing IPv4 and IPv6 addresses, networks and interfaces (i.e. " "an IP address associated with a specific IP subnet)." msgstr "" -#: ../../whatsnew/3.3.rst:897 +#: ../../whatsnew/3.3.rst:899 msgid "(Contributed by Google and Peter Moody in :pep:`3144`.)" msgstr "(由 Google 和 Peter Moody 在 :pep:`3144` 中貢獻。)" -#: ../../whatsnew/3.3.rst:900 +#: ../../whatsnew/3.3.rst:902 msgid "lzma" msgstr "lzma" -#: ../../whatsnew/3.3.rst:902 +#: ../../whatsnew/3.3.rst:904 msgid "" "The newly added :mod:`lzma` module provides data compression and " "decompression using the LZMA algorithm, including support for the ``.xz`` " "and ``.lzma`` file formats." msgstr "" -#: ../../whatsnew/3.3.rst:906 +#: ../../whatsnew/3.3.rst:908 msgid "(Contributed by Nadeem Vawda and Per Øyvind Karlsen in :issue:`6715`.)" msgstr "(由 Nadeem Vawda 和 Per Øyvind Karlsen 在 :issue:`6715` 中貢獻。)" -#: ../../whatsnew/3.3.rst:910 +#: ../../whatsnew/3.3.rst:912 msgid "Improved Modules" msgstr "改進的模組" -#: ../../whatsnew/3.3.rst:913 +#: ../../whatsnew/3.3.rst:915 msgid "abc" msgstr "abc" -#: ../../whatsnew/3.3.rst:915 +#: ../../whatsnew/3.3.rst:917 msgid "" "Improved support for abstract base classes containing descriptors composed " "with abstract methods. The recommended approach to declaring abstract " @@ -1477,7 +1480,7 @@ msgid "" "updated property. The built-in descriptors have been updated accordingly." msgstr "" -#: ../../whatsnew/3.3.rst:920 ../../whatsnew/3.3.rst:2246 +#: ../../whatsnew/3.3.rst:922 ../../whatsnew/3.3.rst:2248 msgid "" ":class:`abc.abstractproperty` has been deprecated, use :class:`property` " "with :func:`abc.abstractmethod` instead." @@ -1485,7 +1488,7 @@ msgstr "" ":class:`abc.abstractproperty` 已被棄用,請改 :class:`property` 和 :func:`abc." "abstractmethod`。" -#: ../../whatsnew/3.3.rst:922 ../../whatsnew/3.3.rst:2248 +#: ../../whatsnew/3.3.rst:924 ../../whatsnew/3.3.rst:2250 msgid "" ":class:`abc.abstractclassmethod` has been deprecated, use :class:" "`classmethod` with :func:`abc.abstractmethod` instead." @@ -1493,7 +1496,7 @@ msgstr "" ":class:`abc.abstractclassmethod` 已被棄用,請改用 :class:`classmethod` 和 :" "func:`abc.abstractmethod`。" -#: ../../whatsnew/3.3.rst:924 ../../whatsnew/3.3.rst:2250 +#: ../../whatsnew/3.3.rst:926 ../../whatsnew/3.3.rst:2252 msgid "" ":class:`abc.abstractstaticmethod` has been deprecated, use :class:" "`staticmethod` with :func:`abc.abstractmethod` instead." @@ -1501,35 +1504,35 @@ msgstr "" ":class:`abc.abstractstaticmethod` 已被棄用,請改用 :class:`staticmethod` 和 :" "func:`abc.abstractmethod`。" -#: ../../whatsnew/3.3.rst:927 +#: ../../whatsnew/3.3.rst:929 msgid "(Contributed by Darren Dale in :issue:`11610`.)" msgstr "(由 Darren Dale 在 :issue:`11610` 中貢獻。)" -#: ../../whatsnew/3.3.rst:929 +#: ../../whatsnew/3.3.rst:931 msgid "" ":meth:`abc.ABCMeta.register` now returns the registered subclass, which " "means it can now be used as a class decorator (:issue:`10868`)." msgstr "" -#: ../../whatsnew/3.3.rst:934 +#: ../../whatsnew/3.3.rst:936 msgid "array" msgstr "array" -#: ../../whatsnew/3.3.rst:936 +#: ../../whatsnew/3.3.rst:938 msgid "" "The :mod:`array` module supports the :c:expr:`long long` type using ``q`` " "and ``Q`` type codes." msgstr "" -#: ../../whatsnew/3.3.rst:939 +#: ../../whatsnew/3.3.rst:941 msgid "(Contributed by Oren Tirosh and Hirokazu Yamamoto in :issue:`1172711`.)" msgstr "(由 Oren Tirosh 和 Hirokazu Yamamoto 在 :issue:`1172711` 中貢獻。)" -#: ../../whatsnew/3.3.rst:943 +#: ../../whatsnew/3.3.rst:945 msgid "base64" msgstr "base64" -#: ../../whatsnew/3.3.rst:945 +#: ../../whatsnew/3.3.rst:947 msgid "" "ASCII-only Unicode strings are now accepted by the decoding functions of " "the :mod:`base64` modern interface. For example, ``base64." @@ -1537,44 +1540,44 @@ msgid "" "issue:`13641`.)" msgstr "" -#: ../../whatsnew/3.3.rst:951 +#: ../../whatsnew/3.3.rst:953 msgid "binascii" msgstr "binascii" -#: ../../whatsnew/3.3.rst:953 +#: ../../whatsnew/3.3.rst:955 msgid "" "In addition to the binary objects they normally accept, the ``a2b_`` " "functions now all also accept ASCII-only strings as input. (Contributed by " "Antoine Pitrou in :issue:`13637`.)" msgstr "" -#: ../../whatsnew/3.3.rst:959 +#: ../../whatsnew/3.3.rst:961 msgid "bz2" msgstr "bz2" -#: ../../whatsnew/3.3.rst:961 +#: ../../whatsnew/3.3.rst:963 msgid "" "The :mod:`bz2` module has been rewritten from scratch. In the process, " "several new features have been added:" msgstr "" -#: ../../whatsnew/3.3.rst:964 +#: ../../whatsnew/3.3.rst:966 msgid "" "New :func:`bz2.open` function: open a bzip2-compressed file in binary or " "text mode." msgstr "" -#: ../../whatsnew/3.3.rst:967 +#: ../../whatsnew/3.3.rst:969 msgid "" ":class:`bz2.BZ2File` can now read from and write to arbitrary file-like " "objects, by means of its constructor's *fileobj* argument." msgstr "" -#: ../../whatsnew/3.3.rst:970 +#: ../../whatsnew/3.3.rst:972 msgid "(Contributed by Nadeem Vawda in :issue:`5863`.)" msgstr "(由 Nadeem Vawda 在 :issue:`5863` 中貢獻。)" -#: ../../whatsnew/3.3.rst:972 +#: ../../whatsnew/3.3.rst:974 msgid "" ":class:`bz2.BZ2File` and :func:`bz2.decompress` can now decompress multi-" "stream inputs (such as those produced by the :program:`pbzip2` tool). :class:" @@ -1582,21 +1585,21 @@ msgid "" "``'a'`` (append) mode." msgstr "" -#: ../../whatsnew/3.3.rst:977 +#: ../../whatsnew/3.3.rst:979 msgid "(Contributed by Nir Aides in :issue:`1625`.)" msgstr "(由 Nir Aides 在 :issue:`1625` 中貢獻。)" -#: ../../whatsnew/3.3.rst:979 +#: ../../whatsnew/3.3.rst:981 msgid "" ":class:`bz2.BZ2File` now implements all of the :class:`io.BufferedIOBase` " "API, except for the :meth:`detach` and :meth:`truncate` methods." msgstr "" -#: ../../whatsnew/3.3.rst:984 +#: ../../whatsnew/3.3.rst:986 msgid "codecs" msgstr "codecs" -#: ../../whatsnew/3.3.rst:986 +#: ../../whatsnew/3.3.rst:988 msgid "" "The :mod:`~encodings.mbcs` codec has been rewritten to handle correctly " "``replace`` and ``ignore`` error handlers on all Windows versions. The :mod:" @@ -1604,7 +1607,7 @@ msgid "" "``replace`` to encode and ``ignore`` to decode." msgstr "" -#: ../../whatsnew/3.3.rst:991 +#: ../../whatsnew/3.3.rst:993 msgid "" "A new Windows-only codec has been added: ``cp65001`` (:issue:`13216`). It is " "the Windows code page 65001 (Windows UTF-8, ``CP_UTF8``). For example, it " @@ -1612,7 +1615,7 @@ msgid "" "(e.g., using ``chcp 65001`` command)." msgstr "" -#: ../../whatsnew/3.3.rst:996 +#: ../../whatsnew/3.3.rst:998 msgid "" "Multibyte CJK decoders now resynchronize faster. They only ignore the first " "byte of an invalid byte sequence. For example, ``b'\\xff\\n'." @@ -1620,17 +1623,17 @@ msgid "" "character." msgstr "" -#: ../../whatsnew/3.3.rst:1000 +#: ../../whatsnew/3.3.rst:1002 msgid "(:issue:`12016`)" msgstr "(:issue:`12016`)" -#: ../../whatsnew/3.3.rst:1002 +#: ../../whatsnew/3.3.rst:1004 msgid "" "Incremental CJK codec encoders are no longer reset at each call to their " "encode() methods. For example::" msgstr "" -#: ../../whatsnew/3.3.rst:1005 +#: ../../whatsnew/3.3.rst:1007 msgid "" ">>> import codecs\n" ">>> encoder = codecs.getincrementalencoder('hz')('strict')\n" @@ -1644,32 +1647,32 @@ msgstr "" "Bye.')\n" "b'~{NpJ)l6HK!#~} Bye.'" -#: ../../whatsnew/3.3.rst:1010 +#: ../../whatsnew/3.3.rst:1012 msgid "" "This example gives ``b'~{Np~}~{J)~}~{l6~}~{HK~}~{!#~} Bye.'`` with older " "Python versions." msgstr "" -#: ../../whatsnew/3.3.rst:1013 +#: ../../whatsnew/3.3.rst:1015 msgid "(:issue:`12100`)" msgstr "(:issue:`12100`)" -#: ../../whatsnew/3.3.rst:1015 +#: ../../whatsnew/3.3.rst:1017 msgid "The ``unicode_internal`` codec has been deprecated." msgstr "``unicode_internal`` 編解碼器已被棄用。" -#: ../../whatsnew/3.3.rst:1019 +#: ../../whatsnew/3.3.rst:1021 msgid "collections" msgstr "collections" -#: ../../whatsnew/3.3.rst:1021 +#: ../../whatsnew/3.3.rst:1023 msgid "" "Addition of a new :class:`~collections.ChainMap` class to allow treating a " "number of mappings as a single unit. (Written by Raymond Hettinger for :" "issue:`11089`, made public in :issue:`11297`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1025 +#: ../../whatsnew/3.3.rst:1027 msgid "" "The abstract base classes have been moved in a new :mod:`collections.abc` " "module, to better differentiate between the abstract and the concrete " @@ -1677,18 +1680,18 @@ msgid "" "`collections` module to preserve existing imports. (:issue:`11085`)" msgstr "" -#: ../../whatsnew/3.3.rst:1032 +#: ../../whatsnew/3.3.rst:1034 msgid "" "The :class:`~collections.Counter` class now supports the unary ``+`` and ``-" "`` operators, as well as the in-place operators ``+=``, ``-=``, ``|=``, and " "``&=``. (Contributed by Raymond Hettinger in :issue:`13121`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1038 +#: ../../whatsnew/3.3.rst:1040 msgid "contextlib" msgstr "contextlib" -#: ../../whatsnew/3.3.rst:1040 +#: ../../whatsnew/3.3.rst:1042 msgid "" ":class:`~contextlib.ExitStack` now provides a solid foundation for " "programmatic manipulation of context managers and similar cleanup " @@ -1700,46 +1703,46 @@ msgid "" "module)." msgstr "" -#: ../../whatsnew/3.3.rst:1049 +#: ../../whatsnew/3.3.rst:1051 msgid "(:issue:`13585`)" msgstr "(:issue:`13585`)" -#: ../../whatsnew/3.3.rst:1053 +#: ../../whatsnew/3.3.rst:1055 msgid "crypt" msgstr "crypt" -#: ../../whatsnew/3.3.rst:1055 +#: ../../whatsnew/3.3.rst:1057 msgid "" -"Addition of salt and modular crypt format (hashing method) and the :func:" -"`~crypt.mksalt` function to the :mod:`crypt` module." +"Addition of salt and modular crypt format (hashing method) and the :func:`!" +"mksalt` function to the :mod:`!crypt` module." msgstr "" -#: ../../whatsnew/3.3.rst:1058 +#: ../../whatsnew/3.3.rst:1060 msgid "(:issue:`10924`)" msgstr "(:issue:`10924`)" -#: ../../whatsnew/3.3.rst:1061 +#: ../../whatsnew/3.3.rst:1063 msgid "curses" msgstr "curses" -#: ../../whatsnew/3.3.rst:1063 +#: ../../whatsnew/3.3.rst:1065 msgid "" "If the :mod:`curses` module is linked to the ncursesw library, use Unicode " "functions when Unicode strings or characters are passed (e.g. :c:func:" "`waddwstr`), and bytes functions otherwise (e.g. :c:func:`waddstr`)." msgstr "" -#: ../../whatsnew/3.3.rst:1066 +#: ../../whatsnew/3.3.rst:1068 msgid "Use the locale encoding instead of ``utf-8`` to encode Unicode strings." msgstr "" -#: ../../whatsnew/3.3.rst:1067 +#: ../../whatsnew/3.3.rst:1069 msgid "" ":class:`curses.window` has a new :attr:`curses.window.encoding` attribute." msgstr "" ":class:`curses.window` 有一個新的 :attr:`curses.window.encoding` 屬性。" -#: ../../whatsnew/3.3.rst:1068 +#: ../../whatsnew/3.3.rst:1070 msgid "" "The :class:`curses.window` class has a new :meth:`~curses.window.get_wch` " "method to get a wide character" @@ -1747,59 +1750,59 @@ msgstr "" ":class:`curses.window` 類別有一個新的 :meth:`~curses.window.get_wch` 方法來獲" "取寬字元" -#: ../../whatsnew/3.3.rst:1070 +#: ../../whatsnew/3.3.rst:1072 msgid "" "The :mod:`curses` module has a new :meth:`~curses.unget_wch` function to " "push a wide character so the next :meth:`~curses.window.get_wch` will return " "it" msgstr "" -#: ../../whatsnew/3.3.rst:1074 +#: ../../whatsnew/3.3.rst:1076 msgid "(Contributed by Iñigo Serna in :issue:`6755`.)" msgstr "(由 Iñigo Serna 在 :issue:`6755` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1077 +#: ../../whatsnew/3.3.rst:1079 msgid "datetime" msgstr "datetime" -#: ../../whatsnew/3.3.rst:1079 +#: ../../whatsnew/3.3.rst:1081 msgid "" "Equality comparisons between naive and aware :class:`~datetime.datetime` " "instances now return :const:`False` instead of raising :exc:`TypeError` (:" "issue:`15006`)." msgstr "" -#: ../../whatsnew/3.3.rst:1082 +#: ../../whatsnew/3.3.rst:1084 msgid "" "New :meth:`datetime.datetime.timestamp` method: Return POSIX timestamp " "corresponding to the :class:`~datetime.datetime` instance." msgstr "" -#: ../../whatsnew/3.3.rst:1084 +#: ../../whatsnew/3.3.rst:1086 msgid "" "The :meth:`datetime.datetime.strftime` method supports formatting years " "older than 1000." msgstr "" -#: ../../whatsnew/3.3.rst:1086 +#: ../../whatsnew/3.3.rst:1088 msgid "" "The :meth:`datetime.datetime.astimezone` method can now be called without " "arguments to convert datetime instance to the system timezone." msgstr "" -#: ../../whatsnew/3.3.rst:1094 +#: ../../whatsnew/3.3.rst:1096 msgid "decimal" msgstr "decimal" -#: ../../whatsnew/3.3.rst:1096 +#: ../../whatsnew/3.3.rst:1098 msgid ":issue:`7652` - integrate fast native decimal arithmetic." msgstr "" -#: ../../whatsnew/3.3.rst:1097 +#: ../../whatsnew/3.3.rst:1099 msgid "C-module and libmpdec written by Stefan Krah." msgstr "由 Stefan Krah 編寫的 C 模組和 libmpdec。" -#: ../../whatsnew/3.3.rst:1099 +#: ../../whatsnew/3.3.rst:1101 msgid "" "The new C version of the decimal module integrates the high speed libmpdec " "library for arbitrary precision correctly rounded decimal floating-point " @@ -1807,7 +1810,7 @@ msgid "" "Specification." msgstr "" -#: ../../whatsnew/3.3.rst:1103 +#: ../../whatsnew/3.3.rst:1105 msgid "" "Performance gains range from 10x for database applications to 100x for " "numerically intensive applications. These numbers are expected gains for " @@ -1816,128 +1819,128 @@ msgid "" "integer bignum arithmetic the differences can be significantly higher." msgstr "" -#: ../../whatsnew/3.3.rst:1109 +#: ../../whatsnew/3.3.rst:1111 msgid "" "The following table is meant as an illustration. Benchmarks are available at " "https://www.bytereef.org/mpdecimal/quickstart.html." msgstr "" -#: ../../whatsnew/3.3.rst:1113 +#: ../../whatsnew/3.3.rst:1115 msgid "decimal.py" msgstr "decimal.py" -#: ../../whatsnew/3.3.rst:1113 +#: ../../whatsnew/3.3.rst:1115 msgid "_decimal" msgstr "_decimal" -#: ../../whatsnew/3.3.rst:1113 +#: ../../whatsnew/3.3.rst:1115 msgid "speedup" msgstr "speedup" -#: ../../whatsnew/3.3.rst:1115 +#: ../../whatsnew/3.3.rst:1117 msgid "pi" msgstr "pi" -#: ../../whatsnew/3.3.rst:1115 +#: ../../whatsnew/3.3.rst:1117 msgid "42.02s" msgstr "42.02s" -#: ../../whatsnew/3.3.rst:1115 +#: ../../whatsnew/3.3.rst:1117 msgid "0.345s" msgstr "0.345s" -#: ../../whatsnew/3.3.rst:1115 +#: ../../whatsnew/3.3.rst:1117 msgid "120x" msgstr "120x" -#: ../../whatsnew/3.3.rst:1117 +#: ../../whatsnew/3.3.rst:1119 msgid "telco" msgstr "telco" -#: ../../whatsnew/3.3.rst:1117 +#: ../../whatsnew/3.3.rst:1119 msgid "172.19s" msgstr "172.19s" -#: ../../whatsnew/3.3.rst:1117 +#: ../../whatsnew/3.3.rst:1119 msgid "5.68s" msgstr "5.68s" -#: ../../whatsnew/3.3.rst:1117 +#: ../../whatsnew/3.3.rst:1119 msgid "30x" msgstr "30x" -#: ../../whatsnew/3.3.rst:1119 +#: ../../whatsnew/3.3.rst:1121 msgid "psycopg" msgstr "psycopg" -#: ../../whatsnew/3.3.rst:1119 +#: ../../whatsnew/3.3.rst:1121 msgid "3.57s" msgstr "3.57s" -#: ../../whatsnew/3.3.rst:1119 +#: ../../whatsnew/3.3.rst:1121 msgid "0.29s" msgstr "0.29s" -#: ../../whatsnew/3.3.rst:1119 +#: ../../whatsnew/3.3.rst:1121 msgid "12x" msgstr "12x" -#: ../../whatsnew/3.3.rst:1125 +#: ../../whatsnew/3.3.rst:1127 msgid "" "The :exc:`~decimal.FloatOperation` signal optionally enables stricter " "semantics for mixing floats and Decimals." msgstr "" -#: ../../whatsnew/3.3.rst:1128 +#: ../../whatsnew/3.3.rst:1130 msgid "" "If Python is compiled without threads, the C version automatically disables " "the expensive thread local context machinery. In this case, the variable :" "const:`~decimal.HAVE_THREADS` is set to ``False``." msgstr "" -#: ../../whatsnew/3.3.rst:1135 +#: ../../whatsnew/3.3.rst:1137 msgid "" "The C module has the following context limits, depending on the machine " "architecture:" msgstr "" -#: ../../whatsnew/3.3.rst:1139 +#: ../../whatsnew/3.3.rst:1141 msgid "32-bit" msgstr "32 位元" -#: ../../whatsnew/3.3.rst:1139 +#: ../../whatsnew/3.3.rst:1141 msgid "64-bit" msgstr "64 位元" -#: ../../whatsnew/3.3.rst:1141 +#: ../../whatsnew/3.3.rst:1143 msgid ":const:`MAX_PREC`" msgstr ":const:`MAX_PREC`" -#: ../../whatsnew/3.3.rst:1141 ../../whatsnew/3.3.rst:1143 +#: ../../whatsnew/3.3.rst:1143 ../../whatsnew/3.3.rst:1145 msgid "``425000000``" msgstr "``425000000``" -#: ../../whatsnew/3.3.rst:1141 ../../whatsnew/3.3.rst:1143 +#: ../../whatsnew/3.3.rst:1143 ../../whatsnew/3.3.rst:1145 msgid "``999999999999999999``" msgstr "``999999999999999999``" -#: ../../whatsnew/3.3.rst:1143 +#: ../../whatsnew/3.3.rst:1145 msgid ":const:`MAX_EMAX`" msgstr ":const:`MAX_EMAX`" -#: ../../whatsnew/3.3.rst:1145 +#: ../../whatsnew/3.3.rst:1147 msgid ":const:`MIN_EMIN`" msgstr ":const:`MIN_EMIN`" -#: ../../whatsnew/3.3.rst:1145 +#: ../../whatsnew/3.3.rst:1147 msgid "``-425000000``" msgstr "``-425000000``" -#: ../../whatsnew/3.3.rst:1145 +#: ../../whatsnew/3.3.rst:1147 msgid "``-999999999999999999``" msgstr "``-999999999999999999``" -#: ../../whatsnew/3.3.rst:1148 +#: ../../whatsnew/3.3.rst:1150 msgid "" "In the context templates (:class:`~decimal.DefaultContext`, :class:`~decimal." "BasicContext` and :class:`~decimal.ExtendedContext`) the magnitude of :attr:" @@ -1945,7 +1948,7 @@ msgid "" "``999999``." msgstr "" -#: ../../whatsnew/3.3.rst:1153 +#: ../../whatsnew/3.3.rst:1155 msgid "" "The :class:`~decimal.Decimal` constructor in decimal.py does not observe the " "context limits and converts values with arbitrary exponents or precision " @@ -1956,7 +1959,7 @@ msgid "" "obtain a rounded or inexact value." msgstr "" -#: ../../whatsnew/3.3.rst:1162 +#: ../../whatsnew/3.3.rst:1164 msgid "" "The power function in decimal.py is always correctly rounded. In the C " "version, it is defined in terms of the correctly rounded :meth:`~decimal." @@ -1964,7 +1967,7 @@ msgid "" "is only \"almost always correctly rounded\"." msgstr "" -#: ../../whatsnew/3.3.rst:1168 +#: ../../whatsnew/3.3.rst:1170 msgid "" "In the C version, the context dictionary containing the signals is a :class:" "`~collections.abc.MutableMapping`. For speed reasons, :attr:`~decimal." @@ -1975,33 +1978,33 @@ msgid "" "do not reference the RHS dictionary." msgstr "" -#: ../../whatsnew/3.3.rst:1178 +#: ../../whatsnew/3.3.rst:1180 msgid "" "Pickling a :class:`~decimal.Context` produces a different output in order to " "have a common interchange format for the Python and C versions." msgstr "" -#: ../../whatsnew/3.3.rst:1182 +#: ../../whatsnew/3.3.rst:1184 msgid "" "The order of arguments in the :class:`~decimal.Context` constructor has been " "changed to match the order displayed by :func:`repr`." msgstr "" -#: ../../whatsnew/3.3.rst:1186 +#: ../../whatsnew/3.3.rst:1188 msgid "" "The ``watchexp`` parameter in the :meth:`~decimal.Decimal.quantize` method " "is deprecated." msgstr ":meth:`~decimal.Decimal.quantize` 方法中的 ``watchexp`` 參數已棄用。" -#: ../../whatsnew/3.3.rst:1193 +#: ../../whatsnew/3.3.rst:1195 msgid "email" msgstr "email" -#: ../../whatsnew/3.3.rst:1196 +#: ../../whatsnew/3.3.rst:1198 msgid "Policy Framework" msgstr "" -#: ../../whatsnew/3.3.rst:1198 +#: ../../whatsnew/3.3.rst:1200 msgid "" "The email package now has a :mod:`~email.policy` framework. A :class:" "`~email.policy.Policy` is an object with several methods and properties that " @@ -2017,52 +2020,52 @@ msgid "" "data:`~email.policy.compat32`." msgstr "" -#: ../../whatsnew/3.3.rst:1211 +#: ../../whatsnew/3.3.rst:1213 msgid "The minimum set of controls implemented by all ``policy`` objects are:" msgstr "" -#: ../../whatsnew/3.3.rst:1216 +#: ../../whatsnew/3.3.rst:1218 msgid "max_line_length" msgstr "max_line_length" -#: ../../whatsnew/3.3.rst:1216 +#: ../../whatsnew/3.3.rst:1218 msgid "" "The maximum length, excluding the linesep character(s), individual lines may " "have when a ``Message`` is serialized. Defaults to 78." msgstr "" -#: ../../whatsnew/3.3.rst:1220 +#: ../../whatsnew/3.3.rst:1222 msgid "linesep" msgstr "linesep" -#: ../../whatsnew/3.3.rst:1220 +#: ../../whatsnew/3.3.rst:1222 msgid "" "The character used to separate individual lines when a ``Message`` is " "serialized. Defaults to ``\\n``." msgstr "" -#: ../../whatsnew/3.3.rst:1223 +#: ../../whatsnew/3.3.rst:1225 msgid "cte_type" msgstr "cte_type" -#: ../../whatsnew/3.3.rst:1223 +#: ../../whatsnew/3.3.rst:1225 msgid "" "``7bit`` or ``8bit``. ``8bit`` applies only to a ``Bytes`` ``generator``, " "and means that non-ASCII may be used where allowed by the protocol (or where " "it exists in the original input)." msgstr "" -#: ../../whatsnew/3.3.rst:1228 +#: ../../whatsnew/3.3.rst:1230 msgid "raise_on_defect" msgstr "raise_on_defect" -#: ../../whatsnew/3.3.rst:1228 +#: ../../whatsnew/3.3.rst:1230 msgid "" "Causes a ``parser`` to raise error when defects are encountered instead of " "adding them to the ``Message`` object's ``defects`` list." msgstr "" -#: ../../whatsnew/3.3.rst:1233 +#: ../../whatsnew/3.3.rst:1235 msgid "" "A new policy instance, with new settings, is created using the :meth:`~email." "policy.Policy.clone` method of policy objects. ``clone`` takes any of the " @@ -2071,11 +2074,11 @@ msgid "" "``\\r\\n`` linesep characters like this::" msgstr "" -#: ../../whatsnew/3.3.rst:1239 +#: ../../whatsnew/3.3.rst:1241 msgid "mypolicy = compat32.clone(linesep='\\r\\n')" msgstr "mypolicy = compat32.clone(linesep='\\r\\n')" -#: ../../whatsnew/3.3.rst:1241 +#: ../../whatsnew/3.3.rst:1243 msgid "" "Policies can be used to make the generation of messages in the format needed " "by your application simpler. Instead of having to remember to specify " @@ -2088,11 +2091,11 @@ msgid "" "when you create the ``generator``." msgstr "" -#: ../../whatsnew/3.3.rst:1253 +#: ../../whatsnew/3.3.rst:1255 msgid "Provisional Policy with New Header API" msgstr "" -#: ../../whatsnew/3.3.rst:1255 +#: ../../whatsnew/3.3.rst:1257 msgid "" "While the policy framework is worthwhile all by itself, the main motivation " "for introducing it is to allow the creation of new policies that implement " @@ -2104,17 +2107,17 @@ msgid "" "the core developers." msgstr "" -#: ../../whatsnew/3.3.rst:1263 +#: ../../whatsnew/3.3.rst:1265 msgid "" "The new policies are instances of :class:`~email.policy.EmailPolicy`, and " "add the following additional controls:" msgstr "" -#: ../../whatsnew/3.3.rst:1269 +#: ../../whatsnew/3.3.rst:1271 msgid "refold_source" msgstr "refold_source" -#: ../../whatsnew/3.3.rst:1269 +#: ../../whatsnew/3.3.rst:1271 msgid "" "Controls whether or not headers parsed by a :mod:`~email.parser` are " "refolded by the :mod:`~email.generator`. It can be ``none``, ``long``, or " @@ -2123,17 +2126,17 @@ msgid "" "get refolded, and ``all`` means that all lines get refolded." msgstr "" -#: ../../whatsnew/3.3.rst:1278 +#: ../../whatsnew/3.3.rst:1280 msgid "header_factory" msgstr "header_factory" -#: ../../whatsnew/3.3.rst:1278 +#: ../../whatsnew/3.3.rst:1280 msgid "" "A callable that take a ``name`` and ``value`` and produces a custom header " "object." msgstr "" -#: ../../whatsnew/3.3.rst:1282 +#: ../../whatsnew/3.3.rst:1284 msgid "" "The ``header_factory`` is the key to the new features provided by the new " "policies. When one of the new policies is used, any header retrieved from a " @@ -2145,7 +2148,7 @@ msgid "" "now do things like this::" msgstr "" -#: ../../whatsnew/3.3.rst:1291 +#: ../../whatsnew/3.3.rst:1293 msgid "" ">>> m = Message(policy=SMTP)\n" ">>> m['To'] = 'Éric <foo@example.com>'\n" @@ -2187,7 +2190,7 @@ msgstr "" "To: =?utf-8?q?=C3=89ric?= <foo@example.com>\n" "Date: Fri, 25 May 2012 21:44:27 -0400" -#: ../../whatsnew/3.3.rst:1310 +#: ../../whatsnew/3.3.rst:1312 msgid "" "You will note that the unicode display name is automatically encoded as " "``utf-8`` when the message is serialized, but that when the header is " @@ -2196,11 +2199,11 @@ msgid "" "meth:`~email.header.make_header` functions." msgstr "" -#: ../../whatsnew/3.3.rst:1316 +#: ../../whatsnew/3.3.rst:1318 msgid "You can also create addresses from parts::" msgstr "" -#: ../../whatsnew/3.3.rst:1318 +#: ../../whatsnew/3.3.rst:1320 msgid "" ">>> m['cc'] = [Group('pals', [Address('Bob', 'bob', 'example.com'),\n" "... Address('Sally', 'sally', 'example.com')]),\n" @@ -2212,25 +2215,25 @@ msgid "" "<bonz@laugh.com>" msgstr "" -#: ../../whatsnew/3.3.rst:1326 +#: ../../whatsnew/3.3.rst:1328 msgid "Decoding to unicode is done automatically::" msgstr "解碼為 unicode 是自動完成的: ::" -#: ../../whatsnew/3.3.rst:1328 +#: ../../whatsnew/3.3.rst:1330 msgid "" ">>> m2 = message_from_string(str(m))\n" ">>> m2['to']\n" "'Éric <foo@example.com>'" msgstr "" -#: ../../whatsnew/3.3.rst:1332 +#: ../../whatsnew/3.3.rst:1334 msgid "" "When you parse a message, you can use the ``addresses`` and ``groups`` " "attributes of the header objects to access the groups and individual " "addresses::" msgstr "" -#: ../../whatsnew/3.3.rst:1336 +#: ../../whatsnew/3.3.rst:1338 msgid "" ">>> m2['cc'].addresses\n" "(Address(display_name='Bob', username='bob', domain='example.com'), " @@ -2254,7 +2257,7 @@ msgstr "" "addresses=(Address(display_name='Bonzo', username='bonz', domain='laugh." "com'),))" -#: ../../whatsnew/3.3.rst:1341 +#: ../../whatsnew/3.3.rst:1343 msgid "" "In summary, if you use one of the new policies, header manipulation works " "the way it ought to: your application works with unicode strings, and the " @@ -2262,35 +2265,35 @@ msgid "" "RFC standard Content Transfer Encodings." msgstr "" -#: ../../whatsnew/3.3.rst:1347 +#: ../../whatsnew/3.3.rst:1349 msgid "Other API Changes" msgstr "其他 API 變更" -#: ../../whatsnew/3.3.rst:1349 +#: ../../whatsnew/3.3.rst:1351 msgid "" "New :class:`~email.parser.BytesHeaderParser`, added to the :mod:`~email." "parser` module to complement :class:`~email.parser.HeaderParser` and " "complete the Bytes API." msgstr "" -#: ../../whatsnew/3.3.rst:1353 +#: ../../whatsnew/3.3.rst:1355 msgid "New utility functions:" msgstr "新工具函式:" -#: ../../whatsnew/3.3.rst:1355 +#: ../../whatsnew/3.3.rst:1357 msgid "" ":func:`~email.utils.format_datetime`: given a :class:`~datetime.datetime`, " "produce a string formatted for use in an email header." msgstr "" -#: ../../whatsnew/3.3.rst:1358 +#: ../../whatsnew/3.3.rst:1360 msgid "" ":func:`~email.utils.parsedate_to_datetime`: given a date string from an " "email header, convert it into an aware :class:`~datetime.datetime`, or a " "naive :class:`~datetime.datetime` if the offset is ``-0000``." msgstr "" -#: ../../whatsnew/3.3.rst:1362 +#: ../../whatsnew/3.3.rst:1364 msgid "" ":func:`~email.utils.localtime`: With no argument, returns the current local " "time as an aware :class:`~datetime.datetime` using the local :class:" @@ -2299,11 +2302,11 @@ msgid "" "`~datetime.timezone`." msgstr "" -#: ../../whatsnew/3.3.rst:1370 +#: ../../whatsnew/3.3.rst:1372 msgid "ftplib" msgstr "ftplib" -#: ../../whatsnew/3.3.rst:1372 +#: ../../whatsnew/3.3.rst:1374 msgid "" ":class:`ftplib.FTP` now accepts a ``source_address`` keyword argument to " "specify the ``(host, port)`` to use as the source address in the bind call " @@ -2311,7 +2314,7 @@ msgid "" "issue:`8594`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1377 +#: ../../whatsnew/3.3.rst:1379 msgid "" "The :class:`~ftplib.FTP_TLS` class now provides a new :func:`~ftplib.FTP_TLS." "ccc` function to revert control channel back to plaintext. This can be " @@ -2320,18 +2323,18 @@ msgid "" "in :issue:`12139`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1383 +#: ../../whatsnew/3.3.rst:1385 msgid "" "Added :meth:`ftplib.FTP.mlsd` method which provides a parsable directory " "listing format and deprecates :meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP." "dir`. (Contributed by Giampaolo Rodolà in :issue:`11072`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1389 +#: ../../whatsnew/3.3.rst:1391 msgid "functools" msgstr "functools" -#: ../../whatsnew/3.3.rst:1391 +#: ../../whatsnew/3.3.rst:1393 msgid "" "The :func:`functools.lru_cache` decorator now accepts a ``typed`` keyword " "argument (that defaults to ``False`` to ensure that it caches values of " @@ -2339,32 +2342,32 @@ msgid "" "Raymond Hettinger in :issue:`13227`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1398 +#: ../../whatsnew/3.3.rst:1400 msgid "gc" msgstr "gc" -#: ../../whatsnew/3.3.rst:1400 +#: ../../whatsnew/3.3.rst:1402 msgid "" "It is now possible to register callbacks invoked by the garbage collector " "before and after collection using the new :data:`~gc.callbacks` list." msgstr "" -#: ../../whatsnew/3.3.rst:1405 +#: ../../whatsnew/3.3.rst:1407 msgid "hmac" msgstr "hmac" -#: ../../whatsnew/3.3.rst:1407 +#: ../../whatsnew/3.3.rst:1409 msgid "" "A new :func:`~hmac.compare_digest` function has been added to prevent side " "channel attacks on digests through timing analysis. (Contributed by Nick " "Coghlan and Christian Heimes in :issue:`15061`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1413 +#: ../../whatsnew/3.3.rst:1415 msgid "http" msgstr "http" -#: ../../whatsnew/3.3.rst:1415 +#: ../../whatsnew/3.3.rst:1417 msgid "" ":class:`http.server.BaseHTTPRequestHandler` now buffers the headers and " "writes them all at once when :meth:`~http.server.BaseHTTPRequestHandler." @@ -2374,24 +2377,24 @@ msgid "" "`3709`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1421 +#: ../../whatsnew/3.3.rst:1423 msgid "" ":class:`http.server` now produces valid ``HTML 4.01 strict`` output. " "(Contributed by Ezio Melotti in :issue:`13295`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1424 +#: ../../whatsnew/3.3.rst:1426 msgid "" ":class:`http.client.HTTPResponse` now has a :meth:`~http.client.HTTPResponse." "readinto` method, which means it can be used as an :class:`io.RawIOBase` " "class. (Contributed by John Kuhn in :issue:`13464`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1431 +#: ../../whatsnew/3.3.rst:1433 msgid "html" msgstr "html" -#: ../../whatsnew/3.3.rst:1433 +#: ../../whatsnew/3.3.rst:1435 msgid "" ":class:`html.parser.HTMLParser` is now able to parse broken markup without " "raising errors, therefore the *strict* argument of the constructor and the :" @@ -2404,7 +2407,7 @@ msgid "" "`12888`, :issue:`7311`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1443 +#: ../../whatsnew/3.3.rst:1445 msgid "" "A new :data:`~html.entities.html5` dictionary that maps HTML5 named " "character references to the equivalent Unicode character(s) (e.g. " @@ -2413,25 +2416,25 @@ msgid "" "(Contributed by Ezio Melotti in :issue:`11113` and :issue:`15156`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1451 +#: ../../whatsnew/3.3.rst:1453 msgid "imaplib" msgstr "imaplib" -#: ../../whatsnew/3.3.rst:1453 +#: ../../whatsnew/3.3.rst:1455 msgid "" "The :class:`~imaplib.IMAP4_SSL` constructor now accepts an SSLContext " "parameter to control parameters of the secure channel." msgstr "" -#: ../../whatsnew/3.3.rst:1456 +#: ../../whatsnew/3.3.rst:1458 msgid "(Contributed by Sijin Joseph in :issue:`8808`.)" msgstr "(由 Sijin Joseph 在 :issue:`8808` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1460 +#: ../../whatsnew/3.3.rst:1462 msgid "inspect" msgstr "inspect" -#: ../../whatsnew/3.3.rst:1462 +#: ../../whatsnew/3.3.rst:1464 msgid "" "A new :func:`~inspect.getclosurevars` function has been added. This function " "reports the current binding of all names referenced from the function body " @@ -2439,11 +2442,11 @@ msgid "" "internal state when testing code that relies on stateful closures." msgstr "" -#: ../../whatsnew/3.3.rst:1467 +#: ../../whatsnew/3.3.rst:1469 msgid "(Contributed by Meador Inge and Nick Coghlan in :issue:`13062`.)" msgstr "(由 Meador Inge 與 Nick Coghlan 在 :issue:`13062` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1469 +#: ../../whatsnew/3.3.rst:1471 msgid "" "A new :func:`~inspect.getgeneratorlocals` function has been added. This " "function reports the current binding of local variables in the generator's " @@ -2451,26 +2454,26 @@ msgid "" "generators." msgstr "" -#: ../../whatsnew/3.3.rst:1474 +#: ../../whatsnew/3.3.rst:1476 msgid "(Contributed by Meador Inge in :issue:`15153`.)" msgstr "(由 Meador Inge 於 :issue:`15153` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1477 +#: ../../whatsnew/3.3.rst:1479 msgid "io" msgstr "io" -#: ../../whatsnew/3.3.rst:1479 +#: ../../whatsnew/3.3.rst:1481 msgid "" "The :func:`~io.open` function has a new ``'x'`` mode that can be used to " "exclusively create a new file, and raise a :exc:`FileExistsError` if the " "file already exists. It is based on the C11 'x' mode to fopen()." msgstr "" -#: ../../whatsnew/3.3.rst:1483 +#: ../../whatsnew/3.3.rst:1485 msgid "(Contributed by David Townshend in :issue:`12760`.)" msgstr "(由 David Townshend 於 :issue:`12760` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1485 +#: ../../whatsnew/3.3.rst:1487 msgid "" "The constructor of the :class:`~io.TextIOWrapper` class has a new " "*write_through* optional argument. If *write_through* is ``True``, calls to :" @@ -2479,28 +2482,28 @@ msgid "" "its underlying binary buffer." msgstr "" -#: ../../whatsnew/3.3.rst:1493 +#: ../../whatsnew/3.3.rst:1495 msgid "itertools" msgstr "itertools" -#: ../../whatsnew/3.3.rst:1495 +#: ../../whatsnew/3.3.rst:1497 msgid "" ":func:`~itertools.accumulate` now takes an optional ``func`` argument for " "providing a user-supplied binary function." msgstr "" -#: ../../whatsnew/3.3.rst:1500 +#: ../../whatsnew/3.3.rst:1502 msgid "logging" msgstr "logging" -#: ../../whatsnew/3.3.rst:1502 +#: ../../whatsnew/3.3.rst:1504 msgid "" "The :func:`~logging.basicConfig` function now supports an optional " "``handlers`` argument taking an iterable of handlers to be added to the root " "logger." msgstr "" -#: ../../whatsnew/3.3.rst:1505 +#: ../../whatsnew/3.3.rst:1507 msgid "" "A class level attribute :attr:`~logging.handlers.SysLogHandler.append_nul` " "has been added to :class:`~logging.handlers.SysLogHandler` to allow control " @@ -2509,25 +2512,25 @@ msgid "" "log." msgstr "" -#: ../../whatsnew/3.3.rst:1513 +#: ../../whatsnew/3.3.rst:1515 msgid "math" msgstr "math" -#: ../../whatsnew/3.3.rst:1515 +#: ../../whatsnew/3.3.rst:1517 msgid "" "The :mod:`math` module has a new function, :func:`~math.log2`, which " "returns the base-2 logarithm of *x*." msgstr "" -#: ../../whatsnew/3.3.rst:1518 +#: ../../whatsnew/3.3.rst:1520 msgid "(Written by Mark Dickinson in :issue:`11888`.)" msgstr "(由 Mark Dickinson 於 :issue:`11888` 中撰寫)" -#: ../../whatsnew/3.3.rst:1522 +#: ../../whatsnew/3.3.rst:1524 msgid "mmap" msgstr "mmap" -#: ../../whatsnew/3.3.rst:1524 +#: ../../whatsnew/3.3.rst:1526 msgid "" "The :meth:`~mmap.mmap.read` method is now more compatible with other file-" "like objects: if the argument is omitted or specified as ``None``, it " @@ -2535,39 +2538,39 @@ msgid "" "(Contributed by Petri Lehtinen in :issue:`12021`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1531 +#: ../../whatsnew/3.3.rst:1533 msgid "multiprocessing" msgstr "multiprocessing" -#: ../../whatsnew/3.3.rst:1533 +#: ../../whatsnew/3.3.rst:1535 msgid "" "The new :func:`multiprocessing.connection.wait` function allows polling " "multiple objects (such as connections, sockets and pipes) with a timeout. " "(Contributed by Richard Oudkerk in :issue:`12328`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1537 +#: ../../whatsnew/3.3.rst:1539 msgid "" ":class:`multiprocessing.Connection` objects can now be transferred over " "multiprocessing connections. (Contributed by Richard Oudkerk in :issue:" "`4892`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1541 +#: ../../whatsnew/3.3.rst:1543 msgid "" ":class:`multiprocessing.Process` now accepts a ``daemon`` keyword argument " "to override the default behavior of inheriting the ``daemon`` flag from the " "parent process (:issue:`6064`)." msgstr "" -#: ../../whatsnew/3.3.rst:1545 +#: ../../whatsnew/3.3.rst:1547 msgid "" "New attribute :data:`multiprocessing.Process.sentinel` allows a program to " "wait on multiple :class:`~multiprocessing.Process` objects at one time using " "the appropriate OS primitives (for example, :mod:`select` on posix systems)." msgstr "" -#: ../../whatsnew/3.3.rst:1550 +#: ../../whatsnew/3.3.rst:1552 msgid "" "New methods :meth:`multiprocessing.pool.Pool.starmap` and :meth:" "`~multiprocessing.pool.Pool.starmap_async` provide :func:`itertools.starmap` " @@ -2576,18 +2579,18 @@ msgid "" "Schlawack in :issue:`12708`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1559 +#: ../../whatsnew/3.3.rst:1561 msgid "nntplib" msgstr "nntplib" -#: ../../whatsnew/3.3.rst:1561 +#: ../../whatsnew/3.3.rst:1563 msgid "" -"The :class:`nntplib.NNTP` class now supports the context management protocol " -"to unconditionally consume :exc:`socket.error` exceptions and to close the " -"NNTP connection when done::" +"The :class:`!nntplib.NNTP` class now supports the context management " +"protocol to unconditionally consume :exc:`socket.error` exceptions and to " +"close the NNTP connection when done::" msgstr "" -#: ../../whatsnew/3.3.rst:1565 +#: ../../whatsnew/3.3.rst:1567 msgid "" ">>> from nntplib import NNTP\n" ">>> with NNTP('news.gmane.org') as n:\n" @@ -2605,15 +2608,15 @@ msgstr "" "python.committers')\n" ">>>" -#: ../../whatsnew/3.3.rst:1572 +#: ../../whatsnew/3.3.rst:1574 msgid "(Contributed by Giampaolo Rodolà in :issue:`9795`.)" msgstr "(由 Giampaolo Rodolà 於 :issue:`9795` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1576 +#: ../../whatsnew/3.3.rst:1578 msgid "os" msgstr "os" -#: ../../whatsnew/3.3.rst:1578 +#: ../../whatsnew/3.3.rst:1580 msgid "" "The :mod:`os` module has a new :func:`~os.pipe2` function that makes it " "possible to create a pipe with :const:`~os.O_CLOEXEC` or :const:`~os." @@ -2621,7 +2624,7 @@ msgid "" "conditions in multi-threaded programs." msgstr "" -#: ../../whatsnew/3.3.rst:1583 +#: ../../whatsnew/3.3.rst:1585 msgid "" "The :mod:`os` module has a new :func:`~os.sendfile` function which provides " "an efficient \"zero-copy\" way for copying data from one file (or socket) " @@ -2632,12 +2635,12 @@ msgid "" "socket, e.g. for downloading a file." msgstr "" -#: ../../whatsnew/3.3.rst:1591 +#: ../../whatsnew/3.3.rst:1593 msgid "" "(Patch submitted by Ross Lagerwall and Giampaolo Rodolà in :issue:`10882`.)" msgstr "(由 Ross Lagerwall 和 Giampaolo Rodolà 於 :issue:`10882` 提交補丁。)" -#: ../../whatsnew/3.3.rst:1593 +#: ../../whatsnew/3.3.rst:1595 msgid "" "To avoid race conditions like symlink attacks and issues with temporary " "files and directories, it is more reliable (and also faster) to manipulate " @@ -2646,14 +2649,14 @@ msgid "" "`4761`, :issue:`10755` and :issue:`14626`)." msgstr "" -#: ../../whatsnew/3.3.rst:1599 +#: ../../whatsnew/3.3.rst:1601 msgid "" "The :mod:`os` module has a new :func:`~os.fwalk` function similar to :func:" "`~os.walk` except that it also yields file descriptors referring to the " "directories visited. This is especially useful to avoid symlink races." msgstr "" -#: ../../whatsnew/3.3.rst:1603 +#: ../../whatsnew/3.3.rst:1605 msgid "" "The following functions get new optional *dir_fd* (:ref:`paths relative to " "directory descriptors <dir_fd>`) and/or *follow_symlinks* (:ref:`not " @@ -2667,7 +2670,7 @@ msgid "" "`os.supports_follows_symlinks`." msgstr "" -#: ../../whatsnew/3.3.rst:1614 +#: ../../whatsnew/3.3.rst:1616 msgid "" "The following functions now support a file descriptor for their path " "argument: :func:`~os.chdir`, :func:`~os.chmod`, :func:`~os.chown`, :func:" @@ -2676,7 +2679,7 @@ msgid "" "support for this can be checked via the :data:`os.supports_fd` set." msgstr "" -#: ../../whatsnew/3.3.rst:1620 +#: ../../whatsnew/3.3.rst:1622 msgid "" ":func:`~os.access` accepts an ``effective_ids`` keyword argument to turn on " "using the effective uid/gid rather than the real uid/gid in the access " @@ -2684,7 +2687,7 @@ msgid "" "supports_effective_ids` set." msgstr "" -#: ../../whatsnew/3.3.rst:1625 +#: ../../whatsnew/3.3.rst:1627 msgid "" "The :mod:`os` module has two new functions: :func:`~os.getpriority` and :" "func:`~os.setpriority`. They can be used to get or set process niceness/" @@ -2692,11 +2695,11 @@ msgid "" "processes instead of just the current one." msgstr "" -#: ../../whatsnew/3.3.rst:1630 +#: ../../whatsnew/3.3.rst:1632 msgid "(Patch submitted by Giampaolo Rodolà in :issue:`10784`.)" msgstr "(由 Giampaolo Rodolà 於 :issue:`10784` 提交補丁。)" -#: ../../whatsnew/3.3.rst:1632 +#: ../../whatsnew/3.3.rst:1634 msgid "" "The new :func:`os.replace` function allows cross-platform renaming of a file " "with overwriting the destination. With :func:`os.rename`, an existing " @@ -2704,7 +2707,7 @@ msgid "" "Windows. (Contributed by Antoine Pitrou in :issue:`8828`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1638 +#: ../../whatsnew/3.3.rst:1640 msgid "" "The stat family of functions (:func:`~os.stat`, :func:`~os.fstat`, and :func:" "`~os.lstat`) now support reading a file's timestamps with nanosecond " @@ -2713,7 +2716,7 @@ msgid "" "`14127`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1644 +#: ../../whatsnew/3.3.rst:1646 msgid "" "The new :func:`os.get_terminal_size` function queries the size of the " "terminal attached to a file descriptor. See also :func:`shutil." @@ -2721,14 +2724,14 @@ msgid "" "`13609`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1651 +#: ../../whatsnew/3.3.rst:1653 msgid "" "New functions to support Linux extended attributes (:issue:`12720`): :func:" "`~os.getxattr`, :func:`~os.listxattr`, :func:`~os.removexattr`, :func:`~os." "setxattr`." msgstr "" -#: ../../whatsnew/3.3.rst:1655 +#: ../../whatsnew/3.3.rst:1657 msgid "" "New interface to the scheduler. These functions control how a process is " "allocated CPU time by the operating system. New functions: :func:`~os." @@ -2739,90 +2742,90 @@ msgid "" "sched_setscheduler`, :func:`~os.sched_yield`," msgstr "" -#: ../../whatsnew/3.3.rst:1664 +#: ../../whatsnew/3.3.rst:1666 msgid "New functions to control the file system:" msgstr "" -#: ../../whatsnew/3.3.rst:1666 +#: ../../whatsnew/3.3.rst:1668 msgid "" ":func:`~os.posix_fadvise`: Announces an intention to access data in a " "specific pattern thus allowing the kernel to make optimizations." msgstr "" -#: ../../whatsnew/3.3.rst:1668 +#: ../../whatsnew/3.3.rst:1670 msgid "" ":func:`~os.posix_fallocate`: Ensures that enough disk space is allocated for " "a file." msgstr "" -#: ../../whatsnew/3.3.rst:1670 +#: ../../whatsnew/3.3.rst:1672 msgid ":func:`~os.sync`: Force write of everything to disk." msgstr "" -#: ../../whatsnew/3.3.rst:1672 +#: ../../whatsnew/3.3.rst:1674 msgid "Additional new posix functions:" msgstr "其他新的 posix 函式:" -#: ../../whatsnew/3.3.rst:1674 +#: ../../whatsnew/3.3.rst:1676 msgid "" ":func:`~os.lockf`: Apply, test or remove a POSIX lock on an open file " "descriptor." msgstr "" -#: ../../whatsnew/3.3.rst:1675 +#: ../../whatsnew/3.3.rst:1677 msgid "" ":func:`~os.pread`: Read from a file descriptor at an offset, the file offset " "remains unchanged." msgstr "" -#: ../../whatsnew/3.3.rst:1677 +#: ../../whatsnew/3.3.rst:1679 msgid "" ":func:`~os.pwrite`: Write to a file descriptor from an offset, leaving the " "file offset unchanged." msgstr "" -#: ../../whatsnew/3.3.rst:1679 +#: ../../whatsnew/3.3.rst:1681 msgid "" ":func:`~os.readv`: Read from a file descriptor into a number of writable " "buffers." msgstr "" -#: ../../whatsnew/3.3.rst:1680 +#: ../../whatsnew/3.3.rst:1682 msgid "" ":func:`~os.truncate`: Truncate the file corresponding to *path*, so that it " "is at most *length* bytes in size." msgstr "" -#: ../../whatsnew/3.3.rst:1682 +#: ../../whatsnew/3.3.rst:1684 msgid "" ":func:`~os.waitid`: Wait for the completion of one or more child processes." msgstr "" -#: ../../whatsnew/3.3.rst:1683 +#: ../../whatsnew/3.3.rst:1685 msgid "" ":func:`~os.writev`: Write the contents of *buffers* to a file descriptor, " "where *buffers* is an arbitrary sequence of buffers." msgstr "" -#: ../../whatsnew/3.3.rst:1685 +#: ../../whatsnew/3.3.rst:1687 msgid "" ":func:`~os.getgrouplist` (:issue:`9344`): Return list of group ids that " "specified user belongs to." msgstr "" -#: ../../whatsnew/3.3.rst:1688 +#: ../../whatsnew/3.3.rst:1690 msgid "" ":func:`~os.times` and :func:`~os.uname`: Return type changed from a tuple to " "a tuple-like object with named attributes." msgstr "" -#: ../../whatsnew/3.3.rst:1691 +#: ../../whatsnew/3.3.rst:1693 msgid "" "Some platforms now support additional constants for the :func:`~os.lseek` " "function, such as ``os.SEEK_HOLE`` and ``os.SEEK_DATA``." msgstr "" -#: ../../whatsnew/3.3.rst:1694 +#: ../../whatsnew/3.3.rst:1696 msgid "" "New constants :const:`~os.RTLD_LAZY`, :const:`~os.RTLD_NOW`, :const:`~os." "RTLD_GLOBAL`, :const:`~os.RTLD_LOCAL`, :const:`~os.RTLD_NODELETE`, :const:" @@ -2832,70 +2835,70 @@ msgid "" "mod:`DLFCN`. (Contributed by Victor Stinner in :issue:`13226`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1702 +#: ../../whatsnew/3.3.rst:1704 msgid "" ":func:`os.symlink` now accepts (and ignores) the ``target_is_directory`` " "keyword argument on non-Windows platforms, to ease cross-platform support." msgstr "" -#: ../../whatsnew/3.3.rst:1707 +#: ../../whatsnew/3.3.rst:1709 msgid "pdb" msgstr "pdb" -#: ../../whatsnew/3.3.rst:1709 +#: ../../whatsnew/3.3.rst:1711 msgid "" "Tab-completion is now available not only for command names, but also their " "arguments. For example, for the ``break`` command, function and file names " "are completed." msgstr "" -#: ../../whatsnew/3.3.rst:1713 +#: ../../whatsnew/3.3.rst:1715 msgid "(Contributed by Georg Brandl in :issue:`14210`)" msgstr "(由 Georg Brandl 在 :issue:`14210` 中貢獻)" -#: ../../whatsnew/3.3.rst:1717 +#: ../../whatsnew/3.3.rst:1719 msgid "pickle" msgstr "pickle" -#: ../../whatsnew/3.3.rst:1719 +#: ../../whatsnew/3.3.rst:1721 msgid "" ":class:`pickle.Pickler` objects now have an optional :attr:`~pickle.Pickler." "dispatch_table` attribute allowing per-pickler reduction functions to be set." msgstr "" -#: ../../whatsnew/3.3.rst:1723 +#: ../../whatsnew/3.3.rst:1725 msgid "(Contributed by Richard Oudkerk in :issue:`14166`.)" msgstr "(由 Richard Oudkerk 在 :issue:`14166` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1727 +#: ../../whatsnew/3.3.rst:1729 msgid "pydoc" msgstr "pydoc" -#: ../../whatsnew/3.3.rst:1729 +#: ../../whatsnew/3.3.rst:1731 msgid "" "The Tk GUI and the :func:`~pydoc.serve` function have been removed from the :" "mod:`pydoc` module: ``pydoc -g`` and :func:`~pydoc.serve` have been " "deprecated in Python 3.2." msgstr "" -#: ../../whatsnew/3.3.rst:1735 +#: ../../whatsnew/3.3.rst:1737 msgid "re" msgstr "re" -#: ../../whatsnew/3.3.rst:1737 +#: ../../whatsnew/3.3.rst:1739 msgid "" ":class:`str` regular expressions now support ``\\u`` and ``\\U`` escapes." msgstr "" -#: ../../whatsnew/3.3.rst:1739 +#: ../../whatsnew/3.3.rst:1741 msgid "(Contributed by Serhiy Storchaka in :issue:`3665`.)" msgstr "(由 Serhiy Storchaka 在 :issue:`3665` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1743 +#: ../../whatsnew/3.3.rst:1745 msgid "sched" msgstr "sched" -#: ../../whatsnew/3.3.rst:1745 +#: ../../whatsnew/3.3.rst:1747 msgid "" ":meth:`~sched.scheduler.run` now accepts a *blocking* parameter which when " "set to false makes the method execute the scheduled events due to expire " @@ -2904,21 +2907,21 @@ msgid "" "(Contributed by Giampaolo Rodolà in :issue:`13449`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1751 +#: ../../whatsnew/3.3.rst:1753 msgid "" ":class:`~sched.scheduler` class can now be safely used in multi-threaded " "environments. (Contributed by Josiah Carlson and Giampaolo Rodolà in :issue:" "`8684`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1755 +#: ../../whatsnew/3.3.rst:1757 msgid "" "*timefunc* and *delayfunct* parameters of :class:`~sched.scheduler` class " "constructor are now optional and defaults to :func:`time.time` and :func:" "`time.sleep` respectively. (Contributed by Chris Clark in :issue:`13245`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1760 +#: ../../whatsnew/3.3.rst:1762 msgid "" ":meth:`~sched.scheduler.enter` and :meth:`~sched.scheduler.enterabs` " "*argument* parameter is now optional. (Contributed by Chris Clark in :issue:" @@ -2927,7 +2930,7 @@ msgstr "" ":meth:`~sched.scheduler.enter` 和 :meth:`~sched.scheduler.enterabs` " "*argument* 參數現在是可選的。(由 Chris Clark 在 :issue:`13245` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1764 +#: ../../whatsnew/3.3.rst:1766 msgid "" ":meth:`~sched.scheduler.enter` and :meth:`~sched.scheduler.enterabs` now " "accept a *kwargs* parameter. (Contributed by Chris Clark in :issue:`13245`.)" @@ -2935,58 +2938,58 @@ msgstr "" ":meth:`~sched.scheduler.enter` 和 :meth:`~sched.scheduler.enterabs` 現在接受 " "*kwargs* 參數。(由 Chris Clark 在 :issue:`13245` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1770 +#: ../../whatsnew/3.3.rst:1772 msgid "select" msgstr "select" -#: ../../whatsnew/3.3.rst:1772 +#: ../../whatsnew/3.3.rst:1774 msgid "" "Solaris and derivative platforms have a new class :class:`select.devpoll` " "for high performance asynchronous sockets via :file:`/dev/poll`. " "(Contributed by Jesús Cea Avión in :issue:`6397`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1778 +#: ../../whatsnew/3.3.rst:1780 msgid "shlex" msgstr "shlex" -#: ../../whatsnew/3.3.rst:1780 +#: ../../whatsnew/3.3.rst:1782 msgid "" -"The previously undocumented helper function ``quote`` from the :mod:`pipes` " +"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." msgstr "" -#: ../../whatsnew/3.3.rst:1787 +#: ../../whatsnew/3.3.rst:1789 msgid "shutil" msgstr "shutil" -#: ../../whatsnew/3.3.rst:1789 +#: ../../whatsnew/3.3.rst:1791 msgid "New functions:" msgstr "新功能:" -#: ../../whatsnew/3.3.rst:1791 +#: ../../whatsnew/3.3.rst:1793 msgid "" ":func:`~shutil.disk_usage`: provides total, used and free disk space " "statistics. (Contributed by Giampaolo Rodolà in :issue:`12442`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1793 +#: ../../whatsnew/3.3.rst:1795 msgid "" ":func:`~shutil.chown`: allows one to change user and/or group of the given " "path also specifying the user/group names and not only their numeric ids. " "(Contributed by Sandro Tosi in :issue:`12191`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1796 +#: ../../whatsnew/3.3.rst:1798 msgid "" ":func:`shutil.get_terminal_size`: returns the size of the terminal window to " "which the interpreter is attached. (Contributed by Zbigniew Jędrzejewski-" "Szmek in :issue:`13609`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1800 +#: ../../whatsnew/3.3.rst:1802 msgid "" ":func:`~shutil.copy2` and :func:`~shutil.copystat` now preserve file " "timestamps with nanosecond precision on platforms that support it. They also " @@ -2994,7 +2997,7 @@ msgid "" "Hastings in :issue:`14127` and :issue:`15238`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1805 +#: ../../whatsnew/3.3.rst:1807 msgid "" "Several functions now take an optional ``symlinks`` argument: when that " "parameter is true, symlinks aren't dereferenced and the operation instead " @@ -3002,7 +3005,7 @@ msgid "" "Hynek Schlawack in :issue:`12715`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1810 +#: ../../whatsnew/3.3.rst:1812 msgid "" "When copying files to a different file system, :func:`~shutil.move` now " "handles symlinks the way the posix ``mv`` command does, recreating the " @@ -3011,7 +3014,7 @@ msgid "" "the ``dst`` argument as its result." msgstr "" -#: ../../whatsnew/3.3.rst:1816 +#: ../../whatsnew/3.3.rst:1818 msgid "" ":func:`~shutil.rmtree` is now resistant to symlink attacks on platforms " "which support the new ``dir_fd`` parameter in :func:`os.open` and :func:`os." @@ -3019,53 +3022,53 @@ msgid "" "`4489`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1823 +#: ../../whatsnew/3.3.rst:1825 msgid "signal" msgstr "signal" -#: ../../whatsnew/3.3.rst:1825 +#: ../../whatsnew/3.3.rst:1827 msgid "The :mod:`signal` module has new functions:" msgstr ":mod:`signal` 模組有了新的函式:" -#: ../../whatsnew/3.3.rst:1827 +#: ../../whatsnew/3.3.rst:1829 msgid "" ":func:`~signal.pthread_sigmask`: fetch and/or change the signal mask of the " "calling thread (Contributed by Jean-Paul Calderone in :issue:`8407`);" msgstr "" -#: ../../whatsnew/3.3.rst:1829 +#: ../../whatsnew/3.3.rst:1831 msgid ":func:`~signal.pthread_kill`: send a signal to a thread;" msgstr ":func:`~signal.pthread_kill`:向執行緒發送訊號;" -#: ../../whatsnew/3.3.rst:1830 +#: ../../whatsnew/3.3.rst:1832 msgid ":func:`~signal.sigpending`: examine pending functions;" msgstr ":func:`~signal.sigpending`:檢查未定的函式;" -#: ../../whatsnew/3.3.rst:1831 +#: ../../whatsnew/3.3.rst:1833 msgid ":func:`~signal.sigwait`: wait a signal;" msgstr ":func:`~signal.sigwait`:等待訊號;" -#: ../../whatsnew/3.3.rst:1832 +#: ../../whatsnew/3.3.rst:1834 msgid "" ":func:`~signal.sigwaitinfo`: wait for a signal, returning detailed " "information about it;" msgstr ":func:`~signal.sigwaitinfo`:等待訊號,回傳有關該訊號的詳細資訊;" -#: ../../whatsnew/3.3.rst:1834 +#: ../../whatsnew/3.3.rst:1836 msgid "" ":func:`~signal.sigtimedwait`: like :func:`~signal.sigwaitinfo` but with a " "timeout." msgstr "" ":func:`~signal.sigtimedwait`:類似於 :func:`~signal.sigwaitinfo` 但有超時。" -#: ../../whatsnew/3.3.rst:1837 +#: ../../whatsnew/3.3.rst:1839 msgid "" "The signal handler writes the signal number as a single byte instead of a " "nul byte into the wakeup file descriptor. So it is possible to wait more " "than one signal and know which signals were raised." msgstr "" -#: ../../whatsnew/3.3.rst:1841 +#: ../../whatsnew/3.3.rst:1843 msgid "" ":func:`signal.signal` and :func:`signal.siginterrupt` raise an OSError, " "instead of a RuntimeError: OSError has an errno attribute." @@ -3073,29 +3076,29 @@ msgstr "" ":func:`signal.signal` 和 :func:`signal.siginterrupt` 會引發 OSError,而不是 " "RuntimeError:OSError 有一個 errno 屬性。" -#: ../../whatsnew/3.3.rst:1846 +#: ../../whatsnew/3.3.rst:1848 msgid "smtpd" msgstr "smtpd" -#: ../../whatsnew/3.3.rst:1848 +#: ../../whatsnew/3.3.rst:1850 msgid "" "The :mod:`!smtpd` module now supports :rfc:`5321` (extended SMTP) and :rfc:" "`1870` (size extension). Per the standard, these extensions are enabled if " "and only if the client initiates the session with an ``EHLO`` command." msgstr "" -#: ../../whatsnew/3.3.rst:1852 +#: ../../whatsnew/3.3.rst:1854 msgid "" "(Initial ``ELHO`` support by Alberto Trevino. Size extension by Juhana " "Jauhiainen. Substantial additional work on the patch contributed by Michele " "Orrù and Dan Boswell. :issue:`8739`)" msgstr "" -#: ../../whatsnew/3.3.rst:1858 +#: ../../whatsnew/3.3.rst:1860 msgid "smtplib" msgstr "smtplib" -#: ../../whatsnew/3.3.rst:1860 +#: ../../whatsnew/3.3.rst:1862 msgid "" "The :class:`~smtplib.SMTP`, :class:`~smtplib.SMTP_SSL`, and :class:`~smtplib." "LMTP` classes now accept a ``source_address`` keyword argument to specify " @@ -3104,7 +3107,7 @@ msgid "" "`11281`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1866 +#: ../../whatsnew/3.3.rst:1868 msgid "" ":class:`~smtplib.SMTP` now supports the context management protocol, " "allowing an ``SMTP`` instance to be used in a ``with`` statement. " @@ -3113,7 +3116,7 @@ msgstr "" ":class:`~smtplib.SMTP` 現在支援情境管理協議,允許在 ``with`` 陳述式中使用 " "``SMTP`` 實例。(由 Giampaolo Rodolà 在 :issue:`11289` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1870 +#: ../../whatsnew/3.3.rst:1872 msgid "" "The :class:`~smtplib.SMTP_SSL` constructor and the :meth:`~smtplib.SMTP." "starttls` method now accept an SSLContext parameter to control parameters of " @@ -3123,11 +3126,11 @@ msgstr "" "接受 SSLContext 參數來控制安全通道的參數。(由 Kasun Herath 在 :issue:`8809` " "中貢獻。)" -#: ../../whatsnew/3.3.rst:1876 +#: ../../whatsnew/3.3.rst:1878 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.3.rst:1878 +#: ../../whatsnew/3.3.rst:1880 msgid "" "The :class:`~socket.socket` class now exposes additional methods to process " "ancillary data when supported by the underlying platform:" @@ -3135,26 +3138,26 @@ msgstr "" "當底層平台支援時,:class:`~socket.socket` 類現在公開了額外的方法來處理輔助資" "料:" -#: ../../whatsnew/3.3.rst:1881 +#: ../../whatsnew/3.3.rst:1883 msgid ":func:`~socket.socket.sendmsg`" msgstr ":func:`~socket.socket.sendmsg`" -#: ../../whatsnew/3.3.rst:1882 +#: ../../whatsnew/3.3.rst:1884 msgid ":func:`~socket.socket.recvmsg`" msgstr ":func:`~socket.socket.recvmsg`" -#: ../../whatsnew/3.3.rst:1883 +#: ../../whatsnew/3.3.rst:1885 msgid ":func:`~socket.socket.recvmsg_into`" msgstr ":func:`~socket.socket.recvmsg_into`" -#: ../../whatsnew/3.3.rst:1885 +#: ../../whatsnew/3.3.rst:1887 msgid "" "(Contributed by David Watson in :issue:`6560`, based on an earlier patch by " "Heiko Wundram)" msgstr "" "(由 David Watson 在 :issue:`6560` 中貢獻,其基於 Heiko Wundram 的早期補丁)" -#: ../../whatsnew/3.3.rst:1888 +#: ../../whatsnew/3.3.rst:1890 msgid "" "The :class:`~socket.socket` class now supports the PF_CAN protocol family " "(https://en.wikipedia.org/wiki/Socketcan), on Linux (https://lwn.net/" @@ -3163,14 +3166,14 @@ msgstr "" ":class:`~socket.socket` 類別現在支援 Linux (https://lwn.net/Articles/253425) " "上的 PF_CAN 協議系列 (https://en.wikipedia.org/wiki/Socketcan)。" -#: ../../whatsnew/3.3.rst:1892 +#: ../../whatsnew/3.3.rst:1894 msgid "" "(Contributed by Matthias Fuchs, updated by Tiago Gonçalves in :issue:" "`10141`.)" msgstr "" "(在 :issue:`10141` 中由 Matthias Fuchs 貢獻、並由 Tiago Gonçalves 更新。)" -#: ../../whatsnew/3.3.rst:1894 +#: ../../whatsnew/3.3.rst:1896 msgid "" "The :class:`~socket.socket` class now supports the PF_RDS protocol family " "(https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets and `https://oss." @@ -3182,7 +3185,7 @@ msgstr "" "<https://web.archive.org/web/20130115155505/https://oss.oracle.com/projects/" "rds/>`__\\ )。" -#: ../../whatsnew/3.3.rst:1898 +#: ../../whatsnew/3.3.rst:1900 msgid "" "The :class:`~socket.socket` class now supports the ``PF_SYSTEM`` protocol " "family on OS X. (Contributed by Michael Goderbauer in :issue:`13777`.)" @@ -3190,18 +3193,18 @@ msgstr "" ":class:`~socket.socket` 類別現在支援 OS X 上的 ``PF_SYSTEM`` 協議系列。(由 " "Michael Goderbauer 在 :issue:`13777` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1901 +#: ../../whatsnew/3.3.rst:1903 msgid "" "New function :func:`~socket.sethostname` allows the hostname to be set on " "Unix systems if the calling process has sufficient privileges. (Contributed " "by Ross Lagerwall in :issue:`10866`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1907 +#: ../../whatsnew/3.3.rst:1909 msgid "socketserver" msgstr "socketserver" -#: ../../whatsnew/3.3.rst:1909 +#: ../../whatsnew/3.3.rst:1911 msgid "" ":class:`~socketserver.BaseServer` now has an overridable method :meth:" "`~socketserver.BaseServer.service_actions` that is called by the :meth:" @@ -3210,54 +3213,54 @@ msgid "" "processes. (Contributed by Justin Warkentin in :issue:`11109`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1917 +#: ../../whatsnew/3.3.rst:1919 msgid "sqlite3" msgstr "sqlite3" -#: ../../whatsnew/3.3.rst:1919 +#: ../../whatsnew/3.3.rst:1921 msgid "" "New :class:`sqlite3.Connection` method :meth:`~sqlite3.Connection." "set_trace_callback` can be used to capture a trace of all sql commands " "processed by sqlite. (Contributed by Torsten Landschoff in :issue:`11688`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1926 +#: ../../whatsnew/3.3.rst:1928 msgid "ssl" msgstr "ssl" -#: ../../whatsnew/3.3.rst:1928 +#: ../../whatsnew/3.3.rst:1930 msgid "The :mod:`ssl` module has two new random generation functions:" msgstr ":mod:`ssl` 模組有兩個新的隨機生成函式:" -#: ../../whatsnew/3.3.rst:1930 +#: ../../whatsnew/3.3.rst:1932 msgid "" ":func:`~ssl.RAND_bytes`: generate cryptographically strong pseudo-random " "bytes." msgstr ":func:`~ssl.RAND_bytes`:生成加密的強偽隨機位元組。" -#: ../../whatsnew/3.3.rst:1932 +#: ../../whatsnew/3.3.rst:1934 msgid ":func:`~ssl.RAND_pseudo_bytes`: generate pseudo-random bytes." msgstr ":func:`~ssl.RAND_pseudo_bytes`:生成偽隨機位元組。" -#: ../../whatsnew/3.3.rst:1934 +#: ../../whatsnew/3.3.rst:1936 msgid "(Contributed by Victor Stinner in :issue:`12049`.)" msgstr "(由 Victor Stinner 在 :issue:`12049` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1936 +#: ../../whatsnew/3.3.rst:1938 msgid "" "The :mod:`ssl` module now exposes a finer-grained exception hierarchy in " "order to make it easier to inspect the various kinds of errors. (Contributed " "by Antoine Pitrou in :issue:`11183`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1940 +#: ../../whatsnew/3.3.rst:1942 msgid "" ":meth:`~ssl.SSLContext.load_cert_chain` now accepts a *password* argument to " "be used if the private key is encrypted. (Contributed by Adam Simpkins in :" "issue:`12803`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1944 +#: ../../whatsnew/3.3.rst:1946 msgid "" "Diffie-Hellman key exchange, both regular and Elliptic Curve-based, is now " "supported through the :meth:`~ssl.SSLContext.load_dh_params` and :meth:`~ssl." @@ -3265,14 +3268,14 @@ msgid "" "`13626` and :issue:`13627`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1949 +#: ../../whatsnew/3.3.rst:1951 msgid "" "SSL sockets have a new :meth:`~ssl.SSLSocket.get_channel_binding` method " "allowing the implementation of certain authentication mechanisms such as " "SCRAM-SHA-1-PLUS. (Contributed by Jacek Konieczny in :issue:`12551`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1953 +#: ../../whatsnew/3.3.rst:1955 msgid "" "You can query the SSL compression algorithm used by an SSL socket, thanks to " "its new :meth:`~ssl.SSLSocket.compression` method. The new attribute :const:" @@ -3280,91 +3283,91 @@ msgid "" "Antoine Pitrou in :issue:`13634`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1958 +#: ../../whatsnew/3.3.rst:1960 msgid "" "Support has been added for the Next Protocol Negotiation extension using " "the :meth:`ssl.SSLContext.set_npn_protocols` method. (Contributed by Colin " "Marc in :issue:`14204`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1962 +#: ../../whatsnew/3.3.rst:1964 msgid "" "SSL errors can now be introspected more easily thanks to :attr:`~ssl." "SSLError.library` and :attr:`~ssl.SSLError.reason` attributes. (Contributed " "by Antoine Pitrou in :issue:`14837`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1966 +#: ../../whatsnew/3.3.rst:1968 msgid "" "The :func:`~ssl.get_server_certificate` function now supports IPv6. " "(Contributed by Charles-François Natali in :issue:`11811`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1969 +#: ../../whatsnew/3.3.rst:1971 msgid "" "New attribute :const:`~ssl.OP_CIPHER_SERVER_PREFERENCE` allows setting SSLv3 " "server sockets to use the server's cipher ordering preference rather than " "the client's (:issue:`13635`)." msgstr "" -#: ../../whatsnew/3.3.rst:1975 +#: ../../whatsnew/3.3.rst:1977 msgid "stat" msgstr "stat" -#: ../../whatsnew/3.3.rst:1977 +#: ../../whatsnew/3.3.rst:1979 msgid "" "The undocumented tarfile.filemode function has been moved to :func:`stat." "filemode`. It can be used to convert a file's mode to a string of the form '-" "rwxrwxrwx'." msgstr "" -#: ../../whatsnew/3.3.rst:1981 +#: ../../whatsnew/3.3.rst:1983 msgid "(Contributed by Giampaolo Rodolà in :issue:`14807`.)" msgstr "(由 Giampaolo Rodolà 在 :issue:`14807` 中貢獻。)" -#: ../../whatsnew/3.3.rst:1985 +#: ../../whatsnew/3.3.rst:1987 msgid "struct" msgstr "struct" -#: ../../whatsnew/3.3.rst:1987 +#: ../../whatsnew/3.3.rst:1989 msgid "" "The :mod:`struct` module now supports :c:type:`ssize_t` and :c:type:`size_t` " "via the new codes ``n`` and ``N``, respectively. (Contributed by Antoine " "Pitrou in :issue:`3163`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1993 +#: ../../whatsnew/3.3.rst:1995 msgid "subprocess" msgstr "subprocess" -#: ../../whatsnew/3.3.rst:1995 +#: ../../whatsnew/3.3.rst:1997 msgid "" "Command strings can now be bytes objects on posix platforms. (Contributed " "by Victor Stinner in :issue:`8513`.)" msgstr "" -#: ../../whatsnew/3.3.rst:1998 +#: ../../whatsnew/3.3.rst:2000 msgid "" "A new constant :const:`~subprocess.DEVNULL` allows suppressing output in a " "platform-independent fashion. (Contributed by Ross Lagerwall in :issue:" "`5870`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2004 +#: ../../whatsnew/3.3.rst:2006 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.3.rst:2006 +#: ../../whatsnew/3.3.rst:2008 msgid "" "The :mod:`sys` module has a new :data:`~sys.thread_info` :term:`named tuple` " "holding information about the thread implementation (:issue:`11223`)." msgstr "" -#: ../../whatsnew/3.3.rst:2012 +#: ../../whatsnew/3.3.rst:2014 msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.3.rst:2014 +#: ../../whatsnew/3.3.rst:2016 msgid "" ":mod:`tarfile` now supports ``lzma`` encoding via the :mod:`lzma` module. " "(Contributed by Lars Gustäbel in :issue:`5689`.)" @@ -3372,33 +3375,33 @@ msgstr "" ":mod:`tarfile` 現在透過 :mod:`lzma` 模組支援 ``lzma`` 編碼。(由 Lars " "Gustäbel 在 :issue:`5689` 中貢獻。)" -#: ../../whatsnew/3.3.rst:2019 +#: ../../whatsnew/3.3.rst:2021 msgid "tempfile" msgstr "tempfile" -#: ../../whatsnew/3.3.rst:2021 +#: ../../whatsnew/3.3.rst:2023 msgid "" ":class:`tempfile.SpooledTemporaryFile`\\'s :meth:`~tempfile." "SpooledTemporaryFile.truncate` method now accepts a ``size`` parameter. " "(Contributed by Ryan Kelly in :issue:`9957`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2027 +#: ../../whatsnew/3.3.rst:2029 msgid "textwrap" msgstr "textwrap" -#: ../../whatsnew/3.3.rst:2029 +#: ../../whatsnew/3.3.rst:2031 msgid "" "The :mod:`textwrap` module has a new :func:`~textwrap.indent` that makes it " "straightforward to add a common prefix to selected lines in a block of text " "(:issue:`13857`)." msgstr "" -#: ../../whatsnew/3.3.rst:2035 +#: ../../whatsnew/3.3.rst:2037 msgid "threading" msgstr "threading" -#: ../../whatsnew/3.3.rst:2037 +#: ../../whatsnew/3.3.rst:2039 msgid "" ":class:`threading.Condition`, :class:`threading.Semaphore`, :class:" "`threading.BoundedSemaphore`, :class:`threading.Event`, and :class:" @@ -3407,14 +3410,14 @@ msgid "" "Araujo in :issue:`10968`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2043 +#: ../../whatsnew/3.3.rst:2045 msgid "" "The :class:`threading.Thread` constructor now accepts a ``daemon`` keyword " "argument to override the default behavior of inheriting the ``daemon`` flag " "value from the parent thread (:issue:`6064`)." msgstr "" -#: ../../whatsnew/3.3.rst:2047 +#: ../../whatsnew/3.3.rst:2049 msgid "" "The formerly private function ``_thread.get_ident`` is now available as the " "public function :func:`threading.get_ident`. This eliminates several cases " @@ -3423,42 +3426,42 @@ msgid "" "public interface." msgstr "" -#: ../../whatsnew/3.3.rst:2055 +#: ../../whatsnew/3.3.rst:2057 msgid "time" msgstr "time" -#: ../../whatsnew/3.3.rst:2057 +#: ../../whatsnew/3.3.rst:2059 msgid "The :pep:`418` added new functions to the :mod:`time` module:" msgstr ":pep:`418` 向 :mod:`time` 模組新增了新功能:" -#: ../../whatsnew/3.3.rst:2059 +#: ../../whatsnew/3.3.rst:2061 msgid ":func:`~time.get_clock_info`: Get information on a clock." msgstr ":func:`~time.get_clock_info`:獲取時鐘資訊。" -#: ../../whatsnew/3.3.rst:2060 +#: ../../whatsnew/3.3.rst:2062 msgid "" ":func:`~time.monotonic`: Monotonic clock (cannot go backward), not affected " "by system clock updates." msgstr "" ":func:`~time.monotonic`:單調時鐘(不能倒退),不受系統時鐘更新的影響。" -#: ../../whatsnew/3.3.rst:2062 +#: ../../whatsnew/3.3.rst:2064 msgid "" ":func:`~time.perf_counter`: Performance counter with the highest available " "resolution to measure a short duration." msgstr "" -#: ../../whatsnew/3.3.rst:2064 +#: ../../whatsnew/3.3.rst:2066 msgid "" ":func:`~time.process_time`: Sum of the system and user CPU time of the " "current process." msgstr ":func:`~time.process_time`:當前行程的系統和使用者 CPU 時間總和。" -#: ../../whatsnew/3.3.rst:2067 +#: ../../whatsnew/3.3.rst:2069 msgid "Other new functions:" msgstr "其他新功能:" -#: ../../whatsnew/3.3.rst:2069 +#: ../../whatsnew/3.3.rst:2071 msgid "" ":func:`~time.clock_getres`, :func:`~time.clock_gettime` and :func:`~time." "clock_settime` functions with :samp:`CLOCK_{xxx}` constants. (Contributed by " @@ -3468,35 +3471,35 @@ msgstr "" "clock_settime` 函式帶有 :samp:`CLOCK_{xxx}` 常數。(由 Victor Stinner 在 :" "issue:`10278` 中貢獻。)" -#: ../../whatsnew/3.3.rst:2073 +#: ../../whatsnew/3.3.rst:2075 msgid "" "To improve cross platform consistency, :func:`~time.sleep` now raises a :exc:" "`ValueError` when passed a negative sleep value. Previously this was an " "error on posix, but produced an infinite sleep on Windows." msgstr "" -#: ../../whatsnew/3.3.rst:2079 +#: ../../whatsnew/3.3.rst:2081 msgid "types" msgstr "types" -#: ../../whatsnew/3.3.rst:2081 +#: ../../whatsnew/3.3.rst:2083 msgid "" "Add a new :class:`types.MappingProxyType` class: Read-only proxy of a " "mapping. (:issue:`14386`)" msgstr "" -#: ../../whatsnew/3.3.rst:2085 +#: ../../whatsnew/3.3.rst:2087 msgid "" "The new functions :func:`types.new_class` and :func:`types.prepare_class` " "provide support for :pep:`3115` compliant dynamic type creation. (:issue:" "`14588`)" msgstr "" -#: ../../whatsnew/3.3.rst:2090 +#: ../../whatsnew/3.3.rst:2092 msgid "unittest" msgstr "unittest" -#: ../../whatsnew/3.3.rst:2092 +#: ../../whatsnew/3.3.rst:2094 msgid "" ":meth:`.assertRaises`, :meth:`.assertRaisesRegex`, :meth:`.assertWarns`, " "and :meth:`.assertWarnsRegex` now accept a keyword argument *msg* when used " @@ -3504,37 +3507,37 @@ msgid "" "issue:`10775`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2097 +#: ../../whatsnew/3.3.rst:2099 msgid "" ":meth:`unittest.TestCase.run` now returns the :class:`~unittest.TestResult` " "object." msgstr "" ":meth:`unittest.TestCase.run` 現在回傳 :class:`~unittest.TestResult` 物件。" -#: ../../whatsnew/3.3.rst:2102 +#: ../../whatsnew/3.3.rst:2104 msgid "urllib" msgstr "urllib" -#: ../../whatsnew/3.3.rst:2104 +#: ../../whatsnew/3.3.rst:2106 msgid "" "The :class:`~urllib.request.Request` class, now accepts a *method* argument " "used by :meth:`~urllib.request.Request.get_method` to determine what HTTP " "method should be used. For example, this will send a ``'HEAD'`` request::" msgstr "" -#: ../../whatsnew/3.3.rst:2108 +#: ../../whatsnew/3.3.rst:2110 msgid ">>> urlopen(Request('https://www.python.org', method='HEAD'))" msgstr ">>> urlopen(Request('https://www.python.org', method='HEAD'))" -#: ../../whatsnew/3.3.rst:2110 +#: ../../whatsnew/3.3.rst:2112 msgid "(:issue:`1673007`)" msgstr "(:issue:`1673007`)" -#: ../../whatsnew/3.3.rst:2114 +#: ../../whatsnew/3.3.rst:2116 msgid "webbrowser" msgstr "webbrowser" -#: ../../whatsnew/3.3.rst:2116 +#: ../../whatsnew/3.3.rst:2118 msgid "" "The :mod:`webbrowser` module supports more \"browsers\": Google Chrome " "(named :program:`chrome`, :program:`chromium`, :program:`chrome-browser` or :" @@ -3545,11 +3548,11 @@ msgid "" "latter by Matthias Klose in :issue:`14493`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2126 +#: ../../whatsnew/3.3.rst:2128 msgid "xml.etree.ElementTree" msgstr "xml.etree.ElementTree" -#: ../../whatsnew/3.3.rst:2128 +#: ../../whatsnew/3.3.rst:2130 msgid "" "The :mod:`xml.etree.ElementTree` module now imports its C accelerator by " "default; there is no longer a need to explicitly import :mod:`xml.etree." @@ -3560,62 +3563,62 @@ msgid "" "detailed reference." msgstr "" -#: ../../whatsnew/3.3.rst:2138 +#: ../../whatsnew/3.3.rst:2140 msgid "zlib" msgstr "zlib" -#: ../../whatsnew/3.3.rst:2140 +#: ../../whatsnew/3.3.rst:2142 msgid "" "New attribute :attr:`zlib.Decompress.eof` makes it possible to distinguish " "between a properly formed compressed stream and an incomplete or truncated " "one. (Contributed by Nadeem Vawda in :issue:`12646`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2144 +#: ../../whatsnew/3.3.rst:2146 msgid "" "New attribute :const:`zlib.ZLIB_RUNTIME_VERSION` reports the version string " "of the underlying ``zlib`` library that is loaded at runtime. (Contributed " "by Torsten Landschoff in :issue:`12306`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2150 +#: ../../whatsnew/3.3.rst:2152 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.3.rst:2152 +#: ../../whatsnew/3.3.rst:2154 msgid "Major performance enhancements have been added:" msgstr "" -#: ../../whatsnew/3.3.rst:2154 +#: ../../whatsnew/3.3.rst:2156 msgid "" "Thanks to :pep:`393`, some operations on Unicode strings have been optimized:" msgstr "" -#: ../../whatsnew/3.3.rst:2156 +#: ../../whatsnew/3.3.rst:2158 msgid "the memory footprint is divided by 2 to 4 depending on the text" msgstr "" -#: ../../whatsnew/3.3.rst:2157 +#: ../../whatsnew/3.3.rst:2159 msgid "" "encode an ASCII string to UTF-8 doesn't need to encode characters anymore, " "the UTF-8 representation is shared with the ASCII representation" msgstr "" -#: ../../whatsnew/3.3.rst:2159 +#: ../../whatsnew/3.3.rst:2161 msgid "the UTF-8 encoder has been optimized" msgstr "" -#: ../../whatsnew/3.3.rst:2160 +#: ../../whatsnew/3.3.rst:2162 msgid "" "repeating a single ASCII letter and getting a substring of an ASCII string " "is 4 times faster" msgstr "" -#: ../../whatsnew/3.3.rst:2163 +#: ../../whatsnew/3.3.rst:2165 msgid "UTF-8 is now 2x to 4x faster. UTF-16 encoding is now up to 10x faster." msgstr "" -#: ../../whatsnew/3.3.rst:2165 +#: ../../whatsnew/3.3.rst:2167 msgid "" "(Contributed by Serhiy Storchaka, :issue:`14624`, :issue:`14738` and :issue:" "`15026`.)" @@ -3623,79 +3626,79 @@ msgstr "" "(由 Serhiy Storchaka 於 :issue:`14624`、:issue:`14738` 和 :issue:`15026` 貢" "獻。)" -#: ../../whatsnew/3.3.rst:2170 +#: ../../whatsnew/3.3.rst:2172 msgid "Build and C API Changes" msgstr "建置和 C API 更改" -#: ../../whatsnew/3.3.rst:2172 +#: ../../whatsnew/3.3.rst:2174 msgid "Changes to Python's build process and to the C API include:" msgstr "Python 建置程序和 C API 的更改包括:" -#: ../../whatsnew/3.3.rst:2174 +#: ../../whatsnew/3.3.rst:2176 msgid "New :pep:`3118` related function:" msgstr "新的 :pep:`3118` 相關功能:" -#: ../../whatsnew/3.3.rst:2176 +#: ../../whatsnew/3.3.rst:2178 msgid ":c:func:`PyMemoryView_FromMemory`" msgstr ":c:func:`PyMemoryView_FromMemory`" -#: ../../whatsnew/3.3.rst:2178 +#: ../../whatsnew/3.3.rst:2180 msgid ":pep:`393` added new Unicode types, macros and functions:" msgstr "" -#: ../../whatsnew/3.3.rst:2180 +#: ../../whatsnew/3.3.rst:2182 msgid "High-level API:" msgstr "高階 API:" -#: ../../whatsnew/3.3.rst:2182 +#: ../../whatsnew/3.3.rst:2184 msgid ":c:func:`PyUnicode_CopyCharacters`" msgstr ":c:func:`PyUnicode_CopyCharacters`" -#: ../../whatsnew/3.3.rst:2183 +#: ../../whatsnew/3.3.rst:2185 msgid ":c:func:`PyUnicode_FindChar`" msgstr ":c:func:`PyUnicode_FindChar`" -#: ../../whatsnew/3.3.rst:2184 +#: ../../whatsnew/3.3.rst:2186 msgid ":c:func:`PyUnicode_GetLength`, :c:macro:`PyUnicode_GET_LENGTH`" msgstr ":c:func:`PyUnicode_GetLength`, :c:macro:`PyUnicode_GET_LENGTH`" -#: ../../whatsnew/3.3.rst:2185 +#: ../../whatsnew/3.3.rst:2187 msgid ":c:func:`PyUnicode_New`" msgstr ":c:func:`PyUnicode_New`" -#: ../../whatsnew/3.3.rst:2186 +#: ../../whatsnew/3.3.rst:2188 msgid ":c:func:`PyUnicode_Substring`" msgstr ":c:func:`PyUnicode_Substring`" -#: ../../whatsnew/3.3.rst:2187 +#: ../../whatsnew/3.3.rst:2189 msgid ":c:func:`PyUnicode_ReadChar`, :c:func:`PyUnicode_WriteChar`" msgstr ":c:func:`PyUnicode_ReadChar`, :c:func:`PyUnicode_WriteChar`" -#: ../../whatsnew/3.3.rst:2189 +#: ../../whatsnew/3.3.rst:2191 msgid "Low-level API:" msgstr "低階 API:" -#: ../../whatsnew/3.3.rst:2191 +#: ../../whatsnew/3.3.rst:2193 msgid ":c:type:`Py_UCS1`, :c:type:`Py_UCS2`, :c:type:`Py_UCS4` types" msgstr ":c:type:`Py_UCS1`、:c:type:`Py_UCS2`、:c:type:`Py_UCS4` 型別" -#: ../../whatsnew/3.3.rst:2192 +#: ../../whatsnew/3.3.rst:2194 msgid ":c:type:`PyASCIIObject` and :c:type:`PyCompactUnicodeObject` structures" msgstr ":c:type:`PyASCIIObject` 和 :c:type:`PyCompactUnicodeObject` 結構" -#: ../../whatsnew/3.3.rst:2193 +#: ../../whatsnew/3.3.rst:2195 msgid ":c:macro:`PyUnicode_READY`" msgstr ":c:macro:`PyUnicode_READY`" -#: ../../whatsnew/3.3.rst:2194 +#: ../../whatsnew/3.3.rst:2196 msgid ":c:func:`PyUnicode_FromKindAndData`" msgstr ":c:func:`PyUnicode_FromKindAndData`" -#: ../../whatsnew/3.3.rst:2195 +#: ../../whatsnew/3.3.rst:2197 msgid ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" msgstr ":c:func:`PyUnicode_AsUCS4`, :c:func:`PyUnicode_AsUCS4Copy`" -#: ../../whatsnew/3.3.rst:2196 +#: ../../whatsnew/3.3.rst:2198 msgid "" ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" "`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" @@ -3703,14 +3706,14 @@ msgstr "" ":c:macro:`PyUnicode_DATA`, :c:macro:`PyUnicode_1BYTE_DATA`, :c:macro:" "`PyUnicode_2BYTE_DATA`, :c:macro:`PyUnicode_4BYTE_DATA`" -#: ../../whatsnew/3.3.rst:2198 +#: ../../whatsnew/3.3.rst:2200 msgid "" ":c:macro:`PyUnicode_KIND` with :c:enum:`PyUnicode_Kind` enum: :c:data:`!" "PyUnicode_WCHAR_KIND`, :c:data:`PyUnicode_1BYTE_KIND`, :c:data:" "`PyUnicode_2BYTE_KIND`, :c:data:`PyUnicode_4BYTE_KIND`" msgstr "" -#: ../../whatsnew/3.3.rst:2201 +#: ../../whatsnew/3.3.rst:2203 msgid "" ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" "`PyUnicode_WRITE`" @@ -3718,11 +3721,11 @@ msgstr "" ":c:macro:`PyUnicode_READ`, :c:macro:`PyUnicode_READ_CHAR`, :c:macro:" "`PyUnicode_WRITE`" -#: ../../whatsnew/3.3.rst:2202 +#: ../../whatsnew/3.3.rst:2204 msgid ":c:macro:`PyUnicode_MAX_CHAR_VALUE`" msgstr ":c:macro:`PyUnicode_MAX_CHAR_VALUE`" -#: ../../whatsnew/3.3.rst:2204 +#: ../../whatsnew/3.3.rst:2206 msgid "" ":c:macro:`PyArg_ParseTuple` now accepts a :class:`bytearray` for the ``c`` " "format (:issue:`12380`)." @@ -3730,46 +3733,46 @@ msgstr "" ":c:macro:`PyArg_ParseTuple` 現在接受 :class:`bytearray` 為 ``c`` 格式 (:" "issue:`12380`)。" -#: ../../whatsnew/3.3.rst:2210 +#: ../../whatsnew/3.3.rst:2212 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.3.rst:2213 +#: ../../whatsnew/3.3.rst:2215 msgid "Unsupported Operating Systems" msgstr "不支援的作業系統" -#: ../../whatsnew/3.3.rst:2215 +#: ../../whatsnew/3.3.rst:2217 msgid "OS/2 and VMS are no longer supported due to the lack of a maintainer." msgstr "由於缺乏維護者,OS/2 和 VMS 不再受支援。" -#: ../../whatsnew/3.3.rst:2217 +#: ../../whatsnew/3.3.rst:2219 msgid "" "Windows 2000 and Windows platforms which set ``COMSPEC`` to ``command.com`` " "are no longer supported due to maintenance burden." msgstr "" -#: ../../whatsnew/3.3.rst:2220 +#: ../../whatsnew/3.3.rst:2222 msgid "OSF support, which was deprecated in 3.2, has been completely removed." msgstr "OSF 支援在 3.2 中已棄用,現已完全刪除。" -#: ../../whatsnew/3.3.rst:2224 +#: ../../whatsnew/3.3.rst:2226 msgid "Deprecated Python modules, functions and methods" msgstr "已棄用的 Python 模組、函式和方法" -#: ../../whatsnew/3.3.rst:2226 +#: ../../whatsnew/3.3.rst:2228 msgid "" "Passing a non-empty string to ``object.__format__()`` is deprecated, and " "will produce a :exc:`TypeError` in Python 3.4 (:issue:`9856`)." msgstr "" -#: ../../whatsnew/3.3.rst:2228 +#: ../../whatsnew/3.3.rst:2230 msgid "" "The ``unicode_internal`` codec has been deprecated because of the :pep:" "`393`, use UTF-8, UTF-16 (``utf-16-le`` or ``utf-16-be``), or UTF-32 " "(``utf-32-le`` or ``utf-32-be``)" msgstr "" -#: ../../whatsnew/3.3.rst:2231 +#: ../../whatsnew/3.3.rst:2233 msgid "" ":meth:`ftplib.FTP.nlst` and :meth:`ftplib.FTP.dir`: use :meth:`ftplib.FTP." "mlsd`" @@ -3777,7 +3780,7 @@ msgstr "" ":meth:`ftplib.FTP.nlst` 和 :meth:`ftplib.FTP.dir`:使用 :meth:`ftplib.FTP." "mlsd`" -#: ../../whatsnew/3.3.rst:2233 +#: ../../whatsnew/3.3.rst:2235 msgid "" ":func:`platform.popen`: use the :mod:`subprocess` module. Check especially " "the :ref:`subprocess-replacements` section (:issue:`11377`)." @@ -3785,39 +3788,39 @@ msgstr "" ":func:`platform.popen`:使用 :mod:`subprocess` 模組。請特別檢查 :ref:" "`subprocess-replacements` 部分 (:issue:`11377`)。" -#: ../../whatsnew/3.3.rst:2235 +#: ../../whatsnew/3.3.rst:2237 msgid "" ":issue:`13374`: The Windows bytes API has been deprecated in the :mod:`os` " "module. Use Unicode filenames, instead of bytes filenames, to not depend on " "the ANSI code page anymore and to support any filename." msgstr "" -#: ../../whatsnew/3.3.rst:2238 +#: ../../whatsnew/3.3.rst:2240 msgid "" ":issue:`13988`: The :mod:`xml.etree.cElementTree` module is deprecated. The " "accelerator is used automatically whenever available." msgstr "" -#: ../../whatsnew/3.3.rst:2240 +#: ../../whatsnew/3.3.rst:2242 msgid "" "The behaviour of :func:`time.clock` depends on the platform: use the new :" "func:`time.perf_counter` or :func:`time.process_time` function instead, " "depending on your requirements, to have a well defined behaviour." msgstr "" -#: ../../whatsnew/3.3.rst:2243 +#: ../../whatsnew/3.3.rst:2245 msgid "The :func:`os.stat_float_times` function is deprecated." msgstr ":func:`os.stat_float_times` 函式已棄用。" -#: ../../whatsnew/3.3.rst:2244 +#: ../../whatsnew/3.3.rst:2246 msgid ":mod:`abc` module:" msgstr ":mod:`abc` 模組:" -#: ../../whatsnew/3.3.rst:2253 +#: ../../whatsnew/3.3.rst:2255 msgid ":mod:`importlib` package:" msgstr ":mod:`importlib` 套件:" -#: ../../whatsnew/3.3.rst:2255 +#: ../../whatsnew/3.3.rst:2257 msgid "" ":meth:`importlib.abc.SourceLoader.path_mtime` is now deprecated in favour " "of :meth:`importlib.abc.SourceLoader.path_stats` as bytecode files now store " @@ -3825,11 +3828,11 @@ msgid "" "compiled from." msgstr "" -#: ../../whatsnew/3.3.rst:2265 +#: ../../whatsnew/3.3.rst:2267 msgid "Deprecated functions and types of the C API" msgstr "C API 中已棄用的函式和型別" -#: ../../whatsnew/3.3.rst:2267 +#: ../../whatsnew/3.3.rst:2269 msgid "" "The :c:type:`Py_UNICODE` has been deprecated by :pep:`393` and will be " "removed in Python 4. All functions using this type are deprecated:" @@ -3837,13 +3840,13 @@ msgstr "" ":c:type:`Py_UNICODE` 已被 :pep:`393` 棄用,並將在 Python 4 中刪除。所有使用此" "型別的函式均已棄用:" -#: ../../whatsnew/3.3.rst:2270 +#: ../../whatsnew/3.3.rst:2272 msgid "" "Unicode functions and methods using :c:type:`Py_UNICODE` and :c:expr:" "`Py_UNICODE*` types:" msgstr "" -#: ../../whatsnew/3.3.rst:2273 +#: ../../whatsnew/3.3.rst:2275 msgid "" ":c:macro:`!PyUnicode_FromUnicode`: use :c:func:`PyUnicode_FromWideChar` or :" "c:func:`PyUnicode_FromKindAndData`" @@ -3851,7 +3854,7 @@ msgstr "" ":c:macro:`!PyUnicode_FromUnicode`:使用 :c:func:`PyUnicode_FromWideChar` 或 :" "c:func:`PyUnicode_FromKindAndData`" -#: ../../whatsnew/3.3.rst:2275 +#: ../../whatsnew/3.3.rst:2277 msgid "" ":c:macro:`!PyUnicode_AS_UNICODE`, :c:func:`!PyUnicode_AsUnicode`, :c:func:`!" "PyUnicode_AsUnicodeAndSize`: use :c:func:`PyUnicode_AsWideCharString`" @@ -3859,7 +3862,7 @@ msgstr "" ":c:macro:`!PyUnicode_AS_UNICODE`、:c:func:`!PyUnicode_AsUnicode`、:c:func:`!" "PyUnicode_AsUnicodeAndSize`:使用 :c:func:`PyUnicode_AsWideCharString`" -#: ../../whatsnew/3.3.rst:2277 +#: ../../whatsnew/3.3.rst:2279 msgid "" ":c:macro:`!PyUnicode_AS_DATA`: use :c:macro:`PyUnicode_DATA` with :c:macro:" "`PyUnicode_READ` and :c:macro:`PyUnicode_WRITE`" @@ -3867,7 +3870,7 @@ msgstr "" ":c:macro:`!PyUnicode_AS_DATA`:將 :c:macro:`PyUnicode_DATA` 與 :c:macro:" "`PyUnicode_READ` 和 :c:macro:`PyUnicode_WRITE` 一起使用" -#: ../../whatsnew/3.3.rst:2279 +#: ../../whatsnew/3.3.rst:2281 msgid "" ":c:macro:`!PyUnicode_GET_SIZE`, :c:func:`!PyUnicode_GetSize`: use :c:macro:" "`PyUnicode_GET_LENGTH` or :c:func:`PyUnicode_GetLength`" @@ -3875,7 +3878,7 @@ msgstr "" ":c:macro:`!PyUnicode_GET_SIZE`、:c:func:`!PyUnicode_GetSize`:使用 :c:macro:" "`PyUnicode_GET_LENGTH` 或 :c:func:`PyUnicode_GetLength`" -#: ../../whatsnew/3.3.rst:2281 +#: ../../whatsnew/3.3.rst:2283 msgid "" ":c:macro:`!PyUnicode_GET_DATA_SIZE`: use ``PyUnicode_GET_LENGTH(str) * " "PyUnicode_KIND(str)`` (only work on ready strings)" @@ -3883,7 +3886,7 @@ msgstr "" ":c:macro:`!PyUnicode_GET_DATA_SIZE`:使用 ``PyUnicode_GET_LENGTH(str) * " "PyUnicode_KIND(str)``\\ (僅適用於準備好的字串)" -#: ../../whatsnew/3.3.rst:2284 +#: ../../whatsnew/3.3.rst:2286 msgid "" ":c:func:`!PyUnicode_AsUnicodeCopy`: use :c:func:`PyUnicode_AsUCS4Copy` or :c:" "func:`PyUnicode_AsWideCharString`" @@ -3891,15 +3894,15 @@ msgstr "" ":c:func:`!PyUnicode_AsUnicodeCopy`:使用 :c:func:`PyUnicode_AsUCS4Copy` 或 :" "c:func:`PyUnicode_AsWideCharString`" -#: ../../whatsnew/3.3.rst:2286 +#: ../../whatsnew/3.3.rst:2288 msgid ":c:func:`!PyUnicode_GetMax`" msgstr ":c:func:`!PyUnicode_GetMax`" -#: ../../whatsnew/3.3.rst:2289 +#: ../../whatsnew/3.3.rst:2291 msgid "Functions and macros manipulating Py_UNICODE* strings:" msgstr "操作 Py_UNICODE* 字串的函式和巨集:" -#: ../../whatsnew/3.3.rst:2291 +#: ../../whatsnew/3.3.rst:2293 msgid "" ":c:macro:`!Py_UNICODE_strlen()`: use :c:func:`PyUnicode_GetLength` or :c:" "macro:`PyUnicode_GET_LENGTH`" @@ -3907,7 +3910,7 @@ msgstr "" ":c:macro:`!Py_UNICODE_strlen()`:使用 :c:func:`PyUnicode_GetLength` 或 :c:" "macro:`PyUnicode_GET_LENGTH`" -#: ../../whatsnew/3.3.rst:2293 +#: ../../whatsnew/3.3.rst:2295 msgid "" ":c:macro:`!Py_UNICODE_strcat()`: use :c:func:`PyUnicode_CopyCharacters` or :" "c:func:`PyUnicode_FromFormat`" @@ -3915,7 +3918,7 @@ msgstr "" ":c:macro:`!Py_UNICODE_strcat()`:使用 :c:func:`PyUnicode_CopyCharacters` 或 :" "c:func:`PyUnicode_FromFormat`" -#: ../../whatsnew/3.3.rst:2295 +#: ../../whatsnew/3.3.rst:2297 msgid "" ":c:macro:`!Py_UNICODE_strcpy()`, :c:macro:`!Py_UNICODE_strncpy()`, :c:macro:" "`!Py_UNICODE_COPY()`: use :c:func:`PyUnicode_CopyCharacters` or :c:func:" @@ -3925,15 +3928,15 @@ msgstr "" "`!Py_UNICODE_COPY()`:使用 :c:func:`PyUnicode_CopyCharacters` 或 :c:func:" "`PyUnicode_Substring`" -#: ../../whatsnew/3.3.rst:2298 +#: ../../whatsnew/3.3.rst:2300 msgid ":c:macro:`!Py_UNICODE_strcmp()`: use :c:func:`PyUnicode_Compare`" msgstr ":c:macro:`!Py_UNICODE_strcmp()`:使用 :c:func:`PyUnicode_Compare`" -#: ../../whatsnew/3.3.rst:2299 +#: ../../whatsnew/3.3.rst:2301 msgid ":c:macro:`!Py_UNICODE_strncmp()`: use :c:func:`PyUnicode_Tailmatch`" msgstr ":c:macro:`!Py_UNICODE_strncmp()`: 使用 :c:func:`PyUnicode_Tailmatch`" -#: ../../whatsnew/3.3.rst:2300 +#: ../../whatsnew/3.3.rst:2302 msgid "" ":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: use :c:" "func:`PyUnicode_FindChar`" @@ -3941,27 +3944,27 @@ msgstr "" ":c:macro:`!Py_UNICODE_strchr()`, :c:macro:`!Py_UNICODE_strrchr()`: 使用 :c:" "func:`PyUnicode_FindChar`" -#: ../../whatsnew/3.3.rst:2302 +#: ../../whatsnew/3.3.rst:2304 msgid ":c:macro:`!Py_UNICODE_FILL()`: use :c:func:`PyUnicode_Fill`" msgstr ":c:macro:`!Py_UNICODE_FILL()`: 使用 :c:func:`PyUnicode_Fill`" -#: ../../whatsnew/3.3.rst:2303 +#: ../../whatsnew/3.3.rst:2305 msgid ":c:macro:`!Py_UNICODE_MATCH`" msgstr ":c:macro:`!Py_UNICODE_MATCH`" -#: ../../whatsnew/3.3.rst:2305 +#: ../../whatsnew/3.3.rst:2307 msgid "Encoders:" msgstr "編碼器:" -#: ../../whatsnew/3.3.rst:2307 +#: ../../whatsnew/3.3.rst:2309 msgid ":c:func:`!PyUnicode_Encode`: use :c:func:`!PyUnicode_AsEncodedObject`" msgstr ":c:func:`!PyUnicode_Encode`:使用 :c:func:`!PyUnicode_AsEncodedObject`" -#: ../../whatsnew/3.3.rst:2308 +#: ../../whatsnew/3.3.rst:2310 msgid ":c:func:`!PyUnicode_EncodeUTF7`" msgstr ":c:func:`!PyUnicode_EncodeUTF7`" -#: ../../whatsnew/3.3.rst:2309 +#: ../../whatsnew/3.3.rst:2311 msgid "" ":c:func:`!PyUnicode_EncodeUTF8`: use :c:func:`PyUnicode_AsUTF8` or :c:func:" "`PyUnicode_AsUTF8String`" @@ -3969,15 +3972,15 @@ msgstr "" ":c:func:`!PyUnicode_EncodeUTF8`:使用 :c:func:`PyUnicode_AsUTF8` 或 :c:func:" "`PyUnicode_AsUTF8String`" -#: ../../whatsnew/3.3.rst:2311 +#: ../../whatsnew/3.3.rst:2313 msgid ":c:func:`!PyUnicode_EncodeUTF32`" msgstr ":c:func:`!PyUnicode_EncodeUTF32`" -#: ../../whatsnew/3.3.rst:2312 +#: ../../whatsnew/3.3.rst:2314 msgid ":c:func:`!PyUnicode_EncodeUTF16`" msgstr ":c:func:`!PyUnicode_EncodeUTF16`" -#: ../../whatsnew/3.3.rst:2313 +#: ../../whatsnew/3.3.rst:2315 msgid "" ":c:func:`!PyUnicode_EncodeUnicodeEscape` use :c:func:" "`PyUnicode_AsUnicodeEscapeString`" @@ -3985,7 +3988,7 @@ msgstr "" ":c:func:`!PyUnicode_EncodeUnicodeEscape` 使用 :c:func:" "`PyUnicode_AsUnicodeEscapeString`" -#: ../../whatsnew/3.3.rst:2315 +#: ../../whatsnew/3.3.rst:2317 msgid "" ":c:func:`!PyUnicode_EncodeRawUnicodeEscape` use :c:func:" "`PyUnicode_AsRawUnicodeEscapeString`" @@ -3993,26 +3996,26 @@ msgstr "" ":c:func:`!PyUnicode_EncodeRawUnicodeEscape` 使用 :c:func:" "`PyUnicode_AsRawUnicodeEscapeString`" -#: ../../whatsnew/3.3.rst:2317 +#: ../../whatsnew/3.3.rst:2319 msgid "" ":c:func:`!PyUnicode_EncodeLatin1`: use :c:func:`PyUnicode_AsLatin1String`" msgstr "" ":c:func:`!PyUnicode_EncodeLatin1`: 使用 :c:func:`PyUnicode_AsLatin1String`" -#: ../../whatsnew/3.3.rst:2318 +#: ../../whatsnew/3.3.rst:2320 msgid ":c:func:`!PyUnicode_EncodeASCII`: use :c:func:`PyUnicode_AsASCIIString`" msgstr "" ":c:func:`!PyUnicode_EncodeASCII`:使用 :c:func:`PyUnicode_AsASCIIString`" -#: ../../whatsnew/3.3.rst:2319 +#: ../../whatsnew/3.3.rst:2321 msgid ":c:func:`!PyUnicode_EncodeCharmap`" msgstr ":c:func:`!PyUnicode_EncodeCharmap`" -#: ../../whatsnew/3.3.rst:2320 +#: ../../whatsnew/3.3.rst:2322 msgid ":c:func:`!PyUnicode_TranslateCharmap`" msgstr ":c:func:`!PyUnicode_TranslateCharmap`" -#: ../../whatsnew/3.3.rst:2321 +#: ../../whatsnew/3.3.rst:2323 msgid "" ":c:func:`!PyUnicode_EncodeMBCS`: use :c:func:`PyUnicode_AsMBCSString` or :c:" "func:`PyUnicode_EncodeCodePage` (with ``CP_ACP`` code_page)" @@ -4020,7 +4023,7 @@ msgstr "" ":c:func:`!PyUnicode_EncodeMBCS`:使用 :c:func:`PyUnicode_AsMBCSString` 或 :c:" "func:`PyUnicode_EncodeCodePage` (帶有 ``CP_ACP`` code_page)" -#: ../../whatsnew/3.3.rst:2323 +#: ../../whatsnew/3.3.rst:2325 msgid "" ":c:func:`!PyUnicode_EncodeDecimal`, :c:func:`!" "PyUnicode_TransformDecimalToASCII`" @@ -4028,38 +4031,38 @@ msgstr "" ":c:func:`!PyUnicode_EncodeDecimal`、:c:func:`!" "PyUnicode_TransformDecimalToASCII`" -#: ../../whatsnew/3.3.rst:2328 +#: ../../whatsnew/3.3.rst:2330 msgid "Deprecated features" msgstr "已棄用的功能" -#: ../../whatsnew/3.3.rst:2330 +#: ../../whatsnew/3.3.rst:2332 msgid "" "The :mod:`array` module's ``'u'`` format code is now deprecated and will be " "removed in Python 4 together with the rest of the (:c:type:`Py_UNICODE`) API." msgstr "" -#: ../../whatsnew/3.3.rst:2335 +#: ../../whatsnew/3.3.rst:2337 msgid "Porting to Python 3.3" msgstr "移植到 Python 3.3" -#: ../../whatsnew/3.3.rst:2337 +#: ../../whatsnew/3.3.rst:2339 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "本節列出了前面描述的更改以及可能需要你更改程式碼的其他錯誤修復。" -#: ../../whatsnew/3.3.rst:2343 +#: ../../whatsnew/3.3.rst:2345 msgid "Porting Python code" msgstr "移植 Python 程式碼" -#: ../../whatsnew/3.3.rst:2345 +#: ../../whatsnew/3.3.rst:2347 msgid "" "Hash randomization is enabled by default. Set the :envvar:`PYTHONHASHSEED` " "environment variable to ``0`` to disable hash randomization. See also the :" "meth:`object.__hash__` method." msgstr "" -#: ../../whatsnew/3.3.rst:2349 +#: ../../whatsnew/3.3.rst:2351 msgid "" ":issue:`12326`: On Linux, sys.platform doesn't contain the major version " "anymore. It is now always 'linux', instead of 'linux2' or 'linux3' depending " @@ -4068,7 +4071,7 @@ msgid "" "if you don't need to support older Python versions." msgstr "" -#: ../../whatsnew/3.3.rst:2355 +#: ../../whatsnew/3.3.rst:2357 msgid "" ":issue:`13847`, :issue:`14180`: :mod:`time` and :mod:`datetime`: :exc:" "`OverflowError` is now raised instead of :exc:`ValueError` if a timestamp is " @@ -4076,7 +4079,7 @@ msgid "" "or :c:func:`localtime` failed." msgstr "" -#: ../../whatsnew/3.3.rst:2360 +#: ../../whatsnew/3.3.rst:2362 msgid "" "The default finders used by import now utilize a cache of what is contained " "within a specific directory. If you create a Python source file or " @@ -4085,7 +4088,7 @@ msgid "" "file." msgstr "" -#: ../../whatsnew/3.3.rst:2365 +#: ../../whatsnew/3.3.rst:2367 msgid "" ":exc:`ImportError` now uses the full name of the module that was attempted " "to be imported. Doctests that check ImportErrors' message will need to be " @@ -4093,7 +4096,7 @@ msgid "" "name." msgstr "" -#: ../../whatsnew/3.3.rst:2370 +#: ../../whatsnew/3.3.rst:2372 msgid "" "The *index* argument to :func:`__import__` now defaults to 0 instead of -1 " "and no longer support negative values. It was an oversight when :pep:`328` " @@ -4104,20 +4107,20 @@ msgid "" "import_module` rather than call :func:`__import__` directly." msgstr "" -#: ../../whatsnew/3.3.rst:2378 +#: ../../whatsnew/3.3.rst:2380 msgid "" ":func:`__import__` no longer allows one to use an index value other than 0 " "for top-level modules. E.g. ``__import__('sys', level=1)`` is now an error." msgstr "" -#: ../../whatsnew/3.3.rst:2381 +#: ../../whatsnew/3.3.rst:2383 msgid "" "Because :data:`sys.meta_path` and :data:`sys.path_hooks` now have finders on " "them by default, you will most likely want to use :meth:`list.insert` " "instead of :meth:`list.append` to add to those lists." msgstr "" -#: ../../whatsnew/3.3.rst:2385 +#: ../../whatsnew/3.3.rst:2387 msgid "" "Because ``None`` is now inserted into :data:`sys.path_importer_cache`, if " "you are clearing out entries in the dictionary of paths that do not have a " @@ -4128,7 +4131,7 @@ msgid "" "finders, but semantically it should not change anything." msgstr "" -#: ../../whatsnew/3.3.rst:2393 +#: ../../whatsnew/3.3.rst:2395 msgid "" ":class:`!importlib.abc.Finder` no longer specifies a ``find_module()`` " "abstract method that must be implemented. If you were relying on subclasses " @@ -4137,7 +4140,7 @@ msgid "" "in the case of working with :term:`path entry finders <path entry finder>`." msgstr "" -#: ../../whatsnew/3.3.rst:2399 +#: ../../whatsnew/3.3.rst:2401 msgid "" ":mod:`pkgutil` has been converted to use :mod:`importlib` internally. This " "eliminates many edge cases where the old behaviour of the :pep:`302` import " @@ -4148,7 +4151,7 @@ msgid "" "do not provide the non-standard ``iter_modules()`` method." msgstr "" -#: ../../whatsnew/3.3.rst:2407 +#: ../../whatsnew/3.3.rst:2409 msgid "" "A longstanding RFC-compliance bug (:issue:`1079`) in the parsing done by :" "func:`email.header.decode_header` has been fixed. Code that uses the " @@ -4162,7 +4165,7 @@ msgid "" "already present in the input strings." msgstr "" -#: ../../whatsnew/3.3.rst:2418 +#: ../../whatsnew/3.3.rst:2420 msgid "" ":func:`email.utils.formataddr` now does the correct content transfer " "encoding when passed non-``ASCII`` display names. Any code that depended on " @@ -4170,7 +4173,7 @@ msgid "" "formatted output string will need to be changed (:issue:`1690608`)." msgstr "" -#: ../../whatsnew/3.3.rst:2423 +#: ../../whatsnew/3.3.rst:2425 msgid "" ":meth:`poplib.POP3.quit` may now raise protocol errors like all other " "``poplib`` methods. Code that assumes ``quit`` does not raise :exc:`poplib." @@ -4178,7 +4181,7 @@ msgid "" "encountered by a particular application (:issue:`11291`)." msgstr "" -#: ../../whatsnew/3.3.rst:2428 +#: ../../whatsnew/3.3.rst:2430 msgid "" "The ``strict`` argument to :class:`email.parser.Parser`, deprecated since " "Python 2.4, has finally been removed." @@ -4186,51 +4189,51 @@ msgstr "" "自 Python 2.4 以來已棄用的 :class:`email.parser.Parser` 的 ``strict`` 引數終" "於被刪除了。" -#: ../../whatsnew/3.3.rst:2431 +#: ../../whatsnew/3.3.rst:2433 msgid "" "The deprecated method ``unittest.TestCase.assertSameElements`` has been " "removed." msgstr "已棄用的方法 ``unittest.TestCase.assertSameElements`` 已被刪除。" -#: ../../whatsnew/3.3.rst:2434 +#: ../../whatsnew/3.3.rst:2436 msgid "The deprecated variable ``time.accept2dyear`` has been removed." msgstr "已棄用的變數 ``time.accept2dyear`` 已被刪除。" -#: ../../whatsnew/3.3.rst:2436 +#: ../../whatsnew/3.3.rst:2438 msgid "" "The deprecated ``Context._clamp`` attribute has been removed from the :mod:" "`decimal` module. It was previously replaced by the public attribute :attr:" "`~decimal.Context.clamp`. (See :issue:`8540`.)" msgstr "" -#: ../../whatsnew/3.3.rst:2440 +#: ../../whatsnew/3.3.rst:2442 msgid "" "The undocumented internal helper class ``SSLFakeFile`` has been removed " "from :mod:`smtplib`, since its functionality has long been provided directly " "by :meth:`socket.socket.makefile`." msgstr "" -#: ../../whatsnew/3.3.rst:2444 +#: ../../whatsnew/3.3.rst:2446 msgid "" "Passing a negative value to :func:`time.sleep` on Windows now raises an " "error instead of sleeping forever. It has always raised an error on posix." msgstr "" -#: ../../whatsnew/3.3.rst:2447 +#: ../../whatsnew/3.3.rst:2449 msgid "" "The ``ast.__version__`` constant has been removed. If you need to make " "decisions affected by the AST version, use :data:`sys.version_info` to make " "the decision." msgstr "" -#: ../../whatsnew/3.3.rst:2451 +#: ../../whatsnew/3.3.rst:2453 msgid "" "Code that used to work around the fact that the :mod:`threading` module used " "factory functions by subclassing the private classes will need to change to " "subclass the now-public classes." msgstr "" -#: ../../whatsnew/3.3.rst:2455 +#: ../../whatsnew/3.3.rst:2457 msgid "" "The undocumented debugging machinery in the threading module has been " "removed, simplifying the code. This should have no effect on production " @@ -4238,24 +4241,24 @@ msgid "" "interacting with it (:issue:`13550`)." msgstr "" -#: ../../whatsnew/3.3.rst:2462 +#: ../../whatsnew/3.3.rst:2464 msgid "Porting C code" msgstr "" -#: ../../whatsnew/3.3.rst:2464 +#: ../../whatsnew/3.3.rst:2466 msgid "" "In the course of changes to the buffer API the undocumented :c:member:`!" "smalltable` member of the :c:type:`Py_buffer` structure has been removed and " "the layout of the :c:type:`PyMemoryViewObject` has changed." msgstr "" -#: ../../whatsnew/3.3.rst:2469 +#: ../../whatsnew/3.3.rst:2471 msgid "" "All extensions relying on the relevant parts in ``memoryobject.h`` or " "``object.h`` must be rebuilt." msgstr "" -#: ../../whatsnew/3.3.rst:2472 +#: ../../whatsnew/3.3.rst:2474 msgid "" "Due to :ref:`PEP 393 <pep-393>`, the :c:type:`Py_UNICODE` type and all " "functions using this type are deprecated (but will stay available for at " @@ -4265,7 +4268,7 @@ msgid "" "doc:`Unicode API <../c-api/unicode>`." msgstr "" -#: ../../whatsnew/3.3.rst:2479 +#: ../../whatsnew/3.3.rst:2481 msgid "" "However, if you only have been using high-level functions such as :c:func:" "`PyUnicode_Concat()`, :c:func:`PyUnicode_Join` or :c:func:" @@ -4273,11 +4276,11 @@ msgid "" "new unicode representations." msgstr "" -#: ../../whatsnew/3.3.rst:2484 +#: ../../whatsnew/3.3.rst:2486 msgid ":c:func:`PyImport_GetMagicNumber` now returns ``-1`` upon failure." msgstr ":c:func:`PyImport_GetMagicNumber` 現在在失敗時回傳 ``-1``。" -#: ../../whatsnew/3.3.rst:2486 +#: ../../whatsnew/3.3.rst:2488 msgid "" "As a negative value for the *level* argument to :func:`__import__` is no " "longer valid, the same now holds for :c:func:`PyImport_ImportModuleLevel`. " @@ -4285,11 +4288,11 @@ msgid "" "`PyImport_ImportModuleEx` is now ``0`` instead of ``-1``." msgstr "" -#: ../../whatsnew/3.3.rst:2493 +#: ../../whatsnew/3.3.rst:2495 msgid "Building C extensions" msgstr "" -#: ../../whatsnew/3.3.rst:2495 +#: ../../whatsnew/3.3.rst:2497 msgid "" "The range of possible file names for C extensions has been narrowed. Very " "rarely used spellings have been suppressed: under POSIX, files named " @@ -4299,32 +4302,32 @@ msgid "" "remove the ``module`` string from the file names)." msgstr "" -#: ../../whatsnew/3.3.rst:2503 +#: ../../whatsnew/3.3.rst:2505 msgid "(implemented in :issue:`14040`.)" msgstr "(於 :issue:`14040` 中實作。)" -#: ../../whatsnew/3.3.rst:2507 +#: ../../whatsnew/3.3.rst:2509 msgid "Command Line Switch Changes" msgstr "命令列開關更改" -#: ../../whatsnew/3.3.rst:2509 +#: ../../whatsnew/3.3.rst:2511 msgid "" "The -Q command-line flag and related artifacts have been removed. Code " "checking sys.flags.division_warning will need updating." msgstr "" -#: ../../whatsnew/3.3.rst:2512 +#: ../../whatsnew/3.3.rst:2514 msgid "(:issue:`10998`, contributed by Éric Araujo.)" msgstr "(由 Éric Araujo 於 :issue:`10998` 中實作。)" -#: ../../whatsnew/3.3.rst:2514 +#: ../../whatsnew/3.3.rst:2516 msgid "" "When :program:`python` is started with :option:`-S`, ``import site`` will no " "longer add site-specific paths to the module search paths. In previous " "versions, it did." msgstr "" -#: ../../whatsnew/3.3.rst:2518 +#: ../../whatsnew/3.3.rst:2520 msgid "" "(:issue:`11591`, contributed by Carl Meyer with editions by Éric Araujo.)" msgstr "(:issue:`11591`,由 Carl Meyer 貢獻並由 Éric Araujo 修訂。)" diff --git a/whatsnew/3.4.po b/whatsnew/3.4.po index 8e82dabafa..8323096a63 100644 --- a/whatsnew/3.4.po +++ b/whatsnew/3.4.po @@ -4,9 +4,9 @@ # Translators: msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+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-" @@ -35,14 +35,17 @@ msgid "" "Python 3.4 was released on March 16, 2014. For full details, see the " "`changelog <https://docs.python.org/3.4/whatsnew/changelog.html>`_." msgstr "" +"本文介紹了 Python 3.4 與 3.3 相比多了哪些新功能。Python 3.1 已於 2014 年 3 " +"月 16 日發布。完整詳情請見 `changelog <https://docs.python.org/3.4/whatsnew/" +"changelog.html>`_。" #: ../../whatsnew/3.4.rst:70 msgid ":pep:`429` -- Python 3.4 Release Schedule" -msgstr "" +msgstr ":pep:`429` - Python 3.4 發佈時程" #: ../../whatsnew/3.4.rst:75 msgid "Summary -- Release Highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.4.rst:80 msgid "New syntax features:" @@ -279,7 +282,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:175 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.4.rst:180 msgid "PEP 453: Explicit Bootstrapping of PIP in Python Installations" @@ -899,23 +902,23 @@ msgstr "aifc" #: ../../whatsnew/3.4.rst:607 msgid "" -"The :meth:`~aifc.aifc.getparams` method now returns a namedtuple rather than " -"a plain tuple. (Contributed by Claudiu Popa in :issue:`17818`.)" +"The :meth:`!getparams` method now returns a namedtuple rather than a plain " +"tuple. (Contributed by Claudiu Popa in :issue:`17818`.)" msgstr "" #: ../../whatsnew/3.4.rst:610 msgid "" -":func:`aifc.open` now supports the context management protocol: when used in " -"a :keyword:`with` block, the :meth:`~aifc.aifc.close` method of the returned " -"object will be called automatically at the end of the block. (Contributed " -"by Serhiy Storchacha in :issue:`16486`.)" +":func:`!aifc.open` now supports the context management protocol: when used " +"in a :keyword:`with` block, the :meth:`!close` method of the returned object " +"will be called automatically at the end of the block. (Contributed by " +"Serhiy Storchacha in :issue:`16486`.)" msgstr "" -#: ../../whatsnew/3.4.rst:615 +#: ../../whatsnew/3.4.rst:615 ../../whatsnew/3.4.rst:1542 msgid "" -"The :meth:`~aifc.aifc.writeframesraw` and :meth:`~aifc.aifc.writeframes` " -"methods now accept any :term:`bytes-like object`. (Contributed by Serhiy " -"Storchaka in :issue:`8311`.)" +"The :meth:`!writeframesraw` and :meth:`!writeframes` methods now accept any :" +"term:`bytes-like object`. (Contributed by Serhiy Storchaka in :issue:" +"`8311`.)" msgstr "" #: ../../whatsnew/3.4.rst:621 @@ -935,19 +938,19 @@ msgstr "audioop" #: ../../whatsnew/3.4.rst:631 msgid "" -":mod:`audioop` now supports 24-bit samples. (Contributed by Serhiy " +":mod:`!audioop` now supports 24-bit samples. (Contributed by Serhiy " "Storchaka in :issue:`12866`.)" msgstr "" #: ../../whatsnew/3.4.rst:634 msgid "" -"New :func:`~audioop.byteswap` function converts big-endian samples to little-" -"endian and vice versa. (Contributed by Serhiy Storchaka in :issue:`19641`.)" +"New :func:`!byteswap` function converts big-endian samples to little-endian " +"and vice versa. (Contributed by Serhiy Storchaka in :issue:`19641`.)" msgstr "" #: ../../whatsnew/3.4.rst:638 msgid "" -"All :mod:`audioop` functions now accept any :term:`bytes-like object`. " +"All :mod:`!audioop` functions now accept any :term:`bytes-like object`. " "Strings are not accepted: they didn't work before, now they raise an error " "right away. (Contributed by Serhiy Storchaka in :issue:`16685`.)" msgstr "" @@ -2194,13 +2197,13 @@ msgstr "sunau" #: ../../whatsnew/3.4.rst:1530 msgid "" -"The :meth:`~sunau.getparams` method now returns a namedtuple rather than a " -"plain tuple. (Contributed by Claudiu Popa in :issue:`18901`.)" +"The :meth:`!getparams` method now returns a namedtuple rather than a plain " +"tuple. (Contributed by Claudiu Popa in :issue:`18901`.)" msgstr "" #: ../../whatsnew/3.4.rst:1533 msgid "" -":meth:`sunau.open` now supports the context management protocol: when used " +":meth:`!sunau.open` now supports the context management protocol: when used " "in a :keyword:`with` block, the ``close`` method of the returned object will " "be called automatically at the end of the block. (Contributed by Serhiy " "Storchaka in :issue:`18878`.)" @@ -2213,13 +2216,6 @@ msgid "" "Storchaka in :issue:`19261`.)" msgstr "" -#: ../../whatsnew/3.4.rst:1542 -msgid "" -"The :meth:`~sunau.AU_write.writeframesraw` and :meth:`~sunau.AU_write." -"writeframes` methods now accept any :term:`bytes-like object`. (Contributed " -"by Serhiy Storchaka in :issue:`8311`.)" -msgstr "" - #: ../../whatsnew/3.4.rst:1548 msgid "sys" msgstr "sys" @@ -2700,8 +2696,8 @@ msgstr "" #: ../../whatsnew/3.4.rst:1893 msgid "" -"The new :c:func:`Py_SetStandardStreamEncoding` pre-initialization API allows " -"applications embedding the CPython interpreter to reliably force a " +"The new :c:func:`!Py_SetStandardStreamEncoding` pre-initialization API " +"allows applications embedding the CPython interpreter to reliably force a " "particular encoding and error handler for the standard streams. (Contributed " "by Bastien Montagne and Nick Coghlan in :issue:`16129`.)" msgstr "" @@ -3223,7 +3219,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:2239 msgid "Porting to Python 3.4" -msgstr "" +msgstr "移植至 Python 3.4" #: ../../whatsnew/3.4.rst:2241 msgid "" @@ -3412,13 +3408,12 @@ msgstr "" #: ../../whatsnew/3.4.rst:2372 msgid "" -"The :attr:`~cgi.FieldStorage.file` attribute is now automatically closed " -"when the creating :class:`cgi.FieldStorage` instance is garbage collected. " -"If you were pulling the file object out separately from the :class:`cgi." -"FieldStorage` instance and not keeping the instance alive, then you should " -"either store the entire :class:`cgi.FieldStorage` instance or read the " -"contents of the file before the :class:`cgi.FieldStorage` instance is " -"garbage collected." +"The :attr:`!file` attribute is now automatically closed when the creating :" +"class:`!cgi.FieldStorage` instance is garbage collected. If you were pulling " +"the file object out separately from the :class:`!cgi.FieldStorage` instance " +"and not keeping the instance alive, then you should either store the entire :" +"class:`!cgi.FieldStorage` instance or read the contents of the file before " +"the :class:`!cgi.FieldStorage` instance is garbage collected." msgstr "" #: ../../whatsnew/3.4.rst:2379 @@ -3514,7 +3509,7 @@ msgstr "" #: ../../whatsnew/3.4.rst:2436 msgid "" -":mod:`audioop` functions now raise an error immediately if passed string " +":mod:`!audioop` functions now raise an error immediately if passed string " "input, instead of failing randomly later on (:issue:`16685`)." msgstr "" diff --git a/whatsnew/3.5.po b/whatsnew/3.5.po index 8607e5e9b6..43c8937a1d 100644 --- a/whatsnew/3.5.po +++ b/whatsnew/3.5.po @@ -6,9 +6,9 @@ # Noah Chen <noahcse@gmail.com>, 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 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-" @@ -37,14 +37,17 @@ msgid "" "Python 3.5 was released on September 13, 2015.  See the `changelog <https://" "docs.python.org/3.5/whatsnew/changelog.html>`_ for a full list of changes." msgstr "" +"本文介紹了 Python 3.5 與 3.4 相比多了哪些新功能。Python 3.1 已於 2015 年 9 " +"月 13 日發布。完整詳情請見 `changelog <https://docs.python.org/3.5/whatsnew/" +"changelog.html>`_。" #: ../../whatsnew/3.5.rst:54 msgid ":pep:`478` - Python 3.5 Release Schedule" -msgstr "" +msgstr ":pep:`478` - Python 3.5 發佈時程" #: ../../whatsnew/3.5.rst:58 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.5.rst:60 msgid "New syntax features:" @@ -143,7 +146,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:110 msgid "Significant improvements in the standard library:" -msgstr "" +msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.5.rst:112 msgid "" @@ -223,7 +226,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:163 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.5.rst:168 msgid "PEP 492 - Coroutines with async and await syntax" @@ -1376,8 +1379,8 @@ msgstr "cgi" #: ../../whatsnew/3.5.rst:881 msgid "" -"The :class:`~cgi.FieldStorage` class now supports the :term:`context " -"manager` protocol. (Contributed by Berker Peksag in :issue:`20289`.)" +"The :class:`!FieldStorage` class now supports the :term:`context manager` " +"protocol. (Contributed by Berker Peksag in :issue:`20289`.)" msgstr "" #: ../../whatsnew/3.5.rst:886 @@ -1952,9 +1955,9 @@ msgstr "imghdr" #: ../../whatsnew/3.5.rst:1255 msgid "" -"The :func:`~imghdr.what` function now recognizes the `OpenEXR <https://www." -"openexr.com>`_ format (contributed by Martin Vignali and Claudiu Popa in :" -"issue:`20295`), and the `WebP <https://en.wikipedia.org/wiki/WebP>`_ format " +"The :func:`!what` function now recognizes the `OpenEXR <https://www.openexr." +"com>`_ format (contributed by Martin Vignali and Claudiu Popa in :issue:" +"`20295`), and the `WebP <https://en.wikipedia.org/wiki/WebP>`_ format " "(contributed by Fabrice Aneche and Claudiu Popa in :issue:`20197`.)" msgstr "" @@ -2685,9 +2688,8 @@ msgstr "sndhdr" #: ../../whatsnew/3.5.rst:1717 msgid "" -"The :func:`~sndhdr.what` and :func:`~sndhdr.whathdr` functions now return " -"a :func:`~collections.namedtuple`. (Contributed by Claudiu Popa in :issue:" -"`18615`.)" +"The :func:`!what` and :func:`!whathdr` functions now return a :func:" +"`~collections.namedtuple`. (Contributed by Claudiu Popa in :issue:`18615`.)" msgstr "" #: ../../whatsnew/3.5.rst:1723 @@ -3240,7 +3242,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:2099 msgid "" -"Many functions in the :mod:`mmap`, :mod:`ossaudiodev`, :mod:`socket`, :mod:" +"Many functions in the :mod:`mmap`, :mod:`!ossaudiodev`, :mod:`socket`, :mod:" "`ssl`, and :mod:`codecs` modules now accept writable :term:`bytes-like " "objects <bytes-like object>`. (Contributed by Serhiy Storchaka in :issue:" "`23001`.)" @@ -3695,7 +3697,7 @@ msgstr "" #: ../../whatsnew/3.5.rst:2377 msgid "Porting to Python 3.5" -msgstr "" +msgstr "移植至 Python 3.5" #: ../../whatsnew/3.5.rst:2379 msgid "" @@ -3928,10 +3930,11 @@ msgstr "" #: ../../whatsnew/3.5.rst:2529 msgid "" -"Because the lack of the :attr:`__module__` attribute breaks pickling and " -"introspection, a deprecation warning is now raised for builtin types without " -"the :attr:`__module__` attribute. This would be an AttributeError in the " -"future. (Contributed by Serhiy Storchaka in :issue:`20204`.)" +"Because the lack of the :attr:`~type.__module__` attribute breaks pickling " +"and introspection, a deprecation warning is now raised for builtin types " +"without the :attr:`~type.__module__` attribute. This will be an :exc:" +"`AttributeError` in the future. (Contributed by Serhiy Storchaka in :issue:" +"`20204`.)" msgstr "" #: ../../whatsnew/3.5.rst:2535 diff --git a/whatsnew/3.6.po b/whatsnew/3.6.po index 67826bcc28..53d989f8b5 100644 --- a/whatsnew/3.6.po +++ b/whatsnew/3.6.po @@ -2,9 +2,9 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-01 22:24+0800\n" +"POT-Creation-Date: 2024-09-27 00:14+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" "tw)\n" @@ -32,14 +32,17 @@ msgid "" "Python 3.6 was released on December 23, 2016.  See the `changelog <https://" "docs.python.org/3.6/whatsnew/changelog.html>`_ for a full list of changes." msgstr "" +"本文介紹了 Python 3.6 與 3.5 相比多了哪些新功能。Python 3.6 已於 2016 年 12 " +"月 23 日發布。完整詳情請見 `changelog <https://docs.python.org/3.6/whatsnew/" +"changelog.html>`_。" #: ../../whatsnew/3.6.rst:54 msgid ":pep:`494` - Python 3.6 Release Schedule" -msgstr "" +msgstr ":pep:`494` - Python 3.6 發佈時程" #: ../../whatsnew/3.6.rst:58 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.6.rst:60 msgid "New syntax features:" @@ -121,7 +124,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:105 msgid "Significant improvements in the standard library:" -msgstr "" +msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.6.rst:107 msgid "" @@ -234,7 +237,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:176 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.6.rst:181 msgid "PEP 498: Formatted string literals" @@ -771,7 +774,7 @@ msgstr "" msgid "" "Attributes in a class definition body have a natural ordering: the same " "order in which the names appear in the source. This order is now preserved " -"in the new class's :attr:`~object.__dict__` attribute." +"in the new class's :attr:`~type.__dict__` attribute." msgstr "" #: ../../whatsnew/3.6.rst:554 @@ -1368,9 +1371,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:935 msgid "" "The :func:`~collections.namedtuple` function now accepts an optional keyword " -"argument *module*, which, when specified, is used for the ``__module__`` " -"attribute of the returned named tuple class. (Contributed by Raymond " -"Hettinger in :issue:`17941`.)" +"argument *module*, which, when specified, is used for the :attr:`~type." +"__module__` attribute of the returned named tuple class. (Contributed by " +"Raymond Hettinger in :issue:`17941`.)" msgstr "" #: ../../whatsnew/3.6.rst:940 ../../whatsnew/3.6.rst:2295 @@ -2228,7 +2231,7 @@ msgstr "telnetlib" #: ../../whatsnew/3.6.rst:1527 msgid "" -":class:`~telnetlib.Telnet` is now a context manager (contributed by Stéphane " +":class:`!telnetlib.Telnet` is now a context manager (contributed by Stéphane " "Wirtel in :issue:`25485`)." msgstr "" @@ -3017,7 +3020,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:2056 msgid "" -"The :mod:`tkinter.tix` module is now deprecated. :mod:`tkinter` users " +"The :mod:`!tkinter.tix` module is now deprecated. :mod:`tkinter` users " "should use :mod:`tkinter.ttk` instead." msgstr "" @@ -3130,7 +3133,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:2142 msgid "Porting to Python 3.6" -msgstr "" +msgstr "移植至 Python 3.6" #: ../../whatsnew/3.6.rst:2144 msgid "" @@ -3224,7 +3227,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:2200 msgid "" "The following modules have had missing APIs added to their :attr:`__all__` " -"attributes to match the documented APIs: :mod:`calendar`, :mod:`cgi`, :mod:" +"attributes to match the documented APIs: :mod:`calendar`, :mod:`!cgi`, :mod:" "`csv`, :mod:`~xml.etree.ElementTree`, :mod:`enum`, :mod:`fileinput`, :mod:" "`ftplib`, :mod:`logging`, :mod:`mailbox`, :mod:`mimetypes`, :mod:" "`optparse`, :mod:`plistlib`, :mod:`!smtpd`, :mod:`subprocess`, :mod:" @@ -3260,7 +3263,7 @@ msgstr "" #: ../../whatsnew/3.6.rst:2228 msgid "" -":func:`spwd.getspnam` now raises a :exc:`PermissionError` instead of :exc:" +":func:`!spwd.getspnam` now raises a :exc:`PermissionError` instead of :exc:" "`KeyError` if the user doesn't have privileges." msgstr "" @@ -3351,9 +3354,9 @@ msgstr "" #: ../../whatsnew/3.6.rst:2291 msgid "" -"The :const:`crypt.METHOD_CRYPT` will no longer be added to ``crypt.methods`` " -"if unsupported by the platform. (Contributed by Victor Stinner in :issue:" -"`25287`.)" +"The :const:`!crypt.METHOD_CRYPT` will no longer be added to ``crypt." +"methods`` if unsupported by the platform. (Contributed by Victor Stinner in :" +"issue:`25287`.)" msgstr "" #: ../../whatsnew/3.6.rst:2299 @@ -3607,8 +3610,8 @@ msgid "" "parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." "parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " "recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`cgi.parse` and :" -"func:`cgi.parse_multipart` as they use the affected functions internally. " +"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" +"func:`!cgi.parse_multipart` as they use the affected functions internally. " "For more details, please see their respective documentation. (Contributed by " "Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" msgstr "" diff --git a/whatsnew/3.7.po b/whatsnew/3.7.po index 3e1f2a8b2a..c9c6896a50 100644 --- a/whatsnew/3.7.po +++ b/whatsnew/3.7.po @@ -2,9 +2,9 @@ # This file is distributed under the same license as the Python package. msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-18 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: 2018-07-15 18:56+0800\n" "Last-Translator: \n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -32,10 +32,12 @@ msgid "" "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>`。" #: ../../whatsnew/3.7.rst:53 msgid "Summary -- Release Highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.7.rst:58 msgid "New syntax features:" @@ -73,7 +75,7 @@ msgstr ":ref:`whatsnew37_importlib_resources`" #: ../../whatsnew/3.7.rst:72 msgid "New built-in features:" -msgstr "" +msgstr "新的內建功能:" #: ../../whatsnew/3.7.rst:74 msgid "" @@ -82,7 +84,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:76 msgid "Python data model improvements:" -msgstr "" +msgstr "Python 資料模型改進:" #: ../../whatsnew/3.7.rst:78 msgid "" @@ -105,7 +107,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:90 msgid "Significant improvements in the standard library:" -msgstr "" +msgstr "標準函式庫中的顯著改進" #: ../../whatsnew/3.7.rst:92 msgid "" @@ -186,7 +188,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:128 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.7.rst:133 msgid "PEP 563: Postponed Evaluation of Annotations" @@ -1219,14 +1221,14 @@ msgstr "crypt" #: ../../whatsnew/3.7.rst:851 msgid "" -"The :mod:`crypt` module now supports the Blowfish hashing method. " +"The :mod:`!crypt` module now supports the Blowfish hashing method. " "(Contributed by Serhiy Storchaka in :issue:`31664`.)" msgstr "" #: ../../whatsnew/3.7.rst:854 msgid "" -"The :func:`~crypt.mksalt` function now allows specifying the number of " -"rounds for hashing. (Contributed by Serhiy Storchaka in :issue:`31702`.)" +"The :func:`!mksalt` function now allows specifying the number of rounds for " +"hashing. (Contributed by Serhiy Storchaka in :issue:`31702`.)" msgstr "" #: ../../whatsnew/3.7.rst:859 @@ -1628,9 +1630,8 @@ msgstr "msilib" #: ../../whatsnew/3.7.rst:1136 msgid "" -"The new :meth:`Database.Close() <msilib.Database.Close>` method can be used " -"to close the :abbr:`MSI` database. (Contributed by Berker Peksag in :issue:" -"`20486`.)" +"The new :meth:`!Database.Close` method can be used to close the :abbr:`MSI` " +"database. (Contributed by Berker Peksag in :issue:`20486`.)" msgstr "" #: ../../whatsnew/3.7.rst:1142 @@ -2221,7 +2222,7 @@ msgstr "uu" #: ../../whatsnew/3.7.rst:1554 msgid "" -"The :func:`uu.encode` function now accepts an optional *backtick* keyword " +"The :func:`!uu.encode` function now accepts an optional *backtick* keyword " "argument. When it's true, zeros are represented by ``'`'`` instead of " "spaces. (Contributed by Xiang Zhang in :issue:`30103`.)" msgstr "" @@ -2836,8 +2837,8 @@ msgstr "aifc" #: ../../whatsnew/3.7.rst:1956 msgid "" -":func:`aifc.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`aifc.open` instead. (Contributed by Brian Curtin in :issue:" +":func:`!aifc.openfp` has been deprecated and will be removed in Python 3.9. " +"Use :func:`!aifc.open` instead. (Contributed by Brian Curtin in :issue:" "`31985`.)" msgstr "" @@ -2958,8 +2959,8 @@ msgstr "sunau" #: ../../whatsnew/3.7.rst:2077 msgid "" -":func:`sunau.openfp` has been deprecated and will be removed in Python 3.9. " -"Use :func:`sunau.open` instead. (Contributed by Brian Curtin in :issue:" +":func:`!sunau.openfp` has been deprecated and will be removed in Python 3.9. " +"Use :func:`!sunau.open` instead. (Contributed by Brian Curtin in :issue:" "`31985`.)" msgstr "" @@ -3182,7 +3183,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:2230 msgid "Porting to Python 3.7" -msgstr "" +msgstr "移植至 Python 3.7" #: ../../whatsnew/3.7.rst:2232 msgid "" @@ -3321,7 +3322,7 @@ msgstr "" #: ../../whatsnew/3.7.rst:2320 msgid "" -":func:`~cgi.parse_multipart` now accepts the *encoding* and *errors* " +":func:`!cgi.parse_multipart` now accepts the *encoding* and *errors* " "arguments and returns the same results as :class:`!FieldStorage`: for non-" "file fields, the value associated to a key is a list of strings, not bytes. " "(Contributed by Pierre Quentel in :issue:`29979`.)" @@ -3584,15 +3585,15 @@ msgstr "" #: ../../whatsnew/3.7.rst:2511 msgid "" -":c:func:`PySys_AddWarnOptionUnicode` is not currently usable by embedding " +":c:func:`!PySys_AddWarnOptionUnicode` is not currently usable by embedding " "applications due to the requirement to create a Unicode object prior to " -"calling ``Py_Initialize``. Use :c:func:`PySys_AddWarnOption` instead." +"calling ``Py_Initialize``. Use :c:func:`!PySys_AddWarnOption` instead." msgstr "" #: ../../whatsnew/3.7.rst:2515 msgid "" -"warnings filters added by an embedding application with :c:func:" -"`PySys_AddWarnOption` should now more consistently take precedence over the " +"warnings filters added by an embedding application with :c:func:`!" +"PySys_AddWarnOption` should now more consistently take precedence over the " "default filters set by the interpreter" msgstr "" @@ -3689,8 +3690,8 @@ msgid "" "parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." "parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " "recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`cgi.parse` and :" -"func:`cgi.parse_multipart` as they use the affected functions internally. " +"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" +"func:`!cgi.parse_multipart` as they use the affected functions internally. " "For more details, please see their respective documentation. (Contributed by " "Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" msgstr "" diff --git a/whatsnew/3.8.po b/whatsnew/3.8.po index a3348ccd25..ca437cad1c 100644 --- a/whatsnew/3.8.po +++ b/whatsnew/3.8.po @@ -5,9 +5,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-19 00:04+0000\n" +"POT-Creation-Date: 2024-09-24 07:20+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,14 +35,16 @@ msgid "" "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>`。" #: ../../whatsnew/3.8.rst:61 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.8.rst:72 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.8.rst:75 msgid "Assignment expressions" @@ -2816,7 +2818,7 @@ msgstr "" #: ../../whatsnew/3.8.rst:1777 msgid "" -"``parse_qs``, ``parse_qsl``, and ``escape`` are removed from the :mod:`cgi` " +"``parse_qs``, ``parse_qsl``, and ``escape`` are removed from the :mod:`!cgi` " "module. They are deprecated in Python 3.2 or older. They should be imported " "from the ``urllib.parse`` and ``html`` modules instead." msgstr "" @@ -2869,7 +2871,7 @@ msgstr "" #: ../../whatsnew/3.8.rst:1809 msgid "Porting to Python 3.8" -msgstr "" +msgstr "移植至 Python 3.8" #: ../../whatsnew/3.8.rst:1811 msgid "" @@ -3595,8 +3597,8 @@ msgid "" "parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." "parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " "recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`cgi.parse` and :" -"func:`cgi.parse_multipart` as they use the affected functions internally. " +"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" +"func:`!cgi.parse_multipart` as they use the affected functions internally. " "For more details, please see their respective documentation. (Contributed by " "Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" msgstr "" diff --git a/whatsnew/3.9.po b/whatsnew/3.9.po index bef7fc358a..4c88343623 100644 --- a/whatsnew/3.9.po +++ b/whatsnew/3.9.po @@ -5,9 +5,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-03 11:11+0800\n" +"POT-Creation-Date: 2024-09-27 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-" @@ -35,14 +35,16 @@ msgid "" "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>`。" #: ../../whatsnew/3.9.rst:51 msgid ":pep:`596` - Python 3.9 Release Schedule" -msgstr "" +msgstr ":pep:`596` - Python 3.9 發佈時程" #: ../../whatsnew/3.9.rst:55 msgid "Summary -- Release highlights" -msgstr "" +msgstr "發布重點摘要" #: ../../whatsnew/3.9.rst:60 msgid "New syntax features:" @@ -62,7 +64,7 @@ msgstr "" #: ../../whatsnew/3.9.rst:66 msgid "New built-in features:" -msgstr "" +msgstr "新的內建功能:" #: ../../whatsnew/3.9.rst:68 msgid ":pep:`616`, string methods to remove prefixes and suffixes." @@ -107,16 +109,16 @@ msgstr "" #: ../../whatsnew/3.9.rst:84 msgid "" -"a number of Python modules (:mod:`!_abc`, :mod:`audioop`, :mod:`!_bz2`, :mod:" -"`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!_functools`, :mod:`!" -"_json`, :mod:`!_locale`, :mod:`math`, :mod:`operator`, :mod:`resource`, :mod:" -"`time`, :mod:`!_weakref`) now use multiphase initialization as defined by " -"PEP 489;" +"a number of Python modules (:mod:`!_abc`, :mod:`!audioop`, :mod:`!_bz2`, :" +"mod:`!_codecs`, :mod:`!_contextvars`, :mod:`!_crypt`, :mod:`!_functools`, :" +"mod:`!_json`, :mod:`!_locale`, :mod:`math`, :mod:`operator`, :mod:" +"`resource`, :mod:`time`, :mod:`!_weakref`) now use multiphase initialization " +"as defined by PEP 489;" msgstr "" #: ../../whatsnew/3.9.rst:89 msgid "" -"a number of standard library modules (:mod:`audioop`, :mod:`ast`, :mod:" +"a number of standard library modules (:mod:`!audioop`, :mod:`ast`, :mod:" "`grp`, :mod:`!_hashlib`, :mod:`pwd`, :mod:`!_posixsubprocess`, :mod:" "`random`, :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) are now " "using the stable ABI defined by PEP 384." @@ -198,9 +200,9 @@ msgid "" "Python as well. Consult the :ref:`removed-in-python-39` section." msgstr "" -#: ../../whatsnew/3.9.rst:140 ../../whatsnew/3.9.rst:1270 +#: ../../whatsnew/3.9.rst:140 ../../whatsnew/3.9.rst:1271 msgid "New Features" -msgstr "" +msgstr "新增功能" #: ../../whatsnew/3.9.rst:143 msgid "Dictionary Merge & Update Operators" @@ -266,7 +268,7 @@ msgid "" "for example ``queue.Queue``." msgstr "" -#: ../../whatsnew/3.9.rst:180 ../../whatsnew/3.9.rst:1158 +#: ../../whatsnew/3.9.rst:180 ../../whatsnew/3.9.rst:1159 msgid "Example:" msgstr "範例:" @@ -897,10 +899,9 @@ msgstr "nntplib" #: ../../whatsnew/3.9.rst:585 msgid "" -":class:`~nntplib.NNTP` and :class:`~nntplib.NNTP_SSL` now raise a :class:" -"`ValueError` if the given timeout for their constructor is zero to prevent " -"the creation of a non-blocking socket. (Contributed by Donghee Na in :issue:" -"`39259`.)" +":class:`!NNTP` and :class:`!NNTP_SSL` now raise a :class:`ValueError` if the " +"given timeout for their constructor is zero to prevent the creation of a non-" +"blocking socket. (Contributed by Donghee Na in :issue:`39259`.)" msgstr "" #: ../../whatsnew/3.9.rst:590 @@ -986,36 +987,36 @@ msgstr "pydoc" #: ../../whatsnew/3.9.rst:639 msgid "" "The documentation string is now shown not only for class, function, method " -"etc, but for any object that has its own ``__doc__`` attribute. (Contributed " -"by Serhiy Storchaka in :issue:`40257`.)" +"etc, but for any object that has its own :attr:`~definition.__doc__` " +"attribute. (Contributed by Serhiy Storchaka in :issue:`40257`.)" msgstr "" -#: ../../whatsnew/3.9.rst:644 +#: ../../whatsnew/3.9.rst:645 msgid "random" msgstr "random" -#: ../../whatsnew/3.9.rst:646 +#: ../../whatsnew/3.9.rst:647 msgid "" "Added a new :attr:`random.Random.randbytes` method: generate random bytes. " "(Contributed by Victor Stinner in :issue:`40286`.)" msgstr "" -#: ../../whatsnew/3.9.rst:650 +#: ../../whatsnew/3.9.rst:651 msgid "signal" msgstr "signal" -#: ../../whatsnew/3.9.rst:652 +#: ../../whatsnew/3.9.rst:653 msgid "" "Exposed the Linux-specific :func:`signal.pidfd_send_signal` for sending to " "signals to a process using a file descriptor instead of a pid. (:issue:" "`38712`)" msgstr "" -#: ../../whatsnew/3.9.rst:656 +#: ../../whatsnew/3.9.rst:657 msgid "smtplib" msgstr "smtplib" -#: ../../whatsnew/3.9.rst:658 +#: ../../whatsnew/3.9.rst:659 msgid "" ":class:`~smtplib.SMTP` and :class:`~smtplib.SMTP_SSL` now raise a :class:" "`ValueError` if the given timeout for their constructor is zero to prevent " @@ -1023,41 +1024,41 @@ msgid "" "`39259`.)" msgstr "" -#: ../../whatsnew/3.9.rst:662 +#: ../../whatsnew/3.9.rst:663 msgid "" ":class:`~smtplib.LMTP` constructor now has an optional *timeout* parameter. " "(Contributed by Donghee Na in :issue:`39329`.)" msgstr "" -#: ../../whatsnew/3.9.rst:666 +#: ../../whatsnew/3.9.rst:667 msgid "socket" msgstr "socket" -#: ../../whatsnew/3.9.rst:668 +#: ../../whatsnew/3.9.rst:669 msgid "" "The :mod:`socket` module now exports the :const:`~socket." "CAN_RAW_JOIN_FILTERS` constant on Linux 4.1 and greater. (Contributed by " "Stefan Tatschner and Zackery Spytz in :issue:`25780`.)" msgstr "" -#: ../../whatsnew/3.9.rst:672 +#: ../../whatsnew/3.9.rst:673 msgid "" "The socket module now supports the :const:`~socket.CAN_J1939` protocol on " "platforms that support it. (Contributed by Karl Ding in :issue:`40291`.)" msgstr "" -#: ../../whatsnew/3.9.rst:675 +#: ../../whatsnew/3.9.rst:676 msgid "" "The socket module now has the :func:`socket.send_fds` and :func:`socket." "recv_fds` functions. (Contributed by Joannah Nanjekye, Shinya Okano and " "Victor Stinner in :issue:`28724`.)" msgstr "" -#: ../../whatsnew/3.9.rst:681 +#: ../../whatsnew/3.9.rst:682 msgid "time" msgstr "time" -#: ../../whatsnew/3.9.rst:683 +#: ../../whatsnew/3.9.rst:684 msgid "" "On AIX, :func:`~time.thread_time` is now implemented with " "``thread_cputime()`` which has nanosecond resolution, rather than " @@ -1065,11 +1066,11 @@ msgid "" "milliseconds. (Contributed by Batuhan Taskaya in :issue:`40192`)" msgstr "" -#: ../../whatsnew/3.9.rst:689 +#: ../../whatsnew/3.9.rst:690 msgid "sys" msgstr "sys" -#: ../../whatsnew/3.9.rst:691 +#: ../../whatsnew/3.9.rst:692 msgid "" "Added a new :data:`sys.platlibdir` attribute: name of the platform-specific " "library directory. It is used to build the path of standard library and the " @@ -1079,29 +1080,29 @@ msgid "" "and Victor Stinner in :issue:`1294959`.)" msgstr "" -#: ../../whatsnew/3.9.rst:697 +#: ../../whatsnew/3.9.rst:698 msgid "" "Previously, :data:`sys.stderr` was block-buffered when non-interactive. Now " "``stderr`` defaults to always being line-buffered. (Contributed by Jendrik " "Seipp in :issue:`13601`.)" msgstr "" -#: ../../whatsnew/3.9.rst:702 +#: ../../whatsnew/3.9.rst:703 msgid "tracemalloc" msgstr "tracemalloc" -#: ../../whatsnew/3.9.rst:704 +#: ../../whatsnew/3.9.rst:705 msgid "" "Added :func:`tracemalloc.reset_peak` to set the peak size of traced memory " "blocks to the current size, to measure the peak of specific pieces of code. " "(Contributed by Huon Wilson in :issue:`40630`.)" msgstr "" -#: ../../whatsnew/3.9.rst:709 ../../whatsnew/3.9.rst:1492 +#: ../../whatsnew/3.9.rst:710 ../../whatsnew/3.9.rst:1493 msgid "typing" msgstr "typing" -#: ../../whatsnew/3.9.rst:711 +#: ../../whatsnew/3.9.rst:712 msgid "" ":pep:`593` introduced an :data:`typing.Annotated` type to decorate existing " "types with context-specific metadata and new ``include_extras`` parameter " @@ -1109,20 +1110,20 @@ msgid "" "(Contributed by Till Varoquaux and Konstantin Kashin.)" msgstr "" -#: ../../whatsnew/3.9.rst:717 +#: ../../whatsnew/3.9.rst:718 msgid "unicodedata" msgstr "unicodedata" -#: ../../whatsnew/3.9.rst:719 +#: ../../whatsnew/3.9.rst:720 msgid "" "The Unicode database has been updated to version 13.0.0. (:issue:`39926`)." msgstr "" -#: ../../whatsnew/3.9.rst:722 +#: ../../whatsnew/3.9.rst:723 msgid "venv" msgstr "venv" -#: ../../whatsnew/3.9.rst:724 +#: ../../whatsnew/3.9.rst:725 msgid "" "The activation scripts provided by :mod:`venv` now all specify their prompt " "customization consistently by always using the value specified by " @@ -1132,11 +1133,11 @@ msgid "" "Cannon in :issue:`37663`.)" msgstr "" -#: ../../whatsnew/3.9.rst:732 +#: ../../whatsnew/3.9.rst:733 msgid "xml" msgstr "xml" -#: ../../whatsnew/3.9.rst:734 +#: ../../whatsnew/3.9.rst:735 msgid "" "White space characters within attributes are now preserved when serializing :" "mod:`xml.etree.ElementTree` to XML file. EOLNs are no longer normalized to " @@ -1144,32 +1145,32 @@ msgid "" "2.11 of XML spec. (Contributed by Mefistotelis in :issue:`39011`.)" msgstr "" -#: ../../whatsnew/3.9.rst:742 +#: ../../whatsnew/3.9.rst:743 msgid "Optimizations" msgstr "最佳化" -#: ../../whatsnew/3.9.rst:744 +#: ../../whatsnew/3.9.rst:745 msgid "" "Optimized the idiom for assignment a temporary variable in comprehensions. " "Now ``for y in [expr]`` in comprehensions is as fast as a simple assignment " "``y = expr``. For example:" msgstr "" -#: ../../whatsnew/3.9.rst:748 +#: ../../whatsnew/3.9.rst:749 msgid "sums = [s for s in [0] for x in data for s in [s + x]]" msgstr "sums = [s for s in [0] for x in data for s in [s + x]]" -#: ../../whatsnew/3.9.rst:750 +#: ../../whatsnew/3.9.rst:751 msgid "" "Unlike the ``:=`` operator this idiom does not leak a variable to the outer " "scope." msgstr "" -#: ../../whatsnew/3.9.rst:753 +#: ../../whatsnew/3.9.rst:754 msgid "(Contributed by Serhiy Storchaka in :issue:`32856`.)" msgstr "(由 Serhiy Storchaka 在 :issue:`32856` 中貢獻。)" -#: ../../whatsnew/3.9.rst:755 +#: ../../whatsnew/3.9.rst:756 msgid "" "Optimized signal handling in multithreaded applications. If a thread " "different than the main thread gets a signal, the bytecode evaluation loop " @@ -1178,27 +1179,27 @@ msgid "" "interpreter can handle signals." msgstr "" -#: ../../whatsnew/3.9.rst:761 +#: ../../whatsnew/3.9.rst:762 msgid "" "Previously, the bytecode evaluation loop was interrupted at each instruction " "until the main thread handles signals. (Contributed by Victor Stinner in :" "issue:`40010`.)" msgstr "" -#: ../../whatsnew/3.9.rst:765 +#: ../../whatsnew/3.9.rst:766 msgid "" "Optimized the :mod:`subprocess` module on FreeBSD using ``closefrom()``. " "(Contributed by Ed Maste, Conrad Meyer, Kyle Evans, Kubilay Kocak and Victor " "Stinner in :issue:`38061`.)" msgstr "" -#: ../../whatsnew/3.9.rst:769 +#: ../../whatsnew/3.9.rst:770 msgid "" ":c:func:`PyLong_FromDouble` is now up to 1.87x faster for values that fit " "into :c:expr:`long`. (Contributed by Sergey Fedoseev in :issue:`37986`.)" msgstr "" -#: ../../whatsnew/3.9.rst:773 +#: ../../whatsnew/3.9.rst:774 msgid "" "A number of Python builtins (:class:`range`, :class:`tuple`, :class:`set`, :" "class:`frozenset`, :class:`list`, :class:`dict`) are now sped up by using :" @@ -1206,14 +1207,14 @@ msgid "" "Jeroen Demeyer and Petr Viktorin in :issue:`37207`.)" msgstr "" -#: ../../whatsnew/3.9.rst:778 +#: ../../whatsnew/3.9.rst:779 msgid "" "Optimized :func:`~set.difference_update` for the case when the other set is " "much larger than the base set. (Suggested by Evgeny Kapun with code " "contributed by Michele Orrù in :issue:`8425`.)" msgstr "" -#: ../../whatsnew/3.9.rst:782 +#: ../../whatsnew/3.9.rst:783 msgid "" "Python's small object allocator (``obmalloc.c``) now allows (no more than) " "one empty arena to remain available for immediate reuse, without returning " @@ -1222,26 +1223,26 @@ msgid "" "in :issue:`37257`.)" msgstr "" -#: ../../whatsnew/3.9.rst:788 +#: ../../whatsnew/3.9.rst:789 msgid "" ":term:`floor division` of float operation now has a better performance. Also " "the message of :exc:`ZeroDivisionError` for this operation is updated. " "(Contributed by Donghee Na in :issue:`39434`.)" msgstr "" -#: ../../whatsnew/3.9.rst:792 +#: ../../whatsnew/3.9.rst:793 msgid "" "Decoding short ASCII strings with UTF-8 and ascii codecs is now about 15% " "faster. (Contributed by Inada Naoki in :issue:`37348`.)" msgstr "" -#: ../../whatsnew/3.9.rst:795 +#: ../../whatsnew/3.9.rst:796 msgid "" "Here's a summary of performance improvements from Python 3.4 through Python " "3.9:" msgstr "" -#: ../../whatsnew/3.9.rst:797 +#: ../../whatsnew/3.9.rst:798 msgid "" "Python version 3.4 3.5 3.6 3.7 3.8 " "3.9\n" @@ -1389,7 +1390,7 @@ msgstr "" " loop_overhead 0.5 0.6 0.4 0.3 0.3 " "0.3" -#: ../../whatsnew/3.9.rst:842 +#: ../../whatsnew/3.9.rst:843 msgid "" "These results were generated from the variable access benchmark script at: " "``Tools/scripts/var_access_benchmark.py``. The benchmark script displays " @@ -1400,18 +1401,18 @@ msgid "" "python.org/downloads/macos/>`_." msgstr "" -#: ../../whatsnew/3.9.rst:852 +#: ../../whatsnew/3.9.rst:853 msgid "Deprecated" msgstr "已棄用" -#: ../../whatsnew/3.9.rst:854 +#: ../../whatsnew/3.9.rst:855 msgid "" "The distutils ``bdist_msi`` command is now deprecated, use ``bdist_wheel`` " "(wheel packages) instead. (Contributed by Hugo van Kemenade in :issue:" "`39586`.)" msgstr "" -#: ../../whatsnew/3.9.rst:858 +#: ../../whatsnew/3.9.rst:859 msgid "" "Currently :func:`math.factorial` accepts :class:`float` instances with non-" "negative integer values (like ``5.0``). It raises a :exc:`ValueError` for " @@ -1420,7 +1421,7 @@ msgid "" "Serhiy Storchaka in :issue:`37315`.)" msgstr "" -#: ../../whatsnew/3.9.rst:864 +#: ../../whatsnew/3.9.rst:865 msgid "" "The :mod:`!parser` and :mod:`!symbol` modules are deprecated and will be " "removed in future versions of Python. For the majority of use cases, users " @@ -1428,7 +1429,7 @@ msgid "" "stage, using the :mod:`ast` module." msgstr "" -#: ../../whatsnew/3.9.rst:869 +#: ../../whatsnew/3.9.rst:870 msgid "" "The Public C API functions :c:func:`!PyParser_SimpleParseStringFlags`, :c:" "func:`!PyParser_SimpleParseStringFlagsFilename`, :c:func:`!" @@ -1436,7 +1437,7 @@ msgid "" "and will be removed in Python 3.10 together with the old parser." msgstr "" -#: ../../whatsnew/3.9.rst:874 +#: ../../whatsnew/3.9.rst:875 msgid "" "Using :data:`NotImplemented` in a boolean context has been deprecated, as it " "is almost exclusively the result of incorrect rich comparator " @@ -1444,7 +1445,7 @@ msgid "" "Python. (Contributed by Josh Rosenberg in :issue:`35712`.)" msgstr "" -#: ../../whatsnew/3.9.rst:880 +#: ../../whatsnew/3.9.rst:881 msgid "" "The :mod:`random` module currently accepts any hashable type as a possible " "seed value. Unfortunately, some of those types are not guaranteed to have a " @@ -1453,7 +1454,7 @@ msgid "" "`bytes`, and :class:`bytearray`." msgstr "" -#: ../../whatsnew/3.9.rst:886 +#: ../../whatsnew/3.9.rst:887 msgid "" "Opening the :class:`~gzip.GzipFile` file for writing without specifying the " "*mode* argument is deprecated. In future Python versions it will always be " @@ -1462,39 +1463,39 @@ msgid "" "issue:`28286`.)" msgstr "" -#: ../../whatsnew/3.9.rst:892 +#: ../../whatsnew/3.9.rst:893 msgid "" "Deprecated the ``split()`` method of :class:`!_tkinter.TkappType` in favour " "of the ``splitlist()`` method which has more consistent and predictable " "behavior. (Contributed by Serhiy Storchaka in :issue:`38371`.)" msgstr "" -#: ../../whatsnew/3.9.rst:897 +#: ../../whatsnew/3.9.rst:898 msgid "" "The explicit passing of coroutine objects to :func:`asyncio.wait` has been " "deprecated and will be removed in version 3.11. (Contributed by Yury " "Selivanov and Kyle Stanley in :issue:`34790`.)" msgstr "" -#: ../../whatsnew/3.9.rst:901 +#: ../../whatsnew/3.9.rst:902 msgid "" "binhex4 and hexbin4 standards are now deprecated. The :mod:`!binhex` module " "and the following :mod:`binascii` functions are now deprecated:" msgstr "" -#: ../../whatsnew/3.9.rst:904 +#: ../../whatsnew/3.9.rst:905 msgid ":func:`!b2a_hqx`, :func:`!a2b_hqx`" msgstr ":func:`!b2a_hqx`、:func:`!a2b_hqx`" -#: ../../whatsnew/3.9.rst:905 +#: ../../whatsnew/3.9.rst:906 msgid ":func:`!rlecode_hqx`, :func:`!rledecode_hqx`" msgstr ":func:`!rlecode_hqx`、:func:`!rledecode_hqx`" -#: ../../whatsnew/3.9.rst:907 +#: ../../whatsnew/3.9.rst:908 msgid "(Contributed by Victor Stinner in :issue:`39353`.)" msgstr "(由 Victor Stinner 在 :issue:`39353` 中貢獻。)" -#: ../../whatsnew/3.9.rst:909 +#: ../../whatsnew/3.9.rst:910 msgid "" ":mod:`ast` classes ``slice``, ``Index`` and ``ExtSlice`` are considered " "deprecated and will be removed in future Python versions. ``value`` itself " @@ -1503,7 +1504,7 @@ msgid "" "Storchaka in :issue:`34822`.)" msgstr "" -#: ../../whatsnew/3.9.rst:915 +#: ../../whatsnew/3.9.rst:916 msgid "" ":mod:`ast` classes ``Suite``, ``Param``, ``AugLoad`` and ``AugStore`` are " "considered deprecated and will be removed in future Python versions. They " @@ -1512,7 +1513,7 @@ msgid "" "`39969` and Serhiy Storchaka in :issue:`39988`.)" msgstr "" -#: ../../whatsnew/3.9.rst:922 +#: ../../whatsnew/3.9.rst:923 msgid "" "The :c:func:`!PyEval_InitThreads` and :c:func:`!PyEval_ThreadsInitialized` " "functions are now deprecated and will be removed in Python 3.11. Calling :c:" @@ -1521,62 +1522,62 @@ msgid "" "in :issue:`39877`.)" msgstr "" -#: ../../whatsnew/3.9.rst:928 +#: ../../whatsnew/3.9.rst:929 msgid "" "Passing ``None`` as the first argument to the :func:`shlex.split` function " "has been deprecated. (Contributed by Zackery Spytz in :issue:`33262`.)" msgstr "" -#: ../../whatsnew/3.9.rst:931 +#: ../../whatsnew/3.9.rst:932 msgid "" ":func:`!smtpd.MailmanProxy` is now deprecated as it is unusable without an " "external module, ``mailman``. (Contributed by Samuel Colvin in :issue:" "`35800`.)" msgstr "" -#: ../../whatsnew/3.9.rst:934 +#: ../../whatsnew/3.9.rst:935 msgid "" -"The :mod:`lib2to3` module now emits a :exc:`PendingDeprecationWarning`. " +"The :mod:`!lib2to3` module now emits a :exc:`PendingDeprecationWarning`. " "Python 3.9 switched to a PEG parser (see :pep:`617`), and Python 3.10 may " "include new language syntax that is not parsable by lib2to3's LL(1) parser. " -"The ``lib2to3`` module may be removed from the standard library in a future " -"Python version. Consider third-party alternatives such as `LibCST`_ or " -"`parso`_. (Contributed by Carl Meyer in :issue:`40360`.)" +"The :mod:`!lib2to3` module may be removed from the standard library in a " +"future Python version. Consider third-party alternatives such as `LibCST`_ " +"or `parso`_. (Contributed by Carl Meyer in :issue:`40360`.)" msgstr "" -#: ../../whatsnew/3.9.rst:942 +#: ../../whatsnew/3.9.rst:943 msgid "" "The *random* parameter of :func:`random.shuffle` has been deprecated. " "(Contributed by Raymond Hettinger in :issue:`40465`)" msgstr "" -#: ../../whatsnew/3.9.rst:951 ../../whatsnew/3.9.rst:1406 +#: ../../whatsnew/3.9.rst:952 ../../whatsnew/3.9.rst:1407 msgid "Removed" msgstr "已移除" -#: ../../whatsnew/3.9.rst:953 +#: ../../whatsnew/3.9.rst:954 msgid "" "The erroneous version at :data:`!unittest.mock.__version__` has been removed." msgstr "" -#: ../../whatsnew/3.9.rst:955 +#: ../../whatsnew/3.9.rst:956 msgid "" -":class:`nntplib.NNTP`: ``xpath()`` and ``xgtitle()`` methods have been " +":class:`!nntplib.NNTP`: ``xpath()`` and ``xgtitle()`` methods have been " "removed. These methods are deprecated since Python 3.3. Generally, these " "extensions are not supported or not enabled by NNTP server administrators. " -"For ``xgtitle()``, please use :meth:`nntplib.NNTP.descriptions` or :meth:" -"`nntplib.NNTP.description` instead. (Contributed by Donghee Na in :issue:" +"For ``xgtitle()``, please use :meth:`!nntplib.NNTP.descriptions` or :meth:`!" +"nntplib.NNTP.description` instead. (Contributed by Donghee Na in :issue:" "`39366`.)" msgstr "" -#: ../../whatsnew/3.9.rst:962 +#: ../../whatsnew/3.9.rst:963 msgid "" ":class:`array.array`: ``tostring()`` and ``fromstring()`` methods have been " "removed. They were aliases to ``tobytes()`` and ``frombytes()``, deprecated " "since Python 3.2. (Contributed by Victor Stinner in :issue:`38916`.)" msgstr "" -#: ../../whatsnew/3.9.rst:967 +#: ../../whatsnew/3.9.rst:968 msgid "" "The undocumented ``sys.callstats()`` function has been removed. Since Python " "3.7, it was deprecated and always returned :const:`None`. It required a " @@ -1584,7 +1585,7 @@ msgid "" "3.7. (Contributed by Victor Stinner in :issue:`37414`.)" msgstr "" -#: ../../whatsnew/3.9.rst:972 +#: ../../whatsnew/3.9.rst:973 msgid "" "The ``sys.getcheckinterval()`` and ``sys.setcheckinterval()`` functions have " "been removed. They were deprecated since Python 3.2. Use :func:`sys." @@ -1592,21 +1593,21 @@ msgid "" "by Victor Stinner in :issue:`37392`.)" msgstr "" -#: ../../whatsnew/3.9.rst:977 +#: ../../whatsnew/3.9.rst:978 msgid "" "The C function ``PyImport_Cleanup()`` has been removed. It was documented " "as: \"Empty the module table. For internal use only.\" (Contributed by " "Victor Stinner in :issue:`36710`.)" msgstr "" -#: ../../whatsnew/3.9.rst:981 +#: ../../whatsnew/3.9.rst:982 msgid "" "``_dummy_thread`` and ``dummy_threading`` modules have been removed. These " "modules were deprecated since Python 3.7 which requires threading support. " "(Contributed by Victor Stinner in :issue:`37312`.)" msgstr "" -#: ../../whatsnew/3.9.rst:985 +#: ../../whatsnew/3.9.rst:986 msgid "" "``aifc.openfp()`` alias to ``aifc.open()``, ``sunau.openfp()`` alias to " "``sunau.open()``, and ``wave.openfp()`` alias to :func:`wave.open` have been " @@ -1614,14 +1615,14 @@ msgid "" "Stinner in :issue:`37320`.)" msgstr "" -#: ../../whatsnew/3.9.rst:990 +#: ../../whatsnew/3.9.rst:991 msgid "" "The :meth:`!isAlive` method of :class:`threading.Thread` has been removed. " "It was deprecated since Python 3.8. Use :meth:`~threading.Thread.is_alive` " "instead. (Contributed by Donghee Na in :issue:`37804`.)" msgstr "" -#: ../../whatsnew/3.9.rst:995 +#: ../../whatsnew/3.9.rst:996 msgid "" "Methods ``getchildren()`` and ``getiterator()`` of classes :class:`~xml." "etree.ElementTree.ElementTree` and :class:`~xml.etree.ElementTree.Element` " @@ -1631,7 +1632,7 @@ msgid "" "getiterator()``. (Contributed by Serhiy Storchaka in :issue:`36543`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1003 +#: ../../whatsnew/3.9.rst:1004 msgid "" "The old :mod:`plistlib` API has been removed, it was deprecated since Python " "3.4. Use the :func:`~plistlib.load`, :func:`~plistlib.loads`, :func:" @@ -1640,7 +1641,7 @@ msgid "" "are always used instead. (Contributed by Jon Janzen in :issue:`36409`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1009 +#: ../../whatsnew/3.9.rst:1010 msgid "" "The C function ``PyGen_NeedsFinalizing`` has been removed. It was not " "documented, tested, or used anywhere within CPython after the implementation " @@ -1648,7 +1649,7 @@ msgid "" "in :issue:`15088`)" msgstr "" -#: ../../whatsnew/3.9.rst:1014 +#: ../../whatsnew/3.9.rst:1015 msgid "" "``base64.encodestring()`` and ``base64.decodestring()``, aliases deprecated " "since Python 3.1, have been removed: use :func:`base64.encodebytes` and :" @@ -1656,14 +1657,14 @@ msgid "" "`39351`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1019 +#: ../../whatsnew/3.9.rst:1020 msgid "" "``fractions.gcd()`` function has been removed, it was deprecated since " "Python 3.5 (:issue:`22486`): use :func:`math.gcd` instead. (Contributed by " "Victor Stinner in :issue:`39350`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1023 +#: ../../whatsnew/3.9.rst:1024 msgid "" "The *buffering* parameter of :class:`bz2.BZ2File` has been removed. Since " "Python 3.0, it was ignored and using it emitted a :exc:`DeprecationWarning`. " @@ -1671,7 +1672,7 @@ msgid "" "Victor Stinner in :issue:`39357`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1028 +#: ../../whatsnew/3.9.rst:1029 msgid "" "The *encoding* parameter of :func:`json.loads` has been removed. As of " "Python 3.1, it was deprecated and ignored; using it has emitted a :exc:" @@ -1679,7 +1680,7 @@ msgid "" "`39377`)" msgstr "" -#: ../../whatsnew/3.9.rst:1033 +#: ../../whatsnew/3.9.rst:1034 msgid "" "``with (await asyncio.lock):`` and ``with (yield from asyncio.lock):`` " "statements are not longer supported, use ``async with lock`` instead. The " @@ -1687,7 +1688,7 @@ msgid "" "(Contributed by Andrew Svetlov in :issue:`34793`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1038 +#: ../../whatsnew/3.9.rst:1039 msgid "" "The :func:`!sys.getcounts` function, the ``-X showalloccount`` command line " "option and the ``show_alloc_count`` field of the C structure :c:type:" @@ -1696,7 +1697,7 @@ msgid "" "`39489`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1044 +#: ../../whatsnew/3.9.rst:1045 msgid "" "The ``_field_types`` attribute of the :class:`typing.NamedTuple` class has " "been removed. It was deprecated since Python 3.8. Use the " @@ -1704,14 +1705,14 @@ msgid "" "issue:`40182`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1049 +#: ../../whatsnew/3.9.rst:1050 msgid "" "The :meth:`!symtable.SymbolTable.has_exec` method has been removed. It was " "deprecated since 2006, and only returning ``False`` when it's called. " "(Contributed by Batuhan Taskaya in :issue:`40208`)" msgstr "" -#: ../../whatsnew/3.9.rst:1053 +#: ../../whatsnew/3.9.rst:1054 msgid "" "The :meth:`!asyncio.Task.current_task` and :meth:`!asyncio.Task.all_tasks` " "have been removed. They were deprecated since Python 3.7 and you can use :" @@ -1719,7 +1720,7 @@ msgid "" "(Contributed by Rémi Lapeyre in :issue:`40967`)" msgstr "" -#: ../../whatsnew/3.9.rst:1058 +#: ../../whatsnew/3.9.rst:1059 msgid "" "The ``unescape()`` method in the :class:`html.parser.HTMLParser` class has " "been removed (it was deprecated since Python 3.4). :func:`html.unescape` " @@ -1727,21 +1728,21 @@ msgid "" "unicode characters." msgstr "" -#: ../../whatsnew/3.9.rst:1065 ../../whatsnew/3.9.rst:1332 +#: ../../whatsnew/3.9.rst:1066 ../../whatsnew/3.9.rst:1333 msgid "Porting to Python 3.9" -msgstr "" +msgstr "移植至 Python 3.9" -#: ../../whatsnew/3.9.rst:1067 +#: ../../whatsnew/3.9.rst:1068 msgid "" "This section lists previously described changes and other bugfixes that may " "require changes to your code." msgstr "" -#: ../../whatsnew/3.9.rst:1072 +#: ../../whatsnew/3.9.rst:1073 msgid "Changes in the Python API" msgstr "" -#: ../../whatsnew/3.9.rst:1074 +#: ../../whatsnew/3.9.rst:1075 msgid "" ":func:`__import__` and :func:`importlib.util.resolve_name` now raise :exc:" "`ImportError` where it previously raised :exc:`ValueError`. Callers catching " @@ -1749,26 +1750,26 @@ msgid "" "versions will need to catch both using ``except (ImportError, ValueError):``." msgstr "" -#: ../../whatsnew/3.9.rst:1079 +#: ../../whatsnew/3.9.rst:1080 msgid "" "The :mod:`venv` activation scripts no longer special-case when " "``__VENV_PROMPT__`` is set to ``\"\"``." msgstr "" -#: ../../whatsnew/3.9.rst:1082 +#: ../../whatsnew/3.9.rst:1083 msgid "" "The :meth:`select.epoll.unregister` method no longer ignores the :const:" "`~errno.EBADF` error. (Contributed by Victor Stinner in :issue:`39239`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1086 +#: ../../whatsnew/3.9.rst:1087 msgid "" "The *compresslevel* parameter of :class:`bz2.BZ2File` became keyword-only, " "since the *buffering* parameter has been removed. (Contributed by Victor " "Stinner in :issue:`39357`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1090 +#: ../../whatsnew/3.9.rst:1091 msgid "" "Simplified AST for subscription. Simple indices will be represented by their " "value, extended slices will be represented as tuples. ``Index(value)`` will " @@ -1776,21 +1777,21 @@ msgid "" "Load())``. (Contributed by Serhiy Storchaka in :issue:`34822`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1096 +#: ../../whatsnew/3.9.rst:1097 msgid "" "The :mod:`importlib` module now ignores the :envvar:`PYTHONCASEOK` " "environment variable when the :option:`-E` or :option:`-I` command line " "options are being used." msgstr "" -#: ../../whatsnew/3.9.rst:1100 +#: ../../whatsnew/3.9.rst:1101 msgid "" "The *encoding* parameter has been added to the classes :class:`ftplib.FTP` " "and :class:`ftplib.FTP_TLS` as a keyword-only parameter, and the default " "encoding is changed from Latin-1 to UTF-8 to follow :rfc:`2640`." msgstr "" -#: ../../whatsnew/3.9.rst:1104 +#: ../../whatsnew/3.9.rst:1105 msgid "" ":meth:`asyncio.loop.shutdown_default_executor` has been added to :class:" "`~asyncio.AbstractEventLoop`, meaning alternative event loops that inherit " @@ -1798,7 +1799,7 @@ msgid "" "issue:`34037`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1109 +#: ../../whatsnew/3.9.rst:1110 msgid "" "The constant values of future flags in the :mod:`__future__` module is " "updated in order to prevent collision with compiler flags. Previously " @@ -1806,7 +1807,7 @@ msgid "" "(Contributed by Batuhan Taskaya in :issue:`39562`)" msgstr "" -#: ../../whatsnew/3.9.rst:1114 +#: ../../whatsnew/3.9.rst:1115 msgid "" "``array('u')`` now uses :c:type:`wchar_t` as C type instead of " "``Py_UNICODE``. This change doesn't affect to its behavior because " @@ -1814,7 +1815,7 @@ msgid "" "by Inada Naoki in :issue:`34538`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1119 +#: ../../whatsnew/3.9.rst:1120 msgid "" "The :func:`logging.getLogger` API now returns the root logger when passed " "the name ``'root'``, whereas previously it returned a non-root logger named " @@ -1824,7 +1825,7 @@ msgid "" "(Contributed by Vinay Sajip in :issue:`37742`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1126 +#: ../../whatsnew/3.9.rst:1127 msgid "" "Division handling of :class:`~pathlib.PurePath` now returns :data:" "`NotImplemented` instead of raising a :exc:`TypeError` when passed something " @@ -1833,7 +1834,7 @@ msgid "" "types. (Contributed by Roger Aiudi in :issue:`34775`)." msgstr "" -#: ../../whatsnew/3.9.rst:1132 +#: ../../whatsnew/3.9.rst:1133 msgid "" "Starting with Python 3.9.5 the :mod:`ipaddress` module no longer accepts any " "leading zeros in IPv4 address strings. Leading zeros are ambiguous and " @@ -1843,7 +1844,7 @@ msgid "" "leading zeros. (Contributed by Christian Heimes in :issue:`36384`)." msgstr "" -#: ../../whatsnew/3.9.rst:1140 +#: ../../whatsnew/3.9.rst:1141 msgid "" ":func:`codecs.lookup` now normalizes the encoding name the same way as :func:" "`encodings.normalize_encoding`, except that :func:`codecs.lookup` also " @@ -1852,11 +1853,11 @@ msgid "" "in :issue:`37751`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1148 +#: ../../whatsnew/3.9.rst:1149 msgid "Changes in the C API" msgstr "C API 中的改動" -#: ../../whatsnew/3.9.rst:1150 +#: ../../whatsnew/3.9.rst:1151 msgid "" "Instances of :ref:`heap-allocated types <heap-types>` (such as those created " "with :c:func:`PyType_FromSpec` and similar APIs) hold a reference to their " @@ -1867,7 +1868,7 @@ msgid "" "heap-allocated types visit the object's type." msgstr "" -#: ../../whatsnew/3.9.rst:1160 +#: ../../whatsnew/3.9.rst:1161 msgid "" "int\n" "foo_traverse(foo_struct *self, visitproc visit, void *arg) {\n" @@ -1879,7 +1880,7 @@ msgid "" "}" msgstr "" -#: ../../whatsnew/3.9.rst:1171 +#: ../../whatsnew/3.9.rst:1172 msgid "" "If your traverse function delegates to ``tp_traverse`` of its base class (or " "another type), ensure that ``Py_TYPE(self)`` is visited only once. Note that " @@ -1887,19 +1888,19 @@ msgid "" "``tp_traverse``." msgstr "" -#: ../../whatsnew/3.9.rst:1176 +#: ../../whatsnew/3.9.rst:1177 msgid "For example, if your ``tp_traverse`` function includes:" msgstr "" -#: ../../whatsnew/3.9.rst:1178 +#: ../../whatsnew/3.9.rst:1179 msgid "base->tp_traverse(self, visit, arg)" msgstr "base->tp_traverse(self, visit, arg)" -#: ../../whatsnew/3.9.rst:1182 +#: ../../whatsnew/3.9.rst:1183 msgid "then add:" msgstr "" -#: ../../whatsnew/3.9.rst:1184 +#: ../../whatsnew/3.9.rst:1185 msgid "" "#if PY_VERSION_HEX >= 0x03090000\n" " // This was not needed before Python 3.9 (bpo-35810 and bpo-40217)\n" @@ -1911,11 +1912,11 @@ msgid "" "#else" msgstr "" -#: ../../whatsnew/3.9.rst:1195 +#: ../../whatsnew/3.9.rst:1196 msgid "(See :issue:`35810` and :issue:`40217` for more information.)" msgstr "(更多資訊請見 :issue:`35810` 與 :issue:`40217`。)" -#: ../../whatsnew/3.9.rst:1197 +#: ../../whatsnew/3.9.rst:1198 msgid "" "The functions ``PyEval_CallObject``, ``PyEval_CallFunction``, " "``PyEval_CallMethod`` and ``PyEval_CallObjectWithKeywords`` are deprecated. " @@ -1923,11 +1924,11 @@ msgid "" "issue:`29548`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1203 +#: ../../whatsnew/3.9.rst:1204 msgid "CPython bytecode changes" msgstr "CPython 位元組碼變更" -#: ../../whatsnew/3.9.rst:1205 +#: ../../whatsnew/3.9.rst:1206 msgid "" "The :opcode:`LOAD_ASSERTION_ERROR` opcode was added for handling the :" "keyword:`assert` statement. Previously, the assert statement would not work " @@ -1935,37 +1936,37 @@ msgid "" "(Contributed by Zackery Spytz in :issue:`34880`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1210 +#: ../../whatsnew/3.9.rst:1211 msgid "" "The :opcode:`COMPARE_OP` opcode was split into four distinct instructions:" msgstr "" -#: ../../whatsnew/3.9.rst:1212 +#: ../../whatsnew/3.9.rst:1213 msgid "``COMPARE_OP`` for rich comparisons" msgstr "" -#: ../../whatsnew/3.9.rst:1213 +#: ../../whatsnew/3.9.rst:1214 msgid "``IS_OP`` for 'is' and 'is not' tests" msgstr "" -#: ../../whatsnew/3.9.rst:1214 +#: ../../whatsnew/3.9.rst:1215 msgid "``CONTAINS_OP`` for 'in' and 'not in' tests" msgstr "" -#: ../../whatsnew/3.9.rst:1215 +#: ../../whatsnew/3.9.rst:1216 msgid "" "``JUMP_IF_NOT_EXC_MATCH`` for checking exceptions in 'try-except' statements." msgstr "" -#: ../../whatsnew/3.9.rst:1218 +#: ../../whatsnew/3.9.rst:1219 msgid "(Contributed by Mark Shannon in :issue:`39156`.)" msgstr "(由 Mark Shannon 在 :issue:`39156` 中貢獻。)" -#: ../../whatsnew/3.9.rst:1222 +#: ../../whatsnew/3.9.rst:1223 msgid "Build Changes" msgstr "建置變更" -#: ../../whatsnew/3.9.rst:1224 +#: ../../whatsnew/3.9.rst:1225 msgid "" "Added ``--with-platlibdir`` option to the ``configure`` script: name of the " "platform-specific library directory, stored in the new :data:`sys." @@ -1974,26 +1975,26 @@ msgid "" "and Victor Stinner in :issue:`1294959`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1230 +#: ../../whatsnew/3.9.rst:1231 msgid "" "The ``COUNT_ALLOCS`` special build macro has been removed. (Contributed by " "Victor Stinner in :issue:`39489`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1233 +#: ../../whatsnew/3.9.rst:1234 msgid "" "On non-Windows platforms, the :c:func:`!setenv` and :c:func:`!unsetenv` " "functions are now required to build Python. (Contributed by Victor Stinner " "in :issue:`39395`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1237 +#: ../../whatsnew/3.9.rst:1238 msgid "" "On non-Windows platforms, creating ``bdist_wininst`` installers is now " "officially unsupported. (See :issue:`10945` for more details.)" msgstr "" -#: ../../whatsnew/3.9.rst:1240 +#: ../../whatsnew/3.9.rst:1241 msgid "" "When building Python on macOS from source, ``_tkinter`` now links with non-" "system Tcl and Tk frameworks if they are installed in ``/Library/" @@ -2004,13 +2005,13 @@ msgid "" "(Contributed by Ned Deily in :issue:`34956`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1249 +#: ../../whatsnew/3.9.rst:1250 msgid "" "Python can now be built for Windows 10 ARM64. (Contributed by Steve Dower " "in :issue:`33125`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1252 +#: ../../whatsnew/3.9.rst:1253 msgid "" "Some individual tests are now skipped when ``--pgo`` is used. The tests in " "question increased the PGO task time significantly and likely didn't help " @@ -2026,11 +2027,11 @@ msgid "" "details.)" msgstr "" -#: ../../whatsnew/3.9.rst:1267 +#: ../../whatsnew/3.9.rst:1268 msgid "C API Changes" msgstr "C API 變更" -#: ../../whatsnew/3.9.rst:1272 +#: ../../whatsnew/3.9.rst:1273 msgid "" ":pep:`573`: Added :c:func:`PyType_FromModuleAndSpec` to associate a module " "with a class; :c:func:`PyType_GetModule` and :c:func:`PyType_GetModuleState` " @@ -2039,20 +2040,20 @@ msgid "" "(Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1279 +#: ../../whatsnew/3.9.rst:1280 msgid "" "Added :c:func:`PyFrame_GetCode` function: get a frame code. Added :c:func:" "`PyFrame_GetBack` function: get the frame next outer frame. (Contributed by " "Victor Stinner in :issue:`40421`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1283 +#: ../../whatsnew/3.9.rst:1284 msgid "" "Added :c:func:`PyFrame_GetLineNumber` to the limited C API. (Contributed by " "Victor Stinner in :issue:`40421`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1286 +#: ../../whatsnew/3.9.rst:1287 msgid "" "Added :c:func:`PyThreadState_GetInterpreter` and :c:func:" "`PyInterpreterState_Get` functions to get the interpreter. Added :c:func:" @@ -2062,7 +2063,7 @@ msgid "" "issue:`39947`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1294 +#: ../../whatsnew/3.9.rst:1295 msgid "" "Added a new public :c:func:`PyObject_CallNoArgs` function to the C API, " "which calls a callable Python object without any arguments. It is the most " @@ -2070,11 +2071,11 @@ msgid "" "(Contributed by Victor Stinner in :issue:`37194`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1299 ../../whatsnew/3.9.rst:1417 +#: ../../whatsnew/3.9.rst:1300 ../../whatsnew/3.9.rst:1418 msgid "Changes in the limited C API (if ``Py_LIMITED_API`` macro is defined):" msgstr "" -#: ../../whatsnew/3.9.rst:1301 +#: ../../whatsnew/3.9.rst:1302 msgid "" "Provide :c:func:`Py_EnterRecursiveCall` and :c:func:`Py_LeaveRecursiveCall` " "as regular functions for the limited API. Previously, there were defined as " @@ -2083,23 +2084,23 @@ msgid "" "the limited C API)." msgstr "" -#: ../../whatsnew/3.9.rst:1307 +#: ../../whatsnew/3.9.rst:1308 msgid "" "``PyObject_INIT()`` and ``PyObject_INIT_VAR()`` become regular \"opaque\" " "function to hide implementation details." msgstr "" -#: ../../whatsnew/3.9.rst:1310 ../../whatsnew/3.9.rst:1444 +#: ../../whatsnew/3.9.rst:1311 ../../whatsnew/3.9.rst:1445 msgid "(Contributed by Victor Stinner in :issue:`38644` and :issue:`39542`.)" msgstr "(由 Victor Stinner 在 38644 和 39542 中貢獻。)" -#: ../../whatsnew/3.9.rst:1312 +#: ../../whatsnew/3.9.rst:1313 msgid "" "The :c:func:`PyModule_AddType` function is added to help adding a type to a " "module. (Contributed by Donghee Na in :issue:`40024`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1316 +#: ../../whatsnew/3.9.rst:1317 msgid "" "Added the functions :c:func:`PyObject_GC_IsTracked` and :c:func:" "`PyObject_GC_IsFinalized` to the public API to allow to query if Python " @@ -2108,27 +2109,27 @@ msgid "" "issue:`40241`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1322 +#: ../../whatsnew/3.9.rst:1323 msgid "" "Added :c:func:`!_PyObject_FunctionStr` to get a user-friendly string " "representation of a function-like object. (Patch by Jeroen Demeyer in :issue:" "`37645`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1326 +#: ../../whatsnew/3.9.rst:1327 msgid "" "Added :c:func:`PyObject_CallOneArg` for calling an object with one " "positional argument (Patch by Jeroen Demeyer in :issue:`37483`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1334 +#: ../../whatsnew/3.9.rst:1335 msgid "" "``PyInterpreterState.eval_frame`` (:pep:`523`) now requires a new mandatory " "*tstate* parameter (``PyThreadState*``). (Contributed by Victor Stinner in :" "issue:`38500`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1338 +#: ../../whatsnew/3.9.rst:1339 msgid "" "Extension modules: :c:member:`~PyModuleDef.m_traverse`, :c:member:" "`~PyModuleDef.m_clear` and :c:member:`~PyModuleDef.m_free` functions of :c:" @@ -2140,12 +2141,12 @@ msgid "" "`PyModule_GetState`) is ``NULL``." msgstr "" -#: ../../whatsnew/3.9.rst:1347 +#: ../../whatsnew/3.9.rst:1348 msgid "" "Extension modules without module state (``m_size <= 0``) are not affected." msgstr "" -#: ../../whatsnew/3.9.rst:1349 +#: ../../whatsnew/3.9.rst:1350 msgid "" "If :c:func:`Py_AddPendingCall` is called in a subinterpreter, the function " "is now scheduled to be called from the subinterpreter, rather than being " @@ -2153,7 +2154,7 @@ msgid "" "of scheduled calls. (Contributed by Victor Stinner in :issue:`39984`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1355 +#: ../../whatsnew/3.9.rst:1356 msgid "" "The Windows registry is no longer used to initialize :data:`sys.path` when " "the ``-E`` option is used (if :c:member:`PyConfig.use_environment` is set to " @@ -2161,21 +2162,21 @@ msgid "" "by Zackery Spytz in :issue:`8901`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1360 +#: ../../whatsnew/3.9.rst:1361 msgid "" "The global variable :c:data:`PyStructSequence_UnnamedField` is now a " "constant and refers to a constant string. (Contributed by Serhiy Storchaka " "in :issue:`38650`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1364 +#: ../../whatsnew/3.9.rst:1365 msgid "" "The :c:type:`!PyGC_Head` structure is now opaque. It is only defined in the " "internal C API (``pycore_gc.h``). (Contributed by Victor Stinner in :issue:" "`40241`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1368 +#: ../../whatsnew/3.9.rst:1369 msgid "" "The ``Py_UNICODE_COPY``, ``Py_UNICODE_FILL``, ``PyUnicode_WSTR_LENGTH``, :c:" "func:`!PyUnicode_FromUnicode`, :c:func:`!PyUnicode_AsUnicode`, " @@ -2184,7 +2185,7 @@ msgid "" "Python 3.3. (Contributed by Inada Naoki in :issue:`36346`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1375 +#: ../../whatsnew/3.9.rst:1376 msgid "" "The :c:func:`Py_FatalError` function is replaced with a macro which logs " "automatically the name of the current function, unless the " @@ -2192,22 +2193,22 @@ msgid "" "issue:`39882`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1380 +#: ../../whatsnew/3.9.rst:1381 msgid "" "The vectorcall protocol now requires that the caller passes only strings as " "keyword names. (See :issue:`37540` for more information.)" msgstr "" -#: ../../whatsnew/3.9.rst:1383 +#: ../../whatsnew/3.9.rst:1384 msgid "" "Implementation details of a number of macros and functions are now hidden:" msgstr "" -#: ../../whatsnew/3.9.rst:1385 +#: ../../whatsnew/3.9.rst:1386 msgid ":c:func:`PyObject_IS_GC` macro was converted to a function." msgstr "" -#: ../../whatsnew/3.9.rst:1387 +#: ../../whatsnew/3.9.rst:1388 msgid "" "The :c:func:`!PyObject_NEW` macro becomes an alias to the :c:macro:" "`PyObject_New` macro, and the :c:func:`!PyObject_NEW_VAR` macro becomes an " @@ -2215,38 +2216,38 @@ msgid "" "directly the :c:member:`PyTypeObject.tp_basicsize` member." msgstr "" -#: ../../whatsnew/3.9.rst:1392 +#: ../../whatsnew/3.9.rst:1393 msgid "" ":c:func:`!PyObject_GET_WEAKREFS_LISTPTR` macro was converted to a function: " "the macro accessed directly the :c:member:`PyTypeObject.tp_weaklistoffset` " "member." msgstr "" -#: ../../whatsnew/3.9.rst:1396 +#: ../../whatsnew/3.9.rst:1397 msgid "" ":c:func:`PyObject_CheckBuffer` macro was converted to a function: the macro " "accessed directly the :c:member:`PyTypeObject.tp_as_buffer` member." msgstr "" -#: ../../whatsnew/3.9.rst:1399 +#: ../../whatsnew/3.9.rst:1400 msgid "" ":c:func:`PyIndex_Check` is now always declared as an opaque function to hide " "implementation details: removed the ``PyIndex_Check()`` macro. The macro " "accessed directly the :c:member:`PyTypeObject.tp_as_number` member." msgstr "" -#: ../../whatsnew/3.9.rst:1403 +#: ../../whatsnew/3.9.rst:1404 msgid "(See :issue:`40170` for more details.)" msgstr "(更多資訊請見 :issue:`40170`。)" -#: ../../whatsnew/3.9.rst:1408 +#: ../../whatsnew/3.9.rst:1409 msgid "" "Excluded ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros of " "``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner in :issue:" "`38835`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1412 +#: ../../whatsnew/3.9.rst:1413 msgid "" "The ``tp_print`` slot of :ref:`PyTypeObject <type-structs>` has been " "removed. It was used for printing objects to files in Python 2.7 and before. " @@ -2254,89 +2255,89 @@ msgid "" "Demeyer in :issue:`36974`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1419 +#: ../../whatsnew/3.9.rst:1420 msgid "Excluded the following functions from the limited C API:" msgstr "" -#: ../../whatsnew/3.9.rst:1421 +#: ../../whatsnew/3.9.rst:1422 msgid "" "``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye in :issue:" "`37878`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1423 +#: ../../whatsnew/3.9.rst:1424 msgid "``_Py_CheckRecursionLimit``" msgstr "``_Py_CheckRecursionLimit``" -#: ../../whatsnew/3.9.rst:1424 +#: ../../whatsnew/3.9.rst:1425 msgid "``_Py_NewReference()``" msgstr "``_Py_NewReference()``" -#: ../../whatsnew/3.9.rst:1425 +#: ../../whatsnew/3.9.rst:1426 msgid "``_Py_ForgetReference()``" msgstr "``_Py_ForgetReference()``" -#: ../../whatsnew/3.9.rst:1426 +#: ../../whatsnew/3.9.rst:1427 msgid "``_PyTraceMalloc_NewReference()``" msgstr "``_PyTraceMalloc_NewReference()``" -#: ../../whatsnew/3.9.rst:1427 +#: ../../whatsnew/3.9.rst:1428 msgid "``_Py_GetRefTotal()``" msgstr "``_Py_GetRefTotal()``" -#: ../../whatsnew/3.9.rst:1428 +#: ../../whatsnew/3.9.rst:1429 msgid "The trashcan mechanism which never worked in the limited C API." msgstr "" -#: ../../whatsnew/3.9.rst:1429 +#: ../../whatsnew/3.9.rst:1430 msgid "``PyTrash_UNWIND_LEVEL``" msgstr "``PyTrash_UNWIND_LEVEL``" -#: ../../whatsnew/3.9.rst:1430 +#: ../../whatsnew/3.9.rst:1431 msgid "``Py_TRASHCAN_BEGIN_CONDITION``" msgstr "``Py_TRASHCAN_BEGIN_CONDITION``" -#: ../../whatsnew/3.9.rst:1431 +#: ../../whatsnew/3.9.rst:1432 msgid "``Py_TRASHCAN_BEGIN``" msgstr "``Py_TRASHCAN_BEGIN``" -#: ../../whatsnew/3.9.rst:1432 +#: ../../whatsnew/3.9.rst:1433 msgid "``Py_TRASHCAN_END``" msgstr "``Py_TRASHCAN_END``" -#: ../../whatsnew/3.9.rst:1433 +#: ../../whatsnew/3.9.rst:1434 msgid "``Py_TRASHCAN_SAFE_BEGIN``" msgstr "``Py_TRASHCAN_SAFE_BEGIN``" -#: ../../whatsnew/3.9.rst:1434 +#: ../../whatsnew/3.9.rst:1435 msgid "``Py_TRASHCAN_SAFE_END``" msgstr "``Py_TRASHCAN_SAFE_END``" -#: ../../whatsnew/3.9.rst:1436 +#: ../../whatsnew/3.9.rst:1437 msgid "Moved following functions and definitions to the internal C API:" msgstr "" -#: ../../whatsnew/3.9.rst:1438 +#: ../../whatsnew/3.9.rst:1439 msgid "``_PyDebug_PrintTotalRefs()``" msgstr "``_PyDebug_PrintTotalRefs()``" -#: ../../whatsnew/3.9.rst:1439 +#: ../../whatsnew/3.9.rst:1440 msgid "``_Py_PrintReferences()``" msgstr "``_Py_PrintReferences()``" -#: ../../whatsnew/3.9.rst:1440 +#: ../../whatsnew/3.9.rst:1441 msgid "``_Py_PrintReferenceAddresses()``" msgstr "``_Py_PrintReferenceAddresses()``" -#: ../../whatsnew/3.9.rst:1441 +#: ../../whatsnew/3.9.rst:1442 msgid "``_Py_tracemalloc_config``" msgstr "``_Py_tracemalloc_config``" -#: ../../whatsnew/3.9.rst:1442 +#: ../../whatsnew/3.9.rst:1443 msgid "``_Py_AddToAllObjects()`` (specific to ``Py_TRACE_REFS`` build)" msgstr "" -#: ../../whatsnew/3.9.rst:1446 +#: ../../whatsnew/3.9.rst:1447 msgid "" "Removed ``_PyRuntime.getframe`` hook and removed ``_PyThreadState_GetFrame`` " "macro which was an alias to ``_PyRuntime.getframe``. They were only exposed " @@ -2344,72 +2345,72 @@ msgid "" "(Contributed by Victor Stinner in :issue:`39946`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1451 +#: ../../whatsnew/3.9.rst:1452 msgid "" "Removed the following functions from the C API. Call :c:func:`PyGC_Collect` " "explicitly to clear all free lists. (Contributed by Inada Naoki and Victor " "Stinner in :issue:`37340`, :issue:`38896` and :issue:`40428`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1456 +#: ../../whatsnew/3.9.rst:1457 msgid "``PyAsyncGen_ClearFreeLists()``" msgstr "``PyAsyncGen_ClearFreeLists()``" -#: ../../whatsnew/3.9.rst:1457 +#: ../../whatsnew/3.9.rst:1458 msgid "``PyContext_ClearFreeList()``" msgstr "``PyContext_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1458 +#: ../../whatsnew/3.9.rst:1459 msgid "``PyDict_ClearFreeList()``" msgstr "``PyDict_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1459 +#: ../../whatsnew/3.9.rst:1460 msgid "``PyFloat_ClearFreeList()``" msgstr "``PyFloat_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1460 +#: ../../whatsnew/3.9.rst:1461 msgid "``PyFrame_ClearFreeList()``" msgstr "``PyFrame_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1461 +#: ../../whatsnew/3.9.rst:1462 msgid "``PyList_ClearFreeList()``" msgstr "``PyList_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1462 +#: ../../whatsnew/3.9.rst:1463 msgid "" "``PyMethod_ClearFreeList()`` and ``PyCFunction_ClearFreeList()``: the free " "lists of bound method objects have been removed." msgstr "" -#: ../../whatsnew/3.9.rst:1464 +#: ../../whatsnew/3.9.rst:1465 msgid "" "``PySet_ClearFreeList()``: the set free list has been removed in Python 3.4." msgstr "" -#: ../../whatsnew/3.9.rst:1466 +#: ../../whatsnew/3.9.rst:1467 msgid "``PyTuple_ClearFreeList()``" msgstr "``PyTuple_ClearFreeList()``" -#: ../../whatsnew/3.9.rst:1467 +#: ../../whatsnew/3.9.rst:1468 msgid "" "``PyUnicode_ClearFreeList()``: the Unicode free list has been removed in " "Python 3.3." msgstr "" -#: ../../whatsnew/3.9.rst:1470 +#: ../../whatsnew/3.9.rst:1471 msgid "" "Removed ``_PyUnicode_ClearStaticStrings()`` function. (Contributed by Victor " "Stinner in :issue:`39465`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1473 +#: ../../whatsnew/3.9.rst:1474 msgid "" "Removed ``Py_UNICODE_MATCH``. It has been deprecated by :pep:`393`, and " "broken since Python 3.3. The :c:func:`PyUnicode_Tailmatch` function can be " "used instead. (Contributed by Inada Naoki in :issue:`36346`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1478 +#: ../../whatsnew/3.9.rst:1479 msgid "" "Cleaned header files of interfaces defined but with no implementation. The " "public API symbols being removed are: " @@ -2422,26 +2423,26 @@ msgid "" "`39372`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1489 +#: ../../whatsnew/3.9.rst:1490 msgid "Notable changes in Python 3.9.1" msgstr "Python 3.9.1 中顯著的變更" -#: ../../whatsnew/3.9.rst:1494 +#: ../../whatsnew/3.9.rst:1495 msgid "" "The behavior of :class:`typing.Literal` was changed to conform with :pep:" "`586` and to match the behavior of static type checkers specified in the PEP." msgstr "" -#: ../../whatsnew/3.9.rst:1497 +#: ../../whatsnew/3.9.rst:1498 msgid "``Literal`` now de-duplicates parameters." msgstr "" -#: ../../whatsnew/3.9.rst:1498 +#: ../../whatsnew/3.9.rst:1499 msgid "" "Equality comparisons between ``Literal`` objects are now order independent." msgstr "" -#: ../../whatsnew/3.9.rst:1499 +#: ../../whatsnew/3.9.rst:1500 msgid "" "``Literal`` comparisons now respect types. For example, ``Literal[0] == " "Literal[False]`` previously evaluated to ``True``. It is now ``False``. To " @@ -2449,7 +2450,7 @@ msgid "" "differentiating types." msgstr "" -#: ../../whatsnew/3.9.rst:1503 +#: ../../whatsnew/3.9.rst:1504 msgid "" "``Literal`` objects will now raise a :exc:`TypeError` exception during " "equality comparisons if any of their parameters are not :term:`hashable`. " @@ -2457,7 +2458,7 @@ msgid "" "error::" msgstr "" -#: ../../whatsnew/3.9.rst:1508 +#: ../../whatsnew/3.9.rst:1509 msgid "" ">>> from typing import Literal\n" ">>> Literal[{0}]\n" @@ -2473,15 +2474,15 @@ msgstr "" " File \"<stdin>\", line 1, in <module>\n" "TypeError: unhashable type: 'set'" -#: ../../whatsnew/3.9.rst:1515 +#: ../../whatsnew/3.9.rst:1516 msgid "(Contributed by Yurii Karabas in :issue:`42345`.)" msgstr "(由 Yurii Karabas 在 :issue:`42345` 中貢獻。)" -#: ../../whatsnew/3.9.rst:1518 +#: ../../whatsnew/3.9.rst:1519 msgid "macOS 11.0 (Big Sur) and Apple Silicon Mac support" msgstr "" -#: ../../whatsnew/3.9.rst:1520 +#: ../../whatsnew/3.9.rst:1521 msgid "" "As of 3.9.1, Python now fully supports building and running on macOS 11.0 " "(Big Sur) and on Apple Silicon Macs (based on the ``ARM64`` architecture). A " @@ -2493,19 +2494,19 @@ msgid "" "version in use at runtime (\"weaklinking\")." msgstr "" -#: ../../whatsnew/3.9.rst:1529 +#: ../../whatsnew/3.9.rst:1530 msgid "(Contributed by Ronald Oussoren and Lawrence D'Anna in :issue:`41100`.)" msgstr "(由 Ronald Oussoren 和 Lawrence D'Anna 在 :issue:`41100` 中貢獻。)" -#: ../../whatsnew/3.9.rst:1532 +#: ../../whatsnew/3.9.rst:1533 msgid "Notable changes in Python 3.9.2" msgstr "Python 3.9.2 中顯著的變更" -#: ../../whatsnew/3.9.rst:1535 +#: ../../whatsnew/3.9.rst:1536 msgid "collections.abc" msgstr "collections.abc" -#: ../../whatsnew/3.9.rst:1537 +#: ../../whatsnew/3.9.rst:1538 msgid "" ":class:`collections.abc.Callable` generic now flattens type parameters, " "similar to what :data:`typing.Callable` currently does. This means that " @@ -2521,27 +2522,27 @@ msgid "" "Python 3.10. (Contributed by Ken Jin in :issue:`42195`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1551 ../../whatsnew/3.9.rst:1576 +#: ../../whatsnew/3.9.rst:1552 ../../whatsnew/3.9.rst:1577 msgid "urllib.parse" msgstr "urllib.parse" -#: ../../whatsnew/3.9.rst:1553 +#: ../../whatsnew/3.9.rst:1554 msgid "" "Earlier Python versions allowed using both ``;`` and ``&`` as query " "parameter separators in :func:`urllib.parse.parse_qs` and :func:`urllib." "parse.parse_qsl`. Due to security concerns, and to conform with newer W3C " "recommendations, this has been changed to allow only a single separator key, " -"with ``&`` as the default. This change also affects :func:`cgi.parse` and :" -"func:`cgi.parse_multipart` as they use the affected functions internally. " +"with ``&`` as the default. This change also affects :func:`!cgi.parse` and :" +"func:`!cgi.parse_multipart` as they use the affected functions internally. " "For more details, please see their respective documentation. (Contributed by " "Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.)" msgstr "" -#: ../../whatsnew/3.9.rst:1564 +#: ../../whatsnew/3.9.rst:1565 msgid "Notable changes in Python 3.9.3" msgstr "Python 3.9.3 中顯著的變更" -#: ../../whatsnew/3.9.rst:1566 +#: ../../whatsnew/3.9.rst:1567 msgid "" "A security fix alters the :class:`ftplib.FTP` behavior to not trust the IPv4 " "address sent from the remote server when setting up a passive data channel. " @@ -2550,11 +2551,11 @@ msgid "" "instance to ``True``. (See :gh:`87451`)" msgstr "" -#: ../../whatsnew/3.9.rst:1573 +#: ../../whatsnew/3.9.rst:1574 msgid "Notable changes in Python 3.9.5" msgstr "Python 3.9.5 中顯著的變更" -#: ../../whatsnew/3.9.rst:1578 +#: ../../whatsnew/3.9.rst:1579 msgid "" "The presence of newline or tab characters in parts of a URL allows for some " "forms of attacks. Following the WHATWG specification that updates :rfc:" @@ -2564,11 +2565,11 @@ msgid "" "variable ``urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE``. (See :gh:`88048`)" msgstr "" -#: ../../whatsnew/3.9.rst:1586 +#: ../../whatsnew/3.9.rst:1587 msgid "Notable security feature in 3.9.14" msgstr "" -#: ../../whatsnew/3.9.rst:1588 +#: ../../whatsnew/3.9.rst:1589 msgid "" "Converting between :class:`int` and :class:`str` in bases other than 2 " "(binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 (decimal) " @@ -2581,15 +2582,15 @@ msgid "" "digits in string form." msgstr "" -#: ../../whatsnew/3.9.rst:1599 +#: ../../whatsnew/3.9.rst:1600 msgid "Notable changes in 3.9.17" msgstr "" -#: ../../whatsnew/3.9.rst:1602 +#: ../../whatsnew/3.9.rst:1603 msgid "tarfile" msgstr "tarfile" -#: ../../whatsnew/3.9.rst:1604 +#: ../../whatsnew/3.9.rst:1605 msgid "" "The extraction methods in :mod:`tarfile`, and :func:`shutil.unpack_archive`, " "have a new a *filter* argument that allows limiting tar features than may be " diff --git a/whatsnew/changelog.po b/whatsnew/changelog.po index 57e5decb8d..62347d8849 100644 --- a/whatsnew/changelog.po +++ b/whatsnew/changelog.po @@ -7,7 +7,7 @@ # Noah Chen <noahcse@gmail.com>, 2016 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-06-26 18:54+0800\n" "PO-Revision-Date: 2018-05-23 16:21+0000\n" diff --git a/whatsnew/index.po b/whatsnew/index.po index 919f5dd09e..3d82a190e0 100644 --- a/whatsnew/index.po +++ b/whatsnew/index.po @@ -7,9 +7,9 @@ # Steven Hsu <hsuhaochun@gmail.com>, 2022 msgid "" msgstr "" -"Project-Id-Version: Python 3.12\n" +"Project-Id-Version: Python 3.13\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-04-16 00:03+0000\n" +"POT-Creation-Date: 2024-09-23 07:52+0800\n" "PO-Revision-Date: 2022-07-07 11:37+0800\n" "Last-Translator: Steven Hsu <hsuhaochun@gmail.com>\n" "Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-" @@ -35,7 +35,7 @@ msgstr "" "的重大改變的地方。對於希望在新版本釋出時立即了解版本差異的使用者們來說,這些" "說明被歸類為「必讀」的等級。" -#: ../../whatsnew/index.rst:36 +#: ../../whatsnew/index.rst:37 msgid "" "The \"Changelog\" is an HTML version of the :pypi:`file built<blurb>` from " "the contents of the :source:`Misc/NEWS.d` directory tree, which contains "